code stringlengths 2 1.05M | repo_name stringlengths 5 104 | path stringlengths 4 251 | language stringclasses 1
value | license stringclasses 15
values | size int32 2 1.05M |
|---|---|---|---|---|---|
from random import randint
import time
# rolls n dice, reports results
def roll(n):
tally = [0, 0, 0, 0, 0, 0]
for i in range(n):
r = randint(0, 5)
tally[r] += 1
return tally
def main():
n = 0
while n <= 0:
n = int(input("How many dice would you like to roll? "))
... | eldho5505/OOP | dice.py | Python | gpl-2.0 | 689 |
#!/usr/bin/env python
# -*- mode: python; coding: utf-8; -*-
##---------------------------------------------------------------------------##
##
## Copyright (C) 1998-2003 Markus Franz Xaver Johannes Oberhumer
## Copyright (C) 2003 Mt. Hood Playing Card Co.
## Copyright (C) 2005-2009 Skomoroh
##
## This program is free ... | TrevorLowing/PyGames | pysollib/winsystems/__init__.py | Python | gpl-2.0 | 1,307 |
def topic_id2word(p):
f = open(p + "/model.vPhi")
wfile = open(p + "/model.vPhi.new", "w")
words = load(p + "/dict.txt");
for line in f:
dict = {}
i = 0
for w in line.strip().split(" "):
try:
tmp = float(w)
except:
print w
... | ariwaranosai/acfun-LDA | last.py | Python | gpl-2.0 | 765 |
# -*- coding: utf-8 -*-
import attr
from navmazing import NavigateToAttribute
from navmazing import NavigateToSibling
from widgetastic.widget import Table
from widgetastic.widget import Text
from widgetastic.widget import TextInput
from widgetastic_patternfly import Button
from widgetastic_patternfly import Input
from... | apagac/cfme_tests | cfme/control/explorer/policy_profiles.py | Python | gpl-2.0 | 6,869 |
# Copyright (c) 2016 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of G... | jhutar/spacewalk | backend/cdn_tools/manifest.py | Python | gpl-2.0 | 8,783 |
# -*- coding: utf-8 -*-
from django.db import migrations, models
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name="UserActivateKey"... | Nitrate/Nitrate | src/tcms/auth/migrations/0001_initial.py | Python | gpl-2.0 | 1,148 |
#!/usr/bin/env python
__author__ = 'Ben "TheX1le" Smith, Marfi'
__email__ = 'thex1le@gmail.com'
__website__= ''
__date__ = '04/26/2011'
__version__ = '2011.4.26'
__file__ = 'ouiParse.py'
__data__ = 'a class for dealing with the oui txt file'
"""
########################################
#
# This program and its support... | creaktive/aircrack-ng | scripts/airgraph-ng/airgraphviz/libOuiParse.py | Python | gpl-2.0 | 8,152 |
#
# Copyright 2020 University of Washington
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation;
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARR... | nsnam/ns-3-dev-git | src/wifi/examples/reference/bianchi11ax.py | Python | gpl-2.0 | 6,874 |
"""
Overriding Context
------------------
It is possible to override context members that the operator sees, so that they
act on specified rather than the selected or active data, or to execute an
operator in the different part of the user interface.
The context overrides are passed as a dictionary, with keys matchin... | pawkoz/dyplom | blender/doc/python_api/examples/bpy.ops.1.py | Python | gpl-2.0 | 640 |
import collections
import io
import itertools
from ..mkExceptions import BadProQuestRecord, RecordsNotCompatible
from ..mkRecord import ExtendedRecord
from .tagProcessing.specialFunctions import proQuestSpecialTagToFunc
from .tagProcessing.tagFunctions import proQuestTagToFunc
class ProQuestRecord(ExtendedRecord):
... | networks-lab/metaknowledge | metaknowledge/proquest/recordProQuest.py | Python | gpl-2.0 | 4,491 |
class CatchOutput(object):
def __init__(self, out, text):
self.__out = out
self.__text = text
def write(self, text):
if self.__text in text:
raise Exception, text
else:
return self.__out.write(text)
def __getattr__(self, name):
return getattr(self.__out, name)
if __name__ == '__main__':
import ... | onoga/toolib | toolib/dbg/CatchOutput.py | Python | gpl-2.0 | 398 |
# Copyright (C) 2006-2011 Canonical Ltd
#
# 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 distribute... | Distrotech/bzr | bzrlib/tests/per_workingtree/__init__.py | Python | gpl-2.0 | 6,108 |
#!/usr/bin/env python
# encoding: utf-8
#
# rbootstrap - Install RPM based Linux into chroot jails
# Copyright (C) 2014 Lars Michelsen <lm@larsmichelsen.com>
#
# 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 Softwar... | LaMi-/rbootstrap | rbootstrap/config.py | Python | gpl-2.0 | 3,462 |
'''
This is not part of specification
Helper class to make it work as python lib
'''
from .attribute import DbusAttr
from .interface import DbusInterface
from .method import DbusMethod
from .signal import DbusSignal
from .utils import get_mainloop, get_uri, implements, \
list_all_interface, list_interfaces, list_pat... | pat1/autoradio | autoradio/mpris2/decorator/__init__.py | Python | gpl-2.0 | 323 |
##
# This file is part of Netsukuku
# (c) Copyright 2008 Daniele Tricoli aka Eriol <eriol@mornie.org>
#
# This source code 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 ... | vg/netsukuku | pyntk/test/test_inet.py | Python | gpl-2.0 | 2,216 |
#!/usr/bin/env python
# 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 ... | PandaWei/avocado | avocado/utils/software_manager.py | Python | gpl-2.0 | 32,607 |
# -*- coding: utf-8 -*-
try:
from unittest import mock
except ImportError:
import mock
from guessing import i18n
@mock.patch.dict('guessing.i18n.environ', LC_MESSAGES='he_IL')
def test_lang_lc_message_he():
assert i18n.lang() == 'he'
def test_lang_default():
with mock.patch.dict('guessing.i18n.envi... | eliadl/talks | 20170613-mock/code/ggee/tests/test_i18n.py | Python | gpl-3.0 | 2,534 |
# Izhikevich.py ---
#
# Filename: Izhikevich.py
# Description:
# Author: Subhasis Ray
# Maintainer:
# Created: Fri May 28 14:42:33 2010 (+0530)
# Version:
# Last-Updated: Tue Sep 11 14:27:18 2012 (+0530)
# By: subha
# Update #: 1212
# URL:
# Keywords:
# Compatibility:
#
#
# Commentary:
#
# th... | BhallaLab/moose | moose-examples/izhikevich/Izhikevich.py | Python | gpl-3.0 | 23,767 |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------
# pelisalacarta 4
# Copyright 2015 tvalacarta@gmail.com
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#
# Distributed under the terms of GNU General Public License v3 (GPLv3)
# http://www.gnu.org/licenses/gpl-3.0.html
# --... | Hernanarce/pelisalacarta | python/version-mediaserver/platformcode/launcher.py | Python | gpl-3.0 | 24,841 |
# Copyright (C) 2007, Red Hat, Inc.
# Copyright (C) 2007, One Laptop Per Child
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ... | guarddogofww/cs108test | src/jarabe/frame/clipboardicon.py | Python | gpl-3.0 | 8,080 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Code adapted from https://stackoverflow.com/questions/21923249/logging-formatting-right-justify-level-name
import logging
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(8)
#The background is set with 40 plus the number of the color, and the foreground wi... | sciunto-org/scifig | libscifig/collogging.py | Python | gpl-3.0 | 1,446 |
"""
vishay IHSM series inductors
http://www.vishay.com/docs/34018/ihsm3825.pdf
http://www.vishay.com/docs/34019/ihsm4825.pdf
http://www.vishay.com/docs/34020/ihsm5832.pdf
http://www.vishay.com/docs/34021/ihsm7832.pdf
"""
#sizes,shapes,etc]
#name, L, W, pad-w, pad-w, pad-gap, pad-h, datasheet
inductors = [
[3825, 11.18... | pointhi/kicad-footprint-generator | scripts/Inductors/vishay_IHSM.py | Python | gpl-3.0 | 3,297 |
# Copyright 2015 Hewlett-Packard Development Company, L.P.
#
# 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 applicabl... | ctrlaltdel/neutrinator | vendor/requestsexceptions/__init__.py | Python | gpl-3.0 | 2,032 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/copyleft/gpl.txt
from pisi.actionsapi import cmaketools
from pisi.actionsapi import get
from pisi.actionsapi import pisitools
def setup():
cmaketools.configure("-DCMAKE_BUILD_TYP... | vdemir/pisi_package | LXQT/addon/qterminal/actions.py | Python | gpl-3.0 | 607 |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, getdate, get_url
from frappe import _
from frappe.model.document import Document
from erpnext.controllers.... | RandyLowery/erpnext | erpnext/projects/doctype/project/project.py | Python | gpl-3.0 | 8,909 |
# Created By: Virgil Dupras
# Created On: 2010-09-11
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-... | fokusov/moneyguru | core/gui/entry_table_base.py | Python | gpl-3.0 | 15,063 |
# Copyright 2019 Virgil Dupras
#
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.gnu.org/licenses/gpl-3.0.html
from core.trans import trget
from .column import Column
from ..model.sort i... | brownnrl/moneyguru | core/gui/general_ledger_table.py | Python | gpl-3.0 | 2,408 |
import RPi.GPIO as GPIO
# RPi GPIO pin stuff (NOT USED ATM)
class GpioPins():
def __init__(self):
self.doorpin = 11
GPIO.setmode(GPIO.BOARD)
GPIO.setup(self.doorpin, GPIO.IN)
self.doorStatus = GPIO.input(self.doorpin)
def pollPins(self)
newDs = GPIO.input(self.doorpin)... | vranki/pajabot | bot/gpio_pins.py | Python | gpl-3.0 | 477 |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import gevent.monkey
gevent.monkey.patch_all()
from nyaa import app
if app.config["DEBUG"]:
from werkzeug.debug import DebuggedApplication
app.wsgi_app = DebuggedApplication(app.wsgi_app, True)
if __name__ == '__main__':
import gevent.pywsgi
gevent_server = gevent.pywsg... | uMag/nyaa | WSGI.py | Python | gpl-3.0 | 399 |
##
## This file is part of the libsigrokdecode project.
##
## Copyright (C) 2011 Gareth McMullin <gareth@blacksphere.co.nz>
## Copyright (C) 2012-2013 Uwe Hermann <uwe@hermann-uwe.de>
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as pu... | salberin/libsigrokdecode | decoders/usb_signalling/pd.py | Python | gpl-3.0 | 7,715 |
from django.forms.widgets import TextInput
from django.core.urlresolvers import reverse
from django.conf import settings
from django.utils.safestring import mark_safe
class TagAutocompleteTagIt(TextInput):
def __init__(self, max_tags, *args, **kwargs):
self.max_tags = (
max_tags
if... | hzlf/openbroadcast.org | website/apps/ac_tagging/widgets.py | Python | gpl-3.0 | 4,147 |
# -*- coding: utf-8 -*-
#
# COPYRIGHT (C) 2016-2017 Michael Labouebe <gfarmerfr@free.fr>
# COPYRIGHT (C) 2013 SeeSchloss <see@seos.fr>
# COPYRIGHT (C) 2009-2010 Quinox <quinox@users.sf.net>
# COPYRIGHT (C) 2006-2009 Daelstorm <daelstorm@gmail.com>
# COPYRIGHT (C) 2003-2004 Hyriand <hyriand@thegraveyard.org>
#
# GNU GEN... | gfarmerfr/nicotine-plus | pynicotine/gtkgui/userbrowse.py | Python | gpl-3.0 | 34,287 |
"""
Copyright (c) 2012-2020 RockStor, Inc. <http://rockstor.com>
This file is part of RockStor.
RockStor 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 la... | phillxnet/rockstor-core | src/rockstor/smart_manager/views/nfs_share_client_distrib.py | Python | gpl-3.0 | 1,051 |
# Kevin Nash (kjn33)
# EECS 293
# Assignment 12
from entity import Entity
class Actor(Entity):
""" A game entity that can act and be acted upon """
def __init__(self):
"""
Actors follow Entity initialization,
are given a null location
"""
super(Actor, self).__init__()... | Fullbiter/EECS-293 | pa12-13/airville/src/actor.py | Python | gpl-3.0 | 489 |
'''
Created on Nov 29, 2012
@author: Stephen O'Hara
Module with plotting code
'''
import pylab as pl
import cPickle
import os
import math
def loadRes_varyingTrees(datadir=".", fn="SIFT_10K_5trials_VaryingTrees.p"):
'''
Loads pickle files which store the trial details for the varyingNumTrees() experiment.
... | svohara/proximityforest | evaluation/WACV2013/plotResults.py | Python | gpl-3.0 | 2,576 |
# GromacsWrapper: formats.py
# Copyright (c) 2009-2011 Oliver Beckstein <orbeckst@gmail.com>
# Released under the GNU Public License 3 (or higher, your choice)
# See the file COPYING for details.
"""
Gromacs NDX index file format
=============================
The `.ndx file`_ contains lists of atom indices that are g... | PicoCentauri/GromacsWrapper | gromacs/fileformats/ndx.py | Python | gpl-3.0 | 7,868 |
"""Selenium tests for netmap"""
def test_netmap_index_should_not_have_syntax_errors(selenium, base_url):
selenium.get("{}/netmap/".format(base_url))
log = selenium.get_log("browser")
syntax_errors = [
line
for line in log
if "syntaxerror" in line.get("message", "").lower()
... | hmpf/nav | tests/functional/netmap_test.py | Python | gpl-3.0 | 394 |
# -*- coding: utf-8 -*-
##
##
## This file is part of Indico.
## Copyright (C) 2002 - 2014 European Organization for Nuclear Research (CERN).
##
## Indico 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; eith... | pferreir/indico-backup | indico/MaKaC/webinterface/common/slotDataWrapper.py | Python | gpl-3.0 | 9,205 |
from burp import ITab
from javax.swing import JPanel, GroupLayout, JLabel, JComboBox, JCheckBox
from java.awt import Dimension
from core.checks import plugins
class ConfigTab( ITab, JPanel ):
def __init__( self, callbacks ):
self._callbacks = callbacks
self._helpers = callbacks.getHelpers()
... | SecHackLabs/WebHackSHL | modules/tplmap/burp_extension/config_tab.py | Python | gpl-3.0 | 4,466 |
import requests
session = requests.session()
user ="mayank"
password = "test"
p = session.post("http://127.0.0.1:5000/api/users", {'user':user,'password':password})
print ('headers', p.headers)
print ('cookies', requests.utils.dict_from_cookiejar(session.cookies))
print ('html', p.text) | mayankjohri/LetsExplorePython | Section 2 - Advance Python/Chapter S2.05 - REST API - Server & Clients/code/clients/old/6_Cookies_with_Authentication.py | Python | gpl-3.0 | 290 |
#!/usr/bin/env python
# coding: UTF-8
from __future__ import print_function
import time
import numpy as np
from PIL import Image as pil_image
from tensorflow.keras.preprocessing.image import save_img
from tensorflow.keras import layers
from tensorflow.keras.applications import vgg16
from tensorflow.keras import backen... | sangwook236/SWDT | sw_dev/python/rnd/test/machine_learning/keras/keras_conv_filter_visualization.py | Python | gpl-3.0 | 8,314 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################################################
## ##
## This file is part of DPAPIck ##
## Windows DPAPI decryption & forensic ... | newsoft/dpapick | DPAPI/Probes/IE7.py | Python | gpl-3.0 | 4,651 |
# -*- coding: utf-8 -*-
class Charset(object):
common_name = 'NotoSerifGeorgian-Bold'
native_name = ''
def glyphs(self):
chars = []
chars.append(0x0000) #null ????
chars.append(0x000D) #nonmarkingreturn ????
chars.append(0x0020) #space SPACE
chars.append(0x00A0)... | davelab6/pyfontaine | fontaine/charsets/noto_chars/notoserifgeorgian_bold.py | Python | gpl-3.0 | 8,189 |
from .compute import *
| jmbeuken/abinit | scripts/post_processing/ElectronPhononCoupling/ElectronPhononCoupling/interface/__init__.py | Python | gpl-3.0 | 23 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
progress test (count to 1000)
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from ...utils.timing import TimedTestCase
from ..progress import together
class test_progress(TimedTestCase):
de... | Thetoxicarcade/ac | congredi/utils/test/test_progress.py | Python | gpl-3.0 | 391 |
# Copyright (C) 2013 Johnny Vestergaard <jkv@unixcluster.dk>
#
# 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 ... | threatstream/mnemosyne | test/test_webapi/test_d/dorks_test.py | Python | gpl-3.0 | 4,675 |
from mediastore.views import admin
| samsath/cpcc_backend | src/mediastore/views/__init__.py | Python | gpl-3.0 | 35 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import socorro.database.database as db
from configman import ConfigurationManager, Namespace
from configman.converters i... | bsmedberg/socorro | socorro/unittest/external/postgresql/unittestbase.py | Python | mpl-2.0 | 3,375 |
import abc
import errno
import os
import platform
import socket
import time
import traceback
import mozprocess
__all__ = ["SeleniumServer", "ChromeDriverServer", "EdgeChromiumDriverServer", "OperaDriverServer",
"GeckoDriverServer", "InternetExplorerDriverServer", "EdgeDriverServer",
"ServoDrive... | pyfisch/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/webdriver_server.py | Python | mpl-2.0 | 8,378 |
# ############################################################################
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core business i... | uclouvain/OSIS-Louvain | education_group/ddd/validators/_copy_check_mini_training_end_date.py | Python | agpl-3.0 | 1,855 |
# -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2021, Shuup Commerce Inc. All rights reserved.
#
# This source code is licensed under the OSL-3.0 license found in the
# LICENSE file in the root directory of this source tree.
from django import forms
from django.http import HttpResponseRedir... | shoopio/shoop | shuup/admin/modules/products/views/edit_parent.py | Python | agpl-3.0 | 3,373 |
# -*- encoding: utf-8 -*-
from osv import fields,osv,orm
import openerp.addons.decimal_precision as dp
class attribute_set(orm.Model):
_inherit = "attribute.set"
_columns = {
'type': fields.char('Type'),
'price_standard': fields.float('Standard Price', digits_compute= dp.get_precision('P... | 837278709/metro-openerp | metro_mto/mto_attribute.py | Python | agpl-3.0 | 6,783 |
''' -- imports from python libraries -- '''
import os
import csv
import json
import ast
import time
import datetime
''' imports from installed packages '''
from django.core.management.base import BaseCommand, CommandError
from mongokit import IS
try:
from bson import ObjectId
except ImportError: # old pymongo
f... | AvadootNachankar/gstudio | gnowsys-ndf/gnowsys_ndf/ndf/management/commands/data_entry.py | Python | agpl-3.0 | 45,442 |
# -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | odoousers2014/odoo_addons-2 | clv_tag/seq/__init__.py | Python | agpl-3.0 | 1,423 |
# This file is part of Shuup.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from django import forms
from django.db import models
from enumfields import Enum, EnumIntegerField
... | hrayr-artunyan/shuup | shuup_tests/core/test_enums.py | Python | agpl-3.0 | 763 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | pulinagrawal/nupic | examples/opf/experiments/multistep/simple_3/description.py | Python | agpl-3.0 | 1,645 |
# Copyright 2018 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import models
class StockMove(models.Model):
_inherit = 'stock.move'
def identify_blocking_objects(self, blocking_moves):
res = super().identify_blocking_objects(blocking_moves)
workorder... | Domatix/stock-logistics-workflow | mrp_stock_picking_restrict_cancel/models/stock_move.py | Python | agpl-3.0 | 456 |
from udata.features.notifications.actions import notifier
from .models import HarvestSource, VALIDATION_PENDING
import logging
log = logging.getLogger(__name__)
@notifier('validate_harvester')
def validate_harvester_notifications(user):
'''Notify admins about pending harvester validation'''
if not user.sys... | etalab/udata | udata/harvest/notifications.py | Python | agpl-3.0 | 774 |
"""
Unit tests for getting the list of courses and the course outline.
"""
import json
import lxml
from contentstore.tests.utils import CourseTestCase
from contentstore.utils import reverse_course_url, add_instructor
from contentstore.views.access import has_course_access
from course_action_state.models import CourseR... | carsongee/edx-platform | cms/djangoapps/contentstore/views/tests/test_course_index.py | Python | agpl-3.0 | 8,877 |
"""Test model properties."""
import pytest
from gremlin_python.statics import long
from goblin import element, exception, manager, properties
def test_set_change_property(person, lives_in):
# vertex
assert not person.name
person.name = 'leif'
assert person.name == 'leif'
person.name = 'leifur'
... | ZEROFAIL/goblin | tests/test_properties.py | Python | agpl-3.0 | 7,949 |
#
# Copyright 2018, Maha Farhat
#
# This file is part of the software gentb, consisting of custom
# code for the Inkscape project's django-based website.
#
# gentb 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 Fo... | IQSS/gentb-site | apps/predict/app.py | Python | agpl-3.0 | 1,507 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2017 VoltDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitati... | deerwalk/voltdb | tests/sqlcoverage/schema/joined-matview-string-schema.py | Python | agpl-3.0 | 3,168 |
#!/usr/bin/env python
# This file is part of VoltDB.
# Copyright (C) 2008-2017 VoltDB Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitati... | deerwalk/voltdb | tests/scripts/valleak.py | Python | agpl-3.0 | 3,161 |
# Generated by Django 3.0.4 on 2020-11-05 22:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtaildocs', '0010_document_file_hash'),
('pages', '0005_auto_20201105_1414'),
]
operations = [
mi... | openstax/openstax-cms | pages/migrations/0006_auto_20201105_1620.py | Python | agpl-3.0 | 631 |
# 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)
class PyNltk(PythonPackage):
"""The Natural Language Toolkit (NLTK) is a Python package for
natural language proc... | iulian787/spack | var/spack/repos/builtin/packages/py-nltk/package.py | Python | lgpl-2.1 | 37,778 |
# This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will b... | sfriesel/suds | suds/sax/parser.py | Python | lgpl-3.0 | 4,378 |
import webapp2
import models
class PrefsPage(webapp2.RequestHandler):
def post(self):
userprefs = models.get_userprefs()
try:
tz_offset = int(self.request.get('tz_offset'))
userprefs.tz_offset = tz_offset
userprefs.put()
except ValueError:
# ... | jscontreras/learning-gae | pgae-examples-master/2e/python/clock/clock4/prefs.py | Python | lgpl-3.0 | 541 |
import socket
import wsgiref.handlers
class App:
def __call__(self, environ, start_response):
# This won't work under GAE, since this is app code
here = socket.gethostbyname('localhost')
start_response('200 OK', [('Content-type', 'text/plain')])
return ['Hello %s' % here]
def appli... | udacity/nose2-gae | tests/bad_app/bad_app.py | Python | lgpl-3.0 | 460 |
"""
BinaryTree inter-engine communication class
use from bintree_script.py
Provides parallel [all]reduce functionality
"""
import cPickle as pickle
import re
import socket
import uuid
import zmq
from IPython.parallel.util import disambiguate_url
#-----------------------------------------------------------------... | cloud9ers/gurumate | environment/share/doc/ipython/examples/parallel/interengine/bintree.py | Python | lgpl-3.0 | 7,132 |
# Copyright 2016 Hewlett Packard Enterprise Development LP
#
# 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... | mahak/neutron | neutron/services/trunk/rpc/agent.py | Python | apache-2.0 | 4,441 |
from __future__ import absolute_import, unicode_literals
from case import Mock
from celery.worker.heartbeat import Heart
class MockDispatcher(object):
heart = None
next_iter = 0
def __init__(self):
self.sent = []
self.on_enabled = set()
self.on_disabled = set()
self.enab... | kawamon/hue | desktop/core/ext-py/celery-4.2.1/t/unit/worker/test_heartbeat.py | Python | apache-2.0 | 1,829 |
# Copyright 2014 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 ... | JPO1/python-docs-samples | appengine/ndb/modeling/relation_model_models_test.py | Python | apache-2.0 | 2,299 |
# Copyright 2013 NEC Corporation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required ... | cloudbase/lis-tempest | tempest/api/compute/admin/test_simple_tenant_usage_negative.py | Python | apache-2.0 | 2,648 |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function, unicode_literals
import platform
import re
import shlex
import sys
def is... | rsocket/rsocket-cpp | build/fbcode_builder/getdeps/platform.py | Python | apache-2.0 | 3,227 |
name = 'hello'
version = '1.0'
authors = ["dr.foo"]
uuid = "110c80c135c142479d47e756bdbbddf8"
description = "A very simple C++ project."
tools = ['hai']
build_command = "make -f {root}/Makefile {install}"
def commands():
env.PATH.append('{root}/bin')
| nerdvegas/rez | src/rez/data/tests/builds/packages/hello/1.0/package.py | Python | apache-2.0 | 258 |
"""Models for serialization of tests."""
from client.sources.common import core
class Test(core.Serializable):
name = core.String()
points = core.Float()
partner = core.String(optional=True)
def run(self, env):
"""Subclasses should override this method to run tests.
NOTE: env is inte... | Cal-CS-61A-Staff/ok-client | client/sources/common/models.py | Python | apache-2.0 | 2,352 |
'''
Created on June 6, 2018
Filer Guidelines: esma32-60-254_esef_reporting_manual.pdf
@author: Workiva
(c) Copyright 2022 Workiva, All rights reserved.
'''
try:
import regex as re
except ImportError:
import re
from arelle.ModelValue import qname
from arelle.XbrlConst import all, notAll, hypercubeDimension,... | acsone/Arelle | arelle/plugin/validate/ESEF/Const.py | Python | apache-2.0 | 19,152 |
import pymongo
class Ports(object):
def __init__(self):
self.__ports = []
def get(self):
return self.__ports
def add(self, name, num):
port = {'name': name,
'num': num}
self.__ports.append(port)
class SDNDatapathResourceTable(object):
def __in... | dana-i2cat/felix | modules/resource/manager/stitching-entity/src/delegate/geni/v3/models/sdn_resource_table.py | Python | apache-2.0 | 1,820 |
import pytest
from plenum.common.startable import Mode
def test_can_send_3pc_batch_by_primary_only(primary_orderer):
assert primary_orderer.can_send_3pc_batch()
primary_orderer._data.primary_name = "SomeNode:0"
assert not primary_orderer.can_send_3pc_batch()
def test_can_send_3pc_batch_not_participatin... | evernym/zeno | plenum/test/consensus/order_service/test_can_send_3pc.py | Python | apache-2.0 | 5,936 |
# Copyright 2015 Cloudbase Solutions Srl
# 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 r... | cloudbase/cloudbase-init-ci | argus/recipes/base.py | Python | apache-2.0 | 2,745 |
# 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... | bryancall/trafficserver | tests/gold_tests/pluginTest/tsapi/tsapi.test.py | Python | apache-2.0 | 4,053 |
import gae_django
from soc.profiling import viewer
def main():
viewer.main()
if __name__ == '__main__':
main()
| MatthewWilkes/mw4068-packaging | src/melange/src/melange/profiler.py | Python | apache-2.0 | 119 |
from pysparkling import *
from pyspark.sql import SparkSession
# Initiate SparkSession
spark = SparkSession.builder.appName("App name").getOrCreate()
# Initiate H2OContext
hc = H2OContext.getOrCreate()
| h2oai/sparkling-water | py/examples/tests/H2OContextWithoutExplicitStop.py | Python | apache-2.0 | 204 |
#!/usr/bin/env python
import subprocess
import re
import os
import sys
import argparse
import commands
from multiprocessing import Process, Queue
# Module import of openstack control script
__location__ = os.path.realpath(
os.path.join(os.getcwd(), os.path.dirname(__file__)))
sys.path.append('../openstack_con... | includeos/includeos-tools | bombardment/bombardment.py | Python | apache-2.0 | 8,263 |
from floyd.client.base import FloydHttpClient
from floyd.model.version import CliVersion
from floyd.log import logger as floyd_logger
class VersionClient(FloydHttpClient):
"""
Client to get API version from the server
"""
def __init__(self):
self.url = "/cli_version"
super(VersionClien... | houqp/floyd-cli | floyd/client/version.py | Python | apache-2.0 | 580 |
#!/usr/bin/env python
# Copyright 2013 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice... | facekapow/runtime | deps/v8/tools/release/common_includes.py | Python | apache-2.0 | 29,028 |
from django.contrib import admin
from blog.models import Post, BlogRoll
class PostAdmin(admin.ModelAdmin):
list_display = ('title', 'publish', 'status')
list_filter = ('publish', 'status')
search_fields = ('title', 'body')
prepopulated_fields = {'slug': ('title',)}
admin.site.register(Post, PostAdmi... | callowayproject/django-gwo | example/blog/admin.py | Python | apache-2.0 | 479 |
# -*- coding: utf-8 -*-
from django.core.exceptions import ValidationError
from django.test import TestCase, tag
import factories
from formlibrary.models import CustomForm
@tag('pkg')
class CustomFormTest(TestCase):
def setUp(self):
self.organization = factories.Organization()
self.user = factori... | toladata/TolaActivity | formlibrary/tests/test_models.py | Python | apache-2.0 | 1,601 |
from django.utils import safestring
mystr = '<b>Hello World</b>'
mystr = safestring.mark_safe(mystr)
| chair6/bandit | examples/mark_safe.py | Python | apache-2.0 | 102 |
# Natural Language Toolkit: Applications package
#
# Copyright (C) 2001-2017 NLTK Project
# Author: Edward Loper <edloper@gmail.com>
# Steven Bird <stevenbird1@gmail.com>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
"""
Interactive NLTK Applications:
chartparser: Chart Parser
chunkpar... | arju88nair/projectCulminate | venv/lib/python3.5/site-packages/nltk/app/__init__.py | Python | apache-2.0 | 1,733 |
#!/bin/python
from __future__ import print_function
import subprocess
import sys
import os
import json
from util import appendline, get_ip_address
if __name__ == "__main__":
path = os.path.dirname(os.path.realpath(__file__))
config = json.load(open(path+'/cluster-config.json'));
for node in config['nodes']:
files... | wangyangjun/RealtimeStreamBenchmark | script/pull-updates.py | Python | apache-2.0 | 715 |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 OpenStack Foundation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.... | netscaler/neutron | neutron/db/db_base_plugin_v2.py | Python | apache-2.0 | 66,754 |
#!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# btrfsslower Trace slow btrfs operations.
# For Linux, uses BCC, eBPF.
#
# USAGE: btrfsslower [-h] [-j] [-p PID] [min_ms]
#
# This script traces common btrfs file operations: reads, writes, opens, and
# syncs. It measures the time spent in ... | mkacik/bcc | tools/btrfsslower.py | Python | apache-2.0 | 9,760 |
# 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 the... | swiftstack/kinetic-swift | test_kinetic_swift/test_diskfile.py | Python | apache-2.0 | 13,975 |
#
# 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
# ... | pshchelo/heat | heat/common/short_id.py | Python | apache-2.0 | 1,951 |
"""Tests for two-process terminal frontend
Currently only has the most simple test possible, starting a console and running
a single command.
Authors:
* Min RK
"""
#-----------------------------------------------------------------------------
# Imports
#--------------------------------------------------------------... | noslenfa/tdjangorest | uw/lib/python2.7/site-packages/IPython/terminal/console/tests/test_console.py | Python | apache-2.0 | 1,726 |
# Copyright (c) 2018 PaddlePaddle 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 app... | putcn/Paddle | python/paddle/fluid/layers/metric.py | Python | apache-2.0 | 2,939 |
from seahub.notifications.models import (
UserNotification, repo_share_msg_to_json, file_comment_msg_to_json,
repo_share_to_group_msg_to_json, file_uploaded_msg_to_json,
group_join_request_to_json, add_user_to_group_to_json, group_msg_to_json)
from seahub.share.utils import share_dir_to_user, share_dir_to_g... | miurahr/seahub | tests/seahub/notifications/test_models.py | Python | apache-2.0 | 4,419 |
#
# Copyright (C) 2014 eNovance SAS <licensing@enovance.com>
#
# 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... | enovance/managesf | managesf/controllers/htp.py | Python | apache-2.0 | 2,279 |
# Copyright 2015 - StackStorm, 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 agr... | openstack/mistral | mistral/tests/unit/config.py | Python | apache-2.0 | 992 |