repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
Ayrx/cryptography | refs/heads/master | tests/hazmat/primitives/twofactor/test_totp.py | 5 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import pytest
from cryptography.exceptions import _Reasons
from cryptogr... |
rschnapka/odoo | refs/heads/7.0 | addons/point_of_sale/wizard/pos_payment_report.py | 55 | # -*- 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... |
sitsbeyou/Django-facebook | refs/heads/master | django_facebook/urls.py | 22 | try:
from django.conf.urls import patterns, url
except ImportError:
from django.conf.urls.defaults import patterns, url
from django.conf import settings
# help autodiscovery a bit
from django_facebook import admin
urlpatterns = patterns(
'django_facebook.views',
url(r'^connect/$', 'connect', name='fac... |
jttoday/spider | refs/heads/master | pyspider/libs/result_dump.py | 58 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<roy@binux.me>
# http://binux.me
# Created on 2015-03-27 20:12:11
import six
import csv
import json
import itertools
from io import StringIO, BytesIO
from six import iteritems
def result_formater(r... |
bpeck/tumblr-display | refs/heads/master | src/models/BlogModel.py | 1 | import os
from AbstractRootModel import AbstractRootModel
import pytumblr
import PostModel
from Settings import Settings
class BlogModel(AbstractRootModel):
def __init__(self, account):
self.client = pytumblr.TumblrRestClient(Settings.OAUTH_CONSUMER, Settings.SECRET)
self.account = account
... |
mcsosa121/cafa | refs/heads/master | cafaenv/lib/python2.7/site-packages/django/core/management/commands/testserver.py | 200 | from django.core.management import call_command
from django.core.management.base import BaseCommand
from django.db import connection
class Command(BaseCommand):
help = 'Runs a development server with data from the given fixture(s).'
requires_system_checks = False
def add_arguments(self, parser):
... |
zulip/django | refs/heads/master | tests/template_tests/syntax_tests/test_lorem.py | 443 | from django.test import SimpleTestCase
from ..utils import setup
class LoremTagTests(SimpleTestCase):
@setup({'lorem1': '{% lorem 3 w %}'})
def test_lorem1(self):
output = self.engine.render_to_string('lorem1')
self.assertEqual(output, 'lorem ipsum dolor')
|
robertoesteban/sccs_supereduc | refs/heads/master | territorios/apps.py | 1 | from __future__ import unicode_literals
from django.apps import AppConfig
class TerritoriosConfig(AppConfig):
name = 'territorios'
|
pamoakoy/invenio | refs/heads/drank-integration-next | modules/websubmit/lib/functions/Format_Record.py | 39 | ## This file is part of Invenio.
## Copyright (C) 2004, 2005, 2006, 2007, 2008, 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
## License, or (at your ... |
mwrightevent38/MissionPlanner | refs/heads/master | Lib/encodings/cp1254.py | 93 | """ Python Character Mapping Codec cp1254 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1254.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_table)
def d... |
GoogleCloudPlatform/runtimes-common | refs/heads/master | appengine/integration_tests/testsuite/test_exception.py | 5 | #!/usr/bin/python
# Copyright 2017 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 applica... |
nicholaschris/massive-wight | refs/heads/master | controllers/sites.py | 7 | # Copyright 2012 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 ... |
freyWill/Amper | refs/heads/master | product/views.py | 2 |
from django.shortcuts import render, render_to_response
from .models import Product, Category, Rating
from django.http import HttpResponse
from Amper.views import baseDict, cartItems
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from django.template import RequestContext
from django.shortcut... |
keysona/python | refs/heads/master | Jimmy66/0012/0012.py | 34 | #!/bin/env python
# -*- coding: utf-8 -*-
#之前没写注释是因为是在Linux下做的,切不出想要的输入法(压根就没倒腾),我要Wine个Bing输入法
#导入模块
import re
#从文件读取信息,以列表形式返回
def read_file(filename):
l = []
with open(filename,'r') as fp:
for line in fp.readlines():
l.append(line.strip())
return l
#生成对应的正则匹配规则
def gen_pattern(l)... |
mattvenn/Arduino | refs/heads/esp8266 | arduino-core/src/processing/app/i18n/python/requests/packages/urllib3/_collections.py | 309 | # urllib3/_collections.py
# Copyright 2008-2012 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
from collections import MutableMapping
from threading import Lock
try: # Python 2.7+
... |
LargePanda/GEAR_Network | refs/heads/master | scripts/mathscinet.py | 1 | import requests
import urllib2
from bs4 import BeautifulSoup
import pyprind
def get_article_year(div):
full_text = get_text(div)
for year in range(2000, 2017):
if str(year) in get_desc(div):
return year
return -1
def get_article_date(div):
return get_desc(div)
def get_article_id(... |
byteweaver/django-filemanager | refs/heads/master | setup.py | 1 | import os
from setuptools import setup, find_packages
import filemanager
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(
name='django-filemanager',
version=filemanager.__version__,
description='Template for reusable django applications.',
long_descript... |
scripni/rethinkdb | refs/heads/next | external/v8_3.30.33.16/build/gyp/pylib/gyp/__init__.py | 574 | #!/usr/bin/env python
# Copyright (c) 2012 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.
import copy
import gyp.input
import optparse
import os.path
import re
import shlex
import sys
import traceback
from gyp.common import GypErr... |
kerel-fs/skylines | refs/heads/master | skylines/schemas/validate.py | 1 | from marshmallow.validate import * # NOQA
class NotEmpty(Validator):
def __call__(self, value):
if len(value) == 0:
raise ValidationError('Must not be empty.')
|
noellekimiko/HMC-Grader | refs/heads/master | TestFiles/CS5BTests/hw4tests/hw4pr4tests.py | 2 | import unittest
import hw4pr4 as hw
class TcToNumTest(unittest.TestCase):
def testTcToNum1(self):
self.assertEqual(hw.TcToNum("00000001"), 1)
def testTcToNum2(self):
self.assertEqual(hw.TcToNum("11111111"), -1)
def testTcToNum3(self):
self.assertEqual(hw.TcToNum("10000000"), -128)
def testTcToNum4(... |
dmitriy0611/django | refs/heads/master | tests/gis_tests/geoapp/urls.py | 380 | from __future__ import unicode_literals
from django.conf.urls import url
from django.contrib.gis import views as gis_views
from django.contrib.gis.sitemaps import views as gis_sitemap_views
from django.contrib.sitemaps import views as sitemap_views
from .feeds import feed_dict
from .sitemaps import sitemaps
urlpatte... |
nerosketch/djing | refs/heads/master | djing/lib/mixins.py | 2 | from django.contrib.auth.mixins import AccessMixin, LoginRequiredMixin
from guardian.mixins import PermissionRequiredMixin
class OnlySuperUserMixin(AccessMixin):
"""Verify that the current user is superuser."""
def dispatch(self, request, *args, **kwargs):
if not request.user.is_superuser:
... |
AriMartti/ZhaltraucsLair | refs/heads/master | functions/combat.py | 1 | # -*- coding: utf-8 -*-
""" Basic combat experiment. Rat vs. Conan the Barbarian."""
import random
def dice(slices):
return random.randint(1,slices)
#BARBARIAN
barName=("Conan")
barHp=28
barS=18
barI=8
barA=2
#weapon is a short sword, no damage boost
#Leather, Chainmail; 1 armor, worn, 10 coins, 1 weight
barArmo... |
pasqualguerrero/django | refs/heads/master | tests/custom_managers/tests.py | 178 | from __future__ import unicode_literals
from django.db import models
from django.test import TestCase
from django.utils import six
from .models import (
Book, Car, CustomManager, CustomQuerySet, DeconstructibleCustomManager,
FunPerson, OneToOneRestrictedModel, Person, PersonFromAbstract,
PersonManager, Pu... |
abdullah2891/remo | refs/heads/master | vendor-local/lib/python/docutils/parsers/rst/languages/pl.py | 6 | # $Id$
# Author: Robert Wojciechowicz <rw@smsnet.pl>
# 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 files must be
# translated for each language: one in docutils/langu... |
open-craft/opencraft | refs/heads/master | registration/migrations/0002_timestampedmodel.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-05-18 09:37
from __future__ import unicode_literals
from django.db import migrations
from django.utils import timezone
import django_extensions.db.fields
now = timezone.now()
class Migration(migrations.Migration):
dependencies = [
('registrat... |
zhenzhai/edx-platform | refs/heads/master | cms/djangoapps/contentstore/views/preview.py | 10 | from __future__ import absolute_import
import logging
from functools import partial
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import Http404, HttpResponseBadRequest
from django.contrib.auth.decorators import login_required
from edxmako.shortcuts import render_to_st... |
sajeeshcs/nested_quota_latest | refs/heads/master | nova/tests/unit/virt/xenapi/test_xenapi.py | 4 | # Copyright (c) 2010 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... |
Eric-Zhong/odoo | refs/heads/8.0 | addons/email_template/email_template.py | 196 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2009 Sharoon Thomas
# Copyright (C) 2010-Today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it ... |
UCSD-CCAL/ccal | refs/heads/master | ccal/rescale_x_y_coordiantes_in_polar_coordiante.py | 1 | from numpy import sign, sqrt
def rescale_x_y_coordiantes_in_polar_coordiante(x, y, radius_rescaling_factor):
x_sign = sign(x)
y_sign = sign(y)
x_y_ratio = x / y
radius = sqrt(x ** 2 + y ** 2)
x = (x_y_ratio * radius / radius_rescaling_factor) / sqrt(x_y_ratio ** 2 + 1)
y = x / x_y_ratio
... |
uclouvain/osis | refs/heads/dev | ddd/logic/learning_unit/domain/model/_class_titles.py | 1 | ##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... |
OmarIthawi/edx-platform | refs/heads/master | common/djangoapps/student/migrations/0006_expand_meta_field.py | 188 | # encoding: 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):
# Changing field 'UserProfile.meta'
db.alter_column('auth_userprofile', 'meta', self.gf('django.db.models.fields.... |
numerigraphe/odoo | refs/heads/8.0 | addons/sales_team/__openerp__.py | 261 | # -*- 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... |
fqtools/shadowsocks | refs/heads/master | setup.py | 929 | import codecs
from setuptools import setup
with codecs.open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
name="shadowsocks",
version="2.8.2",
license='http://www.apache.org/licenses/LICENSE-2.0',
description="A fast tunnel proxy that help you get through firewalls",
... |
bbansalWolfPack/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/py/testing/root/test_std.py | 218 |
import py
def test_os():
import os
assert py.std.os is os
def test_import_error_converts_to_attributeerror():
py.test.raises(AttributeError, "py.std.xyzalskdj")
def test_std_gets_it():
for x in py.std.sys.modules:
assert x in py.std.__dict__
|
fubecka/f5-dashboard | refs/heads/master | flask/lib/python2.6/site-packages/openid/urinorm.py | 159 | import re
# from appendix B of rfc 3986 (http://www.ietf.org/rfc/rfc3986.txt)
uri_pattern = r'^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?'
uri_re = re.compile(uri_pattern)
# gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
#
# sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
# / "*"... |
uw-it-aca/bridge-sis-provisioner | refs/heads/master | sis_provisioner/management/commands/sync_accounts.py | 1 | import logging
from datetime import datetime
from django.core.management.base import BaseCommand, CommandError
from sis_provisioner.account_managers.gws_bridge import GwsBridgeLoader
from sis_provisioner.account_managers.emp_loader import ActiveWkrLoader
from sis_provisioner.account_managers.other_loader import OtherUs... |
mr-niels-christensen/environment-scotland-dot-rural | refs/heads/master | src/main/rdflib/plugins/sparql/sparql.py | 19 | import collections
import itertools
import datetime
from rdflib.namespace import NamespaceManager
from rdflib import Variable, BNode, Graph, ConjunctiveGraph, URIRef, Literal
from rdflib.term import Node
from parserutils import CompValue
import rdflib.plugins.sparql
from rdflib.plugins.sparql.compat import Mapping, ... |
etashjian/ECE757-final | refs/heads/master | src/arch/x86/isa/insts/simd64/integer/__init__.py | 91 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware implemen... |
OpenSeizureDetector/OpenSeizureDetector | refs/heads/master | fitbit_version/galileo/galileo/interactive.py | 3 | """\
This is the implementation of the interactive mode
This is the same idea as ifitbit I wrote for libfitbit some years ago
https://bitbucket.org/benallard/libfitbit/src/tip/python/ifitbit.py?at=default
"""
from __future__ import print_function
#---------------------------
# The engine
import readline
import tr... |
SNoiraud/gramps | refs/heads/master | gramps/gui/editors/addmedia.py | 4 | #
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
#
# 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 you... |
ravindrapanda/tensorflow | refs/heads/master | tensorflow/python/kernel_tests/sparse_tensors_map_ops_test.py | 134 | # 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... |
pombredanne/pythran | refs/heads/master | pythran/tests/cases/slowparts.py | 5 | #from https://groups.google.com/forum/#!topic/parakeet-python/p-flp2kdE4U
#pythran export slowparts(int, int, float [][][], float [][][], float [][], float [][], float [][][], float [][][], int)
#runas import numpy as np ;d = 10 ;re = 5 ;params = (d, re, np.ones((2*d, d+1, re)), np.ones((d, d+1, re)), np.ones((d, 2*d)... |
craighiller/serendipity | refs/heads/master | venv/lib/python2.7/site-packages/setuptools/command/build_ext.py | 286 | from distutils.command.build_ext import build_ext as _du_build_ext
try:
# Attempt to use Pyrex for building extensions, if available
from Pyrex.Distutils.build_ext import build_ext as _build_ext
except ImportError:
_build_ext = _du_build_ext
import os, sys
from distutils.file_util import copy_file
from set... |
houzhenggang/hiwifi-openwrt-HC5661-HC5761 | refs/heads/master | staging_dir/target-mipsel_r2_uClibc-0.9.33.2/usr/lib/python2.7/idlelib/rpc.py | 44 | """RPC Implemention, originally written for the Python Idle IDE
For security reasons, GvR requested that Idle's Python execution server process
connect to the Idle process, which listens for the connection. Since Idle has
has only one client per server, this was not a limitation.
+--------------------------------... |
OlivierLeBozec/tstools | refs/heads/master | test/googletest-release-1.8.1/googletest/test/gtest_xml_test_utils.py | 38 | # Copyright 2006, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... |
ccxt/ccxt | refs/heads/master | python/ccxt/async_support/zb.py | 1 | # -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.async_support.base.exchange import Exchange
import hashlib
from ccxt.base.errors import ExchangeError
from ccxt.base.errors impor... |
ccastell/Transfer-System | refs/heads/master | Website/env/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/sbcsgroupprober.py | 2935 | ######################## 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... |
stuti-rastogi/leetcodesolutions | refs/heads/master | 026_removeDuplicatesFromSortedArr.py | 1 | from collections import Counter
class Solution:
def removeDuplicates(self, nums):
"""
:type nums: List[int]
:rtype: int
"""
# n = len(nums)
# if (n == 0 or n == 1):
# return n
# index = 0
# for i in range(n-1):
# if (nums[i] != ... |
maz5v/cs3240-labdemo | refs/heads/master | hello.py | 1 | def greeting(msg):
print(msg)
if __name__ == "__main__":
greeting("hello") |
sbrunner/QGIS | refs/heads/master | python/plugins/processing/algs/grass7/ext/i_maxlik.py | 5 | # -*- coding: utf-8 -*-
"""
***************************************************************************
i_maxlik.py
-----------
Date : March 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
***************************************... |
neo/django-allauth | refs/heads/master | allauth/account/management/commands/account_unsetmultipleprimaryemails.py | 66 | from django.core.management.base import BaseCommand
from django.db.models import Count
from allauth.account.utils import user_email
from allauth.utils import get_user_model
from allauth.account.models import EmailAddress
class Command(BaseCommand):
def handle(self, *args, **options):
for user in self.get... |
damocles972/Sick-Beard | refs/heads/master | lib/hachoir_parser/audio/mod.py | 90 | """
Parser of FastTrackerII Extended Module (XM) version 1.4
Documents:
- Modplug source code (file modplug/soundlib/Load_mod.cpp)
http://sourceforge.net/projects/modplug
- Dumb source code (files include/dumb.h and src/it/readmod.c
http://dumb.sf.net/
- Documents on "MOD" format on Wotsit
http://www.wotsit.org
... |
jylaxp/django | refs/heads/master | tests/mail/custombackend.py | 428 | """A custom backend for testing."""
from django.core.mail.backends.base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
def __init__(self, *args, **kwargs):
super(EmailBackend, self).__init__(*args, **kwargs)
self.test_outbox = []
def send_messages(self, email_messages):
... |
yudingding6197/fin_script | refs/heads/master | debug/api/file.py | 1 | #!/usr/bin/env python
# -*- coding:gbk -*-
import sys
import re
import os
import string
import urllib
import urllib2
import datetime
import shutil
#±éÀúĿ¼ÏµÄËùÓÐ×ÓĿ¼ºÍÎļþ
path = "."
for (dirpath, dirnames, filenames) in os.walk(path):
print len(filenames)
file_list = filenames
#½ö½öÁгöĿ¼ÏµÄ×ÓĿ¼ºÍÎļþ
fo... |
eli-schwartz/pacman | refs/heads/master | test/pacman/tests/sync137.py | 27 | self.description = "Sysupgrade with a force and ignore on same package"
lp = pmpkg("dummy", "1.0-1")
self.addpkg2db("local", lp)
sp = pmpkg("dummy", "1:1.0-2")
self.addpkg2db("sync", sp)
self.args = "-Su --ignore %s" % lp.name
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=dummy|1.0-1")
|
ckaestne/CIDE | refs/heads/master | CIDE_Language_Python-test/testfiles/test.py | 31 | def spam():
print 'spam'
|
Hackman238/ZenPacks.Rackspace.BTI7200 | refs/heads/master | ZenPacks/Rackspace/BTI7200/__init__.py | 1 | import Globals
import logging
import os
log = logging.getLogger('zen.ZenPacks.Rackspace.BTI7200')
import ZenPacks.Rackspace.BTI7200
from Products.ZenModel.ZenPack import ZenPack as ZenPackBase
from Products.ZenUtils.Utils import zenPath
from Products.ZenModel.ZenMenu import ZenMenu
from Products.Zuul.interfac... |
PennartLoettring/Poettrix | refs/heads/master | rootfs/usr/lib/python3.4/test/test_pydoc.py | 9 | import os
import sys
import builtins
import contextlib
import difflib
import inspect
import pydoc
import keyword
import _pickle
import pkgutil
import re
import string
import test.support
import time
import types
import unittest
import xml.etree
import textwrap
from io import StringIO
from collections import namedtuple
... |
alphafoobar/intellij-community | refs/heads/master | plugins/hg4idea/testData/bin/mercurial/simplemerge.py | 93 | # Copyright (C) 2004, 2005 Canonical Ltd
#
# 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 distribut... |
suyashphadtare/sajil-final-frappe | refs/heads/develop | frappe/model/base_document.py | 8 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
from __future__ import unicode_literals
import frappe, json, sys
from frappe import _
from frappe.utils import cint, flt, now, cstr, strip_html
from frappe.model import default_fields
from frappe.model.naming import ... |
ShineFan/odoo | refs/heads/8.0 | addons/mail/mail_mail.py | 183 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... |
cnsoft/kbengine-cocos2dx | refs/heads/cocos2dx-cnsoft | kbe/res/scripts/common/Lib/test/test_bigmem.py | 8 | from test import support
from test.support import bigmemtest, _1G, _2G, _4G
import unittest
import operator
import sys
import functools
# Bigmem testing houserules:
#
# - Try not to allocate too many large objects. It's okay to rely on
# refcounting semantics, but don't forget that 's = create_largestring()'
# ... |
jnerin/ansible | refs/heads/devel | lib/ansible/modules/cloud/amazon/ecs_taskdefinition_facts.py | 34 | #!/usr/bin/python
# 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',
'status': ['preview'],
... |
jesramirez/odoo | refs/heads/8.0 | addons/account_budget/report/__init__.py | 444 | # -*- 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... |
avanov/django | refs/heads/master | tests/template_tests/alternate_urls.py | 452 | from django.conf.urls import url
from . import views
urlpatterns = [
# View returning a template response
url(r'^template_response_view/$', views.template_response_view),
# A view that can be hard to find...
url(r'^snark/', views.snark, name='snark'),
]
|
bigswitch/neutron | refs/heads/master | neutron/common/topics.py | 9 | # Copyright (c) 2012 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 or agreed to... |
cgstudiomap/cgstudiomap | refs/heads/develop | main/eggs/unittest2-1.1.0-py2.7.egg/unittest2/test/test_unittest2_with.py | 17 | import sys
import unittest2
if sys.version_info[:2] >= (2, 5):
from unittest2.test._test_unittest2_with import *
else:
class TestWith(unittest2.TestCase):
@unittest2.skip('tests using with statement skipped on Python 2.4')
def testWith(self):
pass
if __name__ == '__main__':
... |
Taluu/vdebug | refs/heads/master | python3/vdebug/opts.py | 1 |
class Options:
instance = None
def __init__(self, options):
self.options = options
@classmethod
def set(cls, options):
"""Create an Options instance with the provided dictionary of
options"""
cls.instance = Options(options)
@classmethod
def inst(cls):
... |
cmorgan/trading-with-python | refs/heads/master | cookbook/reconstructVXX/reconstructVXX.py | 77 | # -*- coding: utf-8 -*-
"""
Reconstructing VXX from futures data
author: Jev Kuznetsov
License : BSD
"""
from __future__ import division
from pandas import *
import numpy as np
import os
class Future(object):
""" vix future class, used to keep data structures simple """
def __init__(self,serie... |
iut-ibk/DynaMind-UrbanSim | refs/heads/master | 3rdparty/opus/src/urbansim_parcel/estimation/wcm_estimation_config.py | 2 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from urbansim_parcel.configs.controller_config import config
run_configuration = config
run_configuration["models"] = [
# {"land_price_model": ["run"]}, ... |
simontakite/sysadmin | refs/heads/master | pythonscripts/learningPython/System/Processes/multi3.py | 2 | """
Use multiprocess shared memory objects to communicate.
Passed objects are shared, but globals are not on Windows.
Last test here reflects common use case: distributing work.
"""
import os
from multiprocessing import Process, Value, Array
procs = 3
count = 0 # per-process globals, not shared
def s... |
hendradarwin/VTK | refs/heads/master | Examples/ParallelProcessing/MPI/Python/ParallelCone.py | 9 | from vtk import *
import sys
import os
import time
myProcId = 0
numProcs = 1
compManager = vtkCompositeRenderManager()
if compManager.GetController():
myProcId = compManager.GetController().GetLocalProcessId()
numProcs = compManager.GetController().GetNumberOfProcesses()
try:
v = vtkMesaRenderer()
if... |
flyher/pymo | refs/heads/master | android/pgs4a-0.9.6/python-install/lib/python2.7/inspect.py | 73 | # -*- coding: iso-8859-1 -*-
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of the usef... |
sgerhart/ansible | refs/heads/maintenance_policy_module | test/integration/targets/lambda_policy/files/mini_http_lambda.py | 145 | from __future__ import print_function
import json
def handler(event, context):
"""
The handler function is the function which gets called each time
the lambda is run.
"""
# printing goes to the cloudwatch log allowing us to simply debug the lambda if we can find
# the log entry.
print("got... |
slohse/ansible | refs/heads/devel | lib/ansible/vars/reserved.py | 40 | # (c) 2017 Ansible By Red Hat
#
# 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 ... |
klaricch/Transposons2 | refs/heads/master | scripts/calculate_cov_at_intervals_OOO.py | 1 | #!/usr/bin/env python
# this script calculates the coverage of a sample at each interval given in the interval file
# USE: calculate_cov_at_intervals.py <sample name>
import re
import sys
from subprocess import Popen, PIPE
OUT=open("sample_coverages_and_positions.txt", 'aw')
bam_dir="/lscr2/andersenlab/dec211/WI/bam"... |
andreif/django | refs/heads/master | django/core/checks/caches.py | 283 | from __future__ import unicode_literals
from django.conf import settings
from django.core.cache import DEFAULT_CACHE_ALIAS
from . import Error, Tags, register
E001 = Error(
"You must define a '%s' cache in your CACHES setting." % DEFAULT_CACHE_ALIAS,
id='caches.E001',
)
@register(Tags.caches)
def check_def... |
fubecka/f5-dashboard | refs/heads/master | flask/lib/python2.6/site-packages/pip/_vendor/requests/packages/chardet/euckrprober.py | 2930 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... |
mitchgu/TAMProxy-pyHost | refs/heads/master | tamproxy/logger_test.py | 1 | import logging
from utils import config as c
import logging
import logging.config
logging.config.dictConfig(c.logging)
# create logger
logger = logging.getLogger('simpleExample')
# 'application' code
for i in xrange(100):
logger.debug('debug message')
logger.info('info message')
logger.warn('warn messa... |
tvcsantos/Flexget | refs/heads/develop | flexget/plugins/output/rss.py | 6 | from __future__ import unicode_literals, division, absolute_import
import base64
import hashlib
import logging
import datetime
import os
from sqlalchemy import Column, Integer, String, DateTime, Unicode
from flexget import db_schema, plugin
from flexget.event import event
from flexget.utils.sqlalchemy_utils import ta... |
DuCorey/bokeh | refs/heads/master | sphinx/source/docs/user_guide/examples/js_events.py | 6 | """ Demonstration of how to register event callbacks using an adaptation
of the color_scatter example from the bokeh gallery
"""
import numpy as np
from bokeh.io import show, output_file
from bokeh.plotting import figure
from bokeh import events
from bokeh.models import CustomJS, Div, Button
from bokeh.layouts import c... |
yotchang4s/cafebabepy | refs/heads/develop | src/main/python/asyncore.py | 6 | # -*- Mode: Python -*-
# Id: asyncore.py,v 2.51 2000/09/07 22:29:26 rushing Exp
# Author: Sam Rushing <rushing@nightmare.com>
# ======================================================================
# Copyright 1996 by Sam Rushing
#
# All Rights Reserved
#
# Permission to use, copy, modify,... |
djgagne/scikit-learn | refs/heads/master | examples/semi_supervised/plot_label_propagation_digits_active_learning.py | 294 | """
========================================
Label Propagation digits active learning
========================================
Demonstrates an active learning technique to learn handwritten digits
using label propagation.
We start by training a label propagation model with only 10 labeled points,
then we select the t... |
jbarajas/toastee | refs/heads/master | toastee/settings.py | 1 | """
Django settings for toastee project.
Generated by 'django-admin startproject' using Django 1.10.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import os... |
iniverno/RnR-LLC | refs/heads/master | simics-3.0-install/simics-3.0.31/amd64-linux/lib/python2.4/compileall.py | 251 | """Module/script to "compile" all .py files to .pyc (or .pyo) file.
When called as a script with arguments, this compiles the directories
given as arguments recursively; the -l option prevents it from
recursing into directories.
Without arguments, if compiles all modules on sys.path, without
recursing into subdirecto... |
sebhtml/assembly | refs/heads/master | lib/assembly/cloud.py | 4 | import socket
import shutil
import uuid
import logging
import os
import metadata
from novaclient.v1_1 import client
from ConfigParser import SafeConfigParser
class CloudMonitor(client.Client):
def __init__(self, os_user, os_pass, os_tenant, os_auth_url,
config_file):
super(CloudMonitor, ... |
thehyve/variant | refs/heads/master | eggs/django-1.3.1-py2.7.egg/django/contrib/gis/forms/fields.py | 405 | from django import forms
from django.utils.translation import ugettext_lazy as _
# While this couples the geographic forms to the GEOS library,
# it decouples from database (by not importing SpatialBackend).
from django.contrib.gis.geos import GEOSGeometry
class GeometryField(forms.Field):
"""
This is the bas... |
KartoffelToby/docker-teeworlds-instagib-server | refs/heads/master | files/scripts/build.py | 2 | import imp, optparse, os, re, shutil, sys, zipfile
from optparse import OptionParser
if sys.version_info[0] == 2:
import urllib
url_lib = urllib
elif sys.version_info[0] == 3:
import urllib.request
url_lib = urllib.request
match = re.search('(.*)/', sys.argv[0])
if match != None:
os.chdir(match.group(1))
os.chdir(... |
sjkoon/original-sgs3-soonjung | refs/heads/master | tools/perf/scripts/python/check-perf-trace.py | 11214 | # perf script event handlers, generated by perf script -g python
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# This script tests basic functionality such as flag and symbol
# strings, common_xxx() calls back into perf, begin, end, unhandled
# events, etc. ... |
tlksio/tlksio | refs/heads/develop | env/lib/python3.4/site-packages/pip/log.py | 47 | """Logging
"""
import sys
import os
import logging
from pip import backwardcompat
import colorama, pkg_resources
def _color_wrap(*colors):
def wrapped(inp):
return "".join(list(colors) + [inp, colorama.Style.RESET_ALL])
return wrapped
def should_color(consumer, environ, std=(sys.stdout, sys.stderr... |
agry/NGECore2 | refs/heads/master | scripts/object/draft_schematic/dance_prop/prop_glowstick_l_s05.py | 85615 | import sys
def setup(core, object):
return |
dchen1107/test-infra | refs/heads/master | jenkins/janitor.py | 2 | #!/usr/bin/env python
# Copyright 2016 The Kubernetes 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 appli... |
paniczklos/p2pool-right | refs/heads/master | p2pool/util/variable.py | 270 | import itertools
import weakref
from twisted.internet import defer, reactor
from twisted.python import failure, log
class Event(object):
def __init__(self):
self.observers = {}
self.id_generator = itertools.count()
self._once = None
self.times = 0
def run_and_watch(self, f... |
calamityman/ansible-modules-extras | refs/heads/devel | database/influxdb/influxdb_database.py | 54 | #!/usr/bin/python
# (c) 2016, Kamil Szczygiel <kamil.szczygiel () intel.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
# ... |
ScottSteiner/uguubot | refs/heads/steiner | disabled_plugins/fmylife.py | 4 | from util import hook, http
fml_cache = []
def refresh_cache():
""" gets a page of random FMLs and puts them into a dictionary """
soup = http.get_soup('http://www.fmylife.com/random/')
for e in soup.find_all('div', {'class': 'post article'}):
id = int(e['id'])
text = ''.join(e.find('p').... |
xgfone/snippet | refs/heads/master | snippet/example/python/scrapy/crawler/crawler/spiders/textspider.py | 1 | # coding: utf-8
from __future__ import unicode_literals, print_function
from scrapy.selector import Selector
from crawler.items import TextItem
from crawler.spiders.base import BaseSpider
class TextSpider(BaseSpider):
name = "text"
custom_settings = {
"ITEM_PIPELINES": {
'crawler.pipeline... |
gnuhub/intellij-community | refs/heads/master | python/helpers/python-skeletons/os/path.py | 49 | """Skeleton for 'os.path' stdlib module."""
import sys
import os
def abspath(path):
"""Return a normalized absolutized version of the pathname path.
:type path: T <= bytes | unicode
:rtype: T
"""
return path
def basename(path):
"""Return the base name of pathname path.
:type path: T ... |
yaukwankiu/armor | refs/heads/master | geometry/localFeatures.py | 1 | # local features module
# to detect local scales and features
# input: armor.pattern.DBZ objects
# output: (tentative) DBZ objects with marked rectangles
"""
cd /media/KINGSTON/ARMOR/python/
ipython -pylab
from armor import pattern
a=pattern.a
a.load()
from armor.geometry import localFeatures as lf
a.l... |
bhilburn/gnuradio | refs/heads/master | gr-digital/examples/narrowband/receive_path.py | 15 | #!/usr/bin/env python
#
# Copyright 2005-2007,2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at you... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.