src
stringlengths
721
1.04M
import datetime from ert.test import ExtendedTestCase from ert_gui.plottery import PlotStyle, PlotConfig, PlotLimits class PlotStyleTest(ExtendedTestCase): def test_plot_style_test_defaults(self): style = PlotStyle("Test") self.assertEqual(style.name, "Test") self.assertEqual(style.colo...
from __future__ import division import hashlib import os import random import sys import time from twisted.python import log import p2pool from p2pool.bitcoin import data as bitcoin_data, script, sha256 from p2pool.util import math, forest, pack # hashlink hash_link_type = pack.ComposedType([ ('state', pack.Fi...
#!/usr/bin/env python3 # @Time : 17-9-2 01:53 # @Author : Wavky Huang # @Contact : master@wavky.com # @File : job.py """ Process information of the job. """ class Job: def __init__(self, required_manhour=0, daily_work_hours=0, hourly_pay=0, max_daily_overhours=0): """ Define your job's con...
# -*- coding: utf-8 -*- 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): # Adding model 'Report' db.create_table(u'issues_report', ( (...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
#!/usr/bin/env python # Copyright 2005-2010 Wesabe, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
#!/usr/bin/python """ HeaderID Extension for Python-Markdown ====================================== Adds ability to set HTML IDs for headers. Basic usage: >>> import markdown >>> text = "# Some Header # {#some_id}" >>> md = markdown.markdown(text, ['headerid']) >>> md u'<h1 id="som...
#!/usr/bin/python import unittest """ NOTES ----- In order to run the tests, you have to enter in your login credentials for either MySQL or PostgreSQL. Then, you can run either one of the following commands from the root directory $ sudo python setup.py test $ nosetests You can enter in manual test data below in th...
#!/usr/bin/env python # test_telnet.py import telnetlib import time import socket import sys TELNET_PORT=23 TELNET_TIMEOUT=6 def telnet_connect(ip_addr, TELNET_PORT, TELNET_TIMEOUT): try: return telnetlib.Telnet(ip_addr, TELNET_PORT, TELNET_TIMEOUT) except socket.timeout: sys.exit("Connection...
#!/usr/bin/env python """ DragonPy - Dragon 32 emulator in Python ======================================= :copyleft: 2013-2015 by the DragonPy team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more details. """ from __future__ import absolute_import, division, print_f...
# Test of Wall reflection side test # Copyright (C) 2019 Robin Scheibler, Cyril Cadoux # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the...
# -*- coding: utf-8 -*- # Generated by Django 1.10.2 on 2016-12-03 18:18 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_depende...
"""Majordomo Protocol Client API, Python version. Implements the MDP/Worker spec at http:#rfc.zeromq.org/spec:7. Author: Min RK <benjaminrk@gmail.com> Based on Java example by Arkadiusz Orzechowski """ import logging import zmq import MDP from zhelpers import dump class MajorDomoClient(object): """Majordomo P...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, api from odoo.addons import iap class IapEnrichAPI(models.AbstractModel): _name = 'iap.enrich.api' _description = 'IAP Lead Enrichment API' _DEFAULT_ENDPOINT = 'https://iap-services...
from __future__ import print_function import aaf import aaf.mob import aaf.define import aaf.iterator import aaf.dictionary import aaf.storage import aaf.component import aaf.util import traceback import unittest import os from aaf.util import AUID, MobID cur_dir = os.path.dirname(os.path.abspath(__file__)) sandbox...
#!/usr/bin/env python # coding: UTF-8 from __future__ import division import latex_logger class LaTeXError(Exception): """ LaTeX Error """ class Processor(object): """ Models an object with a logger and some options. General options: - colour - debug """ def __init__(self, logger=None, options=None): ...
import datetime import cgi from bson.objectid import ObjectId from helper_functions import * class Post: def __init__(self, default_config): self.collection = default_config['POSTS_COLLECTION'] self.response = {'error': None, 'data': None} self.debug_mode = default_config['DEBUG'] de...
import logging log = logging.getLogger(__name__) import random import re import botologist.plugin class Bitcoin: currencies = ( 'Razielcoins', 'bitcoins', 'cmd.exe resizes', 'scotweb extortions', 'warp-in staplers', 'dead Palestinian children', 'typematrix keyboards', 'marble eggs in a shitty condom', 'clean...
#Script written for Python 2.7 #Dependencies to download: pyodbc (SQL Server Drivers) import pyodbc import datetime import sys import re from contextlib import contextmanager LATE_CASES = {} @contextmanager def get_connection(): """ Connect to DB """ cnxn = pyodbc.connect('DRIVER={SQL SERVER};SER...
import numpy as np class KNearestNeighbor(object): """ a kNN classifier with L2 distance """ def __init__(self): pass def train(self, X, y): """ Train the classifier. For k-nearest neighbors this is just memorizing the training data. Inputs: - X: A numpy array of shape (num_train, D) ...
# ############################################################################ # |W|I|D|E|I|O|L|T|D|W|I|D|E|I|O|L|T|D|W|I|D|E|I|O|L|T|D|W|I|D|E|I|O|L|T|D| # Copyright (c) WIDE IO LTD # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that...
import glob import os import os.path as osp import re import chainer import numpy as np import scipy.misc from sklearn.model_selection import train_test_split from base import APC2016DatasetBase class APC2016rboDataset(APC2016DatasetBase): def __init__(self, data_type): assert data_type in ('train', 'v...
# # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not...
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
__source__ = 'https://leetcode.com/problems/unique-word-abbreviation/description/' # https://github.com/kamyu104/LeetCode/blob/master/Python/unique-word-abbreviation.py # Time: ctor: O(n), n is number of words in the dictionary. # lookup: O(1) # Space: O(k), k is number of unique words. # # Description: Leetc...
""" multiplication-table.py Author: Sarah Dunbar Credit: http://stackoverflow.com/questions/12102749/how-can-i-suppress-the-newline-after-a-print-statement, https://docs.python.org/3.3/library/functions.html#print, Mr. Dennison Assignment: Write and submit a Python program that prints a multiplication table. The user ...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may ...
""" memd - memcached decorator for lazy developers (like me) usage: # simple @memd() def foo(bar): return bar # with custom key @memd(custom_key="yourkey") def foo(bar): return bar # or with ttl @memd(ttl=100) def foo(bar): return bar """ impo...
import csv import logging from functools import partial from itertools import starmap from django.core.exceptions import ValidationError from django.core.management.base import BaseCommand from django.core.management.base import CommandError from django.db import transaction from kolibri.core.auth.models import Class...
from collections import defaultdict from ray.dashboard.util import to_unix_time, format_reply_id from base64 import b64decode import ray import threading import json import traceback import copy import logging from datetime import datetime import time from typing import Dict import re from operator import itemgetter ...
from flask import jsonify from logging import Logger from typing import Any, AnyStr, Dict from pbench.server import PbenchServerConfig from pbench.server.api.resources.query_apis import ( ElasticBase, Schema, Parameter, ParamType, PostprocessError, ) class ControllersList(ElasticBase): """ ...
from flask import session, Blueprint from lexos.helpers import constants as constants from lexos.managers import session_manager as session_manager from lexos.models.k_means_model import KMeansModel from lexos.views.base import render k_means_blueprint = Blueprint("k-means", __name__) @k_means_blueprint.route("/k-me...
import sqlite3 import urllib import re from urllib.request import urlopen from bs4 import BeautifulSoup from phyllo.phyllo_logger import logger def main(): # Case 1: Sections split by numbers (Roman or not) followed by a period, or bracketed. Subsections split by <p> tags def parsecase1(ptags, c, collti...
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may n...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
import pytest from pbench.server.database.models.tracker import ( Dataset, States, Metadata, DatasetBadParameterType, DatasetBadStateTransition, DatasetTerminalStateViolation, DatasetNotFound, MetadataNotFound, MetadataBadKey, MetadataMissingKeyValue, MetadataDuplicateKey, ) ...
from sandbox.rocky.tf.q_functions.base import QFunction import numpy as np from rllab.core.serializable import Serializable from sandbox.rocky.tf.core.layers_powered import LayersPowered from sandbox.rocky.tf.core.layers import batch_norm from sandbox.rocky.tf.policies.base import StochasticPolicy from sandbox.rocky.t...
# Copyright 2017 Veritas Technologies, LLC All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appli...
# Copyright (c) 2012 Terence Honles <terence@honles.com> (maintainer) # Copyright (c) 2008 Giorgos Verigakis <verigak@gmail.com> (author) # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above # copyright notice and this permiss...
# Copyright 2009 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
#!/usr/bin/env python3 # -*- coding=utf-8 -*- """ crystailio ---------- Read a CRYSTAL output file and export all structures, SCF energies and convergence data. """ __author__ = "Germain Vallverdu" __email__ = "germain.vallverdu@univ-pau.fr" __licence__ = "GPL" import re import numpy as np from pymatgen import Stru...
# Copyright 2017, David Wilson # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # 2....
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'radtrack/ui/rbcbt.ui' # # Created: Thu Jun 16 05:40:41 2016 # by: PyQt4 UI code generator 4.11.3 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QString.fromUtf8 exc...
"""Trigger entity.""" from __future__ import annotations import logging from typing import Any from homeassistant.const import ( CONF_DEVICE_CLASS, CONF_ENTITY_PICTURE_TEMPLATE, CONF_FRIENDLY_NAME, CONF_FRIENDLY_NAME_TEMPLATE, CONF_ICON_TEMPLATE, CONF_UNIQUE_ID, CONF_UNIT_OF_MEASUREMENT, ...
# !/usr/bin/python # -*- coding: utf-8 -*- ''' Created on Oct 10, 2012 @author: Bo Zhao @email: Jakobzhao@gmail.com @website: http://yenching.org @organization: The Ohio State University ''' import sqlite3 import networkx as nx import matplotlib.pyplot as plt plt.rcParams['font.sans-serif'] = ['M...
# -ProblemSet2.py *- coding: utf-8 -*- """ Each problem will be a function to write. Remember that you can execute just the code between the #%% signs by clicking somewhere in that space and the using Ctrl-Enter (Cmd-Enter on Mac). An alternative is to use the second toolbar green triangle or Menu>Run>Run c...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 Justin Santa Barbara # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apach...
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'new.ui' # # Created: Fri Aug 15 21:30:13 2014 # by: PyQt4 UI code generator 4.10.4 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui import sys from os import getcwd, listdir from os.path import j...
import requests # Used to make HTTP requests import json # Used to parse JSON import os # Used to infer environment variables API_TAGO = os.environ.get('TAGO_API') or 'https://api.tago.io' REALTIME = os.environ.get('TAGO_REALTIME') or 'https://realtime.tago.io' class Notifications: def __init__(self, acc_token)...
""" Load multiple pp diagnostic files, aggregate by year, day etc, calcualte mean, sum etc and save """ import os, sys import datetime import iris import iris.unit as unit from iris.coord_categorisation import add_categorised_coord import pdb diag = '_temp_on_p_levs' pp_file_path='/nfs/a90/eepdw/Data/EMBRACE/' ex...
# This file is part of Shuup. # # Copyright (c) 2012-2016, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the AGPLv3 license found in the # LICENSE file in the root directory of this source tree. import abc import six from shuup.apps.provides import get_provide_objects from shuup.cor...
# -*- coding: utf-8 -*- """ readability.models ~~~~~~~~~~~~~~~~~~ This module provides the core Readability API models. """ from .helpers import to_python, to_api class BaseResource(object): """A Base BaseResource object.""" def __init__(self): super(BaseResource, self).__init__() self._rd...
# Copyright (c) 2020 Dell Inc. or its subsidiaries. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
############################################################ ############# Plotting File for Contour Plots ############## ################## Data read from Cloudy ################### ################ Helen Meskhidze, Fall 2015 ################ #################### Elon University ####################### #--------------...
from math import floor, log10 from odoo import api, models class CRMHelpers(models.Model): _name = 'crm.iap.lead.helpers' _description = 'Helper methods for crm_iap_lead modules' @api.model def notify_no_more_credit(self, service_name, model_name, notification_parameter): """ Notify a...
# Copyright 2014 Diamond Light Source Ltd. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed t...
# ============================================================================== # Copyright 2019 - Philip Paquette # # NOTICE: Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the "Software"), # to deal in the Software without rest...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module Copyright (C) 2012-2014 OpenUpgrade community # https://launchpad.net/~openupgrade-committers # # Contributors: # Therp BV <http://therp.nl> # ...
"""py.test hacks to support XFAIL/XPASS""" # XXX this should be integrated into py.test # XXX but we can't force everyone to install py-lib trunk import sys try: # functools is not available in Python 2.4 import functools except ImportError: has_functools = False else: has_functools = True try: #...
# encoding=utf8 from parser.Calendar import Calendar from parser.Definitions import Definitions import logging import datetime import csv import sys #====================================================================================== # This file contains classes to help on the organization of the files. The basic ...
import json from django.db import connections, connection from django.conf import settings __all__ = ['SQLDebugMiddleware'] class SQLDebugMiddleware(object): def process_response(self, request, response): if not settings.DEBUG: return response if request.is_ajax(): if r...
import random import string import sys armel_defaults = { "arch": "armel", "size": "20G", "mem": "256", "interpreter": "qemu-system-arm", "userinterpr": "qemu-arm-static", "console": "ttyAMA0,115200n1", "machine": "versatile...
""" Various global variables """ import os PROG_NAME = "gBuilder" PROG_VERSION = "3.0.0" GINI_ROOT = os.environ["GINI_ROOT"] GINI_HOME = os.environ["GINI_HOME"] environ = {"os":"Windows", "path":GINI_ROOT+"/", "remotepath":"./", "images":os.environ["GINI_SHARE"] +"/gbuilder/images/"...
from model import * from draw import * from naive_baseline import * from quicksort import * # ------------- helpers -------------- def get_id_map(start_sort, truth): ret = dict(zip(start_sort, truth)) return ret def pred_acc(preds, qry): num_cor = 0 ...
# coding=utf-8 """ This module provides functions for working with template fields. """ import re from typing import Iterator class TemplateField: # pylint: disable=too-few-public-methods """ Represents a field in a template. """ def __init__(self, name: str=None, contex...
from django.conf.urls import url from django.contrib import admin from game import views from game.method import in_room from game.method import user, in_game, ready_game urlpatterns = [ url(r'^admin', admin.site.urls), # 系统自带 url(r'^$', views.room_select), # 首页 url(r'^room', views.room), # 游戏页面 ur...
from fauxfactory import gen_string from robottelo.config import settings from robottelo.constants import ( OSCAP_PERIOD, OSCAP_PROFILE, OSCAP_WEEKDAY, ) from robottelo.datafactory import invalid_values_list, valid_data_list from robottelo.decorators import skip_if_bug_open, tier1 from robottelo.helpers impo...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2012 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # no...
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test proper accounting with malleable transactions # from test_framework import BitcoinTestFramework from...
# -*- coding: utf-8 -*- """ Created on Sat Nov 18 12:27:16 2017 @author: Stefan Peidli This script reads sgf files from a file directory, converts them into pairs of "current board - next move" and stores them either in a dictionary or in a sqlite3 database. """ import os from collections import defaultdict from Boa...
#!/usr/bin/env python import os import argparse import json import subprocess import urllib2 import getpass import socket import psutil from simocollector.sender import BaseObjectSender, BaseMultiObjectSender from simocollector.collectors import system_info_collector from simocollector.utils import slugify CRON_JOB_...
"""Test identifiers""" import json from flask_webtest import SessionScope import pytest from werkzeug.exceptions import Conflict from portal.extensions import db from portal.models.identifier import Identifier from portal.models.user import User from tests import TEST_USER_ID, TestCase class TestIdentifier(TestCas...
# -*- coding: utf-8 -*- # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software ...
from __future__ import absolute_import, unicode_literals from itertools import count from kombu.transport import base from kombu.utils import json class Message(base.Message): def __init__(self, *args, **kwargs): self.throw_decode_error = kwargs.get('throw_decode_error', False) super(Message, s...
from reference import Reference from git.config import SectionConstraint from git.util import join_path __all__ = ["Head"] class Head(Reference): """The GitPyhton Head implementation provides more git-command based features A Head is a named reference to a Commit. Every Head instance contains a name and a Commit...
#!/usr/bin/env python3 # # Copyright (c) 2015 - 2021, Intel Corporation # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, th...
################################################################################ """ Functions for Digit Recognition Created on Wed Jun 01 00:00:00 2016 @author: Prasun Roy @e-mail: prasunroy.pr@gmail.com """ ################################################################################ # import modules import ma...
from multiprocessing import Process, Pipe from os import getpid, urandom, path from time import sleep from enum import Enum import binascii, json, signal, sys from random import randint from telegram.ext import Updater from telegram.ext.dispatcher import run_async from telegram.update import Update class Command(Enum...
#!/usr/bin/env python """ The MIT License (MIT) Copyright (c) 2017 LeanIX GmbH Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use,...
import RPi.GPIO as GPIO import time import sys from hx711 import HX711 def cleanAndExit(): print ("Cleaning...") GPIO.cleanup() print("Bye!") sys.exit() hx = HX711(5, 6) # I've found out that, for some reason, the order of the bytes is not always the same between versions of python, numpy and the hx7...
# -*- coding: utf-8 -*- # #################################################################### # Copyright (C) 2005-2009 by the FIFE team # http://www.fifengine.de # This file is part of FIFE. # # FIFE is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General P...
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # # Code generated by Microsoft (R) AutoRest Code Generator. # Changes ...
"""Main module.""" from __future__ import print_function import argparse import logging import os import re import socket import sys import camacq.bootstrap as bootstrap import camacq.config as config_util from camacq.const import (CONFIG_DIR, COORD_FILE, END_10X, END_40X, END_63X, FIELDS_X,...
# -*- coding: utf-8 -*- # #################################################################### # Copyright (C) 2005-2013 by the FIFE team # http://www.fifengine.net # This file is part of FIFE. # # FIFE is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public #...
from django.db import models from django.contrib.auth.models import User from django.core.urlresolvers import reverse class RichTextField(models.TextField): pass class Post(models.Model): internal_title = models.CharField(max_length=255) display_title = models.CharField(null=True, blank=True, max_length=2...
# Definition for singly-linked list: # class ListNode(object): # def __init__(self, x): # self.value = x # self.next = None # def isListPalindrome(l): tmp = l list_len = 0 left = 0 right = 0 while tmp: list_len += 1 tmp = tmp.next tmp = l if list_len == 0 or ...
# -*- coding: utf-8 -*- # __author__ = chenchiyuan from __future__ import division, unicode_literals, print_function from django.db import models from libs.models.models import SingletonModel from django.conf import settings from libs.uuids import get_uuid import requests import json class App(SingletonModel): ...
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright (c) 2011 X.commerce, a business unit of eBay Inc. # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (t...
#!/usr/bin/env python """ Copyright 2012 GroupDocs. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable...
from pathlib import Path import csv import random from ..util import get_file from .._registry import register_loader # DBPedia Ontology from https://course.fast.ai/datasets DBPEDIA_ONTOLOGY_URL = "https://s3.amazonaws.com/fast-ai-nlp/dbpedia_csv.tgz" @register_loader("dbpedia") def dbpedia(loc=None, *, train_limi...
# Copyright (c) Jupyter Development Team. # Distributed under the terms of the Modified BSD License. import mimetypes from .widget_core import CoreWidget from .domwidget import DOMWidget from .valuewidget import ValueWidget from .widget import register from traitlets import Unicode, CUnicode, Bool from .trait_types i...
import pickle def parse_aaf_header(header_path, dest_path=None): if not dest_path: dest_path = 'docs.pkl' f = open(header_path, 'r') header = f.read() f.close() comments = "" interface = {} current = None for line in header.splitlines(): ...
from flask import Flask from flask_sqlalchemy import SQLAlchemy import os NAMESPACE = 'inv' app = Flask(__name__) app.config['SECRET_KEY'] = '123456790' app.config['DATABASE_FILE'] = 's0inv.sqlite' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + app.config['DATABASE_FILE'] app.config['SQLALCHEMY_TRACK_MODIFICA...
# -*- coding: utf-8 -*- # # gPrime - A web-based genealogy program # # Copyright (C) 2003-2005 Donald N. Allingham # Copyright (C) 2008 Brian G. Matherly # # This program 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 Soft...
# Authors: # Tomas Babej <tbabej@redhat.com> # # Copyright (C) 2014 Red Hat # see file 'COPYING' for use and warranty information # # This program 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 vers...
""" Doctest example from the official Python documentation. https://docs.python.org/3/library/doctest.html """ def factorial(n): """Return the factorial of n, an exact integer >= 0. >>> [factorial(n) for n in range(6)] [1, 1, 2, 6, 24, 120] >>> factorial(30) 265252859812191058636308480000000 >...
import unittest import os import shutil import json import time import requests_mock import glob import logging from tubeup.TubeUp import TubeUp, DOWNLOAD_DIR_NAME from tubeup import __version__ from youtube_dl import YoutubeDL from .constants import info_dict_playlist, info_dict_video current_path = os.path.dirname...
# coding: utf8 # Author: Rodrigo Bistolfi # Date: 03/2013 """ Test cases for Nikola ReST extensions. A base class ReSTExtensionTestCase provides the tests basic behaviour. Subclasses must override the "sample" class attribute with the ReST markup. The sample will be rendered as HTML using publish_parts() by setUp(). ...
# ./sedater/plotter/main.py # Author: Ulli Goschler <ulligoschler@gmail.com> # Modified: Thu, 10.12.2015 - 20:25:10 import sys,os sys.path.insert(0, os.getcwd()) import re from sedater.plotter.options import CLIParser from sedater.plotter.plotter import Plotter if __name__ == "__main__": cli = CLIParser() ...
# -*- coding: utf-8 -*- import os def _recreate_job_check(old, new): old_cls = old.splitlines()[-1] new_cls = new.splitlines()[-1] return old_cls != new_cls def present(name, source, template=None, context=None): update_or_create_xml = __salt__['jenkins.update_or_create_xml'] # noqa get_file_s...