repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
alrifqi/django | django/contrib/sitemaps/views.py | 352 | 2953 | import datetime
from calendar import timegm
from functools import wraps
from django.contrib.sites.shortcuts import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.http import Http404
from django.template.response import TemplateResponse
fr... | bsd-3-clause |
alviano/wasp | tests/asp/cautious/test6.gus.gringo.cautious.asp.test.py | 1 | 20192 | input = """
1 1 1 1 63
1 1 1 1 64
1 1 2 0 65 66
1 1 2 0 67 68
1 1 2 0 69 70
1 1 2 0 71 72
1 1 2 0 66 65
1 1 2 0 68 67
1 1 2 0 70 69
1 1 2 0 72 71
1 81 1 1 66
1 82 1 1 65
1 83 1 1 68
1 84 1 1 67
1 85 1 1 70
1 86 1 1 69
1 87 1 1 72
1 88 1 1 71
1 89 1 1 66
1 90 1 1 68
1 91 1 1 67
1 92 1 1 69
1 93 2 1 68 81
1 94 1 0 81
1 9... | apache-2.0 |
abdoosh00/edx-rtl-final | lms/djangoapps/verify_student/tests/test_views.py | 5 | 4251 | """
verify_student/start?course_id=MITx/6.002x/2013_Spring # create
/upload_face?course_id=MITx/6.002x/2013_Spring
/upload_photo_id
/confirm # mark_ready()
---> To Payment
"""
import urllib
from mock import patch, Mock, ANY
from django.test import TestCase
from django.tes... | agpl-3.0 |
itsvetkov/pyqtgraph | pyqtgraph/widgets/CheckTable.py | 52 | 3361 | # -*- coding: utf-8 -*-
from ..Qt import QtGui, QtCore
from . import VerticalLabel
__all__ = ['CheckTable']
class CheckTable(QtGui.QWidget):
sigStateChanged = QtCore.Signal(object, object, object) # (row, col, state)
def __init__(self, columns):
QtGui.QWidget.__init__(self)
self.layo... | mit |
dya2/python-for-android | python3-alpha/python3-src/Lib/test/crashers/gc_inspection.py | 195 | 1092 | """
gc.get_referrers() can be used to see objects before they are fully built.
Note that this is only an example. There are many ways to crash Python
by using gc.get_referrers(), as well as many extension modules (even
when they are using perfectly documented patterns to build objects).
Identifying and removing all ... | apache-2.0 |
BillyLiggins/fitting | first.py | 1 | 7031 | import copy
import echidna
import echidna.output.plot as plot
import echidna.core.spectra as spectra
from echidna.output import store
import matplotlib.pyplot as plt
import argparse
import glob
import numpy as np
import os
def convertor(path):
flist=np.array(glob.glob(path))
for ntuple in flist:
os.sy... | mit |
MichaelNedzelsky/intellij-community | python/lib/Lib/stat.py | 145 | 1667 | """Constants/functions for interpreting results of os.stat() and os.lstat().
Suggested usage: from stat import *
"""
# XXX Strictly spoken, this module may have to be adapted for each POSIX
# implementation; in practice, however, the numeric constants used by
# stat() are almost universal (even for stat() emulations ... | apache-2.0 |
Widiot/simpleblog | venv/lib/python3.5/site-packages/pip/_vendor/retrying.py | 934 | 9972 | ## Copyright 2013-2014 Ray Holder
##
## 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 ... | mit |
Kamp9/scipy | benchmarks/benchmarks/sparse_linalg_solve.py | 52 | 1688 | """
Check the speed of the conjugate gradient solver.
"""
from __future__ import division, absolute_import, print_function
import numpy as np
from numpy.testing import assert_equal
try:
from scipy import linalg, sparse
from scipy.sparse.linalg import cg
except ImportError:
pass
from .common import Benchm... | bsd-3-clause |
AirChen/MachineLearningDoc | collective_intelligence/chapter_7/treepredict.py | 1 | 6590 | #!/usr/bin/python
from math import log
from PIL import Image, ImageDraw
my_data=[['slashdot','USA','yes',18,'None'],
['google','France','yes',23,'Premium'],
['digg','USA','yes',24,'Basic'],
['kiwitobes','France','yes',23,'Basic'],
['google','UK','no',21,'Premium'],
['(direct)','New Zealand','no',12,'None'],
['(... | mit |
audunv/andp | python/andp/view/web/remote.py | 1 | 3288 | # -*- coding: utf-8; -*-
# Copyright (C) 2009 Østfold University College
#
# This file is part of ANDP.
#
# ANDP is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at you... | gpl-2.0 |
bitcity/django | django/core/cache/backends/base.py | 145 | 9680 | "Base Cache class."
from __future__ import unicode_literals
import time
import warnings
from django.core.exceptions import DjangoRuntimeWarning, ImproperlyConfigured
from django.utils.module_loading import import_string
class InvalidCacheBackendError(ImproperlyConfigured):
pass
class CacheKeyWarning(DjangoRun... | bsd-3-clause |
ksachs/invenio | modules/websession/lib/webgroup_dblayer.py | 33 | 14303 | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## ... | gpl-2.0 |
kmonsoor/python-for-android | python3-alpha/extra_modules/gdata/Crypto/Protocol/Chaffing.py | 44 | 9496 | """This file implements the chaffing algorithm.
Winnowing and chaffing is a technique for enhancing privacy without requiring
strong encryption. In short, the technique takes a set of authenticated
message blocks (the wheat) and adds a number of chaff blocks which have
randomly chosen data and MAC fields. This means... | apache-2.0 |
oscarolar/odoo | openerp/report/printscreen/ps_form.py | 381 | 5211 | # -*- 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 GNU... | agpl-3.0 |
petertodd/checklocktimeverify-demos | lib/python-bitcoinlib/bitcoin/signature.py | 10 | 1637 | # Copyright (C) 2012-2014 The python-bitcoinlib developers
#
# This file is part of python-bitcoinlib.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoinlib, including this file, may be copied, modified,
# propagated, or dist... | gpl-3.0 |
neslihanturan/artge | app/signals.py | 1 | 2014 | from django.db.models.signals import post_save, pre_delete, pre_save
from django.dispatch import receiver
from app.forms import MenuForm
from django import forms
from app.models import *
from django.core.exceptions import ObjectDoesNotExist
#from django.db.models.base import ObjectDoesNotExist
@receiver(post_save, sen... | gpl-3.0 |
Boussadia/weboob | modules/hybride/calendar.py | 6 | 1146 | # -*- coding: utf-8 -*-
# Copyright(C) 2013 Bezleputh
#
# This file is part of weboob.
#
# weboob 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) ... | agpl-3.0 |
googlefonts/cu2qu | tests/utils.py | 2 | 9055 | from __future__ import print_function, division, absolute_import
from . import CUBIC_GLYPHS
from fontTools.pens.pointPen import PointToSegmentPen, SegmentToPointPen
from fontTools.misc.py23 import isclose
import unittest
class BaseDummyPen(object):
"""Base class for pens that record the commands they are called w... | apache-2.0 |
Aristocles/CouchPotatoServer | libs/chardet/charsetgroupprober.py | 217 | 3642 | ######################## 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 ... | gpl-3.0 |
jobelenus/thegreco | ignore/tracegen.py | 1 | 1364 | #!/usr/bin/env python
# vim:ts=4:sts=4:sw=4:et:wrap:ai:fileencoding=utf-8:
import collections
#import matplotlib.pyplot as plt
factor = 1/4
class TraceGenerator():
def __init__(self):
fname='/Users/jobelenus/work/thegreco/cpu.entries'
self.fname = fname
with open(self.fname) as ... | gpl-3.0 |
F5Networks/f5-ansible | ansible_collections/f5networks/f5_modules/plugins/modules/bigip_device_group.py | 1 | 19251 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2017, F5 Networks 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
DOCUMENTATION = r'''
---
module: bigip_device_group
shor... | gpl-3.0 |
totolef/Sick-beard | lib/imdb/parser/http/characterParser.py | 143 | 8139 | """
parser.http.characterParser module (imdb package).
This module provides the classes (and the instances), used to parse
the IMDb pages on the akas.imdb.com server about a character.
E.g., for "Jesse James" the referred pages would be:
main details: http://www.imdb.com/character/ch0000001/
biography: ... | gpl-3.0 |
huanpc/IoT-1 | gui/controller/.venv/lib/python3.5/site-packages/django/forms/forms.py | 141 | 19457 | """
Form classes
"""
from __future__ import unicode_literals
import copy
from collections import OrderedDict
from django.core.exceptions import NON_FIELD_ERRORS, ValidationError
# BoundField is imported for backwards compatibility in Django 1.9
from django.forms.boundfield import BoundField # NOQA
from django.forms... | mit |
sbelharbi/structured-output-ae | sop_embed/experiments/lfpw_4l_out_unl.py | 1 | 14984 | from sop_embed.da import DenoisingAutoencoder
from sop_embed.tools import NonLinearity
from sop_embed.tools import CostType
from sop_embed.tools import ModelMLP
from sop_embed.tools import train_one_epoch_chuncks
from sop_embed.tools import theano_fns
from sop_embed.tools import sharedX_value
from sop_embed.tools impor... | lgpl-3.0 |
XiaodunServerGroup/ddyedx | common/djangoapps/course_modes/migrations/0005_auto__add_field_coursemode_expiration_datetime.py | 59 | 1858 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CourseMode.expiration_datetime'
db.add_column('course_modes_coursemode', 'expiration_datetim... | agpl-3.0 |
tensorflow/tensorflow | tensorflow/python/distribute/values_util.py | 11 | 14810 | # Copyright 2020 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 |
drmrd/ansible | test/units/playbook/test_attribute.py | 119 | 1823 | # (c) 2015, Marius Gedminas <marius@gedmin.as>
#
# 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 vers... | gpl-3.0 |
wunderlins/learning | python/django/lib/python2.7/site-packages/django/contrib/gis/geoip2/base.py | 335 | 9054 | import os
import socket
import geoip2.database
from django.conf import settings
from django.core.validators import ipv4_re
from django.utils import six
from django.utils.ipv6 import is_valid_ipv6_address
from .resources import City, Country
# Creating the settings dictionary with any settings, if needed.
GEOIP_SETT... | gpl-2.0 |
runekaagaard/django-contrib-locking | tests/utils_tests/test_safestring.py | 8 | 3704 | from __future__ import unicode_literals
from django.template import Template, Context
from django.test import TestCase
from django.utils.encoding import force_text, force_bytes
from django.utils.functional import lazy
from django.utils.safestring import mark_safe, mark_for_escaping, SafeData, EscapeData
from django.ut... | bsd-3-clause |
jean/python-docx | features/steps/parfmt.py | 6 | 7800 | # encoding: utf-8
"""
Step implementations for paragraph format-related features.
"""
from __future__ import (
absolute_import, division, print_function, unicode_literals
)
from behave import given, then, when
from docx import Document
from docx.enum.text import WD_ALIGN_PARAGRAPH, WD_LINE_SPACING
from docx.sha... | mit |
gavinhungry/hashbrowns | hashbrowns.py | 1 | 3014 | #!/usr/bin/env python2
#
# Name: hashbrowns
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Provides cryptographic hashes with a minimal UI
#
import os, sys
import pygtk, gtk
import hashlib
import pango
import re
class Hashbrowns:
def __init__(self, filename):
self.hash_algs = ['md5', 'sha1', 'sha256', 'sh... | mit |
brianjimenez/lightdock | lightdock/pdbutil/PDBIO.py | 1 | 7384 | """Parses Atomic coordinates entries from PDB files"""
import math
from lightdock.error.lightdock_errors import PDBParsingError, PDBParsingWarning
from lightdock.structure.atom import Atom, HetAtom
from lightdock.structure.residue import Residue
from lightdock.structure.chain import Chain
from lightdock.util.logger im... | gpl-3.0 |
kuwa32/chainer | tests/functions_tests/test_nonparameterized_linear.py | 7 | 2368 | import unittest
import numpy
import chainer
from chainer import cuda
from chainer import functions
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import condition
if cuda.available:
cuda.init()
class TestNonparameterizedLinear(unittest.Test... | mit |
jiachenning/odoo | addons/base_action_rule/tests/base_action_rule_test.py | 395 | 7455 | from openerp import SUPERUSER_ID
from openerp.tests import common
from .. import test_models
class base_action_rule_test(common.TransactionCase):
def setUp(self):
"""*****setUp*****"""
super(base_action_rule_test, self).setUp()
cr, uid = self.cr, self.uid
self.demo = self.registry(... | agpl-3.0 |
andrewcbennett/iris | lib/iris/tests/unit/fileformats/netcdf/test__load_aux_factory.py | 11 | 5682 | # (C) British Crown Copyright 2014 - 2015, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | gpl-3.0 |
user-none/calibre | src/calibre/ebooks/oeb/transforms/guide.py | 16 | 2308 | #!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class Clean(object):
'''Clean up guide, leaving only known values '''
def ... | gpl-3.0 |
40223110/w16b_test | static/Brython3.1.1-20150328-091302/Lib/_thread.py | 740 | 4879 | """Drop-in replacement for the thread module.
Meant to be used as a brain-dead substitute so that threaded code does
not need to be rewritten for when the thread module is not present.
Suggested usage is::
try:
import _thread
except ImportError:
import _dummy_thread as _thread
"""
# Exports ... | agpl-3.0 |
savoirfairelinux/odoo | addons/account/project/wizard/account_analytic_chart.py | 362 | 2100 | # -*- 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 |
w1ll1am23/home-assistant | tests/components/homekit/test_aidmanager.py | 8 | 22428 | """Tests for the HomeKit AID manager."""
import os
from unittest.mock import patch
from fnvhash import fnv1a_32
import pytest
from homeassistant.components.homekit.aidmanager import (
AccessoryAidStorage,
get_aid_storage_filename_for_entry_id,
get_system_unique_id,
)
from homeassistant.helpers import devi... | apache-2.0 |
badock/nova | nova/api/openstack/compute/contrib/createserverext.py | 100 | 1156 | # Copyright 2011 OpenStack Foundation
#
# 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 |
vrkansagara/ultisnips | pythonx/UltiSnips/vim_state.py | 22 | 4763 | #!/usr/bin/env python
# encoding: utf-8
"""Some classes to conserve Vim's state for comparing over time."""
from collections import deque
from UltiSnips import _vim
from UltiSnips.compatibility import as_unicode, byte2col
from UltiSnips.position import Position
class VimPosition(Position):
"""Represents the c... | gpl-3.0 |
xianggong/m2c_unit_test | test/integer/mad_hi_uchar4uchar4uchar4/compile.py | 1861 | 4430 | #!/usr/bin/python
import os
import subprocess
import re
def runCommand(command):
p = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
p.wait()
return iter(p.stdout.readline, b'')
def dumpRunCommand(command,... | gpl-2.0 |
azaghal/ansible | test/support/integration/plugins/modules/postgresql_db.py | 53 | 23381 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# 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 |
firmlyjin/brython | cgi-bin/upload_results.py | 17 | 1186 | #!/usr/bin/env python3
import cgi
import sqlite3
import json
print('Content-type: text/html')
print()
_form=cgi.FieldStorage()
_data=_form.getvalue('data')
_r=json.loads(_data)
_conn=sqlite3.connect("brython_speed_results.db")
_db=_conn.cursor()
try:
_db.execute("select count('x') from info")
except:
_db.exec... | bsd-3-clause |
lihui7115/ChromiumGStreamerBackend | build/win/importlibs/create_importlib_win.py | 185 | 6790 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
"""Creates an import library from an import description file."""
import ast
import logging
import optparse
import os
import os.pat... | bsd-3-clause |
seckcoder/lang-learn | python/sklearn/sklearn/decomposition/tests/test_kernel_pca.py | 1 | 7069 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raises
from sklearn.decomposition import PCA, KernelPCA
from sklearn.datasets import make_circles
from sklearn.linear_model i... | unlicense |
saurabh6790/test-med-app | support/doctype/customer_issue/customer_issue.py | 30 | 2037 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes import session, msgprint
from webnotes.utils import today
from utilities.transaction_base import TransactionBase
... | agpl-3.0 |
40223119/-2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/site-packages/docs.py | 624 | 1503 | from browser import document as doc
from browser import window, html, markdown
import highlight
import time
def run(ev):
# run the code in the elt after the button
ix = ev.target.parent.children.index(ev.target)
elt = ev.target.parent.children[ix+1]
exec(elt.text)
elt.focus()
def load(url,target... | gpl-3.0 |
Hazelsuko07/17WarmingUp | py3.6/lib/python3.6/site-packages/pip/_vendor/cachecontrol/heuristics.py | 490 | 4141 | import calendar
import time
from email.utils import formatdate, parsedate, parsedate_tz
from datetime import datetime, timedelta
TIME_FMT = "%a, %d %b %Y %H:%M:%S GMT"
def expire_after(delta, date=None):
date = date or datetime.now()
return date + delta
def datetime_to_header(dt):
return formatdate(c... | mit |
jonfoster/pyxb2 | tests/drivers/test-po1.py | 3 | 5914 | # -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
import pyxb.binding.generate
import pyxb.utils.domutils
from xml.dom import Node
import os.path
schema_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../schemas/po1.xsd'))
cod... | apache-2.0 |
SUSE/azure-sdk-for-python | azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/operations/job_cancellations_operations.py | 2 | 4214 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit |
aznrice/l-preview | 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 |
domino-team/openwrt-cc | package/gli-pub/openwrt-node-packages-master/node/node-v6.9.1/deps/v8_inspector/third_party/jinja2/jinja2/__init__.py | 27 | 2330 | # -*- coding: utf-8 -*-
"""
jinja2
~~~~~~
Jinja2 is a template engine written in pure Python. It provides a
Django inspired non-XML syntax but supports inline expressions and
an optional sandboxed environment.
Nutshell
--------
Here a small example of a Jinja2 template::
{% ... | gpl-2.0 |
Innovahn/cybex | addons/hr_recruitment/wizard/__init__.py | 381 | 1095 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-Today OpenERP (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
Clever/Diamond | src/collectors/snmpraw/test/testsnmpraw.py | 29 | 1797 | #!/usr/bin/python
# coding=utf-8
###############################################################################
import time
from test import CollectorTestCase
from test import get_collector_config
from test import unittest
from mock import Mock
from mock import patch
from snmpraw import SNMPRawCollector
from diamond.... | mit |
Freestila/dosage | scripts/order-symlinks.py | 3 | 2039 | #!/usr/bin/env python
# Copyright (C) 2013 Tobias Gruetzmacher
"""
This script takes the JSON file created by 'dosage -o json' and uses the
metadata to build a symlink farm in the deduced order of the comic. It created
those in a subdirectory called 'inorder'.
"""
from __future__ import print_function
import sys
import... | mit |
ytjiang/django | tests/utils_tests/test_duration.py | 364 | 1677 | import datetime
import unittest
from django.utils.dateparse import parse_duration
from django.utils.duration import duration_string
class TestDurationString(unittest.TestCase):
def test_simple(self):
duration = datetime.timedelta(hours=1, minutes=3, seconds=5)
self.assertEqual(duration_string(du... | bsd-3-clause |
spacecaker/android_kernel_acer_swing_msm8960_3.4.6 | scripts/gcc-wrapper.py | 501 | 3410 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the a... | gpl-2.0 |
jlew/Web2Py-Inventory | languages/pl.py | 16 | 4832 | # coding: utf8
{
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': '"Uaktualnij" jest dodatkowym wyra\xc5\xbceniem postaci "pole1=\'nowawarto\xc5\x9b\xc4\x87\'". Nie mo\xc5\xbcesz uaktualni\xc4\x87 lub usun\xc4\x85\xc4\x87 wynik\xc3\xb3w z JOIN:',
'%Y-%m... | gpl-3.0 |
randyli/beauty-cpp | template/cgi-bin/menu.py | 1 | 3251 | #!/usr/bin/python
# -*- coding:utf-8 -*-
import cgi
print "Content-Type: text/html\n\n"
projects = [
('/memcached/', 'memcached')
]
form = cgi.FieldStorage()
directory = ''
if form.has_key('dir'):
directory = form['dir'].value
if directory == '/':
print '<ul class="jqueryFileTree" style="display: none;">',
p... | mit |
chrisdunelm/grpc | src/python/grpcio_tests/tests/unit/beta/_utilities_test.py | 22 | 3382 | # Copyright 2015 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | apache-2.0 |
erikriver/eduIntelligent-cynin | src/eduintelligent.courses/eduintelligent/courses/content/coursecontent.py | 1 | 1190 | """Definition of the Lessons content type.
"""
from zope.interface import implements
from Products.Archetypes import atapi
from Products.ATContentTypes.content import folder
from Products.ATContentTypes.content.schemata import finalizeATCTSchema
from eduintelligent.courses.interfaces import ICourseContent
from edui... | gpl-3.0 |
Antiun/project | project_functional_block/__openerp__.py | 22 | 1475 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010 Akretion LDTA (<http://www.akretion.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of... | agpl-3.0 |
tkelman/utf8rewind | tools/gyp/test/subdirectory/gyptest-SYMROOT-all.py | 102 | 1236 | #!/usr/bin/env python
# Copyright (c) 2009 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Verifies building a target and a subsidiary dependent target from a
.gyp file in a subdirectory, without specifying an explicit output b... | mit |
frankvdp/django | tests/i18n/test_compilation.py | 15 | 7840 | import gettext as gettext_module
import os
import stat
import unittest
from io import StringIO
from subprocess import Popen
from unittest import mock
from django.core.management import (
CommandError, call_command, execute_from_command_line,
)
from django.core.management.commands.makemessages import (
Command ... | bsd-3-clause |
pwarren/AGDeviceControl | agdevicecontrol/thirdparty/site-packages/darwin/twisted/python/logfile.py | 3 | 7578 | # -*- test-case-name: twisted.test.test_logfile -*-
# Copyright (c) 2001-2004 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
A rotating, browsable log file.
"""
# System Imports
import os, stat, glob, string, time
# sibling imports
import threadable
class BaseLogFile:
"""The base class for a log... | gpl-2.0 |
Gazzonyx/samba | python/examples/netbios.py | 66 | 1049 | #!/usr/bin/env python
# Unix SMB/CIFS implementation.
# Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
#
# 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 Licens... | gpl-3.0 |
Distrotech/scons | test/CPPPATH/list-expansion.py | 5 | 3385 | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | mit |
HELIO-HFC/SDOSS | lib/python/net/pycurl.py | 1 | 1034 | #! /usr/bin/env python
import sys
import subprocess
import argparse
def pycurl(url, *args, **kwargs):
cmd = "curl"
if (args):
for arg in args: cmd += " "+arg
if (kwargs):
for k,v in kwargs.iteritems():
if (len(k) == 1):
if (v): cmd += " -"+k+" "+v
... | mit |
CloudWareChile/OpenChile | openerp/addons/product/partner.py | 9 | 1587 | # -*- 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 |
dmacvicar/spacewalk | backend/server/test/test_leak2.py | 2 | 1127 | #
# Copyright (c) 2008 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 copy of... | gpl-2.0 |
ruiliLaMeilleure/11ad-backhaul | bindings/python/ns3modulegen_core_customizations.py | 41 | 18881 | from __future__ import print_function
import sys
import re
from pybindgen.typehandlers import base as typehandlers
from pybindgen import ReturnValue, Parameter
from pybindgen.cppmethod import CustomCppMethodWrapper, CustomCppConstructorWrapper
from pybindgen.typehandlers.codesink import MemoryCodeSink
from pybindgen.t... | gpl-2.0 |
jehiah/tornado | tornado/test/asyncio_test.py | 24 | 4766 | # 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 th... | apache-2.0 |
rfhk/awo-custom | sale_line_quant_extended/models/stock_move.py | 1 | 10584 | # -*- coding: utf-8 -*-
# Copyright 2015-2017 Quartile Limted
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
class StockMove(models.Model):
_inherit = "stock.move"
pick_partner_id = fields.Many2one(
related='picking_id.partner_id',
... | lgpl-3.0 |
fzalkow/scikit-learn | sklearn/linear_model/tests/test_omp.py | 272 | 7752 | # Author: Vlad Niculae
# Licence: BSD 3 clause
import numpy as np
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equa... | bsd-3-clause |
mikebenfield/scipy | tools/gh_lists.py | 99 | 4195 | #!/usr/bin/env python
# -*- encoding:utf-8 -*-
"""
gh_lists.py MILESTONE
Functions for Github API requests.
"""
from __future__ import print_function, division, absolute_import
import os
import re
import sys
import json
import collections
import argparse
from urllib2 import urlopen
Issue = collections.namedtuple('... | bsd-3-clause |
run2/citytour | 4symantec/Lib/site-packages/numpy-1.9.2-py2.7-win-amd64.egg/numpy/lib/tests/test_polynomial.py | 32 | 4748 | from __future__ import division, absolute_import, print_function
'''
>>> p = np.poly1d([1.,2,3])
>>> p
poly1d([ 1., 2., 3.])
>>> print(p)
2
1 x + 2 x + 3
>>> q = np.poly1d([3.,2,1])
>>> q
poly1d([ 3., 2., 1.])
>>> print(q)
2
3 x + 2 x + 1
>>> print(np.poly1d([1.89999+2j, -3j, -5.12345678, 2+1j]))
... | mit |
iobond/aib | share/qt/extract_strings_qt.py | 33 | 2717 | #!/usr/bin/python
# Copyright (c) 2012-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Extract _("...") strings for translation and convert to Qt stringdefs so that
they can be picked up by Qt l... | mit |
BT-ojossen/odoo | addons/account_budget/report/analytic_account_budget_report.py | 360 | 7589 | # -*- 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 |
plepers/three.js | utils/exporters/blender/2.65/scripts/addons/io_mesh_threejs/__init__.py | 6 | 18004 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | mit |
isc-projects/forge | tests/dhcpv4/ddns/test_ddns_tsig_release.py | 1 | 12902 | """DDNS without TSIG"""
# pylint: disable=invalid-name,line-too-long
import pytest
import misc
import srv_control
import srv_msg
@pytest.mark.v4
@pytest.mark.ddns
@pytest.mark.tsig
@pytest.mark.forward_reverse_remove
def test_ddns4_tsig_sha1_forw_and_rev_release():
misc.test_setup()
srv_control.config_srv... | isc |
andnovar/networkx | networkx/algorithms/community/tests/test_kclique.py | 94 | 2152 | #!/usr/bin/env python
from nose.tools import *
import networkx as nx
from itertools import combinations
from networkx import k_clique_communities
def test_overlaping_K5():
G = nx.Graph()
G.add_edges_from(combinations(range(5), 2)) # Add a five clique
G.add_edges_from(combinations(range(2,7), 2)) # Add anot... | bsd-3-clause |
HighwindONE/android_kernel_lge_msm8226 | tools/perf/util/setup.py | 4998 | 1330 | #!/usr/bin/python2
from distutils.core import setup, Extension
from os import getenv
from distutils.command.build_ext import build_ext as _build_ext
from distutils.command.install_lib import install_lib as _install_lib
class build_ext(_build_ext):
def finalize_options(self):
_build_ext.finalize_optio... | gpl-2.0 |
MackZxh/OCA-Choice | project/sale_order_project/models/sale.py | 19 | 2400 | # -*- coding: utf-8 -*-
###############################################################################
#
# Module for OpenERP
# Copyright (C) 2014 Akretion (http://www.akretion.com).
# Copyright (C) 2010-2013 Akretion LDTA (<http://www.akretion.com>)
# @author Sébastien BEAU <sebastien.beau@akretion.com>
# @... | lgpl-3.0 |
alejo8591/culttume2 | venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/connection.py | 187 | 5659 | # urllib3/connection.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import socket
from socket import timeout as SocketTimeout
try: # Python 3
from http.cli... | mit |
tuxfux-hlp-notes/python-batches | archieves/batch-64/09-modules/myenv/lib/python2.7/site-packages/django/contrib/admin/validation.py | 82 | 23810 | from django.contrib.admin.utils import NotRelationField, get_fields_from_path
from django.core.exceptions import FieldDoesNotExist, ImproperlyConfigured
from django.db import models
from django.forms.models import (
BaseModelForm, BaseModelFormSet, _get_foreign_key,
)
"""
Does basic ModelAdmin option validation. C... | gpl-3.0 |
laiqiqi886/kbengine | kbe/res/scripts/common/Lib/test/test_codecencodings_jp.py | 88 | 4981 | #
# test_codecencodings_jp.py
# Codec encoding tests for Japanese encodings.
#
from test import support
from test import multibytecodec_support
import unittest
class Test_CP932(multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'cp932'
tstring = multibytecodec_support.load_teststring('shift_jis... | lgpl-3.0 |
openfun/edx-platform | lms/djangoapps/mobile_api/social_facebook/friends/views.py | 85 | 2439 | """
Views for friends info API
"""
from rest_framework import generics, status
from rest_framework.response import Response
from opaque_keys.edx.keys import CourseKey
from student.models import CourseEnrollment
from ...utils import mobile_view
from ..utils import get_friends_from_facebook, get_linked_edx_accounts,... | agpl-3.0 |
madan96/sympy | sympy/integrals/rde.py | 91 | 26625 | """
Algorithms for solving the Risch differential equation.
Given a differential field K of characteristic 0 that is a simple
monomial extension of a base field k and f, g in K, the Risch
Differential Equation problem is to decide if there exist y in K such
that Dy + f*y == g and to find one if there are some. If t i... | bsd-3-clause |
Lamecarlate/gourmet | gourmet/recindex.py | 6 | 30248 | #!/usr/bin/env python
from ImageExtras import get_pixbuf_from_jpg
from gdebug import debug
from gettext import gettext as _, ngettext
from gglobals import REC_ATTRS, INT_REC_ATTRS, DEFAULT_HIDDEN_COLUMNS
from gtk_extras import WidgetSaver, ratingWidget, cb_extras as cb, \
mnemonic_manager, pageable_store, treeview_... | gpl-2.0 |
mohamedhagag/connector | connector/unit/synchronizer.py | 18 | 3407 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | agpl-3.0 |
paris-saclay-cds/ramp-workflow | rampwf/score_types/soft_accuracy.py | 1 | 1665 | """A generalization of the classification accuracy with cross-class scores.
Soften the accuracy score by giving scores through certain misclassifications
defined by the score matrix. For example, in ordinal regression we may want
not to penalize too much misclassifications to neighbor classes. The score also
generaliz... | bsd-3-clause |
GinnyN/Team-Fortress-RPG-Generators | django/core/management/commands/startproject.py | 201 | 1323 | from django.core.management.base import CommandError
from django.core.management.templates import TemplateCommand
from django.utils.crypto import get_random_string
from django.utils.importlib import import_module
class Command(TemplateCommand):
help = ("Creates a Django project directory structure for the given "... | bsd-3-clause |
rembo10/headphones | lib/unidecode/x0be.py | 253 | 4849 | data = (
'byum', # 0x00
'byub', # 0x01
'byubs', # 0x02
'byus', # 0x03
'byuss', # 0x04
'byung', # 0x05
'byuj', # 0x06
'byuc', # 0x07
'byuk', # 0x08
'byut', # 0x09
'byup', # 0x0a
'byuh', # 0x0b
'beu', # 0x0c
'beug', # 0x0d
'beugg', # 0x0e
'beugs', # 0x0f
'beun', # 0x10
'... | gpl-3.0 |
python-recsys/mrec | mrec/evaluation/metrics.py | 1 | 5143 | """
Metrics to evaluate recommendations:
* with hit rate, following e.g. Karypis lab SLIM and FISM papers
* with prec@k and MRR
"""
import numpy as np
from collections import defaultdict
# classes to access known items for each test user
class get_known_items_from_dict(object):
def __init__(self,data):
... | bsd-3-clause |
usakhelo/FreeCAD | src/Mod/Fem/Init.py | 2 | 3004 | # FreeCAD init script of the Fem module
# (c) 2001 Juergen Riegel
# ***************************************************************************
# * (c) Juergen Riegel (juergen.riegel@web.de) 2002 *
# * *
# * This fi... | lgpl-2.1 |
davehunt/bedrock | bedrock/newsletter/utils.py | 26 | 2669 | from hashlib import md5
from django.conf import settings
from django.core.cache import cache
import basket
import commonware.log
log = commonware.log.getLogger('b.newsletter')
NEWSLETTERS_CACHE_KEY = "newsletter-data"
NEWSLETTERS_CACHE_TIMEOUT = 3600 # 1 hour
def get_newsletters():
"""Return a dictionary wit... | mpl-2.0 |
mining/mining | mining/models/cube.py | 4 | 3819 | # -*- coding: utf-8 -*-
import gc
import pandas
from datetime import datetime
from pandas import DataFrame
from sqlalchemy import create_engine
from sqlalchemy.sql import text
from sqlalchemy.orm import sessionmaker
from mining.utils import conf, log_it
from mining.utils._pandas import fix_render
from mining.db impo... | mit |
leafclick/intellij-community | python/helpers/py2only/docutils/parsers/rst/languages/zh_cn.py | 128 | 4007 | # -*- coding: utf-8 -*-
# $Id: zh_cn.py 7119 2011-09-02 13:00:23Z milde $
# Author: Panjunyong <panjy@zopechina.com>
# Copyright: This module has been placed in the public domain.
# New language mappings are welcome. Before doing a new translation, please
# read <http://docutils.sf.net/docs/howto/i18n.html>. Two fil... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.