text
stringlengths
2
999k
import unittest from ds2.tree import Tree class TestTree(unittest.TestCase): def testinit(self): Tree(['root']) Tree([1, [2, [3], [4]], [5, [6], [7], [8]]]) def teststr(self): self.assertEqual(str(Tree([1, [2], [3]])), "1\n 2\n 3") self.assertEqual(str(Tree([1, [2, [3]]])), "...
import pytest from events import renderers from events.models import Location, CustomEvent @pytest.fixture def simple_component_renderer(mocker): mocker.patch.multiple( 'events.renderers', render_event=str, render_block_location=lambda v: '{} '.format(v), ) @pytest.fixture def time_...
''' This module translates a series of statements into a language-specific syntactically correct code block that can be inserted into a template. It infers whether or not a variable can be declared as constant, etc. It should handle common subexpressions, and so forth. The input information needed: * The sequence of...
from shiftmemory import exceptions, adapter class Memory(): """ Main memory API Keeps track of caches, configures and instantiates them on demand and provides means to perform operations on caches """ def __init__(self, *args, **kwargs): """ Creates your memory instance ...
import win32api, win32con, time, sys, random, logging # from driver.bot import openInstagramStories from bot import openInstagramStories # logging logging.basicConfig(filename='example.log', encoding='utf-8', level=logging.DEBUG) ################################### ## Setting runtime variables #######################...
import mmcv import numpy as np from mmdet.datasets.builder import PIPELINES from mmdet.datasets.pipelines.compose import Compose @PIPELINES.register_module() class MultiRotateAugOCR: """Test-time augmentation with multiple rotations in the case that img_height > img_width. An example configuration is as ...
"""Emoji Available Commands: .spem""" from telethon import events @borg.on(events.NewMessage(pattern=r"\.(.*)", outgoing=True)) async def _(event): if event.fwd_from: return input_str = event.pattern_match.group(1) if input_str == "spem": await event.edit(input_str) a...
import logging from datetime import datetime, timedelta, timezone import pytimeparse import os, errno from django.conf import settings import shutil import docker import humanize import time from tno.proccess import ProccessManager import parsl from parsl import * import json from statistics import mean from tno.db imp...
from collections import namedtuple import sys __all__ = ["BTrajectoryPoint"] _name = "BTrajectoryPoint" _fields = ( "position", "velocity", "arbFeedFwd", "auxiliaryPos", "auxiliaryVel", "auxiliaryArbFeedFwd", "profileSlotSelect0", "profileSlotSelect1", "isLastPoint", "zeroPos"...
import flask_adventure_game def test_import(): assert flask_adventure_game
#!/usr/bin/env python # Copyright 2015 University of Chicago # Licensed under the APL 2.0 license import sys import os import argparse import time import Pegasus.DAX3 import fsurfer def generate_dax(): """ Main function that parses arguments and generates the pegasus workflow :return: True if any ...
""" Copyright (c) 2020 COTOBA DESIGN, Inc. 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, copy, modify, merge, publish, distri...
import json import re from six import text_type from unidecode import unidecode from django.db import models from django.shortcuts import render from django.utils.translation import ugettext_lazy as _ from django.utils.text import slugify from django.utils.encoding import python_2_unicode_compatible from wagtail.wa...
from tests.testing_harness import TestHarness def test_trace(): harness = TestHarness('statepoint.10.h5') harness.main()
""" Simple, non parallel optimization set up example. """ import sys,os sys.path.insert(0,'../../../') from glennopt.base import Parameter from glennopt.optimizers import SODE from glennopt.helpers import de_mutation_type, mutation_parameters from glennopt.DOE import Default,CCD,FullFactorial,LatinHyperCube # Gen...
import warnings from itertools import product from operator import add import numpy as np import pandas as pd import pytest from pandas.io.formats import format as pandas_format import dask import dask.array as da import dask.dataframe as dd from dask.array.numpy_compat import _numpy_118 from dask.base import compute...
__author__ = 'SuperFashi' __email__ = 'admin@superfashi.com' __version__ = '0.1'
from .metrics import AverageMeter from .metrics import asMinutes from .metrics import timeSince
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2012, Nachi Ueno, NTT MCL, 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://ww...
#!/usr/bin/env python3 import numpy as np class LaserScan: """Class that contains LaserScan with x,y,z,r""" EXTENSIONS_SCAN = ['.bin'] def __init__(self, project=False, H=64, W=1024, fov_up=3.0, fov_down=-25.0): self.project = project self.proj_H = H self.proj_W = W self.proj_fov_up = fov_up ...
# -*- coding: utf-8 -*- # # MNE documentation build configuration file, created by # sphinx-quickstart on Fri Jun 11 10:45:48 2010. # # This file is execfile()d with the current directory set to its containing # dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All c...
import logging import sys from functools import partial from time import sleep import pytest @pytest.fixture(scope='package') def is_windows(): return sys.platform == 'win32' @pytest.fixture(scope='package') def logger(): root = logging.getLogger() root.setLevel(logging.DEBUG) handler = logging.S...
# # 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...
""" Workflow Archiver Error """ class WorkflowArchiverError(Exception): """ Error for Workflow Archiver module """ def __init__(self, message): super().__init__(message)
from collections import defaultdict from flask import flash def error_print(attacker, defender, options): print("\nCalculation error") print("Options:") print(options) print("Attacker:") print(attacker) print("Defender:") print(defender) def flash_errors(form): """Flashes form errors...
# -*- coding: utf-8 -*- ''' Execute chef in server or solo mode ''' # Import Python libs from __future__ import absolute_import, print_function, unicode_literals import logging import os import tempfile # Import Salt libs import salt.utils.path import salt.utils.platform import salt.utils.decorators.path # Import 3r...
import os import time from unittest import SkipTest import boto3 import six from botocore.exceptions import ClientError import pytest import sure # noqa from moto import mock_logs, settings _logs_region = "us-east-1" if settings.TEST_SERVER_MODE else "us-west-2" @mock_logs def test_create_log_group(): conn = b...
# PyTorch StudioGAN: https://github.com/POSTECH-CVLab/PyTorch-StudioGAN # The MIT License (MIT) # See license file or visit https://github.com/POSTECH-CVLab/PyTorch-StudioGAN for details # train_eval.py import numpy as np import sys import glob from scipy import ndimage from os.path import join from PIL import Image...
# pysqlite2/test/dbapi.py: tests for DB-API compliance # # Copyright (C) 2004-2010 Gerhard Häring <gh@ghaering.de> # # This file is part of pysqlite. # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages # arising from the use of t...
# Copyright (c) Facebook, Inc. and its affiliates. from torch.utils.data.dataset import Subset class multimodelitySubset(Subset): def __init__(self, dataset, indices): super().__init__(dataset, indices) self._dir_representation = dir(self) def __getattr__(self, name): if "_dir_repres...
#: Common folder in which the data file are related. DATA_ROOT_FOLDER = '/Users/mdartiailh/Labber/Data/2019' #: Dictionary of parallel field: pair of file path. The first path should refer #: to the dataset in which the j1 junction is gated, the second to the dataset #: in which the j2 junction is gated. DATA_PATHS = ...
#AppID 46WHPG-43Q7EQJAQ8 #################################################################### # Animus AI Developed by Kuldeep Paul Dated 13th March 2018 # # Animus Wolfram Alpha Skill for Responses # # Copyright 2018 Kuldeep Paul # ###################...
#!/usr/bin/env python # -*- coding: utf-8 -*- from pyspark.sql import SparkSession try: import dataopslib.schemas as schemas except ImportError: import os import sys cur_dir = os.path.dirname(__file__) # Add the parent directory in the search for modules when importing sys.path.append(os.path.a...
import shutil import sqlite3 from datetime import datetime from os import listdir import os import csv from application_logging.logger import App_Logger class dBOperation: """ This class shall be used for handling all the SQL operations. """ def __init__(self): self.pa...
# Copyright (C) <2020> Intel Corporation # # SPDX-License-Identifier: Apache-2.0 '''Script for build in continuous integration environment. It synchronizes code, builds SDK and creates a zip file for the SDK. Please run this script with python 3.4 or newer on Ubuntu 18.04 or Windows 10 20H2. It's expected to be ran ...
import os import torch from corm_data.utils import initialize_datasets default_qm9_dir = '~/datasets/molecular/qm9/' def QM9datasets(root_dir=default_qm9_dir): root_dir = os.path.expanduser(root_dir) filename= f"{root_dir}data_boxed.pz" if os.path.exists(filename): return torch.load(filename) el...
# ------------------------------------------------------------------------- # # Part of the CodeChecker project, under the Apache License v2.0 with # LLVM Exceptions. See LICENSE for license information. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception # # ---------------------------------------------------...
# -*- coding: utf-8 -*- # Copyright 2018 IBM. # # 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 agre...
# License: MIT # encoding=utf8 import abc import logging from typing import List, Union import numpy as np from scipy.stats import norm import math from openbox.utils.config_space import Configuration from openbox.utils.config_space.util import convert_configurations_to_array from openbox.surrogate.base.base_model i...
# -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-04-05 01:12 from __future__ import unicode_literals from django.db import migrations, models import django.utils.timezone class Migration(migrations.Migration): dependencies = [ ('school', '0014_auto_20170405_0500'), ] operations = [ ...
""" Various XML utilities """ import re import string # pylint: disable=deprecated-module from xml.etree import ElementTree import salt.utils.data def _conv_name(x): """ If this XML tree has an xmlns attribute, then etree will add it to the beginning of the tag, like: "{http://path}tag". """ if...
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # We need to do the imports below so that classy vision registry can run import vissl.data.collators # NOQA import vissl.data.ssl_transforms ...
from kafka import KafkaProducer import time producer = KafkaProducer(bootstrap_servers='localhost:9092') i = 0 while True: m = "test message {}".format(i) producer.send("test-topic", bytes(m.encode())) print("sent {}".format(m)) time.sleep(0.1) i += 1
#!/usr/bin/env python # coding=utf-8 from __future__ import division, print_function, unicode_literals import ast import inspect import io import re import sys from tokenize import generate_tokens, tokenize, TokenError, COMMENT from copy import copy from sacred import SETTINGS from sacred.config.config_summary import...
# _*_ coding: utf-8 _*_ from django.db import models from .JerarquiaAcad import JerarquiaAcad class Carrera(models.Model): nombre = models.CharField(max_length=60) abrev = models.CharField(max_length=10, null=True, blank=True) codigo = models.CharField(max_length=10, null=True, blank=True) jerarquia_...
from .glm import glm_LRT from .qtl import qtl_scan, qtl_NB, qtl_limix, qtl_statsmodels
import pytest from hatch.project.core import Project from hatchling.utils.constants import DEFAULT_BUILD_SCRIPT @pytest.fixture(autouse=True) def local_builder(mock_backend_process, mocker): if mock_backend_process: mocker.patch('hatch.env.virtual.VirtualEnvironment.build_environment') yield def t...
# coding: utf-8 """ qTest Manager API Version 8.6 - 9.1 qTest Manager API Version 8.6 - 9.1 OpenAPI spec version: 8.6 - 9.1 Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class ProjectAdmin...
from typing import List, Tuple from app.domain.sentiment_data import Sentiment_Type import nltk import pandas as pd import streamlit as st import matplotlib.pyplot as plt from wordcloud import WordCloud from app.data.data_handler import DataHandler from app.service.analyser import Analyser class UIData_TextInsights: ...
import sys from random import choice def RT3(text): NewText = "" dic4 = {'_NEWLINE ' :'ⵥ', '_music' :'♬', '_unwoken' :'_(ˇωˇ」∠)', '_awoken' :'_(°ω°」 ∠)_ⵥ', '_stretch' ...
from itertools import count import json def main(j, args, params, tags, tasklet): page = args.page hrd = j.core.hrd.get(content=args.cmdstr) eveGrid = { 'specJsonPath': hrd.get('spec.json.path', default='/docs/spec.json'), 'schemaURL': hrd.getStr('schema.url', default=''), 'en...
# # Copyright (c) 2017 Juniper Networks, Inc. All rights reserved. # from builtins import object from kube_manager.common.utils import (get_vn_fq_name_from_dict_string, get_domain_name_from_vn_dict_string, get_project_name_from_vn_dict_string, ...
from fastapi import FastAPI from fastapi.responses import JSONResponse from pydantic import BaseModel class Item(BaseModel): id: str value: str class Message(BaseModel): message: str app = FastAPI() @app.get("/items/{item_id}", response_model=Item, responses={404: {"model": Message}}) async def read...
from .app import App, DocumentApp, MainWindow from .command import Command, CommandSet, Group, GROUP_BREAK, SECTION_BREAK from .documents import Document from .keys import Key # Resources from .colors import hsl, hsla, rgb, rgba from .fonts import Font from .icons import Icon from .images import Image # Widgets from ...
from pacman.model.constraints.key_allocator_constraints.\ key_allocator_contiguous_range_constraint import \ KeyAllocatorContiguousRangeContraint from pacman.model.constraints.key_allocator_constraints.\ key_allocator_fixed_field_constraint import \ KeyAllocatorFixedFieldConstraint from pacman.model.con...
text0 = 'パトカー' text1 = 'タクシー' ans = '' for i in range(len(text0)): ans += text0[i] ans += text1[i] print(ans)
# BSD 3-Clause License; see https://github.com/scikit-hep/uproot4/blob/master/LICENSE """ Physical layer for remote files, accessed via the XRootD protocol. Defines a :py:class:`~uproot4.source.http.XRootDResource` (``XRootD.File``) and two sources: :py:class:`~uproot4.source.http.MultithreadedXRootDSource` and :py:c...
from __future__ import absolute_import, division, print_function from abc import ABCMeta, abstractmethod as abstract_method import attr import six from six import with_metaclass @attr.s class Iterator(object): _iter = attr.ib(init=False) def next(self): return self.__next__() def __next__(self...
# coding=utf-8 class Size(object): """Size encapsulate information for a Digital Ocean droplet size""" def __init__(self, identifier, name): self.id = identifier self.name = name def __repr__(self): return "<%s: %s>" % (self.id, self.name) def __str__(self): return ...
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import zipfile #print "Processing File " + sys.argv[1] def unzip_file(f): _file=zipfile.ZipFile(f,"r"); for name in _file.namelist(): utf8name=name.decode('gbk') if os.name == 'posix': print "Extracting " + utf8nam...
import logging import re log = logging.getLogger(__name__) class ShowVsan(object): def __init__(self, outlines, vsan_id=None): self._all_vsans = [] self._group_dict = {} self.vsan_id = vsan_id self.process_all(outlines) def process_all(self, outlines): outlines = "".j...
from twisted.internet import reactor from ygo.duel_reader import DuelReader from ygo.utils import process_duel from ygo.parsers.duel_parser import DuelParser def display_battle_menu(self, pl): pl.notify(pl._("Battle menu:")) if self.attackable: pl.notify(pl._("a: Attack.")) if self.activatable: pl.n...
import math import osgeo.osr import types WGS84_WKT = "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984'," + \ "SPHEROID['WGS_1984',6378137.0,298.257223563]]," + \ "PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]" class GeoLocation: ''' Class representing a coordinate on a sphere, m...
# pycopy-jitgen - Generate machine code from Pycopy # # This module is part of the Pycopy https://github.com/pfalcon/pycopy # project. # # Copyright (c) 2018-2020 Paul Sokolovsky # # The MIT License # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated docume...
from flask import Flask, render_template from models import civilization,structure,technology,unit from peewee import * app = Flask(__name__) db = SqliteDatabase('ageofempires.db') civ = civilization() struct = structure() tec = technology() un = unit() @app.route('/') def index(): db.connect() civilizatio...
from __future__ import print_function import functools import json import logging import os import sys import atexit from insights.client import InsightsClient from insights.client.config import InsightsConfig from insights.client.constants import InsightsConstants as constants from insights.client.support import Insi...
""" e.g: http://data.eastmoney.com/bbsj/201806/lrb.html """ import requests import re from multiprocessing import Pool import json import csv import pandas as pd import os import time # 设置文件保存在D盘eastmoney文件夹下 file_path = 'D:\\eastmoney' if not os.path.exists(file_path): os.mkdir(file_path) os.chdir(file_path) ...
# coding: utf-8 from __future__ import unicode_literals import json import re from .common import InfoExtractor from ..compat import compat_str from ..utils import ( determine_ext, float_or_none, int_or_none, try_get, unified_timestamp, url_or_none, ) class PinterestBaseIE(InfoExtractor): ...
# Generated by Django 3.1.4 on 2021-01-27 14:29 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency...
#!/usr/bin/env python # -*- coding:utf-8 -*- """ Date: 2021/11/23 20:31 Desc: 股票基本信息 """ import json import warnings from io import BytesIO import pandas as pd import requests from tqdm import tqdm def stock_info_sz_name_code(indicator: str = "A股列表") -> pd.DataFrame: """ 深圳证券交易所-股票列表 http://www.szse.cn/m...
# Copyright 2021 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...
# -*- coding:utf-8 -*- # Author: hankcs # Date: 2019-12-26 23:20 from hanlp.datasets.parsing.semeval16 import SEMEVAL2016_NEWS_TRAIN, SEMEVAL2016_NEWS_DEV, SEMEVAL2016_NEWS_TEST from hanlp.pretrained.word2vec import SEMEVAL16_EMBEDDINGS_300_NEWS_CN from hanlp.utils.tf_util import nice nice() from hanlp.components.pars...
import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation # 3D related Draw from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm from matplotlib.ticker import LinearLocator, FormatStrFormatter import warnings import math class RTPlotMatrix(object): def __init__(self)...
# -*- coding: utf-8 -*- # Copyright (c) 2016, French National Center for Scientific Research (CNRS) # Distributed under the (new) BSD License. See LICENSE for more info. """ Some benchmark to compare CPU with numpy solution and home made OpenCL implementation. For each filter there is several implementation that do n...
""" Some simple visualizations on the iris data. """ import numpy as np from sklearn import datasets from matplotlib import pyplot as plt import style_figs iris = datasets.load_iris() # Plot the histograms of each class for each feature X = iris.data y = iris.target for x, feature_name in zip(X.T, iris.feature_nam...
import numpy as np import cv2 # Capturing video through webcam webcam = cv2.VideoCapture(0) # Start a while loop while(1): _, imageFrame = webcam.read() hsvFrame = cv2.cvtColor(imageFrame, cv2.COLOR_BGR2HSV) red_lower = np.array([136, 87, 111], np.uint8) red_upper = np.array([180, 255, 255], np.uint8) ...
#!/usr/bin/env python3 import math import collections def half(length): return math.sqrt(2 - math.sqrt(4-length*length)) def double(length): return math.sqrt(length*length*(4-length*length)) def sum_(table, alpha, beta): sup_alpha = math.sqrt(4-table[alpha]**2) sup_beta = math.sqrt(4-table[beta]**2) ...
class DefaultConfig(object): DEBUG = False TESTING = False CSRF_ENABLED = True SECRET_KEY = "this-really-needs-to-be-changed" USER = "this-really-needs-to-be-changed" SQLALCHEMY_DATABASE_URI = "postgresql://" + USER + ":" + SECRET_KEY + "@postgres-adk/this-really-needs-to-be-changed" SQLALCH...
import json import os import argparse import shutil import uuid import glob import logging from typing import Any, Tuple, Union from Tests.Marketplace.marketplace_services import init_storage_client, init_bigquery_client, Pack, PackStatus, \ GCPConfig, CONTENT_ROOT_PATH, \ get_packs_statistics_dataframe from Te...
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2017-11-12 09:12 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('logos', '0003_auto_20171111_2123'), ] operations = [ migrations.AddField( ...
# Generated by Django 3.0.3 on 2020-03-05 05:10 import course.models from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Chapter', ...
# -*- coding: utf-8 -*- # # Copyright 2018 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
from Redy.Opt import constexpr, const, feature from rbnf.core.Result import Result from .user_interface import ResultDescription import typing import io from Redy.Tools.PathLib import Path __all__ = ['compile', 'ResultDescription'] class ZeroExp: def __init__(self, bnf_syntax: str, ...
"""Constants for Glances component.""" import sys from openpeerpower.const import DATA_GIBIBYTES, DATA_MEBIBYTES, PERCENTAGE, TEMP_CELSIUS DOMAIN = "glances" CONF_VERSION = "version" DEFAULT_HOST = "localhost" DEFAULT_NAME = "Glances" DEFAULT_PORT = 61208 DEFAULT_VERSION = 3 DEFAULT_SCAN_INTERVAL = 60 DATA_UPDATED ...
# Copyright (c) 2014 Mirantis, 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...
from opera.error import DataError from opera.instance.relationship import Relationship as Instance class Relationship: def __init__(self, name, types, properties, attributes, interfaces): self.name = name self.types = types self.properties = properties self.attributes = attributes ...
import collections from typing import cast, Dict, Union # noqa: F401 import uuid from cytoolz import ( first, merge, last, ) from eth.db.backends.base import BaseDB from eth.exceptions import ValidationError class DeletedEntry: pass DELETED_ENTRY = DeletedEntry() class Journal(BaseDB): """ ...
from django.contrib.auth.models import User from django import forms from .models import Profile class UserForm(forms.ModelForm): class Meta: model = User fields = ['first_name', 'last_name', 'email'] class ProfileForm(forms.ModelForm): date_of_birth = forms.DateField(widget= forms.SelectDa...
# Copyright 2014 OpenStack Foundation # 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 requ...
import api.geometrie as geometrie import mcpi.minecraft as minecraft import mcpi.block as block mc = minecraft.Minecraft.create() geom = geometrie.Geometrie(mc) #################### # inserer votre code ici geom.prepareLeSol(0,0, 100, 100) etages = ["Rez de chaussee", "1er etage", "2eme etage"] for ypos in xrange(0,...
import logging import copy import json import pytest from collections import defaultdict from tests.common.plugins.sanity_check import constants from tests.common.plugins.sanity_check import checks from tests.common.plugins.sanity_check.checks import * from tests.common.plugins.sanity_check.recover import recover f...
# -*- coding: utf-8 -*- from django import forms from django.core.exceptions import ImproperlyConfigured from django.forms.models import ModelForm from django.utils.encoding import smart_text from django.utils.translation import ugettext as _ from cms.api import create_page from cms.constants import TEMPLATE_INHERITA...
#!/usr/bin/env ipython # dotfiles.venv.ipython_magics from __future__ import print_function """ IPython ``%magic`` commands * ``cd`` aliases * ``ds`` (``dotfiles_status``) * ``dr`` (``dotfiles_reload``) Installation -------------- .. code-block:: bash __DOTFILES="${HOME}/-dotfiles" ipython_profile="profile_...
from collections import deque class Vertex: def __init__(self, value): self.value = value class Edge: def __init__(self, vertex, weight): self.vertex = vertex self.weight = weight class Queue(): def __init__(self): self.dq = deque() def enqueue(self, value): ...
# Copyright 2014-present PlatformIO <contact@platformio.org> # # 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 applicabl...
from datastack import DataTable, DataColumn, label, col, desc import pytest import numpy as np def test_one(): tbl = (DataTable(a=(1,2,1,2,3,1), b=(4,5,6,3,2,1),c=(6,7,8,1,2,3)) .order_by(desc(label("b"))) ) exp = DataTable(a=(1,2,1,2,3,1), b=(6,5,4,3,2,1), c=(8,7,6,1,2,3)) assert tbl...
from os import listdir from os.path import isfile,join import re from collections import Counter, defaultdict def file_names(mypath): onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f)) and f.lower().endswith('.txt')] return onlyfiles def tokenize(s): s = s.lower() #lower case ...
import serial import time import Klsinfo packet1 = bytearray() packet1.append(0x3A) packet1.append(0x00) packet1.append(0x3A) packet2 = bytearray() packet2.append(0x3B) packet2.append(0x00) packet2.append(0x3B) i = 0 rec_packet = bytearray check1 = 0 klsinfo = Klsinfo.KlsInfo() ser = serial...
#!/usr/bin/env python import os import shutil import glob def copy_files(pattern, rootdir, dest='.', nfiles=2): files = sorted(glob.glob(os.path.join(rootdir, pattern)))[:nfiles] for item in files: print item shutil.copy(item, '.') if __name__ == '__main__': datadir='/nfs/farm/g/lsst/u1/te...
from .filter import Filter from .observation import Observation