code stringlengths 1 199k |
|---|
"""Tests related to post-processing computation of potential and free surface elevation."""
import pytest
import numpy as np
import capytaine as cpt
def test_potential():
sphere = cpt.Sphere(radius=1.0, ntheta=3, nphi=12, clip_free_surface=True)
sphere.add_translation_dof(name="Heave")
solver = cpt.BEMSolve... |
import TinyEngine
TinyEngine = TinyEngine.TinyEngine()
while True:
Query = input('Search: ')
# print the Binary vector for each term
TermsBinaryVectors, TermsBinaryDictionary, TermsByOrder = TinyEngine.Search(Query)
print(TermsBinaryVectors)
print(TermsBinaryDictionary)
print(TermsByOrder)
#... |
# -*- coding: utf-8 -*-
"""
subrosa.views.create_views
===============
Implements class-based views related to creating projects and articles
:copyright: (c) 2014 by Konrad Wasowicz
:license: MIT, see LICENSE for details.
"""
from __future__ import print_function
from flask import render_template, ... |
"""
Copyright (C) 2014 Technische Universität Berlin,
Fakultät IV - Elektrotechnik und Informatik,
Fachgebiet Regelungssysteme,
Einsteinufer 17, D-10587 Berlin, Germany
This file is part of PaPI.
PaPI is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as publish... |
"""Clip a raster by bounding box."""
import logging
import processing
from qgis.core import QgsRasterLayer, QgsApplication
from safe.common.exceptions import ProcessingInstallationError
from safe.common.utilities import unique_filename, temp_dir
from safe.definitions.processing_steps import quick_clip_steps
from safe.g... |
import unittest
import os
from spikepy.builtins.file_interpreters.wessel_labview_text_tetrode import \
Wessel_LabView_text_tetrode
from spikepy.common.trial import Trial
base_directory = os.path.split(__file__)[0]
sample_data_fullpath = os.path.join(base_directory, 'sample_data_file.tet')
class ReadingSampleDataFil... |
"""
This module defines a model of a well mixed biochemical reaction network.
"""
import uuid
from collections import OrderedDict
class Model():
""" Representation of a well mixed biochemical model. Interfaces to solvers in StochSS
should attempt to extend Model. """
def __init__(self, name="", volu... |
import os
from django.http import HttpResponse, Http404
from django.views.generic import DetailView
from wsgiref.util import FileWrapper
from .models import Graph
class GraphView(DetailView):
queryset = Graph.objects
slug_field = 'name'
def get(self, request, *args, **kwargs):
self.object = self.get... |
import core.Exploit
import core.io
import requests
import interface.utils
from interface.messages import print_error, print_success, print_help, print_info
class Exploit(core.Exploit.RextExploit):
"""
Name: Netgear ProSAFE remote code execution
File: prosafe_exec.py
Author:Ján Trenčanský
License: GNU GPL v3
Created... |
from __future__ import with_statement
__license__ = 'GPL v3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import os, re
from PyQt4.Qt import QPixmap, SIGNAL
from calibre.gui2 import choose_images, error_dialog
from calibre.gui2.convert.metadata_ui import Ui_Form
fro... |
import os
import errno
import unittest
import shutil
import numpy
import tempfile
import xml.dom.minidom as xml
import lofarpipe.support.xmllogging as xmllogging
from lofarpipe.support.xmllogging import get_child
class xmlloggingTest(unittest.TestCase):
def __init__(self, arg):
super(xmlloggingTest, self)._... |
"""server URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-base... |
import numpy as np
import h5py
import matplotlib as mpl
mpl.use('agg')
import pylab as pl
import input_files.domain as domain
import input_files.params as params
pl.rcParams['figure.figsize'] = 12, 7.5
pl.rcParams['figure.dpi'] = 300
pl.rcParams['image.cmap'] = 'jet'
pl.rcParams['lines.linewidth'] = 1.5
pl.r... |
import argparse
import socket
from is_ipv4 import is_ipv4
MIN_PORT = 1
MAX_PORT = 49150
def scan_host(host, port):
'''
scan port on host & return True if open, False if closed.
host : must be an ip address.
port : must be a port number.
'''
try:
s = socket.socket(socket.AF_INET, socket.... |
from dijkstra import dijkstra
import bellman_ford as bf
import unittest, json
from random import randint
class AlgoTest(unittest.TestCase):
def testrandomCompare(self):
# TODO: We need to make sure this test is run in the same dir
# as adj_local.json and dummy.json
with open('adj_local... |
from builtins import object
class KeyMap(object):
def __init__(self,
modifiers,
chords):
self.chords = chords
self.modifiers = modifiers
def __call__(self, pressed_keys, released_index):
# TODO: Better handling of case insensitivity. Review and make sure... |
from openerp import models, api, _
class PrintCommissionSummaryTemplate(models.AbstractModel):
_name = 'report.sales_commission.print_commission_summary_template'
@api.model
def render_html(self, docids, data=None):
report_obj = self.env['report']
report = report_obj._get_report_from_name('s... |
import subprocess
import io
from PIL import Image, ImageTk
import tkinter as tk
class LiveAndroidFeed():
def __init__(self, parent):
self.parent = parent
self.buf = io.BytesIO()
testImg = self.getImage()
xsize, ysize = testImg.size
self.canvas = tk.Canvas(self.parent, width=x... |
from yowsup.layers.interface import YowInterfaceLayer, ProtocolEntityCallback
from yowsup.layers.protocol_messages.protocolentities import TextMessageProtocolEntity
from yowsup.layers.protocol_acks.protocolentities import *
from yowsup.layers.protocol_presence import YowPre... |
from twisted.trial import unittest
from moira.checker import state, expression
class Expression(unittest.TestCase):
def testDefault(self):
self.assertEqual(expression.getExpression(t1=10, warn_value=60, error_value=90), state.OK)
self.assertEqual(expression.getExpression(t1=60, warn_value=60, error_... |
from constants import *
from player import *
class DiverPlayer(Player):
""" This class represents a diver player on the board """
def __init__(self, commands):
Player.__init__(self, commands)
self.type = Constant.PlayerType["Diver"]
self.currentLocation = Constant.TileNames["IronGate"] |
from marshmallow_jsonapi import Schema, fields
class HistorySchema(Schema):
"""
Represents a generic history of data.
"""
id = fields.String()
history = fields.Dict()
class Meta:
type_ = 'history' |
"""For uploading files to a remove server via Rsync"""
import os
import errno
import sys
import subprocess
import syslog
import time
class RsyncUpload(object):
"""Uploads a directory and all its descendants to a remote server.
Keeps track of what files have changed, and only updates changed files."""
def __... |
from flask_wtf import FlaskForm
from wtforms import StringField, FileField, SubmitField
from wtforms.validators import DataRequired
class HashfilesForm(FlaskForm):
name = StringField('Hashfile Name', validator=[DataRequired()])
hashfile = FileField('Upload Hashfile')
submit = SubmitField('Upload') |
"""This demo prints MATLAB version.
"""
from __future__ import division, print_function, absolute_import
from __future__ import unicode_literals
import matlab_wrapper
def main():
matlab = matlab_wrapper.MatlabSession()
print("matlab.version:", matlab.version)
print("raw version string from MATLAB workspace:... |
'''
Some sets and dicts for filtering SNPs (copied from ldsc.ldscore.sumstats).
'''
from __future__ import division
import itertools as it
COMPLEMENT = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
BASES = COMPLEMENT.keys()
STRAND_AMBIGUOUS = {''.join(x): x[0] == COMPLEMENT[x[1]]
for x in it.product(BASE... |
from testfixtures import log_capture
from tests.base_test import BaseTest
from tests import config
from core.sessions import SessionURL
from core import modules
import utils
from core import messages
import subprocess
import os
def setUpModule():
subprocess.check_output("""
BASE_FOLDER="{config.base_folder}/test_fi... |
"""
Testing var_process using exponential decay examples.
"""
from __future__ import print_function
import copy
import pytest
import numpy as np
import tigramite.data_processing as pp
from tigramite.toymodels import structural_causal_processes as toys
def gen_decay(init_val, decay_const, n_times, delay):
"""
Ge... |
"""
Perform (or assist with) cleaning operations.
"""
import glob
import logging
import os.path
import re
import sys
from bleachbit import _
from bleachbit.FileUtilities import children_in_directory
from bleachbit.Options import options
from bleachbit import Command, FileUtilities, Memory, Special
import warnings
warni... |
import asyncio
@asyncio.coroutine
def wait_run_in_executor(func, *args):
"""
Run blocking code in a different thread and wait
for the result.
:param func: Run this function in a different thread
:param args: Parameters of the function
:returns: Return the result of the function
"""
loop ... |
from netCDF4 import Dataset
import numpy as np
import pandas as pd
import xarray as xr
import matplotlib.pyplot as plt
from cell_area import cell_area
import pdb
import os
def q_spinup(run_fol, var_to_integrate, start_month, end_month, plt_dir):
#personalise
#model directory
model_dir = '/scratch/sit204/FMS... |
import sys
import logging
from pprint import pprint
from mapfile import GnuMapFile
logging.basicConfig(level=logging.DEBUG)
f = open(sys.argv[1])
m = GnuMapFile(f)
m.skip_till_memmap()
m.skip_while_lead_space()
m.parse_sections()
m.validate()
basename = sys.argv[1].replace("-", "_").replace(".", "_")
with open(basename... |
class Item:
"""A Item is an item which can be consumed."""
def __init__(self, name, count, verb, act):
self.name = name
self.count = count
self.verb = verb
self.act = act
def use(self):
if self.count <= 0:
print("You don't have any more of those.")
... |
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
import httplib, zlib, json
from functools import partial
from urllib import urlencode
from calibre.srv.tests.base import Libra... |
import os
class BaseConfig(object):
DEBUG = False
SECRET_KEY = '\x94\x7f\xafN{\x8e7M\xeb\xc6\xe4\x90\xee2(\xc0\xc0\xbe\xd9\xac%Kz\x8fm'
SQLALCHEMY_DATABASE_URI = os.environ['DATABASE_URL'] #DATABASE_URL='sqlite:///posts.db'
print SQLALCHEMY_DATABASE_URI
class TestConfig(BaseConfig):
DEBUG = True
... |
def cmd_feedback(args):
try:
if len(args['command_list']) > 0:
return {
'status': True,
'type': "feedback",
'response': u"Obrigado pelo feedback! Alguém em algum momento vai ler, eu acho.",
'feedback': ' '.join(args['command_list']),
'debug': u'Feedback bem sucedido',... |
"""
sphinxy - Script to monitor changes to *.rst files and rerun sphinx-build
Since sphinx-build checks for "out-of-date" rst files,
first "touch" all *.rst files to put them "out-of-date".
Then run "sphinx-build" command
sphinxy tries to launch a web browser with the index.html file from local disk.
This is not guaran... |
""" Module contains Windows-specific functionality.
Specifically, module contains the Windows-specific functions for setting
an image as the desktop background, showing dialog boxes (e.g. to select where to
save images or to warn the user), and hooking into keyboard presses.
"""
import logging
logger = logging.getLogge... |
"""
Copyright (c) 2017 BugScan (http://www.bugscan.net)
See the file 'LICENCE' for copying permission
"""
import os
import re
import binascii
import collections
import mmap
import struct
import zlib
from lib.request import wget
from lib.request import request_data
from lib.data import paths
from lib.data import logger
... |
import unittest
class TestImport(unittest.TestCase):
def test_import(self):
import ufal.morphodita
self.assertTrue(True)
if __name__ == '__main__':
unittest.main() |
import urllib2
from bs4 import BeautifulSoup
from core.archivedotcom import ArchiveDotOrg
from core.logger import Logger
from oakleydb.objectfactory import ObjectFactory
import codecs
import re
import json
LOADER_NAME = 'Oakley.com Loader V1'
SITE_URL = 'http://www.oakley.com'
GLASSES_URL = SITE_URL + '/glasses.asp'
LE... |
from django.db import migrations
import taggit.managers
class Migration(migrations.Migration):
dependencies = [
('taggit', '0003_taggeditem_add_unique_index'),
('conversation', '0020_auto_20191007_2113'),
]
operations = [
migrations.AddField(
model_name='tweetdj',
... |
"""This will count tables and guests."""
def get_party_stats():
families = [['Angel', 'Michael', 'Samuel'], ['Jennifer', 'James']]
table_size = 6
x= families (len)
y = 6
for total_number_of_guests in families :
total_number_of_tables = -(-x //y)
print total_number_of_guests, total_number... |
"""Convert Gettext PO localization files to PHP localization files.
See: http://docs.translatehouse.org/projects/translate-toolkit/en/latest/commands/php2po.html
for examples and usage instructions.
"""
from translate.convert import convert
from translate.misc import quote
from translate.storage import php, po
eol = "\... |
from erukar.system.engine import Indexer, Describable, AiModule
from erukar.ext.math import Random, Namer
from .Lifeform import Lifeform
from .Player import Player
import erukar
import random
import string
class Enemy(Lifeform, Indexer):
RandomizedArmor = []
RandomizedWeapons = []
ElitePointClassificationMi... |
"""
Just use:
gpg --import key.asc
""" |
import unittest
import numpy
from openquake.baselib import hdf5, general
from openquake.hazardlib.sourcewriter import obj_to_node
from openquake.hazardlib.mfd.multi_mfd import MultiMFD
from openquake.hazardlib.source.multi_point import MultiPointSource
from openquake.hazardlib.geo.mesh import Mesh
from openquake.hazard... |
"""
A pure python (slow) implementation of rijndael with a decent interface
To include -
from rijndael import rijndael
To do a key setup -
r = rijndael(key, block_size = 16)
key must be a string of length 16, 24, or 32
blocksize must be 16, 24, or 32. Default is 16
To use -
ciphertext = r.encrypt(plaintext)
plaintext =... |
from .Smite import Smite
__all__ = [
"Smite"
] |
from odoo import api, fields, models
from odoo.osv import expression
class HotelHousekeepingActivityType(models.Model):
_name = "hotel.housekeeping.activity.type"
_description = "Activity Type"
name = fields.Char("Name", required=True)
activity_id = fields.Many2one(
"hotel.housekeeping.activity.... |
import inflect
def test_ancient_1():
p = inflect.engine()
# DEFAULT...
assert p.plural_noun("wildebeest") == "wildebeests"
# "person" PLURALS ACTIVATED...
p.classical(herd=True)
assert p.plural_noun("wildebeest") == "wildebeest"
# OTHER CLASSICALS NOT ACTIVATED...
assert p.plural_noun("f... |
"""
API Errors Jsonified
"""
import logging
from flask import Flask, jsonify, request, g, make_response
from apisrv import app, auth
logger = logging.getLogger(__name__)
@app.errorhandler(404)
def not_found(error=None):
message = {
'status': 404,
'message': 'Not Found: ' + request.url,
}... |
from odoo import models, fields, api, exceptions, _
from datetime import datetime
from dateutil.relativedelta import relativedelta
import logging
NUMBER_OF_UNUSED_MONTHS_BEFORE_EXPIRY = 36
logger = logging.getLogger(__name__)
class AccountBankingMandate(models.Model):
"""SEPA Direct Debit Mandate"""
_inherit = ... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("output", "0004_squashed_41")]
operations = [
migrations.AlterField(
model_name="constraint",
name="weight",
field=models.DecimalField(
decimal_places=8, m... |
from django.contrib import admin
from . import models
@admin.register(models.Role)
class RoleAdmin(admin.ModelAdmin):
search_fields = ['hrid', 'display']
list_display = ['hrid', 'display', 'system']
list_filter = ['system']
class UserAliasInline(admin.TabularInline):
model = models.UserAlias
class Googl... |
from odoo import fields, models, api
import odoo.addons.decimal_precision as dp
from odoo.tools import float_is_zero
from odoo.exceptions import UserError, ValidationError
class Partner(models.Model):
'''查看业务伙伴对账单'''
_inherit = 'partner'
def _init_source_create(self, name, partner_id, category_id, is_init, ... |
import sys
import json
import copy
import sqlalchemy
import config as C
from sqlalchemy.ext.automap import automap_base
from sqlalchemy import create_engine
from sqlalchemy.exc import IntegrityError
from sqlalchemy.sql.expression import ClauseElement
from sqlalchemy.orm import sessionmaker, scoped_session
def remove_du... |
from django.apps import AppConfig
from django.contrib.admin import AdminSite, apps
class SeqrConfig(AppConfig):
name = 'seqr'
class SuperuserAdminSite(AdminSite):
def has_permission(self, request):
return request.user.is_active and request.user.is_superuser
class SuperuserAdminConfig(apps.AdminConfig):
... |
from django.urls import reverse
from wger.core.tests import api_base_test
from wger.core.tests.base_testcase import (
WgerDeleteTestCase,
WgerEditTestCase,
WgerTestCase,
)
from wger.nutrition.models import NutritionPlan
class PlanRepresentationTestCase(WgerTestCase):
"""
Test the representation of a... |
"""Basic type with children typically to create process structures."""
from substanced.folder import Folder
from substanced.util import find_service
from substanced.interfaces import IFolder
from zope.interface import implementer
from zope.deprecation import deprecated
from persistent.mapping import PersistentMapping
i... |
'''
**Purpose**
Module contains functions to manage the database table XFERO_Route
**Unit Test Module:** test_crud_XFERO_Route.py
**Process Flow**
.. figure:: ../process_flow/manage_route.png
:align: center
Process Flow: Manage Route
*External dependencies*
/xfero/
get_conf (/xfero/.db.manage_route)
... |
from openerp.tools.translate import _
from openerp.osv import orm, fields
from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT
import time
import re
class L10nEsAeatReport(orm.Model):
_name = "l10n.es.aeat.report"
_description = "AEAT report base module"
def on_change_company_id(self, cr, uid, ids, comp... |
""" Task file managers """
from abc import ABCMeta, abstractmethod
import codecs
import os.path
from common.base import get_tasks_directory
class AbstractTaskFileManager(object):
""" Manages a type of task file """
__metaclass__ = ABCMeta
def __init__(self, courseid, taskid):
self._courseid = course... |
from __future__ import absolute_import, division, print_function, unicode_literals
"""
sockjs.tornado.transports.jsonp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JSONP transport implementation.
"""
import logging
from tornado.web import asynchronous
from octoprint.vendor.sockjs.tornado import proto
from octoprint.vend... |
from django.apps import apps
from django.db.models import Q
from taiga.base.filters import PermissionBasedFilterBackend
class ContactsFilterBackend(PermissionBasedFilterBackend):
permission = "view_project"
def filter_queryset(self, user, request, queryset, view):
qs = queryset.filter(is_active=True)
... |
from io import BytesIO
from django.apps import apps
from django.core.files import File
from django.db import models
from django.urls import reverse
from django.utils.translation import gettext_lazy as _
from librarian import DocProvider
from librarian.parser import WLDocument as LegacyWLDocument
from librarian.builders... |
"""
Control the sphere's position with the help of a Proportional-Differential (PD)
controller.
Use the ``demo_lockedsphere`` to start Azrael because this controller assumes
there exists a sphere with objID=1 in the scene, and that it has certain
boosters and geometry fragment.
"""
import os
import sys
import time
impo... |
"""add_deflt_dlt_pllstitm
Revision ID: f75b5dfaf06
Revises: 2857a895c068
Create Date: 2016-11-29 18:53:47.033901
"""
revision = 'f75b5dfaf06'
down_revision = '2857a895c068'
from alembic import op
import sqlalchemy as sa
def upgrade():
### commands auto generated by Alembic - please adjust! ###
op.drop_column('c... |
""" Helper functions for actions that operate on accounts.
These could be methods of ImapAccount, but separating them gives us more
flexibility with calling code, as most don't need any attributes of the account
object other than the ID, to limit the action.
Types returned for data are the column types defined via SQLA... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mediacenter', '0014_escape_summary'),
]
operations = [
migrations.AddField(
model_name='document',
name='hidden',
fie... |
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('challenge', '0022_auto_20150930_1608'),
]
operations = [
migrations.RemoveField(
model_name='session',
name='chosen_staff',
... |
import re
from base_widget import BaseWidget
from element_locators import StringWidgetLocators as locators
class StringWidget(BaseWidget):
"""
class to initialize a map widget element
"""
# def init_locators(self):
# self.locators =
def set_text(self, text=''):
input_box = self.root_... |
{
'name': 'Equitania HR Timesheet Begin End Erweiterungen',
'license': 'AGPL-3',
'version': '1.0.2',
'description': """
Equitania Erweiterungen für das HR Timesheet Begin End Modul der OCA
""",
'author': 'Equitania Software GmbH',
'website': 'www.myodoo.de',
'depends': ['hr_times... |
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('unit', '0003_worldunit_owners_debt'),
]
operations = [
migrations.AlterField(
model_name='worldunit',
name='owners_debt',
... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('organization_media', '0015_livestreaming_event_location'),
('organization_network', '0108_merge'),
]
operations = [
... |
from . import test_mrp_supplier_price |
import logging
import cgi
from urllib import urlencode
from pylons import config
import ckan.logic as logic
import ckan.lib.base as base
import ckan.lib.jsonp as jsonp
import ckan.lib.maintain as maintain
import ckan.lib.navl.dictization_functions as df
import ckan.lib.helpers as h
import ckan.model as model
import cka... |
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
setup(name='agenda',
version='1.3.0',
description="",
long_description="",
classifiers=[],
keywords='',
... |
from openerp import fields, models
class HrTrainingCategory(models.Model):
_inherit = "hr.training_category"
pre_survey_ids = fields.Many2many(
string="Pre-Evaluation Survey",
comodel_name="survey.survey",
relation="rel_training_category_pre_survey",
column1="category_id",
... |
""" Test mixins. """
from django.contrib.auth import get_user, get_user_model
from django.urls import reverse
from social_django.models import UserSocialAuth
PASSWORD = 'test'
User = get_user_model()
class LogoutViewTestMixin:
""" Mixin for tests of the LogoutRedirectBaseView children. """
def create_user(self)... |
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('crowdfund', '0017_crowdfund_date_created'),
]
operations = [
migrations.AlterField(
model_name='crowdfund',
name='date_created',
field=models... |
from __future__ import unicode_literals
import django.contrib.postgres.fields.hstore
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('notices', '0007_auto_20161121_0947'),
]
operations = [
migrations.AlterField(
model_name='notice',
... |
{
'name': 'Base Reporting',
'summary': 'Base for reporting ',
'version': '8.0.1.0',
'category': 'Technical Settings',
'website': 'http://clearcorp.cr',
'author': 'ClearCorp',
'license': 'AGPL-3',
'sequence': 10,
'application': False,
'installable': True,
'auto_install': False... |
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('accounts', '0020_optional_group_instituion'),
('exams', '0095_group_level'),
]
operations = [
migrations.AddFiel... |
"""XML-RPC API to the application roots."""
__metaclass__ = type
__all__ = [
'ISelfTest',
'PrivateApplication',
'SelfTest',
]
import xmlrpclib
from zope.component import getUtility
from zope.interface import (
implements,
Interface,
)
from lp.bugs.interfaces.malone import IPrivateMaloneAppli... |
from comics.aggregator.crawler import ComicsKingdomCrawlerBase
from comics.core.comic_data import ComicDataBase
class ComicData(ComicDataBase):
name = "Dustin"
language = "en"
url = "https://www.comicskingdom.com/dustin"
start_date = "2010-01-04"
rights = "Steve Kelley & Jeff Parker"
class Crawler(C... |
__author__ = 'Dom Barnett'
import random
import string
from lib import get_or_create_driver
class Register_and_login():
#def __init__(self):
def register_and_login(self):
first_name = ''.join(random.choice(string.ascii_lowercase) for _ in range(5))
surname = ''.join(random.choice(string.ascii_lo... |
'''
Wraps shell commands and sends the result to Datadog as events. Ex:
dogwrap -n test-job -k $API_KEY --submit_mode all "ls -lah"
Note that you need to enclose your command in quotes to prevent python
from thinking the command line arguments belong to the python command
instead of the wrapped command.
You can also ha... |
"""
Declaration of CourseOverview model
"""
import json
import logging
from urlparse import urlparse, urlunparse
from django.db import models, transaction
from django.db.models.fields import BooleanField, DateTimeField, DecimalField, TextField, FloatField, IntegerField
from django.db.utils import IntegrityError
from dj... |
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('attribution', '0013_auto_20220106_0904'),
('attribution', '0011_auto_20220105_1305'),
]
operations = [
] |
import os
import sys
import logging
import openerp
import openerp.netsvc as netsvc
import openerp.addons.decimal_precision as dp
from openerp.osv import fields, osv, expression, orm
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
from openerp import SUPERUSER_ID, api
from opene... |
from odoo import api, models
from odoo.addons.queue_job.job import job
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
@api.multi
@job
def modify_open_invoice(self, vals):
"""
Job for changing an open invoice with new values. It will put it back
in draft, modifiy... |
from odoo.exceptions import UserError
from odoo.tests.common import Form
from odoo.addons.account_invoice_inter_company.tests.test_inter_company_invoice import (
TestAccountInvoiceInterCompanyBase,
)
class TestPurchaseSaleInterCompany(TestAccountInvoiceInterCompanyBase):
@classmethod
def setUpClass(cls):
... |
"""This file is part of DING0, the DIstribution Network GeneratOr.
DING0 is a tool to generate synthetic medium and low voltage power
distribution grids based on open data.
It is developed in the project open_eGo: https://openegoproject.wordpress.com
DING0 lives at github: https://github.com/openego/ding0/
The document... |
"""
storlever_megaraid.app
~~~~~~~~~~~~~~~~
storlever_megaraid's main file to extend the rest api of storlever
:copyright: (c) 2014 by OpenSight (www.opensight.cn).
:license: AGPLv3, see LICENSE for more details.
"""
def main(config):
# route and view configuration of REST API version 1 can be found in module storl... |
from builtins import map
from builtins import range
import errno
import os
import socket
import threading
from django.core.exceptions import ImproperlyConfigured
from django.db import connections
from django.test.testcases import TransactionTestCase
from tornado.ioloop import IOLoop
from tornado.platform.asyncio import... |
"""
Django settings for Helfertool.
"""
import os
import socket
import sys
import yaml
from django.utils.translation import ugettext_lazy as _
from datetime import timedelta
from pathlib import Path
from .utils import dict_get, build_path, get_version, pg_trgm_installed
BASE_DIR = Path(__file__).resolve().parent.parent... |
from io import StringIO
import logging
import os
from django.contrib.auth.decorators import login_required
from django.core.management import call_command
from django.http import Http404, HttpResponse
from django.utils.decorators import method_decorator
from django.views.generic import View, ListView, TemplateView
from... |
"""
All urls for philu_courseware app
"""
from django.conf import settings
from django.conf.urls import url
from .views import CompetencyAssessmentAPIView, RevertPostAssessmentAttemptsAPIView
urlpatterns = [
url(r'^api/competency_assessment/(?P<chapter_id>[a-z0-9]+)/$',
CompetencyAssessmentAPIView.as_view()... |
import sys
sys.path.append('/home/subha/src/moose/pymoose')
import moose
from math import *
dt = 1e-5
context = moose.PyMooseBase.getContext()
def setup(container='/', dt=1e-5):
comp = moose.Compartment('comp')
print comp.path
comp.length = 20e-6
comp.diameter = 2 * 7.5e-6
comp.xarea = pi * comp.dia... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.