repo_name
stringlengths
5
100
ref
stringlengths
12
67
path
stringlengths
4
244
copies
stringlengths
1
8
content
stringlengths
0
1.05M
⌀
fkie-cad/FACT_core
refs/heads/master
src/plugins/analysis/checksec/test/test_plugin_checksec.py
1
from pathlib import Path import pytest from objects.file import FileObject from test.unit.analysis.analysis_plugin_test_class import AnalysisPluginTest # pylint: disable=wrong-import-order from ..code.checksec import ( AnalysisPlugin, check_canary, check_clang_cfi, check_clang_safestack, check_fortify_source, c...
winnerineast/Origae-6
refs/heads/master
origae/dataset/text/generic/job.py
1
from __future__ import absolute_import from ..job import TextDatasetJob from origae.dataset import tasks from origae.utils import subclass, override, constants # NOTE: Increment this every time the pickled object changes PICKLE_VERSION = 1 @subclass class GenericTextDatasetJob(TextDatasetJob): """ A Job tha...
valentin-krasontovitsch/ansible
refs/heads/devel
lib/ansible/modules/system/java_keystore.py
9
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2016, Guillaume Grossetie <ggrossetie@yuzutech.fr> # 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_versio...
DoriKal/linux
refs/heads/master
scripts/gdb/linux/cpus.py
997
# # gdb helper commands and functions for Linux kernel debugging # # per-cpu tools # # Copyright (c) Siemens AG, 2011-2013 # # Authors: # Jan Kiszka <jan.kiszka@siemens.com> # # This work is licensed under the terms of the GNU GPL version 2. # import gdb from linux import tasks, utils MAX_CPUS = 4096 def get_cu...
linvictor88/vse-lbaas-driver
refs/heads/master
quantum/agent/metadata/__init__.py
56
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2012 New Dream Network, LLC (DreamHost) # # 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/li...
tqchen/tvm
refs/heads/master
python/tvm/relay/testing/mlp.py
5
# 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...
ryfeus/lambda-packs
refs/heads/master
LightGBM_sklearn_scipy_numpy/source/scipy/io/matlab/tests/test_miobase.py
24
""" Testing miobase module """ import numpy as np from numpy.testing import assert_equal from pytest import raises as assert_raises from scipy.io.matlab.miobase import matdims def test_matdims(): # Test matdims dimension finder assert_equal(matdims(np.array(1)), (1, 1)) # numpy scalar assert_equal(mat...
erggo/Harpy
refs/heads/master
harpia/amara/binderytools.py
2
""" Convenience functions for using the Amara bindery. """ # # Utility functions for common binding usage # import re import time from datetime import time as dt_time from datetime import datetime, timedelta from Ft.Xml import InputSource from Ft.Xml import SplitQName from Ft.Lib import Uri from harpia.amara import b...
rlcode/reinforcement-learning-kr
refs/heads/master
1-grid-world/4-sarsa/environment.py
1
import time import numpy as np import tkinter as tk from PIL import ImageTk, Image np.random.seed(1) PhotoImage = ImageTk.PhotoImage UNIT = 100 # 필셀 수 HEIGHT = 5 # 그리드 월드 가로 WIDTH = 5 # 그리드 월드 세로 class Env(tk.Tk): def __init__(self): super(Env, self).__init__() self.action_space = ['u', 'd', '...
ppwwyyxx/tensorflow
refs/heads/master
tensorflow/python/kernel_tests/lookup_ops_test.py
3
# 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...
turbokongen/home-assistant
refs/heads/dev
homeassistant/components/atag/__init__.py
9
"""The ATAG Integration.""" from datetime import timedelta import logging import async_timeout from pyatag import AtagException, AtagOne from homeassistant.components.climate import DOMAIN as CLIMATE from homeassistant.components.sensor import DOMAIN as SENSOR from homeassistant.components.water_heater import DOMAIN ...
aequitas/CouchPotato
refs/heads/master
library/pynmwp/__init__.py
8
#!/usr/bin/python from pynmwp import PyNMWP
Kamik423/uni_plan
refs/heads/master
plan/plan/lib/python3.4/site-packages/flask/__main__.py
321
# -*- coding: utf-8 -*- """ flask.__main__ ~~~~~~~~~~~~~~ Alias for flask.run for the command line. :copyright: (c) 2015 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ if __name__ == '__main__': from .cli import main main(as_module=True)
foobarbazblarg/stayclean
refs/heads/master
stayclean-2020-december/venv/lib/python3.8/site-packages/pip/_vendor/chardet/charsetgroupprober.py
270
######################## 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...
maheshp/novatest
refs/heads/master
nova/scheduler/filters/num_instances_filter.py
9
# 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.apache.org/licenses/LICENSE-2.0 # # Unless ...
zeinsteinz/tacker
refs/heads/feyman
tacker/tests/functional/vnfm/test_tosca_vnf_alarm.py
1
# # # 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 # ...
skyostil/tracy
refs/heads/master
src/generator/Cheetah/Templates/_SkeletonPage.py
1
#!/usr/bin/env python # $Id: _SkeletonPage.py,v 1.1 2006-09-06 09:50:09 skyostil Exp $ """A baseclass for the SkeletonPage template Meta-Data ========== Author: Tavis Rudd <tavis@damnsimple.com>, Version: $Revision: 1.1 $ Start Date: 2001/04/05 Last Revision Date: $Date: 2006-09-06 09:50:09 $ """ __author__...
citrix-openstack-build/python-keystoneclient
refs/heads/master
keystoneclient/contrib/ec2/utils.py
4
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 OpenStack LLC # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 - 2012 Justin Santa Barbara # All Rights Reserved. # # Licensed under the Apache License, ...
ppwwyyxx/tensorflow
refs/heads/master
tensorflow/python/tpu/device_assignment.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...
BDAsdeCorazones/TestAirlines
refs/heads/master
tabo/cherrypy/cherrypy/test/helper.py
6
"""A library of helper functions for the CherryPy test suite.""" import datetime import logging log = logging.getLogger(__name__) import os thisdir = os.path.abspath(os.path.dirname(__file__)) serverpem = os.path.join(os.getcwd(), thisdir, 'test.pem') import re import sys import time import warnings import cherrypy ...
gandalfcode/gandalf
refs/heads/master
tests/dust_tests/test_dustybox.py
1
from gandalf.analysis.facade import * from gandalf.analysis.data_fetcher import TimeData from gandalf.analysis.compute import L1errornorm, lagrangian_radii import unittest from plot_dustybox import DriftVelocitySolutionFactory import numpy as np class DustyBoxTest(unittest.TestCase): def setUp(self): sel...
shakamunyi/nova
refs/heads/master
nova/virt/vmwareapi/__init__.py
97
# Copyright (c) 2011 Citrix Systems, Inc. # Copyright 2011 OpenStack Foundation # # 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...
pmacMaps/ArcPy
refs/heads/master
GPXtoPolyline.py
1
# Name: gpx_to_polyline.py # Description: Converts GPX file into a polyline feature # Feature class can be a shapefile or geodatabase feature class # Created by: Patrick McKinney, Cumberland County GIS # Contact: pnmcartography@gmail.com # "Telling the stories of our world through the power of maps" # Import system mo...
KRHS-GameProgramming-2015/Manpac
refs/heads/master
Norb.py
1
import sys, pygame, math class Norb(): def __init__(self, pos=[0,0]): self.image = pygame.image.load("Norb/Norb.png") self.image = pygame.transform.scale(self.image, [25,25]) self.rect = self.image.get_rect(center = pos) self.radius = self.rect.width/2 - 2 self.living = True...
kret0s/gnuhealth-live
refs/heads/master
tryton/server/trytond-3.8.3/trytond/modules/sale/sale.py
1
# This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. from decimal import Decimal from itertools import groupby, chain from functools import partial from sql import Table, Null from sql.functions import Overlay, Position from sql...
GageGaskins/osf.io
refs/heads/develop
framework/analytics/piwik.py
42
# -*- coding: utf-8 -*- import json import uuid from hashlib import md5 from urllib import urlencode import requests from website import settings class PiwikException(Exception): pass def _create_user(user): """ Given an OSF user, creates a Piwik user. """ login = 'osf.' + user._id pw = str(u...
podgorskiy/TinyFEM
refs/heads/master
libs/freetype/src/tools/chktrcmp.py
192
#!/usr/bin/env python # # Check trace components in FreeType 2 source. # Author: suzuki toshiya, 2009, 2013 # # This code is explicitly into the public domain. import sys import os import re SRC_FILE_LIST = [] USED_COMPONENT = {} KNOWN_COMPONENT = {} SRC_FILE_DIRS = [ "src" ] TRACE_DEF_FILES = [ "include/inter...
rishavray/biotoolset
refs/heads/master
bst/test.py
1
from avl import AVLTree from avl import GenAVLTree genome = GenAVLTree() #genome.put('chr1',12,'a') #print genome.chroms genome['chr1'][12] = 'a' genome['chr2'][13] = 'b' genome['chr1'][10] = 'a' genome['chr3'][564880]='c' genome['chr3'][564881]='d' genome['chr3'][564882]='e' genome['chr3'][564883]='f' genome['chr3'][...
0x90sled/catapult
refs/heads/master
perf_insights/perf_insights/value/__init__.py
4
# Copyright (c) 2015 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. # Simplified version of telemetry Value system, just enough for us to get # perf_insights up and running. class Value(object): def __init__(self, run_i...
qlands/onadata
refs/heads/20151009
onadata/apps/logger/migrations/0004_auto__del_field_xform_deleted.py
13
# 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): # Deleting field 'XForm.deleted' db.delete_column('odk_logger_xform', 'deleted') def backwards(self,...
nhomar/odoo
refs/heads/8.0
addons/account_analytic_plans/wizard/__init__.py
445
# -*- 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...
zhreshold/mxnet
refs/heads/master
python/mxnet/tvmop.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...
Acidburn0zzz/servo
refs/heads/master
tests/wpt/web-platform-tests/tools/third_party/pytest/testing/test_assertion.py
30
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import sys import textwrap import _pytest.assertion as plugin import py import pytest from _pytest.assertion import util from _pytest.assertion import truncate PY3 = sys.version_info >= (3, 0) @pytest.fixture def mock_config():...
avati/samba
refs/heads/master
lib/subunit/python/subunit/__init__.py
12
# # subunit: extensions to Python unittest to get test results from subprocesses. # Copyright (C) 2005 Robert Collins <robertc@robertcollins.net> # # Licensed under either the Apache License, Version 2.0 or the BSD 3-clause # license at the users choice. A copy of both licenses are available in the # project sour...
kvakvs/otp
refs/heads/master
lib/asn1/examples/Int.py
98
Int DEFINITIONS ::= BEGIN -- F.2.2.2 -- Define the minimum and maximum allowed values of an integer type -- as named numbers. -- EXAMPLE DayOfTheMonth ::= INTEGER {first(1), last(31)} today DayOfTheMonth ::= first unknown DayOfTheMonth ::= 0 -- To restrict the value of DayOfTheMonth to just "first"...
albertomurillo/ansible
refs/heads/devel
lib/ansible/modules/network/f5/_bigip_gtm_facts.py
12
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: (c) 2017, F5 Networks Inc. # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
xHeliotrope/injustice_dropper
refs/heads/master
env/lib/python3.4/site-packages/corsheaders/models.py
7
from django.db import models class CorsModel(models.Model): cors = models.CharField(max_length=255)
EDUlib/edx-platform
refs/heads/master
lms/djangoapps/commerce/api/v1/tests/test_serializers.py
4
""" Commerce API v1 serializer tests. """ from django.test import TestCase from ..serializers import serializers, validate_course_id class CourseValidatorTests(TestCase): """ Tests for Course Validator method. """ def test_validate_course_id_with_non_existent_course(self): """ Verify a validator c...
adit-chandra/tensorflow
refs/heads/master
tensorflow/python/kernel_tests/distributions/student_t_test.py
13
# 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 applica...
live-clones/dolfin-adjoint
refs/heads/master
tests_dolfin/checkpoint_burgers_newton/test_checkpoint_burgers_newton.py
3
from os import path import subprocess import dolfin import pytest @pytest.mark.skipif(not hasattr(dolfin, "HDF5File"), reason="requires hdf5 support") def test(request): test_file = path.split(path.dirname(str(request.fspath)))[1] + ".py" test_dir = path.split(str(request.fspath))[0] test_cmd = ["python"...
eschleicher/flask_shopping_list
refs/heads/master
venv/lib/python3.4/site-packages/werkzeug/debug/repr.py
280
# -*- coding: utf-8 -*- """ werkzeug.debug.repr ~~~~~~~~~~~~~~~~~~~ This module implements object representations for debugging purposes. Unlike the default repr these reprs expose a lot more information and produce HTML instead of ASCII. Together with the CSS and JavaScript files of the debug...
liqd/adhocracy4
refs/heads/master
tests/dashboard/components/test_views_project_basic.py
1
import pytest from adhocracy4.dashboard import components from adhocracy4.projects.enums import Access from adhocracy4.test.helpers import redirect_target component = components.projects.get('basic') @pytest.mark.django_db def test_edit_view(client, project, admin): url = component.get_base_url(project) cli...
koniiiik/django
refs/heads/master
tests/migrations/test_auto_now_add/0001_initial.py
37
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): initial = True operations = [ migrations.CreateModel( name='Entry', fields=[ ('id', models.AutoField(auto_created=T...
Yen-Chung-En/2015cdb_W12
refs/heads/master
static/Brython3.1.3-20150514-095342/Lib/unittest/test/test_result.py
788
import io import sys import textwrap from test import support import traceback import unittest class Test_TestResult(unittest.TestCase): # Note: there are not separate tests for TestResult.wasSuccessful(), # TestResult.errors, TestResult.failures, TestResult.testsRun or # TestResult.shouldStop because t...
rudij7/green_machine_bacon
refs/heads/cm-12.0
tools/perf/scripts/python/netdev-times.py
11271
# Display a process of packets and processed time. # It helps us to investigate networking or network device. # # options # tx: show only tx chart # rx: show only rx chart # dev=: show only thing related to specified device # debug: work with debug mode. It shows buffer status. import os import sys sys.path.append(os...
ecolitan/fatics
refs/heads/master
venv/lib/python2.7/site-packages/twisted/trial/reporter.py
7
# -*- test-case-name: twisted.trial.test.test_reporter -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # # Maintainer: Jonathan Lange """ Defines classes that handle the results of tests. """ from __future__ import division, absolute_import import sys import os import time import warnings...
rjshaver/bitcoin
refs/heads/master
qa/rpc-tests/test_framework/script.py
53
# # script.py # # This file is modified from python-bitcoinlib. # # Distributed under the MIT/X11 software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # """Scripts Functionality to build scripts, as well as SignatureHash(). """ from __future__ import absolute_i...
jeezybrick/django
refs/heads/master
tests/admin_widgets/tests.py
33
# -*- coding: utf-8 -*- from __future__ import unicode_literals import gettext import os from datetime import datetime, timedelta from importlib import import_module from unittest import skipIf from django import forms from django.conf import settings from django.contrib import admin from django.contrib.admin import ...
hachreak/zenodo
refs/heads/master
zenodo/modules/deposit/loaders/base.py
5
# -*- coding: utf-8 -*- # # This file is part of Zenodo. # Copyright (C) 2016 CERN. # # Zenodo is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later v...
ThomasMcVay/MediaApp
refs/heads/master
MediaAppWidgets/GraphWidget.py
1
#=============================================================================== # @Author: Madison Aster # @ModuleDescription: # @License: # MediaApp Library - Python Package framework for developing robust Media # Applications with Qt Library # Copyright (C) 2013 Madison Aster # ...
joariasl/odoo
refs/heads/8.0
openerp/addons/base/ir/ir_fields.py
194
# -*- coding: utf-8 -*- import cStringIO import datetime import functools import itertools import time import psycopg2 import pytz from openerp import models, api, _ from openerp.tools import DEFAULT_SERVER_DATE_FORMAT, DEFAULT_SERVER_DATETIME_FORMAT, ustr REFERENCING_FIELDS = set([None, 'id', '.id']) def only_ref_f...
P2poolBrasil/p2pool-dilmacoin
refs/heads/master
p2pool/test/util/test_datachunker.py
287
import random import unittest from p2pool.util import datachunker def random_bytes(length): return ''.join(chr(random.randrange(2**8)) for i in xrange(length)) class Test(unittest.TestCase): def test_stringbuffer(self): for i in xrange(100): sb = datachunker.StringBuffer() ...
eugena/django
refs/heads/master
tests/inline_formsets/models.py
236
# -*- coding: utf-8 -*- from django.db import models from django.utils.encoding import python_2_unicode_compatible class School(models.Model): name = models.CharField(max_length=100) class Parent(models.Model): name = models.CharField(max_length=100) class Child(models.Model): mother = models.ForeignK...
Benjamin-Marks/mit-tab-appengine
refs/heads/master
mittab/libs/tests/assertion.py
2
def assert_nearly_equal(left, right, precision=7, message=None): """Asserts that left is equal to right up to precision digits""" condition = round(abs(left - right), precision) == 0 if message is not None: assert condition, message else: assert condition
Instagram/django
refs/heads/master
django/core/management/commands/validate.py
449
from django.core.management.base import NoArgsCommand class Command(NoArgsCommand): help = "Validates all installed models." requires_model_validation = False def handle_noargs(self, **options): self.validate(display_num_errors=True)
sparkslabs/kamaelia
refs/heads/master
Sketches/PT/likefile/testlikefile.py
3
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1) # # (1) Kamaelia Contributors are listed in the AUTHORS file and at # http://www.kamaelia.org/AUTHORS - please extend this file, # not this notice. # # Licensed under the Apache License,...
mojeto/django
refs/heads/master
tests/template_tests/syntax_tests/test_simple_tag.py
475
from django.template import TemplateSyntaxError from django.test import SimpleTestCase from ..utils import setup class SimpleTagTests(SimpleTestCase): libraries = {'custom': 'template_tests.templatetags.custom'} @setup({'simpletag-renamed01': '{% load custom %}{% minusone 7 %}'}) def test_simpletag_rena...
drawcode/yaml-cpp.core
refs/heads/master
test/gmock-1.7.0/gtest/test/gtest_catch_exceptions_test.py
2139
#!/usr/bin/env python # # Copyright 2010 Google Inc. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list o...
brandonium21/snowflake
refs/heads/master
snowflakeEnv/lib/python2.7/site-packages/alembic/ddl/sqlite.py
2
from .. import util from .impl import DefaultImpl import re class SQLiteImpl(DefaultImpl): __dialect__ = 'sqlite' transactional_ddl = False """SQLite supports transactional DDL, but pysqlite does not: see: http://bugs.python.org/issue10740 """ def requires_recreate_in_batch(self, batch_op): ...
Jayflux/servo
refs/heads/master
tests/wpt/web-platform-tests/tools/third_party/pytest/testing/code/test_source.py
12
# flake8: noqa # disable flake check on this file because some constructs are strange # or redundant on purpose and can't be disable on a line-by-line basis from __future__ import absolute_import, division, print_function import sys import _pytest._code import py import pytest from _pytest._code import Source from _py...
varunr047/homefile
refs/heads/dev
homeassistant/components/switch/scsgate.py
8
""" Support for SCSGate switches. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/switch.scsgate/ """ import logging import voluptuous as vol import homeassistant.components.scsgate as scsgate from homeassistant.components.switch import (SwitchDevice, P...
openstack/vitrage
refs/heads/master
vitrage/datasources/nova/properties.py
1
# Copyright 2019 - China Mobile (SuZhou) Software Technology Co.,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 # # Unless required b...
mdavid/horizon
refs/heads/master
openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py
35
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the...
erilyth/PyGame-Learning-Environment
refs/heads/master
ple/games/utils/vec2d.py
1
import math class vec2d(): def __init__(self, pos): self.x = pos[0] self.y = pos[1] def __add__(self, o): x = self.x + o.x y = self.y + o.y return vec2d((x,y)) def __eq__(self, o): return self.x == o.x and self.y == o.y def normalize(self): n...
modocache/swift
refs/heads/master
utils/pass-pipeline/src/passes.py
8
from pass_pipeline import Pass # TODO: This should not be hard coded. Create a tool in the compiler that knows # how to dump the passes and the pipelines themselves. AADumper = Pass('AADumper') ABCOpt = Pass('ABCOpt') AllocBoxToStack = Pass('AllocBoxToStack') CFGPrinter = Pass('CFGPrinter') COWArrayOpts = Pass('COWAr...
windyuuy/opera
refs/heads/master
chromium/src/third_party/scons-2.0.1/engine/SCons/Tool/msvs.py
61
"""SCons.Tool.msvs Tool-specific initialization for Microsoft Visual Studio project files. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 20...
flaub/tikitank
refs/heads/master
tikitank.py
1
#!/usr/bin/env python import web import json from tank.Settings import Settings render = web.template.render('templates') s = Settings() urls = ( '/', 'index', '/settings', 'settings', '/api/(\w+)/effects', 'effects', '/api/(\w+)/effect', 'effect', ) class index: def GET(self): return render.index() class...
kamenim/samba-old
refs/heads/master
buildtools/wafsamba/tests/test_utils.py
45
# Copyright (C) 2012 Jelmer Vernooij <jelmer@samba.org> # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # Thi...
srvg/ansible
refs/heads/devel
lib/ansible/plugins/inventory/ini.py
18
# Copyright (c) 2017 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 DOCUMENTATION = ''' name: ini version_added: "2.4" short_description: Uses an Ansible INI...
DBWangGroupUNSW/revs
refs/heads/master
server.py
1
#!/usr/bin/python import json import logging import sys from functools import wraps from flask import Flask, jsonify, request, session from revs import KGService ############################################################################################ # Initialization #############################################...
mdavid/horizon
refs/heads/master
openstack_dashboard/dashboards/admin/images/urls.py
46
# Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the...
beesona/vertsoft-blog
refs/heads/master
app/emails.py
20
from flask import render_template from flask.ext.mail import Message from app import mail from decorators import async from config import ADMINS @async def send_async_email(msg): mail.send(msg) def send_email(subject, sender, recipients, text_body, html_body): msg = Message(subject, sender = sender, r...
atruberg/django-custom
refs/heads/master
tests/template_tests/test_context.py
49
# coding: utf-8 from django.template import Context, Variable, VariableDoesNotExist from django.utils.unittest import TestCase class ContextTests(TestCase): def test_context(self): c = Context({"a": 1, "b": "xyzzy"}) self.assertEqual(c["a"], 1) self.assertEqual(c.push(), {}) c["a"]...
jedlitools/find-for-me
refs/heads/master
ex26_alifsb.py
1
import re filename = 'tabari_tarikh.txt' text = open(filename, mode='r', encoding='utf-8').read() #modified_text = re.sub("أ|إ|آ|ٱ", "ا", text) search_results = re.findall("أصغر", text) print(len(search_results))
rexroof/slack-hubot-demos
refs/heads/master
ansible-plugins/update.py
1
# -*- coding: utf-8 -*- # Copyright 2012 Dag Wieers <dag@wieers.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 ...
signed/intellij-community
refs/heads/master
python/testData/inspections/PyTypeCheckerInspection/FieldWithNoneInStub/m1.py
83
class C(object): foo = None
xingwu1/autorest
refs/heads/master
Samples/petstore/Python/swaggerpetstore/credentials.py
22
# coding=utf-8 # -------------------------------------------------------------------------- # -------------------------------------------------------------------------- from msrest.authentication import ( BasicAuthentication, BasicTokenAuthentication, OAuthTokenAuthentication)
SteveXiSong/UW-Madison-ECE757-S15-MulticastSnooping
refs/heads/master
src/arch/x86/isa/insts/general_purpose/string/store_string.py
91
# Copyright (c) 2007-2008 The Hewlett-Packard Development Company # All rights reserved. # # The license below extends only to copyright in the software and shall # not be construed as granting a license to any other intellectual # property including but not limited to intellectual property relating # to a hardware imp...
kch8qx/osf.io
refs/heads/master
api/files/permissions.py
27
from rest_framework import permissions from api.base.utils import get_user_auth from website.files.models import FileNode class CheckedOutOrAdmin(permissions.BasePermission): def has_object_permission(self, request, view, obj): assert isinstance(obj, FileNode), 'obj must be a FileNode, got {}'.format(obj)...
qdqmedia/fabric-bolt
refs/heads/master
fabric_bolt/launch_window/tables.py
14
import django_tables2 as tables from fabric_bolt.launch_window import models from fabric_bolt.core.mixins.tables import ActionsColumn, PaginateTable class LaunchWindowTable(PaginateTable): actions = ActionsColumn([ {'title': '<i class="glyphicon glyphicon-file"></i>', 'url': 'launch_window_launchwindow_d...
nelmiux/CarnotKE
refs/heads/master
jyhton/Lib/test/test_cpickle_jy.py
23
"""Misc cPickle tests. Made for Jython. """ import __builtin__ import sys import cPickle import pickle import unittest from StringIO import StringIO from test import test_support class MyClass(object): pass class CPickleTestCase(unittest.TestCase): def test_zero_long(self): self.assertEqual(cPickle...
ceeblet/OST_PythonCertificationTrack
refs/heads/master
Python2/HandlingDatabases/src/addfood.py
1
""" Create the food table and add all necessary data. Note that the foods are identified by the animal's name and family, so we have to look up the primary key. """ import mysql.connector from database import login_info db = mysql.connector.Connect(**login_info) cursor = db.cursor() cursor.execute("""DROP TABLE IF E...
looker/sentry
refs/heads/master
src/sentry/management/commands/collectstatic.py
7
""" sentry.management.commands.collectstatic ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2015 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import os from click import echo from itertools import chain from operat...
hiway/micropython
refs/heads/master
tests/pyb/pyb_f405.py
24
# test pyb module on F405 MCUs import os, pyb if not 'STM32F405' in os.uname().machine: print('SKIP') raise SystemExit print(pyb.freq()) print(type(pyb.rng()))
kontza/sigal
refs/heads/master
tests/test_cli.py
2
import logging import os from os.path import join from click.testing import CliRunner from sigal import build, init, serve, set_meta TESTGAL = join(os.path.abspath(os.path.dirname(__file__)), 'sample') def test_init(tmpdir): config_file = str(tmpdir.join('sigal.conf.py')) runner = CliRunner() result = ...
yangyang1989/linux-3.8.2-mini2440
refs/heads/master
tools/perf/scripts/python/futex-contention.py
11261
# 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...
saintpai/sos
refs/heads/master
sos/plugins/pacemaker.py
11
# This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but...
heke123/chromium-crosswalk
refs/heads/master
tools/metrics/histograms/histogram_ownership.py
37
#!/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. """A simple tool to go through histograms.xml and print out the owners for histograms. """ import os import sys import xml.etree.Eleme...
Chasego/Unblock-Youku
refs/heads/master
test/run-selenium.py
16
import os import sys import json import time from selenium import webdriver from selenium.webdriver.chrome.options import Options if os.path.dirname(sys.argv[0]) != '': os.chdir(os.path.dirname(sys.argv[0])) driver = None def start_up(): global driver chrome_options = Options() chrome_options.add_a...
spennihana/h2o-3
refs/heads/master
h2o-py/tests/testdir_apis/Data_Manipulation/pyunit_h2oH2OFrame_nchar.py
2
from __future__ import print_function import sys sys.path.insert(1,"../../../") import h2o from tests import pyunit_utils from h2o.utils.typechecks import assert_is_type from h2o.frame import H2OFrame def h2o_H2OFrame_nchar(): """ Python API test: h2o.frame.H2OFrame.nchar() """ iris = h2o.import_file(p...
kamyu104/django
refs/heads/master
django/contrib/staticfiles/storage.py
334
from __future__ import unicode_literals import hashlib import json import os import posixpath import re from collections import OrderedDict from django.conf import settings from django.contrib.staticfiles.utils import check_settings, matches_patterns from django.core.cache import ( InvalidCacheBackendError, cache...
AunShiLord/sympy
refs/heads/master
sympy/functions/special/tests/test_hyper.py
21
from sympy import (hyper, meijerg, S, Tuple, pi, I, exp, log, cos, sqrt, symbols, oo, Derivative, gamma, O) from sympy.series.limits import limit from sympy.abc import x, z, k from sympy.utilities.pytest import raises from sympy.utilities.randtest import ( random_complex_number as randcplx, v...
azz2k/ardrone_alt
refs/heads/master
src/ardrone_alt/__init__.py
20578
mengxn/tensorflow
refs/heads/master
tensorflow/python/saved_model/utils.py
65
# 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 applica...
moutai/scikit-learn
refs/heads/master
doc/tutorial/text_analytics/skeletons/exercise_01_language_train_model.py
103
"""Build a language detector model The goal of this exercise is to train a linear classifier on text features that represent sequences of up to 3 consecutive characters so as to be recognize natural languages by using the frequencies of short character sequences as 'fingerprints'. """ # Author: Olivier Grisel <olivie...
jds2001/ocp-checkbox
refs/heads/master
plugins/user_interface.py
2
# # This file is part of Checkbox. # # Copyright 2008 Canonical Ltd. # # Checkbox 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. # # C...
sirinath/root
refs/heads/master
interpreter/llvm/src/utils/lit/tests/test-output.py
103
# RUN: %{lit} -j 1 -v %{inputs}/test-data --output %t.results.out > %t.out # RUN: FileCheck < %t.results.out %s # CHECK: { # CHECK: "__version__" # CHECK: "elapsed" # CHECK-NEXT: "tests": [ # CHECK-NEXT: { # CHECK-NEXT: "code": "PASS", # CHECK-NEXT: "elapsed": {{[0-9.]+}}, # CHECK-NEXT: "metrics": { # CH...
linyaoli/acm
refs/heads/master
graph/intermediate/course_schedule.py
2
""" There are a total of n courses you have to take, labeled from 0 to n - 1. Some courses may have prerequisites, for example to take course 0 you have to first take course 1, which is expressed as a pair: [0,1] Given the total number of courses and a list of prerequisite pairs, is it possible for you to ...
Maximilian-Reuter/SickRage-1
refs/heads/master
lib/sqlalchemy/dialects/mysql/mysqlconnector.py
76
# mysql/mysqlconnector.py # Copyright (C) 2005-2014 the SQLAlchemy authors and contributors <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """ .. dialect:: mysql+mysqlconnector :name: MySQL Connector/Python :d...
SatoshiNXSimudrone/sl4a-damon-clone
refs/heads/master
python/src/Lib/test/test_threaded_import.py
77
# This is a variant of the very old (early 90's) file # Demo/threads/bug.py. It simply provokes a number of threads into # trying to import the same module "at the same time". # There are no pleasant failure modes -- most likely is that Python # complains several times about module random having no attribute # randran...