src
stringlengths
721
1.04M
"""Support for Google Actions Smart Home Control.""" import asyncio from datetime import timedelta import logging from uuid import uuid4 from aiohttp import ClientError, ClientResponseError from aiohttp.web import Request, Response import jwt # Typing imports from homeassistant.components.http import HomeAssistantVie...
#!/usr/bin/python import unittest, time, sys, os, shelve, random import common from autotest.client import utils from autotest.client.shared.test_utils import mock import utils_misc, cartesian_config class utils_misc_test(unittest.TestCase): def test_cpu_vendor_intel(self): flags = ['fpu', 'vme', 'de', ...
# Copyright (c) 2019 J. Alvarez-Jarreta and C.J. Brasher # # This file is part of the LipidFinder software tool and governed by the # 'MIT License'. Please see the LICENSE file that should have been # included as part of this software. """Set of methods aimed to reassign a m/z value to every feature in a cluster: >...
# Copyright (c) 2017 Ansible Tower by Red Hat # All Rights Reserved. import sys import six from awx.main.utils.pglock import advisory_lock from awx.main.models import Instance, InstanceGroup from django.core.management.base import BaseCommand, CommandError class InstanceNotFound(Exception): def __init__(self, m...
#! usr/bin/python3 # программа для создания backups import os, zipfile def backupToZip(folder): """ создает резервную копию всего содержимого папки folder """ folder = os.path.abspath(folder) number = 1 while True: zipFilename = os.path.basename(folder) + '_' + str(number) + '.zip' ...
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'PlaylistItemPlaylist.fade_cross' db.add_column('alibrary_playlistitemplaylist', 'fade_cross'...
from django.contrib.auth.models import AbstractUser from django.db import models from utils.default_model import random_nick_name from blog.models import Article __all__ = [ 'UserProfile', 'EmailVerifyCode', 'Message', 'Comment', 'Reply' ] # Create your models here. class UserProfile(AbstractUse...
import re from validate_email import validate_email import ipaddress try: import urlparse except ImportError: import urllib.parse as urlparse import uuid import struct from jinja2 import Template import time import sys printer = "" # Well known regex mapping. regex_map = { "UNKNOWN": "", "HTTP_HEADER_...
""" Simple benchmarks for the sparse module """ from __future__ import division, print_function, absolute_import import warnings import time import timeit import numpy import numpy as np from numpy import ones, array, asarray, empty, random, zeros try: from scipy import sparse from scipy.sparse import (csr_m...
#!/usr/bin/env python # Copyright 2017 Stanford University, NVIDIA Corporation # # 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 r...
#!/usr/bin/env python3 """ Module (type "import") to import a Lastline report from an analysis link. """ import json import lastline_api misperrors = { "error": "Error", } userConfig = { "analysis_link": { "type": "String", "errorMessage": "Expected analysis link", "message": "The li...
# Python Security Project (PySec) and its related class files. # # PySec is a set of tools for secure application development under Linux # # Copyright 2014 PySec development team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You...
#!/usr/bin/env python from storm.locals import * from IMSmotorcfg import * from IMSmotor import * import sys class Instrument(object): __storm_table__ = "instrument" id = Int(primary=True) name = Unicode() #locations = Unicode() def __init__(self, name): self.name = name class Loc(...
# Teaching Python Classes by Peter Farrell # From http://hackingmathclass.blogspot.com/2015/08/finally-some-class.html # Typer: Ginny C Ghezzo # What I learned: # why doesn't the first import bring in locals ?? import pygame from pygame.locals import * black = (0,0,0) white = (255,255,255) green = (0,255, 0) ...
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='Customer', fields=[ ('id', models.AutoField(aut...
from itertools import chain from time import mktime, time from pickle import dumps, loads from traceback import format_exc from circuits.protocols.irc import PRIVMSG from circuits import handler, task, Event, Timer, Component from feedparser import parse as parse_feed from funcy import first, second from html2text...
#!/usr/bin/env python # -*- coding: utf-8 -*- """Setup script for python-bitbucket.""" from setuptools import setup from word2html import VERSION SHORT_DESC = ( "A quick and dirty script to convert a Word " "(docx) document to html." ) setup( name='word2html', version=VERSION, description=SHORT_...
# # This file is: # Copyright (C) 2018 Calin Culianu <calin.culianu@gmail.com> # # MIT License # import os from electroncash_gui.ios_native.monkeypatches import MonkeyPatches from electroncash.util import set_verbosity from electroncash_gui.ios_native import ElectrumGui from electroncash_gui.ios_native.utils import...
#!/usr/bin/env python # encoding: utf-8 """ Compute WIRCam synthetic surface brightnesses within regions of a segmentation map. Accepts segmentation maps and pixel tables made by, e.g. andromass. 2014-11-18 - Created by Jonathan Sick """ import argparse # from collections import defaultdict # import math import num...
# 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 # distributed under the Li...
# Copyright 2014 Hewlett-Packard Development Company, L.P. # # 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 requir...
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (C) 2016 STI (<https://github.com/sumihai-tekindo>). # @author Pambudi Satria <pambudi.satria@yahoo.com> # # This program is free software: you can redistribute it and/or modify # it u...
""" Created on 8 Nov 2012 @author: plish """ from trolly.trelloobject import TrelloObject class Board(TrelloObject): """ Class representing a Trello Board """ def __init__(self, trello_client, board_id, name=''): super(Board, self).__init__(trello_client) self.id = board_id ...
# 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 u...
#!/usr/bin/python '''Test for an openGL based stereo renderer - test binocular rendering to a single window David Dunn Feb 2017 - created www.qenops.com ''' __author__ = ('David Dunn') __version__ = '1.0' import OpenGL OpenGL.ERROR_CHECKING = False # Uncomment for 2x speed up OpenGL.ERROR_LOGGING = False ...
import asyncio import logging import sys SERVER_ADDRESS = ('localhost', 10000) logging.basicConfig( level=logging.DEBUG, format='%(name)s: %(message)s', stream=sys.stderr, ) log = logging.getLogger('main') event_loop = asyncio.get_event_loop() class EchoServer(asyncio.Protocol): def connection_made...
# 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 u...
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Test the IO routines - based on the MSAT test cases """ import unittest import numpy as np import pytasa.anisotropy_index class TestAnisotropyIndex(unittest.TestCase): def setUp(self): """Some useful matricies for testing""" self.olivine = np.ar...
from JumpScale import j from time import sleep app = j.tools.cuisine._getBaseAppClass() class CuisineVolumeDriver(app): NAME = "volumedriver" def __init__(self, executor, cuisine): self._executor = executor self._cuisine = cuisine self.logger = j.logger.get("j.tools.cuisine.volumedr...
""" models of catalog are.. """ from django.db import models from django.forms import ModelForm import useraccounts from django.contrib.auth.models import User """ This class defines the name of category and parent category of product """ class Category(models.Model): name = models.CharField(max_length=100) p...
#!/usr/bin/python # Kindle Weather Display # Matthew Petroff (http://www.mpetroff.net/) # September 2012 # # Owen Bullock - UK Weather - MetOffice - Aug 2013 # Apr 2014 - amended for Wind option # # Mendhak - redone for WeatherUnderground API import json import urllib2 from xml.dom import minidom import datetime impo...
"""Base classes and convenience functions for writing indexers and skimmers""" from collections import namedtuple from operator import itemgetter from os.path import join, islink from warnings import warn from funcy import group_by, decorator, imapcat from dxr.utils import build_offset_map, split_content_lines STR...
__author__ = 'amw' from quicktest.Reporting import plot3d, plot2d, create_dataset, create_plot_matrix # Initialise database config db_config = {"hostname": "localhost", "port": "27017", "db_name": "simulations", "collection_name": "02-09-13"} # Create plot tag = "direct_null_1m_020913" x_param = "parameters.numSubs...
"""Various utility functions""" import os import inspect import six def class_of(value): if inspect.isclass(value): return repr(value) else: t = type(value) return repr(t) def repr_of(value): return "%r %r" % (value, type(value)) # Parts below taken from ipython: # Copyright (c) ...
from cnrclient.display import print_packages from cnrclient.commands.command_base import CommandBase class ListPackageCmd(CommandBase): name = 'list' help_message = "list packages" def __init__(self, options): super(ListPackageCmd, self).__init__(options) self.registry_host = options.regi...
from json_p_n import sendRecieve import pexpect,argparse from sys import path import subprocess path.append('/home/efim/Dropbox') from ipcalc_flask import calculateSubnet as calc def Main(): parser = argparse.ArgumentParser() parser.add_argument('subnet', help='Give me a subnet', type=str) #optinal argument ...
# -*- coding: utf-8 -*- #!/usr/bin/env python # # Copyright 2015 BigML # # 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 b...
try: from functools import reduce except: pass data = { 'des_system_lib': set('std synopsys std_cell_lib des_system_lib dw02 dw01 ramlib ieee'.split()), 'dw01': set('ieee dw01 dware gtech'.split()), 'dw02': set('ieee dw02 dware'.split()), 'dw03': set('std s...
# catalog.management.commands.ingest # Ingest utility to grab data from a CSV file and insert into database. # # Author: Benjamin Bengfort <bbengfort@districtdatalabs.com> # Created: Sun Aug 23 21:18:54 2015 -0500 # # Copyright (C) 2015 District Data Labs # For license information, see LICENSE.txt # # ID: ingest.py ...
# -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function import os import re import sys import json import requests import argparse import time import codecs from bs4 import BeautifulSoup from six import u __version__ = '1.0' # if python 2, disable verify flag in requests....
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 13 11:45:04 2019 @author: BallBlueMeercat This script runs through models, noise on data and dataset size options to collect the distribution of angular diameter distance assosiated with each, then plots these distributions as scatter and as a norm...
# Copyright (C) 2012 Science and Technology Facilities Council. # # 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 2 of the License, or # (at your option) any later ...
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import absolute_import, division, print_function, unicode_literals import json import logging import os import pkgutil import threading import xml.etree.Ele...
# ***** BEGIN LICENSE BLOCK ***** # Version: MPL 1.1/GPL 2.0/LGPL 2.1 # # The contents of this file are subject to the Mozilla Public License Version # 1.1 (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.mozilla.org/MPL/ # # Softwa...
__author__ = "Rajiv Mayani" import logging from Pegasus.db import connection from Pegasus.db.admin.admin_loader import DBAdminError from Pegasus.db.errors import StampedeDBNotFoundError from Pegasus.db.schema import * # Main stats class. class StampedeWorkflowStatistics: def __init__(self, connString=None, expa...
#!/usr/bin python # coding=utf-8 # This Module provides some functions about getting stock's data. import DataConnection as dc import datetime import numpy as np import db_func LEAST_DATE = '2016-01-01 00:00:00' def string_toDatetime(timestr): return datetime.datetime.strptime(timestr,"%Y-%m-%d %H:%M:%S") def las...
# coding=utf-8 import glob import os class File(object): def __init__(self, path): self.original = path self.abspath = os.path.abspath(path) def __str__(self): prefix = '' if self.isfile: prefix = 'file: ' elif self.isdir: prefix = 'dir: ' ...
""" This is where Studio interacts with the learning_sequences application, which is responsible for holding course outline data. Studio _pushes_ that data into learning_sequences at publish time. """ from datetime import timezone from typing import List, Tuple from edx_django_utils.monitoring import function_trace, s...
def main(j, args, params, tags, tasklet): def _formatdata(jumpscripts): aaData = list() for name, jumpscript in jumpscripts.items(): itemdata = ['<a href=adminjumpscript?name=%s>%s</a>' % (name, name)] for field in ['organization', 'version', 'descr']: #code i...
from __future__ import print_function import sys, os, math import numpy as np from numpy import float32, int32, uint8, dtype # Load PyGreentea # Relative path to where PyGreentea resides pygt_path = '../..' sys.path.append(pygt_path) import pygreentea.pygreentea as pygt import caffe from caffe import layers as L from...
"""This module is based on the Steam WebAPI and can be used to get information about items in TF2. Using this module, you can obtain the item schema, store prices, bundles, item sets and attributes for TF2. You can also obtain market prices from backpack.tf and trade.tf. There are also functions for parsing the inform...
# -*- coding: utf-8 -*- __author__ = 'Dennis Rump' ############################################################################### # # The MIT License (MIT) # # Copyright (c) 2015 Dennis Rump # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation...
""" Administration for photos and galleries. """ from django.contrib import admin from django.db.models import Count from django.utils.translation import ugettext_lazy as _ from .forms import PhotoForm from .models import Gallery, Photo class PhotoInline(admin.TabularInline): """ Administration for photos. ...
import pytest from dataclasses import dataclass from simple_parsing import ArgumentParser, choice from typing import Union from .testutils import * @dataclass class A(TestSetup): color: str = choice("red", "green", "blue", default="red") def test_choice_default(): a = A.setup("") assert a.color == "red...
import Graffity import numpy import scipy import matplotlib.pyplot as pyplot wave = 632.8 ciao = Graffity.WFS(wavelength=1800.0) var = numpy.array([False, False, True, True, True]) offsets = [] x = 0 for v in var: if v: offsets.append(x) x+= 1 else: offsets.append(0) zern = [0.0, 0.0...
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import logging from logging import getLogger, Formatter, StreamHandler from simiki import utils from simiki.compat import is_linux, is_osx class ANSIFormatter(Formatter): """Use ANSI escape sequences to colore...
import drake from functools import lru_cache from itertools import chain import os class CMakeBuilder(drake.Builder): def __init__(self, toolkit, srcs, dsts, vars, targets = None, path_to_cmake_source = None): ''' `srcs`: what we depend upon. `dsts`: what will be built. `vars`: dict v...
from collections import defaultdict import random class RandomizedSet(object): def __init__(self): """ Initialize your data structure here. """ self.l = [] self.d = defaultdict(set) def insert(self, val): """ Inserts a value to the set. Returns ...
from skidl import SKIDL, TEMPLATE, Part, Pin, SchLib SKIDL_lib_version = '0.0.1' digital_audio = SchLib(tool=SKIDL).add_parts(*[ Part(name='AK5392VS',dest=TEMPLATE,tool=SKIDL,keywords='24bit Sigma Delta Audio ADC 2ch',description='AK5392-VS, Enhanced Audio ADC, 2 channels Sigma Delta, 24bit, SO28',ref_prefix=...
import tempfile import logging import luigi import time import random import os from datetime import datetime from os.path import join as pjoin, dirname, exists, basename, abspath CONFIG = luigi.configuration.get_config() CONFIG.add_config_path(pjoin(dirname(__file__), 'loadconfig.cfg')) # Set global config TEMPDIR ...
from django.utils.translation import ugettext as _ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from cmsplugin_video_youtube.models import YouTubeVideo from cmsplugin_video_youtube.forms import YouTubeVideoForm class YouTubeVideoPlugin(CMSPluginBase): model = YouTubeVideo ...
import pytest skip = False try: from simple_settings.strategies.toml_file import SettingsLoadStrategyToml except ImportError: skip = True @pytest.mark.skipif(skip, reason='Installed without Toml') class TestTomlStrategy: @pytest.fixture def strategy_toml(self): return SettingsLoadStrategyTom...
############################################################################## # Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-64...
import copy import datetime import inspect import json import logging import traceback import warnings from collections import defaultdict, namedtuple from collections.abc import Hashable from typing import Any, Dict, Iterable, List, Optional, Set import pandas as pd from dateutil.parser import parse from tqdm.auto im...
import cv2 import os import numpy as np import random import pickle import argparse parser = argparse.ArgumentParser(description='PyTorch Relations-from-Stream sort-of-CLVR dataset builder') parser.add_argument('--dir', type=str, default='./data', help='Directory in which to store the dataset')...
######################################################################## # Rancho - Open Source Group/Project Management Tool # Copyright (C) 2008 The Rancho Team # # 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 t...
from flask import render_template, flash, url_for, redirect, send_from_directory, jsonify, request from app import app, tmdb, lib from app.forms import SearchForm, TVSettingsForm, MovieSettingsForm, QualityForm, SettingsForm from app.models import Movie, TV, TVSeason, TVEpisode, TVEpisodeFile, MovieFile, Settings, Log ...
from bokeh.core.properties import Instance from bokeh.io import output_file, show from bokeh.models import ColumnDataSource, Tool from bokeh.plotting import figure output_file('tool.html') JS_CODE = """ import * as p from "core/properties" import {GestureTool, GestureToolView} from "models/tools/gestures/gesture_tool...
# Copyright 2014 Open Source Robotics Foundation, 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...
# This file is part of Indico. # Copyright (C) 2002 - 2021 CERN # # Indico is free software; you can redistribute it and/or # modify it under the terms of the MIT License; see the # LICENSE file for more details. import os from flask import Response, current_app, redirect, request, send_from_directory from werkzeug.e...
# -*- coding: utf-8 -*- """ Created on Sun Feb 28 20:16:35 2016 @name: MultiNomial Asymmetric Logit--version 3 @author: Timothy Brathwaite @summary: Contains functions necessary for estimating multinomial asymmetric logit models (with the help of the "base_multinomial_cm.py" file) @notes: Dif...
# Create your views here. from django.http import HttpResponse from django.template import loader from django.template.context import Context from django.template import RequestContext from django.shortcuts import redirect from django.shortcuts import render from conversation.models import ConvoWall, ConversationPost ...
#!/usr/bin/env python # Copyright 2020 Google 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...
## # Copyright 2009-2021 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://www.vscentrum.be), # Flemish Research Foundation (F...
#!/usr/bin/env python from setuptools import setup setup( name='meuh', version='0.1', description='Create debian package with rsync, docker and love', author='Xavier Barbosa', author_email='clint.northwood@gmail.com', license='MIT', install_requires=[ 'cliff==1.9.0', 'docke...
#!/usr/bin/env python # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2021 # Leandro Toledo de Souza <devs@python-telegram-bot.org> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser Public License as published by #...
# Copyright 2019 The TensorFlow Authors. 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 applica...
import json import logging import socket import traceback from copy import copy from datetime import datetime from tempfile import NamedTemporaryFile from textwrap import dedent from time import sleep, time import attr import dateutil.parser import fauxfactory import os import re import requests import sentaku import ...
# # Copyright (C) 2014 Stanislav Bohm # # This file is part of Shampoo. # # Shampoo 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, version 3 of the License. # # Shampoo is distributed in the...
import os import subprocess import time from collections import defaultdict from queue import Empty, Queue from threading import Lock, Thread from weakref import WeakKeyDictionary import django from django.db import DEFAULT_DB_ALIAS from django.db import connection as default_connection from django.db import connectio...
""" sentry.utils.auth ~~~~~~~~~~~~~~~~~ :copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details. :license: BSD, see LICENSE for more details. """ from __future__ import absolute_import import six import logging from django.conf import settings from django.contrib.auth import login as _login from d...
import pytest from os import path DB_PATH = '~/.demolog/meta.db' DATA_DIR = path.join(path.dirname(path.realpath(__file__)),'../../example_data/') def test_implant_angle_filter(): from labbookdb.report.selection import animal_id, animal_treatments, animal_operations import numpy as np db_path=DB_PATH df = animal...
import unittest2 import numpy as np from .weighting import AWeighting from .frequencyscale import LinearScale, FrequencyBand, GeometricScale, MelScale from .tfrepresentation import FrequencyDimension from .frequencyadaptive import FrequencyAdaptive from zounds.timeseries import Seconds, TimeDimension, Milliseconds, SR1...
from datetime import date, datetime from services import * from collections import defaultdict import sys CATEGORIES = ["populerkultur", "yazmevsimi", "kismevsimi", "yesilcam", "emojiler", "gol", "turkdizileri", "evlilik", "para", "kultursanat", "sesinicikar", "ikililer", "okul", "taklit", "osmanli", "markalar", "parti...
""" GPL License 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 hope that it will be useful...
# -*- coding: utf-8 -*- # Generated by Django 1.11.21 on 2020-03-31 10:03 from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone import django_countries.fields import model_utils.fields class Migration(migrations.Migration): initial = True dependencies...
import image import logging import tempfile from os import path DEBUG = False def make_map_url(ty, coord, area_size, zoom): return \ ('https://static-maps.yandex.ru/1.x/?lang=ru_RU' '&ll={lat}%2C{lon}' '&z={zoom}&l={ty}&size={size_x},{size_y}' ).format( ty=ty, ...
from __future__ import absolute_import, unicode_literals, print_function, division from nosql_rest_preprocessor import exceptions from nosql_rest_preprocessor.utils import non_mutating class BaseModel(object): required_attributes = set() optional_attributes = None immutable_attributes = set() priv...
# # Copyright (c) 2006-2013 Christopher L. Felton # # This program 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 3 of the License, or # (at your option) any later version. # # This prog...
from collections import Counter def split(name): name, _, sector_checksum = name.strip().rpartition('-') sector, _, checksum = sector_checksum.partition('[') checksum = checksum[:-1] return name, int(sector), checksum def real(name, checksum): letters = Counter(name.replace('-', '')) return ...
#!/usr/bin/python # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import re import fbchisellldbbase as fb import lldb NOT_FOUND = 0xFFFFFFFF # UINT32_MAX def lldbc...
from django.core.management.base import BaseCommand, CommandError from django.contrib.auth.models import User, Group from opensubmit.signalhandlers import check_permission_system skiplist = ['AUTHENTICATION_BACKENDS', 'EMAIL_BACKEND', 'LOG_FILE', 'FORCE_SCRIPT_NAME', 'GRAPPELLI_ADMIN_TITLE', 'GRAPPELLI_IN...
import os,sys,pandas sys.path.append("/opt/SoMA/python/lib") from libsoma import * import pygsheets from bs4 import BeautifulSoup from tabulate import tabulate def get_worksheet_names(ssheet): sheetnames=[] for ws in ssheet.worksheets(): sheetnames.append(ws.title) return sheetnames def get_as_dict(df): i...
""" General functions for HTML manipulation. """ import re as _re try: from html.entities import html5 as _html5 unichr = chr except ImportError: import htmlentitydefs _html5 = {'apos;':u"'"} for k, v in htmlentitydefs.name2codepoint.iteritems(): _html5[k + ';'] = unichr(v) __all__ = ['es...
from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import CreateView from django.views.generic import ListView from django.views.generic import TemplateView from django.views.generic import UpdateView, DetailView from apps.utils.shortcuts import get_object_or_none class BaseListView(L...
""" Creates a YAML file with info about the structured Cartesian mesh that will be parsed by cuIBM. """ from snake.cartesianMesh import CartesianStructuredMesh # info about the 2D structured Cartesian grid width = 0.02 # minimum grid spacing in the x- and y- directions info = [{'direction': 'x', 'start': -15.0, ...
# 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. #----------------------------------------------------------------------...
""" A Command Set (CmdSet) holds a set of commands. The Cmdsets can be merged and combined to create new sets of commands in a non-destructive way. This makes them very powerful for implementing custom game states where different commands (or different variations of commands) are available to the accounts depending on...
#-*- coding: utf-8 -*- #! /usr/bin/env python ''' filename: run_tf_basic_rnn_seq2seq_trainer.py This script is for predicting time series author: Jaewook Kang @ 2018 Sep ''' from __future__ import absolute_import from __future__ import division from __future__ import print_function from datetime import...
#! /bin/python3 import csv #For csv file handling import re #Regular expressions import sys #System processes import os #Work on files and folders depending on your OS #import pdb #Debugger #pdb.set_trace() #Input arguments #sys.argv[1] = Input file name #sys.argv[2] = Output file name #sys.argv[3] = Folder name (Def...