code stringlengths 1 199k |
|---|
import time
import sys
if len(sys.argv) > 1:
INTERFACE = sys.argv[1]
else:
INTERFACE = 'eth1'
STATS = []
print 'Interface:',INTERFACE
def rx():
ifstat = open('/proc/net/dev').readlines()
for interface in ifstat:
#print '----', interface, '-----'
if INTERFACE in interface:
st... |
from gnuradio import gr, gr_unittest
from gnuradio import blocks
import drm_swig as drm
class qa_cell_mapping_cc (gr_unittest.TestCase):
def setUp (self):
self.tb = gr.top_block ()
self.tp = drm.transm_params(1, 3, False, 0, 1, 0, 1, 1, 0, False, 24000, "station label", "text message")
vlen_... |
"""
Created on Sat Sep 17 17:19:10 2016
@author: Michael
"""
from PyQt5 import QtWidgets
class AboutWindow(QtWidgets.QTextEdit):
def __init__(self, parent=None):
super().__init__(parent)
self.setReadOnly(True)
self.setHtml(
"""
<h1 id="kano">Kano</h1>
<p>Copyright (c) 2017, Michael Schreier <br>
All ... |
import time, sys, socket, os
import threading
import urllib2
import json
import Queue
import sqlite3
import electrum_doge as electrum
electrum.set_verbosity(False)
import ConfigParser
config = ConfigParser.ConfigParser()
config.read("merchant.conf")
my_password = config.get('main','password')
my_host = config.get('main... |
class Solution(object):
def updateBoard(self, board, click):
"""
:type board: List[List[str]]
:type click: List[int]
:rtype: List[List[str]]
"""
if not board:
return
m, n = len(board), len(board[0])
queue = collections.deque()
queue... |
import base64
import calendar
import os
import re
import paramiko
from io import StringIO
import hashlib
import threading
import time
import pyte
def ssh_key_string_to_obj(text):
key_f = StringIO(text)
key = None
try:
key = paramiko.RSAKey.from_private_key(key_f)
except paramiko.SSHException:
... |
import os
def remove_fname_extension(fname):
return os.path.splitext(fname)[0]
def change_fname_extension(fname, extension):
return remove_fname_extension(fname) + '.' + extension
def concat(path, fname):
return path + '/' + fname |
"""
These are the views that control the spaces, meetings and documents.
"""
import datetime
import itertools
import hashlib
from django.views.generic.base import TemplateView, RedirectView
from django.views.generic.list import ListView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from djang... |
import time
import numpy as np
"""
Module for prime related computations
Includes:
Infinite prime iterator
Thresholded prime iterator
Primality test
Prime Factorization
Divisor Computation
Divisor Cardinality
"""
class EratosthenesSieve(object):
"""
Dynamic Sieve of Eratosthenes for prim... |
from collections import namedtuple
from uuid import uuid4
from GEMEditor.model.classes.annotation import Annotation
class Reference:
""" ReferenceItem contains the information a pubmed or similar literature reference
Authors are saved as author instances """
def __init__(self, id=None, pmid="", pmc="", doi=... |
import unittest
from datetime import datetime
import tempfile
import os
from due.agent import Agent
from due.episode import Episode
from due.event import Event
from due.persistence import serialize, deserialize
from due.models.tfidf import TfIdfAgent
from due.models.dummy import DummyAgent
class TestTfIdfAgent(unittest... |
import numpy as np
import warnings
import subprocess
import pogoFunctions as pF
import pdb
from PolyInterface import poly
class PogoInput:
def __init__(self,
fileName,
elementTypes,
signals,
historyMeasurement,
nodes = None,
... |
"""
FILE: php.py
AUTHOR: Cody Precord
@summary: Lexer configuration module for PHP.
"""
__author__ = "Cody Precord <cprecord@editra.org>"
__svnid__ = "$Id: _php.py 67413 2011-04-07 14:39:39Z CJP $"
__revision__ = "$Revision: 67413 $"
import wx.stc as stc
import synglob
import syndata
import _html
from _cpp import AutoI... |
"""
Creates fasta file from orfs
"""
import argparse
import os
import sys
import site
import re
import numpy as np
import numpy.random
base_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
base_path="%s/src"%base_path
for directory_name in os.listdir(base_path):
site.addsitedir(os.path.join(base_p... |
from django.db import models
class Group(models.Model):
BASE_URL = "https://www.facebook.com/groups/%s"
def __unicode__(self):
return self.name
id = models.BigIntegerField(primary_key=True)
name = models.CharField(max_length = 100)
school = models.CharField(max_length = 100)
class User(models.Model):
def __unic... |
from __future__ import unicode_literals
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
from builtins import * # noqa
import logging
import requests
from base64 import b64decode, b64encode
from bottle import request, abort
from future.moves.urllib.parse impo... |
from __future__ import print_function, division, unicode_literals
from pprint import pprint
from itertools import groupby
from functools import wraps
from collections import namedtuple, deque
try:
from collections import OrderedDict
except ImportError:
from .ordereddict import OrderedDict
def group_entries_bylo... |
'''
Font handling wrapper.
'''
from weblate import appsettings
from PIL import ImageFont
import os.path
BASE_CHARS = frozenset((
0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe,
0xf, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a,
0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x2... |
import MySQLdb
import string
import time
import datetime
import os
import re
import json
import sys
reload(sys)
sys.setdefaultencoding('utf8')
import ConfigParser
import smtplib
from email.mime.text import MIMEText
from email.message import Message
from email.header import Header
from pymongo import MongoClient
import ... |
"""
views.py
Created by Christophe VAN FRACKEM on 2014/05/25.
Copyright (c) 2014 Tiss'Page. All rights reserved.
"""
__author__ = 'Christophe VAN FRACKEM <contact@tisspage.fr>'
__version__= '0.0.1'
__copyright__ = '© 2014 Tiss\'Page'
from django.shortcuts import render_to_response
from django.views.generic import View,... |
import glob, gzip, csv, sys, os, copy, re
csv.register_dialect('tab', delimiter='\t', quoting=csv.QUOTE_NONE)
def usage(msg=None):
if msg==None:
print 'Usage: plot.py [OPTIONS] <dir>'
print 'Options:'
print ' -H, --highlight +group1,-group2 Highlight calls shared within group1 but no... |
COUNTRIES = {
"AF": "Afghanistan",
"AX": "Aland Islan",
"AL": "Albania",
"DZ": "Algeria",
"AS": "American Samoa",
"AD": "Andorra",
"AO": "Angola",
"AI": "Anguilla",
"AQ": "Antarctica",
"AG": "Antigua and Barbuda",
"AR": "Argentina",
"AM": "Armenia",
"AW": "Aruba",
... |
from distutils.util import convert_path
import os
from setuptools import setup
root = os.path.abspath(os.path.dirname(__file__))
path = lambda *p: os.path.join(root, *p)
try:
long_desc = open(path('README.txt')).read()
except Exception:
long_desc = "<Missing README.txt>"
print("Missing README.txt")
def find... |
import os
import sys
this_directory = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.abspath(os.path.join(this_directory, '..')))
from community_share import config, store, Base
from community_share.models.user import User, TypedLabel
from community_share.models.search import Label
grade_level_labe... |
"""desktop_l10n.py
This script manages Desktop repacks for nightly builds.
In this version, a single partial is supported.
"""
import os
import re
import sys
import subprocess
sys.path.insert(1, os.path.dirname(sys.path[0]))
from mozharness.base.errors import BaseErrorList, MakefileErrorList
from mozharness.base.script... |
from .version import version as __version__
from oplus.configuration import CONF
from oplus.epm.api import *
from oplus.weather_data.api import *
from oplus.standard_output.api import *
from oplus.eio import Eio
from oplus.mtd import Mtd
from oplus.err import Err
from oplus.summary_table import SummaryTable
from oplus.... |
import base64
import json
import os
import six
from wptserve.utils import isomorphic_decode, isomorphic_encode
def decodebytes(s):
if six.PY3:
return base64.decodebytes(six.ensure_binary(s))
return base64.decodestring(s)
def main(request, response):
headers = []
headers.append((b'X-ServiceWorker... |
from datetime import datetime
from django.conf import settings
from django.db import models
from django_extensions.db.fields import CreationDateTimeField
class TimeStampedModel(models.Model):
"""
Replacement for django_extensions.db.models.TimeStampedModel
that updates the modified timestamp by default, but... |
import mozhttpd
import urllib2
import os
import unittest
import mozunit
here = os.path.dirname(os.path.abspath(__file__))
class RequestLogTest(unittest.TestCase):
def check_logging(self, log_requests=False):
httpd = mozhttpd.MozHttpd(port=0, docroot=here, log_requests=log_requests)
httpd.start(block... |
import cis_profile
import cis_publisher
import boto3
import botocore
import os
import logging
import json
import time
from auth0.v3.authentication import GetToken
from auth0.v3.management import Auth0
from auth0.v3.exceptions import Auth0Error
from datetime import datetime, timezone, timedelta
from traceback import for... |
from __future__ import unicode_literals
from __future__ import division
from __future__ import absolute_import
from pyLibrary.dot import wrap
def es_query_template():
output = wrap({
"query": {"match_all": {}},
"from": 0,
"size": 0,
"sort": []
})
return output
def qb_sort_to_... |
from django.conf import settings as django_settings
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.http import HttpResponse
from django.shortcuts import render, redirect, get_object_or_404
from django.views.decorators.cache import never_cache
from helfertool.utils ... |
import datetime
import os
from sqlalchemy import create_engine
from sqlalchemy import MetaData, Table, Column, DateTime, Float, Integer, ForeignKey
from sqlalchemy import between, func
from sqlalchemy.sql import select
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy import Column, String, DateTime, Fl... |
from django.conf.urls.defaults import patterns, url
from django.conf import settings
import views
urlpatterns = patterns('',
# CRUD
url(r'^new$', views.new, name='create'),
# Search
url(r'^search$', views.search, name='search'),
url(r'^search/cantfind$', views.search_cantfind, name='search-cantfind'... |
'''
Created on 2010 aza 30
@author: peio
It test the mapping module of franklin
'''
import unittest, os, StringIO
from os.path import join, exists
from tempfile import NamedTemporaryFile
from franklin.utils.misc_utils import TEST_DATA_DIR, NamedTemporaryDir
from franklin.mapping import map_reads_with_gmap, map_reads_wi... |
from django.conf.urls import patterns, url
from piston.authentication import HttpBasicAuthentication
from piston.resource import Resource
from identityprovider.auth import (
basic_authenticate,
SSOOAuthAuthentication,
)
import api.v10.handlers as v10
import api.v11.handlers as v11
import api.v20.handlers as v20... |
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
notifica... |
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='video',
name='a... |
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=abst... |
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', 'A')
assert getge... |
from math import fabs
class Body(object):
"""Basic component for physics.
You can enable or disable gravity for this :class:`Body` with the
attribute *gravity*.
"""
def __init__(self, gravity=False, max_falling_speed=0., max_ascending_speed=0.):
self.x = 0.0
self.y = 0.0
self... |
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) |
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 ecommer... |
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) |
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', self.gf('django.db.models.f... |
"""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.admin = True
return u
de... |
import superdesk
import urllib3
import urllib
import xml.etree.ElementTree as etree
from superdesk.io.iptc import subject_codes
from datetime import datetime
from superdesk.metadata.item import ITEM_TYPE, CONTENT_TYPE, ITEM_STATE, CONTENT_STATE
from superdesk.utc import utc
from superdesk.io.commands.update_ingest impo... |
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)
... |
from . import tnt_config
from . import delivery
from . import stock
from . import carrier_file |
{
"name": "Sale Order Analysis",
"version": "3.1.1.2",
"author": "Didotech SRL",
"website": "http://www.didotech.com",
"category": "Sales Management",
"description": """
Module permits to create a simple analysis on sale shop based on date, sales team, user
""",
"depends": [
... |
from openerp import fields, models
class Event(models.Model):
_inherit = 'myo.event'
annotation_ids = fields.Many2many(
'myo.annotation',
'myo_event_annotation_rel',
'event_id',
'annotation_id',
'Annotations'
)
class Annotation(models.Model):
_inherit = 'myo.annot... |
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):
"""
A TestCase for DragonResea... |
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, Authe... |
"""
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 InstructorDashboardPageExtend... |
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)
return ret
if __name... |
"""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... |
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.ForeignK... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('course_metadata', '0090_degree_curriculum_reset'),
]
operations = [
migrations.AddField(
model_name='degree',
name='campus_image_desktop',
field=models.Image... |
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
from flask_wtf.file import... |
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 = args[1]... |
from odoo import api, fields, models
class AnalyticAccountOpen(models.TransientModel):
_name = 'analytic.account.open'
_description = 'Open single analytic account'
analytic_account_id = fields.Many2one(
'account.analytic.account',
'Analytic Account',
required=True
)
include_... |
from pts.core.basics.configuration import ConfigurationDefinition
definition = ConfigurationDefinition()
definition.add_optional("input_path", "directory_path", "path to the input directory")
definition.add_optional("output_path", "directory_path", "path to the output directory")
definition.add_flag("track_record", "tr... |
from odoo import api, fields, models, _
from odoo.exceptions import UserError
class AccountInvoiceSend(models.TransientModel):
_name = 'account.invoice.send'
_inherit = 'account.invoice.send'
_description = 'Account Invoice Send'
partner_id = fields.Many2one('res.partner', compute='_get_partner', string... |
import colander
import deform
import hashlib
from functools import reduce
from zope.interface import implementer
from substanced.schema import NameSchemaNode
from substanced.content import content
from substanced.util import get_oid
from dace.descriptors import (
CompositeUniqueProperty,
SharedUniqueProperty,
... |
"""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 = 'a23e88f06478'
down_revision = '284c10efdbce'
branch_labels = None
depends_on = None
commentset = table... |
"""
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 CourseFact... |
"""
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 ... |
from team_system_template import cash_book, account_template, tax_template
from team_system_template import deadline_book, industrial_accounting_template, industrial_accounting
tax_data = tax_template.format(**{
'taxable': 240000000, # Imponibile 6 dec?
'vat_code': 22, # Aliquota Iva o Codice esenzione
'a... |
{
'name': "Inactive Sessions Timeout",
'summary': """
This module disable all inactive sessions since a given delay""",
'author': "ACSONE SA/NV, "
"Dhinesh D, "
"Jesse Morgan, "
"LasLabs, "
"Odoo Community Association (OCA)",
'maintainer': ... |
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 = Elast... |
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 == r... |
__author__ = "Felix Brezo, Yaiza Rubio <contacto@i3visio.com>"
__version__ = "2.0"
from osrframework.utils.platforms import Platform
class Forocoches(Platform):
"""A <Platform> object for Forocoches"""
def __init__(self):
self.platformName = "Forocoches"
self.tags = ["opinions", "activism"]
... |
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_questio... |
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", 30)... |
params = {
'bitcoin_main': {
'pubkey_address': 50,
'script_address': 9,
'genesis_hash': '00000c7c73d8ce604178dae13f0fc6ec0be3275614366d44b1b4b5c6e238c60c'
},
'bitcoin_test': {
'pubkey_address': 88,
'script_address': 188,
'genesis_hash': '000003ae7f631de18a457f... |
from odoo import fields, models
class IntrastatTransaction(models.Model):
_name = "l10n_ro_intrastat.transaction"
_description = "Intrastat Transaction"
_rec_name = "description"
code = fields.Char("Code", required=True, readonly=True)
parent_id = fields.Many2one("l10n_ro_intrastat.transaction", "Pa... |
"""Post admins
Revision ID: 449914911f93
Revises: 2420dd9c9949
Create Date: 2013-12-03 23:03:02.404457
"""
revision = '449914911f93'
down_revision = '2420dd9c9949'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.create_table(
'jobpost_admin',
sa.Column('created_at', sa.DateTime(), n... |
"""
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
@ddt.ddt
... |
import logging
from datetime import datetime
from babel.dates import format_date
from odoo import api, models, fields, _
from odoo.exceptions import UserError
logger = logging.getLogger(__name__)
COMPASSION_QRR = "CH2430808007681434347"
class ContractGroup(models.Model):
_inherit = ["recurring.contract.group", "tra... |
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(cours... |
"""Carnaval Toolkit: SMB2+ message header packing and parsing.
Common classes, functions, etc., for packing and unpacking SMB2+ Headers.
This module deals with structures common to both the client and server.
CONSTANTS:
Protocol constants:
SMB2_MSG_PROTOCOL : \\xFESMB; SMB2 message prefix (protocol ID).
... |
'''
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:
ass... |
"""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_support,... |
from . import account_invoice
from . import account_invoice_refund |
"""
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 Fragme... |
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"),
] |
"""Views for evaluating functions on a SQLAlchemy model.
The main class in this module, :class:`FunctionAPI`, is a
:class:`~flask.MethodView` subclass that creates endpoints for fetching
the result of evaluating a SQL function on a SQLAlchemy model.
"""
from flask import json
from flask import request
from sqlalchemy.e... |
"""
TBW
"""
from __future__ import absolute_import
from __future__ import print_function
from lachesis.elements import Span
from lachesis.elements import Token
from lachesis.language import Language
from lachesis.nlpwrappers.base import BaseWrapper
from lachesis.nlpwrappers.upostags import UniversalPOSTags
class Patter... |
{
"name": "Causali pagamento per ritenute d'acconto",
"version": "10.0.1.0.0",
"development_status": "Beta",
"category": "Hidden",
"website": "https://github.com/OCA/l10n-italy",
"author": "Agile Business Group, Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False... |
import logging
import pdb
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 safestring
from exceptions import TeamAlreadyExistsError, TeamNoLongerExistsError, TeamF... |
"""
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 your option) any la... |
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.utils.functional import cached_property
from django.views.generic import TemplateView
from assessments.calendar.scores_exam_submission_calendar import ScoresExamSubmissionCalendar
from base.utils.cache import CacheFilterMixin
from ... |
"""A wait callback to allow psycopg2 cooperation with gevent.
Use `patch_psycopg()` to enable gevent support in Psycopg.
"""
from __future__ import absolute_import
import psycopg2
from psycopg2.extras import RealDictConnection
from psycopg2 import extensions
from gevent.coros import Semaphore
from gevent.local import l... |
{
"name": "LDAP groups assignment",
"version": "11.0.1.0.0",
"depends": ["auth_ldap"],
"author": "initOS GmbH, Therp BV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-tools",
"license": "AGPL-3",
"summary": "Adds user accounts to groups based on rules defined "... |
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
class Te... |
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.p... |
import ctypes
from flufl.enum import Enum
sizeof = ctypes.sizeof
Arg_type = Enum('Arg_type', [str(x.strip()) for x in '''
TYPE_NONE
TYPE_SCHAR
TYPE_UCHAR
TYPE_SHORT
TYPE_USHORT
TYPE_INT
TYPE_UINT
TYPE_LONGINT
TYPE_ULONGINT
TYPE_LONGLONGINT
TYPE_ULONGLONGINT
TYPE_DOUBLE
TYPE_LONGDOUBLE
TYPE_CHAR
TYPE_WIDE_CHAR
TYPE_STRI... |
"""
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', signal=... |
from __future__ import division, print_function
import os
import sys
try:
import termios
except ImportError:
pass # windows
from urwid.util import StoppingContext, int_scale
from urwid import signals
from urwid.compat import B, bytes3, xrange, with_metaclass
UNPRINTABLE_TRANS_TABLE = B("?") * 32 + bytes3(list(x... |
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):
self.stream.send(Presence())
def idle(self):
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.