hexsha
stringlengths
40
40
size
int64
5
2.06M
ext
stringclasses
10 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
248
max_stars_repo_name
stringlengths
5
125
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
listlengths
1
10
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
248
max_issues_repo_name
stringlengths
5
125
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
listlengths
1
10
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
248
max_forks_repo_name
stringlengths
5
125
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
listlengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
2.06M
avg_line_length
float64
1
1.02M
max_line_length
int64
3
1.03M
alphanum_fraction
float64
0
1
count_classes
int64
0
1.6M
score_classes
float64
0
1
count_generators
int64
0
651k
score_generators
float64
0
1
count_decorators
int64
0
990k
score_decorators
float64
0
1
count_async_functions
int64
0
235k
score_async_functions
float64
0
1
count_documentation
int64
0
1.04M
score_documentation
float64
0
1
5510dc6e8363a437e31e7e5a4bf4b7a901eabff1
459
py
Python
cliva_fl/utils/__init__.py
DataManagementLab/thesis-fl_client-side_validation
0f6a35d08966133e6a8c13a110b9307d91f2d9cb
[ "MIT" ]
null
null
null
cliva_fl/utils/__init__.py
DataManagementLab/thesis-fl_client-side_validation
0f6a35d08966133e6a8c13a110b9307d91f2d9cb
[ "MIT" ]
null
null
null
cliva_fl/utils/__init__.py
DataManagementLab/thesis-fl_client-side_validation
0f6a35d08966133e6a8c13a110b9307d91f2d9cb
[ "MIT" ]
null
null
null
from .utils import vc, load_config, tensors_close, tensors_close_sum, rand_true, freivalds_rounds, submul_ratio from .partial_class import partial_class from .validation_set import ValidationSet from .validation_buffer import ValidationBuffer from .register_hooks import register_activation_hooks, register_gradient_hooks from .model_poisoning import gradient_noise from .logger import Logger from .plotter import Plotter from .time_tracker import TimeTracker
51
111
0.873638
0
0
0
0
0
0
0
0
0
0
5513ebc4d50ae6eaae27a3d7a14bbfdad406c427
712
py
Python
brainframe/api/stubs/__init__.py
aotuai/brainframe_python
8397f2fd7a4402716c65d402417995b4862eeb7a
[ "BSD-3-Clause" ]
4
2020-05-20T01:06:10.000Z
2020-09-12T14:23:05.000Z
brainframe/api/stubs/__init__.py
aotuai/brainframe-python
8397f2fd7a4402716c65d402417995b4862eeb7a
[ "BSD-3-Clause" ]
8
2021-04-22T00:02:45.000Z
2022-02-01T08:08:07.000Z
brainframe/api/stubs/__init__.py
aotuai/brainframe-python
8397f2fd7a4402716c65d402417995b4862eeb7a
[ "BSD-3-Clause" ]
2
2021-02-18T07:28:27.000Z
2021-10-08T03:22:10.000Z
from .alerts import AlertStubMixin from .analysis import AnalysisStubMixin from .identities import IdentityStubMixin from .capsules import CapsuleStubMixin from .streams import StreamStubMixin from .zone_statuses import ZoneStatusStubMixin from .zones import ZoneStubMixin from .storage import StorageStubMixin from .alarms import ZoneAlarmStubMixin from .process_image import ProcessImageStubMixIn from .encodings import EncodingStubMixIn from .premises import PremisesStubMixin from .users import UserStubMixin from .licenses import LicenseStubMixIn from .cloud_tokens import CloudTokensStubMixin from .cloud_users import CloudUsersStubMixIn from .oauth2 import OAuth2StubMixIn from .base_stub import BaseStub
37.473684
48
0.873596
0
0
0
0
0
0
0
0
0
0
5515891d5f1f8f61ee9eb8bdb9f6ccda922b50fc
118
py
Python
shgo/__init__.py
rkern/shgo
03315284025e705f64bf84f3f9ba36026f6a7236
[ "MIT" ]
null
null
null
shgo/__init__.py
rkern/shgo
03315284025e705f64bf84f3f9ba36026f6a7236
[ "MIT" ]
null
null
null
shgo/__init__.py
rkern/shgo
03315284025e705f64bf84f3f9ba36026f6a7236
[ "MIT" ]
null
null
null
from shgo.shgo_m.triangulation import * from ._shgo import shgo __all__ = [s for s in dir() if not s.startswith('_')]
29.5
53
0.728814
0
0
0
0
0
0
0
0
3
0.025424
55169c728f2c5da43dc85a640e3450e734567aeb
20,482
py
Python
opusfilter/filters.py
BrightXiaoHan/OpusFilter
804c82a46837fc57ca69934314622043248f6042
[ "MIT" ]
null
null
null
opusfilter/filters.py
BrightXiaoHan/OpusFilter
804c82a46837fc57ca69934314622043248f6042
[ "MIT" ]
null
null
null
opusfilter/filters.py
BrightXiaoHan/OpusFilter
804c82a46837fc57ca69934314622043248f6042
[ "MIT" ]
null
null
null
"""Corpus filtering""" import difflib import itertools import logging import math import os import string from typing import Iterator, List, Tuple import rapidfuzz import regex from langid.langid import LanguageIdentifier, model import pycld2 from bs4 import BeautifulSoup as bs import fasttext from . import FilterABC, ConfigurationError from .util import check_args_compability from .lm import CrossEntropyFilter, CrossEntropyDifferenceFilter, LMClassifierFilter # pylint: disable=W0611 # noqa: F401 from .word_alignment import WordAlignFilter # pylint: disable=W0611 # noqa: F401 from .embeddings import SentenceEmbeddingFilter # pylint: disable=W0611 # noqa: F401 logger = logging.getLogger(__name__) class LengthFilter(FilterABC): """Sentence length filter""" def __init__(self, min_length=1, max_length=100, unit='word', pass_empty=False, **kwargs): min_length, max_length, unit = check_args_compability( min_length, max_length, unit, required_types=[int, int, str], choices=[None, None, ('word', 'char', 'character')], names=['min_length', 'max_length', 'unit']) self.min_length = min_length self.max_length = max_length self.unit = unit self.pass_empty = pass_empty super().__init__(**kwargs) def get_length(self, segment, idx): """Return length of the segment in index""" if self.unit[idx] == 'word': return len(segment.split()) return len(segment) def score(self, pairs): for pair in pairs: yield [self.get_length(segment, idx) for idx, segment in enumerate(pair)] def accept(self, score): if self.pass_empty and sum(score) == 0: return True return all(self.min_length[idx] <= length <= self.max_length[idx] for idx, length in enumerate(score)) class LengthRatioFilter(FilterABC): """Character length ratio""" def __init__(self, threshold=3, unit='word', **kwargs): self.threshold = threshold self.unit = check_args_compability( unit, required_types=[str], choices=[('word', 'char', 'character')], names=['unit']) super().__init__(**kwargs) def get_length(self, segment, idx): """Return length of the segment in index""" if self.unit[idx] == 'word': return len(segment.split()) return len(segment) def score(self, pairs): for pair in pairs: lengths = sorted(self.get_length(segment, idx) for idx, segment in enumerate(pair)) if lengths[0] == 0: if lengths[-1] == 0: yield 0 else: yield float('inf') else: yield lengths[-1] / lengths[0] def accept(self, score): return score < self.threshold class LongWordFilter(FilterABC): """Word length filter""" def __init__(self, threshold=40, **kwargs): self.threshold = check_args_compability(threshold, required_types=[int], names=['threshold']) super().__init__(**kwargs) def score(self, pairs): for pair in pairs: yield [max((len(word) for word in segment.split()), default=0) for segment in pair] def accept(self, score): return all(length < self.threshold[idx] for idx, length in enumerate(score)) class AverageWordLengthFilter(FilterABC): """Average word length filter Returns zeros for empty segments. If pass_empty is true, pairs with only empty segments are accepted. """ def __init__(self, min_length=2, max_length=20, pass_empty=False, **kwargs): min_length, max_length = check_args_compability( min_length, max_length, required_types=[int, int], names=['min_length', 'max_length']) self.min_length = min_length self.max_length = max_length self.pass_empty = pass_empty super().__init__(**kwargs) @staticmethod def _average_word_len(sentence): parts = sentence.split() if parts: return len(''.join(parts)) / len(parts) return 0 def score(self, pairs): for pair in pairs: yield [self._average_word_len(sent) for sent in pair] def accept(self, score): if self.pass_empty and sum(score) == 0: return True return all(self.min_length[idx] <= length <= self.max_length[idx] for idx, length in enumerate(score)) class HtmlTagFilter(FilterABC): """HTML tag filter""" def __init__(self, **kwargs): super().__init__(**kwargs) def check(self, segment): try: found = bool(bs(segment, 'html.parser').find()) except TypeError as err: logger.warning("BeautifulSoup parsing failed for %s: %s", repr(segment), err) found = True return found def score(self, pairs): for pair in pairs: yield [self.check(sent) for sent in pair] def accept(self, score): return not any(score) class RegExpFilter(FilterABC): """Filter out segments that match or do not match a regular expression You can either provide a single regexp or one for each language in the parallel data. The regex library is used for the search. If accept_match is False, the pair is accepted only if none of the segment match the corresponding regexp. If accept_match is True, the pair is accepted only if all segments match the corresponding regexp. """ def __init__(self, regexps=None, accept_match=False, **kwargs): self.regexps = check_args_compability(regexps, required_types=[str], names=['regexps']) self.accept_match = accept_match super().__init__(**kwargs) def score(self, pairs): for pair in pairs: yield [bool(regex.search(self.regexps[idx], segment)) for idx, segment in enumerate(pair)] def accept(self, score): if self.accept_match: return all(score) return not any(score) class AlphabetRatioFilter(FilterABC): """Proportion of alphabetic characters in the segment""" def __init__(self, threshold=0.75, exclude_whitespace=False, **kwargs): self.threshold = check_args_compability(threshold, required_types=[float], names=['threshold']) self.exclude_whitespace = exclude_whitespace self.re_whitespace = regex.compile(r'\s') self.re_not_alphas = regex.compile(r'\p{Alphabetic=No}') super().__init__(**kwargs) def score(self, pairs): for pair in pairs: scores = [] for segment in pair: if self.exclude_whitespace: segment = self.re_whitespace.sub('', segment) alphas = self.re_not_alphas.sub('', segment) if segment: scores.append(len(alphas) / len(segment)) else: scores.append(1.0) yield scores def accept(self, score): return all(ratio >= threshold for ratio, threshold in zip(score, self.threshold)) class CharacterScoreFilter(FilterABC): """Proportion of alphabetic characters that are in the given script For a list of valid scripts, see e.g. https://www.regular-expressions.info/unicode.html """ def __init__(self, scripts=None, thresholds=None, **kwargs): if scripts is None: raise ConfigurationError("A list of language scripts needs to be defined") self.scripts = scripts self.thresholds = [1] * len(scripts) if thresholds is None else thresholds if len(self.scripts) != len(self.thresholds): raise ConfigurationError( f"Mismatch in number of scripts ({len(self.scripts)}) and thresholds ({len(self.thresholds)})") self.re_not_alphas = regex.compile(r'\p{Alphabetic=No}') self.re_not_script = [regex.compile(fr'\p{{^Script={script}}}') for script in self.scripts] super().__init__(**kwargs) def score(self, pairs): for pair in pairs: if len(pair) != len(self.scripts): raise ValueError(f"Mismatch in number of scripts ({len(self.scripts)}) and sentences ({len(pair)})") scores = [] for idx, sent in enumerate(pair): alphas = self.re_not_alphas.sub('', sent) if alphas: script = self.re_not_script[idx].sub('', alphas) scores.append(len(script) / len(alphas)) else: scores.append(1.0) yield scores def accept(self, score): return all(ratio >= threshold for ratio, threshold in zip(score, self.thresholds)) class LanguageIDFilter(FilterABC): """Language identification confidence filter Currently this supports three methods: * langid (default): see :cite:`lui-baldwin-2012-langid` * cld2: see https://github.com/CLD2Owners/cld2 * fasttext: see :cite:`joulin-etal-2016-fasttext` and :cite:`joulin-etal-2017-bag` """ def __init__(self, languages=None, id_method='langid', thresholds=None, fasttext_model_path=None, langid_languages=None, cld2_options=None, **kwargs): super().__init__(**kwargs) if languages is None: raise ConfigurationError("A list of language codes needs to be defined") # fasttext options if id_method == 'fasttext' and not fasttext_model_path: raise ConfigurationError("FastText language ID method was choosen without specifying " "any path to fasttext model") if id_method != 'fasttext' and fasttext_model_path: raise ConfigurationError("FastText language ID method was not choosen but fasttext " "path to model was set") self.fasttext_model = fasttext.load_model(os.path.join(self.workdir, fasttext_model_path)) \ if id_method == 'fasttext' else None # langid options if id_method == 'langid': self.identifier = LanguageIdentifier.from_modelstring(model, norm_probs=True) if langid_languages: self.identifier.set_languages(langid_languages) else: if langid_languages: raise ConfigurationError( "langid_languages option is supported only by the method langid") self.identifier = None # cld2 options if id_method == 'cld2': self.cld2_options = cld2_options if cld2_options else {} else: if cld2_options: raise ConfigurationError("cld2_options is supported only by the method cld2") self.cld2_options = None # global options self.languages = languages self.id_method = id_method self.thresholds = [0] * len(self.languages) if thresholds is None else thresholds def confidence(self, sentence: str, lan: str) -> float: """Return confidence of the identifier""" if not sentence: # Prevent filtering empty lines return 1.0 if self.id_method == 'cld2': try: clddetails = pycld2.detect(sentence, **self.cld2_options) except pycld2.error as err: logger.warning("pycld2 could not process '%s' due to: %s", sentence, err) clddetails = (0, 0, ((0, 'un', 0.0), 0)) cldlan = clddetails[2][0][1] cldconf = round(clddetails[2][0][2]/100, 2) if cldlan != lan: cldconf = 0.0 return cldconf if self.id_method == 'langid': lidetails = self.identifier.classify(sentence) lilan, liconf = lidetails[0], round(lidetails[1], 2) if lilan != lan: liconf = 0.0 return liconf if self.id_method == 'fasttext': lang, confidence = self._fasttext_predict_lang(sentence) if lang != lan: liconf = 0.0 else: liconf = confidence return liconf raise ValueError(f"Unknown language identification method '{self.id_method}'") def score(self, pairs: List[Tuple[str, str]]) -> Iterator[List[float]]: for pair in pairs: yield [self.confidence(sent, self.languages[idx]) for idx, sent in enumerate(pair)] def accept(self, score: Tuple[float, float]) -> bool: return all(conf > threshold for conf, threshold in zip(score, self.thresholds)) def _fasttext_predict_lang(self, texts: List[str]) -> Tuple[str, float]: output = self.fasttext_model.predict(texts, k=1) confidence = output[1][0] label = output[0][0][9:] return label, confidence class TerminalPunctuationFilter(FilterABC): """Penalty score with respect to the co-occurrence of terminal punctuation marks See :cite:`vazquez-etal-2019-university` """ def __init__(self, threshold=-2, **kwargs): self.threshold = threshold super().__init__(**kwargs) def score(self, pairs): for pair in pairs: if len(pair) != 2: raise ValueError("Only bilingual input supported by TerminalPunctuationFilter") sent1, sent2 = pair spun = len([c for c in sent1 if c in ['.', '?', '!', '…']]) tpun = len([c for c in sent2 if c in ['.', '?', '!', '…']]) score = abs(spun-tpun) if spun > 1: score += spun - 1 if tpun > 1: score += tpun - 1 score = -math.log(score + 1) yield score def accept(self, score): return score >= self.threshold class NonZeroNumeralsFilter(FilterABC): """Similarity measure between numerals of the two sentences with zeros removed If require_all is True, all scores (for pairs of n segments) have to be equal or above the threshold; otherwise at least one the scores have to be equal or above the threshold. For bilingual input, it has no effect. See :cite:`vazquez-etal-2019-university` """ def __init__(self, threshold=0.5, require_all=True, **kwargs): self.threshold = threshold self.require_all = require_all super().__init__(**kwargs) def score(self, pairs): for pair in pairs: nums = [[int(c) for c in sent if c in string.digits and c != '0'] for sent in pair] ratios = [] for num1, num2 in itertools.combinations(nums, 2): seq = difflib.SequenceMatcher(None, num1, num2) ratios.append(seq.ratio()) yield ratios def accept(self, score): if self.require_all: return all(ratio >= self.threshold for ratio in score) return any(ratio >= self.threshold for ratio in score) class LongestCommonSubstringFilter(FilterABC): """Ratios of longest common substring to the shorter of the strings If require_all is True, all ratios (for pairs of n segments) have to be below the threshold; otherwise at least one the ratios have to be below the threshold. For bilingual input, it has no effect. """ def __init__(self, threshold=0.9, require_all=True, **kwargs): self.threshold = threshold self.require_all = require_all super().__init__(**kwargs) def score(self, pairs): for pair in pairs: ratios = [] for seq1, seq2 in itertools.combinations(pair, 2): seq = difflib.SequenceMatcher(isjunk=None, a=seq1, b=seq2) _, _, size = seq.find_longest_match(0, len(seq1), 0, len(seq2)) minlen = min(len(seq1), len(seq2)) ratios.append(0 if minlen == 0 else size / minlen) yield ratios def accept(self, score): if self.require_all: return all(ratio < self.threshold for ratio in score) return any(ratio < self.threshold for ratio in score) class SimilarityFilter(FilterABC): """Filter on string/sequence similarity Uses Levenshtein distance implemented in the RapidFuzz library. The weights parameter can be used to change the costs of the three operations (insertion, deletion, substitution). If require_all is True, all ratios (for pairs of n segments) have to be below the threshold; otherwise at least one the ratios have to be below the threshold. For bilingual input, it has no effect. """ VALID_UNITS = ('word', 'char', 'character') def __init__(self, threshold=0.9, weights=(1, 1, 1), unit='char', lowercase=False, require_all=True, **kwargs): if unit not in self.VALID_UNITS: raise ConfigurationError( f"Value of 'unit' are not one of the allowed choices {self.VALID_UNITS}: {unit}") self.threshold = threshold self.weights = weights self.unit = unit self.lowercase = lowercase self.require_all = require_all super().__init__(**kwargs) def similarity(self, seq1, seq2): """Return normalized similarity between the sequences""" if self.lowercase: seq1 = seq1.lower() seq2 = seq2.lower() if self.unit == 'word': seq1 = seq1.split() seq2 = seq2.split() return rapidfuzz.distance.Levenshtein.normalized_similarity( seq1, seq2, weights=self.weights) def score(self, pairs): for pair in pairs: yield [self.similarity(seq1, seq2) for seq1, seq2 in itertools.combinations(pair, 2)] def accept(self, score): if self.require_all: return all(ratio < self.threshold for ratio in score) return any(ratio < self.threshold for ratio in score) class RepetitionFilter(FilterABC): """Filter segments with repeated content Filter segments with substrings of min_length to max_length characters that are repeated at least threshold number of times. The first occurrence is not counted to the threshold, i.e., threshold 2 means that the substring has to occur three times. There may be optional space character(s) between the repeated strings that are not counted to the length. The repeated string cannot start with a whitespace character but is not limited otherwise. """ def __init__(self, threshold=2, min_length=3, max_length=100, **kwargs): if threshold < 1: raise ConfigurationError("threshold for RepetitionFilter has to be at least one") if min_length < 1: raise ConfigurationError("min_length for RepetitionFilter has to be at least one") self._threshold = threshold self._min_length = min_length self._max_length = max_length self._regexp = self._get_regexp() super().__init__(**kwargs) @property def min_length(self): """Minimum number of characters in pattern""" return self._min_length @property def max_length(self): """Maximum number of characters in pattern""" return self._max_length @property def threshold(self): """Threshold for the number of repetitions""" return self._threshold def _get_regexp(self): """Return compiled regexp for finding repetitions""" rstring = f'(\\S.{{{self.min_length-1},{self.max_length}}}?)(?: *\\1){{{self.threshold},}}' return regex.compile(rstring) def get_repetitions(self, segment): """Return the number of repetitions and the repeated string Returns the number of repetitions and the repeated string for the first match of at least self.threshold number of repetitions. The segment may contain longer repetitions than the one returned. If there no matched repetitions, zero and None are returned. """ match = self._regexp.search(segment) if match: full = match.group(0) repeated = match.group(1) return full.count(repeated) - 1, repeated return 0, None def score(self, pairs): for pair in pairs: yield [self.get_repetitions(sent)[0] for sent in pair] def accept(self, score): return all(repetitions < self.threshold for repetitions in score)
36.640429
122
0.621424
19,727
0.96295
3,917
0.191204
531
0.02592
0
0
5,381
0.262667
55180aff035712fdcf712454876146f0f9f3d598
180
py
Python
Python_2/FOR e IN/programa -- Soma dos Pares.py
NicolasGandolfi/Exercicios-Python
935fe3577c149192f9e29568e9798e970a620131
[ "MIT" ]
null
null
null
Python_2/FOR e IN/programa -- Soma dos Pares.py
NicolasGandolfi/Exercicios-Python
935fe3577c149192f9e29568e9798e970a620131
[ "MIT" ]
null
null
null
Python_2/FOR e IN/programa -- Soma dos Pares.py
NicolasGandolfi/Exercicios-Python
935fe3577c149192f9e29568e9798e970a620131
[ "MIT" ]
null
null
null
s=0 c=0 for n in range(6): num=int(input('digite o {}º número:'.format(n+1))) if num%2==0: s+=num c+=1 print('a soma dos {} números pares é {}'.format(c,s))
22.5
54
0.533333
0
0
0
0
0
0
0
0
60
0.326087
551845565ec5d90acf0eee28224a4ae202f9477d
3,736
py
Python
backend/FlaskAPI/mf_get_table_data.py
steruel/CovalentMFFPrototype
275ade0fa0a2ce3c80ed3aaac3a861dd0e273622
[ "MIT" ]
null
null
null
backend/FlaskAPI/mf_get_table_data.py
steruel/CovalentMFFPrototype
275ade0fa0a2ce3c80ed3aaac3a861dd0e273622
[ "MIT" ]
null
null
null
backend/FlaskAPI/mf_get_table_data.py
steruel/CovalentMFFPrototype
275ade0fa0a2ce3c80ed3aaac3a861dd0e273622
[ "MIT" ]
null
null
null
# coding: utf-8 # In[1]: ##Includes from flask import request, url_for from flask_api import FlaskAPI, status, exceptions from flask_cors import CORS, cross_origin from flask import Blueprint, render_template, abort import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) import pickle import json import sqlite3 mf_get_table_data = Blueprint('mf_get_table_data', __name__) CORS(mf_get_table_data) CORS(mf_get_table_data,resources={r"/mf_get_table_data/*/": {"origins": "*"}}) #cors = CORS(app, resources={r"/api/*": {"origins": "*"}}) ######flask_api ########## ##Pass header=0 if first line in text file contains header def read_csv_file(filename, seperator, header): df = pd.read_csv(filename,sep=seperator,header=header) return df def df_give_columnnames(df,colnames_array): df.columns = colnames_array return df def write_json_file(df,filename): df.to_json(filename,orient='records') #http://localhost:5000/mf_get_table_data/gettabledatafromsqlite/?dbname=mf&tablename=dataset&limit=20 #http://localhost:5000/mf_get_table_data/gettabledatafromsqlite/?dbname=mf&tablename=dataset&limit= @mf_get_table_data.route("/mf_get_table_data/gettabledatafromsqlite/", methods=['GET']) @cross_origin() def gettabledatafromsqlite(): list_records = [] dbname = request.args.get('dbname') db_file = '../database/'+dbname+'.db' tablename = request.args.get('tablename') limit = request.args.get('limit') conn = sqlite3.connect(db_file) cursor = conn.cursor() limit = str(limit) if limit == '': limit = '50' sql = "select * from "+tablename + " limit "+limit print sql cursor.execute(sql) colnames = [description[0] for description in cursor.description] rows = cursor.fetchall() conn.close() for row in rows: list_records.append(row) df = pd.DataFrame(list_records,columns=colnames) json = df.to_json(orient='records') return json #http://localhost:5000/mf_get_table_data/join_modelmetadata_dataset/ @mf_get_table_data.route("/mf_get_table_data/join_modelmetadata_dataset/", methods=['GET']) @cross_origin() def gettabledata_join_modelmetadata_dataset(): dbname = 'mf' db_file = '../database/'+dbname+'.db' tablename = request.args.get('tablename') conn = sqlite3.connect(db_file) cursor = conn.cursor() sql = "select t1.model_id,t1.model_description, t1.datasetid,t2.datasetname,t2.tablename from model_metadata t1, dataset t2 where t1.datasetid = t2.datasetid" cursor.execute(sql) colnames = [description[0] for description in cursor.description] rows = cursor.fetchall() conn.close() df = pd.DataFrame(rows,columns=colnames) json = df.to_json(orient='records') return json ##?folder=bank_direct_marketing&file=bank-additional-full.csv #http://localhost:5000/mf_get_table_data/gettabledatafromcsv?folder=bank_direct_marketing&file=bank-additional-full.csv @mf_get_table_data.route("/mf_get_table_data/gettabledatafromcsv/", methods=['GET']) def gettabledatafromcsv(): folder = request.args.get('folder') file = request.args.get('file') #filename = '../data/bank_direct_marketing/' + tablename filename = '../data/'+folder+'/'+ file print filename df = read_csv_file(filename, ";", 0) json = df.to_json(orient='records') return json ##?file=bank-additional-full.csv #http://localhost:5000/mf_get_table_data/gettabledatafromcsv1?file=bank-additional-full.csv @mf_get_table_data.route("/mf_get_table_data/gettabledatafromcsv1/", methods=['GET']) def gettabledatafromcsv1(): file = request.args.get('file') filename = '../data/'+ file print filename df = read_csv_file(filename, ";", 0) json = df.to_json(orient='records') return json #process() #
27.072464
159
0.738758
0
0
0
0
2,124
0.568522
0
0
1,484
0.397216
55192286c083738515eab7ff51801fcee926be51
2,119
py
Python
dkr-py310/docker-student-portal-310/course_files/begin_advanced/py_numpy_1.py
pbarton666/virtual_classroom
a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675
[ "MIT" ]
null
null
null
dkr-py310/docker-student-portal-310/course_files/begin_advanced/py_numpy_1.py
pbarton666/virtual_classroom
a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675
[ "MIT" ]
null
null
null
dkr-py310/docker-student-portal-310/course_files/begin_advanced/py_numpy_1.py
pbarton666/virtual_classroom
a9d0dc2eb16ebc4d2fd451c3a3e6f96e37c87675
[ "MIT" ]
null
null
null
#py_numpy_1.py """a snake-charming application""" from PIL import Image import numpy as np import os idir =os.getcwd() iname= 'im3.png'# 'white_snake.PNG' saveas='new_snake.PNG' #sets up an array for pixel processing white=np.array([255,255,255,0]) #r, g, b, a transparent = np.array([0, 0, 0, 0]) background = white #open the image and convert it raw_image = Image.open(iname) converted_image = raw_image.convert('RGBA') raw_image.close() h, w = converted_image.size converted_histo=converted_image.histogram() converted_colors=converted_image.getcolors(w*h) #dump the data into a numpy array and split the channels "bands" data = np.array(converted_image) # h * w * 4 array (rgba) r, g, b, a = data.T #this sets the masking condition and replaces the background color replace = (r == background[0]) & (b == background[1]) & (g == background[2]) data[replace.T] = (0,0,0,0) #generate a new image, grab some stats, and save it. new_image = Image.fromarray(data, 'RGBA') h, w = new_image.size new_histo=new_image.histogram() new_colors=new_image.getcolors(w*h) #a list of tuples [count (rgba), ...] new_image.save(saveas) recovered_image = Image.open(saveas) h, w = recovered_image.size recovered_histo=recovered_image.histogram() recovered_colors=recovered_image.getcolors(w*h) #a list of tuples [count (rgba), ...] #strategy: make a list of color bins we expect to find. These will have pixel ranges # that are human-friendly e.g., 'brownish', 'gold'. Each spec within the bin can be # additively applied to a mask - functionally reducing the color palette. reduced_image = recovered_image.convert('P', palette=Image.ADAPTIVE, colors=10) reduc1 = reduced_image = recovered_image.convert('P', palette=Image.ADAPTIVE, colors=10) reduc2 = reduc1.convert('RGB') #turns it to rgb #save the image in a couple formats reduc_fn = 'scratch.BMP' reduc2.save(reduc_fn) reduced_histo=reduced_image.histogram() reduced_colors=reduced_image.getcolors(w*h) #a list of tuples [count (rgba), ...] reduced_image.save(saveas+'reduced.BMP') #now show them recovered_image.show() reduced_image.show() recovered_image.close()
32.6
88
0.747994
0
0
0
0
0
0
0
0
841
0.396885
5519d50b257da54e3b0054563d77f75181fccdb3
2,958
py
Python
zfg2parser.py
valoeghese/ZoesteriaConf
10c3239acde2b4568bb48d1d71b3798ecff0afc3
[ "MIT" ]
1
2020-09-02T19:24:22.000Z
2020-09-02T19:24:22.000Z
zfg2parser.py
valoeghese/ZoesteriaConf
10c3239acde2b4568bb48d1d71b3798ecff0afc3
[ "MIT" ]
7
2020-08-08T01:57:29.000Z
2021-05-08T08:50:19.000Z
zfg2parser.py
valoeghese/ZoesteriaConf
10c3239acde2b4568bb48d1d71b3798ecff0afc3
[ "MIT" ]
1
2021-04-29T14:25:21.000Z
2021-04-29T14:25:21.000Z
class Container: def __init__(self): self.data = {} index = -1 # compound "container" entries def parseContainer(container, data, size): global index mode = 0 # 0 = var names, 1 = var values buffer = "" while index + 1 < size: index += 1 char = data[index] if char == '}': break elif char == "#": parseComment(data, size) elif mode == 1: if char.isspace(): pass else: if char == '{': # new container container.data[buffer] = parseContainer(Container(), data, size) elif char == '[': # new list container.data[buffer] = parseList(data, size) elif char == ';': # new empty data object container.data[buffer] = "" else: # new data object container.data[buffer] = parseData(data, size) buffer = "" mode = 0 elif char == '=': mode = 1 elif not char.isspace(): buffer += char # append character to string buffer return container # list entries def parseList(data, size): global index buffer = [] while index + 1 < size: index += 1 char = data[index] if char == ']': break elif char == "#": parseComment(data, size) elif not char.isspace(): if char == '{': # new container buffer.append(parseContainer(Container(), data, size)) elif char == '[': # new list buffer.append(parseList(data, size)) elif char == ';': # new empty data object buffer.append("") else: # new data object buffer.append(parseData(data, size)) return buffer # data value entries def parseData(data, size): global index buffer = data[index] # initial character is already at the index while index + 1 < size: index += 1 char = data[index] if char == ';': break elif (not char.isspace()) or char == ' ': # the only form of whitespace in data values allowed is spaces # tabs, carriage return, and line feed are considered merely formatting buffer += char return buffer.strip() # remove trailing whitespace # comments def parseComment(data, size): global index while index + 1 < size: index += 1 char = data[index] if char == '\n': # break comment on new lines break fileData = "" with open(input(), 'r') as file: fileData = file.read() fileSize = len(fileData) if (fileSize == 0): print("File is empty!") else: fileContent = parseContainer(Container(), fileData, fileSize)
29.58
85
0.499324
65
0.021974
0
0
0
0
0
0
593
0.200473
551b09ca0d43e7df528a517a764809a6c7946e75
3,017
py
Python
syndicate/connection/secrets_manager_connection.py
Dmytro-Skorniakov/aws-syndicate
81363334886c53969f1f0a0c0ac0168318204990
[ "Apache-2.0" ]
null
null
null
syndicate/connection/secrets_manager_connection.py
Dmytro-Skorniakov/aws-syndicate
81363334886c53969f1f0a0c0ac0168318204990
[ "Apache-2.0" ]
null
null
null
syndicate/connection/secrets_manager_connection.py
Dmytro-Skorniakov/aws-syndicate
81363334886c53969f1f0a0c0ac0168318204990
[ "Apache-2.0" ]
null
null
null
""" Copyright 2018 EPAM Systems, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law 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. """ from boto3 import client from syndicate.commons.log_helper import get_logger from syndicate.connection.helper import apply_methods_decorator, retry _LOG = get_logger('syndicate.connection.secrets_manager_connection') @apply_methods_decorator(retry) class SecretsManagerConnection(object): def __init__(self, region=None, aws_access_key_id=None, aws_secret_access_key=None, aws_session_token=None): self.client = client('secretsmanager', region, aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, aws_session_token=aws_session_token) _LOG.debug('Opened new Secrets Manager connection.') def describe_secret(self, secret_id): response = self.client.describe_secret(SecretId=secret_id) return response def get_secret_value(self, secret_id, secret_type='string', version_id=None, version_label=None): arguments = { 'SecretId': secret_id, } if version_id and version_label: raise AssertionError('version_id and version_label cannot be passed both') elif version_id: arguments['VersionId'] = version_id else: arguments['VersionLabel'] = version_label if secret_type != 'string' and secret_type != 'binary': raise AssertionError('wrong type value. only string or binary is allowed') response = self.client.get_secret_value(**arguments) if response and secret_type == 'string': return response.get('SecretString') if response and secret_type == 'binary': return response.get('SecretBinary') def put_secret_value(self, secret_id, secret_value, secret_type='string', labels=None): labels = set(labels) arguments = { 'SecretId': secret_id, 'VersionStages': labels } if secret_type == 'string': arguments['SecretString'] = secret_value elif secret_type == 'binary': arguments['SecretBinary'] = secret_value else: raise AssertionError('wrong secret_type value. only string or binary is allowed') self.client.put_secret_value(**arguments) def delete_secret(self, secret_id): self.client.delete_parameter(SecretId=secret_id)
39.181818
101
0.670202
2,160
0.715943
0
0
2,192
0.72655
0
0
1,050
0.348028
551b46a9abb3f55dfb647a884266cebfd6c4db08
3,324
py
Python
Simple GAN/networks.py
Srujan35007/My-GANs
7953c859169134a0a84ac3cd674f629af9942465
[ "MIT" ]
null
null
null
Simple GAN/networks.py
Srujan35007/My-GANs
7953c859169134a0a84ac3cd674f629af9942465
[ "MIT" ]
null
null
null
Simple GAN/networks.py
Srujan35007/My-GANs
7953c859169134a0a84ac3cd674f629af9942465
[ "MIT" ]
null
null
null
import time b = time.time() import torch import torch.nn as nn import torch.nn.functional as F from torchsummary import summary from math import log2, exp a = time.time() print('Imports complete in %.3f seconds' % (a-b)) class Generator(nn.Module): def __init__(self,latent_dims=128,n_channels=3,max_resolution=64,max_channels=256,min_channels=16): super(Generator, self).__init__() self.n_z = latent_dims assert latent_dims > 16 num_blocks = int(log2(max_resolution))-2 layers_ = [] layers_.append(nn.ConvTranspose2d(self.n_z//16,max_channels,3,1,1)) output_channels = -1 # The upsampling pyramid for i in range(num_blocks): in_channels_ = max(min_channels, max_channels//((2**i))) out_channels_ = max(min_channels, in_channels_//2) layers_.append(self.make_gen_block(in_channels_,out_channels_,4,2,1)) output_channels = out_channels_ layers_.append(nn.Conv2d(output_channels,n_channels,3,1,1)) layers_.append(nn.Tanh()) self.layers = nn.Sequential(*layers_) def make_gen_block(self,in_channels,out_channels,kernel_size_=3,stride_=1,padding_=1): return nn.Sequential( nn.ConvTranspose2d(in_channels,out_channels, kernel_size_,stride_,padding=padding_,bias=False), nn.BatchNorm2d(out_channels), nn.LeakyReLU(negative_slope=0.2,inplace=True) ) def forward(self, latent): latent = latent.view(-1,self.n_z//16,4,4) return self.layers(latent) class Discriminator(nn.Module): def __init__(self,max_resolution=64,n_channels=3,max_channels=256,min_channels=8): super(Discriminator, self).__init__() self.max_resolution = max_resolution self.n_channels = n_channels self.max_channels = max_channels num_blocks = int(log2(max_resolution))-1 layers_ = [] layers_.append(nn.Conv2d(n_channels, max(min_channels,max_channels//(2**num_blocks)),3,1,1)) for i in range(num_blocks): in_ = max_channels//(2**(num_blocks-i)) if in_ < min_channels: in_ = min_channels out_ = min_channels else: out_ = in_*2 layers_.append(self.make_disc_block(in_,out_,4,2,1)) layers_.append(nn.AvgPool2d(2)) self.layers = nn.Sequential(*layers_) def make_disc_block(self,in_channels,out_channels,kernel_size_=3,stride_=1,padding_=1): return nn.Sequential( nn.Conv2d(in_channels,out_channels,kernel_size_,stride_,padding_,bias=False), nn.BatchNorm2d(out_channels), nn.LeakyReLU(0.2,inplace=True) ) def forward(self,image): image = image.view(-1,self.n_channels,self.max_resolution,self.max_resolution) return nn.Sigmoid()(torch.mean(self.layers(image).view(-1,self.max_channels),dim=1,keepdim=True)) print('\nGenerator Summary\n') gen = Generator(max_resolution=512,max_channels=512,min_channels=8) a = torch.empty(128).normal_(0,0.35).view(-1,128) (summary(gen, (1,128))) print('\nDiscriminator Summary\n') disc = Discriminator(max_channels=512,max_resolution=512) a = torch.empty(10,3,512,512).normal_(0,0.35) (summary(disc, (1,3,512,512)))
39.571429
105
0.663357
2,753
0.828219
0
0
0
0
0
0
108
0.032491
551c341bfebf085d7288ee08b3180f837e7122dd
2,607
py
Python
ui/Rhino/RV2/dev/__temp/RV2init_console_cmd.py
tkmmark/compas-RV2
bc18f4dada9c1e31a0f7df4ef981934c6d2b05b3
[ "MIT" ]
null
null
null
ui/Rhino/RV2/dev/__temp/RV2init_console_cmd.py
tkmmark/compas-RV2
bc18f4dada9c1e31a0f7df4ef981934c6d2b05b3
[ "MIT" ]
null
null
null
ui/Rhino/RV2/dev/__temp/RV2init_console_cmd.py
tkmmark/compas-RV2
bc18f4dada9c1e31a0f7df4ef981934c6d2b05b3
[ "MIT" ]
null
null
null
from __future__ import print_function from __future__ import absolute_import from __future__ import division import scriptcontext as sc try: import compas # noqa: F401 import compas_rhino # noqa: F401 import compas_ags # noqa: F401 import compas_tna # noqa: F401 import compas_cloud # noqa: F401 except ImportError: # do something here to fix the problem raise else: from compas_cloud import Proxy from compas_rv2.rhino import BrowserForm from compas_rv2.scene import Scene __commandname__ = "RV2init" def RunCommand(is_interactive): browser = BrowserForm() browser.Show() sc.sticky["RV2.proxy"] = Proxy(background=False) settings = { "layers.skeleton": "RV2::Skeleton", "layers.form": "RV2::FormDiagram", "layers.force": "RV2::ForceDiagram", "layers.thrust": "RV2::ThrustNetwork", "show.form.vertices": True, "show.form.edges": True, "show.form.faces": False, "show.force.vertices": True, "show.force.edges": True, "show.force.faces": False, "show.thrust.vertices": True, "show.thrust.edges": True, "show.thrust.faces": True, "color.form.vertices": (0, 255, 0), "color.form.vertices:is_fixed": (0, 255, 255), "color.form.vertices:is_external": (0, 0, 255), "color.form.vertices:is_anchor": (255, 255, 255), "color.form.edges": (0, 255, 0), "color.form.edges:is_external": (0, 0, 255), "color.thrust.vertices": (255, 0, 255), "color.thrust.vertices:is_fixed": (0, 255, 0), "color.thrust.vertices:is_anchor": (255, 0, 0), "color.thrust.edges": (255, 0, 255), "color.thrust.faces": (255, 0, 255), "color.force.vertices": (0, 255, 0), "color.force.vertices:is_fixed": (0, 255, 255), "color.force.edges": (0, 255, 0), "color.force.edges:is_external": (0, 0, 255), "scale.thrust.external": 0.25, "vertical.zmax": 4.0, "vertical.kmax": 100, "horizontal.kmax": 100, "horizontal.alpha": 100 } scene = Scene(settings) scene.clear() sc.sticky["RV2"] = { "session": { "cwd": None, "ext": 'rv2', "current": None }, "scene": scene # "data": DATA } # ============================================================================== # Main # ============================================================================== if __name__ == '__main__': RunCommand(True)
24.59434
80
0.542769
0
0
0
0
0
0
0
0
1,137
0.436133
551c6b36cc572d6424d1e8e35b4d86a47b2d8f93
3,783
py
Python
utils/count_supported.py
delcypher/smt-coral-wrapper
e7024efd83ba2da87fb178917f49a6b430b9c01c
[ "MIT" ]
1
2018-05-04T03:51:58.000Z
2018-05-04T03:51:58.000Z
utils/count_supported.py
delcypher/smt2coral
e7024efd83ba2da87fb178917f49a6b430b9c01c
[ "MIT" ]
null
null
null
utils/count_supported.py
delcypher/smt2coral
e7024efd83ba2da87fb178917f49a6b430b9c01c
[ "MIT" ]
null
null
null
#!/usr/bin/env python # vim: set sw=4 ts=4 softtabstop=4 expandtab: """ Read invocation info file for smt-runner and report which benchmarks are supported by the CoralPrinter. """ # HACK: put smt2coral in search path import os import sys _repo_root = os.path.dirname(os.path.dirname(__file__)) sys.path.insert(0, _repo_root) from smt2coral import Converter from smt2coral import DriverUtil from smt2coral import Util import argparse import logging import yaml _logger = logging.getLogger(__name__) def loadYaml(openFile): if hasattr(yaml, 'CLoader'): # Use libyaml which is faster _loader = yaml.CLoader else: _logger.warning('Using slow Python YAML loader') _loader = yaml.Loader return yaml.load(openFile, Loader=_loader) def benchmark_can_be_converted(full_path): assert os.path.exists(full_path) translation_was_sound = None # Parse using Z3 with open(full_path, 'r') as f: _logger.debug('Opened "{}"'.format(f.name)) constraint, err = Util.parse(f) if err is not None: # Parser failure _logger.error('Parser failure ({}): {}'.format(full_path, err)) sys.exit(1) constraints = Util.split_bool_and(constraint) # Try to do conversion printer = Converter.CoralPrinter() try: _ = printer.print_constraints(constraints) translation_was_sound = printer.translation_was_sound() except Converter.CoralPrinterException as e: _logger.debug('{}: {}: {}'.format(full_path, type(e).__name__, e)) return (False, translation_was_sound) return (True, translation_was_sound) def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument("invocation_info_file", nargs='?', type=argparse.FileType('r'), default=sys.stdin, ) parser.add_argument('--benchmark-base', type=str, dest='benchmark_base', default="") DriverUtil.parserAddLoggerArg(parser) pargs = parser.parse_args(args) DriverUtil.handleLoggerArgs(pargs, parser) # Load invocatin info ii = loadYaml(pargs.invocation_info_file) assert isinstance(ii, dict) assert 'results' in ii results = ii['results'] benchmarks_can_be_converted = set() benchmarks_with_sound_translation = set() benchmarks_cannot_be_converted = set() # Iterate over benchmarks for index, benchmark_info in enumerate(results): benchmark = benchmark_info['benchmark'] full_path = os.path.join(pargs.benchmark_base, benchmark) if not os.path.exists(full_path): _logger.error('Could not find benchmark "{}"'.format(full_path)) return 1 can_convert, sound_translation = benchmark_can_be_converted(full_path) progress_str = '{} of {}'.format(index + 1, len(results)) if can_convert: _logger.info('{}: Conversion successful ({})'.format( benchmark, progress_str)) benchmarks_can_be_converted.add(benchmark) if sound_translation: benchmarks_with_sound_translation.add(benchmark) else: _logger.warning('{}: Conversion failed ({})'.format( benchmark, progress_str)) benchmarks_cannot_be_converted.add(benchmark) # Report print("# of benchmarks can be converted: {}".format( len(benchmarks_can_be_converted))) print("# of benchmarks that could be converted soundly: {}".format( len(benchmarks_with_sound_translation))) print("# of benchmarks cannot be converted: {}".format( len(benchmarks_cannot_be_converted))) if __name__ == '__main__': sys.exit(main(sys.argv[1:]))
32.612069
78
0.662437
0
0
0
0
0
0
0
0
785
0.207507
551d7656dfcd2d9ac6106ecaf6448701f59205fd
393
py
Python
closest_numbers.py
odellus/year_of_code
bfa2b30893bcc12f46e73ac34c63b5b05b27af5f
[ "MIT" ]
1
2017-01-03T02:24:34.000Z
2017-01-03T02:24:34.000Z
closest_numbers.py
odellus/year_of_code
bfa2b30893bcc12f46e73ac34c63b5b05b27af5f
[ "MIT" ]
null
null
null
closest_numbers.py
odellus/year_of_code
bfa2b30893bcc12f46e73ac34c63b5b05b27af5f
[ "MIT" ]
null
null
null
def closestNumbers(numbers): numbers.sort() mindiff = sys.maxint n = len(numbers) for k in range(n-1): absdiff = abs(numbers[k] - numbers[k+1]) if absdiff < mindiff: mindiff = absdiff for k in range(n-1): absdiff = abs(numbers[k] - numbers[k+1]) if absdiff == mindiff: print "{0} {1}".format(numbers[k],numbers[k+1])
30.230769
59
0.554707
0
0
0
0
0
0
0
0
9
0.022901
551f2a4107231a13573c3c3b43e182531e15c00c
18,810
py
Python
atoman/filtering/filterer.py
chrisdjscott/Atoman
e87ac31bbdcf53bb8f3efdfb109787d604890394
[ "MIT" ]
9
2015-11-23T12:13:34.000Z
2021-11-18T05:23:35.000Z
atoman/filtering/filterer.py
chrisdjscott/Atoman
e87ac31bbdcf53bb8f3efdfb109787d604890394
[ "MIT" ]
1
2017-07-17T20:27:50.000Z
2017-07-23T05:27:15.000Z
atoman/filtering/filterer.py
chrisdjscott/Atoman
e87ac31bbdcf53bb8f3efdfb109787d604890394
[ "MIT" ]
4
2015-11-23T12:13:37.000Z
2017-05-03T08:24:19.000Z
""" The filterer object. @author: Chris Scott """ from __future__ import absolute_import from __future__ import unicode_literals import copy import time import logging import numpy as np import six from six.moves import zip from .filters import _filtering as filtering_c from ..system.atoms import elements from . import voronoi from .filters import base from . import filters from . import atomStructure from ..rendering import _rendering class Filterer(object): """ Filterer class. Applies the selected filters in order. """ # known atom structure types knownStructures = atomStructure.knownStructures # all available filters defaultFilters = [ "Species", "Point defects", "Crop box", "Cluster", "Displacement", "Charge", "Crop sphere", "Slice", "Coordination number", "Voronoi neighbours", "Voronoi volume", "Bond order", "Atom ID", "ACNA", "Slip", "Bubbles", ] defaultFilters.sort() # filters that are compatible with the 'Point defects' filter defectCompatibleFilters = [ "Crop box", "Slice", ] def __init__(self, voronoiOptions): self.logger = logging.getLogger(__name__) self.voronoiOptions = voronoiOptions self._driftCompensation = False self.reset() def toggleDriftCompensation(self, driftCompensation): """Toggle the drift setting.""" self._driftCompensation = driftCompensation def reset(self): """ Reset to initial state. """ self.inputState = None self.refState = None self.currentFilters = [] self.currentSettings = [] self.visibleAtoms = np.asarray([], dtype=np.int32) self.interstitials = np.asarray([], dtype=np.int32) self.vacancies = np.asarray([], dtype=np.int32) self.antisites = np.asarray([], dtype=np.int32) self.onAntisites = np.asarray([], dtype=np.int32) self.splitInterstitials = np.asarray([], dtype=np.int32) self.visibleSpecieCount = np.asarray([], dtype=np.int32) self.vacancySpecieCount = np.asarray([], dtype=np.int32) self.interstitialSpecieCount = np.asarray([], dtype=np.int32) self.antisiteSpecieCount = np.asarray([], dtype=np.int32) self.splitIntSpecieCount = np.asarray([], dtype=np.int32) self.driftVector = np.zeros(3, np.float64) self.clusterList = [] self.bubbleList = [] self.structureCounterDicts = {} self.voronoiAtoms = voronoi.VoronoiAtomsCalculator(self.voronoiOptions) self.voronoiDefects = voronoi.VoronoiDefectsCalculator(self.voronoiOptions) self.scalarsDict = {} self.latticeScalarsDict = {} self.vectorsDict = {} self.defectFilterSelected = False self.bubblesFilterSelected = False self.spaghettiAtoms = np.asarray([], dtype=np.int32) def runFilters(self, currentFilters, currentSettings, inputState, refState, sequencer=False): """ Run the filters. """ # time runFiltersTime = time.time() # reset the filterer self.reset() # validate the list of filters defectFilterSelected = False bubblesFilterSelected = False for filterName in currentFilters: if filterName not in self.defaultFilters and not filterName.startswith("Scalar:"): # TODO: check the scalar exists too raise ValueError("Unrecognised filter passed to Filterer: '%s'" % filterName) # check if the defect filter in the list if filterName == "Point defects": defectFilterSelected = True elif filterName == "Bubbles": bubblesFilterSelected = True self.logger.debug("Defect filter selected: %s", defectFilterSelected) self.defectFilterSelected = defectFilterSelected self.bubblesFilterSelected = bubblesFilterSelected # store refs to inputs self.inputState = inputState self.refState = refState self.currentFilters = currentFilters self.currentSettings = currentSettings # set up visible atoms or defect arrays if not defectFilterSelected: self.logger.debug("Setting all atoms visible initially") self.visibleAtoms = np.arange(inputState.NAtoms, dtype=np.int32) self.logger.info("%d visible atoms", len(self.visibleAtoms)) # set Lattice scalars self.logger.debug("Adding initial scalars from inputState") for scalarsName, scalars in six.iteritems(inputState.scalarsDict): self.logger.debug(" Adding '%s' scalars", scalarsName) self.latticeScalarsDict[scalarsName] = copy.deepcopy(scalars) # set initial vectors self.logger.debug("Adding initial vectors from inputState") for vectorsName, vectors in six.iteritems(inputState.vectorsDict): self.logger.debug(" Adding '%s' vectors", vectorsName) self.vectorsDict[vectorsName] = vectors else: # initialise defect arrays self.interstitials = np.empty(inputState.NAtoms, dtype=np.int32) self.vacancies = np.empty(refState.NAtoms, dtype=np.int32) self.antisites = np.empty(refState.NAtoms, dtype=np.int32) self.onAntisites = np.empty(refState.NAtoms, dtype=np.int32) self.splitInterstitials = np.empty(3 * refState.NAtoms, dtype=np.int32) # drift compensation if self._driftCompensation: filtering_c.calculate_drift_vector(inputState.NAtoms, inputState.pos, refState.pos, refState.cellDims, inputState.PBC, self.driftVector) self.logger.info("Calculated drift vector: (%f, %f, %f)" % tuple(self.driftVector)) # run filters applyFiltersTime = time.time() for filterName, filterSettings in zip(currentFilters, currentSettings): # determine the name of filter module to be loaded if filterName.startswith("Scalar: "): moduleName = "genericScalarFilter" filterObjectName = "GenericScalarFilter" else: words = str(filterName).title().split() filterObjectName = "%sFilter" % "".join(words) moduleName = filterObjectName[:1].lower() + filterObjectName[1:] self.logger.debug("Loading filter module: '%s'", moduleName) self.logger.debug("Creating filter object: '%s'", filterObjectName) # get module filterModule = getattr(filters, moduleName) # load dialog filterObject = getattr(filterModule, filterObjectName, None) if filterObject is None: self.logger.error("Could not locate filter object for: '%s'", filterName) else: self.logger.info("Running filter: '%s'", filterName) # filter filterObject = filterObject(filterName) # construct filter input object filterInput = base.FilterInput() filterInput.visibleAtoms = self.visibleAtoms filterInput.inputState = inputState filterInput.refState = refState filterInput.voronoiOptions = self.voronoiOptions filterInput.bondDict = elements.bondDict filterInput.NScalars, filterInput.fullScalars = self.makeFullScalarsArray() filterInput.NVectors, filterInput.fullVectors = self.makeFullVectorsArray() filterInput.voronoiAtoms = self.voronoiAtoms filterInput.voronoiDefects = self.voronoiDefects filterInput.driftCompensation = self._driftCompensation filterInput.driftVector = self.driftVector filterInput.vacancies = self.vacancies filterInput.interstitials = self.interstitials filterInput.splitInterstitials = self.splitInterstitials filterInput.antisites = self.antisites filterInput.onAntisites = self.onAntisites filterInput.defectFilterSelected = defectFilterSelected # run the filter result = filterObject.apply(filterInput, filterSettings) # cluster list if result.hasClusterList(): self.clusterList = result.getClusterList() # bubble list if result.hasBubbleList(): self.bubbleList = result.getBubbleList() # structure counters if result.hasStructureCounterDict(): self.structureCounterDicts[result.getStructureCounterName()] = result.getStructureCounterDict() # spaghetti analysis if result.hasSpaghettiAtoms(): self.spaghettiAtoms = result.getSpaghettiAtoms() # full vectors/scalars self.storeFullScalarsArray(len(self.visibleAtoms), filterInput.NScalars, filterInput.fullScalars) self.storeFullVectorsArray(len(self.visibleAtoms), filterInput.NVectors, filterInput.fullVectors) # new scalars self.scalarsDict.update(result.getScalars()) if defectFilterSelected: nint = len(self.interstitials) nvac = len(self.vacancies) nant = len(self.antisites) nsplit = len(self.splitInterstitials) / 3 num = nint + nvac + nant + nsplit self.logger.info("%d visible defects", num) else: self.logger.info("%d visible atoms", len(self.visibleAtoms)) # species counts here if len(self.visibleAtoms): self.visibleSpecieCount = _rendering.countVisibleBySpecie(self.visibleAtoms, len(inputState.specieList), inputState.specie) if len(self.interstitials) + len(self.vacancies) + len(self.antisites) + len(self.splitInterstitials) > 0: self.vacancySpecieCount = _rendering.countVisibleBySpecie(self.vacancies, len(refState.specieList), refState.specie) self.interstitialSpecieCount = _rendering.countVisibleBySpecie(self.interstitials, len(inputState.specieList), inputState.specie) self.antisiteSpecieCount = _rendering.countAntisitesBySpecie(self.antisites, len(refState.specieList), refState.specie, self.onAntisites, len(inputState.specieList), inputState.specie) self.splitIntSpecieCount = _rendering.countSplitIntsBySpecie(self.splitInterstitials, len(inputState.specieList), inputState.specie) # TODO: dictionary of calculated properties... ?? sum of voro vols etc... # time to apply filters applyFiltersTime = time.time() - applyFiltersTime self.logger.debug("Apply filter(s) time: %f s", applyFiltersTime) # refresh available scalars in extra options dialog # self.parent.colouringOptions.refreshScalarColourOption() # time runFiltersTime = time.time() - runFiltersTime self.logger.debug("Apply list total time: %f s", runFiltersTime) def getBubblesIndices(self): """Return arrays for bubble vacancy and atom indices.""" bubbleVacs = [] bubbleAtoms = [] for bubble in self.bubbleList: for index in bubble.vacancies(): bubbleVacs.append(index) for index in bubble.atoms(): bubbleAtoms.append(index) bubbleVacs = np.asarray(bubbleVacs, dtype=np.int32) bubbleAtoms = np.asarray(bubbleAtoms, dtype=np.int32) return bubbleVacs, bubbleAtoms def povrayAtomsWrittenSlot(self, status, povtime, uniqueID): """ POV-Ray atoms have been written """ if not status: self.povrayAtomsWritten = True self.logger.debug("Povray atoms written in %f s (%s)", povtime, uniqueID) def makeFullScalarsArray(self): """ Combine scalars array into one big array for passing to C """ self.logger.debug("Making full scalars array (N=%d)", len(self.scalarsDict) + len(self.latticeScalarsDict)) scalarsList = [] for name, scalars in six.iteritems(self.scalarsDict): self.logger.debug(" Adding '%s' scalars", name) scalarsList.append(scalars) if len(scalars) != len(self.visibleAtoms): raise RuntimeError("Wrong length for scalars: '{0}'".format(name)) for name, scalars in six.iteritems(self.latticeScalarsDict): self.logger.debug(" Adding '%s' scalars (Lattice)", name) scalarsList.append(scalars) if len(scalars) != len(self.visibleAtoms): raise RuntimeError("Wrong length for scalars: '{0}' (Lattice)".format(name)) if len(scalarsList): scalarsFull = np.concatenate(scalarsList) else: scalarsFull = np.array([], dtype=np.float64) return len(scalarsList), scalarsFull def makeFullVectorsArray(self): """ Combine vectors array into one big array for passing to C """ self.logger.debug("Making full vectors array (N=%d)", len(self.vectorsDict)) vectorsList = [] for name, vectors in six.iteritems(self.vectorsDict): self.logger.debug("Adding '%s' vectors", name) vectorsList.append(vectors) if vectors.shape != (len(self.visibleAtoms), 3): raise RuntimeError("Shape wrong for vectors array '%s': %r != %r" % (name, vectors.shape, (len(self.visibleAtoms), 3))) if len(vectorsList): vectorsFull = np.concatenate(vectorsList) else: vectorsFull = np.array([], dtype=np.float64) return len(vectorsList), vectorsFull def storeFullScalarsArray(self, NVisible, NScalars, scalarsFull): """ Split and resize full scalars array; store in dict Assumes scalarsDict was not modified since we called makeFullScalarsArray. """ if NScalars > 0: self.logger.debug("Storing full scalars array") scalarsList = np.split(scalarsFull, NScalars) # Filterer.scalarsDict keys = list(self.scalarsDict.keys()) lenError = False for i, key in enumerate(keys): self.logger.debug("Storing '%s' scalars", key) scalars = scalarsList[i] if len(scalars) < NVisible: msg = "'%s' scalars smaller than expected (%d < %d) (this is expected in some situations); " msg += "clearing scalars list" self.logger.warning(msg, key, len(scalars), NVisible) lenError = True break else: scalars_cp = copy.copy(scalars) scalars_cp.resize(NVisible, refcheck=False) self.scalarsDict[key] = scalars_cp if lenError: self.scalarsDict.clear() # Lattice.scalarsDict offset = len(keys) keys = list(self.latticeScalarsDict.keys()) lenError = False for j, key in enumerate(keys): self.logger.debug(" Storing '%s' scalars (Lattice)", key) i = j + offset scalars = scalarsList[i] if len(scalars) < NVisible: msg = "'%s' scalars smaller than expected (%d < %d) (this is expected in some situations); " msg += "clearing scalars list" self.logger.warning(msg, key, len(scalars), NVisible) lenError = True break else: scalars_cp = copy.copy(scalars) scalars_cp.resize(NVisible, refcheck=False) self.latticeScalarsDict[key] = scalars_cp if lenError: self.latticeScalarsDict.clear() def storeFullVectorsArray(self, NVisible, NVectors, vectorsFull): """ Split and resize full vectors array; store in dict Assumes vectorsDict was not modified since we called makeFullVectorsArray. """ if NVectors > 0: self.logger.debug("Storing full vectors array in dict") vectorsList = np.split(vectorsFull, NVectors) keys = list(self.vectorsDict.keys()) lenError = False for key, vectors in zip(keys, vectorsList): self.logger.debug(" Storing '%s' vectors", key) if len(vectors) < NVisible: msg = "'%s' vectors smaller than expected (%d < %d) (this is expected in some situations); " msg += "clearing vectors list" self.logger.warning(msg, key, len(vectors), NVisible) lenError = True break else: vectors_cp = copy.copy(vectors) vectors_cp.resize((NVisible, 3), refcheck=False) self.vectorsDict[key] = vectors_cp if lenError: self.vectorsDict.clear()
42.080537
119
0.563477
18,362
0.976183
0
0
0
0
0
0
3,432
0.182456
551fb4d66e7bdb8b9da3ce7860f15d493f500f54
475
py
Python
Entree_in/rou.py
dipkhandait/Entree_in
5cc03555b1e8022262dffa0a0a459637fa9f49c7
[ "MIT" ]
null
null
null
Entree_in/rou.py
dipkhandait/Entree_in
5cc03555b1e8022262dffa0a0a459637fa9f49c7
[ "MIT" ]
null
null
null
Entree_in/rou.py
dipkhandait/Entree_in
5cc03555b1e8022262dffa0a0a459637fa9f49c7
[ "MIT" ]
null
null
null
import sqlite3 connection = sqlite3.connect("Project.db") cursor = connection.cursor() S_user = cursor.execute(f"SELECT * FROM Current_login WHERE No = '{1}'") record = S_user.fetchone() user = record[0] print(user) try: Spl_user = cursor.execute(f"SELECT * FROM Col_Pref_list where Username = '{user}'") recordpl = Spl_user.fetchone() userpl = recordpl[0] print(userpl) print("SUCCESSFULL") except Exception as e: print("Unsuccessful") print(e)
26.388889
87
0.696842
0
0
0
0
0
0
0
0
142
0.298947
5520df1b613fa85e6ad8dd2ba56eeb9d62e2e7df
2,766
py
Python
tests/cases/yield_test.py
MiguelMarcelino/py2many
9b040b2a157e265df9c053eaf3e5cd644d3e30d0
[ "MIT" ]
2
2022-02-02T11:37:53.000Z
2022-03-30T18:19:06.000Z
tests/cases/yield_test.py
MiguelMarcelino/py2many
9b040b2a157e265df9c053eaf3e5cd644d3e30d0
[ "MIT" ]
25
2022-02-28T21:19:11.000Z
2022-03-23T21:26:20.000Z
tests/cases/yield_test.py
MiguelMarcelino/py2many
9b040b2a157e265df9c053eaf3e5cd644d3e30d0
[ "MIT" ]
null
null
null
@resumable # For PyJL def generator_func(): num = 1 yield num num = 5 yield num num = 10 yield num @resumable def generator_func_loop(): num = 0 for n in range(0, 3): yield num + n @resumable def generator_func_loop_using_var(): num = 0 end = 2 end = 3 # should get last variable assignment for n in range(0, end): yield num + n @resumable def generator_func_nested_loop(): for n in range(0, 2): for i in range(0, 2): yield (n,i) @resumable def file_reader(file_name:str): for file_row in open(file_name, "r"): yield file_row @resumable def testgen(): print("first") yield 1 print("second") yield 2 @resumable def fib(): a = 0 b = 1 while True: yield a a, b = b, a+b class TestClass: @resumable def generator_func(self): num = 123 yield num num = 5 yield num num = 10 yield num if __name__ == "__main__": # Calling functions normally (Supported) arr1 = [] for i in generator_func(): arr1.append(i) assert arr1 == [1, 5, 10] # ----------------------- arr2 = [] for i in generator_func_loop(): arr2.append(i) assert arr2 == [0, 1, 2] # ----------------------- arr3 = [] for i in generator_func_loop_using_var(): arr3.append(i) assert arr3 == [0, 1, 2] # ----------------------- # Testing with class scope arr4 = [] testClass1: TestClass = TestClass() for i in testClass1.generator_func(): arr4.append(i) assert arr4 == [123, 5, 10] # ----------------------- # Testing nested loop arr5 = [] for i in generator_func_nested_loop(): arr5.append(i) assert arr5 == [(0,0), (0,1), (1,0), (1,1)] # ----------------------- arr6 = [] # Create file before executing for res in file_reader("C:/Users/Miguel Marcelino/Desktop/test.txt"): arr6.append(res) assert arr6 == ['test\n', 'test\n', 'test'] # ----------------------- arr7 = [] res = fib() for i in range(0,6): arr7.append(res.__next__()) assert arr7 == [0,1,1,2,3,5] # ----------------------- for i in testgen(): print(i) # ----------------------------------- # Calling functions using loop (unsupported in PyJL) # testClass2: TestClass = TestClass() # funcs = [generator_func, generator_func_loop, generator_func_loop_using_var, testClass2.generator_func, # generator_func_nested_loop] # arrL = [] # for func in funcs: # for i in func(): # arrL.append(i) # assert arrL == [1, 5, 10, 0, 1, 2, 0, 1, 2, 123, 5, 10, (0,0), (0,1), (1,0), (1,1)]
22.487805
109
0.5141
166
0.060014
846
0.305857
949
0.343095
0
0
859
0.310557
5521cf44b0712c36f70ad0bbd932c50c521247f6
1,252
py
Python
apps/api/quipper/main.py
phillamb168/system-design
d074409211521c930a2b355cac102caef827d627
[ "Apache-2.0" ]
3
2021-11-12T11:00:35.000Z
2022-02-16T10:33:53.000Z
apps/api/quipper/main.py
phillamb168/system-design
d074409211521c930a2b355cac102caef827d627
[ "Apache-2.0" ]
null
null
null
apps/api/quipper/main.py
phillamb168/system-design
d074409211521c930a2b355cac102caef827d627
[ "Apache-2.0" ]
8
2021-08-04T18:47:18.000Z
2022-03-15T10:14:32.000Z
from fastapi import ( Depends, FastAPI, ) from fastapi.middleware.cors import CORSMiddleware from sqlalchemy.orm import Session from quipper import ( models, schemas, services, ) from quipper.database import ( SessionLocal, engine, ) # Create the tables models.Base.metadata.create_all(bind=engine) app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) # https://fastapi.tiangolo.com/tutorial/dependencies/dependencies-with-yield def get_db(): db = SessionLocal() try: yield db finally: db.close() @app.get("/healthz/", status_code=200) def get_health(): return {"healthy": True} @app.post("/messages/", status_code=201) def post_message(message: schemas.MessageCreate, db: Session = Depends(get_db)): services.create_message(db=db, message=message) @app.get("/conversations/{conversation_id}", response_model=schemas.Conversation) def get_conversation(conversation_id: str, db: Session = Depends(get_db)): return services.get_conversation(db=db, conversation_id=conversation_id)
21.220339
76
0.664537
0
0
95
0.075879
575
0.459265
0
0
170
0.135783
5522df8e11c9c1d695b6fd19a76f81ba0655ccc5
3,611
py
Python
data_structures/adjacency_list_graph.py
avg-2049-joe/py-algo-ds
4f9c3c086e134ee23fcc0ee3b981e81f40e860cd
[ "MIT" ]
null
null
null
data_structures/adjacency_list_graph.py
avg-2049-joe/py-algo-ds
4f9c3c086e134ee23fcc0ee3b981e81f40e860cd
[ "MIT" ]
null
null
null
data_structures/adjacency_list_graph.py
avg-2049-joe/py-algo-ds
4f9c3c086e134ee23fcc0ee3b981e81f40e860cd
[ "MIT" ]
null
null
null
"""Adjacency list is a graph representation using array or a hash map""" from collections import deque class AdjacencyListGraph: """Graph representation using dictionary""" def __init__(self): self.__nodes = {} def __str__(self): return str(self.__nodes) def insert_vertex(self, data): """Insert a vertex and its relationships """ self.__nodes[data] = set() def insert_edge(self, start_data, end_data): """Insert a relationship b/w edges""" adj_list_start = self.__nodes.get(start_data, None) adj_list_end = self.__nodes.get(end_data, None) if adj_list_start is not None and adj_list_end is not None: adj_list_start.add(end_data) adj_list_end.add(start_data) else: raise Exception('vertexes are not found') def depth_first_search_path(self, source, destination, visited=None): """Looks for a path from source - destination""" print(source, visited) if visited is None: visited = set() # the source and destination must be vertices in the graph if source not in self.__nodes or destination not in self.__nodes: return False # if we looked through the source already # then the path does not exist if source in visited: return False # add to the visited list visited.add(source) # if the source and destination are equal then we found a path if source == destination: return True # ask the adj vertices to see if the path exists for adj_vertex in self.__nodes[source]: if self.depth_first_search_path(adj_vertex, destination, visited): return True # if the adj list is exhausted then return False as path does not exist return False def breadth_first_search(self, source, destination): """Do a breadth first search - queue & set""" visited = set() # source and destination must be valid vertices in the graph if source not in self.__nodes or destination not in self.__nodes: return False # create a queue and add source to it queue = deque() queue.appendleft(source) while len(queue): vertex = queue.pop() if vertex == destination: return True # if the vertex is already visited, nothing to do if vertex in visited: continue # add to visited set visited.add(vertex) # at the end add all of the adj vertices to the queue for adj_vertex in self.__nodes[vertex]: queue.appendleft(adj_vertex) return False def create_graph(): """Create and insert vertices and paths""" graph = AdjacencyListGraph() graph.insert_vertex(0) graph.insert_vertex(1) graph.insert_vertex(2) graph.insert_vertex(3) graph.insert_edge(0, 1) graph.insert_edge(1, 2) graph.insert_edge(1, 3) graph.insert_edge(2, 3) return graph def test_adjacency_list_graph(): """Simple test for the graph implementation""" graph = create_graph() print(graph) def test_dfs(): """Depth first search a path""" graph = create_graph() print(graph.depth_first_search_path(0, 3)) def test_bfs(): """Breadth first search a path""" graph = create_graph() print(graph.breadth_first_search(0, 3)) if __name__ == '__main__': test_adjacency_list_graph() test_dfs() test_bfs()
27.356061
79
0.623927
2,687
0.744115
0
0
0
0
0
0
1,029
0.284963
5523fbe79d2ce42233aa94670f1b7a5b2c7819fa
4,515
py
Python
monroe-netalyzr/files/runme2.py
ana-cc/dockerstuffs
98131138731dd3c7a18e4e1a3b6975e3778502f9
[ "BSD-2-Clause" ]
1
2020-09-10T19:15:09.000Z
2020-09-10T19:15:09.000Z
monroe-netalyzr/files/runme2.py
ana-cc/dockerstuffs
98131138731dd3c7a18e4e1a3b6975e3778502f9
[ "BSD-2-Clause" ]
null
null
null
monroe-netalyzr/files/runme2.py
ana-cc/dockerstuffs
98131138731dd3c7a18e4e1a3b6975e3778502f9
[ "BSD-2-Clause" ]
null
null
null
#!/usr/bin/python import json import subprocess import logging from pyroute2 import IPDB import sys logging.basicConfig(level=logging.DEBUG) logger = logging.getLogger("runme") def add_dns(interface): str = "" try: with open('/dns') as dnsfile: dnsdata = dnsfile.readlines() dnslist = [ x.strip() for x in dnsdata ] for item in dnslist: if interface in item: str += item.split('@')[0].replace("server=", "nameserver ") str += "\n" str += "nameserver 8.8.8.8\n" with open("/etc/resolv.conf", "w") as f: f.write(str) except: str = "Could not find DNS file" return str def main(): ip = IPDB() s = set([interface.ifname for interface in ip.interfaces.values()]) logger.debug("Interfaces encountered: ") logger.debug(s) try: s.remove('lo') s.remove('metadata') except: logger.debug("Metadata or lo not found!\n") try: with open('/monroe/config') as configfile: config = json.load(configfile) nodeid = config['nodeid'] except: nodeid = 'could-not-get-id' try: with open('/monroe/config') as configfile: config = json.load(configfile) operator = config['operator'] except: operator = 'N/A' subprocess.call(['mkdir', '/tmp/res/']) result_files=[] for item in s: if item in ['op0', 'op1']: logger.debug("Running on interface: " + item) try: subprocess.call(['route', 'del','default']) logger.debug("Default route deleted.") except Exception as e: logger.debug(e) try: subprocess.call(['route', 'add','default','dev', item]) logger.debug("Default route for interface " + item + " was added.") except Exception as e: logger.debug(e) try: a = add_dns(item) logger.debug("DNS added\n") logger.debug(a) logger.debug("Testing connectivity...\n") process = subprocess.Popen(['ping' , '-c', '3', '8.8.8.8'], stdout=subprocess.PIPE) result_ping = process.communicate()[0] logger.debug(result_ping) except Exception as e: logger.debug(e) try: logger.debug("Running netalyzr...\n") process = subprocess.Popen(['java', '-jar', '/opt/monroe/NetalyzrCLI.jar']) process.wait() result = "See container.log" logger.debug("Finished running netalyzr...\n") except Exception as e: logger.debug(e) wr_str = "/tmp/res/mnr-" +str(nodeid) + "_" + item result_files.append(wr_str) try: logger.debug("Verifying resolv.conf...\n") dnsproc = subprocess.Popen(['cat','/etc/resolv.conf'], stdout=subprocess.PIPE) result_dns = dnsproc.communicate()[0] except Exception as e: result_dns = e try: logger.debug("Writing results to file...\n") with open(wr_str, 'w') as wr_file: wr_file.write("ID: " + str(nodeid) + "\n") wr_file.write("Interface: " + item +"\n") wr_file.write("Operator: " + str(operator) +"\n") wr_file.write("Resolv.conf:\n" + str(result_dns)+ "\n") wr_file.write("Ping Results:\n" + str(result_ping)+ "\n") with open(wr_str, 'a') as wr_file: wr_file.write(result) logger.debug("Acquiring global IP address...\n") process = subprocess.Popen(['curl', 'https://stat.ripe.net/data/whats-my-ip/data.json'], stdout=subprocess.PIPE) result_ripe = process.communicate()[0] with open(wr_str, 'a') as wr_file: wr_file.write(result_ripe) except Exception as e: logger.debug(e) for result_file in result_files: try: subprocess.call(['/usr/bin/mv', result_file, '/monroe/results/']) except Exception as e: logger.debug(e) ip.release() if __name__ == "__main__": sys.exit(main())
32.021277
127
0.50897
0
0
0
0
0
0
0
0
937
0.20753
9b28efc68a829abe66b1f36c000e5c38c0f766de
9,725
py
Python
teptools/summarise.py
nelsyeung/teptools
90a8cde2793e509b30c6fca0c3f64320855cf7c6
[ "MIT" ]
null
null
null
teptools/summarise.py
nelsyeung/teptools
90a8cde2793e509b30c6fca0c3f64320855cf7c6
[ "MIT" ]
null
null
null
teptools/summarise.py
nelsyeung/teptools
90a8cde2793e509b30c6fca0c3f64320855cf7c6
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 import sys import os import argparse import subprocess import textwrap import helpers class Summarise(): def __init__(self, file, term_cols): self.term_cols = term_cols self.cols_width = [21, 22, 11, 15, 22] self.in_lnv = False self.lnv_iteration = 0 self.iteration = 0 self.rms_gradient = 0.0 self.energy = 0.0 self.old_energy = 0.0 self.step_size = 0.0 self.commutator = 0.0 self.message = '' self.time_taken = '' self.num_processor = 0 self.iteration_header, self.iteration_info = self.unformatted_str() self.summary = [] with open(file, 'r') as f: self.file_lines = f.readlines() def unformatted_str(self): """Return summary info string for .format function.""" header = '' info = '' num_decimals = [14, 14, 6, 11, 14] while self.term_cols < sum(self.cols_width) + 5: self.cols_width = [x-1 for x in self.cols_width] num_decimals = [x-1 for x in num_decimals] for i in range(len(self.cols_width)): header += '|{:^' + str(self.cols_width[i] - 1) + '}' info += ('{:' + str(self.cols_width[i]) + '.' + str(num_decimals[i]) + 'f}') header = '| i' + header + '|' info = '{:3d}' + info + '{}' return header, info def parse_line(self, line): """Parse the contents of the file line currently on.""" linesplit = line.split() if 'TOTAL TIME' in line: self.time_taken = linesplit[2] self.num_processor = linesplit[4] elif 'RMS gradient' in line and 'NGWF' not in line: self.rms_gradient = float(linesplit[-1]) elif 'step 0' in line: self.old_energy = self.energy self.energy = float(linesplit[5]) elif ('Selected quadratic step' in line or 'Selected cubic step' in line): self.step_size = float(linesplit[4]) elif ('Starting BFGS iteration' in line or 'improving iteration' in line): self.energy = 0.0 self.old_energy = 1 elif 'RMS NGWF gradient =' in line: self.rms_gradient = float(linesplit[5]) elif 'BFGS: starting iteration' in line: self.iteration = 0 elif '| commutator' in line: self.in_lnv = True self.lnv_iteration = 1 elif (line and self.in_lnv and str(self.lnv_iteration) == linesplit[0]): try: self.commutator = float(linesplit[3]) except ValueError: pass self.lnv_iteration += 1 elif 'Finished density kernel iterations' in line: self.in_lnv = False elif 'WARNING: maximum number of NGWF CG iterations' in line: self.message = ' <-- MAXIT_NGWF_CG EXCEEDED' elif 'NGWF optimisation converged' in line: self.message = ' <-- CG CONVERGED' elif 'NGWF CG iteration 001' in line: return self.iteration_header.format( 'RMS Gradient', 'Total Energy', 'Step', 'Commutator', 'Change') elif ('Job started' in line or 'Moving atom' in line or 'WARNING: slope along search direction' in line): return line elif 'NGWF line search finished' in line: self.iteration += 1 return self.iteration_info.format( self.iteration, self.rms_gradient, self.energy, self.step_size, self.commutator, self.energy - self.old_energy, '') elif '-- CG' in line: iteration = self.iteration + 1 self.iteration = 0 self.old_energy = self.energy self.energy = float(linesplit[2]) return self.iteration_info.format( iteration, self.rms_gradient, self.energy, 0, self.commutator, self.energy - self.old_energy, self.message) elif 'Job completed' in line: return '{} in {} on {} processors'.format( line, self.time_taken, self.num_processor) if ('BFGS' in line and 'BFGS: line :' not in line and 'BFGS: trial:' not in line and 'BFGS: quad :' not in line): return line return '' def run(self, line_print): """Parse the whole file and store the summary.""" for line in self.file_lines: result = self.parse_line(line.strip()) if result: self.summary.append(result) if line_print: print(result) def parser(default_args, args): """Return parsed command line arguments.""" parser = argparse.ArgumentParser( description=( 'Extracts the results of the NGWF CG optimisation steps from an\n' 'output file (which may still be running) and output them in a\n' 'format as if you were running with output_detail=BRIEF or\n' 'looking at the calculation summary.'), formatter_class=argparse.RawTextHelpFormatter) parser.add_argument( 'outfiles', metavar='outfile', type=str, nargs='*', help='ONETEP output files to be summarised\n' 'If none is specified then all out files (*.out)\n' 'in the current directory will be read') parser.add_argument( '-vd', '--vimdiff', action='store_true', help='Open multiple outputs in vimdiff') parser.add_argument( '--no-vimdiff', action='store_false', dest='vimdiff', help='Prevent opening multiple outputs in vimdiff') parser.add_argument( '-o', '--output', action='store_true', help='Write each output into its own file') parser.add_argument( '--no-output', action='store_false', dest='output', help='Prevent writing each output into its own file') if args is None: # pragma: no cover if default_args == ['']: default_args = [] args = default_args args.extend(sys.argv[1:]) return parser.parse_args(args) def print_side_view(summaries, col_width): """Print two summaries side-by-side.""" wrapper = textwrap.TextWrapper(width=col_width) indices = [0, 0] locks = [False, False] unlocks = [False, False] sync_lines = ['| i|'] completed = False while indices[0] < len(summaries[0]) or indices[1] < len(summaries[1]): outputs = ['--', '--'] # Dashes for empty lines to avoid confusions if completed: unlocks = [True, True] for j in range(2): if (unlocks[j] or not locks[j]) and indices[j] < len(summaries[j]): if (not unlocks[j] and any(line in summaries[j][indices[j]] for line in sync_lines)): locks[j] = True else: wrapped = wrapper.wrap(summaries[j][indices[j]]) outputs[j] = wrapped[0] locks[j] = False unlocks[j] = False indices[j] += 1 if len(wrapped) > 1: summaries[j].insert(indices[j], wrapped[1]) if indices[j] == len(summaries[j]): completed = True if locks[0] and locks[1]: unlocks = [True, True] if not locks[0] or not locks[1]: print(('{:<' + str(col_width) + '}' + '{:' + str(col_width) + '}').format( outputs[0], outputs[1])) def main(args=None, rcfile=None): default_config = { 'options': [], 'outfile_ext': 'out' } config = helpers.parse_rcfile(rcfile, 'summarise', default_config) args = parser(config['options'], args) try: term_cols = int(subprocess.check_output(['stty', 'size']).split()[1]) except subprocess.CalledProcessError: term_cols = 180 # Minimum size required for proper display outfiles = helpers.find_files(args.outfiles, config['outfile_ext']) # Always disable vimdiff mode if only one output file is specified if len(outfiles) == 1: args.vimdiff = False iswrite = args.output or args.vimdiff newfiles = [] # files created by write output mode summaries = [] # Only used for side-by-side view side_view = not iswrite and len(outfiles) == 2 and term_cols >= 180 term_cols = int(term_cols / 2) if side_view else term_cols line_print = not iswrite and not side_view for file in outfiles: summarise = Summarise(file, term_cols) summarise.run(line_print) if iswrite: filename = os.path.splitext(os.path.basename(file))[0] newfile, summary_file = helpers.create_file(filename, 'summary') newfiles.append(newfile) if side_view: summaries.append(summarise.summary) for line in summarise.summary: if iswrite: summary_file.write(line + '\n') if iswrite: summary_file.close() if not args.vimdiff: print(file + ' summary > ' + newfile) if side_view: print_side_view(summaries, term_cols) if args.vimdiff: subprocess.call('vimdiff ' + ' '.join(newfiles), shell=True) if not args.output and args.vimdiff: for newfile in newfiles: os.remove(newfile) if __name__ == '__main__': # pragma: no cover main()
34.003497
79
0.55671
4,725
0.485861
0
0
0
0
0
0
2,014
0.207095
9b292f152e109d6afd9ce99c12e29518dfc1f37f
3,202
py
Python
catfeeder_stepper.py
novalis111/catfeeder
4597bb24b4d159b9a79ef18e808ccab15391c659
[ "MIT" ]
null
null
null
catfeeder_stepper.py
novalis111/catfeeder
4597bb24b4d159b9a79ef18e808ccab15391c659
[ "MIT" ]
null
null
null
catfeeder_stepper.py
novalis111/catfeeder
4597bb24b4d159b9a79ef18e808ccab15391c659
[ "MIT" ]
null
null
null
#!/usr/bin/python # -*- coding: utf-8 -*- # Import required libraries import time import random import datetime import RPi.GPIO as GPIO # Use BCM GPIO references instead of physical pin numbers GPIO.setmode(GPIO.BCM) GPIO.setup(18, GPIO.IN, pull_up_down=GPIO.PUD_UP) # 1 step = 1/4 of full def rotate(movesteps, rotation='r', speed=1): # One sequence is eight mini steps, 512 steps = 360° movesteps = movesteps * 128 * 8 if speed < 1: speed = 1 # Define GPIO signals to use # Physical pins 11,15,16,18 # GPIO17,GPIO22,GPIO23,GPIO24 step_pins = [17, 22, 23, 24] # Set all pins as output for pin in step_pins: GPIO.setup(pin, GPIO.OUT) GPIO.output(pin, False) # Define advanced sequence # as shown in manufacturers datasheet seq = [[1, 0, 0, 1], [1, 0, 0, 0], [1, 1, 0, 0], [0, 1, 0, 0], [0, 1, 1, 0], [0, 0, 1, 0], [0, 0, 1, 1], [0, 0, 0, 1]] step_count = len(seq) if rotation == 'r': step_dir = 1 else: step_dir = -1 # Set to 1 or 2 for clockwise # Set to -1 or -2 for anti-clockwise # Initialise variables step_counter = 0 # Start main loop while movesteps > 0: for pin in range(0, 4): xpin = step_pins[pin] # Get GPIO if seq[step_counter][pin] != 0: GPIO.output(xpin, True) else: GPIO.output(xpin, False) step_counter += step_dir # If we reach the end of the sequence # start again if step_counter >= step_count: step_counter = 0 if step_counter < 0: step_counter = step_count + step_dir # Wait before moving on time.sleep(speed / float(1000)) movesteps -= 1 # reset pins for pin in step_pins: GPIO.output(pin, False) ''' limit = 5 cur_rot = 'r' while limit > 0: steps = random.randint(0, 4) pace = random.randint(0, 5) if cur_rot == 'r': cur_rot = 'l' else: cur_rot = 'r' rotate(steps, cur_rot, pace) limit -= 1 ''' lastpress = 0 lastfeed = 0 while True: input_state = GPIO.input(18) if not input_state: # Button pressed press_ago = time.time() - lastpress lastfeed_ago = time.time() - lastfeed if press_ago > 10800 or lastfeed_ago > 10800: # Full load -> 5 full rounds = 5*4 steps print("Full feed") rotate(20) lastpress = time.time() lastfeed = time.time() elif press_ago > 300: # 5 minutes ago, only one round print("Medium feed") rotate(4) lastpress = time.time() elif press_ago > 60: # 1 minute ago, only tiny move print("Tiny feed") rotate(1) lastpress = time.time() else: print("No Feed yet") print("Last Feed was " + str(round(lastfeed_ago / 60, 1)) + " minutes ago") print("Next full Feed is in " + str(round((10800 - lastfeed_ago) / 60, 1)) + " minutes") time.sleep(5) GPIO.cleanup()
25.212598
100
0.538101
0
0
0
0
0
0
0
0
1,041
0.325008
9b2ae5c5d7a422f9f2eda94d4feb8800f0416e6f
604
py
Python
SpoTwillio/search.py
Natfan/funlittlethings
80d5378b45b5c0ead725942ee50403bd057514a6
[ "MIT" ]
1
2017-12-03T15:08:42.000Z
2017-12-03T15:08:42.000Z
SpoTwillio/search.py
Natfan/funlittlethings
80d5378b45b5c0ead725942ee50403bd057514a6
[ "MIT" ]
2
2017-09-25T12:43:41.000Z
2021-05-07T14:29:27.000Z
SpoTwillio/search.py
Natfan/funlittlethings
80d5378b45b5c0ead725942ee50403bd057514a6
[ "MIT" ]
1
2017-09-04T19:37:42.000Z
2017-09-04T19:37:42.000Z
import spotipy import argparse sp = spotipy.Spotify() parser = argparse.ArgumentParser() parser.add_argument("term", help="The artist that you want to search for") parser.add_argument("-c", "--count", help="The amount of results that you want, capped at 20", type=int) args = parser.parse_args() def spoprint(): results = sp.search(q=args.term, limit=args.count) for i, t in enumerate(results['tracks']['items']): print(' ', i, t['name']) if args.count: if args.count > 20: print("enter a count lower than or equal to 20") else: spoprint() else: spoprint()
27.454545
104
0.662252
0
0
0
0
0
0
0
0
175
0.289735
9b2b7e3184a648dffa11f8e71194a20d3c591394
13,484
py
Python
denverapi/bdtp.py
xcodz-dot/denver
4142594756ceb7edb23d77cf7549f8d770185def
[ "MIT" ]
4
2020-09-26T08:48:53.000Z
2020-12-02T21:50:28.000Z
denverapi/bdtp.py
xcodz-dot/denver
4142594756ceb7edb23d77cf7549f8d770185def
[ "MIT" ]
22
2020-09-26T08:12:13.000Z
2020-12-03T04:01:13.000Z
denverapi/bdtp.py
xcodz-dot/denver-api
4142594756ceb7edb23d77cf7549f8d770185def
[ "MIT" ]
3
2020-09-26T17:25:14.000Z
2020-12-02T21:47:18.000Z
""" ##Big Data Transfer Protocol ###What does it do This protocol sends big data on a address (IPv4,port) without worrying about pipe errors. """ __author__ = "Xcodz" __version__ = "2021.2.24" import abc import socket import time import typing from . import thread_control default_buffer_size = 100000 class _BaseSender(abc.ABC): @abc.abstractmethod def send(self, c): pass class _BaseReceiver(abc.ABC): @abc.abstractmethod def recv(self, c): pass class DataSenderHost(_BaseSender): """ it is used for sending data as a host or in other words, server to create a new DataSenderHost please use function implementation for it """ def __init__(self): self.data = b"" self.address: tuple = ("", 0) self.data_send: int = 0 self.buffer_size: int = default_buffer_size self.task = False def send(self, connected_socket: socket.socket = None): """ use this function to initiate the connection and send the data. `connected_socket` can be supplied if you want to send over a already connected socket. """ if connected_socket is None: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(self.address) s.listen(5) connection, _ = s.accept() else: connection = connected_socket if isinstance(self.data, bytes): for line in range(0, len(self.data), self.buffer_size): lts = self.data[line : line + self.buffer_size] connection.sendall(lts) self.data_send += self.buffer_size elif isinstance(self.data, typing.BinaryIO): while True: line = self.data.read(self.buffer_size) if line == b"": break connection.sendall(line) self.data_send += self.buffer_size connection.send(b"") if connected_socket is None: connection.close() s.close() self.task = True class DataSenderPort(_BaseSender): """ it is used for sending data as a client to create a new DataSenderPort please use function implementation for it """ def __init__(self): self.data: bytes = b"" self.address: tuple = ("", 0) self.data_send: int = 0 self.buffer_size: int = default_buffer_size self.task = False def send(self, connected_socket: socket.socket = None): """ use this function to initiate the connection and send the data. `connected_socket` can be supplied if you want to send over a already connected socket. """ if connected_socket is None: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(self.address) else: s = connected_socket if isinstance(self.data, bytes): for x in range(0, len(self.data), self.buffer_size): lts = self.data[x : x + self.buffer_size] s.sendall(lts) self.data_send += self.buffer_size elif isinstance(self.data, typing.BinaryIO): while True: line = self.data.read(self.buffer_size) if line == b"": break s.sendall(line) self.data_send += self.buffer_size s.send(b"") if connected_socket is None: s.close() self.task = True class DataReceiverHost(_BaseReceiver): """ it is used for receiving data as a server or host to create a new DataReceiverHost please use function implementation for it """ def __init__(self): self.address: tuple = ("", 0) self.data_recv: int = 0 self.buffer_size: int = default_buffer_size self.data = b"" self.task = False def recv(self, connected_socket: socket.socket = None): """ use this function to initiate the connection and start receiving the data. `connected_socket` can be supplied if you want to receive over a already connected socket. """ if connected_socket is None: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(self.address) s.listen(5) connection, _ = s.accept() else: connection = connected_socket recv_bytes = b"\0" while recv_bytes != b"": recv_bytes = connection.recv(self.buffer_size) self.data += recv_bytes self.data_recv += self.buffer_size if connected_socket is None: connection.close() s.close() self.task = True class DataReceiverPort(_BaseReceiver): """ it is used for receiving data as a client to create a new DataReceiverPort please use function implementation for it """ def __init__(self): self.address: tuple = ("", 0) self.data_recv: int = 0 self.buffer_size: int = default_buffer_size self.data = b"" self.task = False def recv(self, connected_socket: socket.socket = None): """ use this function to initiate the connection and start receiving the data. `connected_socket` can be supplied if you want to receive over a already connected socket. """ if connected_socket is None: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(self.address) connection = s else: connection = connected_socket recv_bytes = b"\0" while recv_bytes != b"": recv_bytes = connection.recv(self.buffer_size) self.data += recv_bytes self.data_recv += self.buffer_size if connected_socket is None: connection.close() self.task = True def new_send_data_host(data: bytes, addr: tuple = None, buffer_size=None): """ Make a new `DataSenderHost` with provided arguments. It's better to not supply `addr` if you are going to use the object on existing connection. It is also not recommended to change `buffer_size` because this argument is supposed to be same at both the sender and receiver. You can then use the `send` method of the returned object to send the provided data. Example: ```python from denverapi import bdtp import socket # Without existing connection my_sender = bdtp.new_send_data_host(b"Some Data", ("127.0.0.1", 7575)) my_sender.send() # With existing connection my_server = socket.socket() my_server.bind(("127.0.0.1", 1234)) my_server.listen(5) my_connection, address = my_server.accept() my_sender = bdtp.new_send_data_host(b"Some Data") my_sender.send(my_connection) # With changed buffer size my_sender = bdtp.new_send_data_host(b"Some Data", ("127.0.0.1", 12345), 3) my_sender.send() ``` """ sender_object = DataSenderHost() sender_object.data = data sender_object.address = addr if buffer_size is not None: sender_object.buffer_size = buffer_size return sender_object def new_send_data_port(data: bytes, addr: tuple = None, buffer_size=None): """ Make a new `DataSenderPort` with provided arguments. It's better to not supply `addr` if you are going to use the object on existing connection. It is also not recommended to change `buffer_size` because this argument is supposed to be same at both the sender and receiver. You can then use the `send` method of the returned object to send the provided data. Example: ```python from denverapi import bdtp import socket # Without existing connection my_sender = bdtp.new_send_data_port(b"Some Data", ("127.0.0.1", 7575)) my_sender.send() # With existing connection my_connection = socket.socket() my_connection.connect(("127.0.0.1", 1234)) my_sender = bdtp.new_send_data_port(b"Some Data") my_sender.send(my_connection) # With changed buffer size my_sender = bdtp.new_send_data_host(b"Some Data", ("127.0.0.1", 12345), 3) my_sender.send() ``` """ sender_object = DataSenderPort() sender_object.data = data sender_object.address = addr if buffer_size is not None: sender_object.buffer_size = buffer_size return sender_object def new_receive_data_host(addr: tuple = None, buffer_size=None): """ Make a new `DataReceiverHost` object to receive data sent by sender. It is not recommended to supply `addr` if you are going to use it with existing connection. It is highly discouraged to use `buffer_size` argument as it is supposed to be kept same at both sender and receiver. You can use the returned object's `recv` method to start receiving data. Once receiving is complete. data will be stored in object's `data` attribute as bytes. ```python from denverapi import bdtp import socket # Without existing connection my_receiver = bdtp.new_receive_data_host(("127.0.0.1", 7575)) my_receiver.recv() # With existing connection my_connection = socket.socket() my_connection.connect(("127.0.0.1", 1234)) my_receiver = bdtp.new_receive_data_host() my_receiver.recv(my_connection) # With changed buffer size my_receiver = bdtp.new_receive_data_host(("127.0.0.1", 12345), 3) my_receiver.recv() ``` """ sender_object = DataReceiverHost() sender_object.address = addr if buffer_size is not None: sender_object.buffer_size = buffer_size return sender_object def new_receive_data_port(addr: tuple, buffer_size=None): """ Make a new `DataReceiverHost` object to receive data sent by sender. It is not recommended to supply `addr` if you are going to use it with existing connection. It is highly discouraged to use `buffer_size` argument as it is supposed to be kept same at both sender and receiver. You can use the returned object's `recv` method to start receiving data. Once receiving is complete. data will be stored in object's `data` attribute as bytes. ```python from denverapi import bdtp import socket # Without existing connection my_receiver = bdtp.new_receive_data_port(("127.0.0.1", 7575)) my_receiver.recv() # With existing connection my_connection = socket.socket() my_connection.connect(("127.0.0.1", 1234)) my_receiver = bdtp.new_receive_data_port() my_receiver.recv(my_connection) # With changed buffer size my_receiver = bdtp.new_receive_data_port(("127.0.0.1", 12345), 3) my_receiver.recv() ``` """ sender_object = DataReceiverPort() sender_object.address = addr if buffer_size is not None: sender_object.buffer_size = buffer_size return sender_object def attach_speed_logger(data_object) -> typing.List[int]: """ Attaches a speed logger that captures the speed of transfer for either receiver object or sender object. Returns a list that gets updated as the speed transfer continues. To get the average speed use `average_speed_log`. Example: ```python from denverapi import bdtp sender = bdtp.new_receive_data_port(b"Hello World"*10000, ("localhost", 8000)) speed_log = bdtp.attach_speed_logger(sender) sender.send() speed = bdtp.average_speed_log(speed_log) ``` """ spl = [] @thread_control.runs_parallel def sps(spl, d: _BaseSender): old = 0 new = 0 spl.append(d.buffer_size) while not d.task: time.sleep(0.01) new = d.data_send spl.append(new - old) old = new @thread_control.runs_parallel def spr(spl, d: _BaseReceiver): old = 0 new = 0 spl.append(d.buffer_size) while not d.task: time.sleep(0.01) new = d.data_recv spl.append(new - old) old = new (spr if isinstance(data_object, _BaseReceiver) else sps)(spl, data_object) return spl def launch(data_object, connected_socket=None): """ Just a simple function that starts a sender or receiver object. It is here because it looks good when using this. """ if isinstance(data_object, _BaseSender): data_object.send(connected_socket) else: data_object.recv(connected_socket) def average_speed_log(spl: list) -> int: """ Finds average speed of the connection. It strips out 0 from the end and starting of `spl` and then finds the average and returns it """ while spl[0] == 0: spl.pop(0) while spl[-1] == 0: spl.pop() return (sum(spl) / len(spl)) * 100 def main(): """ Nothing more than a test """ print("Reading Data") datats = open(input("File > "), "r+b").read() print("Read Data") print("Making Classes") sc = new_send_data_port(datats, ("127.0.0.1", 4623)) rc = new_receive_data_host(("127.0.0.1", 4623)) spl = attach_speed_logger(rc) from threading import Thread Thread(target=launch, args=(sc,)).start() rc.recv() print(len(spl)) print( f"Data Send:\n\tlen: {len(sc.data)}\nData Received:\n\tlen: {len(rc.data)}\n\tis_equal: {rc.data == sc.data}" ) print(f"Average Speed: {average_speed_log(spl)} bytes per second") if __name__ == "__main__": main()
30.575964
117
0.637867
5,600
0.415307
0
0
652
0.048354
0
0
6,550
0.485761
9b2b9f0e1320f2cd7097a2cc090fb00dcd38d4c6
1,431
py
Python
wstest/handler/current_effect_status_handler_test.py
PedalController/PedalPiREST
aa9418d44f2f5dbec604753a03bf8a74057c627c
[ "Apache-2.0" ]
null
null
null
wstest/handler/current_effect_status_handler_test.py
PedalController/PedalPiREST
aa9418d44f2f5dbec604753a03bf8a74057c627c
[ "Apache-2.0" ]
42
2016-07-04T11:17:54.000Z
2018-03-18T18:36:09.000Z
wstest/handler/current_effect_status_handler_test.py
PedalController/PedalPiREST
aa9418d44f2f5dbec604753a03bf8a74057c627c
[ "Apache-2.0" ]
null
null
null
# Copyright 2017 SrMouraSilva # # 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. from wstest.handler.handler_test import Test class CurrentEffectStatusHandlerTest(Test): def test_put(self): original_current_index = self.rest.get_current_index().json() bank = self.default_bank_mock bank.index = self.rest.create_bank(bank).json()['index'] pedalboard = bank.pedalboards[0] self.rest.set_current_pedalboard(pedalboard) effect = pedalboard.effects[0] response = self.rest.toggle_effect_current_pedalboard(effect) self.assertEqual(Test.SUCCESS, response.status_code) response = self.rest.get_pedalboard(pedalboard) effect.toggle() self.assertEqual(pedalboard.json, response.json()) self.rest.set_current_pedalboard_by_index(original_current_index['bank'], original_current_index['pedalboard']) self.rest.delete_bank(bank)
35.775
119
0.735849
806
0.563242
0
0
0
0
0
0
588
0.410901
9b2edfe2e18a8a45ebbb7dd7d27ff5218861d483
1,203
py
Python
src/sample-scripts/solved_problems/Examples test_compare/make_prop.py
hpgl/hpgl
72d8c4113c242295de740513093f5779c94ba84a
[ "BSD-3-Clause" ]
70
2015-01-21T12:24:50.000Z
2022-03-16T02:10:45.000Z
src/sample-scripts/solved_problems/Examples test_compare/make_prop.py
hpgl/hpgl
72d8c4113c242295de740513093f5779c94ba84a
[ "BSD-3-Clause" ]
8
2015-04-22T13:14:30.000Z
2021-11-23T12:16:32.000Z
src/sample-scripts/solved_problems/Examples test_compare/make_prop.py
hpgl/hpgl
72d8c4113c242295de740513093f5779c94ba84a
[ "BSD-3-Clause" ]
18
2015-02-15T18:04:31.000Z
2021-01-16T08:54:32.000Z
from geo import * from geo.routines import * from matplotlib import * from sys import * from pylab import * import os import time import pylab size = (166, 141, 20) print "loading image..." data_3D = load_ind_property("BIG_SOFT_DATA_160_141_20.INC", -99, [0,1], size) data = data_3D[0][:,:,0] mask = data_3D[1][:,:,0] figure() pylab.imshow(data[:,:], vmin = 0, vmax = 2) pylab.savefig("hard_data") #initial_data = copy(data) # test with 98% of harddata #n = 0.995 # for i in xrange(size[0]): # for j in xrange(size[1]): # value = numpy.random.uniform() # if (value < n): # mask[i,j] = 0 # data[i,j] = -99 # initial_data[i,j] = -99 # for i in xrange(size[0]): # for j in xrange(size[1]): # if (mask[i,j] <> 0): # if (initial_data[i,j] <> -99): # initial_data[i,j] = float32(numpy.random.normal(4.0, 1.0)) # for i in xrange(size[0]): # for j in xrange(size[1]): # if (initial_data[i,j] <> -99): # initial_data[i,j] = abs(initial_data[i,j,0]) / initial_data.max() prop = (data, mask, 2) write_property(prop, "IND_data.INC", "Ind_data", -99) # write_property((initial_data, mask), "CONT_data.INC", "Cont_data", -99)
24.06
78
0.60266
0
0
0
0
0
0
0
0
720
0.598504
9b34dab60e953e0b05289a4632892770d19cd60e
533
py
Python
ex039/exercicio039.py
ArthurAlesi/Python-Exercicios-CursoEmVideo
ed0f0086ddbc0092df9d16ec2d8fdbabcb480cdd
[ "MIT" ]
null
null
null
ex039/exercicio039.py
ArthurAlesi/Python-Exercicios-CursoEmVideo
ed0f0086ddbc0092df9d16ec2d8fdbabcb480cdd
[ "MIT" ]
null
null
null
ex039/exercicio039.py
ArthurAlesi/Python-Exercicios-CursoEmVideo
ed0f0086ddbc0092df9d16ec2d8fdbabcb480cdd
[ "MIT" ]
null
null
null
# faça um programa q leia o ano de nascimento de um jovem e informe de # acordo com sua idade se ele ainda vai se alistar ao serviço miliar, # se é a hora de se alistar ou se ja passsou do tempo do alistamento from datetime import date hoje = date.today().year print(hoje) nascimento = int(input("Diga o ano que voce nasceu")) idade = hoje - nascimento if idade == 18: print("Esta na hora de voce se alistar") elif idade < 18: print("Voce ainda vai ter q se alistar") else: print("Ja passou da hora de voce se alistar")
33.3125
70
0.72045
0
0
0
0
0
0
0
0
342
0.63806
9b374ff2739d4dbdac37bc7c8c986c366e319b95
1,250
py
Python
dmsl-runner/main.py
GloomyGhost-MosquitoSeal/DmslRunner
b541c27f9a9857012b465e153b5de827a8db4b29
[ "Apache-2.0" ]
null
null
null
dmsl-runner/main.py
GloomyGhost-MosquitoSeal/DmslRunner
b541c27f9a9857012b465e153b5de827a8db4b29
[ "Apache-2.0" ]
null
null
null
dmsl-runner/main.py
GloomyGhost-MosquitoSeal/DmslRunner
b541c27f9a9857012b465e153b5de827a8db4b29
[ "Apache-2.0" ]
null
null
null
import os import sys import json import time import base64 import subprocess DEBUG = 0 def json_paser(injson): injson = str.encode(injson) injson = base64.b64decode(injson) jsonin = json.loads(injson) if jsonin["language"] == "dmsl": code = jsonin["code"] code = bytes.decode(base64.b64decode(code)) if DEBUG == 1: print(code) return code else: print("json error") def dmsl_runner(code): temp = str(time.time()).replace(".", "a")[0: 13] os.mkdir("/tmp/" + temp) path = "/tmp/" + temp f = open(path + "/demo.dmsl", "w+") f.write(code) f.close() run_path = "cd " + path + " && DmslRunner demo.dmsl" try: outstd = subprocess.Popen(run_path, shell=True, stdout=subprocess.PIPE) outstd.wait() if DEBUG == 1: print(path) print(run_path) print(outstd) out = outstd.stdout.read() out = bytes.decode(out) except: out = "你的dmsl代码错误啦,回去重新学!" return out if __name__ == "__main__": if len(sys.argv) < 2: print("Arg Error") else: instr = sys.argv[1] sta1 = json_paser(instr) sta2 = dmsl_runner(sta1) print(sta2)
22.321429
79
0.5576
0
0
0
0
0
0
0
0
170
0.13302
9b37765b1ebe35daf9d92813e7199c416682ab3a
1,313
py
Python
modules/investigate/investigate.py
geekpy03/pgn-tactics-generator
a0509ec412b7163526aba3d29220b87d9cf7f688
[ "MIT" ]
68
2018-09-09T17:55:30.000Z
2022-03-28T17:04:43.000Z
modules/investigate/investigate.py
geekpy03/pgn-tactics-generator
a0509ec412b7163526aba3d29220b87d9cf7f688
[ "MIT" ]
31
2018-09-07T19:32:27.000Z
2022-01-25T13:25:29.000Z
modules/investigate/investigate.py
geekpy03/pgn-tactics-generator
a0509ec412b7163526aba3d29220b87d9cf7f688
[ "MIT" ]
20
2019-03-11T09:52:14.000Z
2022-02-23T05:37:31.000Z
import chess from chess import Board from chess.engine import Score def sign(a): return (a > 0) - (a < 0) def material_value(board): return sum(v * (len(board.pieces(pt, True)) + len(board.pieces(pt, False))) for v, pt in zip([0, 3, 3, 5.5, 9], chess.PIECE_TYPES)) def material_count(board): return chess.popcount(board.occupied) def investigate(a: Score, b: Score, board: Board): """ determine if the difference between position A and B is worth investigating for a puzzle. """ a_cp, a_mate = a.score(), a.mate() b_cp, b_mate = b.score(), b.mate() if a_cp is not None and b_cp is not None: if (((-110 < a_cp < 850 and 200 < b_cp < 850) or (-850 < a_cp < 110 and -200 > b_cp > -850)) and material_value(board) > 3 and material_count(board) > 6): return True elif a_cp is not None and b_mate is not None and material_value(board) > 3: if (a_cp < 110 and sign(b_mate) == -1) or (a_cp > -110 and sign(b_mate) == 1): # from an even position, walking int a checkmate return True elif a_mate is not None and b_mate is not None: if sign(a_mate) == sign(b_mate): # actually means that they're opposite return True return False
32.02439
92
0.599391
0
0
0
0
0
0
0
0
195
0.148515
9b37f557e5299f598ed6cf66a7877c41c10b6ac2
3,212
py
Python
src/endtype_controller/__init__.py
CadworkMontreal/CwAPI3D
5a2c15ad9f334d6dbfa55d59b6a855ac5667f289
[ "MIT" ]
null
null
null
src/endtype_controller/__init__.py
CadworkMontreal/CwAPI3D
5a2c15ad9f334d6dbfa55d59b6a855ac5667f289
[ "MIT" ]
null
null
null
src/endtype_controller/__init__.py
CadworkMontreal/CwAPI3D
5a2c15ad9f334d6dbfa55d59b6a855ac5667f289
[ "MIT" ]
null
null
null
from typing import List def create_new_endtype(endtype_name: str, endtype_id: int, folder_name: str) -> int: """Create a new endtype Args: endtype_name (str): name endtype_id (int): endtype id folder_name (str): folder name Returns: int: endtype id """ def get_endtype_id(name: str) -> int: """Gets the endtypeID by endtypename Args: name (str): endtype name Returns: int: endtype id """ def get_endtype_id_end(element_id: int) -> int: """Gets the endtypeID of the end face Args: arg0 (int): elmement ID Returns: int: endtype id """ def get_endtype_id_facet(element: int, face_number: int) -> int: """Gets the endtypeID of the face with a number Args: element (int): element ID face_number (int): face number Returns: int: endtype id """ def get_endtype_id_start(element: int) -> int: """Gets the endtypeID of the start face Args: element (int): element ID Returns: int: endtype id """ def get_endtype_name(endtype_id: int) -> str: """Get endtype name Args: endtype_id (int): endtype ID Returns: str: endtype name """ def get_endtype_name_end(element: int) -> str: """Get endtype name end Args: endtype_id (int): endtype ID Returns: str: endtype name """ def get_endtype_name_facet(element: int, face_number: int) -> str: """Gets the endtypename of the face with a number Args: element (int): element ID face_number (int): face number Returns: str: endtype name facet """ def get_endtype_name_start(element: int) -> str: """Gets the endtypename of the start face Args: element (int): element ID Returns: str: endtype name start """ def set_endtype_id_end(element: int, endtype_id: int) -> None: """Sets the endtype to end face by endtypeID Args: element (int): element ID endtype_id (int): endtype ID """ def set_endtype_id_facet(element: int, endtype_id: int, face_number: int) -> None: """Sets the endtype to a face by endtypeID Args: element (int): element ID endtype_id (int): endtype ID face_number (int): face number """ def set_endtype_id_start(element: int, endtype_id: int) -> None: """Sets the endtype to start face by endtypeID Args: element (int): element ID endtype_id (int): endtype ID """ def set_endtype_name_end(element: int, face_number: str) -> None: """Sets the endtype to end face by endtypename Args: element (int): element ID face_number (str): face number """ def set_endtype_name_facet(element: int, name: str, face_number: int) -> None: """Sets the endtype to a face by endtypename Args: element (int): element ID name (str): name face_number (int): face number """ def set_endtype_name_start(element: int, face_number: str) -> None: """Sets the endtype to start face by endtypename Args: element (int): element ID face_number (str): face number """
23.970149
84
0.615816
0
0
0
0
0
0
0
0
2,190
0.681818
9b38e1564807028d56e7217b8ffcc8fe5b8fefc8
399
py
Python
Task2G.py
JoeBarney1/floodlevelmonitor131
98d93ca3d5bf6d1f2f105529d2f758450f791188
[ "MIT" ]
1
2022-01-23T19:30:19.000Z
2022-01-23T19:30:19.000Z
Task2G.py
JoeBarney1/floodlevelmonitor131
98d93ca3d5bf6d1f2f105529d2f758450f791188
[ "MIT" ]
null
null
null
Task2G.py
JoeBarney1/floodlevelmonitor131
98d93ca3d5bf6d1f2f105529d2f758450f791188
[ "MIT" ]
null
null
null
from floodsystem.flood import highest_risk from floodsystem.stationdata import build_station_list def run(): """Requirements for Task 2G""" stations= build_station_list() for s in highest_risk(stations,dt=3,N=10,y=3): print(s) #works with whole list but takes v. long time if __name__ == "__main__": print("*** Task 2G: CUED Part IA Flood Warning System ***") run()
30.692308
63
0.691729
0
0
0
0
0
0
0
0
137
0.343358
9b39ad17854b7e4901af7b84394b158a0378ff8a
621
py
Python
testing/framework/factory/compare_utility.py
gigabackup/gigantum-client
70fe6b39b87b1c56351f2b4c551b6f1693813e4f
[ "MIT" ]
60
2018-09-26T15:46:00.000Z
2021-10-10T02:37:14.000Z
testing/framework/factory/compare_utility.py
gigabackup/gigantum-client
70fe6b39b87b1c56351f2b4c551b6f1693813e4f
[ "MIT" ]
1,706
2018-09-26T16:11:22.000Z
2021-08-20T13:37:59.000Z
testing/framework/factory/compare_utility.py
griffinmilsap/gigantum-client
70fe6b39b87b1c56351f2b4c551b6f1693813e4f
[ "MIT" ]
11
2019-03-14T13:23:51.000Z
2022-01-25T01:29:16.000Z
class CompareUtility(object): """Compares the text with the passed argument""" def compare_text(self, *args): return self.get_text() == args[0] def check_element(self, *args): """Check for an element by it's class name""" try: element = self.find_element_by_xpath(args[0]) if element: return True else: return False except: pass def check_contains_text(self, *args): """Check whether the text is present in the element""" return True if args[0] in self.get_text() else False
31.05
62
0.573269
620
0.99839
0
0
0
0
0
0
147
0.236715
9b3a30a350d4766ec5248befbf7cb18770423342
10,867
py
Python
molsysmt/forms/viewers/api_nglview_NGLWidget.py
uibcdf/MolSysMT
9866a6fb090df9fff36af113a45164da4b674c09
[ "MIT" ]
3
2020-06-02T03:55:52.000Z
2022-03-21T04:43:52.000Z
molsysmt/forms/viewers/api_nglview_NGLWidget.py
uibcdf/MolSysMT
9866a6fb090df9fff36af113a45164da4b674c09
[ "MIT" ]
28
2020-06-24T00:55:53.000Z
2021-07-16T22:09:19.000Z
molsysmt/forms/viewers/api_nglview_NGLWidget.py
uibcdf/MolSysMT
9866a6fb090df9fff36af113a45164da4b674c09
[ "MIT" ]
1
2021-06-17T18:55:25.000Z
2021-06-17T18:55:25.000Z
from molsysmt._private_tools.exceptions import * from molsysmt.forms.common_gets import * import numpy as np from nglview import widget as _nglview_widget import importlib import sys from molsysmt.molecular_system import molecular_system_components form_name='nglview.NGLWidget' is_form = { _nglview_widget.NGLWidget: form_name } info=["NGLView visualization native object","http://nglviewer.org/nglview/latest/_modules/nglview/widget.html"] has = molecular_system_components.copy() for ii in ['elements', 'coordinates', 'box']: has[ii]=True def to_openmm_PDBFile(item, molecular_system=None, atom_indices='all', frame_indices='all'): from io import StringIO from simtk.openmm.app import PDBFile try: structure_string = item.component_0.get_structure_string() except: structure_string = item.get_state()['_ngl_msg_archive'][0]['args'][0]['data'] str_as_file = StringIO(structure_string) tmp_item = PDBFile(str_as_file) str_as_file.close() del(str_as_file) if molecular_system is not None: tmp_molecular_system = molecular_system.combine_with_items(tmp_item) else: tmp_molecular_system = None return tmp_item, tmp_molecular_system def to_molsysmt_Topology(item, molecular_system=None, atom_indices='all', frame_indices='all'): from molsysmt.native.io.topology.viewers import from_nglview_NGLWidget as nglview_NGLWidget_to_molsysmt_Topology tmp_item, tmp_molecular_system = nglview_NGLWidget_to_molsysmt_Topology(item, molecular_system=molecular_system, atom_indices=atom_indices, frame_indices='all') return tmp_item, tmp_molecular_system def to_nglview_NGLWidget(item, molecular_system=None, atom_indices='all', frame_indices='all', copy_if_all=True): tmp_molecular_system = None if (atom_indices is 'all') and (frame_indices is 'all'): if copy_if_all: tmp_item = extract_item(item) if tmp_molecular_system is not None: tmp_molecular_system = molecular_system.combine_with_items(tmp_item) else: tmp_item = item if tmp_molecular_system is not None: tmp_molecular_system = molecular_system else: tmp_item = extract_item(item, atom_indices=atom_indices, frame_indices=frame_indices) if tmp_molecular_system is not None: tmp_molecular_system = molecular_system.combine_with_items(tmp_item, atom_indices=atom_indices, frame_indices=frame_indices) return tmp_item, tmp_molecular_system def extract_item(item, atom_indices='all', frame_indices='all'): if (atom_indices is 'all') and (frame_indices is 'all'): raise NotImplementedError() else: raise NotImplementedError() return tmp_item def add(item, from_item, atom_indices='all', frame_indices='all'): raise NotImplementedError def append_frames(item, step=None, time=None, coordinates=None, box=None): raise NotImplementedError ###### Get def aux_get(item, indices='all', frame_indices='all'): from molsysmt.forms import forms method_name = sys._getframe(1).f_code.co_name if 'openmm.PDBFile' in forms: tmp_item, _ = to_openmm_PDBFile(item) module = importlib.import_module('molsysmt.forms.classes.api_openmm_PDBFile') _get = getattr(module, method_name) output = _get(tmp_item, indices=indices, frame_indices=frame_indices) else: raise NotImplementedError return output ## Atom def get_atom_index_from_atom(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_atom_id_from_atom(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_atom_name_from_atom(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_atom_type_from_atom(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_group_index_from_atom (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_component_index_from_atom (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_chain_index_from_atom (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_molecule_index_from_atom (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_entity_index_from_atom (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_inner_bonded_atoms_from_atom (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_n_inner_bonds_from_atom (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_coordinates_from_atom(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_frame_from_atom(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) ## group def get_group_id_from_group(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_group_name_from_group(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_group_type_from_group(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) ## component def get_component_id_from_component (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_component_name_from_component (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_component_type_from_component (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) ## molecule def get_molecule_id_from_molecule (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_molecule_name_from_molecule (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_molecule_type_from_molecule (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) ## chain def get_chain_id_from_chain (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_chain_name_from_chain (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_chain_type_from_chain (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) ## entity def get_entity_id_from_entity (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_entity_name_from_entity (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_entity_type_from_entity (item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) ## system def get_n_atoms_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_n_groups_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_n_components_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_n_chains_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_n_molecules_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_n_entities_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_n_bonds_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_coordinates_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_box_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_box_shape_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_box_lengths_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_box_angles_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_box_volume_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_time_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_step_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_n_frames_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_bonded_atoms_from_system(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) ## bond def get_bond_order_from_bond(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_bond_type_from_bond(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) def get_atom_index_from_bond(item, indices='all', frame_indices='all'): return aux_get(item, indices=indices, frame_indices=frame_indices) ###### Set def set_box_to_system(item, indices='all', frame_indices='all', value=None): raise NotImplementedError def set_coordinates_to_system(item, indices='all', frame_indices='all', value=None): raise NotImplementedError
33.334356
164
0.767829
0
0
0
0
0
0
0
0
915
0.0842
9b3e5ba25f6539f2d54fc3ee309eb76f77501061
1,435
py
Python
editor/plugins/example_app_keys.py
albertvisser/hotkeys
73b2b10af326a37e4ae01294f44cd855ccb3ab99
[ "MIT" ]
1
2019-11-03T08:28:59.000Z
2019-11-03T08:28:59.000Z
editor/plugins/example_app_keys.py
albertvisser/hotkeys
73b2b10af326a37e4ae01294f44cd855ccb3ab99
[ "MIT" ]
null
null
null
editor/plugins/example_app_keys.py
albertvisser/hotkeys
73b2b10af326a37e4ae01294f44cd855ccb3ab99
[ "MIT" ]
null
null
null
"""Hotkeys plugin example this module contains the general, non gui-toolkit specific part of the code """ # uncomment these where appropriate # import collections # from example_app_keys_gui import layout_extra_fields_* # om dit beschikbaar te maken voor import # uncomment this to define a routine to (re)build the csv file from source data # showinfo is a switch for in case you want to show instructions # otherstuff can be used to pass on things like a list of possible commands # to method add_extra_attributes # ** corresponds to the RebuildCSV setting ** # def buildcsv(parent, showinfo=True): # shortcuts = collections.defaultdict() # otherstuff = {} # ...implement some logic here... # return shortcuts, otherstuff # uncomment these to define routines to be used by methods of a HotKeyPanel instance # ** corresponds to the ShowDetails setting ** # win is a reference to the HotKeyPanel instance # def add_extra_attributes(win): # """add attributes specific to this plugin # e.g a shorter name for a collection read from buildcsv's otherstuff # some of these are needed when filling fields in the details part of the screen # """ # win.contextslist = win.otherstuff['...'] # win.commandslist = win.otherstuff['...'] # uncomment this to define a routine to write back the keydefs to the source data # ** corresponds to the RedefineKeys setting ** # def savekeys(parent): # pass
41
99
0.738676
0
0
0
0
0
0
0
0
1,404
0.978397
9b40ad333c949a389ee209ebc469efbe2a1da3d3
8,525
py
Python
electrumx/lib/script.py
Electrum-RVN-SIG/electrumx-ravencoin
6b888a9246257037c95cdaffcce3386181050398
[ "MIT" ]
11
2021-04-03T21:29:44.000Z
2022-03-28T09:37:34.000Z
electrumx/lib/script.py
Electrum-RVN-SIG/electrumx-ravencoin
6b888a9246257037c95cdaffcce3386181050398
[ "MIT" ]
4
2021-05-14T13:10:01.000Z
2021-12-03T15:12:23.000Z
electrumx/lib/script.py
Electrum-RVN-SIG/electrumx-ravencoin
6b888a9246257037c95cdaffcce3386181050398
[ "MIT" ]
4
2021-04-05T22:07:06.000Z
2021-09-23T08:04:48.000Z
# Copyright (c) 2016-2017, Neil Booth # # All rights reserved. # # The MIT License (MIT) # # 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. # and warranty status of this software. '''Script-related classes and functions.''' import struct from enum import IntEnum from electrumx.lib.util import unpack_le_uint16_from, unpack_le_uint32_from, \ pack_le_uint16, pack_le_uint32 class ScriptError(Exception): '''Exception used for script errors.''' class OpCodes(IntEnum): # push value OP_0 = 0x00 OP_FALSE = OP_0 OP_PUSHDATA1 = 0x4c OP_PUSHDATA2 = 0x4d OP_PUSHDATA4 = 0x4e OP_1NEGATE = 0x4f OP_RESERVED = 0x50 OP_1 = 0x51 OP_TRUE = OP_1 OP_2 = 0x52 OP_3 = 0x53 OP_4 = 0x54 OP_5 = 0x55 OP_6 = 0x56 OP_7 = 0x57 OP_8 = 0x58 OP_9 = 0x59 OP_10 = 0x5a OP_11 = 0x5b OP_12 = 0x5c OP_13 = 0x5d OP_14 = 0x5e OP_15 = 0x5f OP_16 = 0x60 # control OP_NOP = 0x61 OP_VER = 0x62 OP_IF = 0x63 OP_NOTIF = 0x64 OP_VERIF = 0x65 OP_VERNOTIF = 0x66 OP_ELSE = 0x67 OP_ENDIF = 0x68 OP_VERIFY = 0x69 OP_RETURN = 0x6a # stack ops OP_TOALTSTACK = 0x6b OP_FROMALTSTACK = 0x6c OP_2DROP = 0x6d OP_2DUP = 0x6e OP_3DUP = 0x6f OP_2OVER = 0x70 OP_2ROT = 0x71 OP_2SWAP = 0x72 OP_IFDUP = 0x73 OP_DEPTH = 0x74 OP_DROP = 0x75 OP_DUP = 0x76 OP_NIP = 0x77 OP_OVER = 0x78 OP_PICK = 0x79 OP_ROLL = 0x7a OP_ROT = 0x7b OP_SWAP = 0x7c OP_TUCK = 0x7d # splice ops OP_CAT = 0x7e OP_SUBSTR = 0x7f OP_LEFT = 0x80 OP_RIGHT = 0x81 OP_SIZE = 0x82 # bit logic OP_INVERT = 0x83 OP_AND = 0x84 OP_OR = 0x85 OP_XOR = 0x86 OP_EQUAL = 0x87 OP_EQUALVERIFY = 0x88 OP_RESERVED1 = 0x89 OP_RESERVED2 = 0x8a # numeric OP_1ADD = 0x8b OP_1SUB = 0x8c OP_2MUL = 0x8d OP_2DIV = 0x8e OP_NEGATE = 0x8f OP_ABS = 0x90 OP_NOT = 0x91 OP_0NOTEQUAL = 0x92 OP_ADD = 0x93 OP_SUB = 0x94 OP_MUL = 0x95 OP_DIV = 0x96 OP_MOD = 0x97 OP_LSHIFT = 0x98 OP_RSHIFT = 0x99 OP_BOOLAND = 0x9a OP_BOOLOR = 0x9b OP_NUMEQUAL = 0x9c OP_NUMEQUALVERIFY = 0x9d OP_NUMNOTEQUAL = 0x9e OP_LESSTHAN = 0x9f OP_GREATERTHAN = 0xa0 OP_LESSTHANOREQUAL = 0xa1 OP_GREATERTHANOREQUAL = 0xa2 OP_MIN = 0xa3 OP_MAX = 0xa4 OP_WITHIN = 0xa5 # crypto OP_RIPEMD160 = 0xa6 OP_SHA1 = 0xa7 OP_SHA256 = 0xa8 OP_HASH160 = 0xa9 OP_HASH256 = 0xaa OP_CODESEPARATOR = 0xab OP_CHECKSIG = 0xac OP_CHECKSIGVERIFY = 0xad OP_CHECKMULTISIG = 0xae OP_CHECKMULTISIGVERIFY = 0xaf # expansion OP_NOP1 = 0xb0 OP_CHECKLOCKTIMEVERIFY = 0xb1 OP_NOP2 = OP_CHECKLOCKTIMEVERIFY OP_CHECKSEQUENCEVERIFY = 0xb2 OP_NOP3 = OP_CHECKSEQUENCEVERIFY OP_NOP4 = 0xb3 OP_NOP5 = 0xb4 OP_NOP6 = 0xb5 OP_NOP7 = 0xb6 OP_NOP8 = 0xb7 OP_NOP9 = 0xb8 OP_NOP10 = 0xb9 OP_INVALIDOPCODE = 0xff # Ravencoin OP_RVN_ASSET = 0xc0 def hex(self) -> str: return bytes([self]).hex() # Paranoia to make it hard to create bad scripts assert OpCodes.OP_DUP == 0x76 assert OpCodes.OP_HASH160 == 0xa9 assert OpCodes.OP_EQUAL == 0x87 assert OpCodes.OP_EQUALVERIFY == 0x88 assert OpCodes.OP_CHECKSIG == 0xac assert OpCodes.OP_CHECKMULTISIG == 0xae def is_unspendable_legacy(script): # OP_FALSE OP_RETURN or OP_RETURN #return len(script) == 0 or return script[:2] == b'\x00\x6a' or (script and script[0] == 0x6a) def is_unspendable_genesis(script): # OP_FALSE OP_RETURN #len(script) == 0 or return script[:2] == b'\x00\x6a' def _match_ops(ops, pattern): if len(ops) != len(pattern): return False for op, pop in zip(ops, pattern): if pop != op: # -1 means 'data push', whose op is an (op, data) tuple if pop == -1 and isinstance(op, tuple): continue return False return True class ScriptPubKey(object): '''A class for handling a tx output script that gives conditions necessary for spending. ''' TO_ADDRESS_OPS = [OpCodes.OP_DUP, OpCodes.OP_HASH160, -1, OpCodes.OP_EQUALVERIFY, OpCodes.OP_CHECKSIG] TO_P2SH_OPS = [OpCodes.OP_HASH160, -1, OpCodes.OP_EQUAL] TO_PUBKEY_OPS = [-1, OpCodes.OP_CHECKSIG] @classmethod def P2SH_script(cls, hash160): return (bytes([OpCodes.OP_HASH160]) + Script.push_data(hash160) + bytes([OpCodes.OP_EQUAL])) @classmethod def P2PKH_script(cls, hash160): return (bytes([OpCodes.OP_DUP, OpCodes.OP_HASH160]) + Script.push_data(hash160) + bytes([OpCodes.OP_EQUALVERIFY, OpCodes.OP_CHECKSIG])) class Script(object): @classmethod def get_ops(cls, script): ''' Returns a tuple list of (op_code, index of next op in script, pushed bytes if any) If at any point the script fails do decode, a tuple of (-1, len(script), remaining script) is appended ''' ops = [] # The unpacks or script[n] n = 0 try: while n < len(script): op = script[n] op_v = (script[n], n+1) n += 1 if op <= OpCodes.OP_PUSHDATA4: # Raw bytes follow if op < OpCodes.OP_PUSHDATA1: dlen = op n1 = 0 elif op == OpCodes.OP_PUSHDATA1: dlen = script[n] n1 = 1 elif op == OpCodes.OP_PUSHDATA2: dlen, = unpack_le_uint16_from(script[n: n + 2]) n1 = 2 else: dlen, = unpack_le_uint32_from(script[n: n + 4]) n1 = 4 if n + n1 + dlen > len(script): raise IndexError n += n1 op_v = (op, n+dlen, script[n:n + dlen]) n += dlen ops.append(op_v) except (IndexError, struct.error): # n - 1 because we read a byte first ops.append((-1, len(script), script[n-1:])) return ops @classmethod def push_data(cls, data): '''Returns the opcodes to push the data on the stack.''' assert isinstance(data, (bytes, bytearray)) n = len(data) if n < OpCodes.OP_PUSHDATA1: return bytes([n]) + data if n < 256: return bytes([OpCodes.OP_PUSHDATA1, n]) + data if n < 65536: return bytes([OpCodes.OP_PUSHDATA2]) + pack_le_uint16(n) + data return bytes([OpCodes.OP_PUSHDATA4]) + pack_le_uint32(n) + data @classmethod def opcode_name(cls, opcode): if OpCodes.OP_0 < opcode < OpCodes.OP_PUSHDATA1: return 'OP_{:d}'.format(opcode) try: return OpCodes.whatis(opcode) except KeyError: return 'OP_UNKNOWN:{:d}'.format(opcode) @classmethod def dump(cls, script): opcodes, datas = cls.get_ops(script) for opcode, data in zip(opcodes, datas): name = cls.opcode_name(opcode) if data is None: print(name) else: print('{} {} ({:d} bytes)' .format(name, data.hex(), len(data)))
26.892744
110
0.598827
6,229
0.730674
0
0
3,044
0.357067
0
0
2,066
0.242346
9b4525dbfb8005b0d75af097477692fce19cafdb
3,854
py
Python
main.py
poplock1/Number_guesser
2766d73e0f1babc980865de8fabe2f37d9ee43a6
[ "MIT" ]
null
null
null
main.py
poplock1/Number_guesser
2766d73e0f1babc980865de8fabe2f37d9ee43a6
[ "MIT" ]
null
null
null
main.py
poplock1/Number_guesser
2766d73e0f1babc980865de8fabe2f37d9ee43a6
[ "MIT" ]
null
null
null
import pygame import tensorflow as tf import sys import settings as stg import matplotlib.pyplot as plt from board import Grid import gui import numpy as np class Game(): def __init__(self): pygame.init() self.game_display = pygame.display.set_mode( (stg.display_x, stg.display_y)) pygame.display.set_caption(stg.display_title) self.tf_model = tf.keras.models.load_model('num_reader.model') self.running = True self.guessing = False self.drawing = True self.clock = pygame.time.Clock() self.click = False self.prediction_text = None def new_board(self): if self.running: self.guessing = False self.drawing = True self.board = Grid() def new_guess(self): self.info_text1 = gui.TextWindow( stg.text3_x, stg.text3_y, stg.text3_w, stg.text3_h, stg.text3_text_color, stg.text3_text, stg.text3_font) self.info_text2 = gui.TextWindow( stg.text4_x, stg.text4_y, stg.text4_w, stg.text4_h, stg.text4_text_color, stg.text4_text, stg.text4_font) while self.running: self.new_board() self.run() def run(self): self.playing = True while self.playing: self.clock.tick(60) self.events() self.update() self.draw() def events(self): for event in pygame.event.get(): if event.type == pygame.QUIT: self.playing = False self.running = False pygame.quit() sys.exit() if event.type == pygame.MOUSEBUTTONDOWN: self.click = True if event.type == pygame.MOUSEBUTTONUP: self.click = False self.mouse_pos = pygame.mouse.get_pos() self.keys = pygame.key.get_pressed() if self.keys[pygame.K_ESCAPE]: self.playing = False self.running = False pygame.quit() sys.exit() if self.keys[pygame.K_SPACE]: self.drawing = False self.guessing = True if self.keys[pygame.K_c]: self.new_board() def update(self): if self.drawing: if self.click: self.board.update() elif self.guessing: self.guess() def draw(self): self.game_display.fill(stg.BG_COLOR) self.board.draw(self.game_display) if self.drawing: self.info_text1.draw(self.game_display) elif self.prediction_text: self.prediction_text.draw(self.game_display) self.info_text2.draw(self.game_display) pygame.display.update() def guess(self): # self.data = self.overwriting_data() self.data = np.reshape(self.board.grid, (-1, 28, 28)) self.predictions = self.tf_model.predict(self.data) self.prediction = (np.argmax(self.predictions[0])) self.prediction_text = gui.TextWindow(stg.text2_x, stg.text2_y, stg.text2_w, stg.text2_h, stg.text2_text_color, (f'{stg.text2_text}{self.prediction}'), stg.text2_font) self.guessing = False # def overwriting_data(self): # mnist = tf.keras.datasets.mnist # (x_train, y_train), (x_test, y_test) = mnist.load_data() # x_train = tf.keras.utils.normalize(x_train, axis=1) # x_test = tf.keras.utils.normalize(x_test, axis=1) # for row in range(28): # for col in range(28): # x_test[0][row][col] = self.board.grid[row][col] # plt.imshow(x_test[2]) # plt.show() # print(x_test[2]) # print(self.board.grid) # return x_test game = Game() while game.running: game.new_guess() pygame.quit()
31.590164
123
0.577582
3,621
0.939543
0
0
0
0
0
0
562
0.145823
9b454cd03eb2a08f7263b1381a0130bff6f74d66
825
py
Python
examples/maskrcnn_fastai.py
ramaneswaran/mantisshrimp
d30c056f1f9f26a2ce42da73cfb32d591321f426
[ "Apache-2.0" ]
null
null
null
examples/maskrcnn_fastai.py
ramaneswaran/mantisshrimp
d30c056f1f9f26a2ce42da73cfb32d591321f426
[ "Apache-2.0" ]
8
2020-06-16T18:06:42.000Z
2020-09-15T22:35:56.000Z
examples/maskrcnn_fastai.py
ramaneswaran/mantisshrimp
d30c056f1f9f26a2ce42da73cfb32d591321f426
[ "Apache-2.0" ]
null
null
null
from mantisshrimp import * from mantisshrimp.hub.pennfundan import * from mantisshrimp.engines.fastai import * import albumentations as A source = get_pennfundan_data() parser = PennFundanParser(source) splitter = RandomSplitter([0.8, 0.2]) train_records, valid_records = parser.parse(splitter) train_transforms = AlbuTransform([A.Flip()]) train_dataset = Dataset(train_records, train_records) valid_dataset = Dataset(valid_records) model = MantisMaskRCNN(num_classes=2) metric = COCOMetric(valid_records, bbox=True, mask=True) train_dataloader = model.dataloader(train_dataset, batch_size=2, num_workers=2) valid_dataloader = model.dataloader(valid_dataset, batch_size=2, num_workers=2) learn = rcnn_learner( dls=[train_dataloader, valid_dataloader], model=model, metrics=[metric] ) learn.fine_tune(3, lr=2e-4)
28.448276
79
0.796364
0
0
0
0
0
0
0
0
0
0
9b465713a6d45355da79d52e919ae9d389a96675
10,649
py
Python
setup.py
mdavezac/bempp
bc573062405bda107d1514e40b6153a8350d5ab5
[ "BSL-1.0" ]
null
null
null
setup.py
mdavezac/bempp
bc573062405bda107d1514e40b6153a8350d5ab5
[ "BSL-1.0" ]
null
null
null
setup.py
mdavezac/bempp
bc573062405bda107d1514e40b6153a8350d5ab5
[ "BSL-1.0" ]
null
null
null
from os.path import basename, dirname, join, abspath from setuptools import setup, Extension from distutils.command.build import build as dBuild from setuptools.command.install import install as dInstall from setuptools.command.build_ext import build_ext as dBuildExt from setuptools.command.bdist_egg import bdist_egg as dBuildDistEgg from setuptools.command.sdist import sdist as dSDist from setuptools.command.egg_info import egg_info as dEggInfo from distutils.dir_util import mkpath source_dir = dirname(abspath(__file__)) package_dir = join(source_dir, 'pkg_install') mkpath(package_dir) def cmake_cache_line(variable, value, type='STRING'): return "set(%s \"%s\" CACHE %s \"\")\n" % (variable, value, type) def as_preload_file(name, info): """ Python information to cmake commandline """ result = [] if len(info.get('libraries', [])): libs = ('-l' + '-l'.join(info['libraries'])).rstrip().lstrip() if len(info.get('library_dirs', [])): libdirs = ('-L' + '-L'.join(info['library_dirs'])).rstrip().lstrip() else: libdirs = "" result.append(cmake_cache_line("%s_LIBRARIES" % name, "%s %s" %(libdirs, libs))) if len(info.get('include_dirs', [])): incs = ';'.join(info['include_dirs']).rstrip().lstrip() result.append(cmake_cache_line("%s_INCLUDE_DIRS" % name, incs)) return result def cmake_executable(): """ Path to cmake executable """ from os.path import exists from os import environ from distutils.spawn import find_executable cmake = find_executable('cmake') if cmake is None and 'CASAPATH' in environ: # Tries to out-smart CASA. # Look places cmake might be that casa removes from path. directories = [ join('/', 'usr', 'local', 'bin'), join(environ['HOME'], 'bin'), join(environ['HOME'], '.local', 'bin'), join(environ['HOME'], 'usr', 'bin'), join('/', 'sw', 'bin') # -- default Fink location ] for directory in directories: if exists(join(directory, 'cmake')): cmake = join(directory, 'cmake') break if cmake is None: raise RuntimeError('Could not find cmake executable in path') return cmake class Build(dBuild): """ Build that runs cmake. """ description = "Compiles BEM++ using cmake" user_options = dBuild.user_options + [ ("external=", None, "Location for external packages") ] def initialize_options(self): self.external = None dBuild.initialize_options(self) def configure_cmdl(self, filename): """ Creates cmake command-line First puts variables into a cache file. This is safer that going through the command-line. """ from sys import executable # other args other_args = [ cmake_cache_line('PYTHON_EXECUTABLE', executable, 'PATH'), cmake_cache_line('NOEXPORT', 'TRUE', 'BOOL'), cmake_cache_line('PYPACKED', 'TRUE', 'BOOL'), ] if(self.external): other_args.extend([ cmake_cache_line('EXTERNAL_ROOT', self.external, 'PATH'), cmake_cache_line('CMAKE_PREFIX_PATH', self.external + ";" + join(self.external, 'python', 'PyTrilinos'), 'PATH' ) ]) other_args.append('\n') with open(filename, 'w') as file: file.writelines(other_args) return ['-C%s' % filename] def _configure(self, build_dir): from distutils import log from distutils.spawn import spawn from os import chdir, getcwd current_dir = getcwd() mkpath(build_dir) command_line = self.configure_cmdl(join(build_dir, 'Variables.cmake')) log.info( "CMake: configuring with variables in %s " % join(build_dir, 'Variables.cmake') ) cmake = cmake_executable() try: chdir(build_dir) spawn([cmake] + command_line + [source_dir]) finally: chdir(current_dir) def _build(self, build_dir): from distutils import log from distutils.spawn import spawn from os import chdir, getcwd log.info("CMake: building in %s" % build_dir) current_dir = getcwd() cmake = cmake_executable() try: chdir(build_dir) spawn([cmake, '--build', '.']) finally: chdir(current_dir) def run(self): from os.path import abspath build_dir = join(dirname(abspath(__file__)), self.build_base) self._configure(build_dir) self._build(build_dir) self._install(build_dir, package_dir) try: prior = getattr(self.distribution, 'running_binary', False) dBuild.run(self) finally: self.distribution.running_binary = prior def _install(self, build_dir, install_dir): from distutils import log from distutils.sysconfig import PREFIX, get_python_lib from sys import version_info from os.path import abspath, relpath from os import chdir, getcwd libtopy = relpath(get_python_lib(), PREFIX) if len(libtopy) > 2 and libtopy[:1] == '..': libtopy = join( 'lib', 'python{0.major}.{0.minor}'.format(version_info), 'site-packages' ) current_cwd = getcwd() build_dir = abspath(build_dir) cmake = cmake_executable() install_dir = abspath(install_dir) log.info("CMake: Installing package to %s" % install_dir) try: chdir(build_dir) self.spawn([cmake, '-DPYTHON_PKG_DIR=\'%s\'' % install_dir, source_dir ]) self.spawn([cmake, '--build', '.', '--target', 'install']) finally: chdir(current_cwd) self.distribution.running_binary = True class Install(dInstall): def run(self): from distutils import log from os.path import abspath from os import chdir, getcwd self.distribution.run_command('build') current_cwd = getcwd() build_dir = join(dirname(abspath(__file__)), self.build_base) cmake = cmake_executable() pkg = abspath(self.install_lib) log.info("CMake: Installing package to %s" % pkg) try: chdir(build_dir) self.spawn([cmake, '-DPYTHON_PKG_DIR=\'%s\'' % pkg, '-DPYPACKED=TRUE', '..' ]) self.spawn([cmake, '--build', '.', '--target', 'install']) finally: chdir(current_cwd) try: prior = getattr(self.distribution, 'running_binary', False) self.distribution.running_binary = True self.distribution.have_run['egg_info'] = 0 dInstall.run(self) finally: self.distribution.running_binary = prior class BuildExt(dBuildExt): def __init__(self, *args, **kwargs): dBuildExt.__init__(self, *args, **kwargs) def run(self):pass class BuildDistEgg(dBuildDistEgg): def __init__(self, *args, **kwargs): dBuildDistEgg.__init__(self, *args, **kwargs) def run(self): try: prior = getattr(self.distribution, 'running_binary', False) self.distribution.running_binary = True self.run_command('build') dBuildDistEgg.run(self) finally: self.distribution.running_binary = prior class EggInfo(dEggInfo): def __init__(self, *args, **kwargs): dEggInfo.__init__(self, *args, **kwargs) def run(self): from setuptools.command.egg_info import manifest_maker from os import listdir which_template = 'MANIFEST.source.in' dist = self.distribution old_values = dist.ext_modules, dist.ext_package, \ dist.packages, dist.package_dir if len(listdir(package_dir)) != 0 \ and getattr(self.distribution, 'running_binary', False): which_template = 'MANIFEST.binary.in' else: dist.ext_modules, dist.ext_package = None, None dist.packages, dist.package_dir = None, None try: old_template = manifest_maker.template manifest_maker.template = which_template dEggInfo.run(self) finally: manifest_maker.template = old_template dist.ext_modules, dist.ext_package = old_values[:2] dist.packages, dist.package_dir = old_values[2:] class SDist(dSDist): def __init__(self, *args, **kwargs): dSDist.__init__(self, *args, **kwargs) def run(self): dist = self.distribution try: old_values = dist.ext_modules, dist.ext_package, \ dist.packages, dist.package_dir dist.ext_modules, dist.ext_package = None, None dist.packages, dist.package_dir = None, None dSDist.run(self) finally: dist.ext_modules, dist.ext_package = old_values[:2] dist.packages, dist.package_dir = old_values[2:] setup( name = "bempp", version = "2.0", setup_requires = ['numpy', 'pytest'], install_requires = ['numpy', 'pytest'], platforms = ['GNU/Linux','Unix','Mac OS-X'], zip_safe = False, cmdclass = { 'build': Build, 'install': Install, 'build_ext': BuildExt, 'bdist_egg': BuildDistEgg, 'egg_info': EggInfo }, author = "Tim Betcke", author_email = "[email protected]", description = "BEMP does what it does well", license = "MIT", url = "https://github.com/bempp/bempp", ext_modules = [Extension('bempp._core', [])], ext_package = 'bempp', packages = ['bempp', 'PyTrilinos'], package_dir = { 'bempp': join(basename(package_dir), 'bempp'), 'PyTrilinos': join(basename(package_dir), 'PyTrilinos'), }, include_package_data=True, keywords= "mathology", classifiers = [ 'Development Status :: 0 - Beta', 'Intended Audience :: Developers', 'Intended Audience :: Science/Research', 'License :: OSI Approved :: MIT License', 'Operating System :: OS Independent', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Topic :: Scientific/Engineering', 'Topic :: Scientific/Engineering :: Mathematics', ], long_description = open(join(dirname(__file__), 'README'), 'r').read() )
35.855219
88
0.596676
6,938
0.651517
0
0
0
0
0
0
2,092
0.19645
9b465aec5248b4a295d099e00bd63dbcb0fdd474
677
py
Python
config/__init__.py
CSuppan/two-shot-brdf-shape
352201b66bfa5cd5e25111451a6583a3e7d499f0
[ "BSD-Source-Code" ]
null
null
null
config/__init__.py
CSuppan/two-shot-brdf-shape
352201b66bfa5cd5e25111451a6583a3e7d499f0
[ "BSD-Source-Code" ]
null
null
null
config/__init__.py
CSuppan/two-shot-brdf-shape
352201b66bfa5cd5e25111451a6583a3e7d499f0
[ "BSD-Source-Code" ]
null
null
null
# ----------------------------------------------------------------------- # Copyright (c) 2020, NVIDIA Corporation. All rights reserved. # # This work is made available # under the Nvidia Source Code License (1-way Commercial). # # Official Implementation of the CVPR2020 Paper # Two-shot Spatially-varying BRDF and Shape Estimation # Mark Boss, Varun Jampani, Kihwan Kim, Hendrik P. A. Lensch, Jan Kautz # ----------------------------------------------------------------------- import json import os def read_json(path): with open(path, "r") as f: data = json.load(f) return data def get_render_config(): return read_json("config/render_config.json")
28.208333
73
0.567208
0
0
0
0
0
0
0
0
499
0.737075
9b4985b49cd879340b47fb541710318c2bb259dc
26,765
py
Python
demo/rrteAutoLog.py
CharlesWangYu/guitest
785f234321143a4a3f4afe92376dc4f138489b31
[ "BSD-3-Clause" ]
null
null
null
demo/rrteAutoLog.py
CharlesWangYu/guitest
785f234321143a4a3f4afe92376dc4f138489b31
[ "BSD-3-Clause" ]
null
null
null
demo/rrteAutoLog.py
CharlesWangYu/guitest
785f234321143a4a3f4afe92376dc4f138489b31
[ "BSD-3-Clause" ]
null
null
null
import pdb import logging import os import sys import time import subprocess import xlrd import win32gui import win32api import win32con #import comtypes from configparser import ConfigParser from comtypes.client import * from ctypes import * def logTreeItem(node): logging.info('----------------------------------------------------------') logging.info('Parent\t: %s (%s)' % (node.elem.name, node.elem.ctrlType)) if node.left: logging.info('Child[0]\t: %s (%s)' % (node.left.elem.name, node.left.elem.ctrlType)) curr = node.left.right cnt = 1 while not curr is None: logging.info('Child[%d]\t: %s (%s)' % (cnt, curr.elem.name, curr.elem.ctrlType)) cnt += 1 curr = curr.right class UIA: Client = GetModule('UIAutomationCore.dll') IUIA = CreateObject('{ff48dba4-60ef-4201-aa87-54103eef594e}', interface=Client.IUIAutomation) DesktopRoot = IUIA.GetRootElement() @staticmethod def findAllElem(start, key, type, flag=Client.PropertyConditionFlags_None, scope=Client.TreeScope_Descendants): cnd = UIA.IUIA.CreatePropertyConditionEx(type, key, flag) all = start.FindAll(scope, cnd) #for x in range(0, all.Length): #element = all.GetElement(x) #logging.info('Element[%s] is searched.' % element.CurrentName) return all @staticmethod def findFirstElem(start, key, type, flag=Client.PropertyConditionFlags_None, scope=Client.TreeScope_Descendants): cnd = UIA.IUIA.CreatePropertyConditionEx(type, key, flag) element = start.FindFirst(scope, cnd) #logging.info('Element[%s] is searched.' % element.CurrentName) return element @staticmethod def findFirstElem2And(start, key1, type1, key2, type2, flag=Client.PropertyConditionFlags_None, scope=Client.TreeScope_Descendants): cnd1 = UIA.IUIA.CreatePropertyConditionEx(type1, key1, flag) cnd2 = UIA.IUIA.CreatePropertyConditionEx(type2, key2, flag) combine = UIA.IUIA.CreateAndCondition(cnd1, cnd2) element = start.FindFirst(scope, combine) #logging.info('Element[%s] is searched.' % element.CurrentName) return element @staticmethod def findAllElem2Or(start, key1, type1, key2, type2, flag=Client.PropertyConditionFlags_None, scope=Client.TreeScope_Descendants): cnd1 = UIA.IUIA.CreatePropertyConditionEx(type1, key1, flag) cnd2 = UIA.IUIA.CreatePropertyConditionEx(type2, key2, flag) combine = UIA.IUIA.CreateOrCondition(cnd1, cnd2) all = start.FindAll(scope, combine) #for x in range(0, all.Length): #element = all.GetElement(x) #logging.info('Element[%s] is searched.' % element.CurrentName) return all @staticmethod def findAllElem4Or(start, key1, key2, key3, key4, type, flag=Client.PropertyConditionFlags_None, scope=Client.TreeScope_Descendants): cnd1 = UIA.IUIA.CreatePropertyConditionEx(type, key1, flag) cnd2 = UIA.IUIA.CreatePropertyConditionEx(type, key2, flag) cnd3 = UIA.IUIA.CreatePropertyConditionEx(type, key3, flag) cnd4 = UIA.IUIA.CreatePropertyConditionEx(type, key4, flag) combine1 = UIA.IUIA.CreateOrCondition(cnd1, cnd2) combine2 = UIA.IUIA.CreateOrCondition(cnd3, cnd4) combine = UIA.IUIA.CreateOrCondition(combine1, combine2) all = start.FindAll(scope, combine) #for x in range(0, all.Length): #element = all.GetElement(x) #logging.info('Element[%s] is searched.' % element.CurrentName) return all def getParentElem(elem): walker = UIA.IUIA.ControlViewWalker parent = walker.GetParentElement(elem) return parent @staticmethod def getNextSiblingElem(elem): walker = UIA.IUIA.ControlViewWalker element = walker.GetNextSiblingElement(elem) return element @staticmethod def getPreviousSiblingElem(elem): walker = UIA.IUIA.ControlViewWalker element = walker.GetPreviousSiblingElement(elem) return element @staticmethod def getElemSubText(elem): text = UIA.findFirstElem(elem, UIA.Client.UIA_TextControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) return text.CurrentName @staticmethod def findElemBySubText(start, name, flag=Client.PropertyConditionFlags_None, scope=Client.TreeScope_Descendants): child = UIA.findFirstElem(start, name, UIA.Client.UIA_NamePropertyId) element = UIA.getParentElem(child) return element @staticmethod def isUIAElem(elem): try: temp = elem.CurrentName return True except Exception as e: return False @staticmethod def setEditbox(elem, text): assert UIA.isUIAElem(elem) pattern = elem.GetCurrentPattern(UIA.Client.UIA_ValuePatternId) ctrl = cast(pattern, POINTER(UIA.Client.IUIAutomationValuePattern)) elem.SetFocus() ctrl.SetValue(text) @staticmethod def expandTree(elem): assert UIA.isUIAElem(elem) pattern = elem.GetCurrentPattern(UIA.Client.UIA_ExpandCollapsePatternId) ctrl = cast(pattern, POINTER(UIA.Client.IUIAutomationExpandCollapsePattern)) if ctrl.value.CurrentExpandCollapseState == UIA.Client.ExpandCollapseState_Collapsed: ctrl.Select() @staticmethod def collapseTree(elem): assert UIA.isUIAElem(elem) pattern = elem.GetCurrentPattern(UIA.Client.UIA_ExpandCollapsePatternId) ctrl = cast(pattern, POINTER(UIA.Client.IUIAutomationExpandCollapsePattern)) if ctrl.value.CurrentExpandCollapseState == UIA.Client.ExpandCollapseState_Expanded: ctrl.Select() @staticmethod def isLeaf(elem): assert UIA.isUIAElem(elem) pattern = elem.GetCurrentPattern(UIA.Client.UIA_ExpandCollapsePatternId) ctrl = cast(pattern, POINTER(UIA.Client.IUIAutomationExpandCollapsePattern)) return ctrl.value.CurrentExpandCollapseState == UIA.Client.ExpandCollapseState_LeafNode @staticmethod def pushLeaf(elem): assert UIA.isUIAElem(elem) pattern1 = elem.GetCurrentPattern(UIA.Client.UIA_ExpandCollapsePatternId) ctrl1 = cast(pattern1, POINTER(UIA.Client.IUIAutomationExpandCollapsePattern)) pattern2 = elem.GetCurrentPattern(UIA.Client.UIA_SelectionItemPatternId) ctrl2 = cast(pattern2, POINTER(UIA.Client.IUIAutomationSelectionItemPattern)) if ctrl1.value.CurrentExpandCollapseState == UIA.Client.ExpandCollapseState_LeafNode: ctrl2.Select() @staticmethod def pushButton(elem): assert UIA.isUIAElem(elem) pattern = elem.GetCurrentPattern(UIA.Client.UIA_InvokePatternId) ctrl = cast(pattern, POINTER(UIA.Client.IUIAutomationInvokePattern)) ctrl.Invoke() @staticmethod def selectTab(elem): assert UIA.isUIAElem(elem) pattern = elem.GetCurrentPattern(UIA.Client.UIA_SelectionItemPatternId) ctrl = cast(pattern, POINTER(UIA.Client.IUIAutomationSelectionItemPattern)) if not ctrl.value.CurrentIsSelected: ctrl.Select() @staticmethod def selectCheckbox(elem): assert UIA.isUIAElem(elem) pattern = elem.GetCurrentPattern(UIA.Client.UIA_TogglePatternId) ctrl = cast(pattern, POINTER(UIA.Client.IUIAutomationTogglePattern)) if not ctrl.value.CurrentToggleState: ctrl.Toggle() @staticmethod def unselectCheckbox(elem): assert UIA.isUIAElem(elem) pattern = elem.GetCurrentPattern(UIA.Client.UIA_TogglePatternId) ctrl = cast(pattern, POINTER(UIA.Client.IUIAutomationTogglePattern)) if ctrl.value.CurrentToggleState: ctrl.Toggle() @staticmethod def setDirInCommonDialog(dialog, path): assert UIA.isUIAElem(dialog) #logging.info('Reference file is %s.' % path) edit = UIA.findFirstElem2And(dialog, UIA.Client.UIA_EditControlTypeId, UIA.Client.UIA_ControlTypePropertyId, 'Edit', UIA.Client.UIA_ClassNamePropertyId) assert UIA.isUIAElem(edit) okBtn = UIA.findFirstElem(dialog, '1', UIA.Client.UIA_AutomationIdPropertyId, scope=UIA.Client.TreeScope_Children) assert UIA.isUIAElem(okBtn) UIA.setEditbox(edit, path) time.sleep(1) UIA.pushButton(okBtn) time.sleep(1) class RRTE: DELAY_RRET_START = 8 DELAY_WAIT_DLG = 3 NAME_RRTE_APP = 'Reference Run-time Environment' NAME_TRACE_LEVEL = 'Microsoft.Windows.Controls.Ribbon.RibbonGallery Items.Count:1' NAME_BROWSER_MODEL = 'Fdi.Client.Catalog.DeviceCatalogBrowserModel' NAME_TOP_TAB = 'Fdi.Client.DeviceUi.ViewModel.DeviceUiHostContainerItemViewModel' NAME_X_BTN = 'X' NAME_ONLINE_PARAMS = 'OnlineParameters' NAME_OFFLINE_TAB = 'Offline root menu' NAME_ONLINE_TAB = 'Online' NAME_DEVICE_ROOT_MENU = 'Device root menu' NAME_DIAGNOSTIC_ROOT_MENU = 'Diagnostic root menu' NAME_MAINT_ROOT_MENU = 'Maintenance root menu' NAME_PROCESS_ROOT_MENU = 'Process variables root menu' NAME_HEALTH_TAB = 'Health' NAME_TREE_ROOT = 'DD_ExplorerView' NAME_APPLY_BTN = 'Apply' NAME_REVERT_BTN = 'Revert' def __init__(self): self.config = ConfigParser() self.config.read('test.conf', encoding='UTF-8') self.provider = None self.tree = None self.RRTERoot = None self.RRTECurr = None self.CurrTAB = None # layer2 self.WorkRoot = None # layer3 self.TopTAB = None # TAB for special fdi package self.TopBtnX = None # button on the right side of top TAB self.TopRoot = None # window to contain tab, menu tree, and param # layer4 self.Offline = None # offline entry self.OfflineX = None self.TABRoot = None # root TABs' parent # layer5 self.Online = None # online entry self.OnlineX = None self.Device = None # device root menu entry self.DeviceX = None self.Diagnose = None # diagnostic root menu entry self.DiagnoseX = None self.Maintena = None # maintenance root menu entry self.MaintenaX = None self.Process = None # process variable root menu entry self.ProcessX = None # layer4 self.Health = None self.Explorer = None self.TreeRoot = None # update after click root menu button self.PaneRoot = None # update after click menu or window item self.Apply = None self.Revert = None def start(self): inputMode = self.config['MISC']['TEST_FILE_TYPE'].strip("'") hostApp = self.config['MISC']['HOST_APP_PATH'].strip("'") + '\Reference Run-time Environment\Fdi.Reference.Client.exe' testFile = self.config['MISC']['TEST_FILE'].strip("'") outPath = self.config['MISC']['OUTPUT_PATH'].strip("'") logPath = self.config['MISC']['RRTE_LOG_PATH'].strip("'") execCmd = '\"' + hostApp + '\" -l \"' + testFile + '\"' #os.system(execCmd) self.provider = subprocess.Popen(execCmd, shell=True, stdout=subprocess.PIPE, close_fds=True) #self.provider = subprocess.Popen(execCmd, shell=True, stdout=subprocess.PIPE) #self.provider = subprocess.Popen(execCmd) time.sleep(RRTE.DELAY_RRET_START) logging.info('execCmd = %s' % execCmd) #print('Please tuning the window size') #pdb.set_trace() # find layer1 element self.RRTERoot = UIA.findFirstElem(UIA.DesktopRoot, RRTE.NAME_RRTE_APP, UIA.Client.UIA_NamePropertyId, scope=UIA.Client.TreeScope_Children) assert UIA.isUIAElem(self.RRTERoot) self.RRTECurr = self.RRTERoot self.getBasicElem() # create basic root menu node onlineElem = Top('Online') onlineElem.ctrlType = 'Top' processElem = Top('Process variables root menu') processElem.ctrlType = 'Top' DiagElem = Top('Diagnostic root menu') DiagElem.ctrlType = 'Top' MaintElem = Top('Maintenance root menu') MaintElem.ctrlType = 'Top' DevElem = Top('Device root menu') DevElem.ctrlType = 'Top' rootNode = TreeNode(onlineElem) processNode = TreeNode(processElem) DiagNode = TreeNode(DiagElem) MaintNode = TreeNode(MaintElem) DevNode = TreeNode(DevElem) rootNode.left = processNode processNode.right = DiagNode DiagNode.right = MaintNode MaintNode.right = DevNode rootNode.parent = None processNode.parent = rootNode DiagNode.parent = rootNode MaintNode.parent = rootNode DevNode.parent = rootNode self.tree = Tree(rootNode, rootNode) time.sleep(2) def getBasicElem(self): # find layer2 element(work area) all = UIA.findAllElem(self.RRTERoot, UIA.Client.UIA_CustomControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) self.WorkRoot = all.GetElement(all.Length-1) assert UIA.isUIAElem(self.WorkRoot) # find layer3 element self.TopTAB = UIA.findFirstElem(self.WorkRoot, RRTE.NAME_TOP_TAB, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.TopTAB) self.TopTABX = UIA.findFirstElem(self.TopTAB, RRTE.NAME_X_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.TopTABX) self.TopRoot = UIA.getNextSiblingElem(self.TopTABX) assert UIA.isUIAElem(self.TopRoot) # find layer4 element self.Offline = UIA.findElemBySubText(self.TopRoot, RRTE.NAME_OFFLINE_TAB) assert UIA.isUIAElem(self.Offline) self.OfflineX = UIA.findFirstElem(self.Offline, RRTE.NAME_X_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.OfflineX) self.TABRoot = UIA.findFirstElem(self.TopRoot, RRTE.NAME_ONLINE_PARAMS, UIA.Client.UIA_AutomationIdPropertyId) assert UIA.isUIAElem(self.TABRoot) self.Health = UIA.getNextSiblingElem(self.TABRoot) assert UIA.isUIAElem(self.Health) self.Explorer = UIA.findFirstElem(self.TopRoot, RRTE.NAME_TREE_ROOT, UIA.Client.UIA_AutomationIdPropertyId) assert UIA.isUIAElem(self.Explorer) #self.TreeRoot = UIA.getNextSiblingElem(self.Explorer) #self.PaneRoot = UIA.getNextSiblingElem(self.TreeRoot) self.Apply = UIA.findFirstElem(self.TopRoot, RRTE.NAME_APPLY_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.Apply) self.Revert = UIA.findFirstElem(self.TopRoot, RRTE.NAME_REVERT_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.Revert) # layer5 self.Online = UIA.findElemBySubText(self.TABRoot, RRTE.NAME_ONLINE_TAB) assert UIA.isUIAElem(self.Online) self.OnlineX = UIA.findFirstElem(self.Online, RRTE.NAME_X_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.OnlineX) self.Device = UIA.findElemBySubText(self.TABRoot, RRTE.NAME_DEVICE_ROOT_MENU) assert UIA.isUIAElem(self.Device) self.DeviceX = UIA.findFirstElem(self.Device, RRTE.NAME_X_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.DeviceX) self.Diagnose = UIA.findElemBySubText(self.TABRoot, RRTE.NAME_DIAGNOSTIC_ROOT_MENU) assert UIA.isUIAElem(self.Diagnose) self.DiagnoseX = UIA.findFirstElem(self.Diagnose, RRTE.NAME_X_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.DiagnoseX) self.Maintena = UIA.findElemBySubText(self.TABRoot, RRTE.NAME_MAINT_ROOT_MENU) assert UIA.isUIAElem(self.Maintena) self.MaintenaX = UIA.findFirstElem(self.Maintena, RRTE.NAME_X_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.MaintenaX) self.Process = UIA.findElemBySubText(self.TABRoot, RRTE.NAME_PROCESS_ROOT_MENU) assert UIA.isUIAElem(self.Process) self.ProcessX = UIA.findFirstElem(self.Process, RRTE.NAME_X_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.ProcessX) def createNodeTree(self, selectedNode): # can't be 'Online' item if selectedNode == None: return assert not selectedNode.elem.name == 'Online' assert isinstance(selectedNode.elem, SelectableElement) # get current node's path path = [] path.append(selectedNode) currNode = selectedNode while not currNode.parent == None: currNode = currNode.parent path.append(currNode) path.remove(self.tree.root) path.reverse() #for item in path: # logging.info(item.elem.name) # push button sequence to getting into current tree node for item in path: if isinstance(item.elem, SelectableElement): item.elem.select(self) if item.isEqual(selectedNode): item.setChildren(self) logTreeItem(item) currNode = item.left if isinstance(currNode.elem, SelectableElement): self.createNodeTree(currNode) currNode = currNode.right while not currNode == None: if isinstance(currNode.elem, SelectableElement): self.createNodeTree(currNode) currNode = currNode.right time.sleep(2) def loadPackage(self): browser = UIA.findFirstElem(self.RRTERoot, RRTE.NAME_BROWSER_MODEL, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(browser) UIA.selectTab(browser) time.sleep(2) all = UIA.findAllElem(browser, UIA.Client.UIA_CustomControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) custom = all.GetElement(all.Length-1) loadBtn = UIA.findFirstElem(custom, UIA.Client.UIA_ButtonControlTypeId, UIA.Client.UIA_ControlTypePropertyId) assert UIA.isUIAElem(loadBtn) UIA.pushButton(loadBtn) logging.info('Load FDI package') time.sleep(2) self.getBasicElem() time.sleep(1) #self.wait() def closeMenu(self): # find layer2 element(work area) all = UIA.findAllElem(self.RRTERoot, UIA.Client.UIA_CustomControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) self.WorkRoot = all.GetElement(all.Length-1) assert UIA.isUIAElem(self.WorkRoot) # find layer3 element self.TopTAB = UIA.findFirstElem(self.WorkRoot, RRTE.NAME_TOP_TAB, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.TopTAB) self.TopTABX = UIA.findFirstElem(self.TopTAB, RRTE.NAME_X_BTN, UIA.Client.UIA_NamePropertyId) assert UIA.isUIAElem(self.TopTABX) UIA.pushButton(self.TopTABX) logging.info('Close Menu') time.sleep(4) #self.wait() def close(self): ''' titleBar = UIA.findFirstElem(self.RRTERoot, UIA.Client.UIA_TitleBarControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) pdb.set_trace() assert UIA.isUIAElem(titleBar) closeBtn = UIA.findFirstElem(titleBar, 'Close', UIA.Client.UIA_AutomationIdPropertyId, scope=UIA.Client.TreeScope_Children) assert UIA.isUIAElem(closeBtn) UIA.pushButton(closeBtn) ''' hwnd = win32gui.FindWindow(None, RRTE.NAME_RRTE_APP) win32gui.SetForegroundWindow(hwnd) win32api.keybd_event(win32con.VK_MENU, 0, 0, 0) win32api.keybd_event(win32con.VK_F4, 0, 0, 0) win32api.keybd_event(win32con.VK_F4, 0, win32con.KEYEVENTF_KEYUP, 0) win32api.keybd_event(win32con.VK_MENU, 0, win32con.KEYEVENTF_KEYUP, 0) time.sleep(4) #self.provider.terminate() #time.sleep(4) logging.info('Close RRTE') def setTraceLevel(self, level): item = UIA.findFirstElem2And(self.RRTERoot, level, UIA.Client.UIA_NamePropertyId, UIA.Client.UIA_ListItemControlTypeId, UIA.Client.UIA_ControlTypePropertyId) assert UIA.isUIAElem(item) UIA.selectTab(item) time.sleep(3) logging.info('Set trace level') def clearRegistLog(self): logPath = self.config['MISC']['RRTE_LOG_PATH'].strip("'") os.system('del /F /S /Q ' + logPath + '\DMS.log') os.system('del /F /S /Q ' + logPath + '\FdiContainer.log') os.system('del /F /S /Q ' + logPath + '\HARTModemDriver.log') os.system('del /F /S /Q ' + logPath + '\ReferenceHost.log') os.system('del /F /S /Q ' + logPath + '\Trace.log') time.sleep(1) logging.info('Clear register log files') def clearOutput(self): outPath = self.config['MISC']['OUTPUT_PATH'].strip("'") outPath += '\\rrte' execCmd = 'rmdir /S /Q "' + outPath + '"' os.system(execCmd) time.sleep(2) execCmd = 'mkdir "' + outPath + '"' os.system(execCmd) time.sleep(2) logging.info('Clear already existing output log files') def traversal(self, targetNode): if not targetNode is None: if isinstance(targetNode.elem, Window): # TODO: Page self.createRegistLog(targetNode) self.traversal(targetNode.left) self.traversal(targetNode.right) def createRegistLog(self, node): assert not node.elem.name == 'Online' assert isinstance(node.elem, Window) outPath = self.config['MISC']['OUTPUT_PATH'].strip("'") logPath = self.config['MISC']['RRTE_LOG_PATH'].strip("'") # get path path = [] path.append(node) currNode = node while not currNode.parent == None: currNode = currNode.parent path.append(currNode) path.remove(path[len(path)-1]) path.reverse() # start RRTE and go into target window item #self.start() self.loadPackage() self.setTraceLevel('Information') # Verbose pathName = outPath + '\\rrte' for item in path: item.elem.select(self) pathName += '\\' + item.elem.name execCmd = 'mkdir "' + pathName + '"' os.system(execCmd) time.sleep(3) # wait question mark dispear (create log) #self.close() self.closeMenu() # make folder and copy log files execCmd = 'copy "' + logPath + '\\*.*" "' + pathName + '"' os.system(execCmd) time.sleep(1) self.clearRegistLog() def wait(self, dlgFindType=UIA.Client.UIA_ControlTypePropertyId, dlgFindKey=UIA.Client.UIA_WindowControlTypeId): dialog = UIA.findFirstElem(self.RRTERoot, dlgFindKey, dlgFindType) while not UIA.isUIAElem(dialog): time.sleep(RRTE.DELAY_WAIT_DLG) dialog = UIA.findFirstElem(self.RRTERoot, dlgFindKey, dlgFindType) return dialog class TreeNode: def __init__(self, elem, parent=None, left=None, right=None): self.elem = elem self.parent = parent # It's logic parent node in tree, not in binary tree self.left = left self.right = right def setChildren(self, rrte): elems = self.elem.children(rrte) if len(elems) > 0: self.left = TreeNode(elems[0], self) currNode = self.left for x in range(1, len(elems)): currNode.right = TreeNode(elems[x], self) currNode = currNode.right def isEqual(self, ref): node1 = self node2 = ref while not (node1 == None and node2 == None): if node1.elem.name == node2.elem.name: node1 = node1.parent node2 = node2.parent else: return False return True class Tree: # It's logic tree, not control view tree in ui automation def __init__(self, root=None, curr=None): self.root = root self.curr = curr ''' def addChild(self, child, parent): # insert node under the current node if parent == None and self.root == None: self.root = child child.parent = None else: child.parent = parent if self.curr.left == None: self.curr.left = child else: currNode = self.curr.left while (not currNode.right == None): currNode = currNode.right currNode.right = child def preorderScreen(self): # traverse to page node in tree items pass ''' class Element: # abstract class def __init__(self, name): self.name = name self.ctrlType = None self.rectangle = None def children(self, rrte): pass # RRTE element class class RRTEElement(Element): # abstract class (not used in demo) pass class SelectableElement(Element): # abstract class def select(self, rrte): pass class Top(SelectableElement): def select(self, rrte): btn = UIA.findElemBySubText(rrte.TABRoot, self.name) UIA.pushButton(btn) time.sleep(4) rrte.Explorer = UIA.findFirstElem(rrte.TopRoot, RRTE.NAME_TREE_ROOT, UIA.Client.UIA_AutomationIdPropertyId) rrte.TreeRoot = UIA.getNextSiblingElem(rrte.Explorer) rrte.RRTECurr = rrte.TreeRoot def children(self, rrte): all = UIA.findAllElem(rrte.RRTECurr, UIA.Client.UIA_TreeItemControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) set = [] for x in range(0, all.Length): item = all.GetElement(x) name = UIA.getElemSubText(item) if UIA.isLeaf(item): elem = Window(name) else: elem = Menu(name) elem.ctrlType = 'TreeItem' elem.rectangle = item.CurrentBoundingRectangle set.append(elem) return set class Menu(SelectableElement): def select(self, rrte): tree = UIA.findElemBySubText(rrte.RRTECurr, self.name) UIA.expandTree(tree) time.sleep(2) rrte.Explorer = UIA.findFirstElem(rrte.TopRoot, RRTE.NAME_TREE_ROOT, UIA.Client.UIA_AutomationIdPropertyId) rrte.TreeRoot = UIA.getNextSiblingElem(rrte.Explorer) rrte.PaneRoot = UIA.getNextSiblingElem(rrte.TreeRoot) rrte.RRTECurr = tree def children(self, rrte): all = findAllElem(rrte.RRTECurr, UIA.Client.UIA_TreeItemControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) set = [] for x in range(0, all.Length): item = all.GetElement(x) elem = Window(UIA.getElemSubText(item)) elem.ctrlType = 'TreeItem' elem.rectangle = item.CurrentBoundingRectangle set.append(elem) return set class Window(SelectableElement): def select(self, rrte): leaf = UIA.findElemBySubText(rrte.RRTECurr, self.name) UIA.pushLeaf(leaf) time.sleep(2) rrte.Explorer = UIA.findFirstElem(rrte.TopRoot, RRTE.NAME_TREE_ROOT, UIA.Client.UIA_AutomationIdPropertyId) rrte.TreeRoot = UIA.getNextSiblingElem(rrte.Explorer) rrte.PaneRoot = UIA.getNextSiblingElem(rrte.TreeRoot) rrte.RRTECurr = rrte.PaneRoot def children(self, rrte): all = UIA.findAllElem4Or(rrte.RRTECurr, UIA.Client.UIA_CustomControlTypeId, UIA.Client.UIA_ButtonControlTypeId, UIA.Client.UIA_GroupControlTypeId, UIA.Client.UIA_TabControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) set = [] for x in range(0, all.Length): item = all.GetElement(x) if item.CurrentControlType == UIA.Client.UIA_CustomControlTypeId: # variable elem = self.createParam(item) elem.ctrlType = 'Custom' elif item.CurrentControlType == UIA.Client.UIA_ButtonControlTypeId: # method elem = Method(UIA.getElemSubText(item)) elem.ctrlType = 'Button' elif item.CurrentControlType == UIA.Client.UIA_GroupControlTypeId: # group elem = Group(UIA.getElemSubText(item)) elem.ctrlType = 'Group' elif item.CurrentControlType == UIA.Client.UIA_TabControlTypeId: # tab elem = Page('') elem.ctrlType = 'Tab' elem.rectangle = item.CurrentBoundingRectangle set.append(elem) return set def createParam(self, uiaElem): editbox = UIA.findFirstElem(uiaElem, 'Value', UIA.Client.UIA_AutomationIdPropertyId, scope=UIA.Client.TreeScope_Children) if not UIA.isUIAElem(editbox): group = UIA.findFirstElem(uiaElem, UIA.Client.UIA_GroupControlTypeId, UIA.Client.UIA_ControlTypePropertyId, scope=UIA.Client.TreeScope_Children) return BitEnum(UIA.getElemSubText(group)) elif editbox.CurrentControlType == UIA.Client.UIA_EditControlTypeId: return Data(UIA.getElemSubText(uiaElem)) elif editbox.CurrentControlType == UIA.Client.UIA_ComboBoxControlTypeId: return Enum(UIA.getElemSubText(uiaElem)) class Page(SelectableElement): def select(self, rrte): tab = UIA.findElemBySubText(rrte.PaneRoot, self.name) UIA.selectTab(tab) time.sleep(3) rrte.Explorer = UIA.findFirstElem(rrte.TopRoot, RRTE.NAME_TREE_ROOT, UIA.Client.UIA_AutomationIdPropertyId) rrte.TreeRoot = UIA.getNextSiblingElem(rrte.Explorer) rrte.PaneRoot = UIA.getNextSiblingElem(rrte.TreeRoot) rrte.RRTECurr = tab class Group(Element): pass class Param(Element): # abstract class def __init__(self, label, mode='RO', edit='None', unit=''): Element.__init__(self, label) self.mode = mode self.edit = edit self.unit = unit class Method(Element): pass class Data(Param): pass class Enum(Param): pass class BitEnum(Param): pass if __name__ == '__main__': #pdb.set_trace() logging.basicConfig(level = logging.INFO) # get hart register log from RRTE rrte = RRTE() rrte.clearOutput() rrte.start() rrte.createNodeTree(rrte.tree.root.left) #pdb.set_trace() rrte.closeMenu() #rrte.close() rrte.clearRegistLog() rrte.traversal(rrte.tree.root.left) #rrte.close()
37.173611
256
0.74986
25,672
0.959163
0
0
6,511
0.243265
0
0
4,525
0.169064
9b49b82dae00206e28c1ae751fd26cec3f45c20f
1,052
py
Python
eregs_core/migrations/0006_analysisparagraph_analysissection_footnote.py
cfpb/eregs-2.0
820bd56fa5265ee25f88fe8dce4c7aa092e5d6a3
[ "CC0-1.0" ]
1
2019-02-25T21:43:36.000Z
2019-02-25T21:43:36.000Z
eregs_core/migrations/0006_analysisparagraph_analysissection_footnote.py
cfpb/eregs-2.0
820bd56fa5265ee25f88fe8dce4c7aa092e5d6a3
[ "CC0-1.0" ]
46
2017-03-16T21:58:49.000Z
2017-09-05T16:21:29.000Z
eregs_core/migrations/0006_analysisparagraph_analysissection_footnote.py
cfpb/eregs-2.0
820bd56fa5265ee25f88fe8dce4c7aa092e5d6a3
[ "CC0-1.0" ]
7
2017-06-07T14:56:46.000Z
2021-02-20T10:50:48.000Z
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-03-03 17:48 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('eregs_core', '0005_appendix_definition_paragraph_reference_tocentry_tocinterpentry'), ] operations = [ migrations.CreateModel( name='AnalysisParagraph', fields=[ ], options={ 'proxy': True, }, bases=('eregs_core.regnode',), ), migrations.CreateModel( name='AnalysisSection', fields=[ ], options={ 'proxy': True, }, bases=('eregs_core.regnode',), ), migrations.CreateModel( name='Footnote', fields=[ ], options={ 'proxy': True, }, bases=('eregs_core.regnode',), ), ]
23.909091
95
0.497148
861
0.818441
0
0
0
0
0
0
280
0.26616
9b4a434127e56ce9f10a860ea190256cba7c7ff6
2,592
py
Python
project-euler/261/euler_261_v3.py
zoffixznet/project-euler
39921379385ae2521354c7266a541c46785e85a2
[ "MIT" ]
null
null
null
project-euler/261/euler_261_v3.py
zoffixznet/project-euler
39921379385ae2521354c7266a541c46785e85a2
[ "MIT" ]
null
null
null
project-euler/261/euler_261_v3.py
zoffixznet/project-euler
39921379385ae2521354c7266a541c46785e85a2
[ "MIT" ]
null
null
null
# The Expat License # # Copyright (c) 2017, Shlomi Fish # # 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. import sys if sys.version_info > (3,): long = int xrange = range LIM = 10000000000 def find_pivots(): initial_k = 2 s_k = 1*1+2*2 kdk = 1 kddk = 1 d = 8 STEP = 10000000 c = STEP ldm = (((initial_k-1) << 1) - 1) ksn = 2*2 dksn = 3 for k in xrange(initial_k, LIM+1): if k == c: print("Reached %d" % k) sys.stdout.flush() c += STEP while ksn < s_k: dksn += 2 ksn += dksn sm = s_n = nsq = ksn ldm += 2 dm = dnsq = dksn dnsq += 2 ss_k = s_k dk = kdk kddk += 2 ddk = kddk kdk += kddk for m in xrange(2, k+1): while s_n > ss_k and dm > ldm: sm -= dm dm -= 2 s_n += sm - nsq dnsq -= 2 nsq -= dnsq if s_n == ss_k: print("Found %d" % k) print(">>> S[ %d .. %d ; %d] = S[ %d .. %d ; %d] ( %d )" % (k-m+1, k, m, ((dm + 1) >> 1), ((dnsq - 1) >> 1), m-1, ((dm + 1) >> 1) - k)) sys.stdout.flush() if dm <= ldm: break ddk -= 2 dk -= ddk ss_k += dk nsq += dnsq dnsq += 2 s_n += nsq s_k += d d += 4 def main(): find_pivots() if __name__ == "__main__": main()
28.483516
79
0.531636
0
0
0
0
0
0
0
0
1,174
0.452932
9b4addb7383ad54fbd74f3fafd29a6bba825287f
4,331
py
Python
Naive_Bayes/lib/naive_bayes.py
DavexPro/MLStudy
869ab4e569fe1cde1a3a6238977282b81a71fc81
[ "MIT" ]
null
null
null
Naive_Bayes/lib/naive_bayes.py
DavexPro/MLStudy
869ab4e569fe1cde1a3a6238977282b81a71fc81
[ "MIT" ]
null
null
null
Naive_Bayes/lib/naive_bayes.py
DavexPro/MLStudy
869ab4e569fe1cde1a3a6238977282b81a71fc81
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # coding=utf-8 # -*- utf8 -*- # [email protected] # create=20170330 import math from lib.log import LOGGER class NaiveBayes: def __init__(self): # 元数据 self.data_set = [] # 分类后的数据 self.separate_set = {} # 分类后, 性别的先验概率 self.separate_prior = {} # 分类数据的参数分类 self.separate_probability = {} def import_data(self, file_path): """ 导入元数据 :param file_path: :return: """ LOGGER.info('样例数据导入路径: {0}'.format(file_path)) file_handle = open(file_path) file_content = file_handle.read().split('\n') for line in file_content: if line.strip() == '' or line[0] == '#': continue tmp_set = line.split(' ') self.data_set.append(tmp_set) LOGGER.info('样例数据集导入完成...') def separate_data(self): """ 分类样例数据, 并计算性别的先验概率 :return: """ LOGGER.info('开始分类样例数据...') # 根据性别对样例数据进行分类 for one_set in self.data_set: if one_set[0] not in self.separate_set: self.separate_set[one_set[0]] = [] self.separate_probability[one_set[0]] = [] self.separate_prior[one_set[0]] = 0 self.separate_set[one_set[0]].append(one_set) # 计算性别的先验概率 P(gender) for one_prior in self.separate_prior: self.separate_prior[one_prior] = len(self.separate_set[one_prior]) / len(self.data_set) LOGGER.info('样例数据分类完成...') def analyse_data(self): """ 对分类数据进行再次加工, 方便后续的取均值以及标准差的计算 :return: """ for one_separate in self.separate_set: self.separate_probability[one_separate] = { 'height': [], 'weight': [], 'foot': [] } for one_set in self.separate_set[one_separate]: self.separate_probability[one_separate]['height'].append(float(one_set[1])) self.separate_probability[one_separate]['weight'].append(float(one_set[2])) self.separate_probability[one_separate]['foot'].append(float(one_set[3])) def classify(self, height, weight, foot): """ 根据所给数据进行分类, 并给出判断 :param height: :param weight: :param foot: :return: 性别 """ LOGGER.info('数据分类: 身高{0}英尺 / 体重{1}磅 / 脚掌{2}英寸'.format(height, weight, foot)) category = {} for one_separate in self.separate_set: # 计算所给身高在该类别(性别)的概率密度 pro_height = calc_probability(height, calc_mean(self.separate_probability[one_separate]['height']), calc_stdev(self.separate_probability[one_separate]['height'])) # 计算所给体重在该类别(性别)的概率密度 pro_weight = calc_probability(weight, calc_mean(self.separate_probability[one_separate]['weight']), calc_stdev(self.separate_probability[one_separate]['weight'])) # 计算所给脚长在该类别(性别)的概率密度 pro_foot = calc_probability(foot, calc_mean(self.separate_probability[one_separate]['foot']), calc_stdev(self.separate_probability[one_separate]['foot'])) category[one_separate] = self.separate_prior[one_separate] * pro_height * pro_weight * pro_foot # 两个概率比较, 取最大值作为我们最后分类的结果 if category['0'] / category['1'] > 1: LOGGER.info('女性 / 女性的概率比男性的概率高{0}倍'.format(round(category['0'] / category['1']))) else: LOGGER.info('男性 / 男性的概率比女性的概率高{0}倍'.format(round(category['1'] / category['0']))) def calc_mean(numbers): """ 计算一组数的均值 :param numbers: :return: 均值 """ return sum(numbers) / float(len(numbers)) def calc_stdev(numbers): """ 计算一组数的标准差 :param numbers: :return: 标准差 """ avg = calc_mean(numbers) variance = sum([pow(x - avg, 2) for x in numbers]) / float(len(numbers) - 1) return math.sqrt(variance) def calc_probability(x, mean, stdev): """ 计算概率密度函数的值 :param x: :param mean: :param stdev: :return: """ exponent = math.exp(-(math.pow(x - mean, 2) / (2 * math.pow(stdev, 2)))) return (1 / (math.sqrt(2 * math.pi) * stdev)) * exponent
31.384058
111
0.563842
4,074
0.827208
0
0
0
0
0
0
1,645
0.33401
9b4d709976efa66a27e01fd0d18980bfda0f6d63
1,004
py
Python
views/sprite_views/combo_attack_sprite.py
kuyu12/pygame_fight_game
3bbc286b9f33c6d6d9db9bea21f9b7af15247df5
[ "MIT" ]
1
2020-08-03T07:54:59.000Z
2020-08-03T07:54:59.000Z
views/sprite_views/combo_attack_sprite.py
kuyu12/pygame_fight_game
3bbc286b9f33c6d6d9db9bea21f9b7af15247df5
[ "MIT" ]
null
null
null
views/sprite_views/combo_attack_sprite.py
kuyu12/pygame_fight_game
3bbc286b9f33c6d6d9db9bea21f9b7af15247df5
[ "MIT" ]
null
null
null
from views.sprite_views.attack_sprite import AttackSprite, AttackState from views.sprite_views.movement_sprite import Direction, State class ComboAttackSprite(AttackSprite): def __init__(self, player_data, combo_attack, on_finish): self.combo_attack = combo_attack self.combo_images = player_data.get_combo_images(combo_attack.combo_type) self.attack_state = AttackState.COMBO loc = (player_data.location[0] + combo_attack.off_set[0],player_data.location[1] + combo_attack.off_set[1]) super().__init__(loc, player_data.bounds_size) self.directions[player_data.faceDirection] = True self.is_blocking_move = True self.finish_block_state = State.DEAD if player_data.faceDirection == Direction.RIGHT: self.move_x = combo_attack.move_x else: self.move_x = -combo_attack.move_x self.on_dead_animation_finish = on_finish def load_images(self): self.images = self.combo_images
37.185185
115
0.721116
866
0.86255
0
0
0
0
0
0
0
0
9b4eebb09566e097a91f5dda6e303d168c9b41e8
337
py
Python
app/migrations/0024_auto_20190801_2013.py
olivierpons/evalr
7c76474ad41769804965a11550501321d7b1889b
[ "MIT" ]
null
null
null
app/migrations/0024_auto_20190801_2013.py
olivierpons/evalr
7c76474ad41769804965a11550501321d7b1889b
[ "MIT" ]
null
null
null
app/migrations/0024_auto_20190801_2013.py
olivierpons/evalr
7c76474ad41769804965a11550501321d7b1889b
[ "MIT" ]
null
null
null
# Generated by Django 2.2.3 on 2019-08-01 18:13 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('app', '0023_auto_20190801_2011'), ] operations = [ migrations.RenameModel( old_name='MotVoice', new_name='ExpressionVoice', ), ]
18.722222
47
0.602374
252
0.747774
0
0
0
0
0
0
104
0.308605
9b4f6caa8f4e00e79f672af5d86d90e4902524c8
548
py
Python
app/users/__init__.py
niross/ftrack
73196f8b72f52ad04fe67ffa2bd830e058ceaf7f
[ "MIT" ]
null
null
null
app/users/__init__.py
niross/ftrack
73196f8b72f52ad04fe67ffa2bd830e058ceaf7f
[ "MIT" ]
null
null
null
app/users/__init__.py
niross/ftrack
73196f8b72f52ad04fe67ffa2bd830e058ceaf7f
[ "MIT" ]
null
null
null
from flask import Blueprint from flask_security import SQLAlchemyUserDatastore from app import db from app.users.models import User, Role bp = Blueprint('users', __name__, template_folder='templates') user_datastore = SQLAlchemyUserDatastore(db, User, Role) # Create a user to test with @bp.before_app_first_request def create_user(): db.create_all() if User.query.filter_by(email='[email protected]').count() == 0: user_datastore.create_user(email='[email protected]', password='password') db.session.commit()
28.842105
86
0.755474
0
0
0
0
255
0.465328
0
0
102
0.186131
9b4fcde6493e496f8266585c418f51bc87980875
6,457
py
Python
payctl/utils.py
arjanz/substrate-payctl
57d13155ffd8e200d54ec4d4382a09b757fa8211
[ "MIT" ]
null
null
null
payctl/utils.py
arjanz/substrate-payctl
57d13155ffd8e200d54ec4d4382a09b757fa8211
[ "MIT" ]
null
null
null
payctl/utils.py
arjanz/substrate-payctl
57d13155ffd8e200d54ec4d4382a09b757fa8211
[ "MIT" ]
null
null
null
from substrateinterface import SubstrateInterface, Keypair from substrateinterface.utils.ss58 import ss58_encode, ss58_decode # # get_config - Get a default and validator specific config elements from args and config. # def get_config(args, config, key, section='Defaults'): if vars(args)[key] is not None: return vars(args)[key] if config[section].get(key) is not None: return config[section].get(key) return config['Defaults'].get(key) # # get_eras_rewards_point - Collect the ErasRewardPoints (total and invididual) for a given range of eras. # def get_eras_rewards_point(substrate, start, end): eras_rewards_point = {} for era in range(start, end): reward_points = substrate.query( module='Staking', storage_function='ErasRewardPoints', params=[era] ) try: eras_rewards_point[era] = {} eras_rewards_point[era]['total'] = reward_points.value['total'] eras_rewards_point[era]['individual'] = {} for reward_points_item in reward_points.value['individual']: eras_rewards_point[era]['individual'][reward_points_item[0]] = reward_points_item[1] except: continue return eras_rewards_point # # get_eras_validator_rewards - Collect the ErasValidatorReward for a given range of eras. # def get_eras_validator_rewards(substrate, start, end): eras_validator_rewards = {} for era in range(start, end): validator_rewards = substrate.query( module='Staking', storage_function='ErasValidatorReward', params=[era] ) try: eras_validator_rewards[era] = validator_rewards.value except: continue return eras_validator_rewards # # get_eras_payment_info - Combine information from ErasRewardPoints and ErasValidatorReward for given # range of eras to repor the amount of per validator instead of era points. # def get_eras_payment_info(substrate, start, end): eras_rewards_point = get_eras_rewards_point(substrate, start, end) eras_validator_rewards = get_eras_validator_rewards(substrate, start, end) eras_payment_info = {} for era in list(set(eras_rewards_point.keys()) & set(eras_validator_rewards.keys())): total_points = eras_rewards_point[era]['total'] for validatorId in eras_rewards_point[era]['individual']: total_reward = eras_validator_rewards[era] if total_reward is not None: eras_rewards_point[era]['individual'][validatorId] *= (total_reward/total_points) eras_payment_info[era] = eras_rewards_point[era]['individual'] return eras_payment_info # # get_eras_payment_info_filtered - Similar than get_eras_payment_info but applying some filters; # 1 . Include only eras containing given acconts. # 2 . Include only eras containing unclaimed rewards. # # NOTE: The returned structure is slighly different than # get_eras_payment_info # def get_eras_payment_info_filtered(substrate, start, end, accounts=[], unclaimed=False): eras_paymemt_info_filtered = {} eras_paymemt_info = get_eras_payment_info(substrate, start, end) accounts_ledger = get_accounts_ledger(substrate, accounts) for era in eras_paymemt_info: for accountId in accounts: if accountId in eras_paymemt_info[era]: if era in accounts_ledger[accountId]['claimedRewards']: if unclaimed == True: continue claimed = True else: claimed = False if era not in eras_paymemt_info_filtered: eras_paymemt_info_filtered[era] = {} eras_paymemt_info_filtered[era][accountId] = {} amount = eras_paymemt_info[era][accountId] / (10**substrate.token_decimals) eras_paymemt_info_filtered[era][accountId]['claimed'] = claimed eras_paymemt_info_filtered[era][accountId]['amount'] = amount return eras_paymemt_info_filtered # # get_included_accounts - Get the list (for the filtering) of included accounts from the args and config. # def get_included_accounts(substrate, args, config): included_accounts = [] if len(args.validators) != 0: for validator in args.validators: included_accounts.append(validator) else: for section in config.sections(): if section == 'Defaults': continue included_accounts.append(section) return included_accounts # # get_accounts_ledger - Collect the Ledger for a given list of accounts. # def get_accounts_ledger(substrate, accounts): accounts_ledger = {} for account in accounts: try: controller_account = substrate.query( module='Staking', storage_function='Bonded', params=[accounts[0]] ) ledger = substrate.query( module='Staking', storage_function='Ledger', params=[controller_account.value] ) accounts_ledger[account] = ledger.value except: continue return accounts_ledger # # get_keypair - Generate a Keypair from args and config. # def get_keypair(args, config): enabled_signing_methods = config['Defaults'].keys() & {'signingseed', 'signingmnemonic', 'signinguri'} if (len(enabled_signing_methods) != 1): return None signing_method = list(enabled_signing_methods)[0] if signing_method == 'signingseed': keypair = Keypair.create_from_seed(config['Defaults'].get('signingseed')) if signing_method == 'signingmnemonic': keypair = Keypair.create_from_mnemonic(config['Defaults'].get('signingmnemonic')) if signing_method == 'signinguri': keypair = Keypair.create_from_uri(config['Defaults'].get('signinguri')) return keypair # # get_nonce - Get the next nonce to be used on a signature for a given account. # def get_nonce(substrate, account): account_info = substrate.query( module='System', storage_function='Account', params=[account] ) return account_info.value['nonce']
32.447236
106
0.647205
0
0
0
0
0
0
0
0
1,666
0.258015
9b52940acbc894f83db7c38174cba4aed0fe37b6
7,279
py
Python
Notepad++/programfiles/Notepad++/plugins/PythonScript/scripts/Samples/LogfileLexer.py
slim71/Utils
5fcb0ec604cc039668f132c102d6bd2050bcea5c
[ "Unlicense" ]
null
null
null
Notepad++/programfiles/Notepad++/plugins/PythonScript/scripts/Samples/LogfileLexer.py
slim71/Utils
5fcb0ec604cc039668f132c102d6bd2050bcea5c
[ "Unlicense" ]
null
null
null
Notepad++/programfiles/Notepad++/plugins/PythonScript/scripts/Samples/LogfileLexer.py
slim71/Utils
5fcb0ec604cc039668f132c102d6bd2050bcea5c
[ "Unlicense" ]
null
null
null
# -*- coding: utf-8 -*- """ LogfileLexer - Demo Highlights whole lines which matches the regex. Usage: Load a logfile, modify error and warning regex and run script to see how it works Note: By commenting or deleting everything, including, the <comment_or_delete> tags it is ready to be used as an additional lexer """ from Npp import editor, notepad, LEXER, SCINTILLANOTIFICATION, NOTIFICATION, LANGTYPE import re try: # on first run this will generate an NameError exception LOGFILE_LEXER().main() except NameError: class LOGFILE_LEXER_SINGLETON(type): ''' Ensures that only one log file lexer instance exists and prevents of getting multiple callbacks ''' _instance = None def __call__(cls, *args, **kwargs): ''' The real constructor and first method called when a new instance should be created. On first instantiation class variable _instance gets itself assigned, every subsequent instantiation try returns this object ''' if cls._instance is None: cls._instance = super(LOGFILE_LEXER_SINGLETON, cls).__call__(*args, **kwargs) return cls._instance class LOGFILE_LEXER(object): ''' A line based lexer implementation. Whole line gets coloured if part or complete line matches regex ''' __metaclass__ = LOGFILE_LEXER_SINGLETON DEFAULT = 0 # the current default style ERROR_STYLE = 60 WARNING_STYLE = 61 # define the style colors ERROR_STYLE_FOREGROUND = (224,108,117) WARNING_STYLE_FOREGROUND = (255,255,128) # define the regex which return the position of the matches ERROR_REGEX = '.*error.*' WARNING_REGEX = '.*warning.*' def __init__(self): ''' Register needed callbacks on first class instantiation ''' editor.callbackSync(self.styleneeded_callback, [SCINTILLANOTIFICATION.STYLENEEDED]) notepad.callback(self.bufferactivated_callback, [NOTIFICATION.BUFFERACTIVATED]) notepad.callback(self.langchanged_callback, [NOTIFICATION.LANGCHANGED]) def logfile_lexer(self, start_pos, end_pos): ''' Main lexing logic. Gets called by styleneeded callback ''' def style_it(match, STYLE): ''' Inform scintilla to do the styling''' if match[1]-match[0] >= 0: editor.startStyling(start_pos + match[0], 31) editor.setStyling(match[1]-match[0], STYLE) def do_regex(regex): ''' return a list of match positions Note, is using python regular expression instead of boost::re ''' return [m.span(0) for m in re.finditer(regex, text, flags=re.I)] # ensure that position is really the first position for each line start_pos = editor.positionFromLine(editor.lineFromPosition(start_pos)) # fast but potentially unsafe way to get the text of the line text = editor.getRangePointer(start_pos, end_pos-start_pos) # first everything will be styled with default style style_it((start_pos, end_pos), self.DEFAULT) # map style_it function to each match returned by do_regex # ordering is important as it might be that a line matches # multiple regexes - the last do_regex overwrites previous styling map(lambda match: style_it(match, self.WARNING_STYLE), do_regex(self.WARNING_REGEX)) map(lambda match: style_it(match, self.ERROR_STYLE), do_regex(self.ERROR_REGEX)) # this needs to stay and to be the last line, to signal scintilla we are done. editor.startStyling(end_pos,31) def init_scintilla(self): ''' Initialize configured styles ''' editor.setMarginWidthN(0,38) editor.setMarginWidthN(1,14) editor.setMarginWidthN(2,0) if editor.getLexer() != LEXER.CONTAINER: editor.setLexer(LEXER.CONTAINER) editor.styleSetFore(self.ERROR_STYLE, self.ERROR_STYLE_FOREGROUND) editor.styleSetFore(self.WARNING_STYLE, self.WARNING_STYLE_FOREGROUND) def set_lexer_doc(self,bool_value): ''' Assign the class name as an additional property to every document which should be handled by this lexer A value of 1 indicates it should be handled. ''' editor.setProperty(self.__class__.__name__, 1 if bool_value is True else 0) def is_lexer_doc(self): ''' Check if the current document is of interest by reading the class name property. ''' return True if editor.getPropertyInt(self.__class__.__name__, 0) == 1 else False def styleneeded_callback(self,args): ''' Called by scintilla to inform the lexer about the need to style the document. If document is of interest call main logic (logfile_lexer) function Ensures that the start position is really the first position per line ''' if self.is_lexer_doc(): startPos = editor.getEndStyled() lineNumber = editor.lineFromPosition(startPos) startPos = editor.positionFromLine(lineNumber) self.logfile_lexer(startPos, args['position']) def bufferactivated_callback(self,args): ''' Called by notepad when document switch happens If document is of interest styles need to be reinitialized ''' if self.is_lexer_doc(): self.init_scintilla() def langchanged_callback(self,args): ''' Called by notepad when a built-in or udl language switch happens If document was previously styled by this lexer it will be reset and therefore will not be styled by this lexer anymore until script gets executed on this document again. ''' if self.is_lexer_doc(): self.set_lexer_doc(False) def main(self): ''' Main entry point To prevent issues with other lexers document language will be set to normal text, then document does get the class name property assigned, styles do get initialized and main lexing function does get called on whole document ''' notepad.setLangType(LANGTYPE.TXT) self.set_lexer_doc(True) self.init_scintilla() self.logfile_lexer(0, editor.getTextLength()) # <comment_or_delete> # just some demo text not really needed by lexer notepad.new() editor.appendText(''' A line with no keywords followed by a warning line some fillings until a line with ERROR appears again some text and a line with error and WARNING ''') # </comment_or_delete> LOGFILE_LEXER().main()
37.911458
96
0.615469
6,672
0.916609
0
0
0
0
0
0
3,501
0.480973
9b52da16ba296fc3a30eb27a8abe81a9c2046c19
913
py
Python
py_mybatis/mapper_func.py
malone081021/py_mybatis
bea69b2aa0d17d9a96ddf596bc63bd88e5a2045e
[ "Apache-2.0" ]
15
2020-08-20T03:57:13.000Z
2022-02-01T03:08:14.000Z
py_mybatis/mapper_func.py
malone081021/py_mybatis
bea69b2aa0d17d9a96ddf596bc63bd88e5a2045e
[ "Apache-2.0" ]
3
2020-08-20T05:43:22.000Z
2020-09-23T08:08:10.000Z
py_mybatis/mapper_func.py
malone081021/py_mybatis
bea69b2aa0d17d9a96ddf596bc63bd88e5a2045e
[ "Apache-2.0" ]
10
2020-12-10T06:17:20.000Z
2022-02-26T07:07:48.000Z
from .logger import LOG from .funs import * # 函数容器 class PyFunction(object): def __init__(self): self.function_map = dict() def register_func(self, function_name: str, func): if function_name in self.function_map: LOG.warning("function {} exist".format(function_name)) return self.function_map[function_name] = func def get_func(self, function_name: str): if function_name in self.function_map: return self.function_map[function_name] return None def call_func(self, function_name: str, *args): func = self.get_func(function_name) if func and callable(func): return func(*args) # 参数 转换函数 PY_PARAM_FUNCTION = PyFunction() # 注册参数转换函数 for fun_name in default_fun_dict: PY_PARAM_FUNCTION.register_func(fun_name, default_fun_dict[fun_name]) # 返回值转换函数 PY_RESULT_FUNCTION = PyFunction()
25.361111
73
0.682366
650
0.674974
0
0
0
0
0
0
103
0.106957
9b5316477ce7fd6da19f6364699eb3e0afb2374d
87
py
Python
envisage/plugins/ipython_kernel/api.py
janvonrickenbach/Envisage_wxPhoenix_py3
cf79e5b2a0c3b46898a60b5fe5a2fb580604808b
[ "BSD-3-Clause" ]
null
null
null
envisage/plugins/ipython_kernel/api.py
janvonrickenbach/Envisage_wxPhoenix_py3
cf79e5b2a0c3b46898a60b5fe5a2fb580604808b
[ "BSD-3-Clause" ]
1
2017-05-22T21:15:22.000Z
2017-05-22T21:15:22.000Z
envisage/plugins/ipython_kernel/api.py
janvonrickenbach/Envisage_wxPhoenix_py3
cf79e5b2a0c3b46898a60b5fe5a2fb580604808b
[ "BSD-3-Clause" ]
1
2019-10-01T07:03:58.000Z
2019-10-01T07:03:58.000Z
from ipython_kernel_plugin import IPythonKernelPlugin, IPYTHON_KERNEL_PROTOCOL # noqa
43.5
86
0.885057
0
0
0
0
0
0
0
0
6
0.068966
9b533be27e81a8ec5389e0a6e1d39a3dcf1f48a7
3,283
py
Python
multiAgentEnv/maenv/mpe/_mpe_utils/forward_models/forward_model.py
eranbTAU/Closing-the-Reality-Gap-for-a-Multi-Agent-System-Using-GAN
3df5f8ba1069ce3f16f1ab743da9cbdd3bddd43c
[ "MIT" ]
null
null
null
multiAgentEnv/maenv/mpe/_mpe_utils/forward_models/forward_model.py
eranbTAU/Closing-the-Reality-Gap-for-a-Multi-Agent-System-Using-GAN
3df5f8ba1069ce3f16f1ab743da9cbdd3bddd43c
[ "MIT" ]
null
null
null
multiAgentEnv/maenv/mpe/_mpe_utils/forward_models/forward_model.py
eranbTAU/Closing-the-Reality-Gap-for-a-Multi-Agent-System-Using-GAN
3df5f8ba1069ce3f16f1ab743da9cbdd3bddd43c
[ "MIT" ]
1
2022-02-22T11:06:40.000Z
2022-02-22T11:06:40.000Z
import torch import numpy as np import os from ..utils import load_params, get_scaler, get_rescaler class ForwardModel(): def __init__(self, robot_type=None): try: filename = f'.../maenv/mpe/_mpe_utils/{robot_type}_config.yaml' params = load_params(filename).get('forward_model') except FileNotFoundError: print(f"{filename} not found. Note that robot_type param should 'car' or 'fish' be defined") self.model_name = params['fd_model'] self.robot_type = robot_type self.device = set_device(params['fdm_device']) self.dir = '.../maenv/mpe/_mpe_utils/forward_models' self.model = self.load_forward_model(params['fdm_input_dim'], params['fdm_output_dim']) self.model.to(self.device) def load_state_dict(self, path, net): state = torch.load(path, map_location=self.device) try: net.load_state_dict(state) except: try: net.load_state_dict(state['best_state']) except: net.load_state_dict(state['best_state_val']) net.eval() return net def load_forward_model(self, input_dim, output_dim): ''' load forward model for eval mode ''' if self.robot_type=='car': from maenv.mpe._mpe_utils.forward_models.car.NN import get_fd_model NN, scalers = get_fd_model(self.model_name) net = NN(input_dim=2, output_dim=3) min_x = [scalers[0], scalers[0]] max_x = [scalers[1], scalers[1]] min_y = [scalers[2], scalers[4], scalers[6]] max_y = [scalers[3], scalers[5], scalers[7]] elif self.robot_type == 'fish': from maenv.mpe._mpe_utils.forward_models.fish.NN import get_fd_model NN, scalers = get_fd_model(self.model_name) net = NN(input_dim, output_dim) min_x = [scalers[0], scalers[2], scalers[4]] max_x = [scalers[1], scalers[3], scalers[5]] min_y = [scalers[6], scalers[8], scalers[10]] max_y = [scalers[7], scalers[9], scalers[11]] else: raise NameError(self.robot_type) model_path = os.path.join(self.dir, self.robot_type, 'models', self.model_name) model = self.load_state_dict(model_path, net) self.scaledown_x = get_scaler(np.array(min_x), np.array(max_x)) self.scaledown_y = get_scaler(np.array(min_y), np.array(max_y)) self.rescale_x = get_rescaler(np.array(min_x), np.array(max_x)) self.rescale_y = get_rescaler(np.array(min_y), np.array(max_y)) return model def predict_single(self, x): x = torch.from_numpy(x).unsqueeze(0).to(self.device) with torch.no_grad(): y = self.model(x) y = y.squeeze().detach().cpu().numpy() y = self.rescale_y(y) return y def predict_batch(self, x): x = torch.from_numpy(x).to(self.device) with torch.no_grad(): y = self.model(x) y = y.detach().cpu().numpy() y = self.rescale_y(y) return y def set_device(device): return torch.device(device if torch.cuda.is_available() else 'cpu') if device != 'cpu' else torch.device('cpu')
35.301075
115
0.603412
3,035
0.924459
0
0
0
0
0
0
364
0.110874
9b5505ca703b310b156073810269854022e84cd6
948
py
Python
src/personal/views.py
vybhavpai/Blog
8e0adf52bfba5502f787dd339866f39b5f4856f4
[ "bzip2-1.0.6" ]
null
null
null
src/personal/views.py
vybhavpai/Blog
8e0adf52bfba5502f787dd339866f39b5f4856f4
[ "bzip2-1.0.6" ]
17
2020-06-06T00:04:23.000Z
2022-03-12T00:25:43.000Z
src/personal/views.py
vybhavpai/Blog
8e0adf52bfba5502f787dd339866f39b5f4856f4
[ "bzip2-1.0.6" ]
null
null
null
from django.shortcuts import render from blog.models import BlogPost from operator import attrgetter from blog.views import get_blog_queryset from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator # Create your views here. BLOG_POSTS_PER_PAGE = 1 def home_screen_view(request): context = {} query = "" if request.GET: query = request.GET.get('q','') context['query'] = str(query) blog_posts = sorted(get_blog_queryset(query),key=attrgetter('date_updated'),reverse=True) # Pagination page = request.GET.get('page', 1) blog_posts_paginator = Paginator(blog_posts, BLOG_POSTS_PER_PAGE) try: blog_posts = blog_posts_paginator.page(page) except PageNotAnInteger: blog_posts = blog_posts_paginator.page(BLOG_POSTS_PER_PAGE) except EmptyPage: blog_posts = blog_posts_paginator.page(blog_posts_paginator.num_pages) context['blog_posts'] = blog_posts return render(request, "personal/home.html", context)
27.085714
90
0.781646
0
0
0
0
0
0
0
0
103
0.10865
9b551741cab1afbab203fa568039b9c06d277d87
5,771
py
Python
tools/makeplugin.py
rhcad/x3py
a631b9130673683f9c0395209ff49b94eb0ceac6
[ "Apache-2.0" ]
214
2015-01-25T15:54:57.000Z
2022-03-13T13:20:34.000Z
tools/makeplugin.py
HAERBINWINE/x3py
a631b9130673683f9c0395209ff49b94eb0ceac6
[ "Apache-2.0" ]
18
2015-03-11T15:42:56.000Z
2021-12-23T10:11:03.000Z
tools/makeplugin.py
HAERBINWINE/x3py
a631b9130673683f9c0395209ff49b94eb0ceac6
[ "Apache-2.0" ]
126
2015-01-19T03:28:48.000Z
2022-03-16T06:52:57.000Z
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Function: Create a plugin project based on example project. This script has been tested with ActivePython 2.7/3.2. Usage: python makeplugin.py [prjname [pkgname [srcprj [srcpkg [useswig]]]]] or double click the file 'makeplugin.py'. prjname: name of the new project. pkgname: package name of the new project, the default value is 'example'. srcprj: template (exists) project name, the default value is 'pltempl'. srcpkg: package name of the template project, the default value is 'example'. useswig: need swig files or not (y/n), the default value is 'n'. Creator: Zhang Yungui <[email protected]> Date: 2011.11.14 ChangeList: 1. Implemented the function: multi_replace, copyfiles, makeproj 2. Auto copy interface files and skip swig files. [2011.12.14] 3. Auto skip empty folders. [2012.02.21] """ import os, sys, re, uuid def multi_replace(text, adict): rx = re.compile('|'.join(map(re.escape, adict))) def xlat(match): return adict[match.group(0)] return rx.sub(xlat, text) def copyfiles(srcdir, dstdir, pairs, srcprj, callback, noswig): if ".svn" in srcdir or not os.path.exists(srcdir): return if noswig and "swig" in srcdir: return has_i = noswig and os.path.exists(os.path.join(srcdir, srcprj + ".i")) for fn in os.listdir(srcdir): srcfile = os.path.join(srcdir, fn) dstfile = os.path.join(dstdir, multi_replace(fn, pairs)) if os.path.isdir(srcfile): copyfiles(srcfile, dstfile, pairs, srcprj, callback, noswig) continue if has_i and (fn==srcprj+".i" or fn.startswith("test"+srcprj)): continue if not os.path.exists(dstfile) and callback(fn, pairs): if not os.path.exists(dstdir): os.makedirs(dstdir) open(dstfile, "wb").write(open(srcfile, "rb").read()) isutf8 = False try: text = open(dstfile).read() except UnicodeDecodeError: try: text = open(dstfile,'r',-1,'utf-8').read() isutf8 = True except UnicodeDecodeError: print("* Fail to read '%s' as utf-8 encoding." % (dstfile,)) continue newtext = multi_replace(text, pairs) if newtext != text: try: if (isutf8): open(dstfile, 'w',-1,'utf-8').write(newtext) print('[replaced] %s [utf-8]' % (dstfile,)) else: open(dstfile, 'w').write(newtext) print('[replaced] %s' % (dstfile,)) except UnicodeDecodeError: open(dstfile, 'w',-1,'utf-8').write(newtext) print('[replaced] %s [utf-8]' % (dstfile,)) else: print('[created] %s' % (dstfile,)) def makeproj(prjname, pkgname, srcprj, srcpkg, noswig): rootpath = os.path.abspath('..') basepath = os.path.join(rootpath, 'source', srcpkg, srcprj) pkgpath = os.path.join(rootpath, 'source', pkgname) dstdir = os.path.join(pkgpath, prjname) if prjname == '': print("Need input the project name.") return if not os.path.exists(basepath): print("\nPlease input a valid exists template project name." "\n\'%s\' does not exist." % (basepath,)) return if not os.path.exists(pkgpath): os.makedirs(pkgpath) srcmk = os.path.join(rootpath, 'source', srcpkg, 'Makefile') if os.path.exists(srcmk): dstmk = os.path.join(pkgpath, 'Makefile') open(dstmk, "w").write(open(srcmk).read()) print('%s [created]' % (dstmk,)) pairs = {srcprj:prjname, srcpkg:pkgname} def matchfile(filename, pairs): if filename.find("_wrap.cxx") > 0 or filename.find("_wrap.h") > 0: return False return True copyfiles(basepath, dstdir, pairs, srcprj, matchfile, noswig) basepath = os.path.join(rootpath, 'interface', srcpkg, srcprj) dstdir = os.path.join(rootpath, 'interface', pkgname, prjname) intpairs = pairs intpairs["78d30c77-e0f0-48a3-a489-dd4327759c27"] = str(uuid.uuid1()) intpairs["94071767-ba6b-4769-9eb4-2ebf469289f3"] = str(uuid.uuid1()) intpairs["feefc399-29f2-4354-8eeb-048d4cf56567"] = str(uuid.uuid1()) copyfiles(basepath, dstdir, intpairs, srcprj, matchfile, noswig) def matchproj(filename, pairs): if ".user" in filename: return False for key in pairs.keys(): if filename.startswith(key + '_') or \ filename.startswith(key + '.'): return True return False projects = os.path.join(rootpath, 'projects') copyfiles(projects, projects, pairs, srcprj, matchproj, noswig) if __name__=="__main__": def inputparam(index, prompt, default=''): if len(sys.argv) > index: ret = sys.argv[index] else: ret = raw_input(prompt) if ret == '': ret = default return ret prjname = inputparam(1, 'New project name: ') pkgname = inputparam(2, 'Package name of the new project (default: example): ', 'example') srcprj = inputparam(3, 'Template (exists) project name (default: pltempl): ', 'pltempl') srcpkg = inputparam(4, 'Package name of the template project (default: example): ', 'example') useswig = inputparam(5, 'Need swig (y/n) ? (default: n): ', 'n') makeproj(prjname, pkgname, srcprj, srcpkg, 'n' in useswig) if len(sys.argv) < 3: raw_input("Press <ENTER> to end.")
41.517986
99
0.582741
0
0
0
0
0
0
0
0
1,794
0.310865
9b56838a87136d14ec040f4d65ab94a7e2ebd723
146,532
py
Python
V1/R1/N2HF_armors_v1_r1.py
N2HF-OFFICIAL/n2hf
de4a26a3b70082cd2375cc3fe7a5c2fd09cec085
[ "MIT" ]
null
null
null
V1/R1/N2HF_armors_v1_r1.py
N2HF-OFFICIAL/n2hf
de4a26a3b70082cd2375cc3fe7a5c2fd09cec085
[ "MIT" ]
null
null
null
V1/R1/N2HF_armors_v1_r1.py
N2HF-OFFICIAL/n2hf
de4a26a3b70082cd2375cc3fe7a5c2fd09cec085
[ "MIT" ]
null
null
null
from PIL import Image import os import numpy as np import pandas as pd from random import seed from random import randint dirname = os.path.dirname('') dimensions = 600, 600 def make_armors(ma, ma2, ma3): count_doojunggap = 0 count_gyungbyungap = 0 count_chalgap = 0 for x in range(0, ma2): b=ma3 seed(x+b) ## 1이 진한거 2가 연한거 ## a : 두정갑 주 색 (빨강) aa = randint(0, 400) if aa<100: # a1 색상 a1 = (randint(130, 150), randint(30, 50), randint(30, 40)) c=randint(0,500) seed(c) # a2 색상 a2 = (randint(190, 210), randint(0, 20), randint(0, 20)) d = randint(501,1000) seed(d) elif 100<=aa<200: # a1 색상 a1 = (randint(80, 100), randint(20, 40), randint(20, 40)) c=randint(0,500) seed(c) # a2 색상 a2 = (randint(130, 150), randint(25, 45), randint(25, 45)) d = randint(501,1000) seed(d) elif 200<=aa<300: # a1 색상 a1 = (randint(5, 25), randint(5, 25), randint(50, 70)) c=randint(0,500) seed(c) # a2 색상 a2 = (randint(45, 65), randint(35, 55), randint(115, 135)) d = randint(501,1000) seed(d) else: # a1 색상 a1 = (randint(25, 45), randint(55, 75), randint(20, 40)) c=randint(0,500) seed(c) # a2 색상 a2 = (randint(30, 50), randint(105, 125), randint(45, 65)) d = randint(501,1000) seed(d) ## b : 어두운 철 부분 (찰갑 투구 주색) # b1 색상 b1 = (randint(0, 100), randint(0, 100), randint(0, 100)) e=randint(1001,1500) seed(e) # b2 색상 b2 = (b1[0]+randint(30, 60), b1[1]+randint(30, 60), b1[2]+randint(30, 60)) f = randint(1501,2000) seed(f) ## c : 찰갑 주색 (어두운 나무색) cc = randint(0, 200) if cc<100: # c1 색상 c1 = (randint(50, 100), randint(0, 40), randint(0, 40)) g=randint(2001,2500) seed(g) # c2 색상 c2 = (c1[0]+randint(30, 60), c1[1]+randint(30, 60), c1[2]+randint(30, 60)) h = randint(2501,3000) seed(h) else: # c1 색상 c1 = (randint(60, 80), randint(60, 80), randint(70, 90)) g=randint(2001,2500) seed(g) # c2 색상 c2 = (randint(130, 150), randint(125, 145), randint(120, 140)) h = randint(2501,3000) seed(h) # d 벨트부분 dd = randint(0, 300) if dd<100: # d1 색상 d1 = (randint(0, 30), randint(0, 30), randint(200, 230)) i=randint(3001,3500) seed(i) # d2 색상 d2 = (d1[0]+randint(30, 60), d1[1]+randint(30, 60), d1[2]+randint(0, 26)) j=randint(3501,4000) seed(j) elif 100<=dd<200: d1 = (randint(0, 40), randint(60, 100), randint(40, 80)) i=randint(3001,3500) seed(i) # d2 색상 d2 = (randint(0, 20), randint(150, 190), randint(60, 100)) j=randint(3501,4000) seed(j) else: d1 = (randint(60, 100), randint(50, 90), randint(0, 40)) i=randint(3001,3500) seed(i) # d2 색상 d2 = (randint(150, 190), randint(110, 150), randint(0, 20)) j=randint(3501,4000) seed(j) ## e : 두정갑 노란솔 & 금속 (금색, 노란색) # e1 색상 e1 = (randint(190, 220), randint(120, 180), randint(10, 40)) k = randint(4001,4500) seed(k) # e2 색상 e2 = (e1[0]+randint(0, 26), e1[1]+randint(20, 50), e1[2]+randint(0, 30)) l = randint(5001,5500) seed(l) ## f : 솔 부분 (빨강, 초록, 파랑 범위 중 1개) # f1 색상 f1 = (randint(0, 200), randint(0, 200), randint(0, 200)) m = randint(5501,6000) seed(m) # f2 색상 f2 = (f1[0]+randint(0, 50), f1[1]+randint(0, 50), f1[2]+randint(0, 50)) n = randint(6501,7000) seed(n) ## 배경색 bg1 = randint(0,300) if bg1 < 100: # 194, 164, 29 / # bg1 : 누런~주황 ex) 194, 164, 29 bg1_1 = (randint(110, 150), randint(55, 95), randint(0, 25)) o = randint(7501,8000) seed(o) bg1_2 = (randint(150, 190), randint(75, 115), randint(0, 20)) p = randint(8001,8500) seed(p) bg1_3 = (randint(175, 215), randint(145, 185), randint(10, 50)) q = randint(8501,9000) seed(q) elif 100 <= bg1 < 200: # 141, 179, 173 / 45, 125, 112 / 0, 80, 67 bg1_3 = (randint(125, 155), randint(165, 195), randint(160, 190)) r = randint(9001,9500) seed(r) bg1_2 = (randint(30, 60), randint(110, 140), randint(95, 125)) s = randint(9501,10000) seed(s) bg1_1 = (randint(0, 30), randint(65, 95), randint(50, 80)) t = randint(10001,10500) seed(t) else: # 127, 173, 218 / 50, 97, 143 / 1, 40, 78 bg1_3 = (randint(115, 145), randint(160, 190), randint(205, 235)) r = randint(9001,9500) seed(r) bg1_2 = (randint(35, 65), randint(85, 115), randint(130, 160)) s = randint(9501,10000) seed(s) bg1_1 = (randint(0, 30), randint(25, 55), randint(65, 95)) t = randint(10001,10500) seed(t) bg2 = randint(0,300) if bg2 < 100: # 166, 148, 105 / 121, 61, 0 / 97, 69, 0 bg2_3 = (randint(150, 180), randint(130, 160), randint(90, 120)) r = randint(9001,9500) seed(r) bg2_2 = (randint(105, 135), randint(45, 75), randint(0, 30)) s = randint(9501,10000) seed(s) bg2_1 = (randint(80, 110), randint(55, 85), randint(0, 30)) t = randint(10001,10500) seed(t) elif 100 <= bg2 < 200: # 141, 179, 173 / 45, 125, 112 / 0, 80, 67 bg2_3 = (randint(125, 155), randint(165, 195), randint(160, 190)) r = randint(9001,9500) seed(r) bg2_2 = (randint(30, 60), randint(110, 140), randint(95, 125)) s = randint(9501,10000) seed(s) bg2_1 = (randint(0, 30), randint(65, 95), randint(50, 80)) t = randint(10001,10500) seed(t) else: # 127, 173, 218 / 50, 97, 143 / 1, 40, 78 bg2_3 = (randint(115, 145), randint(160, 190), randint(205, 235)) r = randint(9001,9500) seed(r) bg2_2 = (randint(35, 65), randint(85, 115), randint(130, 160)) s = randint(9501,10000) seed(s) bg2_1 = (randint(0, 30), randint(25, 55), randint(65, 95)) t = randint(10001,10500) seed(t) bg3 = randint(0,300) if bg3 < 100: # bg3_1 : 갈색 ex) 179, 86, 5 / bg3_2 : 황토 ex) 222, 161, 108 bg3_1 = (randint(150, 200), randint(70, 100), randint(0, 10)) u = randint(10501,11000) seed(u) bg3_2 = (bg3_1[0]+randint(30, 55), bg3_1[1]+randint(30, 55), bg3_1[2]+randint(30, 55)) v = randint(11001,11500) seed(v) elif 100 <= bg3 <200 : # 127, 173, 218 / 50, 97, 143 bg3_2 = (randint(115, 145), randint(160, 190), randint(205, 235)) r = randint(9001,9500) seed(r) bg3_1 = (randint(35, 65), randint(85, 115), randint(130, 160)) s = randint(9501,10000) seed(s) else: # 141, 179, 173 / 45, 125, 112 bg3_2 = (randint(125, 155), randint(165, 195), randint(160, 190)) r = randint(9001,9500) seed(r) bg3_1 = (randint(30, 60), randint(110, 140), randint(95, 125)) s = randint(9501,10000) seed(s) ## g : 경계 (검은색) g = (0, 0, 0) w = randint(11500,12001) seed(w) ## h : 두정갑 투구 금속 (금색) h = (randint(180, 230), randint(100, 200), randint(0, 50)) x = randint(12001,12501) seed(x) ## i : 어두운 회색 & 검은색 i = (randint(0, 100), randint(0, 100), randint(0, 100)) x1 = randint(12001,12501) seed(x1) ## j : 투구 빛 (흰색) j = (randint(230, 256), randint(230, 256), randint(230, 256)) x2 = randint(12001,12501) seed(x2) ## k : 두정갑 투구 주 색 (어두움) k = (randint(0, 100), randint(0, 100), randint(0, 100)) x3 = randint(12001,12501) seed(x3) ## l : 경변갑 주 색 (어두운 갈색) ll = randint(0, 200) if ll<100: l1 = (randint(30, 90), randint(0, 30), randint(0, 30)) o1 = randint(7501,8000) seed(o1) l2 = (l1[0]+randint(10, 26), l1[1]+randint(10, 26), l1[2]+randint(0, 10)) p1 = randint(8001,8500) seed(p1) l3 = (l2[0]+randint(20, 26), l2[1]+randint(20, 26), l2[2]+randint(0, 10)) q1 = randint(8501,9000) seed(q1) else: l1 = (randint(30, 90), randint(0, 30), randint(0, 30)) o1 = randint(7501,8000) seed(o1) l2 = (l1[0]+randint(10, 26), l1[1]+randint(10, 26), l1[2]+randint(0, 10)) p1 = randint(8001,8500) seed(p1) l3 = (randint(90, 110), randint(90, 110), randint(90, 110)) q1 = randint(8501,9000) seed(q1) ## m : 경변갑 철판 (어두운 색 or 어두운 은색) m = (randint(0, 100), randint(0, 100), randint(0, 100)) x4 = randint(12001,12501) seed(x4) DooJungGap1 = [ [bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3], [bg1_1, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f2, f2, f2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_3, bg1_3], [bg1_3, bg1_1, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f2, f1, f1, f1, f2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_3], [bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, g, f2, bg1_3, f1, f2, h, f2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2], [bg1_3, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, g, f2, f2, f2, f1, f2, bg1_3, h, f1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f2, f1, f2, bg1_3, f1, h, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f1, f2, bg1_3, f1, bg1_3, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f1, g, g, f1, bg1_3, g, h, h, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, bg1_3, bg1_3, g, g, j, h, h, k, g, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, g, g, e1, k, h, h, k, e1, g, g, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, g, e2, g, k, k, h, h, k, k, e1, e2, g, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, g, e2, a2, g, k, k, h, h, k, k, k, e2, a2, g, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, a2, e2, e2, h, h, e1, e1, h, h, h, e2, a2, g, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, a2, a2, e2, e2, h, g, h, h, g, h, g, e2, a2, g, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, e1, a2, a2, e2, g, g, g, g, g, g, g, g, e2, a2, e1, g, g, g, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, e2, a1, e1, a2, e2, g, i, i, i, i, i, i, g, e2, a2, a2, a2, e1, e2, g, bg1_3, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_1, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, e2, a1, a2, e2, e2, g, i, i, i, i, i, i, g, e2, a1, a2, e1, a2, a2, e2, g, g, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, a2, e2, g, e2, e2, e2, e2, g, a1, e2, i, i, i, i, e2, g, e2, e2, a1, a2, a2, a2, e2, g, a2, g, bg1_3, bg1_3, bg1_1, bg1_1, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, a2, e2, a2, a2, a1, g, g, g, g, a1, a2, a1, e2, e2, e2, e2, a2, a1, g, e2, e2, e2, e2, e2, g, a1, e2, a2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_2, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, a2, a2, a2, a2, a2, e2, a1, a1, a1, a1, a2, a2, a2, a1, e2, e2, a2, a2, a2, a1, g, g, g, g, g, a1, a2, a2, a2, a2, g, g, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_1, bg1_2, bg1_2], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, a2, a2, a2, a2, a2, e2, a2, a2, a2, a2, e2, a2, e2, a2, e2, a2, e2, e2, a2, e1, a2, e2, a2, e1, a1, a1, e2, a2, e2, a2, a2, a2, a2, a2, g, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, a2, a2, a2, a2, a2, a2, a2, a2, a2, e2, a2, a2, a2, a2, a2, a2, a2, e2, e2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a1, a2, a2, a2, a2, a2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, a2, a2, a1, a2, a2, a2, a2, a1, e1, a2, a2, a2, e1, a2, e2, a2, e2, a2, e2, e2, a2, e2, a2, e1, a2, e2, a2, e2, a2, e1, a1, a2, a2, a2, a2, a2, a2, a2, g, g, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, g, e2, a2, a2, a1, a2, a2, a2, a2, a2, a1, a2, a2, a2, a2, a2, a2, a2, a2, a2, e2, e2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a1, a2, a2, a2, a2, a2, a2, a2, a2, e2, g, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, g, e2, a1, a1, a2, a2, a1, a2, a2, a1, e2, g, a2, e2, a2, e2, a2, e2, a2, e2, e2, a2, e2, a2, e2, a2, e2, a2, g, e2, a1, a2, a2, a2, a2, a2, a2, a2, a2, e2, g, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, g, e2, a1, a2, a2, a2, a1, a1, a2, g, g, a2, a2, a2, a1, a2, a2, a2, e2, e2, a2, a2, a2, a2, a2, a2, a2, g, g, a1, a2, a2, a1, a2, a2, a2, a2, e2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, g, e2, a1, a2, a2, a2, a2, a2, g, g, a2, a2, e2, a1, e1, a2, e2, a2, e2, e2, a2, e1, a2, e2, a2, e2, a2, a2, g, g, a1, a1, a2, a2, a2, a2, e2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, g, e2, a1, a2, a2, a2, a2, g, g, a2, a2, a2, a1, a2, a2, a2, a2, e2, e2, a2, a2, a2, a1, a2, a2, a1, a2, g, g, a2, a2, a2, a2, a2, e2, g, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, g, e2, a1, a2, a2, a2, g, a2, a2, e2, a1, e2, a2, e2, a1, a2, e2, e2, a2, a2, e2, a2, e1, a1, e1, a2, a2, g, a2, a2, a2, a2, e2, g, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3], [bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_3, g, e2, a1, a2, a2, g, g, a2, a2, a1, a2, a2, a1, a1, a2, a2, e2, e2, a2, a2, a1, a2, a2, a1, a2, a2, a2, g, a2, a2, a2, e2, g, g, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_1, bg1_3, g, e2, a2, a2, g, g, g, g, g, g, a1, a2, a2, a2, a2, e2, e2, a2, a1, a2, a2, a1, a2, a2, g, g, g, g, g, e2, e2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, e2, g, bg1_3, g, d1, d2, d2, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, d1, d1, g, bg1_3, bg1_3, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, bg1_3, bg1_3, g, d1, d2, d2, d2, d2, d2, d2, g, g, d2, d2, g, g, g, d2, d2, d1, d1, d2, d2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, d1, d1, d1, d2, d2, d2, g, g, g, g, g, g, d2, g, d2, d2, d2, d2, d2, d2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, g, d1, d1, d1, g, d2, d2, g, g, d1, d2, g, g, d2, d2, g, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_1, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, a1, a1, a2, g, g, g, g, d2, d1, g, g, d1, d2, g, g, g, g, a2, a1, a2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2], [bg1_1, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, a1, a1, e1, a1, a2, g, d2, d2, g, e2, e2, g, d1, d2, g, a2, a1, e1, a1, a2, g, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_1, bg1_1, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2], [bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, g, a2, a1, a2, a1, a2, g, d2, d1, g, e2, e2, g, d1, d2, g, g, a1, a2, a1, a2, g, bg1_1, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_3, bg1_3, bg1_1, bg1_1, bg1_2, bg1_2, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, g, a2, a2, e2, a1, g, g, d2, g, a1, e2, e2, a2, g, d1, d2, g, a2, e2, a2, a2, g, bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1], [bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, g, a2, a1, a2, a2, a2, g, d1, g, a1, e2, e2, a2, g, d1, d2, g, a2, a2, a1, a2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_1, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, a2, a1, e2, a2, a2, e1, g, a2, a1, e2, e2, a2, e2, g, d1, d2, g, e2, a2, a2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, g, a2, a2, a2, a2, a2, a2, a2, a2, a1, e2, e2, a2, a2, g, d1, d2, g, a2, a2, a2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_1, bg1_1, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, g, a2, a2, a2, e1, a2, a2, e2, a2, e2, a1, e2, e2, a2, e2, g, d1, d2, g, e1, a2, a2, a2, g, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_2, g, a2, a2, a2, a2, a2, a2, a2, a2, a2, a1, e2, e2, a2, a2, g, d1, d2, g, a2, a2, a2, a2, g, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_3, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_1, bg1_2, g, a2, a2, a2, e2, a2, a2, e2, a2, e2, a1, e2, e2, a2, e1, g, d1, d2, g, e2, a2, a2, a2, g, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_1, g, e2, e2, e2, a2, a2, a2, a2, a2, a2, a1, e2, e2, a2, a2, g, d1, d2, g, a2, e2, e2, e2, g, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, e2, e2, a2, a1, a1, a1, a1, e2, e2, a1, a1, g, d1, d2, g, e2, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_1, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, g, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, g, g, g, g, g, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], ] DooJungGap2 = [ [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, g, g, g, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, g, f2, f2, f2, g, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, g, f2, f1, f1, f1, f2, g, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, g, f2, bg2_2, f1, f2, h, f2, g, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, f2, f2, f2, f1, f2, bg2_2, h, f1, g, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, g, f2, f1, f2, bg2_2, f1, h, g, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, f1, f2, bg2_3, f1, bg2_2, g, g, bg2_2, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, f1, g, g, f1, bg2_3, g, h, h, g, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, bg2_3, bg2_2, g, g, j, h, h, k, g, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, g, g, e1, k, h, h, k, e1, g, g, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, e2, g, k, k, h, h, k, k, e1, e2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, e2, a2, g, k, k, h, h, k, k, k, e2, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, e2, e2, h, h, e1, e1, h, h, h, e2, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1], [bg2_1, bg2_1, bg2_1, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, a2, e2, e2, h, g, h, h, g, h, g, e2, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_1, bg2_1, bg2_1, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, e1, a2, a2, e2, g, g, g, g, g, g, g, g, e2, a2, e1, g, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, e2, a1, e1, a2, e2, g, i, i, i, i, i, i, g, e2, a2, a2, a2, e1, e2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, g, e2, a1, a2, e2, e2, g, i, i, i, i, i, i, g, e2, a1, a2, e1, a2, a2, e2, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, a2, e2, g, e2, e2, e2, e2, g, a1, e2, i, i, i, i, e2, g, e2, e2, a1, a2, a2, a2, e2, g, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, e2, a2, a2, a1, g, g, g, g, a1, a2, a1, e2, e2, e2, e2, a2, a1, g, e2, e2, e2, e2, e2, g, a1, e2, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, a2, a2, a2, a2, a2, e2, a1, a1, a1, a1, a2, a2, a2, a1, e2, e2, a2, a2, a2, a1, g, g, g, g, g, a1, a2, a2, a2, a2, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, a2, a2, a2, a2, e2, a2, a2, a2, a2, e2, a2, e2, a2, e2, a2, e2, e2, a2, e1, a2, e2, a2, e1, a1, a1, e2, a2, e2, a2, a2, a2, a2, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, a2, a2, a2, a2, a2, a2, a2, a2, e2, a2, a2, a2, a2, a2, a2, a2, e2, e2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a1, a2, a2, a2, a2, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, a2, a1, a2, a2, a2, a2, a1, e1, a2, a2, a2, e1, a2, e2, a2, e2, a2, e2, e2, a2, e2, a2, e1, a2, e2, a2, e2, a2, e1, a1, a2, a2, a2, a2, a2, a2, a2, g, g, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, g, e2, a2, a2, a1, a2, a2, a2, a2, a2, a1, a2, a2, a2, a2, a2, a2, a2, a2, a2, e2, e2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a1, a2, a2, a2, a2, a2, a2, a2, a2, e2, g, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, e2, a1, a1, a2, a2, a1, a2, a2, a1, e2, g, a2, e2, a2, e2, a2, e2, a2, e2, e2, a2, e2, a2, e2, a2, e2, a2, g, e2, a1, a2, a2, a2, a2, a2, a2, a2, a2, e2, g, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, e2, a1, a2, a2, a2, a1, a1, a2, g, g, a2, a2, a2, a1, a2, a2, a2, e2, e2, a2, a2, a2, a2, a2, a2, a2, g, g, a1, a2, a2, a1, a2, a2, a2, a2, e2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, e2, a1, a2, a2, a2, a2, a2, g, g, a2, a2, e2, a1, e1, a2, e2, a2, e2, e2, a2, e1, a2, e2, a2, e2, a2, a2, g, g, a1, a1, a2, a2, a2, a2, e2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, e2, a1, a2, a2, a2, a2, g, g, a2, a2, a2, a1, a2, a2, a2, a2, e2, e2, a2, a2, a2, a1, a2, a2, a1, a2, g, g, a2, a2, a2, a2, a2, e2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, e2, a1, a2, a2, a2, g, a2, a2, e2, a1, e2, a2, e2, a1, a2, e2, e2, a2, a2, e2, a2, e1, a1, e1, a2, a2, g, a2, a2, a2, a2, e2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, e2, a1, a2, a2, g, g, a2, a2, a1, a2, a2, a1, a1, a2, a2, e2, e2, a2, a2, a1, a2, a2, a1, a2, a2, a2, g, a2, a2, a2, e2, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, e2, a2, a2, g, g, g, g, g, g, a1, a2, a2, a2, a2, e2, e2, a2, a1, a2, a2, a1, a2, a2, g, g, g, g, g, e2, e2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, e2, g, bg2_3, g, d1, d2, d2, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, d1, d1, g, bg2_3, bg2_3, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, bg2_1, bg2_1, g, d1, d2, d2, d2, d2, d2, d2, g, g, d2, d2, g, g, g, d2, d2, d1, d1, d2, d2, g, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, d1, d1, d1, d2, d2, d2, g, g, g, g, g, g, d2, g, d2, d2, d2, d2, d2, d2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, g, g, d1, d1, d1, g, d2, d2, g, g, d1, d2, g, g, d2, d2, g, g, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a1, a1, a2, g, g, g, g, d2, d1, g, g, d1, d2, g, g, g, g, a2, a1, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a1, a1, e1, a1, a2, g, d2, d2, g, e2, e2, g, d1, d2, g, a2, a1, e1, a1, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_1, bg2_1, bg2_1, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, a1, a2, a1, a2, g, d2, d1, g, e2, e2, g, d1, d2, g, g, a1, a2, a1, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_1, bg2_1, bg2_1, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, a2, e2, a1, g, g, d2, g, a1, e2, e2, a2, g, d1, d2, g, a2, e2, a2, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, a1, a2, a2, a2, g, d1, g, a1, e2, e2, a2, g, d1, d2, g, a2, a2, a1, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, a1, e2, a2, a2, e1, g, a2, a1, e2, e2, a2, e2, g, d1, d2, g, e2, a2, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, a2, a2, a2, a2, a2, a2, a2, a2, a1, e2, e2, a2, a2, g, d1, d2, g, a2, a2, a2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, g, a2, a2, a2, e1, a2, a2, e2, a2, e2, a1, e2, e2, a2, e2, g, d1, d2, g, e1, a2, a2, a2, g, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, g, a2, a2, a2, a2, a2, a2, a2, a2, a2, a1, e2, e2, a2, a2, g, d1, d2, g, a2, a2, a2, a2, g, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, g, a2, a2, a2, e2, a2, a2, e2, a2, e2, a1, e2, e2, a2, e1, g, d1, d2, g, e2, a2, a2, a2, g, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, g, e2, e2, e2, a2, a2, a2, a2, a2, a2, a1, e2, e2, a2, a2, g, d1, d2, g, a2, e2, e2, e2, g, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, g, g, g, e2, e2, a2, a1, a1, a1, a1, e2, e2, a1, a1, g, d1, d2, g, e2, g, g, g, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, g, g, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, g, g, g, g, g, g, g, g, g, g, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], ] DooJungGap3 = [ [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, f2, f2, f2, g, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, g, f2, f1, f1, f1, f2, g, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, g, f2, bg3_2, f1, f2, h, f2, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, f2, f2, f2, f1, f2, bg3_2, h, f1, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, g, f2, f1, f2, bg3_1, f1, h, g, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, f1, f2, bg3_1, f1, bg3_1, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, f1, g, g, f1, bg3_2, g, h, h, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, bg3_2, bg3_2, g, g, j, h, h, k, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, g, e1, k, h, h, k, e1, g, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, e2, g, k, k, h, h, k, k, e1, e2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, e2, a2, g, k, k, h, h, k, k, k, e2, a2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, a2, e2, e2, h, h, e1, e1, h, h, h, e2, a2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, a2, a2, e2, e2, h, g, h, h, g, h, g, e2, a2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, e1, a2, a2, e2, g, g, g, g, g, g, g, g, e2, a2, e1, g, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, e2, a1, e1, a2, e2, g, i, i, i, i, i, i, g, e2, a2, a2, a2, e1, e2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, e2, a1, a2, e2, e2, g, i, i, i, i, i, i, g, e2, a1, a2, e1, a2, a2, e2, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, g, g, a2, e2, g, e2, e2, e2, e2, g, a1, e2, i, i, i, i, e2, g, e2, e2, a1, a2, a2, a2, e2, g, a2, g, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, g, a2, e2, a2, a2, a1, g, g, g, g, a1, a2, a1, e2, e2, e2, e2, a2, a1, g, e2, e2, e2, e2, e2, g, a1, e2, a2, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, g, a2, a2, a2, a2, a2, e2, a1, a1, a1, a1, a2, a2, a2, a1, e2, e2, a2, a2, a2, a1, g, g, g, g, g, a1, a2, a2, a2, a2, g, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, a2, a2, a2, a2, a2, e2, a2, a2, a2, a2, e2, a2, e2, a2, e2, a2, e2, e2, a2, e1, a2, e2, a2, e1, a1, a1, e2, a2, e2, a2, a2, a2, a2, a2, g, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, a2, a2, a2, a2, a2, a2, a2, a2, a2, e2, a2, a2, a2, a2, a2, a2, a2, e2, e2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a1, a2, a2, a2, a2, a2, g, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, a2, a2, a1, a2, a2, a2, a2, a1, e1, a2, a2, a2, e1, a2, e2, a2, e2, a2, e2, e2, a2, e2, a2, e1, a2, e2, a2, e2, a2, e1, a1, a2, a2, a2, a2, a2, a2, a2, g, g, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, g, e2, a2, a2, a1, a2, a2, a2, a2, a2, a1, a2, a2, a2, a2, a2, a2, a2, a2, a2, e2, e2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a2, a1, a2, a2, a2, a2, a2, a2, a2, a2, e2, g, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, e2, a1, a1, a2, a2, a1, a2, a2, a1, e2, g, a2, e2, a2, e2, a2, e2, a2, e2, e2, a2, e2, a2, e2, a2, e2, a2, g, e2, a1, a2, a2, a2, a2, a2, a2, a2, a2, e2, g, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, e2, a1, a2, a2, a2, a1, a1, a2, g, g, a2, a2, a2, a1, a2, a2, a2, e2, e2, a2, a2, a2, a2, a2, a2, a2, g, g, a1, a2, a2, a1, a2, a2, a2, a2, e2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, g, e2, a1, a2, a2, a2, a2, a2, g, g, a2, a2, e2, a1, e1, a2, e2, a2, e2, e2, a2, e1, a2, e2, a2, e2, a2, a2, g, g, a1, a1, a2, a2, a2, a2, e2, g, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, g, e2, a1, a2, a2, a2, a2, g, g, a2, a2, a2, a1, a2, a2, a2, a2, e2, e2, a2, a2, a2, a1, a2, a2, a1, a2, g, g, a2, a2, a2, a2, a2, e2, g, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, g, e2, a1, a2, a2, a2, g, a2, a2, e2, a1, e2, a2, e2, a1, a2, e2, e2, a2, a2, e2, a2, e1, a1, e1, a2, a2, g, a2, a2, a2, a2, e2, g, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, e2, a1, a2, a2, g, g, a2, a2, a1, a2, a2, a1, a1, a2, a2, e2, e2, a2, a2, a1, a2, a2, a1, a2, a2, a2, g, a2, a2, a2, e2, g, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, g, e2, a2, a2, g, g, g, g, g, g, a1, a2, a2, a2, a2, e2, e2, a2, a1, a2, a2, a1, a2, a2, g, g, g, g, g, e2, e2, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, g, e2, g, bg3_1, g, d1, d2, d2, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, d1, d1, g, bg3_1, bg3_1, g, g, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, g, bg3_2, bg3_1, g, d1, d2, d2, d2, d2, d2, d2, g, g, d2, d2, g, g, g, d2, d2, d1, d1, d2, d2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, d1, d1, d1, d2, d2, d2, g, g, g, g, g, g, d2, g, d2, d2, d2, d2, d2, d2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, g, d1, d1, d1, g, d2, d2, g, g, d1, d2, g, g, d2, d2, g, g, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, a1, a1, a2, g, g, g, g, d2, d1, g, g, d1, d2, g, g, g, g, a2, a1, a2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, a1, a1, e1, a1, a2, g, d2, d2, g, e2, e2, g, d1, d2, g, a2, a1, e1, a1, a2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, a2, a1, a2, a1, a2, g, d2, d1, g, e2, e2, g, d1, d2, g, g, a1, a2, a1, a2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, a2, a2, e2, a1, g, g, d2, g, a1, e2, e2, a2, g, d1, d2, g, a2, e2, a2, a2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, a2, a1, a2, a2, a2, g, d1, g, a1, e2, e2, a2, g, d1, d2, g, a2, a2, a1, a2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, a2, a1, e2, a2, a2, e1, g, a2, a1, e2, e2, a2, e2, g, d1, d2, g, e2, a2, a2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, a2, a2, a2, a2, a2, a2, a2, a2, a1, e2, e2, a2, a2, g, d1, d2, g, a2, a2, a2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, a2, a2, a2, e1, a2, a2, e2, a2, e2, a1, e2, e2, a2, e2, g, d1, d2, g, e1, a2, a2, a2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, a2, a2, a2, a2, a2, a2, a2, a2, a2, a1, e2, e2, a2, a2, g, d1, d2, g, a2, a2, a2, a2, g, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, a2, a2, a2, e2, a2, a2, e2, a2, e2, a1, e2, e2, a2, e1, g, d1, d2, g, e2, a2, a2, a2, g, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, g, e2, e2, e2, a2, a2, a2, a2, a2, a2, a1, e2, e2, a2, a2, g, d1, d2, g, a2, e2, e2, e2, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, g, g, e2, e2, a2, a1, a1, a1, a1, e2, e2, a1, a1, g, d1, d2, g, e2, g, g, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, g, g, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, g, g, g, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, g, g, g, g, g, g, g, g, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], ] GyungByunGap1 = [ [bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3], [bg1_1, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f2, f2, f2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_3, bg1_3], [bg1_3, bg1_1, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f2, f1, f1, f1, f2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_3], [bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, g, f2, bg1_3, f1, f2, e2, f2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2], [bg1_3, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, g, f2, f2, f2, f1, f2, bg1_3, e2, f1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f2, f1, f2, bg1_3, f1, e2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f1, f2, bg1_3, f1, bg1_3, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, f1, g, g, f1, bg1_3, g, e2, e2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, bg1_3, bg1_3, bg1_3, g, j, e2, e2, e2, g, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, g, e1, e2, e2, e2, e2, e2, g, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, g, e1, e2, e2, e2, e2, e2, e2, e2, g, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, g, e1, e2, e2, e2, e2, e2, e2, e2, g, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, l3, e1, e1, e1, e2, e2, e1, e1, e2, l3, g, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, l3, e1, g, g, e1, e1, g, g, e1, l3, g, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, l3, l3, g, i, i, g, g, i, i, g, l3, l3, g, bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, l3, l3, l3, g, i, i, i, i, i, i, g, l1, l3, g, g, g, g, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_1, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, l1, g, l3, l3, l1, g, i, i, i, i, i, i, g, l1, l3, g, l3, l2, l3, g, g, g, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, l3, l3, l2, l1, g, l1, l1, g, l1, g, i, i, i, i, g, g, l1, l3, l3, g, l3, l2, l3, l3, l2, g, bg1_3, bg1_3, bg1_1, bg1_1, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, l2, l3, l3, l2, l3, l1, g, g, g, l1, l3, l1, g, g, g, g, l3, l1, g, l1, g, l3, l2, l2, l3, l2, l3, l3, g, g, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_2, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, l3, l3, l2, l3, l2, l3, l2, l3, l1, l1, l1, l3, l2, l3, l1, l3, g, l3, l2, l3, l1, g, l3, l2, l3, l2, l3, l3, l2, l2, l3, l3, g, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_1, bg1_2, bg1_2], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, l3, l3, l2, l3, l2, l3, l2, l3, l2, l3, m, m, l3, m, m, l3, l2, g, l2, l3, m, m, l3, m, m, l3, l3, l2, l3, l3, l3, l3, l2, l3, g, g, bg1_1, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, l3, l2, l3, l3, l2, l3, l3, l2, l3, l3, l2, m, m, l2, m, m, l2, l3, g, l3, l3, m, m, l2, m, m, l3, l2, l3, l2, l1, l2, l3, l3, l2, l3, l2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, l3, l2, l3, l3, l2, l2, l3, l1, l3, l2, l2, l3, m, m, l3, m, m, l3, l2, g, l3, l2, m, m, l3, m, m, l3, l3, l3, l1, l3, l3, l2, l3, l3, l2, l3, l2, g, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, g, l1, l2, l3, l1, l3, l2, l3, l2, l3, l1, l3, l3, l2, l3, l2, l3, l3, l2, l3, g, l3, l2, l3, l3, l2, l3, l3, l3, l3, l2, l3, l1, l3, l2, l3, l2, l2, l3, l2, l3, l1, g, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, g, l1, l2, l3, l2, l3, l1, l3, l2, l1, l2, g, m, m, l3, m, m, l3, l3, g, l2, l3, m, m, l3, m, m, l2, g, l3, l1, l3, l2, l3, l2, l3, l3, l2, l3, l1, g, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, g, l1, l2, l2, l3, l2, l1, l1, l3, g, g, m, m, l2, m, m, l2, l3, g, l3, l2, m, m, l2, m, m, l3, g, g, l1, l2, l3, l1, l3, l3, l2, l3, l1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, g, l1, l3, l2, l2, l3, l3, l2, g, g, l3, m, m, l3, m, m, l3, l2, g, l2, l3, m, m, l3, m, m, l2, l3, g, g, l1, l1, l3, l2, l2, l3, l1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, g, l1, l3, l2, l3, l2, l3, g, g, l2, l3, l2, l3, l3, l2, l3, l3, g, l2, l3, l2, l3, l2, l3, l2, l3, l3, g, g, l3, l3, l2, l3, l3, l1, g, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, g, l1, l3, l2, l3, l3, g, l3, l3, m, m, l2, m, m, l2, l3, g, l3, l2, m, m, l3, m, m, l3, l2, l3, g, l2, l3, l2, l3, l1, g, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3], [bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_3, g, l1, l2, l3, l2, g, g, l2, l3, m, m, l3, m, m, l3, l2, g, l3, l3, m, m, l2, m, m, l2, l3, l2, g, l3, l2, l3, l1, g, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_1, bg1_3, g, l1, l3, l1, g, g, g, g, g, g, l2, m, m, l2, l3, g, l2, l3, m, m, l3, m, m, l3, g, g, g, g, g, l1, l1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, l1, g, bg1_3, g, d1, d2, d2, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, d1, d1, g, bg1_3, bg1_3, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, bg1_3, bg1_3, g, d1, d2, d2, d2, d2, d2, d2, g, g, d2, d2, g, g, g, d2, d2, d1, d1, d2, d2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, d1, d1, d1, d2, d2, d2, g, g, g, g, g, g, d2, g, d2, d2, d2, d2, d2, d2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, g, d1, d1, d1, g, d2, d2, g, g, d1, d2, g, g, d2, d2, g, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_1, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, l1, l1, l3, g, g, g, g, d2, d1, g, g, d1, d2, g, g, g, g, l3, l3, l3, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2], [bg1_1, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, l1, l1, l2, m, m, g, d2, d2, g, g, l3, g, d1, d2, g, m, m, l3, l2, l3, g, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_1, bg1_1, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2], [bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, g, l3, l1, l3, m, m, g, d2, d1, g, l1, g, g, d1, d2, g, g, m, m, l3, l2, g, bg1_1, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_3, bg1_3, bg1_1, bg1_1, bg1_2, bg1_2, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, g, l2, l3, l2, m, m, g, d2, g, l3, l1, g, l3, g, d1, d2, g, m, m, l3, l3, g, bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1], [bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, g, l3, l1, l3, l3, l2, g, d1, g, l2, l1, g, l2, g, d1, d2, g, l2, l3, l2, l3, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_1, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, l2, l1, l2, m, m, l2, g, g, l3, l1, g, l3, l2, g, d1, d2, g, m, l3, l3, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, g, l3, l2, l3, m, m, l3, m, m, l2, l1, g, l2, l3, g, d1, d2, g, m, l3, l2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_1, bg1_1, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, g, l3, l2, l3, l3, m, m, l2, m, m, l3, l1, g, l3, l3, g, d1, d2, g, m, l3, l3, l2, g, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_2, g, l3, l3, l2, l2, l3, l2, l3, l2, l3, l2, l1, g, l3, l2, g, d1, d2, g, l2, l3, l2, l3, g, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_3, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_1, bg1_2, g, l2, l3, l3, m, m, l3, m, m, l3, l1, g, l3, l2, m, g, g, g, g, l3, l2, l3, l2, g, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_1, g, l1, l1, l1, m, m, l2, m, m, l2, l1, g, l2, l3, m, m, l2, m, m, l3, l1, l1, l1, g, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, m, m, l3, m, m, l3, l1, g, l3, l2, m, m, l3, m, m, l1, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_1, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, l1, l1, l1, l1, l1, g, l1, l1, l1, l1, l1, l1, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, g, g, g, g, g, g, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], ] GyungByunGap2 = [ [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, m, bg2_3, g, g, g, bg2_3, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, g, f2, f2, f2, g, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, g, f2, f1, f1, f1, f2, g, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, g, f2, bg2_2, f1, f2, e2, f2, g, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, f2, f2, f2, f1, f2, bg2_2, e2, f1, g, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, g, f2, f1, f2, bg2_2, f1, e2, g, bg2_3, bg2_3, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, f1, f2, bg2_3, f1, bg2_2, g, g, bg2_2, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, f1, g, g, f1, bg2_3, g, e2, e2, g, bg2_3, bg2_3, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, bg2_3, bg2_2, bg2_2, g, j, e2, e2, e2, g, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_2, g, e1, e2, e2, e2, e2, e2, g, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, g, e1, e2, e2, e2, e2, e2, e2, e2, g, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, e1, e2, e2, e2, e2, e2, e2, e2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, e1, e1, e1, e2, e2, e1, e1, e2, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m], [m, m, m, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, e1, g, g, e1, e1, g, g, e1, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, m, m, m, m, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, l3, g, i, i, g, g, i, i, g, l3, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, l3, l3, l3, g, i, i, i, i, i, i, g, l1, l3, g, g, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, g, l1, g, l3, l3, l1, g, i, i, i, i, i, i, g, l1, l3, g, l3, l2, l3, g, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, l3, l3, l2, l1, g, l1, l1, g, l1, g, i, i, i, i, g, g, l1, l3, l3, g, l3, l2, l3, l3, l2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, l2, l3, l3, l2, l3, l1, g, g, g, l1, l3, l1, g, g, g, g, l3, l1, g, l1, g, l3, l2, l2, l3, l2, l3, l3, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, l3, l2, l3, l2, l3, l2, l3, l1, l1, l1, l3, l2, l3, l1, l3, g, l3, l2, l3, l1, g, l3, l2, l3, l2, l3, l3, l2, l2, l3, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, l3, l2, l3, l2, l3, l2, l3, l2, l3, m, m, l3, m, m, l3, l2, g, l2, l3, m, m, l3, m, m, l3, l3, l2, l3, l3, l3, l3, l2, l3, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, l2, l3, l3, l2, l3, l3, l2, l3, l3, l2, m, m, l2, m, m, l2, l3, g, l3, l3, m, m, l2, m, m, l3, l2, l3, l2, l1, l2, l3, l3, l2, l3, l2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, l2, l3, l3, l2, l2, l3, l1, l3, l2, l2, l3, m, m, l3, m, m, l3, l2, g, l3, l2, m, m, l3, m, m, l3, l3, l3, l1, l3, l3, l2, l3, l3, l2, l3, l2, g, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, g, l1, l2, l3, l1, l3, l2, l3, l2, l3, l1, l3, l3, l2, l3, l2, l3, l3, l2, l3, g, l3, l2, l3, l3, l2, l3, l3, l3, l3, l2, l3, l1, l3, l2, l3, l2, l2, l3, l2, l3, l1, g, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l1, l2, l3, l2, l3, l1, l3, l2, l1, l2, g, m, m, l3, m, m, l3, l3, g, l2, l3, m, m, l3, m, m, l2, g, l3, l1, l3, l2, l3, l2, l3, l3, l2, l3, l1, g, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l1, l2, l2, l3, l2, l1, l1, l3, g, g, m, m, l2, m, m, l2, l3, g, l3, l2, m, m, l2, m, m, l3, g, g, l1, l2, l3, l1, l3, l3, l2, l3, l1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l1, l3, l2, l2, l3, l3, l2, g, g, l3, m, m, l3, m, m, l3, l2, g, l2, l3, m, m, l3, m, m, l2, l3, g, g, l1, l1, l3, l2, l2, l3, l1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, l1, l3, l2, l3, l2, l3, g, g, l2, l3, l2, l3, l3, l2, l3, l3, g, l2, l3, l2, l3, l2, l3, l2, l3, l3, g, g, l3, l3, l2, l3, l3, l1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, l1, l3, l2, l3, l3, g, l3, l3, m, m, l2, m, m, l2, l3, g, l3, l2, m, m, l3, m, m, l3, l2, l3, g, l2, l3, l2, l3, l1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, l1, l2, l3, l2, g, g, l2, l3, m, m, l3, m, m, l3, l2, g, l3, l3, m, m, l2, m, m, l2, l3, l2, g, l3, l2, l3, l1, g, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, l1, l3, l1, g, g, g, g, g, g, l2, m, m, l2, l3, g, l2, l3, m, m, l3, m, m, l3, g, g, g, g, g, l1, l1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, l1, g, bg2_3, g, d1, d2, d2, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, d1, d1, g, bg2_3, bg2_3, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, m, m, g, d1, d2, d2, d2, d2, d2, d2, g, g, d2, d2, g, g, g, d2, d2, d1, d1, d2, d2, g, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, d1, d1, d1, d2, d2, d2, g, g, g, g, g, g, d2, g, d2, d2, d2, d2, d2, d2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, g, g, d1, d1, d1, g, d2, d2, g, g, d1, d2, g, g, d2, d2, g, g, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l1, l1, l3, g, g, g, g, d2, d1, g, g, d1, d2, g, g, g, g, l3, l3, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l1, l1, l2, m, m, g, d2, d2, g, g, l3, g, d1, d2, g, m, m, l3, l2, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [m, m, m, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, l1, l3, m, m, g, d2, d1, g, l1, g, g, d1, d2, g, g, m, m, l3, l2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, m, m, m, m, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l2, l3, l2, m, m, g, d2, g, l3, l1, g, l3, g, d1, d2, g, m, m, l3, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, l1, l3, l3, l2, g, d1, g, l2, l1, g, l2, g, d1, d2, g, l2, l3, l2, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l2, l1, l2, m, m, l2, g, g, l3, l1, g, l3, l2, g, d1, d2, g, m, l3, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, l2, l3, m, m, l3, m, m, l2, l1, g, l2, l3, g, d1, d2, g, m, l3, l2, g, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, g, l3, l2, l3, l3, m, m, l2, m, m, l3, l1, g, l3, l3, g, d1, d2, g, m, l3, l3, l2, g, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, g, l3, l3, l2, l2, l3, l2, l3, l2, l3, l2, l1, g, l3, l2, g, d1, d2, g, l2, l3, l2, l3, g, bg2_3, bg2_3, m, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, g, l2, l3, l3, m, m, l3, m, m, l3, l1, g, l3, l2, m, g, g, g, g, l3, l2, l3, l2, g, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, g, l1, l1, l1, m, m, l2, m, m, l2, l1, g, l2, l3, m, m, l2, m, m, l3, l1, l1, l1, g, bg2_3, bg2_3, m, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, g, g, g, m, m, l3, m, m, l3, l1, g, l3, l2, m, m, l3, m, m, l1, g, g, g, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, l1, l1, l1, l1, l1, g, l1, l1, l1, l1, l1, l1, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, g, g, g, g, g, g, g, g, g, g, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, m, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], ] GyungByunGap3 = [ [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, f2, f2, f2, g, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, g, f2, f1, f1, f1, f2, g, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, g, f2, bg3_2, f1, f2, e2, f2, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, f2, f2, f2, f1, f2, bg3_2, e2, f1, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, g, f2, f1, f2, bg3_1, f1, e2, g, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, f1, f2, bg3_1, f1, bg3_1, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, f1, g, g, f1, bg3_2, g, e2, e2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, bg3_2, bg3_2, bg3_2, g, j, e2, e2, e2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, e1, e2, e2, e2, e2, e2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, e1, e2, e2, e2, e2, e2, e2, e2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, e1, e2, e2, e2, e2, e2, e2, e2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l3, e1, e1, e1, e2, e2, e1, e1, e2, l3, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, l3, e1, g, g, e1, e1, g, g, e1, l3, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l3, l3, g, i, i, g, g, i, i, g, l3, l3, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, g, l3, l3, l3, g, i, i, i, i, i, i, g, l1, l3, g, g, g, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, l1, g, l3, l3, l1, g, i, i, i, i, i, i, g, l1, l3, g, l3, l2, l3, g, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, g, g, l3, l3, l2, l1, g, l1, l1, g, l1, g, i, i, i, i, g, g, l1, l3, l3, g, l3, l2, l3, l3, l2, g, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, g, g, l2, l3, l3, l2, l3, l1, g, g, g, l1, l3, l1, g, g, g, g, l3, l1, g, l1, g, l3, l2, l2, l3, l2, l3, l3, g, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, l3, l3, l2, l3, l2, l3, l2, l3, l1, l1, l1, l3, l2, l3, l1, l3, g, l3, l2, l3, l1, g, l3, l2, l3, l2, l3, l3, l2, l2, l3, l3, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, l3, l3, l2, l3, l2, l3, l2, l3, l2, l3, m, m, l3, m, m, l3, l2, g, l2, l3, m, m, l3, m, m, l3, l3, l2, l3, l3, l3, l3, l2, l3, g, g, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, l3, l2, l3, l3, l2, l3, l3, l2, l3, l3, l2, m, m, l2, m, m, l2, l3, g, l3, l3, m, m, l2, m, m, l3, l2, l3, l2, l1, l2, l3, l3, l2, l3, l2, g, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, l3, l2, l3, l3, l2, l2, l3, l1, l3, l2, l2, l3, m, m, l3, m, m, l3, l2, g, l3, l2, m, m, l3, m, m, l3, l3, l3, l1, l3, l3, l2, l3, l3, l2, l3, l2, g, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, g, l1, l2, l3, l1, l3, l2, l3, l2, l3, l1, l3, l3, l2, l3, l2, l3, l3, l2, l3, g, l3, l2, l3, l3, l2, l3, l3, l3, l3, l2, l3, l1, l3, l2, l3, l2, l2, l3, l2, l3, l1, g, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, l1, l2, l3, l2, l3, l1, l3, l2, l1, l2, g, m, m, l3, m, m, l3, l3, g, l2, l3, m, m, l3, m, m, l2, g, l3, l1, l3, l2, l3, l2, l3, l3, l2, l3, l1, g, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, l1, l2, l2, l3, l2, l1, l1, l3, g, g, m, m, l2, m, m, l2, l3, g, l3, l2, m, m, l2, m, m, l3, g, g, l1, l2, l3, l1, l3, l3, l2, l3, l1, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, g, l1, l3, l2, l2, l3, l3, l2, g, g, l3, m, m, l3, m, m, l3, l2, g, l2, l3, m, m, l3, m, m, l2, l3, g, g, l1, l1, l3, l2, l2, l3, l1, g, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, g, l1, l3, l2, l3, l2, l3, g, g, l2, l3, l2, l3, l3, l2, l3, l3, g, l2, l3, l2, l3, l2, l3, l2, l3, l3, g, g, l3, l3, l2, l3, l3, l1, g, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, g, l1, l3, l2, l3, l3, g, l3, l3, m, m, l2, m, m, l2, l3, g, l3, l2, m, m, l3, m, m, l3, l2, l3, g, l2, l3, l2, l3, l1, g, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, l1, l2, l3, l2, g, g, l2, l3, m, m, l3, m, m, l3, l2, g, l3, l3, m, m, l2, m, m, l2, l3, l2, g, l3, l2, l3, l1, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, g, l1, l3, l1, g, g, g, g, g, g, l2, m, m, l2, l3, g, l2, l3, m, m, l3, m, m, l3, g, g, g, g, g, l1, l1, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, g, l1, g, bg3_1, g, d1, d2, d2, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, d1, d1, g, bg3_1, bg3_1, g, g, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, g, bg3_2, bg3_1, g, d1, d2, d2, d2, d2, d2, d2, g, g, d2, d2, g, g, g, d2, d2, d1, d1, d2, d2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, d1, d1, d1, d2, d2, d2, g, g, g, g, g, g, d2, g, d2, d2, d2, d2, d2, d2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, g, d1, d1, d1, g, d2, d2, g, g, d1, d2, g, g, d2, d2, g, g, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, l1, l1, l3, g, g, g, g, d2, d1, g, g, d1, d2, g, g, g, g, l3, l3, l3, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l1, l1, l2, m, m, g, d2, d2, g, g, l3, g, d1, d2, g, m, m, l3, l2, l3, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, l3, l1, l3, m, m, g, d2, d1, g, l1, g, g, d1, d2, g, g, m, m, l3, l2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l2, l3, l2, m, m, g, d2, g, l3, l1, g, l3, g, d1, d2, g, m, m, l3, l3, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l3, l1, l3, l3, l2, g, d1, g, l2, l1, g, l2, g, d1, d2, g, l2, l3, l2, l3, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l2, l1, l2, m, m, l2, g, g, l3, l1, g, l3, l2, g, d1, d2, g, m, l3, l3, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, l3, l2, l3, m, m, l3, m, m, l2, l1, g, l2, l3, g, d1, d2, g, m, l3, l2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l3, l2, l3, l3, m, m, l2, m, m, l3, l1, g, l3, l3, g, d1, d2, g, m, l3, l3, l2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, l3, l3, l2, l2, l3, l2, l3, l2, l3, l2, l1, g, l3, l2, g, d1, d2, g, l2, l3, l2, l3, g, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l2, l3, l3, m, m, l3, m, m, l3, l1, g, l3, l2, m, g, g, g, g, l3, l2, l3, l2, g, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, g, l1, l1, l1, m, m, l2, m, m, l2, l1, g, l2, l3, m, m, l2, m, m, l3, l1, l1, l1, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, g, g, m, m, l3, m, m, l3, l1, g, l3, l2, m, m, l3, m, m, l1, g, g, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, g, g, l1, l1, l1, l1, l1, g, l1, l1, l1, l1, l1, l1, g, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, g, g, g, g, g, g, g, g, g, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], ] ChalGap1 = [ [bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3], [bg1_1, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_3, bg1_3], [bg1_3, bg1_1, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_3], [bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2], [bg1_3, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, b2, b2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, j, b2, b2, b2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, b1, b2, b2, b2, b2, b2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, b1, b2, b2, b2, b2, b2, b2, b2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, g, b1, b2, b2, b2, b2, b2, b2, b2, g, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, g, l3, g, b1, b2, b2, b2, b2, b2, g, l3, g, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, g, l3, g, b1, b1, b1, b1, b1, b1, g, l3, g, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, l3, l3, g, g, g, g, g, g, g, g, l3, l3, g, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, l3, l3, l3, g, i, i, i, i, i, i, g, l1, l3, g, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, c1, g, l3, l3, l1, g, i, i, i, i, i, i, g, l1, l3, g, c1, c1, c2, g, g, g, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, g, g, c1, c1, c1, c2, g, l1, l1, g, c1, g, i, i, i, i, g, g, l1, l3, l3, g, c2, c1, c1, c2, c1, g, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_1, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, g, g, c1, c2, c1, c2, c1, c2, g, g, g, c2, c1, c2, g, g, g, g, c1, c2, g, l1, g, c2, c1, c1, c2, c1, c1, c2, g, g, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, c2, c1, c1, c2, c1, c1, c2, c1, c1, c2, g, bg1_1, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c1, g, g, bg1_2, bg1_2, bg1_1, bg1_3, bg1_2, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, c2, c1, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, g, bg1_1, bg1_3, bg1_1, bg1_2, bg1_2], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, c2, c1, c2, c1, c1, c2, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, c1, g, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, c2, c1, c2, c1, c1, c2, c1, g, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, c2, c1, c1, c2, c1, c2, c1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, c2, c1, c2, c1, c1, g, bg1_3, bg1_3, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg1_3, bg1_3, g, c1, c2, c1, c2, c1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, g, c2, c1, c2, g, bg1_3, bg1_3, bg1_3, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, bg1_3, bg1_3, bg1_3, g, c1, c2, c1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, g, c2, g, bg1_3, bg1_3, bg1_3, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg1_3, bg1_3, bg1_3, g, c1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_2, g, bg1_2, bg1_3, bg1_3, g, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, bg1_3, bg1_3, bg1_3, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_3, bg1_3, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_3, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, g, g, g, g, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, g, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3], [bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1, g, d1, d2, d2, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, d1, d1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, d1, d2, d2, d2, d2, d2, d2, g, g, d2, d2, g, g, g, d2, d2, d1, d1, d2, d2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, d1, d1, d1, d2, d2, d2, g, g, g, g, g, g, d2, g, d2, d2, d2, d2, d2, d2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, g, g, g, d1, d1, d1, g, d2, d2, g, g, d1, d2, g, g, d2, d2, g, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, c2, c1, c2, g, g, g, g, d2, d1, g, g, d1, d2, g, g, g, g, c1, c2, c1, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, g, c1, c2, c1, c2, c1, g, d2, d2, g, g, c1, g, d1, d2, g, c2, c1, c2, c1, c2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_1, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, c1, c2, c1, c2, c1, g, d2, d1, g, c2, c1, g, d1, d2, g, g, c1, c2, c1, c2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2], [bg1_1, bg1_3, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, g, c2, c1, c2, c1, c2, g, d2, g, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, c1, g, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_1, bg1_1, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2], [bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, g, c2, c1, c2, c1, c2, g, d1, g, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, c1, g, bg1_1, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_3, bg1_3, bg1_1, bg1_1, bg1_2, bg1_2, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, g, c1, c2, c1, c2, c1, c2, g, c2, c1, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, g, bg1_3, bg1_1, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1], [bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_1, bg1_2, bg1_3, bg1_3, bg1_3, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, d1, d2, g, c1, c2, c1, c2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_3, bg1_3, bg1_3, bg1_1, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, d1, d2, g, c1, c2, c1, c2, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_1, bg1_1, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, c1, c2, c1, c2, c1, g, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_1, bg1_3, bg1_2, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_3, bg1_1, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_1, bg1_2, bg1_2, g, g, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, g, g, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1, bg1_2, bg1_2, bg1_2, g, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, g, g, g, g, g, g, g, g, g, g, g, g, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_1, bg1_2, bg1_2, bg1_2, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_2, bg1_3, bg1_2, bg1_2, bg1_2, bg1_2, bg1_2, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_1, bg1_1, bg1_1, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], [bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3, bg1_3], ] ChalGap2 = [ [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, g, g, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, g, b2, b2, g, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, g, j, b2, b2, b2, g, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, g, b1, b2, b2, b2, b2, b2, g, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, g, b1, b2, b2, b2, b2, b2, b2, b2, g, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, g, b1, b2, b2, b2, b2, b2, b2, b2, g, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, g, l3, g, b1, b2, b2, b2, b2, b2, g, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, g, b1, b1, b1, b1, b1, b1, g, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, l3, l3, g, g, g, g, g, g, g, g, l3, l3, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1], [bg2_1, bg2_1, bg2_1, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, l3, l3, l3, g, i, i, i, i, i, i, g, l1, l3, g, g, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_1, bg2_1, bg2_1, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, g, c1, g, l3, l3, l1, g, i, i, i, i, i, i, g, l1, l3, g, c1, c1, c2, g, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, c1, c1, c1, c2, g, l1, l1, g, c1, g, i, i, i, i, g, g, l1, l3, l3, g, c2, c1, c1, c2, c1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, c1, c2, c1, c2, c1, c2, g, g, g, c2, c1, c2, g, g, g, g, c1, c2, g, l1, g, c2, c1, c1, c2, c1, c1, c2, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, c2, c1, c1, c2, c1, c1, c2, c1, c1, c2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c1, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c2, c1, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c2, c1, c2, c1, c1, c2, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, c1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c2, c1, c2, c1, c1, c2, c1, g, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, c2, c1, c1, c2, c1, c2, c1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c2, c1, c2, c1, c1, g, bg2_3, bg2_2, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg2_3, bg2_3, g, c1, c2, c1, c2, c1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, g, c2, c1, c2, g, bg2_2, bg2_3, bg2_3, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, bg2_3, bg2_2, bg2_3, g, c1, c2, c1, g, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, g, c2, g, bg2_2, bg2_2, bg2_2, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg2_2, bg2_2, bg2_3, g, c1, g, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, g, bg2_2, bg2_2, bg2_2, g, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, bg2_2, bg2_2, bg2_3, g, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, g, g, g, g, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, g, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, g, d1, d2, d2, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, d1, d1, g, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, g, d1, d2, d2, d2, d2, d2, d2, g, g, d2, d2, g, g, g, d2, d2, d1, d1, d2, d2, g, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, g, d1, d1, d1, d2, d2, d2, g, g, g, g, g, g, d2, g, d2, d2, d2, d2, d2, d2, g, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_1, g, g, g, g, d1, d1, d1, g, d2, d2, g, g, d1, d2, g, g, d2, d2, g, g, g, g, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c2, c1, c2, g, g, g, g, d2, d1, g, g, d1, d2, g, g, g, g, c1, c2, c1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c1, c2, c1, c2, c1, g, d2, d2, g, g, c1, g, d1, d2, g, c2, c1, c2, c1, c2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c1, c2, c1, c2, c1, g, d2, d1, g, c2, c1, g, d1, d2, g, g, c1, c2, c1, c2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c2, c1, c2, c1, c2, g, d2, g, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, c1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3], [bg2_1, bg2_1, bg2_1, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c2, c1, c2, c1, c2, g, d1, g, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, c1, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_1, bg2_1, bg2_1, bg2_3], [bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c1, c2, c1, c2, c1, c2, g, c2, c1, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, d1, d2, g, c1, c2, c1, c2, g, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, d1, d2, g, c1, c2, c1, c2, g, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, c1, c2, c1, c2, c1, g, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, g, g, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, g, g, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_2, bg2_2, bg2_3], [bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, g, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, g, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3], [bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, g, g, g, g, g, g, g, g, g, g, g, g, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_2, bg2_3, bg2_3, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_2, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_2, bg2_2, bg2_3, bg2_3, bg2_3, bg2_2, bg2_2], [bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_3, bg2_1, bg2_3, bg2_3, bg2_3, bg2_2, bg2_3, bg2_2, bg2_3, bg2_3], ] ChalGap3 = [ [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, g, b2, b2, g, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, g, j, b2, b2, b2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, b1, b2, b2, b2, b2, b2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, b1, b2, b2, b2, b2, b2, b2, b2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, b1, b2, b2, b2, b2, b2, b2, b2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l3, g, b1, b2, b2, b2, b2, b2, g, l3, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l3, g, b1, b1, b1, b1, b1, b1, g, l3, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, l3, l3, g, g, g, g, g, g, g, g, l3, l3, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, g, l3, l3, l3, g, i, i, i, i, i, i, g, l1, l3, g, g, g, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, c1, g, l3, l3, l1, g, i, i, i, i, i, i, g, l1, l3, g, c1, c1, c2, g, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, g, c1, c1, c1, c2, g, l1, l1, g, c1, g, i, i, i, i, g, g, l1, l3, l3, g, c2, c1, c1, c2, c1, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, c1, c2, c1, c2, c1, c2, g, g, g, c2, c1, c2, g, g, g, g, c1, c2, g, l1, g, c2, c1, c1, c2, c1, c1, c2, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, c2, c1, c1, c2, c1, c1, c2, c1, c1, c2, g, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, g, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c1, g, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, c2, c1, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, c2, c1, c2, c1, c1, c2, c1, c2, c1, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c1, c2, c1, c1, c2, c1, c2, c1, g, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, g, c2, c1, c2, c1, c1, c2, c1, g, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, c2, c1, c1, c2, c1, c2, c1, g, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, g, c2, c1, c2, c1, c1, g, bg3_2, bg3_2, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg3_2, bg3_2, g, c1, c2, c1, c2, c1, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, c2, c1, c2, g, bg3_1, bg3_1, bg3_1, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, bg3_1, bg3_1, bg3_1, g, c1, c2, c1, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, g, c2, g, bg3_2, bg3_2, bg3_2, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg3_2, bg3_2, bg3_2, g, c1, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, bg3_1, bg3_1, bg3_1, g, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, bg3_1, bg3_1, bg3_1, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, g, g, g, g, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, g, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, d1, d2, d2, g, g, g, g, g, g, g, g, g, g, g, g, g, g, g, d1, d1, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, g, d1, d2, d2, d2, d2, d2, d2, g, g, d2, d2, g, g, g, d2, d2, d1, d1, d2, d2, g, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, d1, d1, d1, d2, d2, d2, g, g, g, g, g, g, d2, g, d2, d2, d2, d2, d2, d2, g, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_1, g, g, g, g, d1, d1, d1, g, d2, d2, g, g, d1, d2, g, g, d2, d2, g, g, g, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, g, c2, c1, c2, g, g, g, g, d2, d1, g, g, d1, d2, g, g, g, g, c1, c2, c1, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, c1, c2, c1, c2, c1, g, d2, d2, g, g, c1, g, d1, d2, g, c2, c1, c2, c1, c2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, c1, c2, c1, c2, c1, g, d2, d1, g, c2, c1, g, d1, d2, g, g, c1, c2, c1, c2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, c2, c1, c2, c1, c2, g, d2, g, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, c1, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, c2, c1, c2, c1, c2, g, d1, g, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, c1, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, c1, c2, c1, c2, c1, c2, g, c2, c1, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, d1, d2, g, c2, c1, c2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, d1, d2, g, c1, c2, c1, c2, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, d1, d2, g, c1, c2, c1, c2, g, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, g, g, c1, c2, c1, c2, c1, g, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, g, g, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, g, g, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, g, g, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, c2, c1, g, g, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], [bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, g, g, g, g, g, g, g, g, g, g, g, g, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_1], [bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_2, bg3_1, bg3_2, bg3_1, bg3_2, bg3_2], [bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_1, bg3_2, bg3_1, bg3_1, bg3_1], ] y = randint(12501,13000) seed(y) if ma=="doojunggap": z = randint(13001,13500) seed(z) zq = randint(0,300) if zq < 100: pixels = DooJungGap1 p = "doojunggap" count_doojunggap += 1 elif 100 <= zq < 200: pixels = DooJungGap2 p = "doojunggap" count_doojunggap += 1 else: pixels = DooJungGap3 p = "doojunggap" count_doojunggap += 1 elif ma == "gyungbyungap": aa = randint(12501,13000) seed(aa) zw = randint(0,300) if zw < 100: pixels = GyungByunGap1 p = "gyungbyungap" count_gyungbyungap += 1 elif 100 <= zw < 200: pixels = GyungByunGap2 p = "gyungbyungap" count_gyungbyungap += 1 else: pixels = GyungByunGap3 p = "gyungbyungap" count_gyungbyungap += 1 elif ma == "chalgap": ab = randint(13001,13500) seed(ab) ze = randint(0,300) if ze < 100: pixels = ChalGap1 p = "chalgap" count_chalgap += 1 elif 100 <= ze < 200: pixels = ChalGap2 p = "chalgap" count_chalgap += 1 else: pixels = ChalGap3 p = "chalgap" count_chalgap += 1 array = np.array(pixels, dtype=np.uint8) new_image = Image.fromarray(array) new_image = new_image.resize(dimensions, resample=0) if p == "doojunggap": imgname = dirname + '/armors/' + p + '_' + str(count_doojunggap) + '.png' elif p == "gyungbyungap": imgname = dirname + '/armors/' + p + '_' + str(count_gyungbyungap) + '.png' else: imgname = dirname + '/armors/' + p + '_' + str(count_chalgap) + '.png' new_image.save(imgname) make_armors("doojunggap", 500, 54) make_armors("gyungbyungap", 500, 41) make_armors("chalgap", 34, 12113524)
163.175947
364
0.591611
0
0
0
0
0
0
0
0
1,511
0.010286
9b57a3de7044f1cb8c387a458b45c232a75ebe2f
700
py
Python
maze/model/stack.py
cleuton/pythondrops
8190567fc3c0b54b4cb2465d989f1bc992ca89da
[ "Apache-2.0" ]
8
2018-06-15T05:37:41.000Z
2021-05-23T23:40:45.000Z
maze/model/stack.py
cleuton/pythondrops
8190567fc3c0b54b4cb2465d989f1bc992ca89da
[ "Apache-2.0" ]
2
2018-06-15T05:39:59.000Z
2019-08-30T01:16:30.000Z
maze/model/stack.py
cleuton/pythondrops
8190567fc3c0b54b4cb2465d989f1bc992ca89da
[ "Apache-2.0" ]
5
2018-06-15T05:37:42.000Z
2019-08-29T10:19:22.000Z
from collections import namedtuple class _Entry(namedtuple('_Entry', 'value next')): def _repr_assist(self, postfix): r = repr(self.value) + postfix if self.next is not None: return self.next._repr_assist(', ' + r) return r class Stack(object): def __init__(self): self.top = None def push(self, value): self.top = _Entry(value, self.top) def pop(self): if self.top is None: raise ValueError("Can't pop from an empty stack") res, self.top = self.top.value, self.top.next return res def __repr__(self): if self.top is None: return '[]' return '[' + self.top._repr_assist(']')
31.818182
61
0.594286
662
0.945714
0
0
0
0
0
0
65
0.092857
9b5a7ee5d76db4300a01a1e469082c5cdcc09d8b
468
py
Python
polynomials_on_simplices/calculus/test/real_interval_test.py
FAndersson/polynomials_on_simplices
f015a4772c817bfa99b0d6b726667a38a174b064
[ "MIT" ]
1
2021-03-17T11:41:21.000Z
2021-03-17T11:41:21.000Z
polynomials_on_simplices/calculus/test/real_interval_test.py
FAndersson/polynomials_on_simplices
f015a4772c817bfa99b0d6b726667a38a174b064
[ "MIT" ]
null
null
null
polynomials_on_simplices/calculus/test/real_interval_test.py
FAndersson/polynomials_on_simplices
f015a4772c817bfa99b0d6b726667a38a174b064
[ "MIT" ]
null
null
null
import sys import pytest from polynomials_on_simplices.calculus.real_interval import equivalent_periodic_element def test_equivalent_element(): b = equivalent_periodic_element(1.0, 2.0) assert 1.0 == b b = equivalent_periodic_element(3.0, 2.0) assert 1.0 == b b = equivalent_periodic_element(-3.0, 2.0) assert 1.0 == b b = equivalent_periodic_element(4.5, 2.5) assert 2.0 == b if __name__ == "__main__": pytest.main(sys.argv)
22.285714
87
0.700855
0
0
0
0
0
0
0
0
10
0.021368
9b5b1c2f681b75f91aedc79ae49917274c836bb0
761
py
Python
client codes/client v2/get_code_when_free.py
nathaniel-security/Localhost-distributed-computing-engine
4643c22f563a969ccaf1062da17696819e00ab9a
[ "MIT" ]
null
null
null
client codes/client v2/get_code_when_free.py
nathaniel-security/Localhost-distributed-computing-engine
4643c22f563a969ccaf1062da17696819e00ab9a
[ "MIT" ]
null
null
null
client codes/client v2/get_code_when_free.py
nathaniel-security/Localhost-distributed-computing-engine
4643c22f563a969ccaf1062da17696819e00ab9a
[ "MIT" ]
null
null
null
from client_database_connection import mycursor from ftp import * from config import free config = json.loads(open('config.json').read()) node_id = config['node id'] local_path = config['local path'] while free: sql = "SELECT code_id FROM code_node where node_id = " + node_id mycursor.execute(sql) node = mycursor.fetchone() code_id = mycursor.fetchone() if(code_id is not None): free = False break hostname = ftp_hostname() password = ftp_password() user = ftp_user() sql = "SELECT code_path FROM code_data where code_id = " + code_id mycursor.execute(sql) remote_path = mycursor.fetchone() connect(hostname, user , password ,local_path ,remote_path) os.system("python run.py")
22.382353
69
0.680683
0
0
0
0
0
0
0
0
147
0.193167
9b5be5c5ed6504a2c9ccae3984febdda2e35498d
5,862
py
Python
server/app.py
LeartKrasniqi/Sign-Language-Interpreter
46ffef29eaf3746d48654bc4430d6e921120d33e
[ "MIT" ]
3
2020-02-25T14:43:33.000Z
2020-10-10T08:42:27.000Z
server/app.py
LeartKrasniqi/Sign-Language-Interpreter
46ffef29eaf3746d48654bc4430d6e921120d33e
[ "MIT" ]
null
null
null
server/app.py
LeartKrasniqi/Sign-Language-Interpreter
46ffef29eaf3746d48654bc4430d6e921120d33e
[ "MIT" ]
1
2020-02-24T19:46:11.000Z
2020-02-24T19:46:11.000Z
import os from flask import Flask, flash, request, redirect, url_for, jsonify from flask_cors import CORS from werkzeug.utils import secure_filename import subprocess # set up text to speech map from nltk.stem import PorterStemmer from nltk.tokenize import word_tokenize # speech recognition import speech_recognition as sr recognizer = sr.Recognizer() # Create dictionary word_dict = dict() stem_dict = dict() # Create stemmer stemmer = PorterStemmer() # Read in the dictionary file dict_dir = "../img/" dict_filename = dict_dir + "dict.txt" dict_file = open(dict_filename, "r") dict_lines = dict_file.read().splitlines() # Make map of word and word stem to file for line in dict_lines: split = line.split() word = split[0] filepath = dict_dir + split[1] if word not in word_dict.keys(): word_dict[word] = filepath stem = stemmer.stem(word) if stem not in stem_dict.keys(): stem_dict[stem] = filepath # List of words that do not need a sign non_signs = ["is", "are", "be"] # The alphabet alpha = "abcdefghijklmnopqrstuvwxyz" # Translate the sentences # takes recognized_words as input and # returns a valid path to each word or letter def text2imgpath(recognized_words): # sample file that contains a few lines of text: # sentences_file = open("../text2img/tests/sentences.txt", "r") s = recognized_words img_links = [] tokens = word_tokenize(s) for t in tokens: t = t.lower() # Skip words that do not need a sign if t in non_signs: continue # Get stem of word wordstem = stemmer.stem(t) if t in word_dict.keys(): # word image img_links.append(word_dict[t]) elif wordstem in stem_dict.keys(): img_links.append(stem_dict[wordstem]) else: # letter image chars = list(t) for c in chars: # Skip any thing not in our dictionary if c not in alpha: continue path = "../img/letters/{}.png".format(c) img_links.append(path) return img_links # set up server app = Flask(__name__) UPLOAD_FOLDER_VIDEO = './videos/' UPLOAD_FOLDER_VOICE = './voice/' UPLOAD_FOLDER_IMAGE = './images/' ALLOWED_EXTENSIONS = {'mpg', 'mp4'} app = Flask(__name__) app.config['UPLOAD_FOLDER_VIDEO'] = UPLOAD_FOLDER_VIDEO app.config['UPLOAD_FOLDER_VOICE'] = UPLOAD_FOLDER_VOICE app.config['UPLOAD_FOLDER_IMAGE'] = UPLOAD_FOLDER_IMAGE CORS(app) def allowed_file(filename): return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS @app.route('/') def hello(): return "Hello World!" @app.route('/audio',methods=['POST', 'GET']) def audio(): if request.method == 'POST': file = request.files['audio'] filename = "speech" filename = secure_filename(filename) audiopath = os.path.join(app.config['UPLOAD_FOLDER_VOICE'], filename + ".webm") audionewpath = os.path.join(app.config['UPLOAD_FOLDER_VOICE'], filename + ".wav") file.save(audiopath) command = "ffmpeg -i " + audiopath + " -ab 160k -ac 2 -y -ar 44100 -vn " + audionewpath os.system(command) speech = sr.AudioFile(audionewpath) with speech as audio_file: try: recognizer.adjust_for_ambient_noise(audio_file) audio = recognizer.record(audio_file, offset = 0) # list of recognized words in list recog_words = recognizer.recognize_google(audio).lower() #.split(",!? ") # get image path for the word imgpath = text2imgpath(recog_words) return(jsonify(imgpath)) except Exception as e: print("Exception found!: {}: {}".format(type(e), e.message)) return "success" @app.route('/video', methods=['POST','GET']) def audiovideo(): if request.method == 'POST': file = request.files['audiovideo'] filename = "asl_video.webm" filename = secure_filename(filename) file.save(os.path.join(app.config['UPLOAD_FOLDER_VIDEO'], filename)) return jsonify(status="success", text="blah") @app.route('/videofile', methods=['POST','GET']) def videofile(): if request.method == 'POST': file = request.files['video'] filename = "asl_video.mp4" filename = secure_filename(filename) file.save(os.path.join(app.config['UPLOAD_FOLDER_VIDEO'], filename)) return jsonify(status="success", text="blah") @app.route('/image', methods=['POST','GET']) def image(): if request.method == 'POST': file = request.files['image'] filename = "asl_image.png" filename = secure_filename(filename) file.save(os.path.join(app.config['UPLOAD_FOLDER_IMAGE'], filename)) return jsonify(letter='H') @app.route('/api/upload', methods=['POST','GET']) def upload_file(): if request.method == 'POST': if 'file' not in request.files: flash('No file part') return redirect(request.url) file = request.files['file'] if file.filename == '': flash('No selected file') return redirect(request.url) if file and allowed_file(file.filename): filename = secure_filename(file.filename) file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) return redirect(url_for('uploaded_file', filename=filename)) return ''' <!doctype html> <title>Upload new File</title> <h1>Upload new File</h1> <form method=post enctype=multipart/form-data> <input type=file name=file> <input type=submit value=Upload> </form> ''' if __name__ == '__main__': app.run(host="localhost", port=42248, debug=True)
31.686486
95
0.628796
0
0
0
0
3,148
0.537018
0
0
1,691
0.288468
9b5d3c5659fc7c63b174be7b4744d1de06e0f242
1,128
py
Python
main/PluginDemos/MomentOfInertia/MomentOfInertia3D/Simulation/MomentOfInertia3DSteppables.py
JulianoGianlupi/nh-cc3d-4x-base-tool
c0f4aceebd4c5bf3ec39e831ef851e419b161259
[ "CC0-1.0" ]
null
null
null
main/PluginDemos/MomentOfInertia/MomentOfInertia3D/Simulation/MomentOfInertia3DSteppables.py
JulianoGianlupi/nh-cc3d-4x-base-tool
c0f4aceebd4c5bf3ec39e831ef851e419b161259
[ "CC0-1.0" ]
null
null
null
main/PluginDemos/MomentOfInertia/MomentOfInertia3D/Simulation/MomentOfInertia3DSteppables.py
JulianoGianlupi/nh-cc3d-4x-base-tool
c0f4aceebd4c5bf3ec39e831ef851e419b161259
[ "CC0-1.0" ]
1
2021-02-26T21:50:29.000Z
2021-02-26T21:50:29.000Z
from cc3d.core.PySteppables import * class MomentOfInertiaPrinter3D(SteppableBasePy): def __init__(self, frequency=10): SteppableBasePy.__init__(self, frequency) self.semi_minor_axis = 15 self.semi_median_axis = 8 self.semi_major_axis = 5 def start(self): self.generate_ellipsoid(self.semi_minor_axis, self.semi_median_axis, self.semi_major_axis) def generate_ellipsoid(self, semi_minor_axis, semi_median_axis, semi_major_axis): cell = self.new_cell(cell_type=1) for x, y, z in self.every_pixel(): if (x - self.dim.x / 2.0) ** 2 / semi_minor_axis ** 2 + ( y - self.dim.y / 2.0) ** 2 / semi_major_axis ** 2 + ( z - self.dim.z / 2.0) ** 2 / semi_median_axis ** 2 < 1: self.cell_field[x, y, z] = cell def step(self, mcs): for cell in self.cellList: # preferred way of accessing information about semiminor axes axes = self.momentOfInertiaPlugin.getSemiaxes(cell) print("minorAxis=", axes[0], " majorAxis=", axes[2], " medianAxis=", axes[1])
40.285714
98
0.618794
1,088
0.964539
0
0
0
0
0
0
100
0.088652
9b5d42d58638f8e19f6b1354d952d443c3e13a52
4,003
py
Python
skirt-sniffer.py
macenpav/skirt-sniffer
3ba45d5f7f22b83417525835dc594e698c4ebb1a
[ "MIT" ]
null
null
null
skirt-sniffer.py
macenpav/skirt-sniffer
3ba45d5f7f22b83417525835dc594e698c4ebb1a
[ "MIT" ]
null
null
null
skirt-sniffer.py
macenpav/skirt-sniffer
3ba45d5f7f22b83417525835dc594e698c4ebb1a
[ "MIT" ]
null
null
null
import data_module import email_module import db_module from jinja2 import Environment, FileSystemLoader from os import path import time from datetime import datetime DIR_PATH = path.dirname(path.realpath(__file__)) NEW_SKIRT_SUBJECT = r"Novinka! - {0}" NEW_PRINT_SUBJECT = r"NOVÉ TISKY! - {0}" DAY_INIT_SUBJECT = r"Keporkak se probouzí! - {0}" PAGE_LIMIT = 20 # limit to read pages so we don't deadlock while mining data def send_email(subject_base, data, **kwargs): email = email_module.Email() subject = subject_base.format(data[0]['name']); if len(data) > 1: subject += ' a další ...' file_loader = FileSystemLoader(path.join(DIR_PATH, 'templates')) env = Environment(loader=file_loader) template = env.get_template('email.html') email.set_content(template.render(title=subject, items=data)) email.set_subject(subject) if 'is_print' in kwargs: if kwargs['is_print']: email.send(email_module.CONFIG_PRINT_R) # send email to print Recipients else: email.send(email_module.CONFIG_REGULAR_R) # send email to regular Recipients def send_wakeup_email(): email = email_module.Email() subject = DAY_INIT_SUBJECT.format(datetime.strftime(datetime.today(), '%y-%m-%d')); file_loader = FileSystemLoader(path.join(DIR_PATH, 'templates')) env = Environment(loader=file_loader) template = env.get_template('wakeup.html') email.set_content(template.render(title=subject)) email.set_subject(subject) email.send(email_module.CONFIG_ADMIN_R) # send email to Admin only def run_base(): page_no = 0 conn = db_module.open_connection() db_module.create_database(conn, db_module.default_product_table) new_data = [] while True: url = data_module.get_url(page_no) products = data_module.mine(url) # mine until we can, we don't know how many pages are in the e-shop if products and (page_no < PAGE_LIMIT): new_products = db_module.insert_products(conn, db_module.default_product_table, products) if new_products: for prod in new_products: new_data.append(prod) else: break page_no += 1 else: break db_module.close_connection(conn) if new_data: print("run_base({0}): New data found - sending email.".format(str(time.time()))) send_email(NEW_SKIRT_SUBJECT, new_data, is_print=False) else: print("run_base({0}): No new data.".format(str(time.time()))) def run_print(): conn = db_module.open_connection() db_module.create_database(conn, db_module.default_print_table) url = data_module.get_url_print() products = data_module.mine(url) new_data = None if products: new_data = db_module.insert_products(conn, db_module.default_print_table, products) db_module.close_connection(conn) if new_data: print("run_print({0}): New data found - sending email.".format(str(time.time()))) send_email(NEW_PRINT_SUBJECT, new_data, is_print=True) else: print("run_print({0}): No new data.".format(str(time.time()))) def day_init_check(): conn = db_module.open_connection() db_module.create_today_database(conn) if db_module.is_today_init(conn): db_module.insert_today(conn) print("day_init_check({0}): Today's first mining - sending email.".format(str(time.time()))) send_wakeup_email() db_module.close_connection(conn) if __name__ == "__main__": print("main({0}): Checking if server is available.".format(str(time.time()))) if data_module.is_server_available() is False: print("main({0}): Unable to ping server.".format(str(time.time()))) else: day_init_check() print("main({0}): Starting to mine data.".format(str(time.time()))) run_base() run_print() print("main({0}): Finished mining.".format(str(time.time())))
32.024
101
0.671496
0
0
0
0
0
0
0
0
757
0.188919
9b5e52eda69e6b966095678067006f5bc461763d
3,661
py
Python
gos/manager.py
sergey-aganezov-jr/gos
fb4d210284f3037c5321250cb95f3901754feb6b
[ "MIT" ]
null
null
null
gos/manager.py
sergey-aganezov-jr/gos
fb4d210284f3037c5321250cb95f3901754feb6b
[ "MIT" ]
null
null
null
gos/manager.py
sergey-aganezov-jr/gos
fb4d210284f3037c5321250cb95f3901754feb6b
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- from gos.configuration import Configuration from gos.exceptions import GOSTaskException, GOSExecutableContainerException from gos.executable_containers import ExecutableContainer from gos.tasks import TaskLoader class Manager(object): def __init__(self, config): self.configuration = config self.tasks_classes = {} self.tasks_instances = {} self.executable_containers_classes = {} self.executable_containers_instances = {} def initiate_tasks(self): """ Loads all tasks using `TaskLoader` from respective configuration option """ self.tasks_classes = TaskLoader().load_tasks( paths=self.configuration[Configuration.ALGORITHM][Configuration.TASKS][Configuration.PATHS]) def instantiate_tasks(self): """ All loaded tasks are initialized. Depending on configuration fails in such instantiations may be silent """ self.tasks_instances = {} for task_name, task_class in self.tasks_classes.items(): try: self.tasks_instances[task_name] = task_class() except Exception as ex: if not self.configuration[Configuration.ALGORITHM][Configuration.IOSF]: raise GOSTaskException("An exception happened during the task instantiation." "{exception}".format(exception=ex)) def initiate_executable_containers(self): for entry in self.configuration[Configuration.ALGORITHM]["executable_containers"]: if "reference" in entry: reference = entry["reference"] for ec_config in self.configuration[Configuration.ALGORITHM][reference]: ec_config["group_reference_name"] = reference result = ExecutableContainer.setup_from_config(manager=self, config=ec_config) self.executable_containers_instances[result.name] = result elif "paths" in entry: paths = entry["paths"] for path in paths: try: for ec_instance in ExecutableContainer.setup_from_file(file_path=path): self.executable_containers_instances[ec_instance.name] = ec_instance except GOSExecutableContainerException: continue if "pipeline" not in self.configuration[Configuration.ALGORITHM]["executable_containers"]: pipeline_config = self.configuration[Configuration.ALGORITHM]["pipeline"] if "name" not in pipeline_config: pipeline_config["name"] = "pipeline" self.executable_containers_instances["pipeline"] = ExecutableContainer.setup_from_config(manager=self, config=pipeline_config) def instantiate_executable_containers(self): for executable_container in self.executable_containers_instances.values(): for entry_name in executable_container.entries_names: try: entry = self.tasks_instances[entry_name] except KeyError: entry = self.executable_containers_instances[entry_name] executable_container.entries.append(entry) def run(self): self.executable_containers_instances["pipeline"].run(manager=self) def get_task_instance(self, task_name): return self.tasks_instances[task_name] def get_executable_container_instance(self, ec_name): return self.executable_containers_instances[ec_name]
50.847222
124
0.645179
3,422
0.934717
0
0
0
0
0
0
446
0.121825
9b5f11338fa982d437506f6ebd36acb9e68351e8
2,608
py
Python
couchcrdt/crdt.py
drsm79/couch-crdt
1717a8b03a488793984d7209f6da78c395b3477f
[ "Apache-2.0" ]
null
null
null
couchcrdt/crdt.py
drsm79/couch-crdt
1717a8b03a488793984d7209f6da78c395b3477f
[ "Apache-2.0" ]
null
null
null
couchcrdt/crdt.py
drsm79/couch-crdt
1717a8b03a488793984d7209f6da78c395b3477f
[ "Apache-2.0" ]
null
null
null
import requests import json class CRDT(object): """ A base class CRDT. This only takes care of getting the value and putting the local state of the CRDT from/to the database. What those things mean is up to specific implementations. """ def __init__(self, name, url, db, auth=(), params={}, always_write=False): """ name: an identifier for the crdt, translates to a key in a CouchDB view url: the full url of the crdt, e.g. a named view db: the url of the database auth: a tuple of (username, password) params: a dict of additional query string parameters to send to the view always_write: write out the state of the CRDT """ self.name = name self.url = url self.database = db self.session = requests.Session() self.session.auth = auth self.session.headers = { 'User-Agent': 'couchcrdt/0.0.1', 'Content-Type': 'application/json' } p = {'reduce': True, 'group': True, 'key': self.name} p.update(params) self.params = dict((k, json.dumps(v)) for k, v in p.iteritems()) self.value = None self.state = None self.always_write = always_write self.default_state = None def get(self): """ Get the latest value from the database for the CRDT and eliminate local state. """ r = self.session.get(self.url, params=self.params) r.raise_for_status() self.value = self._parse(r) self._update(self.default_state) def put(self): """ Write the CRDT's local state (not it's value) to the database """ r = self.session.post( self.database, json.dumps({ 'value': self._serialise(), 'name': self.name, 'type': '.'.join([ self.__class__.__module__, self.__class__.__name__ ]) }) ) r.raise_for_status() def _update(self, state): """ Update the local state """ self.state = state if self.always_write: self.put() def _get_state(self): """ Return the internal, local only state """ return self.state def _parse(self, data): return data.json()['rows'][0]['value'] def _serialise(self): """ Return the externalised state of the CRDT, defaults to the local state """ return self._get_state()
28.347826
79
0.546012
2,577
0.988113
0
0
0
0
0
0
1,098
0.421012
9b5f1ca95a4bf43c73f0a6830a6c9ae4f3d79f44
134
py
Python
svreal/enums.py
sgherbst/svreal
62811a3074732554db650b8decde60997fbe8b59
[ "MIT" ]
27
2019-05-14T10:14:21.000Z
2022-01-22T03:00:05.000Z
svreal/enums.py
sgherbst/svreal
62811a3074732554db650b8decde60997fbe8b59
[ "MIT" ]
8
2020-03-16T07:38:30.000Z
2021-05-27T17:59:24.000Z
svreal/enums.py
sgherbst/svreal
62811a3074732554db650b8decde60997fbe8b59
[ "MIT" ]
3
2020-10-21T19:10:13.000Z
2022-02-23T12:34:12.000Z
from enum import Enum class RealType(Enum): FixedPoint = 'FIXED_POINT' FloatReal = 'FLOAT_REAL' HardFloat = 'HARD_FLOAT'
19.142857
30
0.701493
110
0.820896
0
0
0
0
0
0
37
0.276119
9b601d1541c40d95e59c43221fab5f52ddc75afd
231
py
Python
zvt/recorders/joinquant/overall/__init__.py
Evergreen2020/zvt
446a2512d716a38a12164b6d4468a6c9de01b986
[ "MIT" ]
6
2020-09-03T10:02:00.000Z
2021-02-04T02:51:47.000Z
zvt/recorders/joinquant/overall/__init__.py
Evergreen2020/zvt
446a2512d716a38a12164b6d4468a6c9de01b986
[ "MIT" ]
2
2019-12-20T13:12:30.000Z
2020-01-03T06:24:30.000Z
zvt/recorders/joinquant/overall/__init__.py
Evergreen2020/zvt
446a2512d716a38a12164b6d4468a6c9de01b986
[ "MIT" ]
2
2020-07-08T04:15:40.000Z
2021-06-08T08:51:31.000Z
# -*- coding: utf-8 -*- from zvt.recorders.joinquant.overall.cross_market_recorder import * from zvt.recorders.joinquant.overall.margin_trading_recorder import * from zvt.recorders.joinquant.overall.stock_summary_recorder import *
46.2
69
0.822511
0
0
0
0
0
0
0
0
23
0.099567
9b6200504eb1e628d498d1956f71cf3b490895b3
1,708
py
Python
legacy/dx/simulator/simulator_diagnoser/test/diagnosis/apt_diagnoser_test.py
GaloisInc/adapt
2ccff778d3e77505899266572f8f7caacb5b630f
[ "BSD-3-Clause" ]
2
2020-04-09T13:04:25.000Z
2021-09-24T14:17:26.000Z
legacy/dx/simulator/simulator_diagnoser/test/diagnosis/apt_diagnoser_test.py
GaloisInc/adapt
2ccff778d3e77505899266572f8f7caacb5b630f
[ "BSD-3-Clause" ]
null
null
null
legacy/dx/simulator/simulator_diagnoser/test/diagnosis/apt_diagnoser_test.py
GaloisInc/adapt
2ccff778d3e77505899266572f8f7caacb5b630f
[ "BSD-3-Clause" ]
3
2019-09-20T20:49:54.000Z
2021-09-02T17:33:47.000Z
import unittest from simulator_diagnoser.graph import InmemoryGraph from simulator_diagnoser.diagnosis import APTDiagnoser from simulator_diagnoser.matcher import Terminal, \ Sequence, \ StatelessMatcher class APTDiagnoserTest(unittest.TestCase): def setUp(self): # Graph = # 9 # / | \ # 6 7 8 # \ / \ / # 4 5 # / \ / \ # 1 2 3 self.g1 = InmemoryGraph() edges = [(1, 4), (2, 4), (2, 5), (3, 5), (4, 6), (4, 7), (5, 7), (5, 8), (6, 9), (7, 9), (8, 9)] for edge in edges: self.g1.add_edge(*edge) self.g1.add_node_label(1, 'A') self.g1.add_node_label(3, 'A') self.g1.add_node_label(7, 'B') self.g1.add_node_label(9, 'C') g1 = Sequence([Terminal('A'), Terminal('B'), Terminal('C')], 'sequence') self.matcher1 = StatelessMatcher(g1) self.apt_diagnoser = APTDiagnoser(self.g1, self.matcher1) def test_forward_analysis(self): result = self.apt_diagnoser.forward_analysis() self.assertEqual(9, result.get_rank()[0][0]) def test_backward_analysis(self): result = self.apt_diagnoser.forward_analysis() node = result.get_rank()[0][0] paths = self.apt_diagnoser.backward_analysis(node) self.assertEqual(2, len(paths)) def test_diagnoser(self): self.apt_diagnoser.store_diagnoses() self.assertEqual(2, len(self.g1.diagnoses)) if __name__ == '__main__': unittest.main()
31.054545
65
0.527518
1,374
0.80445
0
0
0
0
0
0
118
0.069087
9b650fbea222942a995d60c70b774dcb9b12f9c7
888
py
Python
etl/produce_map.py
hbmartin/sub9-client
0f85639412e2a2d695e9f6a56913dcb055af82b2
[ "CC-BY-4.0" ]
null
null
null
etl/produce_map.py
hbmartin/sub9-client
0f85639412e2a2d695e9f6a56913dcb055af82b2
[ "CC-BY-4.0" ]
null
null
null
etl/produce_map.py
hbmartin/sub9-client
0f85639412e2a2d695e9f6a56913dcb055af82b2
[ "CC-BY-4.0" ]
null
null
null
#!/usr/bin/env python3 """Roll up the geo6 json to produce a tree suitable for sub9 query""" __author__ = "H. Martin" __version__ = "0.1.0" import json import math from random import randint data = {} transformed = {} with open('geohash_counter_6.json', encoding='utf-8') as data_file: data = json.loads(data_file.read()) for geo6 in data: geohash_info = {} count = math.ceil(data[geo6] * 0.1) geohash_info['count'] = count geo4 = geo6[:4] if geo4 not in transformed: transformed[geo4] = {"count":0} transformed[geo4]["count"] += count geo5 = geo6[:5] if geo5 not in transformed[geo4]: transformed[geo4][geo5] = {"count":0} transformed[geo4][geo5]["count"] += count transformed[geo4][geo5][geo6] = geohash_info with open('full_map.json', 'w', encoding='utf-8') as outfile: json.dump(transformed, outfile, indent=2)
24.666667
69
0.653153
0
0
0
0
0
0
0
0
200
0.225225
9b65e671e782ba8045e5362d7f2aa0daf9d92725
716
py
Python
tests/factory_fixtures/notes.py
codeforpdx/dwellinglybackend
92fee6d19a68ae00750927b8700eaa7195b57668
[ "MIT" ]
15
2020-07-09T20:51:09.000Z
2021-11-28T21:59:02.000Z
tests/factory_fixtures/notes.py
codeforpdx/dwellinglybackend
92fee6d19a68ae00750927b8700eaa7195b57668
[ "MIT" ]
148
2020-03-28T22:10:30.000Z
2021-12-19T09:22:59.000Z
tests/factory_fixtures/notes.py
codeforpdx/dwellinglybackend
92fee6d19a68ae00750927b8700eaa7195b57668
[ "MIT" ]
30
2020-03-12T02:31:27.000Z
2021-07-29T02:40:36.000Z
import pytest from models.notes import NotesModel from schemas.notes import NotesSchema from tests.attributes import note_attrs @pytest.fixture def note_attributes(faker): def _note_attributes(text, user, ticket): return {**note_attrs(faker, text), "user_id": user.id, "ticket_id": ticket.id} yield _note_attributes @pytest.fixture def create_note(faker, note_attributes, create_admin_user, create_ticket): def _create_note(user=None, ticket=None, text=None): user = user or create_admin_user() ticket = ticket or create_ticket() return NotesModel.create( schema=NotesSchema, payload=note_attributes(text, user, ticket) ) yield _create_note
27.538462
86
0.726257
0
0
550
0.768156
582
0.812849
0
0
20
0.027933
9b6659e81f23a3d9ae4d6dd42d1200115d52d82d
2,220
py
Python
src/routers/v1/endpoints/facetime.py
kal-byte/my-api
e1fccfa57cda874753d48411f7bfff06afbdb019
[ "MIT" ]
2
2021-03-13T14:43:05.000Z
2021-03-13T15:10:58.000Z
src/routers/v1/endpoints/facetime.py
kal-byte/my-api
e1fccfa57cda874753d48411f7bfff06afbdb019
[ "MIT" ]
null
null
null
src/routers/v1/endpoints/facetime.py
kal-byte/my-api
e1fccfa57cda874753d48411f7bfff06afbdb019
[ "MIT" ]
2
2021-03-13T14:42:40.000Z
2021-03-17T18:18:10.000Z
""" MIT License Copyright 2021-Present kal-byte 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. """ import utils import polaroid from io import BytesIO from fastapi import APIRouter from fastapi.responses import StreamingResponse, JSONResponse router = APIRouter() @utils.to_thread def generate_image(first_image: bytes, second_image: bytes) -> BytesIO: """Backend code that generates the image that provides the facetime effect.""" img_one = polaroid.Image(first_image) img_two = polaroid.Image(second_image) img_one.resize(1024, 1024, 5) img_two.resize(256, 256, 5) facetime_btns = polaroid.Image("./static/facetimebuttons.png") facetime_btns.resize(1024, 1024, 5) img_one.watermark(img_two, 15, 15) img_one.watermark(facetime_btns, 0, 390) buffer = BytesIO(img_one.save_bytes()) return buffer @router.get("/facetime") async def serve_image(first: str, second: str): first = await utils.get_image(first) second = await utils.get_image(second) if isinstance(first, JSONResponse): return first if isinstance(second, JSONResponse): return second image = await generate_image(first, second) return StreamingResponse(image, media_type="image/png")
34.153846
102
0.763964
0
0
0
0
969
0.436486
366
0.164865
1,206
0.543243
9b695e220684cc34d44b4b158affb4987027de4f
213
py
Python
test/test_hook.py
mudox/pytav
4124628c45ffd3fc35913d781278eb349d9c8559
[ "MIT" ]
null
null
null
test/test_hook.py
mudox/pytav
4124628c45ffd3fc35913d781278eb349d9c8559
[ "MIT" ]
null
null
null
test/test_hook.py
mudox/pytav
4124628c45ffd3fc35913d781278eb349d9c8559
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from tav.tmux import hook def test_hook_suppression(): hook.disable('testing') assert not hook.isEnabled() hook.enable('testing') assert hook.isEnabled()
16.384615
29
0.690141
0
0
0
0
0
0
0
0
63
0.295775
9b6a583e7f9d54f4d8150fa8893fc6c891b5dbd8
172
py
Python
falcon/core/events/handling/base_handler.py
jopereira/horus-tracer
03671206f02c5ebea18f5682b346f59884e0a538
[ "MIT" ]
21
2018-04-18T19:01:09.000Z
2021-11-24T19:22:33.000Z
falcon/core/events/handling/base_handler.py
jopereira/horus-tracer
03671206f02c5ebea18f5682b346f59884e0a538
[ "MIT" ]
29
2018-04-30T16:39:27.000Z
2021-04-03T16:04:19.000Z
falcon/core/events/handling/base_handler.py
jopereira/horus-tracer
03671206f02c5ebea18f5682b346f59884e0a538
[ "MIT" ]
7
2018-04-21T13:04:03.000Z
2021-03-07T08:24:26.000Z
class BaseHandler(object): def boot(self): pass def handle(self, cpu, data, size): raise NotImplementedError def shutdown(self): pass
17.2
38
0.604651
171
0.994186
0
0
0
0
0
0
0
0
9b6bba0de98dfc7b9557b30776b8cee5fb813b43
445
py
Python
app/accounts/migrations/0003_auto_20190323_1709.py
NjengaSaruni/Accountant-Web-Server
e77124307f235a4a446e1251d2830d7587cb8719
[ "MIT" ]
null
null
null
app/accounts/migrations/0003_auto_20190323_1709.py
NjengaSaruni/Accountant-Web-Server
e77124307f235a4a446e1251d2830d7587cb8719
[ "MIT" ]
19
2018-12-10T20:06:21.000Z
2021-06-10T21:03:31.000Z
app/accounts/migrations/0003_auto_20190323_1709.py
NjengaSaruni/Accountant-Web-Server
e77124307f235a4a446e1251d2830d7587cb8719
[ "MIT" ]
null
null
null
# Generated by Django 2.1.7 on 2019-03-23 17:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('accounts', '0002_auto_20190113_1602'), ] operations = [ migrations.AlterField( model_name='user', name='created_at', field=models.DateTimeField(auto_now_add=True, help_text='The time the transaction was done.'), ), ]
23.421053
106
0.626966
352
0.791011
0
0
0
0
0
0
136
0.305618
9b6c6e386630575a00a0344243a155f4ff7c4cd5
979
py
Python
src/components/sidebar1.py
DishaDH123/Disha551Dashboard
3354ff94134e6094f7e5759f17abe5d988a32198
[ "MIT" ]
null
null
null
src/components/sidebar1.py
DishaDH123/Disha551Dashboard
3354ff94134e6094f7e5759f17abe5d988a32198
[ "MIT" ]
null
null
null
src/components/sidebar1.py
DishaDH123/Disha551Dashboard
3354ff94134e6094f7e5759f17abe5d988a32198
[ "MIT" ]
null
null
null
import dash from dash import dcc from dash import html,Input, Output import dash_bootstrap_components as dbc from ..app import app from .sidebar_function_tab1 import TAB1_DROPDOWN,time_scale,date_slider,choose_fun_tab1 SIDEBAR1 = [dbc.Row("Energy Dashboard",class_name="title",style={"font-size":"30px","padding-left": "10px","padding-top": "10px"}), dbc.Row("___________________________________________"), html.Br(), dbc.Row("This dashboard figure out which factors make a difference to house temperature and humidity. You can choose the factors from the dropdown below.",class_name="description"), html.Br(), dbc.Label("Compare Across:",class_name="sub_title",style={"font-size":"20px"}), html.Br(), dbc.Row(TAB1_DROPDOWN), html.Br(), dbc.Row(id="selection_tab1"), html.Br(), dbc.Row(time_scale), html.Br(), dbc.Row(date_slider), ] @app.callback(Output("selection_tab1", "children"), Input("tab1_dropdown", "value")) def output_div(value): return choose_fun_tab1(value)
34.964286
181
0.763023
0
0
0
0
141
0.144025
0
0
394
0.402451
9b6d446a16c44d84b91f269a1e5ec023a880fe0e
4,176
py
Python
interbotix_examples/interbotix_moveit_interface/get_trajectory_server.py
junyaoshi/interbotix_ros_arms
ca37aa98a66acdbd17557d6808d6c32f0ad4799b
[ "BSD-2-Clause" ]
null
null
null
interbotix_examples/interbotix_moveit_interface/get_trajectory_server.py
junyaoshi/interbotix_ros_arms
ca37aa98a66acdbd17557d6808d6c32f0ad4799b
[ "BSD-2-Clause" ]
null
null
null
interbotix_examples/interbotix_moveit_interface/get_trajectory_server.py
junyaoshi/interbotix_ros_arms
ca37aa98a66acdbd17557d6808d6c32f0ad4799b
[ "BSD-2-Clause" ]
null
null
null
#!/usr/bin/env python from __future__ import print_function from moveit_python_interface import MoveGroupPythonInteface from geometry_msgs.msg import Pose import rospy from interbotix_moveit_interface.srv import GetTrajectory, GetTrajectoryResponse # flags GO_TO_START_JOINT_VALUES = False # whether to use execute a plan to go to start joint values EXECUTE_PLAN = False # whether to execute the plan generated for reaching pose goal ROBOT_NAME = 'wx200' # name of the robot DOF = 5 # robot's degrees of freedom # mesh object path dictionary MESH_OBJECT_FILENAMES = {"chair_bernhard_0146/left_leg": "furniture/env/models/assets/objects/chair_bernhard_0146/left_leg.stl", "chair_bernhard_0146/right_leg": "furniture/env/models/assets/objects/chair_bernhard_0146/right_leg.stl", "chair_bernhard_0146/seat": "furniture/env/models/assets/objects/chair_bernhard_0146/seat.stl", "table_klubbo_0743/leg1": "furniture/env/models/assets/objects/table_klubbo_0743/leg1.stl", "table_klubbo_0743/leg2": "furniture/env/models/assets/objects/table_klubbo_0743/leg2.stl", "table_klubbo_0743/leg3": "furniture/env/models/assets/objects/table_klubbo_0743/leg3.stl", "table_klubbo_0743/leg4": "furniture/env/models/assets/objects/table_klubbo_0743/leg4.stl", "table_klubbo_0743/table_top": "furniture/env/models/assets/objects/table_klubbo_0743/table_top.stl"} def generate_trajectory(req): """ Handles service request message :param req: service request message :return: service response message """ start = rospy.get_time() print("Generating joint trajectory for the following request... \n" "--- Position: [{} {} {}]\n" "--- Start joint values: {}\n" "--- Object names: {}".format(req.x, req.y, req.z, req.start_joint_values, req.object_names)) # add mesh object to scene for i in range(len(req.object_names)): object_name = req.object_names[i] object_pose = req.object_poses[i] object_size_vector3 = req.object_sizes[i] object_size = (object_size_vector3.x, object_size_vector3.y, object_size_vector3.z) try: object_filename = MESH_OBJECT_FILENAMES[object_name] if object_name in interface.scene.get_known_object_names(): interface.move_mesh(object_name, object_pose) else: interface.add_mesh(object_name, object_pose, object_filename, object_size) except KeyError: print("Unrecognized object name: {}".format(object_name)) # remove objects no longer in scene objects_no_longer_in_scene = list(set(interface.scene.get_known_object_names()) - set(req.object_names)) for object in objects_no_longer_in_scene: interface.remove_mesh(object) if GO_TO_START_JOINT_VALUES: interface.go_to_joint_state(req.start_joint_values) target_position = [req.x, req.y, req.z] trajectory_exists, plan = interface.plan_ee_position(target_position, req.start_joint_values, execute_plan=EXECUTE_PLAN) end = rospy.get_time() print("Trajectory exists?: {} ".format(trajectory_exists)) print("Trajectory sent to client!") print("Objects in scene after trajectory update: {}".format(interface.scene.get_known_object_names())) print("Processed request in {} seconds".format(end - start)) return GetTrajectoryResponse(plan.joint_trajectory, trajectory_exists) if __name__ == "__main__": interface = MoveGroupPythonInteface(robot_name=ROBOT_NAME, dof=DOF) # remove objects in moveit scene because of previous runs for name in interface.scene.get_known_object_names(): interface.scene.remove_world_object(name) s = rospy.Service('get_trajectory', GetTrajectory, generate_trajectory) print("Ready to generate trajectory.") rospy.spin()
48
130
0.677443
0
0
0
0
0
0
0
0
1,579
0.378113
9b6da7ce7169ebed552ff066ea4c100e67f503a4
573
py
Python
importers/base_importer.py
lwhjon/repo-labels-cli
5a16638f45f0b13e9fdddc59b1a0952f3ba51287
[ "MIT" ]
1
2021-07-14T06:32:50.000Z
2021-07-14T06:32:50.000Z
importers/base_importer.py
lwhjon/repo-labels-cli
5a16638f45f0b13e9fdddc59b1a0952f3ba51287
[ "MIT" ]
2
2021-08-31T18:14:03.000Z
2021-12-29T18:14:25.000Z
importers/base_importer.py
lwhjon/repo-labels-cli
5a16638f45f0b13e9fdddc59b1a0952f3ba51287
[ "MIT" ]
null
null
null
""" This module contains the BaseImporter Abstract class which all other importers are inherited from. """ from abc import ABC, abstractmethod from utilities.constants import ImportModes class BaseImporter(ABC): def __init__(self, link, loaded_json_data): self.link = link self.json_data = loaded_json_data self.repo_owner = None self.repo_name = None @abstractmethod def import_labels(self): raise NotImplementedError @abstractmethod def execute(self, mode: ImportModes): raise NotImplementedError
23.875
98
0.713787
382
0.666667
0
0
169
0.294939
0
0
106
0.184991
9b6ff38b27b5eaa149ea68c6674af0e96146a1de
28
py
Python
trump/extensions/source/tx-worldbankst/__init__.py
Equitable/trump
a2802692bc642fa32096374159eea7ceca2947b4
[ "BSD-3-Clause" ]
8
2015-03-14T13:09:46.000Z
2020-08-29T17:49:52.000Z
trump/extensions/source/tx-worldbankst/__init__.py
Equitable/trump
a2802692bc642fa32096374159eea7ceca2947b4
[ "BSD-3-Clause" ]
64
2015-03-14T12:14:17.000Z
2015-08-15T12:31:42.000Z
trump/extensions/source/tx-worldbankst/__init__.py
Equitable/trump
a2802692bc642fa32096374159eea7ceca2947b4
[ "BSD-3-Clause" ]
10
2015-03-14T12:18:02.000Z
2022-01-18T21:44:27.000Z
from worldbankstext import *
28
28
0.857143
0
0
0
0
0
0
0
0
0
0
9b70b9748dd8ac6b70d6284121fe398a2d54b264
367
py
Python
ScratchPad/TestSendWeb.py
jdzawodniak/TempMonitorWeb
280ce2612af9125967b8113d50df945eaf532a5b
[ "MIT" ]
null
null
null
ScratchPad/TestSendWeb.py
jdzawodniak/TempMonitorWeb
280ce2612af9125967b8113d50df945eaf532a5b
[ "MIT" ]
null
null
null
ScratchPad/TestSendWeb.py
jdzawodniak/TempMonitorWeb
280ce2612af9125967b8113d50df945eaf532a5b
[ "MIT" ]
null
null
null
# Imports import requests import os import sys import lcddriver import time import datetime import RPi.GPIO as GPIO import dht11 thingspeak_key = 'ZHAO5MQEKA0B93P7' temperature = 23 humidity = 35 # Send the data to Thingspeak r = requests.post('https://api.thingspeak.com/update.json', data = {'api_key':thingspeak_key, 'field1':temperature, 'field2':humidity})
19.315789
135
0.771117
0
0
0
0
0
0
0
0
121
0.3297
9b71684b4558f4e73ca309d8159aa55dc5c42ada
51
py
Python
storage/models/__init__.py
parveenchahal/python-common
4e5488615db3e0f8ba7f0bfeee87304a98fee2d5
[ "MIT" ]
null
null
null
storage/models/__init__.py
parveenchahal/python-common
4e5488615db3e0f8ba7f0bfeee87304a98fee2d5
[ "MIT" ]
null
null
null
storage/models/__init__.py
parveenchahal/python-common
4e5488615db3e0f8ba7f0bfeee87304a98fee2d5
[ "MIT" ]
null
null
null
from ._storage_entry_model import StorageEntryModel
51
51
0.921569
0
0
0
0
0
0
0
0
0
0
9b7271707272e07905c19e8e64deead59d30237a
857
py
Python
data_utils/merge_dev_set.py
weihezhai/HatefulMemesChallenge
04f52643c0864d1efb6c0a9c674db42764f6834c
[ "MIT" ]
63
2020-12-09T18:58:16.000Z
2022-03-21T02:34:35.000Z
data_utils/merge_dev_set.py
weihezhai/HatefulMemesChallenge
04f52643c0864d1efb6c0a9c674db42764f6834c
[ "MIT" ]
5
2021-01-29T10:33:04.000Z
2021-08-25T14:15:27.000Z
data_utils/merge_dev_set.py
weihezhai/HatefulMemesChallenge
04f52643c0864d1efb6c0a9c674db42764f6834c
[ "MIT" ]
18
2020-12-11T20:36:04.000Z
2021-12-12T07:04:20.000Z
import os import json import fire def main(meme_dir): print("meme_dir: ", meme_dir) print("-" * 100) meme_val_anno_1 = [] with open(os.path.join(meme_dir, "dev_seen.jsonl")) as f: for line in f: meme_val_anno_1.append(json.loads(line)) meme_val_anno_2 = [] with open(os.path.join(meme_dir, "dev_unseen.jsonl")) as f: for line in f: meme_val_anno_2.append(json.loads(line)) id2val = {} for anno in meme_val_anno_1: id2val[anno['id']] = anno for anno in meme_val_anno_2: id2val[anno['id']] = anno out_path = os.path.join(meme_dir, "dev_all.jsonl") with open(out_path, 'w') as f: for anno_line in id2val.values(): seri_line = json.dumps(anno_line) f.write(f"{seri_line}\n") if __name__ == "__main__": fire.Fire(main)
25.205882
63
0.606768
0
0
0
0
0
0
0
0
101
0.117853
9b739e9baaf2f66a5a0221be7c0052b516ff1db9
1,324
py
Python
scripts/gen-go-pylons.py
KinSai1975/Menira.py
ca275ce244ee4804444e1827ba60010a55acc07c
[ "BSD-3-Clause" ]
118
2015-01-04T06:55:14.000Z
2022-01-14T08:32:41.000Z
scripts/gen-go-pylons.py
KinSai1975/Menira.py
ca275ce244ee4804444e1827ba60010a55acc07c
[ "BSD-3-Clause" ]
21
2015-01-03T02:16:28.000Z
2021-03-24T06:10:57.000Z
scripts/gen-go-pylons.py
KinSai1975/Menira.py
ca275ce244ee4804444e1827ba60010a55acc07c
[ "BSD-3-Clause" ]
53
2015-01-04T03:21:08.000Z
2021-08-04T20:52:01.000Z
#!/usr/bin/env python """Generate go-pylons.py""" import sys import textwrap import virtualenv filename = 'go-pylons.py' after_install = """\ import os, subprocess def after_install(options, home_dir): etc = join(home_dir, 'etc') ## TODO: this should all come from distutils ## like distutils.sysconfig.get_python_inc() if sys.platform == 'win32': lib_dir = join(home_dir, 'Lib') bin_dir = join(home_dir, 'Scripts') elif is_jython: lib_dir = join(home_dir, 'Lib') bin_dir = join(home_dir, 'bin') else: lib_dir = join(home_dir, 'lib', py_version) bin_dir = join(home_dir, 'bin') if not os.path.exists(etc): os.makedirs(etc) subprocess.call([join(bin_dir, 'easy_install'), '-f', 'http://pylonshq.com/download/%s', 'Pylons==%s']) """ def generate(filename, version): path = version if '==' in version: path = version[:version.find('==')] output = virtualenv.create_bootstrap_script( textwrap.dedent(after_install % (path, version))) fp = open(filename, 'w') fp.write(output) fp.close() def main(): if len(sys.argv) != 2: print >> sys.stderr, 'usage: %s version' % sys.argv[0] sys.exit(1) generate(filename, sys.argv[1]) if __name__ == '__main__': main()
25.461538
63
0.614804
0
0
0
0
0
0
0
0
792
0.598187
9b73b142beb25313894454214e85b3ed177d34f5
3,173
py
Python
cweqgen/sphinx/utils.py
cwinpy/cweqgen
b76634f0cdd62ede3295c584027ff911897590be
[ "MIT" ]
2
2022-01-14T18:09:15.000Z
2022-01-15T22:37:29.000Z
cweqgen/sphinx/utils.py
cwinpy/cweqgen
b76634f0cdd62ede3295c584027ff911897590be
[ "MIT" ]
null
null
null
cweqgen/sphinx/utils.py
cwinpy/cweqgen
b76634f0cdd62ede3295c584027ff911897590be
[ "MIT" ]
null
null
null
import os import pkg_resources import shutil from ..equations import equations from ..definitions import EQN_DEFINITIONS def generate_equations_doc(docfile): """ Helper function to automatically generate a documentation page containing all the available equations within cweqgen. Parameters ---------- docfile: str: The output file for the documentation. """ doccontents = """ ######### Equations ######### The currently implemented equations are: """ references = """\ References ---------- """ usedreferences = [] usedrefurls = [] refcount = 1 for eqn in EQN_DEFINITIONS: eqstr = "" # create equation eq = equations(eqn) if eq.reference_string in usedreferences: refnum = usedreferences.index(eq.reference_string) + 1 else: usedreferences.append(eq.reference_string) usedrefurls.append(eq.reference_adsurl) refnum = refcount refcount += 1 eqstr += """\ {0} {1} """.format( eq.description, "-" * len(eq.description) ) eqstr += """ This equation can be accessed from the :func:`~cweqgen.equations.equations` function using the name ``{}``. """.format( eqn ) eqno = "" if eq.reference_eqno is None else f"Eqn. {eq.reference_eqno} in " eqstr += """ The generated equation ({0} [{1}]_) is: .. math:: {2} """.format( eqno, refnum, eq.equation(nocomment=True) ) eqstr += """ The fiducial values defined for this equation are: .. math:: {} """.format( eq.fiducial_equation(nocomment=True) ) eqstr += """ .. note:: These fiducial values are just those defined within this package and may not be representative of fiducial values used elsewhere in the literature. """ eqstr += """ To generate the equation as calculated at particular values, the :func:`~cweqgen.equations.equations` can be used as .. py:function:: equations("{0}", {1}) :noindex: """.format( eq.equation_name, ", ".join( [ "{}={}".format(fid, str(val)) for fid, val in eq.default_fiducial_values.items() ] ), ) # add doc string lines for line in eq.__doc__.split("\n"): eqstr += f" {line}\n" doccontents += eqstr + "\n" # add in list of references for i in range(len(usedreferences)): references += """ .. [{0}] {1} [`ADS URL <{2}>`__] """.format( (i + 1), usedreferences[i], usedrefurls[i] ) with open(docfile, "w") as fp: fp.write(doccontents + references) def generate_yamlexample_doc(docfile, eqn="h0"): """ Output an example YAML file. Parameters ---------- docfile: str The output file for the documentation. eqn: str The name of the equation for which the docstring is required. """ src = os.path.join(pkg_resources.resource_filename("cweqgen", "eqnfiles"), f"{eqn}.yaml") shutil.copyfile(src, docfile)
22.188811
98
0.570753
0
0
0
0
0
0
0
0
1,409
0.444059
9b7594f95dc3f33774a8b817bdaeb1f8a8797812
3,624
py
Python
employee-project/src/FileIO.py
NischayaSharma/python-codes
f2216002a82f17a9103544f6ba361ed31eb85654
[ "MIT" ]
null
null
null
employee-project/src/FileIO.py
NischayaSharma/python-codes
f2216002a82f17a9103544f6ba361ed31eb85654
[ "MIT" ]
null
null
null
employee-project/src/FileIO.py
NischayaSharma/python-codes
f2216002a82f17a9103544f6ba361ed31eb85654
[ "MIT" ]
null
null
null
import os; import sys; FileName='FileIO.txt' def fileInput(fw,numOfEmployees): #Getting the value of counter frc = open(os.path.dirname(os.path.realpath(__file__))+"/counter.txt","r"); counter = int(frc.read()); frc.close(); #Taking input and writing to the file for i in range(counter,numOfEmployees+counter): empFName, empLName, empSalary, empEmailId = raw_input("Enter employee first name: "), raw_input("Enter employee last name: "), raw_input("Enter employee salary: "), raw_input("Enter employee Email ID: "); string = str(i)+" "+empFName+" "+empLName+" "+empSalary+" "+empEmailId+"\n"; fw.write(string); counter += 1; #Writing back to counterthe updated value. fwc = open(os.path.dirname(os.path.realpath(__file__))+"/counter.txt","w"); fwc.write(str(counter)+"\n"); fwc.close(); def fileSearch(fw, searchStr): line = fw.readline(); while line: empId, empFName, empLName, empSalary, empEmailId = line.split(); if(searchStr == empFName): print line; line = fw.readline(); def fileUpdate(fw,lineNum): #Taking the new record as input empFName, empLName, empSalary, empEmailId = raw_input("Enter employee first name: "), raw_input("Enter employee last name: "), raw_input("Enter employee salary: "), raw_input("Enter employee Email ID: "); updateStr = str(lineNum)+" "+empFName+" "+empLName+" "+empSalary+" "+empEmailId+"\n"; #Replacing the given record with he updated record and writing back to file lines = fw.readlines(); fwu = open(string, "w"); lines[lineNum]= updateStr; for line in lines: fwu.write(line); fwu.close(); def fileDelete(lineNum): #Deleting the record lines = fw.readlines(); fwu = open(string, "w"); lines.pop(lineNum); #Correcting the Employee Ids and Writing Back to File for line in lines: empId, empFName, empLName, empSalary, empEmailId = line.split(); empId = str(lines.index(line)); line = empId+" "+empFName+" "+empLName+" "+empSalary+" "+empEmailId+"\n"; fwu.write(line); fwu.close(); #Reducing Counter value frc = open(os.path.dirname(os.path.realpath(__file__))+"/counter.txt","r"); counter = int(frc.read()); frc.close(); fwc = open(os.path.dirname(os.path.realpath(__file__))+"/counter.txt","w"); fwc.write(str(counter-1)+"\n"); fwc.close(); def filePrint(): fw.seek(0); lines = fw.readlines(); print "The File: " for line in lines: print line; def crud(): #Creating and writing to file fw.seek(0); numOfEmployees = input("Enter the number of employees: "); fileInput(fw,numOfEmployees); filePrint(); #Reading the file for an element fw.seek(0); searchStr = raw_input("Enter the name of the employee you want to search: "); fileSearch(fw,searchStr); filePrint(); #Updating an entry in the file fw.seek(0); lineNum = int(input("Enter the entry you want to update(The entries start with 0 so the 1st entry is 0th entry and so on.): ")); fileUpdate(fw,lineNum); filePrint(); #Deleting an entry from the file fw.seek(0); lineNum = int(input("Enter the entry you want to delete(The entries start with 0 so the 1st entry is 0th entry and so on.): ")); fileDelete(lineNum); filePrint(); #Closing the file fw.close(); try: string = os.path.dirname(os.path.realpath(__file__))+'/'+FileName; fw = open(string, "a+"); crud(); except Exception as e: print e; fw.close(); sys.exit();
30.2
213
0.63521
0
0
0
0
0
0
0
0
1,125
0.31043
9b76216fa16aa9281bbd570ee1371176ada29324
4,442
py
Python
examples/cardless_credit_example.py
glendaesutanto/xendit-python
f9b131882ff7d045f2e2c6518933d1594efba3e6
[ "MIT" ]
10
2020-10-31T23:34:34.000Z
2022-03-08T19:08:55.000Z
examples/cardless_credit_example.py
glendaesutanto/xendit-python
f9b131882ff7d045f2e2c6518933d1594efba3e6
[ "MIT" ]
22
2020-07-30T14:25:07.000Z
2022-03-31T03:55:46.000Z
examples/cardless_credit_example.py
glendaesutanto/xendit-python
f9b131882ff7d045f2e2c6518933d1594efba3e6
[ "MIT" ]
11
2020-07-28T08:09:40.000Z
2022-03-18T00:14:02.000Z
import time from print_running_function import print_running_function # Hackish method to import from another directory # Useful while xendit-python isn't released yet to the public import importlib.machinery loader = importlib.machinery.SourceFileLoader("xendit", "../xendit/__init__.py") xendit = loader.load_module("xendit") class CreateCardlessCreditPayment: @staticmethod def run(xendit_instance, **kwargs): try: cardless_credit_payment = xendit_instance.CardlessCredit.create_payment( **kwargs ) print(cardless_credit_payment) except xendit.XenditError as e: print("Error status code:", e.status_code) print("Error message:", e) @staticmethod def example(xendit_instance): cardless_credit_items = [] cardless_credit_items.append( { "id": "item-123", "name": "Phone Case", "price": 200000, "type": "Smartphone", "url": "http://example.com/phone/phone_case", "quantity": 2, } ) customer_details = { "first_name": "customer first name", "last_name": "customer last name", "email": "[email protected]", "phone": "0812332145", } shipping_address = { "first_name": "first name", "last_name": "last name", "address": "Jl Teknologi No. 12", "city": "Jakarta", "postal_code": "12345", "phone": "081513114262", "country_code": "IDN", } args = { "cardless_credit_type": xendit.CardlessCreditType.KREDIVO, "external_id": f"id-{int(time.time())}", "amount": 10000, "payment_type": "3_months", "items": cardless_credit_items, "customer_details": customer_details, "shipping_address": shipping_address, "redirect_url": "https://my-shop.com/home", "callback_url": "https://my-shop.com/callback", } print_running_function("xendit.CardlessCredit.create_payment", args) CreateCardlessCreditPayment.run(xendit_instance, **args) class CalculatePaymentType: @staticmethod def run(xendit_instance, **kwargs): try: cardless_credit_payment_types = xendit_instance.CardlessCredit.calculate_payment_type( **kwargs ) print(cardless_credit_payment_types) except xendit.XenditError as e: print("Error status code:", e.status_code) print("Error message:", e) @staticmethod def example(xendit_instance): cardless_credit_items = [] cardless_credit_items.append( { "id": "item-123", "name": "Phone Case", "price": 200000, "type": "Smartphone", "url": "http://example.com/phone/phone_case", "quantity": 2, } ) args = { "cardless_credit_type": xendit.CardlessCreditType.KREDIVO, "amount": 10000, "items": cardless_credit_items, } print_running_function("xendit.CardlessCredit.calculate_payment_type", args) CalculatePaymentType.run(xendit_instance, **args) def ask_cardless_credit_input(): print("Input the action that you want to use") print("0. Exit") print("1. Create Payment / Generate Checkout URL") print("2. Calculate Payment Types") try: return int(input()) except ValueError: print("Invalid input. Please type a number") return ask_cardless_credit_input() def cardless_credit_example(xendit_instance): cardless_credit_input = ask_cardless_credit_input() while cardless_credit_input != 0: if cardless_credit_input == 1: print("Running example of Create Payment / Generate Checkout URL") CreateCardlessCreditPayment.example(xendit_instance) elif cardless_credit_input == 2: print("Running example of Calculate Payment Types") CalculatePaymentType.example(xendit_instance) cardless_credit_input = ask_cardless_credit_input()
35.822581
99
0.579244
3,159
0.711166
0
0
3,070
0.69113
0
0
1,300
0.292661
9b79ce41c55d1514dd77ba2f1d765d1a882ab8ed
2,220
py
Python
tests/test_lines.py
phipleg/trafaret-config
0063a5027e7db015e0b0b0dafd8159df409121f2
[ "Apache-2.0", "MIT" ]
26
2016-12-07T16:40:44.000Z
2020-11-09T03:27:23.000Z
tests/test_lines.py
phipleg/trafaret-config
0063a5027e7db015e0b0b0dafd8159df409121f2
[ "Apache-2.0", "MIT" ]
6
2017-10-27T13:50:21.000Z
2020-09-24T17:08:48.000Z
tests/test_lines.py
phipleg/trafaret-config
0063a5027e7db015e0b0b0dafd8159df409121f2
[ "Apache-2.0", "MIT" ]
5
2016-12-05T10:23:29.000Z
2020-06-05T15:31:24.000Z
import unittest from textwrap import dedent import trafaret as T from .util import get_err class TestSMTP(unittest.TestCase): TRAFARET = T.Dict({ T.Key('port'): T.Int(), T.Key('smtp'): T.Dict({ 'server': T.String(), 'port': T.Int(), 'ssl_port': T.Int(), }), }) def test_bad(self): self.assertEqual(get_err(self.TRAFARET, u"""\ smtp: server: mail.example.org port: unknown ssl_port: NaN port: ??? """),dedent("""\ config.yaml:3: smtp.port: value can't be converted to int -> 'unknown' config.yaml:4: smtp.ssl_port: value can't be converted to int -> 'NaN' config.yaml:5: port: value can't be converted to int -> '???' """)) class TestList(unittest.TestCase): TRAFARET = T.Dict({ "hosts": T.List(T.String() & T.Regexp("\w+:\d+")), }) def test_ok(self): self.assertEqual(get_err(self.TRAFARET, u"""\ hosts: - bear:8080 - cat:7070 """), None) def test_err(self): self.assertEqual(get_err(self.TRAFARET, u"""\ hosts: - bear:8080 - cat:x """), "config.yaml:3: hosts[1]: " "does not match pattern \\w+:\\d+\n" ) class TestInvalidYaml(unittest.TestCase): TRAFARET = T.Dict() def test_star(self): self.assertIn(get_err(self.TRAFARET, u"""\ port: 8080 host: localhost *: 1 """),{ # message depends on whether we use libyaml (C speedups) or not dedent( # with C speedups "config.yaml:3: did not find expected alphabetic or " "numeric character\n" "config.yaml:3: while scanning an alias\n" ), dedent( # without C speedups "config.yaml:3: expected alphabetic or numeric character, " "but found ':'\n" "config.yaml:3: while scanning an alias\n" )})
27.75
75
0.476577
2,119
0.954505
0
0
0
0
0
0
1,189
0.535586
9b79f3b170c6f1c8996ced8d0a625ff3c7e18cd9
4,856
py
Python
epytope/Data/pssms/arb/mat/B_5801_9.py
christopher-mohr/epytope
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
[ "BSD-3-Clause" ]
7
2021-02-01T18:11:28.000Z
2022-01-31T19:14:07.000Z
epytope/Data/pssms/arb/mat/B_5801_9.py
christopher-mohr/epytope
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
[ "BSD-3-Clause" ]
22
2021-01-02T15:25:23.000Z
2022-03-14T11:32:53.000Z
epytope/Data/pssms/arb/mat/B_5801_9.py
christopher-mohr/epytope
8ac9fe52c0b263bdb03235a5a6dffcb72012a4fd
[ "BSD-3-Clause" ]
4
2021-05-28T08:50:38.000Z
2022-03-14T11:45:32.000Z
B_5801_9 = {0: {'A': -0.3411047643185575, 'C': 0.003633483019123024, 'E': -0.4818751780000427, 'D': -0.48635888961606405, 'G': -0.2552323225624609, 'F': -0.18023397304713804, 'I': 0.3607439895775445, 'H': 0.020686177466924322, 'K': 0.8273437122618179, 'M': 0.47430136579724197, 'L': 0.17966127012728303, 'N': -0.3291966962696378, 'Q': -0.21345233956382428, 'P': -0.5325369892850287, 'S': -0.16301393166900496, 'R': 0.027601955371264083, 'T': -0.18363093014019005, 'W': 0.10578368712358037, 'V': 0.052805213226038004, 'Y': -0.02429605455631148}, 1: {'A': 1.174860463273255, 'C': -0.2457666452096607, 'E': -0.5906915606703014, 'D': -0.548169630828652, 'G': 0.19969510117868258, 'F': -0.36554838520842226, 'I': -0.3276255291469775, 'H': -0.5376109875970715, 'K': -0.45690036967999276, 'M': -0.041595243905379574, 'L': -0.3505575547489804, 'N': -0.31767465208943557, 'Q': -0.3475029432425459, 'P': -0.5979633564295069, 'S': 1.2852802397755638, 'R': -0.534535428563245, 'T': 0.6447770595158945, 'W': -0.441133012859596, 'V': -0.1520364358887288, 'Y': -0.50951053028935}, 2: {'A': 0.2684471724541413, 'C': -0.22902610856967154, 'E': -0.43278624501578816, 'D': -0.06934855994261531, 'G': -0.06716035432846008, 'F': 0.10455873668111254, 'I': 0.1925134837370194, 'H': -0.23149990350621824, 'K': -0.46548913891902827, 'M': 0.3464088618155669, 'L': 0.18626735624915097, 'N': 0.38542411767568263, 'Q': -0.22383835157789417, 'P': -0.48532126156662114, 'S': 0.4532418271352197, 'R': -0.4544277107989695, 'T': 0.3260679087260621, 'W': 0.15010475497333664, 'V': 0.07161428162621108, 'Y': 0.017730490237516758}, 3: {'A': 0.37784956251501206, 'C': -0.4793875343459822, 'E': -0.08902382036802833, 'D': -0.20050905903977564, 'G': -0.06495306821998638, 'F': -0.0593473711437512, 'I': 0.09933541588624818, 'H': 0.03514885697831995, 'K': -0.06116699534123581, 'M': -0.040991791908567006, 'L': -0.0835037295409453, 'N': 0.004148481569409193, 'Q': 0.1711363775698798, 'P': 0.24374294428136922, 'S': 0.2637317211760683, 'R': -0.07428765491674041, 'T': -0.20527317097312292, 'W': -0.30252432168185744, 'V': 0.011206871127331007, 'Y': -0.12549661307016982}, 4: {'A': -0.0037956386025211923, 'C': 0.3425836755273221, 'E': 0.10837411544244627, 'D': -0.10977722569677738, 'G': -0.07429577634177878, 'F': -0.05545998502340835, 'I': 0.03806137859551105, 'H': -0.14042662908810716, 'K': -0.20302056052250367, 'M': 0.1420266411631764, 'L': -0.1064722376037199, 'N': -0.17401409416144922, 'Q': 0.11997316956010566, 'P': -0.04128125080580932, 'S': 0.19196080156121637, 'R': -0.3491766626926857, 'T': 0.48839925104094956, 'W': -0.1944017253597289, 'V': 0.3636334120779938, 'Y': 0.005288600613324553}, 5: {'A': 0.024240456081329534, 'C': -0.05403424525777517, 'E': -0.1372571018612249, 'D': 0.1998462489077772, 'G': 0.03626418238439089, 'F': -0.22385026969299843, 'I': -0.007118698099601649, 'H': 0.18750955312048573, 'K': -0.25639938785996624, 'M': -0.10761999816284834, 'L': -0.07945610243767709, 'N': -0.01336954634949329, 'Q': 0.03388141345430495, 'P': 0.3792426447667947, 'S': 0.14003490093027127, 'R': -0.35413455397288635, 'T': -0.040374278317003756, 'W': 0.17171048536053823, 'V': 0.0144078763897194, 'Y': 0.3456580758311246}, 6: {'A': -0.048764474656820316, 'C': 0.12527155006022642, 'E': 0.018375613094484246, 'D': -0.14355729462432953, 'G': -0.24198435176223246, 'F': 0.5050091762270842, 'I': -0.23409484528144958, 'H': 0.26461313711055967, 'K': -0.29103757239392125, 'M': 0.10614249980976018, 'L': 0.2980575675511649, 'N': -0.12749768289935284, 'Q': -0.05399490523715788, 'P': -0.04337669219017715, 'S': -0.14150596935678242, 'R': -0.3052744786829771, 'T': -0.016085631730931502, 'W': 0.40021875630643317, 'V': -0.12139104413894072, 'Y': 0.04764866712879748}, 7: {'A': -0.2887306170747365, 'C': -0.05546020707654955, 'E': 0.19614530507925096, 'D': -0.11508919814164928, 'G': -0.12096740474241689, 'F': 0.008661990458820913, 'I': 0.06185055066826462, 'H': 0.40470050115085127, 'K': -0.13793373991315833, 'M': -0.19958425618472464, 'L': 0.171498045363748, 'N': 0.09101485071050694, 'Q': 0.31543446904424916, 'P': -0.2442195336322221, 'S': 0.137140741872122, 'R': 0.10414695150169023, 'T': 0.1017840080220198, 'W': -0.10367157482864542, 'V': -0.04055738088903421, 'Y': 0.14643767030214036}, 8: {'A': -0.5774250143899277, 'C': -0.5489099143796122, 'E': -0.5419428470896012, 'D': -0.5395040580297729, 'G': -0.5145904975923917, 'F': 0.4800720103518297, 'I': -0.1826648609200773, 'H': -0.16754627174560963, 'K': -0.594895104992003, 'M': 0.019272566780701248, 'L': -0.43483232548876344, 'N': -0.44121647814689663, 'Q': -0.43432236841340954, 'P': -0.5419428470896012, 'S': -0.5417201571462467, 'R': -0.5221447856642065, 'T': -0.5509579040144501, 'W': 1.9927421718393323, 'V': -0.5507750466260991, 'Y': 0.1924242909646485}, -1: {'slope': 0.11072004198674867, 'intercept': -0.4166818572835276}}
4,856
4,856
0.706549
0
0
0
0
0
0
0
0
558
0.114909
9b7a95fc7a817c6bbe96dbb60f85ab236a523c5a
919
py
Python
django_requests_logger/admin.py
mabouchama/django-requests-logger
d28bae0312878cb09f355e8793e56b6a7d1e6f72
[ "MIT" ]
1
2019-02-20T09:08:15.000Z
2019-02-20T09:08:15.000Z
django_requests_logger/admin.py
mabouchama/django-requests-logger
d28bae0312878cb09f355e8793e56b6a7d1e6f72
[ "MIT" ]
4
2022-02-15T12:43:15.000Z
2022-02-22T13:23:10.000Z
django_requests_logger/admin.py
mabouchama/django-requests-logger
d28bae0312878cb09f355e8793e56b6a7d1e6f72
[ "MIT" ]
2
2022-02-10T06:36:27.000Z
2022-02-16T06:58:16.000Z
from django.contrib import admin from django.utils.translation import gettext_lazy as _ from django_requests_logger.models import RequestLog class RequestLogAdmin(admin.ModelAdmin): list_display = ( 'url', 'method', 'response_status_code', 'created' ) list_filter = ('method', 'response_status_code') search_fields = ['url'] fieldsets = ( (None, { 'fields': ( 'url', 'method', 'response_status_code', 'created') }), (_('Request'), { 'classes': ('collapse',), 'fields': ( 'params', 'body', 'headers') }), (_('Response'), { 'classes': ('collapse',), 'fields': ( 'response_content', 'response_headers') }) ) readonly_fields = list(d for t in fieldsets for d in t[1]['fields']) admin.site.register(RequestLog, RequestLogAdmin)
28.71875
72
0.558215
724
0.787813
0
0
0
0
0
0
271
0.294886
9b7acf5a00804730593a41046352d93d47c45b81
4,006
py
Python
suspect/dag/expressions.py
michaelbynum/suspect
efbfbc4a004d8e167fd4a7247b465b6569818433
[ "Apache-2.0" ]
14
2018-07-10T20:15:15.000Z
2022-02-10T09:55:45.000Z
suspect/dag/expressions.py
michaelbynum/suspect
efbfbc4a004d8e167fd4a7247b465b6569818433
[ "Apache-2.0" ]
9
2019-10-11T15:27:15.000Z
2021-08-13T12:28:52.000Z
suspect/dag/expressions.py
michaelbynum/suspect
efbfbc4a004d8e167fd4a7247b465b6569818433
[ "Apache-2.0" ]
4
2019-10-07T14:57:31.000Z
2021-08-20T19:17:53.000Z
# Copyright 2017 Francesco Ceccon # # 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. from enum import Enum import abc import sys from suspect.math import inf # pylint: disable=no-name-in-module class Domain(Enum): """The variable domain""" REALS = 0 INTEGERS = 1 BINARY = 2 class Sense(Enum): """The objective function sense""" MINIMIZE = 0 MAXIMIZE = 1 class Expression(metaclass=abc.ABCMeta): """The base class for all expressions objects in the DAG""" is_source = False is_sink = False def __init__(self, children=None): if children is None: children = [] self._children = children @property def args(self): return self._children @property def args(self): return self._children def is_variable_type(self): return False def is_constant(self): return False class Objective(Expression): is_sink = True def __init__(self, name, sense=None, children=None): super().__init__(children) if sense is None: sense = Sense.MINIMIZE self.sense = sense self.name = name @property def body(self): return self.args[0] def is_expression_type(self): return True def is_minimizing(self): return self.sense == Sense.MINIMIZE def is_maximizing(self): return self.sense == Sense.MAXIMIZE class BoundedExpression(Expression): def __init__(self, lower_bound, upper_bound, children=None): super().__init__(children) self.lower_bound = lower_bound self.upper_bound = upper_bound def bounded_below(self): return self.lower_bound is not None and self.lower_bound != -inf def bounded_above(self): return self.upper_bound is not None and self.upper_bound != inf class Constraint(BoundedExpression): is_sink = True def __init__(self, name, lower_bound, upper_bound, children=None): super().__init__(lower_bound, upper_bound, children) self.name = name @property def body(self): return self.args[0] def is_expression_type(self): return True def is_equality(self): return self.lower_bound == self.upper_bound def __str__(self): return 'Constraint(name={}, lower_bound={}, upper_bound={}, args={})'.format( self.name, self.lower_bound, self.upper_bound, self.args ) class Variable(BoundedExpression): is_source = True def __init__(self, name, lower_bound, upper_bound, domain=None): super().__init__(lower_bound, upper_bound, None) self.domain = domain self.name = name def is_binary(self): return self.domain == Domain.BINARY def is_integer(self): return self.domain == Domain.INTEGERS def is_real(self): return self.domain == Domain.REALS def is_constant(self): # TODO(fracek): if we ever support fixing variables, change this return False def __str__(self): return 'Variable(name={}, lower_bound={}, upper_bound={}, domain={})'.format( self.name, self.lower_bound, self.upper_bound, self.domain ) class Constant(BoundedExpression): is_source = True def __init__(self, value): super().__init__(value, value, None) @property def value(self): assert self.lower_bound == self.upper_bound return self.lower_bound def is_constant(self): return True
25.0375
85
0.658512
3,292
0.821767
0
0
346
0.08637
0
0
908
0.22666
9b7cb7e95cec056b67de9696402880e28ea63ad1
5,662
py
Python
rubybot/cogs/memes.py
lakepower/Ruby-Bot
332d3f8bc9c8ba2902f67b59e360596778483473
[ "MIT" ]
null
null
null
rubybot/cogs/memes.py
lakepower/Ruby-Bot
332d3f8bc9c8ba2902f67b59e360596778483473
[ "MIT" ]
null
null
null
rubybot/cogs/memes.py
lakepower/Ruby-Bot
332d3f8bc9c8ba2902f67b59e360596778483473
[ "MIT" ]
null
null
null
import requests import bs4 import re import random import codecs import os from discord.ext import commands from discord.ext.commands import BucketType from cogs.utils import checks path_qaz = os.path.join(os.getcwd(), 'files', 'qaz.txt') path_riko = os.path.join(os.getcwd(), 'files', 'riko_meme') nsfw = [ "CngcndGUEAAZh8q.jpg", "Cnsqi9DUsAAtJG_.jpg", "Cnh5oJHUEAAICHv.jpg" ] class Memes: def __init__(self, bot): self.bot = bot self.init_qaz() self.init_riko() def init_qaz(self): self.filename = path_qaz self.qaz_file = open(self.filename, 'r') self.qaz_list = dict() for line in self.qaz_file: data = line.split() qaz_post = '' qaz_tag = '' for block in data: if block.startswith('http'): qaz_post += block + ' ' else: qaz_tag += block + ' ' self.qaz_list[qaz_tag.strip()] = qaz_post.strip() self.qaz_file.close() self.qaz_file = open(self.filename, 'a') def init_riko(self): self.riko_memes = os.listdir(path_riko) @commands.command(name='tsun', no_pm=True) @commands.cooldown(1, 5, BucketType.user) async def tsun(self, *, index: str=''): """ Displays a post from tsuntsunlive's Instagram. Original code taken from Chezz at https://github.com/chesszz/MemeBot/blob/master/MemeBot.py :param index: If an index is specified, the specific post on the front page is retrieved. If not, a random post is grabbed. """ msgs = self.get_tsun(index) for msg in msgs: await self.bot.say(msg) def get_tsun(self, index: str): r = requests.get('https://www.instagram.com/tsuntsunlive/') html = r.content soup = bs4.BeautifulSoup(html, 'html.parser') tag_list = soup.find_all("script", type="text/javascript") tag_list = [str(tag) for tag in tag_list] tag_list = sorted(tag_list, key=len) data_tag = tag_list[-1] after = index.split() try: index = int(after[0]) except ValueError: index = None except IndexError: index = None post_list = re.split('"caption": "', data_tag)[1:] if index is None: post = random.choice(post_list) else: post = post_list[index - 1] caption = post[:re.search('", "likes"', post).start()] caption = re.sub(r"(\\u[0-9a-f]{4})", lambda match: codecs.decode(match.group(1), "unicode_escape"), caption) caption = re.sub(r"\\n", "\n", caption) img_part = post[re.search('"display_src": "', post).end():] img = img_part[:re.search("\?", img_part).start()] img = re.sub(r"\\", "", img) data = [img, caption] return data @commands.group(pass_context=True, no_pm=True) @commands.cooldown(1, 5, BucketType.user) async def qaz(self, ctx): """ Lets you save dank qaz quotes. If a subcommand is not called, a random qaz quote is displayed. """ if ctx.invoked_subcommand is None: tags = list(self.qaz_list.keys()) await self.bot.say(self.qaz_list[tags[random.randrange(0, len(tags))]]) @qaz.command(pass_context=True, no_pm=True) async def add(self, ctx, name, *, link): """ Adds a qaz quote to the database. :param name: Name of the qaz quote :param link: Content of the qaz quote """ tag = name if tag not in list(self.qaz_list.keys()): print(self.qaz_file.write('\n' + link + ' ' + tag)) self.qaz_file.flush() self.qaz_list[tag] = link await self.bot.say('Tag added successfully!') else: await self.bot.say('That tag already exists!') @qaz.command(name='list', pass_context=True, no_pm=True) async def _list(self, ctx): """ Displays a list of all saved qaz quotes. """ await self.bot.say(list(self.qaz_list.keys())) @commands.group(name='riko', pass_context=True, invoke_without_command=True) @commands.cooldown(1, 5, BucketType.user) async def riko(self, ctx, filename=""): """ Uploads a Riko meme. Chooses a random meme if filename is not specified. :param filename: Filename of the meme. """ if ctx.invoked_subcommand is None: await self.upload_riko(filename) @riko.command(name='list') async def r_list(self): await self.bot.say('There are currently {} Riko memes!'.format(str(len(self.riko_memes)))) @riko.command(name='refresh', pass_context=True) @checks.is_owner() async def r_refresh(self, ctx): self.init_riko() await self.bot.say('Database refreshed!') async def upload_riko(self, filename): if not filename in self.riko_memes: filename = self.riko_memes[random.randrange(0, len(self.riko_memes))] while filename in nsfw: filename = self.riko_memes[random.randrange(0, len(self.riko_memes))] await self.bot.upload(fp=os.path.join(path_riko, filename), content=filename) print('uploaded riko meme') @riko.command() @checks.is_owner() async def blacklist(self, ctx, filename: str): nsfw.append(filename) def setup(bot): bot.add_cog(Memes(bot))
33.502959
132
0.575062
5,206
0.919463
0
0
2,691
0.475274
2,516
0.444366
1,276
0.225362
9b7cbdab3a8e39b99a930ed638449c9b5895940a
803
py
Python
src/python_parser/config.py
ttu/cubersensors-iot-azure
cdec18bb99f2316ed65179090f0f66b8791f57ca
[ "Apache-2.0" ]
1
2016-05-29T10:53:09.000Z
2016-05-29T10:53:09.000Z
src/python_parser/config.py
ttu/cubersensors-iot-azure
cdec18bb99f2316ed65179090f0f66b8791f57ca
[ "Apache-2.0" ]
null
null
null
src/python_parser/config.py
ttu/cubersensors-iot-azure
cdec18bb99f2316ed65179090f0f66b8791f57ca
[ "Apache-2.0" ]
1
2018-03-02T05:19:08.000Z
2018-03-02T05:19:08.000Z
# keys file is not included in repository import keys ROOT = "http://api.cubesensors.com" AUTH = "%s/auth" % ROOT RES = "%s/v1" % ROOT logger_name = "cubesensors_parser" # Define if should use event hub or insert data straight to db use_event_hub = False # CubeSensors config consumer_key = keys.cube_consumer_key consumer_secret = keys.cube_consumer_secret oauth_verifier = keys.cube_oauth_verifier access_token = keys.cube_access_token access_token_secret = keys.cube_access_token_secret # Azure config servicebus_namespace = keys.azure_servicebus_namespace eventhub_name = "cubesensor" eventhub_key_name = "cube_sender" eventhub_private_key = keys.cubesender_private_key # Database config db_user = keys.db_user db_password = keys.db_password db_name = keys.db_name db_server = keys.db_server
25.09375
62
0.808219
0
0
0
0
0
0
0
0
243
0.302615
9b7d015d0188b694a8bc8e7bf62510306eb4231c
375
py
Python
airflow/ascii.py
dtardoin/airflow
4d7f413c7db3ffdb1236e7799e4fe647842e5dbd
[ "Apache-2.0" ]
1
2021-03-02T20:08:53.000Z
2021-03-02T20:08:53.000Z
airflow/ascii.py
dtardoin/airflow
4d7f413c7db3ffdb1236e7799e4fe647842e5dbd
[ "Apache-2.0" ]
null
null
null
airflow/ascii.py
dtardoin/airflow
4d7f413c7db3ffdb1236e7799e4fe647842e5dbd
[ "Apache-2.0" ]
1
2019-05-14T16:19:12.000Z
2019-05-14T16:19:12.000Z
bug = r"""\ =, .= =.| ,---. |.= =.| "-(:::::)-" |.= \\__/`-.|.-'\__// `-| .::| .::|-' Pillendreher _|`-._|_.-'|_ (Scarabaeus sacer) /.-| | .::|-.\ // ,| .::|::::|. \\ || //\::::|::' /\\ || /'\|| `.__|__.' ||/'\ ^ \\ // ^ /'\ /'\ ^ ^ """
23.4375
46
0.114667
0
0
0
0
0
0
0
0
368
0.981333
9b7e0fc01325c4db573e5b390f7ba040016a6e45
11,092
py
Python
tooldb.py
SolidifiedRay/layout-web-tool
cefba938c1e03ea8da206ec7fb0c6d8a62f1fc1b
[ "MIT" ]
1
2020-04-01T15:05:54.000Z
2020-04-01T15:05:54.000Z
tooldb.py
SolidifiedRay/layout-web-tool
cefba938c1e03ea8da206ec7fb0c6d8a62f1fc1b
[ "MIT" ]
42
2017-05-23T17:19:19.000Z
2021-04-26T12:28:47.000Z
tooldb.py
SolidifiedRay/layout-web-tool
cefba938c1e03ea8da206ec7fb0c6d8a62f1fc1b
[ "MIT" ]
7
2017-05-04T02:13:07.000Z
2020-07-09T10:56:03.000Z
""" <Program Name> tooldb.py <Author> Lukas Puehringer <[email protected]> <Started> June 12, 2017 <Copyright> See LICENSE for licensing information. <Purpose> A basic collection of software supply chain tools in four categories - vcs (version control systems) - building - qa (quality assurance) - package (packaging) The tools are presented to the user on the different pages of the web wizard as options to choose from to define a custom supply chain TODO: - Update! Some of the tools might be not used at all while other popular tools are missing - Clean up! Common commands, logo, ... """ COLLECTION = { "vcs": [{ "type": "", "prog_lang": "", "name": "Git", "logo": "https://git-scm.com/images/logos/downloads/Git-Icon-1788C.png", "cmd": "git clone <repo>" }, { "type": "", "prog_lang": "", "name": "SVN", "logo": "https://subversion.apache.org/images/svn-square.jpg", "cmd": "svn checkout <repo>" }, { "type": "", "prog_lang": "", "name": "Mercurial", "logo": "https://www.mercurial-scm.org/logo-droplets-200.png", "cmd": "hg clone <repo>" }, { "type": "", "prog_lang": "", "name": "GNU Bazaar ", "logo": "http://bazaar.canonical.com/bzricons/bazaar-logo.png", "cmd": "bzr branch <remote repo> <local repo>" }, { "type": "", "prog_lang": "", "name": "Monotone", "logo": "https://www.monotone.ca/res/logo.png", "cmd": "mtn --db=<db> sync <repo>" }, { "type": "", "prog_lang": "", "name": "Fossil", "logo": "https://www.fossil-scm.org/index.html/doc/trunk/www/fossil3.gif", "cmd": "fossil clone <repo>" }, { "type": "", "prog_lang": "", "name": "Darcs", "logo": "http://darcs.net/img/logos/logo.png", "cmd": "darcs clone <repo>" }, { "type": "", "prog_lang": "", "name": "CVS", "logo": "", "cmd": "cvs co <repo>" }, { # "type": "", # "prog_lang": "", # "name": "AccuRev", # "logo": "https://pbs.twimg.com/profile_images/378800000092420461/aeab81f94d12ea387f7cae8868892112_400x400.png", # "cmd": "accurev mkstream -s <stream> -b <backing-stream>" # }, { # "type": "", # "prog_lang": "", # "name": "Veracity", # "logo": "https://discoversdkcdn.azureedge.net/runtimecontent/companyfiles/5875/3191/thumbnail.png", # "cmd": "" # }, { # "type": "", # "prog_lang": "", # "name": "ArX", # "logo": "https://arxequity.com/wp-content/themes/arx/img/logo_big_blue.png", # "cmd": "arx make-archive ArchiveName RepositoryDirectory" # }, { "type": "", "prog_lang": "", "name": "BitKeeper", "logo": "http://www.bitkeeper.org/man/BitKeeper_SN_Blue.png", "cmd": "bk clone <repo>" # }, { # "type": "", # "prog_lang": "", # "name": "SVK", # "logo": "", # "cmd": "svk commit [PATH\u2026]" # }, { # "type": "", # "prog_lang": "", # "name": "Plastic SCM", # "logo": "https://pbs.twimg.com/profile_images/378800000542266610/114e3495e712c5bc736970326ecfb9f2_400x400.png", # "cmd": "cm mkwk [name]" # }, { # "type": "", # "prog_lang": "", # "name": "Team Foundation Server", # "logo": "https://szul.blob.core.windows.net/images/team-foundation-server-2015-header.png", # "cmd": "tf get [itemspec]" }], "building": [{ "type": "make_based", "prog_lang": "", "logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/3/35/Tux.svg/150px-Tux.svg.png", "name": "make", "cmd": "make [-einpqrst] [-f makefile]... [-k|-S] [macro=value...] [target_name...]" }, { "type": "build_script_generation", "prog_lang": "", "logo": "", "name": "configure", "cmd": "./configure" }, { "type": "non_make_based", "prog_lang": "Java, C, C++", "logo": "http://antinstaller.sourceforge.net/manual/images/ant_logo_large.gif", "name": "Apache ANT", "cmd": "install, init, all" }, { "type": "non_make_based", "prog_lang": "", "logo": "http://www.scala-sbt.org/assets/typesafe_sbt_svg.svg", "name": "sbt", "cmd": "compile" }, { "type": "non_make_based", "prog_lang": "MS Visual Studio, C++", "logo": "http://www.eitcafe.com/wp-content/uploads/2016/07/msbuild.jpg", "name": "MS Build", "cmd": "MSBuild.exe MyProj.proj /property:Configuration=Debug , cl /EHsc hello.cpp" }, { "type": "non_make_based", "prog_lang": "Ruby", "logo": "", "name": "Rake", "cmd": "rake" }, { "type": "", "prog_lang": "XML(Project Object Model)", "logo": "https://maven.apache.org/images/maven-logo-black-on-white.png", "name": "Maven", "cmd": "mvn compile" }, { "type": "non_make_based", "prog_lang": "Python", "logo": "http://scons.org/images/SCons.png", "name": "Scons", "cmd": "scons foo.out" }], "qa": [{ "type": "Unit Testing", "prog_lang": "C", "name": "Check", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C", "name": "AceUnit", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C#", "name": "csUnit", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C#", # "name": "Visual Studio Unit Testing Framework", "name": "Visual Studio", "logo": "http://www.qatestingtools.com/sites/default/files/tools_shortcuts/Visual%20Studio%20Unite%20Testing%20Framework%20150.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C++", # "name": "Parasoft C/C++test", "name": "Parasoft", "logo": "https://discoversdkcdn.azureedge.net/runtimecontent/companyfiles/5703/1899/thumbnail.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C++", "name": "CppUnit", "logo": "http://www.howcsharp.com/img/0/9/cppunit-300x225.jpg", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Haskell", "name": "HUnit", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Haskell", "name": "QuickCheck", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Java", "name": "JUnit", "logo": "http://www.swtestacademy.com/wp-content/uploads/2015/11/Junit_Logo.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Java", "name": "Jtest", "logo": "http://www.bj-zhzt.com/datacache/pic/390_260_b91e82190f00f190d60d78bf53f6352b.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "JavaScript", "name": "Jasmine", "logo": "https://upload.wikimedia.org/wikipedia/en/thumb/2/22/Logo_jasmine.svg/1028px-Logo_jasmine.svg.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "JavaScript", "name": "Unit.js", "logo": "https://upload.wikimedia.org/wikipedia/en/e/ec/Unit_JS_logo.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "PHP", "name": "SimpleTest", "logo": "http://www.simpletest.org/images/simpletest-logo.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "PHP", "name": "PHPUnit", "logo": "http://4.bp.blogspot.com/-xrvHPUBqc7Y/Ucxe5ZYDVYI/AAAAAAAAAVE/cXtFm0NcE9A/s500/logo.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Python", "name": "unittest", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Python", "name": "doctest", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "R", "name": "RUnit", "logo": "", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "R", "name": "testthat", "logo": "https://d21ii91i3y6o6h.cloudfront.net/gallery_images/from_proof/13597/small/1466619792/rstudio-hex-testthat.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Scala", "name": "ScalaTest", "logo": "http://media.tumblr.com/ec3c87095fe8a21216c516606afffdcc/tumblr_inline_mtskzebUcv1s17bu5.jpg", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "Scala", "name": "ScUnit", "logo": "", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "Travis CI", "logo": "https://cdn.travis-ci.com/images/logos/TravisCI-Mascot-1-20feeadb48fc2492ba741d89cb5a5c8a.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "Java", "name": "Jenkins", "logo": "https://www.cloudbees.com/sites/default/files/Jenkins_8.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "Java", "name": "TeamCity", "logo": "http://workingwithdevs.com/wp-content/uploads/2014/05/TeamCity-logo.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "Bamboo", "logo": "https://www.vectorcast.com/sites/default/themes/vectorsoftware/images/Bamboo-logo_clipped.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "Codeship", "logo": "http://rixrix.github.io/ci-talk-codeship/images/logo_codeship_colour.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "CircleCI", "logo": "https://circleci.com/circleci-logo-stacked-fb.png", "cmd": "" }, { "type": "Continuous Integration", "prog_lang": "all", "name": "Buildbot", "logo": "https://buildbot.net/img/nut.png", "cmd": "" }, { "type": "Linting", "prog_lang": "Python", "name": "Pylint", "logo": "https://carlchenet.com/wp-content/uploads/2013/08/pylint-logo.png", "cmd": "" }, { "type": "Linting", "prog_lang": "Python", "name": "Flake8", "logo": "", "cmd": "" }, { "type": "Linting", "prog_lang": "Python", "name": "PyChecker", "logo": "", "cmd": "" }, { "type": "Linting", "prog_lang": "Java", "name": "Checkstyle", "logo": "http://checkstyle.sourceforge.net/images/header-checkstyle-logo.png", "cmd": "" }, { "type": "Linting", "prog_lang": "Java", "name": "Coverity", "logo": "https://2015.appsecusa.org/c/wp-content/uploads/2014/07/coveritylogo.png", "cmd": "" }, { "type": "Linting", "prog_lang": "C/C++", "name": "Lint", "logo": "", "cmd": "" }, { "type": "Linting", "prog_lang": "C/C++", "name": "Cppcheck", "logo": "https://cdn.portableapps.com/CppcheckPortable_128.png", "cmd": "" }, { "type": "Unit Testing", "prog_lang": "C", "name": "Check", "logo": "", "cmd": "" }, ], "package": [{ "type": "", "prog_lang": "", "logo": "", "name": "Tar", "cmd": "tar -cvf afiles.tar file1 file2 file3" }, { "type": "", "prog_lang": "", "logo": "", "name": "Zip", "cmd": "" }, { "type": "", "prog_lang": "", "logo": "", "name": "Wheel", "cmd": "python setup.py bdist_wheel" }, { "type": "", "prog_lang": "", "logo": "", "name": "MSI", "cmd": "" }] }
26.857143
136
0.542102
0
0
0
0
0
0
0
0
8,341
0.751983
9b7e283a083204b48c0d43c9af36980bb2c2c080
811
py
Python
operations/constant.py
anon-cand/nexpreval
e033bb9f5f25c74c44d0eb29748bf48193c185ae
[ "MIT" ]
null
null
null
operations/constant.py
anon-cand/nexpreval
e033bb9f5f25c74c44d0eb29748bf48193c185ae
[ "MIT" ]
null
null
null
operations/constant.py
anon-cand/nexpreval
e033bb9f5f25c74c44d0eb29748bf48193c185ae
[ "MIT" ]
null
null
null
from operations.operation import Operation class Constant(Operation): """ Class to represent a constant """ TAG = 'default' __slots__ = 'value' def __init__(self, value = None): self.value = value def __hash__(self): return hash(self.value) def __call__(self): """ Verify and return the constant stored within the object :return: value of this object """ if self.value and isinstance(self.value, (int, float)): return self.value return self.NAN def add_operand(self, operand, _): """ Add an operand for this operation """ try: int(operand) except ValueError: raise TypeError("Operand of type int is expected") self.value = int(operand)
23.852941
63
0.588163
764
0.942047
0
0
0
0
0
0
252
0.310727
9b7e3f441634f0a952e1cc4ac8faf39f1d5c0e8a
3,587
py
Python
flask_tutorial/marshmallow_demo/nesting_schemas.py
ftconan/python3
eb63ba33960072f792ecce6db809866b38c402f8
[ "MIT" ]
1
2018-12-19T22:07:56.000Z
2018-12-19T22:07:56.000Z
marshmallow_demo/nesting_schemas.py
ftconan/flask-tutorial
d5164c93b5e6a6e3d2b8980e4b846adb7cb21aee
[ "MIT" ]
12
2020-03-14T05:32:26.000Z
2022-03-12T00:08:49.000Z
marshmallow_demo/nesting_schemas.py
ftconan/flask-tutorial
d5164c93b5e6a6e3d2b8980e4b846adb7cb21aee
[ "MIT" ]
1
2018-12-19T22:08:00.000Z
2018-12-19T22:08:00.000Z
# coding=utf-8 """ @author: magician @date: 2018/9/13 """ import datetime as dt from marshmallow import Schema, fields, pprint class User(object): """ User """ def __init__(self, name, email): self.name = name self.email = email self.created_at = dt.datetime.now() self.friends = [] self.employer = None class Blog(object): def __init__(self, title, author): self.title = title self.author = author class UserSchema(Schema): """ user schema """ name = fields.String() email = fields.Email() # created_at = fields.DateTime() # friends = fields.Nested('self', only='name', many=True) friends = fields.Nested('self', many=True) # use the 'exclude' argument to avoid infinite recursion employer = fields.Nested('self', exclude=('employer', ), default=None) class BlogSchema(Schema): """ blog schema """ title = fields.String() # nested field author = fields.Nested(UserSchema) class BlogSchema2(Schema): """ blog schema2 specifying which fields to nest """ title = fields.String() # nested field author = fields.Nested(UserSchema, only=['email']) class SiteSchema(Schema): """ nest using dot delimiters """ blog = fields.Nested(BlogSchema2) class AuthorSchema(Schema): """ Make sure to use the 'only' or 'exclude' params to avoid infinite recursion """ books = fields.Nested('BookSchema', many=True, exclude=('author', )) class Meta: fields = ('id', 'name', 'books') class BookSchema(Schema): author = fields.Nested(AuthorSchema, only=('id', 'name')) class Meta: fields = ('id', 'title', 'author') if __name__ == '__main__': user = User(name='Monty', email='[email protected]') blog = Blog(title='Something Completely Different', author=user) result = BlogSchema().dump(blog) pprint(result) # specifying which fields to nest schema = BlogSchema2() result = schema.dump(blog) pprint(result) # nest using dot delimiters schema = SiteSchema(only=['blog.author.email']) site = { 'blog': { 'author': {'email': u'[email protected]'} } } result = schema.dump(site) pprint(result) # only value deserialized # new_user = { # 'name': 'Steve', # 'email': '[email protected]', # 'friends': ['Mike', 'Joe'] # } # serialized_data = UserSchema().dump(new_user) # pprint(serialized_data) # deserialized_data = UserSchema().load(result) # pprint(deserialized_data) # two-way nesting # author = Author(name='William Faulkner') # book = Book(title='As I Lay Dying', author=author) # book_result = BookSchema().dump(book) # pprint(book_result, indent=2) # { # "id": 124, # "title": "As I Lay Dying", # "author": { # "id": 8, # "name": "William Faulkner" # } # } # author_result = AuthorSchema().dump(author) # pprint(author_result, indent=2) # { # "id": 8, # "name": "William Faulkner", # "books": [ # { # "id": 124, # "title": "As I Lay Dying" # } # ] # } # nesting a schema within itself user = User('Steve', '[email protected]') user.friends.append(User('Mike', '[email protected]')) user.friends.append(User('Joe', '[email protected]')) user.employer = User('Dirk', '[email protected]') result = UserSchema().dump(user) pprint(result, indent=2)
23.444444
74
0.583496
1,593
0.444104
0
0
0
0
0
0
1,697
0.473097
9b7ec91f09b0e08306d5eb9d01d89bc063dc7870
3,906
py
Python
integration_tests/util/generate_scene.py
carderne/raster-vision
915fbcd3263d8f2193e65c2cd0eb53e050a47a01
[ "Apache-2.0" ]
1,577
2017-05-22T14:22:00.000Z
2022-03-31T02:03:25.000Z
integration_tests/util/generate_scene.py
carderne/raster-vision
915fbcd3263d8f2193e65c2cd0eb53e050a47a01
[ "Apache-2.0" ]
933
2017-05-09T20:25:02.000Z
2022-03-31T10:22:59.000Z
integration_tests/util/generate_scene.py
monocilindro/raster-vision
fc181a6f31f085affa1ee12f0204bdbc5a6bf85a
[ "Apache-2.0" ]
336
2017-05-15T16:30:44.000Z
2022-03-28T06:19:33.000Z
import random import click import numpy as np import rasterio from rasterio.transform import from_origin from rastervision.core.box import Box from rastervision.data import (RasterioCRSTransformer, ObjectDetectionLabels, ObjectDetectionGeoJSONStore) from rastervision.core.class_map import (ClassItem, ClassMap) @click.command() @click.option( '--task', '-t', type=click.Choice(['object_detection', 'semantic_segmentation']), required=True) @click.option('--chip_size', '-c', default=300, type=int) @click.option('--chips_per_dimension', '-s', default=3, type=int) @click.argument('tiff_path') @click.argument('labels_path') def generate_scene(task, tiff_path, labels_path, chip_size, chips_per_dimension): """Generate a synthetic object detection scene. Randomly generates a GeoTIFF with red and greed boxes denoting two classes and a corresponding label file. This is useful for generating synthetic scenes for testing purposes. """ class_map = ClassMap([ClassItem(1, 'car'), ClassItem(2, 'building')]) # make extent that's divisible by chip_size chip_size = chip_size ymax = chip_size * chips_per_dimension xmax = chip_size * chips_per_dimension extent = Box(0, 0, ymax, xmax) # make windows along grid windows = extent.get_windows(chip_size, chip_size) # for each window, make some random boxes within it and render to image nb_channels = 3 image = np.zeros((ymax, xmax, nb_channels)).astype(np.uint8) boxes = [] class_ids = [] for window in windows: # leave some windows blank if random.uniform(0, 1) > 0.3: # pick a random class class_id = random.randint(1, 2) box = window.make_random_square(50).to_int() boxes.append(box) class_ids.append(class_id) image[box.ymin:box.ymax, box.xmin:box.xmax, class_id - 1] = 255 # save image as geotiff centered in philly transform = from_origin(-75.163506, 39.952536, 0.000001, 0.000001) print('Generated {} boxes with {} different classes.'.format( len(boxes), len(set(class_ids)))) with rasterio.open( tiff_path, 'w', driver='GTiff', height=ymax, transform=transform, crs='EPSG:4326', compression=rasterio.enums.Compression.none, width=xmax, count=nb_channels, dtype='uint8') as dst: for channel_ind in range(0, nb_channels): dst.write(image[:, :, channel_ind], channel_ind + 1) if task == 'object_detection': # make OD labels and make boxes npboxes = Box.to_npboxes(boxes) class_ids = np.array(class_ids) labels = ObjectDetectionLabels(npboxes, class_ids) # save labels to geojson with rasterio.open(tiff_path) as image_dataset: crs_transformer = RasterioCRSTransformer(image_dataset) od_file = ObjectDetectionGeoJSONStore(labels_path, crs_transformer, class_map) od_file.save(labels) elif task == 'semantic_segmentation': label_image = np.zeros((ymax, xmax, 1)).astype(np.uint8) for box, class_id in zip(boxes, class_ids): label_image[box.ymin:box.ymax, box.xmin:box.xmax, 0] = class_id # save labels to raster with rasterio.open( labels_path, 'w', driver='GTiff', height=ymax, transform=transform, crs='EPSG:4326', compression=rasterio.enums.Compression.none, width=xmax, count=1, dtype='uint8') as dst: dst.write(label_image[:, :, 0], 1) if __name__ == '__main__': generate_scene()
33.965217
79
0.616999
0
0
0
0
3,508
0.898105
0
0
840
0.215054
9b7f4ac026f327923c4f012b100b9d4fe6b0b3e2
148
py
Python
examples/test_hanzi_dict.py
smilelight/lightDict
bd21afd90777489b6a62b9f6954f0d24c3f772d1
[ "Apache-2.0" ]
4
2020-01-15T09:54:40.000Z
2020-12-13T09:10:25.000Z
examples/test_hanzi_dict.py
smilelight/lightDict
bd21afd90777489b6a62b9f6954f0d24c3f772d1
[ "Apache-2.0" ]
null
null
null
examples/test_hanzi_dict.py
smilelight/lightDict
bd21afd90777489b6a62b9f6954f0d24c3f772d1
[ "Apache-2.0" ]
1
2021-05-28T09:40:14.000Z
2021-05-28T09:40:14.000Z
from lightdict import HanziDict hanzi_dic = HanziDict(r'D:\Data\NLP\corpus\words\hanzi.csv') print('和' in hanzi_dic) x = hanzi_dic['哈'] print(x)
16.444444
60
0.72973
0
0
0
0
0
0
0
0
47
0.309211
9b814e62cd1712261791628b00ae51e5874b229d
883
py
Python
src/quill/fold/wire/html_util.py
spin-systems/quill
b210f840e228295e41feaf4ff79f2cc8bd96889d
[ "MIT" ]
null
null
null
src/quill/fold/wire/html_util.py
spin-systems/quill
b210f840e228295e41feaf4ff79f2cc8bd96889d
[ "MIT" ]
14
2020-11-22T09:59:08.000Z
2021-11-02T16:05:35.000Z
src/quill/fold/wire/html_util.py
spin-systems/quill
b210f840e228295e41feaf4ff79f2cc8bd96889d
[ "MIT" ]
null
null
null
from bs4 import Tag __all__ = ["CustomHtmlTag", "Attrs", "PartialAttrs"] ######## General utility classes for tags and attrs class CustomHtmlTag(Tag): "Base class defining as_str for a bs4.Tag (may be overridden)" def as_str(self): return str(self)#.prettify() class Attrs(dict): "For passing into bs4.Tag constructor" def __init__(self, attr_dict): self.update({"attrs": attr_dict}) class PartialAttrs(Attrs): "Store a dict as an object property and pass a dict to create an attrs dict" def __init__(self, custom_attrs): super().__init__({**self.default_attrs, **custom_attrs}) @property def default_attrs(self): return self._default_attrs if hasattr(self, "_default_attrs") else dict() @default_attrs.setter def default_attrs(self, default_dict): self._default_attrs = default_dict
30.448276
81
0.682899
742
0.840317
0
0
227
0.257078
0
0
298
0.337486
9b81731e40409f7877598e1a56186915df1cedd5
573
py
Python
pycess/wsgi.py
pycess/pycess
07fa4cdd59fff5d51686bd6a769d78ece38a41d5
[ "BSD-2-Clause-FreeBSD" ]
1
2015-07-07T02:36:12.000Z
2015-07-07T02:36:12.000Z
pycess/wsgi.py
pycess/pycess
07fa4cdd59fff5d51686bd6a769d78ece38a41d5
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
pycess/wsgi.py
pycess/pycess
07fa4cdd59fff5d51686bd6a769d78ece38a41d5
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
""" WSGI config for pycess project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/ """ import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pycess.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application() import pycess.settings if hasattr(pycess.settings, 'USE_DJ_STATIC') and pycess.settings.USE_DJ_STATIC: from dj_static import Cling application = Cling(get_wsgi_application())
26.045455
79
0.788831
0
0
0
0
0
0
0
0
276
0.481675
9b821c976ee4f99cdb762f5c8e9e17a0905d593c
321
py
Python
Problem Solving/Algorithms/Introduction to Nim Game.py
Muntaha-Islam0019/HackerRank-Solutions
caa687aab67461aba69026d3bdc44b62c1dec1c9
[ "MIT" ]
null
null
null
Problem Solving/Algorithms/Introduction to Nim Game.py
Muntaha-Islam0019/HackerRank-Solutions
caa687aab67461aba69026d3bdc44b62c1dec1c9
[ "MIT" ]
null
null
null
Problem Solving/Algorithms/Introduction to Nim Game.py
Muntaha-Islam0019/HackerRank-Solutions
caa687aab67461aba69026d3bdc44b62c1dec1c9
[ "MIT" ]
null
null
null
from functools import reduce games = int(input()) for game in range(games): number_of_piles = int(input()) pile = list(map(int, input().rstrip().split())) result = reduce((lambda x, y: x ^ y), pile) # result = len(pile) % 2 [wont work on test case 2] print('Second' if result == 0 else 'First')
21.4
55
0.616822
0
0
0
0
0
0
0
0
66
0.205607
9b822cf2e09599ac604bde44effce84c6a2e3f54
54
py
Python
gr_module.py
GunarakulanGunaretnam/python-basic-fundamentals
c62bf939fbaef8895d28f85af9ef6ced70801f96
[ "Apache-2.0" ]
null
null
null
gr_module.py
GunarakulanGunaretnam/python-basic-fundamentals
c62bf939fbaef8895d28f85af9ef6ced70801f96
[ "Apache-2.0" ]
null
null
null
gr_module.py
GunarakulanGunaretnam/python-basic-fundamentals
c62bf939fbaef8895d28f85af9ef6ced70801f96
[ "Apache-2.0" ]
null
null
null
def print_name(): print("My name is Gunarakulan")
10.8
32
0.685185
0
0
0
0
0
0
0
0
24
0.444444
9b82673b26c46b4b26d95c88f868cace6cd8a642
294
py
Python
flows/statestore/tests/django_tests.py
sergioisidoro/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
[ "BSD-2-Clause" ]
104
2015-01-05T14:29:16.000Z
2021-11-08T11:20:24.000Z
flows/statestore/tests/django_tests.py
sergioisidoro/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
[ "BSD-2-Clause" ]
4
2015-09-23T11:14:50.000Z
2020-03-21T06:08:34.000Z
flows/statestore/tests/django_tests.py
sergioisidoro/django-flows
326baa3e216a15bd7a8d13b2a09ba9752e250dbb
[ "BSD-2-Clause" ]
16
2015-01-05T10:13:44.000Z
2022-02-14T05:21:23.000Z
import unittest from flows.statestore.django_store import StateStore from flows.statestore.tests.utils import store_state_works class DjangoStateStoreTest(unittest.TestCase): def test_django_store_state(self): store = StateStore() store_state_works(self, store)
24.5
58
0.765306
158
0.537415
0
0
0
0
0
0
0
0
9b830f6c20e0821da065a595dcea7c80e7322901
4,238
py
Python
tests/test_ann.py
mtezzele/EZyRB
30e6db72d444a3a1713f0af63ceb0585350a7ecf
[ "MIT" ]
39
2016-06-30T08:21:47.000Z
2022-03-18T16:05:30.000Z
tests/test_ann.py
mtezzele/EZyRB
30e6db72d444a3a1713f0af63ceb0585350a7ecf
[ "MIT" ]
38
2016-09-21T08:45:27.000Z
2022-03-07T13:48:59.000Z
tests/test_ann.py
mtezzele/EZyRB
30e6db72d444a3a1713f0af63ceb0585350a7ecf
[ "MIT" ]
47
2016-05-20T12:44:39.000Z
2022-03-05T05:01:19.000Z
import numpy as np import torch.nn as nn from torch import Tensor, from_numpy from unittest import TestCase from ezyrb import ANN np.random.seed(17) def get_xy(): npts = 20 dinput = 4 inp = np.random.uniform(-1, 1, size=(npts, dinput)) out = np.array([ np.sin(inp[:, 0]) + np.sin(inp[:, 1]**2), np.cos(inp[:, 2]) + np.cos(inp[:, 3]**2) ]).T return inp, out class TestANN(TestCase): def test_constructor_empty(self): ann = ANN([10, 5], nn.Tanh(), 20000) def test_constrctor_loss_none(self): ann = ANN([10, 5], nn.Tanh(), 20000, loss=None) assert isinstance(ann.loss, nn.MSELoss) def test_constructor_single_function(self): passed_func = nn.Tanh() ann = ANN([10, 5], passed_func, 20000) assert isinstance(ann.function, list) for func in ann.function: assert func == passed_func def test_constructor_layers(self): ann = ANN([10, 5], nn.Tanh(), 20000) assert ann.layers == [10, 5] def test_constructor_stop_training(self): ann = ANN([10, 5], nn.Tanh(), 20000) assert isinstance(ann.stop_training, list) assert ann.stop_training == [20000] def test_constructor_fields_initialized(self): ann = ANN([10, 5], nn.Tanh(), 20000) assert ann.loss_trend == [] assert ann.model is None def test_fit_mono(self): x, y = get_xy() ann = ANN([10, 5], nn.Tanh(), [20000, 1e-5]) ann.fit(x[:, 0].reshape(-1,1), y[:, 0].reshape(-1,1)) assert isinstance(ann.model, nn.Sequential) def test_fit_01(self): x, y = get_xy() ann = ANN([10, 5], nn.Tanh(), [20000, 1e-8]) ann.fit(x, y) assert isinstance(ann.model, nn.Sequential) def test_fit_02(self): x, y = get_xy() ann = ANN([10, 5, 2], [nn.Tanh(), nn.Sigmoid(), nn.Tanh()], [20000, 1e-8]) ann.fit(x, y) assert isinstance(ann.model, nn.Sequential) def test_predict_01(self): np.random.seed(1) x, y = get_xy() ann = ANN([10, 5], nn.Tanh(), 20) ann.fit(x, y) test_y = ann.predict(x) assert isinstance(test_y, np.ndarray) def test_predict_02(self): np.random.seed(1) x, y = get_xy() ann = ANN([10, 5], nn.Tanh(), [20000, 1e-8]) ann.fit(x, y) test_y = ann.predict(x) np.testing.assert_array_almost_equal(y, test_y, decimal=3) def test_predict_03(self): np.random.seed(1) x, y = get_xy() ann = ANN([10, 5], nn.Tanh(), 1e-8) ann.fit(x, y) test_y = ann.predict(x) np.testing.assert_array_almost_equal(y, test_y, decimal=3) def test_convert_numpy_to_torch(self): arr = [1.0, 2.0, 3.0, 4.0, 5.0] ann = ANN([10, 5], nn.Tanh(), 20000) value = ann._convert_numpy_to_torch(np.array(arr)) assert isinstance(value, Tensor) for i in range(len(arr)): assert value[i] == arr[i] def test_convert_torch_to_numpy(self): arr = [1.0, 2.0, 3.0, 4.0, 5.0] tensor = from_numpy(np.array(arr)).float() ann = ANN([10, 5], nn.Tanh(), 20000) value = ann._convert_torch_to_numpy(tensor) assert isinstance(value, np.ndarray) for i in range(len(arr)): assert value[i] == arr[i] def test_build_model(self): passed_func = nn.Tanh() ann = ANN([10, 5, 2], passed_func, 20000) ann._build_model(np.array([[1,2],[3,4]]), np.array([[5,6],[7,8]])) assert len(ann.model) == 6 + 1 for i in range(7): layer = ann.model[i] # the last layer, I keep the separated for clarity if i == 6: assert isinstance(layer, nn.Linear) elif i % 2 == 0: assert isinstance(layer, nn.Linear) else: assert layer == passed_func # check input and output assert ann.model[6].out_features == np.array([[5,6],[7,8]]).shape[1] assert ann.model[0].in_features == np.array([[1,2],[3,4]]).shape[1] for i in range(0, 5, 2): assert ann.model[i].out_features == ann.model[i+2].in_features
30.710145
82
0.558046
3,834
0.904672
0
0
0
0
0
0
74
0.017461
9b838f908501c804e2f543284ab15cfe75ddca4d
380
py
Python
ipub/params.py
ms8r/scriv2epub
a8d4ee7abc5b5bef654e40fec25605b34ed43207
[ "MIT" ]
8
2016-01-15T21:12:50.000Z
2021-10-17T18:47:40.000Z
ipub/params.py
ms8r/scriv2epub
a8d4ee7abc5b5bef654e40fec25605b34ed43207
[ "MIT" ]
null
null
null
ipub/params.py
ms8r/scriv2epub
a8d4ee7abc5b5bef654e40fec25605b34ed43207
[ "MIT" ]
null
null
null
import os.path _PATH_PREFIX = os.path.dirname(os.path.realpath(__file__)) _TEMPLATE_PATH = os.path.join(_PATH_PREFIX, 'tmpl') _TEMPLATE_EXT = '.jinja' _EPUB_SKELETON_PATH = os.path.join(_PATH_PREFIX, 'epub') _BASIC_CH_PAR_STYLE = 'par-indent' _FIRST_CH_PAR_STYLE = 'texttop' _DROP_CAP_STYLE = 'dropcap' _CLEAR_STYLE = 'clearit' _IN_PG_SEC_BREAK_STYLE = 'center-par-tb-space'
31.666667
59
0.776316
0
0
0
0
0
0
0
0
80
0.210526