code stringlengths 1 199k |
|---|
from scap.Model import Model
import logging
logger = logging.getLogger(__name__)
class PostalServiceElementsType(Model):
MODEL_MAP = {
'tag_name': 'PostalServiceElements',
'elements': [
{'tag_name': 'AddressIdentifier', 'list': 'address_identifiers', 'class': 'AddressIdentifierType'},
... |
IMAP_HOST = "imap.pomona.edu"
IMAP_PORT = 993
SMTP_HOST = "smtp.pomona.edu"
SMTP_PORT = 587
NAME = "CS Coursebot"
MYADDR = "cs_coursebot@pomona.edu"
IMAP_USERNAME = "CSCourseBot"
SMTP_USERNAME = "CSCourseBot"
PASSWORD = None # input by user
INTERVAL = 5
TEMP_AUTH_INTERVAL = 60 * 30
DATABASE = "academibot.db"
SUBMISSION... |
from Qt import QtWidgets as QtGui
from Qt import QtCore
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, text, d... |
from django.db import models
from polymorphic import PolymorphicModel
import datetime
from django.core.urlresolvers import reverse
class Experiment(PolymorphicModel):
# shortName=models.CharField(max_length=50)
date=models.DateField('Date; if in doubt, end date',default=datetime.date.today())
note=models.TextField()... |
import argparse
import base64
import fileinput
import os
import re
import sys
import zlib
files = [
'{{languageCode}}.prob',
'apertium-{{languageCode}}.{{languageCode}}.lexc',
'apertium-{{languageCode}}.{{languageCode}}.lexd',
'apertium-{{languageCode}}.{{languageCode}}.twol',
'apertium-{{languageCo... |
FILENAME = ""
AUTHOR = ""
PREPEND = ""
XMLINDENT = 4
FLOATPRE = 5
ANIMFPS = 25.0
EXPORTGL = False
LOD = False
EXTRADATA = False
SUBMESHMODE = "group" # "group" (one submesh per group) or "object" (one submesh per object)
SCALE = 1.0 |
import base, random
import entity.monster.monsters as m
import entity.status.monster_statuses as status
import entity.status.player_statuses as p_status
import entity.monster.monster_modification as mods
import math
class ChemicalOgre(m.Monster):
def __init__(self,level):
super(ChemicalOgre,self).__init__(l... |
"""
plugin.audio.addict
Unofficial addon for the AudioAddict network of radio streams.
"""
import urlparse
import sys
import os
TOPDIR = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, os.path.join(TOPDIR, 'resources', 'lib'))
import audioaddict # pylint: disable=wrong-import-position
def parse_a... |
HOST = "ip-172-31-29-102.us-west-2.compute.internal:27017,ip-172-31-29-103.us-west-2.compute.internal:27017,ip-172-31-29-104.us-west-2.compute.internal:27017,ip-172-31-29-105.us-west-2.compute.internal:27017,ip-172-31-29-101.us-west-2.compute.internal:27017,ip-172-31-29-106.us-west-2.compute.internal:27017,ip-172-31-29... |
import cvxpy
from cvxpy.atoms.affine.add_expr import AddExpression
import cvxpy.error as error
import cvxpy.reductions.dgp2dcp.atom_canonicalizers as dgp_atom_canon
from cvxpy.reductions import solution
from cvxpy.settings import SOLVER_ERROR
from cvxpy.tests.base_test import BaseTest
import numpy as np
SOLVER = cvxpy.... |
import unittest
from unittest.mock import patch
import numpy as np
import pandas as pd
from tmc import points
from tmc.utils import load, get_out, patch_helper
module_name="src.special_missing_values"
special_missing_values = load(module_name, "special_missing_values")
main = load(module_name, "main")
ph = patch_helper... |
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL)... |
import logging
class AppFilter(logging.Filter):
def filter(self, record):
states = {
logging.CRITICAL : 2,
logging.ERROR : 3,
logging.WARNING : 4,
logging.INFO : 6,
logging.DEBUG : 7
}
record.severity = states[record.levelno]
... |
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.feature_selection import SelectPercentile, f_classif, chi2
import numpy as np
import pandas as pd
class UnivCombineFilter(BaseEstimator, TransformerMixin):
def __init__(self, catCols = None, columns = None, percentile = None):
self.ixCols... |
from PyQt5.QtXmlPatterns import (
QAbstractMessageHandler,
QAbstractUriResolver,
QAbstractXmlNodeModel,
QAbstractXmlReceiver,
QSimpleXmlNodeModel,
QSourceLocation,
QXmlFormatter,
QXmlItem,
QXmlName,
QXmlNamePool,
QXmlNodeModelIndex,
QXmlQuery,
QXmlResultItems,
QXm... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'Guillaume Smaha'}
DOCUMENTATION = '''
---
filter: gluu_ssha_user_password
author: "Guillaume Smaha"
short_description: Filter to hash password with salt (SSHA in ldap)
description:
Filter to en... |
import configparser
import os.path
import string
import sys
import time
import subprocess
VERBOSE=True
MYPATH = os.path.dirname(sys.argv[0])
MYPATH_ABS = os.path.abspath(MYPATH)
LOCKFILE=''
DO_REMOVE_LOCK=False
def dbgPrint(str):
if (VERBOSE):
print('# ' + str)
def getRemoteGitBranches(git_uri):
OUT=sub... |
import getopt, sys, os
from PIL import Image
class Argument:
def __init__(self):
self.v = 0
self.D = ""
self.t = '*'
self.f = ""
self.c = "black"
self.debug = 0
def usage():
print """
Usage: python imgstitch.py [OPTION]... [FILENAME] [FILES]
Combine together [FILES] into one image
Example: ... |
from linux import LinuxBase
class Fedora(LinuxBase):
def __init__(self, version, arch):
super().__init__('fedora', 'fedora', version, arch, ['libusb', 'opencv']) |
import sys
import os
import warnings
warnings.filterwarnings("ignore", "apt API not stable yet", FutureWarning)
import apt
import apt_pkg
import logging
logging.basicConfig(level=logging.DEBUG,
filename="/var/log/dist-upgrade/apt-autoinst-fixup.log",
format='%(asctime)s %(levelna... |
from enum import Enum as _Enum
class Role(_Enum):
_enum_lookup = {
0:'ROLE_INVALID',
1:'ROLE_ACCELERATOR_LABEL',
2:'ROLE_ALERT',
3:'ROLE_ANIMATION',
4:'ROLE_ARROW',
5:'ROLE_CALENDAR',
6:'ROLE_CANVAS',... |
import logging
from typing import Optional
from numpy import unravel_index
from pytripgui.canvas_vc.objects.ctx import Ctx
from pytripgui.canvas_vc.objects.dos import Dos
from pytripgui.canvas_vc.objects.let import Let
from pytripgui.canvas_vc.objects.vdx import Vdx
from pytripgui.canvas_vc.projection_selector import P... |
import unittest
import ossie.utils.testing
import os
from omniORB import any
class ComponentTests(ossie.utils.testing.ScaComponentTestCase):
"""Test for all component implementations in skiphead_ii"""
def testScaBasicBehavior(self):
#######################################################################... |
import json
import logging
import tornado.web
from tornado.escape import utf8
from tornado.options import options
from base import BaseHandler, AuthenticatedHandler, authenticated_user
from ..utils import *
from ..domain import BaseError, NotLoggedInError, Category, Activity, Color, ActivityDict, TimeSheet, Quarter, Co... |
import pandas as pd
import matplotlib.pyplot as plt
from mplstyle.enfo import PLTenfo
def read_data(name):
df = pd.read_csv(name).set_index('jahr')
return df
def plot_fig(df, title):
fig, (ax0, ax1) = plt.subplots(2, 1, figsize=[11, 8],
gridspec_kw={'height_ratios': [1, 0.... |
from core.config.configReader import ConfigReader
class GenerateHtml:
"""This class will generate index.html based on index.html.template and the active renderer plugin."""
def getPluginFile(self, filelocation):
"""Get the file where the scripts for the current active renderer plugin live."""
wi... |
import cvxpy as cvx
import numpy as np
'''
Input parameters
G: matrix of path gains from transmitters to receivers
P_max: Maximum power that can be transmitted
P_received: Maximum power that can be received
sigma: Noise at each receiver
Group: Power supply groups the transmitters belong to
Group_max: The ma... |
from urlparse import urlparse
import json
import re
from requests import HTTPError
import time
import traceback
import xml.etree.ElementTree as XMLTree
try:
from xml.etree.ElementTree import ParseError as XmlParseError
except ImportError:
from xml.parsers.expat import ExpatError as XmlParseError
from couchpotat... |
import numpy as np
import scipy.sparse as sps
import scipy.sparse.linalg as spsla
import time
import logging
import sadptprj_riclyap_adi.lin_alg_utils as lau
__all__ = ['cnab',
'sbdftwo',
'nse_include_lnrcntrllr'
]
def cnab(trange=None, inivel=None, inip=None, bcs_ini=[],
M=Non... |
import sys
import moduloinicio
def tours():
print("\t\t\tTours(Decameron Explore)")
print()
print("-Santuario Nacional Manglares de Tumbes")
print("\tAdulto-->98USD Niño-->98USD")
print()
print("-Manglares de Puerto Pizarro.")
print("\tAdulto-->68USD Niño-->68USD")
print()
print("-Pesca de Altura")
... |
"""
This is the actual client code. Actual GUI classes are in the separate modules
"""
import os
import threading
import time
from collections import deque
from pynicotine import slskmessages
from pynicotine import slskproto
from pynicotine import transfers
from pynicotine.config import config
from pynicotine.geoip.geo... |
print ("")
myvalue = 3
def iteratinghere(fromvalue):
for number in range(fromvalue):
yield number ** 2
myvar = iteratinghere(myvalue)
print (myvar.next())
print (myvar.next())
print (myvar.next())
print ("")
for mynumber in iteratinghere(10):
print ("My value is: " + str(mynumber))
print ("")
def anothe... |
from __future__ import print_function
import re, sys, time
from itertools import count
from collections import OrderedDict, namedtuple
from MiniMax.minimax import *
import pc
import os
import time
from lockfile import LockFile
TABLE_SIZE = 1e8
MATE_LOWER = 60000 - 8*2700
MATE_UPPER = 60000 + 8*2700
QS_LIMIT = 150
EVAL_... |
import mock
import random
from buildbot import config
from buildbot.process import builder
from buildbot.process import factory
from buildbot.test.fake import fakedb
from buildbot.test.fake import fakemaster
from buildbot.util import epoch2datetime
from twisted.internet import defer
from twisted.trial import unittest
c... |
from PyQt4 import QtCore, QtGui
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, text, disambig, _encoding)
exce... |
"""DAL for dictionary-based database of products."""
from numina.core import import_object
from numina.core import fully_qualified_name
from numina.core import obsres_from_dict
from numina.core.pipeline import DrpSystem
from numina.store import load
from numina.exceptions import NoResultFound
from .absdal import AbsDAL... |
"""
conference.py -- Udacity conference server-side Python App Engine API;
uses Google Cloud Endpoints
$Id: conference.py,v 1.25 2014/05/24 23:42:19 wesc Exp wesc $
created by wesc on 2014 apr 21
"""
__author__ = 'wesc+api@google.com (Wesley Chun)'
from datetime import datetime
import json
import os
import time
imp... |
import bpy
from bpy.props import *
from .. utils.recursion import noRecursion
from .. operators.callbacks import newSocketCallback
from .. events import treeChanged, executionCodeChanged
from .. utils.names import getRandomString, toVariableName
from .. operators.dynamic_operators import getInvokeFunctionOperator
from ... |
import os
import unittest
from memacs.gpx import GPX
class TestGPX(unittest.TestCase):
def test_google(self):
sample = os.path.join(
os.path.dirname(os.path.abspath(__file__)), 'data', 'sample.gpx'
)
argv = []
argv.append('-f')
argv.append(sample)
memacs =... |
""" Defines Bravais Lattices. """
__docformat__ = "restructuredtext en"
__all__ = ['bcc', 'fcc']
def bcc():
""" Creates a BCC lattice with a single site. """
from pylada.crystal import Structure
return Structure(-0.5, 0.5, 0.5,
0.5, -0.5, 0.5,
0.5, 0.5, -0.5,
... |
from django.db import models
from .common_info import CommonInfo
class UnitType(CommonInfo):
"""
A controlled vocabulary for units of measure.
"""
title = models.CharField("Unit Type", max_length=50)
description = models.TextField("Unit Type", blank=True)
def __str__(self):
return self.t... |
import kplugs
try:
kernel_func = r'''
def hello_world(string):
buffer(string, 0x100)
print "%s" % string
'''
plug = kplugs.Plug(ip='127.0.0.1')
hello_world = plug.compile(kernel_func)[0]
hello_world("Hello World!")
finally:
kplugs.release_kplugs() |
from paraview.simple import *
from paraview import servermanager
import time
print "Process started"
errors = 0
def getHost(url):
return url.split(':')[1][2:]
def getScheme(url):
return url.split(':')[0]
def getPort(url):
return int(url.split(':')[2])
import os
def findInSubdirectory(filename, subdirectory='')... |
import os
import numpy as numpy
from mathematical import *
assert(8192 == exponent(2, 13))
assert(268435456 == exponent(4, 14))
assert(1 == exponent(10, 0))
assert(8192 == exponent_nonr(2, 13))
assert(268435456 == exponent_nonr(4, 14))
assert(1 == exponent_nonr(10, 0))
assert(950 == exponent_mod(3, 7, 1237))
m = numpy.... |
ANSIBLE_METADATA = {'metadata_version': '1.0',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: timezone
short_description: Configure timezone setting
description:
- This module configures the timezone setting, both of the system clock and of ... |
import socket,os,sys,xmpp,time
import ConfigParser
from pwd import getpwnam
from config_parser import ReadParameters
parameters = ReadParameters("server.conf")
uid=getpwnam(parameters['process_user']).pw_uid
os.setuid(uid)
s=socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
try:
os.remove(parameters['socket_path'])... |
'''
HyPnOt - a small python blog CMS using flat files instead of a table-based DB.
Runs under Apache mod_wsgi (https://code.google.com/p/modwsgi/)
Edit config.py. You do not have to change anything here.
Complaints: @modalexii (<- is not a programmer and is amazed that this works at all)
'''
if __name__ == '__main__':
... |
import re
import nltk
from scenes import classify
from ucca import layer0, layer1
def get_terminals_labels(passages):
terminals = []
labels = []
for passage in passages:
l0 = passage.layer(layer0.LAYER_ID)
l1 = passage.layer(layer1.LAYER_ID)
heads = [x for x in l1.all
... |
from . import vocabulary_questions
class sub_object(vocabulary_questions.structure):
def __init__(self, build_data, **options):
MULTIPLE_QUESTIONS = {2: _('What is the double of {nb2}?'),
3: _('What is the triple of {nb2}?'),
4: _('What is the quad... |
"""
Module implementing the debug base class.
"""
import sys
import bdb
import os
import types
import atexit
import inspect
from DebugProtocol import ResponseClearWatch, ResponseClearBreak, \
ResponseLine, ResponseSyntax, ResponseException, CallTrace
gRecursionLimit = 64
def printerr(s):
"""
Module function... |
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ["preview"], 'supported_by': 'community'}
DOCUMENTATION = '''
---
module: gcp_cloudbuild_trigger
description:
- Configuration for an automated build in response to source reposi... |
import unittest
'''from unitTests.commandsRefactored import Commands'''
class CommandsTest(unittest.TestCase):
''' TO DO, rewrite these tests
def setUp(self):
self.commands = Commands()
self.path = '../smug-anime-faces'
def test_bye(self):
self.assertEqual(self.commands.bye("!bye", "... |
import ast
from . import expressions
from .. import itypes, utils
def assign_to_node(target, value, scope):
if isinstance(target, str):
target = ast.parse(target, mode="eval").body
if isinstance(value, str):
value = ast.parse(value, mode="eval").body
if utils.is_ast_sequence(target):
... |
__author__ = "mozman <mozman@gmx.at>"
from .tags import stream_tagger
from .sections import Sections
DEFAULT_OPTIONS = {
"grab_blocks": True, # import block definitions True=yes, False=No
"assure_3d_coords": False, # guarantees (x, y, z) tuples for ALL coordinates
"resolve_text_styles": True, # Text, Att... |
from netCDF4 import Dataset
root = Dataset("heat_map.nc", "w", format="NETCDF4")
test_grp = root.createGroup("testing_data")
print('\ngroups = ' + str(root.groups.keys()))
time = root.createDimension("time", None)
layer = root.createDimension("layer", 11)
lat = root.createDimension("lat", 321)
lon = root.createDimensio... |
import imp
import sys
import subprocess
import os
import glob
import getopt
from itertools import chain
import configparser
path = os.path.join(os.path.dirname(__file__), 'BioHelpers/*.py')
for infile in glob.glob(path):
fullbasename = os.path.basename(infile)
basename = fullbasename[:-3]
imp.load_source(ba... |
import sys
import copy
class temps:
def __init__(self,h=0,m=0,s=0):
self.t=3600*h+60*m+s
def __str__(self):
h=int(self.t/3600)
m=int(self.t%3600/60)
s=self.t%60
st=''
if h>0:
st=st+str(h)+' h '
if m<10:
st=st+'0'+str(m)+' m '
... |
import pickle
import os
all_list = [[]]
cur = 0 #current tab
dlist =[] #for indices of other lists that need to be deleted
for pfb_file in ["prefab_list.txt","prefab_icon_list.txt","prefab_text_list.txt"]:
with open("tf2/prefab_template/"+pfb_file,"r") as cfile:
all_list.append(cfile.read().splitlines())
fo... |
MAX = 200
ALL = set(range(MAX))
class DStore:
"""Domain store holding domains for variables. (Really the domains are held in
dicts kept by the variables.)"""
def __init__(self, name='', level=0, problem=None, parent=None):
"""This store is a strengthening of parent store if there is one."""
... |
print(" ")
print("Starting FD_1D_DX4_DT3_ABS")
import numpy as np
import matplotlib.pyplot as plt
c1=20 # Number of grid points per dominant wavelength
c2=0.5 # CFL-Number
nx=2000 # Number of grid points
T=10 # Total propagation time
f0= 10 # Center frequency Ricker-wavelet
q0= 1 # Maximum amplitude R... |
"""
Tests for user handling.
"""
from django.test import TestCase
from django.contrib.auth.models import AnonymousUser, User
from django.test.utils import override_settings
from django.http import HttpRequest, HttpResponseRedirect
from weblate.accounts.middleware import RequireLoginMiddleware
class MiddlewareTest(TestC... |
from __future__ import unicode_literals
import os
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.coverage',
'sphinx.ext.extlinks',
'sphinx.ext.ifconfig',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinxcontrib.programoutput',
]
if os.getenv('SPELLCHECK'):
... |
"""Install and test tool shed repositories of type tool_dependency_definition.""" |
"""Loading and caching of unresolved alert states from the database"""
import logging
from nav.models.event import AlertHistory
from nav.models.fields import INFINITY
_logger = logging.getLogger(__name__)
_unresolved_alerts_map = {}
def get_map():
"""Returns a cached dictionary of unresolved AlertHistory entries"""... |
__author__ = 'Kristian Hinnenthal'
import time
import twisted.internet.defer as defer
def printer(x):
print x
import decaf_utils_rpc.rpc_layer as rpc
r = rpc.RpcLayer(u'amqp://fg-cn-sandman1.cs.upb.de:5672')
@defer.inlineCallbacks
def doWork():
result = (yield r.call("deployment.scenario_start","7df6fbc97549440... |
"""
Switchy
Licensed under the MPL license (see `LICENSE` file)
Fast FreeSWITCH ESL control with a focus on load testing.
The `EventListener` was inspired from Moises Silva's
'fs_test' project: https://github.com/moises-silva/fs_test
"""
import apps
from os import path
from utils import get_logger, ESLError
from observ... |
import weakref
import logging
from ..transport import Transport
from ..exceptions import NotFoundError, TransportError
from .indices import IndicesClient
from .cluster import ClusterClient
from .cat import CatClient
from .nodes import NodesClient
from .snapshot import SnapshotClient
from .utils import query_params, _ma... |
from functools import partial
from kivy.app import App
from kivy.clock import Clock
from kivy.lang import Builder
from kivy.uix.screenmanager import Screen
from kivy.uix.recycleview import RecycleView
from kivy.properties import ListProperty, ObjectProperty, StringProperty
from .util import SelectableRecycleBoxLayout
c... |
from urllib import quote
from decimal import Decimal
import re
from cStringIO import StringIO
from weboob.tools.browser import BasePage, BrokenPageError
from weboob.tools.json import json
from weboob.capabilities.bank import Account
from weboob.capabilities import NotAvailable
from weboob.tools.capabilities.bank.transa... |
"""
Acceptance tests for adding components in Studio.
"""
from __future__ import absolute_import
import ddt
from common.test.acceptance.fixtures.course import XBlockFixtureDesc
from common.test.acceptance.pages.studio.container import ContainerPage
from common.test.acceptance.pages.studio.settings_advanced import Advan... |
{
'name': 'Mail Organizer',
'version': '7.0.1.0.0',
'category': 'Social Network',
'depends': ['web_polymorphic', 'mail'],
'author': 'Elico Corp',
'license': 'AGPL-3',
'website': 'https://www.elico-corp.com',
'description': """
This module allows you to assign a message to an existing or
a new resource dynam... |
import pdb
from django.contrib.auth.models import User
from django.core.cache import cache
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.test.client import Client
from django.utils.html import escape
from ..models import BattleRecord, BattleProfile
from ..views import self_at... |
import invite
import mail_compose_message |
from __future__ import absolute_import, print_function, division
import unittest
from pony.orm.core import Database, db_session
from pony.orm.sqlsymbols import *
class TestSQLAST(unittest.TestCase):
def setUp(self):
self.db = Database('sqlite', ':memory:')
with db_session:
conn = self.db... |
import os
import re
import openerp
from openerp import SUPERUSER_ID, tools, api
from openerp.osv import fields, osv
from openerp.tools.translate import _
from openerp.tools.safe_eval import safe_eval as eval
from openerp.tools import image_resize_image
class multi_company_default(osv.osv):
"""
Manage multi comp... |
import collections
from django.db import models
from django.db.models import Case, When
from django.utils.translation import ugettext_lazy as _
from base.models.enums import education_group_categories
from osis_common.models.osis_model_admin import OsisModelAdmin
GROUP_TYPE_OPTION = 'Option'
class EducationGroupTypeAdm... |
"""
Tests for the pulses module.
@author: fryckbos
"""
from __future__ import absolute_import
import unittest
import xmlrunner
from peewee import SqliteDatabase, DoesNotExist
from mock import Mock
from ioc import SetTestMode, SetUpTestInjections
from gateway.dto import PulseCounterDTO
from gateway.pulse_counter_control... |
import os.path
import platform
import sys
import webbrowser
import argparse
import simplejson as json
from datadog import api
from datadog.util.format import pretty_json
from datadog.dogshell.common import report_errors, report_warnings, print_err
from datetime import datetime
class TimeboardClient(object):
@classm... |
from openerp.osv import osv
from openerp.osv import fields
class Partner(osv.Model):
'''Partner'''
_inherit = 'res.partner'
_columns = {
'member_ok': fields.boolean(
string='Member',
help='Is this contact a member of the association ?',
),
}
_defaults = {
... |
from odoo import _, fields, models
from odoo.exceptions import UserError
class StockLocation(models.Model):
_inherit = "stock.location"
block_stock_entrance = fields.Boolean(
help="if this box is checked, putting stock on this location won't be "
"allowed. Usually used for a virtual location tha... |
"""
Course Header Menu Tests.
"""
from django.conf import settings
from django.test.utils import override_settings
from contentstore.tests.utils import CourseTestCase
from contentstore.utils import reverse_course_url
from util.testing import UrlResetMixin
FEATURES_WITH_CERTS_ENABLED = settings.FEATURES.copy()
FEATURES_... |
import json
from django.core.management.base import BaseCommand
from postix.core.models import TransactionPosition
class Command(BaseCommand):
help = 'Export preorder redemptions.'
def handle(self, *args, **kwargs):
pos = TransactionPosition.objects.filter(
reversed_by__isnull=True, preorder... |
"""test_api_create_snippet: Test POST /snippets API."""
import json
from falcon import testing
import falcon
import pytest
from snippy.constants import Constants as Const
from tests.lib.content import Content
from tests.lib.content import Request
from tests.lib.content import Storage
from tests.lib.snippet import Snipp... |
import intervention_invoice
import wizard
import report |
import subprocess, sys
from videos.types.base import VideoType
import logging
logger= logging.getLogger(__name__)
class FLVVideoType(VideoType):
abbreviation = 'L'
name = 'FLV'
def __init__(self, url):
self.url = url
def get_direct_url(self, prefer_audio=False):
return self.url
@clas... |
from openerp.osv import fields,osv
POSTFIX_USER = "mailproc"
class postfix_transport(osv.Model):
_name = "postfix.transport"
_description = "Postfix Transport Table"
_auto = False
_columns = {
"domain" : fields.char("Domain",size=256),
"transport" : fields.char("Transport",size=256)
... |
"""associate_disruption_tag table added
Revision ID: 395d2d1824a9
Revises: 32ea230d67a8
Create Date: 2014-07-31 16:57:43.384630
"""
revision = '395d2d1824a9'
down_revision = '32ea230d67a8'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
### commands auto gene... |
from django.db import migrations
import meinberlin.apps.moderatorfeedback.fields
class Migration(migrations.Migration):
dependencies = [
('meinberlin_kiezkasse', '0015_point_helptext'),
]
operations = [
migrations.AlterField(
model_name='proposal',
name='moderator_fee... |
from decimal import Decimal
import re
from weboob.capabilities.bank import Account
from weboob.tools.browser import BasePage
from weboob.tools.capabilities.bank.transactions import FrenchTransaction
__all__ = ['LoginPage', 'DashboardPage', 'OperationsPage']
class LoginPage(BasePage):
def login(self, username, passw... |
from __future__ import absolute_import, print_function, unicode_literals, division
from .tests_mechanism import AbstractTestFixture, dataset
from .check_utils import *
from jormungandr import stat_manager
from jormungandr.stat_manager import StatManager
from jormungandr.utils import str_to_time_stamp
from jormungandr i... |
import subprocess
import pysolr
from django.conf import settings
def clear_core(core_url):
"""
Clear out the old data from a core
:param core_url: The url of the core to clear
:return: None
"""
core = pysolr.Solr(core_url, always_commit=True)
core.delete(q='*:*')
def index_to_core(url, json_... |
"""
Django Command e2e_test for running e2e_tests
"""
from django.core.management.commands import test
from e2e_tests.frontend_server import start_react_server
class Command(test.Command):
"""
Management command to run the e2e test.
Start the frontend server and run the tests in e2e application.
"""
... |
""" A simple continuous receiver class. """
from time import sleep
from SX127x.LoRa import *
from SX127x.LoRaArgumentParser import LoRaArgumentParser
from SX127x.board_config import BOARD
BOARD.setup()
parser = LoRaArgumentParser("Continous LoRa receiver.")
class LoRaRcvCont(LoRa):
def __init__(self, verbose=False)... |
import os
from joulupukki.common import VERSION
os.environ['PBR_VERSION'] = VERSION
import setuptools
setuptools.setup(
setup_requires=['pbr'],
version=VERSION,
pbr=True,
) |
from threading import Timer
from enum import Enum
import i2cMock
from utils import *
def from_int16(tab):
return struct.unpack('h', ensure_string(tab[0:2]))[0]
def from_uint16(tab):
return struct.unpack('H', ensure_string(tab[0:2]))[0]
def from_int32(tab):
return struct.unpack('i', ensure_string(tab[0:4]))[... |
"""
Functions that can are used to modify XBlock fragments for use in the LMS and Studio
"""
import datetime
import json
import logging
import static_replace
import uuid
from django.conf import settings
from django.utils.timezone import UTC
from edxmako.shortcuts import render_to_string
from xblock.exceptions import In... |
import re
def reformat(lang, transformations):
locale = open(f"locales/{lang}.json").read()
for pattern, replace in transformations.items():
locale = re.compile(pattern).sub(replace, locale)
open(f"locales/{lang}.json", "w").write(locale)
godamn_spaces_of_hell = [
"\u00a0",
"\u2000",
"\u... |
import sys, os
sys.path.append("./EduTK.zip")
sys.path.append("../EduTK.zip")
if ('Q37_XPP' in os.environ):
sys.path.append(os.path.join(os.environ["HOME"],"epeios/other/libs/edutk/PYH/edutk"))
import edutk as _
from edutk import Atlas, Core, core, dom, recall, store
F_SALUTE = "Salute"
F_RESOLVE = "Resolve"
F_DRAW =... |
"""
Install Python and Node prerequisites.
"""
import hashlib
import os
import re
import sys
from distutils import sysconfig
from paver.easy import BuildFailure, sh, task
from .utils.envs import Env
from .utils.timer import timed
PREREQS_STATE_DIR = os.getenv('PREREQ_CACHE_DIR', Env.REPO_ROOT / '.prereqs_cache')
NPM_RE... |
import colander
import deform
from zope.interface import invariant
from pontus.schema import omit, select, Schema
from pontus.widget import (
SequenceWidget, SimpleMappingWidget,
CheckboxChoiceWidget, Select2Widget,
RichTextWidget)
from pontus.file import ObjectData, File
from novaideo.content.processes.pro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.