code stringlengths 1 199k |
|---|
scarf = ["scarf{}.png".format(i) for i in range(1, 31)] |
from blueman.services.meta import SerialService
from blueman.Sdp import DIALUP_NET_SVCLASS_ID
class DialupNetwork(SerialService):
__group__ = 'serial'
__svclass_id__ = DIALUP_NET_SVCLASS_ID
__icon__ = "modem"
__priority__ = 50 |
'''
Created on 30 de set de 2017
@author: fernando
'''
import unittest
from chapter1.solution_1_1 import has_all_unique_characters
from chapter1.solution_1_4 import are_anagrams
class Test(unittest.TestCase):
def testSolution1_1(self):
result = has_all_unique_characters("cafdgbc")
assert(result == F... |
import os
import sys
import signal
import time
import subprocess
WHO = None
def handler(signum, frame):
global WHO
print('Signal handler', signum, WHO, frame)
print('Disable handler', signum, WHO, frame)
signal.signal(signal.SIGINT, signal.SIG_DFL)
def main(argv):
global WHO
WHO = argv[1]
if... |
import unittest
from pyrogi import Screen, Backend
from pyrogi.util import Vec2
class TestScreen(Screen):
pass
class TestBackend(unittest.TestCase):
def test_screens(self):
backend = Backend(Vec2(0, 0), Vec2(0, 0), '')
self.assertEqual(len(backend.screens), 0)
backend.set_screen(TestScre... |
__doc__ = """\
playback.py - A plugin for Gate One that adds support for saving and playing
back session recordings.
.. note:: Yes this only contains one function and it is exposed to clients through a WebSocket hook.
Hooks
-----
This Python plugin file implements the following hooks::
hooks = {
'WebSocket'... |
lista_de_asignaturas_teoricas = [ 'matematicas', 'lengua castellana']
print "cantidad de elementos en la lista lista_de_asignaturas_teoricas"
print len(lista_de_asignaturas_teoricas)
lista_de_numeros = [1, 2, 3, 4, 2, 3, 7, 8]
print "elemento de mayor valor"
print max(lista_de_numeros)
print "elemento de menor valor"
p... |
"""
Created on Thu Apr 28 16:52:18 2016 by emin
"""
import os
import sys
import theano
import theano.tensor as T
import numpy as np
from lasagne.layers import InputLayer, ReshapeLayer, DenseLayer
from generators import KalmanFilteringTaskFFWD
import lasagne.layers
import lasagne.nonlinearities
import lasagne.updates
im... |
"""
Module defining the Spline class, something easy to wrap around SciPy splines.
Includes BOK algorithms (Mollinari et al)
Some rules of splrep (k = 3)
- do not put more then 2 knots between data points.
- splrep wants inner knots only, do not give extremal knots, even only "once".
"""
import numpy as np
import sys... |
identity = {
# https://www.census.gov/prod/cen2010/briefs/c2010br-03.pdf
'sex': [('M',49.2),('F',50.8)],
# https://en.wikipedia.org/wiki/Race_and_ethnicity_in_the_United_States
'race': [('O',72.4),('U',12.6)]
}
iq = {
# Class: (mu, sigma)
# http://www.iqcomparisonsite.com/sexdifferences.aspx
... |
import traceback
from datetime import datetime
from itertools import count
import zmq
def serve(procs, port=None, addr='tcp://*', context=None, debug=False):
"""Make some procedures available for remote calls via ØMQ."""
if context is None:
context = zmq.Context.instance()
with context.socket(zmq.RE... |
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import Qt
from maestro.gui import selection, actions
class TreeviewSelection(selection.Selection):
"""Objects of this class store a selection of nodes in a TreeView. Different than a QItemSelectionModel,
a Selection knows about Nodes, Elements etc and... |
from __future__ import unicode_literals
from __future__ import print_function
import logging
import requests
logger = logging.getLogger(__name__)
def collect_filters(url):
"""Return filters from FEWS, cleaned and ready for storing as json."""
from_fews = _download(url)
result = []
for filter_dict in fro... |
from .chucky_neighborhood_tool import NeighborhoodTool |
"""
a csv trace reader
Author: Jason Yang <peter.waynechina@gmail.com> 2016/06
"""
import string
from PyMimircache.const import ALLOW_C_MIMIRCACHE, INSTALL_PHASE
from PyMimircache.utils.printing import *
if ALLOW_C_MIMIRCACHE and not INSTALL_PHASE:
import PyMimircache.CMimircache.CacheReader as c_cacheReade... |
from __future__ import unicode_literals
from frappe import _
app_name = "erpnext"
app_title = "ERPNext"
app_publisher = "Frappe Technologies Pvt. Ltd."
app_description = """ERP made simple"""
app_icon = "fa fa-th"
app_color = "#e74c3c"
app_email = "info@erpnext.com"
app_license = "GNU General Public License (v3)"
sourc... |
import tkinter
tk = tkinter.Tk()
tk.title("Bounce")
tk.resizable(0, 0)
tk.wm_attributes("-topmost", 1)
canvas = tkinter.Canvas(tk, width=500, height=400)
canvas.configure(bd=0)
canvas.configure(highlightthickness=0)
canvas.pack()
ball = canvas.create_oval(10, 10, 25, 25, fill='red')
def handle_timer_event():
canvas... |
"""
Connection module
"""
from pyxmn.utils import support
import psycopg2.extras # load the psycopg extras module
class Pool():
"""
Connection Pool
"""
settings = None
connection = None
pool = None
@staticmethod
def commit():
(Pool.connection).commit()
@staticmethod
def ... |
def progress(current, total, percent=10, iteration=None):
"""
Used in a loop to indicate progress
"""
current += 1
if current:
previous = current - 1
else:
previous = current
# print out every percent
frac = percent/100.
value = max(1, frac*total)
return not (... |
import signal
import sys
from PyQt5.QtCore import QCoreApplication, QFileSystemWatcher
def directory_changed(path):
print("directory_changed: {}".format(path))
def file_changed(path):
print("file_changed: {}".format(path))
def main(argv):
signal.signal(signal.SIGINT, signal.SIG_DFL)
app = QCoreApplicati... |
import unittest
import pandas as pd
from pandas_schema import Column
from pandas_schema.validation import CanConvertValidation, LeadingWhitespaceValidation, TrailingWhitespaceValidation
class SingleValidationColumn(unittest.TestCase):
"""
Test a column with one single validation
"""
NAME = 'col1'
co... |
import languages.autodetect_lang as autodetect_lang
import re
import os.path
import logging
log = logging.getLogger("subdownloader.languages.Languages")
import __builtin__
__builtin__._ = lambda x : x
LANGUAGES = [{'locale':'sq', 'ISO639': 'sq', 'SubLanguageID': 'alb', 'LanguageName': _('Albanian')},
{'locale':'ar', ... |
from patient_evaluation_report import * |
import re
from core import httptools
from core import logger
from core import scrapertools
from core.item import Item
HOST = "http://documentales-online.com/"
def mainlist(item):
logger.info()
itemlist = list()
itemlist.append(Item(channel=item.channel, title="Novedades", action="listado", url=HOST))
it... |
import sys, os, shutil
from os import path
from urllib.request import pathname2url
import subprocess
from subprocess import call
import sys
import re
import zipfile
import config
os.chdir(config.root_dir)
SUPPORTED_OPERATING_SYSTEMS = ('windows_x64', 'linux_x64', 'mac')#, 'linux-arm32', 'linux-arm64')
def make_dir(dir_... |
"""
Defers gettext translation till request time.
IPA presents some tricky gettext challenges. On the one hand, most translatable
message are defined as class attributes on the plugins, which means these get
evaluated at module-load time. But on the other hand, each request to the
server can be in a different locale,... |
import sys, os, re, urllib, csv
pkginstall_configvars = {
'PACKAGE' : 'dummy', 'PACKAGE_NAME' : 'dummy', 'VERSION' : '0.0', 'REVISION' : 'uninstalled',
#@PKGINSTALL_CONFIGVARS_IN24LINES@ # configvars are substituted upon script installation
}
bugurls = (
('gb', 'http://bugzilla.gnome.org/buglist.cgi?bug_i... |
"""
Initialize Lychee.
"""
__all__ = [
'converters',
'document',
'exceptions',
'logs',
'namespaces',
'signals',
'tui',
'workflow',
'vcs',
'views',
]
from lychee import *
from ._version import get_versions
__version__ = get_versions()['version']
del get_versions |
"""Provide history manager for SCCTool."""
import json
import logging
import scctool.settings.translation
from scctool.settings import getJsonFile, idx2race, race2idx
module_logger = logging.getLogger(__name__)
_ = scctool.settings.translation.gettext
class HistoryManager:
"""History manager for SCCTool."""
__m... |
import unittest
"""804. Unique Morse Code Words
https://leetcode.com/problems/unique-morse-code-words/description/
International Morse Code defines a standard encoding where each letter is
mapped to a series of dots and dashes, as follows: `"a"` maps to `".-"`, `"b"`
maps to `"-..."`, `"c"` maps to `"-.-."`, and so on.... |
import warnings
from pathlib import Path
from typing import Union
try:
import xlwings as xw
except ImportError:
xw = None
from larray.util.misc import _positive_integer
from larray.core.group import _translate_sheet_name
from larray.core.array import asarray, zip_array_items
from larray.example import load_exam... |
"""Early initialization and main entry point.
qutebrowser's initialization process roughly looks like this:
- This file gets imported, either via the setuptools entry point or
__main__.py.
- At import time, we check for the correct Python version and show an error if
it's too old.
- The main() function in this file... |
from typing import Optional
from lib.data import CustomFieldArgs
async def fieldUser(args: CustomFieldArgs) -> Optional[str]:
if args.field.lower() == 'user' or args.field.lower() == 'nick':
if args.nick:
return (args.prefix or '') + args.nick + (args.suffix or '')
else:
ret... |
import pdb
version=2.0
def my_add(a,b):
''' This is the function for addition of numbers and strings '''
print "value of a is {}".format(a)
print "value of b is {}".format(b)
return a+b
def my_div(a,b):
''' This is the function for division '''
return a/b
def my_sub(a,b):
''' This is the function for subs... |
"""
Use this component to create a custom opaque material that has no mass, which can be plugged into the "Honeybee_EnergyPlus Construction" component.
_
It is important to note that this component creates a material with no mass and, because of this, the accuracy of the component is not as great as a material that has... |
""" Disable blocks module """
from __future__ import print_function
from __future__ import absolute_import
from __future__ import unicode_literals
import os
import re
import sys
import logging
from ..tools import CMakeFileEditor
from .base import ModTool, ModToolException
logger = logging.getLogger(__name__)
class ModT... |
from nose.tools import *
import iDibo
def setup():
print "SETUP!"
def teardown():
print "TEAR DOWN!"
def test_basic():
print "I RAN!" |
#!/usr/bin/python
import sys
import ConfigParser
import os
import time
import logging
import pyinotify
import serial
import subprocess
import threading
import re
import string
import signal
import Queue
from struct import *
NX_lf = '\xff\xff\xff'
NX_channel = 0
NX_page = 0
version = '0.18'
temps = dict()
channels = di... |
"""
Round raster to set decimals.
"""
from os.path import dirname, exists
import argparse
import os
from osgeo import gdal
import numpy as np
from raster_tools import datasets
DRIVER = gdal.GetDriverByName('gtiff')
OPTIONS = ['compress=deflate', 'tiled=yes']
progress = True
class Exchange(object):
def __init__(self... |
from phystricks import *
def rotation(angle,pts):
ptsp=[ x.rotation(angle) for x in pts ]
return tuple(ptsp)
def truc(A,B,C,D,points_names,angle,pspicts,n):
A,B,C,D=rotation(angle,[A,B,C,D])
quadri=Polygon(A,B,C,D)
quadri.put_mark(0.2,points_names=points_names,pspicts=pspicts)
no_symbol(A,B,C,... |
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import django_ca.models
class Migration(migrations.Migration):
dependencies = [
('django_ca', '0019_certificate_autogenerated'),
]
operations = [
migrations.Cr... |
import time
import networkx as nx
import matplotlib.pyplot as plt
from neat import activation_functions
def find_feed_forward_layers(inputs, connections):
"""
Collect the layers whose members can be evaluated in parallel in a feed-forward network.
Adapted from: https://github.com/CodeReclaimers/neat-python,... |
import sys
from com.l2scoria import Config
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
qn = "644_GraveRobberAnnihilation"
DROP_CHANCE = 75
KARUDA = 32017
ORC_GOODS = 8088
REW... |
def main():
s = 'this is a string'
for c in s:
print(c, end='')
else:
print(' else')
print()
for i in range(10, 0, -1):
print(i, end=' ')
if __name__ == "__main__":
main() |
import numpy as np
from .abstract_layer import LayerBase, NoParamMixin
from ..util import zX, zX_like, white, scalX
class PoolLayer(NoParamMixin, LayerBase):
def __init__(self, filter_size, compiled=True):
LayerBase.__init__(self, activation="linear", trainable=False)
if compiled:
from .... |
'''Publish sensor events to MQTT broker.'''
import logging
import paho.mqtt.publish as mqtt_pub
import paho.mqtt.client as mqtt
import socket
class MqttPublisher():
'''Publish sensor events to an MQTT broker.'''
def __init__(self, broker, topic_prefix='/sensors'):
'''Initialize a MqttPublisher instance.... |
import socket
import sickbeard
from sickbeard import logger, common
from sickrage.helper.exceptions import ex
from libgrowl import gntp
class GrowlNotifier(object):
sr_logo_url = 'https://raw.githubusercontent.com/SickRage/SickRage/master/gui/slick/images/sickrage-shark-mascot.png'
def test_notify(self, host, p... |
import sys
import random
import collections
import itertools
import bisect
def nonuniform_random_number_generation(values, probabilities):
prefix_sum_of_probabilities = (
[0.0] + list(itertools.accumulate(probabilities)))
interval_idx = bisect.bisect(prefix_sum_of_probabilities,
... |
import sys
from com.l2scoria.gameserver.model.quest import State
from com.l2scoria.gameserver.model.quest import QuestState
from com.l2scoria.gameserver.model.quest.jython import QuestJython as JQuest
qn = "404_PathToWizard"
MAP_OF_LUSTER = 1280
KEY_OF_FLAME = 1281
FLAME_EARING = 1282
BROKEN_BRONZE_MIRROR = 1283
WIND_F... |
import json
import hashlib
from django.db import models
from django.db.models import Count, Func
from django.contrib.postgres.fields import ArrayField
from django.contrib.auth.models import BaseUserManager, AbstractBaseUser
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.models import Pe... |
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import (
int_or_none,
smuggle_url,
)
class TeleQuebecIE(InfoExtractor):
_VALID_URL = r'https?://zonevideo\.telequebec\.tv/media/(?P<id>\d+)'
_TEST = {
'url': 'http://zonevideo.telequebec.tv/media/20984/le-cour... |
import pickle
import urwid
import zmq
from ..ifc import *
def tui_client(src_uri, dst_uri, log_uri):
set_current_thread_name()
_log = getLogger()
ctx = zmq.Context.instance()
# NOTE:(cohesion): connect topology backward :: from dst to src
dst_sock = ctx.socket(zmq.PUSH)
dst_sock.connect(dst_uri)... |
import os
sys = os.system
CC = 'g++ {} -std=gnu++0x -Wall'
FLAG_clear = ['/c', '-c']
FLAG_window = ['/w', '-w']
FLAG_exit = ['/e', '-e']
def main():
print('List of existing <*.cpp> files:')
files = []
counter = 0
for file in os.listdir():
if file[-4:] == '.cpp':
counter += 1
files.append(file)
print('{:-... |
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
setup(name='peloton_bloomfilters',
author = 'Adam DePrince',
author_email = 'adam@pelotoncycle.com',
url = 'https://github.com/pelotoncycle/peloton_bloomfilters',
version='0.0.1',... |
""" create rst files for documentation of DIRAC """
import os
import shutil
import socket
import sys
import logging
import glob
from diracdoctools.Utilities import writeLinesToFile, mkdir, makeLogger
from diracdoctools.Config import Configuration, CLParser as clparser
LOG = makeLogger('CodeReference')
CUSTOMIZED_DOCSTR... |
from math import exp, log
import sqlite3
from numpy import polyval
from scipy.optimize import fsolve
from PyQt4.QtGui import QApplication
from lib import unidades
from lib.sql import databank_name
class Reaction(object):
"""Chemical reaction object"""
status = 0
msg = QApplication.translate("pychemqt", "und... |
from __future__ import absolute_import, print_function
from grid_cell_model.submitting import flagparse
import noisefigs
from noisefigs.env import NoiseEnvironment
import config_standard_gEE_3060 as config
parser = flagparse.FlagParser()
parser.add_flag('--bumpDriftSweep')
args = parser.parse_args()
env = NoiseEnvironm... |
"""
Form widgets for ToscaWidgets.
To download and install::
easy_install twForms
"""
from tw.api import Widget
from tw.forms.core import *
from tw.forms.fields import *
from tw.forms.datagrid import *
from tw.forms.calendars import *
from tw.forms.core import __all__ as __core_all
from tw.forms.fields import __all_... |
""" unit test for Watchdog.py
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from mock import MagicMock
from DIRAC.WorkloadManagementSystem.JobWrapper.Watchdog import Watchdog
mock_exeThread = MagicMock()
mock_spObject = MagicMock()
def test_ca... |
import sys
sys.path.append('/home/pi/Desktop/ADL/YeastRobot/PythonLibrary')
from RobotControl import *
deck="""\
DW96W DW96W DW96W BLANK BLANK BLANK BLANK
DW96W DW96W DW96W BLANK BLANK BLANK BLANK
DW96W DW96W DW96W BLANK BLANK BLANK BLANK
BLANK BLANK BLANK BLANK BLANK BLANK BLANK
"""
OffsetDict={0: 'UL', 1: 'UR... |
"""abydos.distance._tarantula.
Tarantula similarity
"""
from typing import Any, Counter as TCounter, Optional, Sequence, Set, Union
from ._token_distance import _TokenDistance
from ..tokenizer import _Tokenizer
__all__ = ['Tarantula']
class Tarantula(_TokenDistance):
r"""Tarantula similarity.
For two sets X and... |
"""
Created on Mon Jan 30 20:12:17 2017
@author: Mohtashim
"""
spells = ["protego", "accio", "expecto patronum", "legilimens"]
shout_spells = map(lambda item: item + '!!!', spells)
shout_spells_list = list(shout_spells)
print(shout_spells_list) |
from os.path import abspath
import wptools
from mycroft.messagebus.message import Message
from mycroft.skills.LILACS_knowledge.services import KnowledgeBackend
from mycroft.util.log import getLogger
__author__ = 'jarbas'
logger = getLogger(abspath(__file__).split('/')[-2])
class WikidataService(KnowledgeBackend):
d... |
from nbxmpp.namespaces import Namespace
from nbxmpp.structs import StanzaHandler
from nbxmpp.structs import ChatMarker
from nbxmpp.modules.base import BaseModule
class ChatMarkers(BaseModule):
def __init__(self, client):
BaseModule.__init__(self, client)
self._client = client
self.handlers =... |
'''
Mepinta
Copyright (c) 2011-2012, Joaquin G. Duo
This file is part of Mepinta.
Mepinta 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.
Mep... |
"""
Test coming episodes
"""
from __future__ import print_function, unicode_literals
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../../lib')))
sys.path.insert(1, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../..')))
from sickchill.s... |
"""
Wheel will try to read configurations from environment variables
so you dont need this local_settings.py file if you have env vars.
1. You can set as a file
export WHEEL_SETTINGS='/path/to/settings.py'
2. You can set individual values
export WHEEL_MONGODB_DB="wheel_db"
export WHEEL_MONGODB_HOST='localhost'
export W... |
from Once_Property import Once_Property
from STG._Object_ import _STG_Object_
from STG._Program_Object_ import _Program_Object_
from STG.Parameter import Parameter, Parameter_Ref, Parameter_Type, Absolute_Segment
from STG.Language import Language
import os
fr... |
from multiprocessing import Process,Queue
import os
class TestMP:
def __init__(self,n):
self.n = n
@staticmethod
def worker(q):
"""worker function"""
q.put([1,'x',(os.getpid(),[])])
return
def main(self):
if __name__ == '__main__':
jobs = []
... |
import sys
import unittest
sys.path.insert(0, "../src/build")
import addonconf
class AddonConfModuleTestCase(unittest.TestCase):
def test_load(self):
# act
config = addonconf.load("configs/config.json")
# assert
self.assertEqual(config, None, "Wrong return value for not exists config... |
import os
from configurations.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "morgoth.settings")
os.environ.setdefault("DJANGO_CONFIGURATION", "Production")
application = DjangoWhiteNoise(get_wsgi_application()) |
import hashlib
import StringIO
import gzip
import web
import mock
from nose.tools import eq_, ok_
from datetime import datetime
from contextlib import closing
from configman.dotdict import DotDict
from socorro.collector.wsgi_breakpad_collector import BreakpadCollector
from socorro.collector.throttler import ACCEPT, IGN... |
SFDC_COUNTRIES = {
'af': 'Afghanistan',
'ax': 'Aland Islands',
'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',
'au': 'Australia',
... |
import functools
from . import (
constants,
utils,
)
class Card():
def __init__(self, kind=None, strength=None, value=None, verbose=None, **kwargs):
if kind is None:
raise(TypeError("Missing required 'kind' argument."))
self.kind = kind
self.strength = strength
... |
config = {
"suite_definitions": {
"gaiatest_desktop": {
"options": [
"--restart",
"--timeout=%(timeout)s",
"--type=%(type)s",
"--testvars=%(testvars)s",
"--profile=%(profile)s",
"--symbols-path=%(symb... |
from firefox_ui_harness.arguments import UpdateArguments
from firefox_ui_harness.runners import UpdateTestRunner
from firefox_ui_harness.runtests import cli
def cli_update():
cli(runner_class=UpdateTestRunner, parser_class=UpdateArguments)
if __name__ == '__main__':
cli_update() |
import json
from wva.test.test_utilities import WVATestBase
class TestWVASubscriptions(WVATestBase):
def test_get_subscriptions(self):
self.prepare_json_response("GET", "/ws/subscriptions", {
"subscriptions": [
"subscriptions/a",
"subscriptions/b",
]
... |
"""
rebuildbot/travis.py
Wrapper around travispy
The latest version of this package is available at:
<https://github.com/jantman/rebuildbot>
Copyright 2015 Jason Antman <jason@jasonantman.com> <http://www.jasonantman.com>
This file is part of rebuildbot.
rebuildbot is free software: you can redistribute it and/... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('api', '0003_auto_20141128_0831'),
]
operations = [
migrations.AlterField(
model_name='acl',
name='user',
field=models... |
from django.conf.urls.defaults import *
from twistranet.core.views import AsView
from views import *
urlpatterns = patterns('sharing',
url(r'^like_toggle_by_id/(\d+)$', AsView(LikeToggleView, lookup = 'id'), name=LikeToggleView.name),
url(r'^like_toggle_by_slug/(\d+)$', AsView(LikeToggleView, lookup = 'slug'), ... |
from __future__ import unicode_literals
import frappe
import unittest
class TestItemInfo(unittest.TestCase):
pass |
from datetime import datetime
from dateutil.relativedelta import relativedelta
import time
from osv import fields, orm, osv
from tools.translate import _
import netsvc
import tools
class stock_location(orm.Model):
_inherit = "stock.location"
_columns = {
'retention_mode': fields.selection(
[... |
"""
Comprehensive Theming support for Django's collectstatic functionality.
See https://docs.djangoproject.com/en/1.8/ref/contrib/staticfiles/
"""
from __future__ import absolute_import
import os.path
import posixpath
import re
from django.conf import settings
from django.contrib.staticfiles.finders import find
from dj... |
"""
Discounts application configuration
"""
from __future__ import absolute_import
from django.apps import AppConfig
class DiscountsConfig(AppConfig):
name = 'openedx.features.discounts' |
from .base_premierecinemas import BasePremierecinemasCinemaSpider
class Spider(BasePremierecinemasCinemaSpider):
name = 'praha-premierecinemas'
calendar_url = 'http://www.premierecinemas.cz/' |
from openerp.osv import orm, fields, osv
from openerp import SUPERUSER_ID
import logging
_logger = logging.getLogger(__name__)
class nh_etake_list_review(orm.Model):
_name = "nh.etake_list.review"
_inherits = {'nh.activity': 'activity_id'}
_description = "Review View"
_rec_name = 'patient_id'
_auto ... |
from . import test_invoice_mode_weekly
from . import test_invoice_mode_weekly_is_it_today |
from . import purchase
from . import invoice |
"""
THis exists solely to provide less typing for a "leaf node"
in a simple realtional schema (1:M and 1:M-N:1) when used with SQLAlchemy
SA does not support class based inheritence in the normal Python way for objects inheriting from Base. Thus we have those objects perform multiple inheritence...
"""
import json
imp... |
import logging
import os
import sys
import shutil
import openerp
from openerp import api
from openerp.osv import orm, fields
from openerp.addons.runbot.runbot import mkdirs
_logger = logging.getLogger(__name__)
MAGIC_PID_RUN_NEXT_JOB = -2
def custom_build(func):
"""Decorator for functions which should be overwritte... |
from .api import API, ApiMethods
from .config import Config
__all__ = ["API", "ApiMethods", "Config"] |
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
class ChangeRequest(Document):
pass |
import syslog
from shinken.basemodule import BaseModule
from shinken.log import logger
properties = {
'daemons': ['broker'],
'type': 'syslog',
'external': False,
'phases': ['running'],
}
def get_instance(plugin):
logger.info("Get a Syslog broker for plugin %s" % plugin.get_name())
#Catch err... |
from odoo import api, models, fields, tools, _
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT, float_repr
from odoo.tests.common import Form
from odoo.exceptions import UserError
from datetime import datetime
from lxml import etree
from PyPDF2 import PdfFileReader
import io
import logging
_logger = logging.getLogger... |
'''Base classes for data analysis tools.'''
import re
import logging
import inspect
import importlib
import simplejson
import numpy as np
import pandas as pd
import collections
from abc import ABCMeta
from abc import abstractmethod
from abc import abstractproperty
from sqlalchemy import func
from sqlalchemy.dialects.po... |
from openerp import models, fields, api
import openerp.addons.decimal_precision as dp
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
@api.one
@api.depends('price_unit',
'price_subtotal',
'order_id.pricelist_id.currency_id',
'order_i... |
from cStringIO import StringIO
from captcha.models import CaptchaStore
from django.http import HttpResponse, Http404
from django.shortcuts import get_object_or_404
import Image,ImageDraw,ImageFont,ImageFilter
import random
from captcha.conf import settings
def captcha_image(request,key):
store = get_object_or_404(C... |
from odoo.addons.website_sale.controllers.main import WebsiteSale
from odoo import http
class WebsiteSaleProductDetailAttributeImage(WebsiteSale):
@http.route()
def product(self, product, category='', search='', **kwargs):
res = super().product(
product, category=category, search=search, **k... |
from setuptools import setup, find_packages # Always prefer setuptools over distutils
from codecs import open # To use a consistent encoding
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
long_description = f.read()
setup(
name=... |
import logging
from datetime import datetime
import os
import json
from flask import request, g, Response
from openspending.auth import require
from openspending.lib.jsonexport import jsonify
from openspending.views.api_v2.common import blueprint
from openspending.views.error import api_json_errors
from openspending.li... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.