code
stringlengths
3
1.05M
repo_name
stringlengths
5
104
path
stringlengths
4
251
language
stringclasses
1 value
license
stringclasses
15 values
size
int64
3
1.05M
from __future__ import absolute_import class Ngram(object): def __init__(self, token): self.token = token self.count = 1 self.after = [] def __str__(self): return str({ 'after': self.after, 'count': self.count }) def __repr__(self): ...
pennetti/voicebox
server/src/voicebox/ngram.py
Python
mit
878
class Pair: def __init__(self, x, y): self.x = x self.y = y def __repr__(self): return 'Pair({0.x!r}, {0.y!r})'.format(self) def __str__(self): return '({0.x}, {0.y})'.format(self)
tuanavu/python-cookbook-3rd
src/8/changing_the_string_representation_of_instances/example.py
Python
mit
226
#!/usr/bin/env python # Copyright (c) 2017-2021 F5 Networks, 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 appl...
f5devcentral/f5-cccl
f5_cccl/resource/ltm/monitor/test/test_udp_monitor.py
Python
apache-2.0
2,642
# -*- coding: utf-8 -*- # # bitme documentation build configuration file, created by # sphinx-quickstart on Sun Oct 27 20:01:55 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
bitme/python-bitme
doc/source/conf.py
Python
mit
8,009
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. { 'name': 'Manufacturing Expiry', 'version': '1.0', 'category': 'Manufacturing/Manufacturing', 'summary': 'Manufacturing Expiry', 'description': """ Technical module. """, 'depends': ['mrp', '...
ygol/odoo
addons/mrp_product_expiry/__manifest__.py
Python
agpl-3.0
480
# Copyright (c) 2003-2006 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # # 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, o...
isohybrid/dotfile
vim/bundle/git:--github.com-klen-python-mode/pylibs/pylint/checkers/design_analysis.py
Python
bsd-2-clause
13,656
import logging import anyjson as json from django.conf import settings as django_settings from django.http import HttpResponse, HttpResponseBadRequest from redis_utils import redis_client, RedisError log = logging.getLogger(__name__) def get_builds(request): ''' url handler that returns all known build uids...
peterbe/bramble
bramble/base/api.py
Python
mpl-2.0
5,364
#!/usr/bin/env python # -*- coding: utf-8 -*- import time import obci_log_model class DummyLogModel(obci_log_model.LogModel): def __init__(self): super(DummyLogModel, self).__init__() self._ind = 0 self._peers_log = {'amplifier': {'peer_id': 'amplifier', 'logs'...
BrainTech/openbci
obci/control/gui/obci_log_model_dummy.py
Python
gpl-3.0
732
""" Basic tests for table plot visualization """ import os from click.testing import CliRunner import perun.cli as cli import perun.vcs as vcs import perun.testing.utils as test_utils import perun.testing.asserts as asserts TABLE_TEST_DIR = os.path.join(os.path.split(__file__)[0], 'references', "table_files") __auth...
tfiedor/perun
tests/test_table.py
Python
gpl-3.0
5,117
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (c) 2012-2021 SoftBank Robotics. All rights reserved. # Use of this source code is governed by a BSD-style license (see the COPYING file). """ Remove the given build config. """ from __future__ import absolute_import from __future__ import unicode_literals from ...
aldebaran/qibuild
python/qibuild/actions/rm_config.py
Python
bsd-3-clause
1,053
from osgeo import ogr import os shapefile = "states.shp" driver = ogr.GetDriverByName("ESRI Shapefile") dataSource = driver.Open(shapefile, 0) layer = dataSource.GetLayer() for feature in layer: geom = feature.GetGeometryRef() print geom.Centroid().ExportToWkt()
roscoeZA/GeoGigSync
ogr2ogr_convert.py
Python
cc0-1.0
272
import pickle from django.core.signing import JSONSerializer as BaseJSONSerializer class PickleSerializer: """ Simple wrapper around pickle to be used in signing.dumps and signing.loads. """ def dumps(self, obj): return pickle.dumps(obj, pickle.HIGHEST_PROTOCOL) def loads(self, data)...
edmorley/django
django/contrib/sessions/serializers.py
Python
bsd-3-clause
394
# -*- coding: utf-8 -*- from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('outreach', '0001_initial'), ] operations = [ migrations.AlterField( model_name='outreachevent', name='description', field=model...
sfu-fas/coursys
outreach/migrations/0002_make_description_longer.py
Python
gpl-3.0
389
# -*- coding: utf-8 -* import string DESCRIPTION = ""\ """ _ __ _ ___ / \| \ / \|_ _| ( o ) o ) o || | \_/|__/|_n_||_| ------------------------------------------- _ __ _ ___ / \ | \ / \ |_ _| ( o ) o ) ...
quentinhardy/odat
Constants.py
Python
lgpl-3.0
1,740
import os import importlib from django.conf import settings from geotrek.common.parsers import Parser if 'geotrek.zoning' in settings.INSTALLED_APPS: import geotrek.zoning.parsers # noqa if 'geotrek.sensitivity' in settings.INSTALLED_APPS: import geotrek.sensitivity.parsers # noqa def subclasses(cls): ...
GeotrekCE/Geotrek-admin
geotrek/common/utils/import_celery.py
Python
bsd-2-clause
2,058
# -*- coding: utf-8 -*- ''' Genesis Add-on Copyright (C) 2015 lambda This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any ...
AMOboxTV/AMOBox.LegoBuild
plugin.video.titan/resources/lib/resolvers/videowood.py
Python
gpl-2.0
1,605
__all__ = [ "autoregulation.py", "feedforward_loop.py", "__init__.py", "multi_input.py", "simple_regulation.py", "single_input.py" ]
kietjohn/network_motif
motif/__init__.py
Python
mit
141
#!/usr/bin/env python # # 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 # # Unless required by applicable law o...
ychen820/microblog
y/google-cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/shutdown_test.py
Python
bsd-3-clause
2,746
# 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...
npuichigo/ttsflow
third_party/tensorflow/tensorflow/contrib/keras/python/keras/layers/convolutional_recurrent.py
Python
apache-2.0
24,296
''' Created on Jan 10, 2017 @author: tamsyn ''' import basefilter import rblquery import filterfactory class RBLFilter(basefilter.BaseFilter): ''' classdocs ''' def __init__(self, msg, params): ''' Constructor ''' basefilter.BaseFilter.__init__(self...
tamsynlin/dragon-master
sample/rblfilter.py
Python
mit
903
import cutil import logging from selenium import webdriver from web_wrapper.web import Web from web_wrapper.selenium_utils import SeleniumUtils logger = logging.getLogger(__name__) class DriverSeleniumPhantomJS(Web, SeleniumUtils): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) ...
xtream1101/web-wrapper
web_wrapper/driver_selenium_phantomjs.py
Python
mit
4,415
# # Code by Alexander Pruss and under the MIT license # # mengersponge [levels [options]] # levels is a level count, up to 5 # options is a string of characters containing possibly the options 's' for 'slice' (cut off a diagonal slice) and 'c' for 'color' # from mine import * import mcpi.settings as setting...
arpruss/raspberryjam-pe
p2/scripts3/mengersponge.py
Python
mit
2,297
from copy import deepcopy from common.serializers.serialization import pool_state_serializer from plenum.common.constants import TARGET_NYM, DATA, ALIAS, SERVICES from plenum.common.ledger import Ledger from plenum.server.pool_req_handler import PoolRequestHandler as PHandler from indy_common.auth import Authoriser f...
spivachuk/sovrin-node
indy_node/server/pool_req_handler.py
Python
apache-2.0
2,510
#MenuTitle: HT LetterSpacer UI # # Letterspacer, an auto-spacing tool # Copyright (C) 2009 - 2018, The Letterspacer Project Authors # # Version 1.1 import HT_LetterSpacer_script try: from importlib import reload except: pass reload(HT_LetterSpacer_script) HT_LetterSpacer_script.HTLetterspacerScript(ui=True)
huertatipografica/HTLetterspacer
HT_LetterSpacer_UI.py
Python
gpl-3.0
313
import math class NaiveBayesClassifier(object): def __init__(self, x, y): self.classes = set(y) self.class_count = len(set(y)) self.train = zip(x,y) def classProb(self, clss, input, method='regular'): try: x_probab = [] clssProbability = len(filter(lambda u: u[1] == clss, self.train))/float(len(self...
meet-vora/mlp-classifier
models/naiveScratch.py
Python
mit
1,876
# $Id: __init__.py,v 1.1.1.1 2005/10/29 18:20:48 provos Exp $ from dpkt import * import ip, ah, aim, arp, asn1, cdp, dhcp, dns, dtp, esp, ethernet, gre, hsrp, \ http, icmp, icmp6, igmp, ip6, ipx, loopback, netbios, netflow, ospf, \ pcap, pim, rpc, smb, stp, stun, tcp, telnet, tftp, tns, udp, \ vr...
Banjong1990/honey
dpkt/dpkt/__init__.py
Python
gpl-2.0
330
import numpy as np import requests import unicornhat as hat URL = 'https://api.tfl.gov.uk/Line/Mode/tube,overground,dlr/Status' LINES = [ 'bakerloo', # 'central', # 'circle', # 'district', 'dlr', 'hammersmith-city', 'jubilee', # 'metropolitan', # 'northern', # 'london-...
noelevans/sandpit
rpi/all_tube_status.py
Python
mit
1,045
import time from java.lang import Thread, Runnable from java.awt import Canvas, Dimension from java.awt.event import KeyListener, KeyEvent, ComponentListener from java.awt.image import MemoryImageSource from synchronize import make_synchronized import jgl.GL import jgl.GLU import jgl.GLUT from Game import Game import ...
borsboom/babal
src/JGLBabalCanvas.py
Python
gpl-2.0
3,751
# coding=utf8 # # Copyright 2013 Dreamlab Onet.pl # # This library 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; # version 3.0. # This library is distributed in the hope that it will be useful, # bu...
tikan/rmock
tests/unit_tests/test_rmock_data.py
Python
lgpl-3.0
4,347
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)) ...
tomhenderson/ns-3-dev-git
src/virtual-net-device/bindings/modulegen__gcc_LP64.py
Python
gpl-2.0
265,434
from network import * class QNetwork(Network): def __init__(self, conf): """ Set up remaining layers, loss function, gradient compute and apply ops, network parameter synchronization ops, and summary ops. """ super(QNetwork, self).__init__(conf) ...
traai/async-deep-rl
algorithms/q_network.py
Python
apache-2.0
4,926
from app import db from app.models import OrderProduct from datetime import datetime class Product(db.Model): __tablename__ = 'products' id = db.Column(db.Integer, primary_key=True) timestamp = db.Column(db.DateTime, default=datetime.utcnow) company_id = db.Column(db.Integer, db.ForeignKey('companies....
luisfcofv/Superhero
app/models/product.py
Python
mit
927
# Copyright (C) 2018 Red Hat, Inc., # This file is part of the sos project: https://github.com/sosreport/sos # # This copyrighted material is made available to anyone wishing to use, # modify, copy, or redistribute it subject to the terms and conditions of # version 2 of the GNU General Public License. # # See the LICE...
nijinashok/sos
sos/plugins/ovirt_node.py
Python
gpl-2.0
1,069
# Copyright 2017 NeuStar, Inc.All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
sbarbett/ssp-sdk-python
src/blacklists.py
Python
apache-2.0
1,822
#!/usr/bin/python # Copyright (c) 2014 Wladmir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' Script to generate list of seed nodes for chainparams.cpp. This script expects two text files in the directory that...
vericoin/vericoin-core
contrib/seeds/generate-seeds.py
Python
mit
4,378
import json import argparse import csv from datetime import datetime, timedelta from itertools import izip_longest, izip parser = argparse.ArgumentParser(description="Run a script to clean up json files for RAW")#Setting up our Argument Parser parser.add_argument('-i', '--inputFile', help="input .json file", required=...
rochester-rcl/rcl-utils
pythonScripts/jsonParse.py
Python
gpl-2.0
1,863
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # Copyright 2015-2018 Alexander Cogneau (acogneau) <alexander.cogneau@gmail.com>: # # 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...
toofar/qutebrowser
tests/unit/browser/webkit/test_cookies.py
Python
gpl-3.0
5,483
# stdlib imports import os import pickle from operator import itemgetter import types import shutil from cStringIO import StringIO # numpy imports import numpy as np # scikit-learn imports import sklearn from sklearn.cross_validation import StratifiedKFold from sklearn.metrics import roc_auc_score from sklearn.ensemb...
yukisakurai/hhana
mva/classify.py
Python
gpl-3.0
25,774
# Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
google/citest
tests/json_contract/observation_verifier_test.py
Python
apache-2.0
14,132
#! /usr/bin/python # Copyright (c) 2014 Kyle Delaney # 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 l...
DrKylstein/Media-Gizmo
display_daemon.py
Python
bsd-3-clause
4,946
# -*- coding: utf-8 -*- # Copyright 2015 Spanish National Research Council # Copyright 2016 LIP - Lisbon # # 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/licens...
LIP-Computing/occi-net
ooi/tests/controllers/test_helpers.py
Python
apache-2.0
57,221
#!/usr/bin/env python3 import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "jeito.settings_local") from django.core.management import execute_from_command_line execute_from_command_line(sys.argv)
eedf/jeito
manage.py
Python
mit
256
# coding: utf-8 from PyQt4.QtCore import QFileInfo from qgis.core import QgsProject from qgis.utils import iface # Get the project instance project = QgsProject.instance() # Get layer tree print(project.layerTreeRoot()) # QgsLayerTreeGroup # Print the current project file name (might be empty in case no projects ha...
webgeodatavore/pyqgis-samples
core/qgis-sample-QgsProject.py
Python
gpl-2.0
1,262
from CoolProp.HumidAirProp import HAProps print("Validation against H.F. Nelson and H.J. Sauer,\"Formulation for High-Temperature Properties for Moist Air\", HVAC&R Research v.8 #3, 2002") print("Note: More accurate formulation employed than in Nelson. Just for sanity checking") print("Yields a negative relative hum...
henningjp/CoolProp
Web/fluid_properties/Validation/NelsonValidation.py
Python
mit
2,931
import sublime_plugin import os def get_folder_for_view(view, folders): for folder in folders: if view.file_name() and view.file_name().startswith(folder): return os.path.relpath(view.file_name(), folder) return "" def get_view_info(view, folders): """Returns the name for the passed v...
ice9js/power-shift-sublime
power_shift.py
Python
mit
1,372
from django.conf.urls import include from django.urls import path from django.contrib import admin import django_js_reverse.views from rest_framework.routers import DefaultRouter from common.routes import routes as common_routes router = DefaultRouter() routes = common_routes for route in routes: router.registe...
vintasoftware/django-react-boilerplate
backend/project_name/urls.py
Python
mit
636
# -*- coding: utf8 -*- # This file is part of PyBossa. # # Copyright (C) 2014 SF Isle of Man Limited # # PyBossa 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 Foundation, either version 3 of the License, or # (at...
stefanhahmann/pybossa
test/test_uploader/test_local_uploader.py
Python
agpl-3.0
7,020
#!/usr/bin/env python from ciscoconfparse import CiscoConfParse print "We will use this program to parse a cisco config file" filename = raw_input("Please enter the name of the file that needs to be parsed: ") #print filename input_file = CiscoConfParse(filename) crypto_find = input_file.find_objects_w_child(parentsp...
networkpadwan/appliedpython
week1/parse2.py
Python
apache-2.0
435
# -*- coding: utf-8 -*- # # This file is part of NINJA-IDE (http://ninja-ide.org). # # NINJA-IDE 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 # any later version. # # NIN...
goblincoding/ninja-ide
ninja_ide/gui/dialogs/preferences/preferences_editor_configuration.py
Python
gpl-3.0
13,499
""" PureFTP Blueprint =============== **Fabric environment:** .. code-block:: yaml blueprints: - blues.pureftp settings: pureftp: users: - username: joe password: rosebud """ import os from fabric.context_managers import settings from fabric.contrib import files fro...
5monkeys/blues
blues/pureftp.py
Python
mit
6,003
""" GBM_exp.py Author: Ginny Cunningham Date: December 11, 2017 For a given magnitude and time of a GRB, calculate the expected magnitude at a later time assuming a power law decay. Usage: python GBM_exp.py [Initial_Magnitude] [Age of Burst] """ import numpy as np import matplotlib.pyplot as plt impo...
scizen9/kpy
GRB/GBM_exp.py
Python
gpl-2.0
1,780
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2010 - 2014 Savoir-faire Linux # (<http://www.savoirfairelinux.com>). # # This program is free software: you can redistribute it a...
open-synergy/runbot-addons
runbot_build_instructions/runbot_build.py
Python
agpl-3.0
6,892
# -*- coding: utf-8 -*- import os import pygame import random import classes.board import classes.extras as ex import classes.game_driver as gd import classes.level_controller as lc class Board(gd.BoardGame): def __init__(self, mainloop, speaker, config, screen_w, screen_h): self.lvlc = mainloop.xml_con...
imiolek-ireneusz/eduActiv8
game_boards/game027.py
Python
gpl-3.0
9,800
from suds.client import Client from nova import exception from nova import db import logging logging.getLogger('suds').setLevel(logging.INFO) def update_for_run_instance(service_url, region_name, server_port1, server_port2, dpid1, dpid2): # check region name client = Client(service_url + "?wsdl") client...
nii-cloud/dodai-compute
nova/virt/dodai/ofc_utils.py
Python
apache-2.0
2,420
#!/usr/bin/env python # coding:utf-8 vi:et:ts=2 # Python Rewriter predefined loader code. # Copyright 2013 Grigory Petrov # See LICENSE for details. import imp import os class Context( object ): _inst_o = None def __init__( self ): self.predefined = {} @classmethod def get( s...
eyeofhell/pyrewriter
pyrewriter/predefined.py
Python
gpl-3.0
808
class Settings(): def __init__(self): # screen parameters self.screen_width, self.screen_height = 800, 600 self.bg_color = 200, 200, 200 self.scoreboard_height = 50 self.button_width, self.button_height = 250, 50 self.button_bg = (0,163,0) self.button_text_c...
ehmatthes/balloon_ninja
Settings.py
Python
mit
1,274
from datetime import datetime, time, timedelta from django.utils import timezone import sal.plugin from server.models import ManagedItemHistory STATUSES = ('present', 'pending', 'error') class MunkiInstalls(sal.plugin.Widget): description = 'Chart of Munki install activity' widget_width = 8 supported...
salopensource/sal
server/plugins/munkiinstalls/munkiinstalls.py
Python
apache-2.0
1,529
import logging from concurrent.futures import ThreadPoolExecutor import stomp from stomp.listener import TestListener from .testutils import * executor = ThreadPoolExecutor() def create_thread(fc): f = executor.submit(fc) print("Created future %s on executor %s" % (f, executor)) return f class Reconn...
jasonrbriggs/stomp.py
tests/test_override_threading.py
Python
apache-2.0
1,654
from __future__ import division, print_function, absolute_import from functools import reduce import numpy as np import numpy.testing as npt from dipy.reconst.multi_voxel import _squash, multi_voxel_model, CallableArray from dipy.core.sphere import unit_icosahedron def test_squash(): A = np.ones((3, 3), dtype=...
maurozucchelli/dipy
dipy/reconst/tests/test_multi_voxel.py
Python
bsd-3-clause
5,227
from itertools import chain from django.contrib.contenttypes.models import ContentType from django.core.exceptions import ValidationError from django.test import TestCase import guardian from guardian.backends import ObjectPermissionBackend from guardian.exceptions import GuardianError from guardian.exceptions import...
sumit4iit/django-guardian
guardian/tests/other_test.py
Python
bsd-2-clause
12,625
import pyrge, random __doc__="""A simple particle emitter An L{Emitter} can be used to create particle emission effects like explosions, eruptions, fountains, and so on. It works by creating a number of particles of a particular class, with random (but constrained) velocities. Each particle has its own lifetime, and ...
momikey/pyrge
emitter.py
Python
lgpl-2.1
5,678
from paddle.trainer.PyDataProvider2 import * # Define a py data provider @provider(input_types={ 'pixel': dense_vector(28 * 28), 'label': integer_value(10) }) def process(settings, filename): # settings is not used currently. f = open(filename, 'r') # open one of training file for line in f: # rea...
zuowang/Paddle
doc_cn/ui/data_provider/mnist_provider.dict.py
Python
apache-2.0
687
import numpy as np from bokeh.document import Document from bokeh.models import ColumnDataSource, DataRange1d, Plot, LinearAxis, Grid from bokeh.models.glyphs import MultiLine from bokeh.plotting import show N = 9 x = np.linspace(-2, 2, N) y = x**2 xpts = np.array([-.09, -.12, .0, .12, .09]) ypts = np.array([-.1, ...
almarklein/bokeh
tests/glyphs/MultiLine.py
Python
bsd-3-clause
1,133
# Copyright 2017 ProjectQ-Framework (www.projectq.ch) # # 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...
ProjectQ-Framework/FermiLib
src/fermilib/transforms/_jordan_wigner_test.py
Python
apache-2.0
14,760
# -*- coding: utf-8 -*- from copy import deepcopy import pytest import yaml from awx.main.utils.safe_yaml import safe_dump @pytest.mark.parametrize('value', [None, 1, 1.5, []]) def test_native_types(value): # Native non-string types should dump the same way that `yaml.safe_dump` does assert safe_dump(value) ...
GoogleCloudPlatform/sap-deployment-automation
third_party/github.com/ansible/awx/awx/main/tests/unit/utils/test_safe_yaml.py
Python
apache-2.0
2,424
# urls.py from django.conf.urls.defaults import * urlpatterns = patterns('approver.views', (r'^$', 'list_tweets'), (r'^review/(?P<tweet_id>\d+)', 'review_tweet'), )
YuxuanLing/trunk
trunk/code/study/python/core_python_appilication/ch11/myproject/approver/urls.py
Python
gpl-3.0
181
UserFile='./UserList.txt'
51reboot/actual_09_homework
05/qicheng/gconf.py
Python
mit
26
# Generated by Django 2.0.10 on 2019-05-05 23:44 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('userprofile', '0014_auto_20190430_2023'), ] operations = [ migrations.AddField( model_name='profile', name='allergi...
hackerspace-ntnu/website
userprofile/migrations/0015_auto_20190505_2344.py
Python
mit
1,432
import sys import os import re full_path = sys.argv[1] if not os.path.isdir(full_path): print('folder expected') exit(1) os.chdir(full_path) dirname = os.path.basename(full_path) print('Tracklist: ') for f in [fl for fl in os.listdir(full_path) if fl.endswith('.flac')]: new_name = f.replace(dirname, '')...
singulart/bandcd
tracklist.py
Python
mit
451
from blinker import signal pre_init = signal('application-pre-init') post_init = signal('application-post-init') pre_registration = signal('application-pre-registration') post_registration = signal('application-post-registration') pre_create_database = signal('application-pre-create-database') post_create_database = s...
JeffHeard/sondra
sondra/application/signals.py
Python
apache-2.0
735
from django import forms PRODUCT_QUANTITY_CHOICES = [(i, str(i)) for i in range(1, 21)] class CartAddProductForm(forms.Form): quantity = forms.TypedChoiceField( choices=PRODUCT_QUANTITY_CHOICES, coerce=int ) update = forms.BooleanField( required=False, initial=False, ...
ch1huizong/dj
onlineshop/myshop/cart/forms.py
Python
unlicense
355
def f(m,n): ans = 1 while (m - n >= 0): (ans,m) = (ans*2,m-n) return(ans)
selvagit/experiments
nptel/nptel_programming_data_structure/week_1/q3.py
Python
gpl-3.0
97
print "Running SMS request parse script" marker = db(db.gis_marker.name=="phone").select() feature = db(db.gis_feature_class.name=="SMS").select() marker_id = marker[0]['id'] if len(marker) == 1 else None feature_id = feature[0]['id'] if len(feature) == 1 else None def rss2record(entry): myd = {} locd = {}...
luisibanez/SahanaEden
cron/rms_sms2record.py
Python
mit
6,616
# Copyright DataStax, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, softwa...
thelastpickle/python-driver
tests/integration/__init__.py
Python
apache-2.0
25,475
# Copyright 2012 Nebula, Inc. # Copyright 2013 IBM Corp. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required...
berrange/nova
nova/tests/integrated/test_api_samples.py
Python
apache-2.0
173,795
"""Test code for upsampling""" import numpy as np import tvm import topi import topi.testing import math def verify_upsampling(batch, in_channel, in_height, in_width, scale, layout='NCHW', method="NEAREST_NEIGHBOR"): if layout == 'NCHW': A = tvm.placeholder((batch, in_channel, in_height, in_width), name=...
mlperf/training_results_v0.6
Fujitsu/benchmarks/resnet/implementations/mxnet/3rdparty/tvm/topi/tests/python/test_topi_upsampling.py
Python
apache-2.0
2,484
########################################################################## # # Copyright (c) 2012, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistribu...
appleseedhq/cortex
test/IECoreGL/FontLoaderTest.py
Python
bsd-3-clause
2,272
# coding: utf-8 import json from .tapioca import TapiocaInstantiator from .exceptions import ( ResponseProcessException, ClientError, ServerError) def generate_wrapper_from_adapter(adapter_class): return TapiocaInstantiator(adapter_class) class TapiocaAdapter(object): def get_api_root(self, api_param...
vu3jej/tapioca-wrapper
tapioca/adapters.py
Python
mit
2,191
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from __future__ import print_function import sys import itertools import spack.cmd import spack.environment as ev import...
rspavel/spack
lib/spack/spack/cmd/uninstall.py
Python
lgpl-2.1
12,598
# -*- coding: utf-8 -*- """ *************************************************************************** SelectByAttribute.py --------------------- Date : May 2010 Copyright : (C) 2010 by Michael Minn Email : pyqgis at michaelminn dot com *******************...
spaceof7/QGIS
python/plugins/processing/algs/qgis/SelectByAttribute.py
Python
gpl-2.0
5,585
from django.test import TestCase from ..middleware.frontendcontext import FrontendContextMiddleware class MockRequest(object): pass class FrontendContextMiddlewareTests(TestCase): def test_middleware_frontend_context_dict(self): """Middleware sets frontend_context dict on request""" request...
1905410/Misago
misago/core/tests/test_frontendcontext_middleware.py
Python
gpl-2.0
454
# Copyright (c) 2021 by Rocky Bernstein """ Python PyPy 3.7 decompiler scanner. Does some additional massaging of xdis-disassembled instructions to make things easier for decompilation. """ import decompyle3.scanners.scanner37 as scan # bytecode verification, verify(), uses JUMP_OPS from here from xdis.opcodes impo...
rocky/python-uncompyle6
uncompyle6/scanners/pypy37.py
Python
gpl-3.0
731
from django.shortcuts import render from django.views.generic import TemplateView from comments.models import Comments from comments.forms import CommentsForm class CommentsView(TemplateView): template_name='comments.html' def get(self, request): form = CommentsForm() return render( ...
oy-np/django-contact-form
django_contact_form/comments/views.py
Python
mit
866
#!/usr/bin/env python # coding: utf8 # ____ _____ # ________ _________ ____ / __ \/ ___/ # / ___/ _ \/ ___/ __ \/ __ \/ / / /\__ \ # / / / __/ /__/ /_/ / / / / /_/ /___/ / # ...
Daverball/reconos
tools/python/mhstools.py
Python
gpl-2.0
7,320
import string class Solution(object): def isPalindrome(self, s): """ :type s: str :rtype: bool """ l, r = 0, len(s) - 1 while l < r: while l < r and not s[l].isalnum(): l += 1 while l < r and not s[r].isalnum(): ...
Jspsun/LEETCodePractice
Python/ValidPalindrome.py
Python
mit
533
# Copyright 2017-2021 TensorHub, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writ...
guildai/guild
guild/commands/stop.py
Python
apache-2.0
965
# # Copyright 2017-2019 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed ...
oVirt/vdsm
tests/hugepages_test.py
Python
gpl-2.0
16,013
# -*- 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
monhustla/line-bot-sdk-python
linebot/__about__.py
Python
apache-2.0
821
# PyAlgoTrade # # Copyright 2011-2015 Gabriel Martin Becedillas Ruiz # # 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 ap...
cgqyh/pyalgotrade-mod
testcases/trades_analyzer_test.py
Python
apache-2.0
22,683
# Author: Roberto Polli <rpolli@redhat.com> # # NOTE: Edit the jcmd location according to your path or use update-alternatives. global BIN_JCMD BIN_JCMD = '/usr/bin/jcmd' class dstat_plugin(dstat): """ This plugin gathers jvm stats via jcmd. Usage: JVM_PID=15123 dstat --jvm-full Minimize the...
dagwieers/dstat
plugins/dstat_jvm_full.py
Python
gpl-2.0
4,523
# 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...
CCI-MOC/python-novaclient
novaclient/tests/unit/fixture_data/images.py
Python
apache-2.0
2,783
import modeltranslation from modeltranslation.translator import translator def expand_model_fields(model, field_names): model_class = type(model) try: trans_field_mapping = translator.get_options_for_model(model_class).fields except modeltranslation.translator.NotRegistered: return field_n...
City-of-Helsinki/linkedevents
events/translation_utils.py
Python
mit
691
# Copyright (c) 2012 Santosh Philip # ======================================================================= # Distributed under the MIT License. # (See accompanying file LICENSE or copy at # http://opensource.org/licenses/MIT) # ======================================================================= """py.test fo...
pachi/eppy
p3/eppy/tests/test_examples.py
Python
mit
3,864
# Mercurial extension to provide 'hg relink' command # # Copyright (C) 2007 Brendan Cully <brendan@kublai.com> # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. """recreates hardlinks between repository clones""" from mercurial imp...
mikel-egana-aranguren/SADI-Galaxy-Docker
galaxy-dist/eggs/mercurial-2.2.3-py2.7-linux-x86_64-ucs4.egg/hgext/relink.py
Python
gpl-3.0
6,076
from django.conf import settings from django.contrib.auth import authenticate from django.contrib.auth import login from ...forms import RegistrationForm from ...models import User class SimpleBackend(object): """ A registration backend which implements the simplest possible workflow: a user supplies a u...
stefankoegl/django-couchdb-utils
django_couchdb_utils/registration/backends/simple/__init__.py
Python
bsd-3-clause
2,028
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
AutorestCI/azure-sdk-for-python
azure-mgmt-network/azure/mgmt/network/v2017_06_01/models/vpn_client_configuration.py
Python
mit
3,065
import pytest from django.urls import reverse users = ( ('editor', 'editor'), ('reviewer', 'reviewer'), ('user', 'user'), ('api', 'api'), ('anonymous', None), ) status_map = { 'list': { 'editor': 200, 'reviewer': 200, 'api': 200, 'user': 200, 'anonymous': 401 }, } urlnames = { ...
rdmorganiser/rdmo
rdmo/questions/tests/test_viewset_widgettype.py
Python
apache-2.0
669
from openstack_portation import utils from neutronclient.common import exceptions as neutron_exceptions import logging log = logging.getLogger(__name__) def create_network(neutron, keystone, **args): log.debug('Creating network:%s' % args) tenant = utils.find_project(keystone, ...
tnoff/OpenStack-Account-Setup
openstack_portation/openstack/neutron.py
Python
bsd-2-clause
3,246
"""Library implementing different ways to preprocess the data. """ import re import numpy as np import skimage.io import skimage.transform from itertools import izip from functools import partial import quasi_random import utils from configuration import config from image_transform import resize_to_make_it_fit, re...
317070/kaggle-heart
preprocess.py
Python
mit
47,808
# -*- coding: utf-8 -*- # @Author: Gillett Hernandez # @Date: 2017-11-28 21:37:36 # @Last Modified by: Gillett Hernandez # @Last Modified time: 2017-12-01 12:35:27 from euler_funcs import really_large_prime_sieve, basic_large_prime_sieve, large_prime_sieve, get_primes from math import log import os # since the nu...
gillett-hernandez/project-euler
Python/problem_187.py
Python
mit
3,139