repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
tafaRU/odoo | refs/heads/8.0 | addons/account/report/account_partner_balance.py | 95 | # -*- 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... |
mlacunza/bibliocode | refs/heads/master | Bibliocode/biblio.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-#
__author__ = 'Mario Lacunza <mlacunza@gmail.com>'
__version__ = '0.1'
"""
Archivo inicial para BiblioCode.
Equivale al EXE - 02
"""
import wx
#import tools.errores
class biblio(wx.App):
def OnInit(self):
self.Inicio()
return True
def Inicio(... |
a301-teaching/pyman | refs/heads/master | Book/chap8/Problems/MakePwrLawData.py | 3 | # Make simulated data
import numpy as np
import matplotlib.pyplot as plt
npts = 13
A = 1.e8
n = np.logspace(1.1, 2.9, npts)
p = -1.5
m = 0.1 * n**p
m *= A*np.random.normal(loc=1.0, scale=0.1, size=m.size)
n *= np.random.normal(loc=1.0, scale=0.1, size=n.size)
dm = m**0.81
# Write to data file
fileout = open("Mass.... |
safwanrahman/linuxdesh | refs/heads/master | kitsune/sumo/admin.py | 23 | from django.contrib import admin
admin.site.disable_action('edit_permissions')
|
ybenitezf/nstock | refs/heads/master | modules/whoosh/spelling.py | 52 | # Copyright 2007 Matt Chaput. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the... |
maikelwever/gitlabot | refs/heads/master | bot.py | 1 | #!/usr/bin/env python
#
# 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 distributed in the hope that... |
webflint/nflvid | refs/heads/master | nflvid/__init__.py | 1 | """
A simple library to download, slice and search NFL game footage on a
play-by-play basis.
This library comes with preloaded play-by-play meta data, which
describes the start time of each play in the game footage. However,
the actual footage does not come with this library and is not released
by me. This package the... |
mancoast/CPythonPyc_test | refs/heads/master | cpython/252_time_hashlib.py | 214 | # It's intended that this script be run by hand. It runs speed tests on
# hashlib functions; it does not test for correctness.
import sys, time
import hashlib
def creatorFunc():
raise RuntimeError, "eek, creatorFunc not overridden"
def test_scaled_msg(scale, name):
iterations = 106201/scale * 20
longSt... |
mageelen/snow | refs/heads/master | device/tasks.py | 1 | from __future__ import absolute_import
from snow.celery import app
@app.task
def add(x, y):
return x + y
@app.task
def test():
print("this is just a test.")
@app.task
def mul(x, y):
return x * y
@app.task
def xsum(numbers):
return sum(numbers)
|
boundlessgeo/QGIS | refs/heads/master | python/plugins/processing/algs/qgis/SnapGeometries.py | 8 | # -*- coding: utf-8 -*-
"""
***************************************************************************
SnapGeometries.py
-----------------
Date : October 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot com
******************... |
kod3r/miasm | refs/heads/master | miasm2/arch/sh4/arch.py | 6 | #!/usr/bin/env python
#-*- coding:utf-8 -*-
from pyparsing import *
from miasm2.core.cpu import *
from miasm2.expression.expression import *
from collections import defaultdict
import miasm2.arch.sh4.regs as regs_module
from miasm2.arch.sh4.regs import *
from miasm2.core.asmbloc import asm_label
jra = ExprId('jra')
j... |
andriibekker/biddingsbase | refs/heads/master | django/views/generic/__init__.py | 493 | from django.views.generic.base import View, TemplateView, RedirectView
from django.views.generic.dates import (ArchiveIndexView, YearArchiveView, MonthArchiveView,
WeekArchiveView, DayArchiveView, TodayArchiveView,
DateDetailView)
from django.vie... |
ywang2014/learn-python3 | refs/heads/master | samples/io/do_stringio.py | 21 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from io import StringIO
# write to StringIO:
f = StringIO()
f.write('hello')
f.write(' ')
f.write('world!')
print(f.getvalue())
# read from StringIO:
f = StringIO('水面细风生,\n菱歌慢慢声。\n客亭临小市,\n灯火夜妆明。')
while True:
s = f.readline()
if s == '':
break
print(... |
mpillar/codeeval | refs/heads/master | 1-moderate/to-pi-or-not-to-pi/main1.py | 1 | import sys
# http://stackoverflow.com/questions/9004789/1000-digits-of-pi-in-python
def make_pi():
q, r, t, k, m, x = 1, 0, 1, 1, 3, 3
for j in range(21604): # experimentation to determine the loop value needed for 5k digits.
if 4 * q + r - t < m * t:
yield m
q, r, t, k, m, x =... |
largescale-dfss/concept-demo | refs/heads/master | app/dfss/demo/migrations/0002_auto_20151216_0033.py | 1 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('demo', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='resume',
name='timestamp',... |
revmischa/boto | refs/heads/develop | tests/integration/configservice/__init__.py | 586 | # Copyright (c) 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved
#
# 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 ... |
cantell/silos | refs/heads/master | silos/ui/SubjectHandler.py | 1 | import htmlPy
import core.Subject as sub
class SubjectHandler(htmlPy.Object):
def __init__(self, app):
super(SubjectHandler, self).__init__()
self.app = app
@staticmethod
def get_subjects():
subjects = []
for subject in sub.get_subjects():
subjects.append(
... |
blademainer/intellij-community | refs/heads/master | python/testData/refactoring/move/usageFromFunctionResolvesToDunderAllWithAlias/before/src/b.py | 316 | __all__ = ['foo']
class C(object):
def foo(self):
pass
_c = C()
def _init(g):
for name in dir(_c):
if not name.startswith('_'):
g[name] = getattr(_c, name)
_init(globals()) |
Algesat/BladeApex2 | refs/heads/master | tools/perf/python/twatch.py | 7370 | #! /usr/bin/python
# -*- python -*-
# -*- coding: utf-8 -*-
# twatch - Experimental use of the perf python interface
# Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com>
#
# This application is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License... |
Elbagoury/odoo | refs/heads/8.0 | openerp/addons/test_converter/__init__.py | 2355 | # -*- coding: utf-8 -*-
import models
|
oorestisime/debsources | refs/heads/master | debsources/tests/test_updater.py | 1 | # Copyright (C) 2013-2015 The Debsources developers <info@sources.debian.net>.
# See the AUTHORS file at the top-level directory of this distribution and at
# https://anonscm.debian.org/gitweb/?p=qa/debsources.git;a=blob;f=AUTHORS;hb=HEAD
#
# This file is part of Debsources. Debsources is free software: you can
# redi... |
hasanferit/trumpcrawler | refs/heads/master | crawlenv/lib/python3.5/site-packages/wheel/__main__.py | 70 | """
Wheel command line tool (enable python -m wheel syntax)
"""
import sys
def main(): # needed for console script
if __package__ == '':
# To be able to run 'python wheel-0.9.whl/wheel':
import os.path
path = os.path.dirname(os.path.dirname(__file__))
sys.path[0:0] = [path]
i... |
samthor/intellij-community | refs/heads/master | python/testData/completion/isInstanceAssert.py | 83 | class Foo:
def xyzzy(self): pass
def bar(): pass
f = bar()
assert isinstance(f, Foo)
f.xy<caret> |
jmcarp/osf.io | refs/heads/develop | website/addons/github/exceptions.py | 23 | from github3 import GitHubError # noqa
from website.util.sanitize import escape_html
from website.addons.base.exceptions import AddonEnrichmentError
class ApiError(Exception):
pass
class NotFoundError(ApiError):
pass
class EmptyRepoError(ApiError):
pass
class TooBigError(ApiError):
pass
clas... |
pepeportela/edx-platform | refs/heads/master | common/djangoapps/util/tests/test_file.py | 4 | # -*- coding: utf-8 -*-
"""
Tests for file.py
"""
import os
from datetime import datetime
from io import StringIO
import ddt
from django.core import exceptions
from django.core.files.uploadedfile import SimpleUploadedFile
from django.http import HttpRequest
from django.test import TestCase
from django.utils.timezone i... |
shastikk/youtube-dl | refs/heads/master | youtube_dl/extractor/varzesh3.py | 120 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class Varzesh3IE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?video\.varzesh3\.com/(?:[^/]+/)+(?P<id>[^/]+)/?'
_TEST = {
'url': 'http://video.varzesh3.com/germany/bundesliga/5-%D9%88%D8%A7%DA%A9%D9%86%D8%B4... |
gbowerman/azure-quickstart-templates | refs/heads/master | bosh-setup/scripts/inject_xip_io_records.py | 52 | #!/usr/bin/env python
import sys
import yaml
import json
from pg import DB
bosh_manifest_path = sys.argv[1]
with open(bosh_manifest_path, 'r') as f:
bosh_manifest = yaml.load(f.read())
settings_path = sys.argv[2]
with open(settings_path, 'r') as f:
cf_ip = json.loads(f.read())['cf-ip']
postgres_properties =... |
valfa14/Piton-calc | refs/heads/master | piton_kalkulacka.py | 1 | # -*- coding: utf-8 -*-
#!/usr/bin/env python
##
# @file piton_kalkulacka.py
# @author Vladimír Alfery
# @author Martin Hlavacka
# @date 25.11.2015
# @brief Kalkulačka Pitoň s grafickým módem
from tkinter import *
from tkinter import messagebox
import graph
from PIL import ImageTk, Image
import calc_ev... |
joshua-cogliati-inl/raven | refs/heads/devel | tests/framework/pca_sparseGridCollocation/scgpcMVNUncorrelated/polynomial.py | 6 | # Copyright 2017 Battelle Energy Alliance, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... |
pinae/Habitica-tweaker | refs/heads/master | sync_accounts/migrations/0003_auto_20160822_2206.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-22 20:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sync_accounts', '0002_auto_20160819_1748'),
]
operations = [
migrations.Alter... |
sailfishapps/tmo | refs/heads/master | tmo/lib/requests/packages/urllib3/util/ssl_.py | 156 | from binascii import hexlify, unhexlify
from hashlib import md5, sha1, sha256
from ..exceptions import SSLError, InsecurePlatformWarning
SSLContext = None
HAS_SNI = False
create_default_context = None
import errno
import ssl
import warnings
try: # Test for SSL features
from ssl import wrap_socket, CERT_NONE, ... |
SerCeMan/intellij-community | refs/heads/master | python/testData/quickFixes/AddFieldQuickFixTest/addFieldFromInstance.py | 83 | class A:
def __init__(self):
self.x = 1
a = A()
a.<caret><warning descr="Unresolved attribute reference 'y' for class 'A'">y</warning>+1
|
zooba/PTVS | refs/heads/master | Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/cryptography/hazmat/backends/openssl/x448.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
from cryptography import utils
from cryptography.hazmat.backends.openssl.... |
2014c2g4/2015cda_g7 | refs/heads/master | static/Brython3.1.3-20150514-095342/Lib/_testcapi.py | 742 |
CHAR_MAX = 127
CHAR_MIN = -128
DBL_MAX = 1.7976931348623157e+308
DBL_MIN = 2.2250738585072014e-308
FLT_MAX = 3.4028234663852886e+38
FLT_MIN = 1.1754943508222875e-38
INT_MAX = 2147483647
INT_MIN = -2147483648
LLONG_MAX = 9223372036854775807
LLONG_MIN = -9223372036854775808
LONG_MAX = 2147483647
LONG_MIN = -2... |
moodpulse/l2 | refs/heads/develop | integration_framework/urls.py | 1 | from django.urls import path
from . import views
urlpatterns = [
path('result/next', views.next_result_direction),
path('result/amd', views.get_dir_amd),
path('result/n3', views.get_dir_n3),
path('result/resend-l2', views.get_dir_n3),
path('result/sendamd', views.result_amd_send),
path('direct... |
vbannai/neutron | refs/heads/master | neutron/tests/unit/services/firewall/agents/l3reference/test_firewall_l3_agent.py | 3 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.ap... |
DxCx/nzbToMedia | refs/heads/master | libs/unidecode/x04f.py | 252 | data = (
'Zhong ', # 0x00
'Qi ', # 0x01
'Pei ', # 0x02
'Yu ', # 0x03
'Diao ', # 0x04
'Dun ', # 0x05
'Wen ', # 0x06
'Yi ', # 0x07
'Xin ', # 0x08
'Kang ', # 0x09
'Yi ', # 0x0a
'Ji ', # 0x0b
'Ai ', # 0x0c
'Wu ', # 0x0d
'Ji ', # 0x0e
'Fu ', # 0x0f
'Fa ', # 0x10
'Xiu ', ... |
BeATz-UnKNoWN/python-for-android | refs/heads/master | python-modules/twisted/twisted/trial/test/packages.py | 62 | import sys, os
from twisted.trial import unittest
testModule = """
from twisted.trial import unittest
class FooTest(unittest.TestCase):
def testFoo(self):
pass
"""
dosModule = testModule.replace('\n', '\r\n')
testSample = """
'''This module is used by test_loader to test the Trial test loading
function... |
codepantry/django | refs/heads/master | tests/save_delete_hooks/models.py | 409 | """
Adding hooks before/after saving and deleting
To execute arbitrary code around ``save()`` and ``delete()``, just subclass
the methods.
"""
from __future__ import unicode_literals
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Person(... |
CamelBackNotation/CarnotKE | refs/heads/master | jyhton/lib-python/2.7/macpath.py | 191 | """Pathname and path-related operations for the Macintosh."""
import os
import warnings
from stat import *
import genericpath
from genericpath import *
__all__ = ["normcase","isabs","join","splitdrive","split","splitext",
"basename","dirname","commonprefix","getsize","getmtime",
"getatime","getc... |
Immortalin/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/encodings/cp856.py | 272 | """ Python Character Mapping Codec cp856 generated from 'MAPPINGS/VENDORS/MISC/CP856.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 decode(self,input,errors='... |
dahlstrom-g/intellij-community | refs/heads/master | python/testData/intentions/PyConvertCollectionLiteralIntentionTest/convertTupleWithoutParenthesesToList_after.py | 78 | xs = [1, 2]
|
BlessedAndy/Programming-Foundations-with-Python | refs/heads/master | Programming Foundations with Python/src/cn/careerwinner/andy/RequestTest.py | 1 | '''
Created on Sep 30, 2017
@author: I310003
'''
import requests
r = requests.get('https://api.github.com/events')
print(r.text) |
marcore/edx-platform | refs/heads/master | openedx/core/djangoapps/content/course_overviews/migrations/0003_courseoverviewgeneratedhistory.py | 81 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
import model_utils.fields
class Migration(migrations.Migration):
dependencies = [
('course_overviews', '0002_add_course_catalog_fields'),
]
operations = [
... |
eblot/micropython | refs/heads/master | tests/basics/dict_iterator.py | 118 | d = {1: 2, 3: 4}
els = []
for i in d:
els.append((i, d[i]))
print(sorted(els))
|
JTCunning/sentry | refs/heads/master | src/sentry/utils/json.py | 16 | """
sentry.utils.json
~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
# Avoid shadowing the standard library json module
from __future__ import absolute_import
from django.core.serializers.json import DjangoJSONEncoder
imp... |
nopjmp/SickRage | refs/heads/master | lib/sqlalchemy/testing/suite/test_ddl.py | 76 |
from .. import fixtures, config, util
from ..config import requirements
from ..assertions import eq_
from sqlalchemy import Table, Column, Integer, String
class TableDDLTest(fixtures.TestBase):
__backend__ = True
def _simple_fixture(self):
return Table('test_table', self.metadata,
... |
ktosiek/spacewalk | refs/heads/debian-repos | scripts/ncsu-rhntools/rhnstats/rhnstats.py | 19 | #!/usr/bin/python
#
# rhnstats.py - Generate db/web/csv statistics for RHN usage.
# Copyright (C) 2007 NC State University
# Written by Jack Neely <jjneely@ncsu.edu>
#
# 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... |
KanchanChauhan/erpnext | refs/heads/develop | erpnext/stock/reorder_item.py | 20 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import frappe
import erpnext
from frappe.utils import flt, nowdate, add_days, cint
from frappe import _
def reorder_item():
""" Reorder item if stock reaches reorder level"""
# if initial s... |
Barbarian1010/pychess | refs/heads/master | lib/pychess/System/conf.py | 22 | """ The task of this module is to provide easy saving/loading of configurations
It also supports gconf like connection, so you get notices when a property
has changed. """
from __future__ import absolute_import
from . import conf_configParser as confmodule
"""Module for using gconf without having to care abou... |
sumanthha/fundafriend | refs/heads/master | django/contrib/auth/hashers.py | 26 | import hashlib
from django.conf import settings
from django.utils import importlib
from django.utils.datastructures import SortedDict
from django.utils.encoding import smart_str
from django.core.exceptions import ImproperlyConfigured
from django.utils.crypto import (
pbkdf2, constant_time_compare, get_random_strin... |
zengenti/ansible | refs/heads/devel | lib/ansible/modules/packaging/language/maven_artifact.py | 21 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (c) 2014, Chris Schmidt <chris.schmidt () contrastsecurity.com>
#
# Built using https://github.com/hamnis/useful-scripts/blob/master/python/download-maven-artifact
# as a reference and starting point.
#
# This module is free software: you can redistribute it and/or... |
michael-mao/titanium | refs/heads/master | thermostat/gui.py | 1 | # -*- coding: utf-8 -*-
import sys
import os
import pygame
from logging import getLogger
from . import utils, errors, config
class GUI(metaclass=utils.Singleton):
WIDTH = 480
HEIGHT = 320
SIZE = (WIDTH, HEIGHT)
DEFAULT_FONT = 'roboto'
BACKGROUND_COLOUR = (255, 255, 255)
TEMP_TEXT_COLOUR =... |
anhstudios/swganh | refs/heads/develop | data/scripts/templates/object/mobile/shared_dressed_deathstar_debris_cultist_hum_m_01.py | 2 | #### NOTICE: THIS FILE IS AUTOGENERATED
#### MODIFICATIONS MAY BE LOST IF DONE IMPROPERLY
#### PLEASE SEE THE ONLINE DOCUMENTATION FOR EXAMPLES
from swgpy.object import *
def create(kernel):
result = Creature()
result.template = "object/mobile/shared_dressed_deathstar_debris_cultist_hum_m_01.iff"
result.attribut... |
PlayUAV/MissionPlanner | refs/heads/master | Lib/site-packages/numpy/random/setup.py | 54 | from os.path import join
from numpy.distutils.system_info import get_info
def testcode_wincrypt():
return """\
/* check to see if _WIN32 is defined */
int main(int argc, char *argv[])
{
#ifdef _WIN32
return 0;
#else
return 1;
#endif
}
"""
def configuration(parent_package='',top_path=None):
from nu... |
nazo/ansible | refs/heads/devel | lib/ansible/module_utils/vyos.py | 17 | # 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... |
sunzuolei/youtube-dl | refs/heads/master | youtube_dl/extractor/tf1.py | 101 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class TF1IE(InfoExtractor):
"""TF1 uses the wat.tv player."""
_VALID_URL = r'http://(?:(?:videos|www|lci)\.tf1|www\.tfou)\.fr/.*?-(?P<id>\d+)(?:-\d+)?\.html'
_TESTS = [{
'url': 'http://videos.tf1.fr/auto-mot... |
alphafoobar/intellij-community | refs/heads/master | python/testData/deprecation/deprecatedModule.py | 83 | import warnings
warnings.warn("the deprecated module is deprecated; use a non-deprecated module instead",
DeprecationWarning, 2)
|
verper/faculty_evaluation | refs/heads/master | assets/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py | 1869 | # Copyright 2014 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.
"""A clone of the default copy.deepcopy that doesn't handle cyclic
structures or complex types except for dicts and lists. This is
because gyp copies so large structur... |
cysuncn/python | refs/heads/master | study/test/main_runner.py | 1 | #encoding=utf-8
#main_runner.py
import unittest
from study.test.widget import Widget
#执行测试的类
class WidgetTestCase(unittest.TestCase):
def setUp(self):
self.widget = Widget()
def tearDown(self):
self.widget.dispose()
self.widget = None
def testSize(self):
self.assertEqual(s... |
folbo/MuseScore | refs/heads/master | thirdparty/freetype/src/tools/docmaker/content.py | 97 | #
# content.py
#
# Parse comment blocks to build content blocks (library file).
#
# Copyright 2002-2015 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,
# modified, and distributed under the terms of the FreeType project
# license, LICENSE.TXT. By continuing to use, modi... |
blueboxgroup/cinder | refs/heads/master | cinder/tests/fake_notifier.py | 8 | # Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agre... |
benroeder/moviepy | refs/heads/master | moviepy/video/tools/drawing.py | 13 | """
This module deals with making images (np arrays). It provides drawing
methods that are difficult to do with the existing Python libraries.
"""
import numpy as np
def blit(im1, im2, pos=[0, 0], mask=None, ismask=False):
""" Blit an image over another.
Blits ``im1`` on ``im2`` as position ``pos=(x,y)``... |
popazerty/beyonwiz-4.1 | refs/heads/master | lib/python/Screens/MinuteInput.py | 57 | from Screens.Screen import Screen
from Components.ActionMap import NumberActionMap
from Components.Input import Input
class MinuteInput(Screen):
def __init__(self, session, basemins = 5):
Screen.__init__(self, session)
self["minutes"] = Input(str(basemins), type=Input.NUMBER)
self["actions"] = NumberActionMap... |
globau/servo | refs/heads/master | tests/wpt/css-tests/tools/pywebsocket/src/mod_pywebsocket/dispatch.py | 652 | # Copyright 2012, 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... |
ychen820/microblog | refs/heads/master | flask/lib/python2.7/site-packages/pip/vcs/git.py | 85 | from __future__ import absolute_import
import logging
import tempfile
import os.path
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves.urllib import request as urllib_request
from pip.utils import call_subprocess
from pip.utils import display_path, rmtree
from pip.vcs import v... |
rrrene/django | refs/heads/master | tests/test_utils/views.py | 481 | from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from django.template import Context, Template
from .models import Person
def get_person(request, pk):
person = get_object_or_404(Person, pk=pk)
return HttpResponse(person.name)
def no_template_used(request):
template = ... |
smishenk/blink-crosswalk | refs/heads/master | Source/build/scripts/make_media_features.py | 78 | #!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import media_feature_symbol
import in_generator
import template_expander
import name_utilities
import sys
class MakeMediaFeaturesWri... |
davisein/jitsudone | refs/heads/master | djangoappengine/djangoappengine/storage.py | 37 | import mimetypes
import os
import urlparse
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.core.files.base import File
from django.core.files.storage import Storage
from django.core.files.uploadedfile import UploadedFile
from d... |
spthaolt/breakpad | refs/heads/master | src/tools/gyp/pylib/gyp/MSVSProject.py | 137 | #!/usr/bin/python2.4
# 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.
"""Visual Studio project reader/writer."""
import common
import xml.dom
import xml.dom.minidom
import MSVSNew
#----------------------------... |
lanbing510/GTDWeb | refs/heads/master | django/conf/locale/is/formats.py | 578 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
# DAT... |
tmuelle2/phantomjs | refs/heads/master | src/qt/qtwebkit/Source/ThirdParty/gtest/test/gtest_list_tests_unittest.py | 1068 | #!/usr/bin/env python
#
# 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... |
jplourenco/bokeh | refs/heads/master | examples/charts/file/bar.py | 4 | from bokeh.charts import Bar, output_file, show, vplot, hplot, defaults
from bokeh.sampledata.autompg import autompg as df
df['neg_displ'] = 0 - df['displ']
defaults.width = 350
defaults.height = 250
bar_plot = Bar(df, label='cyl', title="label='cyl'")
bar_plot2 = Bar(df, label='cyl', bar_width=0.4, title="label='c... |
ging/horizon | refs/heads/master | openstack_dashboard/dashboards/idm_admin/administrators/models.py | 979 | """
Stub file to work around django bug: https://code.djangoproject.com/ticket/7198
"""
|
ii0/pybrain | refs/heads/master | examples/supervised/backprop/datasets/xor.py | 30 | #!/usr/bin/env python
__author__ = 'Tom Schaul, tom@idsia.ch'
from pybrain.datasets import SupervisedDataSet, ImportanceDataSet
class XORDataSet(SupervisedDataSet):
""" A dataset for the XOR function."""
def __init__(self):
SupervisedDataSet.__init__(self, 2, 1)
self.addSample([0,0],[0])
... |
vrypan/webmention-tools | refs/heads/master | test/test_discover.py | 1 | import unittest
import pytest
from webmentiontools.discover import WebmentionDiscover
from .endpoints import WEBMENTION_ROCKS_TESTS
MOCK_URL = 'http://foo.bar/'
class WebmentionDiscoverTestCase(unittest.TestCase):
def test_init(self):
webmention = WebmentionDiscover(
MOCK_URL
)
... |
roadmapper/ansible | refs/heads/devel | test/units/modules/network/fortios/test_fortios_system_central_management.py | 21 | # Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the... |
nikitasingh981/scikit-learn | refs/heads/master | sklearn/linear_model/least_angle.py | 7 | """
Least Angle Regression algorithm. See the documentation on the
Generalized Linear Model for a complete discussion.
"""
from __future__ import print_function
# Author: Fabian Pedregosa <fabian.pedregosa@inria.fr>
# Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Gael Varoquaux
#
# License: BSD 3 ... |
bowen0701/algorithms_data_structures | refs/heads/master | lc0532_k_diff_pairs_in_an_array.py | 1 | """Leetcode 532. K-diff Pairs in an Array
Easy
URL: https://leetcode.com/problems/k-diff-pairs-in-an-array/
Given an array of integers and an integer k, you need to find the number
of unique k-diff pairs in the array. Here a k-diff pair is defined as an
integer pair (i, j), where i and j are both numbers in the arra... |
pwoodworth/intellij-community | refs/heads/master | python/testData/refactoring/rename/renamePackageUpdatesFirstFormImports/after/bar/m1.py | 166 | def f():
return 0 |
zero-ui/miniblink49 | refs/heads/master | third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/reftests/__init__.py | 6014 | # Required for Python to search this directory for module files
|
perrygeo/rasterio | refs/heads/master | rasterio/rio/helpers.py | 3 | """
Helper objects used by multiple CLI commands.
"""
import json
def coords(obj):
"""Yield all coordinate coordinate tuples from a geometry or feature.
From python-geojson package."""
if isinstance(obj, (tuple, list)):
coordinates = obj
elif 'geometry' in obj:
coordinates = obj['geo... |
40223125/40223125-2 | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/site-packages/pygame/version.py | 607 | ## pygame - Python Game Library
## Copyright (C) 2000-2003 Pete Shinners
##
## This library is free software; you can redistribute it and/or
## modify it under the terms of the GNU Library General Public
## License as published by the Free Software Foundation; either
## version 2 of the License, or (... |
BizzCloud/PosBox | refs/heads/master | addons/stock_account/wizard/stock_valuation_history.py | 28 |
from openerp import tools
from openerp.osv import fields, osv
from openerp.tools.translate import _
class wizard_valuation_history(osv.osv_memory):
_name = 'wizard.valuation.history'
_description = 'Wizard that opens the stock valuation history table'
_columns = {
'choose_date': fields.boolean('C... |
s-good/AutoQC | refs/heads/master | tests/CSIRO_long_gradient_validation.py | 1 | import qctests.CSIRO_long_gradient
import util.testingProfile
import numpy
##### CSIRO_long_gradient ---------------------------------------------------
def test_CSIRO_long_gradient():
'''
Spot-check the nominal behavior of the CSIRO long gradient test.
'''
# nominal
p = util.testingProfile.fakeP... |
Lujeni/ansible | refs/heads/devel | lib/ansible/modules/network/eos/eos_lldp_global.py | 19 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is au... |
xros/apm_planner | refs/heads/master | libs/mavlink/share/pyshared/pymavlink/generator/mavtemplate.py | 56 | #!/usr/bin/env python
'''
simple templating system for mavlink generator
Copyright Andrew Tridgell 2011
Released under GNU GPL version 3 or later
'''
from mavparse import MAVParseError
class MAVTemplate(object):
'''simple templating system'''
def __init__(self,
start_var_token="${",
... |
macph/easement-curve | refs/heads/master | tests/tests_coord.py | 1 | # MIT License, copyright Ewan Macpherson, 2016; see LICENCE in root directory
# Test script for the TrackCoord class
import math
import os
import sys
import unittest
sys.path.insert(0, os.path.abspath('..'))
import ec.coord
class CoordGeneralTests(unittest.TestCase):
def test_position(self):
tc = ec.co... |
rogthedodge/redux | refs/heads/master | test/test.py | 1 | from source import redux_DB
x = redux_DB.redux_model()
y = x.get_next_person_to_call('Cus March')
print(y)
|
yavalvas/yav_com | refs/heads/master | build/matplotlib/lib/mpl_examples/animation/subplots.py | 14 | import numpy as np
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
import matplotlib.animation as animation
# This example uses subclassing, but there is no reason that the proper function
# couldn't be set up and then use FuncAnimation. The code is long, but not
# really complex. The length is due... |
maxvogel/NetworKit-mirror2 | refs/heads/master | networkit/stopwatch.py | 4 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2008 John Paulett (john -at- 7oars.com)
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
import time
"""stopwatch is a very simple Python module for measuring time.
Great for ... |
kustomzone/Fuzium | refs/heads/master | core/src/lib/rsa/bigfile.py | 196 | # -*- coding: utf-8 -*-
#
# Copyright 2011 Sybren A. Stüvel <sybren@stuvel.eu>
#
# 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
#
# Unl... |
navodissa/python-flask | refs/heads/master | flask/lib/python2.7/site-packages/markupsafe/_compat.py | 864 | # -*- coding: utf-8 -*-
"""
markupsafe._compat
~~~~~~~~~~~~~~~~~~
Compatibility module for different Python versions.
:copyright: (c) 2013 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import sys
PY2 = sys.version_info[0] == 2
if not PY2:
text_type = str
string_type... |
hcsturix74/django | refs/heads/master | django/core/management/sql.py | 399 | from __future__ import unicode_literals
from django.apps import apps
from django.db import models
def sql_flush(style, connection, only_django=False, reset_sequences=True, allow_cascade=False):
"""
Returns a list of the SQL statements used to flush the database.
If only_django is True, then only table n... |
Zearin/git-bup | refs/heads/master | cmd/on--server-cmd.py | 8 | #!/usr/bin/env python
import sys, os, struct
from bup import options, helpers
optspec = """
bup on--server
--
This command is run automatically by 'bup on'
"""
o = options.Options(optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])
if extra:
o.fatal('no arguments expected')
# get the subcommand's argv.
# Nor... |
mcella/django | refs/heads/master | django/contrib/gis/geometry/regex.py | 657 | import re
# Regular expression for recognizing HEXEWKB and WKT. A prophylactic measure
# to prevent potentially malicious input from reaching the underlying C
# library. Not a substitute for good Web security programming practices.
hex_regex = re.compile(r'^[0-9A-F]+$', re.I)
wkt_regex = re.compile(r'^(SRID=(?P<srid... |
christophlsa/odoo | refs/heads/8.0 | addons/edi/models/res_currency.py | 437 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2011-2012 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of t... |
prmtl/fuel-web | refs/heads/master | nailgun/nailgun/rpc/utils.py | 1 | # -*- coding: utf-8 -*-
# Copyright 2014 Mirantis, 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 requi... |
nikolas/lettuce | refs/heads/master | tests/integration/lib/Django-1.3/django/utils/unittest/case.py | 151 | """Test case implementation"""
import sys
import difflib
import pprint
import re
import unittest
import warnings
from django.utils.unittest import result
from django.utils.unittest.util import\
safe_repr, safe_str, strclass,\
unorderable_list_difference
from django.utils.unittest.compatibility import wraps
... |
carlohamalainen/django-struct-log | refs/heads/master | djangostructlog/urls.py | 1 | """djangostructlog URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
C... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.