code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
# Copyright 2012 Antoine Bertin <diaoulael@gmail.com>
#
# This file is part of pyextdirect.
#
# pyextdirect is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of th... | Diaoul/pyextdirect | pyextdirect/configuration.py | Python | gpl-3.0 | 4,570 |
#!/usr/bin/env python
# coding=utf-8
import sys
import argparse
parser = argparse.ArgumentParser(
description='convert a non-standord hostname like xx-xx-[1-3] to a '
'expansion state',
formatter_class=argparse.RawDescriptionHelpFormatter,
epilog="""
Sample:
$ ./converter.py xxx-xxx-\[1-3\]
xxx-xxx-1
x... | supersu097/Mydailytools | converter.py | Python | gpl-3.0 | 905 |
#!/usr/bin/env python
#
# Generate report in Excel format (from xml input)
#
import sys,os,shelve
import re,dfxml,fiwalk
from bc_utils import filename_from_path
from openpyxl.workbook import Workbook
from openpyxl.writer.excel import ExcelWriter
from openpyxl.cell import get_column_letter
def bc_generate_feature_x... | sesuncedu/bitcurator | python/bc_gen_feature_rep_xls.py | Python | gpl-3.0 | 1,974 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014, 2015, 2016 Adam.Dybbroe
# Author(s):
# Adam.Dybbroe <adam.dybbroe@smhi.se>
# Janne Kotro fmi.fi
# Trygve Aspenes
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as ... | TAlonglong/trollduction-test | aapp_runner/aapp_dr_runner.py | Python | gpl-3.0 | 72,713 |
# coding: utf-8
import time
import config_mqtt
class Asynch_result:
def __init__(self, correlation_id, requests, yield_to):
self.correlation_id = correlation_id
self._requests_need_result = requests
self.yield_to = yield_to
def get(self, timeout = config_mq... | Wei1234c/Elastic_Network_of_Things_with_MQTT_and_MicroPython | codes/node/asynch_result.py | Python | gpl-3.0 | 1,312 |
"""Namegame, where you try to remember a team number starting with the last number of the previous played team"""
import asyncio
import gzip
import pickle
import traceback
from collections import OrderedDict
from functools import wraps
import discord
import tbapi
from discord.ext.commands import has_permissions
from f... | FRCDiscord/Dozer | dozer/cogs/namegame.py | Python | gpl-3.0 | 37,558 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | dustymabe/ansible-modules-core | cloud/amazon/ec2_elb_lb.py | Python | gpl-3.0 | 52,548 |
# coding: utf-8
from __future__ import absolute_import
from .base_model_ import Model
from datetime import date, datetime
from typing import List, Dict
from ..util import deserialize_model
class StorageData(Model):
"""
NOTE: This class is auto generated by the swagger code generator program.
Do not edit ... | turdusmerula/kipartman | kipartbase/swagger_server/models/storage_data.py | Python | gpl-3.0 | 2,758 |
# -*- coding: utf-8 -*-
from __future__ import division
'''Test for checking variation of initial prestress force along a
post-tensioned member.
Data and rough calculation are taken from
Example 4.3 of the topic 4 of course "Prestressed Concrete Design
(SAB 4323) by Baderul Hisham Ahmad
ocw.utm.my
Problem stateme... | lcpt/xc | verif/tests/materials/prestressing/test_short_term_loss_prestress_01.py | Python | gpl-3.0 | 3,985 |
"""
This module contains various methods for checking the type of timelines and a
class that creates all kinds of timelines.
"""
import re
from functools import partial
from gettext import gettext as _
from turses.models import Timeline, is_DM
HOME_TIMELINE = 'home'
MENTIONS_TIMELINE = 'mentions'
FAVORITES_TIMELINE... | joedicastro/turses | turses/api/helpers.py | Python | gpl-3.0 | 5,201 |
import re
from tower import ugettext_lazy as _lazy
from tower import ugettext as _
from django import forms
from django.conf import settings
from django.forms.widgets import CheckboxSelectMultiple
from kuma.contentflagging.forms import ContentFlagForm
import kuma.wiki.content
from kuma.core.form_fields import Strip... | mastizada/kuma | kuma/wiki/forms.py | Python | mpl-2.0 | 19,906 |
#!/usr/bin/env python
# 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/.
# Copyright (c) 2014 Mozilla Corporation
#
# Contributors:
# Anthony Verez averez@mozilla.com
imp... | ameihm0912/MozDef | cron/healthToMongo.py | Python | mpl-2.0 | 5,358 |
# encoding: utf-8
#
#
# self 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 self file,
# You can obtain one at http:# mozilla.org/MPL/2.0/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import unicode_literals
from __... | klahnakoski/esReplicate | pyLibrary/queries/dimensions.py | Python | mpl-2.0 | 13,303 |
#!/bin/false
# This file is part of Espruino, a JavaScript interpreter for Microcontrollers
#
# Copyright (C) 2013 Gordon Williams <gw@pur3.co.uk>
#
# 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 ... | redbear/Espruino | scripts/common.py | Python | mpl-2.0 | 16,565 |
# Copyright (c) 2015-2020 Contributors as noted in the AUTHORS file
#
# 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/.
# System imports
import json
import logging
import... | Alidron/alidron-isac | isac/transport/pyre_node.py | Python | mpl-2.0 | 6,714 |
"""URL routes for the sample app."""
from django.conf.urls import include, url
from django.views.generic import TemplateView
from rest_framework.routers import DefaultRouter
from .viewsets import ChoiceViewSet, QuestionViewSet, UserViewSet
router = DefaultRouter()
router.register(r'users', UserViewSet)
router.regist... | jwhitlock/drf-cached-instances | sample_poll_app/urls.py | Python | mpl-2.0 | 652 |
import os
from outlawg import Outlawg
from fftool import (
DIR_CONFIGS,
local
)
from ini_handler import IniHandler
Log = Outlawg()
env = IniHandler()
env.load_os_config(DIR_CONFIGS)
def launch_firefox(profile_path, channel, logging, nspr_log_modules=''):
"""relies on the other functions (download, instal... | rpappalax/ff-tool | fftool/firefox_run.py | Python | mpl-2.0 | 849 |
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 8 14:45:26 2017
@author: leonidas
"""
import numpy as np
import operator
def classify(inputPoint,dataSet,labels,k):
dataSetSize = dataSet.shape[0]
diffMat = np.tile(inputPoint,(dataSetSize,1))-dataSet
sqDiffMat = pow(diffMat,2)
sqDistances = sqDi... | leonidas141/HIT-ML-2016-report | load.py | Python | mpl-2.0 | 1,459 |
import mock
from crashstats.base.tests.testbase import TestCase
from crashstats.api.cleaner import Cleaner, SmartWhitelistMatcher
from crashstats import scrubber
class TestCleaner(TestCase):
def test_simplest_case(self):
whitelist = {'hits': ('foo', 'bar')}
data = {
'hits': [
... | Tayamarn/socorro | webapp-django/crashstats/api/tests/test_cleaner.py | Python | mpl-2.0 | 6,751 |
# encoding: utf-8
#
#
# 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from __f... | klahnakoski/JsonSchemaToMarkdown | vendor/jx_sqlite/expressions.py | Python | mpl-2.0 | 30,120 |
"""TxnReconcile allow txn_id to be null
Revision ID: 08b6358a04bf
Revises: 04e61490804b
Create Date: 2018-03-07 19:48:06.050926
"""
from alembic import op
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.
revision = '08b6358a04bf'
down_revision = '04e61490804b'
branch_labels = None
depen... | jantman/biweeklybudget | biweeklybudget/alembic/versions/08b6358a04bf_txnreconcile_allow_txn_id_to_be_null.py | Python | agpl-3.0 | 765 |
from cl.api import views
from cl.audio import api_views as audio_views
from cl.people_db import api_views as judge_views
from cl.search import api_views as search_views
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
router = DefaultRouter()
# Search & Audio
router.register(... | voutilad/courtlistener | cl/api/urls.py | Python | agpl-3.0 | 2,240 |
# -*- coding: utf-8 -*-
# Akvo RSR is covered by the GNU Affero General Public License.
# See more details in the license.txt file located at the root folder of the Akvo RSR module.
# For additional details on the GNU license please see < http://www.gnu.org/licenses/agpl.html >.
from django.contrib.auth import get_u... | akvo/akvo-rsr | akvo/rest/serializers/user.py | Python | agpl-3.0 | 6,303 |
# -*- coding: utf-8 -*-
# © 2015 Elico corp (www.elico-corp.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import base64
import random
import string
from binascii import hexlify, unhexlify
from openerp import api, fields, models
try:
from captcha.image import ImageCaptcha
except ImportE... | Elico-Corp/odoo-addons | website_captcha_nogoogle/website.py | Python | agpl-3.0 | 2,704 |
# Generated by Django 2.2.15 on 2020-12-01 13:12
from django.db import migrations
import djmoney.models.fields
class Migration(migrations.Migration):
dependencies = [
("projects", "0008_auto_20190220_1133"),
]
operations = [
migrations.AddField(
model_name="project",
... | adfinis-sygroup/timed-backend | timed/projects/migrations/0009_auto_20201201_1412.py | Python | agpl-3.0 | 38,360 |
from django.views.decorators.cache import never_cache
from django.views.generic.base import RedirectView
from C4CApplication.views.utils import create_user
class MemberDetailsRedirectView(RedirectView):
url = ""
connected_member = None
def dispatch(self, request, *args, **kwargs):
... | dsarkozi/care4care-sdp-grp4 | Care4Care/C4CApplication/views/MemberDetailsRedirectView.py | Python | agpl-3.0 | 1,019 |
"""
Specific overrides to the base prod settings to make development easier.
"""
# Silence noisy logs
import logging
from os.path import abspath, dirname, join
from corsheaders.defaults import default_headers as corsheaders_default_headers
# pylint: enable=unicode-format-string # lint-amnesty, pylint: disable=bad-... | eduNEXT/edx-platform | lms/envs/devstack.py | Python | agpl-3.0 | 17,710 |
from unittest.mock import ANY, patch
from django.test import override_settings
from geoip2.errors import AddressNotFoundError
from rest_framework import status
from rest_framework.test import APITestCase
from karrot.groups.factories import GroupFactory
from karrot.users.factories import UserFactory
from karrot.utils.... | yunity/foodsaving-backend | karrot/bootstrap/tests/test_api.py | Python | agpl-3.0 | 4,392 |
# -*- coding: utf-8; -*-
#
# This file is part of Superdesk.
#
# Copyright 2013, 2014 Sourcefabric z.u. and contributors.
#
# For the full copyright and license information, please see the
# AUTHORS and LICENSE files distributed with this source code, or
# at https://www.sourcefabric.org/superdesk/license
import logg... | petrjasek/superdesk-server | superdesk/io/commands/update_ingest.py | Python | agpl-3.0 | 9,268 |
"""
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from __future__ import unicode_literals
from django.conf import settings
from keops.core.serializers import base
from django.db ... | mrmuxl/keops | keops/core/serializers/python.py | Python | agpl-3.0 | 6,979 |
# -*- coding: utf-8 -*-
"""
Tests the "preview" selector in the LMS that allows changing between Staff, Learner, and Content Groups.
"""
from textwrap import dedent
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.pages.common.auto_auth import AutoAuthPa... | msegado/edx-platform | common/test/acceptance/tests/lms/test_lms_user_preview.py | Python | agpl-3.0 | 5,975 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
from django.utils import timezone
from crm.models import Person
from geocodable.models import LocationAlias
import uuid
class Event(models.Model):
name = models.CharField(max_length=200)
timestamp = models.DateTimeFie... | tdfischer/organizer | events/models.py | Python | agpl-3.0 | 1,124 |
# pylint: disable=arguments-differ
""" Models for the shopping cart and assorted purchase types """
from collections import namedtuple
from datetime import datetime
from datetime import timedelta
from decimal import Decimal
import json
import analytics
from io import BytesIO
from django.db.models import Q, F
import py... | caesar2164/edx-platform | lms/djangoapps/shoppingcart/models.py | Python | agpl-3.0 | 91,861 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
import time
from datetime import date, datetime, timedelta
from optparse import make_option
import openid.store.nonce
from django.conf import settings
from django.core.management.... | miing/mci_migo | identityprovider/management/commands/cleanup.py | Python | agpl-3.0 | 4,126 |
# Copyright 2021 Alfredo de la Fuente - Avanzosc S.L.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo.tests import common
from odoo.tests import tagged
@tagged("post_install", "-at_install")
class TestNameCodeYearId(common.SavepointCase):
@classmethod
def setUpClass(cls):
sup... | avanzosc/odoo-addons | event_name_code_year_id/tests/test_event_name_code_year_id.py | Python | agpl-3.0 | 1,353 |
try:
import serial # Python2
except ImportError:
from serial3 import * # Python3
from nupic.frameworks.opf.modelfactory import ModelFactory
import os,sys
ser = serial.Serial('/dev/ttyACM0', 9600)
def get_online(number_of_records=20):# 0 means forever
model = ModelFactory.loadFromCheckpoint(os.getcwd()... | lmaag182/nupic_physical | online.py | Python | agpl-3.0 | 994 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 ADHOC SA (http://www.adhoc.com.ar)
# All Rights Reserved.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Pu... | maljac/odoo-addons | partner_person/__openerp__.py | Python | agpl-3.0 | 2,095 |
"""
Tests suite for the views of the private messages app.
"""
from django.test import TestCase, Client
from django.conf import settings
from django.core.urlresolvers import reverse
from django.contrib.auth import get_user_model
from django.utils import timezone
from ..models import (PrivateMessage,
... | TamiaLab/carnetdumaker | apps/privatemsg/tests/test_views.py | Python | agpl-3.0 | 30,624 |
# -*- coding: utf-8 -*-
# Copyright 2019 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api
class PurchaseOrderLine(models.Model):
_inherit = "purchase.order.line"
@api.multi
@api.depends(
"product_id",
)
def... | open-synergy/opnsynid-purchase-workflow | purchase_order_line_allowed_uom/models/purchase_order_line.py | Python | agpl-3.0 | 2,605 |
from openerp.osv import fields,osv
import time
import openerp.addons.decimal_precision as dp
from openerp.tools.translate import _
from openerp import pooler
from openerp import netsvc
import base64
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from openerp.addons.Edumedi... | trabacus-softapps/docker-edumedia | additional_addons/Edumedia_India/ed_sale.py | Python | agpl-3.0 | 56,005 |
from requests import post
import io
import base64
class ZivService(object):
def __init__(self, cnc_url, user=None, password=None, sync=True):
self.cnc_url = cnc_url
self.sync = sync
self.auth = None
if user and password:
self.auth = (user,password)
def send_cycle(se... | gisce/primestg | primestg/ziv_service.py | Python | agpl-3.0 | 959 |
"""
Tests for send_email_base_command
"""
import datetime
from unittest import skipUnless
import ddt
import pytz
from django.conf import settings
from mock import DEFAULT, Mock, patch
from openedx.core.djangoapps.schedules.management.commands import SendEmailBaseCommand
from openedx.core.djangoapps.site_configurati... | stvstnfrd/edx-platform | openedx/core/djangoapps/schedules/management/commands/tests/test_send_email_base_command.py | Python | agpl-3.0 | 2,135 |
# coding: utf-8
def configure(app):
if app.config.get('DEBUG_TOOLBAR_ENABLED'):
try:
from flask_debugtoolbar import DebugToolbarExtension
DebugToolbarExtension(app)
except ImportError:
app.logger.info('flask_debugtoolbar is not installed')
if app.config.get... | Spotipo/spotipo | unifispot/ext/development.py | Python | agpl-3.0 | 902 |
import json
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.urls import reverse
from django.db import models
from django.utils.html import strip_tags
from opaque_keys.edx.django.models import CourseKeyField
from six import text_type
class Note(models.Model):... | jolyonb/edx-platform | lms/djangoapps/notes/models.py | Python | agpl-3.0 | 3,401 |
# -*- coding: utf-8 -*-
"""
Basic unit tests for LibraryContentBlock
Higher-level tests are in `cms/djangoapps/contentstore/tests/test_libraries.py`.
"""
import six
from bson.objectid import ObjectId
from fs.memoryfs import MemoryFS
from lxml import etree
from mock import Mock, patch
from search.search_engine_base i... | stvstnfrd/edx-platform | common/lib/xmodule/xmodule/tests/test_library_content.py | Python | agpl-3.0 | 26,994 |
"""
Test the views of jurisdiction models
"""
# Django
from django.test import TestCase
# Third Party
from nose.tools import assert_is_not, eq_
# MuckRock
from muckrock.core.test_utils import http_get_response
from muckrock.jurisdiction import factories, views
class TestExemptionDetailView(TestCase):
"""The ex... | MuckRock/muckrock | muckrock/jurisdiction/tests/test_views.py | Python | agpl-3.0 | 3,078 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright (C) 2009-2012:
# Gabes Jean, naparuba@gmail.com
# Gerhard Lausser, Gerhard.Lausser@consol.de
# Gregory Starck, g.starck@gmail.com
# Hartmut Goebel, h.goebel@goebel-consult.de
#
# This file is part of Shinken.
#
# Shinken is free software: you can redis... | wbsavage/shinken | shinken/objects/item.py | Python | agpl-3.0 | 45,311 |
"""
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
import itertools
from datetime import timedelta
import ddt
from django.core.exceptions import ValidationError
from django.test import T... | proversity-org/edx-platform | common/djangoapps/course_modes/tests/test_models.py | Python | agpl-3.0 | 21,323 |
# Copyright 2009-2010 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
__metaclass__ = type
__all__ = [
'BranchRevision',
]
from storm.locals import (
Int,
Reference,
Storm,
)
from zope.interface import implements
from l... | abramhindle/UnnaturalCodeFork | python/testdata/launchpad/lib/lp/code/model/branchrevision.py | Python | agpl-3.0 | 984 |
from gavel import app
from gavel.models import *
from gavel.constants import *
import gavel.settings as settings
import gavel.utils as utils
from flask import (
redirect,
render_template,
request,
url_for,
)
import urllib.parse
@app.route('/admin/')
@utils.requires_auth
def admin():
annotators = An... | atagh/gavel-clone | gavel/controllers/admin.py | Python | agpl-3.0 | 6,919 |
import os
import subprocess
import shutil
karma = os.path.join(os.path.dirname(__file__), '../node_modules/.bin/karma')
def javascript_tests():
if not shutil.which('nodejs'):
print("W: nodejs not available, skipping javascript tests")
return 0
elif os.path.exists(karma):
chrome_exec ... | Linaro/squad | test/javascript.py | Python | agpl-3.0 | 895 |
# coding: utf-8
# Copyright (C) 2017 Jaime Bemarás
# See LICENSE.txt
from IPy import IP
import re
ASN = re.compile(r'AS\d+', re.IGNORECASE)
def validate(resources):
outcome = True
for resource in resources:
if ASN.match(resource):
continue
else:
try:
... | synte/ec-ripe-api | resource_validator/validator.py | Python | agpl-3.0 | 479 |
"""
Studio editing view for OpenAssessment XBlock.
"""
import copy
import logging
from uuid import uuid4
from django.template.loader import get_template
from django.utils.translation import ugettext_lazy
from voluptuous import MultipleInvalid
from xblock.fields import List, Scope
from xblock.core import XBlock
from... | edx/edx-ora2 | openassessment/xblock/studio_mixin.py | Python | agpl-3.0 | 20,504 |
# Copyright 2018 Silvio Gregorini (silviogregorini@openforce.it)
# Copyright (c) 2018 Openforce Srls Unipersonale (www.openforce.it)
# Copyright (c) 2019 Matteo Bilotta
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import models
class AccountMoveLine(models.Model):
_inherit = "accoun... | OCA/l10n-italy | l10n_it_vat_statement_split_payment/models/account.py | Python | agpl-3.0 | 670 |
# Amara, universalsubtitles.org
#
# Copyright (C) 2013 Participatory Culture Foundation
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your op... | ujdhesa/unisubs | apps/videos/urls.py | Python | agpl-3.0 | 3,989 |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from rest_framework import viewsets, routers
from voting_app.models import Topic
from voting_app.views import Vote
from voting_app.serializer import TopicSerializer
admin.autodiscover()
# ViewSets define the view behavior.
class To... | gc3-uzh-ch/django-simple-poll | voting/urls.py | Python | agpl-3.0 | 833 |
# This file is part of rinohtype, the Python document preparation system.
#
# Copyright (c) Brecht Machiels.
#
# Use of this source code is subject to the terms of the GNU Affero General
# Public License v3. See the LICENSE file or http://www.gnu.org/licenses/.
import pytest
from io import BytesIO
from rinoh.backen... | brechtm/rinohtype | tests/test_pdf_reader.py | Python | agpl-3.0 | 3,238 |
# Yum plugin to re-patch container rootfs after a yum update is done
#
# Copyright (C) 2012 Oracle
#
# Authors:
# Dwight Engen <dwight.engen@oracle.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 Software Fou... | czchen/debian-lxc | config/yum/lxc-patch.py | Python | lgpl-2.1 | 1,850 |
#
# ICRAR - International Centre for Radio Astronomy Research
# (c) UWA - The University of Western Australia, 2015
# Copyright by UWA (in the framework of the ICRAR)
# All rights reserved
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser G... | steve-ord/daliuge | daliuge-engine/dlg/manager/__init__.py | Python | lgpl-2.1 | 1,112 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# -------------------------------------------------------------------
# Copyright (c) 2010-2019 Denis Machard
# This file is part of the extensive automation project
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Le... | dmachard/extensive-testing | src/ea/serverinterfaces/TestServerInterface.py | Python | lgpl-2.1 | 13,189 |
# fMBT, free Model Based Testing tool
# Copyright (c) 2012 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU Lesser General Public License,
# version 2.1, as published by the Free Software Foundation.
#
# This program is distribute... | pombreda/fMBT | utils/fmbt.py | Python | lgpl-2.1 | 9,267 |
# Copyright (C) 2013-2017 Chris Lalancette <clalancette@gmail.com>
# Copyright (C) 2013 Ian McLeod <imcleod@redhat.com>
# 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 2... | imcleod/oz | oz/RHEL_7.py | Python | lgpl-2.1 | 2,885 |
import telepathy
from telepathy.interfaces import CONN_MGR_INTERFACE
import dbus
def parse_account(s):
lines = s.splitlines()
pairs = []
manager = None
protocol = None
for line in lines:
if not line.strip():
continue
k, v = line.split(':', 1)
k = k.strip()
... | epage/telepathy-python | examples/account.py | Python | lgpl-2.1 | 1,551 |
#
# Copyright 2015-2016 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published
# by the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distr... | mojaves/convirt | convirt/events.py | Python | lgpl-2.1 | 3,067 |
# !/bin/python
# -*- coding: latin-1 -*-
# Copyright (C) 2009-2014 CEA/DEN, EDF R&D
#
# 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; either
# version 2.1 of the License, or (at your opt... | FedoraScientific/salome-hexablock | src/TEST_PY/test_v6/monica.py | Python | lgpl-2.1 | 5,353 |
#!/usr/bin/env python
#
# rpclib - Copyright (C) Rpclib contributors.
#
# 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; either
# version 2.1 of the License, or (at your option) any later ... | martijnvermaat/rpclib | src/rpclib/test/test_service.py | Python | lgpl-2.1 | 8,487 |
from leapp.topics import Topic
class ApiTestTopic(Topic):
name = 'api_test'
| leapp-to/prototype | tests/data/actor-api-tests/topics/apitest.py | Python | lgpl-2.1 | 82 |
# 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)
import os
import sys
from spack import *
class Vtk(CMakePackage):
"""The Visualization Toolkit (VTK) is an open-sou... | rspavel/spack | var/spack/repos/builtin/packages/vtk/package.py | Python | lgpl-2.1 | 12,385 |
# python
# This file is generated by a program (mib2py).
import HOST_RESOURCES_MIB
OIDMAP = {
'1.3.6.1.2.1.25': HOST_RESOURCES_MIB.host,
'1.3.6.1.2.1.25.1': HOST_RESOURCES_MIB.hrSystem,
'1.3.6.1.2.1.25.2': HOST_RESOURCES_MIB.hrStorage,
'1.3.6.1.2.1.25.2.1': HOST_RESOURCES_MIB.hrStorageTypes,
'1.3.6.1.2.1.25.3': HOST... | xiangke/pycopia | mibs/pycopia/mibs/HOST_RESOURCES_MIB_OID.py | Python | lgpl-2.1 | 5,000 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Distutils installer for PyJack
# Test for Jack2
#---------------------------------------------------#
import os
if os.path.exists("/usr/local/include/jack/jack.h"):
path = "/usr/local/include/jack/jack.h"
elif os.path.exists("/usr/include/jack/jack.h"):
path = "/usr/incl... | kylerbrown/pyjack | setup.py | Python | lgpl-2.1 | 1,661 |
#!/usr/bin/python
from gi.repository import Gdk
from xml.etree.ElementTree import ElementTree, Element
import re
ESCAPE_PATTERN = re.compile(r'\\u\{([0-9A-Fa-f]+?)\}')
ISO_PATTERN = re.compile(r'[A-E]([0-9]+)')
def parse_single_key(value):
key = Element('key')
uc = 0
if hasattr(__builtins__, 'unichr'):
... | GNOME/caribou | tools/convert_cldr.py | Python | lgpl-2.1 | 3,381 |
# coding: utf-8
import os
import shutil
from nxdrive.client.base_automation_client import DOWNLOAD_TMP_FILE_PREFIX, \
DOWNLOAD_TMP_FILE_SUFFIX
from nxdrive.engine.processor import Processor as OldProcessor
from nxdrive.logging_config import get_logger
log = get_logger(__name__)
class Processor(OldProcessor):
... | ssdi-drive/nuxeo-drive | nuxeo-drive-client/nxdrive/engine/next/processor.py | Python | lgpl-2.1 | 4,670 |
import os
import subprocess
from pathlib import Path
import pyinstaller_versionfile
import tomli
packaging_path = Path(__file__).resolve().parent
def get_version() -> str:
project_dir = Path(__file__).resolve().parent.parent
f = project_dir / "pyproject.toml"
return str(tomli.loads(f.read_text())["tool"... | amolenaar/gaphor | packaging/make-script.py | Python | lgpl-2.1 | 2,017 |
#!/usr/bin/env python
from nose.tools import *
from utilities import execution_path, save_data, contains_word
import os, mapnik
def setup():
# All of the paths used are relative, if we run the tests
# from another directory we need to chdir()
os.chdir(execution_path('.'))
def test_dataraster_colori... | mojodna/debian-mapnik | tests/python_tests/raster_symbolizer_test.py | Python | lgpl-2.1 | 6,314 |
# -*- coding: UTF-8 -*-
from datetime import date
import re
import pytest
from pyopenmensa.feed import LazyBuilder
@pytest.fixture
def canteen():
return LazyBuilder()
def test_date_converting(canteen):
day = date(2013, 3, 7)
assert canteen.dayCount() == 0
canteen.setDayClosed('2013-03-07')
ass... | mswart/pyopenmensa | tests/feed/test_lazy_canteen.py | Python | lgpl-3.0 | 1,685 |
'''
Puck: FreeBSD virtualization guest configuration server
Copyright (C) 2011 The Hotel Communication Network inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the Lic... | masom/Puck | server/controllers/root.py | Python | lgpl-3.0 | 2,450 |
# Copyright (c) 2015 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
from UM.Math.Vector import Vector
from UM.Math.Float import Float
class Plane:
"""Plane representation using normal and distance."""
def __init__(self, normal = Vector(), distance = 0.0):
super().__ini... | Ultimaker/Uranium | UM/Math/Plane.py | Python | lgpl-3.0 | 975 |
from __future__ import absolute_import
import logging
import os
import sys
import datetime
import psutil
from six import StringIO
from twisted.web import http, resource
from Tribler.Core.Utilities.instrumentation import WatchDog
import Tribler.Core.Utilities.json_util as json
HAS_MELIAE = True
try:
from meliae ... | Captain-Coder/tribler | Tribler/Core/Modules/restapi/debug_endpoint.py | Python | lgpl-3.0 | 18,160 |
# RABDAM
# Copyright (C) 2020 Garman Group, University of Oxford
# This file is part of RABDAM.
# RABDAM is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your... | GarmanGroup/RABDAM | tests/test_bnet_calculation.py | Python | lgpl-3.0 | 8,856 |
from cqparts.constraint import Mate, Coincident
from .base import Fastener
from ..screws import Screw
from ..utils import VectorEvaluator, Selector, Applicator
class ScrewFastener(Fastener):
"""
Screw fastener assembly.
Example usage can be found here: :ref:`cqparts_fasteners.built-in.screw`
"""
... | jmwright/cadquery-freecad-module | ThirdParty/cqparts_fasteners/fasteners/screw.py | Python | lgpl-3.0 | 1,975 |
VERSION = (1, 2, 21)
def get_version():
return '%d.%d.%d'%VERSION
__author__ = 'Marinho Brandao'
#__date__ = '$Date: 2008-07-26 14:04:51 -0300 (Ter, 26 Fev 2008) $'[7:-2]
__license__ = 'GNU Lesser General Public License (LGPL)'
__url__ = 'http://django-plus.googlecode.com'
__version__ = get_version()
def get_dyn... | marinho/django-plus | djangoplus/__init__.py | Python | lgpl-3.0 | 468 |
# Generated by Django 2.2.6 on 2019-10-31 08:31
from django.db import migrations, models
import multiselectfield.db.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Book',
fields=[
... | goinnn/django-multiselectfield | example/app/migrations/0001_initial.py | Python | lgpl-3.0 | 1,535 |
#!/usr/local/bin/python
# check python version
import sys
ver_info = sys.version_info
# parse commandlines
if ver_info[0] < 3 and ver_info[1] < 7:
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename", help="input log file", metavar="LOG_FILE... | EmoryUniversity/PIAT | src/common/log-analysis/python-discard/LogDBIngester.py | Python | lgpl-3.0 | 2,170 |
from vertebra.actor import actor
class test_00_actor:
def test_00_instantiate(self):
"""actor: can instantiate a base actor"""
a = actor()
assert isinstance(a,actor), "instantiated actor is actually an actor"
| jvantuyl/vertebra-py | tests/test_20_actor.py | Python | lgpl-3.0 | 224 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Copyright (C) 2011-2014 German Aerospace Center DLR
(Deutsches Zentrum fuer Luft- und Raumfahrt e.V.),
Institute of System Dynamics and Control
and BAUSCH-GALL GmbH, Munich
All rights reserved.
This file is licensed under the "BSD New" license
(see also http://openso... | PySimulator/PySimulator | PySimulator/Plugins/SimulationResult/Mtsf/MtsfFmi.py | Python | lgpl-3.0 | 15,300 |
#!/usr/bin/env python2
# Copyright (C) 2011-2012 by Imperial College London
# Copyright (C) 2013 University of Oxford
# Copyright (C) 2014 University of Edinburgh
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the... | pf4d/dolfin-adjoint | timestepping/python/timestepping/pre_assembled_adjoint.py | Python | lgpl-3.0 | 23,635 |
import datetime
from django.db import models
from django.core import validators
from django.utils.translation import ugettext_lazy as _
from nmadb_contacts.models import Municipality, Human
class School(models.Model):
""" Information about school.
School types retrieved from `AIKOS
<http://www.aikos.sm... | vakaras/nmadb-students | src/nmadb_students/models.py | Python | lgpl-3.0 | 10,676 |
"""
This test illustrate how to generate an XML Mapnik style sheet from a pycnik
style sheet written in Python.
"""
import os
from pycnik import pycnik
import artefact
actual_xml_style_sheet = 'artefacts/style_sheet.xml'
expected_xml_style_sheet = 'style_sheet.xml'
class TestPycnik(artefact.TestCaseWithArtefacts):
... | Mappy/pycnikr | tests/test_pycnik.py | Python | lgpl-3.0 | 660 |
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# This file is part of astroid.
#
# astroid 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
#... | lukaszpiotr/pylama_with_gjslint | pylama/checkers/pylint/astroid/mixins.py | Python | lgpl-3.0 | 4,313 |
# created based on
# https://python-packaging.readthedocs.io/en/latest/minimal.html
# But instead of python setup.py register sdist upload,
# use https://pypi.org/p/twine/
#
from setuptools import setup
import sys
import os
import re
sys.path.append("src")
def read(fname):
try:
return open(os.path.join... | KlausPopp/Moddy | setup.py | Python | lgpl-3.0 | 1,397 |
#!/usr/bin/env python3
# coding: utf8
"""
Unit tests for module PySetTrie (see settrie.py).
Author: Márton Miháltz
https://sites.google.com/site/mmihaltz/
"""
import unittest
from settrie import SetTrie, SetTrieMap, SetTrieMultiMap
class TestSetTrie(unittest.TestCase):
"""
UnitTest for SetTrie class
"""
d... | mmihaltz/pysettrie | tests/test_settrie.py | Python | lgpl-3.0 | 15,405 |
big = 2000000 # B = the number below which primes are summed
p = [True] * big # P = whether a number is prime, all are initially true and will later be falsified
print("running sieve...")
s = 0 # S = the sum of primes less than big whic... | rck109d/projectEuler | src/euler/p10_sieve.py | Python | lgpl-3.0 | 748 |
# Copyright (C) 2015-2022 by the RBniCS authors
#
# This file is part of RBniCS.
#
# SPDX-License-Identifier: LGPL-3.0-or-later
from rbnics.utils.decorators import ABCMeta, AbstractBackend, abstractmethod
@AbstractBackend
class ReducedVertices(object, metaclass=ABCMeta):
def __init__(self, space):
pass
... | mathLab/RBniCS | rbnics/backends/abstract/reduced_vertices.py | Python | lgpl-3.0 | 613 |
#
# GdbLib - A Gdb python library.
# Copyright (C) 2012 Fernando Castillo
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any la... | skibyte/gdblib | gdblib/util.py | Python | lgpl-3.0 | 864 |
import string
import uuid
import random
from util import iDict
import exception
# Nothing is validating the Redir section in the xml. I may get nonexistent
# params.
#
__all__ = ['RedirectionManager', 'LocalRedirection', 'RemoteRedirection']
def str2bool(x):
if x is None:
return False
if x.lower(... | DarthMaulware/EquationGroupLeaks | Leak #5 - Lost In Translation/windows/fuzzbunch/redirection.py | Python | unlicense | 20,247 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Mendel's First Law
Usage:
IPRB.py <input>
IPRB.py (--help | --version)
Options:
-h --help show this help message and exit
-v --version show version and exit
"""
problem_description = """Mendel's First Law
Problem
Probability is the mathematical stud... | SavinaRoja/challenges | Rosalind/Heredity/IPRB.py | Python | unlicense | 3,585 |
import scrapy
import re
from research.items import ResearchItem
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
class CaltechSpider(scrapy.Spider):
name = "WISC"
allowed_domains = ["cs.wisc.edu"]
start_urls = ["https://www.cs.wisc.edu/research/groups"]
def parse(self, response):
item = ResearchItem()
f... | doge-search/webdoge | liqian/WISC/research/research/spiders/WISCSpider.py | Python | unlicense | 678 |
from __future__ import division #brings in Python 3.0 mixed type calculation rules
import logging
import numpy as np
import pandas as pd
class TerrplantFunctions(object):
"""
Function class for Stir.
"""
def __init__(self):
"""Class representing the functions for Sip"""
super(Terrplan... | puruckertom/ubertool | ubertool/terrplant/terrplant_functions.py | Python | unlicense | 20,304 |
'''Convert video JSON data into CSV list.
The JSON documents should be from
https://api.twitch.tv/kraken/videos/top?limit=20&offset=0&period=all
'''
import argparse
import csv
import json
import glob
def main():
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument('directory')
arg_parser.add_... | ArchiveTeam/twitchtv-items | utils/apivideos2csv.py | Python | unlicense | 931 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Project.is_forced_active'
db.add_column(u'projects_projec... | tochev/obshtestvo.bg | projects/migrations/0012_auto__add_field_project_is_forced_active.py | Python | unlicense | 19,324 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.