repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
flx2015/ns-3-dev-git | refs/heads/master | src/dsr/bindings/modulegen__gcc_LP64.py | 28 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... |
tmenjo/cinder-2015.1.0 | refs/heads/master | cinder/tests/volume/drivers/netapp/fakes.py | 5 | # Copyright (c) - 2014, Clinton Knight All rights reserved.
# Copyright (c) - 2015, Alex Meade. All Rights Reserved.
# Copyright (c) - 2015, Rushil Chugh. 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. ... |
KGerring/cex | refs/heads/master | cex/read_cex.py | 1 | #!/usr/bin/env
# -*- coding: utf-8 -*-
#packages =,
#date = 4/19/16find
if __name__ == "__main__":
test_file = '/Applications/PycharmProjects1/proj/cex/data/PowerContext.cex' |
klmitch/nutjob | refs/heads/master | test_nutjob.py | 1 | # Copyright 2013 Rackspace
# 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 app... |
zhuwenping/python-for-android | refs/heads/master | python-modules/twisted/twisted/internet/test/test_threads.py | 56 | # Copyright (c) 2008-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for implementations of L{IReactorThreads}.
"""
__metaclass__ = type
from weakref import ref
import gc
from twisted.internet.test.reactormixins import ReactorBuilder
from twisted.python.threadpool import ThreadPool
class Th... |
martinspeleo/dicomlayers | refs/heads/master | src/dicom/filewriter.py | 4 | # filewriter.py
"""Write a dicom media file."""
# Copyright (c) 2008-2012 Darcy Mason
# This file is part of pydicom, released under a modified MIT license.
# See the file license.txt included with this distribution, also
# available at http://pydicom.googlecode.com
from struct import pack
import logging
logger... |
SakuradaJun/django-rest-auth | refs/heads/master | rest_auth/registration/serializers.py | 1 | from django.http import HttpRequest
from rest_framework import serializers
from requests.exceptions import HTTPError
from allauth.socialaccount.helpers import complete_social_login
class SocialLoginSerializer(serializers.Serializer):
access_token = serializers.CharField(required=False)
code = serializers.Cha... |
KaptenJon/calvin-base | refs/heads/master | calvin/runtime/north/plugins/storage/proxy/__init__.py | 1 | # -*- coding: utf-8 -*-
# Copyright (c) 2015 Ericsson AB
#
# 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 ... |
treveradams/connector-telephony | refs/heads/8.0 | setup/crm_phone/setup.py | 7073 | import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
|
gshirishfree/linux | refs/heads/master | tools/perf/scripts/python/syscall-counts-by-pid.py | 1996 | # system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os, sys
sys.path.append(os.env... |
CiscoSystems/horizon | refs/heads/master | openstack_dashboard/dashboards/project/data_processing/clusters/tests.py | 26 | # 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... |
palerdot/calibre | refs/heads/master | src/calibre/gui2/store/stores/baen_webscription_plugin.py | 7 | # -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
store_version = 1 # Needed for dynamic plugin loading
__license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
import re
import urllib2
from con... |
Allow2CEO/browser-ios | refs/heads/master | brave/node_modules/bloom-filter-cpp/vendor/depot_tools/third_party/cq_client/cq_pb2.py | 7 | # This file was originally generated by the protocol buffer compiler 2.6.1, but
# was subsequently manually edited to import protobuf26 instead of
# google.protobuf to prevent conflicts with a different version of
# google.protobuf that some users of depot_tools have installed. If you need to
# re-generate this file, p... |
by46/flask-kits | refs/heads/master | flask_kits/common/code.py | 1 | # -*- coding: utf-8 -*-
ENCODINGS = ['utf8', 'gbk']
def decode_statement(statement, encodings):
if isinstance(statement, unicode):
return statement
for encoding in encodings:
try:
return statement.decode(encoding)
except UnicodeDecodeError:
pass
... |
xiang12835/python_web | refs/heads/master | py2_web2py/web2py/applications/examples/controllers/session_examples.py | 14 | def counter():
""" every time you reload, it increases the session.counter """
if not session.counter:
session.counter = 0
session.counter += 1
return dict(counter=session.counter)
|
LotusEcho/clarion-architecture | refs/heads/master | clarion/tools/UniqueDict.py | 1 | class UniqueDict(dict):
def __init__(self, *args, **kwargs):
dict.__init__(self, *args, **kwargs)
def __setitem__(self, key, value):
if key not in self:
dict.__setitem__(self, key, value)
else:
raise KeyError("Key already exists")
|
matthiascy/panda3d | refs/heads/master | direct/src/directutil/DistributedLargeBlobSenderAI.py | 12 | """DistributedLargeBlobSenderAI module: contains the DistributedLargeBlobSenderAI class"""
from direct.distributed import DistributedObjectAI
from direct.directnotify import DirectNotifyGlobal
import LargeBlobSenderConsts
class DistributedLargeBlobSenderAI(DistributedObjectAI.DistributedObjectAI):
"""DistributedL... |
dfunckt/django | refs/heads/master | django/contrib/gis/geos/prototypes/coordseq.py | 485 | from ctypes import POINTER, c_double, c_int, c_uint
from django.contrib.gis.geos.libgeos import CS_PTR, GEOM_PTR, GEOSFuncFactory
from django.contrib.gis.geos.prototypes.errcheck import (
GEOSException, last_arg_byref,
)
# ## Error-checking routines specific to coordinate sequences. ##
def check_cs_op(result, fu... |
xsynergy510x/android_external_chromium_org | refs/heads/cm-12.1 | media/tools/layout_tests/test_expectations_history.py | 156 | # 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.
"""A module for the history of the test expectation file."""
from datetime import datetime
from datetime import timedelta
import os
import re
import sy... |
liveblog/liveblog | refs/heads/master | server/ws.py | 3 | #!/usr/bin/env python
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014, 2015 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/sup... |
tombstone/models | refs/heads/master | research/fivo/fivo/nested_utils_test.py | 4 | # 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 applicab... |
Endika/django | refs/heads/master | django/db/migrations/graph.py | 351 | from __future__ import unicode_literals
import warnings
from collections import deque
from functools import total_ordering
from django.db.migrations.state import ProjectState
from django.utils.datastructures import OrderedSet
from django.utils.encoding import python_2_unicode_compatible
from .exceptions import Circu... |
shreyasp/erpnext | refs/heads/develop | erpnext/schools/doctype/program_enrollment_tool/program_enrollment_tool.py | 10 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from erpnext.schools.api import enroll_student
class ProgramEnrollmentTool(Docum... |
mclevey/PyGithub | refs/heads/master | github/tests/AllTests.py | 12 | # -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... |
hsuchie4/TACTIC | refs/heads/master | 3rd_party/CherryPy/cherrypy/test/test_httplib.py | 6 | """Tests for cherrypy/lib/httputil.py."""
from cherrypy.test import test
test.prefer_parent_path()
import unittest
from cherrypy.lib import httputil
class UtilityTests(unittest.TestCase):
def test_urljoin(self):
# Test all slash+atom combinations for SCRIPT_NAME and PATH_INFO
self.assertEqu... |
rlerch/IoTGroceryPrinter | refs/heads/master | ListManager/views.py | 1 | import json
from django.http import HttpResponse
from django.shortcuts import render
from django.views.decorators.csrf import csrf_exempt
from Adafruit_Thermal import *
printer = Adafruit_Thermal("/dev/ttyAMA0", 19200, timeout=5)
# Create your views here.
def list_manager(request):
return render(request, 'listMan... |
myerpengine/odoo | refs/heads/master | addons/l10n_hr/__init__.py | 432 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Module: l10n_hr
# Author: Goran Kliska
# mail: goran.kliska(AT)slobodni-programi.hr
# Copyright (C) 2011- Slobodni programi d.o.o., Zagreb
# Contrib... |
benni0815/root | refs/heads/master | interpreter/llvm/src/utils/DSAextract.py | 124 | #! /usr/bin/python
#this is a script to extract given named nodes from a dot file, with
#the associated edges. An edge is kept iff for edge x -> y
# x and y are both nodes specified to be kept.
#known issues: if a line contains '->' and is not an edge line
#problems will occur. If node labels do not begin with
#Nod... |
GuozhuHe/webspider | refs/heads/master | webspider/utils/pagination.py | 1 | # coding=utf-8
from math import ceil
class Pagination(object):
"""分页"""
def __init__(self, page=1, per_page=10, total=0):
self.page = page
self.per_page = per_page
self.total = total
@property
def pages(self):
if self.per_page == 0:
pages = 0
else:
... |
iw3hxn/LibrERP | refs/heads/master | l10n_ch_zip/__openerp__.py | 3 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author Nicolas Bessi. Copyright Camptocamp SA
# Contributor: WinGo SA
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all... |
xcgoner/dist-mxnet | refs/heads/master | example/numpy-ops/custom_softmax.py | 12 | # 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... |
40323230/Pyslvs-PyQt5 | refs/heads/master | pyslvs_ui/synthesis/dimensional_synthesis/dialogs/edit_path.py | 1 | # -*- coding: utf-8 -*-
"""The option dialog use to adjust target path."""
from __future__ import annotations
__author__ = "Yuan Chang"
__copyright__ = "Copyright (C) 2016-2021"
__license__ = "AGPL"
__email__ = "pyslvs@gmail.com"
from typing import TYPE_CHECKING
from math import cos, sin, atan2, radians, hypot
from... |
KimByoungjae/DSTC6-track1-memN2N | refs/heads/master | memn2n-t6/main.py | 1 | import os
import pprint
import tensorflow as tf
import numpy as np
import json
from data import read_data, pad_data, depad_data
from model import MemN2N
pp = pprint.PrettyPrinter()
flags = tf.app.flags
flags.DEFINE_integer("edim", 20, "internal state dimension [20]")
flags.DEFINE_integer("nhop", 3, "number of hops ... |
blindroot/django | refs/heads/master | tests/template_tests/test_library.py | 413 | from django.template import Library
from django.template.base import Node
from django.test import TestCase
class FilterRegistrationTests(TestCase):
def setUp(self):
self.library = Library()
def test_filter(self):
@self.library.filter
def func():
return ''
self.ass... |
blublud/networkx | refs/heads/master | doc/make_gallery.py | 35 | """
Generate a thumbnail gallery of examples.
"""
from __future__ import print_function
import os, glob, re, shutil, sys
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot
import matplotlib.image
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCa... |
lehmannro/translate | refs/heads/master | convert/test_po2txt.py | 7 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from translate.convert import po2txt
from translate.convert import test_convert
from translate.misc import wStringIO
class TestPO2Txt:
def po2txt(self, posource, txttemplate=None):
"""helper that converts po source to txt source without requiring files"""
... |
josealber84/deep-learning | refs/heads/master | tensorboard/utils.py | 154 | import numpy as np
def split_data(chars, batch_size, num_steps, split_frac=0.9):
slice_size = batch_size * num_steps
n_batches = int(len(chars) / slice_size)
x = chars[: n_batches*slice_size]
y = chars[1: n_batches*slice_size + 1]
split_idx = int(batch_size*split_frac)
x = np.stack(np.spli... |
crosswalk-project/crosswalk-android-extensions | refs/heads/master | build/android/gyp/jar.py | 13 | #!/usr/bin/env python
#
# Copyright 2013 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 fnmatch
import optparse
import os
import sys
from util import build_utils
from util import md5_check
def DoJar(options):
... |
mwrightevent38/MissionPlanner | refs/heads/master | Lib/site-packages/numpy/numarray/compat.py | 102 |
__all__ = ['NewAxis', 'ArrayType']
from numpy import newaxis as NewAxis, ndarray as ArrayType
|
mrabbah/snmpccgx | refs/heads/master | flask/lib/python2.7/site-packages/pip/_vendor/webencodings/mklabels.py | 512 | """
webencodings.mklabels
~~~~~~~~~~~~~~~~~~~~~
Regenarate the webencodings.labels module.
:copyright: Copyright 2012 by Simon Sapin
:license: BSD, see LICENSE for details.
"""
import json
try:
from urllib import urlopen
except ImportError:
from urllib.request import urlopen
def asser... |
lumig242/Hue-Integration-with-CDAP | refs/heads/pull3 | desktop/core/ext-py/MySQL-python-1.2.5/MySQLdb/times.py | 76 | """times module
This module provides some Date and Time classes for dealing with MySQL data.
Use Python datetime module to handle date and time columns."""
import math
from time import localtime
from datetime import date, datetime, time, timedelta
from _mysql import string_literal
Date = date
Time = tim... |
Deepakkothandan/ansible | refs/heads/devel | lib/ansible/modules/cloud/rackspace/rax_mon_alarm.py | 29 | #!/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'],
... |
gylian/sickbeard | refs/heads/master | lib/hachoir_core/tools.py | 90 | # -*- coding: utf-8 -*-
"""
Various utilities.
"""
from lib.hachoir_core.i18n import _, ngettext
import re
import stat
from datetime import datetime, timedelta, MAXYEAR
from warnings import warn
def deprecated(comment=None):
"""
This is a decorator which can be used to mark functions
as deprecated. It wi... |
VinnyQ/blueflood | refs/heads/master | contrib/grinder/scripts/annotationsingest.py | 2 | import random
try:
from com.xhaus.jyson import JysonCodec as json
except ImportError:
import json
from utils import *
from net.grinder.script import Test
from net.grinder.plugin.http import HTTPRequest
from HTTPClient import NVPair
class AnnotationsIngestThread(AbstractThread):
# The list of metric number... |
mastbaum/rat-pac | refs/heads/master | python/SCons/Util.py | 19 | """SCons.Util
Various utility functions go here.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation
#
# 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 So... |
WMD-Bath/CZTS-model | refs/heads/master | interpolate_thermal_property.py | 2 | ################################################################################
# Copyright Adam J. Jackson (2015) #
# #
# This program is free software: you can redistribute it and/or modify ... |
dmuhamedagic/crmsh | refs/heads/master | crmsh/ui_ra.py | 2 | # Copyright (C) 2008-2011 Dejan Muhamedagic <dmuhamedagic@suse.de>
# Copyright (C) 2013 Kristoffer Gronlund <kgronlund@suse.com>
# See COPYING for license information.
from . import command
from . import completers as compl
from . import utils
from . import ra
from . import constants
from . import options
from . impor... |
dvitme/odoomrp-wip | refs/heads/8.0 | product_price_history/__init__.py | 20 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright 2013 Camptocamp SA
# Author: Joel Grand-Guillaume
#
# This program is free software: you can redistribute it and/or modify
# it under the terms... |
srm912/servo | refs/heads/master | tests/wpt/web-platform-tests/referrer-policy/generic/subresource/xhr.py | 227 | import os, sys, json
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
import subresource
def generate_payload(server_data):
data = ('{"headers": %(headers)s}') % server_data
return data
def main(request, response):
subresource.respond(request,
response,
... |
HKUST-Aerial-Robotics/VINS-Mobile | refs/heads/master | VINS_ThirdPartyLib/ceres-solver/internal/ceres/generate_eliminator_specialization.py | 19 | # Ceres Solver - A fast non-linear least squares minimizer
# Copyright 2015 Google Inc. All rights reserved.
# http://ceres-solver.org/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source cod... |
jsoref/django | refs/heads/master | django/db/models/sql/query.py | 19 | """
Create SQL statements for QuerySets.
The code in here encapsulates all of the SQL construction so that QuerySets
themselves do not have to (and could be backed by things other than SQL
databases). The abstraction barrier only works one way: this module has to know
all about the internals of models in order to get ... |
hwu25/AppPkg | refs/heads/trunk | Applications/Python/Python-2.7.2/Lib/test/test_fractions.py | 9 | """Tests for Lib/fractions.py."""
from decimal import Decimal
from test.test_support import run_unittest
import math
import numbers
import operator
import fractions
import unittest
from copy import copy, deepcopy
from cPickle import dumps, loads
F = fractions.Fraction
gcd = fractions.gcd
# decorator for... |
charliequinn/django-guardian | refs/heads/devel | guardian/backends.py | 37 | from __future__ import unicode_literals
from django.db import models
from guardian.compat import get_user_model
from guardian.conf import settings
from guardian.exceptions import WrongAppError
from guardian.core import ObjectPermissionChecker
class ObjectPermissionBackend(object):
supports_object_permissions = T... |
rh-s/heat | refs/heads/master | heat/db/sqlalchemy/migrate_repo/versions/058_resource_engine_id.py | 13 | #
# 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
# ... |
cloudbase/nova | refs/heads/master | nova/api/openstack/compute/views/server_tags.py | 19 | # Copyright 2016 Mirantis 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 ... |
Charlotte-Morgan/inasafe | refs/heads/develop | safe/utilities/test/test_file_downloader.py | 6 | # coding=utf-8
"""
Test for Save Scenario Dialog.
Contact : ole.moller.nielsen@gmail.com
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
... |
tensorflow/lucid | refs/heads/master | tests/recipes/activation_atlas.py | 1 | import pytest
from lucid.modelzoo.aligned_activations import NUMBER_OF_AVAILABLE_SAMPLES
from lucid.modelzoo.vision_models import AlexNet, InceptionV1
from lucid.recipes.activation_atlas import activation_atlas, aligned_activation_atlas
from lucid.misc.io import save
# Run test with just 1/10th of available samples
s... |
FluidityProject/fluidity | refs/heads/testharnessClean | tools/vtudecomp.py | 2 | #!/usr/bin/env python3
#
# James Maddison
"""
Tool to decompose a vtu using a given decomposed gmsh mesh
"""
import glob
import optparse
import os
import fluidity.diagnostics.debug as debug
import fluidity.diagnostics.gmshtools as gmshtools
import fluidity.diagnostics.vtutools as vtktools
optionParser = optparse.Op... |
cgaspoz/l10n-switzerland | refs/heads/8.0 | __unported__/l10n_ch_dta_base_transaction_id/wizard/create_dta.py | 11 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... |
GoogleCloudPlatform/training-data-analyst | refs/heads/master | courses/machine_learning/deepdive2/end_to_end_ml/solutions/serving/application/lib/pyasn1/codec/ber/decoder.py | 7 | #
# This file is part of pyasn1 software.
#
# Copyright (c) 2005-2019, Ilya Etingof <etingof@gmail.com>
# License: http://snmplabs.com/pyasn1/license.html
#
from pyasn1 import debug
from pyasn1 import error
from pyasn1.codec.ber import eoo
from pyasn1.compat.integer import from_bytes
from pyasn1.compat.octets import oc... |
MeirKriheli/Open-Knesset | refs/heads/master | mks/migrations/0004_add_members_residence.py | 15 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Member.area_of_residence'
db.add_column('mks_member', 'area_of_residence', self.gf('dj... |
wxgeo/geophar | refs/heads/master | wxgeometrie/sympy/assumptions/tests/test_context.py | 126 | from sympy.assumptions import ask, Q
from sympy.assumptions.assume import assuming, global_assumptions
from sympy.abc import x, y
def test_assuming():
with assuming(Q.integer(x)):
assert ask(Q.integer(x))
assert not ask(Q.integer(x))
def test_assuming_nested():
assert not ask(Q.integer(x))
ass... |
okuser/okcupyd | refs/heads/master | okcupyd/statistics.py | 2 | import itertools
import numbers
from . import util
from .attractiveness_finder import AttractivenessFinder
class Statistics(object):
def __init__(self, user, message_threads=None, filters=(),
attractiveness_finder=None):
self._user = user
self._message_threads = message_threads ... |
jh0ker/mau_mau_bot | refs/heads/master | game.py | 1 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Telegram bot to play UNO in group chats
# Copyright (c) 2016 Jannes Höke <uno@jhoeke.de>
#
# This program 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 Free Software Foundatio... |
pepetreshere/odoo | refs/heads/patch-2 | odoo/addons/base/models/ir_qweb.py | 3 | # -*- coding: utf-8 -*-
from __future__ import print_function
import ast
import copy
import json
import logging
from collections import OrderedDict
from time import time
from lxml import html
from lxml import etree
from werkzeug import urls
from odoo import api, models, tools
from odoo.tools.safe_eval import assert_v... |
google/ftc-object-detection | refs/heads/master | training/experimental/video_thresh.py | 1 | # Copyright 2018 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 agreed to in writing, ... |
vipul-sharma20/oh-mainline | refs/heads/master | vendor/packages/celery/celery/states.py | 34 | # -*- coding: utf-8 -*-
"""
celery.states
=============
Built-in Task States.
.. _states:
States
------
See :ref:`task-states`.
Sets
----
.. state:: READY_STATES
READY_STATES
~~~~~~~~~~~~
Set of states meaning the task result is ready (has been executed).
.. state:: UNREADY_STATES
UNREADY_STATES
~~~~~~~~~~~~~... |
PetrDlouhy/django | refs/heads/master | django/conf/locale/nn/formats.py | 504 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j. F Y'
TIME_FORMAT = 'H:i'
DATET... |
navijo/FlOYBD | refs/heads/master | DataMining/weather/ml/naiveBayesMlib2.py | 2 | from pyspark import SparkContext, SparkConf
from pyspark.ml.feature import VectorAssembler, StringIndexer
from pyspark.sql import SQLContext, SparkSession
from pyspark.sql.types import *
from pyspark.sql.functions import avg
from pyspark.sql.utils import IllegalArgumentException
from cassandra.cluster import Cluster... |
dol-sen/gentoolkit | refs/heads/gentoolkit | pym/gentoolkit/eshowkw/keywords_content.py | 1 | # vim:fileencoding=utf-8
# Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import portage as port
import os
from portage.output import colorize
__all__ = ['keywords_content']
from gentoolkit.eshowkw.display_pretty import colorize_string
from gentoolkit.eshowkw.disp... |
mapr/hue | refs/heads/hue-3.9.0-mapr | desktop/core/ext-py/django-extensions-1.5.0/django_extensions/mongodb/fields/__init__.py | 65 | """
MongoDB model fields emulating Django Extensions' additional model fields
These fields are essentially identical to existing Extensions fields, but South hooks have been removed (since mongo requires no schema migration)
"""
import re
import six
import datetime
from django import forms
from django.template.defau... |
eteq/bokeh | refs/heads/master | bokeh/server/__init__.py | 26 | from __future__ import absolute_import, print_function
import argparse, os, sys
import logging
import werkzeug.serving
from bokeh import __version__; __version__
from bokeh.server.utils.reload import robust_reloader; robust_reloader
from bokeh.server.app import bokeh_app; bokeh_app
from bokeh.settings import setting... |
laincloud/lain | refs/heads/master | playbooks/roles/libraries/library/etcd_prepare_update.py | 2 | #!/usr/bin/python
import os
from subprocess import check_call
from ansible.module_utils.basic import AnsibleModule
def main():
module = AnsibleModule(
argument_spec=dict(
current_members=dict(type='list', required=True),
wanted_members=dict(type='list', required=True),
... |
mattclay/ansible | refs/heads/devel | test/units/cli/arguments/test_optparse_helpers.py | 15 | # -*- coding: utf-8 -*-
# Copyright: (c) 2018, 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
import sys
import pytest
from ansible import constants as C
from ansible... |
spinlock/redis | refs/heads/dev_v2 | deps/jemalloc/scripts/gen_travis.py | 21 | #!/usr/bin/env python
from itertools import combinations
travis_template = """\
language: generic
matrix:
include:
%s
before_script:
- autoconf
- ./configure ${COMPILER_FLAGS:+ \
CC="$CC $COMPILER_FLAGS" \
CXX="$CXX $COMPILER_FLAGS" } \
$CONFIGURE_FLAGS
- make -j3
- make -j3 tests
scrip... |
CVML/opengm | refs/heads/master | src/interfaces/python/opengm/_inference_parameter_injector.py | 14 | import sys
from cStringIO import StringIO
import types
import numpy
import inspect
from _to_native_converter import to_native_class_converter ,is_sub_inf_param,is_inf_param
def _injectGenericInferenceParameterInterface(solverParamClass,infParam,subInfParam):
BoostPythonMetaclass=solverParamClass.__class__
class... |
Endika/maintainer-quality-tools | refs/heads/master | travis/travis_transifex.py | 1 | #!/usr/bin/env python
# coding: utf-8
from __future__ import print_function
from __future__ import unicode_literals
import os
import sys
from slumber import API, exceptions
from odoo_connection import context_mapping
from test_server import setup_server, get_addons_path, \
get_server_path, get_addons_to_check
from... |
newerthcom/savagerebirth | refs/heads/master | libs/python-2.72/Lib/bsddb/test/test_db.py | 41 | import unittest
import os, glob
from test_all import db, test_support, get_new_environment_path, \
get_new_database_path
#----------------------------------------------------------------------
class DB(unittest.TestCase):
import sys
if sys.version_info < (2, 4) :
def assertTrue(self, expr, ms... |
Shyam10/kivy | refs/heads/master | kivy/tools/generate-icons.py | 37 | #!/usr/bin/env python
'''
Icon generator
==============
This tool will help you to generate all the icons wanted for Google Play Store,
App Store, Amazon store.
'''
import sys
from PIL import Image
from os.path import exists, join, realpath, basename, dirname
from os import makedirs
from argparse import ArgumentParse... |
DrDos0016/z2 | refs/heads/master | comic/migrations/0006_auto_20170602_0100.py | 1 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-06-02 01:00
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('comic', '0005_comic_commentary'),
]
operations = [
migrations.AlterModelOptions(
... |
defionscode/ansible-modules-core | refs/heads/devel | network/nxos/nxos_aaa_server.py | 25 | #!/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... |
Fireblend/chromium-crosswalk | refs/heads/master | third_party/tlslite/tlslite/utils/tripledes.py | 58 | # Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""Abstract class for 3DES."""
class TripleDES(object):
def __init__(self, key, mode, IV, implementation):
if len(key) != 24:
raise ValueError()
if mode != 2:
raise ValueError()... |
zhjunlang/kbengine | refs/heads/master | kbe/res/scripts/common/Lib/test/test_rlcompleter.py | 173 | from test import support
import unittest
import builtins
import rlcompleter
class CompleteMe:
""" Trivial class used in testing rlcompleter.Completer. """
spam = 1
class TestRlcompleter(unittest.TestCase):
def setUp(self):
self.stdcompleter = rlcompleter.Completer()
self.completer = rlcom... |
firebase/grpc-SwiftPM | refs/heads/main | test/core/bad_client/gen_build_yaml.py | 2 | #!/usr/bin/env python2.7
# Copyright 2015 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 la... |
taogb/linux | refs/heads/master | tools/perf/scripts/python/futex-contention.py | 1997 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... |
pingf/falsy | refs/heads/master | setup.py | 1 | from glob import glob
from pbr import util
from setuptools import setup
cfg = util.cfg_to_args()
cfg.update({
'data_files': [
('docs', glob('docs/*.rst'))
],
# 'pbr': True,
})
setup(
**cfg
)
|
emon10005/sympy | refs/heads/master | sympy/core/evaluate.py | 96 | from .cache import clear_cache
from contextlib import contextmanager
class _global_evaluate(list):
""" The cache must be cleared whenever global_evaluate is changed. """
def __setitem__(self, key, value):
clear_cache()
super(_global_evaluate, self).__setitem__(key, value)
global_evaluate = _... |
wearpants/osf.io | refs/heads/develop | website/addons/__init__.py | 59 | class Addon(object):
registry = {}
def __init__(self, fullname, shortname, provider, user_settings_model=None, node_model=None):
self.fullname = fullname
self.shortname = shortname
self.provider = provider
self.user_settings_model = user_settings_model
self.node_model =... |
sunny94/temp | refs/heads/iss8501_parsing | sympy/physics/mechanics/tests/test_linearize.py | 21 | from __future__ import division
from sympy import symbols, Matrix, solve, simplify, cos, sin, atan, sqrt
from sympy.physics.mechanics import dynamicsymbols, ReferenceFrame, Point,\
dot, cross, inertia, KanesMethod, Particle, RigidBody, Lagrangian,\
LagrangesMethod
def test_linearize_rolling_disc_kane():
# ... |
goal/uwsgi | refs/heads/master | plugins/redislog/uwsgiplugin.py | 21 | NAME = 'redislog'
CFLAGS = []
LDFLAGS = []
LIBS = []
GCC_LIST = ['redislog_plugin']
|
farhaanbukhsh/sympy | refs/heads/master | sympy/combinatorics/graycode.py | 83 | from __future__ import print_function, division
from sympy.core import Basic
from sympy.core.compatibility import range
import random
class GrayCode(Basic):
"""
A Gray code is essentially a Hamiltonian walk on
a n-dimensional cube with edge length of one.
The vertices of the cube are represented by ... |
diagramsoftware/odoo | refs/heads/8.0 | addons/purchase/purchase.py | 19 | # -*- 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... |
marianotepper/sgft | refs/heads/master | sgft/test_spectrogram.py | 1 | from __future__ import absolute_import
import graph_tool.generation as gt_gen
# import graph_tool.draw as gt_draw
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.colors as colors
import seaborn.apionly as sns
import timeit
import sgft.ppr as ppr
def test_chain():
graph = gt_gen.lattice([1, 10... |
wenghengcong/MQTTExplore | refs/heads/master | lib/mosquitto-1.4.4/test/lib/03-publish-c2b-qos1-timeout.py | 7 | #!/usr/bin/env python
# Test whether a client sends a correct PUBLISH to a topic with QoS 1 and responds to a delay.
# The client should connect to port 1888 with keepalive=60, clean session set,
# and client id publish-qos1-test
# The test will send a CONNACK message to the client with rc=0. Upon receiving
# the CON... |
fbossy/SickRage | refs/heads/master | lib/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py | 2359 | """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
__version__ = '3.4.0.2'
class CertificateError(ValueError):
pass
def _dnsname_match(dn, host... |
wtamu-cisresearch/nltksite | refs/heads/master | nltksite/urls.py | 1 | """nltksite URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/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... |
OpenAcademy-OpenStack/nova-scheduler | refs/heads/master | nova/api/openstack/compute/contrib/virtual_interfaces.py | 23 | # Copyright (C) 2011 Midokura KK
# 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 ... |
StefanRijnhart/server-tools | refs/heads/7.0 | __unported__/server_env_base_external_referentials/base_external_referentials.py | 70 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2011-2012 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# ... |
paaschpa/badcomputering | refs/heads/master | blog/posts_page_dependency.py | 2 | from .models import Post
from django.db import models
from django.db.models.signals import pre_save, post_save
try:
from django.dispatch import receiver
except ImportError:
def receiver(signal, **kwargs):
def _decorator(func):
signal.connect(func, **kwargs)
return func
re... |
valtech-mooc/edx-platform | refs/heads/master | lms/djangoapps/shoppingcart/migrations/0017_auto__add_field_courseregistrationcode_order__chg_field_registrationco.py | 114 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CourseRegistrationCode.order'
db.add_column('shoppingcart_courseregistrationcode', 'order',
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.