blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
281
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
6
116
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
313 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
18.2k
668M
โŒ€
star_events_count
int64
0
102k
fork_events_count
int64
0
38.2k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
107 values
src_encoding
stringclasses
20 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
4
6.02M
extension
stringclasses
78 values
content
stringlengths
2
6.02M
authors
listlengths
1
1
author
stringlengths
0
175
51abc3a0995b54ff641ac7d9299e5d5c875dcdd3
bdcf6c539bc622e2236347ecc1fea1e0b512669c
/Bennos Projekte/QUAX-Manager/QuaxManager3/main.py
7009c188da514d91b011b2b67d4d0e8dcf7f3384
[]
no_license
TheRealCubeAD/BANDO
b06aa9e4d8551d07d55a6ff660e5f8b22301cb61
d756b81b2d8f1c92c1170a2af8bb99033cae60be
refs/heads/master
2022-09-01T12:13:00.999514
2022-08-07T10:10:08
2022-08-07T10:10:08
125,618,232
0
0
null
null
null
null
UTF-8
Python
false
false
13,628
py
import os import filecmp import string import time import shutil import datetime import threading IMAGE = 123 VIDEO = 789 IMAGE_ENDINGS = set(("png","dng","jpg","jpeg")) VIDEO_ENDINGS = set(("avi","mp4","mpeg")) IDENT_FILE = "IDENT.config" INTERNAL = "itd" EXTERNAL = "etd" STORAGE = "stc" def INTERRUPT(cause=None): print(cause) input() pass class DATE: def __init__(self, year, month, day, from_file=None, folder=False): if from_file: if not folder: file_date = os.path.getctime(from_file) file_date = str(datetime.datetime.fromtimestamp(file_date)) file_date = file_date.split()[0].split("-") self.year = int(file_date[0]) self.month = int(file_date[1]) self.day = int(file_date[2]) else: self.year, self.month, self.day = from_file.split(".") self.year = int(self.year) + 2000 self.month = int(self.month) self.day = int(self.day) else: self.year = year self.month = month self.day = day if type(self.year) != int or type(self.month) != int or type(self.day) != int: raise TypeError("date-component must be int") if self.month not in range(1, 13) or self.day not in range(1, 32): raise AttributeError("invalid date") def __eq__(self, other): return self.year == other.year and self.month == other.month and self.day == other.day def __hash__(self): return hash(self.to_string()) def duplicate(self): return DATE(self.year, self.month, self.day) def to_string(self): s_day = str(self.day) s_month = str(self.month) s_year = str(self.year) if len(s_day) < 2: s_day = "0" + s_day if len(s_month) < 2: s_month = "0" + s_month s_year = s_year[2:] return s_year + "." + s_month + "." + s_day def __str__(self): s_day = str(self.day) s_month = str(self.month) s_year = str(self.year) if len(s_day) < 2: s_day = "0" + s_day if len(s_month) < 2: s_month = "0" + s_month s_year = s_year[2:] return s_day + "." + s_month + "." + s_year class FILE: def __init__(self, path, name=None, ending=None, should_exist=False): self.date = None path = path.replace("\\", "/") self.path = "" if name: if ending: self.ending = ending self.name = name else: self.name, self.ending = name.split(".") self.path = path if self.path[-1] != "/": self.path += "/" else: parts = path.rstrip("/").split("/") self.name, self.ending = parts.pop().split(".") for part in parts: self.path += part + "/" if self.ending.lower() in IMAGE_ENDINGS: self.type = IMAGE elif self.ending.lower() in VIDEO_ENDINGS: self.type = VIDEO else: print("WARNING: Unknown File-type: " + self.ending) self.type = None self.should_exist = should_exist if self.should_exist: self.load_date() def get_full_path(self): return self.path + self.name + "." + self.ending def check_exsitance(self): if self.should_exist: while 1: if self.is_existing(): return True else: INTERRUPT("missing_file") else: return self.is_existing() def is_existing(self): return os.path.exists(self.get_full_path()) def load_date(self): self.check_exsitance() try: self.date = DATE(0, 0, 0, from_file=self.get_full_path()) except: self.date = None print("ERROR while loading file-date") def get_size(self): self.check_exsitance() try: return os.path.getsize(self.get_full_path()) except: print("WARNING: file_size_error") return 1 def copy(self, destination): full_destination = destination + self.name + "." + self.ending while 1: try: self.check_exsitance() if shutil.copy2(self.get_full_path(), full_destination) != full_destination: raise NameError if not filecmp.cmp(self.get_full_path(), full_destination, shallow=False): raise FileNotFoundError return except: INTERRUPT("file_copy") while 1: if not os.path.exists(destination): INTERRUPT("folder_missing") continue if os.path.exists(full_destination): try: os.remove(full_destination) if not os.path.exists(full_destination): return print("WARNING: File could not be deleted") except: INTERRUPT("file_deletion") class FOLDER: IMAGES_PATH = "Images/" VIDEOS_PATH = "Videos/" def __init__(self, path, name=None): path = path.replace("\\", "/") self.path = "" if name: self.path = path.rstrip() if self.path[-1] != "/": self.path += "/" self.name = name else: parts = path.split("/") self.name = parts.pop() for part in parts: self.path += part + "/" self.date = DATE(0, 0, 0, from_file=self.name, folder=True) def get_full_path(self): return self.path + self.name + "/" def create(self): while 1: try: if not os.path.exists(self.get_full_path()): os.mkdir(self.get_full_path()) if not os.path.exists(self.get_full_path()): raise FileNotFoundError if not os.path.exists(self.get_full_path() + self.IMAGES_PATH): os.mkdir(self.get_full_path() + self.IMAGES_PATH) if not os.path.exists(self.get_full_path() + self.IMAGES_PATH): raise FileNotFoundError if not os.path.exists(self.get_full_path() + self.VIDEOS_PATH): os.mkdir(self.get_full_path() + self.VIDEOS_PATH) if not os.path.exists(self.get_full_path() + self.VIDEOS_PATH): raise FileNotFoundError return except: INTERRUPT("folder_creation") def copy_file(self, file): full_path = self.get_full_path() if file.type == IMAGE: full_path += self.IMAGES_PATH else: full_path += self.VIDEOS_PATH file.copy(full_path) def does_exist(self, file): full_path = self.get_full_path() if file.type == IMAGE: full_path += self.IMAGES_PATH else: full_path += self.VIDEOS_PATH while 1: if os.path.exists(self.get_full_path()): break else: INTERRUPT("folder_missing") return os.path.exists(full_path + file.name + "." + file.ending) def __eq__(self, other): return self.get_full_path() == other.get_full_path() class SOURCE: def __init__(self, type): self.active = False self.path = None self.type = type self.files = [] self.searching = True self.search_thread = threading.Thread(target=self.search_path) self.search_thread.daemon = True self.search_thread.start() def search_path(self): while self.searching: available_drives = [drive + ":/" for drive in string.ascii_uppercase if os.path.exists(drive + ":")] for drive in available_drives: if os.path.exists(drive + IDENT_FILE): with open(drive + IDENT_FILE, "r") as info: lines = info.readlines() print(lines) if len(lines) < 2: print("WARNING: invalid config file") continue if lines[0].rstrip() == self.type: self.path = drive + lines[1].rstrip() self.search_files() self.active = True print(self.type, "found") return True time.sleep(1) def search_files(self): for folder in os.listdir(self.path): if "media" in folder.lower(): sub_path = self.path + folder + "/" for file_name in os.listdir(sub_path): self.check_existance() file = FILE(sub_path, name=file_name, should_exist=True) if file.type: self.files.append(file) def get_dates(self): all_dates = set() for file in self.files: all_dates.add(file.date) return all_dates def stop_searching(self): self.searching = False def check_existance(self): while 1: if os.path.exists(self.path): return True else: INTERRUPT(self.type+"_missing") class DESTINATION: def __init__(self): self.path = None self.folders = [] self.active = False self.search_thread = threading.Thread(target=self.search_path) self.search_thread.daemon = True self.search_thread.start() def search_path(self): while 1: available_drives = [drive + ":/" for drive in string.ascii_uppercase if os.path.exists(drive + ":")] for drive in available_drives: if os.path.exists(drive + IDENT_FILE): with open(drive + IDENT_FILE, "r") as info: lines = info.readlines() print(lines) if len(lines) < 2: print("WARNING: invalid config file") continue if lines[0].rstrip() == STORAGE: self.path = drive + lines[1].rstrip() self.search_folders() self.active = True print("dest found") return True time.sleep(1) def search_folders(self): self.check_existance() for folder_name in os.listdir(self.path): try: folder = FOLDER(self.path, name=folder_name) self.folders.append(folder) except: print("Invalid Folder: " + folder_name) def get_dates(self): all_dates = set() for folder in self.folders: all_dates.add(folder.date) return all_dates def check_existance(self): while 1: if os.path.exists(self.path): return True else: INTERRUPT(STORAGE+"_missing") def create_folders(self, dates): self.check_existance() for date in dates: self.check_existance() new_folder = FOLDER(self.path, name=date.to_string()) new_folder.create() self.folders.append(new_folder) def copy_file(self, file): for folder in self.folders: if folder.date == file.date: folder.copy_file(file) return True print("WARNING: Date not Found") def does_exist(self, file): for folder in self.folders: if folder.date == file.date: return folder.does_exist(file) print("WARNING: Date not Found") return False class CONTROL: def __init__(self): self.source_internal = SOURCE(INTERNAL) self.source_external = SOURCE(EXTERNAL) self.destination = DESTINATION() def start_transfer(self): if not (self.source_external.active or self.source_internal.active) or not self.destination.active: print("System not ready yet!") return False self.source_external.stop_searching() self.source_internal.stop_searching() to_create_dates = self.source_internal.get_dates() to_create_dates = to_create_dates.union(self.source_external.get_dates()) to_create_dates.difference(self.destination.get_dates()) self.destination.create_folders(to_create_dates) all_files = self.source_internal.files + self.source_external.files to_copy = [file for file in all_files if not self.destination.does_exist(file)] all_space = sum([file.get_size() for file in to_copy]) print("Copying " + str(all_space) + " Byte in " + str(len(to_copy)) + " Files") for file in to_copy: print(" Copying " + file.name + " ...") self.destination.copy_file(file) print("Finished!") return True def test(cause): input(">>>") c = CONTROL() while 1: time.sleep(1) input() if c.start_transfer(): break
3412bc422fb6235564f0b57b12435dcbc6b538bf
eb9c3dac0dca0ecd184df14b1fda62e61cc8c7d7
/google/cloud/kms/v1/kms-v1-py/google/cloud/kms_v1/services/key_management_service/__init__.py
728218e181e680e1d75ce85d1b9e2142874feb86
[ "Apache-2.0" ]
permissive
Tryweirder/googleapis-gen
2e5daf46574c3af3d448f1177eaebe809100c346
45d8e9377379f9d1d4e166e80415a8c1737f284d
refs/heads/master
2023-04-05T06:30:04.726589
2021-04-13T23:35:20
2021-04-13T23:35:20
null
0
0
null
null
null
null
UTF-8
Python
false
false
795
py
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # 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 .client import KeyManagementServiceClient from .async_client import KeyManagementServiceAsyncClient __all__ = ( 'KeyManagementServiceClient', 'KeyManagementServiceAsyncClient', )
[ "bazel-bot-development[bot]@users.noreply.github.com" ]
bazel-bot-development[bot]@users.noreply.github.com
dd6f5f85aed5431dcc5d6f54a167b1a3ad008d74
07daef15cc1cfe45712811c83a771a044dd03ebf
/myvenv/Scripts/django-admin.py
98020e79406622606dcd802efa3e5ce85fc40b4c
[]
no_license
rkdtmddnjs97/kmu_likelion_lesson_8th
c29024ccac54f623cd6cbf7ee3921ded54204eb5
e9b2992b233c1d8a2e00f33d6716a6042ac49a19
refs/heads/master
2022-06-20T05:56:33.998526
2020-05-14T06:37:55
2020-05-14T06:37:55
263,804,501
1
0
null
null
null
null
UTF-8
Python
false
false
173
py
#!c:\users\rkdtm\desktop\kmu_likelion8th\myvenv\scripts\python.exe from django.core import management if __name__ == "__main__": management.execute_from_command_line()
0485afd33fb758d0685dc00ab7dc02c61a7c1dfe
b36eace4a335f2518988f5929ffdba6e48c9e97e
/posts/admin.py
73419fc31cbfc465253fb736228f37c88e9a522a
[]
no_license
berkyaglioglu/Post-Sharing-Application
d3c4187a8b05cf34c65fee5cc90ab6b85740e754
c169af6d27dd55ea711207e3e4b04cc61e678dca
refs/heads/master
2020-06-22T22:42:56.720956
2019-08-01T08:40:04
2019-08-01T08:40:04
198,419,497
0
0
null
2019-08-01T08:40:06
2019-07-23T11:46:57
Python
UTF-8
Python
false
false
145
py
from django.contrib import admin import django from .models import Post, Ingredients admin.site.register(Post) admin.site.register(Ingredients)
6b47716cb6f55c7cc6a34a6b37043fb59aaa4fbb
6254584a5febbfcd6babed94ed05c1de4e7c80bd
/genCSS.py
3c72901514003dc76c716c171c1a975a71bbf32f
[]
no_license
pathumego/font-process-animator
81304b975d0aebaf5389a3ef8bf3a0c942d341c5
88e23f9986b71831710452b7f3f7f3bd3b550049
refs/heads/master
2021-01-22T19:31:16.485961
2016-11-29T12:14:43
2016-11-29T12:14:43
40,301,812
2
1
null
2016-11-29T12:14:43
2015-08-06T11:41:37
null
UTF-8
Python
false
false
739
py
import os def getFileListToArray(): elements = ( os.listdir('fonts/') ) for element in elements: if element.endswith( '.css' ) or element.endswith( 'Log' ): elements.remove( element ) elements.sort() return elements def writeToFile( fontName, fontFormat ): CSSFile = open( 'fonts/fonts.css', 'ab+' ) elements = getFileListToArray() for i in elements: CSSFile.write( bytes( "@font-face {\n", 'UTF-8' ) ) CSSFile.write( bytes( ' font-family:\'' + i[ :-4 ] + "\';\n", 'UTF-8' ) ) CSSFile.write( bytes( ' src:url(\"' + fontName + "\") format(\'" + fontFormat + "\');\n", 'UTF-8' ) ) CSSFile.write( bytes( '}\n\n', 'UTF-8' ) ) CSSFile.close()
e3857d5d953a43b0d3e5f393152b820ac12e7d3b
5d5561589dd5a8c7e0e6fa31a484238cc903d1f7
/ProgressiveLoader/cetate_img.py
94bb81034e4dcb9e1bd9e762651673ed5ea4b23b
[]
no_license
peixin/cn2tw
fccda2aa2ed95aae9a038a565f4bc99243e23674
6178f9cf1cbdc2de08e9ec575c35735c177b1ae3
refs/heads/master
2021-05-29T11:58:18.688251
2015-04-17T07:35:11
2015-04-17T07:35:11
33,116,958
1
0
null
null
null
null
UTF-8
Python
false
false
586
py
# coding=utf-8 from PIL import Image from PIL import ImageFile from exceptions import IOError def main(): img = Image.open('2.jpg') destination = '2_py_progressive.jpeg' try: img.save(destination, "JPEG", quality=80, optimize=True, progressive=True) except IOError, e: print(e) ImageFile.MAXBLOKC = img.size[0] * mig.zise[1] img.save(destination, "JPEG", quality=80, optimize=True, progressive=True) if __name__ == '__main__': # main() a = 4333837 print(hex(4333837), hex(1097372565632), hex(4286611584))
b86af03b4a3d06e33a2362c0b892d0b0423a6674
a27226dc758b2922ee2068aec4134237b821eb5e
/Blogger/Blog/migrations/0005_likecomment_date.py
a63a2e173a735e954e4df96cf92fb016576c144f
[]
no_license
trilok002/myBlogger
56a0d3eaa627777b0ceb2c3842e174a7da56c2e2
6cbfd70f506318e35e3b99e28dededd64fd4cc9a
refs/heads/master
2023-01-09T04:42:30.465036
2020-11-12T10:21:27
2020-11-12T10:21:27
311,295,994
0
0
null
null
null
null
UTF-8
Python
false
false
378
py
# Generated by Django 3.0 on 2020-01-10 11:10 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Blog', '0004_auto_20200110_1550'), ] operations = [ migrations.AddField( model_name='likecomment', name='date', field=models.DateField(null=True), ), ]
86e0e080f61ad0e8524181b4748ad09937bf617f
1fa9ca9ab5bd0121fa557893ae937a2cf312e564
/ch2/ch2_lexresources.py
fb42b4c068c16227a2c6c757b5a01d822b4140b9
[]
no_license
alexbumpers/NLTK_Practice
b3c02f16fcfe0a2e40e7febaf4560c47f86b1f0d
4051ad5da02b2173c73b2d3fb771d717cdd6e366
refs/heads/master
2020-04-12T09:44:31.952080
2017-01-11T15:33:08
2017-01-11T15:33:08
65,736,554
0
0
null
null
null
null
UTF-8
Python
false
false
4,690
py
import nltk from nltk.corpus import gutenberg #gutenberg.fileids() #def unusual_words(text): #text_vocab = set(w.lower() for w in text if w.isalpha()) #english_vocab = set(w.lower() for w in nltk.corpus.words.words()) ## .difference() returns new set with elements in x but not y ## in this example, text_vocab = x ; english_vocab = y #unusual = text_vocab.difference(english_vocab) #return sorted(unusual) #print unusual_words(nltk.corpus.gutenberg.words('austen-sense.txt')) #print unusual_words(nltk.corpus.nps_chat.words()) ## -------- stopwords -------- ## stopwords are high frequency words like the, to, and, also, etc. #from nltk.corpus import stopwords #from nltk.corpus import gutenberg #gutenberg.fileids() #print stopwords.words('english') ##just returns 0 for some reason #def content_fraction(text): #stopwords = nltk.corpus.stopwords.words('english') #content = [w for w in text if w.lower() not in stopwords] #return len(content) / len(text) #print content_fraction(nltk.corpus.gutenberg.words('austen-sense.txt')) ##same as line 26 #def content_fraction(text): #stopwords = nltk.corpus.stopwords.words('english') #content = [w for w in text if w.lower() not in stopwords] #return len(content) / len(text) #print int(content_fraction(nltk.corpus.reuters.words())) ## -------- SEE 2-6 ON PAGE 61 ------- ##letters in the puzzle. They must all be used once per word. ##each word must contain 'r' and there must be at least one 9 letter word ##no plurals ending in 's', no foreign words, no proper names. #puzzle_letters = nltk.FreqDist('egivrvonl') #obligatory = 'r' #wordlist = nltk.corpus.words.words() #puzzle_solution = [w for w in wordlist if len(w) >= 4 #and obligatory in w #and nltk.FreqDist(w) <= puzzle_letters] #print puzzle_solution # ----- names by gender ----- #import nltk #from nltk.corpus import names #print names.fileids() #male_names = names.words('male.txt') #female_names = names.words('female.txt') #print [w for w in male_names if w in female_names] ##returns last letter of names by sex in c_freqdist, then plots it #cfd = nltk.ConditionalFreqDist( #(fileid, name[-1]) #for fileid in names.fileids() #for name in names.words(fileid) #) #print cfd.plot() ## ----- CMU Pronouncing Dictionary ----- import nltk from nltk.corpus import cmudict entries = nltk.corpus.cmudict.entries() print len(entries) for entry in entries[39943:39951]: print entry ##scans lexicon looking for entires who pronunciation consists of 3 phones ##if true, assigns contents of pron to 3 variables: ph1, ph2, ph3 for word, pron in entries: if len(pron) == 3: ph1, ph2, ph3 = pron if ph1 == 'P' and ph3 == 'T': print word, ph2 ##for loop that returns/prints all words ending with -nicks pronunciation syllable = ['N', 'IH0', 'K', 'S'] print [word for word, pron in entries if pron[-4:] == syllable] ## For loop that returns words ending with 'mn' pronunciation, where 'M' ## is pronounced with a silent n print [w for w, pron in entries if pron[-1] == 'M' and w[-1] == 'n'] ## Print beginning of words where 'N' is pronounced and the letter preceding ## it is silent (e.g.: knob, pneumonia, knife) print sorted(set(w[:2] for w, pron in entries if pron[0] == 'N' and w[0] != 'n')) ## Phones contain digits to represent primary stress (1), secondary stress (2), ## no stress (0). ## Function below defines function to extract stress digits and then scan ## lexicon to find words w/ particular stress pattern. def stress(pron): return [char for phone in pron for char in phone if char.isdigit()] print [w for w, pron in entries if stress(pron) == ['0', '1', '2', '0']] print [w for w, pron in entries if stress(pron) == ['0', '2', '0', '1', '0']] ## Finds all 'p' word consisting of three sounds, groups them according to ## their first and last sounds. ##p words with 3 sounds p3 = [(pron[0] + '-' + pron[2], word) for (word, pron) in entries if pron[0] == 'P' and len(pron) == 3] ## ConditionalFreqDist of p3 cfd = nltk.ConditionalFreqDist(p3) ## for template in cfd.conditions(): if len(cfd[template]) > 10: words = cfd[template].keys() wordlist = ' '.join(words) print template, wordlist[:70] + "..." prondict = nltk.corpus.cmudict.dict() print prondict['fire'] ##'blog' doesn't exist in cmudict.dict(), gives KeyError #print prondict['blog'] ##assigns pron to 'blog' in this script prondict['blog'] = ['B', 'L', 'AA1', 'G'] print prondict['blog'] text = ['natural', 'language', 'processing'] print [ph for w in text for ph in prondict[w][0]]
4671c52d67a2c52405795ec4df4cacd024ba19c0
e67a3db1aef6c62eb9d419da74b37ea0b2ba8029
/hkyoon/love_liverpool.py
ce49ca23204239429e75989b4e976880415b9b3f
[]
no_license
lilyyoon/hkyoon
1ad28f5e5226aee29572a5bf5c976ea7147479a2
6d1f38869a3c606e06966e59537eda0a17f4a386
refs/heads/master
2020-06-02T00:54:44.441211
2019-06-09T09:44:54
2019-06-09T09:44:54
190,985,146
0
0
null
null
null
null
UTF-8
Python
false
false
14
py
YNWA liverpool
0dcb4282491a5b8542b9f778ff9f79a24647d434
269f2b3b418083c3c15e84a118d5cb55bc13fc71
/pythonexercicios/ex037 comversor de bases numericas.py
88fea769b749da32dfca0669f3dd5839c942eafe
[]
no_license
LindomarB/Curso-em-video-python-git
0e38d40e091fe64fb590d16779162759f6d402dd
0d5f7c7eb9eed06b8495ea435f27e6623ea89354
refs/heads/master
2022-12-25T04:28:39.580278
2018-05-29T14:32:54
2018-05-29T14:32:54
135,308,766
0
1
null
2022-12-11T19:12:49
2018-05-29T14:30:49
Python
UTF-8
Python
false
false
374
py
#escreva um programa que leia um numero inteiro qualque #e peรงa para o usuario escolher qual sera a base de conversao #1 para binario #2 para octal #3 para hexadecimal n = int(input('digite um numero: ')) r = int(input("""1 = binario 2 = hexadecimal 3 = octal """ )) if r == 1: print(bin(n)[2:]) elif r == 2: print(hex(n)[2:]) elif r == 3: print(oct(n)[2:])
f03cbd0776557b97bca758eac8ddf48281a65fe1
aa55945714117a0a25b45a7ed110a9d42b4e9d47
/UserStore.py
811ad60cfd787a3f329f6fd102a7186c1ed27333
[]
no_license
EnotionZ/FoodListing
941ef02b648cce181e8d02dce5ab00ead60c0d9a
8c502674cca4e3f611cef980d103548a4f116583
refs/heads/master
2021-01-04T14:06:37.375130
2012-03-09T01:25:21
2012-03-09T01:25:21
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,196
py
""" UserInfo.py -- Grabs user info from the database. by Sean. """ from Config import Config from pymongo import Connection from datetime import datetime import time from hashlib import sha256 from base64 import b64encode import logging class UserStore: def __init__( self, config ): self.config = Config( config ) self.address = self.config['mongo']['address'] self.port = self.config['mongo']['port'] self.database = "foodlisting" self.logger = logging.getLogger( "FoodListing.DB.UserInfo" ) try: self.database = self.config['mongo']['database'] except: pass self.collection = "users" self.con = Connection( self.address, self.port ) self.db = self.con[self.database] self.collection = self.db[self.collection] self.food = self.db['food'] #self.collection.ensure_index( "id", unique=True ) """ PRE: uid = fb, google, other id name = user's real name gathered from their account upon registration. age = user's real age gathered from their account upon registration. loc = 2-tuple that contains their approximate lat/lng. this can be gotten from facebook/google or guess from their registration ip. POST: The user with the above information is added, and the object is returned from the function to be used else where. """ def addUser( self, id, idType, name, password, age, zip, loc ): user = {} user['uid'] = id #user id user['idType'] = idType#id type, facebook, google, ect... user['food_history'] = [] #all food ordered by this person user['name'] = name #name of the user user['pass'] = b64encode( sha256( password ).digest() ) user['age'] = age #age of the person user['location'] = loc #location user['zip'] = zip #zip code if self.collection.save( user ) != None: return user['uid'] else: return None """ PRE: id = the users id POST: The RV is the user document or None if it does not exist. """ def getByID( self, id ): user = self.collection.find_one( { "uid": id } ) user['_id'] = str( user['_id'] ) history = user['food_history'] food = [] for h in history: h['date'] = str( h['date'] ) f = self.food.find_one( { "_id": h['fid'] } ) if not f == None: try: f['_id'] = str( f['_id'] ) f['date'] = str( f['date'] ) food.append( f ) except: print f user['food_history'] = food return user """ PRE: username and password are defined. POST: The RV is not none if the user and password combination work. """ def checkUser( self, username, password ): p = b64encode( sha256( password ).digest() ) return self.collection.find_one( { "name": username, "pass": p } ) def addFood( self, id, fid ): food = { "fid": fid, "date": datetime.now() } return self.collection.update( { "uid": id }, { "$push": { "food_history": food } } ) if __name__ == "__main__": u = UserStore( "config.json" ) a = u.addUser( "12345543215", "facebook", "Megan", "password", 21, 20151, ( 73.1, 73.1 ) ) a = u.getByID( a ) print a
069cfe8f788574fd861f98725e5d9cc0701879d0
11395aa469ecd56ea73efaf6f35128f17c42d5f4
/api/database.py
538550442a4474bc97bbb19062ccc487d35b6134
[]
no_license
kottas/http-rest-demo
4d7f2bd395259f645781e9ff5a3c3cd1f1aa686a
13fdd391ab69f061767949fef89254754afa59b4
refs/heads/master
2023-03-09T06:56:11.050061
2021-02-14T21:16:09
2021-02-14T21:16:09
338,868,090
2
0
null
null
null
null
UTF-8
Python
false
false
2,277
py
from elasticsearch import Elasticsearch, NotFoundError, RequestError, ElasticsearchException from elasticsearch.client.indices import IndicesClient from typing import List, Tuple from .schemas import Document, DocumentIndex, DocumentText, SearchResult INDEX = "en_documents" async def document_add(elasticsearch: Elasticsearch, document: Document) -> DocumentIndex: response = elasticsearch.index(index=INDEX, body=document.dict()) return DocumentIndex(index=response.get("_id", "")) async def document_retrieve(elasticsearch: Elasticsearch, index: str) -> DocumentText: response = elasticsearch.get(index=INDEX, id=index) source = response.get("_source", {}) return DocumentText(text=source.get("text", "")) async def document_search( elasticsearch: Elasticsearch, vector: List[float], top_k: int ) -> List[SearchResult]: response = elasticsearch.search( index=INDEX, body={ "size": top_k, "query": { "script_score": { "query": {"match_all": {}}, "script": { "source": "cosineSimilarity(params.queryVector, 'vector') + 1.0", "params": {"queryVector": vector}, }, } }, }, ) return [ SearchResult(index=hit["_id"], text=hit["_source"]["text"], score=hit["_score"]) for hit in response["hits"]["hits"] ] def initialize_elastic_search() -> Tuple[Elasticsearch, IndicesClient]: elastic_search = Elasticsearch(hosts=[{"host": "localhost", "port": 9200}]) indices_client = IndicesClient(client=elastic_search) try: indices_client.create( index=INDEX, body={ "mappings": { "properties": { "doc": {"type": "text"}, "vector": {"type": "dense_vector", "dims": 768}, } } }, ) except RequestError: pass return elastic_search, indices_client async def shutdown_elastic_search( elastic_search: Elasticsearch, indices_client: IndicesClient ) -> None: indices_client.delete(index=INDEX) elastic_search.close()
fc7afe7c321e18b93ea2aaee4b690db7ab2f9a6d
689d19292c4858f7cd30402d0eaf38405fb21ff5
/venv/bin/pyrsa-decrypt
29859a31e55c24b69991089eb158b9b9a467360b
[]
no_license
akhilraj95/CollgeDatabase
205f8cf9843f70477d11d9ee4a66fbc34c5ae625
2d615ed3bdf81b514f1d66d9721ef6cb78f47a08
refs/heads/master
2021-01-12T16:41:03.224118
2017-02-12T16:20:52
2017-02-12T16:20:52
71,425,194
0
1
null
null
null
null
UTF-8
Python
false
false
250
#!/home/akhil/work/CJ/CollgeDatabase/venv/bin/python # -*- coding: utf-8 -*- import re import sys from rsa.cli import decrypt if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(decrypt())
fdc2c39b4c6702662ee0e0425034c1cdbe6f6504
a4dbdd63a6b9693b35d028f1c474afec04a57c77
/yeonkyung/์ง์ง€์–ด ์ œ๊ฑฐํ•˜๊ธฐ.py
d392e86a26595e8346a56c2ac0982ee89ecdb156
[]
no_license
yeonkyungJoo/algorithm_study
1aead72dad7badb1a7ef52e3fe1eff75feaf578a
f205e5c97202783c246e7dc28f2338da065e9b82
refs/heads/main
2023-06-09T03:57:11.055310
2021-07-04T01:53:50
2021-07-04T01:53:50
347,650,540
0
5
null
2021-06-24T21:51:19
2021-03-14T13:54:02
Python
UTF-8
Python
false
false
279
py
def solution(s): stack = [] for ch in s: if stack and stack[-1] == ch: stack.pop() else: stack.append(ch) if stack: return 0 else: return 1 if __name__ == "__main__": s = "cdcd" print(solution(s))
23603c3747093f0f01f514546c24ce3bad2ff880
fe6f6d11dde2a3205ae9758c7d4eb1f824b84102
/venv/lib/python2.7/site-packages/logilab/common/test/unittest_ureports_html.py
c849c4f82d85d7321cc94b30f3be83ecd578cec2
[ "MIT" ]
permissive
mutaihillary/mycalculator
ebf12a5ac90cb97c268b05606c675d64e7ccf8a6
55685dd7c968861f18ae0701129f5af2bc682d67
refs/heads/master
2023-01-10T14:56:11.780045
2016-09-20T12:30:21
2016-09-20T12:30:21
68,580,251
0
0
MIT
2022-12-26T20:15:21
2016-09-19T07:27:48
Python
UTF-8
Python
false
false
2,918
py
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:[email protected] # # This file is part of logilab-common. # # logilab-common is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the Free # Software Foundation, either version 2.1 of the License, or (at your option) any # later version. # # logilab-common is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more # details. # # You should have received a copy of the GNU Lesser General Public License along # with logilab-common. If not, see <http://www.gnu.org/licenses/>. '''unit tests for ureports.html_writer ''' __revision__ = "$Id: unittest_ureports_html.py,v 1.3 2005-05-27 12:27:08 syt Exp $" from utils import WriterTC from logilab.common.testlib import TestCase, unittest_main from logilab.common.ureports.html_writer import * class HTMLWriterTC(TestCase, WriterTC): def setUp(self): self.writer = HTMLWriter(1) # Section tests ########################################################### section_base = '''<div> <h1>Section title</h1> <p>Section\'s description. Blabla bla</p></div> ''' section_nested = '''<div>\n<h1>Section title</h1>\n<p>Section\'s description.\nBlabla bla</p><div>\n<h2>Subsection</h2>\n<p>Sub section description</p></div>\n</div>\n''' # List tests ############################################################## list_base = '''<ul>\n<li>item1</li>\n<li>item2</li>\n<li>item3</li>\n<li>item4</li>\n</ul>\n''' nested_list = '''<ul> <li><p>blabla<ul> <li>1</li> <li>2</li> <li>3</li> </ul> </p></li> <li>an other point</li> </ul> ''' # Table tests ############################################################# table_base = '''<table>\n<tr class="odd">\n<td>head1</td>\n<td>head2</td>\n</tr>\n<tr class="even">\n<td>cell1</td>\n<td>cell2</td>\n</tr>\n</table>\n''' field_table = '''<table class="field" id="mytable">\n<tr class="odd">\n<td>f1</td>\n<td>v1</td>\n</tr>\n<tr class="even">\n<td>f22</td>\n<td>v22</td>\n</tr>\n<tr class="odd">\n<td>f333</td>\n<td>v333</td>\n</tr>\n</table>\n''' advanced_table = '''<table class="whatever" id="mytable">\n<tr class="header">\n<th>field</th>\n<th>value</th>\n</tr>\n<tr class="even">\n<td>f1</td>\n<td>v1</td>\n</tr>\n<tr class="odd">\n<td>f22</td>\n<td>v22</td>\n</tr>\n<tr class="even">\n<td>f333</td>\n<td>v333</td>\n</tr>\n<tr class="odd">\n<td> <a href="http://www.perdu.com">toi perdu ?</a></td>\n<td>&#160;</td>\n</tr>\n</table>\n''' # VerbatimText tests ###################################################### verbatim_base = '''<pre>blablabla</pre>''' if __name__ == '__main__': unittest_main()
de3e7c7a99d56bbcd47d532b61dd9abdb705c05a
e3365bc8fa7da2753c248c2b8a5c5e16aef84d9f
/indices/nncuthbert.py
68a51f0d1e582e2bf577eed1be5fba6c8208bebd
[]
no_license
psdh/WhatsintheVector
e8aabacc054a88b4cb25303548980af9a10c12a8
a24168d068d9c69dc7a0fd13f606c080ae82e2a6
refs/heads/master
2021-01-25T10:34:22.651619
2015-09-23T11:54:06
2015-09-23T11:54:06
42,749,205
2
3
null
2015-09-23T11:54:07
2015-09-18T22:06:38
Python
UTF-8
Python
false
false
139
py
ii = [('PettTHE.py', 1), ('ClarGE2.py', 2), ('BuckWGM.py', 2), ('DibdTRL2.py', 1), ('WadeJEB.py', 1), ('MartHRW.py', 1), ('BrewDTO.py', 1)]
daac803ef97a17ffd00461cc522a1b737afc3636
dfaaaedf0c466ccde145873befbb16cf29fee106
/pyentrypoint/constants.py
132393f8c8f2c9b94e90b63ee3733eb65974ed2a
[]
no_license
cmehay/pyentrypoint
8e27c91522f875541aa4be4650f7ab4f2c7b690b
d552129309eeb75c4bb93b7c580bd727ad7beccb
refs/heads/master
2023-02-20T06:13:19.751500
2022-07-24T17:13:21
2022-07-24T17:13:21
52,220,352
15
3
null
2023-02-08T03:46:34
2016-02-21T18:14:38
Python
UTF-8
Python
false
false
44
py
ENTRYPOINT_FILE = 'entrypoint-config.yml'
abf5f26c55cbaee20359ab26aed91e4d87724511
bd8c661d0e3e3adebfecfdfbe55ce7b97a8b4fdb
/src/L0_xtc31/train_model.py
94b8b3cdafab3b307a8ddaa3733ca489ed4adc4f
[ "MIT" ]
permissive
jimthompson5802/kaggle-BNP-Paribas
ea2d8625c0876e517b16914daa9fa36db7aedf63
536bcd0b1fe4cb3e1bfd55ee34e9027732cc7d5b
refs/heads/master
2021-03-08T19:34:09.855388
2016-05-10T02:56:06
2016-05-10T02:56:06
56,448,955
13
7
null
null
null
null
UTF-8
Python
false
false
1,554
py
# -*- coding: utf-8 -*- """ Created on Wed Mar 2 22:16:47 2016 @author: jim """ # py_train.tsv: training data set import sys import pickle import zlib import pandas as pd from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import ExtraTreesClassifier from sklearn import ensemble # model data stricture # parameters gleaned from R script submission: ExtraTreesClassifier (score 0.45911) mdl_fit = ExtraTreesClassifier(n_estimators=850,max_features= 60, criterion = 'entropy',min_samples_split= 4, max_depth= 40, min_samples_leaf= 2, n_jobs=7) if __name__ == "__main__": print "Starting training" # retrieve work directory work_dir = sys.argv[1] # work_dir = "../../src/L0_xtc1" # generate training data set file name training_file = work_dir + "/py_train.tsv" print training_file # read training data train = pd.read_csv(training_file,sep="\t") # isoloate response variable response = [1 if x == 'Class_1' else 0 for x in train["response"]] # isolate predictors predictors = train.columns[1:len(train.columns)].values X_train = train[predictors] # fit model mdl_fit.fit(X_train,response) # save fitted model structure model_dict = {'model':mdl_fit} model_file = work_dir + "/possible_model" with open(model_file,"wb") as f: pickle.dump(model_dict,f) print "Saved " + model_file
a95baf7ce1fc8fcf328f10cda2007623bf9c70e5
8536fd114a5e3565c7e9958ca668f243eb678f2e
/tl_detection/generate_tfrecord.py
86100b9d1779b65ae4d8e551e151152ab7a8672f
[ "MIT" ]
permissive
TeamDoernbach/SDCNanodegreeCapstone
e235bb7154d2bef7cf9bd8b0328b22e3d24484d8
10bdc59dc1b8f56136bf3f6f4ab64c97082420bb
refs/heads/master
2020-04-13T23:45:19.297948
2019-01-21T20:28:21
2019-01-21T20:28:21
163,514,891
4
4
MIT
2019-01-21T20:19:27
2018-12-29T13:52:26
Python
UTF-8
Python
false
false
3,580
py
""" Usage: # From tensorflow/models/ # Create train data: python generate_tfrecord.py --csv_input=data/train_labels.csv --output_path=train.record # Create test data: python generate_tfrecord.py --csv_input=data/test_labels.csv --output_path=test.record """ from __future__ import division from __future__ import print_function from __future__ import absolute_import import os import io import pandas as pd import tensorflow as tf from PIL import Image from object_detection.utils import dataset_util from collections import namedtuple, OrderedDict flags = tf.app.flags flags.DEFINE_string('csv_input', '', 'Path to the CSV input') flags.DEFINE_string('output_path', '', 'Path to output TFRecord') flags.DEFINE_string('image_dir', '', 'Path to images') FLAGS = flags.FLAGS # TO-DO replace this with label map def class_text_to_int(row_label): if row_label == 'tl_red': return 1 if row_label == 'tl_yellow': return 2 if row_label == 'tl_green': return 3 else: None def split(df, group): data = namedtuple('data', ['filename', 'object']) gb = df.groupby(group) return [data(filename, gb.get_group(x)) for filename, x in zip(gb.groups.keys(), gb.groups)] def create_tf_example(group, path): with tf.gfile.GFile(os.path.join(path, '{}'.format(group.filename)), 'rb') as fid: encoded_jpg = fid.read() encoded_jpg_io = io.BytesIO(encoded_jpg) image = Image.open(encoded_jpg_io) width, height = image.size filename = group.filename.encode('utf8') image_format = b'jpg' xmins = [] xmaxs = [] ymins = [] ymaxs = [] classes_text = [] classes = [] for index, row in group.object.iterrows(): xmins.append(row['xmin'] / width) xmaxs.append(row['xmax'] / width) ymins.append(row['ymin'] / height) ymaxs.append(row['ymax'] / height) classes_text.append(row['class'].encode('utf8')) classes.append(class_text_to_int(row['class'])) tf_example = tf.train.Example(features=tf.train.Features(feature={ 'image/height': dataset_util.int64_feature(height), 'image/width': dataset_util.int64_feature(width), 'image/filename': dataset_util.bytes_feature(filename), 'image/source_id': dataset_util.bytes_feature(filename), 'image/encoded': dataset_util.bytes_feature(encoded_jpg), 'image/format': dataset_util.bytes_feature(image_format), 'image/object/bbox/xmin': dataset_util.float_list_feature(xmins), 'image/object/bbox/xmax': dataset_util.float_list_feature(xmaxs), 'image/object/bbox/ymin': dataset_util.float_list_feature(ymins), 'image/object/bbox/ymax': dataset_util.float_list_feature(ymaxs), 'image/object/class/text': dataset_util.bytes_list_feature(classes_text), 'image/object/class/label': dataset_util.int64_list_feature(classes), })) return tf_example def main(_): writer = tf.python_io.TFRecordWriter(FLAGS.output_path) path = os.path.join(FLAGS.image_dir) examples = pd.read_csv(FLAGS.csv_input) grouped = split(examples, 'filename') for group in grouped: tf_example = create_tf_example(group, path) writer.write(tf_example.SerializeToString()) writer.close() output_path = os.path.join(os.getcwd(), FLAGS.output_path) print('Successfully created the TFRecords: {}'.format(output_path)) if __name__ == '__main__': tf.app.run()
62ccbe5d8ee222ec7df51815f4784d75bac59406
284e1e7e79485586e0f347255bba01506fa9b8f3
/jacobi_fast_prox_nuc_norm.py
e15863d83ba562f83da2e02038d70c5d62f50fd7
[]
no_license
Harry-MG/jacobi_approx_proximal
52340bbd57e6177ebcf0245941f22998f8c28462
df5996f2468405375ea7e550b030de63c1a94896
refs/heads/main
2023-05-02T21:12:04.571322
2021-05-26T12:26:56
2021-05-26T12:26:56
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,239
py
import numpy as np import time from cyclic_jacobi_sweeps import cyclic_jacobi_sweeps from cyclic_jacobi_tol import cyclic_jacobi_tol from prox_l1_norm import prox_l1_norm def jacobi_fast_prox_nuc_norm(f, grad, max_iter, dimension, step_size, reltol, lambd, tol=None, num_sweeps=None): if tol is not None and num_sweeps is not None: raise Exception( "Set only one of tol and num_sweeps. If using cyclic_jacobi_tol use tol. If using cyclic_jacobi_sweeps " "use num_sweeps") # Initialise n = dimension x = np.eye(n) x_old = np.eye(n) U = np.eye(n) t = step_size sweeps_list = np.zeros(max_iter) times_list = np.zeros(max_iter) rank_list = np.zeros(max_iter) objective_value = np.zeros(max_iter) start_main = time.time() for k in range(2, max_iter + 2): start = time.time() x_old_old = x_old x_old = x beta = (k - 1) / (k + 2) y = x_old + beta * (x_old - x_old_old) z = y - t * grad(y) if tol is not None: D = cyclic_jacobi_tol(np.transpose(U) @ z @ U, tol).diagonal J = cyclic_jacobi_tol(np.transpose(U) @ z @ U, tol).eigenvectors nsweeps = cyclic_jacobi_tol(np.transpose(U) @ z @ U, tol).sweeps sweeps_list[k] = nsweeps else: D = cyclic_jacobi_sweeps(np.transpose(U) @ z @ U, num_sweeps).diagonal J = cyclic_jacobi_sweeps(np.transpose(U) @ z @ U, num_sweeps).eigenvectors U = U @ J prox = prox_l1_norm(np.abs(np.diag(D)), t*lambd) Dplus = np.diag(prox) x = U @ Dplus @ np.transpose(U) end = time.time() times_list[k] = end - start rank_list[k] = np.linalg.matrix_rank(x) objective_value[k] = f(x) if np.abs(f(x) - f(x_old)) < reltol: final_iter = k break end_main = time.time() class outputs: argmin = x minimum = f(x) objective_values = objective_value[:final_iter] sweeps_per_iter = sweeps_list[:final_iter] iter_times = times_list[:final_iter] ranks = rank_list[:final_iter] total_time = end_main - start_main return outputs
6b00101db5a87305ec976c278a71af8819781aab
ed41ef435122ba229fc5dd1a94d0ec90e049ae31
/Nathaniel and Selina Plotting.py
7263b7ab04486dbfae592addf8e8bac5e582e4b2
[]
no_license
lhaney/Intro-to-Python
81e632f03a188d14717ce7b5a09b236c58e16604
03e929296bdc0d4ab6e14a02badcab3d9580cc2f
refs/heads/master
2021-04-27T12:18:11.912594
2018-04-27T23:33:03
2018-04-27T23:33:03
122,578,443
0
0
null
null
null
null
UTF-8
Python
false
false
791
py
''' Made by Nathaniel and Selina Writes points in a text file and plots them on a graph 3/22/18 ''' import matplotlib from matplotlib import pyplot as plt import numpy as np #creates a file filename=open('array.txt','w') #writes a series of numbers into it filename.write('3,9'+'\n') filename.write('12,56'+'\n') filename.write('47,74'+'\n') filename.write('91,29'+'\n') #closes the file filename.close() #reopens the file to read filename=open('array.txt','r') #defines lists xlist=[] ylist=[] for line in filename: #adds numbers to a list xlist.append(float(line.split(',')[0])) ylist.append(float(line.split(',')[1])) #prints lists print xlist print ylist #plots list line=plt.plot(ylist,xlist) #changes color to yellow) plt.setp(line, 'color', 'y',) #opens the plot plt.show()
01aba594e0438ffdd0367eefacb37bc81bbda437
ff91e5f5815b97317f952038e19af5208ef12d84
/square2.py
98eb0412527458a11fcc5211790ef83d9f7ee25a
[]
no_license
BryanPachas-lpsr/class-samples
c119c7c1280ca2a86f24230d85f6c712f18d9be8
a194201dce28299bd522295110814c045927ef5b
refs/heads/master
2021-01-17T07:03:42.968452
2016-06-12T22:35:54
2016-06-12T22:35:54
48,007,820
0
0
null
null
null
null
UTF-8
Python
false
false
191
py
#square.py import turtle #make out turtle buzz = turtle.Turtle() #buzz makes a square lines = 0 while lines < 4: buzz.forward(150) buzz.left(90) lines = lines + 1 turtle.exitonclick()
[ "lps@lps-1011PX.(none)" ]
lps@lps-1011PX.(none)
cd5f45fedd5a29f463733931bc43475a0785a354
b59f50886181367c35b0ae9a1525a4cc5e6bc930
/train.py
3bee12fa13a839bcfd4526d092af99fd1da19bff
[]
no_license
hlfshell/deep_q_network
deaad2129d0b8488e698041a8c3dcc5a2fc9efb5
7b23b4b54a5ae1579d3aa4b87974a312bc2f2a2c
refs/heads/main
2023-03-02T01:48:06.337638
2021-02-03T06:03:44
2021-02-03T06:03:44
328,849,257
0
0
null
null
null
null
UTF-8
Python
false
false
14,654
py
import torch from torch import optim from random import random, sample import numpy as np from collections import deque import pickle import copy def train( # Required inputs model, environment, loss_function, optimizer_function, # Standard settings learning_rate=1e-4, episodes=5000, gamma=0.95, render=False, device=None, # Epsilon greedy settings epsilon=1, epsilon_minimum=0.05, epsilon_minimum_at_episode=None, # Backpropagation settings batch_size=64, backpropagate_every=1, # Experience replay settings experience_replay=True, experience_memory_size=10_00, # Target network settings target_network=True, sync_every_steps=500, # Function controls state_transform=None, on_episode_complete=None, modify_reward=None, # Checkpoint settings checkpoint_model=None, checkpoint_target_model=None, checkpoint_trainer=None, save_every=None, save_to_folder="", ): rewards = [] steps = [] # If the device is not set, determine if we are going # to use GPU or CPU. If it is set, respect that setting if device == None: if torch.cuda.is_available(): device = "cuda" else: device = "cpu" # Calculate the epsilon decay off of epsilon_minimum and # epsilon_minimum_at_episode. If epsilon_minimum_at_episode # is None, set it to the total episode count by default if epsilon_minimum_at_episode is None: epsilon_minimum_at_episode = episodes # This math is derived on the idea that we want the # decay, over epsilon_minimum_at_episode episodes # to equal our epsilon minimum. epsilon_decay = (epsilon_minimum / epsilon) ** (1/epsilon_minimum_at_episode) # If needed, prep our experience replay buffer if experience_replay: experience_memory = deque(maxlen=experience_memory_size) # If needed, prep our target network if target_network: target_model = copy.deepcopy(model) target_model.load_state_dict(model.state_dict()) optimizer_steps = 0 # Prepare our optimizer optimizer = optimizer_function(model.parameters(), lr=learning_rate) # Start at episode 0 episode = 0 # If we have a checkpoint set, we will resume from that. # So here we shall load up the checkpoint and if checkpoint_model: model.load(checkpoint_model) if target_network: target_model.load(checkpoint_target_model) training_state = pickle.load(open(checkpoint_trainer, 'rb')) rewards = training_state['rewards'] steps = training_state['steps'] episode = len(rewards) optimizer_steps = training_state['optimizer_steps'] epsilon = training_state['epsilon'] experience_memory = training_state['experience_memory'] del training_state for episode in range(episode, episodes): state = environment.reset() if state_transform: state = state_transform(state) else: # Convert our state to pytorch - ensure it's float state = torch.from_numpy(state).float() if render: environment.render() done = False step = 0 total_reward = 0 while not done: step += 1 # Ensure that state is on the appropriate device state = state.to(device) # Get our Q values predictions for each action Q = model(state.unsqueeze(dim=0)) if render: environment.render() # Convert to numpy for ease of use. If it's on GPU, we need to # copy the tensor back to CPU q_values = Q.cpu().data.numpy() if random() < epsilon: # Generate a random action from the action_space of the environment action = environment.action_space.sample() else: # If we are not exploring, exploit the best predicted value # argmax returns the index location of the higest value action = np.argmax(q_values) # Take our action and take a step state2, reward, done, info = environment.step(action) if modify_reward: reward = modify_reward(reward) total_reward += reward if state_transform: state2 = state_transform(state2) else: # Convert our state to pytorch - ensure it's float state2 = torch.from_numpy(state2).float() # If we are using experience replay, we now have everything we need to record if experience_replay: # We are transfering state and state2 to cpu to make use of non GPU RAM # so that our experience replay buffer does not take up significant GPU # RAM. We are doing this instead of storing the original state since # often the pytorch represented state may be smaller than the actual # original state. experience = (state.cpu(), action, reward, state2.cpu(), done) experience_memory.append(experience) # If we have experience replay, we must wait until we have at least # a single batch of memories to train on. If we aren't, just continue # irregardless. if experience_replay and len(experience_memory) >= batch_size: # Create our batches from the experience memory experience_batch = sample(experience_memory, batch_size) # As we prepare each batch, we convert them to tensors. Since state # and state2 are already tensors, we use torch.cat instead of # instantiating a new Tensor. We use unsqueeze here as we want the # tensor to be of a shape [1, <observational space>]. instead of just # [<observational space>] to prevent the cat from just creating a # long singular row of tensors state_batch = torch.cat([state.unsqueeze(dim=0) for (state, action, reward, state2, done) in experience_batch]) action_batch = torch.Tensor([action for (state, action, reward, state2, done) in experience_batch]) # Take the sequence of actions, convert to tensor reward_batch = torch.Tensor([reward for (state, action, reward, state2, done) in experience_batch]) # Take the sequence of rewards, convert to tensor state2_batch = torch.cat([state2.unsqueeze(dim=0) for (state, action, reward, state2, done) in experience_batch]) done_batch = torch.Tensor([done for (state, action, reward, state2, done) in experience_batch]) # Take the sequence of done booleans, convert to tensor. This automatically onehot-encodes # This is done in case the state transformation function fails to. # It should be a no-op in the event that the tensors were already # on the disk. state_batch = state_batch.to(device) action_batch = action_batch.to(device) reward_batch = reward_batch.to(device) state2_batch = state2_batch.to(device) done_batch = done_batch.to(device) # Regenerate the Q values for the given batch at our current state # This is necessary because the batch may include old states from an # earlier, less-accurate model Q1 = model(state_batch) # Grab the expected reward future reward (Q2) for this batch # Turn off gradient for this batch as we aren't backpropagating on it # Note that we are using the target model (theta_t) instead of the # q model (theta_q) to prevent instability/oscillations with torch.no_grad(): # If we are using a target network, use that here. if target_network: Q2 = target_model(state2_batch) else : Q2 = model(state2_batch) # results is our given rewards, plus the discounted gamma of future rewards. # By doing (1 - done_batch), we are inverting the done_batch recording. Thus # we are ignoring the expected value of Q2 if our Q1 move finished the episode # The dimension = 1 because of the method we generated the tensor - it is columnular. # Or, in other words - we have a batch of N rows, each with 4 columns. We are grabbing # the highest value for each row. torch.max in this case returns the max value in the first # tensor, and the indicies in the second. We only care about the highest values, so # the first tensor only (hence [0]) # Detach it from the graph - we are not backpropagating on it results = (reward_batch + (gamma * (1 - done_batch) * torch.max(Q2, dim=1)[0])).detach() # calculated is what our model expected for a reward # dim=1 # - because we're batching, it is columnar data, same as before # index=action_batch.long().unsqueeze(dim=1)) # - because we are selecting the value for the given action chosen. # ...we must convert this to long to satisfy the function # .unsqueeze(dim=1) # - we need to go from a shape [200] to shape [200,1] tensor # # We then call gather on the tensor, which with the above seetings and # The gather function will select values from our Q1 tensor based on the # calculated index (which is our chosen action for the example) # # .squeeze(): # the gather, when done, has too many dimensions, we bring it back down to # tensor shape of [200] calculated = Q1.gather(dim=1, index=action_batch.long().unsqueeze(dim=1)).squeeze() elif not experience_replay: # Without saving the gradient, get the Q for the next state (Q2) as well with torch.no_grad(): # If the target network is being used, we utilize that network # to get our second state. Otherwise, use the base netwwork if target_network: Q2 = target_model(state2.unsqueeze(dim=0)) else: Q2 = model(state2.unsqueeze(dim=0)) # Grab the max of the calculated next step maxQ = torch.max(Q2) # If the episode is over, return the last reward. If it is not, # return our reward with the maxQ predicted for the next state, # reduced by our gamma factor. if not done: reward = reward + (gamma * maxQ) # results is our reward, separated from the graph as it's an # observation and we don't need to back propragate on it. results = torch.Tensor([reward]).detach() # calculated is our calculated outcome via the chosen action's # Q value calculated = Q.squeeze()[action].unsqueeze(dim=0) if (not experience_replay or (experience_replay and len(experience_memory) >= batch_size)) \ and step % backpropagate_every == 0: # Irregardless of what method we used, we now have two tensors - # calculated and results - which represent, respectively, what # our Q network thinks it will get for the actions, and what it # actually received in that situation. We can now calculate the # loss # Calculate our loss as per the loss function. We pass it our expected # output, and the actual result. Here, it's the expected reward vs # the actual reward loss = loss_function(calculated, results) # Zero out our gradient and backpropagate optimizer.zero_grad() loss.backward() optimizer.step() # If we have a target network for this training, we increment our count # of optimizer steps. Every sync_every_steps we will copy the target # network weights over to the primary network. if target_network: optimizer_steps += 1 if optimizer_steps % sync_every_steps == 0: target_model.load_state_dict(model.state_dict()) # Our state2 becomes our current state # We also transfer state = state2 # Append the step count to steps steps.append(step) rewards.append(total_reward) if save_every and (episode + 1) % save_every == 0: model.save(f"model_episode_{episode+1}.pt") # After each episode, we reduce the epsilon value to slow down our exploration # rate. We never go below epsilon_minimum. if epsilon > epsilon_minimum: epsilon *= epsilon_decay else: epsilon = epsilon_minimum # If our save_every triggers, saved the model, our target model (if used), and # what traininer state/variables we need to continue on from this point. # Note that this process tends to be slow if save_every and (episode + 1) % save_every == 0: model.save(f"{save_to_folder}/model_episode_{episode+1}.pt") if target_network: target_model.save(f"{save_to_folder}/target_network_episode_{episode+1}.pt") training_state = { "experience_memory": experience_memory, "rewards": rewards, "steps": steps, "epsilon": epsilon, "optimizer_steps": optimizer_steps, } pickle.dump(training_state, open(f"{save_to_folder}/training_state_{episode+1}.pt", "wb")) del training_state # This shouldn't be needed, but I've seen some troubles with RAM post pickle write if on_episode_complete: stop = on_episode_complete(episode, step, steps, total_reward, rewards) if stop: break return steps, rewards
5915ecc1d4f20c6bcd2de56e75f093ed7e74554e
485cb787a97caf96537dedc8bcf647dca906d5e3
/pythonx/test.py
7138756b901240d3c15c91b373252175d3ed95f6
[]
no_license
MattWoelk/vim-easymarks2
d40cfa960c170a33a40055f69e81683c3b0cb2a2
f6a05d0a009f2636845a20c112afc5402f814325
refs/heads/master
2021-01-17T12:47:25.645868
2014-02-28T21:44:10
2014-02-28T21:44:10
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,086
py
import vim # TODO add more options here TODO make customizable possible_marks = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' def drr(): marks = get_mark_locations() old_buf = list(vim.current.buffer) print(marks) a_mark = marks['a'] cur_line = vim.current.buffer[a_mark['row'] - 1] cur_line_list = list(cur_line) cur_line_list[a_mark['col']] = '?' print(cur_line_list) vim.current.buffer[a_mark['row'] - 1] = ''.join(cur_line_list) #print(old_buf) #print(vim.vars) highlight_marks() restore_buffer(old_buf) def insert_mark_labels(): buf = vim.current.buffer return buf def get_mark_locations(): """ Output format: {'a': {'col': 0, 'row': 4}, etc.}""" result = {} for mark in possible_marks: mark_location = vim.current.buffer.mark(mark) if mark_location: mark_location = {'row': mark_location[0], 'col': mark_location[1]} result[mark] = mark_location return result def highlight_marks(): print("highlighting") def restore_buffer(buf): pass
a262d4af2b159ffdb3466c28b7cb4719109837c8
11a27fd404adc9a43126017b280ec4e66ce6c8b1
/calculation.py
c96f995e168d364b97db953b873bfa5b3297f68a
[]
no_license
xm1112/unet-Precipitation-correction
e1f051756e8c05d8b1d346688111e375b69d6d88
3da387069619f569cb18f3bfe6ce2c42875208aa
refs/heads/master
2023-04-15T12:33:55.368401
2022-06-01T01:15:58
2022-06-01T01:15:58
498,146,340
0
0
null
null
null
null
UTF-8
Python
false
false
3,512
py
""" 2021/4/15 Calculate RMSE, CC and re of predicted precipitation and real precipitation """ import itertools import os import numpy as np import math from PIL import Image import matplotlib.pyplot as plt np.set_printoptions(threshold=np.inf) os.chdir("E:/14DL-unet-Regression/run/return/") #####################################Read the predicted quantified precipitation file############################################ f = open("./led7rawmean_2/b12_e150_final_test_pre.txt", mode='r', encoding='utf-8') line = f.readline() print(line) print(type(line)) #str line = line.split() list = list(line) pre = [] for i in range(len(list)): pre.append(float(list[i])) print(pre) pre = np.array(pre) pre = pre.astype(float) ###################################################Read forecast data################################################################3 f = open("E:/14DL-unet-Regression/data_make/led7rawmean.txt", mode='r', encoding='utf-8') line = f.readline() print(line) print(type(line)) led1 = line.split() led1_data = [] for i in range(len(led1)): led1_data.append(float(led1[i])) led1_data = np.array(led1_data) led1_data = led1_data.reshape(1196, 225) led1_data = led1_data[920:1196, :] #test #led1_data = np.divide(led1_data, 500.0) #led1_data = led1_data[0:736, :] #train #led1_data = led1_data[736:920, :] #val led1_data =led1_data.reshape(-1) led1_data = led1_data.astype(float) ##############################################Read real observed precipitation data๏ผˆobsn.txt๏ผ‰########################################################### file_obs = open("E:/14DL-unet-Regression/data_make/obsn.txt", mode='r', encoding='utf-8') line = file_obs.readline() obs = [] while line: a = line.split() obs.append(a) line = file_obs.readline() file_obs.close() print(obs) print(len(obs[920:1196])) test_obs = obs[920:1196] #test #test_obs = np.divide(led1_data, 500.0) #test_obs = obs[0:736] #train #test_obs = obs[736:920] #val test_obs = np.array(test_obs) test_obs = test_obs.reshape(-1) test_obs = test_obs.astype(np.float) # Calculate rmseใ€ccใ€re #The input is arrays, and the type must be unified (two-dimensional array becomes one-dimensional array) def mse(y_true, y_pred): m = np.mean((y_true-y_pred)**2) return m def rmse(y_true,y_pred): m = mse(y_true, y_pred) if mse: return math.sqrt(m) else: return None def cc(y_true, y_pred): y_true_mean = np.mean(y_true) y_pred_mean = np.mean(y_pred) s = np.sum((y_true-y_true_mean)*(y_pred-y_pred_mean)) t = np.sqrt(np.sum((y_true-y_true_mean)**2)) p = np.sqrt(np.sum((y_pred-y_pred_mean)**2)) c = s/(t*p) return c def bais(y_true, y_pred): bais = np.mean(y_pred-y_true) return bais def re(y_true, y_pred): r = np.sum(y_pred-y_true) o = np.sum(y_true) re = (r/o)*100 return re print("__"*20) print("Deep learning predicted precipitation data and real observed precipitation data") print("rmse๏ผš", rmse(test_obs, pre)) print("cc๏ผš", cc(test_obs, pre)) print("bais๏ผš", bais(test_obs, pre)) print("re๏ผš", re(test_obs, pre)) print("__"*20) print("Forecast precipitation data and real observed precipitation data") print("rmse๏ผš", rmse(test_obs, led1_data)) print("cc๏ผš", cc(test_obs, led1_data)) print("bais๏ผš", bais(test_obs, led1_data)) print("re๏ผš", re(test_obs, led1_data)) print("__"*20)
f7ecb98c52d86587f015570263ac5a20bdfbe240
0567fcd808397a7024b5009cc290de1c414eff06
/src/1658.minimum-operations-to-reduce-x-to-zero.py
7f3176eb03955d6bbc0e2d39d5a8afa61e2fd290
[]
no_license
tientheshy/leetcode-solutions
d3897035a7fd453b9f47647e95f0f92a03bff4f3
218a8a97e3926788bb6320dda889bd379083570a
refs/heads/master
2023-08-23T17:06:52.538337
2021-10-03T01:47:50
2021-10-03T01:47:50
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,481
py
# # @lc app=leetcode id=1658 lang=python3 # # [1658] Minimum Operations to Reduce X to Zero # # @lc code=start # TAGS: Greedy, Sliding Window class Solution: # LTE. Time and Space O(N^2). def minOperations(self, nums: List[int], x: int) -> int: q = [(x, 0, len(nums) - 1)] visited = {} depth = 0 while q: cur = [] for x, left, right in q: if x == 0: return depth if (left, right) in visited and visited[(left, right)] <= depth: continue visited[(left, right)] = depth if x < 0 or left > right: continue cur.append((x - nums[left], left + 1, right)) cur.append((x - nums[right], left, right - 1)) depth += 1 q = cur return -1 # Think in reverse, instead of finding the minmum prefix + suffix, we can find the subarray with maximum length def minOperations(self, nums: List[int], x: int) -> int: prefix_sum = [0] for num in nums: prefix_sum.append(prefix_sum[-1] + num) y = prefix_sum[-1] - x ans = -1 visited = {} for i, num in enumerate(prefix_sum): if y + num not in visited: visited[y + num] = i if num in visited: ans = max(ans, i - visited[num]) if ans == -1: return -1 return len(nums) - ans # @lc code=end
61b401769d07af9b8953298be222d7c0e8eef4b8
53fab060fa262e5d5026e0807d93c75fb81e67b9
/backup/user_287/ch6_2020_03_09_20_09_01_051283.py
43555c7f67b482084ac43022e30452bb1cd602a2
[]
no_license
gabriellaec/desoft-analise-exercicios
b77c6999424c5ce7e44086a12589a0ad43d6adca
01940ab0897aa6005764fc220b900e4d6161d36b
refs/heads/main
2023-01-31T17:19:42.050628
2020-12-16T05:21:31
2020-12-16T05:21:31
306,735,108
0
0
null
null
null
null
UTF-8
Python
false
false
61
py
def celsius_para_fahrenheit(C): F = 9/5*C+32 return F
1489d378e57780ff3019b198c1954499f4a477e2
2dee1b222fcf1bc75efe30679b18c17d0faaa18e
/day19/part1.py
dba8fb487852286125ce76df783cf252c4e3c935
[]
no_license
bofh69/aoc
783bd26c400c51aa0407aa39d28d64ee6d13344d
267c2313cc775f4cd4fd82e6eb4ef386a3a64c48
refs/heads/master
2020-11-25T00:29:10.520970
2019-12-27T17:24:59
2019-12-27T17:24:59
228,408,482
0
0
null
null
null
null
UTF-8
Python
false
false
11,409
py
#!/usr/bin/env python3 import itertools import sys prog = [109,424,203,1,21101,11,0,0,1105,1,282,21101,18,0,0,1106,0,259,2102,1,1,221,203,1,21101,0,31,0,1106,0,282,21102,38,1,0,1105,1,259,20101,0,23,2,22101,0,1,3,21101,1,0,1,21101,0,57,0,1105,1,303,2101,0,1,222,20102,1,221,3,21001,221,0,2,21101,0,259,1,21101,80,0,0,1105,1,225,21101,137,0,2,21101,91,0,0,1105,1,303,1202,1,1,223,21001,222,0,4,21102,259,1,3,21101,225,0,2,21102,225,1,1,21101,0,118,0,1106,0,225,20102,1,222,3,21101,0,88,2,21102,133,1,0,1105,1,303,21202,1,-1,1,22001,223,1,1,21101,0,148,0,1106,0,259,1202,1,1,223,20102,1,221,4,20101,0,222,3,21101,24,0,2,1001,132,-2,224,1002,224,2,224,1001,224,3,224,1002,132,-1,132,1,224,132,224,21001,224,1,1,21102,1,195,0,106,0,108,20207,1,223,2,20102,1,23,1,21101,-1,0,3,21101,0,214,0,1105,1,303,22101,1,1,1,204,1,99,0,0,0,0,109,5,2102,1,-4,249,22102,1,-3,1,22102,1,-2,2,22102,1,-1,3,21101,0,250,0,1105,1,225,22102,1,1,-4,109,-5,2106,0,0,109,3,22107,0,-2,-1,21202,-1,2,-1,21201,-1,-1,-1,22202,-1,-2,-2,109,-3,2106,0,0,109,3,21207,-2,0,-1,1206,-1,294,104,0,99,22101,0,-2,-2,109,-3,2105,1,0,109,5,22207,-3,-4,-1,1206,-1,346,22201,-4,-3,-4,21202,-3,-1,-1,22201,-4,-1,2,21202,2,-1,-1,22201,-4,-1,1,22102,1,-2,3,21102,343,1,0,1105,1,303,1105,1,415,22207,-2,-3,-1,1206,-1,387,22201,-3,-2,-3,21202,-2,-1,-1,22201,-3,-1,3,21202,3,-1,-1,22201,-3,-1,2,21202,-4,1,1,21102,1,384,0,1106,0,303,1106,0,415,21202,-4,-1,-4,22201,-4,-3,-4,22202,-3,-2,-2,22202,-2,-4,-4,22202,-3,-2,-3,21202,-4,-1,-2,22201,-3,-2,1,22101,0,1,-4,109,-5,2106,0,0] class IntCodeInterpreter: def __init__(self, prog, inp): self.mem = prog.copy() self.pc = 0 self.inp = inp.copy() self.relative_base = 0 self.out = [] def _op_len(self, op): if op == 1: return 4 elif op == 2: return 4 elif op == 3: return 2 elif op == 4: return 2 elif op == 5: return 3 elif op == 6: return 3 elif op == 7: return 4 elif op == 8: return 4 elif op == 9: return 2 elif op == 99: return 0 def _read(self, pos, mode): if mode == 1: return pos idx = pos if mode == 0: pass elif mode == 2: idx = pos + self.relative_base else: raise Exception("Unknown mode: %d" % mode) if idx < 0: raise Exception("Relative position < 0") diff = idx - len(self.mem) if diff >= 0: self.mem.extend([0] * (diff+1)) try: return self.mem[idx] except: print(idx, len(self.mem)) raise def _write(self, pos, mode, value): idx = pos if mode == 0: pass elif mode == 2: idx = pos + self.relative_base else: raise Exception("Unknown mode: %d" % mode) if idx < 0: raise Exception("Relative position < 0") diff = idx - len(self.mem) if diff >= 0: self.mem.extend([0] * (diff+2)) try: self.mem[idx] = value except: print(idx, len(self.mem)) raise def run(self): param = 0 try: while self.pc < len(self.mem): op = self.mem[self.pc] % 100 params = self.mem[self.pc] // 100 op_len = self._op_len(op) if(op == 99): return 0 else: arg = [0,0,0] param = [0,0,0] if op_len > 1: arg[0] = self.mem[self.pc+1] param[0] = params % 10 if op_len > 2: arg[1] = self.mem[self.pc+2] param[1] = (params // 10) % 10 if op_len > 3: arg[2] = self.mem[self.pc+3] param[2] = (params // 100) % 10 if(op == 1): self._write(arg[2], param[2], self._read(arg[0], param[0]) + self._read(arg[1], param[1])) elif(op == 2): self._write(arg[2], param[2], self._read(arg[0], param[0]) * self._read(arg[1], param[1])) elif(op == 3): if len(self.inp) > 0: # print("INP: ", self.inp[0]) self._write(arg[0], param[0], self.inp[0]) self.inp = self.inp[1::] else: return None elif(op == 4): # print("OUT: ", self._read(arg[0], param[0])) self.out.append(self._read(arg[0], param[0])) elif(op == 5): # Jump if true if self._read(arg[0], param[0]) != 0: self.pc = self._read(arg[1], param[1]) op = 99 elif(op == 6): # Jump if false if self._read(arg[0], param[0]) == 0: self.pc = self._read(arg[1], param[1]) op = 99 elif(op == 7): # less than if self._read(arg[0], param[0]) < self._read(arg[1], param[1]): self._write(arg[2], param[2], 1) else: self._write(arg[2], param[2], 0) elif(op == 8): # equals if self._read(arg[0], param[0]) == self._read(arg[1], param[1]): self._write(arg[2], param[2], 1) else: self._write(arg[2], param[2], 0) elif(op == 9): # Set Relative base self.relative_base = self.relative_base + self._read(arg[0], param[0]) else: print("Unknown op. Halting! at %d" % self.pc) return -1 self.pc += self._op_len(op) except Exception as e: print("Failed at %d" % self.pc) raise def left(dir): if dir == '^': return '<' elif dir == '<': return 'v' elif dir == 'v': return '>' elif dir == '>': return '^' else: raise Exception("Unknown dir: %s" % dir) def right(dir): if dir == '^': return '>' elif dir == '<': return '^' elif dir == 'v': return '<' elif dir == '>': return 'v' else: raise Exception("Unknown dir: %s" % dir) def forward(pos, dir): (x, y) = pos if dir == '^': return (x, y-1) elif dir == '<': return (x-1, y) elif dir == 'v': return (x, y+1) elif dir == '>': return (x+1, y) else: raise Exception("Unknown dir: %s" % dir) for dir in ['v', '<', '>', '^']: if left(right(dir)) != dir: raise Exception("left and right doesn't match") if right(left(dir)) != dir: raise Exception("left and right doesn't match") if right(dir) == dir: raise Exception("right doesn't match") def clear(): print("\x1b[2J") def goto(x, y): sys.stdout.write("\x1b[%d;%dH" % (y, x)) # map = [[0 for x in range(60)] for y in range(30)] pos = (0, 0) def find(tile): for y in range(len(map)): row = map[y] for x in range(len(row)): if row[x] == tile: return (x, y) raise Exception("Not found") def move_to_result(dir, interp): interp.inp = [dir] interp.out = [] while len(interp.out) == 0: interp.run() def rev(dir): if dir == 1: return 2 if dir == 2: return 1 if dir == 3: return 4 if dir == 4: return 3 raise Exception("Unknown dir: %d" % dir) def new_pos(dir): if dir == 1: return (pos[0], pos[1]-1) if dir == 2: return (pos[0], pos[1]+1) if dir == 3: return (pos[0]-1, pos[1]) if dir == 4: return (pos[0]+1, pos[1]) raise Exception("Unknown dir: %d" % dir) def new_dirs(dir): if dir == 1: return [1,3,4] if dir == 2: return [2,3,4] if dir == 3: return [1,2,3] if dir == 4: return [1,2,4] raise Exception("Unknown dir: %d" % dir) def search(interp, themap): global pos path=[] tries=dict() tries[pos] = (0, [1, 2, 3, 4]) themap[pos] = '.' while len(tries) > 0: curr = tries[pos] if len(curr[1]) == 0: # Done here, backtrack if curr[0] == 0: # Done! return dir = curr[0] move_to_result(dir, interp) if interp.out[0] == 0: raise Exception("Confused...") del tries[pos] pos = new_pos(dir) else: dir = curr[1].pop() np = new_pos(dir) if not np in themap: move_to_result(dir, interp) if interp.out[0] == 0: themap[np] = '#' else: if interp.out[0] == 1: themap[np] = '.' else: themap[np] = 'O' tries[np] = (rev(dir), new_dirs(dir)) pos = np def is_intersect(themap, p): if themap.get((p[0]-1, p[1]), ' ') == '#' and themap.get((p[0]+1, p[1]), ' ') == '#' and themap.get((p[0], p[1]-1), ' ') == '#' and themap.get((p[0], p[1]+1), ' ') == '#': return True return False def is_robot(c): if c == '^' or c == 'v' or c == '<' or c == '>': return True return False def get_at_most(n, s, others): while True: found = False for o in others: if s.find(o) == 0: s = s[len(o)::] found = True if not found: break result = s[:n+1] pos = result.rfind(',') return result[0:pos+1] def compress(s, words): result = [] while True: found = False for i, word in enumerate(words): if s.find(word) == 0: s = s[len(word)::] found = True result.append('ABCD'[i]) if not found: break if len(s) == 0 and len(result) <= 10: return ",".join(result) def find_solution(directives): for max_a in range(2, 21): a = get_at_most(max_a, directives, []) for max_b in range(2, 21): b = get_at_most(max_b, directives, [a]) for max_c in range(2, 21): c = get_at_most(max_c, directives, [a, b]) res = compress(directives, [a, b, c]) if res and len(res) <= 21: return [res, a[:-1], b[:-1], c[:-1]] clear() themap = dict() count = 0 for y in range(50): for x in range(50): interp = IntCodeInterpreter(prog, [x, y]) interp.out = [] interp.run() if interp.out[0] == 1: themap[(x,y)] = '#' count = count + 1 else: themap[(x,y)] = '.' print(count)
4fddc48a7f0271c0fedfd2bc34e067720cfab81d
92f0c73936c45d683a2d3b87465840b7b1b9817a
/scripts/rest
2dce48c36886b3c8f0edf871482f7b0511147132
[ "MIT" ]
permissive
unixeO/rest-cli
24b7bb7fd5b549f6d805003ed0ebdad014b5eed4
b689900f745a2f7456e0aec7d54e77f4af815d2d
refs/heads/master
2023-03-16T06:25:06.484026
2021-01-04T19:21:43
2021-01-04T19:21:43
null
0
0
null
null
null
null
UTF-8
Python
false
false
194
#!/usr/bin/env python # rest-cli - python REST client # https://github.com/jfillmore/rest-cli import sys from rest_cli.shell import Shell shell = Shell(sys.argv[1:]) sys.exit(shell.last_rv)
7c7a476c5669fbb0f5838024df127dccffa90f98
f115b3351c61c9785b28015813d740a55e36774e
/m2m-relations/articles/migrations/0006_auto_20210912_2105.py
73e8e189e7b9e46fbc857f0791058ec2e743d66c
[]
no_license
97wave/dz_ORM.2_4
dc59b0ea4272bfd6debd161eb173d718f96dbad3
0b88a76696d278755d368e0a70d81b89a382dddb
refs/heads/master
2023-08-06T21:50:50.613856
2021-09-22T11:07:01
2021-09-22T11:07:01
409,170,953
0
0
null
null
null
null
UTF-8
Python
false
false
363
py
# Generated by Django 3.1.2 on 2021-09-12 18:05 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('articles', '0005_alter_article_tags'), ] operations = [ migrations.RenameField( model_name='article', old_name='tags', new_name='scopes', ), ]
070961f5207cfaa07e5c3ac149066c0718aa436f
da13d10e600fe9e31e6d232ccf4f1f9e9a8dd0d9
/setlist_gen_funcs.py
3eee988c71af1e422ee6ac5d44f4544c69d77e2c
[]
no_license
dharit-tan/setlist_gen
5a77fab48f80f3509fc2ff08af5d514106fdd6c1
932fffd62e87ac93ad69642762c7bbce269ca161
refs/heads/master
2022-05-03T14:28:31.542313
2013-12-20T16:31:05
2013-12-20T16:31:05
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,893
py
# pygame shit import pygame import pygame.midi as pymidi import pygame.key as pykey import pygame.event as pyevent import pygame.fastevent as pyfastevent from pygame.locals import * # other imports import socket import signal import datetime import re HOST = 'localhost' PORT = 8080 MIX_MIN = 20 MIX_MAX = 106 X_FADE_DIF = 80 X_FADER = (176, 0) # did as much as I could, how the fuck do u pass decks and sock for closing? def handler(signum, frame): pymidi.quit() pygame.quit() # class def class Deck: def __init__(self, name): # constants self.PLAY = None self.EQ_HI = None self.EQ_MID = None self.EQ_LO = None self.FILT = None self.VOL = None self.DEFAULT_VOL = 127 self.X_FADE_SIDE = 0 self.name = name # instance variables self.aud = False self.x_fade = True self.vol = True self.eq_hi = 63 self.eq_mid = 63 self.eq_lo = 63 self.eq = True self.filt = True self.play = False def update(self): self.eq = (self.eq_hi > MIX_MIN) or (self.eq_mid > MIX_MIN) or (self.eq_lo > MIX_MIN) self.aud = self.x_fade & self.vol & self.eq & self.filt & self.play def debug(a, b): for i in [a, b]: print i.name, "aud?", i.aud for v in vars(i): if v == False: print v, "False" def list_devices(): for i in range(pymidi.get_count()): print pymidi.get_device_info(i) # pass in timestamp - init_timestamp def handle_timestamp(timestamp): s = "[" + str(timestamp)[:7] + "]" return s def get_device(): while True: try: device_id = input('Enter device number (starts at 1): ') device = pymidi.Input(device_id) except NameError: print 'NameError, try again... ' except pymidi.MidiException: print 'MidiException, try again...' except SyntaxError: print 'SyntaxError, try again...' else: return device def connect_to_traktor(): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind((HOST, PORT)) sock.listen(1) (conn, addr) = sock.accept() conn.send("HTTP/1.0 200 OK\r\n\r\n") print "Connected to traktor" return conn, sock def handle_midi(e, deck_A, deck_B, focused_deck): for deck in [deck_A, deck_B]: if (e.status, e.data1) == deck.PLAY: if e.data2 == 127: deck.play = True else: deck.play = False if (e.status, e.data1) == deck.VOL: if e.data2 > (deck.DEFAULT_VOL / 3): deck.vol = True else: deck.vol = False if (e.status, e.data1) == deck.EQ_HI: deck.eq_hi = e.data2 if (e.status, e.data1) == deck.EQ_MID: deck.eq_mid = e.data2 if (e.status, e.data1) == deck.EQ_LO: deck.eq_lo = e.data2 if (e.status, e.data1) == deck.FILT: if (e.data2 > MIX_MIN) and (e.data2 < MIX_MAX): deck.filt = True else: deck.filt = False if (e.status, e.data1) == deck.VOL: if e.data2 > (deck.DEFAULT_VOL / 3): deck.vol = True else: deck.vol = False if (e.status, e.data1) == X_FADER: if abs(e.data2 - deck.X_FADE_SIDE) < X_FADE_DIF: deck.x_fade = True else: deck.x_fade = False # if focused_deck: # print "focused deck:", focused_deck.name # else: # print "no focused_deck" if focused_deck != deck_B and not deck_B.aud: deck_B.update() if deck_B.aud: return datetime.datetime.now() deck_B.update() if focused_deck != deck_A and not deck_A.aud: deck_A.update() if deck_A.aud: return datetime.datetime.now() deck_A.update() return None def get_default_midi_val(prompt, decks): print prompt key_entered, midi_entered = False, False while not key_entered or not midi_entered: events = pyfastevent.get() for e in events: if e.type == pygame.KEYDOWN: if (e.key == pygame.K_RETURN) and (midi_entered == True): key_entered = True if e.type == pymidi.MIDIIN: val = e.data2 midi_entered = True if decks.poll(): midi_events = decks.read(1) events = pymidi.midis2events(midi_events, decks.device_id) for e in events: pyfastevent.post(e) return val
ffcb5dfd61b8ea8406307f4d49316125cb08366c
54f352a242a8ad6ff5516703e91da61e08d9a9e6
/Source Codes/AtCoder/agc006/B/4249708.py
c209881efba18f1680c0d7282393670ecf313f49
[]
no_license
Kawser-nerd/CLCDSA
5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb
aee32551795763b54acb26856ab239370cac4e75
refs/heads/master
2022-02-09T11:08:56.588303
2022-01-26T18:53:40
2022-01-26T18:53:40
211,783,197
23
9
null
null
null
null
UTF-8
Python
false
false
685
py
N,x = map(int,input().split()) if x in (1, 2 * N - 1): print('No') exit() print('Yes') if N == 2 and x == 2: l = [1, 2, 3] print(*l, sep='\n') elif x == 2: l = [4, 1, 2, 3] rest = list(range(5, 2 * N)) m = len(rest) // 2 l = rest[:m] + l + rest[m:] print(*l, sep='\n') elif x == 2 * N - 2: l = [x - 2, x + 1, x, x - 1] rest = list(range(1, 2 * N - 4)) m = len(rest) // 2 l = rest[:m] + l + rest[m:] print(*l, sep='\n') else: l = [x + 2, x - 1, x, x + 1, x - 2] rest = list(range(1, x - 2)) + list(range(x + 3, 2 * N)) m = len(rest) // 2 l = rest[:m] + l + rest[m:] print(*l, sep='\n')
481b8f827a0fecfaff1fbc39d098e6d4f9a3ff51
a3b90a6c64a13968d01ed18de66c06487378f97f
/flask_project1.0/date.py
896d2b03908a7768abe4c82c2361d62e4eecfd45
[]
no_license
RiddMa/SoftwareEngineering2021
287ef83c30b351e477dc3e92b9d02201fad555eb
e1ca6e99ac28610bbaa1aa59755595c8fafd7c66
refs/heads/master
2023-07-12T22:32:58.202705
2021-07-21T15:54:51
2021-07-21T15:54:51
348,347,591
0
0
null
null
null
null
UTF-8
Python
false
false
583
py
from pytz import utc from pytz import timezone from datetime import datetime cst_tz = timezone('Asia/Shanghai') utc_tz = timezone('UTC') now = datetime.now().replace(tzinfo=cst_tz) #local_dt = cst_tz.localize(now, is_dst=None) utctime = now.astimezone(utc) print ("now : %s"%now) print ("format: %s"%now.strftime('%Y-%m-%d %H:%M:%S')) print ("utc : %s"%utctime) utcnow = datetime.utcnow() utcnow = utcnow.replace(tzinfo=utc_tz) china = utcnow.astimezone(cst_tz) print ("utcnow: %s"%utcnow) print ("format: %s"%utcnow.strftime('%Y-%m-%d %H:%M:%S')) print ("china : %s"%china)
6d83bd86d52e7c41b5c8607183656819ac0f9d10
120b0b37550c3cebec83a6dbf05e53462c76ab5f
/Oving_2/most_common_player.py
a208c135c9d0e81979ee852a0bdfe7818ab03c34
[]
no_license
Magnusld/TDT4113_Plab
72a0175aa6a88ea296361eb672ce1259c0c16d2e
360045466e543cc6006c24a96df13f01d1f7562a
refs/heads/master
2023-04-04T09:04:15.616349
2021-04-07T09:34:40
2021-04-07T09:34:40
354,326,501
0
0
null
null
null
null
UTF-8
Python
false
false
1,772
py
""" This is one of the player classes """ from player_interface import PlayerInterface import random class MostCommonPlayer(PlayerInterface): """ This player looks at what the opponent has picked the most often, and assumes it will pick it again and then counter that pick """ opponents_previous = [] def __init__(self, name): super().__init__(name) def select_action(self): if len(self.opponents_previous) == 0: return random.choice(["rock", "paper", "scissors"]) else: most_common = self.find_most_common() if most_common == 0: return "paper" elif most_common == 1: return "scissors" else: return "rock" def find_most_common(self): """ Findes the opponents most common pick :return: """ counter = [0, 0, 0] for play in self.opponents_previous: if play == "rock": counter[0] += 1 elif play == "paper": counter[1] += 1 else: counter[2] += 1 largest = 0 largest_index = None for number in range(len(counter)): if counter[number] > largest: largest = counter[number] largest_index = number return largest_index def receive_result(self, result): if result.winner is not None: if self.name == result.winner.name: self.points += 1 else: self.points += 0.5 if result.player_1.name == self.name: self.opponents_previous.append(result.p2_choice) else: self.opponents_previous.append(result.p1_choice)
5c56194f34aae729ad3cf0e25875e5a8ecaf2ec8
c72710b1712889a096df3253983a8ebf08210bd3
/PuLink/spiders/incliva.py
408238d99e4fb7fb52e375560250eaec42cc98c7
[]
no_license
Angel-RC/PuLink
74233b365db5c2d5f0b4fa9f0910fd37d199614d
e3a2e3eeffd2728fca2bafadca0c444aac8855b0
refs/heads/master
2022-04-20T10:31:23.446094
2020-04-17T17:27:19
2020-04-17T17:27:19
226,748,440
0
0
null
null
null
null
UTF-8
Python
false
false
2,154
py
import sys #sys.path.append('C:/Users/Chicote/Desktop/proyectos/PuLink/Pulink') #from items import PulinkItem import scrapy from scrapy.spiders import CrawlSpider, Rule from scrapy.linkextractors import LinkExtractor from scrapy.exceptions import CloseSpider #from PuLink.items import PulinkItem import datetime from scrapy.crawler import CrawlerProcess class PulinkItem(scrapy.Item): # define the fields for your item here like: start_date = scrapy.Field() entidad = scrapy.Field() ciudad = scrapy.Field() titulo = scrapy.Field() deadline = scrapy.Field() referencia = scrapy.Field() url = scrapy.Field() class spider_incliva(CrawlSpider): name = 'spider_incliva' entidad = 'INCLIVA' ciudad = 'Valencia' url_site = 'https://www.incliva.es/' allowed_domain = ['https://www.incliva.es/empleo'] start_urls = ['https://www.incliva.es/empleo'] estado_abierto = ["Abierta", "ABIERTA", "Open", "OPEN"] def parse(self, response): """ Parsing of each page. """ # seleccionamos solo los empleos que estan abiertos empleo_list = response.xpath("//table[@id='tabla_empleo']/tbody/tr") empleo_list = [item for item in empleo_list if item.xpath("td[5]/text()").get() in self.estado_abierto] for empleo_item in empleo_list: oferta = PulinkItem() oferta['start_date'] = empleo_item.xpath("td[3]/text()").get() oferta['entidad'] = self.entidad oferta['ciudad'] = self.ciudad oferta['titulo'] = empleo_item.xpath("td[1]/text()").get().replace("\n", '').replace("\r", '') oferta['referencia'] = empleo_item.xpath("td[2]/text()").get() oferta['url'] = self.url_site + empleo_item.xpath("td[6]/a/@href").get() oferta['deadline'] = empleo_item.xpath("td[4]/text()").get() yield oferta if __name__ == "__main__": process = CrawlerProcess({ 'FEED_URI': 'data/incliva.csv', 'FEED_FORMAT': 'csv' }) process.crawl(spider_incliva) process.start()
[ "angel.r.chicote.com" ]
angel.r.chicote.com
68e02bc0b29817b39b36e472da89ec1b87795889
9d15ae6577f1cff53a51809a6dd3177c1b4c8f2a
/Size/Geometric_Transform/src/color_interpolation.py
ee9ea9b206dc24d0c8e3e02e9da7184ae4a08ad6
[]
no_license
LeeChungHyun/Computer-Vision
89f1b9e48e381e90339cfb3407663347f5fc99b9
0ac39478ef4cce5a8065991c8b3b2ead6c7d48e8
refs/heads/master
2021-05-21T15:21:07.372918
2020-06-22T12:10:22
2020-06-22T12:10:22
252,695,358
0
0
null
null
null
null
UTF-8
Python
false
false
383
py
import cv2 as cv import numpy as np def color_rect(): g = np.zeros((256,256,3), np.uint8) for i in range(256): g[i,:,:] = (0, i, 255-i) g[i, 255, :] = (255-i,i,i) for j in range(256): g[i,j,:] = (1-j/256)*src[i,0,:] + j/256*g[i,255,:] return g g = color_rect() cv.imshow('Org', g) cv.waitKey(0) cv.destroyAllWindows()
953960235b1932b88be7cf42442ff1a77defb61a
9d7bcc1b03de3cf263e5807a81fb4a694f84bf06
/cLasstd2D.py
544d3ca8e695e0e05250279926d5d354b5835ec5
[]
no_license
RiverTate/Chern
00aac98a0d22fccb0764305703492282c499420c
e6f7b6e826bfc9bfc8a8c1806bba8e82788ee8bc
refs/heads/master
2021-10-19T23:38:20.174332
2019-02-24T17:39:53
2019-02-24T17:39:53
279,393,140
1
0
null
2020-07-13T19:25:57
2020-07-13T19:25:56
null
UTF-8
Python
false
false
8,647
py
""" Class of infinite two-dimensional lattices. The module contains hexagonal and square lattices. """ import numpy as np import numpy.linalg as lg import FL_funcs as fl ######################################## class lattice2D(): """ class of 2D infinite hexagonal lattice in k-representation. """ def __init__(self, Nd=2, J_hop=1., delta = 1., it = 0, k_vec = np.zeros((2), float), **kwargs): """ the basic structure of a hexagonal lattice is persumed, if no other parameter are not given """ self.J_hop = J_hop # the hopping coefficient self.Nd = Nd # dimension of Hamiltonian, self.delta = delta # time-dep hopping amplitude self.it = it # time-interval that system is in self.k_vec = k_vec # the k-vector # initialize the Hamilnonian matrix self.H_kc = fl.H_k(k_vec, it, delta) #################### def updateH(self,k_vec,it): """ update the Hamiltonian matrix by new k-vector and time-interval it input: ------ k_vec: real (2,), 2D (kx,ky) vector """ self.k_vec = k_vec self.it = it self.H_kc = fl.H_k(k_vec, self.it, self.delta) #################### def evolve(self, k_vec, Nt,**kwargs): """ evolve the time-dependent parameter of a lattice and generate effective Floquet Hamiltonian. input: ------ Nt: int, number of intervals in one period kwargs: depending on the form of lattice the time-dependent variables can be different. return: ------- Efl_k: real (Nd, ) ndarray, sorted quasienergies of effective Floquet Hamiltonian. Ufl_k: complex (Nd,Nd) ndarray, sorted eigenvectors of effective Floquet Hamiltonian """ M_eff = np.eye((self.Nd), dtype=complex) # aux matrix T = 1. for it in range(Nt): # update the Hamiltonian for time-inteval self.updateH(k_vec, it) # return eigenenergies and vectors E_k, U = lg.eig(self.H_kc) # U^-1 * exp(H_d) U U_inv = lg.inv(U) # construct a digonal matrix out of a vector M1 = (np.exp(-1.j*E_k*T) * U_inv.T).T #MM = np.dot(U_inv,np.dot(H_M, U)) MM = np.dot(U,M1) M_eff = np.dot(M_eff,MM) # end of loop Ek, Uk = lg.eig( M_eff ) idx = (np.log(Ek).imag).argsort() Efl_k = np.log(Ek).imag[idx] Ufl_k = Uk[idx] return Efl_k, Ufl_k #################### def band_structure_static(self, kx_range, ky_range, N_res): """ a Hamiltonian in (kx,ky) is given, evaluate the bandstructire of a static Hamiltonian E(kx,ky) input: ------ kx_range: real (2,), the domain of kx ky_range: real (2,), the domain of ky N_res: int, resolution in kx and kx direction output: ------- E_arr: real (Nd, N_res, N_res), eigenenergies """ kxR = np.linspace(kx_range[0], kx_range[1], N_res) kyR = np.linspace(ky_range[0], ky_range[1], N_res) E_arr = np.zeros((2,N_res,N_res), float) # mesh over area in k-space # Kx, Ky = np.meshgrid(kx,ky) for ix, kx in enumerate(kxR): for iy, ky in enumerate(kyR): k_vec = np.array([kx,ky], float) # Construct k-representation of Hamiltonian self.updateH(k_vec, self.it) E_arr[:,ix,iy] = np.sort( np.linalg.eigvalsh(self.H_kc).real ) #end-loop ky #end-loop kx return E_arr #################### def band_structure_dynamic(self, kx_range, ky_range, N_res): """ a Hamiltonian in (kx,ky,t) is given, evaluate the quasienergy bandstructire of a dynamic Hamiltonian E(kx,ky) input: ------ kx_range: real (2,), the domain of kx ky_range: real (2,), the domain of ky N_res: int, resolution in kx and kx direction output: ------- E_arr: real (Nd, N_res, N_res), eigenenergies """ kxR = np.linspace(kx_range[0], kx_range[1], N_res) kyR = np.linspace(ky_range[0], ky_range[1], N_res) Nt = 3 E_arr = np.zeros((2,N_res,N_res), float) # mesh over area in k-space # Kx, Ky = np.meshgrid(kx,ky) for ix, kx in enumerate(kxR): for iy, ky in enumerate(kyR): k_vec = np.array([kx,ky], float) # Floquet eigenvalues and eigenenergies E_arr[:,ix,iy] , Uaux = self.evolve(k_vec, Nt) #end-loop ky #end-loop kx return E_arr #################### def latF(self, k_vec, Dk, delta): """ Calulating lattice field using the definition: F12 = ln[ U1 * U2(k+1) * U1(k_2)^-1 * U2(k)^-1 ] so for each k=(kx,ky) point, four U must be calculate. The lattice field has the same dimension of number of energy bands. input: ------ k_vec=(kx,ky), Dk=(Dkx,Dky), output: ------- F12:lattice field corresponding to each band as a n dimensional vec E: Quasienergies """ k = k_vec E_sort, psi = lg.eig( fl.H_k(k, self.it, self.delta) ) E_sort = np.sort(E_sort) k = np.array([k_vec[0]+Dk[0], k_vec[1]], float) E, psiDx = lg.eig( fl.H_k(k, self.it, self.delta) ) k = np.array([k_vec[0], k_vec[1]+Dk[1]], float) E, psiDy = lg.eig( fl.H_k(k, self.it, self.delta) ) k = np.array([k_vec[0]+Dk[0], k_vec[1]+Dk[1]], float) E, psiDxDy = lg.eig( fl.H_k(k, self.it, self.delta) ) U1x = np.zeros((self.Nd), dtype=complex) U2y = np.zeros((self.Nd), dtype=complex) U1y = np.zeros((self.Nd), dtype=complex) U2x = np.zeros((self.Nd), dtype=complex) for i in range(self.Nd): U1x[i] = fl.build_U(psi[:,i], psiDx[:,i] ) U2y[i] = fl.build_U(psi[:,i], psiDy[:,i] ) U1y[i] = fl.build_U(psiDy[:,i], psiDxDy[:,i] ) U2x[i] = fl.build_U(psiDx[:,i], psiDxDy[:,i] ) F12 = np.zeros((self.Nd), dtype=complex) F12 = np.log( U1x * U2x * 1./U1y * 1./U2y) return F12, E_sort ######################################## def chernNum(self, kx_Bz=np.array([0,4*np.pi/3]), ky_Bz=np.array([0,2*np.pi/np.sqrt(3)]), N_res=30): """ To calculate the Chern number of the Hamiltonian (or the Floquet Hamiltonian) over its Brillouin zone (BZ). input: ------ kx_Bz: real (2,), kx BZ ky_Bz: real (2,), ky BZ N_res: int, resolution in kx and kx direction output: ------- Chrn_Num: real (Nd,), the Chern number associated with each band. """ x_eps = 0.3 # shift from Dirac point x_res = 20 kx_int = 0 + x_eps # -np.pi kx_fin = 4*np.pi/3 + x_eps Dx = (kx_fin - kx_int)/x_res y_res = 20 ky_int = 0 # -np.pi ky_fin = 2*np.pi/np.sqrt(3) Dy = (ky_fin - ky_int)/y_res Nd = self.Nd # dimension of the Hamiltonian Dk = np.array([Dx,Dy], float) LF = np.zeros((Nd), dtype=complex) LF_arr = np.zeros((Nd,x_res, y_res), dtype=float) E_arr = np.zeros((Nd,x_res, y_res), dtype=float) sumN = np.zeros((Nd), dtype=complex) E_k = np.zeros((Nd), dtype=complex) chernN = np.zeros((Nd), dtype=complex) # Loop over kx for ix in range(x_res): kx = kx_int + ix*Dx # Loop over ky for iy in range(y_res): ky = ky_int + iy*Dy k_vec = np.array([kx,ky], float) LF, E_k = self.latF(k_vec, Dk, self.delta) sumN += LF # # save data for plotting LF_arr[:,ix,iy] = LF.imag E_arr[:,ix,iy] = np.sort(E_k.real) # End of ky Loop # End of kx Loop chernN = sumN.imag/(2*np.pi) print("Chern number bands are (%.3f, %.3f) " %(chernN[0], chernN[1])) print("Sum of all bands Chern Number is %.2f " %(sum(chernN))) return chernN, E_arr ####################
6124897fe7745ee9efb97ddf0a74376434848881
ce6cc66ad9527b32f8bc010b9aff7d44a8a9cc62
/ffm/singleton.py
f3ffe85f1ae177bd0b8a460fb9eff7c314566fc5
[]
no_license
wayswang/recommend_sys
7463ef04b5198178d4f478ef85ccb815b89b5bf3
10cb88732a7049197220c48d4fecd11c98e779ba
refs/heads/master
2023-06-24T23:35:11.998942
2021-07-15T08:36:10
2021-07-15T08:36:10
null
0
0
null
null
null
null
UTF-8
Python
false
false
497
py
# -*- coding: utf-8 -*- # @Date : 3/2/18 # @Author : zhangchaoyang class Singleton(type): def __init__(cls, class_name,base_classes, attr_dict): cls.__instance = None super(Singleton, cls).__init__( class_name,base_classes, attr_dict) def __call__(cls, *args, **kwargs): if cls.__instance is None: cls.__instance = super(Singleton, cls).__call__(*args, **kwargs) return cls.__instance else: return cls.__instance
78631f8c427327a030e57ee66b8fe5df5f3beed2
2839ece36a5186ae0e7f90af1efa0913f701f066
/tools/convert_textures.py
8cd770e3d1d1bdd3ea642dba13d2aaf02443e7b3
[ "Apache-2.0" ]
permissive
Longi94/rl-loadout
5d32badffb72d1e16561d31422e470d6e51f735e
07a248e16c8e5fb615ec4f8018631f3c622ac2a4
refs/heads/master
2023-01-08T07:40:42.445982
2020-03-14T00:00:37
2020-03-14T00:00:37
197,087,185
18
2
Apache-2.0
2023-01-07T08:47:39
2019-07-15T23:49:19
TypeScript
UTF-8
Python
false
false
906
py
import argparse import os from PIL import Image from multiprocessing import Pool from functools import partial def convert(file, args): print(f'Processing {file}...') image = Image.open(os.path.join(args.dir, file)) image.save(os.path.join('converted', file.replace('.tga', '.png'))) image.thumbnail((image.size[0] / 2, image.size[1] / 2), Image.LANCZOS) image.save(os.path.join('converted', file.replace('.tga', '_S.tga'))) image.save(os.path.join('converted', file.replace('.tga', '_S.png'))) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--dir', '-d', type=str, required=True) args = parser.parse_args() if not os.path.exists('converted'): os.makedirs('converted') files = filter(lambda x: x.endswith('.tga'), os.listdir(args.dir)) with Pool(10) as p: p.map(partial(convert, args=args), files)
baa3b7287586e03c59cfa147035055db68506852
7ff42d0f1800f6fa80845651c607e1917a6818b1
/examples/trading_system2/converte_xml_txt.py
535d2ab94416fabb8bcaa0a596928147afb18e32
[]
no_license
LCAD-UFES/MAE
cff9a632c2c2bbd8916942c9a514f9306b76d54a
2ae6664b66091e7919e94582b022dd12b4e5842b
refs/heads/master
2021-01-10T16:55:44.737700
2018-08-02T23:14:27
2018-08-02T23:14:27
53,516,570
5
1
null
null
null
null
UTF-8
Python
false
false
3,570
py
import sys import os from xml.etree.ElementTree import ElementTree # Cria um dicionario com todos os hora-minutos do dia (das 10:00 aas 16:59). Cada elemento do dicionario contera um preco e um volume. def init_cotacoes(hora_inicio_pregao, hora_fim_pregao): cotacoes = {} # hora inicio pregao (fora do horario de verao) = 10 # hora fim pregao (fora do horario de verao) = 17 for h in range(hora_inicio_pregao, hora_fim_pregao): for m in range(0,60): if h != hora_fim_pregao: if m < 10: cotacoes[str(h)+":0"+str(m)] = [-1.0, 0] else: cotacoes[str(h)+":"+str(m)] = [-1.0, 0] else: cotacoes[str(h)+":00"] = [-1.0, 0] break return cotacoes def converte(arquivo_xml, hora_inicio_pregao, hora_fim_pregao): if os.path.exists(arquivo_xml): tree = ElementTree() tree.parse(arquivo_xml) # Cria uma arvore com o conteudo do arquivo xml root = tree.getroot() # Pega a raiz da arvore quotes = tree.findall("quote") # Acha todos os quotes dentro da arvore criada # Cria um dicionario com todos os hora-minutos do dia (das 10:00 aas 16:59) cotacoes = init_cotacoes(hora_inicio_pregao, hora_fim_pregao) # Le a array de quotes em ordem reversa for quote in reversed(quotes): # data = quote.attrib["timestamp"] hora_minuto = quote.attrib["timestamp"][(len(quote.attrib["timestamp"])-5):(len(quote.attrib["timestamp"]))] preco = eval(quote.find("price").text) volume = eval(quote.find("volume").text) try: # Em alguns minutos nao ha contacoes: a linha abaixo gera um erro que ee descartado no except temp = cotacoes[hora_minuto] cotacoes[hora_minuto] = [preco, volume] temp = cotacoes[hora_minuto] #print hora_minuto, preco, temp except: pass # Conta quantas cotacoes estao faltando no inicio do dia num_faltando_iniciais = 0 for hora_minuto in sorted(cotacoes.keys()): if cotacoes[hora_minuto][0] == -1.0: num_faltando_iniciais = num_faltando_iniciais + 1 else: primeiro_preco = cotacoes[hora_minuto][0] break # Preenche as cotacoes faltando com a ultima cotacao valida i = 0 volume_anterior = 0 for hora_minuto in sorted(cotacoes.keys()): if i < num_faltando_iniciais: cotacoes[hora_minuto][0] = primeiro_preco cotacoes[hora_minuto][1] = 0 i = i + 1 if cotacoes[hora_minuto][0] == -1.0: cotacoes[hora_minuto][0] = preco_anterior cotacoes[hora_minuto][1] = volume_anterior print hora_minuto, cotacoes[hora_minuto][0], cotacoes[hora_minuto][1] - volume_anterior preco_anterior = cotacoes[hora_minuto][0] volume_anterior = cotacoes[hora_minuto][1] if __name__ == '__main__': if len(sys.argv) != 4: print "Numero de paramentros errado" print " Uso: python converte_xml_txt.py <arquivo.xml> <hora inicio pregao, ex.: 10> <hora inicio pregao, ex.: 17>" sys.exit(1) try: converte (sys.argv[1], int(sys.argv[2]), int(sys.argv[3])) except: print "Erro em ", sys.argv[1], sys.argv[2], sys.argv[3]
32d8b503fe1035e019f17332a9f9ba9578c65a5c
94197cf1fd92b55d9ed0fc36772c379f7174d496
/my_bakery_store/bakery_store/migrations/0005_user_avt.py
84bd4c3231ed57a4a10465a6a1103001779fa4a0
[]
no_license
tuyen97/Do_an_cac_cong_nghe_xay_dung_HTTT
42897e10c304ccef680ac9cf42a862a771edd965
ccb8739f23d06f8f6b133b9db7efc6b6904d39c4
refs/heads/master
2020-04-01T17:01:29.512843
2018-12-20T17:31:49
2018-12-20T17:31:49
153,409,413
0
0
null
2018-11-26T14:57:41
2018-10-17T06:53:06
JavaScript
UTF-8
Python
false
false
406
py
# Generated by Django 2.1.1 on 2018-10-31 09:52 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('bakery_store', '0004_auto_20181031_0920'), ] operations = [ migrations.AddField( model_name='user', name='avt', field=models.ImageField(null=True, upload_to='images/user'), ), ]
75edfbac6bf85741f7b0f433d319369072044602
2d6855b6940e93c6a77a4b7a16d23ea509cf66e1
/envdumptests/donothing.py
ab367d6ea74987c0614a91f81cb5284f3b3af111
[]
no_license
eukaryote/junkdrawer
7239a01d88159d2728b72e11efcc406ff7b6733a
696f3e43cffafcc6cf833d26643a97f7b414c7d7
refs/heads/master
2020-12-24T17:08:50.021603
2016-03-24T03:39:26
2016-03-24T03:39:26
32,162,396
0
0
null
null
null
null
UTF-8
Python
false
false
108
py
#!/usr/bin/env python """ This "null" script takes about 40 milliseconds on my laptop (cpython 2.7.9). """
da48c55d538e85eeafb8462ffa66006f0769a785
11c89364bf014d4d75a10572344b4905eea3a6b5
/pyth.py
d9aba7a5049cc2ff095fe32291a3b5f4cf7ae92a
[]
no_license
wwalid18/pythontraining
aa4eba85dc706489a3ec7c91b4957c9c33321456
4bc5b05fc460680810cfda234b6bfbc34965d1f7
refs/heads/master
2020-11-24T21:55:35.965931
2019-12-16T11:09:00
2019-12-16T11:09:00
228,356,557
1
0
null
null
null
null
UTF-8
Python
false
false
39
py
print('hello world') print('bye world')
92b81222bf64312ec2fe4cdf6f97ddd2e6f49d7d
ffb56a671654cb9e2193135c9d8d2b32f5b5bef3
/blog/views.py
9c545ba4a009ec8fe69577bbf1c99819b1ae7a4f
[]
no_license
Saltyn1/block_molchanov
cf1bf0fd4c6190e4c82f128da6e1aea08cf28f7e
ddb07450f69593189d57adcc05a0e5d827fd23de
refs/heads/master
2023-05-28T17:00:56.034223
2021-06-11T08:49:23
2021-06-11T08:49:23
375,961,242
0
0
null
null
null
null
UTF-8
Python
false
false
1,671
py
from django.views import generic from django.shortcuts import render, redirect from django.shortcuts import get_object_or_404 from django.views.generic import View, CreateView from .forms import TagForm, PostForm from .models import Post, Tag from .utils import ObjectDetailMixin # Create your views here: def posts_list(request): posts = Post.objects.all() return render(request, 'blog/index.html', context={'posts': posts}) class PostDetail(ObjectDetailMixin, View): model = Post template = 'blog/post_detail.html' class PostCreate(View): def get(self, request): form = PostForm() return render(request, 'blog/post_create_form.html', context={'form': form}) def post(self, request): bound_form = PostForm(request.POST) if bound_form.is_valid(): new_post = bound_form.save() return redirect(new_post) return render(request, 'blog/post_create_form.html', context={'form': bound_form}) class TagDetail(ObjectDetailMixin, View): model = Tag template = 'blog/tag_detail.html' class TagCreate(View): def get(self, request): form = TagForm() return render(request, 'blog/tag_create.html', context={'form': form}) def post(self, request): bound_form = TagForm(request.POST) print(bound_form) if bound_form.is_valid(): new_tag = bound_form.save(commit=True) return redirect(new_tag) return render(request, 'blog/tag_create.html', context={'form': bound_form}) def tags_list(request): tags = Tag.objects.all() return render(request, 'blog/tags_list.html', context={'tags': tags})
a0d4235c7fc09361cbc96da609fe235b4bbd785b
772a996b8df470643cb04224d7b869437e8332a7
/Application/app.py
fc6620a0e8882472cbc260db38b21a59480d3f36
[]
no_license
aniket312001/Car-Price-Predictor
a562b0c762759f10df74c05a4a5cf9b590438720
8e86fd9f5cf06c52a7694e0e0a3ae886350f5e50
refs/heads/main
2023-02-09T17:16:22.883562
2021-01-02T14:29:21
2021-01-02T14:29:21
326,198,649
0
0
null
null
null
null
UTF-8
Python
false
false
1,234
py
from flask import Flask, render_template, request from flask_cors import CORS import pandas as pd import numpy as np import pickle app = Flask(__name__) CORS(app) model = pickle.load(open('LinearRegressionModel.pkl','rb')) df = pd.read_csv('Clean_car.csv') @app.route('/',methods=['POST','GET']) def home(): companies = sorted(df['company'].unique()) model_name = sorted(df['name'].unique()) year = sorted(df['year'].unique(),reverse=True) fuel_type = df['fuel_type'].unique() companies.insert(0,"Select Company") return render_template('index.html', companies=companies, car_models=model_name, years=year, fuel_types=fuel_type) @app.route('/predict',methods=['POST','GET']) def pred(): company = request.form.get('company') car_model = request.form.get('car_model') year = int(request.form.get('year')) fuel_type = request.form.get('fuel') kms_driven = int(request.form.get('kms_driven')) prediction = model.predict(pd.DataFrame([[car_model, company, year, kms_driven,fuel_type]], columns=['name', 'company', 'year', 'kms_driven', 'fuel_type'])) return str(np.round(prediction[0],2)) if __name__ == "__main__": app.run(debug=True)
63ce31723463f996d20c3df361f6e287eeb675f4
208b6665723e6afe32af8a4b7e827a92d028db1b
/Ecom/ecommerce/products/models.py
da0f80abc5c02ebb1928916a32c2fee377fcfa92
[]
no_license
gautamp114/django
3ce699473a5b9889317165298754ce06c3a5b4c8
5338d36e52c0835fbf502c1e3d283bb713dcb0a0
refs/heads/main
2023-02-09T20:15:55.281301
2021-01-07T07:03:59
2021-01-07T07:03:59
327,529,808
0
0
null
null
null
null
UTF-8
Python
false
false
1,467
py
from django.db import models # Create your models here. class Product(models.Model): title = models.CharField(max_length=120) description = models.TextField(null=True, blank= True) price = models.DecimalField(decimal_places=2,max_digits=20,default=30.00) sales_price = models.DecimalField(decimal_places=2,max_digits=20,null=True, blank=True) slug = models.SlugField(unique=True) timestamp = models.DateTimeField(auto_now_add= True, auto_now=False) updated = models.DateTimeField(auto_now_add= False, auto_now=True) active = models.BooleanField(default=True) def __str__(self): return self.title class Meta: #to make title and slug unique together unique_together = ('title', 'slug') class ProductImage(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE) image = models.ImageField(upload_to='products/images/') featured = models.BooleanField(default=False) thumbnail = models.BooleanField(default=False) updated = models.DateTimeField(auto_now_add= False, auto_now=True) def __str__(self): return self.product.title # class OrderProduct(models.Model): # product = models.ForeignKey(Product, on_delete= models.CASCADE) # # def __str__(self): # return self.product.title # # class Order(models.Model): # items = models.ManyToManyField(OrderProduct) # ordered_date = models.DateTimeField(auto_now_add=True) # ordered = models.BooleanField(default=False) # # def __str__(self): # return self.order.items
0bdb1aa44a3b4517aeed1e73574cbdff67c94608
22a42be59ba2c59e7bb92ee73e6ec5871d70b5cc
/manage.py
d4cb6e7b945178e15f34a6d93876b6eda9f36349
[]
no_license
devimalka/djangoupload
7d5d44ca59260af372ba81666b4e84aa66c56483
3f25a45afe7dec676b7b4acf807ce433585ce7a3
refs/heads/master
2023-08-22T10:34:07.327978
2021-10-11T14:17:50
2021-10-11T14:17:50
415,957,932
0
0
null
null
null
null
UTF-8
Python
false
false
666
py
#!/usr/bin/env python """Django's command-line utility for administrative tasks.""" import os import sys def main(): """Run administrative tasks.""" os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sinhaladev.settings') try: from django.core.management import execute_from_command_line except ImportError as exc: raise ImportError( "Couldn't import Django. Are you sure it's installed and " "available on your PYTHONPATH environment variable? Did you " "forget to activate a virtual environment?" ) from exc execute_from_command_line(sys.argv) if __name__ == '__main__': main()
8743633783fdae100a42fa40825da1188212e3aa
bad9d9b5bfbc7c20a3daa73fea4273b333c778f1
/fileio_utils.py
5cd2fa4f011ea77d5127e1f6f6f39badf1d7fdfa
[]
no_license
cmilke/vbf4b_coupling_scan_tools
acb9fef5e5c7ab51e6e87b8be4bf922cf7bdb0bc
c672525a880377fe44a9d50deea25febcb2bca73
refs/heads/master
2023-07-14T10:28:49.163247
2021-08-31T15:03:08
2021-08-31T15:03:08
319,711,860
0
0
null
null
null
null
UTF-8
Python
false
false
6,438
py
import math import numpy import uproot import inspect Primary_coupling_file = 'basis_files/nnt_coupling_file_2021May_crypto.dat' def retrieve_lhe_weights(ttree, kinematic_variable, bin_edges, stat_limit=None): if stat_limit == None: event_weights = numpy.array(ttree['weight'].array()) event_kinematics = numpy.array(ttree[kinematic_variable].array()) else: event_weights = numpy.array(ttree['weight'].array())[:stat_limit] event_kinematics = numpy.array(ttree[kinematic_variable].array())[:stat_limit] weights = numpy.histogram(event_kinematics, weights=event_weights, bins=bin_edges)[0] errors = numpy.zeros( len(weights) ) event_bins = numpy.digitize(event_kinematics,bin_edges)-1 for i in range(len(errors)): binned_weights = event_weights[ event_bins == i ] error2_array = binned_weights**2 error = math.sqrt( error2_array.sum() ) errors[i] = error return weights, errors def extract_lhe_truth_data(file_list, mHH_edges, normalize=False, stat_limit=30000, emulateSelection=False): weight_list, error_list = [], [] for f in file_list: f = f[0] ttree = uproot.open(f)['tree'] if emulateSelection: weights, errors = retrieve_lhe_weights_with_emulated_selection(ttree, mHH_edges) else: weights, errors = retrieve_lhe_weights(ttree, 'HH_m', mHH_edges, stat_limit=stat_limit) if normalize: norm = weights.sum() weights /= norm errors /= norm weight_list.append(weights) error_list.append(errors) return weight_list, error_list def extract_ntuple_events(ntuple, key=None, tree_name=None): #tree_name = 'sig_highPtcat' tree_name = 'sig' rootfile = uproot.open(ntuple) #DSID = rootfile['DSID']._members['fVal'] #nfiles = 1 #while( DSID / nfiles > 600050 ): nfiles += 1 #DSID = int(DSID / nfiles) #print(ntuple, DSID) ttree = rootfile[tree_name] #if tree_name == 'sig': #if True: if False: kinvals = ttree['m_hh'].array() weights = ttree['mc_sf'].array()[:,0] run_number = ttree['run_number'].array() else: # Selections pass_vbf_sel = ttree['pass_vbf_sel'].array() x_wt_tag = ttree['X_wt_tag'].array() > 1.5 ntag = ttree['ntag'].array() >= 4 valid_event = numpy.logical_and.reduce( (pass_vbf_sel, x_wt_tag, ntag) ) kinvals = ttree['m_hh'].array()[valid_event] weights = ttree['mc_sf'].array()[:,0][valid_event] run_number = ttree['run_number'].array()[valid_event] mc2015 = ( run_number < 296939 ) * 3.2 mc2016 = ( numpy.logical_and(296939 < run_number, run_number < 320000) ) * 24.6 mc2017 = ( numpy.logical_and(320000 < run_number, run_number < 350000) ) * 43.65 mc2018 = ( numpy.logical_and(350000 < run_number, run_number < 370000) ) * 58.45 all_years = mc2015 + mc2016 + mc2017 + mc2018 lumi_weights = weights * all_years events = numpy.array([kinvals,lumi_weights]) return events def retrieve_reco_weights(var_edges, reco_events): event_weights = reco_events[1] reco_weights = numpy.histogram(reco_events[0], bins=var_edges, weights=event_weights)[0] reco_errors = numpy.zeros( len(reco_weights) ) event_bins = numpy.digitize(reco_events[0],var_edges)-1 for i in range(len(reco_errors)): binned_weights = event_weights[ event_bins == i ] error2_array = binned_weights**2 error = math.sqrt( error2_array.sum() ) reco_errors[i] = error return [reco_weights, reco_errors] def get_cutflow_values(filename, hist_name='VBF_FourTagCutflow'): directory = uproot.open(filename) cutflow_hist = directory[hist_name] labeled_values = { k:v for k,v in zip(cutflow_hist.axis('x').labels(), cutflow_hist.values()) } tree_name = 'sig' ttree = directory[tree_name] pass_vbf_sel = ttree['pass_vbf_sel'].array() x_wt_tag = ttree['X_wt_tag'].array() > 1.5 ntag = ttree['ntag'].array() >= 4 valid_event = numpy.logical_and.reduce( (pass_vbf_sel, x_wt_tag, ntag) ) weights = ttree['mc_sf'].array()[:,0][valid_event] final_weight = sum(weights) labeled_values['Final'] = final_weight labeled_values['FinalCount'] = len(weights) return labeled_values def get_combined_cutflow_values(parameter_list, data_files): combined_cutflows = {} for couplings in parameter_list: for f in data_files[couplings]: run_number = uproot.open(f)['sig']['run_number'].array()[0] lumi_weight = None if run_number < 296939: lumi_weight = 3.2 # MC2015 elif 296939 < run_number and run_number < 320000: lumi_weight = 24.6 # MC2016 elif 320000 < run_number and run_number < 350000: lumi_weight = 43.65 # MC2017 elif 350000 < run_number and run_number < 370000: lumi_weight = 58.45 # MC2018 else: print("UNKNOWN RUN NUMBER!! -- " + str(run_number)) exit(1) cutflows = get_cutflow_values(f) lumi_weighted_cutflows = { key:val*lumi_weight if key != 'FinalCount' else val for key,val in cutflows.items() } if couplings not in combined_cutflows: combined_cutflows[couplings] = lumi_weighted_cutflows else: for key,val in lumi_weighted_cutflows.items(): combined_cutflows[couplings][key] += val return combined_cutflows def read_coupling_file(coupling_file=Primary_coupling_file): data_files = {} with open(coupling_file) as coupling_list: for line in coupling_list: if line.strip().startswith('#'): continue linedata = line.split() couplings = tuple([ float(p) for p in linedata[:3] ]) data_file = linedata[3] if couplings not in data_files: data_files[couplings] = [data_file] else: data_files[couplings].append(data_file) return data_files def get_events(parameter_list, data_files, reco=True): events_list = [] for couplings in parameter_list: new_events = [] for f in data_files[couplings]: new_events.append( extract_ntuple_events(f,key='m_hh') ) events = numpy.concatenate(new_events, axis=1) events_list.append(events) return events_list
f48caaa4b5e38cd8d72a7c91e8ec01b32b5c33ae
c67a9c594112bc8bae81e9ab281630527cc6330d
/sync_modbus_tcp.py
282fe696b994f796cec7d0bb287101d2974b5da1
[]
no_license
BhavyanshM/SCADA
79f54a24607ef857bcf1c8178e5aab7824c6cde3
6fc5a644b60bbf20be9d1ec6080d7e13f116c8cb
refs/heads/master
2020-04-12T01:51:03.055460
2019-05-10T14:59:38
2019-05-10T14:59:38
162,229,891
1
0
null
null
null
null
UTF-8
Python
false
false
477
py
from pymodbus.client.sync import ModbusTcpClient import time UNIT = 0x00 client = ModbusTcpClient('192.168.0.40') #client.write_coil(1, True) f = open("log.txt", 'a') f.write("\n----------------------------------------------------------------------\n\n"+time.ctime()+"\n\n") while True: rr = client.read_holding_registers(0, 8, unit=UNIT) #result = client.read_coils(1,1) print(rr.registers) time.sleep(0.01) f.write(str(rr.registers)+"\n") f.close() client.close()
5b0f51065868fd2232224cfb6f02ad122dca650b
cc5867196b2309fbfa5ba5f2beb935c512f26a54
/Orchestonks/test.py
a3257eb8a70dd5ff4baaeea8571d9fa8eb711120
[ "MIT" ]
permissive
joy13975/Orchestonks
056544b8376f71a6139a2e618941100628d4b778
8b61ce87d0c5ad442a47edb1db2c10893fba5bab
refs/heads/main
2023-02-09T01:25:40.971761
2021-01-04T13:38:52
2021-01-04T13:38:52
326,351,738
1
0
null
null
null
null
UTF-8
Python
false
false
1,480
py
import sys import csv from time import sleep from datetime import datetime import numpy as np from notes import note_to_freq from tone_player import TonePlayer def main(file=''): assert file with open(file, 'r') as f: data = list(csv.reader(f, delimiter=',')) with TonePlayer() as tp: mat = np.asmatrix(data[1:]) # time_vals = [datetime.strptime('-'.join(row.A1), r'%Y%m%d-%H%M%S') for row in mat[:,2:4]] open_vals, high_vals, low_vals, close_vals, vol_vals = np.asarray(mat[:,4:9].T.astype(float)) # pitch = 100.0 * (close_vals - open_vals) / close_vals pitch = 100 * (close_vals - open_vals) / open_vals duration = (close_vals - open_vals) / (high_vals - low_vals) base_freq = note_to_freq('c4') max_pitch = max(abs(pitch)) pitch_factor = 12 * 4 # 1 octaves = 12 notes interval = 100 max_vol = max(vol_vals) vol_cap = 1 for i, (p, d, v) in enumerate(zip(pitch, duration, vol_vals)): h = round(pitch_factor * p / max_pitch) freq = base_freq * (2.0 ** (h/12)) sound_vol = np.clip(v / (max_vol/2), 0, vol_cap) print(f'i={i}, p={p:.4f}, d={d:.2f} h={h}, freq={freq:.2f}, sound_vol={sound_vol:.4f}') tp.play(freq, duration=interval*8*d, volume=sound_vol) sleep(interval/1000) if __name__ == "__main__": main(**dict(v.split('=') for v in sys.argv[1:]))
4be4119618f24eb4a854b957e68ff64726717d61
c27a95964b2740e1ec681b7068f52fb573d90321
/aliyun-python-sdk-cms/aliyunsdkcms/request/v20180308/QueryMetricListRequest.py
56216712133c7d35673a04cf20349e748613f843
[ "Apache-2.0" ]
permissive
mysshget/aliyun-openapi-python-sdk
5cf0a0277cce9823966e93b875c23231d8b32c8a
333cdd97c894fea6570983e97d2f6236841bc7d3
refs/heads/master
2020-03-17T23:07:02.942583
2018-05-17T09:50:53
2018-05-17T09:50:53
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,912
py
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not 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 aliyunsdkcore.request import RpcRequest class QueryMetricListRequest(RpcRequest): def __init__(self): RpcRequest.__init__(self, 'Cms', '2018-03-08', 'QueryMetricList','cms') def get_Cursor(self): return self.get_query_params().get('Cursor') def set_Cursor(self,Cursor): self.add_query_param('Cursor',Cursor) def get_callby_cms_owner(self): return self.get_query_params().get('callby_cms_owner') def set_callby_cms_owner(self,callby_cms_owner): self.add_query_param('callby_cms_owner',callby_cms_owner) def get_ResourceOwnerId(self): return self.get_query_params().get('ResourceOwnerId') def set_ResourceOwnerId(self,ResourceOwnerId): self.add_query_param('ResourceOwnerId',ResourceOwnerId) def get_Period(self): return self.get_query_params().get('Period') def set_Period(self,Period): self.add_query_param('Period',Period) def get_Length(self): return self.get_query_params().get('Length') def set_Length(self,Length): self.add_query_param('Length',Length) def get_Project(self): return self.get_query_params().get('Project') def set_Project(self,Project): self.add_query_param('Project',Project) def get_EndTime(self): return self.get_query_params().get('EndTime') def set_EndTime(self,EndTime): self.add_query_param('EndTime',EndTime) def get_Express(self): return self.get_query_params().get('Express') def set_Express(self,Express): self.add_query_param('Express',Express) def get_StartTime(self): return self.get_query_params().get('StartTime') def set_StartTime(self,StartTime): self.add_query_param('StartTime',StartTime) def get_Metric(self): return self.get_query_params().get('Metric') def set_Metric(self,Metric): self.add_query_param('Metric',Metric) def get_Page(self): return self.get_query_params().get('Page') def set_Page(self,Page): self.add_query_param('Page',Page) def get_Dimensions(self): return self.get_query_params().get('Dimensions') def set_Dimensions(self,Dimensions): self.add_query_param('Dimensions',Dimensions)
7629cbace4c46b36ec498427fe9085047beb7f67
9f27ac0e633f1a75a193932eff91c56943deda58
/Week2/Day2/ParenthesisMatching.py
15884b572ac4e17b281539268417f6a1dccda3b5
[]
no_license
afrinh/CompetitiveProgramming
c5a1b8c617dbd8f3bddb1323c4291d419c7bdc8f
2df8e25698e5ecd54c874e669f2ad0eb00c5513c
refs/heads/master
2020-03-22T00:01:28.737847
2018-07-21T09:28:22
2018-07-21T09:28:22
139,219,980
0
0
null
null
null
null
UTF-8
Python
false
false
1,047
py
import unittest def get_closing_paren(sentence, opening_paren_index): open_nested_parens = 0 position = opening_paren_index + 1 for position in range(opening_paren_index + 1, len(sentence)): char = sentence[position] if char == '(': open_nested_parens += 1 elif char == ')': if open_nested_parens == 0: return position else: open_nested_parens -= 1 raise Exception("No closing parenthesis :(") # Tests class Test(unittest.TestCase): def test_all_openers_then_closers(self): actual = get_closing_paren('((((()))))', 2) expected = 7 self.assertEqual(actual, expected) def test_mixed_openers_and_closers(self): actual = get_closing_paren('()()((()()))', 5) expected = 10 self.assertEqual(actual, expected) def test_no_matching_closer(self): with self.assertRaises(Exception): get_closing_paren('()(()', 2) unittest.main(verbosity=2)
021e4be28d20fb9b8e7a62b502f7cba74dea51df
6bf5db308a2ced233b095c955822ed0c5aba44e9
/mcs435_(nonlinear_optimization)/Assignment_1/venv/bin/pip
5c63b385f6926b13027fcf15157ebda99d85fe89
[]
no_license
AlecHarb/school_projects
756e2f7f5a7435d9180975069c14391e80347fcc
d0c57fe34a3de0f558475da9f567511a17fdc70f
refs/heads/main
2023-03-09T10:53:15.099530
2021-02-28T08:35:52
2021-02-28T08:35:52
342,484,221
0
0
null
null
null
null
UTF-8
Python
false
false
411
#!/Users/harberbarber/Python/MCS435/Assignment_1/venv/bin/python # EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip' __requires__ = 'pip==19.0.3' import re import sys from pkg_resources import load_entry_point if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit( load_entry_point('pip==19.0.3', 'console_scripts', 'pip')() )
[ "" ]
6fb6e1524af5bc5732e4bc123217c972f05010a3
cf9b83d667433a5f912f8981357483197624983d
/editors/content/admin.py
75694e4aaca1e16700897e8f2668a55b4381efb9
[ "Apache-2.0" ]
permissive
LeaseMagnetsTeam/editors.art
08d13e58a17c9930efe78f99d4dc4e25898612f3
778ca76439da798f3b7ffbac5b83f3e85b4f4fca
refs/heads/main
2023-06-26T17:17:52.336540
2021-07-26T00:09:30
2021-07-26T00:09:30
null
0
0
null
null
null
null
UTF-8
Python
false
false
101
py
from django.contrib import admin from editors.content.models import Edit admin.site.register(Edit)
1e9ed7185ff402c3b678869fee7e4b503fb7d6bd
e75c5288579e5866f9618dbcd29d0485b1bddbee
/account/forms.py
3510e0152fb404abfeabdc838eb9bc3d36d85452
[]
no_license
hkhitesh25/Learnan
2ae2e0690a1eacfe4d25511c0b7a789553b60516
a8d79141786fdd5aeb66f9127283d128ce43db02
refs/heads/master
2021-07-09T14:36:57.983818
2017-07-31T15:59:52
2017-07-31T15:59:52
98,341,929
0
0
null
null
null
null
UTF-8
Python
false
false
1,038
py
from django.contrib.auth.models import User from django import forms from .models import Profile class UserRegistrationForm(forms.ModelForm): password = forms.CharField(label='Password', widget=forms.PasswordInput) password2 = forms.CharField(label='Password Again', widget=forms.PasswordInput) #stream = forms.ChoiceField(choices=CHOICES, required=True, label='Stream') class Meta: model = User fields = ('username', 'first_name', 'email') CHOICES = (('IIT-JEE', 'IIT-JEE'),('Medical','Medical'),('Commerce','Commerce')) class ProfileForm(forms.ModelForm): stream= forms.ChoiceField(choices=CHOICES, required=True, label='Stream') class Meta: model = Profile fields = ('stream',) def clean_password2(self): cd = self.cleaned_data if cd['password'] != cd['password2']: raise forms.ValidationError('Passwords don\'t match.') return cd['password2'] class LoginForm(forms.Form): username=forms.CharField() password=forms.CharField(widget=forms.PasswordInput)
254565bcaaa357e4dd2fd04c39baf24bc29f0943
caef77c22623f8cb660f614282a5ada03223ae8c
/copyScript.py
013bc275e19244992993a5e01ff85c4a8a624500
[]
no_license
dimioan/administration_pyscripts
45440960398127783dba4c8aee2739c1f654bae0
09f4a9b91ee3543d9147f348b8320f58b197d983
refs/heads/master
2021-01-13T00:15:21.547921
2016-01-01T12:03:46
2016-01-01T12:03:46
48,877,047
0
0
null
null
null
null
UTF-8
Python
false
false
945
py
# the destination folder must not already exist!!! import shutil import time import sys def copy_directories(source, destination): shutil.copytree(source, destination) toolbar_width = 50 # setup toolbar sys.stdout.write("[%s]" % (" " * toolbar_width)) sys.stdout.flush() sys.stdout.write("\b" * (toolbar_width+1)) # return to start of line, after '[' for i in xrange(toolbar_width): time.sleep(0.1) # do real work here # update the bar sys.stdout.write("-") sys.stdout.flush() sys.stdout.write("\nDONE!!!!!!!\n") source_dir1= '/home/bluesdio/Documents/Attiki' destination_dir1 = '/home/bluesdio/Documents/My_Python/destination/test1' source_dir2 = '/home/bluesdio/Documents/My_Python/Pele' destination_dir2 = '/home/bluesdio/Documents/My_Python/destination/test2' copy_directories(source_dir1, destination_dir1) time.sleep(3) copy_directories(source_dir2, destination_dir2)
06374019a4e5f98b7b8f52c6806f9f9824ff284d
0fb06326f2d17f054699a9943e124704cd824162
/Project 1 - Air Quality Index/Final_dataset_generator.py
03cd353808ff2f1f3cf71c49924a6f8017beb777
[]
no_license
AvAkanksh/Data-Science-Projects
9cc75e4ad509e33a51c2640ae7dead7c4b6619dc
b16177cca4d1bfcd3ed9057d3dbc6bf24043db61
refs/heads/main
2023-05-06T06:24:06.179480
2021-05-30T09:30:28
2021-05-30T09:30:28
370,443,616
0
0
null
null
null
null
UTF-8
Python
false
false
2,990
py
from Plot_AQI import avg_data_2013,avg_data_2014,avg_data_2015,avg_data_2016 import requests import sys import pandas as pd from bs4 import BeautifulSoup import os import csv def met_data(month, year): file_html = open('Data/Html_data/{}/{}.html'.format(year,month), 'rb') plain_text = file_html.read() tempD = [] finalD = [] soup = BeautifulSoup(plain_text, "lxml") for table in soup.findAll('table', {'class': 'medias mensuales numspan'}): for tbody in table: for tr in tbody: a = tr.get_text() tempD.append(a) rows = len(tempD) / 15 for _ in range(round(rows)): newtempD = [] for __ in range(15): newtempD.append(tempD[0]) tempD.pop(0) finalD.append(newtempD) length = len(finalD) finalD.pop(length - 1) finalD.pop(0) for a in range(len(finalD)): finalD[a].pop(6) finalD[a].pop(13) finalD[a].pop(12) finalD[a].pop(11) finalD[a].pop(10) finalD[a].pop(9) finalD[a].pop(0) return finalD def data_combine(year, cs): for a in pd.read_csv('Data/Real-Data/real_' + str(year) + '.csv', chunksize=cs): df = pd.DataFrame(data=a) mylist = df.values.tolist() return mylist if __name__ == "__main__": if not os.path.exists("Data/Real-Data"): os.makedirs("Data/Real-Data") for year in range(2013, 2017): final_data = [] with open('Data/Real-Data/real_' + str(year) + '.csv', 'w') as csvfile: wr = csv.writer(csvfile, dialect='excel') wr.writerow( ['T', 'TM', 'Tm', 'SLP', 'H', 'VV', 'V', 'VM', 'PM 2.5']) for month in range(1, 13): temp = met_data(month, year) final_data = final_data + temp pm = getattr(sys.modules[__name__], 'avg_data_{}'.format(year))() if len(pm) == 364: pm.insert(364, '-') for i in range(len(final_data)-1): final_data[i].insert(8, pm[i]) with open('Data/Real-Data/real_' + str(year) + '.csv', 'a') as csvfile: wr = csv.writer(csvfile, dialect='excel') for row in final_data: flag = 0 for elem in row: if elem == "" or elem == "-": flag = 1 if flag != 1: wr.writerow(row) data_2013 = data_combine(2013, 600) data_2014 = data_combine(2014, 600) data_2015 = data_combine(2015, 600) data_2016 = data_combine(2016, 600) total=data_2013+data_2014+data_2015+data_2016 with open('Data/Real-Data/Real_Combine.csv', 'w') as csvfile: wr = csv.writer(csvfile, dialect='excel') wr.writerow( ['T', 'TM', 'Tm', 'SLP', 'H', 'VV', 'V', 'VM', 'PM 2.5']) wr.writerows(total) df=pd.read_csv('Data/Real-Data/Real_Combine.csv')
5998c8bd953812e35fce547ed6dfa101b44f1a4a
577b733677369f9f02f0c13b0a94171bd633f7c7
/controllerCode/js_linux.py
78936b415080c9f2ebd25e9c07f4dc5c61aa6e8c
[]
no_license
hernandez-jesus/Harvard-REU-2017
41cdff6fd8357e2b34a0ef5350ff0b2ef3862211
e32138f3e5a50a3f02b9dd80cba7f86abce9c9c6
refs/heads/master
2021-06-23T14:50:11.428818
2017-08-16T00:20:25
2017-08-16T00:20:25
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,822
py
# Released by rdb under the Unlicense (unlicense.org) # Based on information from: # https://www.kernel.org/doc/Documentation/input/joystick-api.txt import os, struct, array import fcntl from fcntl import ioctl # Iterate over the joystick devices. print('Available devices:') for fn in os.listdir('/dev/input'): if fn.startswith('js'): print(' /dev/input/%s' % fn) # We'll store the states here. axis_states = {} button_states = {} # Axis and button mapping are joystick-specific # Joystick (DragonRise Inc. Generic USB Joystick ) has 7 axes (X, Y, Z, Rx, Ry, Hat0X, Hat0Y) # and 12 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6). # Run jscal -q to see the address mappings. Current output: # jscal -u 7,0,1,2,3,4,16,17,12,288,289,290,291,292,293,294,295,296,297,298,299 /dev/input/js0 axis_names = { 0x00 : 'axis0', # Binary L/R axis for 4-way button 0x01 : 'axis1', # right joystick analog input L/R 0x02 : 'axis2', # right joystick analog input U/D 0x03 : 'axis3', # Binary U/D axis for 4-way button } button_names = { 0x120 : 'but0', # Triangle AND right joystick up/down 0x121 : 'but1', # Circle AND right joystick left/right 0x122 : 'but2', # Cross AND right joystick up/down 0x123 : 'but3', # Square AND right joystick left/right 0x124 : 'but4', # L2 0x125 : 'but5', # R2 0x126 : 'but6', # L1 0x127 : 'but7', # R1 0x128 : 'but8', # select 0x129 : 'but9', # start 0x130 : 'but10', 0x131 : 'but11', # analog - sends no event output } axis_map = [] button_map = [] # Open the joystick device. fn = '/dev/input/js0' print('Opening %s...' % fn) jsdev = open(fn, 'rb') # set to non-blocking!!! flag = fcntl.fcntl(jsdev, fcntl.F_GETFD) fcntl.fcntl(jsdev, fcntl.F_SETFL, flag | os.O_NONBLOCK) # Get the device name. # Get number of axes and buttons. buf = array.array('B', [0]) ioctl(jsdev, 0x80016a11, buf) # JSIOCGAXES num_axes = buf[0] buf = array.array('B', [0]) ioctl(jsdev, 0x80016a12, buf) # JSIOCGBUTTONS num_buttons = buf[0] # Get the axis map. buf = array.array('B', [0] * 0x40) ioctl(jsdev, 0x80406a32, buf) # JSIOCGAXMAP for axis in buf[:num_axes]: axis_name = axis_names.get(axis, 'unknown(0x%02x)' % axis) axis_map.append(axis_name) axis_states[axis_name] = 0.0 # Get the button map. buf = array.array('H', [0] * 200) ioctl(jsdev, 0x80406a34, buf) # JSIOCGBTNMAP for btn in buf[:num_buttons]: btn_name = button_names.get(btn, 'unknown(0x%03x)' % btn) button_map.append(btn_name) button_states[btn_name] = 0 print('{:d} axes found '.format(num_axes)) print('{:d} buttons found '.format(num_buttons)) # Main control loop # The following code is event-based. That means the values are ONLY updated on change. # It might be more intuitive to update all buttons/axes in a continuous loop. # how this works: every time something is pressed on the joystick, it logs an EVENT # in the EVENT QUEUE # We continuously read from the event queue. HOWEVER this means that if a value isn't changed, # we don't see it in the queue. # It MAY be possible to poll joystick values continuously (check joystick API and maybe evdev API?) # but in the meantime we can write code that APPEARS continuous even though it is event-based def main(): running = True # Observe that axis map and button map contain the CURRENT STATE of each axis. while running: # To see a continuously updated list of the current values of all buttons and axes, uncomment the below # print current controller state: #for butt in button_map: # print("{name} : {val} ".format(name=butt, val=button_states[butt])) #for ax in axis_map: # print("{name} : {val} ".format(name=ax, val=axis_states[ax])) # Use current joystick state to control robot # Axis 2 is the only analog axis BUT can act as 2 axes by combining with buttons # Axis 2 can be controlled by: # L/R on left toggle # U/D on right toggle (this also toggles the states of buttons 0 or 2) # Example code: try: # read evbuf = jsdev.read(8) if evbuf: time, value, intype, number = struct.unpack('IhBB', evbuf) if intype & 0x01: button = button_map[number] if button: button_states[button] = value if intype & 0x02: axis = axis_map[number] if axis: fvalue = value / 32767.0 axis_states[axis] = fvalue except: pass # get value from axis 2 diraxis = axis_map[2] ax2val = axis_states[diraxis] # check button states butt0 = button_map[0] butt2 = button_map[2] # There are several methods to determine which combination of button/axes has been set! # this is just one example if (button_states[butt0] or button_states[butt2]): # we should be moving forwards or backwards if ax2val > 0: print("Going backwards at {} ".format(ax2val)) if ax2val < 0: print ("Going forwards at {} ".format(ax2val)) else: # we should be turning left or right if ax2val < 0: print("Turning left at {} ".format(ax2val)) elif ax2val > 0 : print("Turning right at {} ".format(ax2val)) # Things to think about: # how can we change between turning on the spot and turning while moving forward or back? # what other controls might be useful? if __name__ == '__main__': main()
4ff7317dbd5aec4a5122628aade19c6d7efe7ce4
13e3212fe80ab14cf27164045f8d311c2ee52c29
/Shop/migrations/0002_auto_20210527_0745.py
2e3fd111af36715bdd86c3abbc83592f6147a8d4
[]
no_license
prantacse4/MobileBazar
c209915240017a9bd4e07485bf6595eb0ecfbda1
a69a42b1658532592b19944fd6f25bfb615644c3
refs/heads/master
2023-05-14T08:46:50.641283
2021-06-03T11:34:04
2021-06-03T11:34:04
369,074,938
1
0
null
null
null
null
UTF-8
Python
false
false
1,558
py
# Generated by Django 3.1.6 on 2021-05-27 01:45 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Shop', '0001_initial'), ] operations = [ migrations.CreateModel( name='Slider', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('image', models.ImageField(upload_to='uploaded_image/sliders')), ], ), migrations.AlterField( model_name='brand', name='id', field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), ), migrations.AlterField( model_name='cart', name='id', field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), ), migrations.AlterField( model_name='checkout', name='id', field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), ), migrations.AlterField( model_name='ordered', name='id', field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), ), migrations.AlterField( model_name='product', name='id', field=models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), ), ]
3a8c2a36ba70b28a542910c484faf84b6338657e
2196d3798497fc7d3d80cd02b008dbb35dbd64d8
/d01/ex03/capital_city.py
43c2172c50975816070fc588eec89b5d5b1f9cc8
[]
no_license
avallete/Python-Django-Pool
d59965e1c6315520da54205848d4f59bf05a9928
cee52fe4b30cbc53135caf89a8a8843842e2daeb
refs/heads/master
2021-03-30T06:36:37.546122
2016-10-13T15:08:40
2016-10-13T15:08:40
69,851,733
4
2
null
null
null
null
UTF-8
Python
false
false
511
py
# -*- coding: utf-8 -*- import sys def run(state): states = { "Oregon" : "OR", "Alabama" : "AL", "New Jersey": "NJ", "Colorado" : "CO" } capital_cities = { "OR": "Salem", "AL": "Montgomery", "NJ": "Trenton", "CO": "Denver" } if state in states.keys(): print(capital_cities[states[state]]) else: print("Unknown state") if __name__ == '__main__': if (len(sys.argv) == 2): run(sys.argv[1])
5b3a2e285dac25d8fbaf09b7b6ce6bb8623be7d1
6b9084d234c87d7597f97ec95808e13f599bf9a1
/training/old/detr/eval_step.py
14c769d423b9428725a45145e5fecae4336afb35
[]
no_license
LitingLin/ubiquitous-happiness
4b46234ce0cb29c4d27b00ec5a60d3eeb52c26fc
aae2d764e136ca4a36c054212b361dd7e8b22cba
refs/heads/main
2023-07-13T19:51:32.227633
2021-08-03T16:02:03
2021-08-03T16:02:03
316,664,903
1
0
null
null
null
null
UTF-8
Python
false
false
2,953
py
import torch import Utils.detr_misc as utils from evaluation.evaluator.coco import CocoEvaluator @torch.no_grad() def evaluate(model, criterion, postprocessors, data_loader, base_ds, device, output_dir): model.eval() criterion.eval() metric_logger = utils.MetricLogger(delimiter=" ") metric_logger.add_meter('class_error', utils.SmoothedValue(window_size=1, fmt='{value:.2f}')) header = 'Test:' iou_types = tuple(k for k in ('segm', 'bbox') if k in postprocessors.keys()) coco_evaluator = CocoEvaluator(base_ds, iou_types) # coco_evaluator.coco_eval[iou_types[0]].params.iouThrs = [0, 0.1, 0.5, 0.75] for samples, targets in metric_logger.log_every(data_loader, 10, header): samples = samples.to(device) targets = [{k: v.to(device) for k, v in t.items()} for t in targets] outputs = model(samples) loss_dict = criterion(outputs, targets) weight_dict = criterion.weight_dict # reduce losses over all GPUs for logging purposes loss_dict_reduced = utils.reduce_dict(loss_dict) loss_dict_reduced_scaled = {k: v * weight_dict[k] for k, v in loss_dict_reduced.items() if k in weight_dict} loss_dict_reduced_unscaled = {f'{k}_unscaled': v for k, v in loss_dict_reduced.items()} metric_logger.update(loss=sum(loss_dict_reduced_scaled.values()), **loss_dict_reduced_scaled, **loss_dict_reduced_unscaled) metric_logger.update(class_error=loss_dict_reduced['class_error']) orig_target_sizes = torch.stack([t["orig_size"] for t in targets], dim=0) results = postprocessors['bbox'](outputs, orig_target_sizes) if 'segm' in postprocessors.keys(): target_sizes = torch.stack([t["size"] for t in targets], dim=0) results = postprocessors['segm'](results, outputs, orig_target_sizes, target_sizes) res = {target['image_id'].item(): output for target, output in zip(targets, results)} if coco_evaluator is not None: coco_evaluator.update(res) # gather the stats from all processes metric_logger.synchronize_between_processes() print("Averaged stats:", metric_logger) if coco_evaluator is not None: coco_evaluator.synchronize_between_processes() # accumulate predictions from all images if coco_evaluator is not None: coco_evaluator.accumulate() coco_evaluator.summarize() stats = {k: meter.global_avg for k, meter in metric_logger.meters.items()} if coco_evaluator is not None: if 'bbox' in postprocessors.keys(): stats['coco_eval_bbox'] = coco_evaluator.coco_eval['bbox'].stats.tolist() if 'segm' in postprocessors.keys(): stats['coco_eval_masks'] = coco_evaluator.coco_eval['segm'].stats.tolist() return stats, coco_evaluator
4fee8226361947afb1ef025ada908dc3ad5f97a7
163bbb4e0920dedd5941e3edfb2d8706ba75627d
/Code/CodeRecords/2526/48083/309473.py
a8d534b2af549d2506c477c229047c81420f23b7
[]
no_license
AdamZhouSE/pythonHomework
a25c120b03a158d60aaa9fdc5fb203b1bb377a19
ffc5606817a666aa6241cfab27364326f5c066ff
refs/heads/master
2022-11-24T08:05:22.122011
2020-07-28T16:21:24
2020-07-28T16:21:24
259,576,640
2
1
null
null
null
null
UTF-8
Python
false
false
1,340
py
from typing import List class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def getAllElements(self, root1: TreeNode, root2: TreeNode) -> List[int]: res = [] def inOrder(root): if root: inOrder(root.left) res.append(root.val) inOrder(root.right) inOrder(root1) inOrder(root2) res = filter(None, res) # return sorted(map(int,res)) def str2arr(self,t): t = t[1:-1] t = t.split(',') return t def creatTree(self,arr): nodes = [] for a in arr: node = TreeNode(a) nodes.append(node) parentNum = len(arr) // 2 - 1 for i in range(parentNum+1): leftIndex = 2 * i + 1 rightIndex = 2 * i + 2 if nodes[leftIndex].val!='null': nodes[i].left = nodes[leftIndex] if rightIndex < len(arr) and nodes[rightIndex].val!='null': nodes[i].right = nodes[rightIndex] return nodes[0] s = Solution() t1 = input() t2 = input() t1 = s.str2arr(t1) t2 = s.str2arr(t2) root1 = s.creatTree(t1) root2 = s.creatTree(t2) res = s.getAllElements(root1, root2) print(res)
beb51d68a2bfda9d9043f37aca7dfab32345ec5d
0c66e605e6e4129b09ea14dbb6aa353d18aaa027
/diventi/blog/migrations/0011_auto_20200502_1924.py
cafdf11a5790066124e2ac11c41e6c0b8e07572d
[ "Apache-2.0" ]
permissive
flavoi/diventi
58fbc8c947f387cbcc1ce607878a59a6f2b72313
c0b1efe2baa3ff816d6ee9a8e86623f297973ded
refs/heads/master
2023-07-20T09:32:35.897661
2023-07-11T19:44:26
2023-07-11T19:44:26
102,959,477
2
1
Apache-2.0
2023-02-08T01:03:17
2017-09-09T14:10:51
Python
UTF-8
Python
false
false
612
py
# Generated by Django 2.2.12 on 2020-05-02 17:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('blog', '0010_auto_20200229_1600'), ] operations = [ migrations.AlterField( model_name='blogcover', name='color', field=models.CharField(blank=True, choices=[('info', 'Blue'), ('primary', 'Rose'), ('danger', 'Red'), ('warning', 'Yellow'), ('success', 'Green'), ('default', 'Gray'), ('dark', 'Black'), ('light', 'White')], default='warning', max_length=30, verbose_name='color'), ), ]
5337ceda808da03a25bf931d536938d1881c73a9
f576f0ea3725d54bd2551883901b25b863fe6688
/sdk/paloaltonetworks/azure-mgmt-paloaltonetworksngfw/azure/mgmt/paloaltonetworksngfw/aio/operations/_firewalls_operations.py
8cc8d9e5ce7f000a913bdbed272f44375a317198
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-2.1-or-later" ]
permissive
Azure/azure-sdk-for-python
02e3838e53a33d8ba27e9bcc22bd84e790e4ca7c
c2ca191e736bb06bfbbbc9493e8325763ba990bb
refs/heads/main
2023-09-06T09:30:13.135012
2023-09-06T01:08:06
2023-09-06T01:08:06
4,127,088
4,046
2,755
MIT
2023-09-14T21:48:49
2012-04-24T16:46:12
Python
UTF-8
Python
false
false
50,367
py
# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- from io import IOBase from typing import Any, AsyncIterable, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload import urllib.parse from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ( ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, ResourceNotModifiedError, map_error, ) from azure.core.pipeline import PipelineResponse from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.core.tracing.decorator_async import distributed_trace_async from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models from ..._vendor import _convert_request from ...operations._firewalls_operations import ( build_create_or_update_request, build_delete_request, build_get_global_rulestack_request, build_get_log_profile_request, build_get_request, build_get_support_info_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_save_log_profile_request, build_update_request, ) T = TypeVar("T") ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class FirewallsOperations: """ .. warning:: **DO NOT** instantiate this class directly. Instead, you should access the following operations through :class:`~azure.mgmt.paloaltonetworksngfw.aio.PaloAltoNetworksNgfwMgmtClient`'s :attr:`firewalls` attribute. """ models = _models def __init__(self, *args, **kwargs) -> None: input_args = list(args) self._client = input_args.pop(0) if input_args else kwargs.pop("client") self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.FirewallResource"]: """List FirewallResource resources by subscription ID. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_subscription_request( subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_subscription.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version _parsed_next_link = urllib.parse.urlparse(next_link) _next_request_params = case_insensitive_dict( { key: [urllib.parse.quote(v) for v in value] for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) _next_request_params["api-version"] = self._config.api_version request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) request.method = "GET" return request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) list_by_subscription.metadata = { "url": "/subscriptions/{subscriptionId}/providers/PaloAltoNetworks.Cloudngfw/firewalls" } @distributed_trace def list_by_resource_group( self, resource_group_name: str, **kwargs: Any ) -> AsyncIterable["_models.FirewallResource"]: """List FirewallResource resources by resource group. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either FirewallResource or the result of cls(response) :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResourceListResult] = kwargs.pop("cls", None) error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) def prepare_request(next_link=None): if not next_link: request = build_list_by_resource_group_request( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.list_by_resource_group.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) else: # make call to next link with the client's api-version _parsed_next_link = urllib.parse.urlparse(next_link) _next_request_params = case_insensitive_dict( { key: [urllib.parse.quote(v) for v in value] for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) _next_request_params["api-version"] = self._config.api_version request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) request = _convert_request(request) request.url = self._client.format_url(request.url) request.method = "GET" return request async def extract_data(pipeline_response): deserialized = self._deserialize("FirewallResourceListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) # type: ignore return deserialized.next_link or None, AsyncList(list_of_elem) async def get_next(next_link=None): request = prepare_request(next_link) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response return AsyncItemPaged(get_next, extract_data) list_by_resource_group.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls" } @distributed_trace_async async def get(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.FirewallResource: """Get a FirewallResource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) request = build_get_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("FirewallResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized get.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" } async def _create_or_update_initial( self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any ) -> _models.FirewallResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None if isinstance(resource, (IOBase, bytes)): _content = resource else: _json = self._serialize.body(resource, "FirewallResource") request = build_create_or_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, template_url=self._create_or_update_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 201]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize("FirewallResource", pipeline_response) if response.status_code == 201: deserialized = self._deserialize("FirewallResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore _create_or_update_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" } @overload async def begin_create_or_update( self, resource_group_name: str, firewall_name: str, resource: _models.FirewallResource, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.FirewallResource]: """Create a FirewallResource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param resource: Resource create parameters. Required. :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def begin_create_or_update( self, resource_group_name: str, firewall_name: str, resource: IO, *, content_type: str = "application/json", **kwargs: Any ) -> AsyncLROPoller[_models.FirewallResource]: """Create a FirewallResource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param resource: Resource create parameters. Required. :type resource: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, firewall_name: str, resource: Union[_models.FirewallResource, IO], **kwargs: Any ) -> AsyncLROPoller[_models.FirewallResource]: """Create a FirewallResource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param resource: Resource create parameters. Is either a FirewallResource type or a IO type. Required. :type resource: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either FirewallResource or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.paloaltonetworksngfw.models.FirewallResource] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._create_or_update_initial( resource_group_name=resource_group_name, firewall_name=firewall_name, resource=resource, api_version=api_version, content_type=content_type, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): deserialized = self._deserialize("FirewallResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized if polling is True: polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_create_or_update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" } @overload async def update( self, resource_group_name: str, firewall_name: str, properties: _models.FirewallResourceUpdate, *, content_type: str = "application/json", **kwargs: Any ) -> _models.FirewallResource: """Update a FirewallResource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Required. :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def update( self, resource_group_name: str, firewall_name: str, properties: IO, *, content_type: str = "application/json", **kwargs: Any ) -> _models.FirewallResource: """Update a FirewallResource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Required. :type properties: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def update( self, resource_group_name: str, firewall_name: str, properties: Union[_models.FirewallResourceUpdate, IO], **kwargs: Any ) -> _models.FirewallResource: """Update a FirewallResource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param properties: The resource properties to be updated. Is either a FirewallResourceUpdate type or a IO type. Required. :type properties: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResourceUpdate or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: FirewallResource or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.FirewallResource :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FirewallResource] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None if isinstance(properties, (IOBase, bytes)): _content = properties else: _json = self._serialize.body(properties, "FirewallResourceUpdate") request = build_update_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, template_url=self.update.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("FirewallResource", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized update.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" } async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, firewall_name: str, **kwargs: Any ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) request = build_delete_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self._delete_initial.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) _delete_initial.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" } @distributed_trace_async async def begin_delete(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> AsyncLROPoller[None]: """Delete a FirewallResource. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) cont_token: Optional[str] = kwargs.pop("continuation_token", None) if cont_token is None: raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, firewall_name=firewall_name, api_version=api_version, cls=lambda x, y, z: x, headers=_headers, params=_params, **kwargs ) kwargs.pop("error_map", None) def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements if cls: return cls(pipeline_response, None, {}) if polling is True: polling_method: AsyncPollingMethod = cast( AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), ) elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( polling_method=polling_method, continuation_token=cont_token, client=self._client, deserialization_callback=get_long_running_output, ) return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore begin_delete.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}" } @distributed_trace_async async def get_global_rulestack( self, resource_group_name: str, firewall_name: str, **kwargs: Any ) -> _models.GlobalRulestackInfo: """Get Global Rulestack associated with the Firewall. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: GlobalRulestackInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.GlobalRulestackInfo :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.GlobalRulestackInfo] = kwargs.pop("cls", None) request = build_get_global_rulestack_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_global_rulestack.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("GlobalRulestackInfo", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized get_global_rulestack.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getGlobalRulestack" } @distributed_trace_async async def get_log_profile(self, resource_group_name: str, firewall_name: str, **kwargs: Any) -> _models.LogSettings: """Log Profile for Firewall. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: LogSettings or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.LogSettings] = kwargs.pop("cls", None) request = build_get_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, template_url=self.get_log_profile.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("LogSettings", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized get_log_profile.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getLogProfile" } @distributed_trace_async async def get_support_info( self, resource_group_name: str, firewall_name: str, email: Optional[str] = None, **kwargs: Any ) -> _models.SupportInfo: """support info for firewall. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param email: email address on behalf of which this API called. Default value is None. :type email: str :keyword callable cls: A custom type or function that will be passed the direct response :return: SupportInfo or the result of cls(response) :rtype: ~azure.mgmt.paloaltonetworksngfw.models.SupportInfo :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.SupportInfo] = kwargs.pop("cls", None) request = build_get_support_info_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, email=email, api_version=api_version, template_url=self.get_support_info.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize("SupportInfo", pipeline_response) if cls: return cls(pipeline_response, deserialized, {}) return deserialized get_support_info.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/getSupportInfo" } @overload async def save_log_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, firewall_name: str, log_settings: Optional[_models.LogSettings] = None, *, content_type: str = "application/json", **kwargs: Any ) -> None: """Log Profile for Firewall. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param log_settings: Default value is None. :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @overload async def save_log_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, firewall_name: str, log_settings: Optional[IO] = None, *, content_type: str = "application/json", **kwargs: Any ) -> None: """Log Profile for Firewall. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param log_settings: Default value is None. :type log_settings: IO :keyword content_type: Body Parameter content-type. Content type parameter for binary body. Default value is "application/json". :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ @distributed_trace_async async def save_log_profile( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, firewall_name: str, log_settings: Optional[Union[_models.LogSettings, IO]] = None, **kwargs: Any ) -> None: """Log Profile for Firewall. :param resource_group_name: The name of the resource group. The name is case insensitive. Required. :type resource_group_name: str :param firewall_name: Firewall resource name. Required. :type firewall_name: str :param log_settings: Is either a LogSettings type or a IO type. Default value is None. :type log_settings: ~azure.mgmt.paloaltonetworksngfw.models.LogSettings or IO :keyword content_type: Body Parameter content-type. Known values are: 'application/json'. Default value is None. :paramtype content_type: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None or the result of cls(response) :rtype: None :raises ~azure.core.exceptions.HttpResponseError: """ error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError, 304: ResourceNotModifiedError, } error_map.update(kwargs.pop("error_map", {}) or {}) _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[None] = kwargs.pop("cls", None) content_type = content_type or "application/json" _json = None _content = None if isinstance(log_settings, (IOBase, bytes)): _content = log_settings else: if log_settings is not None: _json = self._serialize.body(log_settings, "LogSettings") else: _json = None request = build_save_log_profile_request( resource_group_name=resource_group_name, firewall_name=firewall_name, subscription_id=self._config.subscription_id, api_version=api_version, content_type=content_type, json=_json, content=_content, template_url=self.save_log_profile.metadata["url"], headers=_headers, params=_params, ) request = _convert_request(request) request.url = self._client.format_url(request.url) _stream = False pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access request, stream=_stream, **kwargs ) response = pipeline_response.http_response if response.status_code not in [204]: map_error(status_code=response.status_code, response=response, error_map=error_map) error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) save_log_profile.metadata = { "url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/PaloAltoNetworks.Cloudngfw/firewalls/{firewallName}/saveLogProfile" }
bac3c30d02721d958e23136003c622e9b7874698
f2e0992e94fa31b640d97f50c576bd360bb323e0
/portfolio/migrations/0001_initial.py
1ee3bb0f226b35248c57c7af90444f588b3e5dd4
[]
no_license
mpmckinley/personal_portfolio-project
01917d8582144a3a7a40766572db5f24c72a62f3
25782c8c8c68ab6a7738e18c889d1b6c438ad97c
refs/heads/master
2023-01-30T12:52:06.044032
2020-12-17T14:37:09
2020-12-17T14:37:09
322,165,904
0
0
null
null
null
null
UTF-8
Python
false
false
685
py
# Generated by Django 3.1.4 on 2020-12-15 23:11 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Project', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=50)), ('description', models.CharField(max_length=150)), ('image', models.ImageField(upload_to='portfolio/images/')), ('url', models.URLField(blank=True)), ], ), ]
404b57be933409cdc797a676f865e78c845133f9
bf1c7016681b5b7c6569a5f20d037e9c5db37854
/VI_semester/mobile_robots/point.py
4141470fd0bdca014339714df82312b8f323ed3a
[ "Beerware" ]
permissive
dainiusjocas/labs
ae62d4672f4c43d27b4e9d23e126fa9fb9cf58a9
25aa0ae2032681dbaf0afd83f3d80bedddea6407
refs/heads/master
2021-01-23T23:03:10.271749
2011-12-13T15:38:48
2011-12-13T15:38:48
6,511,648
1
0
null
null
null
null
UTF-8
Python
false
false
379
py
#!/usr/bin/env python class Point: ''' Class that represents a point in a map ''' def __init__(self, x = 0, y = 0): self.x = x self.y = y def values(self): return [self.x, self.y] def __repr__(self): return "({0}, {1})".format(self.x, self.y) def __eq__(self, other): return self.x == other.x and self.y == other.y
cac6a3f45b7111acbedec61c19bcf6ec0f01d43d
128c1bd8ce38d5c7bfee1f1d3fb1fec0738b3dfc
/venv/bin/wheel
ce977b896c7ae45b2814de6a86fdba70c69cb8d9
[]
no_license
ajitesh-30/Blog
58b8b6a520fab32643efaae01c48d5388195a69c
460f48e2e7d1316855d94644db2ad9d01820af9a
refs/heads/master
2021-05-08T16:23:32.949050
2018-12-12T19:45:48
2018-12-12T19:45:48
120,154,122
0
0
null
null
null
null
UTF-8
Python
false
false
238
#!/home/rattlesnake/Project/venv/bin/python3 # -*- coding: utf-8 -*- import re import sys from wheel.cli import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(main())
5802c971baf6a88738677a1750fa3adc94a4f74b
9ac6dad591f8c1dd512e2b1710f455f19f1ea3d3
/4.5_import_exercises.py
0f89e5b1ae3dfbf11744b9a6ca37cf99d2e84330
[]
no_license
Padraic-Doran/python-exercises
d789b500938f6ca0dee33ab1786897839fb9ea66
fec5cd3109d899b05214c95603cad21d3630ec2f
refs/heads/master
2020-07-23T15:14:05.964961
2019-09-30T21:10:17
2019-09-30T21:10:17
207,604,670
0
0
null
null
null
null
UTF-8
Python
false
false
5,527
py
# from CU_function_exercises import remove_vowels # remove_vowels('RGJJweapr') # import CU_function_exercises as cfe # from CU_function_exercises import remove_vowels as rv # print(rv('wfjnqergpvpoqweoaf')) How many different ways can you combine the letters from "abc" with the numbers 1, 2, and 3? # import itertools # print(list(e for e in itertools.product('ABC', '123'))) # print(len(list(e for e in itertools.product('ABC', '123')))) How many different ways can you combine two of the letters from "abcd"? # print(len(list(e for e in itertools.combinations_with_replacement('ABCD', 2)))) # Save this file as profiles.json inside of your exercises directory. # Use the load function from the json module to open this file, it will produce a list of dictionaries. # Using this data, write some code that calculates and outputs the following information: import json profiles = open('profiles.json') profiles_data = json.load(profiles) # Total number of users """ Remember, profiles_data is a list. Iterate like a list """ user_total = len(profiles_data) # Number of active users """Remember isActive is boolean. x = a dictionary, so "for each dictionary in the list of dictionaries called # profile_data, where the key isactive is set to True" # """ active_total = len([x for x in profiles_data if x["isActive"]]) # print(active_total) """Same thing as above, but boolean is switched to False""" inactive_total = len([x for x in profiles_data if not x["isActive"]]) # print(inactive_total) # Grand total of balances for all users """Remember, the balances have unwanted character in the list, so they need to be removed. Create a function to accomplish this task""" def handle_balance(s): return float(s[1:].replace(',', '')) """ Could also add a seconnd .replace() for $ """ """ Now that that/s accomplished, pass the all balance keys through the function. List comprehension looks like this: """ balances = [handle_balance(x['balance']) for x in profile_data] """ Above means that the variable /balances/ GETS the values of the key named /balance/ for all dictionaries "x" in the list profile_data """ # print(balances) # Average balance per user """ Take the sum of balances and divide it by the number of balances """ total_balance = sum(balances) average_balance = sum(balances) / len(balances) # User with the lowest balance """ from the lecture, Zach explained that anchoring the lowest balance to the first dictionary in the list simplifies the program writing, because you're looping and replacing against a known index. As Kevin pointed out, this could create a situation where multiple accounts have the lowest balance, and this code would not flag that """ user_with_the_lowest_balance user_with_the_lowest_balance = profile_data[0] for user in profile_data[1:]: if handle_balance(user['balance']) < handle_balance(user_with_the_lowest_balance['balance']): user_with_the_lowest_balance = user """ The variable user_with_the_lowest_balance is set to the first index of profile_data. For each user(dictionary) in the list profile_data, starting at the SECOND index, if the balance key(having been run through the balance cleaning function) is less than the current lowest balance, the variable user_with_the_lowest_balance is set to that user. """ # User with the highest balance """ Same as above; just flipping the results from < to > and altering the variable name. """ user_with_the_highest_balance = profiles[0] for user in profiles[1:]: if handle_balance(user['balance']) > handle_balance(user_with_the_highest_balance['balance']): user_with_the_highest_balance = user ### Alternative with a custom key function """ The min function has key that you can manipulate. Here, the key is changed to read the lambda function """ min(profiles, key=lambda profile: handle_balance(profile['balance'])) """ Function created to pass the balances through the cleaning function. Said function is then made the key in min() """ def extract_balance(profile): return handle_balance(profile['balance']) min(profiles, key=extract_balance) # Most common favorite fruit # Least most common favorite fruit """ Using an import from a library called collection, importing just one function called Counter. Because the function was specifically imported, there is no need to us collections.Counter. The datatype created is a !!!Countertype!!! """ from collections import Counter Counter([p['favoriteFruit'] for p in profile_data]) """The list comprehension reads, roughly, the Counter function to counter the variable of the dictionary (p) key 'favoriteFruit' for all dictionaries 'p' in the list of dictionaries called profile_data """ # For loop to create a dictionary of 'favoriteFruits' fruit_counts = {} for profile in profile_data: fruit = profile['favoriteFruit'] if fruit in fruit_counts: fruit_counts[fruit] += 1 else: fruit_counts[fruit] = 1 """ This creates a dictionary as the end results, as opposed to what the Counter function would produce """ # Total number of unread messages for all users """ The number needed for the answer is buried in a string in the key['greeting']. A function needs to be created to extract the digits from the string. """ greetings = [profile['greeting'] for profile in profile_data] def extract_digits(s): return int(''.join([c for c in s if c.isdigit()])) n_unread_messages = [extract_digits(greeting) for greeting in greetings] sum(n_unread_messages)
af426f37de5914387a99e20ec2eba4baf60691aa
15905cfe5ccfbc740ee71b890297aac9139dae18
/computer/urls.py
91df3c3518b003805ae627294a2817fdbc943f3a
[]
no_license
Yura1224/djangolesson2practise
82a962986601c0f27c771ea1ed11cd88c46df014
23855fc048b241eb1444b2006507a88cd619f6e1
refs/heads/master
2023-08-04T12:53:36.339126
2021-09-21T11:46:43
2021-09-21T11:46:43
408,798,094
0
0
null
null
null
null
UTF-8
Python
false
false
335
py
from django.urls import path from .views import ComputerListCreateView, ComputerRetrieveUpdateDeleteView urlpatterns = [ path('', ComputerListCreateView.as_view(), name='computer_list_create'), path('/<int:pk>', ComputerRetrieveUpdateDeleteView.as_view(), name='car_retrieve_update_delete') ] # http:localhost:8000/computers
2c5ec191020dbe6eb0ff6d138d3c4adf6ca3187e
b3c1c93247e83c212f40dd271e15ba296f22be56
/linearregression.py
b11fa874f740dcd15c90a494003bb2197f8e1945
[]
no_license
campbellbg/mypythonlearning
dda78f585668dc087443e3312ff02e921686297a
656725b6ceafbf6408d1308c81cbe430c9f8e123
refs/heads/master
2020-03-27T18:51:50.670832
2019-05-27T12:19:49
2019-05-27T12:19:49
146,949,278
0
0
null
null
null
null
UTF-8
Python
false
false
5,697
py
import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sb from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn import metrics #This config fixes the truncated console writes. Makes things a lot easier pd.set_option('display.width', 400) pd.set_option('display.max_columns', 10) np.set_printoptions(linewidth=400) #Linear Regression coding exercise #*********************************************************************************************************************** #ecommerce data. Read it and understand it customers_all = pd.read_csv('D:\\Course Content\\python-for-data-science-and-ml-bootcamp\\11-Linear-Regression\\Ecommerce Customers') customers = customers_all[['Avg. Session Length', 'Time on App', 'Time on Website', 'Length of Membership', 'Yearly Amount Spent']] #reduce to the numerical fields only #print(customers.corr()) #Based on this is looks like a strong correlation between time on app and the spend #jointplots are pretty cool. This shows a strong correlation with the Time on the App #sb.jointplot(customers['Yearly Amount Spent'], customers['Time on Website']) #sb.jointplot(customers['Yearly Amount Spent'], customers['Time on App']) #sb.pairplot(customers) #sb.lmplot(data = customers[['Yearly Amount Spent', 'Length of Membership']], x = 'Yearly Amount Spent', y = 'Length of Membership') #plt.show() custxtrain, custxtest, custytrain, custytest = train_test_split(customers[['Avg. Session Length', 'Time on App', 'Time on Website', 'Length of Membership']], customers['Yearly Amount Spent'], test_size = 0.3, random_state = 101) #Tried without the lowly correlated variables but surprisingly it did not make much of a difference at all #custxtrain, custxtest, custytrain, custytest = train_test_split(customers[['Time on App', 'Length of Membership']], customers['Yearly Amount Spent'], test_size = 0.3, random_state = 101) #Instantiate and train the model lm = LinearRegression() lm.fit(X = custxtrain, y = custytrain) #Have a look at the coefficients from the trained model print(pd.DataFrame(data = lm.coef_, index = ['Avg. Session Length', 'Time on App', 'Time on Website', 'Length of Membership'])) #Predict the test values and then visualise the residuals predictions = lm.predict(X = custxtest) #sb.scatterplot(x = predictions, y = custytest) #plt.show() #Look at the key performance metrics of the model print('*********************************') print(f'Mean Abs Error = {metrics.mean_absolute_error(y_true = custytest, y_pred = predictions)}') print(f'Mean Squared Error = {metrics.mean_squared_error(y_true = custytest, y_pred = predictions)}') print(f'SQRT Mean Sqaured Error = {np.sqrt(metrics.mean_squared_error(y_true = custytest, y_pred = predictions))}') ''' USA Housing Data. Not real data #*********************************************************************************************************************** #USA housing data mydf = pd.read_csv('D:\\Course Content\\python-for-data-science-and-ml-bootcamp\\11-Linear-Regression\\USA_Housing.csv') #mydf.info() #print(mydf.corr()) #This is nice. A correlation matrix #sb.heatmap(mydf.corr(), annot = True) #sb.pairplot(mydf) #sb.distplot(mydf['Price']) #plt.show() #Need this in order for the chart to show within pycharm. No idea how seaborn and matplot are linked mydfx = mydf[['Avg. Area Income', 'Avg. Area House Age', 'Avg. Area Number of Rooms', 'Avg. Area Number of Bedrooms', 'Area Population']] #remove the dependent variable and the address mydfy = mydf['Price'] mydfx_train, mydfx_test, mydfy_train, mydfy_test = train_test_split(mydfx, mydfy, test_size = 0.3, random_state = 101) lm = LinearRegression() #instantiate an object lm.fit(X = mydfx_train, y = mydfy_train) #fit (train model) #print(f'Intercept = {lm.intercept_}') #print(pd.DataFrame(data = lm.coef_, index = mydfx_train.columns, columns = ['Coeff'])) #Put the co-efficients into a dataframe for readibility predictions = lm.predict(mydfx_test) #will give me back an array of my dependent variable predictions #sb.distplot(mydfy_test - predictions) #Subtraction of the two aways works by index. Plot the residual distribution #plt.show() print(f'The mean abs error is {metrics.mean_absolute_error(y_true = mydfy_test, y_pred = predictions)}') print(f'The mean squared error is {metrics.mean_squared_error(y_true = mydfy_test, y_pred = predictions)}') print(f'The root mean squared error is {np.sqrt(metrics.mean_squared_error(y_true = mydfy_test, y_pred = predictions))}') ''' ''' Playing around with some of the syntax from the initial videos #*********************************************************************************************************************** mymodel = LinearRegression(normalize=True) print(mymodel) #must have an internal ToString method that allows this object to be printed out #Create a bogus set of x and values. Uses a short-hand assignment notation x, y = np.arange(10).reshape(5, 2), range(5) x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.3, random_state = 23) #random_state provides the same seed and therefore consistent results of the split print(x_train) print('------') print(x_test) print('------') print(y_train) print('------') print(y_test) print('######################') #train (fit) the model mymodel.fit(X = x_train, y = y_train) #predict my values and store the result predictions = mymodel.predict(x_test) sum_squares = 0 for i, prediction in enumerate(predictions): print(f'X = {x_test[i]}, Actual Y = {y_test[i]}, Predicted Y = {prediction}') sum_squares += (prediction - y_test[i]) ** 2 print(sum_squares) '''
8979b51513153b74eb4a26efe75e95c67319ebef
40b42ccf2b6959d6fce74509201781be96f04475
/mmocr/models/textdet/necks/fpem_ffm.py
c98b43f1fc2642db598a0f9094b88e4851cc9e75
[ "Apache-2.0" ]
permissive
xdxie/WordArt
2f1414d8e4edaa89333353d0b28e5096e1f87263
89bf8a218881b250d0ead7a0287526c69586c92a
refs/heads/main
2023-05-23T02:04:22.185386
2023-03-06T11:51:43
2023-03-06T11:51:43
515,485,694
106
12
null
null
null
null
UTF-8
Python
false
false
5,999
py
# Copyright (c) OpenMMLab. All rights reserved. import torch.nn.functional as F from mmcv.runner import BaseModule, ModuleList from torch import nn from mmocr.models.builder import NECKS class FPEM(BaseModule): """FPN-like feature fusion module in PANet. Args: in_channels (int): Number of input channels. init_cfg (dict or list[dict], optional): Initialization configs. """ def __init__(self, in_channels=128, init_cfg=None): super().__init__(init_cfg=init_cfg) self.up_add1 = SeparableConv2d(in_channels, in_channels, 1) self.up_add2 = SeparableConv2d(in_channels, in_channels, 1) self.up_add3 = SeparableConv2d(in_channels, in_channels, 1) self.down_add1 = SeparableConv2d(in_channels, in_channels, 2) self.down_add2 = SeparableConv2d(in_channels, in_channels, 2) self.down_add3 = SeparableConv2d(in_channels, in_channels, 2) def forward(self, c2, c3, c4, c5): """ Args: c2, c3, c4, c5 (Tensor): Each has the shape of :math:`(N, C_i, H_i, W_i)`. Returns: list[Tensor]: A list of 4 tensors of the same shape as input. """ # upsample c4 = self.up_add1(self._upsample_add(c5, c4)) # c4 shape c3 = self.up_add2(self._upsample_add(c4, c3)) c2 = self.up_add3(self._upsample_add(c3, c2)) # downsample c3 = self.down_add1(self._upsample_add(c3, c2)) c4 = self.down_add2(self._upsample_add(c4, c3)) c5 = self.down_add3(self._upsample_add(c5, c4)) # c4 / 2 return c2, c3, c4, c5 def _upsample_add(self, x, y): return F.interpolate(x, size=y.size()[2:]) + y class SeparableConv2d(BaseModule): def __init__(self, in_channels, out_channels, stride=1, init_cfg=None): super().__init__(init_cfg=init_cfg) self.depthwise_conv = nn.Conv2d( in_channels=in_channels, out_channels=in_channels, kernel_size=3, padding=1, stride=stride, groups=in_channels) self.pointwise_conv = nn.Conv2d( in_channels=in_channels, out_channels=out_channels, kernel_size=1) self.bn = nn.BatchNorm2d(out_channels) self.relu = nn.ReLU() def forward(self, x): x = self.depthwise_conv(x) x = self.pointwise_conv(x) x = self.bn(x) x = self.relu(x) return x @NECKS.register_module() class FPEM_FFM(BaseModule): """This code is from https://github.com/WenmuZhou/PAN.pytorch. Args: in_channels (list[int]): A list of 4 numbers of input channels. conv_out (int): Number of output channels. fpem_repeat (int): Number of FPEM layers before FFM operations. align_corners (bool): The interpolation behaviour in FFM operation, used in :func:`torch.nn.functional.interpolate`. init_cfg (dict or list[dict], optional): Initialization configs. """ def __init__(self, in_channels, conv_out=128, fpem_repeat=2, align_corners=False, init_cfg=dict( type='Xavier', layer='Conv2d', distribution='uniform')): super().__init__(init_cfg=init_cfg) # reduce layers self.reduce_conv_c2 = nn.Sequential( nn.Conv2d( in_channels=in_channels[0], out_channels=conv_out, kernel_size=1), nn.BatchNorm2d(conv_out), nn.ReLU()) self.reduce_conv_c3 = nn.Sequential( nn.Conv2d( in_channels=in_channels[1], out_channels=conv_out, kernel_size=1), nn.BatchNorm2d(conv_out), nn.ReLU()) self.reduce_conv_c4 = nn.Sequential( nn.Conv2d( in_channels=in_channels[2], out_channels=conv_out, kernel_size=1), nn.BatchNorm2d(conv_out), nn.ReLU()) self.reduce_conv_c5 = nn.Sequential( nn.Conv2d( in_channels=in_channels[3], out_channels=conv_out, kernel_size=1), nn.BatchNorm2d(conv_out), nn.ReLU()) self.align_corners = align_corners self.fpems = ModuleList() for _ in range(fpem_repeat): self.fpems.append(FPEM(conv_out)) def forward(self, x): """ Args: x (list[Tensor]): A list of four tensors of shape :math:`(N, C_i, H_i, W_i)`, representing C2, C3, C4, C5 features respectively. :math:`C_i` should matches the number in ``in_channels``. Returns: list[Tensor]: Four tensors of shape :math:`(N, C_{out}, H_0, W_0)` where :math:`C_{out}` is ``conv_out``. """ c2, c3, c4, c5 = x # reduce channel c2 = self.reduce_conv_c2(c2) c3 = self.reduce_conv_c3(c3) c4 = self.reduce_conv_c4(c4) c5 = self.reduce_conv_c5(c5) # FPEM for i, fpem in enumerate(self.fpems): c2, c3, c4, c5 = fpem(c2, c3, c4, c5) if i == 0: c2_ffm = c2 c3_ffm = c3 c4_ffm = c4 c5_ffm = c5 else: c2_ffm = c2_ffm + c2 c3_ffm = c3_ffm + c3 c4_ffm = c4_ffm + c4 c5_ffm = c5_ffm + c5 # FFM c5 = F.interpolate( c5_ffm, c2_ffm.size()[-2:], mode='bilinear', align_corners=self.align_corners) c4 = F.interpolate( c4_ffm, c2_ffm.size()[-2:], mode='bilinear', align_corners=self.align_corners) c3 = F.interpolate( c3_ffm, c2_ffm.size()[-2:], mode='bilinear', align_corners=self.align_corners) outs = [c2_ffm, c3, c4, c5] return tuple(outs)
2c8b29f4777567834b9d0affa686caba95f48ef3
d1c29c9f06d56644ca2fb11fcff8c25703aced79
/MMCG/make_plots.py
891af441059f2c0d34f6177672eb9d172bde2fe6
[]
no_license
jjhelmus/arm_vap_scripts
4a3d7bbe9e277972312484fe46a35c92dae1c71c
1d49d0e2f8affea11aabc000f74d8d1c4be75ef5
refs/heads/master
2021-01-22T05:24:35.935447
2013-04-12T14:38:31
2013-04-12T14:38:31
null
0
0
null
null
null
null
UTF-8
Python
false
false
861
py
#!/usr/bin/env python import matplotlib.pyplot as plt import netCDF4 import pyart # MMCG figure dataset = netCDF4.Dataset('sgpcsaprmmcgi7.c0.20110520.110100.nc') refl = dataset.variables['reflectivity_horizontal'] fig = plt.figure() ax = fig.add_subplot(111) ax.imshow(refl[0,4], origin='lower') fig.savefig('mapped_figure.png') # Test dataset = netCDF4.Dataset('foo.dir/sgpcsaprmmcgI7.c0.20110520.110100.nc') refl = dataset.variables['reflectivity_horizontal'] fig = plt.figure() ax = fig.add_subplot(111) ax.imshow(refl[0,4], origin='lower') fig.savefig('exp_figure.png') # Radial coords """ radar = pyart.io.read_netcdf('sgpcsaprsurcmacI7.c0.20110520.110100.nc') display = pyart.graph.RadarDisplay(radar) fig = plt.figure() ax = fig.add_subplot(111) display.plot_ppi('reflectivity_horizontal', 0, vmin=-16, vmax=48) fig.savefig('radial_figure.png') """
5f16b6848d8b04d6ee0612be889a4e855a2b016d
87c5fcc4b167a3c09bfc96787e8f3e44216ccf51
/TextboxTurtle.py
ed42ae5544a76166fa29a4f399c17f23c18281c5
[]
no_license
debojit666/Python-PracticeFiles
6c7e7d8e6031985e5484bbdf90b3bf85c2d2af40
a90d2102b9f9fa217853215a8605b4909c41ce0b
refs/heads/master
2020-06-30T16:10:50.168861
2019-10-03T19:09:33
2019-10-03T19:09:33
200,880,737
0
0
null
null
null
null
UTF-8
Python
false
false
385
py
import turtle name = turtle.textinput("name", "What is your name?") name = name.lower() if name.startswith("mr"): print("Hello Sir, How are you?") elif name.startswith("mrs") or name.startswith("miss") or name.startswith("ms"): print("Hello Madam, How are you?") else: name = name.capitalize() str = "Hi " + name + "! How are you?" print(str) turtle.exitonclick
765b302c85fb439d74794e48f3d108dc132fd8f9
41f185a4560b24351897ce19e4d4a71fc229c312
/aap_whatsapp/cron/whatsapp.py
93f42f045a5d9bf50ad38817e0abb48e10ba0d98
[]
no_license
stark3998/Whatsapp-Scraper
46fbbbb54946f367124702722d9b14c013f31243
b7e23a15117381de499fe9622854e6f2a5cf8a20
refs/heads/master
2020-09-11T22:40:24.753785
2019-11-17T07:56:36
2019-11-17T07:56:36
222,214,172
0
0
null
2019-11-17T08:02:08
2019-11-17T07:43:44
HTML
UTF-8
Python
false
false
9,178
py
# -*- coding: utf-8 -*- import time import json from datetime import datetime, timezone from aap_whatsapp import db from flask_script import Command from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.common.by import By from aap_whatsapp.constants.crawl_elem import CLASSES, CSS, SCROLL, ELS from aap_whatsapp.model.message import Message, User, MessageReceived from aap_whatsapp.api.user import create_user from aap_whatsapp import logging from bs4 import BeautifulSoup import re import os emoji_pattern = re.compile("[" u"\U0001F600-\U0001F64F" # emoticons u"\U0001F300-\U0001F5FF" # symbols & pictographs u"\U0001F680-\U0001F6FF" # transport & map symbols u"\U0001F1E0-\U0001F1FF" # flags (iOS) u"\U00002702-\U000027B0" u"\U000024C2-\U0001F251" "]+", flags=re.UNICODE) cwd = os.getcwd() class Whatsapp(Command): def run(self): logging.info("Script Started") _chrome_options = webdriver.ChromeOptions() _chrome_options.add_argument("--disable-infobars") _chrome_options.add_argument("--start-maximized") driver = webdriver.Chrome(cwd + '/aap_whatsapp/driver/chromedriver', chrome_options=_chrome_options) driver.get("https://web.whatsapp.com") # self.set_storage(driver) WebDriverWait(driver,60).until(EC.visibility_of_element_located((By.XPATH,"//*[@id=\"side\"]/div[1]/div/label/input"))) logging.info("LoggedIn to WhatsApp") # ls = driver.execute_script("return {...window.localStorage}") # with open('creds.json', 'w') as outfile: # json.dump(dict(ls), outfile, indent=4) while True: messages = Message.query.filter_by(is_active=True).all() logging.info("Total Active Messages found {0}".format(len(messages))) driver.execute_script(SCROLL['to_top']) try: search_bar=driver.find_element_by_xpath("//*[@id=\"side\"]/div[1]/div/label/input") except Exception as error: print(error) unread = [] logging.info("Extracting unread chats") for i in range(100): chat_list = driver.find_element_by_id('pane-side') soup = BeautifulSoup(chat_list.get_attribute(CLASSES['html_attribute']['ml']), CLASSES['html_attribute']['ml_type']) chats = soup.find_all(ELS['contacts_class']['el'], ELS['contacts_class']['el_class']) for c in chats: if c.find("span", "P6z4j"): try: count = str(c.find('span', "P6z4j")).split(">")[1].split("<")[0] print("Count",count) except: print("Count Error") if count: count = int(count) else: count = 1 person = c.find("span", "_19RFN") print("Person",person) unread.append((person['title'], int(str(count)))) driver.execute_script(SCROLL['left_panel']) print(unread) unread = set(unread) logging.info("unread chats ({0}) in format (person,unread_count) -> {1}".format(len(unread), unread)) for person in unread: try: logging.info("extracting chat for person {0}".format(person)) search_bar.clear() search_bar.send_keys(person[0]) search_bar.send_keys(Keys.ENTER) chat_body = driver.find_element_by_class_name(CLASSES['chat_body']) chat_soup = BeautifulSoup(chat_body.get_attribute(CLASSES['html_attribute']['ml']), CLASSES['html_attribute']['ml_type']) msgs = chat_soup.find_all(ELS['msg']['el'], ELS['msg']['el_class']) # if len(msgs) < int(person[1]): # print("scroll") logging.info("Unread Messages are:") for m in msgs[-int(person[1]):]: msg_text = m.find("span", "selectable-text invisible-space copyable-text").text logging.info(msg_text) for db_msg in messages: diff = int((datetime.now(timezone.utc) - db_msg.created_at).days) print("Difference between Days : ", diff) if (diff >= 3): print("Setting Message as Inactive") db_msg.is_active = False db_msg.update() continue logging.info("matching with {0} from DB".format(db_msg)) line_count = 0 match_count = 0 b = emoji_pattern.sub(r'', msg_text).replace("\n", " ").split(" ") a = emoji_pattern.sub(r'', db_msg.text).replace("\n", " ").split(" ") count = 0 for x in a: if x in b: count += 1 print(" Match Count : ", count) print(" Match accuracy : ", (count / len(a)) * 100) if (count / len(a)) * 100 >= 80: match_count = 1 if match_count: logging.info("[MATCHED] in {0}".format(person[0])) if person[0][0] != "+": u = User.query.filter_by(name=person[0]).first() if not u: logging.info("Creating Entry in DB for user {0}", person[0]) u = create_user(name=person[0]) else: u = User.query.filter_by(number=person[0][3:].replace(" ", "")).first() if not u: logging.info("Creating Entry in DB for user with number {0}", int(person[0][3:].replace(" ", ""))) u = create_user(name="", number=int(person[0][3:].replace(" ", ""))) if u: ob = None logging.info("Updating Receive Info") if db_msg.received_from_users: for usr in db_msg.received_from_users: if u.id == usr.user.id: ob = MessageReceived.query.filter_by(user_id=u.id, message_id=db_msg.id).first() ob.receive_count += 1 ob.save() logging.info( "Increased receive count for {0}. New RecieveCount={1}".format( u.name, ob.receive_count)) break if not ob: logging.info("Creating Entry in received for user {0}".format(u.name)) ob = MessageReceived(user_id=u.id, message_id=db_msg.id) db_msg.received_from_users.append(ob) db_msg.save() except Exception as e: logging.exception(e) driver.execute_script(SCROLL['to_top']) logging.info("Sleep for 1 Min") time.sleep(60) @staticmethod def set_storage(driver): if os.path.exists(cwd + '/creds.json'): with open('creds.json', 'r') as creds: d = json.load(creds) for key in d: if key == "storage_test": continue try: script = "window.localStorage.setItem('{0}',JSON.stringify({1}));".format(key, d[key]) driver.execute_script(script) except Exception as e: logging.exception(e) driver.refresh()
0b8609103dd7f8a320e1b62047793f8513669fc7
0d247fea57ee40717166b1ff753fd626092e9e78
/tests/test_completer.py
279b880925ed77714e3e343298ac7a331f4a7706
[]
no_license
sean-heller/dockercli
362ff0310992b2257ed20077b76245729ca2a227
ab9ca8f13d01a5d8c5d3f58743c476836b06d186
refs/heads/master
2021-05-29T07:27:33.954752
2015-07-20T16:21:09
2015-07-20T16:21:09
null
0
0
null
null
null
null
UTF-8
Python
false
false
10,645
py
from __future__ import unicode_literals import pytest from prompt_toolkit.completion import Completion from prompt_toolkit.document import Document from dockercli.options import all_options from dockercli.options import COMMAND_NAMES @pytest.fixture def completer(): import dockercli.completer as cmp return cmp.DockerCompleter() @pytest.fixture def complete_event(): from mock import Mock return Mock() cs1 = ['newton', 'tesla', 'einstein', 'edison'] rs1 = ['einstein', 'edison'] im1 = ['ubuntu', 'hello-world', 'postgres', 'nginx'] cs2 = ['desperate_hodgkin', 'desperate_torvalds', 'silly_fermat', 'some-percona'] def test_empty_string_completion(completer, complete_event): """ In the beginning of the line, all available commands are suggested. """ text = '' position = 0 result = set(completer.get_completions( Document(text=text, cursor_position=position), complete_event)) assert result == set(map(Completion, COMMAND_NAMES)) def test_build_path_completion_absolute(completer, complete_event): """ Suggest build paths from filesystem root. """ command = 'build /' position = len(command) result = set(completer.get_completions( Document(text=command, cursor_position=position), complete_event)) expected = ['etc', 'home', 'tmp', 'usr', 'var'] expected = set(map(lambda t: Completion(t, 0), expected)) assert expected.issubset(result) def test_build_path_completion_user(completer, complete_event): """ Suggest build paths from user home directory. """ command = 'build ~' position = len(command) result = set(completer.get_completions( Document(text=command, cursor_position=position), complete_event)) expected = ['~/Documents', '~/Downloads'] expected = set(map(lambda t: Completion(t, -1), expected)) assert expected.issubset(result) def test_build_path_completion_user_dir(completer, complete_event): """ Suggest build paths from user home directory. """ command = 'build ~/s' position = len(command) result = set(completer.get_completions( Document(text=command, cursor_position=position), complete_event)) expected = ['src'] expected = set(map(lambda t: Completion(t, -1), expected)) assert expected.issubset(result) @pytest.mark.parametrize("command, expected", [ ("h", ['help']), ("he", ['help']), ("hel", ['help']), ("help", ['help']), ('run -d ubuntu:14.04 /bin/sh -c "w', []) # not complete in quoted string ]) def test_command_completion(command, expected): """ Test command suggestions. :param command: string: text that user started typing :param expected: list: expected completions """ c = completer() e = complete_event() position = len(command) result = set(c.get_completions( Document(text=command, cursor_position=position), e)) expected = set(map(lambda t: Completion(t, -len(command)), expected)) assert result == expected @pytest.mark.parametrize("command, expected", [ ("h", ['help', 'shell', 'push', 'attach', 'search']), ("he", ['help', 'shell']), ("hel", ['help', 'shell']), ("help", ['help']), ('run -d ubuntu:14.04 /bin/sh -c "w', []) # not complete in quoted string ]) def test_command_completion_fuzzy(command, expected): """ Test command suggestions. :param command: string: text that user started typing :param expected: list: expected completions """ c = completer() e = complete_event() c.set_fuzzy_match(True) position = len(command) result = list(c.get_completions( Document(text=command, cursor_position=position), e)) expected = list(map(lambda t: Completion(t, -len(command)), expected)) assert result == expected pso = list(filter(lambda x: x.name.startswith('-'), all_options('ps'))) @pytest.mark.parametrize("command, expected, expected_pos", [ ("ps ", pso, 0), ("ps --", list(filter( lambda x: x.long_name and x.long_name.startswith('--'), pso)), -2), ("ps --h", list(filter( lambda x: x.long_name and x.long_name.startswith('--h'), pso)), -3), ("ps --all ", list(filter( lambda x: x.long_name not in ['--all'], pso)), 0), ("ps --all --quiet ", list(filter( lambda x: x.long_name not in ['--all', '--quiet'], pso)), 0), ]) def test_options_completion_long(command, expected, expected_pos): """ Test command options suggestions. :param command: string: text that user started typing :param expected: list: expected completions """ c = completer() e = complete_event() position = len(command) result = set(c.get_completions( Document(text=command, cursor_position=position), e)) expected = set(map(lambda t: Completion( t.get_name(is_long=True), expected_pos, t.display), expected)) assert result == expected def option_map(cmd, is_long): return { x.get_name(is_long): x.display for x in all_options(cmd) if x.name.startswith('-') } psm = option_map('ps', True) @pytest.mark.parametrize("command, expected, expected_pos", [ ("ps ", sorted(psm.keys()), 0), ("ps h", ['--help'], -1), ("ps i", ['--since', '--size', '--quiet'], -1), ("ps ze", ['--size'], -2), ]) def test_options_completion_long_fuzzy(command, expected, expected_pos): """ Test command options suggestions. :param command: string: text that user started typing :param expected: list: expected completions """ c = completer() e = complete_event() c.set_fuzzy_match(True) position = len(command) result = list(c.get_completions( Document(text=command, cursor_position=position), e)) expected = list(map(lambda t: Completion( t, expected_pos, psm[t]), expected)) assert result == expected @pytest.mark.parametrize("command, expected, expected_pos", [ ("ps ", pso, 0), ("ps -", filter( lambda x: x.name.startswith('-'), pso), -1), ("ps -h", filter( lambda x: x.short_name and x.short_name.startswith('-h'), pso), -2), ]) def test_options_completion_short(command, expected, expected_pos): """ Test command options suggestions. :param command: string: text that user started typing :param expected: list: expected completions """ c = completer() e = complete_event() c.set_long_options(False) position = len(command) result = set(c.get_completions( Document(text=command, cursor_position=position), e)) expected = set(map(lambda t: Completion( t.get_name( is_long=c.get_long_options()), expected_pos, t.display), expected)) assert result == expected @pytest.mark.parametrize("command, expected, expected_pos", [ ("ps --before ", cs1, 0), ("ps --before e", filter(lambda x: x.startswith('e'), cs1), -1), ("ps --before ei", filter(lambda x: x.startswith('ei'), cs1), -2), ]) def test_options_container_completion(command, expected, expected_pos): """ Suggest container names in relevant options (ps --before) """ c = completer() e = complete_event() c.set_containers(cs1) position = len(command) result = set(c.get_completions( Document(text=command, cursor_position=position), e)) expected = set(map(lambda t: Completion(t, expected_pos), expected)) assert result == expected @pytest.mark.parametrize("command, expected, expected_pos", [ ("top ", list(map( lambda x: (x, x), rs1)) + [('--help', '-h/--help')], 0), ("top e", map( lambda x: (x, x), filter(lambda x: x.startswith('e'), rs1)), -1), ]) def test_options_container_running_completion(command, expected, expected_pos): """ Suggest running container names (top [container]) """ c = completer() e = complete_event() c.set_containers(cs1) c.set_running(rs1) position = len(command) result = set(c.get_completions( Document(text=command, cursor_position=position), e)) expected_completions = set() for text, display in expected: if display: expected_completions.add(Completion(text, expected_pos, display)) else: expected_completions.add(Completion(text, expected_pos)) assert result == expected_completions @pytest.mark.parametrize("command, expected, expected_pos", [ ("rm ", ['--all-stopped', ('--help', '-h/--help')] + cs2, 0), ("rm spe", ['--all-stopped', 'desperate_hodgkin', 'desperate_torvalds', 'some-percona'], -3), ]) def test_options_container_completion_fuzzy(command, expected, expected_pos): """ Suggest running container names (top [container]) """ c = completer() e = complete_event() c.set_containers(cs2) c.set_fuzzy_match(True) position = len(command) result = list(c.get_completions( Document(text=command, cursor_position=position), e)) expected_completions = [] for x in expected: if isinstance(x, tuple): expected_completions.append(Completion(x[0], expected_pos, x[1])) else: expected_completions.append(Completion(x, expected_pos)) assert result == expected_completions def test_options_image_completion(completer, complete_event): """ Suggest image names in relevant options (images --filter) """ command = 'images --filter ' expected = ['ubuntu', 'hello-world', 'postgres', 'nginx'] expected_pos = 0 completer.set_images(expected) position = len(command) result = set(completer.get_completions( Document(text=command, cursor_position=position), complete_event)) expected = set(map(lambda t: Completion(t, expected_pos), expected)) assert result == expected @pytest.mark.parametrize("command, expected, expected_pos", [ ('images --filter ', ['hello-world', 'nginx', 'postgres', 'ubuntu'], 0), ('images --filter n', ['nginx', 'ubuntu'], -1), ('images --filter g', ['nginx', 'postgres'], -1), ('images --filter u', ['ubuntu'], -1), ]) def test_options_image_completion_fuzzy(command, expected, expected_pos): """ Suggest image names in relevant options (images --filter) """ c = completer() e = complete_event() c.set_images(im1) c.set_fuzzy_match(True) position = len(command) result = list(c.get_completions( Document(text=command, cursor_position=position), e)) expected = list(map(lambda t: Completion(t, expected_pos), expected)) assert result == expected
b4a013a5db1bce9ba186a85069333e15577e431f
438895f04e0032b3f18c3450444b1517c301d8b1
/RTT/200server.py
fed53005cae66f686e69d5f4eac37fafa905e618
[]
no_license
iamryanmoreno/ClientServer
3aed1e9d4bff7609d25febb6b3729fee04f60e42
9ce292de9f2848dca7097091cb3fc1a8dc397577
refs/heads/master
2020-05-20T19:45:32.732898
2017-03-10T03:16:58
2017-03-10T03:16:58
84,514,089
0
0
null
null
null
null
UTF-8
Python
false
false
1,921
py
import socket import sys import datetime import time now = datetime.datetime.now() print str(now) # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Bind the socket to the port server_address = ('localhost', 10000) print >>sys.stderr, 'starting up on %s port %s' % server_address #---------------------------------------------------------CONNECTION SETUP PHASE <Protocol Phase> WS <Measurement Type> WS <No. of Probes> WS <MESSAGE SIZE> WS <Server Delay> print 's rtt 2 200 2' sock.bind(server_address) # Listen for incoming connections sock.listen(1) while True: # Wait for a connection print >>sys.stderr, 'waiting for a connection' connection, client_address = sock.accept() try: print '200 OK' print >>sys.stderr, 'connection from', client_address # Receive the data in small chunks and retransmit it while True: data = connection.recv(200) #---------------------------------------------------------MEASUREMENT PHASE <Protocol Phase> WS <Probe Seq. No.> WS <Payload> print 'm 2 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111' print >>sys.stderr, 'received "%s"' % data if data: time.sleep(2) print >>sys.stderr, 'sending data back to the client' connection.sendall(data) else: print >>sys.stderr, 'no more data from', client_address break finally: # Clean up the connection print '200 OK: Closing Connection' #---------------------------------------------------------CONNECTION TERMINATION PHASE <Protocol Phase> WS print 't .' connection.close()
404e2885ea8d3af435aa70e108f7ee3875cdd93b
d1b842eb17900c2bbfc2238cb29dbf290444152e
/keras/ner/mlp.py
72003606acf8e1b605edda65b7c1961539e09cc7
[]
no_license
cambridgeltl/RepEval-2016
6d07f2819439096b280cda171038f38e375a1e74
c52e29312c634df03602bc0d0f2ae0f40a33ca23
refs/heads/master
2020-12-25T15:09:14.054893
2016-11-11T21:10:18
2016-11-11T21:10:18
61,438,829
4
2
null
null
null
null
UTF-8
Python
false
false
3,672
py
#!/usr/bin/env python import sys import numpy as np from os import path from logging import info, warn from keras.models import Sequential from keras.layers import Reshape, Dense, Activation from keras.layers import Merge, Flatten from keras import optimizers from layers import Input, FixedEmbedding import input_data import common import settings # Settings class Defaults(object): window = 2 max_vocab_size = None max_train_examples = None max_develtest_examples = 100000 # for faster develtest examples_as_indices = True hidden_sizes = [300] hidden_activation = 'hard_sigmoid' # 'relu' batch_size = 50 epochs = 10 loss = 'categorical_crossentropy' # 'mse' verbosity = 1 # 0=quiet, 1=progress bar, 2=one line per epoch iobes = False # Map tags to IOBES on input token_level_eval = False # Token-level eval even if IOB-like tagging optimizer = 'adam' # 'sgd' test = False config = settings.from_cli(['datadir', 'wordvecs'], Defaults) optimizer = optimizers.get(config.optimizer) output_name = 'mlp--' + path.basename(config.datadir.rstrip('/')) common.setup_logging(output_name) settings.log_with(config, info) # Data data = input_data.read_data_sets(config.datadir, config.wordvecs, config) embedding = common.word_to_vector_to_matrix(config.word_to_vector) if config.max_train_examples and len(data.train) > config.max_train_examples: warn('cropping train data from %d to %d' % (len(data.train), config.max_train_examples)) data.train.crop(config.max_train_examples) # Model model = Sequential() # Separate embedded-words and word-features sequences embedded = Sequential() embedded.add(FixedEmbedding(embedding.shape[0], embedding.shape[1], input_length=data.input_size, weights=[embedding])) features = Sequential() features.add(Input(data.feature_shape)) model.add(Merge([embedded, features], mode='concat', concat_axis=2)) model.add(Flatten()) # Fully connected layers for size in config.hidden_sizes: model.add(Dense(size)) model.add(Activation(config.hidden_activation)) model.add(Dense(data.output_size)) model.add(Activation('softmax')) model.compile(optimizer=optimizer, loss=config.loss) def predictions(model, inputs): output = list(model.predict(inputs, batch_size=config.batch_size)) return np.argmax(np.asarray(output), axis=1) def eval_report(prefix, model, dataset, config, log=info): pred = predictions(model, dataset.inputs) gold = np.argmax(dataset.labels, axis=1) summary = common.performance_summary(dataset.words, gold, pred, config) for s in summary.split('\n'): log(prefix + ' ' + s) small_train = data.train.subsample(config.max_develtest_examples) small_devel = data.devel.subsample(config.max_develtest_examples) for epoch in range(1, config.epochs+1): model.fit(data.train.inputs, data.train.labels, batch_size=config.batch_size, nb_epoch=1, verbose=config.verbosity) eval_report('Ep %d train' % epoch, model, small_train, config) eval_report('Ep %d devel' % epoch, model, small_devel, config) data.train.shuffle() eval_report('FINAL train', model, data.train, config) eval_report('FINAL devel', model, data.devel, config) pred = predictions(model, data.devel.inputs) common.save_gold_and_prediction(data.devel, pred, config, output_name) if config.test: eval_report('TEST', model, data.test, config) pred = predictions(model, data.test.inputs) common.save_gold_and_prediction(data.test, pred, config, 'TEST--' + output_name)
7d22825383aee94201b5b6c2910f536798d1719e
56550a643bf655ffe5499f4b6ee9db07dae77c40
/mldl/11.py
27c22a2edc70bf4d81a5eeb2678da3c6d94f34e3
[]
no_license
DongJoonLeeDJ/djjsp
06633d0a7b2d7d72449c253e265b18e3042bec72
87de397934748cfaa3898b56b5392c9cc63a12b0
refs/heads/main
2023-08-14T04:25:50.524691
2021-10-08T01:08:52
2021-10-08T01:08:52
397,157,486
4
7
null
null
null
null
UTF-8
Python
false
false
39
py
# print(rfclf.predict([[9.4,1.6,3.3]]))
80bb26a67114fdec2929e2a536de88f8e380d363
09b2adcf32f445c2a5dcd3f68cfe7b33b62427b6
/Sujets/Brut/DFT_003_HM/HM_003.py
8d6d01b28bfd80ecdc5418d42db3d1c9d793f533
[]
no_license
aboutelier/ICM_APATHY_TASKS
5be93afcf43ccf362cd6cb83bac8aac5d9db96ce
f6b732c55656a71f447126415084ca911168dcc7
refs/heads/master
2020-04-19T10:33:16.761807
2019-02-25T10:19:09
2019-02-25T10:19:09
168,143,815
0
0
null
2019-01-29T17:08:33
2019-01-29T11:31:12
Python
UTF-8
Python
false
false
82,800
py
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> RESTART: C:\Users\ECOCAPTURE\Desktop\ECOCAPTURE\ICM_APATHY_TASKS\ICM_APATHY_TASKS m faible-p forte.py Nom sujet :HM_003 TACHE VERBALE FACILE FAIBLE GAIN Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:864 clic y:474 Bien! NR=1 RT=4.384830043216375 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:420 clic y:546 Bien! NR=2 RT=2.0056607133040307 Distracteur:[684.0, 456.0] Cible:[684.0, 456.0] clic x:505 clic y:636 Bien! NR=3 RT=2.5074395836393153 Distracteur:[684.0, 456.0] Cible:[684.0, 456.0] clic x:586 clic y:559 Bien! NR=4 RT=1.8884513735783592 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:601 clic y:379 Bien! NR=5 RT=1.9225157558845076 Distracteur:[504.0, 636.0] Cible:[504.0, 636.0] clic x:771 clic y:565 Bien! NR=6 RT=1.5754477329659622 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:520 clic y:646 Bien! NR=7 RT=1.4008287993199584 Distracteur:[414.0, 546.0] Cible:[414.0, 546.0] clic x:782 clic y:560 Bien! NR=8 RT=2.709030802846522 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:598 clic y:379 Bien! NR=9 RT=2.017840395618137 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:959 clic y:553 Bien! NR=10 RT=2.0819158302229077 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:877 clic y:651 Bien! NR=11 RT=1.8090212849056115 Distracteur:[414.0, 546.0] Cible:[414.0, 546.0] clic x:695 clic y:476 Bien! NR=12 RT=1.6403769104599704 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:771 clic y:373 Bien! NR=13 RT=5.641351268634853 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:956 clic y:540 Bien! NR=14 RT=3.367435185694209 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:775 clic y:385 Bien! NR=15 RT=1.5580216959821982 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:424 clic y:561 Bien! NR=16 RT=1.8920070629685668 Distracteur:[594.0, 546.0] Cible:[594.0, 546.0] clic x:780 clic y:560 Bien! NR=17 RT=1.51710398596596 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:694 clic y:458 Bien! NR=18 RT=1.7655169103450987 Distracteur:[594.0, 366.0] Cible:[594.0, 366.0] clic x:681 clic y:455 Bien! NR=19 RT=2.761897631263487 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:419 clic y:550 Bien! NR=20 RT=1.8922322935529934 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:1042 clic y:660 Bien! NR=21 RT=2.0078391730550322 Distracteur:[594.0, 546.0] Cible:[594.0, 546.0] clic x:867 clic y:478 Bien! NR=22 RT=2.267078755217433 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:764 clic y:543 Bien! NR=23 RT=4.303699032862333 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:858 clic y:458 Bien! NR=24 RT=1.8053679545698813 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:508 clic y:643 Bien! NR=25 RT=1.6467412129302872 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:863 clic y:663 Bien! NR=26 RT=3.8917559862514963 Distracteur:[504.0, 636.0] Cible:[504.0, 636.0] clic x:785 clic y:546 Bien! NR=27 RT=1.53801186624667 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:516 clic y:481 Bien! NR=28 RT=1.4358503090459038 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:688 clic y:290 Bien! NR=29 RT=1.41629545329603 Distracteur:[864.0, 456.0] Cible:[864.0, 456.0] clic x:610 clic y:383 Bien! NR=30 RT=1.7990237546471803 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:683 clic y:452 Bien! NR=31 RT=1.6839707208445418 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:688 clic y:275 Bien! NR=32 RT=1.9202195526403756 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:688 clic y:635 Bien! NR=33 RT=5.274735364319696 Distracteur:[684.0, 456.0] Cible:[684.0, 456.0] clic x:492 clic y:633 Bien! NR=34 RT=1.6572125889537688 Distracteur:[414.0, 546.0] Cible:[414.0, 546.0] clic x:689 clic y:272 Bien! NR=35 RT=1.3060510309324798 Distracteur:[594.0, 546.0] Cible:[594.0, 546.0] clic x:410 clic y:544 Bien! NR=36 RT=2.2645093214282497 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:958 clic y:564 Bien! NR=37 RT=1.9539380890764448 Distracteur:[504.0, 636.0] Cible:[504.0, 636.0] clic x:602 clic y:357 Bien! NR=38 RT=2.1435350617148146 Distracteur:[594.0, 546.0] Cible:[594.0, 546.0] clic x:319 clic y:644 Bien! NR=39 RT=1.6413475763301903 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:316 clic y:642 Bien! NR=40 RT=4.451372347591914 Distracteur:[594.0, 546.0] Cible:[594.0, 546.0] clic x:526 clic y:640 Bien! NR=41 RT=1.4291680581185204 Distracteur:[684.0, 456.0] Cible:[684.0, 456.0] clic x:595 clic y:562 Bien! NR=42 RT=1.9123524821723237 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:696 clic y:284 Bien! NR=43 RT=1.885679273288801 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:689 clic y:637 Bien! NR=44 RT=3.771427469597981 Distracteur:[414.0, 546.0] Cible:[414.0, 546.0] clic x:973 clic y:561 Bien! NR=45 RT=5.037764892090351 Distracteur:[684.0, 456.0] Cible:[684.0, 456.0] clic x:506 clic y:468 Bien! NR=46 RT=1.8185384053018225 Distracteur:[594.0, 366.0] Cible:[594.0, 366.0] clic x:324 clic y:650 Bien! NR=47 RT=1.4146486854164664 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:682 clic y:470 Bien! NR=48 RT=1.5732557347645297 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:499 clic y:457 Bien! NR=49 RT=1.528984181346317 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:860 clic y:646 Bien! NR=50 RT=1.4057067440354842 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:877 clic y:656 Bien! NR=51 RT=7.924459549161398 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:515 clic y:642 Bien! NR=52 RT=2.6413959865468826 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:698 clic y:857 A cรดtรฉ! ratรฉ!AC=1 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:698 clic y:470 Bien! NR=53 RT=1.6478624427795125 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:605 clic y:372 Bien! NR=54 RT=1.5197608042988122 Distracteur:[864.0, 456.0] Cible:[864.0, 456.0] clic x:786 clic y:382 Bien! NR=55 RT=2.0851580839728285 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:693 clic y:636 Bien! NR=56 RT=1.4003578253474416 Distracteur:[1044.0, 636.0] Cible:[1044.0, 636.0] clic x:423 clic y:552 Bien! NR=57 RT=1.9704246396515828 Distracteur:[594.0, 546.0] Cible:[594.0, 546.0] clic x:511 clic y:455 Bien! NR=58 RT=2.393885215273656 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:600 clic y:547 Bien! NR=59 RT=2.761315067638918 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:1055 clic y:636 Bien! NR=60 RT=1.8069749276102982 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:693 clic y:630 Bien! NR=61 RT=2.0222190586920306 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] Plus que 30 sec clic x:862 clic y:638 Bien! NR=62 RT=8.405641923575843 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:697 clic y:461 Bien! NR=63 RT=2.0498190360459034 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:960 clic y:550 Bien! NR=64 RT=2.644956188753895 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:421 clic y:555 Bien! NR=65 RT=2.9438503024818203 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:790 clic y:375 Bien! NR=66 RT=2.180362928932965 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:862 clic y:641 Bien! NR=67 RT=1.7677454213371107 Distracteur:[684.0, 456.0] Cible:[684.0, 456.0] clic x:781 clic y:553 Bien! NR=68 RT=2.5113817342508753 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:778 clic y:570 Bien! NR=69 RT=1.7693778302540863 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:1048 clic y:654 Bien! NR=70 RT=1.5465858079296027 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:962 clic y:556 Bien! NR=71 RT=1.1508380300816157 Distracteur:[864.0, 456.0] Cible:[864.0, 456.0] clic x:329 clic y:644 Bien! NR=72 RT=4.7703739320008935 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] THE END Bonnes rรฉponses:72 Erreurs distracteur:0 Erreurs gris:0 Erreurs ร  cรดtรฉ:1 Erreurs totales:1 Nombre de rรฉponses:73 Taux de rรฉussite= 98.63 RTmoy sec= 2.423 RTmax sec= 8.406 RTmin sec= 1.151 TACHE VERBALE FACILE FORT GAIN Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:953 clic y:578 Distracteur touchรฉ! ratรฉ!NED=1 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] Distracteur:[414.0, 546.0] Cible:[414.0, 546.0] clic x:869 clic y:634 Bien! NR=1 RT=1.5214941362099523 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:421 clic y:548 Bien! NR=2 RT=2.2758861326062743 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:680 clic y:458 Bien! NR=3 RT=1.544936578513557 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:781 clic y:383 Bien! NR=4 RT=1.2813376153127365 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:878 clic y:468 Bien! NR=5 RT=2.141540806940867 Distracteur:[1044.0, 636.0] Cible:[1044.0, 636.0] clic x:937 clic y:563 Bien! NR=6 RT=2.2641478858273842 Distracteur:[504.0, 456.0] Cible:[504.0, 456.0] clic x:784 clic y:548 Bien! NR=7 RT=1.9509341941052867 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:520 clic y:479 Bien! NR=8 RT=2.294131450969047 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:1039 clic y:654 Bien! NR=9 RT=4.932055850620827 Distracteur:[594.0, 366.0] Cible:[594.0, 366.0] clic x:1048 clic y:664 Bien! NR=10 RT=1.2686340359925623 Distracteur:[1044.0, 636.0] Cible:[1044.0, 636.0] clic x:510 clic y:643 Bien! NR=11 RT=2.3216936847641705 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:1055 clic y:652 Bien! NR=12 RT=7.265183782413288 Distracteur:[1044.0, 636.0] Cible:[1044.0, 636.0] clic x:689 clic y:276 Bien! NR=13 RT=9.016601012019692 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:505 clic y:473 Bien! NR=14 RT=1.9365210777262973 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:327 clic y:641 Bien! NR=15 RT=1.51887588194802 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:1034 clic y:660 Bien! NR=16 RT=2.0236040831966875 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:604 clic y:368 Bien! NR=17 RT=2.431268569215547 Distracteur:[864.0, 456.0] Cible:[864.0, 456.0] clic x:497 clic y:637 Bien! NR=18 RT=2.1505438764767746 Distracteur:[594.0, 546.0] Cible:[594.0, 546.0] clic x:595 clic y:378 Bien! NR=19 RT=1.76314439947123 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:420 clic y:555 Bien! NR=20 RT=1.314396870238511 Distracteur:[684.0, 276.0] Cible:[684.0, 276.0] clic x:687 clic y:462 Bien! NR=21 RT=1.6487658266536869 Distracteur:[864.0, 456.0] Cible:[864.0, 456.0] clic x:773 clic y:372 Bien! NR=22 RT=2.3888550655548215 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:424 clic y:561 Bien! NR=23 RT=1.6400688081486692 Distracteur:[684.0, 456.0] Cible:[684.0, 456.0] clic x:506 clic y:644 Bien! NR=24 RT=1.9421005603277308 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:1050 clic y:651 Bien! NR=25 RT=4.321855325657168 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:418 clic y:553 Bien! NR=26 RT=1.7770131060404992 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:1045 clic y:642 Bien! NR=27 RT=12.156216076950898 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:867 clic y:448 Bien! NR=28 RT=1.9561506000815143 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:509 clic y:655 Bien! NR=29 RT=1.6509619274158354 Distracteur:[864.0, 456.0] Cible:[864.0, 456.0] clic x:786 clic y:560 Bien! NR=30 RT=1.668749400000479 Distracteur:[594.0, 366.0] Cible:[594.0, 366.0] clic x:779 clic y:549 Bien! NR=31 RT=2.410021407161935 Distracteur:[864.0, 456.0] Cible:[864.0, 456.0] clic x:1039 clic y:634 Bien! NR=32 RT=1.5697172761293814 Distracteur:[1044.0, 636.0] Cible:[1044.0, 636.0] clic x:422 clic y:552 Bien! NR=33 RT=1.5346522792596602 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:864 clic y:447 Bien! NR=34 RT=2.081085882185903 Distracteur:[1044.0, 636.0] Cible:[1044.0, 636.0] clic x:508 clic y:471 Bien! NR=35 RT=2.009194659122386 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:592 clic y:559 Bien! NR=36 RT=2.1402173208473414 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] clic x:949 clic y:556 Bien! NR=37 RT=1.6372995796515966 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:675 clic y:468 Bien! NR=38 RT=2.0699560451643038 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] clic x:866 clic y:647 Bien! NR=39 RT=1.316026817619047 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:592 clic y:363 Bien! NR=40 RT=3.281584589469105 Distracteur:[504.0, 636.0] Cible:[504.0, 636.0] clic x:418 clic y:554 Bien! NR=41 RT=2.4338872337335715 Distracteur:[504.0, 636.0] Cible:[504.0, 636.0] clic x:960 clic y:559 Bien! NR=42 RT=8.055546210833882 Distracteur:[684.0, 636.0] Cible:[684.0, 636.0] clic x:313 clic y:636 Bien! NR=43 RT=2.396092392949811 Distracteur:[684.0, 456.0] Cible:[684.0, 456.0] clic x:777 clic y:564 Bien! NR=44 RT=2.791233402064904 Distracteur:[504.0, 456.0] Cible:[504.0, 456.0] clic x:415 clic y:549 Bien! NR=45 RT=2.6662808892054386 Distracteur:[504.0, 456.0] Cible:[504.0, 456.0] clic x:967 clic y:559 Bien! NR=46 RT=6.338205260959796 Distracteur:[684.0, 456.0] Cible:[684.0, 456.0] clic x:327 clic y:654 Bien! NR=47 RT=1.7664719864845324 Distracteur:[594.0, 546.0] Cible:[594.0, 546.0] clic x:874 clic y:644 Bien! NR=48 RT=1.5134252197536853 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:601 clic y:365 Bien! NR=49 RT=1.5399749415590236 Distracteur:[864.0, 636.0] Cible:[864.0, 636.0] clic x:1046 clic y:658 Bien! NR=50 RT=1.562570615326706 Distracteur:[774.0, 366.0] Cible:[774.0, 366.0] Plus que 30 sec clic x:870 clic y:470 Bien! NR=51 RT=9.409381407687079 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:788 clic y:370 Bien! NR=52 RT=2.150089312747241 Distracteur:[774.0, 546.0] Cible:[774.0, 546.0] clic x:326 clic y:650 Bien! NR=53 RT=5.91460355724837 Distracteur:[954.0, 546.0] Cible:[954.0, 546.0] clic x:691 clic y:466 Bien! NR=54 RT=2.06234825653479 Distracteur:[324.0, 636.0] Cible:[324.0, 636.0] THE END Bonnes rรฉponses:54 Erreurs distracteur:1 Erreurs gris:0 Erreurs ร  cรดtรฉ:0 Erreurs totales:1 Nombre de rรฉponses:55 Taux de rรฉussite= 98.18 RTmoy sec= 2.871 RTmax sec= 12.156 RTmin sec= 1.269 TACHE VERBALE DIFFICILE FAIBLE GAIN Red 1:[459.0, 591.0, 549.0, 681.0] Blue 1:[549.0, 501.0, 639.0, 591.0] Red 2:[549.0, 321.0, 639.0, 411.0] Blue 2:[459.0, 411.0, 549.0, 501.0] Blue 3:[369.0, 501.0, 459.0, 591.0] clic x:787 clic y:365 clicn=[774.0, 366.0] clic x:695 clic y:293 clicn=[684.0, 276.0] clic x:697 clic y:469 Pas consonne=1 clic x:331 clic y:640 clicn=[324.0, 636.0] clic x:871 clic y:647 clicn=[864.0, 636.0] clic x:694 clic y:649 clicn=[684.0, 636.0] clic x:1055 clic y:636 clicn=[1044.0, 636.0] Combi:[[324.0, 636.0], [864.0, 636.0], [684.0, 636.0], [1044.0, 636.0]] NR=1 RT sec=5.042898426339775 clic x:325 clic y:664 clicn=[324.0, 636.0] clic x:697 clic y:646 Pas consonne=2 clic x:876 clic y:655 clicn=[864.0, 636.0] clic x:692 clic y:645 clicn=[684.0, 636.0] clic x:1046 clic y:632 clicn=[1044.0, 636.0] clic x:327 clic y:652 clicn=[324.0, 636.0] Combi:[[864.0, 636.0], [684.0, 636.0], [1044.0, 636.0], [324.0, 636.0]] NR=2 RT sec=5.615073956862375 clic x:778 clic y:357 clicn=[774.0, 366.0] clic x:686 clic y:275 clicn=[684.0, 276.0] clic x:873 clic y:469 clicn=[864.0, 456.0] clic x:340 clic y:634 clicn=[324.0, 636.0] Combi:[[774.0, 366.0], [684.0, 276.0], [864.0, 456.0], [324.0, 636.0]] clic x:326 clic y:634 NR=3 RT sec=13.657043153195332 clic sur un mรชme cercle:1 clic x:320 clic y:636 clicn=[324.0, 636.0] clic x:861 clic y:659 clicn=[864.0, 636.0] clic x:695 clic y:657 clicn=[684.0, 636.0] clic x:1033 clic y:651 clicn=[1044.0, 636.0] Combi:[[324.0, 636.0], [864.0, 636.0], [684.0, 636.0], [1044.0, 636.0]] Dรฉjร  fait:1 clic x:329 clic y:647 clicn=[324.0, 636.0] clic x:692 clic y:659 Pas consonne=3 clic x:696 clic y:475 clicn=[684.0, 456.0] clic x:877 clic y:649 clicn=[864.0, 636.0] clic x:687 clic y:641 clicn=[684.0, 636.0] clic x:1057 clic y:649 clicn=[1044.0, 636.0] Combi:[[684.0, 456.0], [864.0, 636.0], [684.0, 636.0], [1044.0, 636.0]] NR=4 RT sec=15.744350568738014 clic x:326 clic y:652 clicn=[324.0, 636.0] clic x:687 clic y:648 Pas consonne=4 clic x:685 clic y:459 clicn=[684.0, 456.0] clic x:871 clic y:656 clicn=[864.0, 636.0] clic x:691 clic y:645 clicn=[684.0, 636.0] clic x:1051 clic y:656 clicn=[1044.0, 636.0] Combi:[[684.0, 456.0], [864.0, 636.0], [684.0, 636.0], [1044.0, 636.0]] Dรฉjร  fait:2 clic x:326 clic y:647 clicn=[324.0, 636.0] clic x:685 clic y:633 Pas consonne=5 clic x:689 clic y:460 clicn=[684.0, 456.0] clic x:869 clic y:660 clicn=[864.0, 636.0] clic x:694 clic y:638 clicn=[684.0, 636.0] clic x:1048 clic y:660 clicn=[1044.0, 636.0] Combi:[[684.0, 456.0], [864.0, 636.0], [684.0, 636.0], [1044.0, 636.0]] Dรฉjร  fait:3 clic x:337 clic y:653 clicn=[324.0, 636.0] clic x:702 clic y:633 Pas consonne=6 clic x:683 clic y:470 clicn=[684.0, 456.0] clic x:868 clic y:641 clicn=[864.0, 636.0] clic x:692 clic y:656 clicn=[684.0, 636.0] clic x:1051 clic y:646 clicn=[1044.0, 636.0] Combi:[[684.0, 456.0], [864.0, 636.0], [684.0, 636.0], [1044.0, 636.0]] Dรฉjร  fait:4 clic x:324 clic y:645 clicn=[324.0, 636.0] clic x:701 clic y:657 Pas consonne=7 clic x:692 clic y:458 clicn=[684.0, 456.0] clic x:870 clic y:650 clicn=[864.0, 636.0] clic x:693 clic y:657 clicn=[684.0, 636.0] clic x:1045 clic y:651 clicn=[1044.0, 636.0] Combi:[[684.0, 456.0], [864.0, 636.0], [684.0, 636.0], [1044.0, 636.0]] Dรฉjร  fait:5 clic x:328 clic y:649 clicn=[324.0, 636.0] clic x:692 clic y:628 Pas consonne=8 clic x:688 clic y:461 clicn=[684.0, 456.0] Plus que 30 sec clic x:853 clic y:653 clicn=[864.0, 636.0] clic x:685 clic y:651 clicn=[684.0, 636.0] clic x:1043 clic y:671 clicn=[1044.0, 636.0] Combi:[[684.0, 456.0], [864.0, 636.0], [684.0, 636.0], [1044.0, 636.0]] Dรฉjร  fait:6 clic x:325 clic y:645 clicn=[324.0, 636.0] clic x:695 clic y:641 Pas consonne=9 clic x:677 clic y:465 clicn=[684.0, 456.0] THE END Bonnes rรฉponses:4 Erreurs couleur:0 Erreurs rรฉpรฉtition:6 Erreurs mรชme cercle:1 Erreurs pas consonne:9 Erreurs pas voyelle:0 Erreurs ร  cotรฉ:0 Erreurs totales:16 Nombre de rรฉponses:20 Taux de rรฉussite= 20.00 RTmoy sec= 10.015 RTmax sec= 15.744 RTmin sec= 5.043 TACHE VERBALE DIFFICILE FORT GAIN Red 1:[639.0, 591.0, 729.0, 681.0] Blue 1:[819.0, 411.0, 909.0, 501.0] Red 2:[639.0, 411.0, 729.0, 501.0] Blue 2:[729.0, 321.0, 819.0, 411.0] Blue 3:[909.0, 501.0, 999.0, 591.0] clic x:425 clic y:553 clicn=[414.0, 546.0] clic x:606 clic y:551 clicn=[594.0, 546.0] clic x:863 clic y:638 clicn=[864.0, 636.0] clic x:518 clic y:470 clicn=[504.0, 456.0] Combi:[[414.0, 546.0], [594.0, 546.0], [864.0, 636.0], [504.0, 456.0]] NR=1 RT sec=8.171537910532948 clic x:609 clic y:564 clicn=[594.0, 546.0] clic x:511 clic y:635 Pas consonne=1 clic x:415 clic y:555 clicn=[414.0, 546.0] clic x:604 clic y:545 clicn=[594.0, 546.0] clic x:866 clic y:644 clicn=[864.0, 636.0] clic x:511 clic y:460 clicn=[504.0, 456.0] Combi:[[414.0, 546.0], [594.0, 546.0], [864.0, 636.0], [504.0, 456.0]] Dรฉjร  fait:1 clic x:603 clic y:563 clicn=[594.0, 546.0] clic x:509 clic y:656 Pas consonne=2 clic x:601 clic y:552 clicn=[594.0, 546.0] clic x:872 clic y:663 clicn=[864.0, 636.0] clic x:499 clic y:471 clicn=[504.0, 456.0] clic x:785 clic y:562 clicn=[774.0, 546.0] Combi:[[594.0, 546.0], [864.0, 636.0], [504.0, 456.0], [774.0, 546.0]] NR=2 RT sec=28.515942551021567 clic x:332 clic y:650 clicn=[324.0, 636.0] clic x:596 clic y:367 clicn=[594.0, 366.0] clic x:1047 clic y:664 clicn=[1044.0, 636.0] clic x:864 clic y:653 clicn=[864.0, 636.0] Combi:[[324.0, 636.0], [594.0, 366.0], [1044.0, 636.0], [864.0, 636.0]] NR=3 RT sec=19.593391923370746 clic x:1040 clic y:641 clicn=[1044.0, 636.0] clic x:774 clic y:554 clicn=[774.0, 546.0] clic x:601 clic y:543 clicn=[594.0, 546.0] clic x:866 clic y:644 clicn=[864.0, 636.0] Combi:[[1044.0, 636.0], [774.0, 546.0], [594.0, 546.0], [864.0, 636.0]] NR=4 RT sec=12.525986029960222 clic x:509 clic y:467 clicn=[504.0, 456.0] clic x:858 clic y:642 clicn=[864.0, 636.0] clic x:1053 clic y:656 clicn=[1044.0, 636.0] clic x:778 clic y:562 clicn=[774.0, 546.0] Combi:[[504.0, 456.0], [864.0, 636.0], [1044.0, 636.0], [774.0, 546.0]] NR=5 RT sec=10.291150940594093 clic x:595 clic y:556 clicn=[594.0, 546.0] clic x:868 clic y:642 clicn=[864.0, 636.0] clic x:1050 clic y:648 clicn=[1044.0, 636.0] clic x:780 clic y:548 clicn=[774.0, 546.0] Combi:[[594.0, 546.0], [864.0, 636.0], [1044.0, 636.0], [774.0, 546.0]] NR=6 RT sec=10.234278782130218 clic x:607 clic y:557 clicn=[594.0, 546.0] clic x:865 clic y:643 clicn=[864.0, 636.0] clic x:514 clic y:461 clicn=[504.0, 456.0] clic x:783 clic y:553 clicn=[774.0, 546.0] Combi:[[594.0, 546.0], [864.0, 636.0], [504.0, 456.0], [774.0, 546.0]] Dรฉjร  fait:2 clic x:868 clic y:641 clicn=[864.0, 636.0] clic x:1050 clic y:649 clicn=[1044.0, 636.0] clic x:776 clic y:562 clicn=[774.0, 546.0] clic x:609 clic y:546 clicn=[594.0, 546.0] Combi:[[864.0, 636.0], [1044.0, 636.0], [774.0, 546.0], [594.0, 546.0]] NR=7 RT sec=7.959409264074452 clic x:873 clic y:656 clicn=[864.0, 636.0] clic x:873 clic y:656 clic sur un mรชme cercle:1 clic x:519 clic y:462 clicn=[504.0, 456.0] clic x:857 clic y:646 clicn=[864.0, 636.0] clic x:1044 clic y:642 clicn=[1044.0, 636.0] clic x:776 clic y:550 clicn=[774.0, 546.0] Combi:[[504.0, 456.0], [864.0, 636.0], [1044.0, 636.0], [774.0, 546.0]] Dรฉjร  fait:3 clic x:605 clic y:561 clicn=[594.0, 546.0] clic x:868 clic y:650 clicn=[864.0, 636.0] clic x:530 clic y:471 clicn=[504.0, 456.0] Plus que 30 sec THE END Bonnes rรฉponses:7 Erreurs couleur:0 Erreurs rรฉpรฉtition:3 Erreurs mรชme cercle:1 Erreurs pas consonne:2 Erreurs pas voyelle:0 Erreurs ร  cotรฉ:0 Erreurs totales:6 Nombre de rรฉponses:13 Taux de rรฉussite= 53.85 RTmoy sec= 13.899 RTmax sec= 28.516 RTmin sec= 7.959 TACHE SPATIALE DIFFICILE FAIBLE GAIN Red 1:[639.0, 231.0, 729.0, 321.0] Blue 1:[819.0, 411.0, 909.0, 501.0] Red 2:[279.0, 591.0, 369.0, 681.0] Blue 2:[639.0, 591.0, 729.0, 681.0] Blue 3:[549.0, 321.0, 639.0, 411.0] clic x:769 clic y:380 clicn=[729.0, 321.0, 819.0, 411.0] clic x:689 clic y:476 clicn=[639.0, 411.0, 729.0, 501.0] clic x:509 clic y:480 clicn=[459.0, 411.0, 549.0, 501.0] clic x:595 clic y:559 clicn=[549.0, 501.0, 639.0, 591.0] Combi:[[459.0, 411.0, 549.0, 501.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] NR=1 RT sec=3.731926373803958 clic x:1037 clic y:631 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:945 clic y:546 clicn=[909.0, 501.0, 999.0, 591.0] clic x:867 clic y:645 clicn=[819.0, 591.0, 909.0, 681.0] clic x:768 clic y:545 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=2 RT sec=2.6430201903424404 clic x:770 clic y:371 clicn=[729.0, 321.0, 819.0, 411.0] clic x:683 clic y:475 clicn=[639.0, 411.0, 729.0, 501.0] clic x:585 clic y:572 clicn=[549.0, 501.0, 639.0, 591.0] clic x:500 clic y:650 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] NR=3 RT sec=2.5079212242698077 clic x:1045 clic y:640 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:962 clic y:569 clicn=[909.0, 501.0, 999.0, 591.0] clic x:780 clic y:559 clicn=[729.0, 501.0, 819.0, 591.0] clic x:861 clic y:647 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:1 clic x:788 clic y:394 clicn=[729.0, 321.0, 819.0, 411.0] clic x:699 clic y:480 clicn=[639.0, 411.0, 729.0, 501.0] clic x:591 clic y:560 clicn=[549.0, 501.0, 639.0, 591.0] clic x:512 clic y:642 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:2 clic x:971 clic y:557 clicn=[909.0, 501.0, 999.0, 591.0] clic x:782 clic y:544 clicn=[729.0, 501.0, 819.0, 591.0] clic x:868 clic y:651 clicn=[819.0, 591.0, 909.0, 681.0] clic x:1056 clic y:641 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:3 clic x:786 clic y:375 clicn=[729.0, 321.0, 819.0, 411.0] clic x:689 clic y:470 clicn=[639.0, 411.0, 729.0, 501.0] clic x:591 clic y:545 clicn=[549.0, 501.0, 639.0, 591.0] clic x:527 clic y:648 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:4 clic x:1056 clic y:641 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:951 clic y:563 clicn=[909.0, 501.0, 999.0, 591.0] clic x:779 clic y:554 clicn=[729.0, 501.0, 819.0, 591.0] clic x:873 clic y:658 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:5 clic x:521 clic y:485 clicn=[459.0, 411.0, 549.0, 501.0] clic x:428 clic y:557 clicn=[369.0, 501.0, 459.0, 591.0] clic x:506 clic y:661 clicn=[459.0, 591.0, 549.0, 681.0] clic x:694 clic y:477 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[369.0, 501.0, 459.0, 591.0], [459.0, 411.0, 549.0, 501.0], [459.0, 591.0, 549.0, 681.0], [639.0, 411.0, 729.0, 501.0]] NR=4 RT sec=2.339248542155019 clic x:774 clic y:392 clicn=[729.0, 321.0, 819.0, 411.0] clic x:760 clic y:563 clicn=[729.0, 501.0, 819.0, 591.0] clic x:873 clic y:625 clicn=[819.0, 591.0, 909.0, 681.0] clic x:957 clic y:563 clicn=[909.0, 501.0, 999.0, 591.0] Combi:[[729.0, 321.0, 819.0, 411.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0]] NR=5 RT sec=1.4090056131235542 clic x:1039 clic y:644 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:960 clic y:573 clicn=[909.0, 501.0, 999.0, 591.0] clic x:876 clic y:651 clicn=[819.0, 591.0, 909.0, 681.0] clic x:790 clic y:558 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:6 clic x:773 clic y:375 clicn=[729.0, 321.0, 819.0, 411.0] clic x:695 clic y:472 clicn=[639.0, 411.0, 729.0, 501.0] clic x:602 clic y:566 clicn=[549.0, 501.0, 639.0, 591.0] clic x:530 clic y:660 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:7 clic x:795 clic y:377 clicn=[729.0, 321.0, 819.0, 411.0] clic x:693 clic y:461 clicn=[639.0, 411.0, 729.0, 501.0] clic x:603 clic y:547 clicn=[549.0, 501.0, 639.0, 591.0] clic x:533 clic y:660 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:8 clic x:778 clic y:562 clicn=[729.0, 501.0, 819.0, 591.0] clic x:876 clic y:663 clicn=[819.0, 591.0, 909.0, 681.0] clic x:957 clic y:531 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1045 clic y:660 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:9 clic x:777 clic y:375 clicn=[729.0, 321.0, 819.0, 411.0] clic x:691 clic y:471 clicn=[639.0, 411.0, 729.0, 501.0] clic x:602 clic y:565 clicn=[549.0, 501.0, 639.0, 591.0] clic x:525 clic y:647 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:10 clic x:783 clic y:561 clicn=[729.0, 501.0, 819.0, 591.0] clic x:964 clic y:559 clicn=[909.0, 501.0, 999.0, 591.0] clic x:878 clic y:657 clicn=[819.0, 591.0, 909.0, 681.0] clic x:1061 clic y:656 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:11 clic x:1047 clic y:653 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:964 clic y:559 clicn=[909.0, 501.0, 999.0, 591.0] clic x:870 clic y:658 clicn=[819.0, 591.0, 909.0, 681.0] clic x:778 clic y:557 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:12 clic x:786 clic y:385 clicn=[729.0, 321.0, 819.0, 411.0] clic x:686 clic y:489 clicn=[639.0, 411.0, 729.0, 501.0] clic x:599 clic y:561 clicn=[549.0, 501.0, 639.0, 591.0] clic x:511 clic y:654 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:13 clic x:518 clic y:456 clicn=[459.0, 411.0, 549.0, 501.0] clic x:424 clic y:559 clicn=[369.0, 501.0, 459.0, 591.0] clic x:528 clic y:639 clicn=[459.0, 591.0, 549.0, 681.0] clic x:612 clic y:563 clicn=[549.0, 501.0, 639.0, 591.0] Combi:[[369.0, 501.0, 459.0, 591.0], [459.0, 411.0, 549.0, 501.0], [459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0]] NR=6 RT sec=1.66764170860165 clic x:705 clic y:473 clicn=[639.0, 411.0, 729.0, 501.0] clic x:797 clic y:388 clicn=[729.0, 321.0, 819.0, 411.0] clic x:776 clic y:559 clicn=[729.0, 501.0, 819.0, 591.0] clic x:875 clic y:659 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0]] NR=7 RT sec=1.565435433488915 clic x:967 clic y:556 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1047 clic y:659 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:777 clic y:368 clicn=[729.0, 321.0, 819.0, 411.0] clic x:687 clic y:459 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=8 RT sec=8.303566109894518 clic x:602 clic y:544 clicn=[549.0, 501.0, 639.0, 591.0] clic x:536 clic y:647 clicn=[459.0, 591.0, 549.0, 681.0] clic x:789 clic y:558 clicn=[729.0, 501.0, 819.0, 591.0] clic x:883 clic y:652 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0]] NR=9 RT sec=1.6820642608703338 clic x:962 clic y:561 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1047 clic y:641 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:776 clic y:380 clicn=[729.0, 321.0, 819.0, 411.0] clic x:686 clic y:461 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:14 clic x:580 clic y:563 clicn=[549.0, 501.0, 639.0, 591.0] clic x:514 clic y:643 clicn=[459.0, 591.0, 549.0, 681.0] clic x:502 clic y:469 clicn=[459.0, 411.0, 549.0, 501.0] clic x:421 clic y:556 clicn=[369.0, 501.0, 459.0, 591.0] Combi:[[369.0, 501.0, 459.0, 591.0], [459.0, 411.0, 549.0, 501.0], [459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0]] Dรฉjร  fait:15 clic x:784 clic y:388 clicn=[729.0, 321.0, 819.0, 411.0] clic x:684 clic y:461 clicn=[639.0, 411.0, 729.0, 501.0] clic x:803 clic y:546 clicn=[729.0, 501.0, 819.0, 591.0] clic x:882 clic y:641 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0]] Dรฉjร  fait:16 clic x:965 clic y:560 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1041 clic y:658 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:1188 clic y:29 A cรดtรฉ:1 clic x:765 clic y:383 clicn=[729.0, 321.0, 819.0, 411.0] clic x:697 clic y:461 clicn=[639.0, 411.0, 729.0, 501.0] clic x:608 clic y:548 clicn=[549.0, 501.0, 639.0, 591.0] clic x:526 clic y:635 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:17 clic x:788 clic y:547 clicn=[729.0, 501.0, 819.0, 591.0] clic x:869 clic y:635 clicn=[819.0, 591.0, 909.0, 681.0] clic x:951 clic y:556 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1052 clic y:650 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:18 clic x:766 clic y:372 clicn=[729.0, 321.0, 819.0, 411.0] clic x:682 clic y:477 clicn=[639.0, 411.0, 729.0, 501.0] clic x:601 clic y:552 clicn=[549.0, 501.0, 639.0, 591.0] clic x:521 clic y:658 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:19 clic x:804 clic y:538 clicn=[729.0, 501.0, 819.0, 591.0] clic x:866 clic y:628 clicn=[819.0, 591.0, 909.0, 681.0] clic x:954 clic y:553 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1059 clic y:646 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:20 clic x:519 clic y:455 clicn=[459.0, 411.0, 549.0, 501.0] clic x:425 clic y:542 clicn=[369.0, 501.0, 459.0, 591.0] clic x:506 clic y:636 clicn=[459.0, 591.0, 549.0, 681.0] clic x:595 clic y:566 clicn=[549.0, 501.0, 639.0, 591.0] Combi:[[369.0, 501.0, 459.0, 591.0], [459.0, 411.0, 549.0, 501.0], [459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0]] Dรฉjร  fait:21 clic x:690 clic y:475 clicn=[639.0, 411.0, 729.0, 501.0] clic x:762 clic y:369 clicn=[729.0, 321.0, 819.0, 411.0] clic x:787 clic y:550 clicn=[729.0, 501.0, 819.0, 591.0] clic x:876 clic y:651 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0]] Dรฉjร  fait:22 clic x:955 clic y:566 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1042 clic y:655 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:787 clic y:357 clicn=[729.0, 321.0, 819.0, 411.0] clic x:691 clic y:475 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:23 clic x:608 clic y:557 clicn=[549.0, 501.0, 639.0, 591.0] clic x:513 clic y:644 clicn=[459.0, 591.0, 549.0, 681.0] clic x:788 clic y:384 clicn=[729.0, 321.0, 819.0, 411.0] clic x:688 clic y:467 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:24 clic x:786 clic y:547 clicn=[729.0, 501.0, 819.0, 591.0] clic x:869 clic y:650 clicn=[819.0, 591.0, 909.0, 681.0] clic x:968 clic y:551 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1044 clic y:649 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:25 clic x:519 clic y:466 clicn=[459.0, 411.0, 549.0, 501.0] clic x:420 clic y:554 clicn=[369.0, 501.0, 459.0, 591.0] clic x:520 clic y:657 clicn=[459.0, 591.0, 549.0, 681.0] clic x:613 clic y:561 clicn=[549.0, 501.0, 639.0, 591.0] Combi:[[369.0, 501.0, 459.0, 591.0], [459.0, 411.0, 549.0, 501.0], [459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0]] Dรฉjร  fait:26 clic x:707 clic y:460 clicn=[639.0, 411.0, 729.0, 501.0] clic x:790 clic y:382 clicn=[729.0, 321.0, 819.0, 411.0] clic x:781 clic y:555 clicn=[729.0, 501.0, 819.0, 591.0] clic x:865 clic y:659 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0]] Dรฉjร  fait:27 clic x:1061 clic y:637 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:956 clic y:563 clicn=[909.0, 501.0, 999.0, 591.0] clic x:877 clic y:663 clicn=[819.0, 591.0, 909.0, 681.0] clic x:783 clic y:553 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:28 clic x:760 clic y:403 clicn=[729.0, 321.0, 819.0, 411.0] clic x:690 clic y:475 clicn=[639.0, 411.0, 729.0, 501.0] clic x:593 clic y:557 clicn=[549.0, 501.0, 639.0, 591.0] clic x:488 clic y:657 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:29 clic x:521 clic y:474 clicn=[459.0, 411.0, 549.0, 501.0] clic x:419 clic y:546 clicn=[369.0, 501.0, 459.0, 591.0] clic x:767 clic y:374 clicn=[729.0, 321.0, 819.0, 411.0] clic x:686 clic y:482 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[369.0, 501.0, 459.0, 591.0], [459.0, 411.0, 549.0, 501.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] NR=10 RT sec=2.2530098436842536 clic x:592 clic y:560 clicn=[549.0, 501.0, 639.0, 591.0] clic x:518 clic y:649 clicn=[459.0, 591.0, 549.0, 681.0] clic x:688 clic y:453 clicn=[639.0, 411.0, 729.0, 501.0] clic x:780 clic y:541 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0]] NR=11 RT sec=2.3030118539389832 clic x:869 clic y:645 clicn=[819.0, 591.0, 909.0, 681.0] clic x:963 clic y:557 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1055 clic y:644 clicn=[999.0, 591.0, 1089.0, 681.0] Plus que 30 sec clic x:770 clic y:555 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:30 clic x:778 clic y:360 clicn=[729.0, 321.0, 819.0, 411.0] clic x:688 clic y:452 clicn=[639.0, 411.0, 729.0, 501.0] clic x:596 clic y:551 clicn=[549.0, 501.0, 639.0, 591.0] clic x:492 clic y:659 clicn=[459.0, 591.0, 549.0, 681.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:31 clic x:524 clic y:472 clicn=[459.0, 411.0, 549.0, 501.0] clic x:426 clic y:559 clicn=[369.0, 501.0, 459.0, 591.0] clic x:770 clic y:396 clicn=[729.0, 321.0, 819.0, 411.0] clic x:692 clic y:459 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[369.0, 501.0, 459.0, 591.0], [459.0, 411.0, 549.0, 501.0], [639.0, 411.0, 729.0, 501.0], [729.0, 321.0, 819.0, 411.0]] Dรฉjร  fait:32 clic x:604 clic y:538 clicn=[549.0, 501.0, 639.0, 591.0] clic x:513 clic y:668 clicn=[459.0, 591.0, 549.0, 681.0] clic x:685 clic y:458 clicn=[639.0, 411.0, 729.0, 501.0] clic x:790 clic y:541 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0]] Dรฉjร  fait:33 clic x:883 clic y:652 clicn=[819.0, 591.0, 909.0, 681.0] clic x:1046 clic y:657 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:943 clic y:550 clicn=[909.0, 501.0, 999.0, 591.0] clic x:787 clic y:378 clicn=[729.0, 321.0, 819.0, 411.0] Combi:[[729.0, 321.0, 819.0, 411.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=12 RT sec=2.927058521387835 clic x:686 clic y:468 clicn=[639.0, 411.0, 729.0, 501.0] clic x:618 clic y:565 clicn=[549.0, 501.0, 639.0, 591.0] clic x:501 clic y:673 clicn=[459.0, 591.0, 549.0, 681.0] clic x:777 clic y:546 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0]] Dรฉjร  fait:34 clic x:866 clic y:642 clicn=[819.0, 591.0, 909.0, 681.0] clic x:963 clic y:558 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1055 clic y:649 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:778 clic y:383 clicn=[729.0, 321.0, 819.0, 411.0] Combi:[[729.0, 321.0, 819.0, 411.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:35 clic x:688 clic y:472 clicn=[639.0, 411.0, 729.0, 501.0] clic x:596 clic y:572 clicn=[549.0, 501.0, 639.0, 591.0] clic x:529 clic y:642 clicn=[459.0, 591.0, 549.0, 681.0] clic x:789 clic y:564 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0]] Dรฉjร  fait:36 clic x:876 clic y:664 clicn=[819.0, 591.0, 909.0, 681.0] clic x:964 clic y:560 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1040 clic y:632 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:779 clic y:381 clicn=[729.0, 321.0, 819.0, 411.0] Combi:[[729.0, 321.0, 819.0, 411.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:37 clic x:674 clic y:463 clicn=[639.0, 411.0, 729.0, 501.0] clic x:594 clic y:559 clicn=[549.0, 501.0, 639.0, 591.0] clic x:520 clic y:662 clicn=[459.0, 591.0, 549.0, 681.0] clic x:799 clic y:554 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[459.0, 591.0, 549.0, 681.0], [549.0, 501.0, 639.0, 591.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0]] Dรฉjร  fait:38 clic x:880 clic y:665 clicn=[819.0, 591.0, 909.0, 681.0] clic x:963 clic y:560 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1052 clic y:640 clicn=[999.0, 591.0, 1089.0, 681.0] THE END Bonnes rรฉponses:12 Erreurs couleur:0 Erreurs rรฉpรฉtition:38 Erreurs mรชme cercle:0 Erreurs ร  cotรฉ:1 Erreurs totales:39 Nombre de rรฉponses:51 Taux de rรฉussite= 23.53 RTmoy sec= 2.778 RTmax sec= 8.304 RTmin sec= 1.409 TACHE SPATIALE DIFFICILE FORT GAIN Red 1:[729.0, 321.0, 819.0, 411.0] Blue 1:[549.0, 501.0, 639.0, 591.0] Red 2:[639.0, 231.0, 729.0, 321.0] Blue 2:[459.0, 591.0, 549.0, 681.0] Blue 3:[459.0, 411.0, 549.0, 501.0] clic x:593 clic y:363 clicn=[549.0, 321.0, 639.0, 411.0] clic x:704 clic y:459 clicn=[639.0, 411.0, 729.0, 501.0] clic x:864 clic y:631 clicn=[819.0, 591.0, 909.0, 681.0] clic x:879 clic y:455 clicn=[819.0, 411.0, 909.0, 501.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [819.0, 411.0, 909.0, 501.0], [819.0, 591.0, 909.0, 681.0]] NR=1 RT sec=2.6187166205402264 clic x:957 clic y:550 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1045 clic y:626 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:870 clic y:625 clicn=[819.0, 591.0, 909.0, 681.0] clic x:782 clic y:566 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=2 RT sec=1.873753949740376 clic x:692 clic y:465 clicn=[639.0, 411.0, 729.0, 501.0] clic x:596 clic y:369 clicn=[549.0, 321.0, 639.0, 411.0] clic x:877 clic y:456 clicn=[819.0, 411.0, 909.0, 501.0] clic x:683 clic y:648 clicn=[639.0, 591.0, 729.0, 681.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [639.0, 591.0, 729.0, 681.0], [819.0, 411.0, 909.0, 501.0]] NR=3 RT sec=1.8107066168561232 clic x:769 clic y:562 clicn=[729.0, 501.0, 819.0, 591.0] clic x:870 clic y:641 clicn=[819.0, 591.0, 909.0, 681.0] clic x:960 clic y:550 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1052 clic y:648 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:1 clic x:874 clic y:488 clicn=[819.0, 411.0, 909.0, 501.0] clic x:601 clic y:382 clicn=[549.0, 321.0, 639.0, 411.0] clic x:711 clic y:447 clicn=[639.0, 411.0, 729.0, 501.0] clic x:789 clic y:550 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0]] NR=4 RT sec=1.3175353292017462 clic x:885 clic y:652 clicn=[819.0, 591.0, 909.0, 681.0] clic x:958 clic y:551 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1067 clic y:643 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:854 clic y:474 clicn=[819.0, 411.0, 909.0, 501.0] Combi:[[819.0, 411.0, 909.0, 501.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=5 RT sec=1.2099756225841247 clic x:596 clic y:375 clicn=[549.0, 321.0, 639.0, 411.0] clic x:704 clic y:467 clicn=[639.0, 411.0, 729.0, 501.0] clic x:800 clic y:554 clicn=[729.0, 501.0, 819.0, 591.0] clic x:869 clic y:640 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0]] NR=6 RT sec=6.766697627325129 clic x:873 clic y:459 clicn=[819.0, 411.0, 909.0, 501.0] clic x:953 clic y:566 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1050 clic y:651 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:602 clic y:386 clicn=[549.0, 321.0, 639.0, 411.0] Combi:[[549.0, 321.0, 639.0, 411.0], [819.0, 411.0, 909.0, 501.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=7 RT sec=2.025702543013267 clic x:697 clic y:450 clicn=[639.0, 411.0, 729.0, 501.0] clic x:788 clic y:541 clicn=[729.0, 501.0, 819.0, 591.0] clic x:866 clic y:645 clicn=[819.0, 591.0, 909.0, 681.0] clic x:869 clic y:455 clicn=[819.0, 411.0, 909.0, 501.0] Combi:[[639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0], [819.0, 591.0, 909.0, 681.0]] NR=8 RT sec=1.5166613196624894 clic x:966 clic y:552 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1061 clic y:628 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:854 clic y:647 clicn=[819.0, 591.0, 909.0, 681.0] clic x:665 clic y:661 clicn=[639.0, 591.0, 729.0, 681.0] Combi:[[639.0, 591.0, 729.0, 681.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=9 RT sec=1.504873431898659 clic x:774 clic y:558 clicn=[729.0, 501.0, 819.0, 591.0] clic x:673 clic y:460 clicn=[639.0, 411.0, 729.0, 501.0] clic x:878 clic y:482 clicn=[819.0, 411.0, 909.0, 501.0] clic x:577 clic y:367 clicn=[549.0, 321.0, 639.0, 411.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0]] Dรฉjร  fait:2 clic x:428 clic y:548 clicn=[369.0, 501.0, 459.0, 591.0] clic x:340 clic y:641 clicn=[279.0, 591.0, 369.0, 681.0] clic x:603 clic y:374 clicn=[549.0, 321.0, 639.0, 411.0] clic x:698 clic y:445 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[279.0, 591.0, 369.0, 681.0], [369.0, 501.0, 459.0, 591.0], [549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0]] NR=10 RT sec=8.576587014082406 clic x:784 clic y:555 clicn=[729.0, 501.0, 819.0, 591.0] clic x:879 clic y:635 clicn=[819.0, 591.0, 909.0, 681.0] clic x:888 clic y:444 clicn=[819.0, 411.0, 909.0, 501.0] clic x:974 clic y:548 clicn=[909.0, 501.0, 999.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0]] NR=11 RT sec=1.765514448808517 clic x:1044 clic y:657 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:960 clic y:562 clicn=[909.0, 501.0, 999.0, 591.0] clic x:873 clic y:655 clicn=[819.0, 591.0, 909.0, 681.0] clic x:783 clic y:544 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:3 clic x:696 clic y:450 clicn=[639.0, 411.0, 729.0, 501.0] clic x:606 clic y:368 clicn=[549.0, 321.0, 639.0, 411.0] clic x:877 clic y:462 clicn=[819.0, 411.0, 909.0, 501.0] clic x:785 clic y:558 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0]] Dรฉjร  fait:4 clic x:695 clic y:642 clicn=[639.0, 591.0, 729.0, 681.0] clic x:866 clic y:646 clicn=[819.0, 591.0, 909.0, 681.0] clic x:968 clic y:575 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1047 clic y:635 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[639.0, 591.0, 729.0, 681.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:5 clic x:864 clic y:479 clicn=[819.0, 411.0, 909.0, 501.0] clic x:779 clic y:567 clicn=[729.0, 501.0, 819.0, 591.0] clic x:694 clic y:452 clicn=[639.0, 411.0, 729.0, 501.0] clic x:595 clic y:366 clicn=[549.0, 321.0, 639.0, 411.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0]] Dรฉjร  fait:6 clic x:423 clic y:547 clicn=[369.0, 501.0, 459.0, 591.0] clic x:322 clic y:648 clicn=[279.0, 591.0, 369.0, 681.0] clic x:869 clic y:483 clicn=[819.0, 411.0, 909.0, 501.0] clic x:966 clic y:548 clicn=[909.0, 501.0, 999.0, 591.0] Combi:[[279.0, 591.0, 369.0, 681.0], [369.0, 501.0, 459.0, 591.0], [819.0, 411.0, 909.0, 501.0], [909.0, 501.0, 999.0, 591.0]] NR=12 RT sec=14.272553622520036 clic x:1063 clic y:641 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:870 clic y:633 clicn=[819.0, 591.0, 909.0, 681.0] clic x:767 clic y:565 clicn=[729.0, 501.0, 819.0, 591.0] clic x:673 clic y:458 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [999.0, 591.0, 1089.0, 681.0]] NR=13 RT sec=1.5379117637646686 clic x:597 clic y:368 clicn=[549.0, 321.0, 639.0, 411.0] clic x:692 clic y:660 clicn=[639.0, 591.0, 729.0, 681.0] clic x:887 clic y:447 clicn=[819.0, 411.0, 909.0, 501.0] clic x:787 clic y:571 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 591.0, 729.0, 681.0], [729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0]] NR=14 RT sec=1.483656628794506 clic x:873 clic y:642 clicn=[819.0, 591.0, 909.0, 681.0] clic x:963 clic y:559 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1042 clic y:648 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:674 clic y:456 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[639.0, 411.0, 729.0, 501.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=15 RT sec=1.680634928709651 clic x:591 clic y:374 clicn=[549.0, 321.0, 639.0, 411.0] clic x:424 clic y:542 clicn=[369.0, 501.0, 459.0, 591.0] clic x:334 clic y:642 clicn=[279.0, 591.0, 369.0, 681.0] clic x:691 clic y:466 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[279.0, 591.0, 369.0, 681.0], [369.0, 501.0, 459.0, 591.0], [549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0]] Dรฉjร  fait:7 clic x:795 clic y:543 clicn=[729.0, 501.0, 819.0, 591.0] clic x:861 clic y:656 clicn=[819.0, 591.0, 909.0, 681.0] clic x:1046 clic y:647 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:947 clic y:547 clicn=[909.0, 501.0, 999.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:8 clic x:876 clic y:468 clicn=[819.0, 411.0, 909.0, 501.0] clic x:679 clic y:468 clicn=[639.0, 411.0, 729.0, 501.0] clic x:600 clic y:383 clicn=[549.0, 321.0, 639.0, 411.0] clic x:786 clic y:556 clicn=[729.0, 501.0, 819.0, 591.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0]] Dรฉjร  fait:9 clic x:867 clic y:631 clicn=[819.0, 591.0, 909.0, 681.0] clic x:687 clic y:642 clicn=[639.0, 591.0, 729.0, 681.0] clic x:409 clic y:548 clicn=[369.0, 501.0, 459.0, 591.0] clic x:339 clic y:653 clicn=[279.0, 591.0, 369.0, 681.0] Combi:[[279.0, 591.0, 369.0, 681.0], [369.0, 501.0, 459.0, 591.0], [639.0, 591.0, 729.0, 681.0], [819.0, 591.0, 909.0, 681.0]] NR=16 RT sec=1.4388972809047118 clic x:865 clic y:466 clicn=[819.0, 411.0, 909.0, 501.0] clic x:953 clic y:555 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1055 clic y:642 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:830 clic y:660 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[819.0, 411.0, 909.0, 501.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:10 clic x:866 clic y:630 clicn=[819.0, 591.0, 909.0, 681.0] clic x:768 clic y:538 clicn=[729.0, 501.0, 819.0, 591.0] clic x:683 clic y:450 clicn=[639.0, 411.0, 729.0, 501.0] clic x:579 clic y:370 clicn=[549.0, 321.0, 639.0, 411.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0]] Dรฉjร  fait:11 clic x:409 clic y:555 clicn=[369.0, 501.0, 459.0, 591.0] clic x:344 clic y:649 clicn=[279.0, 591.0, 369.0, 681.0] clic x:716 clic y:647 clicn=[639.0, 591.0, 729.0, 681.0] clic x:862 clic y:652 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[279.0, 591.0, 369.0, 681.0], [369.0, 501.0, 459.0, 591.0], [639.0, 591.0, 729.0, 681.0], [819.0, 591.0, 909.0, 681.0]] Dรฉjร  fait:12 clic x:773 clic y:549 clicn=[729.0, 501.0, 819.0, 591.0] clic x:693 clic y:464 clicn=[639.0, 411.0, 729.0, 501.0] clic x:599 clic y:379 clicn=[549.0, 321.0, 639.0, 411.0] clic x:876 clic y:457 clicn=[819.0, 411.0, 909.0, 501.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0]] Dรฉjร  fait:13 clic x:955 clic y:561 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1064 clic y:649 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:863 clic y:459 clicn=[819.0, 411.0, 909.0, 501.0] clic x:885 clic y:657 clicn=[819.0, 591.0, 909.0, 681.0] Combi:[[819.0, 411.0, 909.0, 501.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:14 clic x:784 clic y:550 clicn=[729.0, 501.0, 819.0, 591.0] clic x:688 clic y:471 clicn=[639.0, 411.0, 729.0, 501.0] clic x:609 clic y:377 clicn=[549.0, 321.0, 639.0, 411.0] clic x:696 clic y:652 clicn=[639.0, 591.0, 729.0, 681.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [639.0, 591.0, 729.0, 681.0], [729.0, 501.0, 819.0, 591.0]] NR=17 RT sec=2.427868777133199 clic x:417 clic y:553 clicn=[369.0, 501.0, 459.0, 591.0] clic x:330 clic y:650 clicn=[279.0, 591.0, 369.0, 681.0] clic x:590 clic y:361 clicn=[549.0, 321.0, 639.0, 411.0] clic x:674 clic y:459 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[279.0, 591.0, 369.0, 681.0], [369.0, 501.0, 459.0, 591.0], [549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0]] Dรฉjร  fait:15 clic x:796 clic y:562 clicn=[729.0, 501.0, 819.0, 591.0] clic x:886 clic y:654 clicn=[819.0, 591.0, 909.0, 681.0] clic x:883 clic y:457 clicn=[819.0, 411.0, 909.0, 501.0] clic x:974 clic y:556 clicn=[909.0, 501.0, 999.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0]] Dรฉjร  fait:16 clic x:1064 clic y:650 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:697 clic y:639 clicn=[639.0, 591.0, 729.0, 681.0] clic x:601 clic y:380 clicn=[549.0, 321.0, 639.0, 411.0] clic x:688 clic y:466 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [639.0, 591.0, 729.0, 681.0], [999.0, 591.0, 1089.0, 681.0]] NR=18 RT sec=10.97462484133348 clic x:805 clic y:547 clicn=[729.0, 501.0, 819.0, 591.0] clic x:1293 clic y:894 A cรดtรฉ:1 clic x:880 clic y:635 clicn=[819.0, 591.0, 909.0, 681.0] clic x:1363 clic y:901 A cรดtรฉ:2 clic x:1044 clic y:646 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:976 clic y:545 clicn=[909.0, 501.0, 999.0, 591.0] clic x:890 clic y:462 clicn=[819.0, 411.0, 909.0, 501.0] clic x:691 clic y:654 clicn=[639.0, 591.0, 729.0, 681.0] Combi:[[639.0, 591.0, 729.0, 681.0], [819.0, 411.0, 909.0, 501.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=19 RT sec=2.859246064208264 clic x:429 clic y:550 clicn=[369.0, 501.0, 459.0, 591.0] clic x:339 clic y:659 clicn=[279.0, 591.0, 369.0, 681.0] clic x:615 clic y:377 clicn=[549.0, 321.0, 639.0, 411.0] clic x:685 clic y:474 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[279.0, 591.0, 369.0, 681.0], [369.0, 501.0, 459.0, 591.0], [549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0]] Dรฉjร  fait:17 clic x:799 clic y:544 clicn=[729.0, 501.0, 819.0, 591.0] clic x:881 clic y:654 clicn=[819.0, 591.0, 909.0, 681.0] clic x:877 clic y:463 clicn=[819.0, 411.0, 909.0, 501.0] clic x:972 clic y:566 clicn=[909.0, 501.0, 999.0, 591.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 411.0, 909.0, 501.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0]] Dรฉjร  fait:18 clic x:1065 clic y:656 clicn=[999.0, 591.0, 1089.0, 681.0] clic x:694 clic y:656 clicn=[639.0, 591.0, 729.0, 681.0] clic x:684 clic y:470 clicn=[639.0, 411.0, 729.0, 501.0] clic x:594 clic y:384 clicn=[549.0, 321.0, 639.0, 411.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [639.0, 591.0, 729.0, 681.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:19 clic x:430 clic y:543 clicn=[369.0, 501.0, 459.0, 591.0] clic x:334 clic y:641 clicn=[279.0, 591.0, 369.0, 681.0] clic x:616 clic y:379 clicn=[549.0, 321.0, 639.0, 411.0] clic x:706 clic y:458 clicn=[639.0, 411.0, 729.0, 501.0] Combi:[[279.0, 591.0, 369.0, 681.0], [369.0, 501.0, 459.0, 591.0], [549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0]] Dรฉjร  fait:20 clic x:791 clic y:554 clicn=[729.0, 501.0, 819.0, 591.0] clic x:879 clic y:642 clicn=[819.0, 591.0, 909.0, 681.0] clic x:972 clic y:560 clicn=[909.0, 501.0, 999.0, 591.0] Plus que 30 sec clic x:1072 clic y:660 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] Dรฉjร  fait:21 clic x:706 clic y:630 clicn=[639.0, 591.0, 729.0, 681.0] clic x:680 clic y:473 clicn=[639.0, 411.0, 729.0, 501.0] clic x:595 clic y:380 clicn=[549.0, 321.0, 639.0, 411.0] clic x:411 clic y:555 clicn=[369.0, 501.0, 459.0, 591.0] Combi:[[369.0, 501.0, 459.0, 591.0], [549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [639.0, 591.0, 729.0, 681.0]] NR=20 RT sec=1.6634460197365115 clic x:322 clic y:653 clicn=[279.0, 591.0, 369.0, 681.0] clic x:880 clic y:487 clicn=[819.0, 411.0, 909.0, 501.0] clic x:956 clic y:536 clicn=[909.0, 501.0, 999.0, 591.0] clic x:1076 clic y:620 clicn=[999.0, 591.0, 1089.0, 681.0] Combi:[[279.0, 591.0, 369.0, 681.0], [819.0, 411.0, 909.0, 501.0], [909.0, 501.0, 999.0, 591.0], [999.0, 591.0, 1089.0, 681.0]] NR=21 RT sec=11.914911659559493 clic x:866 clic y:649 clicn=[819.0, 591.0, 909.0, 681.0] clic x:791 clic y:556 clicn=[729.0, 501.0, 819.0, 591.0] clic x:687 clic y:485 clicn=[639.0, 411.0, 729.0, 501.0] clic x:608 clic y:375 clicn=[549.0, 321.0, 639.0, 411.0] Combi:[[549.0, 321.0, 639.0, 411.0], [639.0, 411.0, 729.0, 501.0], [729.0, 501.0, 819.0, 591.0], [819.0, 591.0, 909.0, 681.0]] Dรฉjร  fait:22 clic x:703 clic y:631 clicn=[639.0, 591.0, 729.0, 681.0] clic x:432 clic y:540 clicn=[369.0, 501.0, 459.0, 591.0] clic x:335 clic y:655 clicn=[279.0, 591.0, 369.0, 681.0] clic x:600 clic y:388 clicn=[549.0, 321.0, 639.0, 411.0] Combi:[[279.0, 591.0, 369.0, 681.0], [369.0, 501.0, 459.0, 591.0], [549.0, 321.0, 639.0, 411.0], [639.0, 591.0, 729.0, 681.0]] NR=22 RT sec=1.7383419582833994 THE END Bonnes rรฉponses:22 Erreurs couleur:0 Erreurs rรฉpรฉtition:22 Erreurs mรชme cercle:0 Erreurs ร  cotรฉ:2 Erreurs totales:24 Nombre de rรฉponses:46 Taux de rรฉussite= 47.83 RTmoy sec= 3.772 RTmax sec= 14.273 RTmin sec= 1.210 TACHE SPATIALE FACILE FORT GAIN Red 1:[819.0, 411.0, 909.0, 501.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:415 clic y:552 Bien! NR=1 RT=5.023952800859206 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:416 clic y:552 Gris touchรฉ! ratรฉ!NEG=1 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:419 clic y:553 Gris touchรฉ! ratรฉ!NEG=2 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:314 clic y:641 Bien! NR=2 RT=0.900465312438655 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:333 clic y:641 Gris touchรฉ! ratรฉ!NEG=3 Red 1:[819.0, 411.0, 909.0, 501.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:318 clic y:642 Gris touchรฉ! ratรฉ!NEG=4 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[639.0, 591.0, 729.0, 681.0] clic x:689 clic y:648 Bien! NR=3 RT=1.1936150206236107 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:316 clic y:651 Bien! NR=4 RT=1.317344560127367 Red 1:[639.0, 411.0, 729.0, 501.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:326 clic y:635 Gris touchรฉ! ratรฉ!NEG=5 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:874 clic y:489 Bien! NR=5 RT=1.0260836709057912 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[729.0, 321.0, 819.0, 411.0] clic x:866 clic y:460 Gris touchรฉ! ratรฉ!NEG=6 Red 1:[819.0, 411.0, 909.0, 501.0] Blue:[549.0, 501.0, 639.0, 591.0] clic x:614 clic y:548 Bien! NR=6 RT=0.9073473580740483 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:591 clic y:561 Rouge touchรฉ! ratรฉ!NER=1 Red 1:[729.0, 501.0, 819.0, 591.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:518 clic y:444 Bien! NR=7 RT=1.396368905543568 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[819.0, 591.0, 909.0, 681.0] clic x:517 clic y:466 Gris touchรฉ! ratรฉ!NEG=7 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1056 clic y:643 Bien! NR=8 RT=0.9359024115672128 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:1043 clic y:661 Gris touchรฉ! ratรฉ!NEG=8 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:518 clic y:627 Bien! NR=9 RT=1.2023686544666816 Red 1:[639.0, 411.0, 729.0, 501.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:504 clic y:637 Gris touchรฉ! ratรฉ!NEG=9 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1060 clic y:652 Bien! NR=10 RT=2.0724622995180653 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:874 clic y:459 Bien! NR=11 RT=7.521821110300607 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:333 clic y:648 Bien! NR=12 RT=1.2796395654238495 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:878 clic y:469 Bien! NR=13 RT=7.649287672379387 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:695 clic y:297 Bien! NR=14 RT=1.2052281393000612 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:519 clic y:456 Bien! NR=15 RT=1.5265472602688988 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[549.0, 501.0, 639.0, 591.0] clic x:600 clic y:573 Bien! NR=16 RT=1.1507079789062118 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:960 clic y:568 Bien! NR=17 RT=1.415876581844941 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:956 clic y:549 Bien! NR=18 RT=2.1427313700664854 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:951 clic y:546 Bien! NR=19 RT=1.3874372205643795 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:866 clic y:454 Bien! NR=20 RT=1.4073350503917936 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[819.0, 591.0, 909.0, 681.0] clic x:867 clic y:642 Bien! NR=21 RT=1.3059086720750201 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[729.0, 321.0, 819.0, 411.0] clic x:771 clic y:373 Bien! NR=22 RT=1.825728553248382 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:514 clic y:628 Bien! NR=23 RT=1.893712087210588 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:301 clic y:641 Bien! NR=24 RT=1.6462997773951429 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:704 clic y:466 Bien! NR=25 RT=3.144887675989594 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:691 clic y:463 Bien! NR=26 RT=4.911754739073103 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[549.0, 501.0, 639.0, 591.0] clic x:689 clic y:451 Gris touchรฉ! ratรฉ!NEG=10 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:702 clic y:467 Gris touchรฉ! ratรฉ!NEG=11 Red 1:[639.0, 411.0, 729.0, 501.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:788 clic y:567 Bien! NR=27 RT=0.695816044458752 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:788 clic y:567 Gris touchรฉ! ratรฉ!NEG=12 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:967 clic y:549 Bien! NR=28 RT=1.1621668412990402 Red 1:[729.0, 501.0, 819.0, 591.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:962 clic y:557 Gris touchรฉ! ratรฉ!NEG=13 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:506 clic y:454 Bien! NR=29 RT=1.2988432419747369 Red 1:[729.0, 501.0, 819.0, 591.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:519 clic y:465 Gris touchรฉ! ratรฉ!NEG=14 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:697 clic y:459 Bien! NR=30 RT=1.0201144450343236 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:697 clic y:459 Gris touchรฉ! ratรฉ!NEG=15 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:694 clic y:467 Bien! NR=31 RT=9.899046236680078 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:504 clic y:650 Bien! NR=32 RT=10.771699879630887 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[819.0, 591.0, 909.0, 681.0] clic x:863 clic y:644 Bien! NR=33 RT=10.436973179919278 Red 1:[729.0, 501.0, 819.0, 591.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:519 clic y:455 Bien! NR=34 RT=3.521585213058188 Red 1:[819.0, 411.0, 909.0, 501.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1059 clic y:644 Bien! NR=35 RT=5.764916705709311 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:418 clic y:555 Bien! NR=36 RT=2.3968932128054803 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:863 clic y:459 Bien! NR=37 RT=7.888210963519214 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:688 clic y:477 Bien! NR=38 RT=7.892916190427741 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1051 clic y:649 Bien! NR=39 RT=1.3945038814326836 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:523 clic y:676 Bien! NR=40 RT=0.8892928087855125 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:523 clic y:676 Gris touchรฉ! ratรฉ!NEG=16 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[729.0, 321.0, 819.0, 411.0] clic x:767 clic y:372 Bien! NR=41 RT=7.383035172894324 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:433 clic y:553 Bien! NR=42 RT=1.2723415201301123 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] Plus que 30 sec clic x:601 clic y:376 Bien! NR=43 RT=26.208897059366564 Red 1:[729.0, 501.0, 819.0, 591.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:860 clic y:478 Bien! NR=44 RT=1.75873865949643 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:392 clic y:551 Bien! NR=45 RT=1.7956555522825965 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:952 clic y:544 Bien! NR=46 RT=1.891153320079411 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:505 clic y:652 Bien! NR=47 RT=1.9156685820155417 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:610 clic y:378 Bien! NR=48 RT=1.8060522617006427 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[729.0, 321.0, 819.0, 411.0] clic x:797 clic y:400 Bien! NR=49 RT=1.9126277639977616 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[819.0, 591.0, 909.0, 681.0] clic x:885 clic y:648 Bien! NR=50 RT=2.8816243022570234 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:869 clic y:661 Gris touchรฉ! ratรฉ!NEG=17 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[279.0, 591.0, 369.0, 681.0] THE END Bonnes rรฉponses:50 Erreurs rouge:1 Erreurs gris:17 Erreurs ร  cรดtรฉ:0 Erreurs totales:18 Nombre de rรฉponses:68 Taux de rรฉussite= 73.53 RTmoy sec= 3.425 RTmax sec= 26.209 RTmin sec= 0.696 TACHE SPATIALE FACILE FAIBLE GAIN Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:604 clic y:370 Bien! NR=1 RT=1.171132577532262 Red 1:[729.0, 501.0, 819.0, 591.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1045 clic y:644 Bien! NR=2 RT=1.1453537268891978 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:435 clic y:543 Bien! NR=3 RT=0.8888115784109232 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[639.0, 591.0, 729.0, 681.0] clic x:686 clic y:640 Bien! NR=4 RT=1.1439194716558632 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:426 clic y:552 Bien! NR=5 RT=0.9142047883449322 Red 1:[819.0, 411.0, 909.0, 501.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:959 clic y:556 Bien! NR=6 RT=1.0457870393540816 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:528 clic y:645 Bien! NR=7 RT=1.1808646721110563 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:412 clic y:546 Bien! NR=8 RT=1.142514754859576 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:707 clic y:264 Bien! NR=9 RT=2.6937955332959973 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:598 clic y:358 Bien! NR=10 RT=1.428266725524736 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:767 clic y:558 Bien! NR=11 RT=1.0549275446746833 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:964 clic y:553 Bien! NR=12 RT=1.1457278804282396 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:503 clic y:641 Bien! NR=13 RT=3.323126298973193 Red 1:[639.0, 411.0, 729.0, 501.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:940 clic y:571 Bien! NR=14 RT=2.0691445586508053 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:517 clic y:466 Bien! NR=15 RT=1.1488478778685476 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:594 clic y:373 Bien! NR=16 RT=1.1400958850495044 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[819.0, 591.0, 909.0, 681.0] clic x:877 clic y:635 Bien! NR=17 RT=1.1444048045909767 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:696 clic y:295 Bien! NR=18 RT=1.0605012836913374 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:505 clic y:634 Bien! NR=19 RT=1.1609053038723687 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:602 clic y:356 Bien! NR=20 RT=1.150119671696757 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:334 clic y:651 Bien! NR=21 RT=1.1404007053122314 Red 1:[819.0, 411.0, 909.0, 501.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:509 clic y:636 Bien! NR=22 RT=1.20185091130179 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1062 clic y:635 Bien! NR=23 RT=1.2740547494934162 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:592 clic y:378 Bien! NR=24 RT=1.2651546542322194 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1034 clic y:641 Bien! NR=25 RT=1.0530120590669867 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:865 clic y:493 Bien! NR=26 RT=0.9404496898876005 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[639.0, 591.0, 729.0, 681.0] clic x:679 clic y:636 Bien! NR=27 RT=0.9436681487850365 Red 1:[819.0, 411.0, 909.0, 501.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:690 clic y:454 Bien! NR=28 RT=6.912526020491441 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1043 clic y:651 Bien! NR=29 RT=1.515283269511201 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:318 clic y:645 Bien! NR=30 RT=1.763159989201995 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:607 clic y:399 Bien! NR=31 RT=1.0019282035459582 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:406 clic y:549 Bien! NR=32 RT=1.2900994542774242 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:680 clic y:453 Bien! NR=33 RT=0.909637817733028 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:509 clic y:637 Bien! NR=34 RT=1.4212439620562236 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:790 clic y:551 Bien! NR=35 RT=1.3947520863571299 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[639.0, 591.0, 729.0, 681.0] clic x:685 clic y:644 Bien! NR=36 RT=7.279805719133947 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:779 clic y:558 Bien! NR=37 RT=1.3244362466164148 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:877 clic y:483 Bien! NR=38 RT=0.8952706500344902 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:431 clic y:563 Bien! NR=39 RT=1.1536811046717048 Red 1:[819.0, 411.0, 909.0, 501.0] Blue:[729.0, 321.0, 819.0, 411.0] clic x:772 clic y:371 Bien! NR=40 RT=1.0098806072774096 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:690 clic y:291 Bien! NR=41 RT=5.396231059502725 Red 1:[729.0, 501.0, 819.0, 591.0] Blue:[729.0, 321.0, 819.0, 411.0] clic x:780 clic y:375 Bien! NR=42 RT=1.3133142044600845 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:1222 clic y:524 A cรดtรฉ! ratรฉ!AC=1 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[729.0, 321.0, 819.0, 411.0] clic x:767 clic y:381 Bien! NR=43 RT=5.203623217540098 Red 1:[729.0, 501.0, 819.0, 591.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:689 clic y:459 Bien! NR=44 RT=1.141726242686218 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:689 clic y:459 Gris touchรฉ! ratรฉ!NEG=1 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:684 clic y:463 Gris touchรฉ! ratรฉ!NEG=2 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:684 clic y:463 Gris touchรฉ! ratรฉ!NEG=3 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:695 clic y:289 Bien! NR=45 RT=1.0550338009979896 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:695 clic y:289 Gris touchรฉ! ratรฉ!NEG=4 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:686 clic y:279 Gris touchรฉ! ratรฉ!NEG=5 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:695 clic y:454 Gris touchรฉ! ratรฉ!NEG=6 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[549.0, 501.0, 639.0, 591.0] clic x:695 clic y:454 Gris touchรฉ! ratรฉ!NEG=7 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:423 clic y:542 Gris touchรฉ! ratรฉ!NEG=8 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:420 clic y:558 Bien! NR=46 RT=1.529061719744277 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:420 clic y:558 Rouge touchรฉ! ratรฉ!NER=1 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[549.0, 501.0, 639.0, 591.0] clic x:611 clic y:547 Bien! NR=47 RT=1.0772778853104228 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:611 clic y:547 Gris touchรฉ! ratรฉ!NEG=9 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:332 clic y:646 Bien! NR=48 RT=1.141459576238276 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:332 clic y:646 Gris touchรฉ! ratรฉ!NEG=10 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:676 clic y:286 Bien! NR=49 RT=2.0409250946256634 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:680 clic y:284 Gris touchรฉ! ratรฉ!NEG=11 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:404 clic y:547 Bien! NR=50 RT=1.1500179281904366 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:861 clic y:464 Bien! NR=51 RT=1.096433972156774 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:416 clic y:546 Bien! NR=52 RT=13.712631210148857 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:772 clic y:579 Bien! NR=53 RT=1.0157304486315297 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:513 clic y:448 Bien! NR=54 RT=1.270278752591821 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:601 clic y:366 Bien! NR=55 RT=1.165787351148765 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:776 clic y:564 Bien! NR=56 RT=0.8992657236792638 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:960 clic y:569 Bien! NR=57 RT=1.054808980669577 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:419 clic y:545 Bien! NR=58 RT=1.1426784470329494 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:512 clic y:483 Bien! NR=59 RT=1.0275511568811453 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:860 clic y:467 Bien! NR=60 RT=1.0320758711172857 Red 1:[729.0, 501.0, 819.0, 591.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:414 clic y:552 Bien! NR=61 RT=0.9044825399116689 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[639.0, 591.0, 729.0, 681.0] clic x:683 clic y:645 Bien! NR=62 RT=1.0320676659957826 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:335 clic y:640 Bien! NR=63 RT=1.2744929029800005 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:503 clic y:456 Bien! NR=64 RT=1.3966884950248186 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:756 clic y:565 Bien! NR=65 RT=0.9324542092683714 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:686 clic y:287 Bien! NR=66 RT=1.5206793676475172 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:674 clic y:463 Bien! NR=67 RT=1.2721347510687337 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:774 clic y:561 Bien! NR=68 RT=0.9394613830061189 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:960 clic y:567 Bien! NR=69 RT=1.147277417618625 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[819.0, 591.0, 909.0, 681.0] clic x:879 clic y:649 Bien! NR=70 RT=1.2517622549642056 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[639.0, 591.0, 729.0, 681.0] clic x:682 clic y:649 Bien! NR=71 RT=1.023378852612268 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[279.0, 591.0, 369.0, 681.0] clic x:336 clic y:661 Bien! NR=72 RT=1.1696507325943912 Red 1:[639.0, 411.0, 729.0, 501.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:316 clic y:623 Gris touchรฉ! ratรฉ!NEG=12 Red 1:[459.0, 411.0, 549.0, 501.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:408 clic y:550 Bien! NR=73 RT=1.6825286707455689 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:949 clic y:544 Bien! NR=74 RT=1.2015276295157946 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1029 clic y:649 Bien! NR=75 RT=1.1781180076980036 Red 1:[819.0, 411.0, 909.0, 501.0] Blue:[639.0, 591.0, 729.0, 681.0] clic x:671 clic y:647 Bien! NR=76 RT=2.6543773092289484 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:398 clic y:559 Bien! NR=77 RT=1.6425086010185623 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:686 clic y:457 Bien! NR=78 RT=1.1407658332177562 Red 1:[639.0, 411.0, 729.0, 501.0] Blue:[639.0, 591.0, 729.0, 681.0] clic x:671 clic y:654 Bien! NR=79 RT=1.2662287046327947 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:591 clic y:365 Bien! NR=80 RT=1.5275482850884146 Red 1:[909.0, 501.0, 999.0, 591.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:1043 clic y:642 Bien! NR=81 RT=1.5547285704792557 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[639.0, 591.0, 729.0, 681.0] clic x:695 clic y:653 Bien! NR=82 RT=2.5309189489896653 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[819.0, 411.0, 909.0, 501.0] Plus que 30 sec clic x:862 clic y:472 Bien! NR=83 RT=1.389110244832409 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[819.0, 591.0, 909.0, 681.0] clic x:858 clic y:646 Bien! NR=84 RT=1.08073060042625 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:867 clic y:477 Bien! NR=85 RT=1.0499437538921939 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[909.0, 501.0, 999.0, 591.0] clic x:947 clic y:576 Bien! NR=86 RT=1.0432775029519235 Red 1:[639.0, 591.0, 729.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:607 clic y:363 Bien! NR=87 RT=1.2641651165824896 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[819.0, 591.0, 909.0, 681.0] clic x:860 clic y:663 Bien! NR=88 RT=1.4325629271279468 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:777 clic y:556 Bien! NR=89 RT=1.395880700815951 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:503 clic y:471 Bien! NR=90 RT=1.2971570895122113 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:597 clic y:362 Bien! NR=91 RT=1.6711120647285043 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[459.0, 591.0, 549.0, 681.0] clic x:506 clic y:657 Bien! NR=92 RT=1.8853490171493377 Red 1:[549.0, 501.0, 639.0, 591.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:683 clic y:278 Bien! NR=93 RT=1.5125214256236177 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[729.0, 321.0, 819.0, 411.0] clic x:829 clic y:356 A cรดtรฉ! ratรฉ!AC=2 Red 1:[639.0, 231.0, 729.0, 321.0] Blue:[999.0, 591.0, 1089.0, 681.0] clic x:791 clic y:384 Gris touchรฉ! ratรฉ!NEG=13 Red 1:[279.0, 591.0, 369.0, 681.0] Blue:[639.0, 231.0, 729.0, 321.0] clic x:677 clic y:290 Bien! NR=94 RT=2.4256550353600232 Red 1:[729.0, 321.0, 819.0, 411.0] Blue:[819.0, 591.0, 909.0, 681.0] clic x:869 clic y:673 Bien! NR=95 RT=1.0793221913254456 Red 1:[549.0, 321.0, 639.0, 411.0] Blue:[639.0, 411.0, 729.0, 501.0] clic x:697 clic y:463 Bien! NR=96 RT=1.1872375899588405 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[729.0, 501.0, 819.0, 591.0] clic x:774 clic y:561 Bien! NR=97 RT=1.30518415984875 Red 1:[369.0, 501.0, 459.0, 591.0] Blue:[819.0, 411.0, 909.0, 501.0] clic x:866 clic y:472 Bien! NR=98 RT=0.9020751572718382 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[369.0, 501.0, 459.0, 591.0] clic x:433 clic y:570 Bien! NR=99 RT=1.6516815165689422 Red 1:[999.0, 591.0, 1089.0, 681.0] Blue:[459.0, 411.0, 549.0, 501.0] clic x:512 clic y:456 Bien! NR=100 RT=1.264391167678923 Red 1:[819.0, 591.0, 909.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] clic x:612 clic y:402 Bien! NR=101 RT=0.9453965576233259 Red 1:[459.0, 591.0, 549.0, 681.0] Blue:[549.0, 321.0, 639.0, 411.0] THE END Bonnes rรฉponses:101 Erreurs rouge:1 Erreurs gris:13 Erreurs ร  cรดtรฉ:2 Erreurs totales:16 Nombre de rรฉponses:117 Taux de rรฉussite= 86.32 RTmoy= 1.617 RTmax= 13.713 RTmin= 0.889 ordre tรขches : ['Verbale Facile Facile', 'Verbale Facile Forte', 'Verbale Difficile Faible', 'Verbale Difficile Fort', 'Spatiale Difficile Faible', 'Spatiale Difficile Fort', 'Spatiale Facile Fort', 'Spatiale Facile Faible'] >>>
1c725c18b3b21a31f7fe5dc8cf9f9f4b63fdd24b
fd6747673bad3628eba33d3892b63180db5fb044
/tensorflow/compiler/xla/python/xla_extension/__init__.pyi
61d1e478c9013a9376efd36b851a37e6b8793772
[ "Apache-2.0", "LicenseRef-scancode-generic-cla", "BSD-2-Clause" ]
permissive
gautam1858/tensorflow
2cbdc251a470eefd27ce31fd4e6fe31253e9d07a
bd56b0b3a00432896cffbb412bedbb13579ec598
refs/heads/master
2022-06-04T22:09:41.533559
2022-05-10T15:51:20
2022-05-10T15:51:20
59,177,861
2
0
Apache-2.0
2022-03-17T14:48:17
2016-05-19T05:56:42
C++
UTF-8
Python
false
false
16,725
pyi
# Copyright 2021 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by 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. # ============================================================================== import enum import inspect import types import typing from typing import Any, Callable, ClassVar, Dict, List, Optional, Sequence, Tuple, Type, TypeVar, Union, overload import numpy as np from . import ops from . import jax_jit from . import mlir from . import outfeed_receiver from . import pmap_lib from . import profiler from . import pytree from . import transfer_guard_lib _LiteralSlice = Any _Status = Any _Dtype = Any _XlaOpMetadata = Any _T = TypeVar("_T") class XlaRuntimeError(RuntimeError): pass class PrimitiveType(enum.IntEnum): PRIMITIVE_TYPE_INVALID: PrimitiveType PRED: PrimitiveType S8: PrimitiveType S16: PrimitiveType S32: PrimitiveType S64: PrimitiveType U8: PrimitiveType U16: PrimitiveType U32: PrimitiveType U64: PrimitiveType BF16: PrimitiveType F16: PrimitiveType F32: PrimitiveType F64: PrimitiveType C64: PrimitiveType C128: PrimitiveType TUPLE: PrimitiveType OPAQUE_TYPE: PrimitiveType TOKEN: PrimitiveType def bfloat16_dtype() -> Type[Any]: ... # === BEGIN xla_compiler.cc class Shape: def __init__(self, s: str): ... @staticmethod def tuple_shape(shapes: Sequence[Shape]) -> Shape: ... @staticmethod def array_shape( type: Union[np.dtype, PrimitiveType], dims_seq: Any = ..., layout_seq: Any = ..., dynamic_dimensions: Optional[List[bool]] = ...) -> Shape: ... @staticmethod def token_shape() -> Shape: ... @staticmethod def scalar_shape(type: Union[np.dtype, PrimitiveType]) -> Shape: ... def dimensions(self) -> Tuple[int, ...]: ... def xla_element_type(self) -> PrimitiveType: ... def element_type(self) -> np.dtype: ... def numpy_dtype(self) -> np.dtype: ... def is_tuple(self) -> bool: ... def is_array(self) -> bool: ... def is_token(self) -> bool: ... def is_static(self) -> bool: ... def is_dynamic(self) -> bool: ... def is_dynamic_dimension(self, dimension: int) -> bool: ... def set_dynamic_dimension(self, dimension: int, is_dynamic: bool) -> None: ... def rank(self) -> int: ... def to_serialized_proto(self) -> bytes: ... def tuple_shapes(self) -> List[Shape]: ... def leaf_count(self) -> int: ... def with_major_to_minor_layout_if_absent(self) -> Shape: ... def __eq__(self, other: Shape) -> bool: ... def __ne__(self, other: Shape) -> bool: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... class Layout: def minor_to_major(self) -> Tuple[int, ...]: ... def to_string(self) -> str: ... def __eq__(self, other: Layout) -> bool: ... def __ne__(self, other: Layout) -> bool: ... def __hash__(self) -> int: ... class ProgramShape: def __init__(self, params: Sequence[Shape], result: Shape) -> None: ... def parameter_shapes(self) -> List[Shape]: ... def result_shape(self) -> Shape: ... def __repr__(self) -> str: ... class ShapeIndex: def __init__(self, indices: List[int]) -> ShapeIndex: ... def __eq__(self, other: Shape) -> bool: ... def __ne__(self, other: Shape) -> bool: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... class Literal: def __repr__(self) -> str: ... class XlaComputation: def __init__(self, serialized_hlo_module_proto: bytes) -> None: ... def get_hlo_module(self) -> HloModule: ... def program_shape(self) -> ProgramShape: ... def as_serialized_hlo_module_proto(self) -> bytes: ... def as_hlo_text(self, print_large_constants: bool=False) -> str: ... def as_hlo_dot_graph(self) -> str: ... def hash(self) -> int: ... def as_hlo_module(self) -> HloModule: ... class HloPrintOptions: def __init__(self) -> None: ... @staticmethod def short_parsable() -> HloPrintOptions: ... @staticmethod def canonical() -> HloPrintOptions: ... @staticmethod def fingerprint() -> HloPrintOptions: ... print_large_constants: bool print_metadata: bool print_backend_config: bool print_result_shape: bool print_operand_shape: bool print_operand_names: bool print_ids: bool print_extra_attributes: bool print_program_shape: bool print_percent: bool print_control_dependencies: bool compact_operands: bool include_layout_in_shapes: bool canonicalize_instruction_names: bool canonicalize_computations: bool indent_amount: int is_in_nested_computation: bool class HloModule: spmd_output_sharding: Optional[OpSharding] spmd_parameters_shardings: Optional[List[OpSharding]] @property def name(self) -> str: ... def to_string(self, options: HloPrintOptions = ...) -> str: ... def as_serialized_hlo_module_proto(self)-> bytes: ... @staticmethod def from_serialized_hlo_module_proto( serialized_hlo_module_proto: bytes) -> HloModule: ... def hlo_module_to_dot_graph(hlo_module: HloModule) -> str: ... def hlo_module_cost_analysis( client: Client, module: HloModule) -> Dict[str, float]: ... class XlaOp: ... class XlaBuilder: def __init__(self, name: str) -> None: ... def Build(self, root: Optional[XlaOp] = ...) -> XlaComputation: ... def GetShape(self, __op: XlaOp) -> Shape: ... build = Build def clear_op_metadata(self) -> None: ... get_shape = GetShape def get_program_shape(self, root: Optional[XlaOp] = ...) -> ProgramShape: ... def is_constant(self, __op: XlaOp) -> bool: ... def set_op_metadata(self, metadata: _XlaOpMetadata) -> None: ... def set_sharding(self, sharding: OpSharding_Type) -> None: ... def clear_sharding(self) -> None: ... def setup_alias( self, __output_index: Sequence[int], __param_number: int, __param_index: Sequence[int]) -> None: ... class DeviceAssignment: @staticmethod def create(array: np.ndarray) -> DeviceAssignment: ... def replica_count(self) -> int: ... def computation_count(self) -> int: ... def __repr__(self) -> str: ... def serialize(self) -> bytes: ... class CompileOptions: def __init__(self) -> None: ... argument_layouts: Optional[List[Shape]] parameter_is_tupled_arguments: bool executable_build_options: ExecutableBuildOptions tuple_arguments: bool num_replicas: int num_partitions: int device_assignment: Optional[DeviceAssignment] def register_custom_call_target(fn_name: str, capsule: Any, platform: str) -> _Status: ... class DebugOptions: def __repr__(self) -> str: ... xla_cpu_enable_fast_math: bool xla_cpu_fast_math_honor_infs: bool xla_cpu_fast_math_honor_nans: bool xla_cpu_fast_math_honor_division: bool xla_cpu_fast_math_honor_functions: bool xla_gpu_enable_fast_min_max: bool xla_backend_optimization_level: int xla_cpu_enable_xprof_traceme: bool xla_llvm_disable_expensive_passes: bool xla_test_all_input_layouts: bool class CompiledMemoryStats: generated_code_size_in_bytes: int argument_size_in_bytes: int output_size_in_bytes: int alias_size_in_bytes: int temp_size_in_bytes: int def __str__(self) -> str: ... class ExecutableBuildOptions: def __init__(self) -> None: ... def __repr__(self) -> str: ... result_layout: Optional[Shape] num_replicas: int num_partitions: int debug_options: DebugOptions device_assignment: Optional[DeviceAssignment] use_spmd_partitioning: bool use_auto_spmd_partitioning: bool auto_spmd_partitioning_mesh_shape: List[int] auto_spmd_partitioning_mesh_ids: List[int] class PrecisionConfig_Precision(enum.IntEnum): DEFAULT: int HIGH: int HIGHEST: int class OpSharding_Type(enum.IntEnum): REPLICATED: int MAXIMAL: int TUPLE: int OTHER: int MANUAL: int class OpSharding: Type: typing.Type[OpSharding_Type] type: OpSharding_Type replicate_on_last_tile_dim: bool last_tile_dims: Sequence[Type] tile_assignment_dimensions: Sequence[int] tile_assignment_devices: Sequence[int] tuple_shardings: Sequence[OpSharding] def SerializeToString(self) -> bytes: ... class ChannelHandle_ChannelType(enum.IntEnum): CHANNEL_TYPE_INVALID: int DEVICE_TO_DEVICE: int DEVICE_TO_HOST: int HOST_TO_DEVICE: int class ChannelHandle: type: ChannelHandle_ChannelType handle: int def __repr__(self) -> str: ... class FftType(enum.IntEnum): FFT: int IFFT: int RFFT: int IRFFT: int # === END xla_compiler.cc class Device: id: int host_id: int process_index: int platform: str device_kind: str client: Client def __repr__(self) -> str: ... def __str__(self) -> str: ... def transfer_to_infeed(self, literal: _LiteralSlice): ... def transfer_from_outfeed(self, shape: Shape): ... def live_buffers(self) -> List[Buffer]: ... def __getattr__(self, name: str) -> Any: ... class GpuDevice(Device): pass class TpuDevice(Device): pass class _GpuAllocatorKind(enum.IntEnum): DEFAULT: int PLATFORM: int BFC: int CUDA_ASYNC: int class GpuAllocatorConfig: # TODO(b/194673104): Remove once pytype correctly resolves a nested enum. Kind = _GpuAllocatorKind def __init__( self, kind: _GpuAllocatorKind = ..., memory_fraction: float = ..., preallocate: bool = ...) -> None: ... class HostBufferSemantics(enum.IntEnum): IMMUTABLE_ONLY_DURING_CALL: HostBufferSemantics IMMUTABLE_UNTIL_TRANSFER_COMPLETES: HostBufferSemantics ZERO_COPY: HostBufferSemantics class Client: platform: str platform_version: str runtime_type: str def device_count(self) -> int: ... def local_device_count(self) -> int: ... def devices(self) -> List[Device]: ... def local_devices(self) -> List[Device]: ... def live_buffers(self) -> List[Buffer]: ... def live_executables(self) -> List[Executable]: ... def host_id(self) -> int: ... def process_index(self) -> int: ... @overload def get_default_device_assignment( self, num_replicas: int, num_partitions: int) -> List[List[Device]]: ... @overload def get_default_device_assignment( self, num_replicas: int) -> List[Device]: ... def create_channel_handle(self) -> ChannelHandle: ... def create_device_to_host_channel_handle(self) -> ChannelHandle: ... def create_host_to_device_channel_handle(self) -> ChannelHandle: ... def buffer_from_pyval( self, argument: Any, device: Device = ..., force_copy: bool = ..., host_buffer_semantics: HostBufferSemantics = ...) -> Buffer: ... def make_cross_host_receive_buffers( self, shapes: Sequence[Shape], device: Device) -> List[Tuple[Buffer, bytes]]: ... def compile( self, computation: XlaComputation, compile_options: CompileOptions = ...) -> Executable: ... def serialize_executable(self, executable: Executable) -> bytes: ... def deserialize_executable( self, serialized: bytes, options: CompileOptions) -> Executable: ... # TODO(skyewm): remove when jax stop providing hlo_module def deserialize_executable( self, serialized: bytes, hlo_module: HloModule, options: CompileOptions) -> Executable: ... def heap_profile(self) -> bytes: ... def defragment(self) -> _Status: ... def get_emit_python_callback_descriptor( self, callable: Callable, operand_shapes: Sequence[XlaOp], results_shapes: Sequence[Shape]) -> Tuple[Any, Any]: ... def emit_python_callback( self, callable: Callable, builder: XlaBuilder, operands: Sequence[XlaOp], results_shapes: Sequence[Shape], operand_layouts: Optional[Sequence[Shape]] = ..., has_side_effects: bool = ...) -> Tuple[XlaOp, Any]: ... def get_cpu_client(asynchronous: bool = ...) -> Client: ... def get_tfrt_cpu_client(asynchronous: bool = ...) -> Client: ... def get_interpreter_client() -> Client: ... def get_gpu_client( asynchronous: bool = ..., allocator_config: GpuAllocatorConfig = ..., distributed_client: Optional[DistributedRuntimeClient] = ..., node_id: int = ..., allowed_devices: Optional[Any] = ..., platform_name: Optional[str] = ...) -> Client:... def get_tpu_client(max_inflight_computations: int = ...) -> Client: ... class DeviceArrayBase: ... class DeviceArray(DeviceArrayBase): __array_priority__: int _device: Optional[Device] aval: Any weak_type: Optional[bool] @property def device_buffer(self: _T) -> _T: ... shape: Tuple[int, ...] dtype: np.dtype size: int ndim: int _value: np.ndarray def copy_to_device(self, dst_device: Device) -> DeviceArray: ... def copy_to_remote_device(self, descriptor: bytes) -> Tuple[_Status, bool]: ... def on_device_size_in_bytes(self) -> int: ... def delete(self) -> None: ... def is_ready(self) -> bool: ... def is_known_ready(self) -> bool: ... def block_until_ready(self) -> DeviceArray: ... def copy_to_host_async(self) -> _Status: ... def to_py(self) -> np.ndarray: ... def xla_shape(self) -> Shape: ... def xla_dynamic_shape(self) -> Shape: ... client: Client def device(self) -> Device: ... def platform(self) -> str: ... def is_deleted(self) -> bool: ... def unsafe_buffer_pointer(self) -> Any: ... __cuda_array_interface__: Dict[str, Any] traceback: Traceback def clone(self) -> DeviceArray: ... PyLocalBuffer = DeviceArray Buffer = DeviceArray class Executable: client: Client def local_logical_device_ids(self) -> List[Tuple[int, int]]: ... def local_devices(self) -> List[Device]: ... def size_of_generated_code_in_bytes(self) -> int: ... def delete(self) -> None: ... def execute(self, arguments: Sequence[DeviceArray]) -> List[DeviceArray]: ... def execute_sharded_on_local_devices( self, arguments: Sequence[List[DeviceArray]]) -> List[List[DeviceArray]]: ... def hlo_modules(self) -> List[HloModule]: ... def keep_alive(self) -> None: ... traceback: Traceback fingerprint: Optional[bytes] def buffer_to_dlpack_managed_tensor( buffer: Buffer, take_ownership: bool = ...) -> Any: ... def dlpack_managed_tensor_to_buffer( tensor: Any, cpu_backend: Optional[Client] = ..., gpu_backend: Optional[Client] = ...) -> Buffer: ... # === BEGIN py_traceback.cc class Frame: file_name: str function_name: str function_line_start: int line_num: int def __repr__(self) -> str: ... class Traceback: enabled: ClassVar[bool] @staticmethod def get_traceback() -> Traceback: ... frames: Sequence[Frame] def __str__(self) -> str: ... def as_python_traceback(self) -> Any: ... def raw_frames(self) -> Tuple[List[types.CodeType], List[int]]: ... @staticmethod def code_addr2line(code: types.CodeType, lasti: int) -> int: ... def replace_thread_exc_traceback(traceback: Any): ... # === END py_traceback.cc class DistributedRuntimeService: def shutdown(self) -> None: ... class DistributedRuntimeClient: def connect(self) -> _Status: ... def shutdown(self) -> _Status: ... def get_distributed_runtime_service( address: str, num_nodes: int, heartbeat_interval: Optional[int] = ..., max_missing_heartbeats: Optional[int] = ..., enumerate_devices_timeout: Optional[int] = ..., shutdown_timeout: Optional[int] = ...) -> DistributedRuntimeService: ... def get_distributed_runtime_client( address: str, node_id: int, rpc_timeout: Optional[int] = ..., init_timeout: Optional[int] = ..., shutdown_timeout: Optional[int] = ..., heartbeat_interval: Optional[int] = ..., max_missing_heartbeats: Optional[int] = ..., missed_heartbeat_callback: Optional[Any] = ..., shutdown_on_destruction: Optional[bool] = ...) -> DistributedRuntimeClient: ... def collect_garbage() -> None: ... def is_optimized_build() -> bool: ... def json_to_pprof_profile(json: str) -> bytes: ... def pprof_profile_to_json(proto: bytes) -> str: ... class CompiledFunction: def __call__(self, *args, **kwargs) -> Any: ... def __getstate__(self) -> Any: ... def __setstate__(self, Any): ... __signature__: inspect.Signature def _cache_size(self) -> int: ... def _clear_cache(self) -> None: ... class PmapFunction: def __call__(self, *args, **kwargs) -> Any: ... def __getstate__(self) -> Any: ... def __setstate__(self, Any): ... __signature__: inspect.Signature def _cache_size(self) -> int: ... def _clear_cache(self) -> None: ...
1f03b8aad24c2370d520e48b592152a4703341a1
a5774cd1c577f4c0ea5353ebbfc752e4ba30326d
/Iteration-1/test/test_bowlinggame.py
e8fe42173fe111f91ad18161a571db1266d187b8
[ "Unlicense" ]
permissive
xray/py-bowling-game-kata
9faaa115ea57b38d441bcc083590b4d7f5aa551c
25da4a8d4bccf6a955ef0bbb7604d0c9d3a4599b
refs/heads/master
2020-03-31T10:02:43.606459
2018-10-08T21:24:34
2018-10-08T21:24:34
152,120,495
0
0
null
null
null
null
UTF-8
Python
false
false
2,067
py
from bowlinggame.game import Score def gen_all_x_except_y_frame(number_to_set, frame_to_change, arr=[]): game = [] for frame in range(10): if frame == (frame_to_change - 1): game.append(arr) else: if frame == 9: if number_to_set == 10: game.append([number_to_set, number_to_set, number_to_set]) else: game.append([number_to_set, number_to_set, 0]) elif number_to_set == 10: game.append([number_to_set, 0]) else: game.append([number_to_set, number_to_set]) return game def test_gutter_game(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(0, 0)) == 0 def test_all_ones_game(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(1, 0)) == 20 def test_spare_in_frame_one_zeros(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(0, 1, [1, 9])) == 10 def test_spare_in_frame_one_ones(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(1, 1, [1, 9])) == 29 def test_strike_in_frame_one_ones(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(1, 1, [10, 0])) == 30 def test_various_game(): rolls = [[6, 3], [6, 4], [6, 2], [4, 6], [10, 0], [10, 0], [3, 2], [5, 5], [4, 3], [3, 1, 0]] new_score = Score() assert new_score.calculate(rolls) == 121 def test_all_strikes_except_last_frame(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(10, 10, [0, 0, 0])) == 240 def test_last_frame_spare(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(0, 10, [9, 1, 9])) == 19 def test_last_frame_strikes(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(0, 10, [10, 10, 10])) == 30 def test_all_strikes(): new_score = Score() assert new_score.calculate(gen_all_x_except_y_frame(10, 10, [10, 10, 10])) == 300
800d097e7641deb96cee13bca8df9f1242e5f9cb
f214ad554e5c227724be6358bd896ed41a0ae866
/dakota/template_dir/model_command_line_driver3.py
7667ea0fc2c3fe27fcad19943d07dbe7bfc44e1a
[]
no_license
SiccarPoint/how_wrong_is_the_code
f42584fedf6fbea1c37564994b289ed3a07130ae
7533b679418d9d9abe78f8c7c73484952acb4641
refs/heads/master
2021-05-20T22:03:41.442612
2020-07-02T16:00:22
2020-07-02T16:00:22
252,392,215
1
0
null
null
null
null
UTF-8
Python
false
false
2,594
py
import sys import os import numpy as np from subprocess import call from yaml import safe_load from bug_model.simulate_bug_decay import run_with_exponential_num_bugs_floats_in from bug_model.simulate_bug_decay import DATA_DIR from bug_model.driver import create_bins BINNING_SCALE = 20 LOW_COMMITS = 10 REPEATS = 3 # This script much indebted to Katy Barnhart's exceptional tutorial on # Dakota for calibration; see # https://github.com/kbarnhart/calibration_with_dakota_clinic # STEP 1: Use Dakota-created input files to prepare for run input_template = "input_template.yml" inputs = "inputs.yml" call(["dprepro", sys.argv[1], input_template, inputs]) call(['rm', input_template]) # STEP 2: Run model # Load parameters from the yaml formatted input. with open(inputs, "r") as f: params = safe_load(f) R = params["R"] S = params["S"] F = params["F"] # load the data real_bfr = np.loadtxt(os.path.join(DATA_DIR, 'all_real_data_bug_find_rate.txt')) real_commits = np.loadtxt(os.path.join(DATA_DIR, 'all_real_data_total_commits.txt')) real_bins, real_bin_counts, real_binned_bfr = create_bins( BINNING_SCALE, real_commits, real_bfr ) # launch the simulation avg_sim_bin_bfr = np.zeros_like(real_binned_bfr, dtype=float) avg_sim_std_low_commits = 0 for i in range(REPEATS): num_bugs, bug_rate, num_commits = run_with_exponential_num_bugs_floats_in( R, S, F, num_realisations='from_data', stochastic=True ) bins, bin_counts, sim_bin_bfr = create_bins( BINNING_SCALE, num_commits, bug_rate ) avg_sim_bin_bfr += sim_bin_bfr / float(REPEATS) low_commit_repos = num_commits < LOW_COMMITS avg_sim_std_low_commits += np.std( bug_rate[low_commit_repos] ) / float(REPEATS) # Step 3: Write output in format Dakota expects # Each of the metrics listed in the Dakota .in file needs to be written to # the specified output file given by sys.argv[2]. This is how information is # sent back to Dakota. # calc the rmse # repo lengths are used directly by model and remain in order so simply now rmse = (np.mean((real_binned_bfr - avg_sim_bin_bfr) ** 2)) ** 0.5 # calc the diff_std_at_low_commits # note we have to use each individual sim, not the std of the averaged run real_std_low_commits = np.std(real_bfr[real_commits < LOW_COMMITS]) diff_std_at_low_commits = np.abs(real_std_low_commits - avg_sim_std_low_commits) # Write both to the expected file. with open(sys.argv[2], "w") as fp: fp.write(str(rmse) + '\n' + str(diff_std_at_low_commits))
c3a4c828b1b352960cd0ad0b3544c00b0b4a1a0b
f4bca02f5d447c13056767bd1723aaf6af25e7b9
/attendance/admin.py
db800eb82e231860cbd1ac92552f9a08a96ad836
[]
no_license
ainc/student-progress
f9ae72f99f741227306dfbf04f2a54498dcebfef
9959d390822613cd7e3d314e92a7579de91af7a5
refs/heads/master
2021-01-21T13:56:35.060947
2016-07-19T17:44:42
2016-07-19T17:44:42
46,016,575
1
0
null
null
null
null
UTF-8
Python
false
false
830
py
from django.contrib import admin from .models import Coach, Student, Class, ClassSession, AttendanceRecord, Enrollment, StudentGuardian, StudentProfile, CoachNote, StudentGoal, Skill, Subskill, StudentProgress, Relationship, Team, TeamMember, PassPhrase # Register your models here. admin.site.register(Coach) admin.site.register(ClassSession) admin.site.register(AttendanceRecord) admin.site.register(Class) admin.site.register(Student) admin.site.register(Enrollment) admin.site.register(StudentGuardian) admin.site.register(StudentProfile) admin.site.register(CoachNote) admin.site.register(StudentGoal) admin.site.register(Skill) admin.site.register(Subskill) admin.site.register(StudentProgress) admin.site.register(Relationship) admin.site.register(Team) admin.site.register(TeamMember) admin.site.register(PassPhrase)
a893b8bc1eb62b75bdbe515d99cf5df8147152ae
7985897a15d89d18597a5cc73fcb5a5bfb81fbff
/powerdnsadmin/models/account_user.py
81bb43abc78abe866311e9bc5d6cdbc795c24b21
[ "MIT" ]
permissive
Atisom/PowerDNS-Admin
5623e93fde89ccfde1ccc19e52732a3e783a1e3b
1d31b7bf818425c8e2b81008ab14704d16caf2a6
refs/heads/master
2021-04-24T00:17:47.919494
2020-11-27T14:43:46
2020-11-27T14:43:46
250,041,982
2
0
MIT
2020-03-25T17:11:53
2020-03-25T17:11:52
null
UTF-8
Python
false
false
569
py
from .base import db class AccountUser(db.Model): __tablename__ = 'account_user' id = db.Column(db.Integer, primary_key=True) account_id = db.Column(db.Integer, db.ForeignKey('account.id'), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) def __init__(self, account_id, user_id): self.account_id = account_id self.user_id = user_id def __repr__(self): return '<Account_User {0} {1}>'.format(self.account_id, self.user_id)
e92271f1c78474217bc02f56b883490d97558c08
d3ab828a7a11db5f35f308f4e30e4ffc5e2cf964
/jd/items.py
0ddb078f594520bd69574980d37a547ad236cd17
[]
no_license
DahuK/Crawler
95a693fc3bdfbf8977ecd9351d20949cf3dde472
f6cd3d0af7a5a9b01bdee92150254b406dc8af11
refs/heads/master
2020-04-28T02:09:21.284569
2016-01-18T11:27:50
2016-01-18T11:27:50
40,756,401
0
0
null
null
null
null
UTF-8
Python
false
false
551
py
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html from scrapy.item import Item, Field class TutorialItem(Item): # define the fields for your item here like: # name = Field() pass class JdbookItem(Item): name = Field() price = Field() publisher = Field() author = Field() commit = Field() shop = Field() # category = Field() # link = Field() # desc = Field() # rank = Field()
ffd1967fdd6141f81536c15df8db6f38b79377a7
edc5caaf86094e01fd1fb94817e8004cefaff780
/TP4/workspace-buildoutput/catkin_ws/build/turtlebot3/turtlebot3_description/catkin_generated/pkg.develspace.context.pc.py
6393b6898e69481fcaf13804491f14bd2290a0bb
[]
no_license
waelkedi/IA
73a04c85e1410ddbf08c3cd11974e8d22f6ef26b
a658ea7600a094a687c6274abef5d49fcbe40688
refs/heads/master
2020-03-29T23:14:27.269859
2019-01-14T16:11:54
2019-01-14T16:11:54
150,463,256
0
0
null
null
null
null
UTF-8
Python
false
false
391
py
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "".split(';') if "" != "" else [] PROJECT_CATKIN_DEPENDS = "urdf;xacro".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else [] PROJECT_NAME = "turtlebot3_description" PROJECT_SPACE_DIR = "/root/ros/catkin_ws/devel" PROJECT_VERSION = "1.1.0"
70c3c7e641524c77f72502fe9dc156224c6de638
2228dbdfd5f1cb4ede5ae87a5e3554f6d4d50258
/Extended_source/Source_estimation/source_lens.py
6eabd2ef5376d6f8453bc19edf0217b78bc2c4c6
[]
no_license
ialopezt/GalLenspy
b5d65403cffecdce8420265b0b220669489b49bf
59af3329f9c390d0b4dbfe1ef36dd414c1691674
refs/heads/master
2023-05-08T07:59:20.275380
2021-05-29T04:06:16
2021-05-29T04:06:16
267,147,572
3
0
null
null
null
null
UTF-8
Python
false
false
13,016
py
from scipy.misc import * import numpy as np import pylab as plb import matplotlib.pyplot as plt import matplotlib.cm as cm from scipy.integrate import quad from scipy.integrate import nquad from scipy.misc import derivative import pandas as pd import emcee import corner from astropy import table as Table # For fast and easy reading / writing with tables using numpy library from galpy.potential import MiyamotoNagaiPotential, NFWPotential, RazorThinExponentialDiskPotential, BurkertPotential # GALPY potentials # In[ ]: tt=Table.Table.read('coordinates.txt', format='ascii.tab') # importando los datos de las imรกgenes #Import coordinates of images theta1=tt['theta1'] theta2=tt['theta2'] sigma=tt['sigma'] theta=np.zeros(len(theta1),float) for i in range(len(theta1)): theta[i]=np.sqrt(theta1[i]**2+theta2[i]**2) tt=Table.Table.read('alpha.txt', format='ascii.tab') # Import the values of the angles belonging to the circle for the arc #Import the values alpha alpha=tt['alpha'] tt=Table.Table.read('Cosmological_distances.txt', format='ascii.tab') # importando los datos de distancias cosmolรณgicas #Importando distancias cosmolรณgicas y Sigma Crรญtico D_ds=tt['D_ds'][0] D_d=tt['D_d'][0] D_s=tt['D_s'][0] SIGMA_CRIT=tt['SIGMA_CRIT'][0] tt=Table.Table.read('init_guess_params.txt', format='ascii.tab') # importando los datos de distancias cosmolรณgicas #Importando distancias cosmolรณgicas y Sigma Crรญtico R = tt['value'][0] r = R*np.pi/(180*3600) CX = tt['value'][1] h = CX*np.pi/(180*3600) CY = tt['value'][2] k = CY*np.pi/(180*3600) escala_r = tt['value'][3] den_0 = tt['value'][4] #R = 0.03 #r = R*np.pi/(180*3600) #CX = -0.09 #h = CX*np.pi/(180*3600) #CY = -0.01 #k = CY*np.pi/(180*3600) Beta1 = r*np.cos(alpha)+h Beta2 = r*np.sin(alpha)+k FC = np.pi/(180*3600) #conversion factor between arcs and radians #escala_r = 18 #den_0 = 44.5e8 #Illustration of obtained images with initial Guess def POTDEFdisk_exp1(x): def integ(TheTa, theta): Sigma = den_0*np.exp(-D_d*TheTa/escala_r) #Volumetric density return 2*TheTa*np.log(THETA/TheTa)*Sigma/(SIGMA_CRIT**3) THETA = np.sqrt(x**2 + theta2[l]**2) x = quad(integ, 0, theta[l], limit=100, args=(theta))[0] return x def POTDEFdisk_exp2(x): def integ(TheTa, theta): Sigma = den_0*np.exp(-D_d*TheTa/escala_r) #Volumetric density return 2*TheTa*np.log(THETA/TheTa)*Sigma/(SIGMA_CRIT**3) THETA = np.sqrt(x**2 + theta1[l]**2) x = quad(integ, 0, theta[l], limit=100, args=(theta))[0] return x #Obteniendo gradiente del potencial deflector GRADPOT1disk_exp = np.zeros((len(theta1)), float) GRADPOT2disk_exp = np.zeros((len(theta1)), float) GRADPOT1 = np.zeros((len(theta1)), float) GRADPOT2 = np.zeros((len(theta1)), float) THETA1 = np.zeros((len(theta1)), float) THETA2 = np.zeros((len(theta1)), float) for l in range(len(theta1)): GRADPOT1disk_exp[l]= derivative(POTDEFdisk_exp1, theta1[l], dx=1e-9, order=7) GRADPOT2disk_exp[l]= derivative(POTDEFdisk_exp2, theta2[l], dx=1e-9, order=7) GRADPOT1[l]=(SIGMA_CRIT**2)*(GRADPOT1disk_exp[l]) GRADPOT2[l]=(SIGMA_CRIT**2)*(GRADPOT2disk_exp[l]) #Images obtained with initial guess for l in range(len(theta1)): THETA1[l] = Beta1[l]+GRADPOT1[l] THETA2[l] = Beta2[l]+GRADPOT2[l] # In[ ]: #Graphics of source and images fig = plt.figure() plt.rcParams['figure.figsize'] =(10,10) plb.plot(Beta1*1e6, Beta2*1e6, '--r') plb.plot(theta1*1e6, theta2*1e6, 'ob') plb.plot(THETA1*1e6, THETA2*1e6, 'og') plb.xlim(-2.5*np.pi*1e6/(180*3600),2.5*np.pi*1e6/(180*3600)) plb.ylim(-2.5*np.pi*1e6/(180*3600),2.5*np.pi*1e6/(180*3600)) plb.savefig('Guess_initial_source_lens.pdf') # In[ ]: print ("\n#####################################################################") print("MCMC------GALLENSPY") #Model of the lens def model(parameters, theta1, theta2, sigma): RAD, H, K, SIGMA_0, H_R = parameters r = RAD*np.pi/(180*3600) h = H*np.pi/(180*3600) k = K*np.pi/(180*3600) Beta1 = r*np.cos(alpha)+h Beta2 = r*np.sin(alpha)+k def POTDEFdisk_exp1(TheTa1,theta): TheTa = np.sqrt(TheTa1**2+theta2[l]**2) R = D_d*TheTa Sigma = SIGMA_0*np.exp(-D_d*TheTa/H_R) #Volumetric density kappa = Sigma/SIGMA_CRIT return (2/theta1[l])*TheTa1*kappa/SIGMA_CRIT**2 def POTDEFdisk_exp2(TheTa2,theta): TheTa = np.sqrt(TheTa2**2+theta1[l]**2) R = D_d*TheTa Sigma = SIGMA_0*np.exp(-D_d*TheTa/H_R) #Volumetric density kappa = Sigma/SIGMA_CRIT return (2/theta2[l])*TheTa2*kappa/SIGMA_CRIT**2 GRADPOT1disk_exp = np.zeros((len(theta1)), float) GRADPOT2disk_exp = np.zeros((len(theta1)), float) GRADPOT1 = np.zeros((len(theta1)), float) GRADPOT2 = np.zeros((len(theta1)), float) THETA1 = np.zeros((len(theta1)), float) THETA2 = np.zeros((len(theta1)), float) for l in range(len(theta1)): GRADPOT1disk_exp[l]= quad(POTDEFdisk_exp1, 0, theta1[l], limit=100, args=(theta[l]))[0] GRADPOT2disk_exp[l]= quad(POTDEFdisk_exp2, 0, theta2[l], limit=100, args=(theta[l]))[0] for l in range(len(theta1)): GRADPOT1[l]=(SIGMA_CRIT**2)*(GRADPOT1disk_exp[l]) GRADPOT2[l]=(SIGMA_CRIT**2)*(GRADPOT2disk_exp[l]) for l in range(len(theta1)): THETA1[l] = Beta1[l]+GRADPOT1[l] THETA2[l] = Beta2[l]+GRADPOT2[l] THETA_teor = np.zeros((len(theta1)), float) for l in range(len(theta1)): THETA_teor[l] = np.sqrt(THETA1[l]**2+THETA2[l]**2) return THETA_teor # In[ ]: #Likelihood function def lnlike(parameters, theta1, theta2, sigma): RAD, H, K, SIGMA_0, H_R = parameters THETA_teor = model(parameters, theta1, theta2, sigma) X = np.zeros((len(theta1)),float) for l in range(len(theta1)): X[l]=((theta[l]-THETA_teor[l])**2)/(sigma[l]**2) return -0.5*np.sum(X) # In[ ]: #initial guess in the MCMC start=np.zeros(5,float) start[0] = R start[1] = CX start[2] = CY start[3] = den_0 start[4] = escala_r # In[ ]: #Parametric space in the MCMC def lnprior(parameters): RAD, H, K, SIGMA_0, H_R = parameters # if 0.05<R_S<32 and 0.05e11<m_0<12e11 and 0.8e8<SIGMA_0<17e8 and 1<H_R<7 and 0.05<B<17 and 0.09e10<MASS<1.1e10: if -0.2<H<0.2 and -0.2<K<0.2 and 1e8<SIGMA_0<60e8 and 2<H_R<24 and 0<RAD<0.2: return 0.0 return -np.inf # In[ ]: #Probability function def lnprob(parameters, theta1, theta2, sigma): lp = lnprior(parameters) if not np.isfinite(lp): return -np.inf return lp + lnlike(parameters, theta1, theta2, sigma) # In[ ]: #Dimension and walkers ndim, nwalkers = 5, 100 #initial posicion and step length pos_step = 1e-8 pos_in = [abs(start + pos_step*start*np.random.randn(ndim)+1e-9*np.random.randn(ndim)) for i in range(nwalkers)] # In[ ]: sampler = emcee.EnsembleSampler(nwalkers, ndim, lnprob, args=(theta1, theta2,sigma)) # In[ ]: #Number of Steps sampler.run_mcmc(pos_in, 1000, progress=True) # In[ ]: fig = plt.figure() ax = fig.add_axes((0.15, 0.3, 0.75, 0.6)) chain_steps = [i for i in range(len(sampler.chain[:,:,0].T))] chain_W = [] for i in range(nwalkers): chain_value = sampler.chain[:,:,0].T[:][:,i] ax.plot(chain_steps, chain_value, '-', color='k', alpha=0.3) ax.plot(chain_steps, len(chain_steps)*[start[0]], '-', color='r', lw=1) ax.set_xlim(0, len(chain_steps)-1) plb.savefig('h.pdf') # In[ ]: fig = plt.figure() ax = fig.add_axes((0.15, 0.3, 0.75, 0.6)) chain_steps = [i for i in range(len(sampler.chain[:,:,1].T))] chain_W = [] for i in range(nwalkers): chain_value = sampler.chain[:,:,1].T[:][:,i] ax.plot(chain_steps, chain_value, '-', color='k', alpha=0.3) ax.plot(chain_steps, len(chain_steps)*[start[1]], '-', color='r', lw=1) ax.set_xlim(0, len(chain_steps)-1) plb.savefig('k.pdf') # In[ ]: fig = plt.figure() ax = fig.add_axes((0.15, 0.3, 0.75, 0.6)) chain_steps = [i for i in range(len(sampler.chain[:,:,2].T))] chain_W = [] for i in range(nwalkers): chain_value = sampler.chain[:,:,2].T[:][:,i] ax.plot(chain_steps, chain_value, '-', color='k', alpha=0.3) ax.plot(chain_steps, len(chain_steps)*[start[2]], '-', color='r', lw=1) ax.set_xlim(0, len(chain_steps)-1) plb.savefig('Sigma_0.pdf') # In[ ]: fig = plt.figure() ax = fig.add_axes((0.15, 0.3, 0.75, 0.6)) chain_steps = [i for i in range(len(sampler.chain[:,:,3].T))] chain_W = [] for i in range(nwalkers): chain_value = sampler.chain[:,:,3].T[:][:,i] ax.plot(chain_steps, chain_value, '-', color='k', alpha=0.3) ax.plot(chain_steps, len(chain_steps)*[start[3]], '-', color='r', lw=1) ax.set_xlim(0, len(chain_steps)-1) plb.savefig('h_r.pdf') # In[ ]: #Step of cut in the MCMC samples = sampler.chain[:, 600:, :].reshape((-1, ndim)) # In[ ]: percentage=0.68 #Contours of values fig = corner.corner(samples, labels=["$r$", "$h$", r"$k$", r"$\Sigma_0$", "$h_r$"], quantiles = [0.5-0.5*percentage, 0.5, 0.5+0.5*percentage],fill_contours=True, plot_datapoints=True) fig.savefig("contours_source_lens.pdf") # In[ ]: #Parameters and errors para = [] parap68=[]; paran68=[] parap95=[]; paran95=[] fit_para = [] for i in range(ndim): mcmc = np.percentile(samples[:, i], [50.-0.5*95, 50.-0.5*68, 50., 50.+0.5*68, 50.+0.5*95]) para.append(mcmc[2]) fit_para.append(mcmc[2]) parap68.append(mcmc[3]-mcmc[2]) paran68.append(mcmc[2]-mcmc[1]) parap95.append(mcmc[4]-mcmc[2]) paran95.append(mcmc[2]-mcmc[0]) # In[ ]: #Visualization of generated images for the parameter set obtained R = para[0] H = para[1] K = para[2] Sigma_0 = para[3] h_r = para[4] r = R*np.pi/(180*3600) h = H*np.pi/(180*3600) k = K*np.pi/(180*3600) Beta1 = r*np.cos(alpha)+h Beta2 = r*np.sin(alpha)+k def POTDEFdisk_exp1(x): def integ(TheTa, theta): Sigma = Sigma_0*np.exp(-D_d*TheTa/h_r) #Volumetric density return 2*TheTa*np.log(THETA/TheTa)*Sigma/(SIGMA_CRIT**3) THETA = np.sqrt(x**2 + theta2[l]**2) x = quad(integ, 0, theta[l], limit=100, args=(theta))[0] return x def POTDEFdisk_exp2(x): def integ(TheTa, theta): Sigma = Sigma_0*np.exp(-D_d*TheTa/h_r) #Volumetric density return 2*TheTa*np.log(THETA/TheTa)*Sigma/(SIGMA_CRIT**3) THETA = np.sqrt(x**2 + theta1[l]**2) x = quad(integ, 0, theta[l], limit=100, args=(theta))[0] return x #Obteniendo gradiente del potencial deflector GRADPOT1disk_exp = np.zeros((len(theta1)), float) GRADPOT2disk_exp = np.zeros((len(theta1)), float) GRADPOT1 = np.zeros((len(theta1)), float) GRADPOT2 = np.zeros((len(theta1)), float) THETA1 = np.zeros((len(theta1)), float) THETA2 = np.zeros((len(theta1)), float) for l in range(len(theta1)): GRADPOT1disk_exp[l]= derivative(POTDEFdisk_exp1, theta1[l], dx=1e-9, order=7) GRADPOT2disk_exp[l]= derivative(POTDEFdisk_exp2, theta2[l], dx=1e-9, order=7) GRADPOT1[l]=(SIGMA_CRIT**2)*(GRADPOT1disk_exp[l]) GRADPOT2[l]=(SIGMA_CRIT**2)*(GRADPOT2disk_exp[l]) #Images obtained with initial guess for l in range(len(theta1)): THETA1[l] = Beta1[l]+GRADPOT1[l] THETA2[l] = Beta2[l]+GRADPOT2[l] # In[ ]: #Graphics of source and images fig = plt.figure() plt.rcParams['figure.figsize'] =(10,10) plb.plot(Beta1/FC, Beta2/FC, '--r') plb.plot(theta1/FC, theta2/FC, 'ob') plb.plot(THETA1/FC, THETA2/FC, 'og') plb.xlim(-2.5,2.5) plb.ylim(-2.5,2.5) plb.legend(['Source', 'Observational data', 'Model values'], loc='upper right', fontsize=15) #plb.show() plt.savefig('fitting.pdf') # In[ ]: #Parameters and errors r= para[0]; r_95pos = parap95[0]; r_95neg = paran95[0]; r_68pos = parap68[0]; r_68neg = paran68[0] h= para[1]; h_95pos = parap95[1]; h_95neg = paran95[1]; h_68pos = parap68[1]; h_68neg = paran68[1] k = para[2]; k_95pos = parap95[2]; k_95neg = paran95[2]; k_68pos = parap68[2]; k_68neg = paran68[2] Sigma_0 = para[3]; Sigma_0_95pos = parap95[3]; Sigma_0_95neg = paran95[3]; Sigma_0_68pos = parap68[3]; Sigma_0_68neg = paran68[3] h_r = para[4]; h_r_95pos = parap95[4]; h_r_95neg = paran95[4]; h_r_68pos = parap68[4]; h_r_68neg = paran68[4] # In[ ]: table_data = [] table_para = [r"r",r"h",r"k",r"Sigma_0", r"h_r"] table_units = [r"arcs",r"arcs",r"arcs", r"Solar_Mass/Kpc^2", r"Kpc"] para = [r, h, k, Sigma_0, h_r] parap68=[r_68pos, h_68pos, k_68pos, Sigma_0_68pos, h_r_68pos] paran68=[r_68neg, h_68neg, k_68neg, Sigma_0_68neg, h_r_68neg] parap95=[r_95pos, h_95pos, k_95pos, Sigma_0_95pos, h_r_95pos] paran95=[r_95neg, h_95neg, k_95neg, Sigma_0_95neg, h_r_95neg] index=[r"r",r"h",r"k",r"Sigma_0", r"h_r"] for i in range(len(para)): table_data.append([table_para[i], table_units[i], para[i], parap95[i], paran95[i], parap68[i], paran68[i]]) column_name = [r"PARAMETER", r"UNITS", r"FIT", r"95%(+)", r"95%(-)", r"68%(+)", r"68%(-)"] table_p = pd.DataFrame(table_data, index=index, columns=column_name) table_p.to_csv("parameters_lens_source.txt", sep='\t', encoding='utf-8') print ("\n#####################################################################") print(table_p) print ("\nDone") print ("\n#####################################################################\n")
967748c947304582173245dab50b88d282158a96
eab97fdb3a2fd93afaa4c5ad172c46e42d32b27a
/math_operations.py
a6e8bb0a2d1586a51315fb305472fbaec961a78d
[]
no_license
chdzr/basic_python
ac2c1727677c58ca92404d404aaa6329570d2424
b2b014526eb6f8c3e618c28df95d504b18719231
refs/heads/main
2023-02-28T07:36:20.964822
2021-01-30T23:43:41
2021-01-30T23:43:41
328,090,701
0
0
null
null
null
null
UTF-8
Python
false
false
67
py
print(2+3) print(3-2) print(2*3) print(6/2) print(1%2) print(5**2)
0285446a48aec8a5abe62bc424a19ff2e89ae8c3
ac50f3ac63fe399cd229f2a5e584494a9299b759
/homework.py
8db383975cbc0a86ae7c5b67b88adc2153173cf9
[ "MIT" ]
permissive
zoltanvasile/homework-session-2
62bed5fe684758239e493f044c850f701915a711
7d1149db3115375e471b6f1d7bb1975934b47f8a
refs/heads/master
2022-11-13T06:31:45.204906
2020-06-25T12:55:45
2020-06-25T12:55:45
274,914,335
0
0
null
null
null
null
UTF-8
Python
false
false
792
py
# 1.Reverse the order of the items in an array. # Example: # a = [1, 2, 3, 4, 5] # Result: # a = [5, 4, 3, 2, 1] def reverseFunction(aList): return aList.reverse() a=[1,2,3,4,5] reverseFunction(a) print(a) # 2. Get the number of occurrences of var b in array a. # Example: # a = [1, 1, 2, 2, 2, 2, 3, 3, 3] # b = 2 # Result: # 4 def occurencesNr(aList,elem): return aList.count(elem) b = [1,1,2,2,2,2,3,3,3] c = 3 d = occurencesNr(b,c) print(d) # 3. Given a sentence as string, count the number of words in it. # Example: # a = 'ana are mere si nu are pere' # Result: # 7 def wordsCounter(aString): return len(aString.split()) string = 'ana are mere si nu are pere' ret = wordsCounter(string) print(ret)
0396eb254b1de5fa42497fb6a7b869393ca51085
29c58b3bec6ac0fcdb3070efc118600ee92004da
/test/test_unread_count.py
42aeede4b08156288cd84090b1b6d8c211d1374e
[ "MIT" ]
permissive
mailslurp/mailslurp-client-python
a2b5a0545206714bd4462ae517f242852b52aaf9
5c9a7cfdd5ea8bf671928023e7263847353d92c4
refs/heads/master
2023-06-23T00:41:36.257212
2023-06-14T10:10:14
2023-06-14T10:10:14
204,662,133
8
0
null
null
null
null
UTF-8
Python
false
false
1,807
py
# coding: utf-8 """ MailSlurp API MailSlurp is an API for sending and receiving emails from dynamically allocated email addresses. It's designed for developers and QA teams to test applications, process inbound emails, send templated notifications, attachments, and more. ## Resources - [Homepage](https://www.mailslurp.com) - Get an [API KEY](https://app.mailslurp.com/sign-up/) - Generated [SDK Clients](https://docs.mailslurp.com/) - [Examples](https://github.com/mailslurp/examples) repository # noqa: E501 The version of the OpenAPI document: 6.5.2 Contact: [email protected] Generated by: https://openapi-generator.tech """ from __future__ import absolute_import import unittest import datetime import mailslurp_client from mailslurp_client.models.unread_count import UnreadCount # noqa: E501 from mailslurp_client.rest import ApiException class TestUnreadCount(unittest.TestCase): """UnreadCount unit test stubs""" def setUp(self): pass def tearDown(self): pass def make_instance(self, include_optional): """Test UnreadCount include_option is a boolean, when False only required params are included, when True both required and optional params are included """ # model = mailslurp_client.models.unread_count.UnreadCount() # noqa: E501 if include_optional : return UnreadCount( count = 56 ) else : return UnreadCount( count = 56, ) def testUnreadCount(self): """Test UnreadCount""" inst_req_only = self.make_instance(include_optional=False) inst_req_and_optional = self.make_instance(include_optional=True) if __name__ == '__main__': unittest.main()
69aa220a34896f8d7cf9b804ed9aa05956608b82
7e0f269b9199d7fc1e56377ad53c5e0011a002a3
/main/homework6/1.py
3c91fd0a96f2f063eebbbea7d3ab0c4594c10ec5
[]
no_license
IgnacioCastro0713/exercises
8fb91fe3c27f27087a26902c118d313173ec36ec
e45c4dc39fb64ed5d310b5422bc4fdc67b840621
refs/heads/master
2020-03-26T13:24:16.862854
2018-10-01T03:22:42
2018-10-01T03:22:42
144,937,116
0
0
null
null
null
null
UTF-8
Python
false
false
564
py
# Josรฉ Ignacio Menchaca Castro # 215818166 lista = ['Ana', 'Luis', 'Pedro', 'Juan'] x = 0 while True: print('Seleciona una opciรณn de la lista a remplazar: ') for i in lista: x += 1 print(x, '.-', i) remove = int(input('Opcion: ')) lista.remove(lista[remove - 1]) print('Lista: ', lista) replace = input('Escribe el nuevo nombre de la lista: ') lista.insert(remove - 1, replace.capitalize()) print('Lista: ', lista) ask = input('ยฟDesea terminar el programa? s/n: ') if ask.lower() != 'n': break
30a0136e2f51eab008da29509e4c56e638b5286a
279d4e5428398d0ddc529e4a45b97c830e10469d
/Projects/Project9_test.py
bfd5617a318ac1186de9dbdad72df2c3c2fb575d
[]
no_license
michaelstreyle/CS160
ffa5a2f7c21b10699458b12dcf14f99a12af397e
b5ac2d5d3d74a1ad131f27480b154556ca6cc0e0
refs/heads/master
2020-09-11T10:34:20.278305
2019-11-16T02:44:51
2019-11-16T02:44:51
222,036,835
0
0
null
null
null
null
UTF-8
Python
false
false
2,850
py
""" Testing the module morse Karina Hoff, 2018 """ #!/usr/bin/python3 import pytest from Project9 import Coder class TestMorseMethods: """Testing module morse""" @pytest.fixture(scope="function", autouse=True) def setup_class(self): """Setting up""" self.the_tree = Coder("morse.txt") def test_init_error(self): """Test __init__ error""" with pytest.raises(Exception) as excinfo: tree = Coder() # pylint: disable=no-value-for-parameter, unused-variable exception_message = excinfo.value.args[0] assert ( exception_message == "__init__() missing 1 required positional argument: 'file_in'" ) def test_find_path(self): """Test find_path""" assert self.the_tree.find_path(self.the_tree.morse_tree, "e", "") == "." assert not self.the_tree.find_path(self.the_tree.morse_tree, "$", "") def test_follow_and_retrieve(self): """Test follow_and_retrieve""" assert self.the_tree.follow_and_retrieve("-.-.") == "c" assert self.the_tree.follow_and_retrieve("...") == "s" assert not self.the_tree.follow_and_retrieve("-.-..") == "ฤ‡" assert not self.the_tree.follow_and_retrieve("...-...") == "ล›" def test_follow_and_insert(self): """Test follow_and_insert""" self.the_tree.follow_and_insert("-.-..", "ฤ‡") assert self.the_tree.follow_and_retrieve("-.-..") == "ฤ‡" self.the_tree.follow_and_insert("...-...", "ล›") assert self.the_tree.follow_and_retrieve("...-...") == "ล›" def test_follow_and_insert_replacement(self): """Test follow_and_insert with replacement""" self.the_tree.follow_and_insert(".", "CS160") assert self.the_tree.follow_and_retrieve(".") == "CS160" assert not self.the_tree.follow_and_retrieve(".") == "e" def test_encode(self): """Test encoding""" assert self.the_tree.encode("sos") == "... --- ... " def test_encode_error(self): """Test encoding error""" with pytest.raises(ValueError) as excinfo: self.the_tree.encode("$$") exception_message = excinfo.value.args[0] assert ( exception_message == "Could not encode $$: $ is not in the tree" ) def test_decode(self): """Test decode""" assert self.the_tree.decode("... --- ...") == "sos" def test_decode_error(self): """Test decoding error""" with pytest.raises(ValueError) as excinfo: self.the_tree.decode("...---...") exception_message = excinfo.value.args[0] assert ( exception_message == "Could not decode ...---...: ...---... is not in the tree" ) if __name__ == "__main__": pytest.main(["Project9_test.py"])
1d9f9d6e6fe20f63cf554997baf332c28a44b7e6
7520659adb4bb3a36b29a68894c449cfff2f241e
/trab1.py
4587ffb68fa3b62c35e4345f5ef38ddf46d1a2b8
[]
no_license
thiagouft/Trabalho-1-TCLFA
6df2f78c6f43771a0d314d2015c0b4755271c3ba
43a5e91e16dc9199da28847d57cc89bceafbb7f6
refs/heads/master
2021-05-16T11:06:53.946436
2017-09-27T23:37:15
2017-09-27T23:37:15
104,926,075
1
0
null
null
null
null
UTF-8
Python
false
false
8,348
py
๏ปฟ#Aluno: Thiago Silva Pereira def transicao_estendida(estado, valor): #print(valor) if valor == '&': return 'q0' i = len(valor) e = transicao_estendida(estado,valor[:len(valor)-1]) #print(e) return trasicao_afd(e,valor[i-1]) def trasicao_afd(estado, palavra): if estado == 'q0': if (palavra == 'a'): print("q0 entrou \"" + palavra + "\"" + " vai para q2.") return 'q2' else: print("q0 entrou \"" + palavra + "\"" + " vai para q1.") return 'q1' if estado == 'q1': if (palavra == 'a'): print("q1 entrou \"" + palavra + "\"" + " vai para q4.") return 'q4' else: print("q1 entrou \"" + palavra + "\"" + " vai para q3.") return 'q3' if estado == 'q2': if (palavra == 'a'): print("q2 entrou \"" + palavra + "\"" + " vai para q6.") return 'q6' else: print("q2 entrou \"" + palavra + "\"" + " vai para q5.") return 'q5' if estado == 'q3': if (palavra == 'a'): print("q3 entrou \"" + palavra + "\"" + " vai para q8.") return 'q8' else: print("q3 entrou \"" + palavra + "\"" + " vai para q7.") return 'q7' if estado == 'q4': if (palavra == 'a'): print("q4 entrou \"" + palavra + "\"" + " vai para q8.") return 'q8' else: print("q4 entrou \"" + palavra + "\"" + " vai para q9.") return 'q9' if estado == 'q5': if (palavra == 'a'): print("q5 entrou \"" + palavra + "\"" + " vai para q8.") return 'q8' else: print("q5 entrou \"" + palavra + "\"" + " vai para q10.") return 'q10' if estado == 'q6': if (palavra == 'a'): print("q6 entrou \"" + palavra + "\"" + " vai para q8.") return 'q8' else: print("q6 entrou \"" + palavra + "\"" + " vai para q11.") return 'q11' if estado == 'q7': if (palavra == 'a'): print("q7 entrou \"" + palavra + "\"" + " vai para q12.") return 'q12' else: print("q7 entrou \"" + palavra + "\"" + " vai para q7.") return 'q7' if estado == 'q8': if (palavra == 'a'): print("q8 entrou \"" + palavra + "\"" + " vai para q8.") return 'q8' else: print("q8 entrou \"" + palavra + "\"" + " vai para q8.") return 'q8' if estado == 'q9': if (palavra == 'a'): print("q9 entrou \"" + palavra + "\"" + " vai para q13.") return 'q13' else: print("q9 entrou \"" + palavra + "\"" + " vai para q10.") return 'q10' if estado == 'q10': if (palavra == 'a'): print("q10 entrou \"" + palavra + "\"" + " vai para q12.") return 'q12' else: print("q10 entrou \"" + palavra + "\"" + " vai para q7.") return 'q7' if estado == 'q11': if (palavra == 'a'): print("q11 entrou \"" + palavra + "\"" + " vai para q13.") return 'q13' else: print("q11 entrou \"" + palavra + "\"" + " vai para q10.") return 'q10' if estado == 'q12': if (palavra == 'a'): print("q12 entrou \"" + palavra + "\"" + " vai para q14.") return 'q14' else: print("q12 entrou \"" + palavra + "\"" + " vai para q9.") return 'q9' if estado == 'q13': if (palavra == 'a'): print("q13 entrou \"" + palavra + "\"" + " vai para q14.") return 'q14' else: print("q13 entrou \"" + palavra + "\"" + " vai para q9.") return 'q9' if estado == 'q14': if (palavra == 'a'): print("q14 entrou \"" + palavra + "\"" + " vai para q15.") return 'q15' else: print("q14 entrou \"" + palavra + "\"" + " vai para q11.") return 'q11' if estado == 'q15': if (palavra == 'a'): print("q15 entrou \"" + palavra + "\"" + " vai para q15.") return 'q15' else: print("q15 entrou \"" + palavra + "\"" + " vai para q11.") return 'q11' '''palavra = input("Digite uma palavra do alfabeto (a,b) minusculo") estado = ['q0'] i = 0 tam_palavra = len(palavra) while tam_palavra > 0: if estado[i] == 'q0': if(palavra[i] == 'a'): estado.append('q2') tam_palavra -= 1 else: estado.append('q1') tam_palavra -= 1 if estado[i] == 'q1': if(palavra[i] == 'a'): estado.append('q4') tam_palavra -= 1 else: estado.append('q3') tam_palavra -= 1 if estado[i] == 'q2': if(palavra[i] == 'a'): estado.append('q6') tam_palavra -= 1 else: estado.append('q5') tam_palavra -= 1 if estado[i] == 'q3': if(palavra[i] == 'a'): estado.append('q8') tam_palavra -= 1 else: estado.append('q7') tam_palavra -= 1 if estado[i] == 'q4': if(palavra[i] == 'a'): estado.append('q8') tam_palavra -= 1 else: estado.append('q9') tam_palavra -= 1 if estado[i] == 'q5': if(palavra[i] == 'a'): estado.append('q8') tam_palavra -= 1 else: estado.append('q10') tam_palavra -= 1 if estado[i] == 'q6': if(palavra[i] == 'a'): estado.append('q8') tam_palavra -= 1 else: estado.append('q11') tam_palavra -= 1 if estado[i] == 'q7': if(palavra[i] == 'a'): estado.append('q12') tam_palavra -= 1 else: estado.append('q7') tam_palavra -= 1 if estado[i] == 'q8': if(palavra[i] == 'a'): estado.append('q8') tam_palavra -= 1 else: estado.append('q8') tam_palavra -= 1 if estado[i] == 'q9': if(palavra[i] == 'a'): estado.append('q13') tam_palavra -= 1 else: estado.append('q10') tam_palavra -= 1 if estado[i] == 'q10': if(palavra[i] == 'a'): estado.append('q12') tam_palavra -= 1 else: estado.append('q7') tam_palavra -= 1 if estado[i] == 'q11': if(palavra[i] == 'a'): estado.append('q13') tam_palavra -= 1 else: estado.append('q10') tam_palavra -= 1 if estado[i] == 'q12': if(palavra[i] == 'a'): estado.append('q14') tam_palavra -= 1 else: estado.append('q9') tam_palavra -= 1 if estado[i] == 'q13': if(palavra[i] == 'a'): estado.append('q14') tam_palavra -= 1 else: estado.append('q9') tam_palavra -= 1 if estado[i] == 'q14': if(palavra[i] == 'a'): estado.append('q15') tam_palavra -= 1 else: estado.append('q11') tam_palavra -= 1 if estado[i] == 'q15': if(palavra[i] == 'a'): estado.append('q15') tam_palavra -= 1 else: estado.append('q11') tam_palavra -= 1 print("Entrou \"" + palavra[i] + "\" estado " +estado[i+1]) i += 1 if estado[-1] == 'q7' or estado[-1] == 'q9' or estado[-1] == 'q12' or estado[-1] == 'q14': print("Palavra \"" + palavra + "\" do alfabeto \"a,b\" Reconhecida com sucesso") else: print("Palavra \"" + palavra + "\" do alfabeto \"a,b\" Nรฃo reconhecida")''' palavra = input("Digite uma palavra do alfabeto (a,b) em minusculo") palavra_com_vazio = "&"+palavra aux = transicao_estendida('q0',palavra_com_vazio) if aux == 'q7' or aux == 'q9' or aux == 'q12' or aux == 'q14': print("Palavra \""+ palavra+"\" " + "Reconhecida com Sucesso.") else: print("Palavra \"" + palavra + "\" " + "Nรฃo Reconhecida.")
aa96742c1637323518cf8e3c63e7ed393d460c7d
d04ed5c974b8cdf41cf1b9fcd48b9c12ac049c77
/app/__init__.py
050c5d9eb285800470126b37cbf1e9c04fe552f5
[]
no_license
KCzenczek/Flask_MG
5f9a44d30a9f8942e1b5f7a1fceb5fbf6991a654
f3823af347517ff75b275ea75aa4a7d271b06869
refs/heads/main
2023-02-12T03:28:38.115294
2021-01-12T20:17:22
2021-01-12T20:17:22
322,925,083
0
0
null
null
null
null
UTF-8
Python
false
false
1,326
py
from flask import Flask from flask_bootstrap import Bootstrap from flask_mail import Mail from flask_moment import Moment from flask_sqlalchemy import SQLAlchemy from config import config from flask_login import LoginManager from flask_migrate import Migrate from flask_pagedown import PageDown from flask_wtf.csrf import CSRFProtect bootstrap = Bootstrap() mail = Mail() moment = Moment() db = SQLAlchemy() migrate = Migrate() pagedown = PageDown() csrf = CSRFProtect() login_manager = LoginManager() login_manager.login_view = 'auth.login' def create_app(config_name): app = Flask(__name__) app.config.from_object(config[config_name]) config[config_name].init_app(app) bootstrap.init_app(app) mail.init_app(app) moment.init_app(app) db.init_app(app) migrate.init_app(app, db) login_manager.init_app(app) pagedown.init_app(app) csrf.init_app(app) if app.config['SSL_REDIRECT']: from flask_sslify import SSLify sslify = SSLify(app) from .main import main as main_blueprint app.register_blueprint(main_blueprint) from .auth import auth as auth_blueprint app.register_blueprint(auth_blueprint, url_prefix='/auth') from .api import api as api_blueprint app.register_blueprint(api_blueprint, url_prefix='/api/v1') return app
5676c70152b1f096593b050e73984295b82952ee
6674ecfc4a2c0a3a5bdc45b458e7f18e9b134092
/src/lvgl/scripts/release.py
28370c668b96a1bc915498d83c2659b7a44e2049
[ "MIT" ]
permissive
AlexGoodyear/TTGO_TWatch_Library
0ab8b76b0d96cadcf5982bafc028bdf0ad6a5ac4
d982092b2700ba2a4deba8be38bf338ffde855c1
refs/heads/master
2022-12-05T03:26:52.905530
2020-08-21T19:28:45
2020-08-21T19:28:45
276,957,141
5
0
MIT
2020-08-12T10:32:06
2020-07-03T17:46:09
C
UTF-8
Python
false
false
13,699
py
#!/usr/bin/env python # Release lvgl, lv_examples, lv_drivers. docs, blog and prepare the development of the next major, minoror bugfix release # Usage: ./release,py bugfix | minor | major # The option means what type of versin to prepare for development after release # # STEPS: # - clone all 5 repos # - get the version numnber from lvgl.h # - set release branch (e.g. "release/v7") # - prepare lvgl # - run lv_conf_internal.py # - run code formatter # - clear LVGL_VERSION_INFO (set to "") # - run Doxygen # - update the version in lvgl's library.json, library.properties, lv_conf_template.h # - update CHANGELOG.md # - commit changes # - prepare lv_examples # - upadte the required LVGL version in lv_examples.h (LV_VERSION_CHECK) # - update the version in lv_ex_conf_template.h # - prepare lv_drivers # - update the version in library.json, lv_drv_conf_template.h # - prepare docs # - update API XML # - clear the versiopn info (should be plain vx.y.z) # - tag all repos with the new version # - merge to release branches # - blog: add release post # - push tags and commits # - docs: run ./updade.py release/vX # # If --patch # - merge master to dev branches # - increment patch version by 1 and append "-dev". E.g. "vX.Y.(Z+1)-dev" # - update version numbers in lvgl and docs # - commit and push # - docs: run ./updade.py latest dev # # Else (not --patch) # - merge master to dev # - merge the dev to master # - increment version number like "vX.(Y+1).0-dev" # - apply the new version in dev branches of lvgl, lv_examples, lv_drivers, docs # - commit and push to dev branches # - docs: run ./updade.py latest dev import re import os, fnmatch import os.path from os import path from datetime import date import sys upstream_org_url = "https://github.com/lvgl/" workdir = "./release_tmp" ver_major = -1 ver_minor = -1 ver_patch = -1 ver_str = "" dev_ver_str = "" release_br = "" release_note = "" prepare_type = ['major', 'minor', 'bugfix'] dev_prepare = 'minor' def upstream(repo): return upstream_org_url + repo + ".git" def cmd(c, exit_on_err = True): print("\n" + c) r = os.system(c) if r: print("### Error: " + str(r)) if exit_on_err: exit(int(r)) def define_set(fn, name, value): print("In " + fn + " set " + name + " to " + value) new_content = "" f = open(fn, "r") for i in f.read().splitlines(): r = re.search(r'^ *# *define +' + name, i) if r: d = i.split("define") i = d[0] + "define " + name + " " + value new_content += i + '\n' f.close() f = open(fn, "w") f.write(new_content) f.close() def clone_repos(): cmd("rm -fr " + workdir) cmd("mkdir " + workdir) os.chdir(workdir) #For debuging just copy the repos #cmd("cp -a ../repos/. .") #return cmd("git clone " + upstream("lvgl") + " lvgl; cd lvgl; git checkout master") cmd("git clone " + upstream("lv_examples") + "; cd lv_examples; git checkout master") cmd("git clone " + upstream("lv_drivers") + "; cd lv_drivers; git checkout master") cmd("git clone --recurse-submodules " + upstream("docs") + "; cd docs; git checkout master") cmd("git clone " + upstream("blog") + "; cd lv_drivers; git checkout blog") def get_lvgl_version(br): print("Get LVGL's version") global ver_str, ver_major, ver_minor, ver_patch, release_br os.chdir("./lvgl") cmd("git checkout " + br) f = open("./lvgl.h", "r") lastNum = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+') for i in f.read().splitlines(): r = re.search(r'^#define LVGL_VERSION_MAJOR ', i) if r: m = lastNum.search(i) if m: ver_major = m.group(1) r = re.search(r'^#define LVGL_VERSION_MINOR ', i) if r: m = lastNum.search(i) if m: ver_minor = m.group(1) r = re.search(r'^#define LVGL_VERSION_PATCH ', i) if r: m = lastNum.search(i) if m: ver_patch = m.group(1) f.close() cmd("git checkout master") ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch) print("New version:" + ver_str) release_br = "release/v" + ver_major os.chdir("../") def update_version(): templ = fnmatch.filter(os.listdir('.'), '*templ*') if templ[0]: print("Updating version in " + templ[0]) cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' " + templ[0]) if os.path.exists("library.json"): print("Updating version in library.json") cmd("sed -i -r 's/[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str[1:] +"/' library.json") if path.exists("library.properties"): print("Updating version in library.properties") cmd("sed -i -r 's/version=[0-9]+\.[0-9]+\.[0-9]+/"+ "version=" + ver_str[1:] + "/' library.properties") def lvgl_prepare(): print("Prepare lvgl") global ver_str, ver_major, ver_minor, ver_patch os.chdir("./lvgl") define_set("./lvgl.h", "LVGL_VERSION_INFO", '\"\"') # Run some scripts os.chdir("./scripts") cmd("./code-format.sh") cmd("./lv_conf_checker.py") cmd("doxygen") os.chdir("../") update_version() #update CHANGLELOG new_content = "" f = open("./CHANGELOG.md", "r") global release_note release_note = "" note_state = 0 for i in f.read().splitlines(): if note_state == 0: r = re.search(r'^## ' + ver_str, i) if r: i = i.replace("planned on ", "") note_state+=1 elif note_state == 1: r = re.search(r'^## ', i) if r: note_state+=1 else: release_note += i + '\n' new_content += i + '\n' f.close() f = open("./CHANGELOG.md", "w") f.write(new_content) f.close() cmd('git commit -am "prepare to release ' + ver_str + '"') os.chdir("../") def lv_examples_prepare(): print("Prepare lv_examples") global ver_str, ver_major, ver_minor, ver_patch os.chdir("./lv_examples") update_version() cmd("sed -i -r 's/LV_VERSION_CHECK\([0-9]+, *[0-9]+, *[0-9]+\)/"+ "LV_VERSION_CHECK(" + ver_major + ", " + ver_minor + ", " + ver_patch + ")/' lv_examples.h") cmd('git commit -am "prepare to release ' + ver_str + '"') os.chdir("../") def lv_drivers_prepare(): print("Prepare lv_drivers") global ver_str, ver_major, ver_minor, ver_patch os.chdir("./lv_drivers") update_version() cmd('git commit -am "prepare to release ' + ver_str + '"') os.chdir("../") def docs_prepare(): print("Prepare docs") global ver_str, ver_major, ver_minor, ver_patch os.chdir("./docs") cmd("git co latest --") cmd("rm -rf xml"); cmd("cp -r ../lvgl/docs/api_doc/xml ."); cmd("git add xml"); cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py") cmd('git commit -am "prepare to release ' + ver_str + '"') os.chdir("../") def blog_add_post(): global ver_str, release_note os.chdir("./blog/_posts") post = "---\nlayout: post\ntitle: " + ver_str + " is released\nauthor: \"kisvegabor\"\ncover: /assets/release_cover.png\n---\n\n" post += release_note today = date.today() d = today.strftime("%Y-%m-%d") f = open(d + "_release_" + ver_str + ".md", "w") f.write(post) f.close() cmd("git add .") cmd("git commit -am 'Add " + ver_str + " release post'") os.chdir("../../") def add_tags(): global ver_str tag_cmd = " git tag -a " + ver_str + " -m 'Release " + ver_str + "' " cmd("cd lvgl; " + tag_cmd) cmd("cd lv_examples; " + tag_cmd) cmd("cd lv_drivers; " + tag_cmd) cmd("cd docs; " + tag_cmd) def update_release_branches(): global release_br merge_cmd = " git checkout " + release_br + "; git pull origin " + release_br + "; git merge master -X ours; git push origin " + release_br + "; git checkout master" cmd("cd lvgl; " + merge_cmd) cmd("cd lv_examples; " + merge_cmd) cmd("cd lv_drivers; " + merge_cmd) merge_cmd = " git checkout " + release_br + "; git pull origin " + release_br + "; git merge latest -X ours; git push origin " + release_br + "; git checkout latest" cmd("cd docs; " + merge_cmd) def publish_master(): pub_cmd = "git push origin master; git push origin " + ver_str cmd("cd lvgl; " + pub_cmd) cmd("cd lv_examples; " + pub_cmd) cmd("cd lv_drivers; " + pub_cmd) pub_cmd = "git push origin latest; git push origin " + ver_str cmd("cd docs; " + pub_cmd) cmd("cd docs; git checkout master; ./update.py " + release_br) pub_cmd = "git push origin master" cmd("cd blog; " + pub_cmd) def merge_to_dev(): merge_cmd = "git checkout dev; git merge master -X ours; git checkout master" cmd("cd lvgl; " + merge_cmd) merge_cmd = "git checkout dev; git merge latest -X ours; git checkout master" cmd("cd docs; " + merge_cmd) def merge_from_dev(): merge_cmd = "git checkout master; git merge dev;" cmd("cd lvgl; " + merge_cmd) merge_cmd = "git checkout latest; git merge dev;" cmd("cd docs; " + merge_cmd) def lvgl_update_master_version(): global ver_major, ver_minor, ver_patch, ver_str os.chdir("./lvgl") cmd("git checkout master") define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major) define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor) define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch) define_set("./lvgl.h", "LVGL_VERSION_INFO", "dev") templ = fnmatch.filter(os.listdir('.'), '*templ*') if templ[0]: print("Updating version in " + templ[0]) cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' " + templ[0]) cmd("git commit -am 'Update version'") os.chdir("../") def docs_update_latest_version(): global ver_str os.chdir("./docs") cmd("git checkout latest --") cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py") cmd("git commit -am 'Update version'") cmd("git checkout master --") os.chdir("../") def lvgl_update_dev_version(): global ver_major, ver_minor, ver_patch, dev_ver_str os.chdir("./lvgl") cmd("git checkout dev") define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major) define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor) define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch) define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"dev\"") templ = fnmatch.filter(os.listdir('.'), '*templ*') if templ[0]: print("Updating version in " + templ[0]) cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ dev_ver_str +"/' " + templ[0]) cmd("git commit -am 'Update dev version'") cmd("git checkout master") os.chdir("../") def docs_update_dev_version(): global dev_ver_str os.chdir("./docs") cmd("git checkout dev --") cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + dev_ver_str + "'/\" conf.py") cmd("git commit -am 'Update dev version'") cmd("git checkout master --") os.chdir("../") def publish_dev(): pub_cmd = "git checkout dev; git push origin dev" cmd("cd lvgl; " + pub_cmd) pub_cmd = "git checkout dev; git push origin dev" cmd("cd docs; " + pub_cmd) cmd("cd docs; git checkout master; ./update.py latest dev") def cleanup(): os.chdir("../") cmd("rm -fr " + workdir) if __name__ == '__main__': if(len(sys.argv) != 2): print("Argument error. Usage ./release.py bugfix | minor | major") exit(1) dev_prepare = sys.argv[1] if not (dev_prepare in prepare_type): print("Invalid argument. Usage ./release.py bugfix | minor | major") exit(1) clone_repos() get_lvgl_version("master") lvgl_prepare() lv_examples_prepare() lv_drivers_prepare() docs_prepare() blog_add_post() add_tags() update_release_branches() publish_master() if dev_prepare == 'bugfix': ver_patch = str(int(ver_patch) + 1) ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev" print("Prepare bugfix version " + ver_str) lvgl_update_master_version() docs_update_latest_version() get_lvgl_version("dev") dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev" merge_to_dev() lvgl_update_dev_version() docs_update_dev_version() publish_dev() else: get_lvgl_version("dev") if dev_prepare == 'minor': ver_minor = str(int(ver_minor) + 1) ver_patch = "0" else: ver_major = str(int(ver_major) + 1) ver_minor = "0" ver_patch = "0" dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev" print("Prepare minor version " + ver_str) merge_to_dev() merge_from_dev() lvgl_update_dev_version() docs_update_dev_version() publish_dev() cleanup()
68d0e1293ce58896cd7ef5a2be74639b3686fcb9
7f50d37ba987fade8bce93fb10286292a9a0d7e1
/sentry.conf.py
f381b1ea1c92503f43337372fa43c0fff2a7968e
[]
no_license
rochacon/docker-sentry
db4ac5be75392b6d7fdabdf211532b3b5b9eca34
32d41ab39a2dbc222e5ed6080ca943b2225cc07a
refs/heads/master
2021-01-18T14:06:01.265851
2014-10-27T19:02:54
2014-10-27T19:02:54
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,043
py
# /etc/sentry.conf.py # edit this to your liking import os import dj_database_url DATABASES = {'default': dj_database_url.config()} # No trailing slash! SENTRY_URL_PREFIX = 'http://127.0.0.1.xip.io' # FIXME modify this to your domain # SENTRY_KEY is a unique randomly generated secret key for your server, and it # acts as a signing token SENTRY_KEY = '0123456789abcde' # FIXME modify this to an unique key SENTRY_WEB_HOST = '0.0.0.0' SENTRY_WEB_PORT = 9000 SENTRY_WEB_OPTIONS = { 'workers': 3, # the number of gunicorn workers 'secure_scheme_headers': {'X-FORWARDED-PROTO': 'https'}, # detect HTTPS mode from X-Forwarded-Proto header } _redis_endpoint = os.environ.get('REDIS_ENDPOINT', '127.0.0.1:6379') SENTRY_REDIS_OPTIONS = { 'hosts': { 0: { 'host': _redis_endpoint.split(':')[0], 'port': _redis_endpoint.split(':')[1], } } } # TODO #EMAIL_HOST = 'localhost' #EMAIL_HOST_PASSWORD = '' #EMAIL_HOST_USER = '' #EMAIL_PORT = 25 #EMAIL_USE_TLS = False ALLOWED_HOSTS = ['*']
3652511f4a3c2e9b77748a3cf8132b152949bf44
ffe4c155e228f1d3bcb3ff35265bb727c684ec1a
/Codes/Quiz/number_of_factors.py
68ce727aa40589c018b92480a89b9de9e4e47ed7
[]
no_license
yuuee-www/Python-Learning
848407aba39970e7e0058a4adb09dd35818c1d54
2964c9144844aed576ea527acedf1a465e9a8664
refs/heads/master
2023-03-12T00:55:06.034328
2021-02-28T13:43:14
2021-02-28T13:43:14
339,406,816
0
0
null
2021-02-28T11:27:40
2021-02-16T13:26:46
Jupyter Notebook
UTF-8
Python
false
false
269
py
def numberOfFactors(num): ans = 1 x = 2 while x * x <= num: cnt = 1 while num % x == 0: cnt += 1 num /= x ans = cnt x += 1 return ans * (1 + (num > 1)) n = int(input()) print(numberOfFactors(n))
e61843b913feb2b63ff73da2ce6702eab8d0d073
618408b7e89798b8a745ae5aaf6a098d17af5468
/luo_hao_reid/transforms.py
7ee514ed3d24e9d5a768d03e943565419472a3ee
[ "MIT" ]
permissive
Mr-Da-Yang/Python_learning
3fc832325aa9aff4e11a15cad5b3636918dd61bc
23586139fc44fe76c7dbcd83929a1804485be5f4
refs/heads/master
2023-01-08T21:35:42.324510
2020-10-26T13:01:02
2020-10-26T13:01:02
281,889,544
0
0
null
null
null
null
UTF-8
Python
false
false
2,316
py
'''OK transformๅฎž็Žฐๆ•ฐๆฎๅขžๅนฟ๏ผŒpytorchไธญ่‡ชๅธฆ็š„้šๆœบ็ฟป่ฝฌ๏ผŒๅ‰ชๅˆ‡ๅฏไปฅ่งฃๅ†ณ90%็š„้—ฎ้ข˜๏ผŒไธ‹้ขๆ˜ฏ่‡ชๅทฑๅฆ‚ไฝ•ๅšไธ€ไธชtransform ''' from __future__ import absolute_import from torchvision.transforms import * from PIL import Image import random import numpy as np import matplotlib.pyplot as plt class Random2DTranslation(object):#้šๆœบๆ”พๅคงๅนถcrop """ With a probability, first increase image size to (1 + 1/8), and then perform random crop. Args: height (int): target height. width (int): target width. p (float): probability of performing this transformation. Default: 0.5. """ def __init__(self, height,width, p=0.5, interpolation=Image.BILINEAR): self.height = height self.width = width self.p = p self.interpolation = interpolation#ๆ”พๅคงๆ—ถ็”จ็š„ๆ’ๅ€ผ def __call__(self, img): """ Args: img (PIL Image): Image to be cropped. Returns: PIL Image: Cropped image. """ if random.random() < self.p:#randomไบง็”Ÿไธ€ไธช0-1ๅˆ†ๆญฅ็š„้šๆœบๆ•ฐ๏ผŒ่‹ฅๆ•ฐๅญ—ๅฐไบŽP๏ผŒๅฐฑไธ่ฟ›่กŒๆ•ฐๆฎๅขžๅนฟ return img.resize((self.width, self.height), self.interpolation) new_width, new_height = int(round(self.width * 1.125)), int(round(self.height * 1.125))#ๆ”พๅคง1/8/roundๅ–ไธŠ้™๏ผŒๅŠ ไธŠintๆ›ด็จณ resized_img = img.resize((new_width, new_height), self.interpolation) x_maxrange = new_width - self.width y_maxrange = new_height - self.height#crop็š„ๆœ€ๅคง่Œƒๅ›ด x1 = int(round(random.uniform(0, x_maxrange)))#crop็š„่ตทๅง‹็‚น y1 = int(round(random.uniform(0, y_maxrange))) croped_img = resized_img.crop((x1, y1, x1 + self.width, y1 + self.height)) return croped_img # if __name__ == '__main__': # import torchvision.transforms as transform # img=Image.open('E:\LINYANG\python_project\luohao_person_reid\dataset\Market-1501-v15.09.15\query\\0004_c1s6_016996_00.jpg') # # transform=transform.Compose([ # Random2DTranslation(128, 256, 0.5), # transforms.RandomHorizontalFlip(p=0.8), # #transform.ToTensor() # ]) # img_t=transform(img) # plt.subplot(121) # plt.imshow(img) # plt.subplot(122) # plt.imshow(img_t) # plt.show()
7e1adfe0c0fd5a509cb006c917e00fe88395a01b
00cb09b91cfccb285be8acd86da9612defd003d7
/python/infrastructure/lib/command_interface.py
3d080c16bb83e6e59f78ff89f8586dc42afd6ed7
[]
no_license
jasonraimondi/flask-command-query
8838fa61211f0e568e02e5b4ce37a6bff04d850d
678b7d3f48a5c40b06c122302727392f982482e3
refs/heads/master
2021-05-07T08:31:00.273681
2017-11-15T03:15:51
2017-11-15T03:15:51
109,299,679
0
0
null
null
null
null
UTF-8
Python
false
false
91
py
class CommandInterface(object): def execute(self): raise NotImplementedError()
cf27aee94cb1f21c671752c877f0bda9db9d2401
025765a4289ad9229225f6627a5a1eaa56fe7726
/Module/Test8.py
72dd475a2d82df1ea67f60054c03e3f2e584cca1
[]
no_license
dongyeon94/Kiwoom_Open_API
dc12b85623994314f4d045a5dda6d5bc7c3e5ef2
df3bca5f6f8ce92a34947f28b21e277693560e05
refs/heads/master
2022-09-07T02:55:03.235742
2020-05-23T15:23:28
2020-05-23T15:23:28
243,203,485
0
0
null
null
null
null
UTF-8
Python
false
false
33,087
py
import sys from PyQt5.QtWidgets import * from PyQt5.QAxContainer import * from PyQt5.QtCore import pyqtSlot, QTimer, QObject, QThread, QTime import datetime import time import threading global current_data current_data = 0 CODE = "CLJ20" # crude oil COM_DATE = datetime.datetime.now().strftime('%Y%m%d%H%M%S') sale_time = None bong_start = None bong_end = None # Head for Doubly LinkedList(๋งค์ˆ˜ํ•œ ์„ ๋ฌผ ๋ฆฌ์ŠคํŠธ) head = None # ์ง„์ž… ํƒ€์ž… type_buy = 2 # ๋งค์ˆ˜ ์ง„์ž… type_sell = 1 # ๋งค๋„ ์ง„์ž… #์ง„์ž… ํ”Œ๋ž˜๊ทธ transaction_flag = False # ์ง„์ž… ํŒ๋‹จ ํŒŒ๋ผ๋ฏธํ„ฐ bongP = 0 bongPlus = None # ๋งˆ์ง€๋ง‰ ๊ฐ€๊ฒฉ. ์ฒซ ๊ฐ€๊ฒฉ์œผ๋กœ ์ž๋™์œผ๋กœ ๋ฐ”๋€œ. lastTickPrice = None debug_file_started = False # Hardcoded numBought = 1 total = 0 class MyWindow(QMainWindow): def __init__(self): # ์ดˆ๊ธฐ setup ๋ชจ๋“ˆ ๋กœ๋”ฉ ๋“ฑ super().__init__() self.setWindowTitle("PyStock") self.setGeometry(300, 150, 400, 800) self.kiwoom = QAxWidget("KFOpenAPI.KFOpenAPICtrl.1") # ์ž…๋ ฅ ๊ธฐ๋Šฅ ์ •๋ฆฌ self.account = QLineEdit(self) self.account.move(200, 20) self.account.resize(100, 30) self.account.setPlaceholderText('๊ณ„์ขŒ๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”') self.password = QLineEdit(self) self.password.move(200, 70) self.password.resize(100, 30) self.password.setPlaceholderText('๋น„๋ฐ€๋ฒˆํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”') self.stoct_code = QLineEdit(self) self.stoct_code.move(200, 120) self.stoct_code.resize(100, 30) self.stoct_code.setPlaceholderText('์ข…๋ชฉ ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”') self.stoct_num = QLineEdit(self) self.stoct_num.move(200, 170) self.stoct_num.resize(100, 30) self.stoct_num.setPlaceholderText('์ฃผ๋ฌธ๋Ÿ‰') # option - version - self.ChekGroup1 = QCheckBox('option1', self) self.ChekGroup1.move(200, 220) self.ChekGroup1.clicked.connect(self.checkbox) self.ChekGroup2 = QCheckBox('option2', self) self.ChekGroup2.move(200, 245) self.ChekGroup2.clicked.connect(self.checkbox) self.starttime = QTimeEdit(self) self.starttime.setDisplayFormat("hh:mm:ss") self.starttime.move(200, 280) self.endtime = QTimeEdit(self) self.endtime.setDisplayFormat("hh:mm:ss") self.endtime.move(200, 320) self.endtime.setTime(QTime(23, 59,59)) # ๋””๋ฒ„๊น… ๋ชจ๋“œ self.debug_check = QCheckBox('๋””๋ฒ„๊น…๋ชจ๋“œ', self) self.debug_check.move(200, 600) self.debug_check.clicked.connect(self.debug_check_fun) self.debug_file = QPushButton('๋””๋ฒ„๊น… ํŒŒ์ผ', self) self.debug_file.move(200, 650) self.debug_file.clicked.connect(self.debug_file_fun) self.debug_file_obj = None self.option_warning = QMessageBox(self) self.option_warning.resize(300,500) # ์‹œ์ž‘ module_start = QPushButton('๊ฑฐ๋ž˜ ์‹œ์ž‘', self) module_start.move(200, 450) module_start.clicked.connect(self.data_loading) # ๋กœ๊ทธ์ธ login_btn = QPushButton("๋กœ๊ทธ์ธ", self) login_btn.move(20, 20) login_btn.clicked.connect(self.login_clicked) info_btn = QPushButton('๋กœ๊ทธ์ธ ํ™•์ธ', self) info_btn.move(20, 70) info_btn.clicked.connect(self.login_info) search_btm = QPushButton('์ฃผ์‹ ์กฐํšŒ', self) search_btm.move(20, 170) search_btm.clicked.connect(self.subject_search) buy_btn = QPushButton('๋งค์ˆ˜๋ฒ„ํŠผ', self) buy_btn.move(20, 270) buy_btn.clicked.connect(self.stock_buy_order) sale_btn = QPushButton('๋งค๋„ ๋ฒ„ํŠผ', self) sale_btn.move(20, 320) sale_btn.clicked.connect(self.stock_sale_order) # ๋ฐ์ดํ„ฐ ์ˆ˜์‹  ์ด๋ฒคํŠธ self.kiwoom.OnReceiveTrData.connect(self.receive_trdata) self.kiwoom.OnReceiveChejanData.connect(self.get_transaction_data) # ๋กœ๊ทธํŒŒ์ผ self.log_file = None test_ = QPushButton(' ํ…Œ์ŠคํŠธ', self) test_.move(20, 600) test_.clicked.connect(self.get_transaction_data) self.stoct_code.setText('CLK20') self.stoct_num.setText('1') def test1(self): print('test22') # data = self.test() # data = self.kiwoom.OnReceiveChejanData.connect(self.test) # print(data) def get_transaction_data(self, sGubun, nItemCnt): global transaction_flag # ๋งค์ˆ˜ 2 ๋งค๋„ 1 if sGubun == '1' and transaction_flag: print('test์ค‘') price = float(self.kiwoom.GetChejanData(910)) type_buy = int(self.kiwoom.GetChejanData(907)) sale_time = int(self.kiwoom.GetChejanData(908)) ll_append(Transaction(type_buy, price, numBought)) if type_buy == 2: pri = round(price + 0.03, 2) self.log_file.write(str(sale_time) + ',' + str(True) + ',_,' + str(0) + + "," + str(price) + '์— ๋งค์ˆ˜ ์ง„์ž…,' + str(pri) + '์— ๋งค๋„ ์˜ˆ์•ฝ\n') self.stock_sale_order(pri) else: pri = round(price - 0.03, 2) self.log_file.write(str(sale_time) + ',' + str(True) + ',_,' + str(0) + "," + str(price) + '์— ๋งค๋„ ์ง„์ž…,' + str(pri) + '์— ๋งค์ˆ˜ ์˜ˆ์•ฝ\n') self.stock_buy_order(pri) transaction_flag = False def get_transaction_data_debug(self, price, type_buy, sale_time, bongP): global transaction_flag print('test์ค‘') ll_append(Transaction(type_buy, price, numBought)) transaction_flag = False if type_buy == type_buy: pri = round(price + 0.03, 2) print(str(sale_time) + ',' + str(True) + ',' + str(price) + ',' + str(bongP) + "," + str(price) + '์— ๋งค์ˆ˜ ์ง„์ž…,' + str(pri) + '์— ๋งค๋„ ์˜ˆ์•ฝ') else: pri = round(price - 0.03, 2) print(str(sale_time) + ',' + str(True) + ',' + str(price) + ',' + str(bongP) + "," + str(price) + '์— ๋งค๋„ ์ง„์ž…,' + str(pri) + '์— ๋งค์ˆ˜ ์˜ˆ์•ฝ') def debug_check_fun(self): if self.debug_check.isChecked(): return True else: return False def debug_file_fun(self): fname = QFileDialog.getOpenFileName(self, 'Open file', "", "All Files(*);; Python Files(*.py)", '/home') if not fname[0]: QMessageBox.about(self, "Warning", "ํŒŒ์ผ์„ ์„ ํƒํ•˜์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค.") else: self.debug_file_name = fname[0] def run(self, price, bongPlus, tickFlag, bongFlag, sale_time, option): global head, type_sell, type_buy, bongP, lastTickPrice, total, transaction_flag if self.debug_check_fun() is False and self.log_file is None: self.log_file = open('log' + COM_DATE + '_๊ฑฐ๋ž˜.csv', mode='wt', encoding='utf-8') self.log_file.write('์ฒด๊ฒฐ์‹œ๊ฐ„,BongFlag,๊ฐ€๊ฒฉ,๋ด‰์นด์šดํŠธ,๊ฑฐ๋ž˜๋‚ด์—ญ\n') self.log_file.flush() if price is None: return if lastTickPrice == None: lastTickPrice = price if self.debug_check_fun() is False: self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + "," + str(bongP) + '\n') self.log_file.flush() else: print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + "," + str(bongP)) return curr = head while curr is not None: tickSold = False if tickFlag: if price > lastTickPrice: curr.tickP += 1 elif price < lastTickPrice: curr.tickP -= 1 if curr.type == type_buy: # Option2: ๋งค์ˆ˜๊ฑฐ๋ž˜๊ฐ€ 3ํ‹ฑ์ด์ƒ ์˜ฌ๋ž์„๋•Œ ๋งค๋„ if curr.tickP == 3: if self.debug_check_fun() is False: self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt2_์ต์ ˆ $' + str(curr.price) + '์— ๋งค์ˆ˜ ํ›„ $' + str(price) + '์— ๋งค๋„\n') else: print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt2_์ต์ ˆ $' + str(curr.price) + '์— ๋งค์ˆ˜ ํ›„ $' + str(price) + '์— ๋งค๋„') # ์ต์ ˆ์€ ์˜ˆ์•ฝ์—์„œ ์•Œ์•„์„œ ํŒ”๋ฆผ remove_elem(curr) tickSold = True total += (price - curr.price) * numBought # Option4: ๋งค์ˆ˜๊ฑฐ๋ž˜๊ฐ€ 6ํ‹ฑ์ด์ƒ ํ•˜๋ฝํ–ˆ์„๋•Œ ๋งค๋„ elif curr.tickP == -6: if self.debug_check_fun() is False: self.stock_buy_wait() self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt4_์†์ ˆ $' + str(curr.price) + '์— ๋งค์ˆ˜ ํ›„ $' + str(price) + '์— ๋งค๋„\n') else: print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt4_์†์ ˆ $' + str(curr.price) + '์— ๋งค์ˆ˜ ํ›„ $' + str(price) + '์— ๋งค๋„') remove_elem(curr) tickSold = True total += (price - curr.price) * numBought else: # Option2_reverse: ๋งค๋„๊ฑฐ๋ž˜๊ฐ€ 3ํ‹ฑ์ด์ƒ ๋‚ด๋ ธ์„ ๋•Œ ๋งค๋„ if curr.tickP == -3: if self.debug_check_fun() is False: self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt2r_์ต์ ˆ $' + str(curr.price) + '์— ๋งค๋„ ํ›„ $' + str(price) + '์— ๋งค์ˆ˜\n') else: print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt2r_์ต์ ˆ $' + str(curr.price) + '์— ๋งค๋„ ํ›„ $' + str(price) + '์— ๋งค์ˆ˜') remove_elem(curr) tickSold = True total += (price - curr.price) * numBought # Option4_reverse: ๋งค๋„๊ฑฐ๋ž˜๊ฐ€ 6ํ‹ฑ์ด์ƒ ์ƒ์Šนํ–ˆ์„๋•Œ ๋งค๋„ elif curr.tickP == 6: if self.debug_check_fun() is False: self.stock_sale_wait() self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt4r_์†์ ˆ $' + str(curr.price) + '์— ๋งค๋„ ํ›„ $' + str(price) + '์— ๋งค์ˆ˜\n') else: print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt4r_์†์ ˆ $' + str(curr.price) + '์— ๋งค๋„ ํ›„ $' + str(price) + '์— ๋งค์ˆ˜') remove_elem(curr) tickSold = True total += (price - curr.price) * numBought if bongFlag and not tickSold: curr.bongCount += 1 if bongPlus > 0: curr.bongP += 1 elif bongPlus < 0: curr.bongP -= 1 if curr.type == type_buy: if curr.bongP == -1 and curr.bongCount == 2: # Option3: ๋งค์ˆ˜์ง„์ž… ์งํ›„ ๋งˆ์ด๋„ˆ์Šค ๋ด‰์ผ๋•Œ ๋ฐ”๋กœ ํŒœ (์ง„์ž…ํ•œ ๋ด‰์€ ๋ฌด์‹œ) if self.debug_check_fun() is False: self.stock_buy_wait() self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt3_์†์ ˆ $' + str(curr.price) + '์— ๋งค์ˆ˜ ํ›„ $' + str(price) + '์— ๋งค๋„\n') else: print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt3_์†์ ˆ $' + str(curr.price) + '์— ๋งค์ˆ˜ ํ›„ $' + str(price) + '์— ๋งค๋„') remove_elem(curr) total += (price - curr.price) * numBought else: if curr.bongP == 1 and curr.bongCount == 2: # Option3_reverse: ๋งค๋„์ง„์ž… ์งํ›„ ํ”Œ๋Ÿฌ์Šค ๋ด‰์ผ๋•Œ ๋ฐ”๋กœ ํŒœ (์ง„์ž…ํ•œ ๋ด‰์€ ๋ฌด์‹œ) if self.debug_check_fun() is False: self.stock_sale_wait() self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt3r_์†์ ˆ $' + str(curr.price) + '์— ๋งค๋„ ํ›„ $' + str(price) + '์— ๋งค์ˆ˜\n') else: print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( bongP) + ',' + 'opt3r_์†์ ˆ $' + str(curr.price) + '์— ๋งค๋„ ํ›„ $' + str(price) + '์— ๋งค์ˆ˜') remove_elem(curr) total += (price - curr.price) * numBought curr = curr.next if bongFlag: if bongP is None: if bongPlus > 0: bongP = 1 elif bongPlus < 0: bongP = -1 else: bongP = 0 else: if option[0] == '1' and bongP <= -3: if bongPlus > 0: # ๋งค์ˆ˜์ง„์ž…: bong 3๋ฒˆ ๋‚ด๋ ค๊ฐ”๋‹ค๊ฐ€ ํ•œ๋ฒˆ ์˜ค๋ฅด๋ฉด '์‚ผ' transaction_flag = True # pri = round(price + 0.03, 2) if self.debug_check_fun() is False: print('๋งค์ˆ˜ ์ง„์ž…', price) self.stock_buy_order() # time.sleep(1) # self.stock_sale_order(pri) # self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( # bongP + '\n')) else: # print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str(bongP)) self.get_transaction_data_debug(price, 2, sale_time, bongP) # ll_append(Transaction(type_buy, price, numBought)) elif option[1] == '1' and bongP >= 3: if bongPlus < 0: transaction_flag = True # ๋งค๋„์ง„์ž…: bong 3๋ฒˆ ์˜ฌ๋ž๋‹ค๊ฐ€ ํ•œ๋ฒˆ ๋‚ด๋ฆฌ๋ฉด ์‚ผ # pri = round(price - 0.03, 2) if self.debug_check_fun() is False: print('๋งค๋„ ์ง„์ž…', price) self.stock_sale_order() # time.sleep(1) # self.stock_buy_order(pri) # self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str( # bongP + '\n')) else: # print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str(bongP)) self.get_transaction_data_debug(price, 1, sale_time, bongP) # ll_append(Transaction(type_sell, price, numBought)) if bongPlus > 0: if bongP > 0: bongP += 1 else: bongP = 1 elif bongPlus < 0: if bongP < 0: bongP -= 1 else: bongP = -1 lastTickPrice = price if self.debug_check_fun() is False: self.log_file.write(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str(bongP) + '\n') self.log_file.flush() else: print(str(sale_time) + ',' + str(bongFlag) + ',' + str(price) + ',' + str(bongP)) # ------ ์ฃผ์‹ ์ฃผ๋ฌธ start ------- # ์ฃผ์‹ ๋งค์ˆ˜ def stock_buy_order(self, price=0): print('๋งค์ˆ˜์ค‘', price) getPrice = 0 # ๊ตฌ๋ถ„ , ํ™”๋ฉด๋ฒˆํ˜ธ , ๊ณ„์ขŒ , ์ฃผ๋ฌธ์œ ํ˜• ,์ข…๋ชฉ์ฝ”๋“œ, ๊ฐœ์ˆ˜,๊ฐ€๊ฒฉ, stop๊ฐ€๊ฒฉ, ๊ฑฐ๋ž˜๊ตฌ๋ถ„, ์ฃผ๋ฌธ๋ฒˆํ˜ธ if price == 0: data = self.kiwoom.SendOrder('์ฃผ์‹๋งค์ˆ˜', "1211", self.account.text(), 2, self.stoct_code.text(), int(self.stoct_num.text()), str(price), "", "1", "") else: data = self.kiwoom.SendOrder('์ฃผ์‹๋งค์ˆ˜', "1211", self.account.text(), 2, self.stoct_code.text(), int(self.stoct_num.text()), str(price), "", "2", "") return getPrice # ์ฃผ์‹ ๋งค๋„ def stock_sale_order(self, price=0): print('๋งค๋„์ค‘', price) # ๊ตฌ๋ถ„ , ํ™”๋ฉด๋ฒˆํ˜ธ , ๊ณ„์ขŒ , ์ฃผ๋ฌธ์œ ํ˜• ,์ข…๋ชฉ์ฝ”๋“œ, ๊ฐœ์ˆ˜,๊ฐ€๊ฒฉ, stop๊ฐ€๊ฒฉ, ๊ฑฐ๋ž˜๊ตฌ๋ถ„, ์ฃผ๋ฌธ๋ฒˆํ˜ธ if price == 0: data = self.kiwoom.SendOrder('์ฃผ์‹๋งค๋„', "1212", self.account.text(), 1, self.stoct_code.text(), int(self.stoct_num.text()), str(price), "", "1", "") else: data = self.kiwoom.SendOrder('์ฃผ์‹๋งค๋„', "1212", self.account.text(), 1, self.stoct_code.text(), int(self.stoct_num.text()), str(price), "", "2", "") # ์ฃผ์‹ ๋งค๋„ ์ •์ • ์ทจ์†Œ def stock_sale_modify(self, code): # ๊ตฌ๋ถ„ , ํ™”๋ฉด๋ฒˆํ˜ธ , ๊ณ„์ขŒ , ์ฃผ๋ฌธ์œ ํ˜• ,์ข…๋ชฉ์ฝ”๋“œ, ๊ฐœ์ˆ˜,๊ฐ€๊ฒฉ, stop๊ฐ€๊ฒฉ, ๊ฑฐ๋ž˜๊ตฌ๋ถ„, ์ฃผ๋ฌธ๋ฒˆํ˜ธ data = self.kiwoom.SendOrder('์ฃผ์‹์ •์ •', "1213", self.account.text(), 3, self.stoct_code.text(), int(self.stoct_num.text()), "0", "0", "2", str(code[6:])) time.sleep(1) print(data) self.stock_sale_order() # ์ฃผ์‹ ๋งค์ˆ˜ ์ •์ • ์ทจ์†Œ def stock_buy_modify(self, code): # ๊ตฌ๋ถ„ , ํ™”๋ฉด๋ฒˆํ˜ธ , ๊ณ„์ขŒ , ์ฃผ๋ฌธ์œ ํ˜• ,์ข…๋ชฉ์ฝ”๋“œ, ๊ฐœ์ˆ˜,๊ฐ€๊ฒฉ, stop๊ฐ€๊ฒฉ, ๊ฑฐ๋ž˜๊ตฌ๋ถ„, ์ฃผ๋ฌธ๋ฒˆํ˜ธ data = self.kiwoom.SendOrder('์ฃผ์‹์ •์ •', "1213", self.account.text(), 4, self.stoct_code.text(), int(self.stoct_num.text()), "0", "0", "2", str(code[6:])) time.sleep(1) print(data) self.stock_buy_order() # ------ ์ฃผ์‹ ์ฃผ๋ฌธ end ------- # ------ ๋ฐ์ดํ„ฐ ์ˆ˜์‹  ๊ธฐ๋Šฅ start ------- def data_loading(self): global debug_file_started, total print('๋ฐ์ดํ„ฐ ๋กœ๋”ฉ') if self.checkbox()=='': # self.option_warning.showMessage('์˜ต์…˜์„ ์„ ํƒํ•ด์ฃผ์„ธ์š”') self.option_warning.about(self,'ํ”„๋กœ๊ทธ๋žจ ๊ฒฝ๊ณ ','์‹œ์ž‘ ์ „ ์˜ต์…ฅ์„ ์„ ํƒํ•ด์ฃผ์„ธ์š”') # show('์˜ต์…˜์„ ์„ ํƒํ•ด์ฃผ์„ธ์š”') return # ์‹ค์‹œ๊ฐ„ ์ฒด๊ฒฐ ๋ฐ์ดํ„ฐ ๋กœ๋”ฉ if self.debug_check_fun() is False: self.kiwoom.SetInputValue('์ข…๋ชฉ์ฝ”๋“œ', self.stoct_code.text()) self.kiwoom.SetInputValue('์‹œ๊ฐ„๋‹จ์œ„', "1") res = self.kiwoom.CommRqData('ํ•ด์™ธ์„ ๋ฌผ์‹œ์„ธ', 'opt10011', "0", 'opt10011') print(res) if res == 0: print('์š”์ฒญ์„ฑ๊ณต') else: print('์š”์ฒญ ์‹คํŒจ') self.kiwoom.OnReceiveRealData.connect(self.realData) else: debugFile = open(self.debug_file_name, mode='rt',encoding="utf-8") while True: try: if debug_file_started is False: # ์ฒซ์ค„ ๋‚ ๋ ค๋ฒ„๋ฆฌ๊ธฐ debugFile.readline() time.sleep(0.2) debug_file_started = True dataline = debugFile.readline() time.sleep(0.2) if dataline == '': print("๋””๋ฒ„๊ทธ ํŒŒ์ผ ์ฝ๊ธฐ ๋") print("Total", total) debugFile.close() break self.realData('', "ํ•ด์™ธ์„ ๋ฌผ์‹œ์„ธ", dataline.strip().split(",")) except EOFError: print("๋””๋ฒ„๊ทธ ํŒŒ์ผ ์ฝ๊ธฐ ๋") print("Total", total) debugFile.close() # ์‹ค์‹œ๊ฐ„ ์ฒด๊ฒฐ ์ •๋ณด ์ˆ˜์‹  ๋ฐ์ดํ„ฐ def realData(self, sJongmokCode, sRealType, sRealData): global sale_time, bong_start, bong_end, bongPlus if sRealType == "ํ•ด์™ธ์„ ๋ฌผ์‹œ์„ธ": bongFlag = False if self.debug_check_fun(): tmp_time = int(sRealData[0]) if sRealData[2] == '_': return current_data = float(sRealData[2]) else: current_data = self.kiwoom.GetCommRealData(sRealType, 10) # market_data = self.kiwoom.GetCommRealData(sJongmokCode, 16) tmp_time = int(self.kiwoom.GetCommRealData(sRealType, 20)) if sale_time is None: if tmp_time / 100 == tmp_time // 100: bong_start = abs(float(str(current_data))) print("ํ”„๋กœ๊ทธ๋žจ ์‹œ์ž‘ ์‹œ๊ฐ„: ", tmp_time // 100) else: startTime = str(tmp_time // 100 + 1) print("ํ”„๋กœ๊ทธ๋žจ ์‹œ์ž‘ ์‹œ๊ฐ„: ", startTime) sale_time = tmp_time if tmp_time // 100 > sale_time // 100 or tmp_time // 100 == 0: if bong_start is None: bong_start = abs(float(str(current_data))) bongPlus = 0 else: bongPlus = bong_end - bong_start if round(abs(bongPlus), 2) <= 0.01: bongPlus = 0 #0.01์ธ๊ฒฝ์šฐ ๋ฌด์‹œ bong_start = abs(float(str(current_data))) else: bong_start = abs(float(str(current_data))) bongFlag = True else: bong_end = abs(float(str(current_data))) if bongPlus is not None: sale_time = tmp_time if self.debug_check_fun() is False: if int(self.start_time()) <= sale_time <= int(self.end_time()): self.run(abs(float(str(current_data))), bongPlus, True, bongFlag, str(sale_time), self.checkbox()) else: self.disconnect() else: self.run(abs(float(str(current_data))), bongPlus, True, bongFlag, str(sale_time), self.checkbox()) # ์‹ค์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ ( ์ข…๋ชฉ์— ๋Œ€ํ•ด ์‹ค์‹œ๊ฐ„ ์ •๋ณด ์š”์ฒญ์„ ์‹คํ–‰ํ•จ) def real_data(self): if self.debug_check_fun() is False: self.kiwoom.SetInputValue('์ข…๋ชฉ์ฝ”๋“œ', self.stoct_code.text()) self.kiwoom.SetInputValue('์‹œ๊ฐ„๋‹จ์œ„', "1") res = self.kiwoom.CommRqData('ํ•ด์™ธ์„ ๋ฌผ์‹œ์„ธ', 'opt10011', "0", 'opt10011') self.kiwoom.OnReceiveRealData.connect(self.realData) # ์‹ค์‹œ๊ฐ„ ๋ฐ์ดํ„ฐ ๋””์Šค์ปค๋„ฅ def real_data_disconnect(self): if self.debug_check_fun() is False: self.kiwoom.DisconnectRealData('opt10011') # ๋งค๋„ ๋ฏธ์ฒด๊ฒฐ ์ทจ์†Œ ์กฐํšŒ def stock_buy_wait(self): print('๋ฏธ์ฒด๊ฒฐ ์กฐํšŒ์ค‘') self.kiwoom.SetInputValue('๊ณ„์ขŒ๋ฒˆํ˜ธ', self.account.text()) self.kiwoom.SetInputValue("๋น„๋ฐ€๋ฒˆํ˜ธ", self.password.text()) self.kiwoom.SetInputValue('๋น„๋ฐ€๋ฒˆํ˜ธ์ž…๋ ฅ๋งค์ฒด', "00") # ๋ฌด์กฐ๊ฑด 00 self.kiwoom.SetInputValue('์ข…๋ชฉ์ฝ”๋“œ', self.stoct_code.text()) self.kiwoom.SetInputValue('ํ†ตํ™”์ฝ”๋“œ', "USD") self.kiwoom.SetInputValue('๋งค๋„์ˆ˜๊ตฌ๋ถ„', "1") res = self.kiwoom.CommRqData("๋งค๋„๋ฏธ์ฒด๊ฒฐ", "opw30001", "", "opw30001") time.sleep(1) # ๋งค์ˆ˜ ๋ฏธ์ฒด๊ฒฐ ์กฐํšŒ def stock_sale_wait(self): print('๋ฏธ์ฒด๊ฒฐ ์กฐํšŒ์ค‘') self.kiwoom.SetInputValue('๊ณ„์ขŒ๋ฒˆํ˜ธ', self.account.text()) self.kiwoom.SetInputValue("๋น„๋ฐ€๋ฒˆํ˜ธ", self.password.text()) self.kiwoom.SetInputValue('๋น„๋ฐ€๋ฒˆํ˜ธ์ž…๋ ฅ๋งค์ฒด', "00") # ๋ฌด์กฐ๊ฑด 00 self.kiwoom.SetInputValue('์ข…๋ชฉ์ฝ”๋“œ', self.stoct_code.text()) self.kiwoom.SetInputValue('ํ†ตํ™”์ฝ”๋“œ', "USD") self.kiwoom.SetInputValue('๋งค๋„์ˆ˜๊ตฌ๋ถ„', "2") res = self.kiwoom.CommRqData("๋งค์ˆ˜๋ฏธ์ฒด๊ฒฐ", "opw30001", "", "opw30001") time.sleep(1) # ๋ฐ์ดํ„ฐ ์ˆ˜์‹ ์ค‘ def receive_trdata(self, sScrNo, sRQName, sTrCode, sRecordName, sPreNext): # print(sRQName) if sRQName == "๋งค๋„๋ฏธ์ฒด๊ฒฐ": # dataCount = self.kiwoom.GetRepeatCnt(sTrCode, sRQName) # dataCount2 = self.kiwoom.GetChejanData(9203) try: num = self.kiwoom.GetCommData(sTrCode, sRQName, 0, "์ฃผ๋ฌธ๋ฒˆํ˜ธ") # typ = self.kiwoom.GetCommData(sTrCode, sRQName, 0, "๊ตฌ๋ธ") print(num) if int(num) > 0: self.stock_sale_modify(num) except: print('๋งค๋„ ๋ฏธ์ฒด๊ฒฐ ๋‚ด์—ญ ์—†์Œ') if sRQName == "๋งค์ˆ˜๋ฏธ์ฒด๊ฒฐ": # dataCount = self.kiwoom.GetRepeatCnt(sTrCode, sRQName) # dataCount2 = self.kiwoom.GetChejanData(9203) try: num = self.kiwoom.GetCommData(sTrCode, sRQName, 0, "์ฃผ๋ฌธ๋ฒˆํ˜ธ") # typ = self.kiwoom.GetCommData(sTrCode, sRQName, 0, "๊ตฌ๋ธ") print(num) if int(num) > 0: self.stock_buy_modify(num) except: print('๋งค์ˆ˜ ๋ฏธ์ฒด๊ฒฐ ๋‚ด์—ญ ์—†์Œ') if sRQName == "์ฃผ๊ฐ€์กฐํšŒ": print('์ฃผ๊ฐ€์กฐํšŒ') dataCount = self.kiwoom.GetRepeatCnt(sTrCode, sRQName) print('์ด ๋ฐ์ดํ„ฐ ์ˆ˜ : ', dataCount) code = self.kiwoom.GetCommData(sTrCode, sRQName, 0, "์ข…๋ชฉ์ฝ”๋“œ") print("์ข…๋ชฉ์ฝ”๋“œ: " + code) print("------------------------------") # ๊ฐ€์žฅ์ตœ๊ทผ์—์„œ 10 ๊ฑฐ๋ž˜์ผ ์ „๊นŒ์ง€ ๋ฐ์ดํ„ฐ ์กฐํšŒ for dataIdx in range(10): inputVal = ["์ฒด๊ฒฐ์‹œ๊ฐ„n", "ํ˜„์žฌ๊ฐ€n", "์‹œ๊ฐ€", "๊ณ ๊ฐ€", "์ €๊ฐ€", "๊ฑฐ๋ž˜๋Ÿ‰"] outputVal = ['', '', '', '', '', ''] for idx, j in enumerate(inputVal): outputVal[idx] = self.kiwoom.GetCommData(sTrCode, sRQName, dataIdx, j) for idx, output in enumerate(outputVal): print(inputVal[idx] + ' : ' + output) print('----------------') if sRQName == "๋ถ„๋ด‰์ •๋ณด": # print('๋ถ„๋ด‰ ๋ฐ์ดํ„ฐ') dataCount = self.kiwoom.GetRepeatCnt(sTrCode, sRQName) # print('์ด ๋ฐ์ดํ„ฐ ์ˆ˜ : ', dataCount) code = self.kiwoom.GetCommData(sTrCode, sRQName, 0, "์ข…๋ชฉ์ฝ”๋“œ") # print("์ข…๋ชฉ์ฝ”๋“œ: " + code) # print("------------------------------") # ๊ฐ€์žฅ์ตœ๊ทผ์—์„œ 10 ๊ฑฐ๋ž˜์ผ ์ „๊นŒ์ง€ ๋ฐ์ดํ„ฐ ์กฐํšŒ for dataIdx in range(1): inputVal = ["์ฒด๊ฒฐ์‹œ๊ฐ„n", "ํ˜„์žฌ๊ฐ€n", "๋“ฑ๋ฝ์œจn", "์‹œ๊ฐ€n", "๊ณ ๊ฐ€n", "์ €๊ฐ€n"] outputVal = ['', '', '', '', '', ''] for idx, j in enumerate(inputVal): outputVal[idx] = self.kiwoom.GetCommData(sTrCode, sRQName, dataIdx, j) # print(outputVal[1]) # self.run(abs(float(str(outputVal[1]))), abs(float(str(outputVal[1]))), True, True, outputVal[0], debugFlag) # self.run(current_data,outputVal[1],True,True) # for idx, output in enumerate(outputVal): # print(inputVal[idx] + ' : ' + output) # print('----------------') def start_time(self): return self.starttime.time().toString().replace(':', '') def end_time(self): return self.endtime.time().toString().replace(':', '') def checkbox(self): te = '' if self.ChekGroup1.isChecked(): te = '10' if self.ChekGroup2.isChecked(): te = '01' if self.ChekGroup1.isChecked() and self.ChekGroup2.isChecked(): te = '11' return te # ------ ๋ฐ์ดํ„ฐ ์ˆ˜์‹  ๊ธฐ๋Šฅ end ------- # ------ ์œ ์ € ์ •๋ณด start ------- def login_clicked(self): ret = self.kiwoom.dynamicCall("CommConnect(0)") print(ret) def staate_clicked(self): if self.kiwoom.dynamicCall("GetConnectState()") == 0: self.statusBar().showMessage("Not connected") print('---------------------------------') print('๋กœ๊ทธ์ธ ์‹คํŒจ') print('---------------------------------') else: self.statusBar().showMessage("Connected") print('---------------------------------') print('๋กœ๊ทธ์ธ ์„ฑ๊ณต') print('---------------------------------') def login_info(self): info_user_id = self.kiwoom.dynamicCall('GetLoginInfo("USER_ID")') info_user_name = self.kiwoom.dynamicCall('GetLoginInfo("USER_NAME")') info_account_cnt = self.kiwoom.dynamicCall('GetLoginInfo("ACCOUNT_CNT")') info_accno = self.kiwoom.dynamicCall('GetLoginInfo("ACCNO")') info_key_bsecgb = self.kiwoom.dynamicCall('GetLoginInfo("KEY_BSECGB")') info_firew_secgb = self.kiwoom.dynamicCall('GetLoginInfo("FIREW_SECGB")') self.account.setText(info_accno.split(';')[0]) print('---------------------------------') print('user_id : ', info_user_id) print('user_name : ', info_user_name) print('์ „์ฒด๊ณ„์ขŒ ๊ฐฏ์ˆ˜ : ', info_account_cnt) print('๊ณ„์ขŒ ์ •๋ณด :', info_accno) print('ํ‚ค๋ณด๋“œ ๋ณด์•ˆ ์—ฌ๋ถ€ : ', info_key_bsecgb, ' [0:์ •์ƒ / 1:ํ•ด์ง€]') print('๋ฐฉํ™”๋ฒฝ ์„ค์ •์—ฌ๋ถ€ :', info_firew_secgb, ' [0:๋ฏธ์„ค์ • / 1:์„ค์ • / 2:ํ•ด์ง€]') print('---------------------------------') # ------ ์œ ์ € ์ •๋ณด end ------- # ------ ์ข…๋ชฉ ์ •๋ณด start ------- def subject_search(self): self.kiwoom.SetInputValue("์ข…๋ชฉ์ฝ”๋“œ", self.stoct_code.text()) res = self.kiwoom.CommRqData("์ฃผ๊ฐ€์กฐํšŒ", "opt10001", "0", "opt10001") print(res) def minute_data(self): self.kiwoom.SetInputValue("์ข…๋ชฉ์ฝ”๋“œ", self.stoct_code.text()) self.kiwoom.SetInputValue("์‹œ๊ฐ„๋‹จ์œ„", "1") # self.kiwoom.SetInputValue("๊ธฐ์ค€์ผ์ž", datetime.datetime.now().strftime('%Y%m%d%H%M%S')) # self.kiwoom.SetInputValue("์ˆ˜์ •์ฃผ๊ฐ€๊ตฌ๋ถ„","1") # res = self.kiwoom.CommRqData("๋ถ„๋ด‰์ •๋ณด","opt10012","0",datetime.datetime.now().strftime('%Y%m%d%H%M%S')) res = self.kiwoom.CommRqData("๋ถ„๋ด‰์ •๋ณด", "opt10012", "0", "opt10012") print(res) if res == 0: print('์กฐํšŒ ์„ฑ๊ณต') else: print('์กฐํšŒ ์‹คํŒจ') # ------ ์œ ์ € ์ •๋ณด end ------- # Transaction: Node class Transaction: def __init__(self, typeIn, priceIn, count): self.type = typeIn self.price = priceIn self.count = count # ์ดˆ๊ธฐ ์„ธํŒ… self.bongP = 0 self.tickP = 0 self.bongCount = 0 # Doubly Linked List๋ผ์„œ prev & next ์กด์žฌ self.prev = None self.next = None def __str__(self): return '์ฒด๊ฒฐ ๋…ธ๋“œ. ๊ฐ€๊ฒฉ: ' + str(self.price) # LinkedList ์˜์—ญ def ll_append(newNode): global head """ Insert a new element at the end of the list. Takes O(n) time. """ if not head: head = newNode return curr = head while curr.next: curr = curr.next curr.next = newNode def remove_elem(node): global head """ Unlink an element from the list. Takes O(1) time. """ prev = node.prev if node.prev: node.prev.next = node.next if node.next: node.next.prev = node.prev if node is head: head = node.next node.prev = None node.next = None return prev if __name__ == "__main__": app = QApplication(sys.argv) # log_file = open('log' + COM_DATE + '_๊ฑฐ๋ž˜.csv', 'w') # log_file.write('์ฒด๊ฒฐ์‹œ๊ฐ„,BongFlag,๊ฐ€๊ฒฉ,๋ด‰์นด์šดํŠธ,๊ฑฐ๋ž˜๋‚ด์—ญ\n') # log_file.flush() myWindow = MyWindow() myWindow.show() app.exec_()