code
stringlengths
1
199k
''' Created on Aug 29, 2013 @author: Mission Liao ''' from __future__ import absolute_import import sqlite3 from toresdo.dal import AdapterBase from toresdo.dal import Cond class Model(AdapterBase): """ Adapter for Sqlite Internally, real data is stored in a list, which is useful when the 'WHERE' clause...
GIT_RELEASE = ''
""" Django settings for movemyfiles project. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) SECRET_KE...
"""Mixin's main module.""" from pyramid_fullauth.models.mixins.password import UserPasswordMixin from pyramid_fullauth.models.mixins.email import UserEmailMixin __all__ = ("UserPasswordMixin", "UserEmailMixin")
from PIL import ImageTk, Image class operator_filter: def __init__(self): self.operator = [[0,0,0],[0,1,0],[0,0,0]] def apply_filter(self, image): width, height = image.size temp_image = image.copy() real_pixels = image.load() pixels = temp_image.load() width, hei...
from json import dumps from pika import BlockingConnection, ConnectionParameters from sys import argv from datetime import datetime ROUTING_KEY = 'movement_successful_test' print argv host = '54.76.183.35' connection = BlockingConnection(ConnectionParameters(host=host, port=5672)) channel = connection.channel() time = ...
S = input() L = len(S) dp = [[False] * (L + 1) for _ in range(L + 1)] for i in range(L + 1): dp[i][i] = True for w in range(3, L + 1, 3): for left in range(L - w + 1): right = left + w if S[left] != 'm' or S[right - 1] != 'w': continue for mid in range(left + 1, right): ...
class PostError(object): IllegalForm = 2001
""" SDoc Copyright 2016 Set Based IT Consultancy Licence MIT """ from cleo import Application from sdoc.command.SDocCommand import SDocCommand from sdoc.command.SDoc1Command import SDoc1Command from sdoc.command.SDoc2Command import SDoc2Command class SDocApplication(Application): """ The SDocApplication applica...
import os import sys import mock import unittest import scraperwiki import scripts.setup as Setup from scripts.ckan_collect import ckan_num_reg_users as Users from mock import patch class CKANRegisteredUsersTest(unittest.TestCase): '''Unit tests for the CKAN registered users scraper.''' def test_run_program(self): ...
from setuptools import find_packages, setup setup( name='query_logger', author="Mattia Procopio", author_email="promat85@gmail.com", version='0.1.0', description="Utility for logging queries while running on `DEBUG = False`", license='BSD License', packages=find_packages(), classifiers=[...
import sys n = int(raw_input().strip()) for i in range (1,11): print "%d x %d = %d"%(n, i, n*i)
""" Python Interchangeable Virtual Instrument Library Copyright (c) 2012-2016 Alex Forencich 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 ri...
'''Simplified version of DLA in PyTorch. Note this implementation is not identical to the original paper version. But it seems works fine. See dla.py for the original paper version. Reference: Deep Layer Aggregation. https://arxiv.org/abs/1707.06484 ''' import torch import torch.nn as nn import torch.nn.functional ...
import numpy as np from scipy.stats import skew, kurtosis, shapiro, pearsonr, ansari, mood, levene, fligner, bartlett, mannwhitneyu from scipy.spatial.distance import braycurtis, canberra, chebyshev, cityblock, correlation, cosine, euclidean, hamming, jaccard, kulsinski, matching, russellrao, sqeuclidean from sklearn.p...
from __future__ import unicode_literals, absolute_import, division, print_function from ._common import PokerEnum class PokerRoom(PokerEnum): STARS = 'PokerStars', 'STARS', 'PS' FTP = 'Full Tilt Poker', 'FTP', 'FULL TILT' PKR = 'PKR', 'PKR POKER' class Currency(PokerEnum): USD = 'USD', '$' EUR = 'EU...
from django.forms import ModelForm from .models import CompsocUser, DatabaseAccount, ShellAccount class CompsocUserForm(ModelForm): class Meta: model = CompsocUser fields = ['nickname', 'first_name', 'last_name', 'discord_user', 'nightmode_on', 'website_title', 'website_url'] class ShellAccountForm(...
import sys for (pos, line) in enumerate(sys.stdin.readlines()): if [c for c in line if ord(c) > 0x7f]: print "%d: %s" % (pos, line)
import matplotlib.pyplot as plt import numpy as np from algorithms.EM import em from algorithms.PageRank import page_rank from algorithms.borda_ordering import borda_ordering from algorithms.random_circle_removal import random_circle_removal from utils.gradings import get_gradings def position_displacement(rankings): ...
import re import dns import dns.resolver import dns.exception import ldap import ldap.sasl import ldap.controls import socket from .exception import Error as ADError from .object import factory, instance from .creds import Creds from .locate import Locator from .constant import LDAP_PORT, GC_PORT from ..protocol import...
import sys import docopt from six import print_, u from . import __doc__ as doc, get_version, \ PROGRAM_NAME, RESTORE_IPSET_JOB_SCRIPT, UPDATE_IPSET_JOB_SCRIPT from .ipset import generate_ipset from .networks import extract_networks from .utils import script_example_header, printable_path @script_example_header def...
import sys import logging import time from ev3dev2.button import ButtonBase from ev3dev2.sensor import Sensor if sys.version_info < (3, 4): raise SystemError('Must be using Python 3.4 or higher') log = logging.getLogger(__name__) class TouchSensor(Sensor): """ Touch Sensor """ SYSTEM_CLASS_NAME = Se...
class Solution(object): def countAndSay(self, n): """ :type n: int :rtype: str """ ret = [1] for i in range(n - 1): ret = Solution.next(ret) return ''.join(map(str, ret)) @staticmethod def next(s): cnt = 0 last = None ...
""" Test that the sample cleaning logic works as expected. """ import unittest import sys, os, re from copy import copy from pprint import pprint sys.path.insert(0,'../MultiQC') from multiqc.utils.config import mqc_add_config, fn_clean_exts, fn_clean_trim from multiqc.modules.base_module import BaseMultiqcModule def_fn...
from __future__ import absolute_import import datetime import dateutil.parser import types import xml.dom.minidom from ...sfa.trust import gid from ...sfa.trust import credential from ..util.tz_util import tzd from .base_authorizer import AM_Methods, V2_Methods class Base_Resource_Manager: def __init__(self): ...
from __future__ import unicode_literals from django.db import models, migrations import imports.models class Migration(migrations.Migration): dependencies = [ ('imports', '0001_initial'), ] operations = [ migrations.AlterField( model_name='file', name='archivo', ...
import tensorflow as tf import preprocessing as ult from datasets.imagenet_dataset import ImagenetData FLAGS = tf.app.flags.FLAGS tf.app.flags.DEFINE_string('subset', 'train', """Either 'train' or 'validation'.""") tf.app.flags.DEFINE_string('data_dir', '/tmp/mydata', """Path to the processed...
from django.db import models from django.db.models.signals import pre_save import os import socket import datetime import random from django import forms from unique_slugify import unique_slugify def time2s(time): """ given 's.s' or 'h:m:s.s' returns s.s """ sec = reduce(lambda x, i: x*60 + i, map(float...
import _plotly_utils.basevalidators class TicktextsrcValidator(_plotly_utils.basevalidators.SrcValidator): def __init__( self, plotly_name="ticktextsrc", parent_name="scatterpolar.marker.colorbar", **kwargs ): super(TicktextsrcValidator, self).__init__( plotly...
import random import numpy as np from deap import base from deap import creator from deap import tools from deap import algorithms import argparse import pandas import os import numpy as np import matplotlib.pyplot as plt import functools from collections import Counter import math import random def main(args): #hc...
import sys from collections import Iterable class TestResult(object): def __init__(self, test_id, exception=None): self.id = test_id if not exception: self.success = True else: self.success = False self.exception = exception self.messages = [] def ...
import os import chainer from chainer.serializers import npz from chainer.training import extension from chainer.training.extensions import snapshot_writers from chainer.utils import argument def _find_snapshot_files(fmt, path): '''Only prefix and suffix match TODO(kuenishi): currently clean format string such ...
xor = lambda a, b: a != b
try: from ._models_py3 import AccessPolicyEntry from ._models_py3 import Attributes from ._models_py3 import CheckNameAvailabilityResult from ._models_py3 import CloudErrorBody from ._models_py3 import DeletedVault from ._models_py3 import DeletedVaultListResult from ._models_py3 import Dele...
import cmath import math from Tkinter import * def load_naca(filename): '''Loads naca profile from file Files from http://airfoiltools.com/airfoil/naca4digit''' xy = [] f = file(filename) lines = f.readlines() scaleFactor = 200 for line in lines[1:]: # Reference point at quarter of c...
import pysplishsplash as sph import pysplishsplash.Utilities.SceneLoaderStructs as Scenes def main(): # Set up the simulator base = sph.Exec.SimulatorBase() base.init(useGui=True, sceneFile=sph.Extras.Scenes.Empty) # Create an imgui simulator gui = sph.GUI.Simulator_GUI_imgui(base) base.setGui(...
from pignore import main if __name__ == '__main__': main()
from datetime import date, time, timedelta from decimal import Decimal import itertools from django.utils import timezone from six.moves import xrange from .models import Person def get_fixtures(n=None): """ Returns `n` dictionaries of `Person` objects. If `n` is not specified it defaults to 6. """ ...
import json import time from project import db from project.api.models import User from project.tests.base import BaseTestCase from project.tests.utils import add_user class TestAuthBlueprint(BaseTestCase): def test_user_registration(self): with self.client: response = self.client.post( ...
import json import requests import urllib def get_account_status(username, password): # Variables host = 'https://api.premiumize.me/pm-api/v1.php?' params = {'method': 'accountstatus', 'params[login]': username, 'params[pass]': password} # POST r = requests.post(host + ur...
from __future__ import division, unicode_literals """ This module implements an interface to enumlib, Gus Hart"s excellent Fortran code for enumerating derivative structures. This module depends on a compiled enumlib with the executables multienum.x and makestr.x available in the path. Please download the library at ht...
import os import platform import re import sys from contextlib import contextmanager from typing import Any from typing import Callable from typing import Generator from typing import Tuple from typing import Type from unittest.mock import MagicMock import pytest from pytest_mock import MockerFixture from pytest_mock i...
def add_native_methods(clazz): def init____(a0): raise NotImplementedError() def getSystemProxy__java_lang_String__java_lang_String__(a0, a1, a2): raise NotImplementedError() clazz.init____ = staticmethod(init____) clazz.getSystemProxy__java_lang_String__java_lang_String__ = getSystemPro...
from collections import OrderedDict from unittest.mock import PropertyMock, patch import pytest from faker import Faker from faker.config import DEFAULT_LOCALE from faker.generator import Generator class TestFakerProxyClass: """Test Faker proxy class""" def test_unspecified_locale(self): fake = Faker() ...
try: from .resource_py3 import Resource from .network_interface_dns_settings_py3 import NetworkInterfaceDnsSettings from .sub_resource_py3 import SubResource from .public_ip_address_dns_settings_py3 import PublicIPAddressDnsSettings from .resource_navigation_link_py3 import ResourceNavigationLink ...
import json from PyQt5 import QtCore, QtGui, QtWidgets import struct from codebase.client.client import Client from codebase.frontend.main import MainWindow from codebase.utils.singleton import Singleton class Events(metaclass=Singleton): def __init__(self, window): self.window = window def push_button_...
from azure.cli.core.azclierror import AzCLIError from ._client_factory import cf_resource_groups def get_rg_location(ctx, resource_group_name, subscription_id=None): groups = cf_resource_groups(ctx, subscription_id=subscription_id) # Just do the get, we don't need the result, it will error out if the group does...
import sys import os extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', ] source_suffix = '.rst' master_doc = 'index' project = 'bitcoingraph' copyright = '2015, Bernhard Haslhofer' try: import bitcoingraph as bg # The short X.Y version. version = bg.__version__ # The full version, incl...
''' Video player ============ .. versionadded:: 1.2.0 The video player widget can be used to play video and let the user control the play/pausing, volume and position. The widget cannot be customized much because of the complex assembly of numerous base widgets. .. image:: images/videoplayer.jpg :align: center Anno...
"""Code for querying Old Norse language dictionaries/lexicons.""" import regex import yaml from cltk.core.exceptions import CLTKException from cltk.data.fetch import FetchCorpus from cltk.utils.file_operations import make_cltk_path from cltk.utils.utils import query_yes_no __author__ = ["Clément Besnier <clem@clementbe...
from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion def initialize_backupschedule_project_links(apps, schema_editor): BackupSchedule = apps.get_model('openstack_tenant', 'BackupSchedule') for backup_schedule in BackupSchedule.objects.iterator(): ...
import sys, six from django.db import IntegrityError from django.utils.timezone import utc from urlparse import urlparse import json from datetime import datetime from email.utils import parsedate from msgvis.apps.questions.models import Article, Question from msgvis.apps.corpus.models import * from msgvis.apps.enhance...
from knack.help_files import helps # pylint: disable=unused-import helps['cognitiveservices'] = """ type: group short-summary: Manage Azure Cognitive Services accounts. long-summary: This article lists the Azure CLI commands for Azure Cognitive Services account and subscription management only. Refer to the documentat...
from functools import wraps from flask import flash, request, render_template, url_for def render(template_name, **kwargs): print __package__.split('.')[-1::] return render_template(template_name, **kwargs)
import roslib import rospy import smach import smach_ros import sys import time from hlpr_speech_recognition.speech_listener import SpeechListener from perception_states import * from navigation_states import * from manipulation_states import * from hlpr_manipulation_utils.manipulator import * from labeling_states impo...
import pytest from botnet.modules.builtin.reminders import parse_message def test_parse_seconds(): assert parse_message('11.1s lorem ipsum') == (11.1, 'lorem ipsum') assert parse_message('11.1sec lorem ipsum') == (11.1, 'lorem ipsum') assert parse_message('11.1second lorem ipsum') == (11.1, 'lorem ipsum') ...
import functools from typing import Any, Callable, Dict, Generic, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport im...
""" The MIT License (MIT) Copyright (c) 2014 Vivek Jha 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, c...
from conan.packager import ConanMultiPackager if __name__ == "__main__": builder = ConanMultiPackager(username="memsharded", channel="testing") builder.add_common_builds(shared_option_name="Protobuf:shared") filtered_builds = [] for settings, options in builder.builds: if settings["compiler.vers...
from django.utils.text import slugify import nflgame def get_full_team_name(scoreboard_team_name): teams_dict = {'NYG':'New York Giants','PHI':'Philadelphia Eagles','DAL':'Dallas Cowboys','WAS':'Washington Redskins', 'NYJ':'New York Jets', 'NE': 'New England Patriots', 'MIA':'Miami Dolphins','BUF':'Buffalo Bills', ...
"""Parse the output of nettest.py into a human-readable list of outage periods. The input is a sorted list of lines like: 1157962502 0 1157962802 1 where the first number is a Unix timestamp, and the second is a 0 for Internet connection down or 1 for Internet connection up. """ import sys import time def prettify(time...
"""merzlyakov URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-b...
from django.test import TestCase from threes_game.gameplay import Board class GameplayTest(TestCase): def setUp(self): self.blank_board = Board() data = list() for n in xrange(4): data.append(range(4 * n, 4 * (n + 1))) self.populated_board = Board(data=data) test_...
from pathlib import Path from os import system from sys import argv, exit from EMAlgorithm import EMAlgorithm from DatabaseReducer import DatabaseReducer from res.ResourceFiles import REDUCED_DB_FILE def main(): try: INPUT_FILE = str(argv[1]) except: print("Missing argument: input file") ...
from flask.ext.wtf import Form from wtforms import StringField, PasswordField, BooleanField, SubmitField, FileField from wtforms.validators import Required, Length, EqualTo from ..models import User from wtforms import ValidationError from flask.ext.login import current_user class LoginForm(Form): uid = StringField...
import unittest import transaction import random from pyramid import testing from pyramid.response import Response import pytest from mood_bot.models import ( User, Sentiments, get_tm_session, ) from mood_bot.models.meta import Base from faker import Faker from passlib.apps import custom_app_context as cont...
from polyphony import testbench def list12(x): reg1 = [0] * 32 reg2 = [10, 12, 14] reg1[0] = reg2[0] reg1[1] = reg2[1] reg1[2] = reg2[2] return reg1[0] + reg1[1] + reg1[2] @testbench def test(): assert 36 == list12(3) test()
import functools from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import Pipe...
""" SnapSearch.tests.test_cgi ~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests SnapSearch.cgi :author: `LIU Yu <liuyu@opencps.net>`_ :date: 2014/03/10 """ __all__ = ['TestControllerMethods', ] import json import os import sys try: from . import _config from ._config import unittest except (ValueError, Impor...
import setuptools setuptools.setup( name='pyregdict', version='0.1', description='Access to Windows Registry data as if a Unix file path.', author='Charles Aracil', author_email='charles.aracil+pyregdict@gmail.com', python_requires='>=3.6', install_requires=(), extras_require={}, py_...
SETTING2 = 'overridden'
from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('gallery', '0006_auto_20151020_1548'), ] operations = [ migrations.DeleteModel( name='EventManager', ), ]
""" Variance Gamma process ====================== """ import numpy as np __all__ = ['VarGamma', 'VarGammaParam'] class VarGammaParam(object): """Parameter storage. """ def __init__(self, theta=-.14, nu=.2, sigma=.25): """Initialize class. Parameters ---------- nu : float ...
from __future__ import unicode_literals from django.core.cache import caches, InvalidCacheBackendError from ..utils import make_template_fragment_key from django.template import Library, Node, TemplateSyntaxError, VariableDoesNotExist register = Library() class CacheNode(Node): def __init__(self, nodelist, fragment...
from flask import * from flask_socketio import SocketIO, emit import os from random import sample from time import time USERS_START = 1 CDOWN_LENGTH = 5000 NUM_WORDS = 25 SITE_ROOT = os.path.realpath(os.path.dirname(__file__)) app = Flask(__name__, static_url_path='/static') socketio = SocketIO(app) def clean_word(word...
def build_person(first_name, last_name, age=''): person = {'first': first_name, 'last': last_name} if age: person['age'] = age return person musician = build_person('jimi', 'hendrix', age=27) print(musician)
""" dto.Record is an abstract base class. Its subclasses hold information about individual data records, which are represented by individual lines in the HonSSH-generated files, individual rows in the local db storage tables, or individual "documents" in the ElasticSearch database. """ import abc fr...
import sys from functools import wraps from abl.vpath.base.fs import CONNECTION_REGISTRY def os_create_file(some_file, content='content'): with open(some_file, 'w') as fd: fd.write('content') def create_file(path, content='content'): with path.open('w') as fs: fs.write(content) return path d...
from boundaries.configs.common.settings import * DEBUG = True TEMPLATE_DEBUG = DEBUG DATABASES = { 'default': { 'ENGINE': 'django.contrib.gis.db.backends.postgis', 'NAME': 'boundaries', 'HOST': 'TODO', 'PORT': '5432', 'USER': 'TODO', 'PASSWORD': 'TODO' } } MEDIA_U...
import requests from urllib3.exceptions import InsecureRequestWarning from jobs import AbstractJob class Plex(AbstractJob): def __init__(self, conf): self.interval = conf["interval"] self.movies = conf["movies"] self.shows = conf["shows"] self.timeout = conf.get("timeout") se...
from __future__ import division from random import randint import myhdl from myhdl import (Signal, always_comb, instance, delay, StopSimulation, ) from rhea.cores.uart import uartlite from rhea.models.uart import UARTModel from rhea import Global, Clock, Reset from rhea.system import FIFOBus from rhea.utils.test import...
import busbus from busbus.provider.lawrenceks import LawrenceTransitProvider from .conftest import mock_gtfs_zip import arrow import pytest import responses @pytest.fixture(scope='module') @responses.activate def lawrenceks_provider(engine): responses.add(responses.GET, LawrenceTransitProvider.gtfs_url, ...
def mergesort(seq): if len(seq) <= 1: return seq mid = len(seq) / 2 left = mergesort(seq[:mid]) right = mergesort(seq[mid:]) res = [] while left and right: if left[0] < right[0]: res.append(left.pop(0)) else: res.append(right.pop(0)) res += (le...
""" ========================================== Author: Tyler Brockett Username: /u/tylerbrockett Description: NetNeutralityBot Date Created: 08/03/2017 Date Last Edited: 08/03/2017 Version: v1.0 ========================================== """ import os import time import t...
"""1473. Paint House III https://leetcode.com/problems/paint-house-iii/ There is a row of m houses in a small city, each house must be painted with one of the n colors (labeled from 1 to n), some houses that have been painted last summer should not be painted again. A neighborhood is a maximal group of continuous house...
from __future__ import annotations import sys from collections import deque from typing import Generic, TypeVar T = TypeVar("T") class LRUCache(Generic[T]): """ Page Replacement Algorithm, Least Recently Used (LRU) Caching. >>> lru_cache: LRUCache[str | int] = LRUCache(4) >>> lru_cache.refer("A") >>...
import re import click from tabulate import tabulate from ._compat import iteritems from .conversions import ( _to_dp, _from_dp, DENSITY_DEFAULT, DENSITY_VALUE_MAP, UNITS, ) HDR_ROW = (('density',) + UNITS) INPUT_RE = re.compile(r'([0-9\.]+)([a-zA-Z]{2})(?:@(.*))?') def parse_size(value): match ...
import tensorflow import lightgbm def handler(event, context): return 0
import re from pywps import xml_util as etree from pywps.app.Common import Metadata from pywps.exceptions import InvalidParameterValue from pywps.inout.formats import Format from pywps.inout import basic from copy import deepcopy from pywps.validator.mode import MODE from pywps.inout.literaltypes import AnyValue, NoVal...
from __future__ import print_function from threading import Thread, Lock, RLock, Condition from functools import * import threading import sys import time import os import os.path import re import argparse import getpass import socket import json import importlib import traceback import functools import itertools impor...
import time #time import psycopg2 #psycopg2 to connect to POSTGRES database import json #json to load json import urllib2 #urlib2 to open url from datetime import datetime #datetime import calendar #date try: conn = psycopg2.connect("dbname='postgres' user='postgres' host='localhost'\ password='smohanta'") ...
import ipaddress from flask_restful import Resource, reqparse, abort, inputs, fields, marshal from flask_login import login_required from twisted.internet.defer import inlineCallbacks, returnValue from crochet import wait_for, TimeoutError from floranet.models.application import Application from floranet.imanager impor...
import numpy as np import scipy.sparse as sps def kron3(A, B, C): return sps.kron(A, sps.kron(B, C)) def kron_IID(D, A): n = D.shape[1] A = A.reshape((n,n,n)) return np.einsum('kj,aij', D, A).ravel() def kron_IDI(D, A): n = D.shape[1] A = A.reshape((n,n,n)) return np.einsum('ij,ajk', D, A).r...
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_dependency(settings.AUTH_USER_MODEL), ('rango', '0003_category_slug'), ]...
"""File: timeweb.py Description: History: 0.1.0 The first version. """ __version__ = '0.1.0' __author__ = 'SpaceLis' from matplotlib import pyplot as plt from anatool.analysis.timemodel import TimeModel from anatool.analysis.textmodel import LanguageModel from anatool.analysis.ranking import ranke, linearjoin, randrank...
import sys, os, mimetypes, concurrent.futures def resultsSearchFile(filepath, target): with open(filepath, "r", encoding="UTF-8") as thefile: result, foundOnce = "", False try: i = 1 for line in thefile: if line.find(target) != -1: if not f...
import numpy as np from pycqed.measurement.waveform_control_CC import amsterdam_waveforms as awf class TestAmsterdamWaveforms: def test_amsterdam_waveform(self): unitlength = 10 rescaling = 0.7 roofScale = 0.5 ams_sc_base = 0.47 * rescaling ams_sc_step = 0.07 * rescaling * ro...
''' https://fisherzachary.github.io/public/r-output.html ''' import math from boundings import * from shapes import * class ShapeDescriptor(): def __init__(self, poly): self._poly = poly self.BG = BoundingGeometry(self._poly.points) def Area(self): return self._poly.area() def Perime...
class Solution: # @param {integer[]} nums # @param {integer} k # @param {integer} t # @return {boolean} def containsNearbyAlmostDuplicate(self, nums, k, t): if t == 0: if not self.containsDuplicate(nums): return False for i in range(len(nums) - 1): ...
""" stonemason.renderer.engine.rendernode ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The basic interface and components of renderer nodes. """ __author__ = 'ray' __date__ = '4/19/15' class RenderNode(object): # pragma: no cover """Render Node Interface The `RenderNode` renders a specified area of geogra...