code stringlengths 1 199k |
|---|
"""Askbot template context processor that makes some parameters
from the django settings, all parameters from the askbot livesettings
and the application available for the templates
"""
from django.conf import settings
import askbot
from askbot import api
from askbot.conf import settings as askbot_settings
from askbot.... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = r'''
---
module: openssl_certificate
version_added: "2.4"
short_description: Ge... |
__license__ = 'GPL 3'
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en'
'''
Transform OEB content into RB compatible markup.
'''
import re
from calibre import prepare_string_for_xml
from calibre.ebooks.rb import unique_name
TAGS = [
'b',
'big',
'blockquote',
... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('venue', '0005_auto_20170916_0701'),
]
operations = [
migrations.CreateModel(
name='EventCalander',
fields=[
('id'... |
import logging
from django.utils.html import format_html
import django_tables2 as tables
from django_tables2.rows import BoundPinnedRow, BoundRow
logger = logging.getLogger(__name__)
class MultiLinkColumn(tables.RelatedLinkColumn):
"""
Like RelatedLinkColumn but allows multiple choices of accessor to be
ren... |
from os import path
s1 = 'one seven three five one six two six six seven'
s2 = 'four zero two nine one eight five nine zero four'
s3 = 'one nine zero seven eight eight zero three two eight'
s4 = 'four nine one two one one eight five five one'
s5 = 'eight six three five four zero two one one two'
s6 = 'two three nine ze... |
import re
from calendar import monthrange
from datetime import date, datetime, timedelta
from hscommon.trans import tr
from hscommon.util import iterdaterange
ONE_DAY = timedelta(1)
class DateRange:
"""A range between two dates.
Much of the information supplied by moneyGuru is done so in a date range context. G... |
import sys
import os
import time
import serial
delay=0.001
def getserials():
s0 = serial.Serial("/dev/ttyUSB0")
s1 = serial.Serial("/dev/ttyUSB1")
return (s0,s1)
def test():
period=0.001
i = 0
s=serial.Serial("/dev/ttyUSB1")
while True:
s.setDTR(True)
#s.setRTS(True)
... |
from django.core.management import BaseCommand
from django.db.models import Count
from zds.notification.models import Subscription
class Command(BaseCommand):
help = "Delete all but last duplicate subscriptions"
def handle(self, *args, **options):
self.stdout.write("Starting uniquifying subscriptions")
... |
"""
module lien
***********
"""
import os, sys, subprocess
import wx
import re
from util_path import toFileEncoding, toSystemEncoding, SYSTEM_ENCODING
from widgets import messageErreur, scaleImage, Grammaire, img2str, str2img
import images
from drag_file import *
from util_path import *
from file2bmp import *
SSCALE = ... |
from ..base import BaseShortener
from ..exceptions import ShorteningErrorException
class Shortener(BaseShortener):
"""
TinyURL.com shortener implementation
Example:
>>> import pyshorteners
>>> s = pyshorteners.Shortener()
>>> s.tinyurl.short('http://www.google.com')
'http://t... |
import os
import re
import sys
import urllib
import generic
import datetime
import sickbeard
import exceptions
from lib import requests
from xml.sax.saxutils import escape
from sickbeard import db
from sickbeard import logger
from sickbeard import tvcache
from sickbeard.exceptions import ex
from sickbeard.common import... |
class Solution(object):
def twoSum(self, nums, target):
lookup = {}
for i, num in enumerate(nums):
if target - num in lookup:
return [lookup[target - num], i]
lookup[num] = i
return []
if __name__ == '__main__':
print Solution().twoSum((0, 2, 7, 11... |
import os
from UserDict import DictMixin
from fnmatch import fnmatch
from datetime import datetime
from datetime import date
import pytz
from pyramid.threadlocal import get_current_registry
from pyramid.traversal import resource_path
from sqlalchemy import Boolean
from sqlalchemy import Column
from sqlalchemy import Da... |
class Solution(object):
def findTilt(self, root):
"""
:type root: TreeNode
:rtype: int
"""
def dfs(root):
if not root:
return 0
left = dfs(root.left)
right = dfs(root.right)
diff[0] += abs(left - right)
... |
from PyQt4 import QtCore, QtGui
from gui.LrBase.main import *
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, t... |
from typing import TYPE_CHECKING, Optional
from .base import (
MATCH_TAB_OPTION, ArgsType, Boss, PayloadGetType, PayloadType, RCOptions,
RemoteCommand, ResponseType, Window
)
if TYPE_CHECKING:
from kitty.cli_stub import FocusTabRCOptions as CLIOptions
class FocusTab(RemoteCommand):
'''
match: The ta... |
CATKIN_PACKAGE_PREFIX = ""
PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else []
PROJECT_CATKIN_DEPENDS = "".replace(';', ' ')
PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else []
PROJECT_NAME = "commanding_velocity"
PROJECT_SPACE_DIR = "/home/computing/catkin_ws/install"
PROJECT_VERSION =... |
import pypm, sys, time
DEV_NAME = 'nanoPAD2 MIDI 1'
OUT_NAME = 'fs'
FIRST_NOTE = 24 + 4 # E, not C
SECOND_NOTE = FIRST_NOTE + 5
PADS1 = range(51, 35, -2)
PADS2 = range(50, 34, -2)
shorten_bools = lambda bool_list: ''.join(('0' if b else '.' for b in bool_list))
def find_device(name_):
for i in range(pypm.CountDevic... |
from gluon import current
import logging
class Utils(object):
"""
Esta clase provee funciones para el manejo de la sesión, validaciones
y para exportar los datos en formato PDF.
Args:
db: La base de datos.
"""
def __init__(self, db):
self.db = db
def resetSession(self):
... |
import numpy as np
import astropy.units as u
from .utils import norm_vector, e2h
__all__ = ['polarization_vectors', 'Q_reflection', 'paralleltransport_matrix',
'parallel_transport']
def polarization_vectors(dir_array, angles):
'''Converts polarization angles to vectors in the direction of polarization.
... |
from __future__ import division, print_function
import unittest
from ..core import *
class TestTime(unittest.TestCase):
def setUp(self):
self.t1 = Time(1.0)
self.t2 = Time(1.1)
self.t3 = Time(1.01)
self.t4 = Time(1.001)
self.t5 = Time(1.00001)
def test_equals(self):
... |
from __future__ import unicode_literals
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bot', '0013_auto_20171109_1759'),
]
operations = [
migrations.AlterField(
model_name='alertausuario',
name='chat_... |
class RouterModelBase:
def login(self, user, passw):
raise NotImplementedError
def logout(self):
raise NotImplementedError
def guess(self):
raise NotImplementedError
def getClientsList(self):
raise NotImplementedError
def forwardPort(self):
raise NotImplemente... |
"""
Backends are a way to permanently store a project on a medium
(like on the hard disk or on the internet)
and to read projects from this medium
"""
import sys
import uuid
import os.path
from GTG.tools.logger import Log
from GTG.tools.borg import Borg
from GTG.backends.genericbackend import GenericBackend
from GTG.co... |
"""
This file is used to make a crawl
"""
import __init__
import os
import re
import urllib
from utility import prgbar
def get_html(url):
"""Get the html """
page = urllib.urlopen(url)
html = page.read()
return html
def get_pdf(html):
""" xxx"""
reg = r'href="(.+?\.pdf)">pdf'
pdfre = re.comp... |
from osgeo import gdal
import numpy as np
from time import clock
import pygeonet_defaults as defaults
import pygeonet_prepare as Parameters
from math import modf, floor
def read_dem_from_geotiff(demFileName,demFilePath):
# Open the GeoTIFF format DEM
fullFilePath = demFilePath + demFileName
#fullFilePath = ... |
from splinter.driver.webdriver.firefox import WebDriver as FirefoxWebDriver
from splinter.driver.webdriver.remote import WebDriver as RemoteWebDriver
from splinter.driver.webdriver.chrome import WebDriver as ChromeWebDriver
from splinter.driver.webdriver.phantomjs import WebDriver as PhantomJSWebDriver
from splinter.ex... |
from setuptools import setup#, find_packages, Extension
import distutils.command.build as _build
import setuptools.command.install as _install
import sys
import os
import os.path as op
import distutils.spawn as ds
import distutils.dir_util as dd
import posixpath
def run_cmake(arg=""):
"""
Forcing to run cmake
... |
import os
import time
import hashlib
import logging
from subprocess import Popen, PIPE
from deluge.plugins.pluginbase import CorePluginBase
import deluge.component as component
from deluge.configmanager import ConfigManager
from deluge.core.rpcserver import export
from deluge.event import DelugeEvent
log = logging.getL... |
'''
Created on Oct 29, 2015
@author: yangke
'''
from model.TaintVar import TaintVar
from TraceTrackTest import TraceTrackTest
class Test_objdump_addr:
def test(self):
passed_message="BINUTILS-2.23 'addr[1]' TEST PASSED!"
not_pass_message="ERRORS FOUND IN BINUTILS-2.23 'addr[1]' TEST!"
answer... |
import traceback
from flask_babel import lazy_gettext
from mycodo.config import SQL_DATABASE_MYCODO
from mycodo.databases.models import Conversion
from mycodo.databases.models import DeviceMeasurements
from mycodo.databases.utils import session_scope
from mycodo.inputs.base_input import AbstractInput
from mycodo.inputs... |
//codecademy course answer
eggs = 10 ** 2
print eggs |
import sys
from core import loop
from util import jsonmanager, debug
def make_console_menu(name):
menu_data_file_path = '_Resources/Data/MenuData/'
path = menu_data_file_path + name + '.json'
data = jsonmanager.get_data(path)
title = data['Title']
item_data = data['Items']
args = []
for item... |
import sys
from lxml import html
import urllib3
import re
http = urllib3.PoolManager()
baseUrl = 'http://scoreboard.uscyberpatriot.org/'
scoresPage = html.fromstring(http.request('GET', baseUrl + 'team.php?team=' + sys.argv[1]).data)
chart = scoresPage.xpath('/html/body/div[2]/div/script[1]')[0]
scoreTimes = re.compile... |
from buildpal_client import compile as buildpal_compile
import os
import subprocess
import asyncio
import sys
import struct
import threading
import pytest
from buildpal.common import MessageProtocol
class ProtocolTester(MessageProtocol):
@classmethod
def check_exit_code(cls, code):
if hasattr(cls, 'expe... |
from __future__ import unicode_literals
from django.conf import settings
import django.core.files.storage
from django.db import migrations, models
import django.db.migrations.operations.special
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
replaces = [
... |
""" Setup file.
"""
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.rst')) as f:
README = f.read()
requires = ['cornice', 'metlog-py', 'mozsvc', 'PasteScript', 'waitress', 'PyBrowserID', 'Requests', 'webtest']
setup(name='f... |
from __future__ import division, absolute_import, print_function, unicode_literals
import OpenSSL
import uuid
import random
import os
import json
import subprocess
import sys
sha256 = 'sha256'
if sys.version_info[:1] == (2,):
input = raw_input
sha256 = b'sha256'
def create_ca(size=2048, valid=315360000, CN=None... |
import pytest
import math as m
import numpy as np
from sisl import Spin
pytestmark = [pytest.mark.physics, pytest.mark.spin]
def test_spin1():
for val in ['unpolarized', '', Spin.UNPOLARIZED,
'polarized', 'p', Spin.POLARIZED,
'non-collinear', 'nc', Spin.NONCOLINEAR,
'... |
"""
Rudimentary system stats collection using ``psutil``.
"""
import time
from switchy import event_callback, utils
def sys_stats(df):
"""Reindex on the call index to allign with call metrics data
and interpolate.
"""
df.index = df.call_index
ci = df.pop('call_index')
# iterpolate all system sta... |
{
'name': 'Account Multicompany Usability',
'version': '8.0.1.2.0',
'author': 'ADHOC SA',
'website': 'www.adhoc.com.ar',
'license': 'AGPL-3',
'depends': [
'account',
],
'data': [
'views/res_company_property_view.xml',
'views/res_company_view.xml',
'views/r... |
import wizard
import account_inv |
"""Tests of Branding API """
from __future__ import absolute_import, unicode_literals
import mock
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from django.urls import reverse
from branding.api import _footer_business_links, get_footer, get_home_url, g... |
"""
The patient visit module
========================
Implements the classes:
* Visit: Main visit module
* ConsultingRoom: Consultings room module
"""
from openerp.osv import osv, fields
class Visit(osv.osv):
"""
The visit module
"""
_name = 'visit'
_description = 'The visit module'
_states = [
... |
import sys
for m in range(0, 2):
n = raw_input()
for i in range(0, int(n)):
print "\x11" + str(m) + ": " + raw_input() + "\x11"
#sys.stdout.flush() |
import StringIO
import csv
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
from xml.dom import minidom
import configdb
def prettify(elem):
"""Return a pretty-printed XML string for the Element.
"""
rough_string = tostring(elem, 'utf-8')
reparsed = minidom.parseString(rough_strin... |
import ckanext.deadoralive.config as config
import ckanext.deadoralive.tests.helpers as custom_helpers
class TestConfig(custom_helpers.FunctionalTestBaseClass):
def test_that_it_reads_settings_from_config_file(self):
"""Test that non-default config settings in the config file work."""
# These non-de... |
import datetime
import decimal
from django.test import TestCase
from django.core.cache import cache
from httmock import HTTMock
from django_dynamic_fixture import G, N
from postnl_checkout.contrib.django_postnl_checkout.models import Order
from .base import PostNLTestMixin
class OrderTests(PostNLTestMixin, TestCase):
... |
from django.conf.urls import url
from ..views import (PowerCycleListView, PowerCycleCreateView, PowerCycleDetailView,
PowerCycleUpdateView, PowerCycleDeleteView)
from django.contrib.auth.decorators import login_required
urlpatterns = [
url(r'^create/$', # NOQA
login_required(PowerCycle... |
from PokeAlarm.Utils import get_gmaps_link, get_applemaps_link, \
get_waze_link, get_dist_as_str, get_team_emoji, get_ex_eligible_emoji
from . import BaseEvent
from PokeAlarm import Unknown
class GymEvent(BaseEvent):
""" Event representing the change occurred in a Gym. """
def __init__(self, data):
... |
from datetime import datetime
import werkzeug
from dateutil.relativedelta import relativedelta
from odoo import http, _, fields
from odoo.addons.http_routing.models.ir_http import slug
from odoo.addons.website.models.ir_http import sitemap_qs2dom
from odoo.http import request
from odoo.addons.cms_form.controllers.main ... |
"""
Script to process pytest warnings output by pytest-json-report plugin and output it as a html
"""
import argparse
import io
import itertools
import json
import os
import re
from collections import Counter
from write_to_html import (
HtmlOutlineWriter,
) # noqa pylint: disable=import-error,useless-suppression
c... |
def make_diff(first: dict, second: dict, not_found_value=None,
excluded_keys: tuple = ()) -> dict:
"""
Compute a diff between two dicts.
"""
diff = {}
# Check all keys in first dict
for key in first:
if key not in second:
diff[key] = (first[key], not_found_value... |
"""
Copyright 2015 Telefonica Investigacion y Desarrollo, S.A.U
This file is part of Orion Context Broker.
Orion Context Broker 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
... |
"""
Python APIs exposed by the bulk_email app to other in-process apps.
"""
from __future__ import absolute_import
from bulk_email.models_api import (
is_bulk_email_enabled_for_course,
is_bulk_email_feature_enabled,
is_user_opted_out_for_course
)
def get_emails_enabled(user, course_id):
"""
Get whet... |
from flask import Flask
__version__ = '0.1.1'
app = Flask(__name__)
app.config.from_object('frijoles.default_settings')
app.config.from_envvar('FRIJOLES_SETTINGS', silent=True)
import frijoles.views |
import contextlib
import os
import shutil
import sys
import wave
def normalize():
""" Normalizes a set of sound files to norm-To dB
return -->> 1
"""
# Get the names of the files in sortFolder.
files = os.listdir(folderToSort)
# Make a directory for the renamed sorted files:
dirname = folderToSort + 'normalized... |
''' -- imports from python libraries -- '''
import datetime
import json
''' -- imports from installed packages -- '''
from django.http import HttpResponseRedirect # , HttpResponse uncomment when to use
from django.http import HttpResponse
from django.http import Http404
from django.shortcuts import render_to_response ... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('search', '0008_auto_20151117_1526'),
]
operations = [
migrations.AlterField(
model_name='docket',
name='slug',
field=... |
"""
Answers with an Error message to a previous Error message.
"""
import copy
import random
from src import Msg
from src import SomeIPPacket
from src.attacks import AttackerHelper
def sendErrorOnError(a, msgOrig):
""" Attack Specific Function. """
sender = msgOrig.receiver
receiver = msgOrig.sender
tim... |
{
"name": "Partner Contact Department",
"summary": "Assign contacts to departments",
"version": "14.0.1.0.1",
"category": "Customer Relationship Management",
"author": "Tecnativa, Odoo Community Association (OCA)",
"license": "AGPL-3",
"website": "https://github.com/OCA/partner-contact",
... |
from .common import *
INTERNAL_IPS = ['127.0.0.1', ]
CORS_ORIGIN_WHITELIST = (
'localhost:8000',
)
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
}
}
Q_CLUSTER = {
'name': 'DjangORM',
'workers': 2,
'timeout': 90,
'retry': 120,
'queue_limit': 50,... |
"""Tests covering utilities for integrating with the catalog service."""
from __future__ import absolute_import
from collections import defaultdict
from datetime import timedelta
import mock
import six
from django.contrib.auth import get_user_model
from django.core.cache import cache
from django.test import TestCase, o... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("uk_results", "0022_postresult_confirmed_resultset")]
operations = [
migrations.AlterModelOptions(
name="candidateresult",
options={"ordering": ("-num_ballots_reported",)},
)
] |
"""
Code to manage fetching and storing the metadata of IdPs.
"""
from celery.task import task # pylint: disable=import-error,no-name-in-module
import datetime
import dateutil.parser
import logging
from lxml import etree
import requests
from onelogin.saml2.utils import OneLogin_Saml2_Utils
from third_party_auth.models... |
from tests.api import auth_for
from tests.data import add_fixtures, clubs, users
def test_lva(db_session, client):
lva = clubs.lva(owner=users.john())
add_fixtures(db_session, lva)
res = client.get("/clubs/{id}".format(id=lva.id))
assert res.status_code == 200
assert res.json == {
"id": lva.... |
import os
import shutil
import boto
from boto.s3.key import Key
import subprocess
from io import StringIO
from django.core.management.base import BaseCommand
from django.core.management import call_command
from django.conf import settings
from django.utils import timezone
from django.core.mail import send_mail
from cor... |
__author__ = "Nick Wong"
"""
用asyncio提供的@asyncio.coroutine可以把一个generator标记为coroutine类型,然后在coroutine内部用yield from调用另一个coroutine实现异步操作
从Python 3.5开始引入了新的语法async和await,可以让coroutine的代码更简洁易读
async和await是针对coroutine的新语法,要使用新的语法,只需要做两步简单的替换:
1.把@asyncio.coroutine替换为async;
2.把yield from替换为await。
"""
import asyncio
@asyncio.cor... |
import numpy as np
import pandas as pd
import xarray as xr
from tikon.central import Módulo, SimulMódulo, Modelo, Exper, Parcela
from tikon.central.res import Resultado
from tikon.datos import Obs
from tikon.utils import EJE_TIEMPO, EJE_PARC
f_inic = '2000-01-01'
crds = {'eje 1': ['a', 'b'], 'eje 2': ['x', 'y', 'z']}
c... |
import logging
import tmlib.models as tm
class SubmissionManager(object):
'''Mixin class for submission and monitoring of computational tasks.'''
def __init__(self, experiment_id, program_name):
'''
Parameters
----------
experiment_id: int
ID of the processed experime... |
from __future__ import absolute_import
from __future__ import division
import os, traceback, math, re, zlib, base64, time, sys, platform, glob, string, stat
import cPickle as pickle
if sys.version_info[0] < 3:
import ConfigParser
else:
import configparser as ConfigParser
from Cura.util import resources
from Cura.util... |
from django.conf import settings
from rest_framework import serializers
from base.models.enums.summary_status import SummaryStatus
from base.models.learning_unit_year import LearningUnitYear
from learning_unit.api.serializers.campus import LearningUnitCampusSerializer
from learning_unit.api.serializers.component import... |
from IPython import embed
import annotateit
from annotateit import model, db, es
from flask import g
def main():
app = annotateit.create_app()
with app.test_request_context():
g.user = model.User.fetch('admin')
embed(display_banner=False)
if __name__ == '__main__':
main() |
from django.conf import settings
from rest_framework import viewsets
from rest_framework.response import Response
import snotes20.models as models
class EditorViewSet(viewsets.ViewSet):
def list(self, request):
return Response([
{
'short': short,
'long': long,
... |
from .AugmentedWeapon import AugmentedWeapon
from .Cloaked import Cloaked
from .Ethereal import Ethereal
from .Muted import Muted
from .TemporaryIllumination import TemporaryIllumination
from .Undead import Undead
from .HealthDrain import HealthDrain
__all__ = [
"AugmentedWeapon",
"Cloaked",
"Ethereal",
... |
__author__ = "Daniel Arroyo <daniel@astroprint.com>"
__license__ = 'GNU Affero General Public License http://www.gnu.org/licenses/agpl.html'
import logging
import threading
import time
import os
from octoprint.server import eventManager
from octoprint.events import Events
from octoprint.settings import settings
from as... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
import politube.views
urlpatterns = patterns('',
url(r'^$', politube.views.home, name='home'),
url(r'^about/', politube.views.about, name='about'),
url(r'^plenary/', include('plenary.urls')),
url(r'... |
from odoo.exceptions import ValidationError
from odoo.addons.analytic_tag_dimension.tests.test_analytic_dimension import (
TestAnalyticDimensionBase,
)
class TestAnalyticDimensionCase(TestAnalyticDimensionBase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.account_obj = cls.env... |
"""Ingest workflow management tool
FileNameSource Class
"""
__copyright__ = "Copyright (C) 2016 University of Maryland"
__license__ = "GNU AFFERO GENERAL PUBLIC LICENSE, Version 3"
import abc
import os
import sys
import psycopg2
class FileNameSource:
def __init__(self): pass
def __iter__(self): return sel... |
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):
# Changing field 'Region.region_code'
db.alter_column('region', 'region_code', self.gf('django.db.mo... |
from itertools import repeat, chain
from operator import itemgetter
from django.db.models import Count, Sum, Case, When, IntegerField, Value, FloatField
from django.db.models.expressions import CombinedExpression
from django.http import JsonResponse
from django.shortcuts import render
from django.utils.translation impo... |
from django.conf import settings
from django.core.urlresolvers import is_valid_path
from django.http import HttpResponseRedirect
from django.utils.cache import patch_vary_headers
from django.utils import translation
from django.middleware.locale import LocaleMiddleware
from corsheaders.middleware import CorsMiddleware
... |
from odoo import fields, models
class ResUsers(models.Model):
_inherit = 'res.users'
has_group_warning_account = fields.Boolean(
'A warning can be set on a partner (Account)', compute='_compute_groups_id', inverse='_inverse_groups_id',
group_xml_id='account.group_warning_account')
has_group_... |
import argparse
import ConfigParser
import logging
import socket
import sys
import time
import threading
import json
import os
import imp
if os.path.dirname(os.path.realpath(__file__)) == os.getcwd():
imp.load_module('electrumcreditbitserver', *imp.find_module('src'))
from electrumcreditbitserver import storage, ne... |
"""
Test cases to cover Accounts-related serializers of the User API application
"""
import logging
from django.test import TestCase
from django.test.client import RequestFactory
from testfixtures import LogCapture
from openedx.core.djangoapps.user_api.accounts.serializers import UserReadOnlySerializer
from common.djan... |
import contextlib
import warnings
from _decimal import Decimal
from typing import Optional, List
from django.db import IntegrityError
from django.db.models import F, Case, When, IntegerField, QuerySet, Max, OuterRef, Subquery
from django.db.models import Q
from base.models.academic_year import AcademicYear
from base.mo... |
{
"name": "New Assignment Career Transition "
"Integration With Timesheet Computation",
"version": "8.0.1.0.0",
"category": "Human Resource",
"website": "https://simetri-sinergi.id",
"author": "OpenSynergy Indonesia, PT. Simetri Sinergi Indonesia",
"license": "AGPL-3",
"installable": Tru... |
from django.db.models import Q
from tastypie import fields
from tastypie.constants import ALL
from tastypie.resources import ModelResource
from tastypie.serializers import Serializer
from iati.models import Activity
from api.v3.resources.helper_resources import TitleResource, DescriptionResource, FinanceTypeResource
fr... |
import wx
import os
from model.Nessus import NessusFile, NessusTreeItem, MergedNessusReport, NessusReport, NessusItem
import difflib
from drop_target import MyFileDropTarget
from view import (
ViewerView,
SaveDialog,
ID_Load_Files,
ID_Merge_Files,
ID_Generate_CSV,
ID_Gene... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('edxval', '0001_squashed_0016_add_transcript_credentials_model'),
]
operations = [
migrations.AddField(
model_name='video',
name='error_description',
field=mo... |
from aqt import mw
from aqt.utils import showInfo
from aqt.qt import *
from anki.exporting import *
from anki.hooks import addHook
class LatexNoteExporter(Exporter):
key = _("Notes in Latex")
ext = ".tex"
def __init__(self, col):
Exporter.__init__(self, col)
self.includeID = True
sel... |
"""
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.
"""
from django.test import TestCase
from models import Place
class SimpleTest(TestCase):
def test_simple_place_creation(self):
""... |
""" Users API URI specification """
from django.conf import settings
from django.conf.urls import url
from django.db import transaction
from edx_solutions_api_integration.users import views as users_views
from rest_framework.urlpatterns import format_suffix_patterns
COURSE_ID_PATTERN = settings.COURSE_ID_PATTERN
urlpat... |
from openerp import models, fields, api
from datetime import *
class clv_medicament_template_history(models.Model):
_name = 'clv_medicament.template.history'
medicament_template_id = fields.Many2one('clv_medicament.template', 'Medicament Template', required=True)
user_id = fields.Many2one ('res.users', 'Use... |
from django import forms
from django.utils.html import escape
from django.forms.utils import ErrorList
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from booktype.utils.misc import booktype_slugify
from booki.editor.models import BookiGroup
from booktype.util... |
from spack import *
class Bml(CMakePackage):
"""The basic matrix library (bml) is a collection of various matrix data
formats (in dense and sparse) and their associated algorithms for basic
matrix operations."""
homepage = "http://lanl.github.io/bml/"
url = "https://github.com/lanl/bml/tarball/... |
"""
L{HostKeys}
"""
import base64
import binascii
from Crypto.Hash import SHA, HMAC
try:
import UserDict
import DictMixin
except:
from collections import UserDict
#from collections import MutableMapping as DictMixin
from collections import Mapping as DictMixin
from paramiko.common import *
from para... |
"""
Tests outgoing calls created with InitialAudio and/or InitialVideo, and
exposing the initial contents of incoming calls as values of InitialAudio and
InitialVideo
"""
import operator
from servicetest import (
assertContains, assertEquals, assertLength,
wrap_channel, EventPattern, call_async, make_channel_pr... |
"Conferencing code"
from shtoom.doug.source import Source
from twisted.internet.task import LoopingCall
from twisted.python import log
from sets import Set
class ConferenceError(Exception): pass
class ConferenceClosedError(ConferenceError): pass
class ConferenceMemberNotFoundError(ConferenceError): pass
CONFDEBUG = Tru... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.