src
stringlengths
721
1.04M
#! /usr/bin/env python # -*- coding: utf-8 -*- import logging.handlers import configparser import re import time handler = logging.handlers.TimedRotatingFileHandler(filename="test", when='s', interval=2, backupCount=5, encoding='UTF-8') handler.suffix = '%Y-%m-%d-%H-...
#!/usr/bin/env python # -*- coding: iso-8859-15 -*- import re from google.appengine.api import users from google.appengine.ext import webapp from google.appengine.api.urlfetch import DownloadError from library import logins3 class BucketVerzeichnisErzeugen(webapp.RequestHandler): def post(self): mobile ...
from collections import Counter from itertools import combinations from ..library.number_theory.primes import is_prime, prime_sieve from ..library.base import list_to_number, number_to_list def solve() -> int: primes = prime_sieve(1_000_000) for prime in primes: if prime < 100_000: conti...
#!/usr/local/bin/python ''' nje_limbcorr_v2 Author: Nicholas J. Elmer Department of Atmospheric Science, University of Alabama in Huntsville (UAH) NASA Short-term Prediction Research and Transition (SPoRT) Center Huntsville, Alabama, USA nicholas.j.elmer@nasa.gov Version: 2.0 (Last updated June 2016) Note: The...
from django.core.validators import MinValueValidator, MaxValueValidator from django.db import models from edc_constants.choices import YES_NO, GENDER from .infant_crf_model import InfantCrfModel class InfantBirthData(InfantCrfModel): """ A model completed by the user on the infant's birth exam. """ infant_...
# -*- coding: utf-8 -*- # # # Author: Alexandre Fayolle # Copyright 2013 Camptocamp SA # # Author: Damien Crier # Copyright 2015 Camptocamp SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the...
""" Support for the Amazon Polly text to speech service. For more details about this component, please refer to the documentation at https://home-assistant.io/components/tts.amazon_polly/ """ import logging import voluptuous as vol from homeassistant.components.tts import PLATFORM_SCHEMA, Provider import homeassista...
''' Created on Sep 28, 2012 @author: garcia ''' import unittest from pyevodyn import symbolic, numerical from sympy.matrices import Matrix import numpy as np class Test(unittest.TestCase): def setUp(self): pass def tearDown(self): pass def test_stationary_distribution(self): for...
#!/usr/bin/python import argparse import json import shutil import os def copy_file(src, dest, backup): success = True if not backup is None: (backup_folder, backup_file) = os.path.split(backup) print("Creating backup file for " + dest + " at " + backup) try: if not os.path.exists(backup_folder): os.ma...
''' ################################################################ # # Python script to manage netflow log and export files # ################################################################ ''' import datetime import os import sys BASE_DIR = '/opt/netflow' CONFIG_FILE = 'listener.conf' def get_config_file(): ...
""" shell sort tests module """ import unittest import random from sort import shell from tests import helper class ShellSortTests(unittest.TestCase): """ shell sort unit tests class """ max = 100 arr = [] def setUp(self): """ setting up for the test """ self.arr = random.sample(ran...
""" uhdl.structures ~~~~~~~~~~~~~~~ Data structures(unrelated to hardware description) used internally by uhdl. """ import collections def _dictrepr(instance, store): name = instance.__class__.__name__ return '{name}({store})'.format(name=name, store=store) class DictRef(object): def __init__(self, st...
#!/usr/local/bin/python3 '''simple brightness controller for Chrubix ''' import sys import os # import hashlib from chrubix.utils import logme, read_oneliner_file # from chrubix import save_distro_record, load_distro_record try: from PyQt4.QtCore import QString except ImportError: QString = str TIME_BETW...
# Copyright 2013,2014 Music Technology Group - Universitat Pompeu Fabra # # This file is part of Dunya # # Dunya is free software: you can redistribute it and/or modify it under the # terms of the GNU Affero General Public License as published by the Free Software # Foundation (FSF), either version 3 of the License, or...
import pymongo from pymongo import MongoClient, MongoReplicaSetClient, uri_parser __all__ = ['ConnectionError', 'connect', 'register_connection', 'DEFAULT_CONNECTION_NAME'] DEFAULT_CONNECTION_NAME = 'default' class ConnectionError(Exception): pass _connection_settings = {} _connections = {} _dbs ...
""" Helper functions, OS agnostic @author: Roy Nielsen """ #--- Native python libraries import re import os import sys import time import ctypes import traceback from subprocess import Popen, STDOUT, PIPE try: import termios except: pass #--- non-native python libraries in this source tree from . loggers imp...
#MenuTitle: Show Kerning Pairs Exception # -*- coding: utf-8 -*- __doc__=""" Show Kerning Exception Pairs for this glyph in a new tab. """ import GlyphsApp thisFont = Glyphs.font Doc = Glyphs.currentDocument selectedLayers = thisFont.selectedLayers namesOfSelectedGlyphs = [ l.parent.name for l in selectedLayers if ha...
"""In-memory representation of interfaces and other data structures. The objects in this module are used to build a representation of an XML interface file in memory. @see: L{reader} constructs these data-structures @see: U{http://0install.net/interface-spec.html} description of the domain model @var defaults: Defau...
""" A library containing atom widths, atomic numbers, etc. """ import nomad.math.constants as constants atom_name = ['X', 'H', 'D', 'T', 'He', 'Li', 'Be', 'B', 'C', 'N', 'O', 'F', 'Ne', 'Na', 'Mg', 'Al', 'Si', 'P', 'S', 'Cl', 'Ar'] atom_width = [0.0, 4.5, 4.5, 4.5, 0.0, 0.0, 0.0, 0.0, 22.5, 19.5, 13.0,...
#!/usr/bin/env python # coding:utf-8 import errno import time import struct import zlib import functools import re import io import string import socket import ssl import httplib import Queue import urlparse import threading from proxy import xlog from connect_manager import https_manager from appids_manager import ...
import unittest import numpy as np import atomic_neu as atomic class TestAtomicData(unittest.TestCase): def test_element_data_names_abbreviated_and_long(self): """This does not require that the user has downloaded data""" data1 = atomic.atomic_data._element_data('Li') data2 = atomic.atomic_...
# -*- coding: utf-8 -*- # # inventory/categories/api/serializers.py # """ Category serializers. """ __docformat__ = "restructuredtext en" import logging from collections import OrderedDict from django.contrib.auth import get_user_model from django.utils.translation import gettext_lazy as _ from rest_framework import...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ | This file is part of the web2py Web Framework | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) This file specifically includes utilities for security. ---------------------------------------------...
# ------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- import thr...
import argparse import sys import os import locale import re import ConfigParser class Config(object): def __init__(self, argv): self.version = "0.5.4" self.rev = 2054 self.argv = argv self.action = None self.config_file = "zeronet.conf" self.createParser() ...
class FormNabarRoleAdmin(Form): def __init__(self, data = None, items = None, post = None, **args): if data is None: data = {} if post is None: post = {} if 'id' not in data: data['id'] = 'FormNabarRoleAdmin' super().__init__(data, items, **args) set = self.add('FieldSet', { 'id' : 'set', '...
import networkx import pyvex from .slicer import SimSlicer class Blade(object): """ Blade is a light-weight program slicer that works with networkx DiGraph containing CFGNodes. It is meant to be used in angr for small or on-the-fly analyses. """ def __init__(self, graph, dst_run, dst_stmt_idx, d...
''' 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 use this ...
# -*- Mode: Python -*- # GObject-Introspection - a framework for introspecting GObject libraries # Copyright (C) 2014 Chun-wei Fan # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; eithe...
__author__ = 'hfriedrich' import sys import codecs import numpy as np from scipy.sparse import csr_matrix from scipy.io import mmwrite # simple script that creates a categoryslice.mtx including a new headers file from the headers.txt file and the # categorized needs in the allneeds.txt file. import logging logging.b...
def _(a_string): return a_string var_1=_('How can I find my server URL?') var_2=_('The server URL is the adress that you can see in your browser when accessing Pydio via the web.') var_3=_('It starts with http or https depending on your server configuration.') var_4=_('If you are logged in Pydio and you see the last pa...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Select lines randomly from source matrix and generate files. PREPARATION: ------------ You need two files: 1. data.csv data.csv is csv file that contains the data matrix. WARNING: only data, not any header. group_1 ...
# train_classifier.py import os import re import codecs from classifier import Classifier TRAINING_FILE = "assignment2/pnp-train.txt" VALIDATE_FILE = "assignment2/pnp-validate.txt" TEST_FILE = "assignment2/pnp-test.txt" TRAINING_FILE_OUTPUT = 'trained.json' TOKEN_REGEX = r"." TOKEN_PATTERN = re.compile(TOKEN_REGEX)...
import json import logging import traceback import pprint import socket import time from smtplib import SMTPException from django.core.mail import mail_admins from django.db import transaction from oioioi.contests.models import Contest, ProblemInstance, Submission, \ SubmissionReport, FailureReport logger = lo...
#!/usr/bin/env python # -*- coding: utf-8 -*- from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import * import os import re import ast from ub import config import ub session = None cc_exceptions = ['datetime', 'int', 'comments', 'float', 'composite', 'series'] cc_c...
# Copyright 2019 The gRPC Authors # # 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 writ...
import numpy as np import xarray as xr from tinamit.config import _ class Variable(object): """La clase más general para variables de modelos en Tinamït.""" def __init__(símismo, nombre, unid, ingr, egr, inic=0, líms=None, info=''): """ Parameters ---------- nombre: str ...
""" Implementation the PayPal processor. To enable this implementation, add the following to lms.auth.json: CC_PROCESSOR_NAME = "PayPal" CC_PROCESSOR = { "PayPal": { "PURCHASE_ENDPOINT": "sandbox or live url of paypal", "CLIENT_ID": "<paypal client_id>", "CLIENT_SEC...
## # Copyright 2009-2016 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), # Flemish Research Foundation ...
import os import pickle from io import BytesIO from sigal import init_plugins from sigal.gallery import Gallery from sigal.plugins.encrypt import endec from sigal.plugins.encrypt.encrypt import cache_key CURRENT_DIR = os.path.dirname(__file__) def get_key_tag(settings): options = settings["encrypt_options"] ...
# Copyright (c) 2005-2008 The Regents of The University of Michigan # All rights reserved. # # 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, this ...
# -*- coding: utf-8 -*- # Generated by Django 1.9.3 on 2016-03-10 07:40 from __future__ import unicode_literals import django.contrib.auth.models import django.core.validators from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('...
# _*_ coding: utf_8 _*_ # @COPYRIGHT_begin # # Copyright [2010_2013] Institute of Nuclear Physics PAN, Krakow, Poland # # 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.apac...
# Django settings for What2Watch project. import os SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') DEBUG = True TEMPLATE_DEBUG = DEBUG ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) LOGIN_URL = '/' ADMINS = ( # ('Your Name', 'your_email@example.com'), ) MANAGERS = ADMINS DATABASES = ...
# -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. import werkzeug from odoo import api, models def urlplus(url, params): return werkzeug.Href(url)(params or None) class Partner(models.Model): _name = 'res.partner' _inherit = ['res.partner', 'website.pub...
# adress by default MAX_PACKET_LEN = 1036 BUFFER_SIZE = 1024 sample_per_packet =256 header_size = 12 frame_header = [('type', 'uint16'), ('length', 'uint16'), ('packet_num', 'uint32'), ('option', 'uint32') ...
import time import pyreclab if __name__ == '__main__': model = pyreclab.IFAls( factors = 50, dataset = 'dataset/u1.base', dlmchar = b'\t', header = False, usercol = 0, itemcol = 1,...
#!/usr/bin/env python # -*- coding: utf-8 -*- # # @Author: Brian Cherinka, José Sánchez-Gallego, and Brett Andrews # @Date: 2016-04-11 # @Filename: rss.py # @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause) # # @Last modified by: José Sánchez-Gallego (gallegoj@uw.edu) # @Last modified time: 2018-...
import inspect from collections import OrderedDict from django.db import models from rest_framework.serializers import ValidationError from landscapesim.common import config from landscapesim.common.types import default_num_to_empty_or_int, bool_to_empty_or_yes from landscapesim.serializers import scenarios as serial...
# shaney - prepare Puppet code with LaTeX comments for multiple audiences. # Based on <https://github.com/afseo/cmits>. # Copyright (C) 2015 Jared Jennings, jjennings@fastmail.fm. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published...
import pytest from flask import json from json.decoder import JSONDecodeError from backend.util.response.cart import CartSchema def test_select_all_controller(flask_app, es_create): prod_list = es_create("products", 2) item_id = prod_list[0].meta["id"] item_id_2 = prod_list[1].meta["id"] with flask_...
import os import logging import traceback import subprocess import httplib from collections import defaultdict from loader import Loader, LoadResult, Timeout, TimeoutError ENV = '/usr/bin/env' ZombieJS = 'node' ZombieLOADER = '/home/b.kyle/github/node-http2/example/pageloader_client.js' # TODO: when do we return FAIL...
####################################################################### ### Parte 2 import numpy as np import pandas as pd import matplotlib.pyplot as plt from PIL import Image ##################################################################### ## Ejercicio 1 # Importar imagen imagen = Image.open('C:/Users...
from __future__ import annotations from copy import deepcopy from textwrap import dedent from typing import Dict, Iterable, Optional, Set, Type import os.path import re from sqlalchemy import DDL, event from sqlalchemy.dialects.postgresql.base import ( RESERVED_WORDS as POSTGRESQL_RESERVED_WORDS, ) from flask im...
# pyeq2 is a collection of equations expressed as Python classes # # Copyright (C) 2012 James R. Phillips # 2548 Vera Cruz Drive # Birmingham, AL 35235 USA # # email: zunzun@zunzun.com # web: http://zunzun.com # # License: BSD-style (see LICENSE.txt in main source directory) # Version info: $Id:...
from django.db import models from django.utils import timezone from django.contrib.auth.models import User from django.core.urlresolvers import reverse from redactor.fields import RedactorField classify = { 'L': u'life', 'E': u'essay', 'T': u'tech', } class TimeStampedModel(models.Model): ...
"""empty message Revision ID: 47f6450771a6 Revises: None Create Date: 2015-04-15 16:44:40.764749 """ # revision identifiers, used by Alembic. revision = '47f6450771a6' down_revision = None from alembic import op import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ###...
#!/usr/bin/env python # -*- coding: utf-8 -*- import re import os import sys from setuptools import setup, find_packages from setuptools.command.test import test as TestCommand class Tox(TestCommand): user_options = [('tox-args=', 'a', "Arguments to pass to tox")] def initialize_options(self): Test...
from bottle import route, run, template, static_file, post, get, request, response import urllib import urllib2 from urllib2 import HTTPError @route('/js/<filepath:path>') def js(filepath): return static_file(filepath, root='./js') @route('/css/<filepath:path>') def css(filepath): return static...
"""Web interface to browse a corpus with various visualizations.""" # stdlib import os import re import sys import glob import math import logging from collections import OrderedDict from functools import wraps import matplotlib matplotlib.use('AGG') import matplotlib.cm as cm import pandas # Flask & co from flask impo...
from flask.ext.wtf import Form from flask.ext.babel import gettext from wtforms import TextField, BooleanField, RadioField from wtforms.validators import Required, Regexp, Optional from wtforms import IntegerField, HiddenField from wtforms import ValidationError from wtforms.validators import StopValidation from wtform...
# This file is part of gilmsg. # Copyright (C) 2015 Red Hat, Inc. # # gilmsg is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License, or (at your option) any later version. #...
import argparse import glob import logging import platform import os import shutil import struct import tempfile __requires__ = ["github_release"] import github_release GITHUB_REPO = "fonttools/skia-builder" ASSET_TEMPLATE = "libskia-{plat}-{arch}.zip" DOWNLOAD_DIR = os.path.join("build", "download") CPU_ARCH = "x6...
#! /usr/bin/env python #File: bibname.py """ :mod:`bibstuff.bibname` --- Name Parser and Formatter ===================================================== Parses bibtex-formatted author/editor raw names and provides formatting functions (e.g., via bibstyles/shared.NamesFormatter). :author: Dylan W. Schwilk :contact: ht...
import os import json import argparse from tabular_benchmarks import FCNetProteinStructureBenchmark, FCNetSliceLocalizationBenchmark,\ FCNetNavalPropulsionBenchmark, FCNetParkinsonsTelemonitoringBenchmark from tabular_benchmarks import NASCifar10A, NASCifar10B, NASCifar10C parser = argparse.ArgumentParser() parse...
# -*- coding: utf-8 -*- # Copyright 2020 Green Valley Belgium NV # # 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 appl...
import unittest import scipy import SloppyCell.Utility as Utility import SloppyCell.daskr from SloppyCell.daskr import daeint redir = Utility.Redirector() ################################################################################ # Van Der Pol oscillator equations # This test problem is from the daskr docume...
from math import cos, sin, sqrt, radians, pi g = 9.81 def air_pressure(wind_speed, window_width, window_height, wind_direction, window_angle, window_opening_angle, left_hinge): v = wind_speed b = window_width h = window_height theta = radians(270 - wind_direction + window_angle + 180 if left_hinge e...
import datetime import config import PyRSS2Gen from google.appengine.ext import webapp from models import blog import view class IndexHandler(webapp.RequestHandler): def get(self): query = blog.Post.all() query.filter('publish =', True) query.order('-pub_date') template_values = ...
""" ============================================================================ Creating your own electrode array ============================================================================ This example shows how to create a new :py:class:`~pulse2percept.implants.ElectrodeArray` object. As the base class for all el...
# -*- encoding:utf-8 -*- from mako import runtime, filters, cache UNDEFINED = runtime.UNDEFINED __M_dict_builtin = dict __M_locals_builtin = locals _magic_number = 5 _modified_time = 1298770751.096385 _template_filename='/home/jojo/pylons_projects/woodstock/woodstock/templates/signup.mako' _template_uri='/signup.mako' ...
import datetime import logging from greentasks import Task from ..core.exts import ext_container as exts from ..core.utils import utcnow class NotificationCleanupTask(Task): name = 'notifications' periodic = True def get_start_delay(self): return exts.config['notifications.default_expiry'] ...
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi # # License: BSD 3 clause """ Multi-class / multi-label utility function ========================================== """ from __future__ import division from collections import Sequence from itertools import chain from scipy.sparse import issparse from scipy.sparse.b...
from toolz.functoolz import (thread_first, thread_last, memoize, curry, compose, pipe, complement, do) from toolz.functoolz.core import _num_required_args from operator import add, mul from toolz.utils import raises from functools import partial from toolz.compatibility import reduce def ...
from django.shortcuts import render from places.forms import LocationForm # Create your views here. def home(request, tmpl='web/home.html'): data = {} loc_form = LocationForm(request.POST or None) data['locaction_form'] = loc_form return render(request, tmpl, data) # from django.conf import setting...
"""SCons.Tool.rpm Tool-specific initialization for rpm. There normally shouldn't be any need to import this module directly. It will usually be imported through the generic SCons.Tool.Tool() selection method. The rpm tool calls the rpmbuild command. The first and only argument should a tar.gz consisting of the sourc...
#!/usr/bin/env python2.7 # # FROM https://raw.githubusercontent.com/adamnovak/sequence-graphs/master/scripts/fetchRegion.py # """ fetchRegion.py: Fetch the sequence data, GRC alignments, and gene sets for a GRC region (like "LRC_KIR" or "MHC") by name. """ import argparse, sys, os, os.path, random, subprocess, shut...
import Words def get_word_length(): word_length = 0 while word_length == 0: try: word_length = int(input('Kor mange bokstavar er det i ordet?\n')) except: print('Du må skrive inn eit tal. Prøv igjen.\n') return word_length def get_if_letter_in_word(letter): an...
#coding=utf-8 import os from app import constant from app import misc INFO = 'Info' SKIN = 'Skin' ICON = 'Icon' THEME_CONFIG = 'conf.ini' class Theme(): params = {} path = '' # Internal def __loadTheme( theme_name = 'default' ): ''' @param theme_name: The name of theme @return: widget....
# Author: Idan Gutman # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickRage. # # SickRage 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 o...
#!/usr/bin/env python # -*- coding: utf8 -*- from nose.tools import ok_, eq_ from nose.plugins.attrib import attr import mock import os class ViewerTestCase(object): def setup(self): import viewer self.original_splash_delay = viewer.SPLASH_DELAY viewer.SPLASH_DELAY = 0 self.u =...
"""Apply the mask to the nifiti data Usage: rfroinii_butterfly roifile """ import re import os import sys import nibabel as nb from roi.pre import join_time from fmrilearn.load import load_roifile from fmrilearn.preprocess.nii import findallnii from fmrilearn.preprocess.nii import masknii def create(args): """C...
# Copyright (c) 2014 NetApp, Inc. # 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...
import re from wsgiref.simple_server import make_server def hello_world_app(environ,start_response): status = '200 OK' headers = [('Content-type','text/plain')] print environ start_response(status,headers) return ["hello world"] def event_analyst(environ,start_response): status = '200...
import socket import requests class DNSQuery: def __init__(self, data): self.data=data self.domain='' type = (data[2] >> 3) & 15 # Opcode bits if type == 0: # Standard query ind=12 len=data[ind] while len != 0: self.domain+=data[ind+1:ind+len+1].de...
#!/usr/bin/python # set gpio18 to high when content of file state is 'ON' import RPi.GPIO as GPIO import time import MySQLdb as mdb import sys import time # set GPIO (pin 12) that command the releais GPIO.setwarnings(False) GPIO.setmode(GPIO.BOARD) GPIO.setup(12, GPIO.OUT) def run(): # Vary curTime = time.strftime(...
# -*- coding: utf-8 -*- import os import urllib.request, urllib.error, urllib.parse import hashlib cache_dir = None def set_cache_dir(dir): global cache_dir cache_dir = dir def create_path_for_file(fname): dirname = os.path.dirname(fname) if not os.path.exists(dirname): os.makedirs(dirname) ...
""" ToxMe Copyright (C) 2016 <ovalseven8> 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 version 3 of the License, or (at your option) any later version. This program is distributed in the ...
"""Utilities related to model visualization.""" import os try: # pydot-ng is a fork of pydot that is better maintained. import pydot_ng as pydot except ImportError: # Fall back on pydot if necessary. try: import pydot except ImportError: pydot = None def _check_pydot(): if not...
'''A demo for defining data iterator. .. versionadded:: 1.2.0 The demo that defines a customized iterator for passing batches of data into `xgboost.DeviceQuantileDMatrix` and use this `DeviceQuantileDMatrix` for training. The feature is used primarily designed to reduce the required GPU memory for training on di...
# Copyright (c) 2020, Manfred Moitzi # License: MIT License import pytest import struct from ezdxf.tools.binarydata import ByteStream def test_init(): bs = ByteStream(b'ABCDABC\x00') assert bs.index == 0 assert len(bs.buffer) == 8 def test_read_ps(): bs = ByteStream(b'ABCDABC\x00') s = bs.read_...
# Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest from telemetry import page class TestPage(unittest.TestCase): def testGetUrlBaseDirAndFileForAbsolutePath(self): apage = page.Page...
import re from string import ascii_lowercase as lc, ascii_uppercase as uc, maketrans class NineAnimeUrlExtender: # _TS_MAP_TABLE = [i for i in uc if ord(i) % 2 != 0] + [i for i in uc if ord(i) % 2 == 0] _CUSB64_MAP_TABLE = [i for i in lc if ord(i) % 2 != 0] + [i for i in lc if ord(i) % 2 == 0] _ts_value_re...
import asyncio import os.path import time import sys import platform import queue import traceback import os import webbrowser from functools import partial, lru_cache from typing import NamedTuple, Callable, Optional, TYPE_CHECKING, Union, List, Dict, Any from PyQt5.QtGui import (QFont, QColor, QCursor, QPixmap, QSt...
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # License: BSD 3 clause import numpy as np from scipy import sparse from sklearn.datasets import load_diabetes, load_iris from sklearn.feature_selection import f_regression, f_classif from sklearn.linear_model.base import _preprocess_data from sklearn.linear_...
#$Id$# from books.api.ContactsApi import ContactsApi from books.api.ContactPersonsApi import ContactPersonsApi from books.api.EstimatesApi import EstimatesApi from books.api.InvoicesApi import InvoicesApi from books.api.RecurringInvoicesApi import RecurringInvoicesApi from books.api.CreditNotesApi import CreditNotesAp...
import os from Tribler.Core.CacheDB.sqlitecachedb import DB_FILE_RELATIVE_PATH from Tribler.Core.simpledefs import NTFY_TORRENTS, NTFY_CHANNELCAST DATA_NONE = u"None" class TriblerStatistics(object): def __init__(self, session): """ Constructor. :param session: The Tribler session. ...
# -*- coding: utf-8 -*- ############################################################################## # # Author: Yannick Buron # Copyright 2015, TODAY Clouder SASU # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License with Attribution # ...
from Service import Service from datetime import tzinfo, timedelta, datetime from dateutil import tz class DateHelper(Service): utc = tz.gettz("UTC") pyToJsFormatMapping = { "%m/%d/%Y": "MM/dd/yyyy", "%d/%m/%Y": "dd/MM/yyyy", "%Y-%m-%d": "yyyy-MM-dd" } def __init__(self, db, timezone = "UTC", dateFormat =...
import re class YouTube(object): def __init__(self, url=None): self._video_id = self._extract_id(url) def __call__(self, url=False): if url is None or url: self._video_id = self._extract_id(url) return self._video_id def _extract_id(self, url=None): """Extract...