repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
jbonofre/beam | refs/heads/master | sdks/python/apache_beam/examples/complete/estimate_pi.py | 7 | # -*- 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 "L... |
thyyks/node-gyp | refs/heads/master | gyp/pylib/gyp/MSVSUserFile.py | 2710 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio user preferences file writer."""
import os
import re
import socket # for gethostname
import gyp.common
import gyp.easy_xml as easy_xml
#------... |
wy1iu/sphereface | refs/heads/master | tools/caffe-sphereface/src/caffe/test/test_data/generate_sample_data.py | 38 | """
Generate data used in the HDF5DataLayer and GradientBasedSolver tests.
"""
import os
import numpy as np
import h5py
script_dir = os.path.dirname(os.path.abspath(__file__))
# Generate HDF5DataLayer sample_data.h5
num_cols = 8
num_rows = 10
height = 6
width = 5
total_size = num_cols * num_rows * height * width
da... |
tojon/treeherder | refs/heads/master | treeherder/webapp/api/push.py | 3 | import datetime
from rest_framework import viewsets
from rest_framework.decorators import detail_route
from rest_framework.exceptions import ParseError
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.status import (HTTP_400_BAD_REQUEST,
... |
edx/lettuce | refs/heads/master | tests/integration/lib/Django-1.3/django/core/serializers/json.py | 204 | """
Serialize data to/from JSON
"""
import datetime
import decimal
from StringIO import StringIO
from django.core.serializers.python import Serializer as PythonSerializer
from django.core.serializers.python import Deserializer as PythonDeserializer
from django.utils import datetime_safe
from django.utils import simpl... |
citrix-openstack-build/neutron | refs/heads/master | neutron/plugins/cisco/common/cisco_credentials_v2.py | 4 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 Cisco Systems, 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... |
jigarkb/CTCI | refs/heads/master | LeetCode/002-M-AddTwoNumbers.py | 2 | # You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse
# order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
#
# You may assume the two numbers do not contain any leading zero, except the number 0 itself.
... |
furf/pledge_service | refs/heads/master | testlib/waitress/tests/fixtureapps/sleepy.py | 40 | import time
def app(environ, start_response): # pragma: no cover
if environ['PATH_INFO'] == '/sleepy':
time.sleep(2)
body = b'sleepy returned'
else:
body = b'notsleepy returned'
cl = str(len(body))
start_response(
'200 OK',
[('Content-Length', cl), ('Content-Type... |
hansenmakangiras/disperindag | refs/heads/master | static/assets/node_modules/grunt-sass/node_modules/node-sass/node_modules/pangyp/gyp/pylib/gyp/MSVSVersion.py | 1509 | # Copyright (c) 2013 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.
"""Handle version information related to Visual Stuio."""
import errno
import os
import re
import subprocess
import sys
import gyp
import glob
class VisualStudi... |
735tesla/SneakPeep | refs/heads/master | unidecode/x086.py | 252 | data = (
'Tuo ', # 0x00
'Wu ', # 0x01
'Rui ', # 0x02
'Rui ', # 0x03
'Qi ', # 0x04
'Heng ', # 0x05
'Lu ', # 0x06
'Su ', # 0x07
'Tui ', # 0x08
'Mang ', # 0x09
'Yun ', # 0x0a
'Pin ', # 0x0b
'Yu ', # 0x0c
'Xun ', # 0x0d
'Ji ', # 0x0e
'Jiong ', # 0x0f
'Xian ', # 0x10
'Mo ',... |
gopal1cloud/neutron | refs/heads/master | neutron/api/versions.py | 18 | # Copyright 2011 Citrix Systems.
# 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 ... |
BitBotFactory/poloniexlendingbot | refs/heads/master | modules/ConsoleUtils.py | 5 | # coding=utf-8
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
- get width and height of console
- works on linux,os x,windows,cygwin(windows)
originally retrieved from:
http://stackoverflow.com/questions/566746/how-to-get-co... |
nirb/whatsapp | refs/heads/master | yowsup/layers/protocol_presence/layer.py | 8 | from yowsup.layers import YowLayer, YowLayerEvent, YowProtocolLayer
from .protocolentities import *
class YowPresenceProtocolLayer(YowProtocolLayer):
def __init__(self):
handleMap = {
"presence": (self.recvPresence, self.sendPresence)
}
super(YowPresenceProtocolLayer, self).__ini... |
yask123/django | refs/heads/master | django/contrib/flatpages/migrations/0001_initial.py | 308 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sites', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='FlatPage',
fields=[
... |
akhilari7/pa-dude | refs/heads/master | lib/python2.7/site-packages/nltk/sem/lfg.py | 10 | # Natural Language Toolkit: Lexical Functional Grammar
#
# Author: Dan Garrette <dhgarrette@gmail.com>
#
# Copyright (C) 2001-2015 NLTK Project
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
from __future__ import print_function, division, unicode_literals
from nltk.internals import Counter
from ... |
fejta/test-infra | refs/heads/master | gubernator/view_pr.py | 20 | # Copyright 2016 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to ... |
hellhound/dentexchange | refs/heads/master | dentexchange/apps/libs/haystack/utils.py | 2 | # -*- coding:utf-8 -*-
from django.db.models.loading import get_model
from django.core.exceptions import ImproperlyConfigured
from haystack import connections, connection_router
from haystack.utils import get_identifier
from djcelery_transactions import PostTransactionTask as Task
def split_identifier(identifier):
... |
alianmohammad/pd-gem5-latest | refs/heads/master | util/stats/stats.py | 77 | #!/usr/bin/env python
# Copyright (c) 2003-2004 The Regents of The University of Michigan
# 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 co... |
ckwatson/kernel | refs/heads/master | tests/quick_test.py | 1 | import sys
import os
from ..data.molecular_species import molecular_species
from ..data.reaction_mechanism_class import reaction_mechanism
from ..data.condition_class import condition
from ..data.reagent import reagent
from ..data.puzzle_class import puzzle
from ..data.solution_class import solution
def name(class_obj... |
webmasterraj/GaSiProMo | refs/heads/master | flask/lib/python2.7/site-packages/gunicorn/_compat.py | 35 | import sys
from gunicorn import six
PY33 = (sys.version_info >= (3, 3))
def _check_if_pyc(fname):
"""Return True if the extension is .pyc, False if .py
and None if otherwise"""
from imp import find_module
from os.path import realpath, dirname, basename, splitext
# Normalize the file-path for th... |
wscullin/spack | refs/heads/qmcpack | var/spack/repos/builtin/packages/hpx5/package.py | 3 | ##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... |
d-Rickyy-b/TelegramBot | refs/heads/master | lang/language.py | 1 | __author__ = 'Rico'
import codecs
import configparser
translations = configparser.ConfigParser()
translations.read_file(codecs.open("lang/translations.ini", "r", "UTF-8"))
# translation returns the translation for a specific string
def translation(string, language):
if language in translations and string in tran... |
mstriemer/olympia | refs/heads/master | src/olympia/tags/models.py | 3 | from django.db import models
from django.core.urlresolvers import NoReverseMatch
from olympia import amo
from olympia.amo.models import ModelBase, ManagerBase
from olympia.amo.urlresolvers import reverse
class TagManager(ManagerBase):
def not_denied(self):
"""Get allowed tags only"""
return self... |
kushalbhola/MyStuff | refs/heads/master | venv/Lib/site-packages/pkg_resources/_vendor/packaging/_structures.py | 1152 | # 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
class Infinity(object):
def __repr__(self):
return "Infinity... |
drahosj/voting_wars | refs/heads/master | db.py | 2 | from sqlalchemy import create_engine
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
#SQLite db
engine = create_engine('sqlite:////tmp/test.db', convert_unicode=True)
#MySQL db
#engine = create_engine('mysql+pymysql://root:cdc@localhost/corp', convert_uni... |
devlin85/p2pool | refs/heads/master | p2pool/networks/digibyte.py | 2 | from p2pool.bitcoin import networks
PARENT = networks.nets['digibyte']
SHARE_PERIOD = 10 # seconds target spacing
CHAIN_LENGTH = 12*60*60//10 # shares
REAL_CHAIN_LENGTH = 12*60*60//10 # shares
TARGET_LOOKBEHIND = 20 # shares diff regulation
SPREAD = 50 # blocks
IDENTIFIER = '48a4ebc31b798115'.decode('hex')
PREFIX = '5... |
jmp0xf/raven-python | refs/heads/master | tests/transport/threaded/tests.py | 12 | import mock
import os
import time
from tempfile import mkstemp
from raven.utils.testutils import TestCase
from raven.base import Client
from raven.transport.threaded import ThreadedHTTPTransport
from raven.utils.urlparse import urlparse
class DummyThreadedScheme(ThreadedHTTPTransport):
def __init__(self, *args,... |
jakirkham/ilastik | refs/heads/master | ilastik/utility/__init__.py | 3 | ###############################################################################
# ilastik: interactive learning and segmentation toolkit
#
# Copyright (C) 2011-2014, the ilastik developers
# <team@ilastik.org>
#
# This program is free software; you can redistribute it and/or
# mod... |
ant-t/heekscnc | refs/heads/master | nc/num_reader.py | 30 | import nc_read as nc
import sys
import math
# a base class for hpgl parsers, and maybe others
class NumReader(nc.Parser):
def __init__(self, writer):
nc.Parser.__init__(self, writer)
def get_number(self):
number = ''
# skip spaces and commas at start of number
... |
metamarcdw/PyBitmessage-I2P | refs/heads/master | src/bitmessageqt/addaddressdialog.py | 18 | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'addaddressdialog.ui'
#
# Created: Sat Nov 30 20:35:38 2013
# by: PyQt4 UI code generator 4.10.3
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
exce... |
ishank08/scikit-learn | refs/heads/master | examples/datasets/plot_digits_last_image.py | 386 | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
=========================================================
The Digit Dataset
=========================================================
This dataset is made up of 1797 8x8 images. Each image,
like the one shown below, is of a hand-written digit.
In order to utilize an 8x8 f... |
spring-week-topos/cinder-week | refs/heads/spring-week | cinder/tests/test_hplefthand.py | 1 | # (c) Copyright 2014 Hewlett-Packard Development Company, L.P.
# 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... |
cchanrhiza/python-pptx | refs/heads/master | docs/conf.py | 4 | # -*- coding: utf-8 -*-
#
# python-pptx documentation build configuration file, created by
# sphinx-quickstart on Thu Nov 29 13:59:35 2012.
#
# 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.
#... |
sujeet4github/MyLangUtils | refs/heads/master | LangPython/oreilly-intro-to-flask-video/venv/lib/python3.6/site-packages/wtforms/ext/django/__init__.py | 177 | import warnings
warnings.warn(
'wtforms.ext.django is deprecated, and will be removed in WTForms 3.0. '
'The package has been split out into its own package, wtforms-django: '
'https://github.com/wtforms/wtforms-django',
DeprecationWarning
)
|
chenjun0210/tensorflow | refs/heads/master | tensorflow/python/ops/clip_ops.py | 67 | # 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... |
simongoffin/website_version | refs/heads/Multi_fonctionnel | addons/pad/py_etherpad/__init__.py | 505 | """Module to talk to EtherpadLite API."""
import json
import urllib
import urllib2
class EtherpadLiteClient:
"""Client to talk to EtherpadLite API."""
API_VERSION = 1 # TODO probably 1.1 sometime soon
CODE_OK = 0
CODE_INVALID_PARAMETERS = 1
CODE_INTERNAL_ERROR = 2
CODE_INVALID_FUNCTION = 3
... |
damiencalloway/djtut | refs/heads/master | mysite/env/lib/python2.7/site-packages/django/contrib/gis/geoip/base.py | 105 | import os
import re
from ctypes import c_char_p
from django.core.validators import ipv4_re
from django.contrib.gis.geoip.libgeoip import GEOIP_SETTINGS
from django.contrib.gis.geoip.prototypes import (
GeoIPRecord, GeoIPTag, GeoIP_open, GeoIP_delete, GeoIP_database_info,
GeoIP_lib_version, GeoIP_record_by_addr... |
gzorin/OpenShadingLanguage | refs/heads/dev/gzorin/delegate-compile | testsuite/render-cornell/run.py | 6 | #!/usr/bin/env python
failthresh = max (failthresh, 0.005) # allow a little more LSB noise between platforms
outputs = [ "out.exr" ]
command = testrender("-r 256 256 -aa 4 cornell.xml out.exr")
|
ina-foss/ID-Fits | refs/heads/master | bin/others/convert_alignment_model_from_text_to_binary.py | 1 | import struct
import argparse
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Converts a model from text format to binary format.")
parser.add_argument("input_text_file", help="Input model file in text format to convert.")
parser.add_argument("output_file", help="Output model fi... |
ZLLab-Mooc/edx-platform | refs/heads/named-release/dogwood.rc | lms/djangoapps/courseware/management/commands/clean_history.py | 30 | """A command to clean the StudentModuleHistory table.
When we added XBlock storage, each field modification wrote a new history row
to the db. Now that we have bulk saves to avoid that database hammering, we
need to clean out the unnecessary rows from the database.
This command that does that.
"""
import datetime
... |
FractalBrew/GoogleMusicChannel.bundle | refs/heads/master | Contents/Libraries/Shared/distutils/command/bdist_dumb.py | 151 | """distutils.command.bdist_dumb
Implements the Distutils 'bdist_dumb' command (create a "dumb" built
distribution -- i.e., just an archive to be unpacked under $prefix or
$exec_prefix)."""
__revision__ = "$Id$"
import os
from sysconfig import get_python_version
from distutils.util import get_platform
from distutil... |
samchrisinger/osf.io | refs/heads/develop | tests/test_notifications.py | 7 | import collections
import datetime
import mock
import pytz
from babel import dates, Locale
from schema import Schema, And, Use, Or
from modularodm import Q
from modularodm.exceptions import NoResultsFound
from nose.tools import * # noqa PEP8 asserts
from framework.auth import Auth
from framework.auth.core import Use... |
macronucleus/chromagnon | refs/heads/master | Chromagnon/Priithon/fileDropPopup.py | 1 | """
Priithon pyshell / view / view2 support file drag-and-drop
-> a popup menu presents a choice of what to do
"""
__author__ = "Sebastian Haase <haase@msg.ucsf.edu>"
__license__ = "BSD license - see LICENSE file"
import wx
NO_SPECIAL_GUI_EXCEPT = True # instead rely on Priithon's guiExceptionFrame (Y._fixGuiExc... |
johnmwalters/ThinkStats2 | refs/heads/master | code/thinkstats2_test.py | 66 | """This file contains code for use with "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function, division
import unittest
import random
from collections import Counter
import ... |
jtrobec/pants | refs/heads/master | src/python/pants/option/option_value_container.py | 4 | # coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import copy
from pa... |
zzqcn/wireshark | refs/heads/zzqcn | test/suite_decryption.py | 1 | #
# Wireshark tests
# By Gerald Combs <gerald@wireshark.org>
#
# Ported from a set of Bash scripts which were copyright 2005 Ulf Lamping
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
'''Decryption tests'''
import os.path
import shutil
import subprocess
import subprocesstest
import sys
import sysconfig
import types
i... |
hkchenhongyi/django | refs/heads/master | django/contrib/gis/geos/libgeos.py | 345 | """
This module houses the ctypes initialization procedures, as well
as the notice and error handler function callbacks (get called
when an error occurs in GEOS).
This module also houses GEOS Pointer utilities, including
get_pointer_arr(), and GEOM_PTR.
"""
import logging
import os
import re
from ctypes import CD... |
cjbe/artiqDrivers | refs/heads/master | artiqDrivers/frontend/coherentDds_controller.py | 1 | #!/usr/bin/env python3.5
import argparse
import sys
from artiqDrivers.devices.coherentDds.driver import CoherentDds, CoherentDdsSim
from sipyco.pc_rpc import simple_server_loop
from sipyco.common_args import simple_network_args, init_logger_from_args
from oxart.tools import add_common_args
def get_argparser():
... |
zhang-shengping/racoon | refs/heads/master | racoon/__init__.py | 1 | # -*- coding: utf-8 -*-
# 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, softw... |
DistrictDataLabs/yellowbrick | refs/heads/develop | tests/test_features/test_pcoords.py | 1 | # tests.test_features.test_pcoords
# Testing for the parallel coordinates feature visualizers
#
# Author: Benjamin Bengfort
# Author: @thekylesaurus
# Created: Thu Oct 06 11:21:27 2016 -0400
#
# Copyright (C) 2017 The scikit-yb developers.
# For license information, see LICENSE.txt
#
# ID: test_pcoords.py [1d407ab] b... |
haad/ansible-modules-extras | refs/heads/devel | windows/win_acl_inheritance.py | 59 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2015, Hans-Joachim Kliemeck <git@kliemeck.de>
#
# 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 ... |
ity/pants | refs/heads/master | tests/python/pants_test/goal/test_artifact_cache_stats.py | 17 | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
from conte... |
neudesk/neucloud | refs/heads/master | openstack_dashboard/dashboards/router/nexus1000v/tests.py | 1 | # 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... |
wilvk/ansible | refs/heads/devel | lib/ansible/modules/cloud/amazon/elb_application_lb_facts.py | 46 | #!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... |
dmrschmidt/the_beet | refs/heads/master | main.py | 1 | #! /usr/bin/python3
from diode.blinker import Blinker
def main():
blinker = Blinker()
blinker.blink()
if __name__ == "__main__":
main()
|
cryptobanana/ansible | refs/heads/devel | test/units/modules/cloud/amazon/test_ec2_utils.py | 231 | import unittest
from ansible.module_utils.ec2 import map_complex_type
class Ec2Utils(unittest.TestCase):
def test_map_complex_type_over_dict(self):
complex_type = {'minimum_healthy_percent': "75", 'maximum_percent': "150"}
type_map = {'minimum_healthy_percent': 'int', 'maximum_percent': 'int'}
... |
bohanapp/gaoyuan.org | refs/heads/master | node_modules/hexo-renderer-scss/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py | 2710 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio user preferences file writer."""
import os
import re
import socket # for gethostname
import gyp.common
import gyp.easy_xml as easy_xml
#------... |
Nitaco/ansible | refs/heads/devel | contrib/inventory/softlayer.py | 5 | #!/usr/bin/env python
"""
SoftLayer external inventory script.
The SoftLayer Python API client is required. Use `pip install softlayer` to install it.
You have a few different options for configuring your username and api_key. You can pass
environment variables (SL_USERNAME and SL_API_KEY). You can also write INI file... |
mjirayu/sit_academy | refs/heads/master | lms/djangoapps/instructor_analytics/tests/test_basic.py | 32 | """
Tests for instructor.basic
"""
import json
from student.models import CourseEnrollment, CourseEnrollmentAllowed
from django.core.urlresolvers import reverse
from mock import patch
from student.roles import CourseSalesAdminRole
from student.tests.factories import UserFactory, CourseModeFactory
from shoppingcart.mod... |
abhiQmar/servo | refs/heads/master | tests/wpt/web-platform-tests/referrer-policy/generic/tools/spec_validator.py | 326 | #!/usr/bin/env python
import json, sys
from common_paths import *
def assert_non_empty_string(obj, field):
assert field in obj, 'Missing field "%s"' % field
assert isinstance(obj[field], basestring), \
'Field "%s" must be a string' % field
assert len(obj[field]) > 0, 'Field "%s" must not be empty'... |
cstipkovic/spidermonkey-research | refs/heads/master | python/mozbuild/mozbuild/mach_commands.py | 1 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, # You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import absolute_import, print_function, unicode_literals
import argparse
import errno
import itertool... |
monash-merc/cvl-fabric-launcher | refs/heads/master | pyinstaller-2.1/tests/import/test_ctypes_cdll_c.py | 7 | #-----------------------------------------------------------------------------
# Copyright (c) 2013, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this softwa... |
googleapis/python-tasks | refs/heads/master | google/cloud/tasks_v2beta3/services/cloud_tasks/async_client.py | 1 | # -*- coding: utf-8 -*-
# Copyright 2020 Google 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... |
cbrewster/servo | refs/heads/master | tests/wpt/web-platform-tests/service-workers/service-worker/resources/import-scripts-version.py | 48 | import datetime
import time
epoch = datetime.datetime(1970, 1, 1)
def main(req, res):
# Artificially delay response time in order to ensure uniqueness of
# computed value
time.sleep(0.1)
now = (datetime.datetime.now() - epoch).total_seconds()
return ([
('Cache-Control', 'no-cache, must-r... |
avedaee/DIRAC | refs/heads/integration | WorkloadManagementSystem/JobWrapper/JobWrapper.py | 1 | ########################################################################
# $HeadURL: $
# File : JobWrapper.py
# Author : Stuart Paterson
########################################################################
""" The Job Wrapper Class is instantiated with arguments tailored for running
a particular job. The JobW... |
Zac-HD/home-assistant | refs/heads/dev | homeassistant/components/device_tracker/snmp.py | 5 | """
Support for fetching WiFi associations through SNMP.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/device_tracker.snmp/
"""
import binascii
import logging
import threading
from datetime import timedelta
import voluptuous as vol
import homeassistan... |
MinimalOS-AOSP/platform_external_skia | refs/heads/mm-6.0 | tools/skp/page_sets/skia_carsvg_desktop.py | 33 | # 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.
# pylint: disable=W0401,W0614
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class SkiaBuildbotDesk... |
PalisadoesFoundation/switchmap-ng | refs/heads/master | switchmap/snmp/snmp_manager.py | 1 | #!/usr/bin/env python3
"""SNMP manager class."""
import os
import easysnmp
from easysnmp import exceptions
# Import project libraries
from switchmap.utils import log
from switchmap.utils import daemon
from switchmap.snmp import iana_enterprise
class Validate(object):
"""Class Verify SNMP data."""
def __in... |
Tejal011089/digitales_erpnext | refs/heads/develop | erpnext/stock/report/stock_projected_qty/stock_projected_qty.py | 24 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
def execute(filters=None):
columns = get_columns()
data = frappe.db.sql("""select
item.name, item.item_n... |
xhongyi/toybrick | refs/heads/master | Prefetch/Benchmark/prefetch_benchmark.py | 1 | #!/usr/bin/python
import os
import re
import sys
import prefetch_run as pf
"""
Define the runtime constants
"""
MAX_PREFETCH_HEAD_START = 1000
STRIDE = 1
RUNS_PER_TEST = 1
INPUT_READ_FILE = 'check0'
OUTPUT_BENCHMARK_FILE = 'constant_prefetch.dat'
"""
List to the store the results during the loop
"""
time_to_complet... |
windyuuy/opera | refs/heads/master | chromium/src/third_party/python_26/Lib/site-packages/win32comext/shell/demos/browse_for_folder.py | 47 | # A couple of samples using SHBrowseForFolder
import sys, os
from win32com.shell import shell, shellcon
import win32gui
# A callback procedure - called by SHBrowseForFolder
def BrowseCallbackProc(hwnd, msg, lp, data):
if msg== shellcon.BFFM_INITIALIZED:
win32gui.SendMessage(hwnd, shellcon.BFFM_SETSELECTIO... |
gazeti/aleph | refs/heads/master | aleph/search/entities.py | 2 | import json
from normality import ascii_text
from pprint import pprint # noqa
from aleph.core import url_for, es, es_index, schemata
from aleph.index import TYPE_ENTITY, TYPE_DOCUMENT
from aleph.search.util import execute_basic
from aleph.search.fragments import match_all, filter_query, multi_match
from aleph.search.... |
GGXH/python_koans | refs/heads/master | python_koans/python3/koans/about_asserts.py | 37 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutAsserts(Koan):
def test_assert_truth(self):
"""
We shall contemplate truth by testing reality, via asserts.
"""
# Confused? This video should help:
#
# http://bit.ly/about_asserts... |
googlefonts/pyfontaine | refs/heads/main | fontaine/charsets/noto_chars/notosansphagspa_regular.py | 2 | # -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSansPhagsPa-Regular'
native_name = ''
def glyphs(self):
chars = []
chars.append(0x0000) #uniFEFF ????
chars.append(0x1801) #uni1801 MONGOLIAN ELLIPSIS
chars.append(0x1802) #uni1802 MONGOLIAN COMMA
... |
h3llrais3r/SickRage | refs/heads/master | lib/requests/packages/chardet/jisfreq.py | 342 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... |
airodactyl/qutebrowser | refs/heads/master | tests/end2end/features/conftest.py | 1 | # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2015-2018 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser 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 S... |
pair-code/what-if-tool | refs/heads/master | witwidget/notebook/colab/wit.py | 2 | # Copyright 2018 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... |
scallemang/rhineland-shopify-theme | refs/heads/master | node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py | 2710 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Visual Studio user preferences file writer."""
import os
import re
import socket # for gethostname
import gyp.common
import gyp.easy_xml as easy_xml
#------... |
sachinkumar123/approprate | refs/heads/master | cloudApp/moderator/apps.py | 1 | from __future__ import unicode_literals
from django.apps import AppConfig
class ModeratorConfig(AppConfig):
name = 'moderator'
|
Aaron0927/xen-4.2.1 | refs/heads/master | tools/xm-test/tests/help/01_help_basic_pos.py | 42 | #!/usr/bin/python
# Copyright (C) International Business Machines Corp., 2005
# Author: Woody Marvel <marvel@us.ibm.com>
import re
from XmTestLib import *
status, output = traceCommand("xm help")
eyecatcher = "Usage:"
where = output.find(eyecatcher)
if where == -1:
FAIL("xm help: didn't see the usage string")
|
BlackPole/bp-enigma2 | refs/heads/master | lib/python/Plugins/SystemPlugins/VideoClippingSetup/plugin.py | 55 | from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.config import config, ConfigSubsection, ConfigInteger, ConfigSlider, getConfigListEntry
config.plugins.VideoClippingSetup = ConfigSubsection()
config.plugins.VideoClippingSetup.clip_left = ConfigInteger(default = 0)
co... |
ziir/lumbergh | refs/heads/master | careers/careers/views.py | 2 | from django.http import Http404
from django.shortcuts import get_object_or_404, render
from django.views.generic import DetailView
from django_jobvite import models as jobvite_models
import utils
from careers.careers.forms import PositionFilterForm
from careers.django_workable import models as workable_models
def h... |
lsst-sqre/ltd-keeper | refs/heads/master | keeper/cli.py | 1 | """Command line subcommands for the Flask CLI.
Flask CLI subcommands are implemented with Click. The application factory
(`keeper.appfactory`) registers these
"""
from __future__ import annotations
import os
from typing import TYPE_CHECKING
import alembic
import click
from flask import current_app
from flask.cli im... |
turbomanage/training-data-analyst | refs/heads/master | courses/machine_learning/deepdive2/structured/labs/serving/application/lib/itsdangerous/exc.py | 11 | from ._compat import PY2
from ._compat import text_type
class BadData(Exception):
"""Raised if bad data of any sort was encountered. This is the base
for all exceptions that itsdangerous defines.
.. versionadded:: 0.15
"""
message = None
def __init__(self, message):
super(BadData, s... |
Andre-Castro/summer17WebApp | refs/heads/master | HFWebApp/HFWebApp/urls.py | 1 | """HFWebApp URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/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')
Class-b... |
usc-isi/essex-baremetal-support | refs/heads/master | nova/tests/test_localization.py | 8 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2011 OpenStack 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... |
andyraib/data-storage | refs/heads/master | python_scripts/env/lib/python3.6/site-packages/setuptools/command/register.py | 986 | import distutils.command.register as orig
class register(orig.register):
__doc__ = orig.register.__doc__
def run(self):
# Make sure that we are using valid current name/version info
self.run_command('egg_info')
orig.register.run(self)
|
semonte/intellij-community | refs/heads/master | python/testData/mover/lastComment1_afterDown.py | 10 | def f():
if True:
a = 1
else:
a = 2
#comment <caret> |
naturali/tensorflow | refs/heads/r0.11 | tensorflow/contrib/quantization/python/array_ops.py | 14 | # 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... |
pointhi/kicad-footprint-generator | refs/heads/master | KicadModTree/nodes/specialized/Translation.py | 2 | # KicadModTree 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.
#
# KicadModTree is distributed in the hope that it will be useful,
# bu... |
tuskar/tuskar-ui | refs/heads/master | horizon/test/test_dashboards/cats/tigers/views.py | 121 | from horizon import views
class IndexView(views.APIView):
# A very simple class-based view...
template_name = 'cats/tigers/index.html'
def get_data(self, request, context, *args, **kwargs):
# Add data to the context here...
return context
|
mdklatt/argparse-cpp | refs/heads/master | test/lib/gtest/googlemock/scripts/generator/cpp/utils.py | 1158 | #!/usr/bin/env python
#
# Copyright 2007 Neal Norwitz
# Portions Copyright 2007 Google 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... |
firebase/grpc-SwiftPM | refs/heads/main | tools/codegen/core/gen_stats_data.py | 5 | #!/usr/bin/env python2.7
# Copyright 2017 gRPC authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
benfinke/ns_python | refs/heads/master | build/lib/nssrc/com/citrix/netscaler/nitro/resource/config/dns/dnsglobal_dnspolicy_binding.py | 3 | #
# Copyright (c) 2008-2015 Citrix Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... |
Fusion-Rom/android_external_chromium_org | refs/heads/lp5.1 | third_party/closure_linter/closure_linter/common/tokenizer.py | 127 | #!/usr/bin/env python
#
# Copyright 2007 The Closure Linter 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
#... |
le9i0nx/ansible | refs/heads/devel | lib/ansible/module_utils/openstack.py | 76 | # 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... |
0k/odoo | refs/heads/master | addons/hr_gamification/__openerp__.py | 320 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... |
wrapp/AutobahnPython | refs/heads/master | examples/wamp/rpc/simple/example2/client.py | 27 | ###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## 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... |
jvkops/django | refs/heads/master | tests/model_meta/models.py | 192 | from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation,
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
class Relation(models.Model):
pass
class AbstractPerson(models.Model):
# DATA fields
data_abstract = models.CharField(max_len... |
ClearCorp/account-financial-reporting | refs/heads/8.0 | account_financial_report/wizard/wizard.py | 32 | # -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
# Copyright (C) OpenERP Venezuela (<http://openerp.com.ve>).
# All Rights Reserved
# Credits######################################################
# ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.