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 |
|---|---|---|---|---|---|
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
for user in orm['auth.user'].objects.all():
notification = orm.Notification()
notification.user = user
... | fgaudin/aemanager | notification/migrations/0002_populate_users.py | Python | agpl-3.0 | 4,216 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import jsonfield.fields
class Migration(migrations.Migration):
dependencies = [
('videos', '0007_auto_20151027_2338'),
]
operations = [
migrations.RemoveField(
model_name... | palfrey/kitling | frontend/videos/migrations/0008_auto_20151028_1154.py | Python | agpl-3.0 | 633 |
import re
from django.conf import settings
from tincan import (
Activity,
ActivityDefinition,
LanguageMap
)
from xapi.patterns.base import BasePattern
from xapi.patterns.eco_verbs import (
LearnerCreatesWikiPageVerb,
LearnerEditsWikiPageVerb
)
class BaseWikiRule(BasePattern): # pylint: disable=ab... | marcore/pok-eco | xapi/patterns/manage_wiki.py | Python | agpl-3.0 | 1,746 |
#!/usr/bin/python
import pytest
from AnnotatorCore import *
def test_getgenesfromfusion():
AB_EXAMPLE = ('A', 'B')
assert getgenesfromfusion('A-B') == AB_EXAMPLE
assert getgenesfromfusion('A-B ') == AB_EXAMPLE
assert getgenesfromfusion('a-b') == ('a', 'b')
assert getgenesfromfusion('A') == ('A', ... | oncokb/oncokb-annotator | test_AnnotatorCore.py | Python | agpl-3.0 | 4,654 |
# ogf4py3
# Copyright (C) 2017 Oscar Triano @cat_dotoscat
# 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 later version.
# Th... | dotoscat/Polytank-ASIR | polytanks/ogf4py3/component.py | Python | agpl-3.0 | 4,129 |
from cms.app_base import CMSApp
from cms.apphook_pool import apphook_pool
from django.utils.translation import ugettext_lazy as _
class ProductApphook(CMSApp):
name = _("Product Apphook")
urls = ["wlansi_store.urls"]
apphook_pool.register(ProductApphook) | matevzmihalic/wlansi-store | wlansi_store/cms_app.py | Python | agpl-3.0 | 264 |
from decimal import Decimal
import ddt
from babel.numbers import format_currency
from django.conf import settings
from django.utils.translation import get_language, to_locale
from oscar.core.loading import get_model
from oscar.test.factories import * # pylint:disable=wildcard-import,unused-wildcard-import
from ecom... | mferenca/HMS-ecommerce | ecommerce/extensions/offer/tests/test_utils.py | Python | agpl-3.0 | 2,446 |
import sys
import zmq
import tnetstring
command_uri = sys.argv[1]
sock = zmq.Context.instance().socket(zmq.REQ)
sock.connect(command_uri)
req = {'method': 'recover'}
sock.send(tnetstring.dumps(req))
resp = tnetstring.loads(sock.recv())
if not resp.get('success'):
raise ValueError('request failed: %s' % resp)
| fanout/pushpin | tools/recover.py | Python | agpl-3.0 | 315 |
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MacadjanUserProfile'
db.create_table(u'macadjan_macadjanuserprofile', (
(u'id', ... | hirunatan/macadjan | macadjan/migrations/0005_auto__add_macadjanuserprofile.py | Python | agpl-3.0 | 15,963 |
# -*- coding: utf-8 -*-
"""Setup the SkyLines application"""
from faker import Faker
from skylines.model import User
def test_admin():
u = User()
u.first_name = u'Example'
u.last_name = u'Manager'
u.email_address = u'manager@somedomain.com'
u.password = u.original_password = u'managepass'
u.a... | kerel-fs/skylines | tests/data/users.py | Python | agpl-3.0 | 1,007 |
# -*- 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 supe... | amagdas/superdesk | server/apps/aap/import_text_archive/commands.py | Python | agpl-3.0 | 9,503 |
import argparse
import os.path
import config
import definitions
import sa_util
import csv_util
def import_module(args):
from dependencies import dependencies_manager
tables = []
for module in args.module:
if not args.updateonly:
definitions.get_importer(module)(verbose=args.verbose)
... | tobes/munge | munge/cli.py | Python | agpl-3.0 | 6,778 |
from . import tnt_config
from . import delivery
from . import stock
from . import carrier_file
| factorlibre/carrier-delivery | delivery_carrier_tnt/model/__init__.py | Python | agpl-3.0 | 95 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
#
# Copyright (C) 2015 Didotech srl (<http://www.didotech.com>).
#
# All Rights Reserved
#
# This program is free software: you can redistr... | iw3hxn/LibrERP | sale_order_analysis/__openerp__.py | Python | agpl-3.0 | 1,472 |
# -*- coding: utf-8 -*-
###############################################################################
#
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol
#
# 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
#... | MostlyOpen/odoo_addons | myo_event/models/annotation.py | Python | agpl-3.0 | 1,400 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import json
import unittest
import intelmq.lib.test as test
from intelmq.bots.parsers.dragonresearchgroup.parser_ssh import \
DragonResearchGroupSSHParserBot
class TestDragonResearchGroupSSHParserBot(test.BotTestCase, unittest.TestCase):
"""
... | sch3m4/intelmq | intelmq/tests/bots/parsers/dragonresearchgroup/test_parser_ssh.py | Python | agpl-3.0 | 598 |
from pyramid.security import ALL_PERMISSIONS, Allow, Authenticated
from .models import DBSession, Distro, Package, Upstream, User
from uptrack.schemas import DistroSchema, UpstreamSchema, UserSchema
resources = {}
class RootFactory(object):
__name__ = 'RootFactory'
__parent__ = None
__acl__ = [(Allow, ... | network-box/uptrack | uptrack/resources.py | Python | agpl-3.0 | 1,492 |
"""
End to end tests for Instructor Dashboard.
"""
from bok_choy.web_app_test import WebAppTest
from regression.pages.lms.course_page_lms import CourseHomePageExtended
from regression.pages.lms.dashboard_lms import DashboardPageExtended
from regression.pages.lms.instructor_dashboard import InstructorDashboardPageExte... | edx/edx-e2e-tests | regression/tests/lms/test_instructor_dashboard.py | Python | agpl-3.0 | 1,326 |
#!/usr/bin/env python3
from math import log, exp
def RungeKutta2aEDO (x0, t0, tf, h, dX):
xold = x0
told = t0
ret = []
while (told <= tf):
ret += [(told, xold)]
k1 = dX(xold, told)
k2 = dX(xold + h*k1, told+h)
xold = xold + h/2 * (k1+k2)
told = round(told + h,3... | paulocsanz/algebra-linear | scripts/runge_kutta_2a.py | Python | agpl-3.0 | 431 |
"""HTTP end-points for the User API. """
import copy
from opaque_keys import InvalidKeyError
from django.conf import settings
from django.contrib.auth.models import User
from django.http import HttpResponse
from django.core.urlresolvers import reverse
from django.core.exceptions import ImproperlyConfigured, NON_FIELD_E... | jbzdak/edx-platform | openedx/core/djangoapps/user_api/views.py | Python | agpl-3.0 | 33,442 |
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from sorl.thumbnail import ImageField
from warnings import warn
class Image(models.Model):
# link to other objects using the ContentType system
content_type = models.Fore... | Hutspace/odekro | mzalendo/images/models.py | Python | agpl-3.0 | 1,690 |
# Generated by Django 1.11.11 on 2018-07-27 18:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0090_degree_curriculum_reset'),
]
operations = [
migrations.AddField(
model_name='degree',
nam... | edx/course-discovery | course_discovery/apps/course_metadata/migrations/0091_auto_20180727_1844.py | Python | agpl-3.0 | 1,487 |
# -*- coding: utf-8 -*-
from ..utils.model_form import ModelForm
from ..models import security
from wtforms import HiddenField, SubmitField
from wtforms.fields import FormField
from wtforms_alchemy import ModelFormField
from wtforms.widgets import ListWidget
from wtforms.ext.sqlalchemy.fields import QuerySelectField
fr... | odtvince/APITaxi | APITaxi/forms/user.py | Python | agpl-3.0 | 716 |
import os
from django.core.management.base import BaseCommand
from xbrowse_server.base.models import Project
class Command(BaseCommand):
def add_arguments(self, parser):
parser.add_argument('args', nargs='*')
def handle(self, *args, **options):
project_id = args[0]
coverage_dir = ... | macarthur-lab/xbrowse | xbrowse_server/base/management/commands/add_coverage_to_project.py | Python | agpl-3.0 | 1,115 |
# -*- coding: utf-8 -*-
# Copyright 2015 Eficent - Jordi Ballester Alomar
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class AnalyticAccountOpen(models.TransientModel):
_name = 'analytic.account.open'
_description = 'Open single analytic account'
... | sysadminmatmoz/pmis | analytic_account_open/wizards/analytic_account_open.py | Python | agpl-3.0 | 1,741 |
#!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
# ... | SKIRT/PTS | magic/config/find_extended.py | Python | agpl-3.0 | 5,377 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class AccountInvoiceSend(models.TransientModel):
_name = 'account.invoice.send'
_inherit = 'account.invoice.send'
_description =... | ddico/odoo | addons/snailmail_account/wizard/account_invoice_send.py | Python | agpl-3.0 | 4,064 |
# Copyright (c) 2016 by Ecreall under licence AGPL terms
# available on http://www.gnu.org/licenses/agpl.html
# licence: AGPL
# author: Amen Souissi
import colander
import deform
import hashlib
from functools import reduce
from zope.interface import implementer
from substanced.schema import NameSchemaNode
from subst... | ecreall/lagendacommun | lac/content/artist.py | Python | agpl-3.0 | 7,788 |
"""Add commentset fields.
Revision ID: a23e88f06478
Revises: 284c10efdbce
Create Date: 2021-03-22 02:54:30.416806
"""
from alembic import op
from sqlalchemy.sql import column, table
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = 'a23e88f06478'
down_revision = '284c10efdbce'
branch_labels... | hasgeek/funnel | migrations/versions/a23e88f06478_add_commentset_fields.py | Python | agpl-3.0 | 1,439 |
"""
Tests for Calendar Sync views.
"""
import ddt
from django.test import TestCase
from django.urls import reverse
from openedx.features.calendar_sync.api import SUBSCRIBE, UNSUBSCRIBE
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import Course... | stvstnfrd/edx-platform | openedx/features/calendar_sync/tests/test_views.py | Python | agpl-3.0 | 2,051 |
"""
Test the about xblock
"""
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from .helpers import LoginEnrollmentTestCase
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from courseware.tests.modulestore_config import TEST_DATA_MIXED_MODULESTORE
from... | pelikanchik/edx-platform | lms/djangoapps/courseware/tests/test_about.py | Python | agpl-3.0 | 1,252 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2016 Didotech srl (http://www.didotech.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 ... | iw3hxn/LibrERP | export_teamsystem/test_data.py | Python | agpl-3.0 | 8,152 |
# -*- coding: utf-8 -*-
# (c) 2015 ACSONE SA/NV, Dhinesh D
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
'name': "Inactive Sessions Timeout",
'summary': """
This module disable all inactive sessions since a given delay""",
'author': "ACSONE SA/NV, "
"Dhinesh D... | ovnicraft/server-tools | auth_session_timeout/__manifest__.py | Python | agpl-3.0 | 691 |
from elasticsearch import helpers
from c2corg_api.scripts.migration.batch import Batch
from elasticsearch.helpers import BulkIndexError
import logging
log = logging.getLogger(__name__)
class ElasticBatch(Batch):
"""A batch implementation to do bulk inserts for ElasticSearch.
Example usage:
batch =... | c2corg/v6_api | c2corg_api/scripts/es/es_batch.py | Python | agpl-3.0 | 1,426 |
from rest_framework.permissions import BasePermission, SAFE_METHODS
class IsOwnerOrReadOnly(BasePermission):
"""
Check if request is safe or authenticated user is owner.
"""
def has_object_permission(self, request, view, obj):
return request.method in SAFE_METHODS or view.get_stream().owner =... | ballotify/django-backend | ballotify/apps/api_v1/streams/permissions.py | Python | agpl-3.0 | 335 |
################################################################################
#
# Copyright 2015-2020 Félix Brezo and Yaiza Rubio
#
# This program is part of OSRFramework. You can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Softwa... | i3visio/osrframework | osrframework/wrappers/pending/cloudflare/forocoches.py | Python | agpl-3.0 | 4,071 |
from datetime import date
from django.core.validators import URLValidator
from django.utils.timezone import now
from survey.tests.models import BaseModelTest
class TestSurvey(BaseModelTest):
def test_unicode(self):
"""Unicode generation."""
self.assertIsNotNone(str(self.survey))
def test_qu... | Pierre-Sassoulas/django-survey | survey/tests/models/test_survey.py | Python | agpl-3.0 | 1,428 |
from pathlib import Path
import pytest
from loguru import logger
from libretime_shared.logging import (
DEBUG,
INFO,
create_task_logger,
level_from_name,
setup_logger,
)
@pytest.mark.parametrize(
"name,level_name,level_no",
[
("error", "error", 40),
("warning", "warning",... | LibreTime/libretime | shared/tests/logging_test.py | Python | agpl-3.0 | 1,238 |
# Main network and testnet3 definitions
params = {
'bitcoin_main': {
'pubkey_address': 50,
'script_address': 9,
'genesis_hash': '00000c7c73d8ce604178dae13f0fc6ec0be3275614366d44b1b4b5c6e238c60c'
},
'bitcoin_test': {
'pubkey_address': 88,
'script_address': 188,
... | mazaclub/tate-server | src/networks.py | Python | agpl-3.0 | 413 |
# © 2008-2020 Dorin Hongu <dhongu(@)gmail(.)com
# See README.rst file on addons root folder for license details
from odoo import fields, models
class IntrastatTransaction(models.Model):
_name = "l10n_ro_intrastat.transaction"
_description = "Intrastat Transaction"
_rec_name = "description"
code = f... | dhongu/l10n-romania | l10n_ro_intrastat/models/l10n_ro_intrastat.py | Python | agpl-3.0 | 1,017 |
"""Post admins
Revision ID: 449914911f93
Revises: 2420dd9c9949
Create Date: 2013-12-03 23:03:02.404457
"""
# revision identifiers, used by Alembic.
revision = '449914911f93'
down_revision = '2420dd9c9949'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'jobpost_admin',
... | hasgeek/hasjob | migrations/versions/449914911f93_post_admins.py | Python | agpl-3.0 | 812 |
"""
Tests of CourseKeys and CourseLocators
"""
import ddt
from bson.objectid import ObjectId
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import BlockUsageLocator, CourseLocator
from opaque_keys.edx.tests import LocatorBaseTest, TestDeprecated
@dd... | devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/opaque_keys/edx/tests/test_course_locators.py | Python | agpl-3.0 | 10,010 |
##############################################################################
#
# Copyright (C) 2015 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __manifest__.py
#
#####################... | eicher31/compassion-switzerland | report_compassion/models/contract_group.py | Python | agpl-3.0 | 5,996 |
from functools import wraps
from django.shortcuts import get_object_or_404, redirect
from django.http import Http404, HttpResponseForbidden, HttpResponseBadRequest
from autodidact.models import *
def needs_course(view):
@wraps(view)
def wrapper(request, course_slug, *args, **kwargs):
if isinstance(cour... | JaapJoris/autodidact | autodidact/views/decorators.py | Python | agpl-3.0 | 3,963 |
# -*- coding: utf-8 -*-
# ============================================================================ #
# SMB2_Header.py
#
# Copyright:
# Copyright (C) 2016 by Christopher R. Hertel
#
# $Id: SMB2_Header.py; 2019-06-18 17:56:20 -0500; crh$
#
# -------------------------------------------... | ubiqx-org/Carnaval | carnaval/smb/SMB2_Header.py | Python | agpl-3.0 | 40,520 |
'''
Created on Nov 10, 2014
@author: lauritz
'''
from mock import Mock
from fakelargefile.segmenttail import OverlapSearcher
def test_index_iter_stop():
os = OverlapSearcher("asdf")
segment = Mock()
segment.start = 11
try:
os.index_iter(segment, stop=10).next()
except ValueError:
... | LauritzThaulow/fakelargefile | tests/test_segmenttail.py | Python | agpl-3.0 | 365 |
"""Charm Helpers saltstack - declare the state of your machines.
This helper enables you to declare your machine state, rather than
program it procedurally (and have to test each change to your procedures).
Your install hook can be as simple as:
{{{
from charmhelpers.contrib.saltstack import (
install_salt_suppor... | Ubuntu-Solutions-Engineering/glance-simplestreams-sync-charm | hooks/charmhelpers/contrib/saltstack/__init__.py | Python | agpl-3.0 | 2,778 |
# -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import account_invoice
from . import account_invoice_refund
| Gebesa-Dev/Addons-gebesa | account_invoice_refund_mode/models/__init__.py | Python | agpl-3.0 | 187 |
"""
Tests the crowdsourced hinter xmodule.
"""
from mock import Mock, MagicMock
import unittest
import copy
from xmodule.crowdsource_hinter import CrowdsourceHinterModule
from xmodule.vertical_module import VerticalModule, VerticalDescriptor
from xblock.field_data import DictFieldData
from xblock.fragment import Frag... | TsinghuaX/edx-platform | common/lib/xmodule/xmodule/tests/test_crowdsource_hinter.py | Python | agpl-3.0 | 22,068 |
from django.urls import path
import users.views
urlpatterns = [
path("settings/", users.views.user_settings, name="settings"),
path("reset_token/", users.views.reset_token, name="reset_token"),
path("panel_hide/", users.views.panel_hide, name="hide_new_panel"),
]
| UrLab/beta402 | users/urls.py | Python | agpl-3.0 | 278 |
# function.py - views for evaluating SQL functions on SQLAlchemy models
#
# Copyright 2011 Lincoln de Sousa <lincoln@comum.org>.
# Copyright 2012, 2013, 2014, 2015, 2016 Jeffrey Finkelstein
# <jeffrey.finkelstein@gmail.com> and contributors.
#
# This file is part of Flask-Restless.
#
# Flask-Restless is distr... | jwg4/flask-restless | flask_restless/views/function.py | Python | agpl-3.0 | 2,512 |
#!/usr/bin/env python
# coding=utf-8
# lachesis automates the segmentation of a transcript into closed captions
#
# Copyright (C) 2016-2017, Alberto Pettarin (www.albertopettarin.it)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License a... | readbeyond/lachesis | lachesis/nlpwrappers/pattern.py | Python | agpl-3.0 | 5,498 |
# -*- coding: utf-8 -*-
# Copyright 2018 Lorenzo Battistini - Agile Business Group
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl).
{
"name": "Causali pagamento per ritenute d'acconto",
"version": "10.0.1.0.0",
"development_status": "Beta",
"category": "Hidden",
"website": "https://g... | linkitspa/l10n-italy | l10n_it_withholding_tax_causali/__manifest__.py | Python | agpl-3.0 | 677 |
# -*- coding: utf-8 -*-
#Copyright (C) 2011 Seán Hayes
#Python imports
import logging
import pdb
#Django imports
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.db import models, IntegrityError
from django.db.models.signals import post_save
from django.utils import... | SeanHayes/swarm-war | swarm_war/teams/models.py | Python | agpl-3.0 | 3,862 |
# coding=utf-8
"""
DCRM - Darwin Cydia Repository Manager
Copyright (C) 2017 WU Zheng <i.82@me.com>
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 yo... | 82Flex/DCRM | WEIPDCRM/views/admin/help/about.py | Python | agpl-3.0 | 1,308 |
##############################################################################
#
# 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 ... | uclouvain/osis | assessments/views/common/score_encoding_progress_overview.py | Python | agpl-3.0 | 2,568 |
"""A wait callback to allow psycopg2 cooperation with gevent.
Use `patch_psycopg()` to enable gevent support in Psycopg.
"""
# Copyright (C) 2010-2012 Daniele Varrazzo <daniele.varrazzo@gmail.com>
# All rights reserved. See COPYING file for details.
from __future__ import absolute_import
import psycopg2
from psyc... | funkring/fdoo | psycogreen/gevent.py | Python | agpl-3.0 | 2,927 |
# Copyright 2020 initOS GmbH
# Copyright 2012-2018 Therp BV <https://therp.nl>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "LDAP groups assignment",
"version": "11.0.1.0.0",
"depends": ["auth_ldap"],
"author": "initOS GmbH, Therp BV, Odoo Community Association (OCA)",... | brain-tec/server-tools | users_ldap_groups/__manifest__.py | Python | agpl-3.0 | 704 |
from twisted.internet.defer import inlineCallbacks, fail, succeed
from globaleaks import models
from globaleaks.orm import transact
from globaleaks.tests import helpers
from globaleaks.jobs.delivery_sched import DeliverySchedule
from globaleaks.jobs.notification_sched import NotificationSchedule, MailGenerator
cla... | vodkina/GlobaLeaks | backend/globaleaks/tests/jobs/test_notification_sched.py | Python | agpl-3.0 | 1,811 |
from popit.models import Membership
def main():
memberships = Membership.objects.language("en").all()
for membership in memberships:
if not membership.organization:
if membership.post:
if membership.post.organization:
membership.organization = membership.... | Sinar/popit_ng | popit/utils/set_membership_org_from_post.py | Python | agpl-3.0 | 402 |
# ported from gnulib rev be7d73709d2b3bceb987f1be00a049bb7021bf87
#
# Copyright (C) 2014, Mark Laws.
# Copyright (C) 1999, 2002-2003, 2005-2007, 2009-2014 Free Software
# Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public Lice... | drvink/pyc-fmtstr-parser | pyc_fmtstr_parser/printf_parse.py | Python | lgpl-2.1 | 13,012 |
"""
Test connecting to a server.
"""
from gabbletest import exec_test
import constants as cs
def test(q, bus, conn, stream):
conn.Connect()
q.expect('dbus-signal', signal='StatusChanged', args=[cs.CONN_STATUS_CONNECTING, cs.CSR_REQUESTED])
q.expect('stream-authenticated')
q.expect('dbus-signal', sign... | jku/telepathy-gabble | tests/twisted/connect/test-success.py | Python | lgpl-2.1 | 558 |
#!/usr/bin/python
# Urwid common display code
# Copyright (C) 2004-2011 Ian Ward
#
# 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 ... | rndusr/urwid | urwid/display_common.py | Python | lgpl-2.1 | 31,238 |
#!/usr/bin/python -u
# -*- coding: utf-8 -*-
import libxml2
import time
import traceback
import sys
import logging
from pyxmpp.all import JID,Iq,Presence,Message,StreamError
from pyxmpp.jabber.all import Client
class Disconnected(Exception):
pass
class MyClient(Client):
def session_started(self):
se... | Jajcus/pyxmpp | examples/c2s_test.py | Python | lgpl-2.1 | 1,349 |
# Written by Ingar Arntzen
# see LICENSE.txt for license information
"""
This module implements a generic console interface that can
be attached to any runnable python object.
"""
import code
import __builtin__
import threading
import exceptions
##############################################
# OBJECT CONSOLE
#######... | egbertbouman/tribler-g | Tribler/UPnP/common/objectconsole.py | Python | lgpl-2.1 | 2,734 |
import os
from zeroinstall.injector import namespaces
from zeroinstall.injector.reader import InvalidInterface, load_feed
from xml.dom import minidom, Node, XMLNS_NAMESPACE
import tempfile
from logging import warn, info
group_impl_attribs = ['version', 'version-modifier', 'released', 'main', 'stability', 'arch', 'lice... | timdiels/0publish | validator.py | Python | lgpl-2.1 | 2,847 |
import requests
params = {'username':'Ryan', 'password':'password'}
r = requests.post("http://pythonscraping.com/pages/cookies/welcome.php", params)
print("Cookie is set to:")
print(r.cookies.get_dict())
print("-------------")
print("Going to profile page...")
r = requests.get("http://pythonscraping.com/pages/cookies/... | XiangYz/webscraper | test10.py | Python | lgpl-2.1 | 368 |
"""SCons.Tool.tar
Tool-specific initialization for tar.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001 - 2015 The SCons Foundation
#
# Permission is hereby granted, free of charge, to... | Uli1/mapnik | scons/scons-local-2.4.0/SCons/Tool/tar.py | Python | lgpl-2.1 | 2,503 |
#!/usr/bin/python
#
# examples/xdamage.py -- demonstrate damage extension
#
# Copyright (C) 2019 Mohit Garg <mrmohitgarg1990@gmail.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... | python-xlib/python-xlib | examples/xdamage.py | Python | lgpl-2.1 | 4,638 |
import ardurpc
from ardurpc.handler import Handler
class Base(Handler):
"""Handler for the Base Text-LCD type"""
def __init__(self, **kwargs):
Handler.__init__(self, **kwargs)
def getWidth(self):
"""
Get the display width as number of characters.
:return: Width
:... | DinoTools/ArduRPC-python | ardurpc/handler/lcd/__init__.py | Python | lgpl-3.0 | 1,384 |
from __future__ import division
"""
instek_pst.py
part of the CsPyController package for AQuA experiment control by Martin Lichtman
Handles sending commands to Instek PST power supplies over RS232.
created = 2015.07.09
modified >= 2015.07.09
"""
__author__ = 'Martin Lichtman'
import logging
logger =... | QuantumQuadrate/CsPyController | python/vaunix.py | Python | lgpl-3.0 | 9,955 |
# Copyright (c) 2020 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from typing import List, Optional, Dict, cast
from PyQt5.QtCore import pyqtSignal, QObject, pyqtProperty, QCoreApplication
from UM.FlameProfiler import pyqtSlot
from UM.PluginRegistry import PluginRegistry
from UM.Applicati... | Ultimaker/Cura | plugins/3MFReader/WorkspaceDialog.py | Python | lgpl-3.0 | 14,135 |
# This file is part of PRAW.
#
# PRAW 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.
#
# PRAW is distributed in the hope that it will ... | mikeolteanu/livepythonconsole-app-engine | boilerplate/external/praw/__init__.py | Python | lgpl-3.0 | 81,183 |
from six import iteritems
class MaxDisplacement(object):
def __init__(self, data):
self.translations = {}
self.rotations = {}
for line in data:
sid = line[0]
self.translations[sid] = line[1:4]
self.rotations[sid] = line[4:]
def write_f06... | saullocastro/pyNastran | pyNastran/f06/dev/f06_classes.py | Python | lgpl-3.0 | 904 |
#
# @BEGIN LICENSE
#
# Psi4: an open-source quantum chemistry software package
#
# Copyright (c) 2007-2021 The Psi4 Developers.
#
# The copyrights for code used from other parties are included in
# the corresponding files.
#
# This file is part of Psi4.
#
# Psi4 is free software; you can redistribute it and/or modify
#... | ashutoshvt/psi4 | psi4/share/psi4/databases/A24alt.py | Python | lgpl-3.0 | 29,758 |
# -*- coding: utf-8 *-*
# made for python3!
from tkinter import *
from tkinter.ttk import *
class TkWindow():
registers = {}
def __init__(self, parent, title, width=400, height=300):
self.parent = parent #Tk or toplevel
self.w = width
self.h = height
self.make_gui(ti... | ManInAGarden/PiADCMeasure | tkwindow.py | Python | lgpl-3.0 | 4,958 |
"""A likelihood function representing a Student-t distribution.
Author:
Ilias Bilionis
Date:
1/21/2013
"""
__all__ = ['StudentTLikelihoodFunction']
import numpy as np
import scipy
import math
from . import GaussianLikelihoodFunction
class StudentTLikelihoodFunction(GaussianLikelihoodFunction):
"""An... | ebilionis/py-best | best/random/_student_t_likelihood_function.py | Python | lgpl-3.0 | 2,586 |
import pytest
from argparse import Namespace
from behave_cmdline import environment as env
@pytest.fixture(scope="function")
def dummy_context():
ns = Namespace()
env.before_scenario(ns, None)
yield ns
env.after_scenario(ns, None)
| buguroo/behave-cmdline | tests/unit/conftest.py | Python | lgpl-3.0 | 249 |
'''
This file is part of GEAR_mc.
GEAR_mc is a fork of Jeremie Passerin's GEAR project.
GEAR 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... | miquelcampos/GEAR_mc | workgroup/Addons/gear/Application/Plugins/gear_transformTools.py | Python | lgpl-3.0 | 5,127 |
"""Various array operations.
Author: Seth Axen
E-mail: seth.axen@gmail.com
"""
import numpy as np
from scipy.spatial.distance import pdist, squareform
QUATERNION_DTYPE = np.float64
X_AXIS, Y_AXIS, Z_AXIS = np.identity(3, dtype=np.float64)
EPS = 1e-12 # epsilon, a number close to 0
# Vector Algebra Methods
def as_u... | keiserlab/e3fp | e3fp/fingerprint/array_ops.py | Python | lgpl-3.0 | 9,285 |
# -*- coding: utf-8 -*-
"""
Created on Sat Dec 6 17:01:05 2014
@author: remi
@TODO :
in the function train_RForest_with_kfold we should keep all result proba for each class, this could be very intersting.
"""
import numpy as np ; #efficient arrays
import pandas as pd; # data frame to do sql like operation
im... | Remi-C/LOD_ordering_for_patches_of_points | script/loading benchmark/rforest_on_patch_lean.py | Python | lgpl-3.0 | 8,121 |
import gtk
import highgtk.entity
import highgtk.present.default.layout
def add (inquiry):
window = getattr (inquiry, "present_window", None)
if window is None:
inquiry.present_window = gtk.Dialog()
title = getattr (inquiry, "title", None)
if title is None:
root = highgtk.e... | zinnschlag/high-pygtk | highgtk/present/default/inquiry.py | Python | lgpl-3.0 | 2,487 |
import re
s = open("neurolab/tool.py", "r").read()
s = re.sub('^([ \t\r\f\v]*)(.+?)\.shape = (.*?), (.*?)$', '\g<1>\g<2> = \g<2>.reshape((\g<3>, \g<4>,)) #replacement for \"\\g<0>\"', s, flags=re.MULTILINE)
s = re.sub('^([ \t\r\f\v]*)(.+?)\.shape = (\S+?)$', '\g<1>\g<2> = \g<2>.reshape(\g<3>) #replacement for \"\\g<0>... | inferrna/neurolabcl | replacer.py | Python | lgpl-3.0 | 407 |
from odoo import fields, models
class SaasSubscriptionLog(models.Model):
_name = 'saas_portal.subscription_log'
_order = 'id desc'
client_id = fields.Many2one('saas_portal.client', 'Client')
expiration = fields.Datetime('Previous expiration')
expiration_new = fields.Datetime('New expiration')
... | it-projects-llc/odoo-saas-tools | saas_portal_subscription/models/subscription_log.py | Python | lgpl-3.0 | 352 |
# encoding: utf-8
from __future__ import unicode_literals
import os
import re
import sys
from .common import InfoExtractor
from .youtube import YoutubeIE
from ..compat import (
compat_etree_fromstring,
compat_urllib_parse_unquote,
compat_urlparse,
compat_xml_parse_error,
)
from ..utils import (
d... | Rudloff/youtube-dl | youtube_dl/extractor/generic.py | Python | unlicense | 99,048 |
import pyodbc
import config
def main():
# formatで`{`を使うため、`{`を重ねることでエスケープ
con_str = 'Driver={{Microsoft Access Driver (*.mdb, *.accdb)}};Dbq={0};'.format(config.PATH_ACCDB)
conn = pyodbc.connect(con_str)
cur = conn.cursor()
cur.execute("select item_name from item")
for c in cur.fetchall():... | thinkAmi-sandbox/python_ms_access_sample | pyodbc_runner.py | Python | unlicense | 487 |
# pattern seems to be multiplying every pair of digits from different numbers and adding them up
from itertools import product
def test_it(a, b):
return sum(int(d1)*int(d2) for d1,d2 in product(str(a), str(b)))
| SelvorWhim/competitive | Codewars/ThinkingTestingAB.py | Python | unlicense | 217 |
#!/usr/bin/env python
import pexpect
import traceback
import time
import os
import sys
import re
addr = 'telnet 192.168.99.1 10000'
uname = ['a', 'd', 'm', 'i', 'n']
passwd = ['p', 'a', 's', 's', 'w', 'd']
cmdline = "show statistics traffic 5/1/0-1\n"
qq = ["e", "x", "i", "t", "\n"]
logName = 'Traffic_' + time.strftim... | wbvalid/python2 | telnetFlowMeasure.py | Python | unlicense | 1,829 |
#!/usr/bin/env python
import warnings as _warnings
_warnings.resetwarnings()
_warnings.filterwarnings('error')
from tdi import html
template = html.from_string("""
<node tdi="item">
<znode tdi="nested" tdi:overlay="foo">
<ynode tdi="subnested"></ynode>
</znode>
<xnode tdi="a"></xnode>
</node>
""".... | ndparker/tdi | tests/template/overlay_nested2.py | Python | apache-2.0 | 865 |
# Copyright (c) 2010-2011 OpenStack, LLC.
# Copyright (c) 2008-2011 Gluster, 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 ... | mja054/swift_plugin | swift/obj/server.py | Python | apache-2.0 | 39,651 |
""" Cisco_IOS_XR_ipv4_acl_cfg
This module contains a collection of YANG definitions
for Cisco IOS\-XR ipv4\-acl package configuration.
This module contains definitions
for the following management objects\:
ipv4\-acl\-and\-prefix\-list\: IPv4 ACL configuration data
Copyright (c) 2013\-2016 by Cisco Systems, Inc.
... | 111pontes/ydk-py | cisco-ios-xr/ydk/models/cisco_ios_xr/Cisco_IOS_XR_ipv4_acl_cfg.py | Python | apache-2.0 | 83,998 |
# ==================================================================================================
# Copyright 2011 Twitter, Inc.
# --------------------------------------------------------------------------------------------------
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use thi... | foursquare/commons-old | tests/python/twitter/pants/base/test-generator.py | Python | apache-2.0 | 1,738 |
import zstackwoodpecker.test_state as ts_header
TestAction = ts_header.TestAction
def path():
return dict(initial_formation="template4",\
path_list=[[TestAction.delete_volume, "vm1-volume1"], \
[TestAction.reboot_vm, "vm1"], \
[TestAction.create_volume, "volume1", "=scsi"], \
[TestAction.attac... | zstackorg/zstack-woodpecker | integrationtest/vm/multihosts/volumes/paths/path119.py | Python | apache-2.0 | 870 |
from servicemanager.actions import actions
from servicemanager.smcontext import SmApplication, SmContext, ServiceManagerException
from servicemanager.smprocess import SmProcess
from servicemanager.service.smplayservice import SmPlayService
from servicemanager.serviceresolver import ServiceResolver
import pytest
from ... | hmrc/service-manager | test/it/test_actions.py | Python | apache-2.0 | 11,909 |
from __future__ import print_function
import os
import sys
from subprocess import Popen, PIPE
from getpass import getpass
from shutil import rmtree
import argparse
# inspired by https://github.com/mitsuhiko/flask/blob/master/scripts/make-release.py
def set_filename_version(filename, version_number):
with open(f... | Alexis-benoist/eralchemy | script/make_release.py | Python | apache-2.0 | 3,766 |
import zstackwoodpecker.operations.host_operations as host_ops
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.operations.volume_operations as vol_ops
import zstackwoodpecker.test_util as test_util
volume = None
disconnect = False
host = None
def test():
global disconnec... | zstackio/zstack-woodpecker | integrationtest/vm/mini/multiclusters/test_disconnect_host_volume_create_negative1.py | Python | apache-2.0 | 2,411 |
# -*- coding: utf-8 -*-
class DictDiffer(object):
"""
Calculate the difference between two dictionaries as:
(1) items added
(2) items removed
(3) keys same in both but changed values
(4) keys same in both and unchanged values
"""
def __init__(self, current_dict, pas... | pyphrb/myweb | app/plugin/nmap/libnmap/diff.py | Python | apache-2.0 | 2,896 |
# Copyright 2021 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, ... | google/jax-cfd | jax_cfd/base/pressure.py | Python | apache-2.0 | 3,942 |
import unittest
import graph
class BreadthFirstSearchTest(unittest.TestCase):
__runSlowTests = False
def testTinyGraph(self):
g = graph.Graph.from_file('tinyG.txt')
bfs = graph.BreadthFirstSearch(g, 0)
self.assertEqual(7, bfs.count())
self.assertFalse(bfs.connected(7))
... | RobMcZag/python-algorithms3 | graph/tests/bfs_test.py | Python | apache-2.0 | 2,306 |
# ----------------------------------------------------------------------------
# Copyright 2015 Nervana Systems 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.o... | nhynes/neon | neon/data/loader/test/compare.py | Python | apache-2.0 | 6,514 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.