repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
santoshphilip/pyclearsky | refs/heads/master | original_code/pytest_helpers.py | 1 | """helpers for pytest"""
# taken from python's unit test
# may be covered by Python's license
def almostequal(first, second, places=7, printit=True):
"""docstring for almostequal"""
if round(abs(second-first), places) != 0:
if printit:
print round(abs(second-first), places)
pr... |
ojake/django | refs/heads/master | django/views/generic/__init__.py | 597 | from django.views.generic.base import RedirectView, TemplateView, View
from django.views.generic.dates import (
ArchiveIndexView, DateDetailView, DayArchiveView, MonthArchiveView,
TodayArchiveView, WeekArchiveView, YearArchiveView,
)
from django.views.generic.detail import DetailView
from django.views.generic.e... |
google/google-ctf | refs/heads/master | third_party/edk2/AppPkg/Applications/Python/Python-2.7.2/Lib/mimetools.py | 71 | """Various tools used by MIME-reading or MIME-writing programs."""
import os
import sys
import tempfile
from warnings import filterwarnings, catch_warnings
with catch_warnings():
if sys.py3kwarning:
filterwarnings("ignore", ".*rfc822 has been removed", DeprecationWarning)
import rfc822
fr... |
yitian134/chromium | refs/heads/master | tools/json_schema_compiler/schema_bundle_generator.py | 6 | # 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.
import code
import cpp_util
import json
import os
import re
# TODO(miket/asargent) - parameterize this.
SOURCE_BASE_PATH = 'chrome/common/extensions/ap... |
carvalhomb/tsmells | refs/heads/master | guess/src/Lib/xml/dom/html/HTMLBRElement.py | 2 | ########################################################################
#
# File Name: HTMLBRElement
#
# Documentation: http://docs.4suite.com/4DOM/HTMLBRElement.html
#
### This file is automatically generated by GenerateHtml.py.
### DO NOT EDIT!
"""
WWW: http://4suite.com/4DOM e... |
levilucio/SyVOLT | refs/heads/master | UMLRT2Kiltera_MM/MT_post__FIXED0.py | 1 | """
__MT_post__FIXED0.py_____________________________________________________
Automatically generated AToM3 syntactic object (DO NOT MODIFY DIRECTLY)
Author: gehan
Modified: Sun Feb 15 10:31:26 2015
_________________________________________________________________________
"""
from ASGNode import *
from ATOM3Type impo... |
wangyou/XX-Net | refs/heads/master | code/default/gae_proxy/server/gae/wsgi.py | 6 | #!/usr/bin/env python
# coding=utf-8
# Contributor:
# Phus Lu <[email protected]>
__version__ = '3.0.7'
__password__ = ''
__hostsdeny__ = ()
#__hostsdeny__ = ('.youtube.com', '.youku.com', ".googlevideo.com")
__content_type__ = 'image/gif'
import sys
import os
import re
import time
import struct
import zl... |
wangyum/tensorflow | refs/heads/master | tensorflow/python/platform/flags.py | 85 | # 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... |
RustoriaRu/hipster_api | refs/heads/master | dj_test/dj_test/wsgi.py | 1 | """
WSGI config for dj_test project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTI... |
nismod/energy_demand | refs/heads/master | tests/scripts/test_s_rs_raw_shapes.py | 1 | """testing
"""
from energy_demand.scripts import s_rs_raw_shapes
import numpy as np
def test_assign_hes_data_to_year():
hes_data = {
'working_day': {
0: np.zeros((24, 2)) + 10,
1: np.zeros((24, 2)) + 20,
2: np.zeros((24, 2)) + 30,
3: np.zeros((24, 2)) + 40, ... |
FireWRT/OpenWrt-Firefly-Libraries | refs/heads/master | staging_dir/host/lib/python2.7/test/test_cd.py | 45 | """Whimpy test script for the cd module
Roger E. Masse
"""
from test.test_support import verbose, import_module
cd = import_module('cd')
cdattrs = ['BLOCKSIZE', 'CDROM', 'DATASIZE', 'ERROR', 'NODISC', 'PAUSED', 'PLAYING', 'READY',
'STILL', '__doc__', '__name__', 'atime', 'audio', 'catalog', 'control', '... |
rschmidtz/httpie | refs/heads/master | httpie/compat.py | 46 | """
Python 2.6, 2.7, and 3.x compatibility.
"""
import sys
is_py2 = sys.version_info[0] == 2
is_py26 = sys.version_info[:2] == (2, 6)
is_py27 = sys.version_info[:2] == (2, 7)
is_py3 = sys.version_info[0] == 3
is_pypy = 'pypy' in sys.version.lower()
is_windows = 'win32' in str(sys.platform).lower()
if is_py2:
b... |
gsmartway/odoo | refs/heads/8.0 | addons/email_template/wizard/mail_compose_message.py | 197 | # -*- 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... |
ravello/ansible | refs/heads/devel | v2/ansible/plugins/connections/funcd.py | 4 | # Based on local.py (c) 2012, Michael DeHaan <[email protected]>
# Based on chroot.py (c) 2013, Maykel Moya <[email protected]>
# (c) 2013, Michael Scherer <[email protected]>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU Gene... |
ininex/geofire-python | refs/heads/master | resource/lib/python2.7/site-packages/Crypto/SelfTest/Cipher/test_ChaCha20.py | 5 | # ===================================================================
#
# Copyright (c) 2014, Legrandin <[email protected]>
# 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. Redistributio... |
IndraVikas/scikit-learn | refs/heads/master | sklearn/decomposition/pca.py | 192 | """ Principal Component Analysis
"""
# Author: Alexandre Gramfort <[email protected]>
# Olivier Grisel <[email protected]>
# Mathieu Blondel <[email protected]>
# Denis A. Engemann <[email protected]>
# Michael Eickenberg <[email protected]>
#
# Lice... |
Orav/kbengine | refs/heads/master | kbe/src/lib/python/Lib/test/test_file.py | 2 | import sys
import os
import unittest
from array import array
from weakref import proxy
import io
import _pyio as pyio
from test.support import TESTFN, run_unittest
from collections import UserList
class AutoFileTests:
# file tests for which a test file is automatically set up
def setUp(self):... |
MounikaVanka/bme590hrm | refs/heads/master | Code/read_input.py | 1 | def read_in():
import numpy as np
a = input('Enter the file name')
file = numpy.genfromtxt('ecg_data.csv',
dtype=['fltvar', 'fltvar'],
... names=['Time', 'Voltage'],
delimiter=" , ")
read_in()
|
kishikawakatsumi/Mozc-for-iOS | refs/heads/master | src/session/gen_session_stress_test_data.py | 1 | # -*- coding: utf-8 -*-
# Copyright 2010-2014, 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... |
yuweijun/learning-programming | refs/heads/master | language-python/closure.py | 1 | #! /usr/bin/python
def outter(x, y):
def inner(a = x, b = y):
return a ** b
return inner
f = outter(2, 3)
print f
print f()
def outter1(x, y):
def inner1(a = x, b = y):
return a ** b
return inner1()
f = outter1(2, 3)
print f
def jc(x):
print x
if x: jc(x - 1)
jc(3) |
glwu/python-for-android | refs/heads/master | python3-alpha/python3-src/Lib/turtledemo/peace.py | 65 | #!/usr/bin/env python3
""" turtle-example-suite:
tdemo_peace.py
A very simple drawing suitable as a beginner's
programming example.
Uses only commands, which are also available in
old turtle.py.
Intentionally no variables are used except for the
colorloop:
"""
from turtle import *
def main():
... |
baloo/shinken | refs/heads/debian/master | test/test_module_simplelog.py | 1 | #!/usr/bin/env python2.6
#Copyright (C) 2009-2010 :
# Gabes Jean, [email protected]
# Gerhard Lausser, [email protected]
#
#This file is part of Shinken.
#
#Shinken 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 Fr... |
castelao/maud | refs/heads/master | tests/test_wmean_2D.py | 1 | """ Test some fundamental results from window_mean_2D_latlon
"""
import numpy as np
from numpy import ma
from numpy.random import random
from maud import tests_support
from maud import wmean_2D, wmean_2D_serial
try:
import cython
with_cython = True
except:
with_cython = False
if with_cython:
from c... |
aspectron/jsx | refs/heads/master | extern/boost/tools/build/test/remove_requirement.py | 44 | #!/usr/bin/python
# Copyright (C) Vladimir Prus 2006.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import BoostBuild
t = BoostBuild.Tester(use_test_config=False)
t.write("jamroot.jam", """
project : requirem... |
MoisesTedeschi/python | refs/heads/master | Scripts-Python/Modulos-Diversos/deteccao-de-faces-com-python-e-opencv/Lib/site-packages/pip/_vendor/cachecontrol/compat.py | 78 | try:
from urllib.parse import urljoin
except ImportError:
from urlparse import urljoin
try:
import cPickle as pickle
except ImportError:
import pickle
# Handle the case where the requests module has been patched to not have
# urllib3 bundled as part of its source.
try:
from pip._vendor.requests.... |
libretees/libreshop | refs/heads/master | libreshop/products/migrations/0010_image_main.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2016-05-31 00:52
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('products', '0009_auto_20160531_0049'),
]
operations = [
migrations.AddField(
... |
ZihengJiang/mxnet | refs/heads/master | example/image-classification/benchmark.py | 46 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
rndusr/stig | refs/heads/master | stig/client/filters/tracker.py | 1 | # 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 hope that it will be useful
# but... |
jimcarreer/hpack | refs/heads/master | docs/source/conf.py | 1 | # -*- coding: utf-8 -*-
#
# hpack documentation build configuration file, created by
# sphinx-quickstart on Mon Oct 12 13:14:36 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... |
Theer108/invenio | refs/heads/master | invenio/legacy/authorlist/templates.py | 13 | # This file is part of Invenio.
# Copyright (C) 2011, 2012, 2013, 2014 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 option) any later version... |
vijayanandnandam/youtube-dl | refs/heads/master | youtube_dl/extractor/huajiao.py | 64 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
parse_duration,
parse_iso8601,
)
class HuajiaoIE(InfoExtractor):
IE_DESC = '花椒直播'
_VALID_URL = r'https?://(?:www\.)?huajiao\.com/l/(?P<id>[0-9]+)'
_TEST = {
'url': 'http://www.h... |
LiveZenLK/CeygateERP | refs/heads/master | addons/sale/report/__init__.py | 70 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import sale_report
import invoice_report
|
fiuba08/robotframework | refs/heads/master | atest/testdata/libdoc/NewStyleNoInit.py | 38 | class NewStyleNoInit(object):
"""No inits here!"""
def keyword(self, arg1, arg2):
"""The only lonely keyword."""
|
HalCanary/skia-hc | refs/heads/master | infra/bots/recipes/test.py | 1 | # Copyright 2016 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.
# Recipe module for Skia Swarming test.
DEPS = [
'env',
'flavor',
'recipe_engine/context',
'recipe_engine/file',
'recipe_engine/path',
'recipe... |
mou4e/zirconium | refs/heads/master | build/android/adb_logcat_printer.py | 69 | #!/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.
"""Shutdown adb_logcat_monitor and print accumulated logs.
To test, call './adb_logcat_printer.py <base_dir>' where
<base_dir> c... |
jamespeterschinner/async_v20 | refs/heads/master | tests/test_interface/test_helpers.py | 1 | import inspect
import json
import re
import pandas as pd
import pytest
from async_v20 import endpoints
from async_v20.client import OandaClient
from async_v20.definitions.types import Account
from async_v20.definitions.types import DateTime
from async_v20.definitions.types import OrderRequest
from async_v20.definitio... |
gtoonstra/airflow | refs/heads/master | airflow/api/common/experimental/get_task.py | 18 | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
jianghuaw/nova | refs/heads/master | nova/objects/keypair.py | 2 | # Copyright 2013 IBM Corp.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... |
JustAkan/Oxygen_united_kernel-gproj-lollipop | refs/heads/cm-12.0 | tools/perf/scripts/python/sctop.py | 11180 | # system call top
# (c) 2010, Tom Zanussi <[email protected]>
# Licensed under the terms of the GNU GPL License version 2
#
# Periodically displays system-wide system call totals, broken down by
# syscall. If a [comm] arg is specified, only syscalls called by
# [comm] are displayed. If an [interval] arg is specified,... |
melon-li/openstack-dashboard | refs/heads/master | openstack_dashboard/dashboards/admin/volumes/volumes/urls.py | 24 | # 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 t... |
kvar/ansible | refs/heads/seas_master_2.9.5 | lib/ansible/modules/cloud/azure/azure_rm_autoscale_info.py | 20 | #!/usr/bin/python
#
# Copyright (c) 2017 Yuwei Zhou, <[email protected]>
#
# 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',
... |
pinkavaj/batch_isp | refs/heads/master | __main__.py | 1 | #!/usr/bin/python3
from batch_isp import BatchISP
if __name__ == '__main__':
batchISP = BatchISP()
exit(batchISP.run())
|
tarzan0820/odoo | refs/heads/8.0 | openerp/addons/test_documentation_examples/__openerp__.py | 344 | # -*- coding: utf-8 -*-
{
'name': "Documentation examples test",
'description': """
Contains pieces of code to be used as technical documentation examples
(via the ``literalinclude`` directive) in situations where they can be
syntax-checked and tested.
""",
'author': "Odoo",
'website': ... |
jaywreddy/django | refs/heads/master | tests/utils_tests/test_os_utils.py | 482 | import os
import unittest
from django.core.exceptions import SuspiciousFileOperation
from django.utils._os import safe_join
class SafeJoinTests(unittest.TestCase):
def test_base_path_ends_with_sep(self):
drive, path = os.path.splitdrive(safe_join("/abc/", "abc"))
self.assertEqual(
pat... |
bigdatauniversity/edx-platform | refs/heads/master | openedx/core/djangoapps/course_groups/management/commands/post_cohort_membership_fix.py | 64 | """
Intended to fix any inconsistencies that may arise during the rollout of the CohortMembership model.
Illustration: https://gist.github.com/efischer19/d62f8ee42b7fbfbc6c9a
"""
from django.core.management.base import BaseCommand
from django.db import IntegrityError
from openedx.core.djangoapps.course_groups.models i... |
amir-qayyum-khan/edx-platform | refs/heads/master | openedx/core/djangoapps/theming/tests/test_storage.py | 21 | """
Tests for comprehensive theme static files storage classes.
"""
import ddt
import unittest
import re
from mock import patch
from django.test import TestCase, override_settings
from django.conf import settings
from openedx.core.djangoapps.theming.helpers import get_theme_base_dirs, Theme, get_theme_base_dir
from ... |
ynvb/DIE | refs/heads/master | DIE/Lib/DataPluginBase.py | 1 |
import logging
from yapsy.PluginManager import IPlugin
from DIE.Lib.ParsedValue import ParsedValue
#from idaapi import *
import idaapi
from idautils import *
from idc import *
class DataPluginBase(IPlugin):
"""
DIE Data Parser plugin base class.
"""
name = ""
version = 0
description = ""
... |
ankeshanand/imgurpython | refs/heads/master | imgurpython/imgur/models/conversation.py | 22 | from .message import Message
class Conversation(object):
def __init__(self, conversation_id, last_message_preview, datetime, with_account_id, with_account, message_count, messages=None,
done=None, page=None):
self.id = conversation_id
self.last_message_preview = last_message_previ... |
40123247/w17 | refs/heads/master | static/Brython3.1.0-20150301-090019/Lib/multiprocessing/util.py | 696 | #
# Module providing various facilities to other parts of the package
#
# multiprocessing/util.py
#
# Copyright (c) 2006-2008, R Oudkerk
# Licensed to PSF under a Contributor Agreement.
#
import sys
import functools
import os
import itertools
import weakref
import atexit
import threading # we want threading to ... |
arista-eosplus/ansible | refs/heads/devel | test/runner/retry.py | 177 | #!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
"""Automatically retry failed commands."""
from __future__ import absolute_import, print_function
# noinspection PyCompatibility
import argparse
import errno
import os
import sys
import time
from lib.util import (
display,
raw_command,
ApplicationError,
A... |
wweiradio/django | refs/heads/master | tests/template_backends/apps/good/templatetags/subpackage/tags.py | 1426 | from django.template import Library
register = Library()
|
alphagov/digitalmarketplace-api | refs/heads/dependabot/pip/digitalmarketplace-apiclient-22.2.0 | tests/test_url_utils.py | 1 | from app.url_utils import force_relative_url
class TestForceRelativeURL(object):
def test_hostname_removed(self):
result = force_relative_url('http://hostname:port/', 'https://badhostname/plus/path?woo')
assert result == "plus/path?woo"
def test_additional_base_path_removed(self):
res... |
MihaiMoldovanu/ansible | refs/heads/devel | test/runner/lib/metadata.py | 21 | """Test metadata for passing data to delegated tests."""
from __future__ import absolute_import, print_function
import json
from lib.util import (
display,
is_shippable,
)
from lib.diff import (
parse_diff,
FileDiff,
)
class Metadata(object):
"""Metadata object for passing data to delegated tes... |
google/rekall | refs/heads/master | rekall-agent/rekall_agent/flows/collect.py | 1 | #!/usr/bin/env python2
# Rekall Memory Forensics
# Copyright 2016 Google Inc. All Rights Reserved.
#
# Author: Michael Cohen [email protected]
#
# 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... |
analyst-collective/dbt | refs/heads/experiment/typetag | test/integration/040_override_database_test/test_override_database.py | 1 | from test.integration.base import DBTIntegrationTest, use_profile
import os
class BaseOverrideDatabase(DBTIntegrationTest):
setup_alternate_db = True
@property
def schema(self):
return "override_database_040"
@property
def models(self):
return "models"
@property
def alte... |
CalthorpeAnalytics/urbanfootprint | refs/heads/master | footprint/main/resources/presentation_medium_resource.py | 1 |
# UrbanFootprint v1.5
# Copyright (C) 2017 Calthorpe Analytics
#
# This file is part of UrbanFootprint version 1.5
#
# UrbanFootprint is distributed under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation. This
# code is distributed WITHOUT ANY WARRANTY, without impl... |
jlepird/turing | refs/heads/master | student_code/Kyania/turing_machine.py | 3 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 18 10:28:35 2015
@author: Community Outreach
"""
import sys
sys.path.append("../")
from tmachine.VirtualHardware import VirtualHardware
tape = [None,1,1, None,1,1,1,1,1,1,1,None]
turing_machine = VirtualHardware(tape_length=1000, init=tape)
running = True
state = 0
whil... |
Jgarcia-IAS/SAT | refs/heads/master | openerp/addons/account/report/account_aged_partner_balance.py | 73 | # -*- 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... |
fperazzi/davis | refs/heads/master | python/experiments/eval_all.py | 1 | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# A Benchmark Dataset and Evaluation Methodology for Video Object Segmentation
#-----------------------------------------------------------------------------
# Copyright (c) 2016 Federico Perazzi
# Licensed under the B... |
antinet/cjdns | refs/heads/master | node_build/dependencies/libuv/build/gyp/test/actions/src/confirm-dep-files.py | 349 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""Confirms presence of files generated by our targets we depend on.
If they exist, create a new file.
Note target's input files are explic... |
murfz/Sick-Beard | refs/heads/development | cherrypy/process/win32.py | 39 | """Windows service. Requires pywin32."""
import os
import win32api
import win32con
import win32event
import win32service
import win32serviceutil
from cherrypy.process import wspbus, plugins
class ConsoleCtrlHandler(plugins.SimplePlugin):
"""A WSPBus plugin for handling Win32 console events (like Ctrl-C)."""
... |
AlanRosenthal/appinventor-sources | refs/heads/master | appinventor/lib/blockly/src/i18n/xliff_to_json.py | 80 | #!/usr/bin/python
# Converts .xlf files into .json files for use at http://translatewiki.net.
#
# Copyright 2013 Google Inc.
# https://blockly.googlecode.com/
#
# 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 o... |
tinkhaven-organization/odoo | refs/heads/8.0 | addons/account/wizard/account_open_closed_fiscalyear.py | 237 | # -*- 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... |
mmardini/django | refs/heads/master | django/contrib/gis/db/models/manager.py | 83 | from django.db.models.manager import Manager
from django.contrib.gis.db.models.query import GeoQuerySet
class GeoManager(Manager):
"Overrides Manager to return Geographic QuerySets."
# This manager should be used for queries on related fields
# so that geometry columns on Oracle and MySQL are selected
... |
longjon/numpy | refs/heads/master | numpy/linalg/lapack_lite/fortran.py | 132 | from __future__ import division, absolute_import, print_function
import re
import itertools
def isBlank(line):
return not line
def isLabel(line):
return line[0].isdigit()
def isComment(line):
return line[0] != ' '
def isContinuation(line):
return line[5] != ' '
COMMENT, STATEMENT, CONTINUATION = 0, 1... |
teoreteetik/api-snippets | refs/heads/master | rest/message/instance-get-example-1/instance-get-example-1.5.x.py | 1 | # Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient
# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)
message ... |
ARudiuk/mne-python | refs/heads/master | mne/io/bti/read.py | 8 | # Authors: Denis A. Engemann <[email protected]>
# simplified BSD-3 license
import numpy as np
def _unpack_matrix(fid, rows, cols, dtype, out_dtype):
""" Aux Function """
dtype = np.dtype(dtype)
string = fid.read(int(dtype.itemsize * rows * cols))
out = np.fromstring(string, dtype=d... |
mixman/djangodev | refs/heads/master | django/contrib/staticfiles/management/commands/findstatic.py | 244 | import os
from optparse import make_option
from django.core.management.base import LabelCommand
from django.utils.encoding import smart_str, smart_unicode
from django.contrib.staticfiles import finders
class Command(LabelCommand):
help = "Finds the absolute paths for the given static file(s)."
args = "[file .... |
fbossy/SickRage | refs/heads/master | sickbeard/metadata/tivo.py | 9 | # Author: Nic Wolfe <[email protected]>
# Author: Gordon Turner <[email protected]>
# URL: http://code.google.com/p/sickbeard/
#
# This file is part of SickRage.
#
# SickRage is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Fre... |
elgambitero/FreeCAD_sf_master | refs/heads/master | src/Mod/Assembly/InitGui.py | 19 | # Assembly gui init module
# (c) 2003 Juergen Riegel
#
# Gathering all the information to start FreeCAD
# This is the second one of three init scripts, the third one
# runs when the gui is up
#***************************************************************************
#* (c) Juergen Riegel (juergen.riegel@... |
JioCloud/nova | refs/heads/master | nova/tests/unit/virt/xenapi/test_vm_utils.py | 10 | # Copyright 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... |
ChrisCummins/clgen | refs/heads/master | deeplearning/clgen/preprocessors/clang.py | 1 | # Copyright (c) 2016-2020 Chris Cummins.
#
# clgen 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.
#
# clgen is distributed in the hope... |
TNT-Samuel/Coding-Projects | refs/heads/master | DNS Server/Source - Copy/Lib/site-packages/setuptools/_vendor/packaging/markers.py | 65 | # 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 operator
import os
import platform
import sys
from setuptools.exte... |
mrbox/django | refs/heads/master | tests/template_tests/filter_tests/test_stringformat.py | 345 | from django.template.defaultfilters import stringformat
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class StringformatTests(SimpleTestCase):
"""
Notice that escaping is applied *after* any filters, so the string
formatting here only needs... |
bigkevmcd/python-lucky | refs/heads/master | lucky/scripts.py | 1 | #!/usr/bin/env python
import argparse
import sys
import os
from os.path import abspath, join, dirname
from collections import namedtuple
# sys.path.insert(0, abspath(join(dirname(__file__), "..")))
from lucky.config import Config
from lucky.board import Boards
def pprinttable(rows, output=sys.stdout):
if len(ro... |
diwer/sublimeconfig | refs/heads/master | Packages/MarkdownEditing/underlined_headers.py | 2 | """Commands for working with with setext-style (underlined) Markdown headers.
Header dashes can be completed with <tab>. For example:
This is an H2
-<tab>
Becomes:
This is an H2
-------------
Inspired by the similar TextMate command.
Also adds "Fix Underlined Markdown Headers" to Tools > Command Palette. Afte... |
MountainWei/nova | refs/heads/master | nova/tests/unit/test_versions.py | 51 | # Copyright 2011 Ken Pepple
#
# 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... |
W4TCH0UT/kernel-msm-ghost | refs/heads/master | scripts/build-all.py | 1182 | #! /usr/bin/env python
# Copyright (c) 2009-2011, The Linux Foundation. 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
# ... |
axbaretto/beam | refs/heads/master | sdks/python/.tox/docs/lib/python2.7/site-packages/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py | 285 | """The match_hostname() function from Python 3.3.3, essential when using SSL."""
# Note: This file is under the PSF license as the code comes from the python
# stdlib. http://docs.python.org/3/license.html
import re
import sys
# ipaddress has been backported to 2.6+ in pypi. If it is installed on the
# system, us... |
kosz85/django | refs/heads/master | tests/update_only_fields/models.py | 71 |
from django.db import models
GENDER_CHOICES = (
('M', 'Male'),
('F', 'Female'),
)
class Account(models.Model):
num = models.IntegerField()
class Person(models.Model):
name = models.CharField(max_length=20)
gender = models.CharField(max_length=1, choices=GENDER_CHOICES)
pid = models.Integer... |
stonegithubs/odoo | refs/heads/8.0 | addons/purchase_requisition/purchase_requisition.py | 200 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# ... |
zhangjunlei26/servo | refs/heads/master | tests/wpt/css-tests/tools/runner/update_manifest.py | 316 | import imp
import json
import os
import sys
here = os.path.dirname(__file__)
localpaths = imp.load_source("localpaths", os.path.abspath(os.path.join(here, os.pardir, "localpaths.py")))
root = localpaths.repo_root
import manifest
def main(request, response):
path = os.path.join(root, "MANIFEST.json")
manifes... |
smi96/django-blog_website | refs/heads/master | lib/python2.7/site-packages/PIL/PcfFontFile.py | 72 | #
# THIS IS WORK IN PROGRESS
#
# The Python Imaging Library
# $Id$
#
# portable compiled font file parser
#
# history:
# 1997-08-19 fl created
# 2003-09-13 fl fixed loading of unicode fonts
#
# Copyright (c) 1997-2003 by Secret Labs AB.
# Copyright (c) 1997-2003 by Fredrik Lundh.
#
# See the README file for informa... |
letolab/cookiecutter | refs/heads/master | cookiecutter/config.py | 18 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
cookiecutter.config
-------------------
Global configuration handling
"""
from __future__ import unicode_literals
import copy
import logging
import os
import io
import yaml
from .exceptions import ConfigDoesNotExistException
from .exceptions import InvalidConfigura... |
gkc1000/pyscf | refs/heads/master | pyscf/nao/test/test_0061_gw_rescf_g0w0_h2o.py | 1 | from __future__ import print_function, division
import os,unittest,numpy as np
from pyscf.nao import gw as gw_c
class KnowValues(unittest.TestCase):
def test_rescf(self):
""" reSCF then G0W0 """
fc = \
"""-1.176137582599898090e+00
-6.697973984258517310e-01
-5.155143130039178123e-01
-4.36544872408... |
ntpwilliam/totravel | refs/heads/master | mysite/login_account.py | 1 | from django.http import HttpResponse
def user_list(request):
return HttpResponse("ha ha first Acconnt page") |
mhauskn/HFO | refs/heads/master | example/example_defense_agent.py | 2 | #!/usr/bin/env python
# encoding: utf-8
# Before running this program, first Start HFO server:
# $> ./bin/HFO --offense-agents 1
import itertools
from hfo import *
def main():
# Create the HFO Environment
hfo = HFOEnvironment()
# Connect to the server with the specified
# feature set. See feature sets in hfo... |
xrg/django-static-gitified | refs/heads/master | django/contrib/formtools/wizard/storage/session.py | 426 | from django.contrib.formtools.wizard import storage
class SessionStorage(storage.BaseStorage):
def __init__(self, *args, **kwargs):
super(SessionStorage, self).__init__(*args, **kwargs)
if self.prefix not in self.request.session:
self.init_data()
def _get_data(self):
self... |
SoSBallers/pogo-map | refs/heads/master | pogom/__init__.py | 27 | #!/usr/bin/python
# -*- coding: utf-8 -*-
config = {
'LOCALE': 'en',
'LOCALES_DIR': 'static/locales',
'ROOT_PATH': None,
'ORIGINAL_LATITUDE': None,
'ORIGINAL_LONGITUDE': None,
'GMAPS_KEY': None,
'REQ_SLEEP': 1,
'REQ_HEAVY_SLEEP': 30,
'REQ_MAX_FAILED': 5
}
|
msanterre/deep_learning | refs/heads/master | tv-script-generation/helper.py | 175 | import os
import pickle
def load_data(path):
"""
Load Dataset from File
"""
input_file = os.path.join(path)
with open(input_file, "r") as f:
data = f.read()
return data
def preprocess_and_save_data(dataset_path, token_lookup, create_lookup_tables):
"""
Preprocess Text Data
... |
mindnervestech/mnrp | refs/heads/master | openerp/addons/base/ir/ir_http.py | 27 | #----------------------------------------------------------
# ir_http modular http routing
#----------------------------------------------------------
import logging
import re
import sys
import werkzeug.exceptions
import werkzeug.routing
import werkzeug.urls
import werkzeug.utils
import openerp
import openerp.excepti... |
virtualanup/hal | refs/heads/master | tests/libtest.py | 1 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import unicode_literals
from hal.library import HalLibrary
import unittest
class HalLibTest(unittest.TestCase):
"""
Base class for testing hal libraries
"""
def assert_successful_response(self, command):
a = self... |
Jeff-Tian/mybnb | refs/heads/master | Python27/Lib/encodings/iso8859_7.py | 93 | """ Python Character Mapping Codec iso8859_7 generated from 'MAPPINGS/ISO8859/8859-7.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,i... |
Tendrl/commons | refs/heads/master | setup.py | 1 | import re
import subprocess
from setuptools import Command
from setuptools import find_packages
from setuptools import setup
try:
# Python 2 backwards compat
from __builtin__ import raw_input as input
except ImportError:
pass
def read_module_contents():
with open('version.py') as app_init:
r... |
bn1/python-apify | refs/heads/master | tests/test_apify.py | 1 | import os
import pytest
from httmock import HTTMock, all_requests
from apify import KeyValueStore
@all_requests
def mock_page_store(url, request):
path = (os.path.dirname(os.path.realpath(__file__)) +
"/data" + url.path + '.json')
with open(path, "r") as fo:
return fo.read()
def test_in... |
mustafat/odoo-1 | refs/heads/8.0 | addons/mass_mailing/models/mass_mailing_report.py | 364 | # -*- coding: utf-8 -*-
from openerp.osv import fields, osv
from openerp import tools
class MassMailingReport(osv.Model):
_name = 'mail.statistics.report'
_auto = False
_description = 'Mass Mailing Statistics'
_columns = {
'scheduled_date': fields.datetime('Scheduled Date', readonly=True),
... |
lmprice/ansible | refs/heads/devel | lib/ansible/modules/cloud/google/gcpubsub_facts.py | 95 | #!/usr/bin/python
# Copyright 2016 Google Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... |
CatsAndDogsbvba/odoo | refs/heads/8.0 | addons/hw_screen/__openerp__.py | 25 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2015 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
arpitar/osf.io | refs/heads/develop | scripts/populate_conferences.py | 3 | #!/usr/bin/env python
# encoding: utf-8
import os
from modularodm import Q
from modularodm.exceptions import ModularOdmException
from framework.auth.core import User
from website import settings
from website.app import init_app
from website.conferences.model import Conference
def main():
init_app(set_backends... |
WeichenXu123/spark | refs/heads/master | examples/src/main/python/ml/one_vs_rest_example.py | 52 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.