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 |
|---|---|---|---|---|---|
#!/usr/bin/py
import os
import sys
import shutil
import unittest
sys.path.append(os.path.abspath('..'))
from sample.LazyCF import LazyCF
from sample.CodeForces import CodeForces
class TestLazyCF(unittest.TestCase):
def test__init__(self):
lazy_test = LazyCF()
self.assertEqual(str(lazy_test.__cla... | filipecn/lazycf | tests/Test_LazyCF.py | Python | mit | 1,628 |
# -*- coding: utf-8 -*-
"""
Sahana Eden Volunteers Management
(Extends modules/eden/hrm.py)
@copyright: 2012 (c) Sahana Software Foundation
@license: MIT
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "... | madhurauti/Map-Polygon | modules/eden/vol.py | Python | mit | 11,144 |
#ImportModules
import ShareYourSystem as SYS
#Define
MyConditioner=SYS.ConditionerClass(
).get(
'MyList'
).set(
'MyList.append',
{
'#value':4,
'#if':[
(type,SYS.operator.eq,SYS.ConditionerClass)
]
}
)
#print
print('MyConditioner is')
SYS._print(MyConditioner)
| Ledoux/ShareYourSystem | Pythonlogy/build/lib/ShareYourSystem/Standards/Itemizers/Conditioner/11_ExampleDoc.py | Python | mit | 288 |
from itertools import chain, combinations, permutations
class RankedPairsResult:
def __init__(self, tallies, winners):
self.tallies = tallies
self.winners = winners
def results(responses):
"""
Returns the list of ranked-pairs winners based on responses.
Takes as input a list of ranki... | ASCIT/donut-python | donut/modules/voting/ranked_pairs.py | Python | mit | 2,107 |
from sfa.rspecs.elements.element import Element
class PLTag(Element):
fields = [
'tagname',
'value',
]
| onelab-eu/sfa | sfa/rspecs/elements/pltag.py | Python | mit | 138 |
# -*- coding: utf-8 -*-
#
# LICENCE MIT
#
# DESCRIPTION Callgraph hooks for evetns during building callgraph.
#
# AUTHOR Michal Bukovsky <michal.bukovsky@trilogic.cz>
#
class Event(object):
def __init__(self, builder, **kwargs):
self.filename = builder.tot.filename
self.lineno = buil... | burlog/py-static-callgraph | callgraph/hooks.py | Python | mit | 1,125 |
#!/usr/bin/python
################################################################
#
# Copyright 2013, Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at... | floodlight/ivs | build/oftest.py | Python | epl-1.0 | 13,000 |
import sys
from connect2j import connectToJava
if (len(sys.argv) > 1):
gateway = None
try:
gateway = connectToJava(sys.argv[1])
map = gateway.getMap()
map['1'] = 1
gateway.setMap(map)
map["obj"].setValue("Hello")
finally:
if gateway != None:
... | kasemir/org.csstudio.display.builder | org.csstudio.display.builder.runtime/scripts/test-script.py | Python | epl-1.0 | 348 |
passwort = "geheim"
fehlversuche = 0
while True:
user_input = raw_input("Passwort eingeben:\n")
if user_input == passwort:
print "Hello User!"
break
else:
fehlversuche += 1
print "Fehlversuche:", fehlversuche
if fehlversuche == 3:
print "Zu viele Fehlversuche"
... | gkabbe/Python-Kurs2015 | Lösungen/Woche1/password.py | Python | gpl-2.0 | 341 |
import subprocess
import multiprocessing
import select
import fcntl, os
import re
import matplotlib.pyplot as plt
import numpy as np
import time
import evolver
import logging
evolver.logger.setLevel(logging.DEBUG)
evolver.logger.addHandler(logging.StreamHandler())
def find_values(fileloc, phrase):
wf = open(file... | ulmusic/python-evolver | test/DS_sweep.py | Python | gpl-2.0 | 1,956 |
from widgetastic.widget import Text
from widgetastic.widget import View
from widgetastic_patternfly import Button
from widgetastic_patternfly import Dropdown
from widgetastic_patternfly import Input
from cfme.common import BaseLoggedInPage
from widgetastic_manageiq import Accordion
from widgetastic_manageiq import Dia... | nachandr/cfme_tests | cfme/automate/dialogs/__init__.py | Python | gpl-2.0 | 4,517 |
class Solution:
# @param num, a list of integer
# @return a list of lists of integers
def permuteUnique(self, num):
res = []
visited = [0 for _ in xrange(len(num))]
self.helper(sorted(num), 0, res, visited, [])
return res
def helper(self, num, i, res, visited, s... | linyaoli/acm | backtrack/intermediate/permutations_ii.py | Python | gpl-2.0 | 851 |
"""Tests for 'site'.
Tests assume the initial paths in sys.path once the interpreter has begun
executing have not been removed.
"""
import unittest
from test.test_support import run_unittest, TESTFN, EnvironmentVarGuard
from test.test_support import captured_output
import __builtin__
import os
import sys
... | j5shi/Thruster | pylibs/test/test_site.py | Python | gpl-2.0 | 15,991 |
from .core import CvBridge, CvBridgeError
| codehacken/Athena | src/vision_opencv/cv_bridge/python/cv_bridge/__init__.py | Python | gpl-2.0 | 42 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
# This is a simple test variable for the interaction of gridcells and households.
from opus_core.variables.variable import Variable
from urbansim.functions import attribute_label
class age_... | christianurich/VIBe2UrbanSim | 3rdparty/opus/src/paris/household_x_neighborhood/age_lnprice.py | Python | gpl-2.0 | 1,876 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright: (2013-2017) Michael Till Beck <Debianguru@gmx.de>
# License: GPL-2.0+
import http.server
import socketserver
import importlib
import sys
import getopt
bind = 'localhost'
port = 8000
configMod = 'config'
try:
opts, args = getopt.getopt(sys.argv[1:], ... | mtill/MailWebsiteChanges | mwcfeedserver.py | Python | gpl-2.0 | 1,039 |
# Copyright (C) 2005 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 distributed in ... | Distrotech/bzr | bzrlib/testament.py | Python | gpl-2.0 | 9,034 |
import json
import logging
import signals
import queue_model_objects_v1 as qmo
import queue_entry as qe
import QueueManager
from flask import Response, jsonify, request, session
from mxcube3 import app as mxcube
from mxcube3 import socketio
from . import qutils
qm = QueueManager.QueueManager('Mxcube3')
@mxcube.rou... | mguijarr/mxcube3 | mxcube3/routes/Queue.py | Python | gpl-2.0 | 17,319 |
#!/usr/bin/env python3
import fnmatch
import os
import re
import ntpath
import sys
import argparse
def validKeyWordAfterCode(content, index):
keyWords = ["for", "do", "count", "each", "forEach", "else", "and", "not", "isEqualTo", "in", "call", "spawn", "execVM", "catch"];
for word in keyWords:
try:
... | osasto-kuikka/KGE | tools/sqf_validator.py | Python | gpl-2.0 | 8,231 |
# -*- coding: utf-8 -*-
# vi:si:et:sw=4:sts=4:ts=4
##
## Copyright (C) 2012 Async Open Source <http://www.async.com.br>
## All rights reserved
##
## 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 Foundati... | andrebellafronte/stoq | stoqlib/gui/test/test_client_details.py | Python | gpl-2.0 | 6,128 |
import datetime
import signal
import mock
from .... import base
from pulp.common import dateutils, constants
from pulp.common.tags import resource_tag, RESOURCE_REPOSITORY_TYPE, action_tag
from pulp.devel import mock_plugins
from pulp.plugins.model import SyncReport
from pulp.server.async import tasks
from pulp.serve... | credativ/pulp | server/test/unit/server/managers/repo/test_sync.py | Python | gpl-2.0 | 28,058 |
# -*- coding: utf-8 -*-
import xbmc, xbmcgui, xbmcplugin, xbmcaddon, urllib2, urllib, re, gzip, datetime, StringIO, urlparse
try:
import json
except:
import simplejson as json
import ChineseKeyboard
# Plugin constants
__addonname__ = "PPTV视频"
__addonid__ = "plugin.video.pptv"
__addon__ = xbmcaddon.Addon(id=__addonid... | iamyangchen/xbmc-addons-chinese | plugin.video.pptv/default.py | Python | gpl-2.0 | 30,009 |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('appliances', '0007_provider_num_simultaneous_configuring'),
]
operations = [
migrations.AddField(
model_name='appliance',
name='uuid',
... | apagac/cfme_tests | sprout/appliances/migrations/0008_appliance_uuid.py | Python | gpl-2.0 | 493 |
#
# This file is part of Gambit
# Copyright (c) 1994-2014, The Gambit Project (http://www.gambit-project.org)
#
# FILE: src/python/gambit/enumeration.py
# Enumeration of support profiles for a strategic game
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General... | chumsley/gambit | src/python/gambit/enumeration.py | Python | gpl-2.0 | 1,952 |
#4! = 4*3*2*1
#5! = 5*4*3*2*1
'''
i = 1
result = 1
while i<=4:
result = result * i
i+=1
print(result)
'''
#5! => 5*4!
#4! => 4*3!
'''
def xxx(num):
num * xxxx(num-1)
def xx(num):
num * xxx(num-1)
def getNums(num):
num * xx(num-1)
getNums(4)
'''
def getNums(num):
if num>1:
retur... | jameswatt2008/jameswatt2008.github.io | python/Python基础/截图和代码/函数-下/11-递归.py | Python | gpl-2.0 | 419 |
#!/user/bin/python
import sys
for line in open(sys.argv[1],'r'):
spl = line.strip().split(',')
for x in spl:
print x
| germs-lab/RefSoil | script_to_clean_list/remove_comma.py | Python | gpl-2.0 | 134 |
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 2014 Bitcraze AB
#
# Cr... | fredg02/crazyflie-clients-python | examples/read-eeprom.py | Python | gpl-2.0 | 5,190 |
#!/usr/bin/python
import xmlrpclib
import struct
import os
import urllib2
from xml.dom import minidom
class bierdopje:
def __init__(self, bierdopjeaddr, bierdopjeapi, useragent, db, logging):
self.useragent = useragent
self.db = db
self.cur = self.db.cursor()
self.bierdopjeurl = "http://" + bierdopjeaddr + "... | laurentbeost/subliminal | bierdopje.py | Python | gpl-2.0 | 2,133 |
# The code in this files is borrowed from Gedit Synctex plugin.
#
# Copyright (C) 2010 Jose Aliste
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public Licence as published by the Free Software
# Foundation; either version 2 of the Licence, or (at your... | mdlerch/Nvim-R | R/synctex_evince_forward.py | Python | gpl-2.0 | 5,572 |
'''
Sprite object definitions.
DisplayObject is the base class for displaying clickable images. It handles the drawing,
moving, clicking, and hashing of a basic image. Subclasses of DisplayObject can and should
override functions like blitTo(), animate() and hash()
'''
import math
import pygame
from pygame.sprite imp... | brendanwhitfield/planetary | PlanetarySprites.py | Python | gpl-2.0 | 7,721 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# ===========================================================================
# eXeLearning
# Copyright 2017, CeDeC
#
# 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... | exelearning/iteexe | exe/webui/templatemanagerpage.py | Python | gpl-2.0 | 11,217 |
# Copyright 2015 Rémy Lapeyrade <remy at lapeyrade dot net>
# Copyright 2015 LAAS-CNRS
#
#
# This file is part of TouSIX-Manager.
#
# TouSIX-Manager 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 Founda... | Baloc/TouSIX-Manager | tousix_manager/Rules_Generation/Statistics/manager.py | Python | gpl-3.0 | 3,475 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2019-01-29 16:08
from __future__ import unicode_literals
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0013_auto_... | linea-it/qlf | backend/framework/qlf/dashboard/migrations/0014_product.py | Python | gpl-3.0 | 995 |
def add(a,b):
c = a + b
return c
def sub(a,b):
c = a - b
return c
def mul(a,b):
c = a * b
return c
def div(a,b):
c = a / b
return c
| ianfelzer1/ifelzer-advprog | ianfelzer/calculator.py | Python | gpl-3.0 | 167 |
# -*- 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/plugins/Collaboration/RecordingManager/fossils.py | Python | gpl-3.0 | 1,501 |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'lassoui.ui'
#
# Created: Sat Apr 11 09:14:27 2015
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
from PyQt4 import QtCore, QtGui
try:
_fromUtf8 = QtCore.QString.fromUtf8
except Attrib... | mlskit/astromlskit | REGRESSION/lassofront.py | Python | gpl-3.0 | 3,925 |
# -*- coding: utf-8 -*-
# this file is released under public domain and you can use without limitations
response.KEY = KEY = 'youshallnotpass'
#########################################################################
## this is the main application menu add/remove items as required
#####################################... | angelverde/evadoc | models/menu.py | Python | gpl-3.0 | 1,321 |
"""
SH shell
"""
import os
import os.path
import pipes
import subprocess
from rez.config import config
from rez.utils.platform_ import platform_
from rez.shells import Shell, UnixShell
from rez.rex import EscapedString
class SH(UnixShell):
norc_arg = '--noprofile'
histfile = "~/.bash_history"
histvar = "H... | saddingtonbaynes/rez | src/rezplugins/shell/sh.py | Python | gpl-3.0 | 4,324 |
"""
The migration module includes migration logic to update database scheme and/or
data for the user database.
To create a migration, simply create a file upgrade<migration number>.py and
define an upgrade() function with the logic. Please note that there must be as
many upgrade files as there are database versions (v... | blitzmann/Pyfa | eos/db/migrations/__init__.py | Python | gpl-3.0 | 1,545 |
############################################################################
#
# Copyright (C) 2016 The Qt Company Ltd.
# Contact: https://www.qt.io/licensing/
#
# This file is part of Qt Creator.
#
# Commercial License Usage
# Licensees holding valid commercial Qt licenses may use this file in
# accordance with the co... | sailfish-sdk/sailfish-qtcreator | scripts/common.py | Python | gpl-3.0 | 7,269 |
import lxml
from utils import State
from .people import NCPersonScraper
from .bills import NCBillScraper
# from .committees import NCCommitteeScraper
class NorthCarolina(State):
scrapers = {
"people": NCPersonScraper,
# 'committees': NCCommitteeScraper,
"bills": NCBillScraper,
}
l... | sunlightlabs/openstates | scrapers/nc/__init__.py | Python | gpl-3.0 | 12,386 |
try:
from unittest import mock
except ImportError:
import mock
try:
import unittest2 as unittest
except ImportError:
import unittest
try:
import configparser as ConfigParser
except ImportError:
import ConfigParser
try:
from StringIO import StringIO
except ImportError:
from io impo... | grigouze/gandi.cli | gandi/cli/tests/compat.py | Python | gpl-3.0 | 463 |
from testfixtures import log_capture
from testsuite.base_fs import BaseFilesystem
from testsuite import config
from core.sessions import SessionURL
from core import modules
import utils
from core import messages
import subprocess
import os
class FileCd(BaseFilesystem):
def setUp(self):
self.session = Sess... | ncrocfer/weevely3 | testsuite/test_file_cd.py | Python | gpl-3.0 | 2,398 |
import calendar
from datetime import date
from django.conf import settings
from django.core.mail import send_mail
from django.core.management import BaseCommand
from django.template.loader import get_template
from compta.bank import get_bank_class
from compta.models import Compte
def generate_mail():
# Dernier ... | mfalaize/homelab | compta/management/commands/check_operations.py | Python | gpl-3.0 | 3,142 |
from feeddb.feed.util import FeedUploadStatus
from django.http import HttpResponseRedirect
class FeedUploadStatusMiddleware():
def process_request(self, request):
request.feed_upload_status = FeedUploadStatus(session=request.session)
request.feed_upload_status.update_with_querystring(request.GET)
| Squishymedia/feedingdb | src/feeddb/feed/middleware.py | Python | gpl-3.0 | 319 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Configuracion
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import os,io
from types import *
PLATFORM_NAME = "plex"
def get_pla... | ChopChopKodi/pelisalacarta | python/version-plex/core/config.py | Python | gpl-3.0 | 2,224 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | ravibhure/ansible | lib/ansible/modules/network/aci/aci_epg_monitoring_policy.py | Python | gpl-3.0 | 4,278 |
# Copyright (c) 2009-2010, Ben Steenhuisen, Stefano Rivera,
# Tslil Clingman, Marco Gallotta
# Released under terms of the MIT/X/Expat Licence. See COPYING for details.
import re
import socket
import struct
from ibid.plugins import Processor, match
from ibid.config import Option, IntOption
from ibid.utils import huma... | caktus/ibid | ibid/plugins/gameservers.py | Python | gpl-3.0 | 5,078 |
#-*- coding: utf-8 -*-
'''
Created on 28 сент. 2010
@author: ivan
'''
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import Pango
from foobnix.util import idle_task
from foobnix.util.const import FTYPE_RADIO
from foobnix.gui.model.signal import FControl
from foobnix.util.time_utils im... | kagel/foobnix | foobnix/gui/controls/seekbar.py | Python | gpl-3.0 | 3,816 |
###############################################################################
# Name: style_editor.py #
# Purpose: Syntax Highlighting configuration dialog #
# Author: Cody Precord <cprecord@editra.org> #
... | ezequielpereira/Time-Line | libs/wx/tools/Editra/src/style_editor.py | Python | gpl-3.0 | 30,179 |
#!/usr/bin/env python
# Copyright 2015 Joshua Charles Campbell
# 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.
# ... | naturalness/partycrasher | lp/bucketizer.py | Python | gpl-3.0 | 4,063 |
# -*- encoding: utf-8 -*-
from abjad import *
def test_datastructuretools_CyclicMatrix___init___01():
r'''Initializes from rows.
'''
cyclic_matrix = datastructuretools.CyclicMatrix((
(0, 1, 2, 3),
(10, 11, 12, 13),
(20, 21, 22, 23),
))
assert cyclic_matrix.rows == \
... | mscuthbert/abjad | abjad/tools/datastructuretools/test/test_datastructuretools_CyclicMatrix___init__.py | Python | gpl-3.0 | 1,618 |
# 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 version.
#
# This program is distributed in the hope that it will be useful,
# bu... | kenorb-contrib/BitTorrent | icmp/test.py | Python | gpl-3.0 | 1,236 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, Michael DeHaan <michael.dehaan@gmail.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... | MiLk/ansible-modules-core | system/service.py | Python | gpl-3.0 | 52,336 |
import os
import sys
import shutil
import subprocess
BASEDIR,BASEFILE = os.path.split(os.path.abspath(__file__))
print(BASEDIR,BASEFILE,os.getcwd())
par_dir,cur_dir = os.path.split(BASEDIR)
src_dir = os.path.join(par_dir,'AnimeWatch-PyQt5')
deb_config_dir = os.path.join(BASEDIR,'DEBIAN')
control_file = os.path.join(... | kanishka-linux/AnimeWatch | AnimeWatch-Debian-PyQt5/create_deb.py | Python | gpl-3.0 | 1,480 |
# -*- coding: utf-8 -*-
from __future__ import (unicode_literals, division, absolute_import, print_function)
__license__ = 'GPL 3'
__copyright__ = '2011-2012, Tomasz Długosz <tomek3d@gmail.com>'
__docformat__ = 'restructuredtext en'
import re
import urllib
from contextlib import closing
from lxml import html
from ... | Eksmo/calibre | src/calibre/gui2/store/stores/ebookpoint_plugin.py | Python | gpl-3.0 | 2,890 |
import sys
import argparse
import multiprocessing
from functools import partial
from math import sqrt
import h5py as h5
import numpy as np
from scipy.sparse import vstack, coo_matrix
from scipy.stats.mstats import gmean
from sklearn.cluster import DBSCAN
from ._database import TimeSeriesData
# Calculate the slopes,... | beiko-lab/timeclust | ananke/_cluster.py | Python | gpl-3.0 | 14,320 |
from datetime import date, datetime, timedelta
from django.core import serializers
from django.db import models
import bleach
from constance import config
from .constants import (ALLOWED_TAGS, ALLOWED_ATTRIBUTES, ALLOWED_STYLES,
TEMPLATE_TITLE_PREFIX)
from .content import parse as parse_conte... | anaran/kuma | kuma/wiki/managers.py | Python | mpl-2.0 | 8,955 |
from django import forms
OPERATORS = (
'__true__', '__null__', '$', '~', '^', '=', '<=', '>=', '<', '>',
'!__true__', '!__null__', '!$', '!~', '!^', '!=', '!'
)
def split_on_operator(value):
for operator in sorted(OPERATORS, key=len, reverse=True):
if value.startswith(operator):
valu... | bsmedberg/socorro | webapp-django/crashstats/supersearch/form_fields.py | Python | mpl-2.0 | 4,545 |
import os
import pytest
import re
hostenv = os.environ['SECUREDROP_TESTINFRA_TARGET_HOST']
@pytest.mark.parametrize('sysctl_opt', [
('net.ipv4.conf.all.accept_redirects', 0),
('net.ipv4.conf.all.accept_source_route', 0),
('net.ipv4.conf.all.rp_filter', 1),
('net.ipv4.conf.all.secure_redirects', 0),
('net.i... | micahflee/securedrop | testinfra/common/test_system_hardening.py | Python | agpl-3.0 | 2,661 |
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, 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... | cogmission/nupic.research | htmresearch/frameworks/union_temporal_pooling/union_temporal_pooler_experiment.py | Python | agpl-3.0 | 10,220 |
import pytest
from udata.core.dataset.actions import archive
from udata.core.dataset.factories import VisibleDatasetFactory
from udata.core.discussions.models import Discussion
from udata.core.user.factories import UserFactory
@pytest.mark.usefixtures('clean_db')
class DatasetActionsTest:
def test_dataset_archi... | opendatateam/udata | udata/tests/dataset/test_dataset_actions.py | Python | agpl-3.0 | 741 |
def get_jenks_breaks(dataList, numClass):
dataList.sort()
mat1 = []
for i in range(0,len(dataList)+1):
temp = []
for j in range(0,numClass+1):
temp.append(0)
mat1.append(temp)
mat2 = []
for i in range(0,len(dataList)+1):
temp = []
for j in range... | Stanford-Legal-Tech-Design/legaltech-rapidpro | temba/flows/stats.py | Python | agpl-3.0 | 2,713 |
# Copyright 2019 Oihane Crucelaegui - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from datetime import datetime, timedelta
from pytz import timezone, utc
from odoo import api, fields, models
class ResourceCalendar(models.Model):
_inherit = 'resource.calendar'
hour_gap = f... | oihane/odoo-addons | resource_time/models/resource_calendar.py | Python | agpl-3.0 | 2,606 |
"""
Convenience methods for working with datetime objects
"""
from __future__ import absolute_import
import re
from datetime import datetime, timedelta
import six
from django.utils.translation import pgettext, ugettext
from pytz import UnknownTimeZoneError, timezone, utc
def get_default_time_display(dtime):
""... | ESOedX/edx-platform | common/djangoapps/util/date_utils.py | Python | agpl-3.0 | 18,694 |
# Copyright (C) 2020 Renato Lima - Akretion <renato.lima@akretion.com.br>
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import api, fields, models
from ..tools import misc
class Nbm(models.Model):
_name = 'l10n_br_fiscal.nbm'
_inherit = 'l10n_br_fiscal.data.product.abstract'
... | kmee/l10n-brazil | l10n_br_fiscal/models/nbm.py | Python | agpl-3.0 | 1,671 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.7 on 2017-08-04 14:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0041_remove_siteconfiguration__allowed_segment_events'),
]
operations = [
migrations.AddField(
... | eduNEXT/edunext-ecommerce | ecommerce/core/migrations/0042_siteconfiguration_enable_partial_program.py | Python | agpl-3.0 | 612 |
#####################################################################################
#
# Copyright (C) Tavendo GmbH
#
# Unless a separate license agreement exists between you and Tavendo GmbH (e.g. you
# have purchased a commercial license), the license terms below apply.
#
# Should you enter into a separate licen... | w1z2g3/crossbar | crossbar/router/auth/ticket.py | Python | agpl-3.0 | 5,567 |
# Copyright (C) 2020 Magno Costa - Akretion
# Copyright (C) 2016 Renato Lima - Akretion
# Copyright (C) 2016 Luis Felipe Miléo - KMEE
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import _, api, fields, models
class StockRule(models.Model):
_inherit = 'stock.rule'
@api.model
... | akretion/l10n-brazil | l10n_br_stock_account/models/stock_rule.py | Python | agpl-3.0 | 2,373 |
# Copyright (c) 2008 Simplistix Ltd
# See license.txt for license details.
from mock import Mock
from testfixtures import wrap,compare
from unittest import TestCase,TestSuite,makeSuite
class TestWrap(TestCase):
def test_wrapping(self):
m = Mock()
@wrap(m.before,m.after)
def test_functio... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/testfixtures/tests/test_wrap.py | Python | agpl-3.0 | 5,995 |
"""LTI integration tests"""
import oauthlib
from . import BaseTestXmodule
from collections import OrderedDict
import mock
import urllib
class TestLTI(BaseTestXmodule):
"""
Integration test for lti xmodule.
It checks overall code, by assuring that context that goes to template is correct.
As part of ... | torchingloom/edx-platform | lms/djangoapps/courseware/tests/test_lti_integration.py | Python | agpl-3.0 | 4,365 |
#!/usr/bin/env python3
# Takes a SUO-kif file in argument and generate a file associating
# each SUMO instance to an atom type. Each line is formatted as
# followed
#
# <instance-name> <atom-type>
import sys
import copy
import kifparser
from collections import defaultdict
from opencog.atomspace import AtomSpace, Trut... | opencog/external-tools | SUMO_importer/sumo-to-atom-types.py | Python | agpl-3.0 | 3,464 |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-08 19:43
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('cours... | philanthropy-u/edx-platform | openedx/features/course_duration_limits/migrations/0001_initial.py | Python | agpl-3.0 | 1,719 |
#!/usr/bin/python3
# Build required code:
# $ ./examples/buildall.py
#
# Start zmqproxy (only one instance)
# $ ./build/zmqproxy
#
# Run client against server using ZMQ:
# $ LD_LIBRARY_PATH=build PYTHONPATH=build python3 examples/python_bindings_example_client.py -z localhost
#
import os
import time
import sys
import... | GomSpace/libcsp | examples/python_bindings_example_client.py | Python | lgpl-2.1 | 1,900 |
from enigma import getDesktop, iPlayableService, eTimer, eServiceReference
from Components.Label import Label
from Components.Pixmap import Pixmap
from Components.ProgressBar import ProgressBar
from Components.ServiceEventTracker import ServiceEventTracker
from Components.ActionMap import NumberActionMap
from Screens... | vetalypp/e2openplugin-CrossEPG | src/enigma2/python/crossepg_downloader.py | Python | lgpl-2.1 | 5,637 |
from cis.data_io.products import NetCDF_Gridded
import logging
class HadGEM_CONVSH(NetCDF_Gridded):
"""
HadGEM plugin for reading NetCDF files converted by CONVSH. It implements a callback to pass to iris when
reading multiple files to allow correct merging
"""
def get_file_signature(self... | cedadev/cis | cis/data_io/products/HadGEM.py | Python | lgpl-3.0 | 5,253 |
import sys
def addAbilities(core, actor, player):
actor.addAbility("sm_inside_information")
return
def removeAbilities(core, actor, player):
actor.removeAbility("sm_inside_information")
return
| agry/NGECore2 | scripts/expertise/expertise_sm_path_inside_information_1.py | Python | lgpl-3.0 | 199 |
#!/usr/bin/env python
"""
Couchbase collector
Refer to the following cbstats documentation for more details:
http://docs.couchbase.com/couchbase-manual-2.1/#cbstats-tool
"""
import os
import sys
import time
import subprocess
import re
from collectors.etc import couchbase_conf
from collectors.lib import utils
CONF... | wangy1931/tcollector | collectors/0/couchbase.py | Python | lgpl-3.0 | 4,853 |
from openerp import api, models, fields, SUPERUSER_ID
class reminder(models.AbstractModel):
_name = 'reminder'
_reminder_date_field = 'date'
_reminder_description_field = 'description'
# res.users or res.partner fields
_reminder_attendees_fields = ['user_id']
reminder_event_id = fields.Many... | Trust-Code/addons-yelizariev | reminder_base/reminder_base_models.py | Python | lgpl-3.0 | 6,555 |
#!/usr/local/bin/python
##
# TODO:
#
##
#import
import os
import time
import shutil
import subprocess
import getpass
import glob
import autoreport
from multiprocessing import Process
from optparse import OptionParser
import config
#variables
numberOfRuns = 2
numberOfClients = 2
testName = "avatar-test"
#folder co... | jesterKing/naali | tools/tests/avatar-test.py | Python | apache-2.0 | 4,768 |
from abc import ABCMeta, abstractmethod
from enum import Enum
class ActionType(Enum):
SHELL = 'shell'
RELEASE = 'release'
class Action(metaclass=ABCMeta):
@abstractmethod
def run(self, path: str, config=None, system_config=None, erlang_vsn: str = None) -> bool:
pass
@abstractmethod
... | comtihon/coon | enot/action/action.py | Python | apache-2.0 | 359 |
# Copyright (c) 2012 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
#
# Unless required by applicable ... | eharney/nova | plugins/xenserver/xenapi/etc/xapi.d/plugins/utils.py | Python | apache-2.0 | 14,618 |
# Copyright (c) 2010-2012 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
#
# Unless required by applicable law or agree... | larsbutler/swift | test/unit/account/test_server.py | Python | apache-2.0 | 99,400 |
import xarray as xr
import matplotlib.pyplot as plt
import cartopy.crs as ccrs
air = (xr.tutorial
.load_dataset('air_temperature')
.air
.isel(time=0))
ax = plt.axes(projection=ccrs.Orthographic(-80, 35))
ax.set_global()
air.plot.contourf(ax=ax, transform=ccrs.PlateCarree())
ax.coastlines()
plt.... | NicWayand/xray | doc/examples/cartopy_example.py | Python | apache-2.0 | 351 |
import pytest
from plenum.test.helper import sdk_send_random_requests
from stp_core.loop.eventually import eventually
from plenum.common.messages.node_messages import Prepare, Commit
from plenum.test.delayers import delay
from plenum.test.propagate.helper import recvdRequest, recvdPropagate, \
sentPropagate, recvd... | evernym/zeno | plenum/test/req_drop/test_req_drop_on_prepare_phase_primary.py | Python | apache-2.0 | 3,979 |
# Copyright (c) 2014 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... | MaximNevrov/neutron | neutron/cmd/sanity/checks.py | Python | apache-2.0 | 13,900 |
# -*- coding: utf-8 -*-
# Copyright 2015, 2016 OpenMarket 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 by applica... | TribeMedia/synapse | tests/events/test_utils.py | Python | apache-2.0 | 8,591 |
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | sasha-gitg/python-aiplatform | .sample_configs/param_handlers/create_hyperparameter_tuning_job_python_package_sample.py | Python | apache-2.0 | 3,158 |
# Copyright (c) 2013 - 2014 Huawei Technologies Co., Ltd.
# 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.... | hybrid-storage-dev/cinder-fs-111t-hybrid-cherry | volume/drivers/huawei/rest_common.py | Python | apache-2.0 | 81,175 |
# -*- coding: utf-8 -*-
# File: regularize.py
import re
import tensorflow as tf
from ..compat import tfv1
from ..tfutils.common import get_tf_version_tuple
from ..tfutils.tower import get_current_tower_context
from ..utils import logger
from ..utils.argtools import graph_memoized
from .common import layer_register
... | google-research/ssl_detection | third_party/tensorpack/tensorpack/models/regularize.py | Python | apache-2.0 | 6,528 |
#!/usr/bin/env python
# Copyright 2012 Google Inc. All Rights Reserved.
"""Client actions related to plist files."""
import cStringIO
import types
from grr.client import actions
from grr.client import vfs
from grr.lib import plist as plist_lib
from grr.lib import rdfvalue
from grr.parsers import binplist
class ... | wandec/grr | client/client_actions/plist.py | Python | apache-2.0 | 2,452 |
# Copyright 2015, A10 Networks
#
# 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... | dougwig/a10-neutron-lbaas | a10_neutron_lbaas/tests/db/session.py | Python | apache-2.0 | 1,905 |
import os
import logging
# standardize use of logging module in fs-drift
def start_log(prefix, verbosity=0):
log = logging.getLogger(prefix)
if os.getenv('LOGLEVEL_DEBUG') != None or verbosity != 0:
log.setLevel(logging.DEBUG)
else:
log.setLevel(logging.INFO)
log_format = prefix + ' %(... | bengland2/fsstress | fsd_log.py | Python | apache-2.0 | 1,486 |
# 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... | rajalokan/keystone | keystone/conf/__init__.py | Python | apache-2.0 | 5,308 |
from bzt.utils import SoapUIScriptConverter
from tests.unit import BZTestCase, RESOURCES_DIR, ROOT_LOGGER
class TestSoapUIConverter(BZTestCase):
def test_minimal(self):
obj = SoapUIScriptConverter(ROOT_LOGGER)
config = obj.convert_script(RESOURCES_DIR + "soapui/project.xml")
self.assertIn... | Blazemeter/taurus | tests/unit/modules/test_SoapUI.py | Python | apache-2.0 | 7,842 |
#!/usr/bin/python
#
# Copyright 2012 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 b... | donspaulding/adspygoogle | examples/adspygoogle/dfp/v201204/deactivate_labels.py | Python | apache-2.0 | 2,216 |
# 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... | ArchiFleKs/magnum | magnum/conf/octavia.py | Python | apache-2.0 | 1,970 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2012 Institut für Experimentelle Kernphysik - Karlsruher Institut für Technologie
#
# 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 Licens... | HappyFaceGoettingen/HappyFaceCore | render.py | Python | apache-2.0 | 2,708 |
#!/usr/bin/env python
# =========================================================================
#
# Copyright NumFOCUS
#
# 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:/... | richardbeare/SimpleITK | Examples/Python/CannyEdge.py | Python | apache-2.0 | 1,302 |
# Copyright (c) 2013 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/licenses/LICENSE-2.0
#
# Unless required by applicable law... | klmitch/pbr | pbr/tests/test_packaging.py | Python | apache-2.0 | 28,790 |