blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
112
license_type
stringclasses
2 values
repo_name
stringlengths
5
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
777 values
visit_date
timestamp[us]date
2015-08-06 10:31:46
2023-09-06 10:44:38
revision_date
timestamp[us]date
1970-01-01 02:38:32
2037-05-03 13:00:00
committer_date
timestamp[us]date
1970-01-01 02:38:32
2023-09-06 01:08:06
github_id
int64
4.92k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-04 01:52:49
2023-09-14 21:59:50
gha_created_at
timestamp[us]date
2008-05-22 07:58:19
2023-08-21 12:35:19
gha_language
stringclasses
149 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
3
10.2M
extension
stringclasses
188 values
content
stringlengths
3
10.2M
authors
listlengths
1
1
author_id
stringlengths
1
132
319d58ed3197580898e4249bda21bfd1cec0797b
bad04904c1c939be61682aebabb0e37409011b3f
/authentication/views/admin.py
c64770c7f650d395b8cdb30fe504657672abe7ae
[]
no_license
oosprey/SRPA
499213d39f41141dc35ab9170510a1f18332b17c
37017f600f61ea1b4a8c8c928ca65ab2c1f00d29
refs/heads/master
2021-01-23T22:00:31.865443
2017-10-12T03:16:27
2017-10-12T03:16:27
102,920,120
0
0
null
2017-09-09T02:17:00
2017-09-09T02:17:00
null
UTF-8
Python
false
false
5,429
py
#!/usr/bin/env python3 # coding: UTF-8 # Author: David # Email: youchen.du@gmail.com # Created: 2017-10-06 14:12 # Last modified: 2017-10-07 17:05 # Filename: admin.py # Description: from django.views.generic import TemplateView, CreateView, UpdateView from django.views.generic import DetailView, ListView from django.contrib.auth.mixins import UserPassesTestMixin from django.contrib.auth.models import User, Group from django.urls import reverse_lazy from django.http import HttpResponseRedirect from const.models import Workshop from authentication import USER_IDENTITY_TEACHER from authentication.forms import TeacherRegisterForm, TeacherUpdateForm from authentication.forms import WorkshopUpdateForm from authentication.models import TeacherInfo from tools.utils import assign_perms class AdminBase(UserPassesTestMixin): raise_exception = True def test_func(self): user = self.request.user return user.is_authenticated and user.is_superuser class AdminIndex(AdminBase, TemplateView): template_name = 'authentication/admin/index.html' class AdminTeacherAdd(AdminBase, CreateView): template_name = 'authentication/admin/teacher_add.html' form_class = TeacherRegisterForm identity = USER_IDENTITY_TEACHER success_url = reverse_lazy('auth:admin:index') form_post_url = reverse_lazy('auth:admin:teacher:add') info_name = 'teacherinfo' def form_valid(self, form): username = form.cleaned_data['username'] first_name = form.cleaned_data['name'] password = form.cleaned_data['password'] email = form.cleaned_data['email'] user = User.objects.create_user( email=email, username=username, password=password, first_name=first_name) form.instance.user = user form.instance.identity = self.identity self.object = form.save() assign_perms(self.info_name, user, self.object, perms=['update', 'view']) return HttpResponseRedirect(self.get_success_url()) def get_context_data(self, **kwargs): kwargs['form_post_url'] = self.form_post_url return super(AdminTeacherAdd, self).get_context_data(**kwargs) class AdminTeacherUpdate(AdminBase, UpdateView): model = TeacherInfo form_class = TeacherUpdateForm template_name = 'authentication/admin/teacher_info_update.html' slug_field = 'uid' slug_url_kwarg = 'uid' success_url = reverse_lazy('auth:admin:teacher:list', args=(1,)) def get_initial(self): kwargs = {} kwargs['first_name'] = self.object.user_info.user.first_name kwargs['phone'] = self.object.user_info.phone kwargs['email'] = self.object.user_info.user.email return kwargs def form_valid(self, form): self.object = form.save() cleaned_data = form.cleaned_data user_info = self.object.user_info user_info.phone = cleaned_data['phone'] user_info.save() user = user_info.user user.email = cleaned_data['email'] user.save() return HttpResponseRedirect(self.get_success_url()) class AdminTeacherDetail(AdminBase, DetailView): model = TeacherInfo template_name = 'authentication/admin/teacher_info_detail.html' slug_field = 'uid' slug_url_kwarg = 'uid' class AdminTeacherList(AdminBase, ListView): model = TeacherInfo template_name = 'authentication/admin/teacher_info_list.html' paginate_by = 10 ordering = 'user_info__user__first_name' class AdminWorkshopAdd(AdminBase, CreateView): model = Workshop template_name = 'authentication/admin/workshop_add.html' fields = ['desc'] success_url = reverse_lazy('auth:admin:workshop:list', args=(1,)) def form_valid(self, form): self.object = form.save(commit=False) group, status = Group.objects.get_or_create(name=self.object.desc) self.object.group = group self.object.save() return HttpResponseRedirect(self.get_success_url()) class AdminWorkshopUpdate(AdminBase, UpdateView): model = Workshop form_class = WorkshopUpdateForm template_name = 'authentication/admin/workshop_update.html' slug_field = 'uid' slug_url_kwarg = 'uid' success_url = reverse_lazy('auth:admin:workshop:list', args=(1,)) def get_initial(self): kwargs = {} kwargs['group_users'] = self.object.group.user_set.all() return kwargs def form_valid(self, form): cleaned_data = form.cleaned_data group = self.object.group old_users = User.objects.filter(groups__name=group) for user in old_users: user.groups.remove(group) for user in cleaned_data['group_users']: user.groups.add(group) return super(AdminWorkshopUpdate, self).form_valid(form) class AdminWorkshopDetail(AdminBase, DetailView): model = Workshop template_name = 'authentication/admin/workshop_detail.html' slug_field = 'uid' slug_url_kwarg = 'uid' def get_context_data(self, **kwargs): context = super(AdminWorkshopDetail, self).get_context_data(**kwargs) context['group_users'] = self.object.group.user_set.all() return context class AdminWorkshopList(AdminBase, ListView): model = Workshop template_name = 'authentication/admin/workshop_list.html' paginate_by = 10 ordering = 'desc'
[ "youchen.du@gmail.com" ]
youchen.du@gmail.com
c3b667c46fa1e0574626695cf60534a6c36e3f66
0ad7fa728c4a8eabb82edb7eb757a4bef3f0a19f
/ha/I2CInterface.py
9883e5e8fc196114b756733829d1bfdb8cceedfa
[]
no_license
randyr505/ha
bb5d8d38441cee41a0c961a6e9d92e8cbbf89a0f
6771c50e3141c4162c89569fa4bce95b5f121867
refs/heads/master
2020-12-29T02:54:43.339856
2016-05-23T00:51:47
2016-05-23T00:51:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,275
py
import smbus from ha.HAClasses import * class I2CInterface(HAInterface): def __init__(self, name, interface=None, event=None, bus=0): HAInterface.__init__(self, name, interface=interface, event=event) self.bus = smbus.SMBus(bus) def read(self, addr): try: debug('debugI2C', self.name, "readByte", addr) return self.bus.read_byte_data(*addr) except: return 0 def readWord(self, addr): try: debug('debugI2C', self.name, "readWord", addr) return self.bus.read_word_data(*addr) except: return 0 def readBlock(self, addr, length): try: debug('debugI2C', self.name, "readBlock", addr, length) return self.bus.read_i2c_block_data(*addr+(length,)) except: return 0 def write(self, addr, value): debug('debugI2C', self.name, "writeByte", addr, value) self.bus.write_byte_data(*addr+(value,)) def writeWord(self, addr, value): debug('debugI2C', self.name, "writeWord", addr, value) self.bus.write_word_data(*addr+(value,)) def writeQuick(self, addr): debug('debugI2C', self.name, "writeQuick", addr) self.bus.write_quick(addr)
[ "joe@thebuehls.com" ]
joe@thebuehls.com
62efaef4c35f83861dd5de7f6c954b1a4eb15c55
11ff14c118240e87c4804d0373e4656d0683d479
/RatToolAgent/ZapAgent.py
77c8328884d695c9fe760d84041ff9d8482c5aa6
[]
no_license
wxmmavis/OS3.1
e3028d9c79d5a1a17449fea6380fcdda902bdec7
26d954344207a82d2298821c3c4f01302393dc7e
refs/heads/master
2020-03-25T20:07:11.225493
2018-08-13T03:20:57
2018-08-13T03:20:57
144,115,963
0
0
null
null
null
null
UTF-8
Python
false
false
2,868
py
import subprocess as sp import time import threading import pdb import re from RatToolAgent import _adapter_name _zap_dict = dict(thread=None, zap_cmd=r'zap -s%s -d%s -X%s', pskill_cmd=r'C:\bin\win\pskill') def send_zap_traffic(source_ip="", destination_ip="", duration="", speed="", proto="", length="", tos="" , debug=False): """ send traffic through zap - source_ip: Specify the IP address of the source station. - destination_ip: Specify the IP address of the destination station. - duration: Test for specified number of seconds. - speed: Controls the rate in mbits/s for transmitting data """ if debug: pdb.set_trace() cmd = _zap_dict['zap_cmd']% (source_ip, destination_ip, duration) if speed: cmd += ' -r%s' % speed if proto == 'tcp': cmd += ' -t' if length: cmd += " -l%s" % length if tos: cmd += " -q%s" % tos zap_thread = LaunchZap('start "zap traffic" %s' % cmd) _zap_dict['thread'] = zap_thread zap_thread.start() return zap_thread def kill_zap_thread(): """ Stop zap by killing its process """ # Find tcpdump process to kill cmd = _zap_dict['pskill_cmd']+ " -t zap" if _zap_dict['thread'] != None: #pipe = sp.Popen(cmd, shell=True, stdout=sp.PIPE) del(_zap_dict['thread']) output = sp.Popen(cmd, stdout=sp.PIPE).communicate()[0] return output def get_sta_traffic_by_if_name(if_name='Wireless Network Connection'): """ get station traffic from cmd "netsh interface show ip interface" - if_name: user-friendly name return tuple (In Octets, Out Octets) """ #@author: Jane.Guo @since: 2013-11 fix bug to get adapter_name from RatToolAgent global _adapter_name if_name = _adapter_name result = {} cmd_line = "netsh interface ip show interface" output = sp.Popen(cmd_line, stdout=sp.PIPE).communicate()[0] for if_info in re.split(r'\r\n\r\n', output): if re.findall(if_name,if_info): for line in if_info.split('\r\n'): k, v = re.split(r':\s+',line) result[k]=v return (result['In Octets'],result['Out Octets']) class LaunchZap(threading.Thread): tlock = threading.Lock() id = 0 def __init__(self, start_cmd): threading.Thread.__init__(self) self.command = start_cmd self.status = 0 self.pid = -1 def run(self): self.pipe = sp.Popen(self.command, shell=True, stdin=sp.PIPE,stdout=sp.PIPE,stderr=sp.PIPE) self.status = 1 time.sleep(5) self.pid = self.pipe.pid self.data = self.pipe.stdout.read() self.status = 2 def pid(self): return self.pid def isDone(self): return (self.status != 1)
[ "1475806321@qq.com" ]
1475806321@qq.com
2967013c3c0c4a820168109b8f5c6c19cdcfe04c
53396d12d606bebea71c149aed0150af7b17b6f5
/array/medium/215-kth-largest-element-in-an-array-1.py
af2f422c0b1f7c9ef583847bde0cd8c0f18028da
[]
no_license
superggn/myleetcode
4c623bd9ad3892d826df73ad3b2c122e08aaa9e9
40ca33aefbf0cf746a2d0b7e7f52643ae39591be
refs/heads/master
2023-02-02T11:06:35.163570
2020-12-19T10:36:45
2020-12-19T10:36:45
322,821,962
0
0
null
null
null
null
UTF-8
Python
false
false
302
py
""" 排序-普通版 https://leetcode-cn.com/problems/kth-largest-element-in-an-array/solution/pai-xu-by-powcai-2/ """ import heapq from typing import List # 排序 class Solution: def findKthLargest(self, nums: List[int], k: int) -> int: return sorted(nums, reverse=True)[k - 1]
[ "939401399@qq.com" ]
939401399@qq.com
c6cb81d05d1327c650793835d04ddd9cd32a007c
750fa6642143723f4585a8668af701cccf053c5d
/barcodecop/barcodecop.py
d617f934941522f30ee36fabd89d40fe41fc19f7
[ "MIT" ]
permissive
dhoogest/barcodecop
858c2cb9d553c4334e1edf67ed7d9723de59cfc5
586fb0df6889caef1bfe9d7cf2a138667465ca89
refs/heads/master
2021-01-25T06:25:19.933057
2017-03-13T19:24:45
2017-03-13T19:24:45
93,571,730
0
0
null
2017-06-06T23:08:28
2017-06-06T23:08:28
null
UTF-8
Python
false
false
5,274
py
#!/usr/bin/env python """Filter fastq files, limiting to exact barcode matches. Input and output files may be compressed as indicated by a .bz2 or .gz suffix. """ import argparse import sys from collections import Counter from itertools import islice, tee, izip import operator import logging from collections import namedtuple from fastalite import fastqlite, Opener try: from . import __version__ except: __version__ = '' class VersionAction(argparse._VersionAction): """Write the version string to stdout and exit""" def __call__(self, parser, namespace, values, option_string=None): formatter = parser._get_formatter() formatter.add_text(parser.version if self.version is None else self.version) sys.stdout.write(formatter.format_help()) sys.exit(0) def filter(barcodes, seqs, bc_match, invert=False): compare = operator.ne if invert else operator.eq for bc, seq in izip(barcodes, seqs): assert bc.id == seq.id if compare(str(bc.seq), bc_match): yield seq def seqdiff(s1, s2): if s1 == s2: return s1 else: return ''.join('.' if c1 == c2 and c1.isalpha() else c2 for c1, c2 in zip(s1, s2)) def as_fastq(seq): return '@{seq.description}\n{seq.seq}\n+\n{seq.qual}\n'.format(seq=seq) def combine_dual_indices(file1, file2): Seq = namedtuple('Seq', ['id', 'seq']) for i1, i2 in izip(fastqlite(file1), fastqlite(file2)): assert i1.id == i2.id yield Seq(id=i1.id, seq=i1.seq + '+' + i2.seq) def main(arguments=None): parser = argparse.ArgumentParser( prog='barcodecop', description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument( 'index', nargs='+', type=Opener(), metavar='file.fastq[.bz2|.gz]', help='one or two files containing index reads in fastq format') parser.add_argument( '-f', '--fastq', type=Opener(), metavar='file.fastq[.bz2|.gz]', help='reads to filter in fastq format') parser.add_argument( '-o', '--outfile', default=sys.stdout, type=Opener('w'), help='output fastq') parser.add_argument( '--snifflimit', type=int, default=10000, metavar='N', help='read no more than N records from the index file [%(default)s]') parser.add_argument( '--head', type=int, metavar='N', help='limit the output file to N records') parser.add_argument( '--min-pct-assignment', type=float, default=90.0, metavar='PERCENT', help=("""warn (or fail with an error; see --strict) if the most common barcode represents less than PERCENT of the total [%(default)s]""")) parser.add_argument( '--strict', action='store_true', default=False, help=("""fail if conditions of --min-pct-assignment are not met""")) parser.add_argument( '--invert', action='store_true', default=False, help='include only sequences *not* matching the most common barcode') # parser.add_argument('--format', choices=['fasta', 'fastq'], default='fastq') parser.add_argument( '-c', '--show-counts', action='store_true', default=False, help='tabulate barcode counts and exit') parser.add_argument( '-q', '--quiet', action='store_true', default=False, help='minimize messages to stderr') parser.add_argument( '-V', '--version', action=VersionAction, version=__version__, help='Print the version number and exit') args = parser.parse_args(arguments) logging.basicConfig( format='%(message)s', level=logging.ERROR if args.quiet else logging.INFO) log = logging.getLogger(__name__) if len(args.index) == 1: bcseqs = fastqlite(args.index[0]) elif len(args.index) == 2: bcseqs = combine_dual_indices(*args.index) else: log.error('error: please specify either one or two index files') bc1, bc2 = tee(bcseqs, 2) # determine the most common barcode barcode_counts = Counter([str(seq.seq) for seq in islice(bc1, args.snifflimit)]) barcodes, counts = zip(*barcode_counts.most_common()) most_common_bc = barcodes[0] most_common_pct = 100 * float(counts[0])/sum(counts) log.info('most common barcode: {} ({}/{} = {:.2f}%)'.format( most_common_bc, counts[0], sum(counts), most_common_pct)) if args.show_counts: for bc, count in barcode_counts.most_common(): print('{}\t{}\t{}'.format(bc, seqdiff(most_common_bc, bc), count)) return None if most_common_pct < args.min_pct_assignment: msg = 'frequency of most common barcode is less than {}%'.format( args.min_pct_assignment) if args.strict: log.error('Error: ' + msg) sys.exit(1) else: log.warning('Warning: ' + msg) if not args.fastq: log.error('specify a fastq format file to filter using -f/--fastq') sys.exit(1) seqs = fastqlite(args.fastq) filtered = islice(filter(bc2, seqs, most_common_bc, args.invert), args.head) for seq in filtered: args.outfile.write(as_fastq(seq)) if __name__ == '__main__': sys.exit(main(sys.argv[1:]))
[ "noah.hoffman@gmail.com" ]
noah.hoffman@gmail.com
67fd7ac430f02f90e57cf3651190c6e9dd7bb15f
ff6f60d02ed8d024f7b2db5c9eb4b1196ebf166b
/mysite/blog2/migrations/0002_article_pub_time.py
761ae2617117e36ba66c73bf9d7ffbcc593e45f4
[]
no_license
cekong/learnit
43b707e347ff552754b6592e01dd106c98cd0cc5
b4111d6fee95960f7b7ca5421b7159cb6122ad2a
refs/heads/master
2020-03-25T13:53:37.848843
2019-08-29T06:46:48
2019-08-29T06:46:48
143,848,485
0
0
null
null
null
null
UTF-8
Python
false
false
378
py
# Generated by Django 2.0.7 on 2018-10-25 06:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog2', '0001_initial'), ] operations = [ migrations.AddField( model_name='article', name='pub_time', field=models.DateTimeField(auto_now=True), ), ]
[ "noreply@github.com" ]
cekong.noreply@github.com
4afecaed7d549f21e85ffa373e6b6bd797513efe
3fda2cf03821d5627d6628aca348870ac3d127c2
/utils.py
4561fe05ef59a3c5eb413fc664df80a1786c8aa1
[ "MIT" ]
permissive
valohai/aws-pricelist-tool
04f0e601cb32995d37f2b207480fe4db4f094f0a
637ff1add70dc5bab0651abd7051822da9df671f
refs/heads/master
2020-04-25T22:24:50.348013
2019-10-18T16:51:00
2019-10-24T13:35:01
173,110,705
1
0
MIT
2019-10-24T13:35:03
2019-02-28T12:45:16
Python
UTF-8
Python
false
false
2,293
py
import fnmatch import itertools import json import os import time import logging from typing import Set import requests log = logging.getLogger(__name__) REGIONS = { 'ap-northeast-1': 'Asia Pacific (Tokyo)', 'ap-northeast-2': 'Asia Pacific (Seoul)', 'ap-northeast-3': 'Asia Pacific (Osaka-Local)', 'ap-south-1': 'Asia Pacific (Mumbai)', 'ap-southeast-1': 'Asia Pacific (Singapore)', 'ap-southeast-2': 'Asia Pacific (Sydney)', 'ca-central-1': 'Canada (Central)', 'cn-north-1': 'China (Beijing)', 'cn-northwest-1': 'China (Ningxia)', 'eu-central-1': 'EU (Frankfurt)', 'eu-north-1': 'EU (Stockholm)', 'eu-west-1': 'EU (Ireland)', 'eu-west-2': 'EU (London)', 'eu-west-3': 'EU (Paris)', 'sa-east-1': 'South America (São Paulo)', 'us-east-1': 'US East (N. Virginia)', 'us-east-2': 'US East (Ohio)', 'us-gov-east-1': 'AWS GovCloud (US-East)', 'us-gov-west-1': 'AWS GovCloud (US)', 'us-west-1': 'US West (N. California)', 'us-west-2': 'US West (Oregon)', } def download_or_read_cached_json(url, cache_filename, max_age=86400): if os.path.isfile(cache_filename) and (time.time() - os.stat(cache_filename).st_mtime) < max_age: log.info(f'Using cached {cache_filename}') with open(cache_filename) as infp: return json.load(infp) log.info(f'Requesting {url}') resp = requests.get(url) resp.raise_for_status() data = resp.json() os.makedirs(os.path.dirname(os.path.realpath(cache_filename)), exist_ok=True) with open(cache_filename, 'wb') as outfp: outfp.write(resp.content) return data def get_region_names() -> Set[str]: return set(REGIONS.keys()) def get_price_list(region, offer): return download_or_read_cached_json( url=f'https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/{offer}/current/{region}/index.json', cache_filename=f'cache/aws-prices-{region}-{offer}.cache.json', ) def get_first_dict_value(d): return next(iter(d.values())) def wildcard_filter(values, patterns): return itertools.chain(*((value for value in values if fnmatch.fnmatch(value, pattern)) for pattern in patterns)) def wildcard_match(value, patterns): return any(fnmatch.fnmatch(value, pat) for pat in patterns)
[ "akx@iki.fi" ]
akx@iki.fi
52afe2fe2d6b878609a8ca061380d4bdaf627bc6
e121ceeeeea5dbacbd3ea36f8d5f226ea43faa89
/shop_catalog/shop_catalog/urls.py
c162cf0f299f8c60d5e66f4a4badb4ace00cf7b0
[]
no_license
Ranc58/training_django_shop
dae7b264f849502da0e54f2d70c715335a8d52f9
260b7c1be1c120652a791ff355afdd64c06602b0
refs/heads/master
2021-05-16T01:34:08.820340
2017-10-16T13:50:08
2017-10-16T13:50:08
107,131,650
0
0
null
null
null
null
UTF-8
Python
false
false
1,148
py
"""shop_catalog URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.11/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-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf import settings from django.conf.urls import url from django.conf.urls.static import static from django.contrib import admin from technic_catalog.views import ProductList, ProductView app_name = 'technic_catalog' urlpatterns = [ url(r'^$', ProductList.as_view(), name='index_page'), url(r'^product/(?P<pk>[0-9]+)/$', ProductView.as_view(), name='product_detail'), url(r'^admin/', admin.site.urls), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
[ "rancvova@gmail.com" ]
rancvova@gmail.com
bb7672c211d730b8ac2e4d8c18f97d833e607424
824b582c2e0236e987a29b233308917fbdfc57a7
/sdk/python/pulumi_google_native/iam/v1/get_service_account_iam_policy.py
cb879aff8b8fc2d019e19500fe1af7596f78c7a2
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
24601/pulumi-google-native
ce8faf8455609a9572a8cbe0638c66427bf0ae7f
b219a14201c6c58eaa10caaeacbdaab528931adf
refs/heads/master
2023-08-23T05:48:31.819709
2021-10-08T18:50:44
2021-10-08T18:50:44
null
0
0
null
null
null
null
UTF-8
Python
false
false
7,255
py
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from ... import _utilities from . import outputs __all__ = [ 'GetServiceAccountIamPolicyResult', 'AwaitableGetServiceAccountIamPolicyResult', 'get_service_account_iam_policy', 'get_service_account_iam_policy_output', ] @pulumi.output_type class GetServiceAccountIamPolicyResult: def __init__(__self__, audit_configs=None, bindings=None, etag=None, version=None): if audit_configs and not isinstance(audit_configs, list): raise TypeError("Expected argument 'audit_configs' to be a list") pulumi.set(__self__, "audit_configs", audit_configs) if bindings and not isinstance(bindings, list): raise TypeError("Expected argument 'bindings' to be a list") pulumi.set(__self__, "bindings", bindings) if etag and not isinstance(etag, str): raise TypeError("Expected argument 'etag' to be a str") pulumi.set(__self__, "etag", etag) if version and not isinstance(version, int): raise TypeError("Expected argument 'version' to be a int") pulumi.set(__self__, "version", version) @property @pulumi.getter(name="auditConfigs") def audit_configs(self) -> Sequence['outputs.AuditConfigResponse']: """ Specifies cloud audit logging configuration for this policy. """ return pulumi.get(self, "audit_configs") @property @pulumi.getter def bindings(self) -> Sequence['outputs.BindingResponse']: """ Associates a list of `members` to a `role`. Optionally, may specify a `condition` that determines how and when the `bindings` are applied. Each of the `bindings` must contain at least one member. """ return pulumi.get(self, "bindings") @property @pulumi.getter def etag(self) -> str: """ `etag` is used for optimistic concurrency control as a way to help prevent simultaneous updates of a policy from overwriting each other. It is strongly suggested that systems make use of the `etag` in the read-modify-write cycle to perform policy updates in order to avoid race conditions: An `etag` is returned in the response to `getIamPolicy`, and systems are expected to put that etag in the request to `setIamPolicy` to ensure that their change will be applied to the same version of the policy. **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. """ return pulumi.get(self, "etag") @property @pulumi.getter def version(self) -> int: """ Specifies the format of the policy. Valid values are `0`, `1`, and `3`. Requests that specify an invalid value are rejected. Any operation that affects conditional role bindings must specify version `3`. This requirement applies to the following operations: * Getting a policy that includes a conditional role binding * Adding a conditional role binding to a policy * Changing a conditional role binding in a policy * Removing any role binding, with or without a condition, from a policy that includes conditions **Important:** If you use IAM Conditions, you must include the `etag` field whenever you call `setIamPolicy`. If you omit this field, then IAM allows you to overwrite a version `3` policy with a version `1` policy, and all of the conditions in the version `3` policy are lost. If a policy does not include any conditions, operations on that policy may specify any valid version or leave the field unset. To learn which resources support conditions in their IAM policies, see the [IAM documentation](https://cloud.google.com/iam/help/conditions/resource-policies). """ return pulumi.get(self, "version") class AwaitableGetServiceAccountIamPolicyResult(GetServiceAccountIamPolicyResult): # pylint: disable=using-constant-test def __await__(self): if False: yield self return GetServiceAccountIamPolicyResult( audit_configs=self.audit_configs, bindings=self.bindings, etag=self.etag, version=self.version) def get_service_account_iam_policy(options_requested_policy_version: Optional[str] = None, project: Optional[str] = None, service_account_id: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetServiceAccountIamPolicyResult: """ Gets the IAM policy that is attached to a ServiceAccount. This IAM policy specifies which members have access to the service account. This method does not tell you whether the service account has been granted any roles on other resources. To check whether a service account has role grants on a resource, use the `getIamPolicy` method for that resource. For example, to view the role grants for a project, call the Resource Manager API's [`projects.getIamPolicy`](https://cloud.google.com/resource-manager/reference/rest/v1/projects/getIamPolicy) method. """ __args__ = dict() __args__['optionsRequestedPolicyVersion'] = options_requested_policy_version __args__['project'] = project __args__['serviceAccountId'] = service_account_id if opts is None: opts = pulumi.InvokeOptions() if opts.version is None: opts.version = _utilities.get_version() __ret__ = pulumi.runtime.invoke('google-native:iam/v1:getServiceAccountIamPolicy', __args__, opts=opts, typ=GetServiceAccountIamPolicyResult).value return AwaitableGetServiceAccountIamPolicyResult( audit_configs=__ret__.audit_configs, bindings=__ret__.bindings, etag=__ret__.etag, version=__ret__.version) @_utilities.lift_output_func(get_service_account_iam_policy) def get_service_account_iam_policy_output(options_requested_policy_version: Optional[pulumi.Input[Optional[str]]] = None, project: Optional[pulumi.Input[Optional[str]]] = None, service_account_id: Optional[pulumi.Input[str]] = None, opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetServiceAccountIamPolicyResult]: """ Gets the IAM policy that is attached to a ServiceAccount. This IAM policy specifies which members have access to the service account. This method does not tell you whether the service account has been granted any roles on other resources. To check whether a service account has role grants on a resource, use the `getIamPolicy` method for that resource. For example, to view the role grants for a project, call the Resource Manager API's [`projects.getIamPolicy`](https://cloud.google.com/resource-manager/reference/rest/v1/projects/getIamPolicy) method. """ ...
[ "noreply@github.com" ]
24601.noreply@github.com
dc8862d5f210ae31a1ad69817c3da3b3f20d26f3
5f4e13201d4c5b7edc8dbbda289380682a187bec
/services/ping_service/coffeehouse_ping/__main__.py
54c78ce3e37e965ab5bbec124d3465090942452d
[]
no_license
intellivoid/CoffeeHousePy
92f4fb344de757837c3d3da05cb5513e90408039
57c453625239f28da88b88ddd0ae5f1ecdd4de3c
refs/heads/master
2023-02-23T14:32:01.606630
2021-01-28T02:57:10
2021-01-28T02:57:10
324,419,067
0
2
null
null
null
null
UTF-8
Python
false
false
850
py
import sys from coffeehouse_ping import Server def _real_main(argv=None): """ The main command-line processor :param argv: :return: """ if argv[1] == '--help': _help_menu(argv) if argv[1] == '--start-server': _start_server(argv) def _start_server(argv=None): """ Starts the server :param argv: :return: """ server = Server() server.start() def _help_menu(argv=None): """ Displays the help menu and commandline usage :param argv: :return: """ print( "CoffeeHouse Ping CLI\n\n" " --help\n" " --start-server\n" ) sys.exit() if __name__ == '__main__': try: _real_main(sys.argv) except KeyboardInterrupt: print('\nInterrupted by user')
[ "netkas@intellivoid.info" ]
netkas@intellivoid.info
33cb531d016b53d9e66de77beab3280ef808fe8e
61ce1dff5e61dde649e3908b6ba7c2a270a78e94
/users/models.py
fd8f6f26694565195903bf3553da2c8b17a77c6a
[ "Unlicense" ]
permissive
xeddmc/pastebin-django
b9438104691b4c21af4a01e46e8c9ada7ee66403
5e38637e5a417ab907a353af8544f64a0ad2b127
refs/heads/master
2021-01-12T20:07:53.454983
2015-12-21T09:31:29
2015-12-21T09:31:29
45,421,895
0
0
Unlicense
2019-08-05T19:47:34
2015-11-02T21:03:40
Python
UTF-8
Python
false
false
6,890
py
from django.db import models, transaction from django.core.cache import cache from django.contrib.auth.models import User from django_redis import get_redis_connection from ipware.ip import get_real_ip from sql import cursor from pastes.models import Paste from pastebin import settings import datetime class Favorite(models.Model): """ Handles user's favorites """ paste = models.ForeignKey(Paste) user = models.ForeignKey(User) added = models.DateTimeField(auto_now_add=True) @staticmethod def has_user_favorited_paste(user, paste): """ Returns True or False depending on whether user has favorited the paste """ result = cache.get("paste_favorited:%s:%s" % (user.username, paste.char_id)) if result != None: return result else: result = Favorite.objects.filter(user=user, paste=paste).exists() cache.set("paste_favorited:%s:%s" % (user.username, paste.char_id), result) return result class PastebinUser(object): """ Contains methods to run on a newly created or deleted user """ @staticmethod def create_user(user): """ Create required entries for a new user """ site_settings = SiteSettings(user=user) site_settings.save() @staticmethod def delete_user(user): """ Deletes an user as well as all of his pastes """ with transaction.atomic(): # Delete favorites Favorite.objects.filter(user=user).delete() Paste.objects.filter(user=user).delete() # Django recommends setting User's is_active property to False instead of # deleting it entirely, as it may break foreign keys user.is_active = False user.save() class Limiter(object): """ Throttles the amount of actions an user can do """ PASTE_UPLOAD = 1 PASTE_EDIT = 2 COMMENT = 3 @staticmethod def get_action_count(request, action): """ Get the raw count of actions a certain IP address has done """ authenticated = request.user.is_authenticated() if action == Limiter.PASTE_UPLOAD and settings.MAX_PASTE_UPLOADS_PER_USER == -1 and \ settings.MAX_PASTE_UPLOADS_PER_GUEST == -1: return 0 elif action == Limiter.PASTE_EDIT and settings.MAX_PASTE_EDITS_PER_USER == -1: return 0 elif action == Limiter.COMMENT and settings.MAX_COMMENTS_PER_USER == -1: return 0 count = 0 con = get_redis_connection("persistent") ip = get_real_ip(request) if action == Limiter.PASTE_UPLOAD: count = con.get("paste_upload_count:%s" % ip) elif action == Limiter.PASTE_EDIT: count = con.get("paste_edit_count:%s" % ip) elif action == Limiter.COMMENT: count = con.get("comment_count:%s" % ip) if count == None: return 0 else: return int(count) @staticmethod def increase_action_count(request, action, amount=1): """ Increase the amount of actions by a certain amount (default=1) """ authenticated = request.user.is_authenticated() count = 0 con = get_redis_connection("persistent") ip = get_real_ip(request) if action == Limiter.PASTE_UPLOAD: if settings.MAX_PASTE_UPLOADS_PER_USER == -1 and authenticated: return 0 elif settings.MAX_PASTE_UPLOADS_PER_GUEST == -1 and not authenticated: return 0 else: count = int(con.incr("paste_upload_count:%s" % ip)) if count == 1: con.expire("comment_count:%s" % ip, settings.MAX_PASTE_UPLOADS_PERIOD) elif action == Limiter.PASTE_EDIT: if settings.MAX_PASTE_EDITS_PER_USER == -1: return 0 else: count = int(con.incr("paste_edit_count:%s" % ip)) if count == 1: con.expire("comment_count:%s" % ip, settings.MAX_PASTE_EDITS_PERIOD) elif action == Limiter.COMMENT: if settings.MAX_COMMENTS_PER_USER == -1: return 0 else: count = int(con.incr("comment_count:%s" % ip)) if count == 1: con.expire("comment_count:%s" % ip, settings.MAX_COMMENTS_PERIOD) return count @staticmethod def is_limit_reached(request, action, count=None): """ Has the guest/user reached the maximum amount of paste uploads """ authenticated = request.user.is_authenticated() if action == Limiter.PASTE_UPLOAD and settings.MAX_PASTE_UPLOADS_PER_USER == -1 and \ authenticated: return False elif action == Limiter.PASTE_UPLOAD and settings.MAX_PASTE_UPLOADS_PER_GUEST == -1 and \ not authenticated: return False elif action == Limiter.PASTE_EDIT and settings.MAX_PASTE_EDITS_PER_USER == -1: return False elif action == Limiter.COMMENT and settings.MAX_COMMENTS_PER_USER == -1: return False if count == None: count = Limiter.get_action_count(request, action) if action == Limiter.PASTE_UPLOAD: if authenticated: return count >= settings.MAX_PASTE_UPLOADS_PER_USER else: return count >= settings.MAX_PASTE_UPLOADS_PER_GUEST elif action == Limiter.PASTE_EDIT: return count >= settings.MAX_PASTE_EDITS_PER_USER elif action == Limiter.COMMENT: return count >= settings.MAX_COMMENTS_PER_USER @staticmethod def get_action_limit(request, action): """ Return the maximum amount of actions the guest/user can do """ authenticated = request.user.is_authenticated() if action == Limiter.PASTE_UPLOAD: if authenticated: return settings.MAX_PASTE_UPLOADS_PER_USER else: return settings.MAX_PASTE_UPLOADS_PER_GUEST elif action == Limiter.PASTE_EDIT: return settings.MAX_PASTE_EDITS_PER_USER elif action == Limiter.COMMENT: return settings.MAX_COMMENTS_PER_USER class SiteSettings(models.Model): """ User's site settings, eg. whether user wants his favorites to be public """ user = models.ForeignKey(User) public_favorites = models.BooleanField(default=True)
[ "jannepulk@gmail.com" ]
jannepulk@gmail.com
57502ecd1d88cf997c4b70a179256c8d58f69ed6
9d8acc20d2ee1d1957849dfb71c22e0dae2d8c5c
/baomoicrawl/venv/Lib/site-packages/twisted/internet/iocpreactor/reactor.py
fcb4aa331cc7f1798f284ef1cc49bc7c67159a3c
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
thuy4tbn99/TranTruongThuy_17021178_Nhom4_Crawler
b0fdedee2942a12d9f64dfed93f43802dc5ab340
87c8c07433466bbc43a24ea089f75baeb467c356
refs/heads/master
2022-11-27T21:36:33.917491
2020-08-10T23:24:42
2020-08-10T23:24:42
286,583,216
0
0
null
null
null
null
UTF-8
Python
false
false
9,463
py
# -*- test-case-name: twisted.internet.test.test_iocp -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Reactor that uses IO completion ports """ import warnings, socket, sys from zope.interface import implementer from twisted.internet import base, interfaces, main, error from twisted.python import log, failure from twisted.internet._dumbwin32proc import Process from twisted.internet.win32eventreactor import _ThreadedWin32EventsMixin from twisted.internet.iocpreactor import iocpsupport as _iocp from twisted.internet.iocpreactor.const import WAIT_TIMEOUT from twisted.internet.iocpreactor import tcp, udp try: from twisted.protocols.tls import TLSMemoryBIOFactory except ImportError: # Either pyOpenSSL isn't installed, or it is too old for this code to work. # The reactor won't provide IReactorSSL. TLSMemoryBIOFactory = None _extraInterfaces = () warnings.warn( "pyOpenSSL 0.10 or newer is required for SSL support in iocpreactor. " "It is missing, so the reactor will not support SSL APIs.") else: _extraInterfaces = (interfaces.IReactorSSL,) MAX_TIMEOUT = 2000 # 2 seconds, see doIteration for explanation EVENTS_PER_LOOP = 1000 # XXX: what's a good value here? # keys to associate with normal and waker events KEY_NORMAL, KEY_WAKEUP = range(2) _NO_GETHANDLE = error.ConnectionFdescWentAway( 'Handler has no getFileHandle method') _NO_FILEDESC = error.ConnectionFdescWentAway('Filedescriptor went away') @implementer(interfaces.IReactorTCP, interfaces.IReactorUDP, interfaces.IReactorMulticast, interfaces.IReactorProcess, *_extraInterfaces) class IOCPReactor(base._SignalReactorMixin, base.ReactorBase, _ThreadedWin32EventsMixin): port = None def __init__(self): base.ReactorBase.__init__(self) self.port = _iocp.CompletionPort() self.handles = set() def addActiveHandle(self, handle): self.handles.add(handle) def removeActiveHandle(self, handle): self.handles.discard(handle) def doIteration(self, timeout): """ Poll the IO completion port for new events. """ # This function sits and waits for an IO completion event. # # There are two requirements: process IO events as soon as they arrive # and process ctrl-break from the user in a reasonable amount of time. # # There are three kinds of waiting. # 1) GetQueuedCompletionStatus (self.port.getEvent) to wait for IO # events only. # 2) Msg* family of wait functions that can stop waiting when # ctrl-break is detected (then, I think, Python converts it into a # KeyboardInterrupt) # 3) *Ex family of wait functions that put the thread into an # "alertable" wait state which is supposedly triggered by IO completion # # 2) and 3) can be combined. Trouble is, my IO completion is not # causing 3) to trigger, possibly because I do not use an IO completion # callback. Windows is weird. # There are two ways to handle this. I could use MsgWaitForSingleObject # here and GetQueuedCompletionStatus in a thread. Or I could poll with # a reasonable interval. Guess what! Threads are hard. processed_events = 0 if timeout is None: timeout = MAX_TIMEOUT else: timeout = min(MAX_TIMEOUT, int(1000*timeout)) rc, numBytes, key, evt = self.port.getEvent(timeout) while 1: if rc == WAIT_TIMEOUT: break if key != KEY_WAKEUP: assert key == KEY_NORMAL log.callWithLogger(evt.owner, self._callEventCallback, rc, numBytes, evt) processed_events += 1 if processed_events >= EVENTS_PER_LOOP: break rc, numBytes, key, evt = self.port.getEvent(0) def _callEventCallback(self, rc, numBytes, evt): owner = evt.owner why = None try: evt.callback(rc, numBytes, evt) handfn = getattr(owner, 'getFileHandle', None) if not handfn: why = _NO_GETHANDLE elif handfn() == -1: why = _NO_FILEDESC if why: return # ignore handles that were closed except: why = sys.exc_info()[1] log.err() if why: owner.loseConnection(failure.Failure(why)) def installWaker(self): pass def wakeUp(self): self.port.postEvent(0, KEY_WAKEUP, None) def registerHandle(self, handle): self.port.addHandle(handle, KEY_NORMAL) def createSocket(self, af, stype): skt = socket.socket(af, stype) self.registerHandle(skt.fileno()) return skt def listenTCP(self, port, factory, backlog=50, interface=''): """ @see: twisted.internet.interfaces.IReactorTCP.listenTCP """ p = tcp.Port(port, factory, backlog, interface, self) p.startListening() return p def connectTCP(self, host, port, factory, timeout=30, bindAddress=None): """ @see: twisted.internet.interfaces.IReactorTCP.connectTCP """ c = tcp.Connector(host, port, factory, timeout, bindAddress, self) c.connect() return c if TLSMemoryBIOFactory is not None: def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''): """ @see: twisted.internet.interfaces.IReactorSSL.listenSSL """ port = self.listenTCP( port, TLSMemoryBIOFactory(contextFactory, False, factory), backlog, interface) port._type = 'TLS' return port def connectSSL(self, host, port, factory, contextFactory, timeout=30, bindAddress=None): """ @see: twisted.internet.interfaces.IReactorSSL.connectSSL """ return self.connectTCP( host, port, TLSMemoryBIOFactory(contextFactory, True, factory), timeout, bindAddress) else: def listenSSL(self, port, factory, contextFactory, backlog=50, interface=''): """ Non-implementation of L{IReactorSSL.listenSSL}. Some dependency is not satisfied. This implementation always raises L{NotImplementedError}. """ raise NotImplementedError( "pyOpenSSL 0.10 or newer is required for SSL support in " "iocpreactor. It is missing, so the reactor does not support " "SSL APIs.") def connectSSL(self, host, port, factory, contextFactory, timeout=30, bindAddress=None): """ Non-implementation of L{IReactorSSL.connectSSL}. Some dependency is not satisfied. This implementation always raises L{NotImplementedError}. """ raise NotImplementedError( "pyOpenSSL 0.10 or newer is required for SSL support in " "iocpreactor. It is missing, so the reactor does not support " "SSL APIs.") def listenUDP(self, port, protocol, interface='', maxPacketSize=8192): """ Connects a given L{DatagramProtocol} to the given numeric UDP port. @returns: object conforming to L{IListeningPort}. """ p = udp.Port(port, protocol, interface, maxPacketSize, self) p.startListening() return p def listenMulticast(self, port, protocol, interface='', maxPacketSize=8192, listenMultiple=False): """ Connects a given DatagramProtocol to the given numeric UDP port. EXPERIMENTAL. @returns: object conforming to IListeningPort. """ p = udp.MulticastPort(port, protocol, interface, maxPacketSize, self, listenMultiple) p.startListening() return p def spawnProcess(self, processProtocol, executable, args=(), env={}, path=None, uid=None, gid=None, usePTY=0, childFDs=None): """ Spawn a process. """ if uid is not None: raise ValueError("Setting UID is unsupported on this platform.") if gid is not None: raise ValueError("Setting GID is unsupported on this platform.") if usePTY: raise ValueError("PTYs are unsupported on this platform.") if childFDs is not None: raise ValueError( "Custom child file descriptor mappings are unsupported on " "this platform.") args, env = self._checkProcessArgs(args, env) return Process(self, processProtocol, executable, args, env, path) def removeAll(self): res = list(self.handles) self.handles.clear() return res def install(): r = IOCPReactor() main.installReactor(r) __all__ = ['IOCPReactor', 'install']
[ "thuy4tbn99@gmail.com" ]
thuy4tbn99@gmail.com
194ea14eaf4b23e565969d666db913b837eb3d1e
0f16edb46a48f9b5a125abb56fc0545ede1d65aa
/doc/rst/conf.py
fee0a9988b79286c7831cf83dfe3e0e67b8e42df
[ "Apache-2.0" ]
permissive
DataONEorg/d1_python
5e685f1af0c356190f2d6df45d1ac849e2f56972
d72a9461894d9be7d71178fb7310101b8ef9066a
refs/heads/master
2023-08-29T03:16:38.131760
2023-06-27T21:59:37
2023-06-27T21:59:37
60,103,877
15
12
Apache-2.0
2023-09-06T18:27:53
2016-05-31T16:01:00
Python
UTF-8
Python
false
false
6,408
py
# This work was created by participants in the DataONE project, and is # jointly copyrighted by participating institutions in DataONE. For # more information on DataONE, see our web site at http://dataone.org. # # Copyright 2009-2019 DataONE # # 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 License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Sphinx configuration for DataONE Python Products documentation.""" import os import sys import better import django os.environ['DJANGO_SETTINGS_MODULE'] = 'd1_gmn.settings' django.setup() project = "DataONE Python Products" copyright = "2019 Participating institutions in DataONE" import d1_gmn.app.models source_suffix = ".rst" master_doc = "index" version = "" release = "" exclude_patterns = [ "_build", "Thumbs.db", ".DS_Store", "tests", "test*.py", "subject_info_renderer.py", '*/generated/*', ] pygments_style = "sphinx" today_fmt = "%Y-%m-%d" extensions = [ "sphinx.ext.autodoc", "sphinx.ext.autosectionlabel", "sphinx.ext.autosummary", "sphinx.ext.doctest", "sphinx.ext.extlinks", "sphinx.ext.graphviz", "sphinx.ext.ifconfig", "sphinx.ext.imgmath", "sphinx.ext.inheritance_diagram", "sphinx.ext.napoleon", # 'sphinxcontrib.napoleon', "sphinx.ext.todo", ] # The default syntax highlighting applied code-block and :: blocks. # Set highlighting where needed, e.g., with ".. highlight:: python". highlight_language = "none" html_logo = "_static/dataone_logo.png" html_theme_path = [better.better_theme_path] html_theme = "better" html_short_title = "Home" html_static_path = ["_static"] templates_path = ["_templates"] html_theme_options = { # show sidebar on the right instead of on the left "rightsidebar": False, # inline CSS to insert into the page if you're too lazy to make a # separate file "inlinecss": "", # CSS files to include after all other CSS files # (refer to by relative path from conf.py directory, or link to a # remote file) "cssfiles": [], # show a big text header with the value of html_title "showheader": True, # show the breadcrumbs and index|next|previous links at the top of # the page "showrelbartop": True, # same for bottom of the page "showrelbarbottom": False, # show the self-serving link in the footer "linktotheme": True, # width of the sidebar. page width is determined by a CSS rule. # I prefer to define things in rem because it scales with the # global font size rather than pixels or the local font size. "sidebarwidth": "15rem", # color of all body text "textcolor": "#000000", # color of all headings (<h1> tags); defaults to the value of # textcolor, which is why it's defined here at all. "headtextcolor": "", # color of text in the footer, including links; defaults to the # value of textcolor "footertextcolor": "", # Google Analytics info "ga_ua": "", "ga_domain": "", } # html_sidebars = { # '**': ['localtoc.html', 'sourcelink.html', 'searchbox.html'], # } # Formatting of NumPy and Google style docstrings # Toggled Napoleon switches napoleon_use_param = False napoleon_use_ivar = True napoleon_include_init_with_doc = True # Napoleon settings # napoleon_google_docstring = True # napoleon_numpy_docstring = True # napoleon_include_private_with_doc = False # napoleon_include_special_with_doc = False # napoleon_use_admonition_for_examples = False # napoleon_use_admonition_for_notes = False # napoleon_use_admonition_for_references = False # napoleon_use_rtype = True # napoleon_use_keyword = True # napoleon_custom_sections = None # Autodoc autodoc_default_options = { # 'members': None, 'member-order': 'bysource', 'special-members': ','.join(('__init__',)), 'exclude-members': ','.join(( "__weakref__", "__doc__", "__module__", "__dict__", )), # Members starting with underscore are excluded by default. This specifies # exceptions, which will be included. # Don't show the base classes for the class. 'show-inheritance': False, # Ignore members imported by __all__(). # 'ignore-module-all': True, # Prevent imported and inherited members from being documented as part of the # classes they're imported/inherited in. They still get documented as separate # classes. 'imported-members': False, ######## 'inherited-members': True, # Skip private members. # 'private-members': False, # Skip members without docstrings. # 'undoc-members': False, } # Create unique labels for autogenerated modules by prefixing with the path of the # module. autosectionlabel_prefix_document = True # Combine the doc for the class and for __init__ and render it in the # class. autoclass_content = 'both' def autodoc_skip_member(app, what, name, obj, skip, options): """Skip members matching criteria""" exclude_member = name in [ 'NAMES_2K', 'UNICODE_NAMES', 'UNICODE_TEST_STRINGS', 'WORDS_1K', 'models.py', ] exclude_obj = obj is [ d1_gmn.app.models.ResourceMap ] if exclude_obj: sys.exit(obj) exclude = exclude_member or exclude_obj return skip or exclude def autodoc_process_signature(app, what, name, obj, options, signature, return_annotation): # print(app, what, name, obj, options, signature, return_annotation) pass def setup(app): for pkg_root in ( 'client_cli', 'client_onedrive', 'csw', 'dev_tools', 'gmn', 'lib_client', 'lib_common', 'lib_scimeta', 'test_utilities', 'utilities', ): sys.path.insert(0, os.path.abspath(f"../../{pkg_root}/src/")) app.connect("autodoc-skip-member", autodoc_skip_member) # app.connect("autodoc-process-signature", autodoc_process_signature)
[ "git@dahlsys.com" ]
git@dahlsys.com
a204884acab08f712678c840bab689bf04f996c3
1ada3010856e39c93e2483c960aa8fc25e2b3332
/Binary Tree/DiameterOfBT.py
accf7d2fa64c600f094487d5b2cfaf5cc85c7837
[]
no_license
Taoge123/LeetCode
4f9e26be05f39b37bdbb9c1e75db70afdfa1b456
4877e35a712f59bc7b8fffa3d8af2ffa56adb08c
refs/heads/master
2022-02-24T20:09:21.149818
2020-07-31T03:18:05
2020-07-31T03:18:05
142,700,689
0
0
null
null
null
null
UTF-8
Python
false
false
711
py
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def height(node): #Base case if node is None: return 0 return max(height(node.left), height(node.right)) + 1 def diameter(node): if node is None: return 0 lHeight = height(node.left) rHeight = height(node.right) lDiameter = diameter(node.left) rDiameter = diameter(node.right) #Return the max return max(lHeight + rHeight + 1, max(lDiameter, rDiameter)) root = Node(1) root.left = Node(2) root.right = Node(3) root.left.left = Node(4) root.left.right = Node(5) print("Diameter of given binary tree is %d" %(diameter(root)))
[ "taocheng984@gmail.com" ]
taocheng984@gmail.com
113ffbcabf72b96ff950c9973a922243f540df6a
53fab060fa262e5d5026e0807d93c75fb81e67b9
/backup/user_216/ch50_2020_09_23_01_25_05_690150.py
3c21d662ff00c1e961bde777d852f3f46d55eb93
[]
no_license
gabriellaec/desoft-analise-exercicios
b77c6999424c5ce7e44086a12589a0ad43d6adca
01940ab0897aa6005764fc220b900e4d6161d36b
refs/heads/main
2023-01-31T17:19:42.050628
2020-12-16T05:21:31
2020-12-16T05:21:31
306,735,108
0
0
null
null
null
null
UTF-8
Python
false
false
198
py
def junta_nome_sobrenome(nomes,sobrenomes): e = ' ' resposta = [] i = 0 while i < len(nomes): resposta.append(nomes[i] + e + sobrenomes[i]) i += 1 return resposta
[ "you@example.com" ]
you@example.com
041e262947c9bf7972e3fb50938ddef32cf407cc
8ed4bf9fbead471c9e5f88e4d18ac432ec3d628b
/hackerrank/algorithm/implementation/bonetrousle.py
f757a2dcc98a7f8c3969b716375b3557e543a413
[]
no_license
hizbul25/programming_problem
9bf26e49ed5bb8c9c829d00e765c9401222fb35c
2acca363704b993ffe5f6c2b00f81a4f4eca7204
refs/heads/master
2021-01-10T22:28:26.105787
2018-01-21T16:45:45
2018-01-21T16:45:45
65,394,734
1
0
null
null
null
null
UTF-8
Python
false
false
1,109
py
# Problem URL: https://www.hackerrank.com/challenges/bonetrousle firstLine = int(input()) for a in range(0, firstLine): nums = input() numsArr = list(map(int, nums.split(" "))) n = numsArr[0] k = numsArr[1] b = numsArr[2] num1 = 0 rem = 0 answer = True remAdded = False count = 0 boxArr = [] for i in range(1, b+1): count += i boxArr.append(i) num1 = (n - count)//b rem = (n - count) % b for j in range(0, len(boxArr)): boxArr[j] += num1 if boxArr[j] > k: answer = False if rem == 0: remAdded = True elif boxArr[-1] + 1 > k: remAdded = False elif answer is not False: l = len(boxArr) - 1 for r in range(l, l - rem, -1): boxArr[r] += 1 remAdded = True if answer is False or remAdded is False: print(-1) elif 0 in boxArr: print(-1) else: for z in range(0, len(boxArr)): if z != len(boxArr) - 1: print(boxArr[z], end=" ") else: print(boxArr[z])
[ "hizbul.ku@gmail.com" ]
hizbul.ku@gmail.com
0922a16dd2cacc23c8c92cdfddbe8f7cf93ac3b3
eef4d2330edb808acdb82b92621f927db4911dda
/CURSOR/Batman/8/8.2.py
a2c0c3111209aabce9e3aec7d076b233909bc78b
[]
no_license
OkS369/Education
648308c755dab6e8510c507211005f34cbed495d
c44f6b0223b567753089627056429d1f4dab7368
refs/heads/master
2023-05-24T06:31:10.869633
2021-06-15T13:52:23
2021-06-15T13:52:23
225,942,342
0
0
null
null
null
null
UTF-8
Python
false
false
71
py
n = 0 while n < 21: print (f'2^{n} = {2**n}') n += 1
[ "romanincognito17@gmail.com" ]
romanincognito17@gmail.com
6b8f6dbf41521d7d6397fdaf4ef3af2ad4fcc709
0d9c964fd7644395a3f0763f484e485fcc67f762
/new/src/13.03.2021/OOP_ Змейка.py
92f0fa1f4d92712f47d0aa2dcf595724363bb77d
[ "Apache-2.0" ]
permissive
VladBaryliuk/my_start_tasks
eaa2e6ff031f2f504be11f0f64f5d99bd1a68a0e
bf387543e6fa3ee303cbef04d2af48d558011ed9
refs/heads/main
2023-04-14T14:00:08.415787
2021-04-24T13:47:38
2021-04-24T13:47:38
354,538,499
0
0
null
null
null
null
UTF-8
Python
false
false
4,801
py
from tkinter import * import random # Создаем окно root = Tk() # Устанавливаем название окна root.title("Змейка на PYTНON") # ширина экрана WIDTH = 800 # высота экрана HEIGHT = 600 # Размер сегмента змейки SEG_SIZE = 20 # Переменная отвечающая за состояние игры IN_GAME = True # создаем экземпляр класса Canvas (его мы еще будем использовать) и заливаем все зеленым цветом c = Canvas(root, width=WIDTH, height=HEIGHT, bg="#003300") c.grid() # Наводим фокус на Canvas, чтобы мы могли ловить нажатия клавиш c.focus_set() class Segment(object): """ Класс сегмента змейки """ def __init__(self, x, y): self.instance = c.create_rectangle(x, y, x + SEG_SIZE, y + SEG_SIZE, fill="white") class Snake(object): """ Класс змейки """ def __init__(self, segments): self.segments = segments # список доступных направлений движения змейки self.mapping = {"Down": (0, 1), "Right": (1, 0), "Up": (0, -1), "Left": (-1, 0)} # изначально змейка двигается вправо self.vector = self.mapping["Right"] def move(self): """ Двигает змейку в заданном направлении """ # перебираем все сегменты кроме первого for index in range(len(self.segments) - 1): segment = self.segments[index].instance x1, y1, x2, y2 = c.coords(self.segments[index + 1].instance) # задаем каждому сегменту позицию сегмента стоящего после него c.coords(segment, x1, y1, x2, y2) # получаем координаты сегмента перед "головой" x1, y1, x2, y2 = c.coords(self.segments[-2].instance) # получаем координаты сегмента перед "головой" c.coords(self.segments[-1].instance, x1 + self.vector[0] * SEG_SIZE, y1 + self.vector[1] * SEG_SIZE, x2 + self.vector[0] * SEG_SIZE, y2 + self.vector[1] * SEG_SIZE) def add_segment(self): """ Добавляет сегмент змейке """ # определяем последний сегмент last_seg = c.coords(self.segments[0].instance) # определяем последний сегмент x = last_seg[2] - SEG_SIZE y = last_seg[3] - SEG_SIZE self.segments.insert(0, Segment(x, y)) """ Изменяет направление движения змейки """ def change_direction(self, event): if event.keysym in self.mapping: self.vector = self.mapping[event.keysym] # создаем набор сегментов segments = [Segment(SEG_SIZE, SEG_SIZE), Segment(SEG_SIZE * 2, SEG_SIZE), Segment(SEG_SIZE * 3, SEG_SIZE)] s = Snake(segments) def create_block(): """ Создает блок в случайной позиции на карте """ global BLOCK posx = SEG_SIZE * random.randint(1, (WIDTH - SEG_SIZE) / SEG_SIZE) posy = SEG_SIZE * random.randint(1, (HEIGHT - SEG_SIZE) / SEG_SIZE) BLOCK = c.create_oval(posx, posy, posx + SEG_SIZE, posy + SEG_SIZE, fill="red") def main(): global IN_GAME if IN_GAME: s.move() head_coords = c.coords(s.segments[-1].instance) x1, y1, x2, y2 = head_coords # Столкновение с границами экрана if x2 > WIDTH or x1 < 0 or y1 < 0 or y2 > HEIGHT: IN_GAME = False # Поедание яблок elif head_coords == c.coords(BLOCK): s.add_segment() c.delete(BLOCK) create_block() # Самоедство else: for index in range(len(s.segments) - 1): if head_coords == c.coords(s.segments[index].instance): IN_GAME = False root.after(100, main) # Если не в игре выводим сообщение о проигрыше else: c.create_text(WIDTH / 2, HEIGHT / 2, text="GAME OVER!", font="Arial 20", fill="red") c.bind("<KeyPress>", s.change_direction) create_block() main() # Запускаем окно root.mainloop()
[ "vladmain9@gmail.com" ]
vladmain9@gmail.com
6296a611321521ffd2004163b14e0bc37d43db87
4d2238210813c1581bf44f64d8a63196f75d2df4
/dfs.py
d9fd93c39b98cb91429e37fb06a310f3bc3625f3
[]
no_license
wwtang/code02
b1600d34907404c81fa523cfdaa74db0021b8bb3
9f03dda7b339d8c310c8a735fc4f6d795b153801
refs/heads/master
2020-12-24T14:10:33.738734
2012-12-14T04:24:47
2012-12-14T04:24:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,172
py
class Vertex: def __init__(self, data): self.data =data self.successor = [] #generate a Graph def petersenGraph(): v = [Vertex(i) for i in xrange(10)] edges = \ [(0,1), (1,0), (1,2), (2,1), (2,3), (3,2), (3,4), (4,3), (4,0), (0,4), (5,6), (6,5), (6,7), (7,6), (7,8), (8,7), (8,9), (9,8), (9,5), (5,9), (5,0), (0,5), (6,2), (2,6), (7,4), (4,7), (8,1), (1,8), (9,3), (3,9)] for a, b in edges: v[a].successor.append(v[b]) return v def dfs(start, isGoal, result): if start in result: return False result.append(start) if isGoal(start):#reach the target item return True for s in start.successor: if dfs(s, isGoal, result): return True #NO path was found result.pop() return False def main(): v = petersenGraph() for vertex in v: print vertex.data print [item.data for item in vertex.successor] print "*"*20 path = [] if dfs(v[0], (lambda v: v.data ==7), path): print "Found path", [u.data for u in path] else: print "No path found" if __name__=="__main__": main()
[ "andytang1994@gmail.com" ]
andytang1994@gmail.com
0f69064cc124c90fd91b36b89f7ef3e0045c1c86
536ec8e275d0e4ac826ed492a818802f17eb29da
/other/diverta20192/b.py
a1dda6c0b38d2f1cf3ff5d45c0772170667c90dd
[]
no_license
tamanyan/coding-problems
3d74ee708a943348ee06f1a25c45ee3a35cfd9ee
415e8230c8386163e1abf5eea217a1e5be8a15bc
refs/heads/master
2020-07-03T21:36:23.566534
2020-06-10T16:33:55
2020-06-10T16:33:55
202,057,698
0
0
null
null
null
null
UTF-8
Python
false
false
1,924
py
from heapq import heappush, heappop, heapify from collections import deque, defaultdict, Counter import itertools from itertools import permutations, combinations, accumulate import sys import bisect import string import math import time def I(): return int(input()) def MI(): return map(int, input().split()) def S(): return input() def MS(): return map(str, input().split()) def LI(): return [int(i) for i in input().split()] def LI_(): return [int(i)-1 for i in input().split()] def StoI(): return [ord(i)-97 for i in input()] def ItoS(nn): return chr(nn+97) def input(): return sys.stdin.readline().rstrip() def show(*inp, end='\n'): if show_flg: print(*inp, end=end) def print_matrix(mat): for i in range(len(mat)): print(*mat[i]) YNL = {False: 'No', True: 'Yes'} YNU = {False: 'NO', True: 'YES'} MOD = 10**9+7 inf = float('inf') IINF = 10**19 l_alp = string.ascii_lowercase u_alp = string.ascii_uppercase ts = time.time() # sys.setrecursionlimit(10**6) nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] # show_flg = True show_flg = False def cost(x, y, initial, N): a = x[initial] b = y[initial] for i in range(N): if i == initial: continue return 0 def main(): N = I() x = [0] * N y = [0] * N ans = 0 dist = [[None] * N for i in range(N)] if N == 1: print(1) return for i in range(N): x[i], y[i] = MI() for i in range(N): for j in range(N): if i == j: continue dist[i][j] = str(x[j] - x[i]) + "," + str(y[j] - y[i]) # print_matrix(dist) c = defaultdict(int) ans = 1 for i in range(N): for j in range(N): if dist[i][j] == None: continue c[dist[i][j]] += 1 mcost = max(c.values()) print(N - mcost) if __name__ == '__main__': main()
[ "tamanyan.sss@gmail.com" ]
tamanyan.sss@gmail.com
94e635241a858c40290e54fa2adf9b57550f8043
70fbcca27b1bf777db40319a025ef1c752e2e11d
/ecmo/sockets.py
34f0deb09632354e978675865e277b199f5c9823
[]
no_license
thecaffiend/ecmo_data_viz
051297ddac642a5f0dbae1ef006158c677aca947
8f80e4070377f173f1883062dac776339f170aa9
refs/heads/master
2021-01-01T18:18:14.818933
2011-08-04T03:00:07
2011-08-04T03:00:07
2,093,412
1
1
null
null
null
null
UTF-8
Python
false
false
5,379
py
from django_websocket import require_websocket from django.utils import simplejson from django.core.cache import cache import math import time from copy import deepcopy from ecmo.models import * import sys def jsjson(msg): return simplejson.dumps(msg, ensure_ascii=True) @require_websocket def screen_socket(request, screen_name, run_id): """ The main end user socket. Doesn't really accept anything. """ run = Run.objects.get(id=run_id) screen = Screen.objects.get(js_name=screen_name) ws = request.websocket ss_base, point_ss_map = screen.struct_base_map() last_sent = None while True: points = cache.get(run.raw_points_key) if points and points.get('points',False) and points['run_time'] != last_sent: run_time = points['run_time'] screen_struct = deepcopy(ss_base) for p in points['points']: p_map = point_ss_map[p['feed']] screen_struct[p_map[0]][p_map[1]].append([run_time, p['val']]) jstruct = jsjson(screen_struct) ws.send(jstruct) last_sent = run_time time.sleep(.25) @require_websocket def mbc_command(request, run_id): """ The main MBC socket. Used for creating new (and deleting old) FeedEvents. Gives the current value. Accepts: { feed: <js_name>, value: <value or min or mean>, arg: <max or stddev>, run_time: <int>, distribution: one of EVT_DISTRIBUTIONS, trend: one of EVT_TRENDS } or { delete: <event_id>} Returns: {points: [{feed: <feed_name>, val:<float>}]} or {events: [<above struct, plus id>,]} """ run = Run.objects.get(id=run_id) ws = request.websocket last_sent = None while True: points = cache.get(run.raw_points_key) if points and points['points'] and points['run_time'] != last_sent: ws.send(jsjson({'points':points['points']})) last_sent = points['run_time'] if ws.has_messages(): msg = ws.read() msg = simplejson.loads(msg) if msg.get('shutdown', False): return if msg.get('delete', False): try: FeedEvent.objects.get(id=msg['delete']).delete() ws.send(jsjson(msg)) except: sys.stderr.write("bad delete %s" % e) if msg.get('feed', False): for feed in run.feed_set.all(): if feed.feed_type.js_name == msg['feed']: msg['feed'] = feed try: event = FeedEvent(**msg) event.full_clean() event.save() ws.send(jsjson({'events':[event.msg]})) except Exception, e: sys.stderr.write("bad insert %s" % e) time.sleep(.25) # DRY would put this in a JSON file that python can use, too CLK_RESUME = 0 CLK_SET = 1 CLK_PAUSE = 2 @require_websocket def mbc_clock(request, run_id): """ Handles the magic of the clock as best as possible... there is some drift, but it's good enough for demo purposes. Expects: {type: CLK_RESUME|CLK_PAUSE} or {type: CLK_SET, run_time: <int>} Returns: {run_time: <int>} """ run = Run.objects.get(id=run_id) ws = request.websocket def msg_time(): ws.send(jsjson({'run_time':run.run_time})) run.save() # iterator will run forever until client disconnects for msg in ws: interrupted = False msg = simplejson.loads(msg) if msg.get('shutdown', False): return if msg['type'] == CLK_RESUME: # initialize wake time for outer loop wake_time = time.time() while not interrupted: if ws.has_messages(): # on pause or set, special stuff interrupt = simplejson.loads(ws.read()) if interrupt.get('shutdown', False): return if interrupt["type"] == CLK_PAUSE: msg_time() # sends back to outer loop interrupted = True break elif interrupt["type"] == CLK_SET: # just updated the time run.run_time = interrupt['run_time'] else: run.run_time += 1 msg_time() # generates all the new points points = run.update_feeds() # send this up so other listeners can hear cache.set(run.raw_points_key, {'run_time': run.run_time, 'points': [p.msg for p in points]}) sleep_time = time.time() # attempt to counter drift time.sleep(1 - (sleep_time - wake_time)) wake_time = time.time() elif msg['type'] == CLK_SET: run.run_time = msg['run_time'] msg_time()
[ "nick.bollweg@gmail.com" ]
nick.bollweg@gmail.com
6d59e0b17594d456e339941c2951d033580722a3
ac5e52a3fc52dde58d208746cddabef2e378119e
/exps-gsn-edf.0/gsn-edf_ut=3.5_rd=0.8_rw=0.06_rn=4_u=0.075-0.325_p=harmonic-2/sched=RUN_trial=7/params.py
d1044ead6dd845269e7675cbd1da27353c9e2499
[]
no_license
ricardobtxr/experiment-scripts
1e2abfcd94fb0ef5a56c5d7dffddfe814752eef1
7bcebff7ac2f2822423f211f1162cd017a18babb
refs/heads/master
2023-04-09T02:37:41.466794
2021-04-25T03:27:16
2021-04-25T03:27:16
358,926,457
0
0
null
null
null
null
UTF-8
Python
false
false
253
py
{'cpus': 4, 'duration': 30, 'final_util': '3.611238', 'max_util': '3.5', 'periods': 'harmonic-2', 'release_master': False, 'res_distr': '0.8', 'res_nmb': '4', 'res_weight': '0.06', 'scheduler': 'GSN-EDF', 'trial': 7, 'utils': 'uni-medium-3'}
[ "ricardo.btxr@gmail.com" ]
ricardo.btxr@gmail.com
93cfc9ca0d3256a4230a2b01248704e4b4d40f54
3b9d763180410bf0abf5b9c37391a64319efe839
/toontown/coghq/LawbotOfficeGearRoom_Platform00.py
71d1e0c89e93a701510c168d907594938d9fc6a4
[]
no_license
qphoton/Reverse_Engineering_Project_ToonTown
442f15d484324be749f6f0e5e4e74fc6436e4e30
11468ab449060169191366bc14ff8113ee3beffb
refs/heads/master
2021-05-08T00:07:09.720166
2017-10-21T02:37:22
2017-10-21T02:37:22
107,617,661
0
1
null
null
null
null
UTF-8
Python
false
false
9,749
py
# File: L (Python 2.4) from toontown.coghq.SpecImports import * GlobalEntities = { 1000: { 'type': 'levelMgr', 'name': 'LevelMgr', 'comment': '', 'parentEntId': 0, 'cogLevel': 0, 'farPlaneDistance': 1500, 'modelFilename': 'phase_11/models/lawbotHQ/LB_Zone7a', 'wantDoors': 1 }, 1001: { 'type': 'editMgr', 'name': 'EditMgr', 'parentEntId': 0, 'insertEntity': None, 'removeEntity': None, 'requestNewEntity': None, 'requestSave': None }, 0: { 'type': 'zone', 'name': 'UberZone', 'comment': '', 'parentEntId': 0, 'scale': 1, 'description': '', 'visibility': [] }, 100008: { 'type': 'healBarrel', 'name': '<unnamed>', 'comment': '', 'parentEntId': 0, 'pos': Point3(9.2117199999999997, -65.163600000000002, 0), 'hpr': Vec3(218.47999999999999, 0, 0), 'scale': Vec3(1, 1, 1), 'rewardPerGrab': 20, 'rewardPerGrabMax': 0 }, 100000: { 'type': 'model', 'name': '<unnamed>', 'comment': '', 'parentEntId': 100001, 'pos': Point3(-7.8051599999999999, 13.482699999999999, 0), 'hpr': Vec3(0, 0, 0), 'scale': Point3(2.5, 2.5, 2.5), 'collisionsOnly': 0, 'flattenType': 'light', 'loadType': 'loadModelCopy', 'modelPath': 'phase_11/models/lawbotHQ/LB_CardBoardBoxX2' }, 100002: { 'type': 'model', 'name': 'copy of <unnamed>', 'comment': '', 'parentEntId': 100001, 'pos': Point3(-22.7622, 13.482699999999999, 0), 'hpr': Vec3(0, 0, 0), 'scale': Point3(2.5, 2.5, 2.5), 'collisionsOnly': 0, 'flattenType': 'light', 'loadType': 'loadModelCopy', 'modelPath': 'phase_11/models/lawbotHQ/LB_CardBoardBoxX3' }, 100003: { 'type': 'model', 'name': 'copy of <unnamed> (2)', 'comment': '', 'parentEntId': 100001, 'pos': Point3(-22.581900000000001, -16.476099999999999, 0), 'hpr': Vec3(0, 0, 0), 'scale': Point3(2.5, 2.5, 2.5), 'collisionsOnly': 0, 'flattenType': 'light', 'loadType': 'loadModelCopy', 'modelPath': 'phase_11/models/lawbotHQ/LB_CardBoardBox' }, 100004: { 'type': 'model', 'name': 'copy of <unnamed> (3)', 'comment': '', 'parentEntId': 100001, 'pos': Point3(7.4503500000000003, -18.421399999999998, 0), 'hpr': Vec3(0, 0, 0), 'scale': Point3(2.5, 2.5, 2.75), 'collisionsOnly': 0, 'flattenType': 'light', 'loadType': 'loadModelCopy', 'modelPath': 'phase_11/models/lawbotHQ/LB_CardBoardBoxX2' }, 100005: { 'type': 'model', 'name': 'copy of <unnamed> (4)', 'comment': '', 'parentEntId': 100001, 'pos': Point3(-7.7419099999999998, -16.751200000000001, 0), 'hpr': Vec3(0, 0, 0), 'scale': Point3(2.5, 2.5, 2.75), 'collisionsOnly': 0, 'flattenType': 'light', 'loadType': 'loadModelCopy', 'modelPath': 'phase_11/models/lawbotHQ/LB_CardBoardBoxX2' }, 100009: { 'type': 'model', 'name': 'copy of <unnamed> (4)', 'comment': '', 'parentEntId': 100001, 'pos': Point3(7.3891299999999998, -1.5659099999999999, 31.7727), 'hpr': Vec3(0, 0, 0), 'scale': Point3(2.2999999999999998, 2.8999999999999999, 2.62459), 'collisionsOnly': 0, 'flattenType': 'light', 'loadType': 'loadModelCopy', 'modelPath': 'phase_11/models/lawbotHQ/LB_metal_crate' }, 100017: { 'type': 'model', 'name': 'copy of <unnamed> (3)', 'comment': '', 'parentEntId': 100001, 'pos': Point3(-7.9470400000000003, -1.5659099999999999, 0), 'hpr': Vec3(0, 0, 0), 'scale': Point3(2.2999999999999998, 2.9199999999999999, 2.9199999999999999), 'collisionsOnly': 0, 'flattenType': 'light', 'loadType': 'loadModelCopy', 'modelPath': 'phase_11/models/lawbotHQ/LB_CardBoardBox' }, 100012: { 'type': 'mover', 'name': 'mover', 'comment': '', 'parentEntId': 100011, 'pos': Point3(0, -10, 0), 'hpr': Vec3(0, 0, 0), 'scale': Vec3(1, 1, 1), 'cycleType': 'loop', 'entity2Move': 100014, 'modelPath': 0, 'moveTarget': 100013, 'pos0Move': 2, 'pos0Wait': 2, 'pos1Move': 2, 'pos1Wait': 2, 'startOn': 1, 'switchId': 0 }, 100001: { 'type': 'nodepath', 'name': 'crateMaster', 'comment': '', 'parentEntId': 0, 'pos': Point3(0, 0, 0), 'hpr': Vec3(0, 0, 0), 'scale': 1 }, 100011: { 'type': 'nodepath', 'name': 'spotlightMover', 'comment': '', 'parentEntId': 0, 'pos': Point3(29.817900000000002, 0, 0), 'hpr': Vec3(0, 0, 0), 'scale': Vec3(1, 1, 1) }, 100013: { 'type': 'nodepath', 'name': 'mover target', 'comment': '', 'parentEntId': 100011, 'pos': Point3(0, 10, 0), 'hpr': Point3(180, 0, 0), 'scale': Vec3(1, 1, 1) }, 100015: { 'type': 'nodepath', 'name': 'lightTarget1', 'comment': '', 'parentEntId': 100011, 'pos': Point3(0, -10, 0), 'hpr': Vec3(0, 0, 0), 'scale': 1 }, 100016: { 'type': 'nodepath', 'name': 'copy of lightTarget1', 'comment': '', 'parentEntId': 100011, 'pos': Point3(0, 10, 0), 'hpr': Vec3(0, 0, 0), 'scale': Vec3(1, 1, 1) }, 100010: { 'type': 'platform', 'name': '<unnamed>', 'comment': '', 'parentEntId': 0, 'pos': Point3(-22.540400000000002, -1.1563399999999999, 0), 'hpr': Vec3(0, 0, 0), 'scale': Vec3(1.18055, 1.18055, 1.18055), 'floorName': 'platformcollision', 'modelPath': 'phase_9/models/cogHQ/platform1', 'modelScale': Point3(1, 1, 2), 'motion': 'noBlend', 'offset': Point3(0, 0, 15), 'period': 4.0, 'phaseShift': 0.0, 'waitPercent': 0.10000000000000001 }, 100014: { 'type': 'securityCamera', 'name': '<unnamed>', 'comment': '', 'parentEntId': 100011, 'pos': Point3(0, 0, 0), 'hpr': Vec3(0, 0, 0), 'scale': 1, 'accel': 10.0, 'damPow': 8, 'hideModel': 0, 'maxVel': 30.0, 'modelPath': 0, 'projector': Point3(0, 0, 25), 'radius': 7.0, 'switchId': 0, 'trackTarget1': 100015, 'trackTarget2': 100016, 'trackTarget3': 0 }, 100006: { 'type': 'stomper', 'name': 'copy of <unnamed>', 'comment': '', 'parentEntId': 0, 'pos': Point3(-22.900400000000001, -31.939, 0), 'hpr': Vec3(0, 0, 0), 'scale': Vec3(1, 1, 1), 'animateShadow': 1, 'cogStyle': 1, 'crushCellId': None, 'damage': 10, 'headScale': Point3(7, 3, 7), 'modelPath': 0, 'motion': 3, 'period': 4.0, 'phaseShift': 0.0, 'range': 15.0, 'removeCamBarrierCollisions': 0, 'removeHeadFloor': 0, 'shaftScale': Point3(0.5, 20, 0.5), 'soundLen': 0, 'soundOn': 1, 'soundPath': 0, 'style': 'vertical', 'switchId': 0, 'wantShadow': 1, 'wantSmoke': 1, 'zOffset': 0 }, 100007: { 'type': 'stomper', 'name': 'copy of <unnamed>', 'comment': '', 'parentEntId': 0, 'pos': Point3(6.8338799999999997, -1.2670600000000001, 0), 'hpr': Vec3(0, 0, 0), 'scale': Vec3(1, 1, 1), 'animateShadow': 1, 'cogStyle': 1, 'crushCellId': None, 'damage': 10, 'headScale': Point3(7, 3, 7), 'modelPath': 0, 'motion': 3, 'period': 4.0, 'phaseShift': 0.29999999999999999, 'range': 15.0, 'removeCamBarrierCollisions': 0, 'removeHeadFloor': 0, 'shaftScale': Point3(0.5, 20, 0.5), 'soundLen': 0, 'soundOn': 1, 'soundPath': 0, 'style': 'vertical', 'switchId': 0, 'wantShadow': 1, 'wantSmoke': 1, 'zOffset': 0 }, 100018: { 'type': 'stomper', 'name': '<unnamed>', 'comment': '', 'parentEntId': 0, 'pos': Point3(-37.5869, -1.2670600000000001, 0), 'hpr': Vec3(0, 0, 0), 'scale': Vec3(1, 1, 1), 'animateShadow': 1, 'cogStyle': 1, 'crushCellId': None, 'damage': 10, 'headScale': Point3(7, 3, 7), 'modelPath': 0, 'motion': 4, 'period': 2.5, 'phaseShift': 0.59999999999999998, 'range': 15.0, 'removeCamBarrierCollisions': 0, 'removeHeadFloor': 0, 'shaftScale': Point3(0.5, 20, 0.5), 'soundLen': 0, 'soundOn': 1, 'soundPath': 0, 'style': 'vertical', 'switchId': 0, 'wantShadow': 1, 'wantSmoke': 1, 'zOffset': 0 } } Scenario0 = { } levelSpec = { 'globalEntities': GlobalEntities, 'scenarios': [ Scenario0] }
[ "Infinitywilee@rocketmail.com" ]
Infinitywilee@rocketmail.com
23aebddeccd15771fc92e83af3e8ccd3ce23cc3f
b8d89bd2b0a4464146b349c6702d13caf776127b
/resticus/parsers.py
8ea5511ef0391e77c7ce9628f8939f579708a74c
[ "MIT" ]
permissive
ssteinerx/django-resticus
7683d20dbf30fe68f5c5ab04219d40f6b8f4627b
772a89d7bbe3ae72b2551f2dd5b823405460ddf8
refs/heads/develop
2020-12-24T06:44:54.998362
2016-11-11T14:17:39
2016-11-11T14:17:39
73,331,769
0
0
null
2016-11-10T00:06:54
2016-11-10T00:06:54
null
UTF-8
Python
false
false
823
py
from django.utils.translation import ugettext as _ from .exceptions import ParseError from .settings import api_settings def parse_content_type(content_type): if ';' in content_type: content_type, params = content_type.split(';', 1) try: params = dict(param.split('=') for param in params.split()) except Exception: params = {} else: params = {} return content_type, params def parse_json(request, **extra): charset = extra.get('charset', 'utf-8') try: data = request.body.decode(charset) return api_settings.JSON_DECODER().decode(data) except Exception: raise ParseError() def parse_post(request, **extra): return dict(request.POST.items()) def parse_plain_text(request, **extra): return request.body
[ "derek.payton@gmail.com" ]
derek.payton@gmail.com
4337257b1cc102097378401dabda4458d298a225
250e692078234b0e3ef22ad20ab7168f807d1d5f
/plus_minus.py
65eeef59116a3bb9fbe1461fbf5552b207e0c437
[]
no_license
AnTznimalz/python_prepro
694338609985971c5e6eaf8ec463c2a5c62dd836
bdc1e49fa03704bebcf2ab69a4c1600e4cd46a74
refs/heads/master
2022-06-22T23:47:28.396580
2020-05-07T15:07:56
2020-05-07T15:07:56
null
0
0
null
null
null
null
UTF-8
Python
false
false
422
py
""" Plus Minus """ def ratio(): """ Func. ratio for calculate ratio of the given array """ num = int(input()) msg = input().split() pos = 0 zero = 0 neg = 0 for i in msg: if int(i) > 0: pos += 1 elif int(i) == 0: zero += 1 else: neg += 1 print("%.6f" %(pos/num)) print("%.6f" %(neg/num)) print("%.6f" %(zero/num)) ratio()
[ "thuchpunapivitcholachat@gmail.com" ]
thuchpunapivitcholachat@gmail.com
422e9f9d1e84b4d2346b968275d55ea920cf8315
85a0ee08b54b2c5e3154e3727b92c37915b4c1de
/test/TT/Strategy7.py
95b8bc12608c042b3536a3d8cca7e4019aa3e6fd
[]
no_license
yaotony/sandbox-empty
877da9b9ba0ec658bbdc8acc79a97267f96408b9
85f04e5db5d26a04fad9ae4ad6d3c86977a9f865
refs/heads/master
2022-05-20T17:14:51.348759
2022-05-04T08:06:56
2022-05-04T08:06:56
35,472,699
0
0
null
null
null
null
UTF-8
Python
false
false
1,569
py
import math import numpy as np def BoxTheory(df,N,S): df['BoxTop'] = 0 df['BoxDown'] = 0 df['BoxTopN'] = 0 df['BoxDownN'] = 0 df['BoxTopD'] = 0 df['BoxDownD'] = 0 #Box 交易訊號欄 df['BoxTopD'] = df['high'].iloc[:].rolling(N).max() df['BoxDownD'] = df['low'].iloc[:].rolling(N).min() df['BoxTopN'] = df['high'].iloc[:].shift(1+N).rolling(N).max() df['BoxDownN'] = df['low'].iloc[:].shift(1+N).rolling(N).min() topV = 0 DownV = 0 boxIndex =0 BoxIndexOrder=0 boxIndexTop =0 boxIndexDown =0 boxIndexBL = 0 BoxTop = 0 BoxDown = 0 BoxTopAr = [] BoxDownAr = [] for i in range( len(df)): BoxTopD = df['BoxTopD'].iloc[i] BoxTopN = df['BoxTopN'].iloc[i] BoxDownD = df['BoxDownD'].iloc[i] BoxDownN = df['BoxDownN'].iloc[i] if BoxTopD < BoxTopN : BoxTop = BoxTopN boxIndexTop = BoxTop else : BoxTop = boxIndexTop if BoxDownD > BoxDownN : BoxDown = BoxDownN boxIndexDown = BoxDownN else : BoxDown = boxIndexDown if BoxTop == 0 : BoxTop = BoxTopD if BoxDown == 0 : BoxDown = BoxDownD BoxTopAr.append(BoxTop) BoxDownAr.append(BoxDown) df['BoxTop'] = BoxTopAr df['BoxDown'] = BoxDownAr return df
[ "tony.exmail@gmail.com" ]
tony.exmail@gmail.com
416d9a1dc7d09ded0fbe07e5a5ca26b458661b4c
6f05f7d5a67b6bb87956a22b988067ec772ba966
/data/train/python/0fee3ef0355224294ed245f863279f4c010e2ae7urls.py
0fee3ef0355224294ed245f863279f4c010e2ae7
[ "MIT" ]
permissive
harshp8l/deep-learning-lang-detection
93b6d24a38081597c610ecf9b1f3b92c7d669be5
2a54293181c1c2b1a2b840ddee4d4d80177efb33
refs/heads/master
2020-04-07T18:07:00.697994
2018-11-29T23:21:23
2018-11-29T23:21:23
158,597,498
0
0
MIT
2018-11-21T19:36:42
2018-11-21T19:36:41
null
UTF-8
Python
false
false
654
py
from django.conf.urls.defaults import * import views from tastypie.api import Api from wdd.api import * api = Api(api_name='v1') api.register(EntryResource()) api.register(RoomResource()) api.register(UserResource()) urlpatterns = patterns('', url(r'^$', views.IndexView.as_view(), name='index'), url(r'^chat/rooms/$', views.RoomList.as_view(), name='room-list'), url(r'^chat/rooms/(?P<pk>\d+)/$', views.RoomDetail.as_view(), name='room-detail'), url(r'^chat/(?P<room>[\w.]+).(?P<mimetype>(json)|(html))$', views.chat, name = 'chat'), #(r'^api/', include(api.urls)), )
[ "aliostad+github@gmail.com" ]
aliostad+github@gmail.com
fcec50a1fdecd92091643f867728bc4c71f9a203
bc441bb06b8948288f110af63feda4e798f30225
/topology_sdk/model/next_builder/import_storyboard_node_pb2.py
045709a9c0e78c00982b424ec7626203e23d88f5
[ "Apache-2.0" ]
permissive
easyopsapis/easyops-api-python
23204f8846a332c30f5f3ff627bf220940137b6b
adf6e3bad33fa6266b5fa0a449dd4ac42f8447d0
refs/heads/master
2020-06-26T23:38:27.308803
2020-06-16T07:25:41
2020-06-16T07:25:41
199,773,131
5
0
null
null
null
null
UTF-8
Python
false
true
9,885
py
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: import_storyboard_node.proto import sys _b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1')) from google.protobuf import descriptor as _descriptor from google.protobuf import message as _message from google.protobuf import reflection as _reflection from google.protobuf import symbol_database as _symbol_database # @@protoc_insertion_point(imports) _sym_db = _symbol_database.Default() from topology_sdk.model.next_builder import storyboard_brick_pb2 as topology__sdk_dot_model_dot_next__builder_dot_storyboard__brick__pb2 from topology_sdk.model.next_builder import storyboard_route_pb2 as topology__sdk_dot_model_dot_next__builder_dot_storyboard__route__pb2 DESCRIPTOR = _descriptor.FileDescriptor( name='import_storyboard_node.proto', package='next_builder', syntax='proto3', serialized_options=_b('ZFgo.easyops.local/contracts/protorepo-models/easyops/model/next_builder'), serialized_pb=_b('\n\x1cimport_storyboard_node.proto\x12\x0cnext_builder\x1a\x36topology_sdk/model/next_builder/storyboard_brick.proto\x1a\x36topology_sdk/model/next_builder/storyboard_route.proto\"\xf9\x02\n\x14ImportStoryboardNode\x12;\n\x07project\x18\x01 \x01(\x0b\x32*.next_builder.ImportStoryboardNode.Project\x12\x39\n\x06parent\x18\x02 \x01(\x0b\x32).next_builder.ImportStoryboardNode.Parent\x12\n\n\x02id\x18\x03 \x01(\t\x12\r\n\x05\x61lias\x18\x04 \x01(\t\x12\r\n\x05\x61ppId\x18\x05 \x01(\t\x12\x12\n\nmountPoint\x18\x06 \x01(\t\x12\x0c\n\x04sort\x18\x07 \x01(\x05\x12\x0c\n\x04type\x18\x08 \x01(\t\x12,\n\x05\x62rick\x18\t \x01(\x0b\x32\x1d.next_builder.StoryboardBrick\x12,\n\x05route\x18\n \x01(\x0b\x32\x1d.next_builder.StoryboardRoute\x1a\x1d\n\x07Project\x12\x12\n\ninstanceId\x18\x01 \x01(\t\x1a\x14\n\x06Parent\x12\n\n\x02id\x18\x01 \x01(\tBHZFgo.easyops.local/contracts/protorepo-models/easyops/model/next_builderb\x06proto3') , dependencies=[topology__sdk_dot_model_dot_next__builder_dot_storyboard__brick__pb2.DESCRIPTOR,topology__sdk_dot_model_dot_next__builder_dot_storyboard__route__pb2.DESCRIPTOR,]) _IMPORTSTORYBOARDNODE_PROJECT = _descriptor.Descriptor( name='Project', full_name='next_builder.ImportStoryboardNode.Project', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='instanceId', full_name='next_builder.ImportStoryboardNode.Project.instanceId', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=485, serialized_end=514, ) _IMPORTSTORYBOARDNODE_PARENT = _descriptor.Descriptor( name='Parent', full_name='next_builder.ImportStoryboardNode.Parent', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='id', full_name='next_builder.ImportStoryboardNode.Parent.id', index=0, number=1, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=516, serialized_end=536, ) _IMPORTSTORYBOARDNODE = _descriptor.Descriptor( name='ImportStoryboardNode', full_name='next_builder.ImportStoryboardNode', filename=None, file=DESCRIPTOR, containing_type=None, fields=[ _descriptor.FieldDescriptor( name='project', full_name='next_builder.ImportStoryboardNode.project', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='parent', full_name='next_builder.ImportStoryboardNode.parent', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='id', full_name='next_builder.ImportStoryboardNode.id', index=2, number=3, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='alias', full_name='next_builder.ImportStoryboardNode.alias', index=3, number=4, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='appId', full_name='next_builder.ImportStoryboardNode.appId', index=4, number=5, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='mountPoint', full_name='next_builder.ImportStoryboardNode.mountPoint', index=5, number=6, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='sort', full_name='next_builder.ImportStoryboardNode.sort', index=6, number=7, type=5, cpp_type=1, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='type', full_name='next_builder.ImportStoryboardNode.type', index=7, number=8, type=9, cpp_type=9, label=1, has_default_value=False, default_value=_b("").decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='brick', full_name='next_builder.ImportStoryboardNode.brick', index=8, number=9, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), _descriptor.FieldDescriptor( name='route', full_name='next_builder.ImportStoryboardNode.route', index=9, number=10, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR), ], extensions=[ ], nested_types=[_IMPORTSTORYBOARDNODE_PROJECT, _IMPORTSTORYBOARDNODE_PARENT, ], enum_types=[ ], serialized_options=None, is_extendable=False, syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=159, serialized_end=536, ) _IMPORTSTORYBOARDNODE_PROJECT.containing_type = _IMPORTSTORYBOARDNODE _IMPORTSTORYBOARDNODE_PARENT.containing_type = _IMPORTSTORYBOARDNODE _IMPORTSTORYBOARDNODE.fields_by_name['project'].message_type = _IMPORTSTORYBOARDNODE_PROJECT _IMPORTSTORYBOARDNODE.fields_by_name['parent'].message_type = _IMPORTSTORYBOARDNODE_PARENT _IMPORTSTORYBOARDNODE.fields_by_name['brick'].message_type = topology__sdk_dot_model_dot_next__builder_dot_storyboard__brick__pb2._STORYBOARDBRICK _IMPORTSTORYBOARDNODE.fields_by_name['route'].message_type = topology__sdk_dot_model_dot_next__builder_dot_storyboard__route__pb2._STORYBOARDROUTE DESCRIPTOR.message_types_by_name['ImportStoryboardNode'] = _IMPORTSTORYBOARDNODE _sym_db.RegisterFileDescriptor(DESCRIPTOR) ImportStoryboardNode = _reflection.GeneratedProtocolMessageType('ImportStoryboardNode', (_message.Message,), { 'Project' : _reflection.GeneratedProtocolMessageType('Project', (_message.Message,), { 'DESCRIPTOR' : _IMPORTSTORYBOARDNODE_PROJECT, '__module__' : 'import_storyboard_node_pb2' # @@protoc_insertion_point(class_scope:next_builder.ImportStoryboardNode.Project) }) , 'Parent' : _reflection.GeneratedProtocolMessageType('Parent', (_message.Message,), { 'DESCRIPTOR' : _IMPORTSTORYBOARDNODE_PARENT, '__module__' : 'import_storyboard_node_pb2' # @@protoc_insertion_point(class_scope:next_builder.ImportStoryboardNode.Parent) }) , 'DESCRIPTOR' : _IMPORTSTORYBOARDNODE, '__module__' : 'import_storyboard_node_pb2' # @@protoc_insertion_point(class_scope:next_builder.ImportStoryboardNode) }) _sym_db.RegisterMessage(ImportStoryboardNode) _sym_db.RegisterMessage(ImportStoryboardNode.Project) _sym_db.RegisterMessage(ImportStoryboardNode.Parent) DESCRIPTOR._options = None # @@protoc_insertion_point(module_scope)
[ "service@easyops.cn" ]
service@easyops.cn
c9b044f351ab64212748338576bcbb175ceb4044
c2fa3b814a7f56ad804dffc767fc54f5099d60f8
/models/structs/snakes_400/mu_context_time.py
db61ba172954e8df0734bdef3f116521d2e2303a
[]
no_license
dmely/contextual_circuit_bp
223b602dbabbe8f8091fbb9106f3103bd5e1dcba
a277bc3146beaa4e3edd2134fc9fb8d3388a6013
refs/heads/master
2021-10-07T19:04:14.509951
2018-03-31T17:10:33
2018-03-31T17:10:33
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,355
py
"""2D convolutional model for Allen data.""" layer_structure = [ { # 'layers': ['alexnet_conv'], # 'alexnet_npy': '/media/data_cifs/clicktionary/pretrained_weights/gabors_for_contours_7.npy', # 'alexnet_layer': 's1', # 'trainable': True, # 'init_bias': True, 'layers': ['conv'], 'names': ['conv1'], 'stride': [1, 2, 2, 1], 'weights': [8], 'filter_size': [7], 'hardcoded_erfs': { 'SRF': 6, 'CRF_excitation': 6, 'CRF_inhibition': 6, 'SSN': [10, 10, 10], # [5, 5, 5], # [11, 11, 11], 'SSF': [10, 10, 10], # [5, 5, 5], # [11, 11, 11] # 30 # 'SSN': [5, 5, 5, 5, 5], # Vanilla VGG-style # 'SSF': [5, 5, 5, 5, 5], # Vanilla VGG-style # 'SSF': [8, 8, 8, 3] # 'SSN': [6, 6, 6], # Atrous VGG-style # 'SSF': [6, 6, 6] }, 'normalization': ['contextual_single_ecrf_time'], 'normalization_target': ['post'], 'normalization_aux': { 'timesteps': 5, 'xi': False, # If FF drive is not trainable 'rectify_weights': True, 'pre_batchnorm': True, 'post_batchnorm': False, # 'dense_connections': True, # 'batch_norm': True, 'atrous_convolutions': False, 'association_field': True, 'multiplicative_excitation': False, 'gru_gates': False, 'trainable': True, 'regularization_targets': { # Modulate sparsity 'q_t': { 'regularization_type': 'l1', # 'orthogonal', 'regularization_strength': 1e-7 # 1e-5 # 0.01 }, 'p_t': { 'regularization_type': 'l1', # 'laplace', # 'orthogonal', 'regularization_strength': 1e-7 # 1e-5 # 1. }, } } }, # { # 'layers': ['global_pool'], # 'weights': [None], # 'names': ['pool2'], # # 'activation': ['relu'], # # 'activation_target': ['post'] # } ] output_structure = [ { 'flatten': [True], 'flatten_target': ['pre'], 'layers': ['fc'], 'weights': [2], 'names': ['fc2'], } ]
[ "drewlinsley@gmail.com" ]
drewlinsley@gmail.com
a29ae03ae7a520b7baa848f815ccbd35b19898db
9df795e57589a99838199f97945e96811e288e75
/W174.py
7c8477888852a7017a676af9a8e81382b0220935
[]
no_license
JakeAttard/2810ICTPythonExercises
945783908a6bf981fc8128a5fc0b4bda6fd52eea
199cc42402a5cf4d8b86060af377d3906af00429
refs/heads/master
2020-06-17T19:07:46.788283
2019-07-16T11:22:15
2019-07-16T11:22:15
196,018,674
0
0
null
null
null
null
UTF-8
Python
false
false
483
py
from PyTest import * ##//////////////////////////// PROBLEM STATEMENT /////////////////////////// ## Given a number n, write while and for loops that add up the numbers in // ## the series 1,2,3,4,..., n-2, n-1, n and display the resultant sum. The // ## number n will be input by the user of the algorithm. // ## 10 -> 55 55 // ##//////////////////////////////////////////////////////////////////////////
[ "jakeattard18@gmail.com" ]
jakeattard18@gmail.com
d1790f748dc1ee5ef4f3bd93c1d0df251d24eeda
dfb53581b4e6dbdc8e3789ea2678de1e1c4b5962
/AI/Machine_Learning/Day02/demo03_save.py
a89925c6b46c5a5bdc001dc176b456aa68c53a86
[]
no_license
biabulinxi/Python-ML-DL
7eff6d6898d72f00575045c5aa2acac45b4b0b82
217d594a3c0cba1e52550f74d100cc5023fb415b
refs/heads/master
2020-06-01T09:13:17.314121
2019-06-08T03:59:36
2019-06-08T03:59:36
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,518
py
# -*- coding: utf-8 -*- # @Project:AID1810 # @Author:biabu # @Date:2019/3/26 14:12 # @File_name:demo03_save.py # @IDE:PyCharm """ 模型保存 """ import pickle import pandas as pd import numpy as np import sklearn.linear_model as lm import matplotlib.pyplot as plt import sklearn.metrics as sm x, y = np.loadtxt('../ml_data/single.txt',delimiter=',',usecols=(0,1), unpack=True) x = x.reshape(-1, 1) # x变为n行1列 # 创建训练模型 model = lm.LinearRegression() model.fit(x, y) # 保存模型 with open('../ml_data/linear.pkl','wb') as f: pickle.dump(model, f) print('Save Success!') pred_y = model.predict(x) ##################################################### # 评估模型的误差 # 平均绝对值误差:1/m*∑|实际输出-预测输出| print(sm.mean_absolute_error(y,pred_y)) # 平均平方误差:sqrt(1/m*∑(实际输出-预测输出)^2) print(sm.mean_squared_error(y, pred_y)) # 中位数绝对值误差: median(|实际输出-预测输出|) print(sm.median_absolute_error(y, pred_y)) # R2得分 (0, 1]区间上的分值,分数越高,模型越好, 误差越小 print(sm.r2_score(y,pred_y)) plt.figure('Linear Regression', facecolor='lightgray') plt.title('Linear Regression', fontsize=14) plt.xlabel('x', fontsize=12) plt.ylabel('y', fontsize=12) plt.tick_params(labelsize=10) plt.grid(linestyle=":") plt.scatter(x, y, c='dodgerblue', alpha=0.5,s=60, label='Sample Points') plt.plot(x, pred_y, c='orangered',linewidth=2,label='Regression Line') plt.legend() plt.show()
[ "biabu1208@163.com" ]
biabu1208@163.com
4a37a85ae9cee3fc4bc3d6ff986b2ffe82c6db0a
527fd39d3a1555800c2c32025fdd15fd86ba6672
/String/user_input.py
c2f37f7cd060b39d3345d5cdf074553f87dff45d
[]
no_license
rohanwarange/Python-Tutorials
cfd39551f7ff62bd032946976ba3820474e42405
53d8fb226f94d027ae7999f9678697206d37d83a
refs/heads/master
2023-06-18T10:45:36.884324
2021-07-07T17:44:22
2021-07-07T17:44:22
null
0
0
null
null
null
null
UTF-8
Python
false
false
112
py
name=input("type your name ") print("hello " + name) age=input("What is your age ?") print("your age is " + age)
[ "rohanwarange24@gmail.com" ]
rohanwarange24@gmail.com
c5af6865211a8e4f3e24f7c23a980bc5eb71dfc4
786de89be635eb21295070a6a3452f3a7fe6712c
/ParCorAna/tags/V00-00-05/src/UserG2.py
c057df1c1414049b1ddc930a968c225c4a9dc031
[]
no_license
connectthefuture/psdmrepo
85267cfe8d54564f99e17035efe931077c8f7a37
f32870a987a7493e7bf0f0a5c1712a5a030ef199
refs/heads/master
2021-01-13T03:26:35.494026
2015-09-03T22:22:11
2015-09-03T22:22:11
null
0
0
null
null
null
null
UTF-8
Python
false
false
21,330
py
'''Example of implementing user code for the G2 calculation. Notes: An import of this module should not do anything complicated. Delay anything complicated until the __init__ method or other methods of the class. The reason for this is that an import of the module is done when reading the params.py file. An import should not depend on MPI or take a long amount of time. ''' import os import numpy as np # to get the definition of SUBTRACT and ADD: import ParCorAna import ParCorAna.XCorrWorkerBase as XCorrWorkerBase import psana import logging import psmon.config as psmonConfig import psmon.publish as psmonPublish import psmon.plots as psmonPlots ################################## ### helper functions for UserG2 class below def getMatchingIndex(delay, iiTimeIdx, n, timesSortIdx, T): '''This is a helper function to workerCalc. Assumes that timesSortIdx is a sorted order of T. Args: delay (int): delay to match iiTimeIdx (int): index into T for start time n (int): number of times to consider in T timesSortIdx (list/array): sorted order for T T (list/array): T values Return: index into T for time such that `T[index]-T[iiTimeIdx]==delay` or None if no such time exists in T. ''' jjTimeIdx = iiTimeIdx + delay if jjTimeIdx >= n: jjTimeIdx = n-1 iiTime = T[iiTimeIdx] while (T[jjTimeIdx]-iiTime) > delay and jjTimeIdx > iiTimeIdx: jjTimeIdx -= 1 if T[jjTimeIdx]-iiTime == delay: return jjTimeIdx return None #################################### class G2Common(object): '''stuff common to both ways to do the G2 calculation ''' def __init__(self, user_params, system_params, mpiParams, testAlternate): self.user_params = user_params self.system_params = system_params self.mp = mpiParams self.testAlternate = testAlternate self._arrayNames = ['G2','IF','IP'] self.delays = system_params['delays'] self.numDelays = len(self.delays) ### COMMON CALLBACK #### # callbacks used by multiple roles, i.e, workers and viewer def fwArrayNames(self): '''Return a list of names for the arrays calculated. This is how the framework knows how many output arrays the user module creates. These must be the same names that workerCalc returns in its dictionary of named arrays. These will be the names the framework passes to the viewer with the assembed arrays. ''' return self._arrayNames #### SERVER CALLBACKS ##### # These callbacks are used on server ranks def serverInit(self): '''Called after framework initializes server. ''' pass def serverEventOk(self, evt): '''tells framework if this event is suitable for including in calculation. This is a callback from the EventIter class. Return True if an event is Ok to proceeed with. This is called before the detector data array is retreived from the event. Although one could look at the detector data here, best practice is to do any filtering that does not require the data array here. Filtering based on the data array should be done in :meth:`ParCorAna.UserG2:serverFinalDataArray` To use the testing part of the framework, it is a good idea to make this callback a wrapper around a function that is accessible to the testing class as well. Args: evt (psana.Event): a psana event. Return: (bool): True if this event should be included in analysis ''' return True def serverFinalDataArray(self, dataArray, evt): '''Callback from the EventIter class. After serverEventOk (above) servers calls this to allow user code to validate the event based on the dataArray. Return None to say the event should not be processed, or the oringial dataArray if it is Ok. Optionally, one can make a copy of the dataArray, modify it, and return the copy. ''' return dataArray ######## WORKER CALLBACKS ######### def workerInit(self, numElementsWorker): '''initialize UserG2 on a worker rank Args: numElementsWorker (int): number of elements this worker processes ''' self.numElementsWorker = numElementsWorker ## define the output arrays returned by this worker # G2 = sum I_i * I_j self.G2 = np.zeros((self.numDelays, self.numElementsWorker), np.float) # IP = sum I_i self.IP = np.zeros((self.numDelays, self.numElementsWorker), np.float) # IF = sum I_j self.IF = np.zeros((self.numDelays, self.numElementsWorker), np.float) # set to 1 when a element arrives that is saturated self.saturatedElements = np.zeros(self.numElementsWorker, np.int8) # counts, how many pairs of times for each delays self.counts = np.zeros(self.numDelays, np.int64) self.saturatedValue = self.user_params['saturatedValue'] self.notzero = self.user_params['notzero'] def workerBeforeDataRemove(self, dataIdx, pivotIndex, lenT, T, X): pass def workerAfterDataInsert(self, dataIdx, pivotIndex, lenT, T, X): self.mp.logInfo("dataIdx=%d" % dataIdx) pass def workerAdjustData(self, data): indexOfSaturatedElements = data >= self.saturatedValue self.saturatedElements[indexOfSaturatedElements]=1 indexOfNegativeAndSmallNumbers = data < self.notzero ## FACTOR OUT data[indexOfNegativeAndSmallNumbers] = self.notzero if self.mp.logger.isEnabledFor(logging.DEBUG): numSaturated = np.sum(indexOfSaturatedElements) numNeg = np.sum(indexOfNegativeAndSmallNumbers) self.mp.logDebug("G2.workerAdjustData: set %d negative values to %r, identified %d saturated pixels" % \ (numNeg, self.notzero, numSaturated)) def workerCalc(self, T, numTimesFilled, X): '''Must be implemented, returns all output arrays. Args: T: 1D array of int64, the 120hz counter identifying the events. Note - T is not sorted. numTimesFilled: T may not be completely filled out. This is the number of entries in T that are. X: the data Multiple Return:: namedArrays counts int8array where these output arguments are as follows. Below let D be the number of delays, that is len(system_params['delays'] and numElementsWorker is what was passed in during workerInit. namedArrays - a dictionary, keys are the names returned in fwArrayNames, i.e, 'G2', 'IF', 'IP'. Values are all numpy arrays of shape (D x numElementsWorker) dtype=np.float64 counts - a 1D array of np.int64, length=numElementsWorker int8array - a 1D array of np.int8 length=numElementsWorker ''' allTimes = T n = numTimesFilled print "n=%d" % n if n < len(allTimes): allTimes = T[0:n] timesSortIdx = np.argsort(allTimes) self.G2[:]=0.0 self.IP[:]=0.0 self.IF[:]=0.0 self.counts[:]=0 for delayIdx, delay in enumerate(self.delays): for ii in range(n-delay): iiTimeIdx = timesSortIdx[ii] jjTimeIdx = getMatchingIndex(delay, iiTimeIdx, n, timesSortIdx, T) if jjTimeIdx is None: continue assert T[jjTimeIdx] - T[iiTimeIdx] == delay, "getMatchingIndex failed" I_ii = X[iiTimeIdx,:] I_jj = X[jjTimeIdx,:] self.counts[delayIdx] += 1 self.G2[delayIdx,:] += I_ii * I_jj self.IP[delayIdx,:] += I_ii self.IF[delayIdx,:] += I_jj return {'G2':self.G2, 'IP':self.IP, 'IF':self.IF}, self.counts, self.saturatedElements ######## VIEWER CALLBACKS ############# def viewerInit(self, maskNdarrayCoords, h5GroupUser): '''initialze viewer. Args: maskNdarrayCoords: this is the array in MPI_Params. h5GroupUser: if system was given an h5 file for output, this is a h5py group opened into that file. Otherwise this argument is None ''' colorFile = self.user_params['colorNdarrayCoords'] assert os.path.exists(colorFile), "user_params['colorNdarrayCoords']=%s not found" % colorFile self.color_ndarrayCoords = np.load(colorFile) self.maskNdarrayCoords = maskNdarrayCoords assert np.issubdtype(self.color_ndarrayCoords.dtype, np.integer), "color array does not have an integer type." assert self.maskNdarrayCoords.shape == self.color_ndarrayCoords.shape, "mask.shape=%s != color.shape=%s" % \ (self.maskNdarrayCoords.shape, self.color_ndarrayCoords.shape) self.colors = [color for color in set(self.color_ndarrayCoords.flatten()) if color > 0] self.colors.sort() self.numColors = len(self.colors) # set up a dictionary that maps each color to a logical index array (in ndarray coords) of # what elements are part of that color. Use the mask to take out masked elements. self.color2ndarrayInd = {} self.color2numElements = {} for color in self.colors: logicalThisColor = self.color_ndarrayCoords == color # take out masked elements logicalThisColor[np.logical_not(self.maskNdarrayCoords)] = False self.color2ndarrayInd[color] = logicalThisColor self.color2numElements[color] = np.sum(logicalThisColor) self.mp.logInfo("UserG2.viewerInit: colorfile contains colors=%s. Number of elements in each color: %s" % \ (self.colors, [self.color2numElements[c] for c in self.colors])) self.plot = self.user_params['psmon_plot'] if self.plot: hostname = os.environ.get('HOSTNAME','*UNKNOWN*') port = self.user_params.get('psmon_port',psmonConfig.APP_PORT) psmonPublish.init() self.mp.logInfo("Initialized psmon. viewer host is: %s" % hostname) psplotCmd = 'psplot --logx -s %s -p %s MULTI' % (hostname, port) self.mp.logInfo("Run cmd: %s" % psplotCmd) def viewerPublish(self, counts, lastEventTime, name2delay2ndarray, int8ndarray, h5GroupUser): '''results have been gathered from workers. User can now publish, either into h5 group, or by plotting, etc. Args: counts (array): this is the 1D array of int64, received from the first worker. It is assumed to be the same for all workers. Typically it is the counts of the number of pairs of times that were a given delay apart. lastEventTime (dict): has keys 'sec', 'nsec', 'fiducials', and 'counter' for the last event that was scattered to workers before gathering at the viewer. counter: 120hz counter for last event before publish name2delay2ndarray: this is a 2D dictionary of the gathered, named arrays. For example name2delay2ndarray['G2'][2] will be the ndarray of G2 calcluations for the G2 term. int8ndarray: gathered int8 array from all the workers, the pixels they found to be saturated. h5GroupUser: either None, or a valid h5py Group to write results into the h5file ''' assert len(counts) == len(self.delays), "UserG2.viewerPublish: len(counts)=%d != len(delays)=%d" % \ (len(counts), len(self.delays)) delayCurves = {} for color in self.colors: if self.color2numElements[color] > 0: delayCurves[color] = np.zeros(len(counts), np.float) ndarrayShape = self.color_ndarrayCoords.shape saturated_ndarrayCoords = int8ndarray assert saturated_ndarrayCoords.shape == ndarrayShape, \ ("UserG2.viewerPublish: gathered saturated_ndarrayCoords.shape=%s != expected=%s" % \ (saturated_ndarrayCoords.shape, self.color_ndarrayCoords.shape)) self.maskOutNewSaturatedElements(saturated_ndarrayCoords) for delayIdx, delayCount in enumerate(counts): delay = self.delays[delayIdx] G2 = name2delay2ndarray['G2'][delay] IF = name2delay2ndarray['IF'][delay] IP = name2delay2ndarray['IP'][delay] assert G2.shape == ndarrayShape, "UserG2.viewerPublish: G2.shape=%s != expected=%s" % \ (G2.shape, ndarrayShape) assert IF.shape == ndarrayShape, "UserG2.viewerPublish: IF.shape=%s != expected=%s" % \ (IF.shape, ndarrayShape) assert IP.shape == ndarrayShape, "UserG2.viewerPublish: IP.shape=%s != expected=%s" % \ (IP.shape, ndarrayShape) G2 /= float(delayCount) IF /= float(delayCount) IP /= float(delayCount) final = G2 / (IP * IF) for color, colorNdarrayInd in self.color2ndarrayInd.iteritems(): numElementsThisColor = self.color2numElements[color] if numElementsThisColor>0: average = np.sum(final[colorNdarrayInd]) / float(numElementsThisColor) delayCurves[color][delayIdx] = average counter120hz = lastEventTime['counter'] groupName = 'G2_results_at_%6.6d' % counter120hz if h5GroupUser is not None: createdGroup = False try: group = h5GroupUser.create_group(groupName) createdGroup = True except ValueError: pass if not createdGroup: self.mp.logError("Cannot create group h5 %s. Is viewer update is to frequent?" % groupName) else: delay_ds = group.create_dataset('delays',(len(self.delays),), dtype='i8') delay_ds[:] = self.delays[:] delay_counts_ds = group.create_dataset('delay_counts',(len(counts),), dtype='i8') delay_counts_ds[:] = counts[:] for color in self.colors: if color not in delayCurves: continue delay_curve_color = group.create_dataset('delay_curve_color_%d' % color, (len(counts),), dtype='f8') delay_curve_color[:] = delayCurves[color][:] # write out the G2, IF, IP matrices using framework helper function ParCorAna.writeToH5Group(group, name2delay2ndarray) if self.plot: multi = psmonPlots.MultiPlot(counter120hz, 'MULTI', ncols=3) for color in self.colors: if color not in delayCurves: continue thisPlot = psmonPlots.XYPlot(counter120hz, 'color/bin=%d' % color, self.delays, delayCurves[color], formats='bs-') multi.add(thisPlot) psmonPublish.send('MULTI', multi) ######## VIEWER HELPERS (NOT CALLBACKS, JUST USER CODE) ########## def maskOutNewSaturatedElements(self, saturated_ndarrayCoords): '''update masks and counts for each color based on new saturated elements Args: saturated_ndarrayCoords: an int8 with the detector ndarray shape. positive values means this is a saturated pixels. ''' saturatedIdx = saturated_ndarrayCoords > 0 if np.sum(saturated_ndarrayCoords)==0: # no saturated pixels return numColorsChanged = 0 numNewSaturatedElements = 0 for color, colorNdarrayInd in self.color2ndarrayInd.iteritems(): numElementsThisColor = self.color2numElements[color] colorNdarrayInd[saturatedIdx]=False self.color2numElements[color] = np.sum(colorNdarrayInd) if self.color2numElements[color] < numElementsThisColor: numColorsChanged += 1 numNewSaturatedElements += (numElementsThisColor - self.color2numElements[color]) if numNewSaturatedElements > 0: self.mp.logInfo("UserG2.maskOutNewSaturatedElements: removed %d elements from among %d colors" % \ (numNewSaturatedElements, numColorsChanged)) def calcAndPublishForTestAlt(self, sortedEventIds, sortedData, h5GroupUser): '''run the alternative test This function receives all the data, with counters, sorted. It should implement the G2 calculation in a robust, alternate way, that can then be compared to the result of the framework. The simplest way to compare results is to reuse the viewerPublish function, however one may want to write an alternate calculate to test this as well. Args: sortedCounters: array of int64, sorted 120hz counters for all the data in the test. sortedData: 2D array of all the accummulated, masked data. h5GroupUser (h5group): the output group that we should write results to. ''' G2 = {} IP = {} IF = {} counts = {} numDetectorElements = sortedData.shape[1] for delay in self.delays: counts[delay]=0 G2[delay]=np.zeros(numDetectorElements) IP[delay]=np.zeros(numDetectorElements) IF[delay]=np.zeros(numDetectorElements) self.mp.logInfo("calcAndPublishForTestAlt: starting double loop") for idxA, eventIdA in enumerate(sortedEventIds): counterA = eventIdA['counter'] for idxB in range(idxA+1,len(sortedEventIds)): counterB = sortedEventIds[idxB]['counter'] delay = counterB - counterA if delay == 0: print "warning: unexpected - same counter twice in data - idxA=%d, idxB=%d" % (idxA, idxB) continue if delay not in self.delays: continue counts[delay] += 1 dataA = sortedData[idxA,:] dataB = sortedData[idxB,:] G2[delay] += dataA*dataB IP[delay] += dataA IF[delay] += dataB self.mp.logInfo("calcAndPublishForTestAlt: finished double loop") name2delay2ndarray = {} for nm,delay2masked in zip(['G2','IF','IP'],[G2,IF,IP]): name2delay2ndarray[nm] = {} for delay,masked in delay2masked.iteritems(): name2delay2ndarray[nm][delay]=np.zeros(self.maskNdarrayCoords.shape, np.float64) name2delay2ndarray[nm][delay][self.maskNdarrayCoords] = masked[:] saturatedElements = np.zeros(self.maskNdarrayCoords.shape, np.int8) saturatedElements[self.maskNdarrayCoords] = self.saturatedElements[:] lastEventTime = {'sec':sortedEventIds[-1]['sec'], 'nsec':sortedEventIds[-1]['nsec'], 'fiducials':sortedEventIds[-1]['fiducials'], 'counter':sortedEventIds[-1]['counter']} countsForViewerPublish = np.zeros(len(counts),np.int) for idx, delay in enumerate(self.delays): countsForViewerPublish[idx]=counts[delay] self.viewerPublish(countsForViewerPublish, lastEventTime, name2delay2ndarray, saturatedElements, h5GroupUser) #################### on going calculation ################################### class G2onGoing(G2Common): '''Workers keep terms of G2 calculation up to date. Do O(n) where n is number of delays, work during each event. ''' def __init__(self, user_params, system_params, mpiParams, testAlternate): super(G2onGoing,self).__init__(user_params, system_params, mpiParams, testAlternate) # Example of printing output: # use logInfo, logDebug, logWarning, and logError to log messages. # these messages get preceded with the rank and viewer/worker/server. # By default, if the message comes from a worker, then only the first # worker logs the message. This reduces noise in the output. # Pass allWorkers=True to have all workers log the message. # it is a good idea to include the class and method at the start of log messages self.mp.logInfo("G2onGoing: object initialized") #################### calculate all at end ################################### class G2atEnd(G2Common): '''workers just store data. Entire G2 calculation is done when update is requested. ''' def __init__(self, user_params, system_params, mpiParams, testAlternate): super(G2atEnd,self).__init__(user_params, system_params, mpiParams, testAlternate) self.mp.logInfo("G2atEnd: object initialized")
[ "davidsch@SLAC.STANFORD.EDU@b967ad99-d558-0410-b138-e0f6c56caec7" ]
davidsch@SLAC.STANFORD.EDU@b967ad99-d558-0410-b138-e0f6c56caec7
c3bd9b7c3ecbdb2de5e7f3c78ae57b2ded1ebef1
dccdfc0b58b24035c614a2fcd3efcc6a88cfa51d
/setup.py
9bf155862a113c7bb84c77fe5c8f87e0b5ae8380
[ "MIT" ]
permissive
igorsobreira/django-test-extensions
203bbb19ccb285a7e816b2b225adc11b89bc8107
d57313401d6964ad0102ad1c584a7b848ba76615
refs/heads/master
2021-01-16T21:02:34.784060
2011-03-12T02:56:16
2011-03-12T02:56:16
1,470,571
1
0
null
null
null
null
UTF-8
Python
false
false
823
py
from setuptools import setup, find_packages setup( name = "django-test-extensions", version = "0.9", author = "Gareth Rushgrove", author_email = "gareth@morethanseven.net", url = "http://github.com/garethr/django-test-extensions/", packages = find_packages('src'), package_dir = {'':'src'}, license = "MIT License", keywords = "django testing", description = "A few classes to make testing django applications easier", install_requires=[ 'setuptools', 'BeautifulSoup', 'coverage', ], classifiers = [ "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", 'Operating System :: OS Independent', 'Programming Language :: Python', 'Topic :: Software Development :: Testing', ] )
[ "gareth@morethanseven.net" ]
gareth@morethanseven.net
cf969a758c84028af52f86848a1607da7e7e5a80
e86fd9f61a41731deb9d56e1107db04de41b6789
/beebeeto/poc_2015_0077.py
96f303abff8c84e77d24cf76f202c39562561b7a
[]
no_license
c0py7hat/POC-EXP
f58e0f1df41e1905e5fdc72b019f8125aac48799
7ddf2790012efb7fb5bd258ddcd1e1c25f0cf201
refs/heads/master
2020-04-30T07:05:31.390537
2019-03-20T08:38:50
2019-03-20T08:38:50
176,674,030
3
2
null
2019-03-20T08:09:56
2019-03-20T07:00:45
Python
UTF-8
Python
false
false
3,536
py
#!/usr/bin/env python # coding=utf-8 """ Site: http://www.beebeeto.com/ Framework: https://github.com/n0tr00t/Beebeeto-framework """ import socket import urllib2 from baseframe import BaseFrame class MyPoc(BaseFrame): poc_info = { # poc相关信息 'poc': { 'id': 'poc-2015-0077', 'name': 'w3tw0rk / Pitbull Perl IRC Bot 远程代码执行漏洞 Exploit', 'author': 'foundu', 'create_date': '2015-04-07', }, # 协议相关信息 'protocol': { 'name': 'http', 'port': [6667], 'layer4_protocol': ['tcp'], }, # 漏洞相关信息 'vul': { 'app_name': 'w3tw0rk / Pitbull Perl IRC', 'vul_version': ['*'], 'type': 'Code Execution', 'tag': ['w3tw0rk / Pitbull Perl IRC Bot 漏洞', 'w3tw0rk / Pitbull Perl IRC Bot Vulnerability'], 'desc': ''' pitbull-w3tw0rk_hunter is POC exploit for Pitbull or w3tw0rk IRC Bot that takes over the owner of a bot which then allows Remote Code Execution. ''', 'references': ['http://www.exploit-db.com/exploits/36652/', ], }, } def _init_user_parser(self): # 定制命令行参数 self.user_parser.add_option('-c','--channel', action='store', dest='channel', type='string', default=None, help='IRC channel') self.user_parser.add_option('-n','--nick', action='store', dest='nick', type='string', default='beebeeto', help='IRC nick') @classmethod def verify(cls, args): #irc server connection settings server = args['options']['target'] # IRC Server botnick = args['options']['nick'] # admin payload for taking over the w3wt0rk bot channel = "#%s"%args['options']['channel'] #channel where the bot is located irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket print "connecting to: " + server irc.connect((server, 6667)) #connects to the server irc.send("USER "+ botnick +" "+ botnick +" "+ botnick +" :I eat w3tw0rk bots!\n") #user authentication irc.send("NICK "+ botnick +"\n") #sets nick irc.send("JOIN "+ channel +"\n") #join the chan irc.send("PRIVMSG "+channel+" :!bot @system 'uname -a' \n") #send the payload to the bot #puts it in a loop while True: text = irc.recv(2040) print text #print text to console if text.find('PING') != -1: #check if 'PING' is found irc.send('PONG ' + text.split() [1] + '\r\n') #returnes 'PONG' back to the server (prevents pinging out!) if text.find('!quit') != -1: #quit the Bot irc.send ("QUIT\r\n") return args if text.find('Linux') != -1: irc.send("PRIVMSG "+channel+" :The bot answers to "+botnick+" which allows command execution \r\n") irc.send ("QUIT\r\n") args['success'] = True return args return args exploit = verify if __name__ == '__main__': from pprint import pprint mp = MyPoc() pprint(mp.run())
[ "noreply@github.com" ]
c0py7hat.noreply@github.com
79770caee3376d14b2ae8c0350f4fcd214826bdb
9a78b2fafd64e200f844a2f6f0deb034ffc96c8d
/rentapps/migrations/0001_initial.py
ace5c693acfd27f917134ddf7e9617354dd36024
[]
no_license
gabrielcoder247/property
8ba29ae443e03f60a39d73b97cd4b0f9e5fea9c4
5620ad7220e2f90d7d95ec711ed3caace4823291
refs/heads/master
2020-06-19T05:16:13.632824
2019-07-17T18:35:06
2019-07-17T18:35:06
196,574,085
0
0
null
null
null
null
UTF-8
Python
false
false
2,493
py
# -*- coding: utf-8 -*- # Generated by Django 1.11 on 2019-07-12 12:37 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): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ migrations.CreateModel( name='Billing', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('firstname', models.CharField(max_length=30, null=True)), ('lastname', models.CharField(max_length=30, null=True)), ('email', models.EmailField(max_length=254, null=True, unique=True)), ('state', models.CharField(max_length=100, null=True)), ('country', models.CharField(max_length=100, null=True)), ('postal_code', models.CharField(max_length=20, null=True)), ('pub_date', models.DateField(auto_now_add=True, null=True)), ('user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), migrations.CreateModel( name='Profile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('pub_date', models.DateField(auto_now_add=True)), ('username', models.CharField(max_length=30, null=True)), ('email', models.EmailField(max_length=254, null=True, unique=True)), ('fname', models.CharField(max_length=30, null=True)), ('lname', models.CharField(max_length=30, null=True)), ('location', models.CharField(max_length=50, null=True)), ('occupation', models.CharField(max_length=60, null=True)), ('org_name', models.CharField(max_length=60, null=True)), ('phone_num', models.CharField(max_length=30, null=True)), ('profile_photo', models.ImageField(upload_to='profile/')), ('bio', models.TextField(max_length=255, null=True)), ('user', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='signup', to=settings.AUTH_USER_MODEL)), ], ), ]
[ "gabrielcoder247@gmail.com" ]
gabrielcoder247@gmail.com
59f25ff70be224b12e6cf04bfee0dce4295358cb
223590e81400eb8192aeb0a56b36b5a80408d4b4
/untitled0.py
5d8197e9f495e56c5efd0c87cbde3b294eba5703
[]
no_license
TianyaoHua/LeetCodeSolutions
c47fd3b6ae0bf60c0656ce12fb88290672c129ed
418172cee1bf48bb2aed3b84fe8b4defd9ef4fdf
refs/heads/master
2020-03-06T19:48:13.338630
2018-08-10T18:27:52
2018-08-10T18:27:52
127,037,907
0
0
null
null
null
null
UTF-8
Python
false
false
936
py
# -*- coding: utf-8 -*- """ Created on Sun Feb 25 16:57:27 2018 @author: Hua Tianyao """ class Solution(object): def dfs(self, color, nums, i, n): next_index = (i + nums[i]) % n if color[next_index] == 1: color[i] = 2 return True elif next_index != i and color[next_index] == 0: color[i] = 1 answer = self.dfs(color, nums, next_index, n) color[i] = 2 return answer else: color[i] = 2 return False def circularArrayLoop(self, nums): """ :type nums: List[int] :rtype: bool """ n = len(nums) color = [0 for i in range(n)] i = 0 while i < n: if color[i] == 0: if self.dfs(color,nums,i,n): return True i += 1 return False print(Solution().circularArrayLoop([1,2,3,4,5]))
[ "hua.tianyao@columbia.edu" ]
hua.tianyao@columbia.edu
c6dac6d64165754472f17a77ad466a0ca0279b6e
ce76b3ef70b885d7c354b6ddb8447d111548e0f1
/last_thing/good_week_and_person/own_eye_and_person/part_and_big_point/problem/problem_or_case.py
20ae2bf35ce4c8e25534587be86a80ec979d2b7a
[]
no_license
JingkaiTang/github-play
9bdca4115eee94a7b5e4ae9d3d6052514729ff21
51b550425a91a97480714fe9bc63cb5112f6f729
refs/heads/master
2021-01-20T20:18:21.249162
2016-08-19T07:20:12
2016-08-19T07:20:12
60,834,519
0
0
null
null
null
null
UTF-8
Python
false
false
214
py
#! /usr/bin/env python def next_person(str_arg): public_week(str_arg) print('own_fact') def public_week(str_arg): print(str_arg) if __name__ == '__main__': next_person('do_good_day_after_case')
[ "jingkaitang@gmail.com" ]
jingkaitang@gmail.com
9682453679a05e8d64bd30fb27ba145b36d956f7
78c3082e9082b5b50435805723ae00a58ca88e30
/03.AI알고리즘 소스코드/venv/Lib/site-packages/caffe2/python/data_workers_test.py
81fa0f865d93340abf4508206c0454608bf2f22e
[]
no_license
jinStar-kimmy/algorithm
26c1bc456d5319578110f3d56f8bd19122356603
59ae8afd8d133f59a6b8d8cee76790fd9dfe1ff7
refs/heads/master
2023-08-28T13:16:45.690232
2021-10-20T08:23:46
2021-10-20T08:23:46
419,217,105
0
1
null
null
null
null
UTF-8
Python
false
false
6,757
py
import numpy as np import unittest import time from caffe2.python import workspace, model_helper from caffe2.python import timeout_guard import caffe2.python.data_workers as data_workers def dummy_fetcher(fetcher_id, batch_size): # Create random amount of values n = np.random.randint(64) + 1 data = np.zeros((n, 3)) labels = [] for j in range(n): data[j, :] *= (j + fetcher_id) labels.append(data[j, 0]) return [np.array(data), np.array(labels)] def dummy_fetcher_rnn(fetcher_id, batch_size): # Hardcoding some input blobs T = 20 N = batch_size D = 33 data = np.random.rand(T, N, D) label = np.random.randint(N, size=(T, N)) seq_lengths = np.random.randint(N, size=(N)) return [data, label, seq_lengths] class DataWorkersTest(unittest.TestCase): def testNonParallelModel(self): workspace.ResetWorkspace() model = model_helper.ModelHelper(name="test") old_seq_id = data_workers.global_coordinator._fetcher_id_seq coordinator = data_workers.init_data_input_workers( model, ["data", "label"], dummy_fetcher, 32, 2, input_source_name="unittest" ) new_seq_id = data_workers.global_coordinator._fetcher_id_seq self.assertEqual(new_seq_id, old_seq_id + 2) coordinator.start() workspace.RunNetOnce(model.param_init_net) workspace.CreateNet(model.net) for _i in range(500): with timeout_guard.CompleteInTimeOrDie(5): workspace.RunNet(model.net.Proto().name) data = workspace.FetchBlob("data") labels = workspace.FetchBlob("label") self.assertEqual(data.shape[0], labels.shape[0]) self.assertEqual(data.shape[0], 32) for j in range(32): self.assertEqual(labels[j], data[j, 0]) self.assertEqual(labels[j], data[j, 1]) self.assertEqual(labels[j], data[j, 2]) coordinator.stop_coordinator("unittest") self.assertEqual(coordinator._coordinators, []) def testRNNInput(self): workspace.ResetWorkspace() model = model_helper.ModelHelper(name="rnn_test") old_seq_id = data_workers.global_coordinator._fetcher_id_seq coordinator = data_workers.init_data_input_workers( model, ["data1", "label1", "seq_lengths1"], dummy_fetcher_rnn, 32, 2, dont_rebatch=False, batch_columns=[1, 1, 0], ) new_seq_id = data_workers.global_coordinator._fetcher_id_seq self.assertEqual(new_seq_id, old_seq_id + 2) coordinator.start() workspace.RunNetOnce(model.param_init_net) workspace.CreateNet(model.net) while coordinator._coordinators[0]._state._inputs < 100: time.sleep(0.01) # Run a couple of rounds workspace.RunNet(model.net.Proto().name) workspace.RunNet(model.net.Proto().name) # Wait for the enqueue thread to get blocked time.sleep(0.2) # We don't dequeue on caffe2 side (as we don't run the net) # so the enqueue thread should be blocked. # Let's now shutdown and see it succeeds. self.assertTrue(coordinator.stop()) @unittest.skip("Test is flaky: https://github.com/pytorch/pytorch/issues/9064") def testInputOrder(self): # # Create two models (train and validation) with same input blobs # names and ensure that both will get the data in correct order # workspace.ResetWorkspace() self.counters = {0: 0, 1: 1} def dummy_fetcher_rnn_ordered1(fetcher_id, batch_size): # Hardcoding some input blobs T = 20 N = batch_size D = 33 data = np.zeros((T, N, D)) data[0][0][0] = self.counters[fetcher_id] label = np.random.randint(N, size=(T, N)) label[0][0] = self.counters[fetcher_id] seq_lengths = np.random.randint(N, size=(N)) seq_lengths[0] = self.counters[fetcher_id] self.counters[fetcher_id] += 1 return [data, label, seq_lengths] workspace.ResetWorkspace() model = model_helper.ModelHelper(name="rnn_test_order") coordinator = data_workers.init_data_input_workers( model, input_blob_names=["data2", "label2", "seq_lengths2"], fetch_fun=dummy_fetcher_rnn_ordered1, batch_size=32, max_buffered_batches=1000, num_worker_threads=1, dont_rebatch=True, input_source_name='train' ) coordinator.start() val_model = model_helper.ModelHelper(name="rnn_test_order_val") coordinator1 = data_workers.init_data_input_workers( val_model, input_blob_names=["data2", "label2", "seq_lengths2"], fetch_fun=dummy_fetcher_rnn_ordered1, batch_size=32, max_buffered_batches=1000, num_worker_threads=1, dont_rebatch=True, input_source_name='val' ) coordinator1.start() workspace.RunNetOnce(model.param_init_net) workspace.CreateNet(model.net) workspace.CreateNet(val_model.net) while coordinator._coordinators[0]._state._inputs < 900: time.sleep(0.01) with timeout_guard.CompleteInTimeOrDie(5): for m in (model, val_model): print(m.net.Proto().name) workspace.RunNet(m.net.Proto().name) last_data = workspace.FetchBlob('data2')[0][0][0] last_lab = workspace.FetchBlob('label2')[0][0] last_seq = workspace.FetchBlob('seq_lengths2')[0] # Run few rounds for _i in range(10): workspace.RunNet(m.net.Proto().name) data = workspace.FetchBlob('data2')[0][0][0] lab = workspace.FetchBlob('label2')[0][0] seq = workspace.FetchBlob('seq_lengths2')[0] self.assertEqual(data, last_data + 1) self.assertEqual(lab, last_lab + 1) self.assertEqual(seq, last_seq + 1) last_data = data last_lab = lab last_seq = seq time.sleep(0.2) self.assertTrue(coordinator.stop())
[ "gudwls3126@gmail.com" ]
gudwls3126@gmail.com
5a5fd88b8f285217867052540eace6bebb77212d
8d6ca1631ef5dd98c65147b01a4b186af055813f
/samples/fleetprovisioning_mqtt5.py
f98d67cc23b0cc010707ec4c9fb94998ced71714
[ "Apache-2.0" ]
permissive
aws/aws-iot-device-sdk-python-v2
fc888c3c08ccca9b7871ceb60ecb51c87d1bcc34
30d6fb27c9ba5b553d25fda5911d16279960f175
refs/heads/main
2023-09-04T10:57:42.561856
2023-08-28T21:09:34
2023-08-28T21:09:34
157,452,080
346
224
Apache-2.0
2023-09-13T18:25:20
2018-11-13T21:52:37
Python
UTF-8
Python
false
false
15,154
py
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0. from awscrt import mqtt5, http from awsiot import iotidentity, mqtt5_client_builder from concurrent.futures import Future import sys import threading import time import traceback import json from utils.command_line_utils import CommandLineUtils # - Overview - # This sample uses the AWS IoT Fleet Provisioning to provision device using either the keys # or CSR # # # - Instructions - # This sample requires you to create a provisioning claim. See: # https://docs.aws.amazon.com/iot/latest/developerguide/provision-wo-cert.html # # - Detail - # On startup, the script subscribes to topics based on the request type of either CSR or Keys # publishes the request to corresponding topic and calls RegisterThing. # cmdData is the arguments/input from the command line placed into a single struct for # use in this sample. This handles all of the command line parsing, validating, etc. # See the Utils/CommandLineUtils for more information. cmdData = CommandLineUtils.parse_sample_input_fleet_provisioning() # Using globals to simplify sample code is_sample_done = threading.Event() mqtt5_client = None identity_client = None createKeysAndCertificateResponse = None createCertificateFromCsrResponse = None registerThingResponse = None future_connection_success = Future() class LockedData: def __init__(self): self.lock = threading.Lock() self.disconnect_called = False locked_data = LockedData() # Function for gracefully quitting this sample def exit(msg_or_exception): if isinstance(msg_or_exception, Exception): print("Exiting Sample due to exception.") traceback.print_exception(msg_or_exception.__class__, msg_or_exception, sys.exc_info()[2]) else: print("Exiting Sample:", msg_or_exception) with locked_data.lock: if not locked_data.disconnect_called: print("Stop the Client...") locked_data.disconnect_called = True mqtt5_client.stop() # Callback for the lifecycle event Connection Success def on_lifecycle_connection_success(lifecycle_connect_success_data: mqtt5.LifecycleConnectSuccessData): print("Lifecycle Connection Success") global future_connection_success future_connection_success.set_result(lifecycle_connect_success_data) # Callback for the lifecycle event on Client Stopped def on_lifecycle_stopped(lifecycle_stopped_data: mqtt5.LifecycleStoppedData): # type: (Future) -> None print("Client Stopped.") # Signal that sample is finished is_sample_done.set() def on_publish_register_thing(future): # type: (Future) -> None try: future.result() # raises exception if publish failed print("Published RegisterThing request..") except Exception as e: print("Failed to publish RegisterThing request.") exit(e) def on_publish_create_keys_and_certificate(future): # type: (Future) -> None try: future.result() # raises exception if publish failed print("Published CreateKeysAndCertificate request..") except Exception as e: print("Failed to publish CreateKeysAndCertificate request.") exit(e) def on_publish_create_certificate_from_csr(future): # type: (Future) -> None try: future.result() # raises exception if publish failed print("Published CreateCertificateFromCsr request..") except Exception as e: print("Failed to publish CreateCertificateFromCsr request.") exit(e) def createkeysandcertificate_execution_accepted(response): # type: (iotidentity.CreateKeysAndCertificateResponse) -> None try: global createKeysAndCertificateResponse createKeysAndCertificateResponse = response if (cmdData.input_is_ci == False): print("Received a new message {}".format(createKeysAndCertificateResponse)) return except Exception as e: exit(e) def createkeysandcertificate_execution_rejected(rejected): # type: (iotidentity.RejectedError) -> None exit("CreateKeysAndCertificate Request rejected with code:'{}' message:'{}' status code:'{}'".format( rejected.error_code, rejected.error_message, rejected.status_code)) def createcertificatefromcsr_execution_accepted(response): # type: (iotidentity.CreateCertificateFromCsrResponse) -> None try: global createCertificateFromCsrResponse createCertificateFromCsrResponse = response if (cmdData.input_is_ci == False): print("Received a new message {}".format(createCertificateFromCsrResponse)) global certificateOwnershipToken certificateOwnershipToken = response.certificate_ownership_token return except Exception as e: exit(e) def createcertificatefromcsr_execution_rejected(rejected): # type: (iotidentity.RejectedError) -> None exit("CreateCertificateFromCsr Request rejected with code:'{}' message:'{}' status code:'{}'".format( rejected.error_code, rejected.error_message, rejected.status_code)) def registerthing_execution_accepted(response): # type: (iotidentity.RegisterThingResponse) -> None try: global registerThingResponse registerThingResponse = response if (cmdData.input_is_ci == False): print("Received a new message {} ".format(registerThingResponse)) return except Exception as e: exit(e) def registerthing_execution_rejected(rejected): # type: (iotidentity.RejectedError) -> None exit("RegisterThing Request rejected with code:'{}' message:'{}' status code:'{}'".format( rejected.error_code, rejected.error_message, rejected.status_code)) def on_resubscribe_complete(resubscribe_future): resubscribe_results = resubscribe_future.result() print("Resubscribe results: {}".format(resubscribe_results)) for topic, qos in resubscribe_results['topics']: if qos is None: sys.exit("Server rejected resubscribe to topic: {}".format(topic)) def waitForCreateKeysAndCertificateResponse(): # Wait for the response. loopCount = 0 while loopCount < 10 and createKeysAndCertificateResponse is None: if createKeysAndCertificateResponse is not None: break if not cmdData.input_is_ci: print('Waiting... CreateKeysAndCertificateResponse: ' + json.dumps(createKeysAndCertificateResponse)) else: print("Waiting... CreateKeysAndCertificateResponse: ...") loopCount += 1 time.sleep(1) def waitForCreateCertificateFromCsrResponse(): # Wait for the response. loopCount = 0 while loopCount < 10 and createCertificateFromCsrResponse is None: if createCertificateFromCsrResponse is not None: break if not cmdData.input_is_ci: print('Waiting...CreateCertificateFromCsrResponse: ' + json.dumps(createCertificateFromCsrResponse)) else: print("Waiting... CreateCertificateFromCsrResponse: ...") loopCount += 1 time.sleep(1) def waitForRegisterThingResponse(): # Wait for the response. loopCount = 0 while loopCount < 20 and registerThingResponse is None: if registerThingResponse is not None: break loopCount += 1 if not cmdData.input_is_ci: print('Waiting... RegisterThingResponse: ' + json.dumps(registerThingResponse)) else: print('Waiting... RegisterThingResponse: ...') time.sleep(1) if __name__ == '__main__': # Create the proxy options if the data is present in cmdData proxy_options = None if cmdData.input_proxy_host is not None and cmdData.input_proxy_port != 0: proxy_options = http.HttpProxyOptions( host_name=cmdData.input_proxy_host, port=cmdData.input_proxy_port) # Create a MQTT connection from the command line data mqtt5_client = mqtt5_client_builder.mtls_from_path( endpoint=cmdData.input_endpoint, port=cmdData.input_port, cert_filepath=cmdData.input_cert, pri_key_filepath=cmdData.input_key, ca_filepath=cmdData.input_ca, client_id=cmdData.input_clientId, clean_session=False, keep_alive_secs=30, http_proxy_options=proxy_options, on_lifecycle_connection_success=on_lifecycle_connection_success, on_lifecycle_stopped=on_lifecycle_stopped) if not cmdData.input_is_ci: print(f"Connecting to {cmdData.input_endpoint} with client ID '{cmdData.input_clientId}'...") else: print("Connecting to endpoint with client ID") mqtt5_client.start() identity_client = iotidentity.IotIdentityClient(mqtt5_client) # Wait for connection to be fully established. # Note that it's not necessary to wait, commands issued to the # mqtt5_client before its fully connected will simply be queued. # But this sample waits here so it's obvious when a connection # fails or succeeds. future_connection_success.result() print("Connected!") try: # Subscribe to necessary topics. # Note that is **is** important to wait for "accepted/rejected" subscriptions # to succeed before publishing the corresponding "request". # Keys workflow if csr is not provided if cmdData.input_csr_path is None: createkeysandcertificate_subscription_request = iotidentity.CreateKeysAndCertificateSubscriptionRequest() print("Subscribing to CreateKeysAndCertificate Accepted topic...") createkeysandcertificate_subscribed_accepted_future, _ = identity_client.subscribe_to_create_keys_and_certificate_accepted( request=createkeysandcertificate_subscription_request, qos=mqtt5.QoS.AT_LEAST_ONCE, callback=createkeysandcertificate_execution_accepted) # Wait for subscription to succeed createkeysandcertificate_subscribed_accepted_future.result() print("Subscribing to CreateKeysAndCertificate Rejected topic...") createkeysandcertificate_subscribed_rejected_future, _ = identity_client.subscribe_to_create_keys_and_certificate_rejected( request=createkeysandcertificate_subscription_request, qos=mqtt5.QoS.AT_LEAST_ONCE, callback=createkeysandcertificate_execution_rejected) # Wait for subscription to succeed createkeysandcertificate_subscribed_rejected_future.result() else: createcertificatefromcsr_subscription_request = iotidentity.CreateCertificateFromCsrSubscriptionRequest() print("Subscribing to CreateCertificateFromCsr Accepted topic...") createcertificatefromcsr_subscribed_accepted_future, _ = identity_client.subscribe_to_create_certificate_from_csr_accepted( request=createcertificatefromcsr_subscription_request, qos=mqtt5.QoS.AT_LEAST_ONCE, callback=createcertificatefromcsr_execution_accepted) # Wait for subscription to succeed createcertificatefromcsr_subscribed_accepted_future.result() print("Subscribing to CreateCertificateFromCsr Rejected topic...") createcertificatefromcsr_subscribed_rejected_future, _ = identity_client.subscribe_to_create_certificate_from_csr_rejected( request=createcertificatefromcsr_subscription_request, qos=mqtt5.QoS.AT_LEAST_ONCE, callback=createcertificatefromcsr_execution_rejected) # Wait for subscription to succeed createcertificatefromcsr_subscribed_rejected_future.result() registerthing_subscription_request = iotidentity.RegisterThingSubscriptionRequest( template_name=cmdData.input_template_name) print("Subscribing to RegisterThing Accepted topic...") registerthing_subscribed_accepted_future, _ = identity_client.subscribe_to_register_thing_accepted( request=registerthing_subscription_request, qos=mqtt5.QoS.AT_LEAST_ONCE, callback=registerthing_execution_accepted) # Wait for subscription to succeed registerthing_subscribed_accepted_future.result() print("Subscribing to RegisterThing Rejected topic...") registerthing_subscribed_rejected_future, _ = identity_client.subscribe_to_register_thing_rejected( request=registerthing_subscription_request, qos=mqtt5.QoS.AT_LEAST_ONCE, callback=registerthing_execution_rejected) # Wait for subscription to succeed registerthing_subscribed_rejected_future.result() fleet_template_name = cmdData.input_template_name fleet_template_parameters = cmdData.input_template_parameters if cmdData.input_csr_path is None: print("Publishing to CreateKeysAndCertificate...") publish_future = identity_client.publish_create_keys_and_certificate( request=iotidentity.CreateKeysAndCertificateRequest(), qos=mqtt5.QoS.AT_LEAST_ONCE) publish_future.add_done_callback(on_publish_create_keys_and_certificate) waitForCreateKeysAndCertificateResponse() if createKeysAndCertificateResponse is None: raise Exception('CreateKeysAndCertificate API did not succeed') registerThingRequest = iotidentity.RegisterThingRequest( template_name=fleet_template_name, certificate_ownership_token=createKeysAndCertificateResponse.certificate_ownership_token, parameters=json.loads(fleet_template_parameters)) else: print("Publishing to CreateCertificateFromCsr...") csrPath = open(cmdData.input_csr_path, 'r').read() publish_future = identity_client.publish_create_certificate_from_csr( request=iotidentity.CreateCertificateFromCsrRequest(certificate_signing_request=csrPath), qos=mqtt5.QoS.AT_LEAST_ONCE) publish_future.add_done_callback(on_publish_create_certificate_from_csr) waitForCreateCertificateFromCsrResponse() if createCertificateFromCsrResponse is None: raise Exception('CreateCertificateFromCsr API did not succeed') registerThingRequest = iotidentity.RegisterThingRequest( template_name=fleet_template_name, certificate_ownership_token=createCertificateFromCsrResponse.certificate_ownership_token, parameters=json.loads(fleet_template_parameters)) print("Publishing to RegisterThing topic...") registerthing_publish_future = identity_client.publish_register_thing( registerThingRequest, mqtt5.QoS.AT_LEAST_ONCE) registerthing_publish_future.add_done_callback(on_publish_register_thing) waitForRegisterThingResponse() exit("success") except Exception as e: exit(e) # Wait for the sample to finish is_sample_done.wait()
[ "noreply@github.com" ]
aws.noreply@github.com
4862104a0fb2371de05ff5051d73fe8321f166a0
6ac0bba8c1851e71529269c0d9d89a7c8fa507f2
/Easy/26.py
0915536721dec4fcf77cccd8a1e6caa20567b01f
[]
no_license
Hellofafar/Leetcode
e81dc85689cd6f9e6e9756beba070cb11e7b192e
7a459e9742958e63be8886874904e5ab2489411a
refs/heads/master
2021-05-16T07:07:19.823953
2020-02-17T03:00:09
2020-02-17T03:00:09
103,690,780
6
0
null
null
null
null
UTF-8
Python
false
false
1,944
py
# ------------------------------ # 26. Remove Duplicates from Sorted Array # # Description: # Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. # Do not allocate extra space for another array, you must do this in place with constant memory. # # For example, # Given input array nums = [1,1,2], # # Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively. It doesn't matter what you leave beyond the new length. # # Version: 1.0 # 09/17/17 by Jianfa # ------------------------------ class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ if len(nums) == 0: return 0 else: nums_len = len(nums) i = 0 check = nums[0] - 1 while i < nums_len: if check != nums[i]: check = nums[i] i += 1 else: nums.pop(i) nums_len -= 1 return len(nums) # Used for test if __name__ == "__main__": test = Solution() nums = [1,1,1,2,3,4,4,4,4] print(test.removeDuplicates(nums)) # ------------------------------ # Good idea from other solution: # Actually there is no need to really remove value from the list. As the last sentence said # "It doesn't matter what you leave beyond the new length." So we can just modify the first several # numbers which is the length of unique values, but leave other values behind unchanged. We set two # runner: a fast runner and a slow runner. As long as a different value is met, modify the corresponding # value in position of slow runner, otherwise move the fast runner. # Here is a link for reference: # https://leetcode.com/problems/remove-duplicates-from-sorted-array/solution/
[ "buptljf@gmail.com" ]
buptljf@gmail.com
a365e4289c66e1d3c595093fd34f83502adf51a3
3090b3e964601e0392a03c903d28f324b4351936
/src/verification/tests.py
865430abb1f493bc192427fbd6115a19476e9f2b
[]
no_license
infoxchange/django-verification
eeebb4f7372ed95d43d8afd6f7b20ebdaa0e295e
51ac7a648863393d44fe7a2813eccbfbee2eb615
refs/heads/master
2021-01-24T23:42:01.913727
2014-07-29T08:29:12
2014-07-29T08:29:12
24,980,017
0
0
null
null
null
null
UTF-8
Python
false
false
13,002
py
from __future__ import unicode_literals import random import hashlib import datetime import unittest from django.core.urlresolvers import resolve, reverse from django.contrib.auth import get_user_model from django.core.exceptions import ValidationError from django import test from django.http import HttpRequest from verification.models import * from verification.views import * from verification.generators import ( Registry, GeneratorError, SMSKeyGenerator, AbstractKeyGenerator, AbstractAlphabetKeyGenerator, HashedHexKeyGenerator, DEFAULT_GENERATOR_NAMES, SAFE_ALPHABET, SHORT_LENGTH, ) class RegistryTest(unittest.TestCase): def setUp(self): registry = Registry() registry.reset() def tearDown(self): registry = Registry() registry.unregister('abstract') def test_available(self): registry = Registry() available = registry.available() expected = DEFAULT_GENERATOR_NAMES self.assertEqual(set(available), set(expected)) def test_get(self): registry = Registry() sms = registry.get('sms') self.assertEqual(sms, SMSKeyGenerator) def test_register(self): registry = Registry() registry.register('abstract', AbstractKeyGenerator) self.assertEqual(registry.get('abstract'), AbstractKeyGenerator) def test_unregister(self): registry = Registry() registry.register('abstract', AbstractKeyGenerator) registry.unregister('abstract') self.assertRaises(GeneratorError, registry.get, 'abstract') self.assertFalse(registry.get('abstract', False)) def test_reset(self): registry = Registry() expected = DEFAULT_GENERATOR_NAMES registry.register('abstract', AbstractKeyGenerator) now_expected = DEFAULT_GENERATOR_NAMES + ['abstract'] self.assertEqual(set(registry.available()), set(now_expected)) registry.reset() self.assertEqual(set(registry.available()), set(expected)) class AbstractKeyGeneratorTest(unittest.TestCase): def tearDown(self): registry = Registry() registry.unregister('abstract') def test_init(self): gen = AbstractKeyGenerator() self.assertEqual(gen.length, 0) #self.assertEqual(gen.name, '') self.assertEqual(gen.seed, None) def test_sms_safe(self): gen = AbstractKeyGenerator() self.assertEqual(gen.sms_safe(), True) gen = AbstractKeyGenerator(length=10) self.assertEqual(gen.sms_safe(), True) gen = AbstractKeyGenerator(length=11) self.assertEqual(gen.sms_safe(), False) def test_tweet_safe(self): gen = AbstractKeyGenerator() self.assertEqual(gen.tweet_safe(), True) gen = AbstractKeyGenerator(length=40) self.assertEqual(gen.tweet_safe(), True) gen = AbstractKeyGenerator(length=41) self.assertEqual(gen.tweet_safe(), False) def test_register(self): gen = AbstractKeyGenerator() gen.register() registry = Registry() self.assertEqual(registry.get('abstract'), gen) def test_unregister(self): gen = AbstractKeyGenerator() gen.register() registry = Registry() self.assertEqual(registry.get('abstract'), gen) gen.unregister() self.assertRaises(GeneratorError, registry.get, 'abstract') class AbstractAlphabetKeyGeneratorTest(unittest.TestCase): def test_init(self): gen = AbstractAlphabetKeyGenerator() self.assertEqual(gen.alphabet, SAFE_ALPHABET) self.assertEqual(gen.length, SHORT_LENGTH) self.assertTrue(hasattr(gen, 'base')) self.assertTrue(hasattr(gen, 'valid_re')) def test_valid_key(self): gen = AbstractAlphabetKeyGenerator() goodkey = 'abc123+-' self.assertTrue(gen.valid_key(goodkey)) badkey = 'abc"123' self.assertFalse(gen.valid_key(badkey)) def test_generate_one_key(self): seed = 12345 expected_key = 'Aa1txnLk' gen = AbstractAlphabetKeyGenerator(seed=seed) key = gen.generate_one_key() self.assertEqual(expected_key, key) class HashedHexKeyGeneratorTest(unittest.TestCase): def test_init(self): gen = HashedHexKeyGenerator() self.assertEqual(gen.hasher, hashlib.sha1) gen = HashedHexKeyGenerator(alphabet=SAFE_ALPHABET) self.assertEqual(gen.base, 16) self.assertEqual(gen.alphabet, SAFE_ALPHABET[:16]) def test_generate_one_key(self): seed = 12345 expected_key = '2b5389d4a96d6f5c03cbbf9b46d56cf0297d9ffd' gen = HashedHexKeyGenerator(seed=seed) key = gen.generate_one_key() self.assertEqual(expected_key, key) key = gen.generate_one_key('fii') expected_key = '98397f5b411802bac598c3f0a19cd7c3063461ca' self.assertEqual(expected_key, key) class KeyGroupTest(test.TestCase): def setUp(self): self.kg_sms = KeyGroup.objects.create(name='test1', generator='sms') self.kg_pin = KeyGroup.objects.create(name='test2', generator='pin') def test_str(self): kg = KeyGroup.objects.create(name='test') self.assertEqual(str(kg), 'test') def test_get_generator(self): self.assertEqual(self.kg_sms.get_generator(), SMSKeyGenerator) kg = KeyGroup.objects.create(name='test3', generator='doesnotexist') self.assertIsNone(kg.get_generator()) def test_purge_keys(self): model = self.kg_sms.key_set.model for i in range(5): model.generate(self.kg_sms) for i in range(5): model.generate(self.kg_pin) self.assertEqual(model.objects.count(), 10) self.kg_sms.purge_keys() self.assertEqual(set(model.objects.all()), set(model.objects.filter(group=self.kg_pin))) self.assertEqual(model.objects.count(), 5) def test_generate_one_key(self): k = self.kg_sms.generate_one_key(Key, seed=12345) self.assertEqual(k.key, 'Aa1txnLk') def test_generate_one_key_with_fact(self): fact = 'this is a test' k = self.kg_sms.generate_one_key(Key, seed=12345, fact=fact) self.assertEqual(k.key, 'Aa1txnLk') self.assertEqual(k.fact, fact) class KeyTest(test.TestCase): def setUp(self): self.kg_sms = KeyGroup.objects.create(name='sms', generator='sms') self.kg_fact = KeyGroup.objects.create(name='fact', has_fact=True, generator='pin') self.kg_ttl = KeyGroup.objects.create(name='ttl', ttl=5, generator='pin') def test_expired(self): now = datetime.datetime.now() earlier = now - datetime.timedelta(minutes=5) k = Key.objects.create(group=self.kg_sms, expires=earlier) expired_keys = Key.objects.expired() self.assertEqual(k, expired_keys[0]) def test_delete_expired(self): now = datetime.datetime.now() earlier = now - datetime.timedelta(minutes=5) k = Key.objects.create(group=self.kg_sms, expires=earlier) Key.objects.delete_expired() expired_keys = Key.objects.expired() self.assertFalse(expired_keys) def test_claimed(self): now = datetime.datetime.now() k = Key.objects.create(group=self.kg_sms, claimed=now) claimed_keys = Key.objects.claimed() self.assertEqual(k, claimed_keys[0]) def test_available(self): now = datetime.datetime.now() earlier = now - datetime.timedelta(minutes=5+random.randint(0, 200)) later = now + datetime.timedelta(minutes=5+random.randint(0, 200)) k1 = Key.objects.create(key='1', group=self.kg_sms, claimed=now) k2 = Key.objects.create(key='2', group=self.kg_sms, claimed=now, expires=earlier) k3 = Key.objects.create(key='3', group=self.kg_sms, claimed=now, expires=later) k4 = Key.objects.create(key='4', group=self.kg_sms) k5 = Key.objects.create(key='5', group=self.kg_sms, expires=earlier) k6 = Key.objects.create(key='6', group=self.kg_sms, expires=later) claimed_keys = Key.objects.claimed() self.assertEqual(set(Key.objects.available()), set((k4, k6))) def test_pprint(self): now = datetime.datetime.now() k = Key.objects.create(key='PPRint', group=self.kg_sms, pub_date=now) pub_date = k.pub_date simple = k.pprint() self.assertEqual(simple, 'PPRint (sms) %s (<= None)' % pub_date) k.expires = now k.save() simple = k.pprint() self.assertEqual(simple, 'PPRint (sms) %s (<= %s)' % (pub_date, now)) def test_clean(self): k1 = Key.objects.create(key='1', group=self.kg_sms) self.assertEqual(k1.clean(), None) k2 = Key.objects.create(key='2', group=self.kg_sms, fact='boo') self.assertEqual(k2.clean(), None) k3 = Key.objects.create(key='3', group=self.kg_fact) self.assertRaises(ValidationError, k3.clean) k4 = Key.objects.create(key='4', group=self.kg_fact, fact='boo') self.assertEqual(k4.clean(), None) def test_save(self): k1 = Key(key='1', group=self.kg_sms) k1.save() self.assertIsNone(k1.expires) k2 = Key(key='2', group=self.kg_ttl) k2.save() self.assertEqual(k2.expires, k2.pub_date + datetime.timedelta(minutes=5)) def test_send_key(self): def dummy_send(*args): return args k1 = Key.objects.create(key='1', group=self.kg_sms) self.assertRaises(TypeError, k1.send_key) k2 = Key.objects.create(key='2', group=self.kg_sms) k2.send_func = dummy_send self.assertEqual(('mjam',), k2.send_key('mjam')) def test_str(self): k1 = Key.objects.create(key='1', group=self.kg_sms) self.assertEqual(str(k1), '1') def test_claim(self): k1 = Key.objects.create(key='1', group=self.kg_sms) User = get_user_model() u = User.objects.create(username='testuser') k_claimed = k1.claim(u) self.assertEqual(k_claimed.claimed_by, u) self.assertTrue(k_claimed.claimed) def test_claim_manager(self): k1 = Key.objects.create(key='1', group=self.kg_sms) User = get_user_model() u = User.objects.create(username='testuser') k_claimed = Key.objects.claim('1', u) self.assertEqual(k_claimed.claimed_by, u) self.assertTrue(k_claimed.claimed) def test_generate(self): k = Key.generate(group=self.kg_sms, seed=12345) self.assertEqual(k.key, 'Aa1txnLk') self.assertEqual(k.group, self.kg_sms) def test_generate_with_fact(self): fact = 'this is a test' k = Key.generate(group=self.kg_sms, seed=12345, fact=fact) self.assertEqual(k.key, 'Aa1txnLk') self.assertEqual(k.group, self.kg_sms) self.assertEqual(k.fact, fact) class ClaimTest(test.TestCase): def setUp(self): self.kg = KeyGroup.objects.create(name='sms') User = get_user_model() self.user = User.objects.create(username='testuser') def test_claim_key_exists(self): k1 = Key.objects.create(key='1', group=self.kg) k_claimed = claim('1', self.user) self.assertEqual(self.user, k_claimed.claimed_by) self.assertTrue(k_claimed.claimed) def test_claim_key_doesnotexist(self): self.assertRaises(VerificationError, claim, '1', self.user) def test_claim_already_claimed(self): k1 = Key.objects.create(key='1', group=self.kg) k_claimed = claim('1', self.user) self.assertRaises(VerificationError, claim, '1', self.user) def test_claim_expired(self): now = datetime.datetime.now() earlier = now - datetime.timedelta(minutes=5+random.randint(0, 200)) k1 = Key.objects.create(key='1', group=self.kg, expires=earlier) self.assertRaises(VerificationError, claim, '1', self.user) class AdminTest(unittest.TestCase): def test_all_defined(self): try: import verification.admin except (NameError, AssertionError) as e: self.fail(e) class ClaimSuccessViewTest(test.TestCase): def setUp(self): self.kg = KeyGroup.objects.create(name='sms') self.k = Key.objects.create(key='blabla', group=self.kg) self.factory = test.RequestFactory() def test_find_view(self): kwargs = { 'key': self.k.key, 'group': self.kg.name } found = resolve(reverse('verification-success', kwargs=kwargs)) self.assertEqual(found.func, claim_success) def test_not500(self): kwargs = { 'key': self.k.key, 'group': self.kg.name } request = self.factory.get(reverse('verification-success', kwargs=kwargs)) response = claim_success(request, **kwargs) self.assertNotEqual(response.status_code, 500)
[ "kaleissin@gmail.com" ]
kaleissin@gmail.com
aa5b6f495066efc73bf588601fe5b0f2372803ab
d2024f10e641ab2f28a888d23071edc032299498
/simple_tasks/realtime_plot_paper_ts_time_based.py
abc861dc00e375a4587e773d46e2b12a8e1f3702
[]
no_license
chen116/demo2018
6f2ae07150182b8e14a2eacbc57bdc79c03e6dee
d289545bcc30445be26e1381d5301d8f657d0c6e
refs/heads/master
2021-04-27T13:11:44.742650
2018-07-14T14:38:37
2018-07-14T14:38:37
122,435,014
0
0
null
null
null
null
UTF-8
Python
false
false
12,714
py
import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.widgets import Cursor from matplotlib.font_manager import FontProperties from matplotlib.widgets import CheckButtons import time fig = plt.figure(figsize=(10, 7)) ax1 = fig.add_subplot(2,1,1) ax2 = fig.add_subplot(2,1,2) buf = 1000 show_frames=1 show_anchors=1 show_dummies=0 show_ts=1 font_per = [{'family': 'serif', 'color': 'k', 'size': 12, },{'family': 'serif', 'color': 'k', # 'weight': 'bold', 'size': 24, }] ax_rtxen = plt.axes([0, 0.91, 0.2, 0.12]) ax_rtxen.text(0.06,0.42,'Average RT-Xen CPU utilization(%/sec):',fontdict=font_per[0]) ax_rtxen_txt = ax_rtxen.text(0.1,0.01,'%.2f%%'%(0),fontdict=font_per[1]) ax_rtxen.axis('off') ax_xen = plt.axes([0.65, 0.91, 0.2, 0.12]) ax_xen.text(0.08,0.42,'Average Credit CPU utilization(%/sec):',fontdict=font_per[0]) ax_xen_txt = ax_xen.text(0.4,0.01,'%.2f%%'%(0),fontdict=font_per[1]) ax_xen.axis('off') last_ts=[15,15] def animate2(i): maxx=30000 global last_ts,show_frames, show_anchors, show_dummies, ax_xen_txt,ax_rtxen_txt,show_ts pullData = open("info.txt","r").read() minmax = open("minmax.txt","r").read() dataArray = pullData.split('\n') minmaxArray = minmax.split('\n') time_start=0 time_end=0 x = [] hrs = [] cpus = [] anchor_xs = [] anchors = [] frame_xs = [] frames = [] dummy_x = [] dummy_hrs = [] ts_xs = [] ts = [] event_last_happened_at_cnt=[-1,-1] for i in range(2): x.append([]) hrs.append([]) cpus.append([]) anchor_xs.append([]) anchors.append([]) frame_xs.append([]) frames.append([]) dummy_x.append([]) dummy_hrs.append([]) ts_xs.append([]) ts.append([]) # for j in range(buf): # x[i].append(j) # hrs[i].append(0) # cpus[i].append(0) cnt=0 maxhrs=0 for eachLine in dataArray: if len(eachLine)>1: line = eachLine.split() if cnt==0: time_start = float(line[-1]) time_end = float(line[-1]) index=int(line[0])-1 if len(line)==3+1: x[index].append(float(line[-1])-time_start) hrs[index].append(float(line[1])) if float(line[1])>maxhrs: maxhrs=float(line[1]) cpus[index].append(float(line[2])/(1)*100) if len(line)==2+1: # print(line) anchor_xs[index].append(float(line[-1])-time_start) anchors[index].append(int(line[1])) event_last_happened_at_cnt[index]=cnt if len(line)==4+1: frame_xs[index].append(float(line[-1])-time_start) frames[index].append(int(line[1])) event_last_happened_at_cnt[index]=cnt if len(line)==5+1: dummy_x[index-2].append(float(line[-1])-time_start) dummy_hrs[index-2].append(float(line[1])) if len(line)==6+1: ts_xs[index].append(float(line[-1])-time_start) ts[index].append(int(line[1])) last_ts[index]=int(line[1]) event_last_happened_at_cnt[index]=cnt # if len(line)==3: # x[index].append(cnt) # hrs[index].append(float(line[1])) # if float(line[1])>maxhrs: # maxhrs=float(line[1]) # cpus[index].append(float(line[2])/(1)*100) # if len(line)==2: # anchor_xs[index].append(cnt) # anchors[index].append(int(line[1])) # event_last_happened_at_cnt[index]=cnt # if len(line)==4: # frame_xs[index].append(cnt) # frames[index].append(int(line[1])) # event_last_happened_at_cnt[index]=cnt # if len(line)==5: # dummy_x[index-2].append(cnt) # dummy_hrs[index-2].append(float(line[1])) # if len(line)==6: # ts_xs[index].append(cnt) # ts[index].append(int(line[1])) # last_ts[index]=int(line[1]) # event_last_happened_at_cnt[index]=cnt cnt+=1 min_max = [] for eachLine in minmaxArray: if len(eachLine)>1: line = eachLine.split() min_max.append(float(line[1])) ax1.clear() ax2.clear() sched=["RT-Xen","Credit"] colrs = ['blue','limegreen'] for i in range(len(x)): ax1.scatter(x[i],hrs[i],s= ((1)%2)*6+5 ,label= sched[i] ,color=colrs[i]) ax2.plot(x[i],cpus[i],color=colrs[i],lw=((i+1)%2)+3,label= sched[i] ) # tmp=[] # for j in range(len(cpus[i])): # tmp.append(100-cpus[i][j]) # ax2.plot(x[i],tmp,color=dummy_colrs[i],lw=((i+1)%2)+3,label= sched[i] ) # ax2.scatter(x[i],cpus[i],s= ((i+1)%2)*6+5,label= sched[i] ,color=colrs[i]) dummy_colrs = ['cyan','lightgreen'] dummy_sched=["Dummy\nRT-Xen","Dummy\nCredit"] if show_dummies: for i in range(len(dummy_x)): ax1.scatter(dummy_x[i],dummy_hrs[i],s= ((1)%2)*6+5 ,label= dummy_sched[i] ,color=dummy_colrs[i],marker='o') x_for_minmax = [] miny = [] maxy = [] total_x_len = len(x[0])+len(x[1])+len(dummy_x[0])+len(dummy_x[1]) for i in range(total_x_len): x_for_minmax.append(i) miny.append(min_max[0]) maxy.append(min_max[1]) if time_start>0 and time_end>0 and len(miny)>1: ax1.plot([0,time_end-time_start],miny[0:2],'r') # ax1.plot([0,time_end-time_start],[(miny[0]+maxy[0])/2,(miny[0]+maxy[0])/2],'pink') ax1.plot([0,time_end-time_start],[(miny[0]+maxy[0])/2,(miny[0]+maxy[0])/2],'pink') ax1.plot([0,time_end-time_start],maxy[0:2],'r',label= 'Target\nFPS\nInterval') fontP = FontProperties() fontP.set_size('small') ax1.legend(bbox_to_anchor=(1.01, 1), loc=2, borderaxespad=0.,prop=fontP) # ax1.legend(loc='upper center', bbox_to_anchor=(0.5, 1.12),ncol=3, fancybox=True, shadow=True,prop=fontP) # ax2.legend(loc='upper center', bbox_to_anchor=(0.5, 1.1),ncol=3, fancybox=True, shadow=True,prop=fontP) ax2.legend(bbox_to_anchor=(1.01, 1), loc=2, borderaxespad=0.,prop=fontP) # fig.suptitle('RT-Xen vs Credit', fontsize=14, fontweight='bold') per = 0 # try: # rtxen_fps = hrs[0][-1] # credit_fps = hrs[1][-1] # per=(rtxen_fps-credit_fps)/credit_fps*100 try: hrs_after_event_rtxen=0 hrs_after_event_rtxen_cnt=0 hrs_after_event_credit=0 hrs_after_event_credit_cnt=0 for ii,xx in enumerate(hrs[0]): if x[0][ii]>event_last_happened_at_cnt[0]: hrs_after_event_rtxen+=xx hrs_after_event_rtxen_cnt+=1 for ii,xx in enumerate(hrs[1]): if x[1][ii]>event_last_happened_at_cnt[1]: hrs_after_event_credit+=xx hrs_after_event_credit_cnt+=1 if hrs_after_event_rtxen_cnt > 0 and hrs_after_event_rtxen_cnt >0: rtxen_fps = hrs_after_event_rtxen/hrs_after_event_rtxen_cnt credit_fps = hrs_after_event_credit/hrs_after_event_credit_cnt per=(rtxen_fps-credit_fps)/credit_fps*100 except: per=0 area_under_curve_rtxen=0 area_under_curve_xen=0 if len(x[1])>0: for i in range(1,len(x[1])): area_under_curve_xen+=cpus[1][i-1]*(x[1][i]-x[1][i-1]) if len(x[0])>0: for i in range(1,len(x[0])): area_under_curve_rtxen+=cpus[0][i-1]*(x[0][i]-x[0][i-1]) if area_under_curve_xen>0: ax_xen_txt.set_text('%.2f%%'%(area_under_curve_xen/(x[1][-1]-x[1][0]))) if area_under_curve_rtxen>0: ax_rtxen_txt.set_text('%.2f%%'%(area_under_curve_rtxen/(x[0][-1]-x[0][0]))) # ax1.set_title('RT-Xen improved by: %.2f %%'%(per)+"\n",loc='right',fontdict=font_per[1]) # ax1.set_title(r'$\frac{RT-Xen\'s improvement}{Percentage}$ = %.2f %%'%(per)+"\n",loc='right',fontsize=18) # ax1.set_title(r'$\frac{RT-Xen \quad FPS}{Credit \quad FPS }$ = %.2f %%'%(per)+"\n",loc='right',fontsize=18) # ax1.set_xlabel('Time\n \n') ax2.set_xlabel('Time') ax1.set_ylabel('Moving Average FPS(frames/sec) \n (Window Size = 5)') ax2.set_ylabel('Assigned CPU Time (%)') # ax2.set_ylim( 45, 105 ) # ax2.set_xlim( 0, 150 ) # ax1.set_xlim( 0, 150 ) ax2.set_ylim( -5, 105 ) ax=[ax1, ax2] font = [{'family': 'serif', 'color': 'dodgerblue', 'weight': 'bold', 'size': 8, },{'family': 'serif', 'color': 'forestgreen', 'weight': 'bold', 'size': 8, }] colrs = ['dodgerblue','forestgreen'] if show_anchors: for i in range(len(anchor_xs)): for j in range(len(anchor_xs[i])): ax1.axvline(x=anchor_xs[i][j],color=colrs[i], linestyle='-') ax2.axvline(x=anchor_xs[i][j],color=colrs[i], linestyle='-') ymin,ymax=ax1.get_ylim() if anchors[i][j]==0: ax1.text(anchor_xs[i][j],ymax,"50%",rotation=45,fontdict=font[i]) elif anchors[i][j]==2: ax1.text(anchor_xs[i][j],ymax,"100%",rotation=45,fontdict=font[i]) elif anchors[i][j]==1: ax1.text(anchor_xs[i][j],ymax,"Linear",rotation=45,fontdict=font[i]) elif anchors[i][j]==3: ax1.text(anchor_xs[i][j],ymax,"APID",rotation=45,fontdict=font[i]) elif anchors[i][j]==4: ax1.text(anchor_xs[i][j],ymax,"AIMD",rotation=45,fontdict=font[i]) if show_frames: for i in range(len(frame_xs)): for j in range(len(frame_xs[i])): ax1.axvline(x=frame_xs[i][j],color=colrs[i], linestyle='--') ax2.axvline(x=frame_xs[i][j],color=colrs[i], linestyle='--') ax2.text(frame_xs[i][j],-10,"period: "+str(frames[i][j]),rotation=45,fontdict=font[i],horizontalalignment='right',verticalalignment='top') if show_ts: for i in range(len(ts_xs)): for j in range(len(ts_xs[i])): ax1.axvline(x=ts_xs[i][j],color=colrs[i], linestyle=':') ax2.axvline(x=ts_xs[i][j],color=colrs[i], linestyle=':') ax2.text(ts_xs[i][j],10,"ts: "+str(ts[i][j]),rotation=45,fontdict=font[i],horizontalalignment='right',verticalalignment='top') ani = animation.FuncAnimation(fig, animate2, interval=1000) # rax = plt.axes([0.91, 0.01, 0.085, 0.2]) # rax.axis('off') # check = CheckButtons(rax, ['Show\nFrames','Show\nAnchors','Show\nTimeslice' ], [True,True,True]) # # check_per = CheckButtons(rax_per, ['Show\nFrames'], [True]) # def func(label): # global show_frames, show_anchors,show_dummies,show_ts # if 'Anchors' in label: # show_anchors=(show_anchors+1)%2 # elif 'Frames' in label: # show_frames=(show_frames+1)%2 # elif 'Dummies' in label: # show_dummies=(show_dummies+1)%2 # elif 'Timeslice' in label: # show_ts=(show_ts+1)%2 # return # check.on_clicked(func) # # cursor = Cursor(rax, useblit=True, color='m', linewidth=2) plt.show() # import matplotlib.pyplot as plt # import matplotlib.animation as animation # import time # fig = plt.figure() # ax1 = fig.add_subplot(2,1,1) # ax2 = fig.add_subplot(2,1,2) # buf = 1000 # def animate(i): # pullData = open("info.txt","r").read() # dataArray = pullData.split('\n') # x = [] # hrs = [] # cpus = [] # cnt=[] # for i in range(2): # x.append([]) # hrs.append([]) # cpus.append([]) # cnt.append(-1) # for j in range(buf): # x[i].append(j) # hrs[i].append(0) # cpus[i].append(0) # for eachLine in dataArray: # if len(eachLine)>1: # line = eachLine.split() # index=int(line[0])-1 # cnt[index]+=1 # hrs[index][cnt[index]]=(float(line[1])) # cpus[index][cnt[index]]=(float(line[2])/10000) # for i in range(2): # hrs[i]=hrs[i][:buf] # cpus[i]=cpus[i][:buf] # ax1.clear() # ax2.clear() # opts=['r*','bo'] # for i in range(len(x)): # ax1.plot(x[i],hrs[i],opts[i],markersize=((i+1)%2)*2+1) # ax2.plot(x[i],cpus[i],opts[i],markersize=((i+1)%2)*3+1) # ani = animation.FuncAnimation(fig, animate, interval=1000) # plt.show()
[ "yvictorck@gmail.com" ]
yvictorck@gmail.com
56d262b69962f3c5f4793a2e6e4dc4c0a775ee3f
f69fdcbc208045fc0b6f5f83231309d9ee473ff7
/src/kedja/models/auth.py
04af025f3ade3f27ecca593937be1b9770514b5d
[]
no_license
kedjaproject/kedja_server
d578266ad5e688dcbd21ceac8694ad60e4b1e72a
6df14d221c8ea247460e7f4600bf7fa860eb18de
refs/heads/master
2020-05-07T18:02:16.816912
2019-10-22T19:43:58
2019-10-22T19:43:58
180,751,037
0
1
null
null
null
null
UTF-8
Python
false
false
5,633
py
import json from random import choice from string import ascii_letters, digits from pyramid.authentication import CallbackAuthenticationPolicy from pyramid.authentication import extract_http_basic_credentials from pyramid.authorization import ACLAuthorizationPolicy from pyramid.interfaces import IAuthenticationPolicy from pyramid.interfaces import IDebugLogger from zope.component import adapter from zope.interface import implementer from kedja.models.credentials import get_valid_credentials from kedja.models.credentials import remove_credentials from kedja.models.credentials import Credentials from kedja.interfaces import IOneTimeAuthToken, IRoot from kedja.interfaces import IOneTimeRegistrationToken from kedja.utils import get_redis_conn @implementer(IAuthenticationPolicy) class HTTPHeaderAuthenticationPolicy(CallbackAuthenticationPolicy): """ An authentication policy that fetches authentication objects from the user profile. It will decode a basic HTTP header """ def __init__(self, callback=None, debug=False): self.callback = callback self.debug = debug def remember(self, request, userid, token=None, **kw): cred = Credentials(userid=userid, token=token, registry=request.registry) cred.save() return cred def forget(self, request): http_creds = extract_http_basic_credentials(request) if http_creds is not None: remove_credentials(http_creds.username, http_creds.password, registry=request.registry) def unauthenticated_userid(self, request): http_creds = extract_http_basic_credentials(request) if http_creds is None: self.debug and self._log( 'No HTTP Credentials received, so no auth. Will return None', 'authenticated_userid', request, ) return # username == userid, and password is the token for the actual credentials cred = get_valid_credentials(http_creds.username, http_creds.password, registry=request.registry) if cred is None: self.debug and self._log( "Credentials weren't valid, will return None", 'authenticated_userid', request, ) return else: self.debug and self._log( 'Valid credentials and user found, will return userid "%s" ' % cred.userid, 'authenticated_userid', request, ) return cred.userid def _log(self, msg, methodname, request): logger = request.registry.queryUtility(IDebugLogger) if logger: # pragma: no cover cls = self.__class__ classname = cls.__module__ + '.' + cls.__name__ methodname = classname + '.' + methodname logger.debug(methodname + ': ' + msg) @implementer(IOneTimeRegistrationToken) @adapter(IRoot) class OneTimeRegistrationToken(object): __doc__ = IOneTimeRegistrationToken.__doc__ prefix = 'otrt' def __init__(self, context: IRoot): self.context = context def get_key(self, token:str): return "{}.{}".format(self.prefix, token) def create(self, payload:dict, expires:int=1200, registry=None): token = _generate_token(length=70) conn = get_redis_conn(registry) key_name = self.get_key(token) conn.setex(key_name, expires, json.dumps(payload)) return token def consume(self, token:str, registry=None): key_name = self.get_key(token) conn = get_redis_conn(registry) payload = conn.get(key_name) if payload: payload = payload.decode() return json.loads(payload) def validate(self, token:str, registry=None): conn = get_redis_conn(registry) key_name = self.get_key(token) return bool(conn.exists(key_name)) @implementer(IOneTimeAuthToken) @adapter(IRoot) class OneTimeAuthToken(object): __doc__ = IOneTimeAuthToken.__doc__ prefix = 'otat' def __init__(self, context: IRoot): self.context = context def get_key(self, userid:str, token:str): return "{}.{}.{}".format(self.prefix, userid, token) def create(self, credentials, expires=30, registry=None): assert isinstance(credentials, Credentials) # Test one_time_token = _generate_token() key_name = self.get_key(credentials.userid, one_time_token) conn = get_redis_conn(registry) conn.setex(key_name, expires, credentials.token) return one_time_token def consume(self, userid:str, token:str, registry=None): key_name = self.get_key(userid, token) conn = get_redis_conn(registry) cred_token = conn.get(key_name) if cred_token: cred_token = cred_token.decode() return Credentials.load(userid, cred_token, registry) def validate(self, userid:str, token:str, registry=None): key_name = self.get_key(userid, token) conn = get_redis_conn(registry) return bool(conn.exists(key_name)) def _generate_token(length=30): out = "" for i in range(length): out += choice(ascii_letters + digits) return out def includeme(config): debug_authn = config.registry.settings.get('pyramid.debug_authorization', False) config.set_authorization_policy(ACLAuthorizationPolicy()) config.set_authentication_policy(HTTPHeaderAuthenticationPolicy(debug=debug_authn)) config.registry.registerAdapter(OneTimeRegistrationToken) config.registry.registerAdapter(OneTimeAuthToken)
[ "robin@betahaus.net" ]
robin@betahaus.net
0a07346dc2887b6524b57e969d9e6eae196467c4
9f5dce388b745c3e7354948a3b833812fb43f202
/storyscript/Features.py
5caefb0e1ed20853201f45714032a47017159eff
[ "Apache-2.0" ]
permissive
ramlaxman/storyscript
f9ba96ea85f50a85ade0083209c588acd1783c0a
274047c4cb4ed7ec301ce4a65f0fb8b98e595cc9
refs/heads/master
2023-04-14T14:59:04.036023
2019-10-01T19:30:03
2019-10-01T19:30:03
212,381,736
0
0
Apache-2.0
2023-04-04T01:23:50
2019-10-02T15:53:11
null
UTF-8
Python
false
false
819
py
# -*- coding: utf-8 -*- class Features: """ Configuration for compiler settings or features. """ defaults = { 'globals': False, # makes global variables writable 'debug': False, # enable debug output } def __init__(self, features): self.features = self.defaults.copy() if features is not None: for k, v in features.items(): assert k in self.defaults, f'{k} is in invalid feature option' self.features[k] = v def __str__(self): features = ','.join([f'{k}={v}' for k, v in self.features.items()]) return f'Features({features})' def __getattr__(self, attribute): return self.features[attribute] @classmethod def all_feature_names(cls): return cls.defaults.keys()
[ "seb@wilzba.ch" ]
seb@wilzba.ch
ec92634dfe091b522492d966ab421e420a73a01a
41dc19883789f45b6086399a1ae23995f53b4b2c
/IPython-parallel-tutorial/check_env.py
85c49fd4c3e695589de399a92b65d5ba442a02d9
[ "MIT" ]
permissive
sunny2309/scipy_conf_notebooks
f86179ddcd67168b709c755cc01862ed7c9ab2bd
30a85d5137db95e01461ad21519bc1bdf294044b
refs/heads/master
2022-10-28T17:27:42.717171
2021-01-25T02:24:05
2021-01-25T02:24:05
221,385,814
2
0
MIT
2022-10-20T02:55:20
2019-11-13T06:12:07
Jupyter Notebook
UTF-8
Python
false
false
707
py
"""check_env.py for IPython.parallel tutorial at SciPy 2014""" import sys import numpy import scipy import requests import matplotlib.pyplot import skimage import matplotlib try: from bs4 import BeautifulSoup except ImportError: print("BeautifulSoup will be used for an example.") try: import networkx except ImportError: print("networkx will be used for an example.") try: import cv except ImportError: print("opencv will be used for an example.") from distutils.version import LooseVersion as V import IPython if V(IPython.__version__) < V('2.0'): print("Need IPython >= 2.0, have %s" % IPython.__version__) sys.exit(1) from IPython import parallel print("OK")
[ "sunny.2309@yahoo.in" ]
sunny.2309@yahoo.in
48bc29bb081af5a16c80a9718cac5b56f870de00
e09930641fa513b821d99674fa0bef3023a7123c
/classification/data_conversion/convert.py
88e354213c1c3d02a8b1560e350ffbee6f19b71b
[]
no_license
abhilashdighe/loop-unroll-583
d7106f9d044b308e3cf778c40a8954becc47626e
9bbbac5b745fc0f33397e3813872ba22379a1ded
refs/heads/master
2021-01-21T09:18:05.299439
2016-03-17T20:22:15
2016-03-17T20:22:15
45,954,635
1
0
null
null
null
null
UTF-8
Python
false
false
2,462
py
import csv import sys from sklearn.cross_validation import train_test_split import cPickle as pickle loop_to_features = {} loop_to_timings = {} with open('features.csv') as features_file: features_csv = csv.reader(features_file) for sample in features_csv: benchmark , loopid = sample[:2] features = map(float , sample[2:]) loop_to_features[(benchmark,loopid)] = features with open('runtime.csv') as runtime_file: runtimes_csv = csv.reader(runtime_file) for sample in runtimes_csv: loopid , trip_count , unroll_factor , time = sample # print benchmark , loopid , trip_count , unroll_factor , time # time_per_trip = float(time) / float(trip_count) time=float(time) if loopid in loop_to_timings: if unroll_factor in loop_to_timings[loopid]: # print loop_to_timings[(benchmark,loopid)] (loop_to_timings[loopid])[unroll_factor].append(time) else: # print loop_to_timings[(benchmark,loopid)] (loop_to_timings[loopid])[unroll_factor] = [time] else: loop_to_timings[loopid] = {} loop_to_timings[loopid][unroll_factor] = [time,] loop_to_label = {} for loopid in loop_to_timings: best_factor = -1 best_time = sys.maxint for unroll_factor in loop_to_timings[loopid]: curr_timing_list = loop_to_timings[loopid][unroll_factor] curr_time = sum(curr_timing_list) / len(curr_timing_list) loop_to_timings[loopid][unroll_factor] = curr_time if curr_time < best_time: best_time = curr_time best_factor = unroll_factor loop_to_label[loopid] = best_factor X = [] y = [] with open('labelled_data.csv' , 'wb') as labelled_file: labelled_csv = csv.writer(labelled_file) for benchmark , loopid in loop_to_features: if loopid in loop_to_timings: features = loop_to_features[(benchmark,loopid)] X.append(features) label = loop_to_label[loopid] y.append(int(label)-1) features.append(label) labelled_csv.writerow(features) X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.33, random_state=42 , stratify=y) print y_train print y_test data = {} data['X_train'] = X_train data['X_test'] = X_test data['y_train'] = y_train data['y_test'] = y_test pickle.dump( data , open('split_data.p' , 'wb'))
[ "=" ]
=
2af238d2ce96798c8a7789cd63e4c8bd8376f814
c43873b9fb8bca215d937f4281d6368bba02a1b5
/plan/testsuite/job.py
9a408603ac095e9eb8fde424f783e76ec14d8755
[ "BSD-3-Clause" ]
permissive
effyroth/plan
f4d2682f9d6ddb031180ebfae62d36b096a3b15f
063b0234fe457386d9c1aeef9cfe4c05b959af24
refs/heads/master
2021-01-18T17:24:23.672363
2014-06-17T03:41:43
2014-06-17T03:41:43
null
0
0
null
null
null
null
UTF-8
Python
false
false
13,314
py
# -*- coding: utf-8 -*- """ plan.testsuite.job ~~~~~~~~~~~~~~~~~~ Tests the Job classes for Plan. :copyright: (c) 2014 by Shipeng Feng. :license: BSD, see LICENSE for more details. """ import sys import unittest from plan.testsuite import BaseTestCase from plan.job import is_month, is_week, get_frequency, get_moment from plan.job import Job, CommandJob, ScriptJob, ModuleJob, RawJob from plan.exceptions import ParseError, ValidationError class BasicTestCase(BaseTestCase): """Tests basic functions used by Job class.""" def test_is_month(self): self.assert_true(is_month('jan')) self.assert_true(is_month('JAN')) self.assert_true(is_month('JANUARY')) self.assert_true(is_month('january')) self.assert_false(is_month('sunday')) def test_is_week(self): self.assert_true(is_week('mon')) self.assert_true(is_week('MON')) self.assert_true(is_week('monday')) self.assert_true(is_week('MONDAY')) self.assert_true(is_week('weekend')) self.assert_false(is_week('feburary')) def test_get_frequency(self): self.assert_equal(3, get_frequency('3.month')) self.assert_equal(3, get_frequency('3.')) def test_get_moment(self): self.assert_equal(3, get_moment('day.3')) self.assert_equal(3, get_moment('.3')) class JobTestCase(BaseTestCase): def test_task(self): job = CommandJob('/bin/task', every='weekend') self.assert_equal(job.cron, '0 0 * * 6,0 /bin/task') job = CommandJob('ls -l ', every='weekend') self.assert_equal(job.cron, '0 0 * * 6,0 ls -l') def test_raw_every(self): job = Job('task', every='0 1 2 3 *', at='minute.2', path='/path') self.assert_equal(job.cron, '0 1 2 3 * cd /path && task') def test_predefined_every(self): job = Job('task', every='yearly', at='minute.2', path='/path') self.assert_equal(job.cron, '@yearly cd /path && task') job = Job('task', every='monthly', at='minute.2', path='/path') self.assert_equal(job.cron, '@monthly cd /path && task') job = Job('task', every='weekly', at='minute.2', path='/path') self.assert_equal(job.cron, '@weekly cd /path && task') job = Job('task', every='daily', at='minute.2', path='/path') self.assert_equal(job.cron, '@daily cd /path && task') job = Job('task', every='hourly', at='minute.2', path='/path') self.assert_equal(job.cron, '@hourly cd /path && task') job = Job('task', every='reboot', at='minute.2', path='/path') self.assert_equal(job.cron, '@reboot cd /path && task') def test_minute_every(self): job = CommandJob('task', every='1.minute') self.assert_equal(job.cron, '* * * * * task') job = CommandJob('task', every='2.minute') self.assert_equal(job.cron, '0,2,4,6,8,10,12,14,16,18,20,22,24,26,' '28,30,32,34,36,38,40,42,44,46,48,50,52,' '54,56,58 * * * * task') job = CommandJob('task', every='10.minute') self.assert_equal(job.cron, '0,10,20,30,40,50 * * * * task') job = CommandJob('task', every='30.minute') self.assert_equal(job.cron, '0,30 * * * * task') job = CommandJob('task', every='60.minute') self.assert_equal(job.cron, '0 * * * * task') job = CommandJob('task', every='11.minute') self.assert_equal(job.cron, '11,22,33,44,55 * * * * task') def test_hour_every(self): job = CommandJob('task', every='1.hour') self.assert_equal(job.cron, '0 * * * * task') job = CommandJob('task', every='24.hour') self.assert_equal(job.cron, '0 0 * * * task') job = CommandJob('task', every='3.hour') self.assert_equal(job.cron, '0 0,3,6,9,12,15,18,21 * * * task') job = CommandJob('task', every='5.hour') self.assert_equal(job.cron, '0 5,10,15,20 * * * task') def test_day_every(self): job = CommandJob('task', every='1.day') self.assert_equal(job.cron, '0 0 * * * task') job = CommandJob('task', every='3.day') self.assert_equal(job.cron, '0 0 4,7,10,13,16,19,22,25,28,31 * * task') job = CommandJob('task', every='31.day') self.assert_equal(job.cron, '0 0 1 * * task') def test_month_every(self): job = CommandJob('task', every='1.month') self.assert_equal(job.cron, '0 0 1 * * task') job = CommandJob('task', every='2.month') self.assert_equal(job.cron, '0 0 1 1,3,5,7,9,11 * task') job = CommandJob('task', every='5.month') self.assert_equal(job.cron, '0 0 1 6,11 * task') job = CommandJob('task', every='january') self.assert_equal(job.cron, '0 0 1 1 * task') def test_week_every(self): job = CommandJob('task', every='monday') self.assert_equal(job.cron, '0 0 * * 1 task') job = CommandJob('task', every='sunday') self.assert_equal(job.cron, '0 0 * * 0 task') job = CommandJob('task', every='saturday') self.assert_equal(job.cron, '0 0 * * 6 task') job = CommandJob('task', every='weekday') self.assert_equal(job.cron, '0 0 * * 1,2,3,4,5 task') job = CommandJob('task', every='weekend') self.assert_equal(job.cron, '0 0 * * 6,0 task') def test_every_parse_error(self): job = CommandJob('task', every='1.century') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='0.minute') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='61.minute') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='0.hour') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='25.hour') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='0.day') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='32.day') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='0.month') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='13.month') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='0.year') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='2.year') self.assert_raises(ParseError, lambda : job.cron) def test_preprocess_at(self): job = Job('job', every='1.hour') at = job.preprocess_at('0:0') self.assert_equal(at, 'hour.0 minute.0') at = job.preprocess_at('1:00') self.assert_equal(at, 'hour.1 minute.0') at = job.preprocess_at('23:01') self.assert_equal(at, 'hour.23 minute.1') at = job.preprocess_at('23:10') self.assert_equal(at, 'hour.23 minute.10') at = job.preprocess_at('12:59') self.assert_equal(at, 'hour.12 minute.59') at = job.preprocess_at('14:09:0') self.assert_equal(at, 'hour.14 minute.9') def test_minute_at(self): job = CommandJob('task', every='1.hour', at='minute.5') self.assert_equal(job.cron, '5 * * * * task') job = CommandJob('task', every='1.day', at='minute.1') self.assert_equal(job.cron, '1 0 * * * task') job = CommandJob('task', every='1.month', at='minute.59') self.assert_equal(job.cron, '59 0 1 * * task') job = CommandJob('task', every='monday', at='minute.30') self.assert_equal(job.cron, '30 0 * * 1 task') def test_hour_at(self): job = CommandJob('task', every='1.day', at='hour.1') self.assert_equal(job.cron, '0 1 * * * task') job = CommandJob('task', every='1.month', at='hour.0') self.assert_equal(job.cron, '0 0 1 * * task') job = CommandJob('task', every='monday', at='hour.23') self.assert_equal(job.cron, '0 23 * * 1 task') def test_day_at(self): job = CommandJob('task', every='1.month', at='day.5') self.assert_equal(job.cron, '0 0 5 * * task') def test_week_at(self): job = CommandJob('task', every='1.month', at='sunday') self.assert_equal(job.cron, '0 0 1 * 0 task') def test_at(self): job = CommandJob('task', every='1.month', at='day.1 hour.1 minute.0') self.assert_equal(job.cron, '0 1 1 * * task') job = CommandJob('task', every='1.month', at='day.1 12:00') self.assert_equal(job.cron, '0 12 1 * * task') job = CommandJob('task', every='1.month', at='day.1 hour.1 minute.5 minute.10') self.assert_equal(job.cron, '5,10 1 1 * * task') job = CommandJob('task', every='1.month', at='day.15 10:55 10:56') self.assert_equal(job.cron, '55,56 10 15 * * task') def test_at_parse_error(self): job = CommandJob('task', every='jan', at='minute.60') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='jan', at='hour.24') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='jan', at='day.0') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='jan', at='day.32') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='jan', at='month.12') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='jan', at='year.1') self.assert_raises(ParseError, lambda : job.cron) job = CommandJob('task', every='jan', at='whenever') self.assert_raises(ParseError, lambda : job.cron) def test_every_at_validation_error(self): job = CommandJob('task', every='1.minute', at='minute.1') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='1.minute', at='hour.23') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='1.minute', at='day.1') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='1.minute', at='sunday') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='1.hour', at='hour.23') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='1.hour', at='day.1') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='1.hour', at='sunday') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='1.day', at='day.1') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='1.day', at='sunday') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='sunday', at='day.1') self.assert_raises(ValidationError, lambda : job.cron) job = CommandJob('task', every='sunday', at='sunday') self.assert_raises(ValidationError, lambda : job.cron) def test_path(self): job = ScriptJob('script.py', every='1.day', path='/web/scripts') self.assert_equal(job.cron, '0 0 * * * cd /web/scripts && %s script.py' % sys.executable) def test_environment(self): job = ScriptJob('script.py', every='1.day', path='/web/scripts', environment={'k': 'v'}) self.assert_equal(job.cron, '0 0 * * * cd /web/scripts && k=v %s' ' script.py' % sys.executable) def test_output(self): job = ScriptJob('script.py', every='1.day', path='/web/scripts', output=dict(stdout='/log/out.log', stderr='/log/err.log')) self.assert_equal(job.cron, '0 0 * * * cd /web/scripts && %s script.py' ' >> /log/out.log 2>> /log/err.log' % sys.executable) def test_command_job(self): job = CommandJob('command', every='1.day', output='null') self.assert_equal(job.cron, '0 0 * * * command > /dev/null 2>&1') def test_script_job(self): job = ScriptJob('script.py', every='1.day', path='/tmp', environment={'key': 'value'}, output='null') self.assert_equal(job.cron, '0 0 * * * cd /tmp && key=value %s' ' script.py > /dev/null 2>&1' % sys.executable) def test_module_job(self): job = ModuleJob('calendar', every='1.day', environment={'key': 'value'}, output='null') self.assert_equal(job.cron, '0 0 * * * key=value %s -m calendar' ' > /dev/null 2>&1' % sys.executable) def test_raw_job(self): job = RawJob('raw ???? my job', every='1.day') self.assert_equal(job.cron, '0 0 * * * raw ???? my job') def suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(BasicTestCase)) suite.addTest(unittest.makeSuite(JobTestCase)) return suite
[ "fsp261@gmail.com" ]
fsp261@gmail.com
5442d0553b637f755d53626209f2a0d888a2b510
c6d4fa98b739a64bb55a8750b4aecd0fc0b105fd
/ScanPi/QRbytes/117.py
67d6fabeee26b4579e9906d7101f49b8478c19ab
[]
no_license
NUSTEM-UK/Heart-of-Maker-Faire
de2c2f223c76f54a8b4c460530e56a5c74b65ca3
fa5a1661c63dac3ae982ed080d80d8da0480ed4e
refs/heads/master
2021-06-18T13:14:38.204811
2017-07-18T13:47:49
2017-07-18T13:47:49
73,701,984
2
0
null
null
null
null
UTF-8
Python
false
false
94,946
py
data = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xF0, 0x00, 0xFF, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0F, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]
[ "jonathan.sanderson@northumbria.ac.uk" ]
jonathan.sanderson@northumbria.ac.uk
fdb2d48f4c0c91c9d980efc87584dee29006574d
54516aed6c3c4dc57873cafd201bef02e9bb419f
/soynlp/noun/_noun_news.py
1afa5524d41fc7c618eac6cdeea4967ac7b16bed
[]
no_license
Kimchanggyun/soynlp
5e5da630d91052eb682f154d8f6876c1672431fa
3c957ed7b9918eaeb39356947e4595dea33b4ccc
refs/heads/master
2021-04-27T14:40:15.282375
2018-02-14T08:19:18
2018-02-14T08:19:18
null
0
0
null
null
null
null
UTF-8
Python
false
false
18,122
py
from collections import namedtuple NewsNounScore = namedtuple('NewsNounScore', 'score count feature_proportion eojeol_proportion n_positive_feature unique_positive_feature_proportion') class NewsNounExtractor: def __init__(self, l_max_length=10, r_max_length=7, predictor_fnames=None, base_noun_dictionary=None, verbose=True): self.l_max_length = l_max_length self.r_max_length = r_max_length self.verbose = verbose self.r_scores = {} self.noun_dictionary = noun_dictionary if base_noun_dictionary else {} import os directory = '/'.join(os.path.abspath(__file__).replace('\\', '/').split('/')[:-2]) if not predictor_fnames: predictor_fnames = ['%s/trained_models/noun_predictor_sejong' % directory] if verbose: print('used default noun predictor; Sejong corpus based logistic predictor') for fname in predictor_fnames: self._load_predictor(fname) self.josa_dictionary = {r for r, s in self.r_scores.items() if s > 0.1} self.josa_dictionary.update({'는'}) self._vdictionary = set() self._vdictionary.update(self._load_dictionary('%s/pos/dictionary/sejong/Verb.txt' % directory)) self._vdictionary.update(self._load_dictionary('%s/pos/dictionary/sejong/Adjective.txt' % directory)) def _load_predictor(self, fname): try: with open(fname, encoding='utf-8') as f: for num_line, line in enumerate(f): r, score = line.split('\t') score = float(score) self.r_scores[r] = max(self.r_scores.get(r, 0), score) except FileNotFoundError: print('predictor file was not found') except Exception as e: print(' ... %s parsing error line (%d) = %s' % (e, num_line, line)) def _load_dictionary(self, fname): try: with open(fname, encoding='utf-8') as f: words = {word.strip().split('\t')[0] for word in f} return words except Exception as e: print(e) return set() def train_extract(self, sents, min_count=3, minimum_noun_score=0.4, minimum_feature_proportion=0.6, wordset=None): self.train(sents) return self.extract(wordset, min_count, minimum_noun_score, minimum_feature_proportion) def train(self, sents): if self.verbose: print('scan vocabulary ... ', end='') self.lrgraph, self.rlgraph, self.eojeols = self._build_graph(sents) self.lcount = {k:sum(d.values()) for k,d in self.lrgraph.items()} self.rcount = {k:sum(d.values()) for k,d in self.rlgraph.items()} if self.verbose: print('done (Lset, Rset, Eojeol) = ({}, {}, {})'.format(len(self.lcount), len(self.rcount), len(self.eojeols))) def _build_graph(self, sents): from collections import defaultdict from collections import Counter dictdictize = lambda dd: {k:dict(d) for k,d in dd.items()} eojeol_max_length = self.l_max_length + self.r_max_length eojeols = Counter((eojeol for sent in sents for eojeol in sent.split() if len(eojeol) <= eojeol_max_length)) lrgraph = defaultdict(lambda: defaultdict(lambda: 0)) rlgraph = defaultdict(lambda: defaultdict(lambda: 0)) for eojeol, count in eojeols.items(): n = len(eojeol) for e in range(1, min(self.l_max_length, n) + 1): if (n - e) > self.r_max_length: continue (l, r) = (eojeol[:e], eojeol[e:]) lrgraph[l][r] += count if r: rlgraph[r][l] += count return dictdictize(lrgraph), dictdictize(rlgraph), eojeols def extract(self, wordset=None, min_count=3, minimum_noun_score=0.4, minimum_feature_proportion=0.6): self._pre_eojeol_analysis(min_count) if not wordset: wordset = {l:c for l, c in self.lcount.items() if len(l) >= 2} wordset = {l for l,c in wordset.items() if c >= min_count and not (l in self.r_scores)} noun_scores = {} for i, l in enumerate(wordset): noun_scores[l] = self.predict(l) if self.verbose and (i+1) % 1000 == 0: print('\rpredicting noun score ... {} / {}'.format(i+1, len(wordset)), end='', flush=True) if self.verbose: print('\rpredicting noun score ... done', flush=True) noun_scores = self._postprocessing(noun_scores, minimum_noun_score, minimum_feature_proportion) self._post_eojeol_analysis(min_count) for noun in self.noun_dictionary: if not (noun in self._noun_scores_postprocessed): self.noun_dictionary[noun] = self.predict(noun) for noun, score in self._noun_scores_postprocessed.items(): self.noun_dictionary[noun] = score del self._noun_scores_ del self._noun_scores_postprocessed return self.noun_dictionary def _pre_eojeol_analysis(self, min_count=3, minimum_eojeol_proportion=0.99): def eojeol_to_NV(l, maximum_eojeol_proportion=0.5, minimum_noun_score=0.4): n = len(l) if n < 4: return None for e in range(2, n-1): (l, r) = (l[:e], l[e:]) if (self.predict(l)[0] >= minimum_noun_score) and (r in self._vdictionary): return (l, r) return None candidates = {l:c for l,c in self.lcount.items() if c >= min_count and (self.eojeols.get(l, 0) / c) >= minimum_eojeol_proportion} for i, (l, c) in enumerate(candidates.items()): if self.verbose and (i+1) % 1000 == 0: args = (len(self.noun_dictionary), i+1, len(candidates)) print('\rextracting {} nouns using verb/adjective dictionary ... {} / {}'.format(*args), end='', flush=True) nv = eojeol_to_NV(l) if not nv: continue self.noun_dictionary[nv[0]] = self.lcount.get(nv[0], 0) if self.verbose: print('\rextracted {} nouns using verb/adjective dictionary'.format(len(self.noun_dictionary)), flush=True) def _post_eojeol_analysis(self, min_count=3, minimum_eojeol_proportion=0.99, minimum_noun_score=0.4): candidates = {l:c for l,c in self.lcount.items() if c >= min_count and (self.eojeols.get(l, 0) / c) >= minimum_eojeol_proportion} begin = len(self.noun_dictionary) for i, (l, c) in enumerate(candidates.items()): if self.verbose and (i+1) % 1000 == 0: args = (len(self.noun_dictionary) - begin, i+1, len(candidates)) print('\rextracting {} compounds from eojeols ... {} / {}'.format(*args), end='', flush=True) if l in self._noun_scores_postprocessed: continue if self._is_NJsubJ(l): continue if self._is_NJ(l): continue if self._is_NV(l): continue if self._hardrule_suffix_filter(l) and self._is_compound(l): self.noun_dictionary[l] = c if self.verbose: print('\rextracted {} compounds from eojeols'.format(len(self.noun_dictionary) - begin), flush=True) def predict(self, l): (norm, score, _total, n_positive_feature, n_feature) = (0, 0, 0, 0, 0) for r, frequency in self.lrgraph.get(l, {}).items(): _total += frequency if not r in self.r_scores: continue norm += frequency score += frequency * self.r_scores[r] n_feature += 1 n_positive_feature += 1 if self.r_scores[r] > 0 else 0 score = score / norm if norm else 0 n_eojeol = self.eojeols.get(l, 0) feature_proportion = norm / (_total - n_eojeol) if (_total - n_eojeol) > 0 else 0 eojeol_proportion = n_eojeol / _total if _total > 0 else 0 unique_positive_feature_proportion = 0 if n_feature <= 0 else n_positive_feature / n_feature return NewsNounScore(score, _total, feature_proportion, eojeol_proportion, n_positive_feature, unique_positive_feature_proportion) # return (score, _total, feature_proportion, eojeol_proportion, n_positive_feature, unique_positive_feature_proportion) def _postprocessing(self, noun_scores, minimum_noun_score=0.4, minimum_feature_proportion=0.6): import sys self._noun_scores_ = dict(filter(lambda x:x[1][0] > minimum_noun_score and x[1][1] > minimum_feature_proportion and len(x[0]) > 1, noun_scores.items())) if self.verbose: print('finding NJsubJ (대학생(으)+로), NsubJ (떡볶+(이)), NVsubE (사기(당)+했다) ... ', end='') njsunjs = {l for l in self._noun_scores_ if self._is_NJsubJ(l)} nsubs = {l0 for l in self._noun_scores_ for l0 in self._find_NsubJ(l) if not (l in njsunjs)} nvsubes = {l for l in self._noun_scores_ if self._is_NVsubE(l) and self._is_NWsub(l) and not self._is_compound(l)} if self.verbose: print('done') # unijosa = {} self._noun_scores_postprocessed = {} for i, (noun, score) in enumerate(self._noun_scores_.items()): if self.verbose and (i+1) % 1000 == 0: print('\rchecking hardrules ... {} / {}'.format(i+1, len(self._noun_scores_)), flush=True, end='') if(noun in njsunjs) or (noun in nsubs) or (noun in nvsubes): continue if not self._hardrule_unijosa_filter(noun) and not self._is_compound(noun): # unijosa[noun] = score continue if not self._hardrule_suffix_filter(noun): continue if not self._hardrule_dang_hada_filter(noun): continue self._noun_scores_postprocessed[noun] = score if self.verbose: print('\rchecking hardrules ... done') return self._noun_scores_postprocessed def _is_NJsubJ(self, l, candidate_noun_threshold=0.4, njsub_proportion_threshold=0.8, min_frequency_droprate=0.7): """### NJsub + J: 대학생으 + 로""" def match_NJsubJ(token): for e in l0_candidates: if token[e:] in self.josa_dictionary: return True return False l0_candidates = {l[:e] for e in range(2, len(l))} l0_candidates = {len(l0) for l0 in l0_candidates if l0 in self.noun_dictionary or self.predict(l0)[0] > candidate_noun_threshold} if not l0_candidates: return False base = self.l_frequency(l[:max(l0_candidates)]) if base == 0: return False elif self.l_frequency(l) / base > min_frequency_droprate: return False tokens = {l+r:c for r, c in self.lrgraph.get(l, {}).items()} prop = sum((c for token, c in tokens.items() if match_NJsubJ(token))) / sum(tokens.values()) return prop > njsub_proportion_threshold def _find_NsubJ(self, l, candidate_noun_threshold=0.7, nsubj_proportion_threshold=0.7): """### Nsub + J: 떡볶 + 이""" proportion = lambda l0, l : self.l_frequency(l0) / self.l_frequency(l) l0_candidates = {l[:e] for e in range(2, len(l)) if l[e:] in self.josa_dictionary} l0_candidates = {l0 for l0 in l0_candidates if (self.predict(l0)[0] > candidate_noun_threshold) and proportion(l0, l) > nsubj_proportion_threshold} return l0_candidates def _is_NVsubE(self, l, maximum_eojeol_proportion=0.7): """is_NVsubE('성심당') # False is_NVsubE('폭행당') # True """ def eojeol_proportion(w): sum_ = sum(self.lrgraph.get(w, {}).values()) return False if not sum_ else (min(1, self.eojeols.get(w, 0) / sum_) > maximum_eojeol_proportion) r_extensions = self.lrgraph.get(l, {}) if not r_extensions: return False n = len(l) for b in range(1, 2 if n <= 3 else 3): (l0, r0) = (l[:-b], l[-b:]) if not (l0 in self._noun_scores_) or not (l0 in self.noun_dictionary): continue r_extension_as_eojeol = sum([eojeol_proportion(r0+r)*c for r, c in r_extensions.items()]) / sum(r_extensions.values()) if r_extension_as_eojeol > maximum_eojeol_proportion: return True return False def _is_NWsub(self, l, minimum_frequency_droprate=0.1): def frequency_droprate(l0): return 0 if self.l_frequency(l0) <= 0 else (self.l_frequency(l) / self.l_frequency(l0)) for b in range(1, 2 if len(l) <= 3 else 3): (l0, r0) = (l[:-b], l[-b:]) if (l0 in self._noun_scores_ or l0 in self.noun_dictionary) and (frequency_droprate(l0) < minimum_frequency_droprate): return True return False def _is_compound(self, l): n = len(l) if n < 4: return False for e in range(2, n): # if (e + 1 == n) and (l[:e] in self._noun_scores_): # return True (l0, l1) = (l[:e], l[e:]) if ((l0 in self._noun_scores_) or (l0 in self.noun_dictionary)) and ((l1 in self._noun_scores_) or (l1 in self.noun_dictionary)): return True if n >= 6: for e1 in range(2, n-3): for e2 in range(e1 + 2, n-1): (l0, l1, l2) = (l[:e1], l[e1:e2], l[e2:]) if ((l0 in self._noun_scores_) or (l0 in self.noun_dictionary)) and ((l1 in self._noun_scores_) or (l1 in self.noun_dictionary)) and ((l2 in self._noun_scores_) or (l2 in self.noun_dictionary)): return True return False def _is_NJ(self, w): for e in range(2, len(w)+1): (l, r) = (w[:e], w[e:]) if ((l in self._noun_scores_) or (l in self.noun_dictionary)) and ((not r) or (self.r_scores.get(r, 0) > 0)): return True return False def _is_NV(self, l): for e in range(2, len(l)): if (l[:e] in self._noun_scores_postprocessed or l[:e] in self.noun_dictionary) and (l[e:] in self._vdictionary): return True return False def _hardrule_unijosa_filter(self, l, min_count=10, maximum_number_of_josa=1): def has_passset(r): passset = {'과', '는', '되고', '되는', '되다', '된다', '들', '들에', '들의', '들이', '로', '로는', '로도', '로서', '를', '부터', '뿐', '뿐만', '뿐이', '뿐인', '에게', '에도', '에서', '에와', '와', '으로', '으로의', '은', '의', '이', '이나', '이라', '이었', '인', '임', '처럼', '하다', '한', '할', '했던', '했고', '했다'} return (r in passset) if not (l in self._noun_scores_): return True if self._noun_scores_[l][1] <= min_count and self._noun_scores_[l][4] <= maximum_number_of_josa: rdict = self.lrgraph.get(l, {}) if not rdict: return False n_passjosa = sum((c for r,c in self.lrgraph[l].items() if (r) and (has_passset(r[:2]) or self._is_NJ(r)))) n_nonemptyr = sum((c for r, c in self.lrgraph[l].items() if r)) passset_prop = n_passjosa / n_nonemptyr if n_nonemptyr else 0 return passset_prop > 0.5 return True def _hardrule_dang_hada_filter(self, l, max_h_proportion=0.5): from soynlp.hangle import decompose # TODO check import path if not (l[-1] == '당') and (l[:-1] in self._noun_scores_ or l[:-1] in self.noun_dictionary): return True rdict = self.lrgraph.get(l, {}) n_base = sum((c for r,c in rdict.items() if c)) n_h = 0 for r,c in rdict.items(): if not r: continue rdecompose = decompose(r[0]) if rdecompose and rdecompose[0] == 'ㅎ': n_h += c return True if n_base <= 0 else (n_h / n_base < max_h_proportion) def _hardrule_suffix_filter(self, l, minimum_frequency_droprate=0.8): def prop_r(l, r): base = sum(self.lrgraph.get(l, {}).values()) return 0 if base == 0 else self.lrgraph.get(l, {}).get(r, 0) / base if l in self._vdictionary: return False stoplsub = {'갔다', '이는', '겠지', '보는'} if l[-2:] in stoplsub: return False if (l[-1] == '으') and ((prop_r(l, '로') + prop_r(l, '로써') + prop_r(l, '로만')) + prop_r(l, '로의') > 0.5): return False if (l[-1] == '지') and (prop_r(l, '만') > 0.5): return False if (l[-1] == '없') and ((prop_r(l, '는') + prop_r(l, '이') + prop_r(l, '다')) + prop_r(l, '었다') > 0.5): return False if (l[-1] == '인') or (l[-1] == '은') or (l[-1] == '의') or (l[-1] == '와') or (l[-1] == '과'): droprate = 0 if not (l[:-1] in self.lcount) else (self.lcount.get(l, 0) / self.lcount[l[:-1]]) if droprate < minimum_frequency_droprate: return False if (l[-2:] == '들이') or (l[-2:] == '들은') or (l[-2:] == '들도') or (l[-2:] == '들을'): droprate = 0 if not (l[:-1] in self.lcount) else (self.lcount.get(l, 0) / self.lcount[l[:-1]]) if droprate < minimum_frequency_droprate: return False if (l[-2:] == '으로') and (len(l) == 3 or (l[:-2] in self.noun_dictionary or l[:-2] in self._noun_scores_postprocessed)): return False return True def l_frequency(self, l): return self.lcount.get(l, 0)
[ "soy.lovit@gmail.com" ]
soy.lovit@gmail.com
1f4c7521cdae03be724f7fda5a14b675b3ac1ba9
fd0be9219fbc479548829289921907659dcfe18c
/src/k8s/my_pod.py
1f5944c99fb3eb7f8b0dc96f19499eb616fa57d1
[ "MIT" ]
permissive
latonaio/kube-etcd-sentinel
00f18c2dabada0211aff474afc25b1b79c4c53a9
bf8d1248ac9b13c30b4624867d8d4d17fa5ab06e
refs/heads/main
2022-12-19T16:58:28.196293
2020-10-21T06:01:22
2020-10-21T06:01:22
305,906,052
10
0
null
null
null
null
UTF-8
Python
false
false
1,416
py
from datetime import datetime as dt from kubernetes import client from k8s.my_kubernetes import MyKubernetes class MyPod(MyKubernetes): def __init__(self, kube_client: client.CoreV1Api, node_name, datetime_fmt): super().__init__(kube_client, node_name, datetime_fmt) self.pod_names = [] self.current_index = 0 self._fetch_names() def __iter__(self): return self def __next__(self): if self.current_index >= len(self.pod_names): raise StopIteration self.name = self.pod_names[self.current_index] pod = self.kube_client.read_namespaced_pod(self.name, self.project_symbol) self.current_index = self.current_index + 1 # remove additional string from docker registry image_name = pod.spec.containers[0].image.split('/')[-1].split(':')[0] return { "podName": self.name, "imageName": image_name, "deviceNameFk": self.node_name, "deployedAt": pod.status.start_time.strftime(self.datetime_fmt), "currentVersion": "1.00", "latestVersion": "2.00", "status": "0", # always true "updateAt": dt.now().strftime(self.datetime_fmt), } def _fetch_names(self): for pod in self.kube_client.list_namespaced_pod(self.project_symbol).items: self.pod_names.append(pod.metadata.name)
[ "kokorononakaniitumo@yahoo.co.jp" ]
kokorononakaniitumo@yahoo.co.jp
546229f61db0dd8227e6fe61a72e2fea1b2455c8
18f8abb90efece37949f5b5758c7752b1602fb12
/py/django_tools/django-cms/cms/admin/placeholderadmin.py
6148ae5ccb44debb9ca9ac07a42637c42008b626
[ "BSD-3-Clause" ]
permissive
marceltoben/evandrix.github.com
caa7d4c2ef84ba8c5a9a6ace2126e8fd6db1a516
abc3fbfb34f791f84e9a9d4dc522966421778ab2
refs/heads/master
2021-08-02T06:18:12.953567
2011-08-23T16:49:33
2011-08-23T16:49:33
2,267,457
3
5
null
2021-07-28T11:39:25
2011-08-25T11:18:56
C
UTF-8
Python
false
false
14,297
py
# -*- coding: utf-8 -*- from cms.forms.fields import PlaceholderFormField from cms.models.fields import PlaceholderField from cms.models.placeholdermodel import Placeholder from cms.models.pluginmodel import CMSPlugin from cms.plugin_pool import plugin_pool from cms.utils import get_language_from_request from cms.utils.permissions import has_plugin_permission from copy import deepcopy from django.conf import settings from django.contrib.admin import ModelAdmin from django.http import HttpResponse, Http404, HttpResponseBadRequest, HttpResponseForbidden from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.template.defaultfilters import force_escape, escapejs from django.utils.translation import ugettext as _ import os class PlaceholderAdmin(ModelAdmin): class Media: css = { 'all': [os.path.join(settings.CMS_MEDIA_URL, path) for path in ( 'css/rte.css', 'css/pages.css', 'css/change_form.css', 'css/jquery.dialog.css', 'css/plugin_editor.css', )] } js = [os.path.join(settings.CMS_MEDIA_URL, path) for path in ( 'js/lib/jquery.js', 'js/csrf.js', 'js/lib/jquery.query.js', 'js/lib/ui.core.js', 'js/lib/ui.dialog.js', )] def get_fieldsets(self, request, obj=None): """ Get fieldsets to enforce correct fieldsetting of placeholder fields """ form = self.get_form(request, obj) placeholder_fields = self._get_placeholder_fields(form) if self.declared_fieldsets: # check those declared fieldsets fieldsets = list(deepcopy(self.declared_fieldsets)) for label, fieldset in fieldsets: fields = list(fieldset['fields']) for field in fieldset['fields']: if field in placeholder_fields: if (len(fieldset['fields']) == 1 and 'classes' in fieldset and 'plugin-holder' in fieldset['classes'] and 'plugin-holder-nopage' in fieldset['classes']): placeholder_fields.remove(field) else: fields.remove(field) if fields: fieldset['fields'] = fields else: # no fields in the fieldset anymore, delete the fieldset fieldsets.remove((label, fieldset)) for placeholder in placeholder_fields: fieldsets.append((self.get_label_for_placeholder(placeholder), { 'fields': (placeholder,), 'classes': ('plugin-holder', 'plugin-holder-nopage',), },)) return fieldsets fieldsets = [] fieldsets.append((None, {'fields': [f for f in form.base_fields.keys() if not f in placeholder_fields]})) for placeholder in placeholder_fields: fieldsets.append((self.get_label_for_placeholder(placeholder), { 'fields': (placeholder,), 'classes': ('plugin-holder', 'plugin-holder-nopage',), })) readonly_fields = self.get_readonly_fields(request, obj) if readonly_fields: fieldsets.append((None, {'fields': list(readonly_fields)})) return fieldsets def get_label_for_placeholder(self, placeholder): return ' '.join([x.capitalize() for x in self.model._meta.get_field_by_name(placeholder)[0].verbose_name.split(' ')]) def formfield_for_dbfield(self, db_field, **kwargs): """ Hook for specifying the form Field instance for a given database Field instance. If kwargs are given, they're passed to the form Field's constructor. """ if isinstance(db_field, PlaceholderField): request = kwargs.pop("request", None) return db_field.formfield_for_admin(request, self.placeholder_plugin_filter, **kwargs) return super(PlaceholderAdmin, self).formfield_for_dbfield(db_field, **kwargs) def placeholder_plugin_filter(self, request, queryset): return queryset def _get_placeholder_fields(self, form): placeholder_fields = [] for key, value in form.base_fields.items(): if isinstance(value, PlaceholderFormField): placeholder_fields.append(key) return placeholder_fields def get_urls(self): """ Register the plugin specific urls (add/edit/copy/remove/move) """ from django.conf.urls.defaults import patterns, url info = "%s_%s" % (self.model._meta.app_label, self.model._meta.module_name) pat = lambda regex, fn: url(regex, self.admin_site.admin_view(fn), name='%s_%s' % (info, fn.__name__)) url_patterns = patterns('', pat(r'add-plugin/$', self.add_plugin), pat(r'edit-plugin/([0-9]+)/$', self.edit_plugin), pat(r'remove-plugin/$', self.remove_plugin), pat(r'move-plugin/$', self.move_plugin), pat(r'copy-plugins/$', self.copy_plugins), ) return url_patterns + super(PlaceholderAdmin, self).get_urls() def add_plugin(self, request): # only allow POST if request.method != "POST": raise Http404 plugin_type = request.POST['plugin_type'] if not has_plugin_permission(request.user, plugin_type, "add"): return HttpResponseForbidden("You don't have permission to add plugins") placeholder_id = request.POST.get('placeholder', None) position = None language = get_language_from_request(request) parent = None # check if we got a placeholder (id) if placeholder_id: placeholder = get_object_or_404(Placeholder, pk=placeholder_id) else: # else get the parent_id parent_id = request.POST.get('parent_id', None) if not parent_id: # if we get neither a placeholder nor a parent, bail out raise Http404 parent = get_object_or_404(CMSPlugin, pk=parent_id) placeholder = parent.placeholder # check add permissions on placeholder if not placeholder.has_add_permission(request): return HttpResponseForbidden(_("You don't have permission to add content here.")) # check the limits defined in CMS_PLACEHOLDER_CONF for this placeholder limits = settings.CMS_PLACEHOLDER_CONF.get(placeholder.slot, {}).get('limits', None) if limits: count = placeholder.cmsplugin_set.count() global_limit = limits.get("global", None) type_limit = limits.get(plugin_type, None) # check the global limit first if global_limit and count >= global_limit: return HttpResponseBadRequest( "This placeholder already has the maximum number of plugins." ) elif type_limit: # then check the type specific limit type_count = CMSPlugin.objects.filter( language=language, placeholder=placeholder, plugin_type=plugin_type ).count() if type_count >= type_limit: return HttpResponseBadRequest( "This placeholder already has the maximum number (%s) " "of %s plugins." % (type_limit, plugin_type) ) # actually add the plugin plugin = CMSPlugin(language=language, plugin_type=plugin_type, position=position, placeholder=placeholder, parent=parent) plugin.save() # returns it's ID as response return HttpResponse(str(plugin.pk)) def edit_plugin(self, request, plugin_id): plugin_id = int(plugin_id) # get the plugin to edit of bail out cms_plugin = get_object_or_404(CMSPlugin, pk=plugin_id) if not has_plugin_permission(request.user, cms_plugin.plugin_type, "change"): return HttpResponseForbidden(_("You don't have permission to add plugins")) # check that the user has permission to change this plugin if not cms_plugin.placeholder.has_change_permission(request): return HttpResponseForbidden(_("You don't have permission to add content here.")) instance, plugin_admin = cms_plugin.get_plugin_instance(self.admin_site) plugin_admin.cms_plugin_instance = cms_plugin plugin_admin.placeholder = cms_plugin.placeholder if request.method == "POST": # set the continue flag, otherwise will plugin_admin make redirect to list # view, which actually does'nt exists post_request = request.POST.copy() post_request['_continue'] = True request.POST = post_request if not instance: # instance doesn't exist, call add view response = plugin_admin.add_view(request) else: # already saved before, call change view # we actually have the instance here, but since i won't override # change_view method, is better if it will be loaded again, so # just pass id to plugin_admin response = plugin_admin.change_view(request, str(plugin_id)) if request.method == "POST" and plugin_admin.object_successfully_changed: # read the saved object from plugin_admin - ugly but works saved_object = plugin_admin.saved_object context = { 'CMS_MEDIA_URL': settings.CMS_MEDIA_URL, 'plugin': saved_object, 'is_popup': True, 'name': unicode(saved_object), "type": saved_object.get_plugin_name(), 'plugin_id': plugin_id, 'icon': force_escape(escapejs(saved_object.get_instance_icon_src())), 'alt': force_escape(escapejs(saved_object.get_instance_icon_alt())), } return render_to_response('admin/cms/page/plugin_forms_ok.html', context, RequestContext(request)) return response def move_plugin(self, request): # only allow POST if request.method != "POST": return HttpResponse(str("error")) if 'plugin_id' in request.POST: # single plugin moving plugin = CMSPlugin.objects.get(pk=int(request.POST['plugin_id'])) if 'placeholder_id' in request.POST: placeholder = Placeholder.objects.get(pk=int(request.POST['placeholder_id'])) else: placeholder = plugin.placeholder # check permissions if not placeholder.has_change_permission(request): raise Http404 # plugin positions are 0 based, so just using count here should give us 'last_position + 1' position = CMSPlugin.objects.filter(placeholder=placeholder).count() plugin.placeholder = placeholder plugin.position = position plugin.save() pos = 0 if 'ids' in request.POST: # multiple plugins/ reordering whitelisted_placeholders = [] for id in request.POST['ids'].split("_"): plugin = CMSPlugin.objects.get(pk=id) # check the permissions for *each* plugin, but cache them locally # per placeholder if plugin.placeholder.pk not in whitelisted_placeholders: if plugin.placeholder.has_change_permission(request): whitelisted_placeholders.append(plugin.placeholder.pk) else: raise Http404 # actually do the moving if plugin.position != pos: plugin.position = pos plugin.save() pos += 1 else: HttpResponse(str("error")) return HttpResponse(str("ok")) def remove_plugin(self, request): if request.method != "POST": # only allow POST raise Http404 plugin_id = request.POST['plugin_id'] plugin = get_object_or_404(CMSPlugin, pk=plugin_id) # check the permissions! if not plugin.placeholder.has_delete_permission(request): return HttpResponseForbidden(_("You don't have permission to delete a plugin")) plugin.delete_with_public() plugin_name = unicode(plugin_pool.get_plugin(plugin.plugin_type).name) comment = _(u"%(plugin_name)s plugin at position %(position)s in %(placeholder)s was deleted.") % {'plugin_name':plugin_name, 'position':plugin.position, 'placeholder':plugin.placeholder} return HttpResponse("%s,%s" % (plugin_id, comment)) def copy_plugins(self, request): # only allow POST if request.method != "POST": raise Http404 placeholder_id = request.POST['placeholder'] placeholder = get_object_or_404(Placeholder, pk=placeholder_id) # check permissions if not placeholder.has_add_permission(request): raise Http404 # the placeholder actions are responsible for copying, they should return # a list of plugins if successful. plugins = placeholder.actions.copy( target_placeholder=placeholder, source_language=request.POST['copy_from'], target_language=get_language_from_request(request), fieldname=placeholder._get_attached_field_name(), model=placeholder._get_attached_model(), ) if plugins: return render_to_response('admin/cms/page/widgets/plugin_item.html', {'plugin_list': list(plugins)}, RequestContext(request)) else: return HttpResponseBadRequest("Error during copy")
[ "evandrix@gmail.com" ]
evandrix@gmail.com
bca470acefa5e161ce2520a221ac6e2465d1d88e
deddca116d34aaeac1193334f6341dffda5bd025
/umonya/content/views.py
59d09160f668c61b1ca1bfc6e29e7c113ee06596
[]
no_license
keegancsmith/Umonya-Website
7079177fe60b9088acd42184ad496a4fb92ad6d2
5575a003dadcc66940cc22564e751051120801cf
refs/heads/master
2016-09-06T16:46:50.882232
2011-07-24T15:04:24
2011-07-24T15:04:24
2,009,325
0
0
null
null
null
null
UTF-8
Python
false
false
287
py
from annoying.decorators import render_to from umonya.content.models import Sponsor @render_to('sponsors.html') def sponsors(request): return { 'sponsors': Sponsor.objects.filter(type='Sponsor'), 'collaborators': Sponsor.objects.filter(type='Collaborator'), }
[ "keegan.csmith@gmail.com" ]
keegan.csmith@gmail.com
3fc99ccb5f274b23b2ab4a310a3b211d475f906c
3b1efdd0aacc98738f3b8b9ee09c6ff59cccc14e
/ietf/meeting/tests_views.py
c049182d7d2229baea703b4903943aff243bc0fa
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
unofficial-mirror/ietfdb
15beb6bf17b1d4abb257ee656ac6b7488339d331
ce54adb30dc7299c6eb4d42b9aa9d2c2929c1a81
refs/heads/master
2020-08-06T17:24:13.966746
2019-10-04T20:54:05
2019-10-04T20:54:05
213,088,920
0
0
null
null
null
null
UTF-8
Python
false
false
113,806
py
# Copyright The IETF Trust 2009-2019, All Rights Reserved # -*- coding: utf-8 -*- from __future__ import absolute_import, print_function, unicode_literals import datetime import io import os import random import shutil import six from unittest import skipIf from mock import patch from pyquery import PyQuery from io import StringIO, BytesIO from bs4 import BeautifulSoup from six.moves.urllib.parse import urlparse from django.urls import reverse as urlreverse from django.conf import settings from django.contrib.auth.models import User import debug # pyflakes:ignore from ietf.doc.models import Document from ietf.group.models import Group, Role from ietf.meeting.helpers import can_approve_interim_request, can_view_interim_request from ietf.meeting.helpers import send_interim_approval_request from ietf.meeting.helpers import send_interim_cancellation_notice from ietf.meeting.helpers import send_interim_minutes_reminder, populate_important_dates, update_important_dates from ietf.meeting.models import Session, TimeSlot, Meeting, SchedTimeSessAssignment, Schedule, SessionPresentation, SlideSubmission from ietf.meeting.test_data import make_meeting_test_data, make_interim_meeting from ietf.meeting.utils import finalize from ietf.name.models import SessionStatusName, ImportantDateName from ietf.utils.decorators import skip_coverage from ietf.utils.mail import outbox, empty_outbox from ietf.utils.test_utils import TestCase, login_testing_unauthorized, unicontent from ietf.utils.text import xslugify from ietf.person.factories import PersonFactory from ietf.group.factories import GroupFactory, GroupEventFactory, RoleFactory from ietf.meeting.factories import ( SessionFactory, SessionPresentationFactory, ScheduleFactory, MeetingFactory, FloorPlanFactory, TimeSlotFactory, SlideSubmissionFactory ) from ietf.doc.factories import DocumentFactory from ietf.submit.tests import submission_file if os.path.exists(settings.GHOSTSCRIPT_COMMAND): skip_pdf_tests = False skip_message = "" else: import sys skip_pdf_tests = True skip_message = ("Skipping pdf test: The binary for ghostscript wasn't found in the\n " "location indicated in settings.py.") sys.stderr.write(" "+skip_message+'\n') class MeetingTests(TestCase): def setUp(self): self.materials_dir = self.tempdir('materials') self.saved_agenda_path = settings.AGENDA_PATH settings.AGENDA_PATH = self.materials_dir def tearDown(self): settings.AGENDA_PATH = self.saved_agenda_path shutil.rmtree(self.materials_dir) def write_materials_file(self, meeting, doc, content): path = os.path.join(self.materials_dir, "%s/%s/%s" % (meeting.number, doc.type_id, doc.uploaded_filename)) dirname = os.path.dirname(path) if not os.path.exists(dirname): os.makedirs(dirname) with io.open(path, "w") as f: f.write(content) def write_materials_files(self, meeting, session): draft = Document.objects.filter(type="draft", group=session.group).first() self.write_materials_file(meeting, session.materials.get(type="agenda"), "1. WG status (15 minutes)\n\n2. Status of %s\n\n" % draft.name) self.write_materials_file(meeting, session.materials.get(type="minutes"), "1. More work items underway\n\n2. The draft will be finished before next meeting\n\n") self.write_materials_file(meeting, session.materials.filter(type="slides").exclude(states__type__slug='slides',states__slug='deleted').first(), "This is a slideshow") def test_meeting_agenda(self): meeting = make_meeting_test_data() session = Session.objects.filter(meeting=meeting, group__acronym="mars").first() slot = TimeSlot.objects.get(sessionassignments__session=session,sessionassignments__schedule=meeting.agenda) # self.write_materials_files(meeting, session) # future_year = datetime.date.today().year+1 future_num = (future_year-1984)*3 # valid for the mid-year meeting future_meeting = Meeting.objects.create(date=datetime.date(future_year, 7, 22), number=future_num, type_id='ietf', city="Panama City", country="PA", time_zone='America/Panama') # utc time_interval = "%s-%s" % (slot.utc_start_time().strftime("%H:%M").lstrip("0"), (slot.utc_start_time() + slot.duration).strftime("%H:%M").lstrip("0")) r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=meeting.number,utc='-utc'))) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) agenda_content = q("#content").html() self.assertIn(session.group.acronym, agenda_content) self.assertIn(session.group.name, agenda_content) self.assertIn(session.group.parent.acronym.upper(), agenda_content) self.assertIn(slot.location.name, agenda_content) self.assertIn(time_interval, agenda_content) # plain time_interval = "%s-%s" % (slot.time.strftime("%H:%M").lstrip("0"), (slot.time + slot.duration).strftime("%H:%M").lstrip("0")) r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=meeting.number))) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) agenda_content = q("#content").html() self.assertIn(session.group.acronym, agenda_content) self.assertIn(session.group.name, agenda_content) self.assertIn(session.group.parent.acronym.upper(), agenda_content) self.assertIn(slot.location.name, agenda_content) self.assertIn(time_interval, agenda_content) # Make sure there's a frame for the agenda and it points to the right place self.assertTrue(any([session.materials.get(type='agenda').href() in x.attrib["data-src"] for x in q('tr div.modal-body div.frame')])) # Make sure undeleted slides are present and deleted slides are not self.assertTrue(any([session.materials.filter(type='slides').exclude(states__type__slug='slides',states__slug='deleted').first().title in x.text for x in q('tr div.modal-body ul a')])) self.assertFalse(any([session.materials.filter(type='slides',states__type__slug='slides',states__slug='deleted').first().title in x.text for x in q('tr div.modal-body ul a')])) # future meeting, no agenda r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=future_meeting.number))) self.assertContains(r, "There is no agenda available yet.") self.assertTemplateUsed(r, 'meeting/no-agenda.html') # text # the rest of the results don't have as nicely formatted times time_interval = time_interval.replace(":", "") r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=meeting.number, ext=".txt"))) self.assertContains(r, session.group.acronym) self.assertContains(r, session.group.name) self.assertContains(r, session.group.parent.acronym.upper()) self.assertContains(r, slot.location.name) self.assertContains(r, time_interval) r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=meeting.number,name=meeting.unofficial_schedule.name,owner=meeting.unofficial_schedule.owner.email()))) self.assertContains(r, 'not the official schedule') # future meeting, no agenda r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=future_meeting.number, ext=".txt"))) self.assertContains(r, "There is no agenda available yet.") self.assertTemplateUsed(r, 'meeting/no-agenda.txt') # CSV r = self.client.get(urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=meeting.number, ext=".csv"))) self.assertContains(r, session.group.acronym) self.assertContains(r, session.group.name) self.assertContains(r, session.group.parent.acronym.upper()) self.assertContains(r, slot.location.name) self.assertContains(r, session.materials.get(type='agenda').uploaded_filename) self.assertContains(r, session.materials.filter(type='slides').exclude(states__type__slug='slides',states__slug='deleted').first().uploaded_filename) self.assertNotContains(r, session.materials.filter(type='slides',states__type__slug='slides',states__slug='deleted').first().uploaded_filename) # iCal r = self.client.get(urlreverse("ietf.meeting.views.ical_agenda", kwargs=dict(num=meeting.number)) + "?" + session.group.parent.acronym.upper()) self.assertContains(r, session.group.acronym) self.assertContains(r, session.group.name) self.assertContains(r, slot.location.name) self.assertContains(r, "BEGIN:VTIMEZONE") self.assertContains(r, "END:VTIMEZONE") self.assertContains(r, session.agenda().href()) self.assertContains(r, session.materials.filter(type='slides').exclude(states__type__slug='slides',states__slug='deleted').first().href()) # TODO - the ics view uses .all on a queryset in a view so it's showing the deleted slides. #self.assertNotContains(r, session.materials.filter(type='slides',states__type__slug='slides',states__slug='deleted').first().get_absolute_url()) # week view r = self.client.get(urlreverse("ietf.meeting.views.week_view", kwargs=dict(num=meeting.number))) self.assertNotContains(r, 'CANCELLED') self.assertContains(r, session.group.acronym) self.assertContains(r, slot.location.name) # week view with a cancelled session session.status_id='canceled' session.save() r = self.client.get(urlreverse("ietf.meeting.views.week_view", kwargs=dict(num=meeting.number))) self.assertContains(r, 'CANCELLED') self.assertContains(r, session.group.acronym) self.assertContains(r, slot.location.name) def test_agenda_current_audio(self): date = datetime.date.today() meeting = MeetingFactory(type_id='ietf', date=date ) make_meeting_test_data(meeting=meeting) url = urlreverse("ietf.meeting.views.agenda", kwargs=dict(num=meeting.number)) r = self.client.get(url) self.assertContains(r, "Audio stream") def test_agenda_by_room(self): meeting = make_meeting_test_data() url = urlreverse("ietf.meeting.views.agenda_by_room",kwargs=dict(num=meeting.number)) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertTrue(all([x in unicontent(r) for x in ['mars','IESG Breakfast','Test Room','Breakfast Room']])) url = urlreverse("ietf.meeting.views.agenda_by_room",kwargs=dict(num=meeting.number,name=meeting.unofficial_schedule.name,owner=meeting.unofficial_schedule.owner.email())) r = self.client.get(url) self.assertTrue(all([x in unicontent(r) for x in ['mars','Test Room',]])) self.assertNotContains(r, 'IESG Breakfast') def test_agenda_by_type(self): meeting = make_meeting_test_data() url = urlreverse("ietf.meeting.views.agenda_by_type",kwargs=dict(num=meeting.number)) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertTrue(all([x in unicontent(r) for x in ['mars','IESG Breakfast','Test Room','Breakfast Room']])) url = urlreverse("ietf.meeting.views.agenda_by_type",kwargs=dict(num=meeting.number,name=meeting.unofficial_schedule.name,owner=meeting.unofficial_schedule.owner.email())) r = self.client.get(url) self.assertTrue(all([x in unicontent(r) for x in ['mars','Test Room',]])) self.assertNotContains(r, 'IESG Breakfast') url = urlreverse("ietf.meeting.views.agenda_by_type",kwargs=dict(num=meeting.number,type='session')) r = self.client.get(url) self.assertTrue(all([x in unicontent(r) for x in ['mars','Test Room']])) self.assertFalse(any([x in unicontent(r) for x in ['IESG Breakfast','Breakfast Room']])) url = urlreverse("ietf.meeting.views.agenda_by_type",kwargs=dict(num=meeting.number,type='lead')) r = self.client.get(url) self.assertFalse(any([x in unicontent(r) for x in ['mars','Test Room']])) self.assertTrue(all([x in unicontent(r) for x in ['IESG Breakfast','Breakfast Room']])) url = urlreverse("ietf.meeting.views.agenda_by_type",kwargs=dict(num=meeting.number,type='lead',name=meeting.unofficial_schedule.name,owner=meeting.unofficial_schedule.owner.email())) r = self.client.get(url) self.assertFalse(any([x in unicontent(r) for x in ['IESG Breakfast','Breakfast Room']])) def test_agenda_room_view(self): meeting = make_meeting_test_data() url = urlreverse("ietf.meeting.views.room_view",kwargs=dict(num=meeting.number)) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code,200) self.assertTrue(all([x in unicontent(r) for x in ['mars','IESG Breakfast','Test Room','Breakfast Room']])) url = urlreverse("ietf.meeting.views.room_view",kwargs=dict(num=meeting.number,name=meeting.unofficial_schedule.name,owner=meeting.unofficial_schedule.owner.email())) r = self.client.get(url) self.assertTrue(all([x in unicontent(r) for x in ['mars','Test Room','Breakfast Room']])) self.assertNotContains(r, 'IESG Breakfast') def test_agenda_week_view(self): meeting = make_meeting_test_data() url = urlreverse("ietf.meeting.views.week_view",kwargs=dict(num=meeting.number)) + "#farfut" r = self.client.get(url) self.assertEqual(r.status_code,200) self.assertTrue(all([x in unicontent(r) for x in ['var all_items', 'maximize', 'draw_calendar', ]])) def test_materials(self): meeting = make_meeting_test_data() session = Session.objects.filter(meeting=meeting, group__acronym="mars").first() self.do_test_materials(meeting, session) def test_interim_materials(self): make_meeting_test_data() group = Group.objects.get(acronym='mars') date = datetime.datetime.today() - datetime.timedelta(days=10) meeting = make_interim_meeting(group=group, date=date, status='sched') session = meeting.session_set.first() self.do_test_materials(meeting, session) def do_test_materials(self, meeting, session): self.write_materials_files(meeting, session) # session agenda document = session.agenda() url = urlreverse("ietf.meeting.views.materials_document", kwargs=dict(num=meeting.number, document=document)) r = self.client.get(url) if r.status_code != 200: q = PyQuery(r.content) debug.show('q(".alert").text()') self.assertContains(r, "1. WG status") # session minutes url = urlreverse("ietf.meeting.views.materials_document", kwargs=dict(num=meeting.number, document=session.minutes())) r = self.client.get(url) self.assertContains(r, "1. More work items underway") # test with explicit meeting number in url if meeting.number.isdigit(): url = urlreverse("ietf.meeting.views.materials", kwargs=dict(num=meeting.number)) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) row = q('#content #%s' % str(session.group.acronym)).closest("tr") self.assertTrue(row.find('a:contains("Agenda")')) self.assertTrue(row.find('a:contains("Minutes")')) self.assertTrue(row.find('a:contains("Slideshow")')) self.assertFalse(row.find("a:contains(\"Bad Slideshow\")")) # test with no meeting number in url url = urlreverse("ietf.meeting.views.materials", kwargs=dict()) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) row = q('#content #%s' % str(session.group.acronym)).closest("tr") self.assertTrue(row.find('a:contains("Agenda")')) self.assertTrue(row.find('a:contains("Minutes")')) self.assertTrue(row.find('a:contains("Slideshow")')) self.assertFalse(row.find("a:contains(\"Bad Slideshow\")")) # test with a loggged-in wg chair self.client.login(username="marschairman", password="marschairman+password") url = urlreverse("ietf.meeting.views.materials", kwargs=dict(num=meeting.number)) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) row = q('#content #%s' % str(session.group.acronym)).closest("tr") self.assertTrue(row.find('a:contains("Agenda")')) self.assertTrue(row.find('a:contains("Minutes")')) self.assertTrue(row.find('a:contains("Slideshow")')) self.assertFalse(row.find("a:contains(\"Bad Slideshow\")")) self.assertTrue(row.find('a:contains("Edit materials")')) # FIXME: missing tests of .pdf/.tar generation (some code can # probably be lifted from similar tests in iesg/tests.py) # document-specific urls for doc in session.materials.exclude(states__slug='deleted'): url = urlreverse('ietf.meeting.views.materials_document', kwargs=dict(num=meeting.number, document=doc.name)) r = self.client.get(url) self.assertEqual(unicontent(r), doc.text()) def test_materials_editable_groups(self): meeting = make_meeting_test_data() self.client.login(username="marschairman", password="marschairman+password") r = self.client.get(urlreverse("ietf.meeting.views.materials_editable_groups", kwargs={'num':meeting.number})) self.assertContains(r, meeting.number) self.assertContains(r, "mars") self.assertNotContains(r, "No session requested") self.client.login(username="ad", password="ad+password") r = self.client.get(urlreverse("ietf.meeting.views.materials_editable_groups", kwargs={'num':meeting.number})) self.assertContains(r, meeting.number) self.assertContains(r, "frfarea") self.assertContains(r, "No session requested") self.client.login(username="plain",password="plain+password") r = self.client.get(urlreverse("ietf.meeting.views.materials_editable_groups", kwargs={'num':meeting.number})) self.assertContains(r, meeting.number) self.assertContains(r, "You cannot manage the meeting materials for any groups") def test_proceedings(self): meeting = make_meeting_test_data() session = Session.objects.filter(meeting=meeting, group__acronym="mars").first() GroupEventFactory(group=session.group,type='status_update') SessionPresentationFactory(document__type_id='recording',session=session) SessionPresentationFactory(document__type_id='recording',session=session,document__title="Audio recording for tests") self.write_materials_files(meeting, session) url = urlreverse("ietf.meeting.views.proceedings", kwargs=dict(num=meeting.number)) r = self.client.get(url) self.assertEqual(r.status_code, 200) def test_proceedings_acknowledgements(self): make_meeting_test_data() meeting = MeetingFactory(type_id='ietf', date=datetime.date(2016,7,14), number="96") meeting.acknowledgements = 'test acknowledgements' meeting.save() url = urlreverse('ietf.meeting.views.proceedings_acknowledgements',kwargs={'num':meeting.number}) response = self.client.get(url) self.assertContains(response, 'test acknowledgements') @patch('six.moves.urllib.request.urlopen') def test_proceedings_attendees(self, mock_urlopen): mock_urlopen.return_value = six.BytesIO(b'[{"LastName":"Smith","FirstName":"John","Company":"ABC","Country":"US"}]') make_meeting_test_data() meeting = MeetingFactory(type_id='ietf', date=datetime.date(2016,7,14), number="96") finalize(meeting) url = urlreverse('ietf.meeting.views.proceedings_attendees',kwargs={'num':96}) response = self.client.get(url) self.assertContains(response, 'Attendee List') q = PyQuery(response.content) self.assertEqual(1,len(q("#id_attendees tbody tr"))) @patch('six.moves.urllib.request.urlopen') def test_proceedings_overview(self, mock_urlopen): '''Test proceedings IETF Overview page. Note: old meetings aren't supported so need to add a new meeting then test. ''' mock_urlopen.return_value = six.BytesIO(b'[{"LastName":"Smith","FirstName":"John","Company":"ABC","Country":"US"}]') make_meeting_test_data() meeting = MeetingFactory(type_id='ietf', date=datetime.date(2016,7,14), number="96") finalize(meeting) url = urlreverse('ietf.meeting.views.proceedings_overview',kwargs={'num':96}) response = self.client.get(url) self.assertContains(response, 'The Internet Engineering Task Force') def test_proceedings_progress_report(self): make_meeting_test_data() MeetingFactory(type_id='ietf', date=datetime.date(2016,4,3), number="95") MeetingFactory(type_id='ietf', date=datetime.date(2016,7,14), number="96") url = urlreverse('ietf.meeting.views.proceedings_progress_report',kwargs={'num':96}) response = self.client.get(url) self.assertContains(response, 'Progress Report') def test_feed(self): meeting = make_meeting_test_data() session = Session.objects.filter(meeting=meeting, group__acronym="mars").first() r = self.client.get("/feed/wg-proceedings/") self.assertContains(r, "agenda") self.assertContains(r, session.group.acronym) def test_important_dates(self): meeting=MeetingFactory(type_id='ietf') meeting.show_important_dates = True meeting.save() populate_important_dates(meeting) url = urlreverse('ietf.meeting.views.important_dates',kwargs={'num':meeting.number}) r = self.client.get(url) self.assertContains(r, str(meeting.importantdate_set.first().date)) idn = ImportantDateName.objects.filter(used=True).first() pre_date = meeting.importantdate_set.get(name=idn).date idn.default_offset_days -= 1 idn.save() update_important_dates(meeting) post_date = meeting.importantdate_set.get(name=idn).date self.assertEqual(pre_date, post_date+datetime.timedelta(days=1)) def test_group_ical(self): meeting = make_meeting_test_data() s1 = Session.objects.filter(meeting=meeting, group__acronym="mars").first() a1 = s1.official_timeslotassignment() t1 = a1.timeslot # Create an extra session t2 = TimeSlotFactory.create(meeting=meeting, time=datetime.datetime.combine(meeting.date, datetime.time(11, 30))) s2 = SessionFactory.create(meeting=meeting, group=s1.group, add_to_schedule=False) SchedTimeSessAssignment.objects.create(timeslot=t2, session=s2, schedule=meeting.agenda) # url = urlreverse('ietf.meeting.views.ical_agenda', kwargs={'num':meeting.number, 'acronym':s1.group.acronym, }) r = self.client.get(url) self.assertEqual(r.get('Content-Type'), "text/calendar") self.assertContains(r, 'BEGIN:VEVENT') self.assertEqual(r.content.count(b'UID'), 2) self.assertContains(r, 'SUMMARY:mars - Martian Special Interest Group') self.assertContains(r, t1.time.strftime('%Y%m%dT%H%M%S')) self.assertContains(r, t2.time.strftime('%Y%m%dT%H%M%S')) self.assertContains(r, 'END:VEVENT') # url = urlreverse('ietf.meeting.views.ical_agenda', kwargs={'num':meeting.number, 'session_id':s1.id, }) r = self.client.get(url) self.assertEqual(r.get('Content-Type'), "text/calendar") self.assertContains(r, 'BEGIN:VEVENT') self.assertEqual(r.content.count(b'UID'), 1) self.assertContains(r, 'SUMMARY:mars - Martian Special Interest Group') self.assertContains(r, t1.time.strftime('%Y%m%dT%H%M%S')) self.assertNotContains(r, t2.time.strftime('%Y%m%dT%H%M%S')) self.assertContains(r, 'END:VEVENT') def test_session_draft_tarfile(self): session = SessionFactory(group__type_id='wg',meeting__type_id='ietf') doc = DocumentFactory(type_id='draft') session.sessionpresentation_set.create(document=doc) file,_ = submission_file(name=doc.name,format='txt',templatename='test_submission.txt',group=session.group,rev="00") filename = os.path.join(doc.get_file_path(),file.name) with io.open(filename,'w') as draftbits: draftbits.write(file.getvalue()) url = urlreverse('ietf.meeting.views.session_draft_tarfile', kwargs={'num':session.meeting.number,'acronym':session.group.acronym}) response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Type'), 'application/octet-stream') os.unlink(filename) @skipIf(skip_pdf_tests, skip_message) @skip_coverage def test_session_draft_pdf(self): session = SessionFactory(group__type_id='wg',meeting__type_id='ietf') doc = DocumentFactory(type_id='draft') session.sessionpresentation_set.create(document=doc) file,_ = submission_file(name=doc.name,format='txt',templatename='test_submission.txt',group=session.group,rev="00") filename = os.path.join(doc.get_file_path(),file.name) with io.open(filename,'w') as draftbits: draftbits.write(file.getvalue()) url = urlreverse('ietf.meeting.views.session_draft_pdf', kwargs={'num':session.meeting.number,'acronym':session.group.acronym}) response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Type'), 'application/pdf') os.unlink(filename) def test_current_materials(self): url = urlreverse('ietf.meeting.views.current_materials') response = self.client.get(url) self.assertEqual(response.status_code, 404) MeetingFactory(type_id='ietf', date=datetime.date.today()) response = self.client.get(url) self.assertEqual(response.status_code, 302) def test_edit_agenda_properties(self): self.client.login(username='secretary',password='secretary+password') url = urlreverse('ietf.meeting.views.edit_agenda_properties',kwargs={'owner':'does@notexist.example','name':'doesnotexist','num':00}) response = self.client.get(url) self.assertEqual(response.status_code,404) self.client.logout() schedule = ScheduleFactory(meeting__type_id='ietf',visible=False,public=False) url = urlreverse('ietf.meeting.views.edit_agenda_properties',kwargs={'owner':schedule.owner.email(),'name':schedule.name,'num':schedule.meeting.number}) response = self.client.get(url) self.assertEqual(response.status_code,302) self.client.login(username='secretary',password='secretary+password') response = self.client.get(url) self.assertEqual(response.status_code,200) response = self.client.post(url, { 'name':schedule.name, 'visible':True, 'public':True, } ) self.assertEqual(response.status_code,302) schedule = Schedule.objects.get(pk=schedule.pk) self.assertTrue(schedule.visible) self.assertTrue(schedule.public) def test_agenda_by_type_ics(self): session=SessionFactory(meeting__type_id='ietf',type_id='lead') url = urlreverse('ietf.meeting.views.agenda_by_type_ics',kwargs={'num':session.meeting.number,'type':'lead'}) login_testing_unauthorized(self,"secretary",url) response = self.client.get(url) self.assertEqual(response.status_code,200) self.assertEqual(response.get('Content-Type'), 'text/calendar') def test_edit_slide_order(self): session=SessionFactory(meeting__type_id='iestf',type_id='session') slides = DocumentFactory(type_id='slides') session.sessionpresentation_set.create(document=slides,order=0) url = urlreverse('ietf.meeting.views.set_slide_order',kwargs={'session_id':session.id,'num':session.meeting.number,'name':slides.name}) response = self.client.put(url,{'order':2}) self.assertEqual(response.status_code, 403) self.client.login(username='secretary', password='secretary+password') response = self.client.post(url,{'order':'2'}) self.assertEqual(response.status_code, 200) self.assertEqual(response.get('Content-Type'), 'application/json') self.assertEqual(session.sessionpresentation_set.first().order,2) class EditTests(TestCase): def setUp(self): # make sure we have the colors of the area from ietf.group.colors import fg_group_colors, bg_group_colors area_upper = "FARFUT" fg_group_colors[area_upper] = "#333" bg_group_colors[area_upper] = "#aaa" def test_edit_agenda(self): meeting = make_meeting_test_data() self.client.login(username="secretary", password="secretary+password") r = self.client.get(urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number))) self.assertContains(r, "load_assignments") def test_save_agenda_as_and_read_permissions(self): meeting = make_meeting_test_data() # try to get non-existing agenda url = urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number, owner=meeting.agenda.owner_email(), name="foo")) r = self.client.get(url) self.assertEqual(r.status_code, 404) # save as new name (requires valid existing agenda) url = urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number, owner=meeting.agenda.owner_email(), name=meeting.agenda.name)) self.client.login(username="ad", password="ad+password") r = self.client.post(url, { 'savename': "foo", 'saveas': "saveas", }) self.assertEqual(r.status_code, 302) # Verify that we actually got redirected to a new place. self.assertNotEqual(urlparse(r.url).path, url) # get schedule = meeting.get_schedule_by_name("foo") url = urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number, owner=schedule.owner_email(), name="foo")) r = self.client.get(url) self.assertEqual(r.status_code, 200) schedule.visible = True schedule.public = False schedule.save() # get as anonymous doesn't work self.client.logout() r = self.client.get(url) self.assertEqual(r.status_code, 403) # public, now anonymous works schedule.public = True schedule.save() r = self.client.get(url) self.assertEqual(r.status_code, 200) # Secretariat can always see it schedule.visible = False schedule.public = False schedule.save() self.client.login(username="secretary", password="secretary+password") r = self.client.get(url) self.assertEqual(r.status_code, 200) def test_save_agenda_broken_names(self): meeting = make_meeting_test_data() # save as new name (requires valid existing agenda) url = urlreverse("ietf.meeting.views.edit_agenda", kwargs=dict(num=meeting.number, owner=meeting.agenda.owner_email(), name=meeting.agenda.name)) self.client.login(username="ad", password="ad+password") r = self.client.post(url, { 'savename': "/no/this/should/not/work/it/is/too/long", 'saveas': "saveas", }) self.assertEqual(r.status_code, 302) self.assertEqual(urlparse(r.url).path, url) # TODO: Verify that an error message was in fact returned. r = self.client.post(url, { 'savename': "/invalid/chars/", 'saveas': "saveas", }) # TODO: Verify that an error message was in fact returned. self.assertEqual(r.status_code, 302) self.assertEqual(urlparse(r.url).path, url) # Non-ASCII alphanumeric characters r = self.client.post(url, { 'savename': "f\u00E9ling", 'saveas': "saveas", }) # TODO: Verify that an error message was in fact returned. self.assertEqual(r.status_code, 302) self.assertEqual(urlparse(r.url).path, url) def test_edit_timeslots(self): meeting = make_meeting_test_data() self.client.login(username="secretary", password="secretary+password") r = self.client.get(urlreverse("ietf.meeting.views.edit_timeslots", kwargs=dict(num=meeting.number))) self.assertContains(r, meeting.room_set.all().first().name) def test_edit_timeslot_type(self): timeslot = TimeSlotFactory(meeting__type_id='ietf') url = urlreverse('ietf.meeting.views.edit_timeslot_type', kwargs=dict(num=timeslot.meeting.number,slot_id=timeslot.id)) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) r = self.client.post(url,{'type':'other',}) self.assertEqual(r.status_code, 302) timeslot = TimeSlot.objects.get(id=timeslot.id) self.assertEqual(timeslot.type.slug,'other') def test_slot_to_the_right(self): meeting = make_meeting_test_data() session = Session.objects.filter(meeting=meeting, group__acronym="mars").first() mars_scheduled = session.timeslotassignments.get(schedule__name='test-agenda') mars_slot = TimeSlot.objects.get(sessionassignments__session=session,sessionassignments__schedule__name='test-agenda') mars_ends = mars_slot.time + mars_slot.duration session = Session.objects.filter(meeting=meeting, group__acronym="ames").first() ames_slot_qs = TimeSlot.objects.filter(sessionassignments__session=session,sessionassignments__schedule__name='test-agenda') ames_slot_qs.update(time=mars_ends + datetime.timedelta(seconds=11 * 60)) self.assertTrue(not mars_slot.slot_to_the_right) self.assertTrue(not mars_scheduled.slot_to_the_right) ames_slot_qs.update(time=mars_ends + datetime.timedelta(seconds=10 * 60)) self.assertTrue(mars_slot.slot_to_the_right) self.assertTrue(mars_scheduled.slot_to_the_right) class SessionDetailsTests(TestCase): def test_session_details(self): group = GroupFactory.create(type_id='wg',state_id='active') session = SessionFactory.create(meeting__type_id='ietf',group=group, meeting__date=datetime.date.today()+datetime.timedelta(days=90)) SessionPresentationFactory.create(session=session,document__type_id='draft',rev=None) SessionPresentationFactory.create(session=session,document__type_id='minutes') SessionPresentationFactory.create(session=session,document__type_id='slides') SessionPresentationFactory.create(session=session,document__type_id='agenda') url = urlreverse('ietf.meeting.views.session_details', kwargs=dict(num=session.meeting.number, acronym=group.acronym)) r = self.client.get(url) self.assertTrue(all([x in unicontent(r) for x in ('slides','agenda','minutes','draft')])) self.assertNotContains(r, 'deleted') def test_add_session_drafts(self): group = GroupFactory.create(type_id='wg',state_id='active') group_chair = PersonFactory.create() group.role_set.create(name_id='chair',person = group_chair, email = group_chair.email()) session = SessionFactory.create(meeting__type_id='ietf',group=group, meeting__date=datetime.date.today()+datetime.timedelta(days=90)) SessionPresentationFactory.create(session=session,document__type_id='draft',rev=None) old_draft = session.sessionpresentation_set.filter(document__type='draft').first().document new_draft = DocumentFactory(type_id='draft') url = urlreverse('ietf.meeting.views.add_session_drafts', kwargs=dict(num=session.meeting.number, session_id=session.pk)) r = self.client.get(url) self.assertEqual(r.status_code, 404) self.client.login(username="plain",password="plain+password") r = self.client.get(url) self.assertEqual(r.status_code, 404) self.client.login(username=group_chair.user.username, password='%s+password'%group_chair.user.username) r = self.client.get(url) self.assertContains(r, old_draft.name) r = self.client.post(url,dict(drafts=[new_draft.pk, old_draft.pk])) self.assertTrue(r.status_code, 200) q = PyQuery(r.content) self.assertIn("Already linked:", q('form .alert-danger').text()) self.assertEqual(1,session.sessionpresentation_set.count()) r = self.client.post(url,dict(drafts=[new_draft.pk,])) self.assertTrue(r.status_code, 302) self.assertEqual(2,session.sessionpresentation_set.count()) session.meeting.date -= datetime.timedelta(days=180) session.meeting.save() r = self.client.get(url) self.assertEqual(r.status_code,404) self.client.login(username='secretary',password='secretary+password') r = self.client.get(url) self.assertEqual(r.status_code,200) q = PyQuery(r.content) self.assertEqual(1,len(q(".alert-warning:contains('may affect published proceedings')"))) class EditScheduleListTests(TestCase): def setUp(self): self.mtg = MeetingFactory(type_id='ietf') ScheduleFactory(meeting=self.mtg,name='Empty-Schedule') def test_list_agendas(self): url = urlreverse('ietf.meeting.views.list_agendas',kwargs={'num':self.mtg.number}) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertTrue(r.status_code, 200) def test_delete_schedule(self): url = urlreverse('ietf.meeting.views.delete_schedule', kwargs={'num':self.mtg.number, 'owner':self.mtg.agenda.owner.email_address(), 'name':self.mtg.agenda.name, }) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertTrue(r.status_code, 403) r = self.client.post(url,{'save':1}) self.assertTrue(r.status_code, 403) self.assertEqual(self.mtg.schedule_set.count(),2) self.mtg.agenda=None self.mtg.save() r = self.client.get(url) self.assertTrue(r.status_code, 200) r = self.client.post(url,{'save':1}) self.assertTrue(r.status_code, 302) self.assertEqual(self.mtg.schedule_set.count(),1) def test_make_schedule_official(self): schedule = self.mtg.schedule_set.exclude(id=self.mtg.agenda.id).first() url = urlreverse('ietf.meeting.views.make_schedule_official', kwargs={'num':self.mtg.number, 'owner':schedule.owner.email_address(), 'name':schedule.name, }) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertTrue(r.status_code, 200) r = self.client.post(url,{'save':1}) self.assertTrue(r.status_code, 302) mtg = Meeting.objects.get(number=self.mtg.number) self.assertEqual(mtg.agenda,schedule) # ------------------------------------------------- # Interim Meeting Tests # ------------------------------------------------- class InterimTests(TestCase): def setUp(self): self.materials_dir = self.tempdir('materials') self.saved_agenda_path = settings.AGENDA_PATH settings.AGENDA_PATH = self.materials_dir def tearDown(self): settings.AGENDA_PATH = self.saved_agenda_path shutil.rmtree(self.materials_dir) def check_interim_tabs(self, url): '''Helper function to check interim meeting list tabs''' # no logged in - no tabs r = self.client.get(url) q = PyQuery(r.content) self.assertEqual(len(q("ul.nav-tabs")), 0) # plain user - no tabs username = "plain" self.client.login(username=username, password=username + "+password") r = self.client.get(url) q = PyQuery(r.content) self.assertEqual(len(q("ul.nav-tabs")), 0) self.client.logout() # privileged user username = "ad" self.client.login(username=username, password=username + "+password") r = self.client.get(url) q = PyQuery(r.content) self.assertEqual(len(q("a:contains('Pending')")), 1) self.assertEqual(len(q("a:contains('Announce')")), 0) self.client.logout() # secretariat username = "secretary" self.client.login(username=username, password=username + "+password") r = self.client.get(url) q = PyQuery(r.content) self.assertEqual(len(q("a:contains('Pending')")), 1) self.assertEqual(len(q("a:contains('Announce')")), 1) self.client.logout() def test_interim_announce(self): make_meeting_test_data() url = urlreverse("ietf.meeting.views.interim_announce") meeting = Meeting.objects.filter(type='interim', session__group__acronym='mars').first() session = meeting.session_set.first() session.status = SessionStatusName.objects.get(slug='scheda') session.save() login_testing_unauthorized(self, "secretary", url) r = self.client.get(url) self.assertContains(r, meeting.number) def test_interim_skip_announcement(self): make_meeting_test_data() group = Group.objects.get(acronym='irg') date = datetime.date.today() + datetime.timedelta(days=30) meeting = make_interim_meeting(group=group, date=date, status='scheda') url = urlreverse("ietf.meeting.views.interim_skip_announcement", kwargs={'number': meeting.number}) login_testing_unauthorized(self, "secretary", url) r = self.client.get(url) self.assertEqual(r.status_code, 200) # check post len_before = len(outbox) r = self.client.post(url) self.assertRedirects(r, urlreverse('ietf.meeting.views.interim_announce')) self.assertEqual(meeting.session_set.first().status.slug,'sched') self.assertEqual(len(outbox), len_before) def test_interim_send_announcement(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim', session__status='apprw', session__group__acronym='mars').first() url = urlreverse("ietf.meeting.views.interim_send_announcement", kwargs={'number': meeting.number}) login_testing_unauthorized(self, "secretary", url) r = self.client.get(url) self.assertEqual(r.status_code, 200) initial = r.context['form'].initial # send announcement len_before = len(outbox) r = self.client.post(url, initial) self.assertRedirects(r, urlreverse('ietf.meeting.views.interim_announce')) self.assertEqual(len(outbox), len_before + 1) self.assertIn('WG Virtual Meeting', outbox[-1]['Subject']) def test_interim_approve_by_ad(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim', session__status='apprw', session__group__acronym='mars').first() url = urlreverse('ietf.meeting.views.interim_request_details', kwargs={'number': meeting.number}) length_before = len(outbox) login_testing_unauthorized(self, "ad", url) r = self.client.post(url, {'approve': 'approve'}) self.assertRedirects(r, urlreverse('ietf.meeting.views.interim_pending')) for session in meeting.session_set.all(): self.assertEqual(session.status.slug, 'scheda') self.assertEqual(len(outbox), length_before + 1) self.assertIn('ready for announcement', outbox[-1]['Subject']) def test_interim_approve_by_secretariat(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim', session__status='apprw', session__group__acronym='mars').first() url = urlreverse('ietf.meeting.views.interim_request_details', kwargs={'number': meeting.number}) login_testing_unauthorized(self, "secretary", url) r = self.client.post(url, {'approve': 'approve'}) self.assertRedirects(r, urlreverse('ietf.meeting.views.interim_send_announcement', kwargs={'number': meeting.number})) for session in meeting.session_set.all(): self.assertEqual(session.status.slug, 'scheda') def test_past(self): today = datetime.date.today() last_week = today - datetime.timedelta(days=7) ietf = SessionFactory(meeting__type_id='ietf',meeting__date=last_week,group__state_id='active',group__parent=GroupFactory(state_id='active')) interim = SessionFactory(meeting__type_id='interim',meeting__date=last_week,status_id='canceled',group__state_id='active',group__parent=GroupFactory(state_id='active')) url = urlreverse('ietf.meeting.views.past') r = self.client.get(url) self.assertContains(r, 'IETF - %02d'%int(ietf.meeting.number)) q = PyQuery(r.content) id="-%s" % interim.group.acronym self.assertIn('CANCELLED', q('[id*="'+id+'"]').text()) def test_upcoming(self): make_meeting_test_data() url = urlreverse("ietf.meeting.views.upcoming") today = datetime.date.today() mars_interim = Meeting.objects.filter(date__gt=today, type='interim', session__group__acronym='mars', session__status='sched').first() ames_interim = Meeting.objects.filter(date__gt=today, type='interim', session__group__acronym='ames', session__status='canceled').first() r = self.client.get(url) self.assertContains(r, mars_interim.number) self.assertContains(r, ames_interim.number) self.assertContains(r, 'IETF - 72') # cancelled session q = PyQuery(r.content) self.assertIn('CANCELLED', q('[id*="-ames"]').text()) self.check_interim_tabs(url) def test_upcoming_ical(self): make_meeting_test_data() url = urlreverse("ietf.meeting.views.upcoming_ical") r = self.client.get(url) self.assertEqual(r.status_code, 200) self.assertEqual(r.get('Content-Type'), "text/calendar") self.assertEqual(r.content.count(b'UID'), 7) # check filtered output url = url + '?filters=mars' r = self.client.get(url) self.assertEqual(r.status_code, 200) self.assertEqual(r.get('Content-Type'), "text/calendar") # print r.content self.assertEqual(r.content.count(b'UID'), 2) def test_interim_request_permissions(self): '''Ensure only authorized users see link to request interim meeting''' make_meeting_test_data() # test unauthorized not logged in upcoming_url = urlreverse("ietf.meeting.views.upcoming") request_url = urlreverse("ietf.meeting.views.interim_request") r = self.client.get(upcoming_url) self.assertNotContains(r,'Request new interim meeting') # test unauthorized user login_testing_unauthorized(self,"plain",request_url) r = self.client.get(upcoming_url) self.assertNotContains(r,'Request new interim meeting') r = self.client.get(request_url) self.assertEqual(r.status_code, 403) self.client.logout() # test authorized for username in ('secretary','ad','marschairman','irtf-chair','irgchairman'): self.client.login(username=username, password= username + "+password") r = self.client.get(upcoming_url) self.assertContains(r,'Request new interim meeting') r = self.client.get(request_url) self.assertEqual(r.status_code, 200) self.client.logout() def test_interim_request_options(self): make_meeting_test_data() # secretariat can request for any group self.client.login(username="secretary", password="secretary+password") r = self.client.get("/meeting/interim/request/") self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertEqual(Group.objects.filter(type__in=('wg', 'rg'), state__in=('active', 'proposed')).count(), len(q("#id_group option")) - 1) # -1 for options placeholder self.client.logout() # wg chair self.client.login(username="marschairman", password="marschairman+password") r = self.client.get("/meeting/interim/request/") self.assertEqual(r.status_code, 200) q = PyQuery(r.content) user = User.objects.get(username='marschairman') person = user.person count = person.role_set.filter(name='chair',group__type__in=('wg', 'rg'), group__state__in=('active', 'proposed')).count() self.assertEqual(count, len(q("#id_group option")) - 1) # -1 for options placeholder # wg AND rg chair group = Group.objects.get(acronym='irg') Role.objects.create(name_id='chair',group=group,person=person,email=person.email()) r = self.client.get("/meeting/interim/request/") self.assertEqual(r.status_code, 200) q = PyQuery(r.content) count = person.role_set.filter(name='chair',group__type__in=('wg', 'rg'), group__state__in=('active', 'proposed')).count() self.assertEqual(count, len(q("#id_group option")) - 1) # -1 for options placeholder def test_interim_request_single_virtual(self): make_meeting_test_data() group = Group.objects.get(acronym='mars') date = datetime.date.today() + datetime.timedelta(days=30) time = datetime.datetime.now().time().replace(microsecond=0,second=0) dt = datetime.datetime.combine(date, time) duration = datetime.timedelta(hours=3) remote_instructions = 'Use webex' agenda = 'Intro. Slides. Discuss.' agenda_note = 'On second level' length_before = len(outbox) meeting_count = Meeting.objects.filter(number__contains='-%s-'%group.acronym, date__year=date.year).count() next_num = "%02d" % (meeting_count+1) self.client.login(username="marschairman", password="marschairman+password") data = {'group':group.pk, 'meeting_type':'single', 'city':'', 'country':'', 'time_zone':'UTC', 'session_set-0-date':date.strftime("%Y-%m-%d"), 'session_set-0-time':time.strftime('%H:%M'), 'session_set-0-requested_duration':'03:00:00', 'session_set-0-remote_instructions':remote_instructions, 'session_set-0-agenda':agenda, 'session_set-0-agenda_note':agenda_note, 'session_set-TOTAL_FORMS':1, 'session_set-INITIAL_FORMS':0, 'session_set-MIN_NUM_FORMS':0, 'session_set-MAX_NUM_FORMS':1000} r = self.client.post(urlreverse("ietf.meeting.views.interim_request"),data) self.assertRedirects(r,urlreverse('ietf.meeting.views.upcoming')) meeting = Meeting.objects.order_by('id').last() self.assertEqual(meeting.type_id,'interim') self.assertEqual(meeting.date,date) self.assertEqual(meeting.number,'interim-%s-%s-%s' % (date.year, group.acronym, next_num)) self.assertEqual(meeting.city,'') self.assertEqual(meeting.country,'') self.assertEqual(meeting.time_zone,'UTC') session = meeting.session_set.first() self.assertEqual(session.remote_instructions,remote_instructions) self.assertEqual(session.agenda_note,agenda_note) self.assertEqual(session.status.slug,'scheda') timeslot = session.official_timeslotassignment().timeslot self.assertEqual(timeslot.time,dt) self.assertEqual(timeslot.duration,duration) # ensure agenda document was created self.assertEqual(session.materials.count(),1) doc = session.materials.first() path = os.path.join(doc.get_file_path(),doc.filename_with_rev()) self.assertTrue(os.path.exists(path)) # check notice to secretariat self.assertEqual(len(outbox), length_before + 1) self.assertIn('interim meeting ready for announcement', outbox[-1]['Subject']) self.assertIn('iesg-secretary@ietf.org', outbox[-1]['To']) def test_interim_request_single_in_person(self): make_meeting_test_data() group = Group.objects.get(acronym='mars') date = datetime.date.today() + datetime.timedelta(days=30) time = datetime.datetime.now().time().replace(microsecond=0,second=0) dt = datetime.datetime.combine(date, time) duration = datetime.timedelta(hours=3) city = 'San Francisco' country = 'US' time_zone = 'America/Los_Angeles' remote_instructions = 'Use webex' agenda = 'Intro. Slides. Discuss.' agenda_note = 'On second level' meeting_count = Meeting.objects.filter(number__contains='-%s-'%group.acronym, date__year=date.year).count() next_num = "%02d" % (meeting_count+1) self.client.login(username="secretary", password="secretary+password") data = {'group':group.pk, 'meeting_type':'single', 'city':city, 'country':country, 'time_zone':time_zone, 'session_set-0-date':date.strftime("%Y-%m-%d"), 'session_set-0-time':time.strftime('%H:%M'), 'session_set-0-requested_duration':'03:00:00', 'session_set-0-remote_instructions':remote_instructions, 'session_set-0-agenda':agenda, 'session_set-0-agenda_note':agenda_note, 'session_set-TOTAL_FORMS':1, 'session_set-INITIAL_FORMS':0} r = self.client.post(urlreverse("ietf.meeting.views.interim_request"),data) self.assertRedirects(r,urlreverse('ietf.meeting.views.upcoming')) meeting = Meeting.objects.order_by('id').last() self.assertEqual(meeting.type_id,'interim') self.assertEqual(meeting.date,date) self.assertEqual(meeting.number,'interim-%s-%s-%s' % (date.year, group.acronym, next_num)) self.assertEqual(meeting.city,city) self.assertEqual(meeting.country,country) self.assertEqual(meeting.time_zone,time_zone) session = meeting.session_set.first() self.assertEqual(session.remote_instructions,remote_instructions) self.assertEqual(session.agenda_note,agenda_note) timeslot = session.official_timeslotassignment().timeslot self.assertEqual(timeslot.time,dt) self.assertEqual(timeslot.duration,duration) def test_interim_request_multi_day(self): make_meeting_test_data() date = datetime.date.today() + datetime.timedelta(days=30) date2 = date + datetime.timedelta(days=1) time = datetime.datetime.now().time().replace(microsecond=0,second=0) dt = datetime.datetime.combine(date, time) dt2 = datetime.datetime.combine(date2, time) duration = datetime.timedelta(hours=3) group = Group.objects.get(acronym='mars') city = 'San Francisco' country = 'US' time_zone = 'America/Los_Angeles' remote_instructions = 'Use webex' agenda = 'Intro. Slides. Discuss.' agenda_note = 'On second level' meeting_count = Meeting.objects.filter(number__contains='-%s-'%group.acronym, date__year=date.year).count() next_num = "%02d" % (meeting_count+1) self.client.login(username="secretary", password="secretary+password") data = {'group':group.pk, 'meeting_type':'multi-day', 'city':city, 'country':country, 'time_zone':time_zone, 'session_set-0-date':date.strftime("%Y-%m-%d"), 'session_set-0-time':time.strftime('%H:%M'), 'session_set-0-requested_duration':'03:00:00', 'session_set-0-remote_instructions':remote_instructions, 'session_set-0-agenda':agenda, 'session_set-0-agenda_note':agenda_note, 'session_set-1-date':date2.strftime("%Y-%m-%d"), 'session_set-1-time':time.strftime('%H:%M'), 'session_set-1-requested_duration':'03:00:00', 'session_set-1-remote_instructions':remote_instructions, 'session_set-1-agenda':agenda, 'session_set-1-agenda_note':agenda_note, 'session_set-TOTAL_FORMS':2, 'session_set-INITIAL_FORMS':0} r = self.client.post(urlreverse("ietf.meeting.views.interim_request"),data) self.assertRedirects(r,urlreverse('ietf.meeting.views.upcoming')) meeting = Meeting.objects.order_by('id').last() self.assertEqual(meeting.type_id,'interim') self.assertEqual(meeting.date,date) self.assertEqual(meeting.number,'interim-%s-%s-%s' % (date.year, group.acronym, next_num)) self.assertEqual(meeting.city,city) self.assertEqual(meeting.country,country) self.assertEqual(meeting.time_zone,time_zone) self.assertEqual(meeting.session_set.count(),2) # first sesstion session = meeting.session_set.all()[0] self.assertEqual(session.remote_instructions,remote_instructions) timeslot = session.official_timeslotassignment().timeslot self.assertEqual(timeslot.time,dt) self.assertEqual(timeslot.duration,duration) self.assertEqual(session.agenda_note,agenda_note) # second sesstion session = meeting.session_set.all()[1] self.assertEqual(session.remote_instructions,remote_instructions) timeslot = session.official_timeslotassignment().timeslot self.assertEqual(timeslot.time,dt2) self.assertEqual(timeslot.duration,duration) self.assertEqual(session.agenda_note,agenda_note) def test_interim_request_multi_day_non_consecutive(self): make_meeting_test_data() date = datetime.date.today() + datetime.timedelta(days=30) date2 = date + datetime.timedelta(days=2) time = datetime.datetime.now().time().replace(microsecond=0,second=0) group = Group.objects.get(acronym='mars') city = 'San Francisco' country = 'US' time_zone = 'America/Los_Angeles' remote_instructions = 'Use webex' agenda = 'Intro. Slides. Discuss.' agenda_note = 'On second level' self.client.login(username="secretary", password="secretary+password") data = {'group':group.pk, 'meeting_type':'multi-day', 'city':city, 'country':country, 'time_zone':time_zone, 'session_set-0-date':date.strftime("%Y-%m-%d"), 'session_set-0-time':time.strftime('%H:%M'), 'session_set-0-requested_duration':'03:00:00', 'session_set-0-remote_instructions':remote_instructions, 'session_set-0-agenda':agenda, 'session_set-0-agenda_note':agenda_note, 'session_set-1-date':date2.strftime("%Y-%m-%d"), 'session_set-1-time':time.strftime('%H:%M'), 'session_set-1-requested_duration':'03:00:00', 'session_set-1-remote_instructions':remote_instructions, 'session_set-1-agenda':agenda, 'session_set-1-agenda_note':agenda_note, 'session_set-TOTAL_FORMS':2, 'session_set-INITIAL_FORMS':0} r = self.client.post(urlreverse("ietf.meeting.views.interim_request"),data) self.assertContains(r, 'days must be consecutive') def test_interim_request_series(self): make_meeting_test_data() meeting_count_before = Meeting.objects.filter(type='interim').count() date = datetime.date.today() + datetime.timedelta(days=30) date2 = date + datetime.timedelta(days=1) time = datetime.datetime.now().time().replace(microsecond=0,second=0) dt = datetime.datetime.combine(date, time) dt2 = datetime.datetime.combine(date2, time) duration = datetime.timedelta(hours=3) group = Group.objects.get(acronym='mars') city = '' country = '' time_zone = 'America/Los_Angeles' remote_instructions = 'Use webex' agenda = 'Intro. Slides. Discuss.' agenda_note = 'On second level' meeting_count = Meeting.objects.filter(number__contains='-%s-'%group.acronym, date__year=date.year).count() next_num = "%02d" % (meeting_count+1) next_num2 = "%02d" % (meeting_count+2) self.client.login(username="secretary", password="secretary+password") r = self.client.get(urlreverse("ietf.meeting.views.interim_request")) self.assertEqual(r.status_code, 200) data = {'group':group.pk, 'meeting_type':'series', 'city':city, 'country':country, 'time_zone':time_zone, 'session_set-0-date':date.strftime("%Y-%m-%d"), 'session_set-0-time':time.strftime('%H:%M'), 'session_set-0-requested_duration':'03:00:00', 'session_set-0-remote_instructions':remote_instructions, 'session_set-0-agenda':agenda, 'session_set-0-agenda_note':agenda_note, 'session_set-1-date':date2.strftime("%Y-%m-%d"), 'session_set-1-time':time.strftime('%H:%M'), 'session_set-1-requested_duration':'03:00:00', 'session_set-1-remote_instructions':remote_instructions, 'session_set-1-agenda':agenda, 'session_set-1-agenda_note':agenda_note, 'session_set-TOTAL_FORMS':2, 'session_set-INITIAL_FORMS':0} r = self.client.post(urlreverse("ietf.meeting.views.interim_request"),data) self.assertRedirects(r,urlreverse('ietf.meeting.views.upcoming')) meeting_count_after = Meeting.objects.filter(type='interim').count() self.assertEqual(meeting_count_after,meeting_count_before + 2) meetings = Meeting.objects.order_by('-id')[:2] # first meeting meeting = meetings[1] self.assertEqual(meeting.type_id,'interim') self.assertEqual(meeting.date,date) self.assertEqual(meeting.number,'interim-%s-%s-%s' % (date.year, group.acronym, next_num)) self.assertEqual(meeting.city,city) self.assertEqual(meeting.country,country) self.assertEqual(meeting.time_zone,time_zone) self.assertEqual(meeting.session_set.count(),1) session = meeting.session_set.first() self.assertEqual(session.remote_instructions,remote_instructions) timeslot = session.official_timeslotassignment().timeslot self.assertEqual(timeslot.time,dt) self.assertEqual(timeslot.duration,duration) self.assertEqual(session.agenda_note,agenda_note) # second meeting meeting = meetings[0] self.assertEqual(meeting.type_id,'interim') self.assertEqual(meeting.date,date2) self.assertEqual(meeting.number,'interim-%s-%s-%s' % (date2.year, group.acronym, next_num2)) self.assertEqual(meeting.city,city) self.assertEqual(meeting.country,country) self.assertEqual(meeting.time_zone,time_zone) self.assertEqual(meeting.session_set.count(),1) session = meeting.session_set.first() self.assertEqual(session.remote_instructions,remote_instructions) timeslot = session.official_timeslotassignment().timeslot self.assertEqual(timeslot.time,dt2) self.assertEqual(timeslot.duration,duration) self.assertEqual(session.agenda_note,agenda_note) def test_interim_pending(self): make_meeting_test_data() url = urlreverse('ietf.meeting.views.interim_pending') count = Meeting.objects.filter(type='interim',session__status='apprw').distinct().count() # unpriviledged user login_testing_unauthorized(self,"plain",url) r = self.client.get(url) self.assertEqual(r.status_code, 403) # secretariat login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertEqual(len(q("#pending-interim-meetings-table tr"))-1, count) self.client.logout() def test_can_approve_interim_request(self): make_meeting_test_data() # unprivileged user user = User.objects.get(username='plain') group = Group.objects.get(acronym='mars') meeting = Meeting.objects.filter(type='interim',session__status='apprw',session__group=group).first() self.assertFalse(can_approve_interim_request(meeting=meeting,user=user)) # Secretariat user = User.objects.get(username='secretary') self.assertTrue(can_approve_interim_request(meeting=meeting,user=user)) # related AD user = User.objects.get(username='ad') self.assertTrue(can_approve_interim_request(meeting=meeting,user=user)) # other AD user = User.objects.get(username='ops-ad') self.assertFalse(can_approve_interim_request(meeting=meeting,user=user)) # WG Chair user = User.objects.get(username='marschairman') self.assertFalse(can_approve_interim_request(meeting=meeting,user=user)) def test_can_view_interim_request(self): make_meeting_test_data() # unprivileged user user = User.objects.get(username='plain') group = Group.objects.get(acronym='mars') meeting = Meeting.objects.filter(type='interim',session__status='apprw',session__group=group).first() self.assertFalse(can_view_interim_request(meeting=meeting,user=user)) # Secretariat user = User.objects.get(username='secretary') self.assertTrue(can_view_interim_request(meeting=meeting,user=user)) # related AD user = User.objects.get(username='ad') self.assertTrue(can_view_interim_request(meeting=meeting,user=user)) # other AD user = User.objects.get(username='ops-ad') self.assertTrue(can_view_interim_request(meeting=meeting,user=user)) # WG Chair user = User.objects.get(username='marschairman') self.assertTrue(can_view_interim_request(meeting=meeting,user=user)) # Other WG Chair user = User.objects.get(username='ameschairman') self.assertFalse(can_view_interim_request(meeting=meeting,user=user)) def test_interim_request_details(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim',session__status='apprw',session__group__acronym='mars').first() url = urlreverse('ietf.meeting.views.interim_request_details',kwargs={'number':meeting.number}) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) def test_interim_request_details_announcement(self): '''Test access to Announce / Skip Announce features''' make_meeting_test_data() date = datetime.date.today() + datetime.timedelta(days=30) group = Group.objects.get(acronym='mars') meeting = make_interim_meeting(group=group, date=date, status='scheda') url = urlreverse('ietf.meeting.views.interim_request_details',kwargs={'number':meeting.number}) # Chair, no access self.client.login(username="marschairman", password="marschairman+password") r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertEqual(len(q("a.btn:contains('Announce')")),0) # Secretariat has access self.client.login(username="secretary", password="secretary+password") r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertEqual(len(q("a.btn:contains('Announce')")),2) def test_interim_request_disapprove(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim',session__status='apprw',session__group__acronym='mars').first() url = urlreverse('ietf.meeting.views.interim_request_details',kwargs={'number':meeting.number}) login_testing_unauthorized(self,"secretary",url) r = self.client.post(url,{'disapprove':'Disapprove'}) self.assertRedirects(r, urlreverse('ietf.meeting.views.interim_pending')) for session in meeting.session_set.all(): self.assertEqual(session.status_id,'disappr') def test_interim_request_cancel(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim', session__status='apprw', session__group__acronym='mars').first() url = urlreverse('ietf.meeting.views.interim_request_details', kwargs={'number': meeting.number}) # ensure no cancel button for unauthorized user self.client.login(username="ameschairman", password="ameschairman+password") r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertEqual(len(q("a.btn:contains('Cancel')")), 0) # ensure cancel button for authorized user self.client.login(username="marschairman", password="marschairman+password") r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertEqual(len(q("a.btn:contains('Cancel')")), 1) # ensure fail unauthorized url = urlreverse('ietf.meeting.views.interim_request_cancel', kwargs={'number': meeting.number}) comments = 'Bob cannot make it' self.client.login(username="ameschairman", password="ameschairman+password") r = self.client.post(url, {'comments': comments}) self.assertEqual(r.status_code, 403) # test cancelling before announcement self.client.login(username="marschairman", password="marschairman+password") length_before = len(outbox) r = self.client.post(url, {'comments': comments}) self.assertRedirects(r, urlreverse('ietf.meeting.views.upcoming')) for session in meeting.session_set.all(): self.assertEqual(session.status_id, 'canceledpa') self.assertEqual(session.agenda_note, comments) self.assertEqual(len(outbox), length_before) # no email notice # test cancelling after announcement meeting = Meeting.objects.filter(type='interim', session__status='sched', session__group__acronym='mars').first() url = urlreverse('ietf.meeting.views.interim_request_cancel', kwargs={'number': meeting.number}) r = self.client.post(url, {'comments': comments}) self.assertRedirects(r, urlreverse('ietf.meeting.views.upcoming')) for session in meeting.session_set.all(): self.assertEqual(session.status_id, 'canceled') self.assertEqual(session.agenda_note, comments) self.assertEqual(len(outbox), length_before + 1) self.assertIn('Interim Meeting Cancelled', outbox[-1]['Subject']) def test_interim_request_edit_no_notice(self): '''Edit a request. No notice should go out if it hasn't been announced yet''' make_meeting_test_data() meeting = Meeting.objects.filter(type='interim', session__status='apprw', session__group__acronym='mars').first() group = meeting.session_set.first().group url = urlreverse('ietf.meeting.views.interim_request_edit', kwargs={'number': meeting.number}) # test unauthorized access self.client.login(username="ameschairman", password="ameschairman+password") r = self.client.get(url) self.assertEqual(r.status_code, 403) # test authorized use login_testing_unauthorized(self, "secretary", url) r = self.client.get(url) self.assertEqual(r.status_code, 200) # post changes length_before = len(outbox) form_initial = r.context['form'].initial formset_initial = r.context['formset'].forms[0].initial new_time = formset_initial['time'] + datetime.timedelta(hours=1) data = {'group':group.pk, 'meeting_type':'single', 'session_set-0-id':meeting.session_set.first().id, 'session_set-0-date':formset_initial['date'].strftime('%Y-%m-%d'), 'session_set-0-time':new_time.strftime('%H:%M'), 'session_set-0-requested_duration':formset_initial['requested_duration'], 'session_set-0-remote_instructions':formset_initial['remote_instructions'], #'session_set-0-agenda':formset_initial['agenda'], 'session_set-0-agenda_note':formset_initial['agenda_note'], 'session_set-TOTAL_FORMS':1, 'session_set-INITIAL_FORMS':1} data.update(form_initial) r = self.client.post(url, data) self.assertRedirects(r, urlreverse('ietf.meeting.views.interim_request_details', kwargs={'number': meeting.number})) self.assertEqual(len(outbox),length_before) session = meeting.session_set.first() timeslot = session.official_timeslotassignment().timeslot self.assertEqual(timeslot.time,new_time) def test_interim_request_edit(self): '''Edit request. Send notice of change''' make_meeting_test_data() meeting = Meeting.objects.filter(type='interim', session__status='sched', session__group__acronym='mars').first() group = meeting.session_set.first().group url = urlreverse('ietf.meeting.views.interim_request_edit', kwargs={'number': meeting.number}) # test unauthorized access self.client.login(username="ameschairman", password="ameschairman+password") r = self.client.get(url) self.assertEqual(r.status_code, 403) # test authorized use login_testing_unauthorized(self, "secretary", url) r = self.client.get(url) self.assertEqual(r.status_code, 200) # post changes length_before = len(outbox) form_initial = r.context['form'].initial formset_initial = r.context['formset'].forms[0].initial new_time = formset_initial['time'] + datetime.timedelta(hours=1) new_duration = formset_initial['requested_duration'] + datetime.timedelta(hours=1) data = {'group':group.pk, 'meeting_type':'single', 'session_set-0-id':meeting.session_set.first().id, 'session_set-0-date':formset_initial['date'].strftime('%Y-%m-%d'), 'session_set-0-time':new_time.strftime('%H:%M'), 'session_set-0-requested_duration':self.strfdelta(new_duration, '{hours}:{minutes}'), 'session_set-0-remote_instructions':formset_initial['remote_instructions'], #'session_set-0-agenda':formset_initial['agenda'], 'session_set-0-agenda_note':formset_initial['agenda_note'], 'session_set-TOTAL_FORMS':1, 'session_set-INITIAL_FORMS':1} data.update(form_initial) r = self.client.post(url, data) self.assertRedirects(r, urlreverse('ietf.meeting.views.interim_request_details', kwargs={'number': meeting.number})) self.assertEqual(len(outbox),length_before+1) self.assertIn('CHANGED', outbox[-1]['Subject']) session = meeting.session_set.first() timeslot = session.official_timeslotassignment().timeslot self.assertEqual(timeslot.time,new_time) self.assertEqual(timeslot.duration,new_duration) def strfdelta(self, tdelta, fmt): d = {"days": tdelta.days} d["hours"], rem = divmod(tdelta.seconds, 3600) d["minutes"], d["seconds"] = divmod(rem, 60) return fmt.format(**d) def test_interim_request_details_permissions(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim',session__status='apprw',session__group__acronym='mars').first() url = urlreverse('ietf.meeting.views.interim_request_details',kwargs={'number':meeting.number}) # unprivileged user login_testing_unauthorized(self,"plain",url) r = self.client.get(url) self.assertEqual(r.status_code, 403) def test_send_interim_approval_request(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim',session__status='apprw',session__group__acronym='mars').first() length_before = len(outbox) send_interim_approval_request(meetings=[meeting]) self.assertEqual(len(outbox),length_before+1) self.assertIn('New Interim Meeting Request', outbox[-1]['Subject']) def test_send_interim_cancellation_notice(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim',session__status='sched',session__group__acronym='mars').first() length_before = len(outbox) send_interim_cancellation_notice(meeting=meeting) self.assertEqual(len(outbox),length_before+1) self.assertIn('Interim Meeting Cancelled', outbox[-1]['Subject']) def test_send_interim_minutes_reminder(self): make_meeting_test_data() group = Group.objects.get(acronym='mars') date = datetime.datetime.today() - datetime.timedelta(days=10) meeting = make_interim_meeting(group=group, date=date, status='sched') length_before = len(outbox) send_interim_minutes_reminder(meeting=meeting) self.assertEqual(len(outbox),length_before+1) self.assertIn('Action Required: Minutes', outbox[-1]['Subject']) def test_group_ical(self): make_meeting_test_data() meeting = Meeting.objects.filter(type='interim', session__group__acronym='mars').first() s1 = Session.objects.filter(meeting=meeting, group__acronym="mars").first() a1 = s1.official_timeslotassignment() t1 = a1.timeslot # Create an extra session t2 = TimeSlotFactory.create(meeting=meeting, time=datetime.datetime.combine(meeting.date, datetime.time(11, 30))) s2 = SessionFactory.create(meeting=meeting, group=s1.group, add_to_schedule=False) SchedTimeSessAssignment.objects.create(timeslot=t2, session=s2, schedule=meeting.agenda) # url = urlreverse('ietf.meeting.views.ical_agenda', kwargs={'num':meeting.number, 'acronym':s1.group.acronym, }) r = self.client.get(url) self.assertEqual(r.get('Content-Type'), "text/calendar") self.assertContains(r, 'BEGIN:VEVENT') self.assertEqual(r.content.count(b'UID'), 2) self.assertContains(r, 'SUMMARY:mars - Martian Special Interest Group') self.assertContains(r, t1.time.strftime('%Y%m%dT%H%M%S')) self.assertContains(r, t2.time.strftime('%Y%m%dT%H%M%S')) self.assertContains(r, 'END:VEVENT') # url = urlreverse('ietf.meeting.views.ical_agenda', kwargs={'num':meeting.number, 'session_id':s1.id, }) r = self.client.get(url) self.assertEqual(r.get('Content-Type'), "text/calendar") self.assertContains(r, 'BEGIN:VEVENT') self.assertEqual(r.content.count(b'UID'), 1) self.assertContains(r, 'SUMMARY:mars - Martian Special Interest Group') self.assertContains(r, t1.time.strftime('%Y%m%dT%H%M%S')) self.assertNotContains(r, t2.time.strftime('%Y%m%dT%H%M%S')) self.assertContains(r, 'END:VEVENT') class AjaxTests(TestCase): def test_ajax_get_utc(self): # test bad queries url = urlreverse('ietf.meeting.views.ajax_get_utc') + "?date=2016-1-1&time=badtime&timezone=UTC" r = self.client.get(url) self.assertEqual(r.status_code, 200) data = r.json() self.assertEqual(data["error"], True) url = urlreverse('ietf.meeting.views.ajax_get_utc') + "?date=2016-1-1&time=25:99&timezone=UTC" r = self.client.get(url) self.assertEqual(r.status_code, 200) data = r.json() self.assertEqual(data["error"], True) url = urlreverse('ietf.meeting.views.ajax_get_utc') + "?date=2016-1-1&time=10:00am&timezone=UTC" r = self.client.get(url) self.assertEqual(r.status_code, 200) data = r.json() self.assertEqual(data["error"], True) # test good query url = urlreverse('ietf.meeting.views.ajax_get_utc') + "?date=2016-1-1&time=12:00&timezone=America/Los_Angeles" r = self.client.get(url) self.assertEqual(r.status_code, 200) data = r.json() self.assertIn('timezone', data) self.assertIn('time', data) self.assertIn('utc', data) self.assertNotIn('error', data) self.assertEqual(data['utc'], '20:00') class FloorPlanTests(TestCase): def setUp(self): pass def tearDown(self): pass def test_floor_plan_page(self): make_meeting_test_data() meeting = Meeting.objects.filter(type_id='ietf').order_by('id').last() floorplan = FloorPlanFactory.create(meeting=meeting) url = urlreverse('ietf.meeting.views.floor_plan') r = self.client.get(url) self.assertEqual(r.status_code, 200) url = urlreverse('ietf.meeting.views.floor_plan', kwargs={'floor': xslugify(floorplan.name)} ) r = self.client.get(url) self.assertEqual(r.status_code, 200) class IphoneAppJsonTests(TestCase): def setUp(self): pass def tearDown(self): pass def test_iphone_app_json(self): make_meeting_test_data() meeting = Meeting.objects.filter(type_id='ietf').order_by('id').last() floorplan = FloorPlanFactory.create(meeting=meeting) for room in meeting.room_set.all(): room.floorplan = floorplan room.x1 = random.randint(0,100) room.y1 = random.randint(0,100) room.x2 = random.randint(0,100) room.y2 = random.randint(0,100) room.save() url = urlreverse('ietf.meeting.views.json_agenda',kwargs={'num':meeting.number}) r = self.client.get(url) self.assertEqual(r.status_code,200) class FinalizeProceedingsTests(TestCase): @patch('six.moves.urllib.request.urlopen') def test_finalize_proceedings(self, mock_urlopen): mock_urlopen.return_value = BytesIO(b'[{"LastName":"Smith","FirstName":"John","Company":"ABC","Country":"US"}]') make_meeting_test_data() meeting = Meeting.objects.filter(type_id='ietf').order_by('id').last() meeting.session_set.filter(group__acronym='mars').first().sessionpresentation_set.create(document=Document.objects.filter(type='draft').first(),rev=None) url = urlreverse('ietf.meeting.views.finalize_proceedings',kwargs={'num':meeting.number}) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) self.assertEqual(meeting.proceedings_final,False) self.assertEqual(meeting.session_set.filter(group__acronym="mars").first().sessionpresentation_set.filter(document__type="draft").first().rev,None) r = self.client.post(url,{'finalize':1}) self.assertEqual(r.status_code, 302) meeting = Meeting.objects.get(pk=meeting.pk) self.assertEqual(meeting.proceedings_final,True) self.assertEqual(meeting.session_set.filter(group__acronym="mars").first().sessionpresentation_set.filter(document__type="draft").first().rev,'00') class MaterialsTests(TestCase): def setUp(self): self.materials_dir = self.tempdir('materials') self.staging_dir = self.tempdir('staging') if not os.path.exists(self.materials_dir): os.mkdir(self.materials_dir) self.saved_agenda_path = settings.AGENDA_PATH settings.AGENDA_PATH = self.materials_dir self.saved_staging_path = settings.SLIDE_STAGING_PATH settings.SLIDE_STAGING_PATH = self.staging_dir def tearDown(self): settings.AGENDA_PATH = self.saved_agenda_path settings.SLIDE_STAGING_PATH = self.saved_staging_path shutil.rmtree(self.materials_dir) shutil.rmtree(self.staging_dir) def crawl_materials(self, url, top): seen = set() def follow(url): seen.add(url) r = self.client.get(url) self.assertEqual(r.status_code, 200) if not ('.' in url and url.rsplit('.', 1)[1] in ['tgz', 'pdf', ]): if r.content: page = unicontent(r) soup = BeautifulSoup(page, 'html.parser') for a in soup('a'): href = a.get('href') path = urlparse(href).path if (path and path not in seen and path.startswith(top)): follow(path) follow(url) def test_upload_bluesheets(self): session = SessionFactory(meeting__type_id='ietf') url = urlreverse('ietf.meeting.views.upload_session_bluesheets',kwargs={'num':session.meeting.number,'session_id':session.id}) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Upload', six.text_type(q("title"))) self.assertFalse(session.sessionpresentation_set.exists()) test_file = StringIO('%PDF-1.4\n%âãÏÓ\nthis is some text for a test') test_file.name = "not_really.pdf" r = self.client.post(url,dict(file=test_file)) self.assertEqual(r.status_code, 302) bs_doc = session.sessionpresentation_set.filter(document__type_id='bluesheets').first().document self.assertEqual(bs_doc.rev,'00') r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Revise', six.text_type(q("title"))) test_file = StringIO('%PDF-1.4\n%âãÏÓ\nthis is some different text for a test') test_file.name = "also_not_really.pdf" r = self.client.post(url,dict(file=test_file)) self.assertEqual(r.status_code, 302) bs_doc = Document.objects.get(pk=bs_doc.pk) self.assertEqual(bs_doc.rev,'01') def test_upload_bluesheets_chair_access(self): make_meeting_test_data() mars = Group.objects.get(acronym='mars') session=SessionFactory(meeting__type_id='ietf',group=mars) url = urlreverse('ietf.meeting.views.upload_session_bluesheets',kwargs={'num':session.meeting.number,'session_id':session.id}) self.client.login(username="marschairman", password="marschairman+password") r = self.client.get(url) self.assertEqual(r.status_code, 403) def test_upload_bluesheets_interim(self): session=SessionFactory(meeting__type_id='interim') url = urlreverse('ietf.meeting.views.upload_session_bluesheets',kwargs={'num':session.meeting.number,'session_id':session.id}) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Upload', six.text_type(q("title"))) self.assertFalse(session.sessionpresentation_set.exists()) test_file = StringIO('%PDF-1.4\n%âãÏÓ\nthis is some text for a test') test_file.name = "not_really.pdf" r = self.client.post(url,dict(file=test_file)) self.assertEqual(r.status_code, 302) bs_doc = session.sessionpresentation_set.filter(document__type_id='bluesheets').first().document self.assertEqual(bs_doc.rev,'00') def test_upload_bluesheets_interim_chair_access(self): make_meeting_test_data() mars = Group.objects.get(acronym='mars') session=SessionFactory(meeting__type_id='interim',group=mars) url = urlreverse('ietf.meeting.views.upload_session_bluesheets',kwargs={'num':session.meeting.number,'session_id':session.id}) self.client.login(username="marschairman", password="marschairman+password") r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Upload', six.text_type(q("title"))) def test_upload_minutes_agenda(self): for doctype in ('minutes','agenda'): session = SessionFactory(meeting__type_id='ietf') if doctype == 'minutes': url = urlreverse('ietf.meeting.views.upload_session_minutes',kwargs={'num':session.meeting.number,'session_id':session.id}) else: url = urlreverse('ietf.meeting.views.upload_session_agenda',kwargs={'num':session.meeting.number,'session_id':session.id}) self.client.logout() login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Upload', six.text_type(q("Title"))) self.assertFalse(session.sessionpresentation_set.exists()) self.assertFalse(q('form input[type="checkbox"]')) session2 = SessionFactory(meeting=session.meeting,group=session.group) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertTrue(q('form input[type="checkbox"]')) test_file = BytesIO(b'this is some text for a test') test_file.name = "not_really.json" r = self.client.post(url,dict(file=test_file)) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertTrue(q('form .has-error')) test_file = BytesIO(b'this is some text for a test'*1510000) test_file.name = "not_really.pdf" r = self.client.post(url,dict(file=test_file)) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertTrue(q('form .has-error')) test_file = BytesIO(b'<html><frameset><frame src="foo.html"></frame><frame src="bar.html"></frame></frameset></html>') test_file.name = "not_really.html" r = self.client.post(url,dict(file=test_file)) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertTrue(q('form .has-error')) # Test html sanitization test_file = BytesIO(b'<html><head><title>Title</title></head><body><h1>Title</h1><section>Some text</section></body></html>') test_file.name = "some.html" r = self.client.post(url,dict(file=test_file)) self.assertEqual(r.status_code, 302) doc = session.sessionpresentation_set.filter(document__type_id=doctype).first().document self.assertEqual(doc.rev,'00') text = doc.text() self.assertIn('Some text', text) self.assertNotIn('<section>', text) self.assertIn('charset="utf-8"', text) # txt upload test_file = BytesIO(b'This is some text for a test, with the word\nvirtual at the beginning of a line.') test_file.name = "some.txt" r = self.client.post(url,dict(file=test_file,apply_to_all=False)) self.assertEqual(r.status_code, 302) doc = session.sessionpresentation_set.filter(document__type_id=doctype).first().document self.assertEqual(doc.rev,'01') self.assertFalse(session2.sessionpresentation_set.filter(document__type_id=doctype)) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Revise', six.text_type(q("Title"))) test_file = BytesIO(b'this is some different text for a test') test_file.name = "also_some.txt" r = self.client.post(url,dict(file=test_file,apply_to_all=True)) self.assertEqual(r.status_code, 302) doc = Document.objects.get(pk=doc.pk) self.assertEqual(doc.rev,'02') self.assertTrue(session2.sessionpresentation_set.filter(document__type_id=doctype)) # Test bad encoding test_file = BytesIO('<html><h1>Title</h1><section>Some\x93text</section></html>'.encode('latin1')) test_file.name = "some.html" r = self.client.post(url,dict(file=test_file)) self.assertContains(r, 'Could not identify the file encoding') doc = Document.objects.get(pk=doc.pk) self.assertEqual(doc.rev,'02') # Verify that we don't have dead links url = url=urlreverse('ietf.meeting.views.session_details', kwargs={'num':session.meeting.number, 'acronym': session.group.acronym}) top = '/meeting/%s/' % session.meeting.number self.crawl_materials(url=url, top=top) def test_upload_minutes_agenda_unscheduled(self): for doctype in ('minutes','agenda'): session = SessionFactory(meeting__type_id='ietf', add_to_schedule=False) if doctype == 'minutes': url = urlreverse('ietf.meeting.views.upload_session_minutes',kwargs={'num':session.meeting.number,'session_id':session.id}) else: url = urlreverse('ietf.meeting.views.upload_session_agenda',kwargs={'num':session.meeting.number,'session_id':session.id}) self.client.logout() login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Upload', six.text_type(q("Title"))) self.assertFalse(session.sessionpresentation_set.exists()) self.assertFalse(q('form input[type="checkbox"]')) test_file = BytesIO(b'this is some text for a test') test_file.name = "not_really.txt" r = self.client.post(url,dict(file=test_file,apply_to_all=False)) self.assertEqual(r.status_code, 410) def test_upload_minutes_agenda_interim(self): session=SessionFactory(meeting__type_id='interim') for doctype in ('minutes','agenda'): if doctype=='minutes': url = urlreverse('ietf.meeting.views.upload_session_minutes',kwargs={'num':session.meeting.number,'session_id':session.id}) else: url = urlreverse('ietf.meeting.views.upload_session_agenda',kwargs={'num':session.meeting.number,'session_id':session.id}) self.client.logout() login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Upload', six.text_type(q("title"))) self.assertFalse(session.sessionpresentation_set.filter(document__type_id=doctype)) test_file = BytesIO(b'this is some text for a test') test_file.name = "not_really.txt" r = self.client.post(url,dict(file=test_file)) self.assertEqual(r.status_code, 302) doc = session.sessionpresentation_set.filter(document__type_id=doctype).first().document self.assertEqual(doc.rev,'00') # Verify that we don't have dead links url = url=urlreverse('ietf.meeting.views.session_details', kwargs={'num':session.meeting.number, 'acronym': session.group.acronym}) top = '/meeting/%s/' % session.meeting.number self.crawl_materials(url=url, top=top) def test_upload_slides(self): session1 = SessionFactory(meeting__type_id='ietf') session2 = SessionFactory(meeting=session1.meeting,group=session1.group) url = urlreverse('ietf.meeting.views.upload_session_slides',kwargs={'num':session1.meeting.number,'session_id':session1.id}) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Upload', six.text_type(q("title"))) self.assertFalse(session1.sessionpresentation_set.filter(document__type_id='slides')) test_file = BytesIO(b'this is not really a slide') test_file.name = 'not_really.txt' r = self.client.post(url,dict(file=test_file,title='a test slide file',apply_to_all=True)) self.assertEqual(r.status_code, 302) self.assertEqual(session1.sessionpresentation_set.count(),1) self.assertEqual(session2.sessionpresentation_set.count(),1) sp = session2.sessionpresentation_set.first() self.assertEqual(sp.document.name, 'slides-%s-%s-a-test-slide-file' % (session1.meeting.number,session1.group.acronym ) ) self.assertEqual(sp.order,1) url = urlreverse('ietf.meeting.views.upload_session_slides',kwargs={'num':session2.meeting.number,'session_id':session2.id}) test_file = BytesIO(b'some other thing still not slidelike') test_file.name = 'also_not_really.txt' r = self.client.post(url,dict(file=test_file,title='a different slide file',apply_to_all=False)) self.assertEqual(r.status_code, 302) self.assertEqual(session1.sessionpresentation_set.count(),1) self.assertEqual(session2.sessionpresentation_set.count(),2) sp = session2.sessionpresentation_set.get(document__name__endswith='-a-different-slide-file') self.assertEqual(sp.order,2) self.assertEqual(sp.rev,'00') self.assertEqual(sp.document.rev,'00') url = urlreverse('ietf.meeting.views.upload_session_slides',kwargs={'num':session2.meeting.number,'session_id':session2.id,'name':session2.sessionpresentation_set.get(order=2).document.name}) r = self.client.get(url) self.assertTrue(r.status_code, 200) q = PyQuery(r.content) self.assertIn('Revise', six.text_type(q("title"))) test_file = BytesIO(b'new content for the second slide deck') test_file.name = 'doesnotmatter.txt' r = self.client.post(url,dict(file=test_file,title='rename the presentation',apply_to_all=False)) self.assertEqual(r.status_code, 302) self.assertEqual(session1.sessionpresentation_set.count(),1) self.assertEqual(session2.sessionpresentation_set.count(),2) sp = session2.sessionpresentation_set.get(order=2) self.assertEqual(sp.rev,'01') self.assertEqual(sp.document.rev,'01') def test_remove_sessionpresentation(self): session = SessionFactory(meeting__type_id='ietf') doc = DocumentFactory(type_id='slides') session.sessionpresentation_set.create(document=doc) url = urlreverse('ietf.meeting.views.remove_sessionpresentation',kwargs={'num':session.meeting.number,'session_id':session.id,'name':'no-such-doc'}) response = self.client.get(url) self.assertEqual(response.status_code, 404) url = urlreverse('ietf.meeting.views.remove_sessionpresentation',kwargs={'num':session.meeting.number,'session_id':0,'name':doc.name}) response = self.client.get(url) self.assertEqual(response.status_code, 404) url = urlreverse('ietf.meeting.views.remove_sessionpresentation',kwargs={'num':session.meeting.number,'session_id':session.id,'name':doc.name}) login_testing_unauthorized(self,"secretary",url) response = self.client.get(url) self.assertEqual(response.status_code, 200) self.assertEqual(1,session.sessionpresentation_set.count()) response = self.client.post(url,{'remove_session':''}) self.assertEqual(response.status_code, 302) self.assertEqual(0,session.sessionpresentation_set.count()) self.assertEqual(2,doc.docevent_set.count()) def test_propose_session_slides(self): for type_id in ['ietf','interim']: session = SessionFactory(meeting__type_id=type_id) chair = RoleFactory(group=session.group,name_id='chair').person session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) newperson = PersonFactory() session_overview_url = urlreverse('ietf.meeting.views.session_details',kwargs={'num':session.meeting.number,'acronym':session.group.acronym}) propose_url = urlreverse('ietf.meeting.views.propose_session_slides', kwargs={'session_id':session.pk, 'num': session.meeting.number}) r = self.client.get(session_overview_url) self.assertEqual(r.status_code,200) q = PyQuery(r.content) self.assertFalse(q('#uploadslides')) self.assertFalse(q('#proposeslides')) self.client.login(username=newperson.user.username,password=newperson.user.username+"+password") r = self.client.get(session_overview_url) self.assertEqual(r.status_code,200) q = PyQuery(r.content) self.assertTrue(q('#proposeslides')) self.client.logout() login_testing_unauthorized(self,newperson.user.username,propose_url) r = self.client.get(propose_url) self.assertEqual(r.status_code,200) test_file = BytesIO(b'this is not really a slide') test_file.name = 'not_really.txt' empty_outbox() r = self.client.post(propose_url,dict(file=test_file,title='a test slide file',apply_to_all=True)) self.assertEqual(r.status_code, 302) session = Session.objects.get(pk=session.pk) self.assertEqual(session.slidesubmission_set.count(),1) self.assertEqual(len(outbox),1) r = self.client.get(session_overview_url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertEqual(len(q('#proposedslidelist p')), 1) SlideSubmissionFactory(session = session) self.client.logout() self.client.login(username=chair.user.username, password=chair.user.username+"+password") r = self.client.get(session_overview_url) self.assertEqual(r.status_code, 200) q = PyQuery(r.content) self.assertEqual(len(q('#proposedslidelist p')), 2) self.client.logout() def test_disapprove_proposed_slides(self): submission = SlideSubmissionFactory() submission.session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) chair = RoleFactory(group=submission.session.group,name_id='chair').person url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':submission.pk,'num':submission.session.meeting.number}) login_testing_unauthorized(self, chair.user.username, url) r = self.client.get(url) self.assertEqual(r.status_code,200) r = self.client.post(url,dict(title='some title',disapprove="disapprove")) self.assertEqual(r.status_code,302) self.assertEqual(SlideSubmission.objects.count(), 0) def test_approve_proposed_slides(self): submission = SlideSubmissionFactory() session = submission.session session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) chair = RoleFactory(group=submission.session.group,name_id='chair').person url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':submission.pk,'num':submission.session.meeting.number}) login_testing_unauthorized(self, chair.user.username, url) r = self.client.get(url) self.assertEqual(r.status_code,200) r = self.client.post(url,dict(title='different title',approve='approve')) self.assertEqual(r.status_code,302) self.assertEqual(SlideSubmission.objects.count(), 0) self.assertEqual(session.sessionpresentation_set.count(),1) self.assertEqual(session.sessionpresentation_set.first().document.title,'different title') def test_approve_proposed_slides_multisession_apply_one(self): submission = SlideSubmissionFactory(session__meeting__type_id='ietf') session1 = submission.session session2 = SessionFactory(group=submission.session.group, meeting=submission.session.meeting) submission.session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) chair = RoleFactory(group=submission.session.group,name_id='chair').person url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':submission.pk,'num':submission.session.meeting.number}) login_testing_unauthorized(self, chair.user.username, url) r = self.client.get(url) self.assertEqual(r.status_code,200) q = PyQuery(r.content) self.assertTrue(q('#id_apply_to_all')) r = self.client.post(url,dict(title='yet another title',approve='approve')) self.assertEqual(r.status_code,302) self.assertEqual(session1.sessionpresentation_set.count(),1) self.assertEqual(session2.sessionpresentation_set.count(),0) def test_approve_proposed_slides_multisession_apply_all(self): submission = SlideSubmissionFactory(session__meeting__type_id='ietf') session1 = submission.session session2 = SessionFactory(group=submission.session.group, meeting=submission.session.meeting) submission.session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) chair = RoleFactory(group=submission.session.group,name_id='chair').person url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':submission.pk,'num':submission.session.meeting.number}) login_testing_unauthorized(self, chair.user.username, url) r = self.client.get(url) self.assertEqual(r.status_code,200) r = self.client.post(url,dict(title='yet another title',apply_to_all=1,approve='approve')) self.assertEqual(r.status_code,302) self.assertEqual(session1.sessionpresentation_set.count(),1) self.assertEqual(session2.sessionpresentation_set.count(),1) def test_submit_and_approve_multiple_versions(self): session = SessionFactory(meeting__type_id='ietf') chair = RoleFactory(group=session.group,name_id='chair').person session.meeting.importantdate_set.create(name_id='revsub',date=datetime.date.today()+datetime.timedelta(days=20)) newperson = PersonFactory() propose_url = urlreverse('ietf.meeting.views.propose_session_slides', kwargs={'session_id':session.pk, 'num': session.meeting.number}) login_testing_unauthorized(self,newperson.user.username,propose_url) test_file = BytesIO(b'this is not really a slide') test_file.name = 'not_really.txt' r = self.client.post(propose_url,dict(file=test_file,title='a test slide file',apply_to_all=True)) self.assertEqual(r.status_code, 302) self.client.logout() submission = SlideSubmission.objects.get(session = session) approve_url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':submission.pk,'num':submission.session.meeting.number}) login_testing_unauthorized(self, chair.user.username, approve_url) r = self.client.post(approve_url,dict(title=submission.title,approve='approve')) self.assertEqual(r.status_code,302) self.client.logout() self.assertEqual(session.sessionpresentation_set.first().document.rev,'00') login_testing_unauthorized(self,newperson.user.username,propose_url) test_file = BytesIO(b'this is not really a slide, but it is another version of it') test_file.name = 'not_really.txt' r = self.client.post(propose_url,dict(file=test_file,title='a test slide file',apply_to_all=True)) self.assertEqual(r.status_code, 302) test_file = BytesIO(b'this is not really a slide, but it is third version of it') test_file.name = 'not_really.txt' r = self.client.post(propose_url,dict(file=test_file,title='a test slide file',apply_to_all=True)) self.assertEqual(r.status_code, 302) self.client.logout() (first_submission, second_submission) = SlideSubmission.objects.filter(session=session).order_by('id') approve_url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':second_submission.pk,'num':second_submission.session.meeting.number}) login_testing_unauthorized(self, chair.user.username, approve_url) r = self.client.post(approve_url,dict(title=submission.title,approve='approve')) self.assertEqual(r.status_code,302) disapprove_url = urlreverse('ietf.meeting.views.approve_proposed_slides', kwargs={'slidesubmission_id':first_submission.pk,'num':first_submission.session.meeting.number}) r = self.client.post(disapprove_url,dict(title='some title',disapprove="disapprove")) self.assertEqual(r.status_code,302) self.client.logout() self.assertEqual(SlideSubmission.objects.count(),0) self.assertEqual(session.sessionpresentation_set.first().document.rev,'01') path = os.path.join(submission.session.meeting.get_materials_path(),'slides') filename = os.path.join(path,session.sessionpresentation_set.first().document.name+'-01.txt') self.assertTrue(os.path.exists(filename)) contents = open(filename,'r').read() self.assertIn('third version', contents) class SessionTests(TestCase): def test_meeting_requests(self): meeting = MeetingFactory(type_id='ietf') area = GroupFactory(type_id='area') requested_session = SessionFactory(meeting=meeting,group__parent=area,status_id='schedw',add_to_schedule=False) not_meeting = SessionFactory(meeting=meeting,group__parent=area,status_id='notmeet',add_to_schedule=False) url = urlreverse('ietf.meeting.views.meeting_requests',kwargs={'num':meeting.number}) r = self.client.get(url) self.assertContains(r, requested_session.group.acronym) self.assertContains(r, not_meeting.group.acronym) def test_request_minutes(self): meeting = MeetingFactory(type_id='ietf') area = GroupFactory(type_id='area') has_minutes = SessionFactory(meeting=meeting,group__parent=area) has_no_minutes = SessionFactory(meeting=meeting,group__parent=area) SessionPresentation.objects.create(session=has_minutes,document=DocumentFactory(type_id='minutes')) empty_outbox() url = urlreverse('ietf.meeting.views.request_minutes',kwargs={'num':meeting.number}) login_testing_unauthorized(self,"secretary",url) r = self.client.get(url) self.assertNotContains(r, has_minutes.group.acronym.upper()) self.assertContains(r, has_no_minutes.group.acronym.upper()) r = self.client.post(url,{'to':'wgchairs@ietf.org', 'cc': 'irsg@irtf.org', 'subject': 'I changed the subject', 'body': 'corpus', }) self.assertEqual(r.status_code,302) self.assertEqual(len(outbox),1)
[ "henrik@levkowetz.com" ]
henrik@levkowetz.com
9c973488f9d719fd9c2a411440ca647bee688d38
ef187d259d33e97c7b9ed07dfbf065cec3e41f59
/work/atcoder/abc/abc071/B/answers/522566_koshin.py
20bb39dec8949fc4e380efefc6a903dbde19a1ce
[]
no_license
kjnh10/pcw
847f7295ea3174490485ffe14ce4cdea0931c032
8f677701bce15517fb9362cc5b596644da62dca8
refs/heads/master
2020-03-18T09:54:23.442772
2018-07-19T00:26:09
2018-07-19T00:26:09
134,586,379
0
0
null
null
null
null
UTF-8
Python
false
false
146
py
S=list(str(input())) a=list('abcdefghijklmnopqrstuvwxyz') for i in a: if i not in S: print(i) exit() else: print('None')
[ "kojinho10@gmail.com" ]
kojinho10@gmail.com
eb04578dd4f8e1459026e5d3de2526c389876ca4
916480ae24345193efa95df013f637e0a115653b
/web/transiq/utils/migrations/0019_auto_20180513_1844.py
450db0d4d873f520e5f19a49c64c33e02caa89ff
[ "Apache-2.0" ]
permissive
manibhushan05/tms
50e289c670e1615a067c61a051c498cdc54958df
763fafb271ce07d13ac8ce575f2fee653cf39343
refs/heads/master
2022-12-11T07:59:30.297259
2021-09-08T03:24:59
2021-09-08T03:24:59
210,017,184
0
0
Apache-2.0
2022-12-08T02:35:01
2019-09-21T16:23:57
Python
UTF-8
Python
false
false
1,611
py
# Generated by Django 2.0.2 on 2018-05-13 18:44 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('utils', '0018_merge_20180508_1254'), ] operations = [ migrations.AlterModelOptions( name='aahooffice', options={'ordering': ['-id']}, ), migrations.AlterModelOptions( name='bank', options={'ordering': ['-id'], 'verbose_name_plural': 'Bank Account Details'}, ), migrations.AlterField( model_name='district', name='created_by', field=models.ForeignKey(limit_choices_to={'is_staff': True}, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AlterField( model_name='locality', name='created_by', field=models.ForeignKey(limit_choices_to={'is_staff': True}, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AlterField( model_name='pincode', name='created_by', field=models.ForeignKey(limit_choices_to={'is_staff': True}, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AlterField( model_name='subdistrict', name='created_by', field=models.ForeignKey(limit_choices_to={'is_staff': True}, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), ]
[ "mani@myhost.local" ]
mani@myhost.local
ac65ddd449c21c09edc55058e5b68f2044967871
62221ae1588e496d278806c63eadd30c6b6ccc56
/chp44/ex44b.py
ea43712920ed198fd78e467ca3c933fd4ded54e3
[ "MIT" ]
permissive
udoyen/pythonlearning
1b2aa32cad2b274fff46ce6abf69363bbfd0efd7
b157a19ebc1bcf8cb8fb5f76d8a98fcb8e465476
refs/heads/master
2021-01-21T04:59:53.287035
2016-06-19T19:13:35
2016-06-19T19:13:35
48,765,097
0
0
null
2016-06-18T23:07:23
2015-12-29T20:06:48
Python
UTF-8
Python
false
false
246
py
# Override Explicitly class Parent(object): def override(self): print "PARENT override()" class Child(Parent): def override(self): print "CHILD override()" dad = Parent() son = Child() dad.override() son.override()
[ "datameshprojects@gmail.com" ]
datameshprojects@gmail.com
3d900bbbb3870178d5f961b5086c1f23d4531ff1
b05761d771bb5a85d39d370c649567c1ff3eb089
/venv/lib/python3.10/site-packages/replit/identity/verify.py
532795d5cfe6b08b999c2c34f721ca585de3d35f
[]
no_license
JawshyJ/Coding_Practice
88c49cab955eab04609ec1003b6b8c20f103fc06
eb6b229d41aa49b1545af2120e6bee8e982adb41
refs/heads/master
2023-02-19T10:18:04.818542
2023-02-06T21:22:58
2023-02-06T21:22:58
247,788,631
4
0
null
null
null
null
UTF-8
Python
false
false
96
py
/home/runner/.cache/pip/pool/22/41/ff/651c060c2d804e00772fb16ad5742f3413e927507140067eb1700cef17
[ "37465112+JawshyJ@users.noreply.github.com" ]
37465112+JawshyJ@users.noreply.github.com
8ea1165a34eb37731299f45c15b41003279813a3
5698fb67c9925902832f69738f1f116bb837528e
/pizza/forms.py
d4bf6b7531157eea4f9afb3d0f6d67b5aa4ac1a9
[]
no_license
lo1cgsan/djangoapp2
ebcc1a2e5758ec2a566d5292ebb3f377bc53dfe7
28aebc44f8a0e70f239626da37fa9bdeab44177c
refs/heads/master
2023-04-28T09:36:55.483445
2021-05-16T18:12:59
2021-05-16T18:12:59
206,551,530
0
0
null
2023-04-21T20:42:23
2019-09-05T11:50:44
Python
UTF-8
Python
false
false
195
py
from django.forms import ModelForm from pizza.models import Skladnik class SkladnikForm(ModelForm): class Meta: model = Skladnik fields = ('nazwa', 'cena', 'jarski', 'pizze')
[ "lo1cgsan@gmail.com" ]
lo1cgsan@gmail.com
55db7e12ea7dea676a28d62fd2b98986a76904b9
5c6ccc082d9d0d42a69e22cfd9a419a5b87ff6cd
/coursera/pythonHse/third/17.py
c6a636de267b026260f08684218d38d2b49704b3
[]
no_license
kersky98/stud
191c809bacc982c715d9610be282884a504d456d
d395a372e72aeb17dfad5c72d46e84dc59454410
refs/heads/master
2023-03-09T20:47:25.082673
2023-03-01T08:28:32
2023-03-01T08:28:32
42,979,807
0
0
null
null
null
null
UTF-8
Python
false
false
721
py
# Дана строка. Найдите в этой строке второе вхождение буквы f, и выведите # индекс этого вхождения. Если буква f в данной строке встречается только один # раз, выведите число -1, а если не встречается ни разу, выведите число -2. # При решении этой задачи нельзя использовать метод count. # s = 'comfort' # s = 'coffee' # s = 'qwerty' s = input() i1 = s.find('f') if i1 < 0: print(-2) else: i2 = s.find('f', i1+1) if i2 < 0: print(-1) else: print(i2)
[ "kerskiy-ev@pao.local" ]
kerskiy-ev@pao.local
1ea86dcdfe9956c456106c7ec0a97a6d8c419cd0
98f1a0bfa5b20a0b81e9e555d76e706c62d949c9
/python/dgl/distgnn/tools/__init__.py
25bdf4c65809df987d8ca20c5e781a9a93bdc9f1
[ "Apache-2.0" ]
permissive
dmlc/dgl
3a8fbca3a7f0e9adf6e69679ad62948df48dfc42
bbc8ff6261f2e0d2b5982e992b6fbe545e2a4aa1
refs/heads/master
2023-08-31T16:33:21.139163
2023-08-31T07:49:22
2023-08-31T07:49:22
130,375,797
12,631
3,482
Apache-2.0
2023-09-14T15:48:24
2018-04-20T14:49:09
Python
UTF-8
Python
false
false
114
py
""" This package contains extra routines related to Libra graph partitioner. """ from .tools import load_proteins
[ "noreply@github.com" ]
dmlc.noreply@github.com
9fd947528b778aef4c2487cc0fd92ba8504da87e
0234ad09e974ca91947751dea575a4fb4d2d138d
/tests/commands/element/test_misc.py
2e0381c1559ee70ad8c52362e0fef632fa26ecf3
[ "MIT", "LicenseRef-scancode-proprietary-license", "BSD-3-Clause", "LicenseRef-scancode-generic-cla" ]
permissive
o3seespy/o3seespy
8e0cee872ec4ec88b81af6c39b6d9287e6d6e057
57e47940cf6c0979215a04a11e184e38fd6f73a5
refs/heads/master
2023-09-04T18:38:45.126336
2023-08-19T01:13:54
2023-08-19T01:13:54
216,960,642
18
6
MIT
2023-02-08T00:40:39
2019-10-23T03:31:48
Python
UTF-8
Python
false
false
1,312
py
import o3seespy as o3 # for testing only import pytest def test_surface_load(): osi = o3.OpenSeesInstance(ndm=2) coords = [[0, 0], [1, 0], [1, 1], [0, 1]] ele_nodes = [o3.node.Node(osi, *coords[x]) for x in range(4)] o3.element.SurfaceLoad(osi, ele_nodes=ele_nodes, p=1.0) def test_vs3d4(): osi = o3.OpenSeesInstance(ndm=2) coords = [[0, 0], [1, 0], [1, 1], [0, 1]] ele_nodes = [o3.node.Node(osi, *coords[x]) for x in range(4)] o3.element.VS3D4(osi, ele_nodes=ele_nodes, big_e=1.0, big_g=1.0, rho=1.0, big_r=1.0, alpha_n=1.0, alpha_t=1.0) @pytest.mark.skip() def test_ac3d8(): osi = o3.OpenSeesInstance(ndm=2) coords = [[0, 0], [1, 0], [1, 1], [0, 1]] ele_nodes = [o3.node.Node(osi, *coords[x]) for x in range(4)] mat = o3.nd_material.ElasticIsotropic(osi, 1, 0.45) o3.element.AC3D8(osi, ele_nodes=ele_nodes, mat=mat) @pytest.mark.skip() def test_asi3d8(): osi = o3.OpenSeesInstance(ndm=2) o3.element.ASI3D8(osi, ele_nodes1=1, ele_nodes2=1) @pytest.mark.skip() def test_av3d4(): osi = o3.OpenSeesInstance(ndm=2) coords = [[0, 0], [1, 0], [1, 1], [0, 1]] ele_nodes = [o3.node.Node(osi, *coords[x]) for x in range(4)] mat = o3.nd_material.ElasticIsotropic(osi, 1, 0.45) o3.element.AV3D4(osi, ele_nodes=ele_nodes, mat=mat)
[ "maxim.millen@gmail.com" ]
maxim.millen@gmail.com
8e7e2b242a40a59a3882ec99d3e0e89f24f03055
b7ae24b0dd67a7fafbf0253f24c80924df88da62
/lab/logger/loop.py
c2ba8b296b533dc4d7b722622f7fd1cf8c2792b3
[ "MIT" ]
permissive
gear/lab
b3a2b1e5babc1adb172f842651e4db5d20939a16
ad1c5838acbcc98abb5d5d93d5c7a6c2b74bdfa2
refs/heads/master
2020-12-19T01:30:33.478027
2020-01-23T10:30:52
2020-01-23T10:30:52
235,579,450
0
0
MIT
2020-01-22T13:29:16
2020-01-22T13:29:15
null
UTF-8
Python
false
false
3,712
py
import math import time from typing import Optional, Dict from lab.logger import internal from lab.logger.sections import LoopingSection from .colors import Text class Loop: def __init__(self, iterator: range, *, logger: 'internal.LoggerInternal', is_print_iteration_time: bool): """ Creates an iterator with a range `iterator`. See example for usage. """ self.iterator = iterator self._start_time = 0. self._iter_start_time = 0. self._init_time = 0. self._iter_time = 0. self._beta_pow = 1. self._beta = 0.9 self.steps = len(iterator) self.counter = 0 self.logger = logger self.__global_step: Optional[int] = None self.__looping_sections: Dict[str, LoopingSection] = {} self._is_print_iteration_time = is_print_iteration_time self.is_started = False def __iter__(self): self.is_started = True self.iterator_iter = iter(self.iterator) self._start_time = time.time() self._init_time = 0. self._iter_time = 0. self.counter = 0 return self def __next__(self): try: next_value = next(self.iterator_iter) except StopIteration as e: self.logger.finish_loop() raise e now = time.time() if self.counter == 0: self.__init_time = now - self._start_time else: self._beta_pow *= self._beta self._iter_time *= self._beta self._iter_time += (1 - self._beta) * (now - self._iter_start_time) self._iter_start_time = now self.counter = next_value return next_value def log_progress(self): """ Show progress """ now = time.time() spent = now - self._start_time if not math.isclose(self._iter_time, 0.): estimate = self._iter_time / (1 - self._beta_pow) else: estimate = sum([s.get_estimated_time() for s in self.__looping_sections.values()]) total_time = estimate * self.steps + self._init_time total_time = max(total_time, spent) remain = total_time - spent remain /= 60 spent /= 60 estimate *= 1000 spent_h = int(spent // 60) spent_m = int(spent % 60) remain_h = int(remain // 60) remain_m = int(remain % 60) to_print = [(" ", None)] if self._is_print_iteration_time: to_print.append((f"{estimate:,.0f}ms", Text.meta)) to_print.append((f"{spent_h:3d}:{spent_m:02d}m/{remain_h:3d}:{remain_m:02d}m ", Text.meta2)) return to_print def get_section(self, *, name: str, is_silent: bool, is_timed: bool, is_partial: bool, total_steps: float): if name not in self.__looping_sections: self.__looping_sections[name] = LoopingSection(logger=self.logger, name=name, is_silent=is_silent, is_timed=is_timed, is_partial=is_partial, total_steps=total_steps) return self.__looping_sections[name] def log_sections(self): parts = [] for name, section in self.__looping_sections.items(): parts += section.log() return parts
[ "vpjayasiri@gmail.com" ]
vpjayasiri@gmail.com
8924942cf9a7e1481b811816c032ff48f0bbd05e
54f352a242a8ad6ff5516703e91da61e08d9a9e6
/Source Codes/AtCoder/abc108/A/4984031.py
47e9337053e96ed5e74b5561b5e2ace37987971b
[]
no_license
Kawser-nerd/CLCDSA
5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb
aee32551795763b54acb26856ab239370cac4e75
refs/heads/master
2022-02-09T11:08:56.588303
2022-01-26T18:53:40
2022-01-26T18:53:40
211,783,197
23
9
null
null
null
null
UTF-8
Python
false
false
75
py
n = int(input()) e = o = n // 2 if ( n % 2 != 0): o += 1 print(e * o)
[ "kwnafi@yahoo.com" ]
kwnafi@yahoo.com
c81184fc056080d1b7ac9ab3668ec51f80548815
238cff74530e5571648da88f127d086d2d9294b4
/0x08-python-more_classes/6-rectangle.py
a84bd8002a4564362e770c5557e21640e606a829
[]
no_license
Achilik/holbertonschool-higher_level_programming-6
b92fcbd1bc6bbedcfef4b49bb3907d97b8be41ff
d0c46cc5ed2bfd1c8d75ce4a2a7604fc4f3f1c5c
refs/heads/master
2023-03-21T08:03:31.613145
2018-09-08T10:10:53
2018-09-08T10:10:53
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,985
py
#!/usr/bin/python3 """Contains the rectangle class""" class Rectangle: """A rectangle class""" number_of_instances = 0 def __init__(self, width=0, height=0): """Initilizes a rectangle""" self.width = width self.height = height Rectangle.number_of_instances += 1 def __del__(self): """Delete a rectangle""" print("Bye rectangle...") if Rectangle.number_of_instances != 0: Rectangle.number_of_instances -= 1 @property def width(self): """width property""" return self.__width @width.setter def width(self, width): """width setter""" if type(width) is not int: raise TypeError("width must be an integer") if width < 0: raise ValueError("width must be >= 0") self.__width = width @property def height(self): """height property""" return self.__height @height.setter def height(self, height): """height setter""" if type(height) is not int: raise TypeError("height must be an integer") if height < 0: raise ValueError("height must be >= 0") self.__height = height def __str__(self): """Returns rectangle str""" if self.width == 0 or self.height == 0: return "" string = "" for y in range(self.height - 1): string += '#' * self.width + '\n' string += '#' * self.width return string def __repr__(self): """Returns repr of the rectangle""" string = "Rectangle(" + str(self.width) + ", " + str(self.height) + ")" return string def area(self): """Returns area of a rectangle""" return self.height * self.width def perimeter(self): """Returns perimeter of a rectangle""" if self.height == 0 or self.width == 0: return 0 return self.height * 2 + self.width * 2
[ "sidneyriffic@gmail.com" ]
sidneyriffic@gmail.com
4d0c92e543eecad07812775d1c61c09793a91b41
4eb67371900b24faab41ca615612c41f78939bef
/stockpy_venv/Scripts/pip-script.py
28c9fc512610a5dbff315b2e8c74e484ab258a30
[]
no_license
CyborgVillager/ja_stock_pydjango
1670b8b48c238994cd7f604954b6d5f9176f1f8c
b352bc1d4d91e809ce8b34b7d85eb7f705b3e98c
refs/heads/master
2020-10-01T00:19:39.965922
2019-12-15T20:02:57
2019-12-15T20:02:57
227,406,481
0
0
null
null
null
null
UTF-8
Python
false
false
435
py
#!D:\PyProject\GitRespo\stock_pydjango\ja_stock_pydjango\stockpy_venv\Scripts\python.exe # EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip' __requires__ = 'pip==19.0.3' import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point('pip==19.0.3', 'console_scripts', 'pip')() )
[ "almawijonathan@gmail.com" ]
almawijonathan@gmail.com
50c67bed7ba721e1cbacce1759cd7d0a11a0e433
3da7f8a1fae54b4aa6f081e049e03ce28c0d7381
/venv/Lib/site-packages/pip/_vendor/urllib3/__init__.py
f05ac4feb8638484d1b140b92ec7e5b6b291bd7d
[]
no_license
1751605606/PersonalBlog
96259196848418be5344520dda4b94b28f4d85e0
29b364897075e0ea6ce358ce0041b5ce29262e32
refs/heads/master
2022-09-28T11:05:54.016739
2019-12-17T13:19:15
2019-12-17T13:19:15
222,211,569
1
0
null
2022-09-16T18:13:09
2019-11-17T07:17:04
Python
UTF-8
Python
false
false
2,683
py
""" urllib3 - Thread-safe connection pooling and re-using. """ from __future__ import absolute_import import warnings from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url from . import exceptions from .filepost import encode_multipart_formdata from .poolmanager import PoolManager, ProxyManager, proxy_from_url from .response import HTTPResponse from .util.request import make_headers from .util.url import get_host from .util.timeout import Timeout from .util.retry import Retry # Set default logging handler to avoid "No handler found" warnings. import logging from logging import NullHandler __author__ = "Andrey Petrov (andrey.petrov@shazow.net)" __license__ = "MIT" __version__ = "1.25.6" __all__ = ( "HTTPConnectionPool", "HTTPSConnectionPool", "PoolManager", "ProxyManager", "HTTPResponse", "Retry", "Timeout", "add_stderr_logger", "connection_from_url", "disable_warnings", "encode_multipart_formdata", "get_host", "make_headers", "proxy_from_url", ) logging.getLogger(__name__).addHandler(NullHandler()) def add_stderr_logger(level=logging.DEBUG): """ Helper for quickly adding a StreamHandler to the logger. Useful for debugging. Returns the handler after adding it. """ # This method needs to be in this __init__.py to get the __name__ correct # even if urllib3 is vendored within another package. logger = logging.getLogger(__name__) handler = logging.StreamHandler() handler.setFormatter(logging.Formatter("%(asctime)s %(levelname)s %(message)s")) logger.addHandler(handler) logger.setLevel(level) logger.debug("Added a stderr logging handler to logger: %s", __name__) return handler # ... Clean up. del NullHandler # All warning filters *must* be appended unless you're really certain that they # shouldn't be: otherwise, it's very hard for model to use most Python # mechanisms to silence them. # SecurityWarning's always go off by default. warnings.simplefilter("always", exceptions.SecurityWarning, append=True) # SubjectAltNameWarning's should go off once per host warnings.simplefilter("default", exceptions.SubjectAltNameWarning, append=True) # InsecurePlatformWarning's don't vary between requests, so we keep it default. warnings.simplefilter("default", exceptions.InsecurePlatformWarning, append=True) # SNIMissingWarnings should go off only once. warnings.simplefilter("default", exceptions.SNIMissingWarning, append=True) def disable_warnings(category=exceptions.HTTPWarning): """ Helper for quickly disabling all urllib3 warnings. """ warnings.simplefilter("ignore", category)
[ "16302010030@fudan.edu.cn" ]
16302010030@fudan.edu.cn
c56b4d049ae904203932b8be248c75f798ac22ab
2a6d385c7737aea3c6b49eef9252babb7557b909
/Scripts/submitDY.py
5ffaab269ea817873d6d083ec627f80c3c6dd808
[]
no_license
Sam-Harper/usercode
1b302a4b647e479d27a9501f9576bd04b07e111a
fa43427fac80d773978ea67b78be58d264f39ec8
refs/heads/120XNtup
2022-08-26T12:59:53.388853
2022-07-12T16:52:46
2022-07-12T16:52:46
15,675,175
1
11
null
2022-07-21T13:27:57
2014-01-06T13:54:22
Python
UTF-8
Python
false
false
3,154
py
#!/usr/bin/env python import threading import subprocess class JobThread (threading.Thread): def __init__(self, cmds): threading.Thread.__init__(self) self.cmds=cmds.split() self.stdout=None self.stderr=None def run(self): # print self.cmds, import subprocess self.stdout,self.stderr = subprocess.Popen(self.cmds,stdout=subprocess.PIPE,stderr=subprocess.PIPE).communicate() import argparse import os parser = argparse.ArgumentParser(description='submits CMSSW jobs to RAL batch system') parser.add_argument('--config',help='cmsRun config file to run',required=True) #parser.add_argument('--output',help='output filebase name, defaults to outputDir+.root',default=None) parser.add_argument('--outputDir',help='ouput dir (under scratch/mc/CMSSWVersion/<outputdir>',required=True) parser.add_argument('--baseOutDir',help='base output directory',default="mc") args = parser.parse_args() inputFiles=[ "ZToEE_NNPDF30_13TeV-powheg_M_120_200_RunIISpring16DR80-PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v1_RAWAODSIM.list", "ZToEE_NNPDF30_13TeV-powheg_M_200_400_RunIISpring16DR80-PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v1_RAWAODSIM.list", "ZToEE_NNPDF30_13TeV-powheg_M_400_800_RunIISpring16DR80-PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v1_RAWAODSIM.list", "ZToEE_NNPDF30_13TeV-powheg_M_800_1400_RunIISpring16DR80-PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v1_RAWAODSIM.list", "ZToEE_NNPDF30_13TeV-powheg_M_1400_2300_RunIISpring16DR80-PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v1_RAWAODSIM.list", "ZToEE_NNPDF30_13TeV-powheg_M_2300_3500_RunIISpring16DR80-PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v5_RAWAODSIM.list", "ZToEE_NNPDF30_13TeV-powheg_M_3500_4500_RunIISpring16DR80-PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v1_RAWAODSIM.list", "ZToEE_NNPDF30_13TeV-powheg_M_4500_6000_RunIISpring16DR80-PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v1_RAWAODSIM.list", "ZToEE_NNPDF30_13TeV-powheg_M_6000_Inf_RunIISpring16DR80-PUSpring16RAWAODSIM_80X_mcRun2_asymptotic_2016_v3-v1_RAWAODSIM.list"] baseDir="/opt/ppd/scratch/harper" baseOutputDir=baseDir+"/"+args.baseOutDir cmsswVersion=os.environ['CMSSW_VERSION'] fullOutputDir=baseOutputDir+"/"+cmsswVersion.split("CMSSW_")[1]+"/"+args.outputDir if os.path.exists(fullOutputDir): print "output directory ",fullOutputDir," exists, aborting " exit(1) os.makedirs(fullOutputDir) threads=[] for filelist in inputFiles: outputFilename=fullOutputDir.rstrip("/")+"/"+filelist.split("_RunIISpring16")[0]+"_ntup_SHv29pre2.root" cmd="cmsRun %s %s %s" % (args.config,filelist,outputFilename) threads.append(JobThread(cmd)) for thread in threads: thread.start() while(len(threads)!=0): for thread in threads: if not thread.isAlive(): print "job","finished" # print thread.cmds print thread.stdout print thread.stderr threads.remove(thread) print "all jobs done"
[ "sam.j.harper@gmail.com" ]
sam.j.harper@gmail.com
fb30adb175d3b157046e8a351c35bbae75a1518a
af41c215f420bbd66067d6dc851ce41d9ed40819
/CRBM/CRBM_linBin.py
37486616144c92d247cebe64ad8654224778066e
[]
no_license
danathughes/pyNeuralNetwork
b704f525bddbc64eabf33c1174dad0649be7bfd9
dbe2090e50434f33ac7a46845ad67eb5dc7dea87
refs/heads/master
2021-01-01T16:30:47.781646
2016-01-27T23:11:51
2016-01-27T23:11:51
19,729,930
0
4
null
2015-02-27T22:22:18
2014-05-13T07:32:24
Python
UTF-8
Python
false
false
4,365
py
import numpy as np import random import copy class CRBM: """ """ def __init__(self, num_visible, num_hidden): """ """ self.num_visible = num_visible self.num_hidden = num_hidden # Weights is a matrix representing the weights between visible units # (rows) and hidden unit (columns) # Biases are column vectors with the number of hidden or visible units self.weights = np.zeros((num_visible, num_hidden)) self.bias_visible = np.zeros((num_visible, 1)) self.bias_hidden = np.zeros((num_hidden, 1)) self.A_visible = np.ones((num_visible, 1)) self.sigma = 1.0 self.lo = 0.0 self.hi = 1.0 self.randomize_weights_and_biases(0.1) def randomize_weights_and_biases(self, value_range = 1): """ Set all weights and biases to a value between [-range/2 and range/2] """ for i in range(self.num_visible): for j in range(self.num_hidden): self.weights[i,j] = value_range*random.random() - value_range/2 for i in range(self.num_visible): self.bias_visible[i,0] = value_range*random.random() - value_range/2 for i in range(self.num_hidden): self.bias_hidden[i,0] = value_range*random.random() - value_range/2 def sigmoid(self, z, A): """ """ return self.lo + (self.hi-self.lo) / (1.0 + np.exp(-A*z)) def binSigmoid(self, z): """ """ return 1.0 / (1.0 + np.exp(-z)) def sample_visible(self, hidden): """ Generate a sample of the visible layer given the hidden layer. """ v = np.dot(self.weights, hidden) + self.bias_visible v += np.random.normal(0,self.sigma, (self.num_visible, 1)) return self.sigmoid(v, self.A_visible) def get_probability_hidden(self, visible): """ Returns the probability of setting hidden units to 1, given the visible unit. """ # h = sigmoid(W'v + c) return self.binSigmoid(np.dot(self.weights.transpose(), visible) + self.bias_hidden) def sample_hidden(self, visible): """ Generate a sample of the hidden layer given the visible layer. """ P_hidden = self.get_probability_hidden(visible) h_sample = [1.0 if random.random() < p else 0.0 for p in P_hidden] return np.array([h_sample]).transpose() def contrastive_divergence(self, v0, k=1): """ Perform CD-k for the given data point """ # Calculate an h0 given the v0 h0 = self.sample_hidden(v0) # We'll need to iteratively sample to get the next values. We'll start # with k=0 and iterate vk = v0 hk = h0 # Now calculate vk and hk for i in range(k): vk = self.sample_visible(hk) hk = self.sample_hidden(vk) # Compute positive and negative as the outer product of these positive = np.dot(v0, h0.transpose()) negative = np.dot(vk, hk.transpose()) # Calculate the delta-weight and delta-biases delta_weights = positive - negative delta_visible_bias = v0 - vk delta_hidden_bias = h0 - hk delta_A_visible = v0*v0 - vk*vk # Return these--let the learning rule handle them return delta_weights, delta_visible_bias, delta_hidden_bias, delta_A_visible def train_epoch(self, dataset, learning_rate = 0.5, k = 1): """ """ total_err = 0.0 dW = np.zeros(self.weights.shape) dB_vis = np.zeros(self.bias_visible.shape) dB_hid = np.zeros(self.bias_hidden.shape) dA_vis = np.zeros(self.A_visible.shape) for data in dataset: dw, db_vis, db_hid, da_vis = self.contrastive_divergence(np.array([data]).transpose(), k) dW = dW + dw dB_vis = dB_vis + db_vis dB_hid = dB_hid + db_hid dA_vis = dA_vis + da_vis total_err += np.sum(db_vis*db_vis) dW = dW / len(dataset) dB_vis = dB_vis / len(dataset) dB_hid = dB_hid / len(dataset) dA_vis = dA_vis / len(dataset) self.weights = self.weights + learning_rate*dW self.bias_hidden = self.bias_hidden + learning_rate*dB_hid self.bias_visible = self.bias_visible + learning_rate*dB_vis self.A_visible = self.A_visible + learning_rate*dA_vis/(self.A_visible*self.A_visible) return total_err / len(dataset)
[ "danathughes@gmail.com" ]
danathughes@gmail.com
9f8789fccf3df008ae84be98d9f9d1eaa6a2e518
2952677aeb4ab4765fd0b588b8cf2a9f58408f3a
/requests/create_geo_objects.py
22ffb604598aab36bd4d8167fbbfba21747d74b4
[]
no_license
VToropov1337/MA
a60c69110a557a744a1b1a949d4dbcfc1d2ca8aa
823c204154f973ded50b62ab2104358f5b2c7131
refs/heads/master
2020-03-20T21:58:45.039951
2019-06-27T18:24:35
2019-06-27T18:24:35
137,772,268
0
0
null
null
null
null
UTF-8
Python
false
false
2,209
py
import requests import json import pandas as pd COL = ['title', 'comment', 'country', 'region', 'city', 'street', 'house', 'ltd', 'lgt', 'address', 'territory', 'metro_city', 'metro_competitor', 'problematical', 'at_code', 'category_id', 'regional_category_id'] token = '***' params = {'Content-Type': 'application/json; charset=utf-8', 'X-Authentication-Token': token} base_url = 'https://***/api/***/***/***/***' # создание 1 тт create = '/geo_objects' def check_file(filename): dataframe = pd.read_excel(filename,sheet_name=0) if list(dataframe.columns) == COL: return dataframe else: raise BaseException('Проверь названия колонок и их порядок') df = check_file('geo_objects.xlsx') df = df.fillna('') data = dict() for i in range(len(df)): data[i] = { "title": df['title'].iloc[i], "comment": df['comment'].iloc[i], "city": df['city'].iloc[i], "address":df['address'].iloc[i], "territory": df['territory'].iloc[i], "metro_city": df['metro_city'].iloc[i], "metro_competitor": df['metro_competitor'].iloc[i], "problematical": str(df['problematical'].iloc[i]).capitalize(), "at_code": df['at_code'].iloc[i], "category_id": df['category_id'].iloc[i], "regional_category_id": df['regional_category_id'].iloc[i] } # print(data) for i in data.keys(): r = requests.post(base_url + create, headers=params, data=json.dumps({"geo_object": { "title": str(data[i]['title']), "comment": str(data[i]['comment']), "city": str(data[i]['city']), "address": str(data[i]['address']), "territory": str(data[i]['territory']), "metro_city": str(data[i]['metro_city']), "metro_competitor": str(data[i]['metro_competitor']), "problematical": str(data[i]['problematical']), "at_code": str(data[i]['at_code']), "category_id": int(data[i]['category_id']), "regional_category_id": int(data[i]['regional_category_id']) }})) print(r.text) print(r)
[ "vladimirtoropov87@gmail.com" ]
vladimirtoropov87@gmail.com
d75a7d8956bc4a6db76ca03519d33c3abfa7d77d
5504bdf5045343145d962537a39fcf4adb823d9b
/simplesocial/posts/models.py
ce20fbee2474320cef8fcfe6b02fac8ceec8f611
[]
no_license
haruyasu/django-deployment-social
f3df16b67ed96175a23537bdb004eaa51510ac61
e4cb3ac2b88ce76d17ec3b6d18686966d5e33673
refs/heads/master
2021-08-23T03:43:53.213940
2017-12-03T01:18:11
2017-12-03T01:18:11
112,890,239
0
0
null
null
null
null
UTF-8
Python
false
false
963
py
from django.db import models from django.core.urlresolvers import reverse from django.conf import settings import misaka from groups.models import Group # Create your models here. from django.contrib.auth import get_user_model User = get_user_model() class Post(models.Model): user = models.ForeignKey(User,related_name='posts') created_at = models.DateTimeField(auto_now=True) message = models.TextField() message_html = models.TextField(editable=False) group = models.ForeignKey(Group, related_name='posts', null=True, blank=True) def __str__(self): return self.message def save(self, *args, **kwargs): self.message_html = misaka.html(self.message) super().save(*args, **kwargs) def get_absolute_url(self): return reverse('posts:single', kwargs={'username':self.user.username, 'pk':self.pk}) class Meta: ordering = ['-created_at'] unique_together = ['user', 'message']
[ "harukun2002@gmail.com" ]
harukun2002@gmail.com
c445921ea9533fb28a3bb8e2efc58bb3c23255fd
163bbb4e0920dedd5941e3edfb2d8706ba75627d
/Code/CodeRecords/2880/61020/248415.py
1e2294e028de52f931cc843ec994906932c8770c
[]
no_license
AdamZhouSE/pythonHomework
a25c120b03a158d60aaa9fdc5fb203b1bb377a19
ffc5606817a666aa6241cfab27364326f5c066ff
refs/heads/master
2022-11-24T08:05:22.122011
2020-07-28T16:21:24
2020-07-28T16:21:24
259,576,640
2
1
null
null
null
null
UTF-8
Python
false
false
533
py
import os import sys s = input() n = int(s[0:1]) k = int(s[2:3]) ''' 8 4 4 2 3 1 5 1 6 4''' weight_list = input().split() for i in range(0, len(weight_list)): weight_list[i] = int(weight_list[i]) left_index = 0 while (left_index < len(weight_list)) and (weight_list[left_index] <= k): left_index += 1 if left_index == len(weight_list): print(n) # os._exit() sys.exit(0) right_index = len(weight_list) - 1 while weight_list[right_index] <= k: right_index -= 1 print(n - (right_index - left_index + 1))
[ "1069583789@qq.com" ]
1069583789@qq.com
fb5ab7fefb1602942552482e3abcdb141674b869
0c9ec5d4bafca45505f77cbd3961f4aff5c10238
/openapi-python-client/test/test_version_dto.py
42e411d4b0a5c74d862fd2bbd0bb770eb27d12b8
[ "Apache-2.0" ]
permissive
yanavasileva/camunda-bpm-examples
98cd2930f5c8df11a56bf04845a8ada5b3bb542d
051f8f28c62845e68ce4059ab64264c5a0bdc009
refs/heads/master
2022-10-19T20:07:21.278160
2020-05-27T15:28:27
2020-05-27T15:28:27
267,320,400
0
0
Apache-2.0
2020-05-27T14:35:22
2020-05-27T13:00:01
null
UTF-8
Python
false
false
1,309
py
# coding: utf-8 """ Camunda BPM REST API OpenApi Spec for Camunda BPM REST API. # noqa: E501 The version of the OpenAPI document: 7.13.0 Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import unittest import datetime import openapi_client from openapi_client.models.version_dto import VersionDto # noqa: E501 from openapi_client.rest import ApiException class TestVersionDto(unittest.TestCase): """VersionDto unit test stubs""" def setUp(self): pass def tearDown(self): pass def make_instance(self, include_optional): """Test VersionDto include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # model = openapi_client.models.version_dto.VersionDto() # noqa: E501 if include_optional : return VersionDto( version = '0' ) else : return VersionDto( ) def testVersionDto(self): """Test VersionDto""" inst_req_only = self.make_instance(include_optional=False) inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main()
[ "noreply@github.com" ]
yanavasileva.noreply@github.com
5357c9994f096c88200299181ed677f3cdcb2aa4
75275e1cd5ef1a5dddd5fdcb82db03fdf1b609d3
/lib/ansible/modules/cloud/alicloud/alicloud_vswitch_facts.py
561d125b8647854e88f68e032792d213c1b52967
[ "Apache-2.0" ]
permissive
jumping/ansible-provider
bc8b2bc51aa422de89d255ba1208ba8e8ae8f0be
067ce1aa4277720bc481c2ba08e3d1b408b8f13c
refs/heads/master
2020-03-13T21:30:50.287049
2018-04-27T13:12:23
2018-04-27T13:12:23
131,297,789
0
0
Apache-2.0
2018-04-27T13:12:24
2018-04-27T13:07:37
Python
UTF-8
Python
false
false
7,048
py
#!/usr/bin/python # Copyright (c) 2017 Alibaba Group Holding Limited. He Guimin <heguimin36@163.com.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # # This file is part of Ansible # # Ansible 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. # # Ansible is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Ansible. If not, see http://www.gnu.org/licenses/. from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: alicloud_vswitch_facts version_added: "2.4" short_description: Gather facts on vswitchs of Alibaba Cloud. description: - This module fetches data from the Open API in Alicloud. The module must be called from within the vswitch itself. options: vpc_id: description: - A vpc id to list vswitches in specified vpc. required: true aliases: ["id"] vswitch_ids: required: false description: - A list of vswitch ids. author: - "He Guimin (@xiaozhu36)" requirements: - "python >= 2.6" - "footmark" extends_documentation_fragment: - alicloud ''' EXAMPLES = ''' # Fetch vswitch details according to setting different filters - name: Fetch vswitch details example hosts: localhost vars: alicloud_access_key: <your-alicloud-access-key> alicloud_secret_key: <your-alicloud-secret-key> alicloud_region: cn-beijing vpc_id: xxxxxxxxxxxxx vswitch_ids: - xxxxxxxxxxxxx - xxxxxxxxxxxxx tasks: - name: Find all vswitches in the specified vpc alicloud_vswitch_facts: alicloud_access_key: '{{ alicloud_access_key }}' alicloud_secret_key: '{{ alicloud_secret_key }}' alicloud_region: '{{ alicloud_region }}' vpc_id: '{{ vpc_id }}' register: vswitch_by_vpc - debug: var=vswitch_by_vpc - name: Find all vswitches in the specified vpc by vswitch_ids alicloud_vswitch_facts: alicloud_access_key: '{{ alicloud_access_key }}' alicloud_secret_key: '{{ alicloud_secret_key }}' alicloud_region: '{{ alicloud_region }}' vpc_id: '{{ vpc_id }}' vswitch_ids: '{{ vswitch_ids }}' register: vswich_by_vswitch_ids - debug: var=vswich_by_vswitch_ids ''' RETURN = ''' vpc_id: description: vpc_id to list all vswitch in specified vpc. returned: when success type: string sample: "vpc-2zegusms7jwd94lq7ix8o" vswitch_ids: description: List all vswitch's id after operating vswitch. returned: when success type: list sample: [ "vsw-2zepee91iv5sl6tg85xnl", "vsw-2zeuo4b8jx8tdg9esy8m7" ] vswitchs: description: Details about the vswitchs that were created. returned: when success type: list sample: [ { "available_ip_address_count": 4091, "cidr_block": "172.17.128.0/20", "description": "System created default virtual switch.", "is_default": true, "region": "cn-beijing", "status": "Available", "tags": {}, "vpc_id": "vpc-2zegusms7jwd94lq7ix8o", "vswitch_id": "vsw-2zepee91iv5sl6tg85xnl", "vswitch_name": "", "zone_id": "cn-beijing-e" }, { "available_ip_address_count": 4092, "cidr_block": "172.17.144.0/20", "description": "System created default virtual switch.", "is_default": true, "region": "cn-beijing", "status": "Available", "tags": {}, "vpc_id": "vpc-2zegusms7jwd94lq7ix8o", "vswitch_id": "vsw-2zeuo4b8jx8tdg9esy8m7", "vswitch_name": "", "zone_id": "cn-beijing-c" } ] total: description: The number of all vswitchs after operating vpc. returned: when success type: int sample: 2 ''' from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.alicloud_ecs import ecs_argument_spec, vpc_connect HAS_FOOTMARK = False try: from footmark.exception import VPCResponseError HAS_FOOTMARK = True except ImportError: HAS_FOOTMARK = False def get_info(vswitch): """ Retrieves vswitch information from an vswitch ID and returns it as a dictionary """ return { 'available_ip_address_count': vswitch.available_ip_address_count, 'cidr_block': vswitch.cidr_block, 'description': vswitch.description, 'is_default': vswitch.is_default, 'region': vswitch.region, 'status': vswitch.status, 'tags': vswitch.tags, 'vpc_id': vswitch.vpc_id, 'vswitch_id': vswitch.vswitch_id, 'vswitch_name': vswitch.vswitch_name, 'zone_id': vswitch.zone_id } def main(): argument_spec = ecs_argument_spec() argument_spec.update(dict( alicloud_zone=dict(aliases=['acs_zone', 'ecs_zone', 'zone_id', 'zone']), vpc_id=dict(required=True, aliases=['id']), vswitch_ids=dict(type='list') ) ) module = AnsibleModule(argument_spec=argument_spec) if HAS_FOOTMARK is False: module.fail_json(msg="Package 'footmark' required for this module.") result = [] zone_id = module.params['alicloud_zone'] vpc_id = module.params['vpc_id'] vswitch_ids = module.params['vswitch_ids'] if vswitch_ids and (not isinstance(vswitch_ids, list) or len(vswitch_ids)) < 1: module.fail_json(msg='vswitch_ids should be a list of vswitch id, aborting') try: vpc_conn = vpc_connect(module) # list all vswitches by vswitch ids if vswitch_ids: for vswitch_id in vswitch_ids: vswitchs = vpc_conn.get_all_vswitches(vpc_id=vpc_id, vswitch_id=vswitch_id, zone_id=zone_id) if vswitchs and len(vswitchs) == 1: result.append(get_info(vswitchs[0])) # list all vswitches in specified vpc else: vswitchs = vpc_conn.get_all_vswitches(vpc_id=vpc_id) vswitch_ids = [] for vswitch in vswitchs: vswitch_ids.append(vswitch.vswitch_id) result.append(get_info(vswitch)) except Exception as e: module.fail_json(msg=str("Unable to describe vswitch, error:{0}".format(e))) module.exit_json(changed=False, vpc_id=vpc_id, vswitch_ids=vswitch_ids, vswitchs=result, total=len(result)) if __name__ == '__main__': main()
[ "guimin.hgm@alibaba-inc.com" ]
guimin.hgm@alibaba-inc.com
93e90f8008b9eb70c05f3db8771a4a04c3ee4d08
643e4cf0a3fe3a3ab04cf584b97e38b4838e4e1d
/1.2.2_[T.S].py
7abc50bd411c7b5bf73393a0ff90c5a3264cd8e8
[]
no_license
riley-csp-2019-20/1-2-2-catch-a-turtle-leaderboard-tiffany85615
188e86ba3a6b85a669321c431305edc702ce5866
20ef11e6aafcf1e87d676aa1a2459bf443888791
refs/heads/master
2020-08-31T22:19:17.319740
2019-11-08T15:59:14
2019-11-08T15:59:14
218,799,571
0
0
null
null
null
null
UTF-8
Python
false
false
2,808
py
# a121_catch_a_turtle.py #-----import statements----- import turtle as trtl import random import leaderboard as lb #-----game configuration---- shape = "turtle" size = 10 color = "orange" score = 0 timer = 5 counter_interval = 1000 #1000 represents 1 second timer_up = False #leaderboard variables leaderboard_file_name = "a122_leaderboard.txt" leader_names_list = [] leader_scores_list = [] player_name = input("Please enter your name:") #-----initialize turtle----- dude = trtl.Turtle(shape = shape) dude.color(color) dude.shapesize(size) writer = trtl.Turtle() writer.shapesize(2) writer.color("green") writer.penup() writer.goto(-270, 330) font = ("Arial", 30, "bold") writer.write(score, font = font) writer.ht() counter = trtl.Turtle() counter.up() counter.goto(250,310) counter.ht() #-----game functions-------- def turtle_clicked(x,y): print("dude was clicked") change_position() score_counter() # this is my customization size_down() '''colors = {"red","orange", "yellow", "green","blue","purple"}''' def change_position(): dude.penup() dude.ht() new_xpos = random.randint(-400, 400) new_ypos = random.randint(-300, 300) dude.goto(new_xpos, new_ypos) dude.showturtle() def score_counter(): global score score += 1 print(score) writer.write(score,font = font) writer.clear() writer.write(score, font = font) def countdown(): global timer, timer_up counter.clear() if timer <= 0: game_end() timer_up = True manage_leaderboard() else: counter.write("Timer: " + str(timer), font = font) timer -= 1 counter.getscreen().ontimer(countdown, counter_interval) def game_end(): dude.ht() dude.goto(500,500) counter.goto(0,0) counter.write("Time's Up", font = font) wn.bgcolor("red") def size_down(): global size size -= 1 dude.shapesize(size) # manages the leaderboard for top 5 scorers def manage_leaderboard(): global leader_scores_list global leader_names_list global score global dude # load all the leaderboard records into the lists lb.load_leaderboard(leaderboard_file_name, leader_names_list, leader_scores_list) # TODO if (len(leader_scores_list) < 5 or score > leader_scores_list[4]): lb.update_leaderboard(leaderboard_file_name, leader_names_list, leader_scores_list, player_name, score) lb.draw_leaderboard(leader_names_list, leader_scores_list, True, dude, score) else: lb.draw_leaderboard(leader_names_list, leader_scores_list, False, dude, score) #-----events---------------- dude.onclick(turtle_clicked) wn = trtl.Screen() wn.ontimer(countdown, counter_interval) wn.mainloop()
[ "noreply@github.com" ]
riley-csp-2019-20.noreply@github.com
83d75d742cdf7f8b7d4970dff0532f6e23253ee2
171179bbef63781fa55ffe94bd33868578272db0
/prog/lu.py
83a4dca99e822dc012b36010c749e84aba2dfab5
[]
no_license
nineties/math-seminar
9a038a4fb88bbcb2fbc2456860a3bd88b99ca10e
51bbc071aa46418abf525969391a502312867c08
refs/heads/master
2020-04-16T16:36:22.207459
2018-09-12T22:41:08
2018-09-12T22:41:08
12,613,664
14
7
null
2019-11-08T12:10:17
2013-09-05T09:06:37
HTML
UTF-8
Python
false
false
659
py
# -*- coding: utf-8 -*- import numpy as np def lu(A): A = np.copy(A) # 作業用 n = A.shape[0] L = np.identity(n, dtype=float) # 対角行列 U = np.zeros((n,n), dtype=float) # 零行列 for k in xrange(n): U[k,k] = A[k,k] for i in xrange(k+1,n): U[k,i] = A[k,i] L[i,k] = A[i,k]/A[k,k] for i in xrange(k+1,n): for j in xrange(k+1,n): A[i,j] -= L[i,k] * U[k,j] return (L, U) A = np.array([[4, 5, 1, 9], [2, 1, 3, 1], [3, 1, 5, 3], [-2, 1, 4, 3]], dtype=float) L,U = lu(A) print "A=\n",A print "L=\n",L print "U=\n",U print "LU=\n", np.dot(L, U)
[ "nineties48@gmail.com" ]
nineties48@gmail.com
16d7ba3880938e774a1bd1213fd7bd46d6db8316
81529f3d8570db42218b9420fe82ddc3ec7820b6
/15-exercises/stochastic_gradient_descent_two.py
15e114c355202edec727a4eb39980aeb15544444
[]
no_license
rileyL6122428/data-science-from-scratch-notes
f10770030fbdd5062de0477b8997cd33b5acf1e6
8202442024a502b13d0b462c398b2dcb74712e38
refs/heads/master
2020-07-13T10:25:39.318516
2019-08-29T02:45:33
2019-08-29T02:45:33
205,064,746
0
0
null
null
null
null
UTF-8
Python
false
false
3,071
py
import random import pdb # USUALLY, ERROR FUNCTIONS FOR GRADIENT DESCENT PROBLEMS ARE ADDITIVE # WHICH MEANS THE PREDICTIVE ERROR ON THE WHOLE DATA SET IS SIMPLY THE SUM # OF THE PREDICTIVE ERRORS FOR EACH DATA POINT # STOCHASTIC GRADIENT DESCENT: # COMPUTES THE GRADIENT OF A SINGLE DATA POINT AND TAKES A STEP # IT CYCLES OVER OUR DATA REPEATEDLY UNTIL IT REACHES A STOPPING POINT def random_order(data): indexes = [ index for index, _ in enumerate(data) ] random.shuffle(indexes) for index in indexes: yield data[index] def vector_subtract(vector_a, vector_b): return [ component_a - component_b for component_a, component_b in zip(vector_a, vector_b) ] def scalar_multiply(scalar, vector): return [ scalar * component for component in vector ] def minimize_stochastic(target_fn, gradient_fn, xs, ys, theta_0, alpha_0=0.01): data = list(zip(xs, ys)) theta = theta_0 alpha = alpha_0 min_theta, min_value = None, float('inf') iterations_with_no_improvement = 0 print('theta_0 = %s' % theta_0) while iterations_with_no_improvement < 100: value = sum( target_fn(x_i, y_i, theta) for x_i, y_i in data ) if value < min_value: print('next_theta = %s' % theta) min_theta, min_value = theta, value iterations_with_no_improvement = 0 alpha = alpha_0 else: iterations_with_no_improvement += 1 print('iterations_with_no_improvement = %s' % iterations_with_no_improvement) alpha *= 0.9 for x_i, y_i in random_order(data): gradient_i = gradient_fn(x_i, y_i, theta) theta = vector_subtract(theta, scalar_multiply(alpha, gradient_i)) return min_theta def negate(func): return lambda *args, **kwargs : -func(*args, **kwargs) def negate_all(func): return lambda *args, **kwargs : [ -y for y in func(*args, **kwargs) ] def maximize_stochastic(target_func, gradient_func, x, y, theta_0, tolerance=0.01): return minimize_stochastic( negate(target_func), negate_all(gradient_func), x, y, theta_0, tolerance ) # TEST STOCHASTIC GRADIENT DESCENT from simple_linear_regression import error from pokemon_trainer_data import trainer_pokemon_counts, trainer_win_counts def squared_error(x_i, y_i, theta): alpha, beta = theta return error(alpha, beta, x_i, y_i) def squared_error_gradient(x_i, y_i, theta): alpha, beta, = theta return [ -2 * error(alpha, beta, x_i, y_i), # alpha partial derivative -2 * error(alpha, beta, x_i, y_i) * x_i # beta partial derivative ] # theta = [ random.random() - 0.5, random.random() - 0.5 ] # alpha, beta = minimize_stochastic( # squared_error, # squared_error_gradient, # trainer_pokemon_counts, # trainer_win_counts, # theta, # 0.001 # ) # print('stochastic alpha = %s' % alpha) # print('stochastic beta = %s' % beta)
[ "rileylittlefield@ymail.com" ]
rileylittlefield@ymail.com
7937369f1aa7ea27e2c1bfb5fe1d8b91569a4c89
3fa149cfcdd8ec56d51cf99a16cbf3afbd9b1266
/django/mysite/blog/views.py
2f789f2fc7fa924fcdb58c4d500f5c19f37ec596
[]
no_license
leinian85/project
045ec90475b012063624151d604d9148d2d8c948
c2463da30cbdda8c35a557048988260e62212d08
refs/heads/master
2020-07-06T16:44:42.993050
2019-11-04T06:44:41
2019-11-04T06:44:41
203,082,284
0
0
null
null
null
null
UTF-8
Python
false
false
3,136
py
from django.shortcuts import render from django.http import HttpResponseRedirect from . import models def index(request): return render(request,"blog/index.html") def list(request): return render(request, "blog/list.html") def mypic(request): return render(request, "blog/mypic.html") def login(request): if request.method == "GET": username = request.COOKIES.get("username","") return render(request, "blog/login.html",locals()) elif request.method == "POST": username = request.POST.get("username") if username == "": user_error = "用户名不能为空" return render(request, "blog/login.html", locals()) password = request.POST.get("password") if password == "": password_error = "密码不能为空" return render(request, "blog/login.html", locals()) try: user = models.User.objects.get(name = username,password = password) request.session["user"] = { "username" : user.name, "id": user.id, } # reps = render(request, "blog/index.html", locals()) # if "remember" in request.POST: # reps.set_cookie("username",username) # # return reps reps = HttpResponseRedirect("/blog/index") reps.set_cookie("username",username) return reps except: password_error = "用户名或密码不正确" return render(request, "blog/login.html", locals()) def regist(request): if request.method == "GET": return render(request, "blog/regist.html") elif request.method == "POST": username = request.POST.get("username") password1 = request.POST.get("password1") password2 = request.POST.get("password2") if len(username)<6: user_error = "用户名太短" return render(request, "blog/regist.html", locals()) if len(password1) == 0: password1_error = "密码不能为空" return render(request, "blog/regist.html", locals()) if len(password2) == 0: password2_error = "密码不能为空" return render(request, "blog/regist.html", locals()) if password1 != password2: password2_error = "两次密码不一致" password1 = password2 = "" return render(request, "blog/regist.html", locals()) try: user = models.User.objects.get(name = username) user_error = "用户已存在" return render(request, "blog/regist.html", locals()) except Exception as e: user = models.User.objects.create( name=username, password = password1 ) msg = "注册成功!" request.session["user"] = {"username":username} return render(request, "blog/ok.html", locals()) def logout(request): if "user" in request.session: del request.session["user"] return render(request, "blog/index.html", locals())
[ "42737521@qq.com" ]
42737521@qq.com
2863c98cb8176410c703c0fd4c2af26245e0829a
ac3db86631a4ab6fd9ef0d1397ccd842cef957fa
/blocks/eyeBlocks/timecomponent.py
14a3c47580776b1a3ce2feb4754be17b0ad1e669
[ "MIT" ]
permissive
csparkresearch/ExpEYES17-Qt
57f5e19196bfd7a04454c0708c33d6eccd36e1e1
7a3bdc0df19569c0321434d8fd897439b1854fb1
refs/heads/master
2020-12-31T00:30:42.669312
2018-04-19T11:11:39
2018-04-19T11:11:39
86,545,764
1
4
null
2017-07-21T10:00:39
2017-03-29T06:22:12
Python
UTF-8
Python
false
false
2,722
py
# -*- coding: utf-8; mode: python; indent-tabs-mode: t; tab-width:4 -*- ############################################################################ # # Copyright (C) 2017 Georges Khaznadar <georgesk@debian.org> # # # This file may be used under the terms of the GNU General Public # License version 3.0 as published by the Free Software Foundation, # or, at your preference, any later verion of the same. # # This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE # WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. # ############################################################################ from __future__ import print_function from PyQt4 import QtCore, QtGui from component import InputComponent, Component def _translate(context, text, disambig): return QtGui.QApplication.translate(context, unicode(text), disambig) class TimeComponent(InputComponent): """ A component to implement a time base for an oscilloscope """ # standard numbers of points np = [11, 101, 501, 1001, 2001] def __init__(*args,**kw): InputComponent.__init__(*args,**kw) self=args[0] self.initDefaults() for a in ("npoints","delay","duration"): if a in kw: setattribute(self, a, kw[a]) def __str__(self): result=super(self.__class__,self).__str__() result+="\n npoints = %s delay = %s duration = %s" %(self.npoints, self.delay, self.duration) return result def initDefaults(self): self.npoints = TimeComponent.np[2] self.delay = 1000 # µs self.duration = (self.npoints-1)*self.delay def draw(self, painter): super(TimeComponent, self).draw(painter) lh=12 # lineheight x=10;y=15 pos=self.rect.topLeft() titlePos=pos+QtCore.QPoint(x,y) x=15; y+=lh delayPos=pos+QtCore.QPoint(x,y) y+=lh durationPos=pos+QtCore.QPoint(x,y) y+=lh pointsPos=pos+QtCore.QPoint(x,y) painter.drawText(titlePos,_translate("eyeBlocks.timecomponent","Time Base",None)) painter.drawText(delayPos,_translate("eyeBlocks.timecomponent","delay: %1 s",None).arg(self.delay/1e6)) painter.drawText(durationPos,_translate("eyeBlocks.timecomponent","duration: %1 s",None) .arg(self.duration/1e6)) painter.drawText(pointsPos,_translate("eyeBlocks.timecomponent","(%1 points)",None).arg(self.npoints)) def getMoreData(self, dataStream): delay=QtCore.QVariant() duration=QtCore.QVariant() npoints=QtCore.QVariant() dataStream >> delay >> duration >> npoints self.delay, report=delay.toInt() self.duration, report=delay.toInt() self.npoints, report=npoints.toInt() return def putMoreData(self, dataStream): dataStream << QtCore.QVariant(self.delay) << QtCore.QVariant(self.duration) << QtCore.QVariant(self.npoints) return
[ "georgesk@debian.org" ]
georgesk@debian.org
3fb4f0e2850f32ab1f80edb8ed59569c4b953632
84a5c4c2e0977d42425771098f5f881c750da7f0
/neomodel_constraints/fetcher/constraints/__init__.py
73fec18b7981f1156387bb109741685f95637d1e
[]
no_license
SSripilaipong/neomodel-constraints
6c3023ba156275e48f5f7ebcbdd283ce8d41f9a1
4b91185ba9eec993c58e9ae770fd3d0e90f915ae
refs/heads/main
2023-07-15T09:58:41.451631
2021-08-29T13:19:38
2021-08-29T13:19:38
390,312,509
1
0
null
null
null
null
UTF-8
Python
false
false
128
py
from .data import Neo4jConstraintQueryRecord from .fetcher import get_constraints_fetcher from . import v4_2 from . import v4_1
[ "santhapon.s@siametrics.com" ]
santhapon.s@siametrics.com
89e30a2a6763156d76c6422ce8f501062ff571fe
bfe6c95fa8a2aae3c3998bd59555583fed72900a
/reverseLeftWords.py
1e01e7b90c6730cb62f2249769eedb64f27917b7
[]
no_license
zzz136454872/leetcode
f9534016388a1ba010599f4771c08a55748694b2
b5ea6c21bff317884bdb3d7e873aa159b8c30215
refs/heads/master
2023-09-01T17:26:57.624117
2023-08-29T03:18:56
2023-08-29T03:18:56
240,464,565
0
0
null
null
null
null
UTF-8
Python
false
false
99
py
class Solution: def reverseLeftWords(self, s: str, n: int) -> str: return s[n:]+s[:n]
[ "zzz136454872@163.com" ]
zzz136454872@163.com
a1f7908d567bac4f484b55effb0cccdaf55518bb
83df1fb88f7abba1198284bb4b8dc8d0a7ff6f93
/src/tools/telemetry/telemetry/internal/backends/chrome/android_browser_finder.py
6958262d5084870fa2bc43a01507674f3049ebeb
[]
no_license
JamshedVesuna/telemetry
7f3385399e47b7b98f8d3eec80ade43690956cd7
1697886b155f22a42e13aa311538f1db65e6e6ed
refs/heads/master
2021-01-20T09:12:34.645395
2016-01-22T08:40:44
2016-01-22T08:40:44
47,851,831
3
2
null
2020-07-24T04:58:51
2015-12-11T21:25:59
HTML
UTF-8
Python
false
false
8,392
py
# Copyright 2013 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. """Finds android browsers that can be controlled by telemetry.""" import logging import os import sys from telemetry.core import exceptions from telemetry.core import platform from telemetry.core import util from telemetry import decorators from telemetry.internal.backends import android_browser_backend_settings from telemetry.internal.backends.chrome import android_browser_backend from telemetry.internal.browser import browser from telemetry.internal.browser import possible_browser from telemetry.internal.platform import android_device from devil.android import apk_helper CHROME_PACKAGE_NAMES = { 'android-content-shell': ['org.chromium.content_shell_apk', android_browser_backend_settings.ContentShellBackendSettings, 'ContentShell.apk'], 'android-webview': ['org.chromium.webview_shell', android_browser_backend_settings.WebviewBackendSettings, None], 'android-webview-shell': ['org.chromium.android_webview.shell', android_browser_backend_settings.WebviewShellBackendSettings, 'AndroidWebView.apk'], 'android-chromium': ['org.chromium.chrome', android_browser_backend_settings.ChromeBackendSettings, 'ChromePublic.apk'], 'android-chrome': ['com.google.android.apps.chrome', android_browser_backend_settings.ChromeBackendSettings, 'Chrome.apk'], 'android-chrome-work': ['com.chrome.work', android_browser_backend_settings.ChromeBackendSettings, None], 'android-chrome-beta': ['com.chrome.beta', android_browser_backend_settings.ChromeBackendSettings, None], 'android-chrome-dev': ['com.chrome.dev', android_browser_backend_settings.ChromeBackendSettings, None], 'android-chrome-canary': ['com.chrome.canary', android_browser_backend_settings.ChromeBackendSettings, None], 'android-jb-system-chrome': ['com.android.chrome', android_browser_backend_settings.ChromeBackendSettings, None] } class PossibleAndroidBrowser(possible_browser.PossibleBrowser): """A launchable android browser instance.""" def __init__(self, browser_type, finder_options, android_platform, backend_settings, apk_name): super(PossibleAndroidBrowser, self).__init__( browser_type, 'android', backend_settings.supports_tab_control) assert browser_type in FindAllBrowserTypes(finder_options), ( 'Please add %s to android_browser_finder.FindAllBrowserTypes' % browser_type) self._platform = android_platform self._platform_backend = ( android_platform._platform_backend) # pylint: disable=protected-access self._backend_settings = backend_settings self._local_apk = None if browser_type == 'exact': if not os.path.exists(apk_name): raise exceptions.PathMissingError( 'Unable to find exact apk %s specified by --browser-executable' % apk_name) self._local_apk = apk_name elif apk_name: assert finder_options.chrome_root, ( 'Must specify Chromium source to use apk_name') chrome_root = finder_options.chrome_root candidate_apks = [] for build_dir, build_type in util.GetBuildDirectories(): apk_full_name = os.path.join(chrome_root, build_dir, build_type, 'apks', apk_name) if os.path.exists(apk_full_name): last_changed = os.path.getmtime(apk_full_name) candidate_apks.append((last_changed, apk_full_name)) if candidate_apks: # Find the candidate .apk with the latest modification time. newest_apk_path = sorted(candidate_apks)[-1][1] self._local_apk = newest_apk_path def __repr__(self): return 'PossibleAndroidBrowser(browser_type=%s)' % self.browser_type def _InitPlatformIfNeeded(self): pass def Create(self, finder_options): self._InitPlatformIfNeeded() browser_backend = android_browser_backend.AndroidBrowserBackend( self._platform_backend, finder_options.browser_options, self._backend_settings, output_profile_path=finder_options.output_profile_path, extensions_to_load=finder_options.extensions_to_load, target_arch=finder_options.target_arch) try: return browser.Browser( browser_backend, self._platform_backend, self._credentials_path) except Exception: logging.exception('Failure while creating Android browser.') original_exception = sys.exc_info() try: browser_backend.Close() except Exception: logging.exception('Secondary failure while closing browser backend.') raise original_exception[0], original_exception[1], original_exception[2] def SupportsOptions(self, finder_options): if len(finder_options.extensions_to_load) != 0: return False return True def HaveLocalAPK(self): return self._local_apk and os.path.exists(self._local_apk) @decorators.Cache def UpdateExecutableIfNeeded(self): if self.HaveLocalAPK(): logging.warn('Installing %s on device if needed.' % self._local_apk) self.platform.InstallApplication(self._local_apk) def last_modification_time(self): if self.HaveLocalAPK(): return os.path.getmtime(self._local_apk) return -1 def SelectDefaultBrowser(possible_browsers): """Return the newest possible browser.""" if not possible_browsers: return None return max(possible_browsers, key=lambda b: b.last_modification_time()) def CanFindAvailableBrowsers(): return android_device.CanDiscoverDevices() def CanPossiblyHandlePath(target_path): return os.path.splitext(target_path.lower())[1] == '.apk' def FindAllBrowserTypes(_options): return CHROME_PACKAGE_NAMES.keys() + ['exact'] def _FindAllPossibleBrowsers(finder_options, android_platform): """Testable version of FindAllAvailableBrowsers.""" if not android_platform: return [] possible_browsers = [] # Add the exact APK if given. if (finder_options.browser_executable and CanPossiblyHandlePath(finder_options.browser_executable)): apk_name = os.path.basename(finder_options.browser_executable) package_info = next((info for info in CHROME_PACKAGE_NAMES.itervalues() if info[2] == apk_name), None) # It is okay if the APK name doesn't match any of known chrome browser APKs, # since it may be of a different browser (say, mandoline). if package_info: normalized_path = os.path.expanduser(finder_options.browser_executable) exact_package = apk_helper.GetPackageName(normalized_path) if not exact_package: raise exceptions.PackageDetectionError( 'Unable to find package for %s specified by --browser-executable' % normalized_path) [package, backend_settings, _] = package_info if package == exact_package: possible_browsers.append(PossibleAndroidBrowser( 'exact', finder_options, android_platform, backend_settings(package), normalized_path)) else: raise exceptions.UnknownPackageError( '%s specified by --browser-executable has an unknown package: %s' % (normalized_path, exact_package)) for name, package_info in CHROME_PACKAGE_NAMES.iteritems(): package, backend_settings, local_apk = package_info b = PossibleAndroidBrowser(name, finder_options, android_platform, backend_settings(package), local_apk) if b.platform.CanLaunchApplication(package) or b.HaveLocalAPK(): possible_browsers.append(b) return possible_browsers def FindAllAvailableBrowsers(finder_options, device): """Finds all the possible browsers on one device. The device is either the only device on the host platform, or |finder_options| specifies a particular device. """ if not isinstance(device, android_device.AndroidDevice): return [] android_platform = platform.GetPlatformForDevice(device, finder_options) return _FindAllPossibleBrowsers(finder_options, android_platform)
[ "jamshed.vesuna@gmail.com" ]
jamshed.vesuna@gmail.com
009c7689d899f6b590b2b405a7df7c8ed717a727
1c6283303ceb883add8de4ee07c5ffcfc2e93fab
/Jinja2/lib/python3.7/site-packages/ixnetwork_restpy/testplatform/sessions/ixnetwork/globals/topology/cuspup/cuspup_985b33e540b199c473b9a9aa9d00f4c4.py
44cd2b03fca9c53826daa25735c52165e2446bed
[]
no_license
pdobrinskiy/devcore
0f5b3dfc2f3bf1e44abd716f008a01c443e14f18
580c7df6f5db8c118990cf01bc2b986285b9718b
refs/heads/main
2023-07-29T20:28:49.035475
2021-09-14T10:02:16
2021-09-14T10:02:16
405,919,390
0
0
null
null
null
null
UTF-8
Python
false
false
5,044
py
# MIT LICENSE # # Copyright 1997 - 2020 by IXIA Keysight # # 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, distribute, sublicense, # and/or sell copies of the Software, and to permit persons to whom the # Software is furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. from ixnetwork_restpy.base import Base from ixnetwork_restpy.files import Files from typing import List, Any, Union class CuspUP(Base): """CUSP UP Port Specific Data The CuspUP class encapsulates a required cuspUP resource which will be retrieved from the server every time the property is accessed. """ __slots__ = () _SDM_NAME = 'cuspUP' _SDM_ATT_MAP = { 'Count': 'count', 'DescriptiveName': 'descriptiveName', 'Name': 'name', 'RowNames': 'rowNames', } _SDM_ENUM_MAP = { } def __init__(self, parent, list_op=False): super(CuspUP, self).__init__(parent, list_op) @property def StartRate(self): """ Returns ------- - obj(ixnetwork_restpy.testplatform.sessions.ixnetwork.globals.topology.ethernet.startrate.startrate_2bc83a4fb9730935e8259bdb40af2dc0.StartRate): An instance of the StartRate class Raises ------ - ServerError: The server has encountered an uncategorized error condition """ from ixnetwork_restpy.testplatform.sessions.ixnetwork.globals.topology.ethernet.startrate.startrate_2bc83a4fb9730935e8259bdb40af2dc0 import StartRate if self._properties.get('StartRate', None) is not None: return self._properties.get('StartRate') else: return StartRate(self)._select() @property def StopRate(self): """ Returns ------- - obj(ixnetwork_restpy.testplatform.sessions.ixnetwork.globals.topology.ethernet.stoprate.stoprate_4ea9a1b38960d2b21012777131469a04.StopRate): An instance of the StopRate class Raises ------ - ServerError: The server has encountered an uncategorized error condition """ from ixnetwork_restpy.testplatform.sessions.ixnetwork.globals.topology.ethernet.stoprate.stoprate_4ea9a1b38960d2b21012777131469a04 import StopRate if self._properties.get('StopRate', None) is not None: return self._properties.get('StopRate') else: return StopRate(self)._select() @property def Count(self): # type: () -> int """ Returns ------- - number: Number of elements inside associated multiplier-scaled container object, e.g. number of devices inside a Device Group. """ return self._get_attribute(self._SDM_ATT_MAP['Count']) @property def DescriptiveName(self): # type: () -> str """ Returns ------- - str: Longer, more descriptive name for element. It's not guaranteed to be unique like -name-, but may offer more context. """ return self._get_attribute(self._SDM_ATT_MAP['DescriptiveName']) @property def Name(self): # type: () -> str """ Returns ------- - str: Name of NGPF element, guaranteed to be unique in Scenario """ return self._get_attribute(self._SDM_ATT_MAP['Name']) @Name.setter def Name(self, value): # type: (str) -> None self._set_attribute(self._SDM_ATT_MAP['Name'], value) @property def RowNames(self): # type: () -> List[str] """ Returns ------- - list(str): Name of rows """ return self._get_attribute(self._SDM_ATT_MAP['RowNames']) def update(self, Name=None): # type: (str) -> CuspUP """Updates cuspUP resource on the server. Args ---- - Name (str): Name of NGPF element, guaranteed to be unique in Scenario Raises ------ - ServerError: The server has encountered an uncategorized error condition """ return self._update(self._map_locals(self._SDM_ATT_MAP, locals()))
[ "pdobrinskiy@yahoo.com" ]
pdobrinskiy@yahoo.com
a99f0536c1d5f211f5d364eb549957ee8b00dfec
3c7057226c7bb01cd493cde5742b3979cf030f94
/lmctl/client/api/behaviour_projects.py
0b0e73b6319e5993be94a05d25387e22b98be3d4
[ "Apache-2.0" ]
permissive
sharadc2001/lmctl
2d047f776d1bbee811801ccc5454a097b1484841
a220a3abeef5fc1f7c0a9410524625c2ff895a0a
refs/heads/master
2023-05-27T06:14:49.425793
2021-04-29T20:08:52
2021-04-29T20:08:52
null
0
0
null
null
null
null
UTF-8
Python
false
false
133
py
from .resource_api_base import ResourceAPIBase class BehaviourProjectsAPI(ResourceAPIBase): endpoint = 'api/behaviour/projects'
[ "daniel.vaccaro-senna@ibm.com" ]
daniel.vaccaro-senna@ibm.com
38f5fcd0c82d2fedebb31c1e82541d9708fd8458
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03252/s222988530.py
d03803223cba2148882efcfde3db4be3936b980f
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
1,205
py
#from statistics import median #import collections #aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0] from fractions import gcd from itertools import combinations,permutations,accumulate, product # (string,3) 3回 #from collections import deque from collections import deque,defaultdict,Counter import decimal import re #import bisect # # d = m - k[i] - k[j] # if kk[bisect.bisect_right(kk,d) - 1] == d: # # # # pythonで無理なときは、pypyでやると正解するかも!! # # # my_round_int = lambda x:np.round((x*2 + 1)//2) # 四捨五入g import sys sys.setrecursionlimit(10000000) mod = 10**9 + 7 #mod = 9982443453 def readInts(): return list(map(int,input().split())) def I(): return int(input()) dics = defaultdict(str) dict = defaultdict(str) s = input() t = input() for i in range(len(s)): if dics[s[i]]: if dics[s[i]] == t[i]: pass else: print('No') exit() else: dics[s[i]] = t[i] if dict[t[i]]: if dict[t[i]] == s[i]: pass else: print('No') exit() else: dict[t[i]] = s[i] print('Yes')
[ "66529651+Aastha2104@users.noreply.github.com" ]
66529651+Aastha2104@users.noreply.github.com
7dcfd73cbe7545f48aac779d51ddde20a249fdd4
3493c9edcc457ea692aa2f992f79c103f558d9c5
/alarms/views.py
51530a89d54e7b91f64f960cdf3d4e94156dbb65
[ "MIT" ]
permissive
RashaMou/clock-api
ad2427d2a0bda03a05a871d63bd0a35f1fbbfd26
57c16e83cdb405feea268c6a03959207a12cb4d0
refs/heads/master
2023-07-05T13:18:42.767423
2021-08-12T15:15:29
2021-08-12T15:15:29
null
0
0
null
null
null
null
UTF-8
Python
false
false
483
py
from rest_framework import viewsets from . import models, serializers class AlarmViewSet(viewsets.ModelViewSet): authentication_classes = [] permission_classes = [] queryset = models.Alarm.objects.select_related("sound", "task__crontab").all() serializer_class = serializers.AlarmSerializer filterset_fields = ("active",) class SoundViewSet(viewsets.ModelViewSet): queryset = models.Sound.objects.all() serializer_class = serializers.SoundSerializer
[ "flavio.curella@gmail.com" ]
flavio.curella@gmail.com
d0d4daccbb923c4f2682742e5a3e450c5c0c2db3
8b57c6609e4bf3e6f5e730b7a4a996ad6b7023f0
/appserver/mrsparkle/lib/message.py
778be4f1fd722f3c66a0b96ba327ed393660c664
[]
no_license
bullll/splunk
862d9595ad28adf0e12afa92a18e2c96308b19fe
7cf8a158bc8e1cecef374dad9165d44ccb00c6e0
refs/heads/master
2022-04-20T11:48:50.573979
2020-04-23T18:12:58
2020-04-23T18:12:58
258,293,313
2
0
null
null
null
null
UTF-8
Python
false
false
13,980
py
from builtins import object import cgi import cherrypy import logging import splunk.util from decorator import decorator logger = logging.getLogger('splunk.appserver.mrsparkle.lib.message') QUEUE_SESSION_KEY = 'queue' QUEUE_INFO_LEVEL = 'info' QUEUE_ERROR_LEVEL = 'error' def get_session_queue(): """ Creates or returns une pickled session Queue object with a key of QUEUE_SESSION_KEY """ sess = cherrypy.session if QUEUE_SESSION_KEY in sess: return sess.get(QUEUE_SESSION_KEY) else: sess[QUEUE_SESSION_KEY] = SessionQueue() return sess[QUEUE_SESSION_KEY] @decorator def save_to_session(fn, self, *a, **kw): '''Simple decorator that ensures cherrypy's session gets re-written.''' ret_val = fn(self, *a, **kw) cherrypy._test_session_has_changed = True if (hasattr(cherrypy, 'session')): if self.isChanged(): cherrypy.session.acquire_lock() if hasattr(cherrypy.session, 'changed'): cherrypy.session.changed = True cherrypy.session[QUEUE_SESSION_KEY] = self return ret_val def send_client_message(level, msg): '''Mechanism for sending a message to the client from the server.''' cherrypy.response.headers['X-Splunk-Messages-Available'] = 1 get_session_queue().add(level, msg) class Queue(object): """ A dead simple container for storing temporary system messages categorized by level. """ def __init__(self): self.queue = [] self.changed = False def isChanged(self): return self.changed def add(self, level, message): """ Add a message to a list with a specified level. Order is perserved. Args: level: The level marker for the message. message: The message string to store. """ logger.debug('adding level:%s, message:%s' % (level, message)) self.changed = True self.queue.append({'message': message, 'time': splunk.util.getISOTime(), 'level': level}) def get_level(self, level, delete=True): """ Retrieve a list of messages based on a specified level. Args: level: The level cagegory for a list of messages. delete: Delete the list of messages from this level after retrieval. """ matches = [] items = self.queue[:] for item in items: if item['level'] is level: matches.append(item) if delete: self.queue.pop(self.queue.index(item)) if matches: self.changed = delete else: self.changed = False return matches def get_levels(self): """ Retrieve a sorted list of distinct message levels stored in the queue. """ levels = [] for item in self.queue: levels.append(item['level']) uniques = sorted(set(levels)) return uniques def get_len(self, level=None): """ Retrieve the length of messages based on a specified level or the length of all messages combined. Args: level: The level cagegory for a list of messages. """ if level is None: return len(self.queue) else: return len(self.get_level(level, delete=False)) def get_all(self, delete=True): """ Retrieve the entire message list. Args: delete: Delete the entire message list entries after retrieval. """ self.changed = False queue = self.queue[:] if delete and self.queue: self.changed = True self.queue = [] return queue def fifo(self, delete=True): """ First in first out (fifo) - retrieve the first message in the list. Args: delete: Delete the message list entry after retrieval. """ if len(self.queue) is 0: self.changed = False return None if delete: self.changed = True queue = self.queue else: self.changed = False queue = self.queue[:] return queue.pop(0) def lifo(self, delete=True): """ Last in first out (lifo) - retrieve the last message in the list. Args: delete: Delete the message list entry after retrieval. """ if len(self.queue) is 0: self.changed = False return None if delete: self.changed = True queue = self.queue else: self.changed = False queue = self.queue[:] return queue.pop() class SessionQueue(Queue): ''' A mirror of the Queue object that ensures if it's stored in a modified Cherrypy session, the session is properly rewritten when necessary. ''' def __init__(self): Queue.__init__(self) @save_to_session def add(self, level, message): super(SessionQueue, self).add(level, message) @save_to_session def get_level(self, level, delete=True): return super(SessionQueue, self).get_level(level, delete) @save_to_session def get_all(self, delete=True): return super(SessionQueue, self).get_all(delete) @save_to_session def fifo(self, delete=True): return super(SessionQueue, self).fifo(delete) @save_to_session def lifo(self, delete=True): return super(SessionQueue, self).lifo(delete) if __name__ == '__main__': import unittest class QueueTests(unittest.TestCase): def testQueue(self): queue = Queue() queue.add("notice", "notice string1") queue.add("notice", "notice string2") queue.add("notice", "notice string3") self.assert_(len(queue.get_levels()) is 1) self.assert_(queue.get_levels()[0] is "notice") self.assert_(queue.get_len(level="notice") is 3) self.assert_(queue.get_len() is 3) self.assert_(len(queue.get_level("notice")) is 3) self.assert_(len(queue.get_level("notice")) is 0) self.assert_(queue.get_len(level="notice") is 0) self.assert_(queue.get_len() is 0) queue.add("notice", "notice string1") queue.add("notice", "notice string2") queue.add("notice", "notice string3") self.assert_(len(queue.get_level("notice", delete=False)) is 3) self.assert_(len(queue.get_level("notice")) is 3) self.assert_(len(queue.get_level("notice")) is 0) queue.add("notice", "notice string1") queue.add("notice", "notice string2") queue.add("notice", "notice string3") queue.add("message", "message string1") queue.add("message", "message string2") queue.add("message", "message string3") queue.add("message", "message string4") self.assert_(len(queue.get_levels()) is 2) self.assert_(queue.get_levels().index("notice") is 1) self.assert_(queue.get_levels().index("message") is 0) self.assert_(queue.get_len(level="notice") is 3) self.assert_(queue.get_len(level="message") is 4) self.assert_(queue.get_len() is 7) messages = queue.get_all() self.assert_(queue.get_len(level="notice") is 0) self.assert_(queue.get_len(level="message") is 0) self.assert_(queue.get_len() is 0) self.assert_(len(messages) is 7) self.assert_(len(queue.get_level("notice")) is 0) self.assert_(len(queue.get_level("message")) is 0) queue.add("notice", "notice string1") queue.add("notice", "notice string2") queue.add("notice", "notice string3") queue.add("message", "message string1") queue.add("message", "message string2") queue.add("message", "message string3") queue.add("message", "message string4") self.assert_(queue.get_len(level="notice") is 3) self.assert_(queue.get_len(level="message") is 4) self.assert_(queue.get_len() is 7) messages = queue.get_all(delete=False) self.assert_(queue.get_len(level="notice") is 3) self.assert_(queue.get_len(level="message") is 4) self.assert_(queue.get_len() is 7) self.assert_(len(messages) is 7) self.assert_(len(queue.get_level("notice")) is 3) self.assert_(len(queue.get_level("message")) is 4) queue = Queue() queue.add("notice", "notice string1") queue.add("notice", "notice string2") queue.add("notice", "notice string3") self.assert_(queue.fifo(delete=False)['message'] is "notice string1") self.assert_(queue.fifo(delete=True)['message'] is "notice string1") self.assert_(queue.fifo(delete=True)['message'] is "notice string2") self.assert_(queue.fifo(delete=True)['message'] is "notice string3") self.assert_(queue.fifo(delete=True) is None) queue = Queue() queue.add("notice", "notice string1") queue.add("notice", "notice string2") queue.add("notice", "notice string3") self.assert_(queue.lifo(delete=False)['message'] is "notice string3") self.assert_(queue.lifo(delete=True)['message'] is "notice string3") self.assert_(queue.lifo(delete=True)['message'] is "notice string2") self.assert_(queue.lifo(delete=True)['message'] is "notice string1") self.assert_(queue.lifo(delete=True) is None) class QueueTestsChanged(unittest.TestCase): def setUp(self): self.queue = Queue() self.assert_(self.queue.isChanged() is False) self.queue.add("notice", "notice string1") self.assert_(self.queue.isChanged() is True) def testQueueChangedGetLevel(self): #get_level self.queue.get_level("notice", False) self.assert_(self.queue.isChanged() is False) self.queue.get_level("notice", True) self.assert_(self.queue.isChanged() is True) self.queue.get_level("notice") self.assert_(self.queue.isChanged() is False) self.queue.add("notice", "notice string1") self.assert_(self.queue.isChanged() is True) self.queue.get_level("message", True) self.assert_(self.queue.isChanged() is False) self.queue.get_level("notice", True) self.assert_(self.queue.isChanged() is True) def testQueueChangedGetAll(self): #get_level self.queue.get_all(False) self.assert_(self.queue.isChanged() is False) self.queue.get_all(True) self.assert_(self.queue.isChanged() is True) self.queue.get_all() self.assert_(self.queue.isChanged() is False) def testQueueChangedFifo(self): #get_level self.queue.add("notice", "notice string2") self.queue.add("notice", "notice string3") self.assert_(self.queue.fifo(delete=False)['message'] == "notice string1") self.assert_(self.queue.isChanged() is False) self.assert_(self.queue.fifo(delete=True)['message'] == "notice string1") self.assert_(self.queue.isChanged() is True) self.assert_(self.queue.fifo(delete=True)['message'] == "notice string2") self.assert_(self.queue.isChanged() is True) self.assert_(self.queue.fifo(delete=True)['message'] == "notice string3") self.assert_(self.queue.isChanged() is True) self.assert_(self.queue.fifo(delete=True) is None) self.assert_(self.queue.isChanged() is False) def testQueueChangedLifo(self): #get_level self.queue.add("notice", "notice string2") self.queue.add("notice", "notice string3") self.assert_(self.queue.lifo(delete=False)['message'] == "notice string3") self.assert_(self.queue.isChanged() is False) self.assert_(self.queue.lifo(delete=True)['message'] == "notice string3") self.assert_(self.queue.isChanged() is True) self.assert_(self.queue.lifo(delete=True)['message'] == "notice string2") self.assert_(self.queue.isChanged() is True) self.assert_(self.queue.lifo(delete=True)['message'] == "notice string1") self.assert_(self.queue.isChanged() is True) self.assert_(self.queue.lifo(delete=True) is None) self.assert_(self.queue.isChanged() is False) class SessionQueueTests(unittest.TestCase): def setUp(self): self.queue = SessionQueue() cherrypy._test_session_has_changed = False def tearDown(self): self.assert_(cherrypy._test_session_has_changed is True) self.queue = None def testSessionQueueAdding(self): self.queue.add('error', 'foo') def testSessionQueueGetLevel(self): self.queue.get_level('error') def testSessionQueueGetAll(self): self.queue.get_all() def testSessionQueueFifo(self): self.queue.fifo() def testSessionQueueLifo(self): self.queue.lifo() loader = unittest.TestLoader() suites = [] suites.append(loader.loadTestsFromTestCase(QueueTests)) suites.append(loader.loadTestsFromTestCase(QueueTestsChanged)) suites.append(loader.loadTestsFromTestCase(SessionQueueTests)) unittest.TextTestRunner(verbosity=2).run(unittest.TestSuite(suites))
[ "splunk@x.y" ]
splunk@x.y
2f84e673311d417b421b9ae8507b879d52c87744
16f11e566c5069a874a99ff33debb47913881bfa
/python/sets/symetric_difference.py
1845ad05bcf46c0bdf85ba51b2d9ade857fbb091
[]
no_license
Suraj-KD/HackerRank
7c5a1a73ea2d2c30370ff5d2dd633aaef315f00a
ef6ba86b2245172de6f62a6fb63916318adef2a6
refs/heads/master
2021-06-27T10:30:14.195489
2019-03-20T12:33:54
2019-03-20T12:33:54
129,599,426
2
0
null
null
null
null
UTF-8
Python
false
false
243
py
import sys def setsym(a, b): return len(set(a) ^ set(b)) def main(): lines = [[int(x) for x in line.strip().split()] for line in sys.stdin.readlines()[:4]] print(setsym(lines[1], lines[3])) if __name__ == '__main__': main()
[ "surajdubey302@gmail.com" ]
surajdubey302@gmail.com
b2426b7f50a539574f6d126b81234c8edd9c082b
cbb9152ea4290fb655caff877101eaeb68236dfd
/students/douglas_klos/session9/mailroom/html_render.py
9b51232fe9339ad8feb8f3eaac197afba6064c58
[]
no_license
pauleclifton/GP_Python210B_Winter_2019
7105a080d105cd9999933936346d5ae29f232d26
661903cd9dc49b294fb9a0c905133a4c3f9d8d0f
refs/heads/master
2020-04-16T04:26:31.951165
2019-03-31T15:22:51
2019-03-31T15:22:51
165,267,180
0
0
null
2019-01-11T15:39:48
2019-01-11T15:39:48
null
UTF-8
Python
false
false
9,989
py
#!/usr/bin/env python3 #pylint: disable=W0223,W0231,C0103,C0321 """ A class based system for rendering HTML """ # Douglas Klos # March 14st, 2019 # Python 210, Session 9, Mailroom OO # html_render.py class Element(): """ Framework for a basic element in HTML code. Class attributes: tag: Tag used for rendering html contents. Element class is set to html. indent: The level of indentation for the current element. """ tag = 'html' indent = '' def __init__(self, content=None, **kwargs): """ __init__ method for Element class. :param content: Content that is to be added to the instance content and later rendered. :param kwargs: Used for passing in tag attributes. Attributes: contents The content that is to be rendered into HTML format. """ self.attributes = kwargs self.contents = [content] if content else [] def _open_tag(self): """ Returns the opening tag for the current element """ return f'<{self.tag}>' def _close_tag(self): """ Returns the closing tag for the current element """ return f'</{self.tag}>' def append(self, new_content): """ Appends new_content to the instance attribute content :param new_content: String that is to be appended to the instance content. """ self.contents.append(new_content) def render(self, out_file, indent="", ind_count=0): """ Recursively renders the instance attribute content into HTML format code. :param out_file: Destination for rendered text. :param indent: The specified indentation level for elements. :param ind_count: How many times indent should be applied to the element. """ self.indent = indent * ind_count out_file.write(f'{self.indent}{self._open_tag()[:-1]}') for key, value in self.attributes.items(): out_file.write(f' {key}="{value}"') out_file.write(f'{self._open_tag()[-1:]}\n') for content in self.contents: if hasattr(content, 'render'): content.render(out_file, indent, ind_count + 1) else: out_file.write(f'{self.indent}{indent}{content}\n') out_file.write(f'{self.indent}{self._close_tag()}\n') class Html(Element): """ Framework for 'html' tag, inherits from Element. Overrides render method and tag class attribute. """ tag = 'html' def render(self, out_file, indent="", ind_count=0): """ Adds <!DOCTYPE html> tag to output then calls super().render after running :param out_file: Destination for rendered text. :param indent: The specified indentation level for elements. :param ind_count: How many times indent should be applied to the element. """ self.indent = indent out_file.write(f'<!DOCTYPE html>\n') super().render(out_file, indent) class Body(Element): """ Framework for 'body' tag, inherits from Element. Overrides tag class attribute. """ tag = 'body' class P(Element): """ Framework for 'p' paragraph tag, inherits from Element. Overrides tag class attribute. """ tag = 'p' class Head(Element): """ Framework for 'head' tag, inherits from Element. Overrides tag class attribute. """ tag = 'head' class Li(Element): """ Framework for 'li' list item tag, inherits from Element. Overrides tag class attribute. """ tag = 'li' class Ul(Element): """ Framework for 'ul' unordered list tag, inherits from Element. Overrides __init__ method and tag class attribute. """ tag = 'ul' def __init__(self, content=None, **kwargs): """ __init__ method for Ul class. :param content: Accepts no content, raises TypeError if content is passed it. :param kwargs: Used for passing in tag attributes. """ if content: raise TypeError self.contents = [] self.attributes = kwargs class Table(Element): """ Framework for 'tr' table tag, inherits from Element """ tag = 'table' class Tr(Element): """ Framework for 'tr' table tag, inherits from Element """ tag = 'tr' class OneLineTag(Element): """ Framework for elements that render on a single line, inherits from Element. Overrides append and render methods. """ def append(self, new_content): """ Raises NotImplementedError if called. Overrides Element.append. One line tags can not append. """ raise NotImplementedError def render(self, out_file, indent="", ind_count=0): """ render method of OneLineTag class. Renders tag and attributes on a single line Overrides Element.render :param out_file: Destination for rendered text. :param indent: The specified indentation level for elements. :param ind_count: How many times indent should be applied for the element. """ self.indent = indent * ind_count out_file.write(f'{self.indent}{self._open_tag()[:-1]}') for key, value in self.attributes.items(): out_file.write(f' {key}="{value}"') out_file.write(f'{self._open_tag()[-1:]}') if self.contents: out_file.write(f'{self.contents[0]}') out_file.write(f'{self._close_tag()}\n') class H(OneLineTag): """ Framework for 'h' header tag, inherits from OneLineTag. Overrides __init__ method and tag class attribute. """ tag = 'h' def __init__(self, level, content=None, **kwargs): """ __init__ method for 'H' header class. Calls super().__init__ after execution :param content: Content that is to be added to the instance content and rendered. :param kwargs: Used for passing in tag attributes. """ # Verifies function called with interger value for header level as first parameter. # If it was forgotten, then contents will likely be the first passed value. # This 'should' then fail if casted to an int, and raises a ValueError try: int(level) except ValueError: raise ValueError self.tag = f'h{level}' super().__init__(content, **kwargs) class Title(OneLineTag): """ Framework for 'title' tag, inherits from OneLineTag. Overrides tag class attribute. """ tag = 'title' class A(OneLineTag): """ Framework for 'a' anchor tag, inherits from OneLineTag. Overrides __init__ method and tag class attribute. """ tag = 'a' def __init__(self, link, content=None, **kwargs): """ __init__ method for 'a' anchor class. adds href and link to kwargs and calls super().__init__ after execution :param link: Anchor link passed in. :param content: Text that is to be added to the link. :param kwargs: Used for passing in tag attributes. """ if not (content and link): raise TypeError kwargs['href'] = link super().__init__(content, **kwargs) class Caption(OneLineTag): """ Framework for 'caption' table tag, inherits from OneLineTag """ tag = 'caption' class Th(OneLineTag): """ Framework for 'tr' table tag, inherits from OneLineTag """ tag = 'th' class Td(OneLineTag): """ Framework for 'tr' table tag, inherits from OneLineTag """ tag = 'td' class SelfClosingTag(Element): """ Framework for self closing tag elements. Inherits from Element. Overrides __init__, append, and render methods. """ def __init__(self, content=None, **kwargs): """ __init__ method for SelfClosingTag class. :param content: Accepts no content, raises TypeError if content is passed it. :param kwargs: Used for passing in tag attributes. """ if content: raise TypeError self.attributes = kwargs def append(self, new_content): """ Overrides Element.append. Self closing tags can not append. Raises NotImplementedError if called. """ raise NotImplementedError def render(self, out_file, indent="", ind_count=0): """ render method for SelfClosingTag class. Renders tag and attributes on a single line Overrides Element.render :param out_file: destination for rendered text :param indent: the specified indentation level for elements :param ind_count: how many times indent should be applied for the element """ self.indent = indent * ind_count out_file.write(f'{self.indent}{self._open_tag()[:-1]}') for key, value in self.attributes.items(): out_file.write(f' {key}="{value}"') out_file.write(f' />\n') class Hr(SelfClosingTag): """ Framework for 'hr' horizontal rule tag, inherits from SelfClosingTag. Overrides tag class attribute. """ tag = 'hr' # <br /> is XHTML format class Br(SelfClosingTag): """ Framework for 'br' horizontal rule tag, inherits from SelfClosingTag. Overrides __init__ method and tag class attribute. """ tag = 'br' def __init__(self, content=None, **kwargs): """ __init__ method for Br class. Checks that no attributes were passed then calls super().__init__ :param content: Content that is to be added to the instance content and later rendered. :param kwargs: br elements accept no attributes. Raises TypeError is passed in. """ if kwargs: raise TypeError super().__init__(content, **kwargs) class Meta(SelfClosingTag): """ Framework for 'meta' rule tag, inherits from SelfClosingTag. Overrides tag class attribute. """ tag = 'meta'
[ "dougklos@gmail.com" ]
dougklos@gmail.com
51469423fd3a93f1c1b7fee30ec663745e8eb641
8dc84558f0058d90dfc4955e905dab1b22d12c08
/third_party/android_sdk/public/platform-tools/systrace/catapult/common/py_utils/py_utils/cloud_storage_unittest.py
20586a4bf6631237fae3e2889ba1eca86686ee43
[ "LGPL-2.0-or-later", "GPL-1.0-or-later", "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
meniossin/src
42a95cc6c4a9c71d43d62bc4311224ca1fd61e03
44f73f7e76119e5ab415d4593ac66485e65d700a
refs/heads/master
2022-12-16T20:17:03.747113
2020-09-03T10:43:12
2020-09-03T10:43:12
263,710,168
1
0
BSD-3-Clause
2020-05-13T18:20:09
2020-05-13T18:20:08
null
UTF-8
Python
false
false
136
py
../../../../../../../../../../.cipd/pkgs/82/_current/platform-tools/systrace/catapult/common/py_utils/py_utils/cloud_storage_unittest.py
[ "arnaud@geometry.ee" ]
arnaud@geometry.ee
aa09f2d8129f95e2dca1a311d322ace71a2eaa32
9e988c0dfbea15cd23a3de860cb0c88c3dcdbd97
/sdBs/AllRun/sdssj_143026.15+195346.7/sdB_sdssj_143026.15+195346.7_coadd.py
60fd321f363d4a9442ec3bb3c4bf7aaccdebdbb7
[]
no_license
tboudreaux/SummerSTScICode
73b2e5839b10c0bf733808f4316d34be91c5a3bd
4dd1ffbb09e0a599257d21872f9d62b5420028b0
refs/heads/master
2021-01-20T18:07:44.723496
2016-08-08T16:49:53
2016-08-08T16:49:53
65,221,159
0
0
null
null
null
null
UTF-8
Python
false
false
482
py
from gPhoton.gMap import gMap def main(): gMap(band="NUV", skypos=[217.608958,19.896306], skyrange=[0.0333333333333,0.0333333333333], stepsz = 30., cntfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sdBs/sdB_sdssj_143026.15+195346.7/sdB_sdssj_143026.15+195346.7_movie_count.fits", cntcoaddfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sdB/sdB_sdssj_143026.15+195346.7/sdB_sdssj_143026.15+195346.7_count_coadd.fits", overwrite=True, verbose=3) if __name__ == "__main__": main()
[ "thomas@boudreauxmail.com" ]
thomas@boudreauxmail.com
d6837933673c1503000c6d39ad4772b2c03345e5
b156c2f5ee7417dfa1f6cdcf14e9773a25397544
/GeneVisualization/venv2/Lib/site-packages/itk/itkMattesMutualInformationImageToImageMetricPython.py
81440a32b1811b0ec96222199dc6ed9ec225ad20
[]
no_license
PinarTurkyilmaz/Vis
1115d9426e9c8eeb5d07949241713d6f58a7721b
4dd4426a70c0bd0a6e405ffe923afee29630aa67
refs/heads/master
2022-11-18T13:16:18.668065
2020-07-06T21:04:10
2020-07-06T21:04:10
226,217,392
0
0
null
null
null
null
UTF-8
Python
false
false
78,289
py
# This file was automatically generated by SWIG (http://www.swig.org). # Version 3.0.8 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. from sys import version_info if version_info >= (3, 0, 0): new_instancemethod = lambda func, inst, cls: _itkMattesMutualInformationImageToImageMetricPython.SWIG_PyInstanceMethod_New(func) else: from new import instancemethod as new_instancemethod if version_info >= (2, 6, 0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_itkMattesMutualInformationImageToImageMetricPython', [dirname(__file__)]) except ImportError: import _itkMattesMutualInformationImageToImageMetricPython return _itkMattesMutualInformationImageToImageMetricPython if fp is not None: try: _mod = imp.load_module('_itkMattesMutualInformationImageToImageMetricPython', fp, pathname, description) finally: fp.close() return _mod _itkMattesMutualInformationImageToImageMetricPython = swig_import_helper() del swig_import_helper else: import _itkMattesMutualInformationImageToImageMetricPython del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self, class_type, name, value, static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name, None) if method: return method(self, value) if (not static): object.__setattr__(self, name, value) else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self, class_type, name, value): return _swig_setattr_nondynamic(self, class_type, name, value, 0) def _swig_getattr_nondynamic(self, class_type, name, static=1): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name, None) if method: return method(self) if (not static): return object.__getattr__(self, name) else: raise AttributeError(name) def _swig_getattr(self, class_type, name): return _swig_getattr_nondynamic(self, class_type, name, 0) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except Exception: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object: pass _newclass = 0 def _swig_setattr_nondynamic_method(set): def set_attr(self, name, value): if (name == "thisown"): return self.this.own(value) if hasattr(self, name) or (name == "this"): set(self, name, value) else: raise AttributeError("You cannot add attributes to %s" % self) return set_attr import ITKCommonBasePython import pyBasePython import itkCovariantVectorPython import vnl_vector_refPython import vnl_vectorPython import vnl_matrixPython import stdcomplexPython import itkVectorPython import itkFixedArrayPython import itkImagePython import itkSizePython import itkPointPython import itkIndexPython import itkOffsetPython import itkRGBAPixelPython import itkRGBPixelPython import itkMatrixPython import vnl_matrix_fixedPython import itkSymmetricSecondRankTensorPython import itkImageRegionPython import itkArrayPython import itkOptimizerParametersPython import itkImageToImageMetricPython import itkInterpolateImageFunctionPython import itkContinuousIndexPython import itkImageFunctionBasePython import itkFunctionBasePython import ITKCostFunctionsPython import vnl_least_squares_functionPython import itkArray2DPython import itkCostFunctionPython import vnl_cost_functionPython import vnl_unary_functionPython import itkSpatialObjectBasePython import itkSpatialObjectPropertyPython import itkAffineTransformPython import itkTransformBasePython import itkVariableLengthVectorPython import itkDiffusionTensor3DPython import itkMatrixOffsetTransformBasePython import itkBoundingBoxPython import itkMapContainerPython import itkVectorContainerPython def itkMattesMutualInformationImageToImageMetricIF3IF3_New(): return itkMattesMutualInformationImageToImageMetricIF3IF3.New() def itkMattesMutualInformationImageToImageMetricIF2IF2_New(): return itkMattesMutualInformationImageToImageMetricIF2IF2.New() def itkMattesMutualInformationImageToImageMetricIUS3IUS3_New(): return itkMattesMutualInformationImageToImageMetricIUS3IUS3.New() def itkMattesMutualInformationImageToImageMetricIUS2IUS2_New(): return itkMattesMutualInformationImageToImageMetricIUS2IUS2.New() def itkMattesMutualInformationImageToImageMetricIUC3IUC3_New(): return itkMattesMutualInformationImageToImageMetricIUC3IUC3.New() def itkMattesMutualInformationImageToImageMetricIUC2IUC2_New(): return itkMattesMutualInformationImageToImageMetricIUC2IUC2.New() def itkMattesMutualInformationImageToImageMetricISS3ISS3_New(): return itkMattesMutualInformationImageToImageMetricISS3ISS3.New() def itkMattesMutualInformationImageToImageMetricISS2ISS2_New(): return itkMattesMutualInformationImageToImageMetricISS2ISS2.New() class itkMattesMutualInformationImageToImageMetricIF2IF2(itkImageToImageMetricPython.itkImageToImageMetricIF2IF2): """Proxy of C++ itkMattesMutualInformationImageToImageMetricIF2IF2 class.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def __New_orig__() -> "itkMattesMutualInformationImageToImageMetricIF2IF2_Pointer": """__New_orig__() -> itkMattesMutualInformationImageToImageMetricIF2IF2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2___New_orig__() __New_orig__ = staticmethod(__New_orig__) def Clone(self) -> "itkMattesMutualInformationImageToImageMetricIF2IF2_Pointer": """Clone(itkMattesMutualInformationImageToImageMetricIF2IF2 self) -> itkMattesMutualInformationImageToImageMetricIF2IF2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_Clone(self) def SetNumberOfHistogramBins(self, _arg: 'unsigned long long') -> "void": """SetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIF2IF2 self, unsigned long long _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_SetNumberOfHistogramBins(self, _arg) def GetNumberOfHistogramBins(self) -> "unsigned long long const &": """GetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIF2IF2 self) -> unsigned long long const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_GetNumberOfHistogramBins(self) def SetUseExplicitPDFDerivatives(self, _arg: 'bool const') -> "void": """SetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIF2IF2 self, bool const _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_SetUseExplicitPDFDerivatives(self, _arg) def GetUseExplicitPDFDerivatives(self) -> "bool const &": """GetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIF2IF2 self) -> bool const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_GetUseExplicitPDFDerivatives(self) def UseExplicitPDFDerivativesOn(self) -> "void": """UseExplicitPDFDerivativesOn(itkMattesMutualInformationImageToImageMetricIF2IF2 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_UseExplicitPDFDerivativesOn(self) def UseExplicitPDFDerivativesOff(self) -> "void": """UseExplicitPDFDerivativesOff(itkMattesMutualInformationImageToImageMetricIF2IF2 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_UseExplicitPDFDerivativesOff(self) def GetJointPDF(self) -> "itkImageD2_Pointer const": """GetJointPDF(itkMattesMutualInformationImageToImageMetricIF2IF2 self) -> itkImageD2_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_GetJointPDF(self) def GetJointPDFDerivatives(self) -> "itkImageD3_Pointer const": """GetJointPDFDerivatives(itkMattesMutualInformationImageToImageMetricIF2IF2 self) -> itkImageD3_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_GetJointPDFDerivatives(self) __swig_destroy__ = _itkMattesMutualInformationImageToImageMetricPython.delete_itkMattesMutualInformationImageToImageMetricIF2IF2 def cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIF2IF2 *": """cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIF2IF2""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_cast(obj) cast = staticmethod(cast) def New(*args, **kargs): """New() -> itkMattesMutualInformationImageToImageMetricIF2IF2 Create a new object of the class itkMattesMutualInformationImageToImageMetricIF2IF2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkMattesMutualInformationImageToImageMetricIF2IF2.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkMattesMutualInformationImageToImageMetricIF2IF2.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkMattesMutualInformationImageToImageMetricIF2IF2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkMattesMutualInformationImageToImageMetricIF2IF2.Clone = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_Clone, None, itkMattesMutualInformationImageToImageMetricIF2IF2) itkMattesMutualInformationImageToImageMetricIF2IF2.SetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_SetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIF2IF2) itkMattesMutualInformationImageToImageMetricIF2IF2.GetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_GetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIF2IF2) itkMattesMutualInformationImageToImageMetricIF2IF2.SetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_SetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIF2IF2) itkMattesMutualInformationImageToImageMetricIF2IF2.GetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_GetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIF2IF2) itkMattesMutualInformationImageToImageMetricIF2IF2.UseExplicitPDFDerivativesOn = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_UseExplicitPDFDerivativesOn, None, itkMattesMutualInformationImageToImageMetricIF2IF2) itkMattesMutualInformationImageToImageMetricIF2IF2.UseExplicitPDFDerivativesOff = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_UseExplicitPDFDerivativesOff, None, itkMattesMutualInformationImageToImageMetricIF2IF2) itkMattesMutualInformationImageToImageMetricIF2IF2.GetJointPDF = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_GetJointPDF, None, itkMattesMutualInformationImageToImageMetricIF2IF2) itkMattesMutualInformationImageToImageMetricIF2IF2.GetJointPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_GetJointPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIF2IF2) itkMattesMutualInformationImageToImageMetricIF2IF2_swigregister = _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_swigregister itkMattesMutualInformationImageToImageMetricIF2IF2_swigregister(itkMattesMutualInformationImageToImageMetricIF2IF2) def itkMattesMutualInformationImageToImageMetricIF2IF2___New_orig__() -> "itkMattesMutualInformationImageToImageMetricIF2IF2_Pointer": """itkMattesMutualInformationImageToImageMetricIF2IF2___New_orig__() -> itkMattesMutualInformationImageToImageMetricIF2IF2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2___New_orig__() def itkMattesMutualInformationImageToImageMetricIF2IF2_cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIF2IF2 *": """itkMattesMutualInformationImageToImageMetricIF2IF2_cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIF2IF2""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF2IF2_cast(obj) class itkMattesMutualInformationImageToImageMetricIF3IF3(itkImageToImageMetricPython.itkImageToImageMetricIF3IF3): """Proxy of C++ itkMattesMutualInformationImageToImageMetricIF3IF3 class.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def __New_orig__() -> "itkMattesMutualInformationImageToImageMetricIF3IF3_Pointer": """__New_orig__() -> itkMattesMutualInformationImageToImageMetricIF3IF3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3___New_orig__() __New_orig__ = staticmethod(__New_orig__) def Clone(self) -> "itkMattesMutualInformationImageToImageMetricIF3IF3_Pointer": """Clone(itkMattesMutualInformationImageToImageMetricIF3IF3 self) -> itkMattesMutualInformationImageToImageMetricIF3IF3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_Clone(self) def SetNumberOfHistogramBins(self, _arg: 'unsigned long long') -> "void": """SetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIF3IF3 self, unsigned long long _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_SetNumberOfHistogramBins(self, _arg) def GetNumberOfHistogramBins(self) -> "unsigned long long const &": """GetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIF3IF3 self) -> unsigned long long const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_GetNumberOfHistogramBins(self) def SetUseExplicitPDFDerivatives(self, _arg: 'bool const') -> "void": """SetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIF3IF3 self, bool const _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_SetUseExplicitPDFDerivatives(self, _arg) def GetUseExplicitPDFDerivatives(self) -> "bool const &": """GetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIF3IF3 self) -> bool const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_GetUseExplicitPDFDerivatives(self) def UseExplicitPDFDerivativesOn(self) -> "void": """UseExplicitPDFDerivativesOn(itkMattesMutualInformationImageToImageMetricIF3IF3 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_UseExplicitPDFDerivativesOn(self) def UseExplicitPDFDerivativesOff(self) -> "void": """UseExplicitPDFDerivativesOff(itkMattesMutualInformationImageToImageMetricIF3IF3 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_UseExplicitPDFDerivativesOff(self) def GetJointPDF(self) -> "itkImageD2_Pointer const": """GetJointPDF(itkMattesMutualInformationImageToImageMetricIF3IF3 self) -> itkImageD2_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_GetJointPDF(self) def GetJointPDFDerivatives(self) -> "itkImageD3_Pointer const": """GetJointPDFDerivatives(itkMattesMutualInformationImageToImageMetricIF3IF3 self) -> itkImageD3_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_GetJointPDFDerivatives(self) __swig_destroy__ = _itkMattesMutualInformationImageToImageMetricPython.delete_itkMattesMutualInformationImageToImageMetricIF3IF3 def cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIF3IF3 *": """cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIF3IF3""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_cast(obj) cast = staticmethod(cast) def New(*args, **kargs): """New() -> itkMattesMutualInformationImageToImageMetricIF3IF3 Create a new object of the class itkMattesMutualInformationImageToImageMetricIF3IF3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkMattesMutualInformationImageToImageMetricIF3IF3.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkMattesMutualInformationImageToImageMetricIF3IF3.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkMattesMutualInformationImageToImageMetricIF3IF3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkMattesMutualInformationImageToImageMetricIF3IF3.Clone = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_Clone, None, itkMattesMutualInformationImageToImageMetricIF3IF3) itkMattesMutualInformationImageToImageMetricIF3IF3.SetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_SetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIF3IF3) itkMattesMutualInformationImageToImageMetricIF3IF3.GetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_GetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIF3IF3) itkMattesMutualInformationImageToImageMetricIF3IF3.SetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_SetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIF3IF3) itkMattesMutualInformationImageToImageMetricIF3IF3.GetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_GetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIF3IF3) itkMattesMutualInformationImageToImageMetricIF3IF3.UseExplicitPDFDerivativesOn = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_UseExplicitPDFDerivativesOn, None, itkMattesMutualInformationImageToImageMetricIF3IF3) itkMattesMutualInformationImageToImageMetricIF3IF3.UseExplicitPDFDerivativesOff = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_UseExplicitPDFDerivativesOff, None, itkMattesMutualInformationImageToImageMetricIF3IF3) itkMattesMutualInformationImageToImageMetricIF3IF3.GetJointPDF = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_GetJointPDF, None, itkMattesMutualInformationImageToImageMetricIF3IF3) itkMattesMutualInformationImageToImageMetricIF3IF3.GetJointPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_GetJointPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIF3IF3) itkMattesMutualInformationImageToImageMetricIF3IF3_swigregister = _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_swigregister itkMattesMutualInformationImageToImageMetricIF3IF3_swigregister(itkMattesMutualInformationImageToImageMetricIF3IF3) def itkMattesMutualInformationImageToImageMetricIF3IF3___New_orig__() -> "itkMattesMutualInformationImageToImageMetricIF3IF3_Pointer": """itkMattesMutualInformationImageToImageMetricIF3IF3___New_orig__() -> itkMattesMutualInformationImageToImageMetricIF3IF3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3___New_orig__() def itkMattesMutualInformationImageToImageMetricIF3IF3_cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIF3IF3 *": """itkMattesMutualInformationImageToImageMetricIF3IF3_cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIF3IF3""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIF3IF3_cast(obj) class itkMattesMutualInformationImageToImageMetricISS2ISS2(itkImageToImageMetricPython.itkImageToImageMetricISS2ISS2): """Proxy of C++ itkMattesMutualInformationImageToImageMetricISS2ISS2 class.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def __New_orig__() -> "itkMattesMutualInformationImageToImageMetricISS2ISS2_Pointer": """__New_orig__() -> itkMattesMutualInformationImageToImageMetricISS2ISS2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2___New_orig__() __New_orig__ = staticmethod(__New_orig__) def Clone(self) -> "itkMattesMutualInformationImageToImageMetricISS2ISS2_Pointer": """Clone(itkMattesMutualInformationImageToImageMetricISS2ISS2 self) -> itkMattesMutualInformationImageToImageMetricISS2ISS2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_Clone(self) def SetNumberOfHistogramBins(self, _arg: 'unsigned long long') -> "void": """SetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricISS2ISS2 self, unsigned long long _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_SetNumberOfHistogramBins(self, _arg) def GetNumberOfHistogramBins(self) -> "unsigned long long const &": """GetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricISS2ISS2 self) -> unsigned long long const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_GetNumberOfHistogramBins(self) def SetUseExplicitPDFDerivatives(self, _arg: 'bool const') -> "void": """SetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricISS2ISS2 self, bool const _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_SetUseExplicitPDFDerivatives(self, _arg) def GetUseExplicitPDFDerivatives(self) -> "bool const &": """GetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricISS2ISS2 self) -> bool const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_GetUseExplicitPDFDerivatives(self) def UseExplicitPDFDerivativesOn(self) -> "void": """UseExplicitPDFDerivativesOn(itkMattesMutualInformationImageToImageMetricISS2ISS2 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_UseExplicitPDFDerivativesOn(self) def UseExplicitPDFDerivativesOff(self) -> "void": """UseExplicitPDFDerivativesOff(itkMattesMutualInformationImageToImageMetricISS2ISS2 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_UseExplicitPDFDerivativesOff(self) def GetJointPDF(self) -> "itkImageD2_Pointer const": """GetJointPDF(itkMattesMutualInformationImageToImageMetricISS2ISS2 self) -> itkImageD2_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_GetJointPDF(self) def GetJointPDFDerivatives(self) -> "itkImageD3_Pointer const": """GetJointPDFDerivatives(itkMattesMutualInformationImageToImageMetricISS2ISS2 self) -> itkImageD3_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_GetJointPDFDerivatives(self) __swig_destroy__ = _itkMattesMutualInformationImageToImageMetricPython.delete_itkMattesMutualInformationImageToImageMetricISS2ISS2 def cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricISS2ISS2 *": """cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricISS2ISS2""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_cast(obj) cast = staticmethod(cast) def New(*args, **kargs): """New() -> itkMattesMutualInformationImageToImageMetricISS2ISS2 Create a new object of the class itkMattesMutualInformationImageToImageMetricISS2ISS2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkMattesMutualInformationImageToImageMetricISS2ISS2.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkMattesMutualInformationImageToImageMetricISS2ISS2.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkMattesMutualInformationImageToImageMetricISS2ISS2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkMattesMutualInformationImageToImageMetricISS2ISS2.Clone = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_Clone, None, itkMattesMutualInformationImageToImageMetricISS2ISS2) itkMattesMutualInformationImageToImageMetricISS2ISS2.SetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_SetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricISS2ISS2) itkMattesMutualInformationImageToImageMetricISS2ISS2.GetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_GetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricISS2ISS2) itkMattesMutualInformationImageToImageMetricISS2ISS2.SetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_SetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricISS2ISS2) itkMattesMutualInformationImageToImageMetricISS2ISS2.GetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_GetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricISS2ISS2) itkMattesMutualInformationImageToImageMetricISS2ISS2.UseExplicitPDFDerivativesOn = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_UseExplicitPDFDerivativesOn, None, itkMattesMutualInformationImageToImageMetricISS2ISS2) itkMattesMutualInformationImageToImageMetricISS2ISS2.UseExplicitPDFDerivativesOff = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_UseExplicitPDFDerivativesOff, None, itkMattesMutualInformationImageToImageMetricISS2ISS2) itkMattesMutualInformationImageToImageMetricISS2ISS2.GetJointPDF = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_GetJointPDF, None, itkMattesMutualInformationImageToImageMetricISS2ISS2) itkMattesMutualInformationImageToImageMetricISS2ISS2.GetJointPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_GetJointPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricISS2ISS2) itkMattesMutualInformationImageToImageMetricISS2ISS2_swigregister = _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_swigregister itkMattesMutualInformationImageToImageMetricISS2ISS2_swigregister(itkMattesMutualInformationImageToImageMetricISS2ISS2) def itkMattesMutualInformationImageToImageMetricISS2ISS2___New_orig__() -> "itkMattesMutualInformationImageToImageMetricISS2ISS2_Pointer": """itkMattesMutualInformationImageToImageMetricISS2ISS2___New_orig__() -> itkMattesMutualInformationImageToImageMetricISS2ISS2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2___New_orig__() def itkMattesMutualInformationImageToImageMetricISS2ISS2_cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricISS2ISS2 *": """itkMattesMutualInformationImageToImageMetricISS2ISS2_cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricISS2ISS2""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS2ISS2_cast(obj) class itkMattesMutualInformationImageToImageMetricISS3ISS3(itkImageToImageMetricPython.itkImageToImageMetricISS3ISS3): """Proxy of C++ itkMattesMutualInformationImageToImageMetricISS3ISS3 class.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def __New_orig__() -> "itkMattesMutualInformationImageToImageMetricISS3ISS3_Pointer": """__New_orig__() -> itkMattesMutualInformationImageToImageMetricISS3ISS3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3___New_orig__() __New_orig__ = staticmethod(__New_orig__) def Clone(self) -> "itkMattesMutualInformationImageToImageMetricISS3ISS3_Pointer": """Clone(itkMattesMutualInformationImageToImageMetricISS3ISS3 self) -> itkMattesMutualInformationImageToImageMetricISS3ISS3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_Clone(self) def SetNumberOfHistogramBins(self, _arg: 'unsigned long long') -> "void": """SetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricISS3ISS3 self, unsigned long long _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_SetNumberOfHistogramBins(self, _arg) def GetNumberOfHistogramBins(self) -> "unsigned long long const &": """GetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricISS3ISS3 self) -> unsigned long long const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_GetNumberOfHistogramBins(self) def SetUseExplicitPDFDerivatives(self, _arg: 'bool const') -> "void": """SetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricISS3ISS3 self, bool const _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_SetUseExplicitPDFDerivatives(self, _arg) def GetUseExplicitPDFDerivatives(self) -> "bool const &": """GetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricISS3ISS3 self) -> bool const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_GetUseExplicitPDFDerivatives(self) def UseExplicitPDFDerivativesOn(self) -> "void": """UseExplicitPDFDerivativesOn(itkMattesMutualInformationImageToImageMetricISS3ISS3 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_UseExplicitPDFDerivativesOn(self) def UseExplicitPDFDerivativesOff(self) -> "void": """UseExplicitPDFDerivativesOff(itkMattesMutualInformationImageToImageMetricISS3ISS3 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_UseExplicitPDFDerivativesOff(self) def GetJointPDF(self) -> "itkImageD2_Pointer const": """GetJointPDF(itkMattesMutualInformationImageToImageMetricISS3ISS3 self) -> itkImageD2_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_GetJointPDF(self) def GetJointPDFDerivatives(self) -> "itkImageD3_Pointer const": """GetJointPDFDerivatives(itkMattesMutualInformationImageToImageMetricISS3ISS3 self) -> itkImageD3_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_GetJointPDFDerivatives(self) __swig_destroy__ = _itkMattesMutualInformationImageToImageMetricPython.delete_itkMattesMutualInformationImageToImageMetricISS3ISS3 def cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricISS3ISS3 *": """cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricISS3ISS3""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_cast(obj) cast = staticmethod(cast) def New(*args, **kargs): """New() -> itkMattesMutualInformationImageToImageMetricISS3ISS3 Create a new object of the class itkMattesMutualInformationImageToImageMetricISS3ISS3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkMattesMutualInformationImageToImageMetricISS3ISS3.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkMattesMutualInformationImageToImageMetricISS3ISS3.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkMattesMutualInformationImageToImageMetricISS3ISS3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkMattesMutualInformationImageToImageMetricISS3ISS3.Clone = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_Clone, None, itkMattesMutualInformationImageToImageMetricISS3ISS3) itkMattesMutualInformationImageToImageMetricISS3ISS3.SetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_SetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricISS3ISS3) itkMattesMutualInformationImageToImageMetricISS3ISS3.GetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_GetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricISS3ISS3) itkMattesMutualInformationImageToImageMetricISS3ISS3.SetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_SetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricISS3ISS3) itkMattesMutualInformationImageToImageMetricISS3ISS3.GetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_GetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricISS3ISS3) itkMattesMutualInformationImageToImageMetricISS3ISS3.UseExplicitPDFDerivativesOn = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_UseExplicitPDFDerivativesOn, None, itkMattesMutualInformationImageToImageMetricISS3ISS3) itkMattesMutualInformationImageToImageMetricISS3ISS3.UseExplicitPDFDerivativesOff = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_UseExplicitPDFDerivativesOff, None, itkMattesMutualInformationImageToImageMetricISS3ISS3) itkMattesMutualInformationImageToImageMetricISS3ISS3.GetJointPDF = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_GetJointPDF, None, itkMattesMutualInformationImageToImageMetricISS3ISS3) itkMattesMutualInformationImageToImageMetricISS3ISS3.GetJointPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_GetJointPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricISS3ISS3) itkMattesMutualInformationImageToImageMetricISS3ISS3_swigregister = _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_swigregister itkMattesMutualInformationImageToImageMetricISS3ISS3_swigregister(itkMattesMutualInformationImageToImageMetricISS3ISS3) def itkMattesMutualInformationImageToImageMetricISS3ISS3___New_orig__() -> "itkMattesMutualInformationImageToImageMetricISS3ISS3_Pointer": """itkMattesMutualInformationImageToImageMetricISS3ISS3___New_orig__() -> itkMattesMutualInformationImageToImageMetricISS3ISS3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3___New_orig__() def itkMattesMutualInformationImageToImageMetricISS3ISS3_cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricISS3ISS3 *": """itkMattesMutualInformationImageToImageMetricISS3ISS3_cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricISS3ISS3""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricISS3ISS3_cast(obj) class itkMattesMutualInformationImageToImageMetricIUC2IUC2(itkImageToImageMetricPython.itkImageToImageMetricIUC2IUC2): """Proxy of C++ itkMattesMutualInformationImageToImageMetricIUC2IUC2 class.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def __New_orig__() -> "itkMattesMutualInformationImageToImageMetricIUC2IUC2_Pointer": """__New_orig__() -> itkMattesMutualInformationImageToImageMetricIUC2IUC2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2___New_orig__() __New_orig__ = staticmethod(__New_orig__) def Clone(self) -> "itkMattesMutualInformationImageToImageMetricIUC2IUC2_Pointer": """Clone(itkMattesMutualInformationImageToImageMetricIUC2IUC2 self) -> itkMattesMutualInformationImageToImageMetricIUC2IUC2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_Clone(self) def SetNumberOfHistogramBins(self, _arg: 'unsigned long long') -> "void": """SetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIUC2IUC2 self, unsigned long long _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_SetNumberOfHistogramBins(self, _arg) def GetNumberOfHistogramBins(self) -> "unsigned long long const &": """GetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIUC2IUC2 self) -> unsigned long long const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_GetNumberOfHistogramBins(self) def SetUseExplicitPDFDerivatives(self, _arg: 'bool const') -> "void": """SetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUC2IUC2 self, bool const _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_SetUseExplicitPDFDerivatives(self, _arg) def GetUseExplicitPDFDerivatives(self) -> "bool const &": """GetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUC2IUC2 self) -> bool const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_GetUseExplicitPDFDerivatives(self) def UseExplicitPDFDerivativesOn(self) -> "void": """UseExplicitPDFDerivativesOn(itkMattesMutualInformationImageToImageMetricIUC2IUC2 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_UseExplicitPDFDerivativesOn(self) def UseExplicitPDFDerivativesOff(self) -> "void": """UseExplicitPDFDerivativesOff(itkMattesMutualInformationImageToImageMetricIUC2IUC2 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_UseExplicitPDFDerivativesOff(self) def GetJointPDF(self) -> "itkImageD2_Pointer const": """GetJointPDF(itkMattesMutualInformationImageToImageMetricIUC2IUC2 self) -> itkImageD2_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_GetJointPDF(self) def GetJointPDFDerivatives(self) -> "itkImageD3_Pointer const": """GetJointPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUC2IUC2 self) -> itkImageD3_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_GetJointPDFDerivatives(self) __swig_destroy__ = _itkMattesMutualInformationImageToImageMetricPython.delete_itkMattesMutualInformationImageToImageMetricIUC2IUC2 def cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIUC2IUC2 *": """cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIUC2IUC2""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_cast(obj) cast = staticmethod(cast) def New(*args, **kargs): """New() -> itkMattesMutualInformationImageToImageMetricIUC2IUC2 Create a new object of the class itkMattesMutualInformationImageToImageMetricIUC2IUC2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkMattesMutualInformationImageToImageMetricIUC2IUC2.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkMattesMutualInformationImageToImageMetricIUC2IUC2.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkMattesMutualInformationImageToImageMetricIUC2IUC2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkMattesMutualInformationImageToImageMetricIUC2IUC2.Clone = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_Clone, None, itkMattesMutualInformationImageToImageMetricIUC2IUC2) itkMattesMutualInformationImageToImageMetricIUC2IUC2.SetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_SetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIUC2IUC2) itkMattesMutualInformationImageToImageMetricIUC2IUC2.GetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_GetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIUC2IUC2) itkMattesMutualInformationImageToImageMetricIUC2IUC2.SetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_SetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUC2IUC2) itkMattesMutualInformationImageToImageMetricIUC2IUC2.GetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_GetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUC2IUC2) itkMattesMutualInformationImageToImageMetricIUC2IUC2.UseExplicitPDFDerivativesOn = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_UseExplicitPDFDerivativesOn, None, itkMattesMutualInformationImageToImageMetricIUC2IUC2) itkMattesMutualInformationImageToImageMetricIUC2IUC2.UseExplicitPDFDerivativesOff = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_UseExplicitPDFDerivativesOff, None, itkMattesMutualInformationImageToImageMetricIUC2IUC2) itkMattesMutualInformationImageToImageMetricIUC2IUC2.GetJointPDF = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_GetJointPDF, None, itkMattesMutualInformationImageToImageMetricIUC2IUC2) itkMattesMutualInformationImageToImageMetricIUC2IUC2.GetJointPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_GetJointPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUC2IUC2) itkMattesMutualInformationImageToImageMetricIUC2IUC2_swigregister = _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_swigregister itkMattesMutualInformationImageToImageMetricIUC2IUC2_swigregister(itkMattesMutualInformationImageToImageMetricIUC2IUC2) def itkMattesMutualInformationImageToImageMetricIUC2IUC2___New_orig__() -> "itkMattesMutualInformationImageToImageMetricIUC2IUC2_Pointer": """itkMattesMutualInformationImageToImageMetricIUC2IUC2___New_orig__() -> itkMattesMutualInformationImageToImageMetricIUC2IUC2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2___New_orig__() def itkMattesMutualInformationImageToImageMetricIUC2IUC2_cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIUC2IUC2 *": """itkMattesMutualInformationImageToImageMetricIUC2IUC2_cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIUC2IUC2""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC2IUC2_cast(obj) class itkMattesMutualInformationImageToImageMetricIUC3IUC3(itkImageToImageMetricPython.itkImageToImageMetricIUC3IUC3): """Proxy of C++ itkMattesMutualInformationImageToImageMetricIUC3IUC3 class.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def __New_orig__() -> "itkMattesMutualInformationImageToImageMetricIUC3IUC3_Pointer": """__New_orig__() -> itkMattesMutualInformationImageToImageMetricIUC3IUC3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3___New_orig__() __New_orig__ = staticmethod(__New_orig__) def Clone(self) -> "itkMattesMutualInformationImageToImageMetricIUC3IUC3_Pointer": """Clone(itkMattesMutualInformationImageToImageMetricIUC3IUC3 self) -> itkMattesMutualInformationImageToImageMetricIUC3IUC3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_Clone(self) def SetNumberOfHistogramBins(self, _arg: 'unsigned long long') -> "void": """SetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIUC3IUC3 self, unsigned long long _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_SetNumberOfHistogramBins(self, _arg) def GetNumberOfHistogramBins(self) -> "unsigned long long const &": """GetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIUC3IUC3 self) -> unsigned long long const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_GetNumberOfHistogramBins(self) def SetUseExplicitPDFDerivatives(self, _arg: 'bool const') -> "void": """SetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUC3IUC3 self, bool const _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_SetUseExplicitPDFDerivatives(self, _arg) def GetUseExplicitPDFDerivatives(self) -> "bool const &": """GetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUC3IUC3 self) -> bool const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_GetUseExplicitPDFDerivatives(self) def UseExplicitPDFDerivativesOn(self) -> "void": """UseExplicitPDFDerivativesOn(itkMattesMutualInformationImageToImageMetricIUC3IUC3 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_UseExplicitPDFDerivativesOn(self) def UseExplicitPDFDerivativesOff(self) -> "void": """UseExplicitPDFDerivativesOff(itkMattesMutualInformationImageToImageMetricIUC3IUC3 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_UseExplicitPDFDerivativesOff(self) def GetJointPDF(self) -> "itkImageD2_Pointer const": """GetJointPDF(itkMattesMutualInformationImageToImageMetricIUC3IUC3 self) -> itkImageD2_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_GetJointPDF(self) def GetJointPDFDerivatives(self) -> "itkImageD3_Pointer const": """GetJointPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUC3IUC3 self) -> itkImageD3_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_GetJointPDFDerivatives(self) __swig_destroy__ = _itkMattesMutualInformationImageToImageMetricPython.delete_itkMattesMutualInformationImageToImageMetricIUC3IUC3 def cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIUC3IUC3 *": """cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIUC3IUC3""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_cast(obj) cast = staticmethod(cast) def New(*args, **kargs): """New() -> itkMattesMutualInformationImageToImageMetricIUC3IUC3 Create a new object of the class itkMattesMutualInformationImageToImageMetricIUC3IUC3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkMattesMutualInformationImageToImageMetricIUC3IUC3.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkMattesMutualInformationImageToImageMetricIUC3IUC3.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkMattesMutualInformationImageToImageMetricIUC3IUC3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkMattesMutualInformationImageToImageMetricIUC3IUC3.Clone = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_Clone, None, itkMattesMutualInformationImageToImageMetricIUC3IUC3) itkMattesMutualInformationImageToImageMetricIUC3IUC3.SetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_SetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIUC3IUC3) itkMattesMutualInformationImageToImageMetricIUC3IUC3.GetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_GetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIUC3IUC3) itkMattesMutualInformationImageToImageMetricIUC3IUC3.SetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_SetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUC3IUC3) itkMattesMutualInformationImageToImageMetricIUC3IUC3.GetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_GetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUC3IUC3) itkMattesMutualInformationImageToImageMetricIUC3IUC3.UseExplicitPDFDerivativesOn = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_UseExplicitPDFDerivativesOn, None, itkMattesMutualInformationImageToImageMetricIUC3IUC3) itkMattesMutualInformationImageToImageMetricIUC3IUC3.UseExplicitPDFDerivativesOff = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_UseExplicitPDFDerivativesOff, None, itkMattesMutualInformationImageToImageMetricIUC3IUC3) itkMattesMutualInformationImageToImageMetricIUC3IUC3.GetJointPDF = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_GetJointPDF, None, itkMattesMutualInformationImageToImageMetricIUC3IUC3) itkMattesMutualInformationImageToImageMetricIUC3IUC3.GetJointPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_GetJointPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUC3IUC3) itkMattesMutualInformationImageToImageMetricIUC3IUC3_swigregister = _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_swigregister itkMattesMutualInformationImageToImageMetricIUC3IUC3_swigregister(itkMattesMutualInformationImageToImageMetricIUC3IUC3) def itkMattesMutualInformationImageToImageMetricIUC3IUC3___New_orig__() -> "itkMattesMutualInformationImageToImageMetricIUC3IUC3_Pointer": """itkMattesMutualInformationImageToImageMetricIUC3IUC3___New_orig__() -> itkMattesMutualInformationImageToImageMetricIUC3IUC3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3___New_orig__() def itkMattesMutualInformationImageToImageMetricIUC3IUC3_cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIUC3IUC3 *": """itkMattesMutualInformationImageToImageMetricIUC3IUC3_cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIUC3IUC3""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUC3IUC3_cast(obj) class itkMattesMutualInformationImageToImageMetricIUS2IUS2(itkImageToImageMetricPython.itkImageToImageMetricIUS2IUS2): """Proxy of C++ itkMattesMutualInformationImageToImageMetricIUS2IUS2 class.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def __New_orig__() -> "itkMattesMutualInformationImageToImageMetricIUS2IUS2_Pointer": """__New_orig__() -> itkMattesMutualInformationImageToImageMetricIUS2IUS2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2___New_orig__() __New_orig__ = staticmethod(__New_orig__) def Clone(self) -> "itkMattesMutualInformationImageToImageMetricIUS2IUS2_Pointer": """Clone(itkMattesMutualInformationImageToImageMetricIUS2IUS2 self) -> itkMattesMutualInformationImageToImageMetricIUS2IUS2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_Clone(self) def SetNumberOfHistogramBins(self, _arg: 'unsigned long long') -> "void": """SetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIUS2IUS2 self, unsigned long long _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_SetNumberOfHistogramBins(self, _arg) def GetNumberOfHistogramBins(self) -> "unsigned long long const &": """GetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIUS2IUS2 self) -> unsigned long long const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_GetNumberOfHistogramBins(self) def SetUseExplicitPDFDerivatives(self, _arg: 'bool const') -> "void": """SetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUS2IUS2 self, bool const _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_SetUseExplicitPDFDerivatives(self, _arg) def GetUseExplicitPDFDerivatives(self) -> "bool const &": """GetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUS2IUS2 self) -> bool const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_GetUseExplicitPDFDerivatives(self) def UseExplicitPDFDerivativesOn(self) -> "void": """UseExplicitPDFDerivativesOn(itkMattesMutualInformationImageToImageMetricIUS2IUS2 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_UseExplicitPDFDerivativesOn(self) def UseExplicitPDFDerivativesOff(self) -> "void": """UseExplicitPDFDerivativesOff(itkMattesMutualInformationImageToImageMetricIUS2IUS2 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_UseExplicitPDFDerivativesOff(self) def GetJointPDF(self) -> "itkImageD2_Pointer const": """GetJointPDF(itkMattesMutualInformationImageToImageMetricIUS2IUS2 self) -> itkImageD2_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_GetJointPDF(self) def GetJointPDFDerivatives(self) -> "itkImageD3_Pointer const": """GetJointPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUS2IUS2 self) -> itkImageD3_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_GetJointPDFDerivatives(self) __swig_destroy__ = _itkMattesMutualInformationImageToImageMetricPython.delete_itkMattesMutualInformationImageToImageMetricIUS2IUS2 def cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIUS2IUS2 *": """cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIUS2IUS2""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_cast(obj) cast = staticmethod(cast) def New(*args, **kargs): """New() -> itkMattesMutualInformationImageToImageMetricIUS2IUS2 Create a new object of the class itkMattesMutualInformationImageToImageMetricIUS2IUS2 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkMattesMutualInformationImageToImageMetricIUS2IUS2.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkMattesMutualInformationImageToImageMetricIUS2IUS2.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkMattesMutualInformationImageToImageMetricIUS2IUS2.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkMattesMutualInformationImageToImageMetricIUS2IUS2.Clone = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_Clone, None, itkMattesMutualInformationImageToImageMetricIUS2IUS2) itkMattesMutualInformationImageToImageMetricIUS2IUS2.SetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_SetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIUS2IUS2) itkMattesMutualInformationImageToImageMetricIUS2IUS2.GetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_GetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIUS2IUS2) itkMattesMutualInformationImageToImageMetricIUS2IUS2.SetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_SetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUS2IUS2) itkMattesMutualInformationImageToImageMetricIUS2IUS2.GetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_GetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUS2IUS2) itkMattesMutualInformationImageToImageMetricIUS2IUS2.UseExplicitPDFDerivativesOn = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_UseExplicitPDFDerivativesOn, None, itkMattesMutualInformationImageToImageMetricIUS2IUS2) itkMattesMutualInformationImageToImageMetricIUS2IUS2.UseExplicitPDFDerivativesOff = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_UseExplicitPDFDerivativesOff, None, itkMattesMutualInformationImageToImageMetricIUS2IUS2) itkMattesMutualInformationImageToImageMetricIUS2IUS2.GetJointPDF = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_GetJointPDF, None, itkMattesMutualInformationImageToImageMetricIUS2IUS2) itkMattesMutualInformationImageToImageMetricIUS2IUS2.GetJointPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_GetJointPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUS2IUS2) itkMattesMutualInformationImageToImageMetricIUS2IUS2_swigregister = _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_swigregister itkMattesMutualInformationImageToImageMetricIUS2IUS2_swigregister(itkMattesMutualInformationImageToImageMetricIUS2IUS2) def itkMattesMutualInformationImageToImageMetricIUS2IUS2___New_orig__() -> "itkMattesMutualInformationImageToImageMetricIUS2IUS2_Pointer": """itkMattesMutualInformationImageToImageMetricIUS2IUS2___New_orig__() -> itkMattesMutualInformationImageToImageMetricIUS2IUS2_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2___New_orig__() def itkMattesMutualInformationImageToImageMetricIUS2IUS2_cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIUS2IUS2 *": """itkMattesMutualInformationImageToImageMetricIUS2IUS2_cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIUS2IUS2""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS2IUS2_cast(obj) class itkMattesMutualInformationImageToImageMetricIUS3IUS3(itkImageToImageMetricPython.itkImageToImageMetricIUS3IUS3): """Proxy of C++ itkMattesMutualInformationImageToImageMetricIUS3IUS3 class.""" thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def __New_orig__() -> "itkMattesMutualInformationImageToImageMetricIUS3IUS3_Pointer": """__New_orig__() -> itkMattesMutualInformationImageToImageMetricIUS3IUS3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3___New_orig__() __New_orig__ = staticmethod(__New_orig__) def Clone(self) -> "itkMattesMutualInformationImageToImageMetricIUS3IUS3_Pointer": """Clone(itkMattesMutualInformationImageToImageMetricIUS3IUS3 self) -> itkMattesMutualInformationImageToImageMetricIUS3IUS3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_Clone(self) def SetNumberOfHistogramBins(self, _arg: 'unsigned long long') -> "void": """SetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIUS3IUS3 self, unsigned long long _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_SetNumberOfHistogramBins(self, _arg) def GetNumberOfHistogramBins(self) -> "unsigned long long const &": """GetNumberOfHistogramBins(itkMattesMutualInformationImageToImageMetricIUS3IUS3 self) -> unsigned long long const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_GetNumberOfHistogramBins(self) def SetUseExplicitPDFDerivatives(self, _arg: 'bool const') -> "void": """SetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUS3IUS3 self, bool const _arg)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_SetUseExplicitPDFDerivatives(self, _arg) def GetUseExplicitPDFDerivatives(self) -> "bool const &": """GetUseExplicitPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUS3IUS3 self) -> bool const &""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_GetUseExplicitPDFDerivatives(self) def UseExplicitPDFDerivativesOn(self) -> "void": """UseExplicitPDFDerivativesOn(itkMattesMutualInformationImageToImageMetricIUS3IUS3 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_UseExplicitPDFDerivativesOn(self) def UseExplicitPDFDerivativesOff(self) -> "void": """UseExplicitPDFDerivativesOff(itkMattesMutualInformationImageToImageMetricIUS3IUS3 self)""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_UseExplicitPDFDerivativesOff(self) def GetJointPDF(self) -> "itkImageD2_Pointer const": """GetJointPDF(itkMattesMutualInformationImageToImageMetricIUS3IUS3 self) -> itkImageD2_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_GetJointPDF(self) def GetJointPDFDerivatives(self) -> "itkImageD3_Pointer const": """GetJointPDFDerivatives(itkMattesMutualInformationImageToImageMetricIUS3IUS3 self) -> itkImageD3_Pointer const""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_GetJointPDFDerivatives(self) __swig_destroy__ = _itkMattesMutualInformationImageToImageMetricPython.delete_itkMattesMutualInformationImageToImageMetricIUS3IUS3 def cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIUS3IUS3 *": """cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIUS3IUS3""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_cast(obj) cast = staticmethod(cast) def New(*args, **kargs): """New() -> itkMattesMutualInformationImageToImageMetricIUS3IUS3 Create a new object of the class itkMattesMutualInformationImageToImageMetricIUS3IUS3 and set the input and the parameters if some named or non-named arguments are passed to that method. New() tries to assign all the non named parameters to the input of the new objects - the first non named parameter in the first input, etc. The named parameters are used by calling the method with the same name prefixed by 'Set'. Ex: itkMattesMutualInformationImageToImageMetricIUS3IUS3.New( reader, Threshold=10 ) is (most of the time) equivalent to: obj = itkMattesMutualInformationImageToImageMetricIUS3IUS3.New() obj.SetInput( 0, reader.GetOutput() ) obj.SetThreshold( 10 ) """ obj = itkMattesMutualInformationImageToImageMetricIUS3IUS3.__New_orig__() import itkTemplate itkTemplate.New(obj, *args, **kargs) return obj New = staticmethod(New) itkMattesMutualInformationImageToImageMetricIUS3IUS3.Clone = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_Clone, None, itkMattesMutualInformationImageToImageMetricIUS3IUS3) itkMattesMutualInformationImageToImageMetricIUS3IUS3.SetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_SetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIUS3IUS3) itkMattesMutualInformationImageToImageMetricIUS3IUS3.GetNumberOfHistogramBins = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_GetNumberOfHistogramBins, None, itkMattesMutualInformationImageToImageMetricIUS3IUS3) itkMattesMutualInformationImageToImageMetricIUS3IUS3.SetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_SetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUS3IUS3) itkMattesMutualInformationImageToImageMetricIUS3IUS3.GetUseExplicitPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_GetUseExplicitPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUS3IUS3) itkMattesMutualInformationImageToImageMetricIUS3IUS3.UseExplicitPDFDerivativesOn = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_UseExplicitPDFDerivativesOn, None, itkMattesMutualInformationImageToImageMetricIUS3IUS3) itkMattesMutualInformationImageToImageMetricIUS3IUS3.UseExplicitPDFDerivativesOff = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_UseExplicitPDFDerivativesOff, None, itkMattesMutualInformationImageToImageMetricIUS3IUS3) itkMattesMutualInformationImageToImageMetricIUS3IUS3.GetJointPDF = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_GetJointPDF, None, itkMattesMutualInformationImageToImageMetricIUS3IUS3) itkMattesMutualInformationImageToImageMetricIUS3IUS3.GetJointPDFDerivatives = new_instancemethod(_itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_GetJointPDFDerivatives, None, itkMattesMutualInformationImageToImageMetricIUS3IUS3) itkMattesMutualInformationImageToImageMetricIUS3IUS3_swigregister = _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_swigregister itkMattesMutualInformationImageToImageMetricIUS3IUS3_swigregister(itkMattesMutualInformationImageToImageMetricIUS3IUS3) def itkMattesMutualInformationImageToImageMetricIUS3IUS3___New_orig__() -> "itkMattesMutualInformationImageToImageMetricIUS3IUS3_Pointer": """itkMattesMutualInformationImageToImageMetricIUS3IUS3___New_orig__() -> itkMattesMutualInformationImageToImageMetricIUS3IUS3_Pointer""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3___New_orig__() def itkMattesMutualInformationImageToImageMetricIUS3IUS3_cast(obj: 'itkLightObject') -> "itkMattesMutualInformationImageToImageMetricIUS3IUS3 *": """itkMattesMutualInformationImageToImageMetricIUS3IUS3_cast(itkLightObject obj) -> itkMattesMutualInformationImageToImageMetricIUS3IUS3""" return _itkMattesMutualInformationImageToImageMetricPython.itkMattesMutualInformationImageToImageMetricIUS3IUS3_cast(obj)
[ "pinar.turkyilmaz@estudiant.upc.edu" ]
pinar.turkyilmaz@estudiant.upc.edu
7b2a69f3ac172111bffd9b484e13e7b56ac6be8a
2a0c2b3b682fdc7a49ff2ea107f53ac4b8fb5d20
/tool/mySpiderUtil/getFontTTF/__init__.py
09fb027b761e9a2e1580ff3f506b9974fab89d76
[]
no_license
NoobsZero/DesignMode
29f8327c09ecd8f26e9fc3c8618e5fba3de712b2
161997377020436491520a10fc3ac927469458f1
refs/heads/master
2023-07-08T04:24:59.776257
2021-08-17T05:55:46
2021-08-17T05:55:46
303,366,863
1
0
null
null
null
null
UTF-8
Python
false
false
139
py
# encoding: utf-8 """ @file: __init__.py.py @time: 2021/6/11 10:54 @author: Chen @contact: Afakerchen@em-data.com.cn @software: PyCharm """
[ "870628995@qq.com" ]
870628995@qq.com
24940e00c644513f38be88fb79e726ba911f152c
3591ab22e1cc0fc1362f909017a8aa5c2b53bd92
/FundNavSpiders/Cookie/20180504_ygh_HaiHangDYQiHuo.py
f05a27560ebeffb699133df25782c69739a91286
[]
no_license
Wnltc/ggscrapy
ef7e9559ce6140e7147f539778e25fc7f6cbee4c
bf929112e14b875a583803fe92980fe67129bdac
refs/heads/master
2023-03-15T22:00:45.377540
2018-06-06T02:19:14
2018-06-06T02:19:14
null
0
0
null
null
null
null
UTF-8
Python
false
false
8,358
py
# coding:utf-8 # Department : 保障部 # Author : 袁龚浩 # Create_date : 2018-05-02 from datetime import datetime from FundNavSpiders import GGFundNavSpider from FundNavSpiders import GGFundNavItem import json class HangHaiDYQiHuoSpider(GGFundNavSpider): name = 'FundNav_HaiHangDYQiHuo' sitename = '海航东银期货' channel = '期货净值' allowed_domains = ['www.dyqh.com.cn'] username = '13916427906' password = 'ZYYXSM123' # 跑数据前请更换最新cookies,不更换会造成漏抓产品 cookies = '__guid=98848536.420203476737738300.1516165948645.9883; ASP.NET_SessionId=5yq3xv5kiz4nz5hd5l511jwh; popped=yes; monitor_count=17' fps = [{ 'url': 'http://www.dyqh.com.cn/wealth-product.aspx?Index=4&Type=1&BItem=1&Item=0', 'form': { '__VIEWSTATE': 'of1ydSBodTI84LFaJVoo2fSQI0Z3x+7rH84tHic+6JAjWf+b6GaS7CqQwYZ1ciRvr1oaGiJPNPI6oc5oe7zxzlI9elMy3yDgZvqh5iPGsL/UAwRXnpdGJKg++t1HiuvSefU6mXCFFTgueqEe1swrg6PTLNjyd3sICgGpA81Pbwl/bLXRpiKzz4dtzj8vtdwCSmsoXwBBLlbi8O+Jz2bliXqj4b9GNif+H7z01uQauFKPhDK2O7t1YmtvMG2Q37m6IY+vDcUpGeB2jz7Ca6dK9ZKUSlhntVw1JpLpksd2+3e37gyOoPZlXn5WDhAtQGC2IIfT9dIpNsgkoTrBJ0UMOqYqQlY8fFOrUlaSEmNpNcXcptROUkmaguu7cKd1r7YXy8z5eBef+DS17r6kZKzC8PKZztojuZlmzpLKfUXtJ1yGZLYnRfMThs2Mj1FkIpFSkkjnS6zpQWlz5soltFgOoDjpH7hA2vKE//fDgUPllphs3Nsko3mYd6TrwWpuku0RBRUlOjU14sZTZlGIoTCoe4/pjGbmau9jBLRtAGGJ8prrTMANssRzAWOZTf6iCXuIRPGG/5OQUj1Iaz7VBypM5tmPAHdkDbm5Uhb4VZF9XnUgsitC6LkfvKEsa1ISgQnN3KBpWFYjEOnevptZAAbtW45nN3tCgIKKwt6UGR0NOEjnLaandpLU9zrQEWjnkRzlx4hT4VS3o8OpcgPcs/SiQuWIUbnfZW9NzWVC2UuN43NfgM9TRv6l/ckJj7dbx842sHZycyGtazjRbTNRkvpf8/2PBXS5vyUazwZuErga6rJ2F5EhiN96PJkvw/uMFIqFe3bmbhyaDWtIb2tbSD31A3MQI+CCj9r351atrfJ3CSspHSXqilIvvNzMDqcOZ6B5sq74VtgYGQkxMi7cPUOQxlBnT7eunjqW9AnUYfVJFs40KLXRc3l5oVNW8osOiaifeTO6TpKKqufhD+bXcDm9J+2b/9XZIxJlYiOwUt4dbU3IazOpmzaC0fr22LGJT4akgScxfFSa8H+Djr+WP07GwI8DrJ0yblnI/+PKVTFZagnUSJ9AtrWbdBJ7EmxoJYlvVJz2PHi49XmPhKW9d5vixNVJRGaKnOrx2FYM5mq9FiBkoPA9CTOJiADEi5MGT8i6jsbQwTlMHaxEnulAAhDdYCiQvjSHe/XEwZJexwFrNzpOXdyvEi2beJv/aiPba1Q1khnjoIEa6Ckmkz+UsGgp0LIjybJPbqk/64Ftw01TfqfKkr37qtPH7TwYCGIkFAESqLAl4TnoW1B3EVMz8MStMwct572AO7qxtcTSqZYB4nc/WAT0G2H9m50F5wxSopIXHwTUDcFWtRJfxNSd1z91TFPb/bCzjy+Hb11xjXNy9gfr9wMLWZmsQ3bOoOpO5vgvg27pmBxvUetXCPLtz/WR8ehEVaDBkt32FMIMaoI0+V7WBaz+MVJn3HMTIEJE0235DmRp79NnqojoVRRK5hwIQUnxSlju74blWMnOovsQyad7tlJ1RXdj4FzACIcCqkp7KOQYqlexHHb5vxmsIFMnucGN06Bz+EMKi802GX2/1qqPgOzdFS6pTr4j8b/+JAAvXtvX05ldEEwm27OwVjBNarEoiEHANd4L+W/AqhSnHcQWp63SzTchfkUugnU8A4ySWjSaP0BIGcdrAulQVuIdRcqOIb+t0af2polC7xSJTWsILukrdTWKST1kzF2i3Qvsxyn+pXoO6S8cqWW377acT0VNwvXZZOMNmGuOl+txlbcEXCk0z0l0Cy9G53rXCsCXIUVweLKwO6E14hnkbVlY5tKN3ZmlJ7E3X9NhAqQ/96mcub9XmarNJh1j7PDZLbnjm/ZLg/XhQzpWFWc/4BE4MSORA8W6didAoi3soyOfvmGSTJyO+91kld4nqvekfcQPx+nTgVXwTYOICq84m/ShpMHxqbcIuKeMFqtgRWjLahmHov/vgyTylsGPf49VgywCkXnI3nzTmRgN8VozJhE0GZZgwdY0JWU0ufjn5FfNAdbFLXyDcst9U/T2H3B7jGl0v+HfHWVQcW1P6whicEm2KvI8+OexjGMrctrqJVlvSZIB/PmVc05Y/mnKRjFnAYqmJ8ucCc0h2CFWuBB9OX04+hiVsipwGSNkGkeXNz5xiWN2uxaBOGESofehvZTgQNAoHWOpk1BZby0ZUBMAXAjRk4vM8QllwLKm7zAIozWAkeo7tCSQiNsTozzE7LCSLlKD80kx7lmoa2NzAELfITpJA/J5Qu3QvISdnNbvBj3GaLbXMVw+IyqFiBNGYXvG7hTNT7qRjNR+GtgBbLhVwsxGrc9pBXrwpA7ovoLSUeTi2lSMiW+Wl17vd8rLJ7Ubr1JQ852mBLRGVJc6EEAKCYN0+rX1eA0HwRrNamygCkkWe0XI2UP1WdxNKsiIUNyQkk//yUMvAWCE1N5AvLDhu3cxeFASzKbISefVFViurGiiqRi3a51xXYg+71d2Pbs0iSgrpG3dB0DTGIQCSgjWLPJs+/XkM2pTSsEXZJFS0BNFxVEtg8lhpv6Yu2IaPkaEKok7QbogmUu1ihMpF97W2XFnmYoJpKoN2o8ed/bopsIoeV1AHq9rT44GvGKkH65TEg1Uk+iGIFFvf0/DSC4MNm+nIKCxOlQYhwhOBAM3YGYQYsaJ/O1P', '__EVENTTARGET': 'pgServer', '__EVENTARGUMENT': '1', }, 'headers': {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'}, 'pg': 1, }] def parse_fund(self, response): pg = response.meta['pg'] codes = response.xpath('//div[@class = "notice-content-top"]//li//dt/a//@href').extract() fund_names = response.xpath('//div[@class = "notice-content-top"]//li//dt/a//p//text()').extract() for fund_code, fund_name in zip(codes, fund_names): ips_url = 'http://www.dyqh.com.cn/Handler/GetWealthNet.ashx?Id=' + fund_code.split('=')[1] self.ips.append({ 'url': ips_url, 'ref': response.url, 'headers': { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'}, 'ext': fund_name }) max_page = response.xpath('//div[@id = "pgServer"]//text()').extract()[-4] if pg < int(max_page): next_pg = pg + 1 self.fps.append({ 'url': 'http://www.dyqh.com.cn/wealth-product.aspx?Index=4&Type=1&BItem=1&Item=0', 'form': { '__VIEWSTATE': 'orfWgLPfYWRTnlD44Yt1FPlhap+tlk5m2cBOLALy7Or2Ie67wX3ujwvg1qFhUX88/z6c0KyNBrLJ4KQECZ8Ar+NlqozcKoXq55Dgr1DUWd9LFtP8+Z3TxZ3A8iErUDICZUi/ZvtM/A5MoW5tA9kLTQghdteFVBxTDFea6PuZv+f0wVyw1CxtoQTSKhrjTBewp0mpX8N8cSVNBTq+p7Cedo4sVbWko4CZQ9yehZ9bkRUBxyx859/tZGQytbGCJy5Yp+czWEckOLgxI4p7vcwgt9tHjlnYY7/6XyKFz3lzIhOYFMYEIBXS2Qu+MIbovYr8VURG2TC3UiTQx+/24c3tT2W+itijuzOH6YkgD06Vc73ZWdkfzus8CB+mwpLKg+8BFGckDRaJAV705wmEVGFvuPiZ3EddokwdXRWJo8H/xnZ6IXtQqoMHPCSt24hCF5M4iPwObwf+TWlhQyXXw/dy021GwuBRmYNebirPAz8Ror/uMBIwAYkqgshIcKBZyIXvqGjEe7UpTA/L3AAPoGBEZYaiWO33PLYz/Ue6xeI/OxJB0P/+aLHB5D+7e8LAMYfq3W35hUEWqVpC0k9dsrAr8reCc08o5/lkQXjn2FtxKN0KPh2Iv19t2r10/jh94zRhMVRE/ud6on4TInBhTFwakrM5t5ISkfluC//bP+ZANjAvKOcIQZdllcrFZ5pq5XGkwg3kyY3Jh26VJDyYoXmj4ceaf9cTUg2CnHj+8yrqMH5gmZui+kjKp4t9Xxyl+7e7uinSbJCqVXd4TmFK7mpUfxt+WrhHio96Q8bUeGlhlWXI2oeEhcO9Jm1EKI1LAAIPLR0ctJr5j+sM5WouMQorT4zrSm6stKRXSYvdlv/YYe2A7JgxapwWDZEK2mqpfKqezAdEDbhezkiPcwmJj0b0bFWAWCRjLI0ZMTk/T/ORgJeuZZ0mPZPuIN2h9uz/uakNskoODPQtSKsnGnuN/rE4XVKTdcALNEvIHfHpGlwW1Gjj4LImrylwmj5KRmmT1IcaC//bYEPZzHvXZstcf6uH+SmiT95YdxBK5i0t63RkvXsX27KY5ADTXgHU2E5uRF3cD2fVAMRB28hM3DlCJ9q9F4VMQZQDj3fkwKow/WigOfuXAtIueaVVdPVYXGvx5GwS9+DqytC2hiq428XCq7NswYjdBio9l3on8Ltk/ACCHj38GpRUMSVVLo+xFKig+gzbWNo7iu3BsyQ7OBvIbqwRDPNswEMTHmsMJa7CI7FiPTHHniFgRWd7bt5pUEi8sX5g7AUIqxfCr731pZWxe8gkndWHJy7euY2L1LZsQFK5Xx7Vl0cvltCYEoc6SLQmNzYTNN134a98jrGHyp2CI+lkhGonku2SZ8bazTaoIhllBp0sEJ45lF50UT5lGy79AAK4AzJJ6+eSxVqRjKhStFHD0J487whVY7I95CU/XWzTaaikG0aalz2LK45nVzcpAVNQp6hcAuGSdo3hJcybKTMOSQa24PmDpDZSYizIfiYDMf2PMJMvVz/hGUNISRpg96fRx19+ykitaoefLVuSIeTT7UaIXERiKlTa5+2wPNaUCVYmsOw72U6mPsEO/fEs2mNoaZ+nRqetldFU/QSr4Vx+SCn3eIyLE/JI7Q73c9SWEeD2nVInVVVgf/Ze3Fd7Fb/zSVnwyE0KUhi7CaI74/q9XMXG2igPklZBLJqiUvqXIDugT8Or4sAU+wWUVTYSM+FczvaAKeezU7B6+t78nmko4TRnJ3v2/aCc27lkztZ/AuDLl5NIwwjLs3V8ji0Gfxc38LGOf1Z9O86/X+B4m2fA/4PGPvsoTlxHrEF4JSTTnHW54oeEqOizOrdELh+MqYhQrtyWyZDn+aWOijVbwq3XR/kmvgPEKZo7pDTyN3xgSXmT9C8DH/5osSVyU45dkwc4GJTZYumKqyaHePUQ6HdXT98ajolpROUMgcCooLiJN/VH35aHNHR4If+mYToDEV4q3I41Dv+vu67IDlZE/njv4EF/Dk0AoWrDGzAemPrapZStZ85vDRge2v0NIKQlM68R8jdPcNG3YUHcRb4dAE9FdrzAk+PFYwRQcjw6Sy6jJ9tbAZUQf/gypMtOQWPC5IQ1PaLk6hPqYfOJQkY4k8r8W7AHWmqCVL/chYR15UiB2yyPPgGlYEjAOpXuqRLY0/FTWux/E6FqiPcp+dgGcHhyB5Rukn58o0rUeWrbLkMGvXkhyPjp3Gwcd2LLgb/hPWvwU42IPosod5z8EcMHPVfzHVhuW9W683H+3PpTr+7Hogw3dLV7k3mqxwFcsYyxax02e3JqgTXX+rrZKiuh5HfF6cQqPYfwE9TN1uABgUHmWqJZYkwiG/1IATYoI3nNJRhVzA+6GxT33nuwHn7cBt1QXnHx/J8Wy+Q603bNEmBWH4tsCn6ip6Vc3z8UyHkAiiDcGk/u14ACGe/qQhP0Crx+vanXqtBynDXCa6cxjwwlCKSKPyCtHpzSDHaOjGgS6wY2p9KAhejtx/vK9g3DxsW+pnsKUHCehllHKSNOTNIxpJTF5RO0HaoX24kARJr1Idy6maetS9dejJwfhqSZaLnyHLOscY2EDmSdhOPoTaObTHfsI34b', '__EVENTTARGET': 'pgServer', '__EVENTARGUMENT': str(next_pg), }, 'headers': {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'}, 'pg': next_pg, }) def parse_item(self, response): fund_name = response.meta['ext'] fund = json.loads(response.text) for i in fund: item = GGFundNavItem() statistic_date = i['NetDate'].replace('0:00:00', '') nav = i['NetEstimate'] item['sitename'] = self.sitename item['channel'] = self.channel item['url'] = response.url item['fund_name'] = fund_name item['statistic_date'] = datetime.strptime(statistic_date, '%Y/%m/%d') item['nav'] = float(nav) if nav is not None else None yield item
[ "songxh@go-goal.com" ]
songxh@go-goal.com
10a0be8ff0647bb8a664bf5229355fe8e245c642
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03291/s377331832.py
862748becfb1ad9796cc654b44a9968803c6871f
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
435
py
s = input() dp = [[0] * (len(s) + 1) for _ in range(4)] dp[0][0] = 1 for i, c in enumerate(s): # use c if c == "A" or c == "?": dp[1][i+1] = dp[0][i] if c == "B" or c == "?": dp[2][i+1] = dp[1][i] if c == "C" or c == "?": dp[3][i+1] = dp[2][i] # not use c for j in range(4): if c == "?": dp[j][i+1] += dp[j][i] * 3 else: dp[j][i+1] += dp[j][i] dp[j][i+1] %= 10**9+7 print(dp[-1][-1])
[ "66529651+Aastha2104@users.noreply.github.com" ]
66529651+Aastha2104@users.noreply.github.com
d80d9361b9b2a5f562f54b6c6ab7714bf12b879c
bb6ebff7a7f6140903d37905c350954ff6599091
/tools/grit/grit/format/policy_templates/writers/ios_plist_writer_unittest.py
14a0cab1edc0f641f2616e5c732fce413fab1ad4
[ "BSD-3-Clause", "BSD-2-Clause", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-unknown", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
PDi-Communication-Systems-Inc/lollipop_external_chromium_org
faa6602bd6bfd9b9b6277ce3cd16df0bd26e7f2f
ccadf4e63dd34be157281f53fe213d09a8c66d2c
refs/heads/master
2022-12-23T18:07:04.568931
2016-04-11T16:03:36
2016-04-11T16:03:36
53,677,925
0
1
BSD-3-Clause
2022-12-09T23:46:46
2016-03-11T15:49:07
C++
UTF-8
Python
false
false
6,156
py
#!/usr/bin/env python # Copyright (c) 2014 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. '''Unit tests for grit.format.policy_templates.writers.ios_plist_writer''' import base64 import functools import os import plistlib import sys if __name__ == '__main__': sys.path.append(os.path.join(os.path.dirname(__file__), '../../../..')) import unittest try: import Cocoa except: Cocoa = None from grit.format.policy_templates.writers import writer_unittest_common class IOSPListWriterUnittest(writer_unittest_common.WriterUnittestCommon): '''Unit tests for IOSPListWriter.''' def _ParseWithPython(self, decode, text): '''Parses a serialized Plist, using Python's plistlib. If |decode| is true then |text| is decoded as Base64 before being deserialized as a Plist.''' if decode: text = base64.b64decode(text) return plistlib.readPlistFromString(text) def _ParseWithCocoa(self, decode, text): '''Parses a serialized Plist, using Cocoa's python bindings. If |decode| is true then |text| is decoded as Base64 before being deserialized as a Plist.''' if decode: data = Cocoa.NSData.alloc().initWithBase64EncodedString_options_(text, 0) else: data = Cocoa.NSData.alloc().initWithBytes_length_(text, len(text)) result = Cocoa.NSPropertyListSerialization. \ propertyListFromData_mutabilityOption_format_errorDescription_( data, Cocoa.NSPropertyListImmutable, None, None) return result[0] def _VerifyGeneratedOutputWithParsers(self, templates, expected_output, parse, decode_and_parse): # Generate the grit output for |templates|. output = self.GetOutput( self.PrepareTest(templates), 'fr', { '_chromium': '1', 'mac_bundle_id': 'com.example.Test' }, 'ios_plist', 'en') # Parse it as a Plist. plist = parse(output) self.assertEquals(len(plist), 2) self.assertTrue('ChromePolicy' in plist) self.assertTrue('EncodedChromePolicy' in plist) # Get the 2 expected fields. chrome_policy = plist['ChromePolicy'] encoded_chrome_policy = plist['EncodedChromePolicy'] # Verify the ChromePolicy. self.assertEquals(chrome_policy, expected_output) # Decode the EncodedChromePolicy and verify it. decoded_chrome_policy = decode_and_parse(encoded_chrome_policy) self.assertEquals(decoded_chrome_policy, expected_output) def _VerifyGeneratedOutput(self, templates, expected): # plistlib is available on all Python platforms. parse = functools.partial(self._ParseWithPython, False) decode_and_parse = functools.partial(self._ParseWithPython, True) self._VerifyGeneratedOutputWithParsers( templates, expected, parse, decode_and_parse) # The Cocoa bindings are available on Mac OS X only. if Cocoa: parse = functools.partial(self._ParseWithCocoa, False) decode_and_parse = functools.partial(self._ParseWithCocoa, True) self._VerifyGeneratedOutputWithParsers( templates, expected, parse, decode_and_parse) def _MakeTemplate(self, name, type, example, extra=''): return ''' { 'policy_definitions': [ { 'name': '%s', 'type': '%s', 'desc': '', 'caption': '', 'supported_on': ['ios:35-'], 'example_value': %s, %s }, ], 'placeholders': [], 'messages': {}, } ''' % (name, type, example, extra) def testEmpty(self): templates = ''' { 'policy_definitions': [], 'placeholders': [], 'messages': {}, } ''' expected = {} self._VerifyGeneratedOutput(templates, expected) def testBoolean(self): templates = self._MakeTemplate('BooleanPolicy', 'main', 'True') expected = { 'BooleanPolicy': True, } self._VerifyGeneratedOutput(templates, expected) def testString(self): templates = self._MakeTemplate('StringPolicy', 'string', '"Foo"') expected = { 'StringPolicy': 'Foo', } self._VerifyGeneratedOutput(templates, expected) def testStringEnum(self): templates = self._MakeTemplate( 'StringEnumPolicy', 'string-enum', '"Foo"', ''' 'items': [ { 'name': 'Foo', 'value': 'Foo', 'caption': '' }, { 'name': 'Bar', 'value': 'Bar', 'caption': '' }, ], ''') expected = { 'StringEnumPolicy': 'Foo', } self._VerifyGeneratedOutput(templates, expected) def testInt(self): templates = self._MakeTemplate('IntPolicy', 'int', '42') expected = { 'IntPolicy': 42, } self._VerifyGeneratedOutput(templates, expected) def testIntEnum(self): templates = self._MakeTemplate( 'IntEnumPolicy', 'int-enum', '42', ''' 'items': [ { 'name': 'Foo', 'value': 100, 'caption': '' }, { 'name': 'Bar', 'value': 42, 'caption': '' }, ], ''') expected = { 'IntEnumPolicy': 42, } self._VerifyGeneratedOutput(templates, expected) def testStringList(self): templates = self._MakeTemplate('StringListPolicy', 'list', '["a", "b"]') expected = { 'StringListPolicy': [ "a", "b" ], } self._VerifyGeneratedOutput(templates, expected) def testListOfDictionary(self): templates = self._MakeTemplate( 'ManagedBookmarks', 'dict', ''' [ { "name": "Google Search", "url": "www.google.com", }, { "name": "Youtube", "url": "www.youtube.com", } ] ''') expected = { 'ManagedBookmarks': [ { "name": "Google Search", "url": "www.google.com" }, { "name": "Youtube", "url": "www.youtube.com" }, ], } self._VerifyGeneratedOutput(templates, expected) if __name__ == '__main__': unittest.main()
[ "mrobbeloth@pdiarm.com" ]
mrobbeloth@pdiarm.com
0f3ceab2ded03ac9f8f286be4adafe0df10dfe98
62cdfa992639a860ab212630b423f86233925a02
/pralon_accounting_reports/wizard/sales_journal.py
aef033b68e97e07f0f1d4b85e9c44db0c3827501
[]
no_license
eksotama/prln-prln
dfd1a411a97dbf8c5f5a22b68c031e205b510a2b
9b3ecc3e1df1e7e795d19a68ab7d915edefc16e8
refs/heads/master
2020-03-25T19:49:08.076300
2015-12-01T07:38:29
2015-12-01T07:38:29
null
0
0
null
null
null
null
UTF-8
Python
false
false
14,844
py
# -*- encoding: utf-8 -*- ############################################################################### # # Vikasa Infinity Anugrah, PT # Copyright (C) 2013 Vikasa Infinity Anugrah <http://www.infi-nity.com> # # 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 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, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see http://www.gnu.org/licenses/. # ############################################################################### from osv import osv, fields from tools.translate import _ from via_jasper_report_utils.framework import register_report_wizard, wizard RPT_NAME = 'Sales Journal' class via_jasper_report(osv.osv_memory): _inherit = 'via.jasper.report' _description = 'Sales Journal' _columns = { # 'rpt_name': fields.text("Report Name", readonly=True), # 'company_ids': fields.many2many('res.company', 'via_report_company_rel', # 'via_report_id', 'company_id', 'Companies'), # 'company_id': fields.many2one('res.company', 'Company'), # 'from_mo': fields.selection(_months, 'From'), # 'from_yr': fields.selection(_get_year, ''), # 'to_mo': fields.selection(_months, 'To'), # 'to_yr': fields.selection(_get_year, ''), # 'from_dt': fields.date('From'), # 'to_dt': fields.date('To'), # 'from_dt_2': fields.date('From'), # 'to_dt_2': fields.date('To'), # 'as_of_dt': fields.date('As of'), # 'as_of_yr': fields.selection(_get_year, 'As of Year'), # 'rpt_output': fields.selection(utility.get_outputs_selection, 'Output Format', # required=True), # 'orderby_ids': fields.many2many('via.report.orderby', 'via_report_orderby_rel', # 'via_report_id', 'orderby_id', 'Order By'), # 'state': fields.selection(_get_states, 'State'), # 'prod_ids': fields.many2many('product.product', # 'via_report_product_rel', # 'via_report_id', # 'product_id', # string='Products'), # 'prod_group_level': fields.integer('Product Grouping Level'), # 'prod_ids_2': fields.many2many('product.product', # 'via_report_product_rel_2', # 'via_report_id', # 'product_id', # string='Products'), # 'prod_lot_ids': fields.many2many('stock.production.lot', # 'via_report_production_lot_rel', # 'via_report_id', # 'lot_id', # string='Product Lots'), # 'prod_lot_ids_2': fields.many2many('stock.production.lot', # 'via_report_production_lot_rel_2', # 'via_report_id', # 'lot_id', # string='Product Lots'), # 'reporting_tree_id': fields.many2one('via.reporting.tree', 'Reporting Tree'), # 'reporting_tree_node_ids': fields.many2many('via.reporting.tree.node', # 'via_report_reporting_tree_node_rel', # 'via_report_id', # 'tree_node_id', # string='Reporting Tree Node'), # 'analytic_acc_ids': fields.many2many('account.analytic.account', # 'via_report_analytic_acc_rel', # 'via_report_id', # 'analytic_acc_id', # string='Analytic Accounts'), # 'acc_ids': fields.many2many('account.account', # 'via_report_acc_rel', # 'via_report_id', # 'acc_id', # string='Accounts'), # 'acc_ids_empty_is_all': fields.boolean('Accounts When Empty Means All'), # 'journal_ids': fields.many2many('account.journal', # 'via_report_journal_rel', # 'via_report_id', # 'journal_id', # string='Journals'), # 'journal_ids_empty_is_all': fields.boolean('Journals When Empty Means All'), # 'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year'), # 'fiscalyear_id_2': fields.many2one('account.fiscalyear', 'Fiscal Year'), # 'target_move': fields.selection([('posted', 'All Posted Entries'), # ('all', 'All Entries'), # ], 'Target Moves'), # 'display_move': fields.boolean('Show Move'), # 'no_zero': fields.boolean('No Zero'), # 'use_indentation': fields.boolean('Use Indentation'), # 'no_wrap': fields.boolean('No Wrap'), # 'display_drcr': fields.boolean('Show Debit & Credit'), # 'display_large': fields.boolean('Large Format'), # 'reference_label': fields.char('Reference Label', size=128), # 'comparison_label': fields.char('Comparison Label', size=128), # 'display_comparison': fields.boolean('Enable Comparison'), # 'from_period_id': fields.many2one('account.period', 'Start Period'), # 'from_period_id_2': fields.many2one('account.period', 'Start Period'), # 'to_period_id': fields.many2one('account.period', 'End Period'), # 'to_period_id_2': fields.many2one('account.period', 'End Period'), # 'date_filter': fields.selection([('filter_no', 'No Filters'), # ('filter_date', 'Date'), # ('filter_period', 'Periods')], 'Filter By'), # 'date_filter_2': fields.selection([('filter_no', 'No Filters'), # ('filter_date', 'Date'), # ('filter_period', 'Periods')], 'Filter By'), # 'location_ids': fields.many2many('stock.location', # 'via_report_location_rel', # 'via_report_id', # 'location_id', # string='Locations'), # 'salesman_ids': fields.many2many('res.users', # 'via_report_salesman_rel', # 'via_report_id', # 'salesman_id', # string='Salesman'), # 'customer_ids': fields.many2many('res.partner', # 'via_report_customer_rel', # 'via_report_id', # 'customer_id', # string='Customer'), # 'customer_addr_ids': fields.many2many('res.partner.address', # 'via_report_customer_addr_rel', # 'via_report_id', # 'customer_addr_id', # string='Customer'), # 'filter_selection': fields.selection(_get_filter_selection, # string='Filter By'), # 'filter_selection_2': fields.selection(_get_filter_selection_2, # string='Filter By'), # 'dept_ids': fields.many2many('hr.department', # 'via_report_dept_rel', # 'via_report_id', # 'dept_id', # string='Departments'), } # DO NOT use the following default dictionary. Use the one in class wizard. # The following is presented for your information regarding the system- # wide defaults. _defaults = { # 'rpt_name': lambda self, cr, uid, ctx: ctx.get('via_jasper_report_utils.rpt_name', None), # 'from_mo': date.today().month, # 'from_yr': date.today().year, # 'to_mo': date.today().month, # 'to_yr': date.today().year, # 'from_dt': str(date.today()), # 'to_dt': str(date.today()), # 'from_dt_2': str(date.today()), # 'to_dt_2': str(date.today()), # 'as_of_dt': str(date.today()), # 'as_of_yr': date.today().year, # 'rpt_output': 'pdf', # 'orderby_ids': orderby_get_ids, # 'company_id': lambda self, cr, uid, ctx: self.pool.get('res.users').browse(cr, uid, uid, context=ctx).company_id.id, # 'prod_group_level': 1, # 'fiscalyear_id': default_fiscalyear_id, # 'target_move': 'posted', # 'date_filter': 'filter_no', } via_jasper_report() class wizard(wizard): _onchange = { } # The structure of _visibility must reflect the placement of the elements. # For example, placing 'company_ids' after 'from_dt' will make 'from_dt' be # placed on top of 'company_ids'. # # To have more than one column, simply put the field names in a list. # For example, the following structure creates two columns with 'company_ids' # located in its own row: # [ # 'company_ids', # ['from_dt', 'to_dt'], # ] # # To put a notebook, place the notebook name prefixed by 'notebook:' and put # a dictionary at the very end of the row list containing the notebook # description such as: # [ # 'company_ids', # 'notebook:notebook_1', # ['from_dt', 'to_dt'], # 'notebook:notebook_2', # { # 'notebook:notebook_1': [ # ('Accounts', [ # ['fiscalyear_id', 'period_id'] # 'acc_ids' # ]) # ('Journals', [ # 'journal_ids' # ]) # ], # 'notebook:notebook_2': [ # ('Filters', [ # ['from_dt_2', 'to_dt_2'] # 'period_id_2' # ]) # ('Notes', [ # 'notes' # ]) # ], # } # ] # A notebook page has a name in the form of: notebook_name + '_' + page_idx. # # To put a separator, place the separator name prefixed by 'separator:'. # # The element to select the report output format has the name 'rpt_output'. # By default, it is located at the very end in its own row before the buttons # to print or cancel printing. # _visibility = [ 'company_ids', ['from_dt', 'to_dt'], ] _required = [ 'from_dt', 'to_dt', ] _readonly = [ ] _attrs = { } _domain = { } _label = { 'from_dt': 'Invoice Date From', } # The values in the dictionary below must be callables with signature: # lambda self, cr, uid, context _defaults = { } # The following is to be used by column state. The entry must be tuple: # (key, value) _states = [ ] # The following is used to specify what columns should appear in a # one-to-many or many-to-many widget. The key must be the field name while # the value must be a list of column names that should appear. _tree_columns = { } def validate_parameters(self, cr, uid, form, context=None): if len(form.company_ids) == 0: raise osv.except_osv(_('Caution !'), _('No page will be printed !')) def print_report(self, cr, uid, form, context=None): self.validate_parameters(cr, uid, form, context=context) # As demonstrated by the following snippet code, this method can return # another report name to be rendered. For example, three report names # are registered with the OERP reporting service: RPT_NAME, RPT_NAME + # '(By Value)', and RPT_NAME + ' (By Quantity)'. Only RPT_NAME has no # report file registered but the name needs to be registered to create # the reporting action. Therefore, a real report name needs to be # returned by this method. Usually a report is selected in this way # because the logic of an available report is orthogonal to the other # available reports. Override method get_service_name_filter below to # select a report because of layout differences like paper size and # orientation. # # if form.rpt_type == 'val': # return RPT_NAME + ' (By Value)' # else: # return RPT_NAME + ' (By Quantity)' # Override this method to return a tuple (callable, context) used to filter # a list of report service names that are available under a particular # report name (e.g., RPT_NAME + ' (By Value)' has rpt_a4_portrait, # rpt_a4_landscape, and rpt_a3_landscape). The callable must have the # following signature: # lambda service_names, context # # Later on the callable will be given a list of report service names in # service_names and a context that is found in the tuple (callable, # context) in context (i.e., the context in the tuple is prepared in this # method to provide information needed by the callable). # # The callable must then return just a single report service name. # # def get_service_name_filter(self, cr, uid, form, context=None): # pass register_report_wizard(RPT_NAME, wizard)
[ "aero@aero.(none)" ]
aero@aero.(none)
bd6301e51bcc84d80811b5a9c3c8e646f908bc2a
dfdb41fdf315819008845949a25800a2a2bd7493
/jacobi_gs_pixelcnn/jacobi_gs_layers.py
54bf547f9e1ec2269564e8e8267c4f9e59465749
[]
no_license
ermongroup/fast_feedforward_computation
1c0507aebd0b10be86970aef2ab5c1a297f3d2a2
6d14294647cfd880f991eacd59c9323643e45ea0
refs/heads/main
2023-08-04T23:05:35.960466
2021-09-25T18:25:36
2021-09-25T18:25:36
376,141,511
17
0
null
null
null
null
UTF-8
Python
false
false
16,133
py
from pixelcnnpp.cached_layers import * import math def sum_rightshift_downshift(rightshifted_pixel, downshifted_row, cols, num_blocks, first_index=True): '''Sums the vertical and horizontal stack.''' if first_index: return rightshifted_pixel + downshifted_row else: # num_block x B x H x W x C downshifted_row = downshifted_row.reshape((num_blocks, -1, *downshifted_row.shape[1:])) rightshifted_pixel = rightshifted_pixel.reshape((num_blocks, -1, *rightshifted_pixel.shape[1:])) # num_block x 1 x B x H x C downshifted_row_pixel = downshifted_row[jnp.arange(num_blocks)[:, None], ..., cols[:, None], :] # num_block x B x H x 1 x C downshifted_row_pixel = downshifted_row_pixel.transpose((0, 2, 3, 1, 4)) sums = downshifted_row_pixel + rightshifted_pixel sums = sums.reshape((-1, *sums.shape[2:])) return sums class down_shifted_conv2d(nn.Module): num_blocks: int original_image_width: int num_filters_out: int batch_size: int image_width: int filter_size: Tuple[int, int] = (2, 3) stride: Tuple[int, int] = (1, 1) @nn.compact def __call__(self, all_inputs, rows, cols, cache_every, run_every, first_index=True): output_width = int(math.ceil(self.image_width // float(self.stride[1]))) output_cache = self.variable('cache', 'output_cache', lambda: jnp.zeros( (self.num_blocks * self.batch_size, 1, output_width, self.num_filters_out) )) conv = WNConv(features=self.num_filters_out, kernel_size=self.filter_size, strides=self.stride) if first_index: pad_left = int((self.filter_size[1] - 1) / 2) pad_right = int((self.filter_size[1] - 1) / 2) pad_top = self.filter_size[0] - 1 pad_down = 0 padded_input = jnp.pad(all_inputs, ((0, 0), (pad_top, pad_down), (pad_left, pad_right), (0, 0)), mode='constant', constant_values=0.) outputs = conv(padded_input) os = output_cache.value.shape should_update_cache = (rows % run_every == 0) run_rows = rows // run_every blockwise_outputs = outputs[:, run_rows[:, None], :, :].transpose((1, 0, 2, 3, 4)) blockwise_cache = output_cache.value.reshape((self.num_blocks, -1, *os[1:])) new_blockwise_cache = jax.vmap(jnp.where)(should_update_cache, blockwise_outputs, blockwise_cache) output_cache.value = new_blockwise_cache.reshape(os) return outputs else: return output_cache.value class down_shifted_deconv2d(nn.Module): num_blocks: int original_image_width: int num_filters_out: int batch_size: int image_width: int filter_size: Tuple[int, int] = (2, 3) stride: Tuple[int, int] = (1, 1) @nn.compact def __call__(self, all_inputs, rows, cols, cache_every, run_every, first_index=True): filter_width = self.filter_size[1] left_pad = filter_width - 1 cache_width = self.image_width * self.stride[0] + left_pad output_cache = self.variable('cache', 'output_cache', lambda: jnp.zeros( (self.num_blocks * self.batch_size, 1, cache_width - 2, self.num_filters_out) )) xs = all_inputs.shape target_shape = [xs[0], None, None, self.num_filters_out] target_shape[1] = deconv_output_length(xs[1], self.filter_size[0], 'valid', output_padding=0, stride=self.stride[0]) target_shape[2] = deconv_output_length(xs[2], self.filter_size[1], 'valid', output_padding=1, stride=self.stride[1]) pad_before_h = self.filter_size[0] - 1 pad_before_w = self.filter_size[1] - 1 pad_after_h = target_shape[1] + self.filter_size[0] - 1 - (xs[1] - 1) * self.stride[0] - 1 - pad_before_h pad_after_w = target_shape[2] + self.filter_size[1] - 1 - (xs[2] - 1) * self.stride[1] - 1 - pad_before_w deconv = WNConvTranspose(features=self.num_filters_out, kernel_size=self.filter_size, strides=self.stride, padding=((pad_before_h, pad_after_h), (pad_before_w, pad_after_w))) if first_index: outputs = deconv(all_inputs) os = output_cache.value.shape blockwise_cache = output_cache.value.reshape((self.num_blocks, -1, *os[1:])) should_update_cache = (rows % run_every == 0) run_rows = rows // run_every blockwise_outputs = outputs[:, run_rows[:, None], 1:-1, :].transpose((1, 0, 2, 3, 4)) new_blockwise_cache = jax.vmap(jnp.where)(should_update_cache, blockwise_outputs, blockwise_cache) output_cache.value = new_blockwise_cache.reshape(os) return outputs[:, :, 1:-1, :] else: return output_cache.value class down_right_shifted_conv2d(nn.Module): num_blocks: int original_image_width: int num_filters_out: int batch_size: int image_width: int filter_size: Tuple[int, int] = (2, 2) stride: Tuple[int, int] = (1, 1) shift_output_right: bool = False @nn.compact def __call__(self, pixel_inputs, rows, cols, cache_every, run_every, first_index=True): filter_height = self.filter_size[0] filter_width = self.filter_size[1] left_pad = filter_width - 1 top_pad = filter_height - 1 cache_height = self.filter_size[0] cache_width = self.image_width + left_pad cache = self.variable('cache', 'cache', lambda: jnp.zeros( (self.batch_size * self.num_blocks, cache_height, cache_width, pixel_inputs.shape[-1]) )) conv = WNConv(features=self.num_filters_out, kernel_size=self.filter_size, strides=self.stride) if first_index: cs = cache.value.shape blockwise_cache = cache.value.reshape((self.num_blocks, -1, *cs[1:])) padded_pixel_inputs = jnp.pad(pixel_inputs, ((0, 0), (self.filter_size[0] - 1, 0), (self.filter_size[1] - 1, 0), (0, 0)), mode='constant', constant_values=0.) should_cache = (rows % cache_every == 0) cache_row = rows // cache_every pads = jnp.arange(0, top_pad + 1) cache_row_ranges = cache_row[:, None] + pads[None, :] new_blockwise_cache = padded_pixel_inputs[:, cache_row_ranges, :, :].transpose((1, 0, 2, 3, 4)) new_blockwise_cache = jax.vmap(jnp.where)(should_cache, new_blockwise_cache, blockwise_cache) cache.value = new_blockwise_cache.reshape(cs) return conv(padded_pixel_inputs) else: # num_blocks x B x H x W x C pixel_inputs = pixel_inputs.reshape((self.num_blocks, -1, *pixel_inputs.shape[1:])) cs = cache.value.shape # num_blocks x B x H x W x C blockwise_cache = cache.value.reshape((self.num_blocks, -1, *cs[1:])) should_cache = (rows % cache_every == 0) & (cols % cache_every == 0) should_run = (rows % run_every == 0) & (cols % run_every == 0) cache_col = cols // cache_every pixel_col = cache_col + left_pad new_blockwise_cache = jax.vmap(jnp.where)( should_cache, # num_blocks x 1 x B x H x C blockwise_cache.at[jnp.arange(0, pixel_col.shape[0])[:, None], :, -1:, pixel_col[:, None], :].set( pixel_inputs.transpose((0, 3, 1, 2, 4))), blockwise_cache ) cache.value = new_blockwise_cache.reshape(cs) ## Run outputs = jnp.zeros((self.num_blocks * self.batch_size, 1, 1, self.num_filters_out)) outputs_view = outputs.reshape((self.num_blocks, -1, *outputs.shape[1:])) width_start = cols // cache_every width_range = width_start[:, None] + jnp.arange(0, filter_width) # num_blocks x filter_width x B x H x C cache_neighborhood = new_blockwise_cache[jnp.arange(0, self.num_blocks)[:, None], :, :, width_range, :] # num_blocks x B x H x filter_width x C cache_neighborhood = cache_neighborhood.transpose((0, 2, 3, 1, 4)) cache_neighborhood = cache_neighborhood.reshape((-1, *cache_neighborhood.shape[2:])) after_conv = conv(cache_neighborhood) after_conv = after_conv.reshape((self.num_blocks, -1, *after_conv.shape[1:])) outputs_view = jax.vmap(jnp.where)(should_run, after_conv, outputs_view) return outputs_view.reshape(outputs.shape) class down_right_shifted_deconv2d(nn.Module): num_blocks: int original_image_width: int num_filters_out: int batch_size: int image_width: int filter_size: Tuple[int, int] = (2, 2) stride: Tuple[int, int] = (1, 1) @nn.compact def __call__(self, pixel_inputs, rows, cols, cache_every, run_every, first_index=True): cache = self.variable('cache', 'cache', lambda: jnp.zeros( (self.num_blocks * self.batch_size, 1, self.image_width * self.stride[1], self.num_filters_out) )) xs = pixel_inputs.shape target_shape = [xs[0], None, None, self.num_filters_out] target_shape[1] = deconv_output_length(xs[1], self.filter_size[0], 'valid', output_padding=0, stride=self.stride[0]) target_shape[2] = deconv_output_length(xs[2], self.filter_size[1], 'valid', output_padding=0, stride=self.stride[1]) pad_before_h = self.filter_size[0] - 1 pad_before_w = self.filter_size[1] - 1 pad_after_h = target_shape[1] + self.filter_size[0] - 1 - (xs[1] - 1) * self.stride[0] - 1 - pad_before_h pad_after_w = target_shape[2] + self.filter_size[1] - 1 - (xs[2] - 1) * self.stride[1] - 1 - pad_before_w deconv = WNConvTranspose(features=self.num_filters_out, kernel_size=self.filter_size, strides=self.stride, padding=((pad_before_h, pad_after_h), (pad_before_w, pad_after_w))) if first_index: outputs = deconv(pixel_inputs) cs = cache.value.shape blockwise_cache = cache.value.reshape((self.num_blocks, -1, *cs[1:])) should_run = (rows % run_every == 0) cache_row = rows // run_every new_blockwise_cache = jax.vmap(jnp.where)( should_run, outputs[:, cache_row[:, None], :, :].transpose((1, 0, 2, 3, 4)), blockwise_cache ) cache.value = new_blockwise_cache.reshape(cs) return outputs else: output_for_cache = deconv(pixel_inputs) cs = cache.value.shape blockwise_cache = cache.value.reshape((self.num_blocks, -1, *cs[1:])) should_cache = (rows % cache_every == 0) & (cols % cache_every == 0) should_run = (rows % run_every == 0) & (cols % run_every == 0) cache_col = cols // cache_every output_for_cache = output_for_cache.reshape((-1, self.batch_size, *output_for_cache.shape[1:])) cache_range_start = cache_col * self.stride[1] cache_range = cache_range_start[:, None] + jnp.arange(0, self.stride[1]) output_for_cache = output_for_cache[:, :, 0:1, :, :] new_blockwise_cache = jax.vmap(jnp.where)( should_cache, blockwise_cache.at[jnp.arange(0, self.num_blocks)[:, None], :, :, cache_range, :].set( output_for_cache.transpose((0, 3, 1, 2, 4)) ), blockwise_cache ) cache.value = new_blockwise_cache.reshape(cs) outputs = jnp.zeros((self.num_blocks * self.batch_size, 1, 1, self.num_filters_out)) output_col = cols // run_every outputs_view = outputs.reshape((self.num_blocks, -1, *outputs.shape[1:])) cache_for_outputs = new_blockwise_cache[jnp.arange(0, self.num_blocks)[:, None], :, :, output_col[:, None], :] outputs_view = jax.vmap(jnp.where)(should_run, cache_for_outputs.transpose((0, 2, 3, 1, 4)), outputs_view) outputs = outputs_view.reshape(outputs.shape) return outputs ''' skip connection parameter : 0 = no skip connection 1 = skip connection where skip input size === input size 2 = skip connection where skip input size === 2 * input size ''' class gated_resnet(nn.Module): num_blocks: int original_image_width: int num_filters: int conv_op: Any batch_size: int image_width: int nonlinearity: Any @nn.compact def __call__(self, og_x, rows, cols, cache_every, run_every, vstack=False, a=None, b=None, first_index=True, train=False): if first_index: if vstack: x = self.conv_op(self.num_blocks, self.original_image_width, self.num_filters, self.batch_size, self.image_width)(self.nonlinearity(og_x), rows, cols, cache_every, run_every, first_index=first_index) if a is not None: x += nin(self.num_filters)(self.nonlinearity(a)) x = self.nonlinearity(x) x = nn.Dropout(0.5, deterministic=not train, broadcast_dims=(1, 2))(x) x = self.conv_op(self.num_blocks, self.original_image_width, 2 * self.num_filters, self.batch_size, self.image_width)(x, rows, cols, cache_every, run_every, first_index) a, b = jnp.split(x, 2, axis=-1) c3 = a * jax.nn.sigmoid(b) return og_x + c3 else: x = self.conv_op(self.num_blocks, self.original_image_width, self.num_filters, self.batch_size, self.image_width)(self.nonlinearity(og_x), rows, cols, cache_every, run_every, first_index=first_index) v_stack_pixel = a if b is not None: v_stack_pixel = jnp.concatenate([a, b], axis=-1) x += nin(self.num_filters)(self.nonlinearity(v_stack_pixel)) x = self.nonlinearity(x) x = nn.Dropout(0.5, deterministic=not train, broadcast_dims=(1, 2))(x) x = self.conv_op(self.num_blocks, self.original_image_width, 2 * self.num_filters, self.batch_size, self.image_width)(x, rows, cols, cache_every, run_every, first_index) a, b = jnp.split(x, 2, axis=-1) c3 = a * jax.nn.sigmoid(b) return og_x + c3 else: if vstack: x = self.conv_op(self.num_blocks, self.original_image_width, self.num_filters, self.batch_size, self.image_width)(self.nonlinearity(og_x), rows, cols, cache_every, run_every, first_index=first_index) if a is not None: x += nin(self.num_filters)(self.nonlinearity(a)) x = self.nonlinearity(x) x = nn.Dropout(0.5, deterministic=not train, broadcast_dims=(1, 2))(x) x = self.conv_op(self.num_blocks, self.original_image_width, 2 * self.num_filters, self.batch_size, self.image_width)(x, rows, cols, cache_every, run_every, first_index) a, b = jnp.split(x, 2, axis=-1) c3 = a * jax.nn.sigmoid(b) return og_x + c3 else: x = self.conv_op(self.num_blocks, self.original_image_width, self.num_filters, self.batch_size, self.image_width)(self.nonlinearity(og_x), rows, cols, cache_every, run_every, first_index=first_index) a_view = a.reshape((self.num_blocks, -1, *a.shape[1:])) cache_col = cols // cache_every v_stack_pixel = a_view[jnp.arange(0, self.num_blocks)[:, None], :, :, cache_col[:, None], :] v_stack_pixel = v_stack_pixel.transpose((0, 2, 3, 1, 4)) if b is not None: b_view = b.reshape((self.num_blocks, -1, *b.shape[1:])) v_stack_pixel = jnp.concatenate([v_stack_pixel, b_view], axis=-1) v_stack_pixel = v_stack_pixel.reshape((-1, *v_stack_pixel.shape[2:])) x += nin(self.num_filters)(self.nonlinearity(v_stack_pixel)) x = self.nonlinearity(x) x = nn.Dropout(0.5, deterministic=not train, broadcast_dims=(1, 2))(x) x = self.conv_op(self.num_blocks, self.original_image_width, 2 * self.num_filters, self.batch_size, self.image_width)(x, rows, cols, cache_every, run_every, first_index) a, b = jnp.split(x, 2, axis=-1) c3 = a * jax.nn.sigmoid(b) return og_x + c3
[ "yang-song@live.cn" ]
yang-song@live.cn
7d76bf001033d051ea34ded6b3e5c8d0d9d5bc2b
aa071e5782c76d8552844329073214ae73f005f0
/Study_9/Study_9.py
cfe964bcbcd8e8a9713f89965fb88d27deb883cd
[ "MIT" ]
permissive
LeeDaeil/PyQt5_study
1feff7a934aa9b46c7e70c4de00e02c49f292db8
ecdd22ce2809ce6f01c8691a7ca75ef1771b7202
refs/heads/master
2021-06-24T09:14:32.358137
2020-12-06T13:35:30
2020-12-06T13:35:30
176,840,877
1
0
null
null
null
null
UTF-8
Python
false
false
1,453
py
import sys from PyQt5.QtWidgets import QDialog, QApplication from ui_data.gui_study_9 import * import Study_9_re_rc # resource file class MyForm(QDialog): def __init__(self): super().__init__() self.ui = Ui_Dialog() self.ui.setupUi(self) self.background_setting() self.initial_interface() # self.show() def background_setting(self): self.back_color ={ 'gray': "background-color: rgb(229, 229, 229);", 'green': "background-color: rgb(0, 170, 0);", 'yellow': "background-color: rgb(0, 170, 0);", 'orange': "background-color: rgb(255, 85, 0);", 'red': "background-color: rgb(255, 0, 0);", } self.back_img = { 'P_1_ON': "image: url(:/Sys/Pump_1_ON.png);", # P_1~6 'P_1_OFF': "image: url(:/Sys/Pump_1_OFF.png);", # P_1~6 'P_2_ON': "image: url(:/Sys/Pump_2_ON.png);", # P_7~9 'P_2_OFF': "image: url(:/Sys/Pump_2_OFF.png);", # P_7~9 'P_3_ON': "image: url(:/Sys/Pump_3_ON.png);", # P_7~9 } def initial_interface(self): self.ui.CSF_1_1.setStyleSheet(self.back_color['gray']) self.ui.CSF_1_2.setStyleSheet(self.back_color['gray']) self.ui.P_1.setStyleSheet(self.back_img['P_1_OFF']) if __name__=="__main__": app = QApplication(sys.argv) w = MyForm() w.show() sys.exit(app.exec_())
[ "dleodlf1004@naver.com" ]
dleodlf1004@naver.com
af5386d8b29e79b56dcf99e9be2b9c056aa19606
4b61ae276d8a198017a5986e72fb2c4d991286b3
/utils/test/visibility_tests/VisibilityDataPrepToolsTestSuite.py
1c8c2cdfd11164f5afad6e168c8b666a2129fd9c
[ "LicenseRef-scancode-warranty-disclaimer", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
NatalieCampos/solutions-geoprocessing-toolbox
b8e13de5b0686d3f0d521e4e4f99520afc965b14
de6b175cd97ad4030fb72b3e66995a018448ffbf
refs/heads/master
2018-01-16T20:20:04.729686
2017-07-20T16:33:41
2017-07-20T16:33:41
24,063,516
0
0
null
null
null
null
UTF-8
Python
false
false
1,274
py
# coding: utf-8 ''' ----------------------------------------------------------------------------- Copyright 2015 Esri 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 License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ----------------------------------------------------------------------------- ================================================== VisibilityDataPrepToolsTestSuite.py -------------------------------------------------- * ArcGIS Desktop 10.X+ or ArcGIS Pro 1.X+ * Python 2.7 or Python 3.4 author: ArcGIS Solutions company: Esri ================================================== description: This test suite collects all of the test cases for the Visibility Data Prep Tools toolboxes: ================================================== history: <date> - <initals> - <modifications> ================================================== '''
[ "mfunk@esri.com" ]
mfunk@esri.com