repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
mcanthony/nupic | refs/heads/master | src/nupic/support/enum.py | 26 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... |
sebadiaz/rethinkdb | refs/heads/next | external/v8_3.30.33.16/tools/js2c.py | 36 | #!/usr/bin/env python
#
# Copyright 2012 the V8 project authors. 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
# noti... |
eoyilmaz/anima | refs/heads/master | anima/ui/progress_dialog.py | 1 | # -*- coding: utf-8 -*-
from anima.base import Singleton
class ProgressCaller(object):
"""A simple object to hold caller data for ProgressDialogManager
"""
def __init__(self, max_steps=0, title=''):
self.max_steps = max_steps
self.title = title
self.current_step = 0
self.... |
apocalypsebg/odoo | refs/heads/8.0 | addons/website_mail_group/controllers/main.py | 306 | # -*- coding: utf-8 -*-
import datetime
from dateutil import relativedelta
from openerp import tools, SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.website.models.website import slug
from openerp.addons.web.http import request
class MailGroup(http.Controller):
_thread_per_page = 20
_r... |
vinnyrose/django-constance | refs/heads/master | tests/test_admin.py | 8 | from django.contrib import admin
from django.contrib.auth.models import User, Permission
from django.core.exceptions import PermissionDenied
from django.test import TestCase, RequestFactory
from constance.admin import settings, Config
class TestAdmin(TestCase):
model = Config
def setUp(self):
super(... |
rmbq/caf_msm-3.10 | refs/heads/LA.BF.2.1.2_rb1.5 | scripts/tracing/draw_functrace.py | 14679 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... |
esikachev/scenario | refs/heads/test_cases | sahara/plugins/vanilla/hadoop2/config.py | 1 | # Copyright (c) 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 required by applicable law or agreed to in writ... |
Dapid/scipy | refs/heads/master | scipy/special/add_newdocs.py | 8 | # Docstrings for generated ufuncs
#
# The syntax is designed to look like the function add_newdoc is being
# called from numpy.lib, but in this file add_newdoc puts the
# docstrings in a dictionary. This dictionary is used in
# generate_ufuncs.py to generate the docstrings for the ufuncs in
# scipy.special at the C lev... |
kurin/py-raft | refs/heads/master | raft/client.py | 1 | from __future__ import print_function
import uuid
import msgpack
import raft.tcp as tcp
class NoConnection(Exception):
pass
class RaftClient(object):
def __init__(self, server):
self.tcp = tcp.TCP(0, 'client')
self.tcp.start()
self.msgs = {}
self.tcp.connect(server)
... |
171121130/SWI | refs/heads/master | venv/Lib/site-packages/pip/_vendor/packaging/version.py | 1151 | # 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 collections
import itertools
import re
from ._structures import In... |
angel511wong/nixysa | refs/heads/master | third_party/ply-3.1/ply/lex.py | 16 | # -----------------------------------------------------------------------------
# ply: lex.py
#
# Author: David M. Beazley (dave@dabeaz.com)
#
# Copyright (C) 2001-2009, David M. Beazley
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# Lice... |
Morgan-Stanley/treadmill | refs/heads/master | lib/python/treadmill/supervisor/winss/scan_dir.py | 3 | """winss service directory management.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import logging
import os
from . import services
from .. import _scan_dir_base
from .. import _utils
_LOGGER = logging.getLog... |
CopeX/odoo | refs/heads/8.0 | addons/auth_openid/utils.py | 428 | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010-2012 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General P... |
karan1276/servo | refs/heads/master | components/script/dom/bindings/codegen/parser/tests/test_callback.py | 126 | import WebIDL
def WebIDLTest(parser, harness):
parser.parse("""
interface TestCallback {
attribute CallbackType? listener;
};
callback CallbackType = boolean (unsigned long arg);
""")
results = parser.finish()
harness.ok(True, "TestCallback interface parsed without ... |
CiscoSystems/quantum | refs/heads/master | neutron/plugins/nec/common/config.py | 3 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 NEC Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.or... |
joshloyal/scikit-learn | refs/heads/master | sklearn/manifold/tests/test_t_sne.py | 28 | import sys
from sklearn.externals.six.moves import cStringIO as StringIO
import numpy as np
import scipy.sparse as sp
from sklearn.neighbors import BallTree
from sklearn.utils.testing import assert_less_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_almost_equal
from skle... |
tersmitten/ansible | refs/heads/devel | test/units/parsing/test_metadata.py | 125 | # coding: utf-8
# (c) 2017, Toshio Kuratomi <tkuratomi@ansible.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
# (at your o... |
markYoungH/chromium.src | refs/heads/nw12 | mojo/public/tools/bindings/pylib/mojom_tests/parse/run_parser.py | 99 | #!/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.
"""Simple testing utility to just run the mojom parser."""
import os.path
import sys
sys.path.insert(0, os.path.join(os.path.dirname... |
opensourcechipspark/platform_external_chromium_org | refs/heads/master | third_party/tlslite/tlslite/__init__.py | 409 | """
TLS Lite is a free python library that implements SSL v3, TLS v1, and
TLS v1.1. TLS Lite supports non-traditional authentication methods
such as SRP, shared keys, and cryptoIDs, in addition to X.509
certificates. TLS Lite is pure python, however it can access OpenSSL,
cryptlib, pycrypto, and GMPY for faster crypt... |
robertwb/incubator-beam | refs/heads/master | sdks/python/apache_beam/testing/benchmarks/chicago_taxi/trainer/task.py | 5 | # Copyright 2019 Google LLC. 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... |
Moriadry/tensorflow | refs/heads/master | tensorflow/contrib/boosted_trees/python/utils/losses.py | 21 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
britcey/ansible | refs/heads/devel | lib/ansible/modules/cloud/openstack/os_zone.py | 22 | #!/usr/bin/python
# Copyright (c) 2016 Hewlett-Packard Enterprise
#
# This module 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.
#
# T... |
signed/intellij-community | refs/heads/master | python/lib/Lib/htmlentitydefs.py | 390 | """HTML character entity references."""
# maps the HTML entity name to the Unicode codepoint
name2codepoint = {
'AElig': 0x00c6, # latin capital letter AE = latin capital ligature AE, U+00C6 ISOlat1
'Aacute': 0x00c1, # latin capital letter A with acute, U+00C1 ISOlat1
'Acirc': 0x00c2, # latin capit... |
stutivarshney/Bal-Aveksha | refs/heads/master | WebServer/BalAvekshaEnv/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/hebrewprober.py | 2928 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Shy Shalom
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#... |
MikeOfNoTrades/netmiko | refs/heads/master | examples/scp_example.py | 18 | #!/usr/bin/env python
'''
Cisco IOS only
Requires scp https://github.com/jbardin/scp.py
'''
from netmiko import ConnectHandler, SCPConn
from SECRET_DEVICE_CREDS import cisco_881
def main():
'''
SCP transfer cisco_logging.txt to network device
Use ssh_conn as ssh channel into network device
scp_conn ... |
qedi-r/home-assistant | refs/heads/dev | tests/components/radarr/__init__.py | 36 | """Tests for the radarr component."""
|
linvictor88/vse-lbaas-driver | refs/heads/master | quantum/tests/unit/mlnx/__init__.py | 139 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2013 Mellanox Technologies, Ltd
#
# 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
#
#... |
jnerin/ansible | refs/heads/devel | lib/ansible/modules/network/nxos/_nxos_portchannel.py | 8 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... |
martinogden/djangae | refs/heads/master | djangae/db/caching.py | 6 | from google.appengine.api import datastore
from djangae.db.backends.appengine import caching, context
class DisableCache(object):
"""
Decorator and context manager for disabling the caches,
passing no args disables everything, but you can pass
memcache=False or context=False to only disab... |
burdell/CS4464-Final-Project | refs/heads/master | django/core/exceptions.py | 292 | """
Global Django exception and warning classes.
"""
class DjangoRuntimeWarning(RuntimeWarning):
pass
class ObjectDoesNotExist(Exception):
"The requested object does not exist"
silent_variable_failure = True
class MultipleObjectsReturned(Exception):
"The query returned multiple objects when only one w... |
luoyetx/mxnet | refs/heads/master | example/numpy-ops/custom_softmax_rtc.py | 19 | # 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... |
tgerla/ansible | refs/heads/devel | lib/ansible/plugins/lookup/url.py | 95 | # (c) 2015, Brian Coca <bcoca@ansible.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
# (at your option) any later version.... |
angadpc/Alexa-Project- | refs/heads/master | requests/packages/urllib3/util/retry.py | 86 | from __future__ import absolute_import
import time
import logging
from collections import namedtuple
from itertools import takewhile
import email
import re
from ..exceptions import (
ConnectTimeoutError,
MaxRetryError,
ProtocolError,
ReadTimeoutError,
ResponseError,
InvalidHeader,
)
from ..pack... |
rickerc/heat_audit | refs/heads/cis-havana-staging | heat/tests/test_autoscaling.py | 3 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# 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... |
spennihana/h2o-3 | refs/heads/master | h2o-py/tests/testdir_munging/pyunit_entropy.py | 7 | import sys
sys.path.insert(1,"../../")
import h2o
from tests import pyunit_utils
def entropy_check():
for parse_type in ('string', 'enum'):
frame = h2o.H2OFrame.from_python(["redrum"], column_types=[parse_type])
g = frame.entropy()
assert abs(g[0,0] - 2.25162916739) < 1e-6
#test NA values
string ... |
40223144/2015cdafinal | refs/heads/master | static/Brython3.1.0-20150301-090019/Lib/_socket.py | 742 | """Implementation module for socket operations.
See the socket module for documentation."""
AF_APPLETALK = 16
AF_DECnet = 12
AF_INET = 2
AF_INET6 = 23
AF_IPX = 6
AF_IRDA = 26
AF_SNA = 11
AF_UNSPEC = 0
AI_ADDRCONFIG = 1024
AI_ALL = 256
AI_CANONNAME = 2
AI_NUMERICHOST = 4
AI_NUMERICSERV = 8
AI_PASSIVE = 1... |
timm/timmnix | refs/heads/master | pypy3-v5.5.0-linux64/lib-python/3/ctypes/test/test_arrays.py | 1 | import unittest
from ctypes import *
from test.support import impl_detail
formats = "bBhHiIlLqQfd"
# c_longdouble commented out for PyPy, look at the commend in test_longdouble
formats = c_byte, c_ubyte, c_short, c_ushort, c_int, c_uint, \
c_long, c_ulonglong, c_float, c_double #, c_longdouble
class ArrayT... |
jounex/hue | refs/heads/master | desktop/libs/libzookeeper/setup.py | 30 | # Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... |
vlinhd11/vlinhd11-android-scripting | refs/heads/master | python-build/python-libs/gdata/samples/oauth/oauth_on_appengine/appengine_utilities/cron.py | 129 | """
Copyright (c) 2008, appengine-utilities project
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 ... |
Ch00k/ansible | refs/heads/devel | lib/ansible/playbook/vars.py | 7690 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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
# (at your option) an... |
pombredanne/click | refs/heads/master | tests/conftest.py | 50 | from click.testing import CliRunner
import pytest
@pytest.fixture(scope='function')
def runner(request):
return CliRunner()
|
martinghunt/Scaffolder-evaluation | refs/heads/master | Analysis-scripts/scaff_test_ctg_to_perfect_ctg.py | 1 | #!/usr/bin/env python3
import argparse
import os
import copy
import shutil
import sys
from pyfastaq import sequences, utils, intervals, tasks
# check required nucmer programs are in path
progs = ['nucmer', 'delta-filter', 'show-coords']
not_in_path = [p for p in progs if shutil.which(p) is None]
if len(not_in_p... |
huylu/support-tools | refs/heads/master | googlecode-issues-exporter/github_issue_converter.py | 4 | # Copyright 2013 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 a... |
Echelon85/volatility | refs/heads/master | volatility/plugins/linux/psxview.py | 44 | # Volatility
# Copyright (C) 2007-2013 Volatility Foundation
# Copyright (c) 2010, 2011, 2012 Michael Ligh <michael.ligh@mnin.org>
#
# This file is part of Volatility.
#
# Volatility 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... |
tectronics/cortex-vfx | refs/heads/master | test/IECore/CachedReader.py | 5 | ##########################################################################
#
# Copyright (c) 2007-2011, Image Engine Design 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:
#
# * Redis... |
macs03/demo-cms | refs/heads/master | cms/lib/python2.7/site-packages/cms/tests/frontend.py | 12 | # -*- coding: utf-8 -*-
import sys
import datetime
import os
import time
from django.contrib.auth.models import Permission
from django.contrib.sites.models import Site
from django.core.cache import cache
from django.core.urlresolvers import clear_url_caches
from django.test import LiveServerTestCase
from django.utils ... |
kevclarx/ansible | refs/heads/devel | lib/ansible/modules/monitoring/logicmonitor_facts.py | 9 | #!/usr/bin/python
# LogicMonitor Ansible module for managing Collectors, Hosts and Hostgroups
# Copyright (C) 2015 LogicMonitor
#
# 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... |
luwei0917/awsemmd_script | refs/heads/master | archive/tensorFlow_next_gen.py | 1 | # Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appl... |
gitprouser/appengine-bottle-skeleton | refs/heads/master | lib/bs4/builder/_htmlparser.py | 41 | """Use the HTMLParser library to parse HTML files that aren't too bad."""
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
__all__ = [
'HTMLParserTreeBuilder',
]
from HTMLParser import HTMLParser
try:
from HTMLParser import HTMLParseError
except Impor... |
omco/geode | refs/heads/windows_vs2015 | geode/geometry/test_offset.py | 2 | #!/usr/bin/env python
from __future__ import division
from geode.geometry.platonic import *
from geode.vector import *
def test_offset():
random.seed(8123171)
offset = .1
alpha = 1/4
small = 1e-8
def single():
return TriangleSoup([(0,1,2)]),[(0,0,0),(1,0,0),(0,1,0)]
for name,(m,X) in ('single',single(... |
MarvinCorro/linux-cmps107 | refs/heads/master | scripts/tracing/draw_functrace.py | 14679 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... |
novic/AniDroid-JB-N7000-Kernel | refs/heads/master | scripts/tracing/draw_functrace.py | 14679 | #!/usr/bin/python
"""
Copyright 2008 (c) Frederic Weisbecker <fweisbec@gmail.com>
Licensed under the terms of the GNU GPL License version 2
This script parses a trace provided by the function tracer in
kernel/trace/trace_functions.c
The resulted trace is processed into a tree to produce a more human
view of the call ... |
rossnomann/playlog | refs/heads/master | tests/src/tests/library/test_overview.py | 1 | from datetime import date, timedelta
from tests.client import get
from tests.fixtures import fixture, refresh_db
def get_data():
return get('overview')
AVATAR_SRC = 'http://www.gravatar.com/avatar/9a22d09f92d50fa3d2a16766d0ba52f8?s=64'
USER_NAME = 'Fabien Potencier'
def test_without_data():
refresh_db()
... |
ArcherCraftStore/ArcherVMPeridot | refs/heads/master | Python/Lib/test/test_smtpnet.py | 12 | import unittest
from test import support
import smtplib
import socket
ssl = support.import_module("ssl")
support.requires("network")
def check_ssl_verifiy(host, port):
context = ssl.create_default_context()
with socket.create_connection((host, port)) as sock:
try:
sock = context.wrap_sock... |
ortoo/schooldata | refs/heads/master | dfe_data.py | 1 | import requests
import csv
import io
from datetime import datetime
DFE_DATA_URL = 'https://www.compare-school-performance.service.gov.uk/download-school-data'
def get_raw_dfe_data(school):
payload = {
'urn': school.urn
}
req = requests.get(DFE_DATA_URL, params=payload)
return req.text
def parse_dfe_data... |
xzturn/tensorflow | refs/heads/master | tensorflow/python/autograph/pyct/static_analysis/activity_py3_test.py | 8 | # python3
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... |
harshilasu/GraphicMelon | refs/heads/master | y/google-cloud-sdk/platform/gsutil/third_party/boto/tests/integration/sts/test_cert_verification.py | 126 | # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 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 withou... |
rh-lab-q/rpg | refs/heads/master | rpg/__init__.py | 3 | import logging
from pathlib import Path
from rpg.plugin_engine import PluginEngine
from rpg.plugins.misc.files_to_pkgs import FilesToPkgsPlugin
from rpg.project_builder import ProjectBuilder
from copr.client import CoprClient
from rpg.package_builder import PackageBuilder, BuildException
from rpg.spec import Spec
from ... |
jfrank1500/minicurso_2015 | refs/heads/master | bin/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py | 2779 | # 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.
"""gypsh output module
gypsh is a GYP shell. It's not really a generator per se. All it does is
fire up an interactive Python session with a few local variables... |
tneumann/splocs | refs/heads/master | import_ply.py | 1 | import argparse
from inout import convert_sequence_to_hdf5, load_ply
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Import a sequence of PLY files and convert to HDF5 file format')
parser.add_argument('input_filename_pattern',
help='Input filename pat... |
ychen820/microblog | refs/heads/master | y/google-cloud-sdk/platform/google_appengine/lib/django-1.4/django/utils/timezone.py | 81 | """Timezone helper functions.
This module uses pytz when it's available and fallbacks when it isn't.
"""
from datetime import datetime, timedelta, tzinfo
from threading import local
import time as _time
try:
import pytz
except ImportError:
pytz = None
from django.conf import settings
__all__ = [
'utc',... |
michaelgallacher/intellij-community | refs/heads/master | python/testData/findUsages/ClassUsages.py | 83 | class C<caret>ow:
def __init__(self):
pass
c = Cow()
|
SimonSapin/pycairo | refs/heads/master | examples/gtk/cairo-demo.py | 14 | #!/usr/bin/env python
"""Based on cairo-demo/X11/cairo-demo.c
"""
import cairo
import gtk
SIZE = 30
def triangle(ctx):
ctx.move_to(SIZE, 0)
ctx.rel_line_to(SIZE, 2*SIZE)
ctx.rel_line_to(-2*SIZE, 0)
ctx.close_path()
def square(ctx):
ctx.move_to(0, 0)
ctx.rel_line_to(2*SIZE, 0)
ctx.rel_line... |
eayunstack/fuel-ostf | refs/heads/master | fuel_health/cleanup.py | 1 | #!/usr/bin/env python
# Copyright 2013 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 required by applicable law or a... |
danielbruns-wf/rockstar | refs/heads/master | examples/dart_rockstar.py | 22 | from rockstar import RockStar
dart_code = "main() { print('Hello Word'); }"
rock_it_bro = RockStar(days=400, file_name='helloWorld.dart', code=dart_code)
rock_it_bro.make_me_a_rockstar()
|
mne-tools/mne-tools.github.io | refs/heads/main | 0.15/_downloads/plot_mne_inverse_psi_visual.py | 1 | """
=====================================================================
Compute Phase Slope Index (PSI) in source space for a visual stimulus
=====================================================================
This example demonstrates how the Phase Slope Index (PSI) [1]_ can be computed
in source space based on s... |
embest-tech/rowboat-external-wpa_supplicant_8 | refs/heads/TIOP-rowboat-ics | wpa_supplicant/examples/wpas-dbus-new-wps.py | 114 | #!/usr/bin/python
import dbus
import sys, os
import time
import gobject
from dbus.mainloop.glib import DBusGMainLoop
WPAS_DBUS_SERVICE = "fi.w1.wpa_supplicant1"
WPAS_DBUS_INTERFACE = "fi.w1.wpa_supplicant1"
WPAS_DBUS_OPATH = "/fi/w1/wpa_supplicant1"
WPAS_DBUS_INTERFACES_INTERFACE = "fi.w1.wpa_supplicant1.Interface"
... |
daGrevis/daGrevis.lv | refs/heads/master | dagrevis_lv/core/context_processors.py | 1 | from django.conf import settings as project_settings
def settings(request):
return {"settings": project_settings}
|
neharejanjeva/techstitution | refs/heads/master | app/logs/venv/lib/python2.7/site-packages/pip/_vendor/requests/certs.py | 516 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
requests.certs
~~~~~~~~~~~~~~
This module returns the preferred default CA certificate bundle.
If you are packaging Requests, e.g., for a Linux distribution or a managed
environment, you can change the definition of where() to return a separately
packaged CA bundle.
... |
nightjean/Deep-Learning | refs/heads/master | tensorflow/contrib/rnn/python/kernel_tests/rnn_cell_test.py | 20 | # 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... |
Cnidarias/al-go-rithms | refs/heads/master | greedy/dijkstra_shortest_path/dijkstra_shortest_path.py | 3 |
def dijkstra(graph, source):
vertices, edges = graph
dist = dict()
previous = dict()
for vertex in vertices:
dist[vertex] = float("inf")
previous[vertex] = None
dist[source] = 0
Q = set(vertices)
while len(Q) > 0:
u = minimum_distance(dist, Q)
print('Curr... |
rizumu/django | refs/heads/master | django/contrib/admin/models.py | 184 | from __future__ import unicode_literals
from django.conf import settings
from django.contrib.admin.utils import quote
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import NoReverseMatch, reverse
from django.db import models
from django.utils import timezone
from django.utils.... |
khkaminska/bokeh | refs/heads/master | examples/interactions/us_marriages_divorces/us_marriages_divorces_interactive.py | 26 | # coding: utf-8
# Plotting U.S. marriage and divorce statistics
#
# Example code by Randal S. Olson (http://www.randalolson.com)
from bokeh.plotting import figure, show, output_file, ColumnDataSource
from bokeh.models import HoverTool, NumeralTickFormatter
from bokeh.models import SingleIntervalTicker, LinearAxis
imp... |
Just-D/chromium-1 | refs/heads/master | tools/telemetry/third_party/gsutilz/third_party/boto/boto/s3/key.py | 72 | # Copyright (c) 2006-2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2011, Nexenta Systems Inc.
# Copyright (c) 2012 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... |
krieger-od/nwjs_chromium.src | refs/heads/master | tools/telemetry/telemetry/util/statistics.py | 35 | # 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.
"""A collection of statistical utility functions to be used by metrics."""
import math
def Clamp(value, low=0.0, high=1.0):
"""Clamp a value between som... |
Nu3001/external_chromium_org | refs/heads/master | tools/mac/symbolicate_crash.py | 178 | #!/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.
"""
This script can take an Apple-style CrashReporter log and symbolicate it. This
is useful for when a user's reports aren't being... |
rmehta/erpnext | refs/heads/develop | erpnext/stock/report/stock_balance/stock_balance.py | 6 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import flt, cint, getdate
def execute(filters=None):
if not filters: filters = {}
validate_filt... |
consulo/consulo-python | refs/heads/master | plugin/src/main/dist/helpers/py3only/docutils/transforms/peps.py | 44 | # $Id: peps.py 6433 2010-09-28 08:21:25Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Transforms for PEP processing.
- `Headers`: Used to transform a PEP's initial RFC-2822 header. It remains a
field list, but some entries get processed.
- ... |
BBELAOUCHA/dMRIParcellation | refs/heads/master | MNNparcellation/inc/__init__.py | 1 |
"""include files for MNNParcellation
"""
from .CSParcellation import Parcellation
from .Prepare_tractogram import Parcellation_data
from .Python2Vtk import ReadVtk2Python, WritePython2Vtk
from .Region_preparation import Mesh, Regions_processing
from .Similarity_Measures import Correlation_SM, Ruzicka_SM, Cosine_SM
fr... |
leture/Misago | refs/heads/master | misago/users/views/auth.py | 4 | from django.conf import settings
from django.contrib import auth
from django.shortcuts import redirect
from django.utils.http import is_safe_url
from django.utils.six.moves.urllib.parse import urlparse
from django.views.decorators.cache import never_cache
from django.views.decorators.csrf import csrf_protect
from djan... |
DarioIriberri/MyriadSwitcher | refs/heads/master | src/difficulty/sources/P2pool.py | 1 | __author__ = 'Dario'
from DataSource import DataSource
URL_DIFFICULTIES = "http://myriad.p2pool.geek.nz/api/network.php"
class P2pool(DataSource):
def __init__(self, parent, queue, timeout):
DataSource.__init__(self, parent, queue, timeout)
self.objDiff = None
def fetchDifficulties(self):
... |
trunca/enigma2 | refs/heads/6.5 | lib/python/Components/Renderer/SingleEpgList.py | 49 | from Components.VariableText import VariableText
from enigma import eLabel, eEPGCache
from Renderer import Renderer
from time import localtime
class SingleEpgList(Renderer, VariableText):
def __init__(self):
Renderer.__init__(self)
VariableText.__init__(self)
self.epgcache = eEPGCache.getInstance()
GUI_WIDG... |
msdx321/android_kernel_samsung_heroXqltechn | refs/heads/tw-6.0 | lazy-prebuilt/aarch64-linux-android-4.9/share/gdb/python/gdb/__init__.py | 83 | # Copyright (C) 2010-2014 Free Software Foundation, 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 progr... |
tallypokemap/PokeAlarm | refs/heads/local | PokeAlarm/Alarm.py | 1 | # Standard Library Imports
import time
import traceback
# 3rd Party Imports
# Local Imports
##################################################### ATTENTION! #####################################################
# You DO NOT NEED to edit this file to customize messages for services! Please see the Wiki on the correct... |
dkubiak789/odoo | refs/heads/8.0 | addons/product/report/product_pricelist.py | 341 | # -*- 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... |
acemgaming/iotvision_final | refs/heads/master | Webserver/node_modules/socket.io/node_modules/socket.io-client/node_modules/engine.io-client/node_modules/engine.io-parser/node_modules/utf8/tests/generate-test-data.py | 1788 | #!/usr/bin/env python
import re
import json
# https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
# http://stackoverflow.com/a/13436167/96656
def unisymbol(codePoint):
if codePoint >= 0x0000 and codePoint <= 0xFFFF:
return unichr(codePoint)
elif codePoint >= 0x010000 and codePoint <= 0x10FFFF:
... |
funtoo/portage-funtoo | refs/heads/2013-06-07 | pym/portage/util/_eventloop/PollSelectAdapter.py | 4 | # Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from .PollConstants import PollConstants
import select
class PollSelectAdapter(object):
"""
Use select to emulate a poll object, for
systems that don't support poll().
"""
def __init__(self):
self._regi... |
ArcEye/MK-Qt5 | refs/heads/master | nosetests/test_netcmd.py | 11 | #!/usr/bin/env python
from nose import with_setup
from machinekit.nosetests.realtime import setup_module,teardown_module
from machinekit.nosetests.support import fnear
from machinekit.nosetests.rtapilog import Log
from machinekit import hal,rtapi
import os
l = Log(level=rtapi.MSG_INFO,tag="nosetest")
def test_co... |
h2educ/scikit-learn | refs/heads/master | sklearn/utils/metaestimators.py | 283 | """Utilities for meta-estimators"""
# Author: Joel Nothman
# Andreas Mueller
# Licence: BSD
from operator import attrgetter
from functools import update_wrapper
__all__ = ['if_delegate_has_method']
class _IffHasAttrDescriptor(object):
"""Implements a conditional property using the descriptor protocol.
... |
rickerc/neutron_audit | refs/heads/cis-havana-staging | neutron/agent/rpc.py | 16 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 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.... |
Bachaco-ve/odoo | refs/heads/8.0 | addons/hr_contract/hr_contract.py | 302 | # -*- 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... |
YOTOV-LIMITED/kuma | refs/heads/master | vendor/packages/translate/lang/es.py | 26 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2007 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 t... |
jmartinm/invenio | refs/heads/master | modules/webjournal/lib/webjournal_web_tests.py | 27 | # -*- coding: utf-8 -*-
## This file is part of Invenio.
## Copyright (C) 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 option) any... |
colinsullivan/AuditionManager | refs/heads/master | auditionapp/auditions/tests.py | 1940 | """
This file demonstrates two different styles of tests (one doctest and one
unittest). These will both pass when you run "manage.py test".
Replace these with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
... |
scorphus/django | refs/heads/master | tests/template_tests/filter_tests/test_truncatechars.py | 428 | from django.test import SimpleTestCase
from ..utils import setup
class TruncatecharsTests(SimpleTestCase):
@setup({'truncatechars01': '{{ a|truncatechars:5 }}'})
def test_truncatechars01(self):
output = self.engine.render_to_string('truncatechars01', {'a': 'Testing, testing'})
self.assertEqu... |
ScreamingUdder/mantid | refs/heads/master | scripts/Inelastic/IndirectCommon.py | 1 | # pylint: disable=invalid-name,redefined-builtin
from __future__ import (absolute_import, division, print_function)
from six.moves import range
import mantid.simpleapi as s_api
from mantid import config, logger
import os.path
import math
import datetime
import re
import numpy as np
def StartTime(prog):
logger.n... |
paolodedios/tensorflow | refs/heads/master | tensorflow/python/data/kernel_tests/range_test.py | 5 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... |
martinrusev/amonone | refs/heads/master | amon/apps/healthchecks/tests/models_test.py | 2 | import unittest
import hashlib
from datetime import datetime
from amon.apps.healthchecks.models import (
health_checks_model,
health_checks_results_model,
health_checks_api_model
)
from amon.apps.servers.models import server_model
from amon.utils.dates import unix_utc_now
class HealthChecksResultsMode... |
colinnewell/odoo | refs/heads/8.0 | addons/website_project/__init__.py | 409 | import models
import controllers |
lunyang/Data-Science-45min-Intros | refs/heads/master | python-unittest-101/mathy.py | 30 | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
__author__="Josh Montague"
__license__="MIT License"
class Calcs(object):
"""
Objects of type Calcs have two methods for numerical calculations, and
an attribute of 'zero' which is set to 0
"""
def __init__(self):
self.zero = 0
def add_o... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.