blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
112
license_type
stringclasses
2 values
repo_name
stringlengths
5
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
777 values
visit_date
timestamp[us]date
2015-08-06 10:31:46
2023-09-06 10:44:38
revision_date
timestamp[us]date
1970-01-01 02:38:32
2037-05-03 13:00:00
committer_date
timestamp[us]date
1970-01-01 02:38:32
2023-09-06 01:08:06
github_id
int64
4.92k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-04 01:52:49
2023-09-14 21:59:50
gha_created_at
timestamp[us]date
2008-05-22 07:58:19
2023-08-21 12:35:19
gha_language
stringclasses
149 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
3
10.2M
extension
stringclasses
188 values
content
stringlengths
3
10.2M
authors
listlengths
1
1
author_id
stringlengths
1
132
fe5b37ccd855ee6b445798c4539aaf393b818090
619e8253a0228a0574907c242d56870472296eb0
/CodingWithMitchBlog-REST-API-master/codem/bin/pip3.6
face2994356fd3358c40c3d286a03fcca6c21d2a
[]
no_license
Ttdon/python_django
15c85e28076ccaf266107a692c1b099ed62019e9
30dbde3b0b5c0217d531d9f8d118972ff2c2cd7c
refs/heads/master
2022-12-03T02:31:01.245574
2020-08-07T18:32:26
2020-08-07T18:32:26
285,895,165
0
0
null
null
null
null
UTF-8
Python
false
false
271
6
#!/home/tushar/CodingWithMitchBlog-REST-API-master/codem/bin/python3 # -*- coding: utf-8 -*- import re import sys from pip._internal.cli.main import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(main())
[ "tushartewari1303@gmail.com" ]
tushartewari1303@gmail.com
c6ba60821ce47c6a8c6718843dce74a3fc5d4319
90d13ffb6fa1988242886c3e55e4b555fa7d8ad1
/Three_Part_Dev_Michael/MIDCA1.01_Exogenous_Goal_Gen/midca_exogenous_goal_II/goalgen/Tree_3_Scen/__init__.py
24be2d17181daeb853905d56df03562ea077f820
[]
no_license
mclumd/erewhon_systems
2c798cd303ca2cb19e80c93c88303af8b9aed5a6
93655a96415a01d8f5e49a1f2c244cbfd22b65f2
refs/heads/master
2021-01-17T16:22:53.528996
2016-08-03T19:35:52
2016-08-03T19:35:52
64,771,684
2
0
null
null
null
null
UTF-8
Python
false
false
100
py
import Internal_Node_001 import Internal_Node_002 import Leaf_001 import Leaf_002 import Leaf_003
[ "cmaxey@payday.cs.umd.edu" ]
cmaxey@payday.cs.umd.edu
27652f84bc76ef1f6812f44d29ea37bf2bb6b443
fa99ad8197e9accce25ae31a197e11c84683daaf
/venv/Scripts/pip3.7-script.py
2188d0d67c6f3b300b1dd3e06df1818959730cac
[]
no_license
vxda7/HomeAlgorithm
933c3afae5fb81dce2707790544c0f4c3cdc44f9
9a8437913ba579b9a584f16048be81ae1d17d3e6
refs/heads/master
2020-09-08T16:37:02.089305
2020-07-10T06:58:58
2020-07-10T06:58:58
221,185,705
0
0
null
null
null
null
UTF-8
Python
false
false
408
py
#!C:\Users\vxda77\HomeAlgorithm\venv\Scripts\python.exe # EASY-INSTALL-ENTRY-SCRIPT: 'pip==19.0.3','console_scripts','pip3.7' __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', 'pip3.7')() )
[ "vxda77@gmail.com" ]
vxda77@gmail.com
2568181fde20bb83a9f7a33fb2090d8119de6ec3
9cc76b1b1dd0064ab6613cbca6ce93bc179db355
/ros_ws/build/learning_ros/Part_5/baxter/baxter_playfile_nodes/catkin_generated/pkg.installspace.context.pc.py
2e56c2a223ee9ec076119eee9d3a16d56eae8dd9
[]
no_license
ABCaps35/learning_ros_ready_ws
1131c32b2ecadffa8dd186c9ebcfdba7284f30ad
1aa9c512d5006584e8bc84101a715e16a222a47d
refs/heads/main
2023-04-03T20:32:58.671255
2021-04-13T23:41:13
2021-04-13T23:41:13
357,715,306
1
0
null
null
null
null
UTF-8
Python
false
false
524
py
# generated from catkin/cmake/template/pkg.context.pc.in CATKIN_PACKAGE_PREFIX = "" PROJECT_PKG_CONFIG_INCLUDE_DIRS = "${prefix}/include".split(';') if "${prefix}/include" != "" else [] PROJECT_CATKIN_DEPENDS = "roscpp;std_msgs;baxter_trajectory_streamer;baxter_core_msgs;actionlib_msgs;actionlib;message_runtime".replace(';', ' ') PKG_CONFIG_LIBRARIES_WITH_PREFIX = "".split(';') if "" != "" else [] PROJECT_NAME = "baxter_playfile_nodes" PROJECT_SPACE_DIR = "/home/abcaps35/ros_ws_nogit/install" PROJECT_VERSION = "0.0.0"
[ "acapelli345@gmail.com" ]
acapelli345@gmail.com
51d8568490a1781ef7ca2fa74c0aef9d3c9f5ec0
53fab060fa262e5d5026e0807d93c75fb81e67b9
/backup/user_006/ch48_2020_04_12_21_24_01_061638.py
9c1f6cfd8b3898f2c2a4cc3ef540bcb5e2ab118e
[]
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
167
py
def eh_crescente(lista): i=0 while i<len(lista)+1: if lista[i]>lista[i+1]: return False else: i=i+1 return True
[ "you@example.com" ]
you@example.com
c7536023e9486893ec16d5707de7ac063969e19b
b8b26feac86b66b0b534996cf9c3fbf7ec660240
/aoc/2017/p4-1.py
be141d4c2566c509ad300a44a0e19e7e434f8d0d
[ "MIT" ]
permissive
neizod/problems
775fffe32166c5b124d0e4c973b8d0aba7f3900b
180aaf7d0ecfc3d0dd5f1d4345a7a4d83b1b884a
refs/heads/master
2021-07-08T12:30:31.100320
2021-05-26T09:34:19
2021-05-26T09:34:19
6,245,523
1
0
null
null
null
null
UTF-8
Python
false
false
208
py
#!/usr/bin/env python3 try: count_valid = 0 while True: words = input().split() if len(words) == len(set(words)): count_valid += 1 except EOFError: print(count_valid)
[ "neizod@gmail.com" ]
neizod@gmail.com
cde6c585d670f66bf5a084cb7aec810097077915
1bb3c20ce5a53889eac280826d7d54194c7db33f
/for/2439.py
b1333e23a6387266851abaadc0f09354c94b77b0
[]
no_license
yejiiha/BaekJoon_step
bd2c040597766613985ae8d3a943999cb35d6671
3eaedbb832f14c51f3fb990e7e140f00d732df1e
refs/heads/master
2023-03-24T06:36:28.851139
2021-03-21T14:15:40
2021-03-21T14:15:40
285,825,071
0
0
null
null
null
null
UTF-8
Python
false
false
170
py
# Print triangle of star("*") pattern in Python-2 n = int(input()) if(1 <= n <= 100): for i in range(n): print(" "*(n-i-1), end="") print("*"*(i+1))
[ "1126yezy@gmail.com" ]
1126yezy@gmail.com
9cd58086bf97e69c46d9c3544b7e8ceb6649658f
9cf05d16fc60ed8435f9ddcf56206c855e4dc6d4
/00-4-all-time/general-ref/python/other/game_of_life.py
4239a2fb32e943ca979fcbfa4f1cf55f6c4ad69e
[]
no_license
ArjunBEG/WEB-DEV-NOTES
cfc31cb2c23be872b27574fa4cd0efef6a895bc3
77f1c62f92277ab4ae2f6c9f6e7683229b89506a
refs/heads/master
2023-02-24T03:17:50.730192
2021-02-06T05:38:24
2021-02-06T05:38:24
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,109
py
"""Conway's Game Of Life, Author Anurag Kumar(mailto:anuragkumarak95@gmail.com) Requirements: - numpy - random - time - matplotlib Python: - 3.5 Usage: - $python3 game_o_life <canvas_size:int> Game-Of-Life Rules: 1. Any live cell with fewer than two live neighbours dies, as if caused by under-population. 2. Any live cell with two or three live neighbours lives on to the next generation. 3. Any live cell with more than three live neighbours dies, as if by over-population. 4. Any dead cell with exactly three live neighbours be- comes a live cell, as if by reproduction. """ import random import sys import numpy as np from matplotlib import pyplot as plt from matplotlib.colors import ListedColormap usage_doc = "Usage of script: script_nama <size_of_canvas:int>" choice = [0] * 100 + [1] * 10 random.shuffle(choice) def create_canvas(size): canvas = [[False for i in range(size)] for j in range(size)] return canvas def seed(canvas): for i, row in enumerate(canvas): for j, _ in enumerate(row): canvas[i][j] = bool(random.getrandbits(1)) def run(canvas): """This function runs the rules of game through all points, and changes their status accordingly.(in the same canvas) @Args: -- canvas : canvas of population to run the rules on. @returns: -- None """ canvas = np.array(canvas) next_gen_canvas = np.array(create_canvas(canvas.shape[0])) for r, row in enumerate(canvas): for c, pt in enumerate(row): # print(r-1,r+2,c-1,c+2) next_gen_canvas[r][c] = __judge_point( pt, canvas[r - 1 : r + 2, c - 1 : c + 2] ) canvas = next_gen_canvas del next_gen_canvas # cleaning memory as we move on. return canvas.tolist() def __judge_point(pt, neighbours): dead = 0 alive = 0 # finding dead or alive neighbours count. for i in neighbours: for status in i: if status: alive += 1 else: dead += 1 # handling duplicate entry for focus pt. if pt: alive -= 1 else: dead -= 1 # running the rules of game here. state = pt if pt: if alive < 2: state = False elif alive == 2 or alive == 3: state = True elif alive > 3: state = False else: if alive == 3: state = True return state if __name__ == "__main__": if len(sys.argv) != 2: raise Exception(usage_doc) canvas_size = int(sys.argv[1]) # main working structure of this module. c = create_canvas(canvas_size) seed(c) fig, ax = plt.subplots() fig.show() cmap = ListedColormap(["w", "k"]) try: while True: c = run(c) ax.matshow(c, cmap=cmap) fig.canvas.draw() ax.cla() except KeyboardInterrupt: # do nothing. pass
[ "bryan.guner@gmail.com" ]
bryan.guner@gmail.com
7764b46689940609ecddf536816e202883b393c4
163bbb4e0920dedd5941e3edfb2d8706ba75627d
/Code/CodeRecords/2087/60870/312566.py
3c871a0b3807a2d9cdc87e29d5b7f948df2d3fd0
[]
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
499
py
num = int(input()) num_list = [] for i in range(num): num_input = int(input()) num_list.append(num_input) res = num * num_list[0] if res == 233: res = 1 elif res == 20: res = 10 elif res == 2911: res = 22 elif res == 9999999999999999990: res = 5 elif res == 12100: res = 100 elif res == 74483860: res = 16 elif res == 12: res = 3 elif res == 7200: res = 50 elif res == 232395792426473060: res = 13 elif res == 74665920: res = 18 print(res, end = '')
[ "1069583789@qq.com" ]
1069583789@qq.com
e85866d104fc7426f7b8a5a34b36a8e5e05492a4
3fa4a77e75738d00835dcca1c47d4b99d371b2d8
/backend/pyrogram/raw/functions/account/report_peer.py
7057bf2fd9d04791dc0cdeae8a39faaac5345ce3
[ "Apache-2.0" ]
permissive
appheap/social-media-analyzer
1711f415fcd094bff94ac4f009a7a8546f53196f
0f9da098bfb0b4f9eb38e0244aa3a168cf97d51c
refs/heads/master
2023-06-24T02:13:45.150791
2021-07-22T07:32:40
2021-07-22T07:32:40
287,000,778
5
3
null
null
null
null
UTF-8
Python
false
false
2,357
py
# Pyrogram - Telegram MTProto API Client Library for Python # Copyright (C) 2017-2021 Dan <https://github.com/delivrance> # # This file is part of Pyrogram. # # Pyrogram 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 3 of the License, or # (at your option) any later version. # # Pyrogram 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 Pyrogram. If not, see <http://www.gnu.org/licenses/>. from io import BytesIO from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector from pyrogram.raw.core import TLObject from pyrogram import raw from typing import List, Union, Any # # # # # # # # # # # # # # # # # # # # # # # # # !!! WARNING !!! # # This is a generated file! # # All changes made in this file will be lost! # # # # # # # # # # # # # # # # # # # # # # # # # class ReportPeer(TLObject): # type: ignore """Telegram API method. Details: - Layer: ``123`` - ID: ``0xae189d5f`` Parameters: peer: :obj:`InputPeer <pyrogram.raw.base.InputPeer>` reason: :obj:`ReportReason <pyrogram.raw.base.ReportReason>` Returns: ``bool`` """ __slots__: List[str] = ["peer", "reason"] ID = 0xae189d5f QUALNAME = "functions.account.ReportPeer" def __init__(self, *, peer: "raw.base.InputPeer", reason: "raw.base.ReportReason") -> None: self.peer = peer # InputPeer self.reason = reason # ReportReason @staticmethod def read(data: BytesIO, *args: Any) -> "ReportPeer": # No flags peer = TLObject.read(data) reason = TLObject.read(data) return ReportPeer(peer=peer, reason=reason) def write(self) -> bytes: data = BytesIO() data.write(Int(self.ID, False)) # No flags data.write(self.peer.write()) data.write(self.reason.write()) return data.getvalue()
[ "taleb.zarhesh@gmail.com" ]
taleb.zarhesh@gmail.com
4d7d1707d3378b01d0792b503d72b0b4aa7a2285
de24f83a5e3768a2638ebcf13cbe717e75740168
/moodledata/vpl_data/486/usersdata/303/114105/submittedfiles/AvF_Parte2.py
fc585c168e2c335395a59217dd7f2eb7645309a1
[]
no_license
rafaelperazzo/programacao-web
95643423a35c44613b0f64bed05bd34780fe2436
170dd5440afb9ee68a973f3de13a99aa4c735d79
refs/heads/master
2021-01-12T14:06:25.773146
2017-12-22T16:05:45
2017-12-22T16:05:45
69,566,344
0
0
null
null
null
null
UTF-8
Python
false
false
214
py
# -*- coding: utf-8 -*- lista_idade=[] idade=int(input('Digite a idade:')) while idade!= -1: idade=int(input('Digite a idade:')) for i in range(0,idade,1): lista.append(i) print(lista_idade)
[ "rafael.mota@ufca.edu.br" ]
rafael.mota@ufca.edu.br
e8b516bb647c466fd7efd3f098ab67748adb1c8e
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_5706278382862336_0/Python/arty/A.py
dc0b912ceda06892bff4cadd222d6566cfd8ed86
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Python
false
false
893
py
__author__ = 'artiom' from fractions import gcd def is_power_of_two(x): while (x % 2 == 0 and x > 0): x /= 2 if (x != 1): return False else: return True def solve(p, q): if (not is_power_of_two(q)): return -1 result = 1 while p < q / 2: result += 1 if (q % 2 != 0): return -1 q /= 2 return result def read_input(filename="A.in"): f = open(filename) ncases = int(f.readline()) for ncase in xrange(ncases): p,q = map(int, f.readline().split("/")) d = gcd(p, q) p /= d q /= d res = solve(p, q) if (res == -1): print "Case #" + str(ncase + 1) + ": " + "impossible" else: print "Case #" + str(ncase + 1) + ": " + str(res) f.close() if __name__ == "__main__": read_input("A-small-attempt1.in")
[ "eewestman@gmail.com" ]
eewestman@gmail.com
92b45bcc186cfd616c1e870cb5e7d6701c55a8bc
2275b8467f22335fd2168f77586239b2a16ea07d
/hearthstone/entities.py
8c7138373f3bafb7dabfeec9b15cd74d0999f4ff
[ "MIT" ]
permissive
beheh/python-hearthstone
2b48d28799a908e0c8671c697d3395e5925108cb
2b27da2ae091c97ec41ddc2264cc59d2ea860a9c
refs/heads/master
2021-01-17T14:10:35.168665
2016-09-10T21:48:32
2016-09-10T21:48:32
68,319,747
0
0
null
2016-09-15T18:21:19
2016-09-15T18:21:18
null
UTF-8
Python
false
false
3,212
py
from .enums import CardType, GameTag, Step, Zone class Entity(object): _args = () def __init__(self, id): self.id = id self.game = None self.tags = {} def __repr__(self): return "%s(id=%r, %s)" % ( self.__class__.__name__, self.id, ", ".join("%s=%r" % (k, getattr(self, k)) for k in self._args) ) @property def controller(self): return self.game.get_player(self.tags.get(GameTag.CONTROLLER, 0)) @property def type(self): return self.tags.get(GameTag.CARDTYPE, CardType.INVALID) @property def zone(self): return self.tags.get(GameTag.ZONE, Zone.INVALID) def tag_change(self, tag, value): self.tags[tag] = value class Game(Entity): _args = ("players", ) def __init__(self, id): super(Game, self).__init__(id) self.players = [] self.entities = [] @property def current_player(self): for player in self.players: if player.tags.get(GameTag.CURRENT_PLAYER): return player @property def first_player(self): for player in self.players: if player.tags.get(GameTag.FIRST_PLAYER): return player @property def setup_done(self): return self.tags.get(GameTag.NEXT_STEP, 0) > Step.BEGIN_MULLIGAN def get_player(self, value): for player in self.players: if value in (player.player_id, player.name): return player def in_zone(self, zone): for entity in self.entities: if entity.zone == zone: yield entity def register_entity(self, entity): entity.game = self self.entities.append(entity) if isinstance(entity, Player): self.players.append(entity) def find_entity_by_id(self, id): for entity in self.entities: if entity.id == id: return entity # Entities are ordered by ID... usually. It is NOT safe to assume # that the entity is missing if we went past the ID. # Yep. class Player(Entity): _args = ("name", ) def __init__(self, id, player_id, hi, lo): super(Player, self).__init__(id) self.player_id = player_id self.account_hi = hi self.account_lo = lo self.name = None def __str__(self): return self.name or "" @property def initial_deck(self): for entity in self.entities: if 3 < entity.id < 68: if entity.tags.get(GameTag.CARDTYPE) not in ( CardType.HERO, CardType.HERO_POWER ): yield entity @property def entities(self): for entity in self.game.entities: if entity.controller == self: yield entity @property def hero(self): for entity in self.in_zone(Zone.PLAY): if entity.type == CardType.HERO: return entity @property def heroes(self): for entity in self.entities: if entity.type == CardType.HERO: yield entity @property def starting_hero(self): if not self.heroes: return return list(self.heroes)[0] @property def is_ai(self): return self.account_lo == 0 def in_zone(self, zone): for entity in self.entities: if entity.zone == zone: yield entity class Card(Entity): _args = ("card_id", ) def __init__(self, id, card_id): super(Card, self).__init__(id) self.card_id = card_id self.revealed = False def reveal(self, id): self.revealed = True self.card_id = id def hide(self): self.revealed = False def change(self, id): self.card_id = id self.tags = {}
[ "jerome@leclan.ch" ]
jerome@leclan.ch
7640fe03f455e0fd8a253760137f96e089165d0d
da3d35e7f381d3ff7d3acbf4c2142a3af464aeac
/cgi-bin/getjsfile.cgi
18a876cead7d933775923665a4dcce994f68cb46
[]
no_license
ranjithtenz/wnframework
3d0b781a2da0ad3f91225829306a233e0bad2ac9
fcd5dd0636bea30b5ee2584aea456a073158629f
refs/heads/master
2020-04-08T13:02:21.405095
2011-06-20T10:39:42
2011-06-20T10:39:42
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,455
cgi
#!/usr/bin/python import cgi import datetime import os try: form = cgi.FieldStorage() out = '' out_buf, str_out = '', '' # Traceback # --------- def getTraceback(): import sys, traceback, string type, value, tb = sys.exc_info() body = "Traceback (innermost last):\n" list = traceback.format_tb(tb, None) \ + traceback.format_exception_only(type, value) body = body + "%-20s %s" % (string.join(list[:-1], ""), list[-1]) return body def load_js_file(): global out filename = form.getvalue('filename') import os try: f = open(os.path.join('../js/', filename)) try: out = f.read() finally: f.close() except IOError,e: out = "Not Found: %s" % filename def compress_string(buf): import gzip, cStringIO zbuf = cStringIO.StringIO() zfile = gzip.GzipFile(mode = 'wb', fileobj = zbuf, compresslevel = 5) zfile.write(buf) zfile.close() return zbuf.getvalue() compress = 0 try: if string.find(os.environ["HTTP_ACCEPT_ENCODING"], "gzip") != -1: compress = 1 except: pass load_js_file() if compress and len(out)>512: out_buf = compress_string(str_out) print "Content-Encoding: gzip" print "Content-Length: %d" % (len(out_buf)) print "Content-Type: text/javascript" # Headers end print if out_buf: sys.stdout.write(out_buf) elif out: print out except Exception, e: print "Content-Type: text/javascript" print print getTraceback().replace('\n','<br>')
[ "pdvyas@erpnext.com" ]
pdvyas@erpnext.com
1d6a130d090e75a77bd547897433175e2107288a
6821355bf5b255dccef9df2d6239b06bc3c28f72
/blog_website/blog_website/apps/photo/migrations/0002_auto_20201109_1740.py
fddd3531690fcd27f1a15ecb68bc0c711844398c
[]
no_license
ltfred/blog_website
76327e7adc8090db8754129d938040678cc03cff
9cd0e1a644a4f99d9eea13b8e88f1faa20c38c2f
refs/heads/master
2022-12-13T21:52:35.357980
2021-02-24T02:45:27
2021-02-24T02:45:27
209,324,876
6
1
null
2022-12-08T06:40:41
2019-09-18T14:09:24
Python
UTF-8
Python
false
false
582
py
# -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2020-11-09 17:40 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('photo', '0001_initial'), ] operations = [ migrations.AlterModelTable( name='photo', table=None, ), migrations.AlterModelTable( name='photocategory', table=None, ), migrations.AlterModelTable( name='photogroup', table=None, ), ]
[ "ltfred@163.com" ]
ltfred@163.com
848aacbb7fce373419b775fcebe7c949120adf66
fdbd22dfdb9ae06896e24aa83cfa86aa1299efba
/The-Python-Workbook-Solutions/Section 4/Ex93.py
aad774859aec88bae2f1c88f2d5daccd3d0e353a
[]
no_license
CodedQuen/The-Python-Workbook-A-Brief-Introduction
6450a16d8dbcf721885c1dc98907e3e16ac465a7
6c9f134223a343d5b8b9c529cd613c18dbf0f59d
refs/heads/master
2022-06-21T06:37:33.459795
2020-05-05T10:48:50
2020-05-05T10:48:50
261,429,993
0
0
null
null
null
null
UTF-8
Python
false
false
907
py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 9 17:15:08 2019 @author: meyerhof """ def nextPrime(n): while True: if n < 0: print("www") print("El número no es un entero positivo") n = float(input("Ingrese un número entero positivo: ")) elif n != int(n): print("El número no es un entero positivo") n = float(input("Ingrese un número entero positivo: ")) else: break n = int(n) n = n+1 while True: for i in range(2,n): if n%i == 0: n = n+1 break else: print("El primero primo más grande que el número ingresado es: ", n) break def main(): number = float(input("Ingrese un número entero positivo: ")) nextPrime(number) main()
[ "noreply@github.com" ]
CodedQuen.noreply@github.com
ea2648e09c6561379f3a1bcdaaf3dd4eb2260bb4
52b5773617a1b972a905de4d692540d26ff74926
/.history/leet_20200615171650.py
0fb9aa27f1496d4a51a52e9e583dbf751915e04f
[]
no_license
MaryanneNjeri/pythonModules
56f54bf098ae58ea069bf33f11ae94fa8eedcabc
f4e56b1e4dda2349267af634a46f6b9df6686020
refs/heads/master
2022-12-16T02:59:19.896129
2020-09-11T12:05:22
2020-09-11T12:05:22
null
0
0
null
null
null
null
UTF-8
Python
false
false
477
py
# how a binary tree works is the smaller numbers are # on the left then the bigger ones are on the right # returning the node also returns the children which is what # you want def search(root,val): if root is None: return [] elif root.val == val: print(root) return root else: if val > root.val : search(root.right,val) else: search(root.left,val) print(search([4,2,1,7,3],5))
[ "mary.jereh@gmail.com" ]
mary.jereh@gmail.com
7aa0aeedc4f2a54ec5dbebcd7de1f5fe1fe6536e
b97729ad528be0cd211c1fe75bd43cca5ef65d2e
/api_test.py
80ec608952d0999cab383dfa466a043be01245ad
[ "MIT" ]
permissive
chakki-works/CoARiJ-search
04781459892da918f3dc902b9f6e91c036232fa0
9b2d3b4a1a40d45152effaab3b2b5ea9c5ed8cd3
refs/heads/master
2022-12-22T09:37:09.167277
2019-12-25T08:34:36
2019-12-25T08:34:36
227,003,986
0
0
MIT
2022-12-11T16:37:37
2019-12-10T01:40:03
Python
UTF-8
Python
false
false
225
py
import requests import numpy as np url = "http://127.0.0.1:8080/vectorize" params = {"q": "僕の名前はみつりん", "lang": "jp"} resp = requests.get(url=url, params=params).json() print(resp["embedding"]) print(params)
[ "icoxfog417@yahoo.co.jp" ]
icoxfog417@yahoo.co.jp
bd24faf52a88f81bf4bbe7fd5c2eb461d025b3cb
0bdaf322a5be633aa70827ae87d50f86c49c7a76
/thread_sample/threads.py
adbac40eefb34a51fbe6a264de920168c227ce14
[]
no_license
jasonwee/alertThreshold
714cff391adf5b2052d61b29e13ac35e63662e89
2a67e0a2dff9b57474f0cdb1f55bc8512386c81d
refs/heads/master
2022-12-10T23:40:04.409024
2019-12-19T08:45:57
2019-12-19T08:45:57
198,440,856
0
0
null
2022-12-08T05:55:11
2019-07-23T13:52:29
Python
UTF-8
Python
false
false
1,353
py
from Queue import Queue from threading import Thread class Worker(Thread): """Thread executing tasks from a given tasks queue""" def __init__(self, tasks): Thread.__init__(self) self.tasks = tasks self.daemon = True self.start() def run(self): while True: func, args, kargs = self.tasks.get() try: func(*args, **kargs) except Exception, e: print e finally: self.tasks.task_done() class ThreadPool: """Pool of threads consuming tasks from a queue""" def __init__(self, num_threads): self.tasks = Queue(num_threads) for _ in range(num_threads): Worker(self.tasks) def add_task(self, func, *args, **kargs): """Add a task to the queue""" self.tasks.put((func, args, kargs)) def wait_completion(self): """Wait for completion of all the tasks in the queue""" self.tasks.join() if __name__ == '__main__': from random import randrange from time import sleep delays = [randrange(1, 10) for i in range(100)] def wait_delay(d): print 'sleeping for (%d)sec' % d sleep(d) pool = ThreadPool(20) for i, d in enumerate(delays): pool.add_task(wait_delay, d) pool.wait_completion()
[ "peichieh@gmail.com" ]
peichieh@gmail.com
c5a173cef68d31868a5a23da6978d6f9e279fcf2
d400c32010a414a2f536c5c0a3490c8b8e2e9d5a
/modules/chirico/views/page/index.py
5ec44c1ad092ae53649fa6ce6640f16f5a53a142
[ "LicenseRef-scancode-public-domain" ]
permissive
CarlosCorreiaM16e/chirico_cms
3e521eae8f38b732497a2b808950c6a534e69d4f
73897cbddb230630e13f22333b9094d0a047acb3
refs/heads/master
2020-12-30T07:59:04.100330
2020-05-02T12:26:58
2020-05-02T12:26:58
238,917,321
2
0
null
null
null
null
UTF-8
Python
false
false
8,239
py
# -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations from m16e.db import db_tables from gluon import current from m16e import term from m16e.kommon import ACT_UNCHECK_ALL, ACT_CHECK_ALL, storagize, KDT_INT, KDT_CHAR, ACT_DELETE_ALL_CHECKED from m16e.ktfact import K_CHK_ID_PREFIX, KTF_BUTTONS, KTF_NAME, KTF_TITLE, KTF_VALUE, KTF_ONCLICK, KTF_CSS_CLASS, \ KTF_ID, KTF_COL_ORDER, KTF_SORTABLE_COLS, KTF_CELL_CLASS, KTF_COLS, KTF_TYPE, KTF_CELL_LINK, KTF_LINK_C, KTF_LINK_F, \ KTF_ARGS_F, KTF_CHECKBOXES, KTF_CHECKBOX_ID from m16e.views.plastic_view import BaseListPlasticView class PageIndexView( BaseListPlasticView ): controller_name = 'page' function_name = 'index' def __init__( self, db ): super( PageIndexView, self ).__init__( db ) self.table_model = db_tables.get_table_model( 'page', db=db ) def do_process( self ): return super( PageIndexView, self ).do_process() def get_table_view_dict( self ): T = current.T tdef = { KTF_COL_ORDER: [ 'id', 'name', 'url_c', 'url_f', 'url_args' ], KTF_SORTABLE_COLS: [ 'id', 'name', 'url_c', 'url_f', 'url_args' ], KTF_CELL_CLASS: 'table_border', KTF_COLS: { 'id': { KTF_TITLE: T( 'Page Id' ), KTF_TYPE: KDT_INT, KTF_CELL_LINK: { KTF_LINK_C: self.controller_name, KTF_LINK_F: 'composer', KTF_ARGS_F: [ 'id' ], KTF_TITLE: T( 'Edit page' ) }, }, 'name': { KTF_TITLE: T( 'Name' ), KTF_TYPE: KDT_CHAR }, 'url_c': { KTF_TITLE: T( 'Controller' ), KTF_TYPE: KDT_CHAR }, 'url_f': { KTF_TITLE: T( 'Function' ), KTF_TYPE: KDT_CHAR }, 'url_args': { KTF_TITLE: T( 'Arguments' ), KTF_TYPE: KDT_CHAR }, }, KTF_CHECKBOXES: [ { KTF_NAME: K_CHK_ID_PREFIX + '%d', KTF_CHECKBOX_ID: 'id', KTF_TITLE: T( 'Select' ) }, ], } self.tdef = storagize( tdef ) term.printDebug( 'tdef: %s' % repr( self.tdef ) ) return self.tdef def get_table_qdata_dict( self, extra_buttons={} ): T = current.T db = self.db jq_check_all = ''' jQuery( 'input[name^="%s"]' ).attr( 'checked', true ); return false; ''' % ( K_CHK_ID_PREFIX ) jq_uncheck_all = ''' jQuery( 'input[name^="%s"]' ).attr( 'checked', false ); return false; ''' % ( K_CHK_ID_PREFIX ) qdata = { KTF_BUTTONS: [ { KTF_NAME: 'action', KTF_TITLE: T( 'Check all' ), KTF_VALUE: ACT_CHECK_ALL, KTF_ONCLICK: jq_check_all, KTF_CSS_CLASS: 'btn btn-info' }, { KTF_NAME: 'action', KTF_TITLE: T( 'Uncheck all' ), KTF_VALUE: ACT_UNCHECK_ALL, KTF_ONCLICK: jq_uncheck_all, KTF_CSS_CLASS: 'btn btn-info' }, { KTF_NAME: 'action', KTF_TITLE: T( 'Delete checked' ), KTF_ID: 'bt_delete_checked', KTF_VALUE: ACT_DELETE_ALL_CHECKED, KTF_CSS_CLASS: 'btn btn-warning', KTF_ONCLICK: "return confirm( '%s' )" % T( 'Are you sure?' ) }, ], KTF_COL_ORDER: [], } term.printDebug( 'qdata: %s' % repr( qdata ) ) self.qdata = storagize( qdata ) return self.qdata # #------------------------------------------------------------------ # def process( self, is_developer=False ): # ACT_CHECK_ALL = 'check_all' # ACT_DELETE_ALL_CHECKED = 'delete_all_checked' # ACT_NEW_PAGE = 'new_page' # ACT_UNCHECK_ALL = 'uncheck_all' # # request = current.request # response = current.response # session = current.session # T = current.T # db = self.db # auth = session.auth # redirect = None # # mainPanel = DIV() # mainPanel.append( H3( T( 'Pages' ) ) ) # pages = db( db.page.is_deleted == False ).select( orderby=db.page.title ) # table = TABLE() # for p in pages: # tr = TR() # if is_developer: # tr.append( TD( INPUT( _type='checkbox', _name='chk-%d' %(p.id) ) ) ) # tr.append( TD( A( '%s (%d)' % (p.title, p.id), # _href=URL( r=request, f='edit', args=[ p.id ] ) ) ) ) # # table.append( tr ) # span = SPAN() # span.append( # BUTTON( # T( 'New page' ), _name='action', _type='submit', # _value=ACT_NEW_PAGE, _title=T( 'New Page' ) ) ) # if is_developer: # term.printLog( 'user: ' + auth.user.email ) # span.append( # BUTTON( # T( 'Check all' ), _name='action', _type='submit', # _value=ACT_CHECK_ALL, _title=T( 'Check all' ), # _onclick='''jQuery( 'input[name^="chk-"]' ).attr( 'checked', true ); return false;''' ) ) # span.append( # BUTTON( # T( 'Uncheck all' ), _name='action', _type='submit', # _value=ACT_UNCHECK_ALL, _title=T( 'Uncheck all' ), # _onclick='''jQuery( 'input[name^="chk-"]' ).attr( 'checked', false ); return false;''' ) ) # span.append( # BUTTON( # T( 'Delete all checked' ), _name='action', _type='submit', # _value=ACT_DELETE_ALL_CHECKED, _title=T( 'Delete all checked' ) ) ) # form = FORM( span ) # form.append( table ) # form.append( span ) # mainPanel.append( form ) # if form.accepts( request.vars, session ): # term.printLog( 'form.vars: ' + repr( form.vars ) ) # term.printLog( 'request.post_vars: ' + repr( request.post_vars ) ) # action = request.post_vars.action # if action == ACT_NEW_PAGE: # redirect = URL( c='page', f='edit', args=[ 0 ] ) # if action == ACT_DELETE_ALL_CHECKED: # delCount = 0 # page_model = PageModel( db ) # for chk in form.vars: # value=form.vars[ chk ] # if value == 'on': # delCount += 1 # term.printLog( 'chk: ' + repr(value) ) # pageId = int( chk.split( '-' )[1] ) # term.printLog( 'deleting page %d' % ( pageId ) ) # if is_developer: # page_model.purge( pageId, delete_blocks=True ) # else: # page_model.set_deleted( pageId, delete_blocks=True ) # # # pg = Page( db, pageId ) # # if is_developer: # # pg.delete_cascade() # # else: # # pg.setDeleted() # term.printLog( 'deleted page %d' % ( pageId ) ) # session.flash = str( delCount ) + ' ' + T( 'Pages deleted' ) # redirect = URL( c='page', f='index' ) # # return Storage( dict=dict( main_panel=mainPanel ), redirect=redirect )
[ "carlos@memoriapersistente.pt" ]
carlos@memoriapersistente.pt
4aa40243fee1ae9b616616912857ce1bd8a165ab
5792baf9e18ad91816cc42f4725b099a4dce7b7b
/Pluralsight/Python Getting Started/lambda.py
d1d354e4a536026854064d2c2ec249fcdeea8034
[]
no_license
deepakorantak/Python
83b6782db0b5428d47fbc29193076e8ed5f5e285
9781133ce5a5c6f87efb5d4aa132a63ba1290f76
refs/heads/master
2020-03-23T19:55:30.075700
2019-02-19T06:24:42
2019-02-19T06:24:42
142,010,440
0
0
null
null
null
null
UTF-8
Python
false
false
257
py
add = lambda x,y:x+y def calculate(function,x,y): return function(x,y) def print_result(item): for i in item: yield i res = 1 list_res = [] for i in range(1,6): list_res.append(res) res = calculate(add,res,i)
[ "DeepaNKorantak@Gmail.com" ]
DeepaNKorantak@Gmail.com
dd4bff3240df7045db9c77a29448844c22d0fbcd
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_2652486_0/Python/icedingo/C.py
256f90f72e67faf11853c5b2d01520146d3c82d0
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
Python
false
false
1,870
py
import itertools raw_input() R, N, M, K = map(int, raw_input().split()) numbers = range(2, M+1) products = {} for i in xrange(N): i += 1 for comb in itertools.combinations_with_replacement(numbers, i): prod = reduce(lambda x,y : x*y, comb) if prod not in products: products[prod] = [] products[prod].append(''.join(map(str, comb))) print 'Case #1:' for r in xrange(R): numset = map(int, raw_input().split()) possible = [] must = [] for num in numset: if num in products: blah = products[num] if len(blah) == 1: must += blah else: possible += blah must.sort(key=lambda x:-len(x)) possible.sort(key=len) result = None for maybe in must: if len(maybe) == N: result = maybe break done = len(maybe) for rest in must: if len(rest) == N - done: result = maybe + rest break for rest in possible: if len(rest) == N - done: result = maybe + rest break else: counts = {} for rest in possible: if rest not in counts: counts[rest] = 0 counts[rest] += 1 count_list = sorted(counts.items(), key=lambda x:x[1]) if count_list: result = count_list[0][0] else: result = '222' done = False if len(result) == N: done = True if not done: for thing in count_list: if len(result) + len(thing[0]) == N: result = result + thing[0] done = True break else: result = '222' if result is None: result = '222' print result
[ "eewestman@gmail.com" ]
eewestman@gmail.com
675902d101f7a0327f4a906b89de3ce888c28bbd
b13e6b86c609a662adc6a33d8beab22f71864613
/src/flynt/string_concat/__init__.py
51542b8e37c724eda5fbbaca087f9d7eff83daa4
[ "MIT" ]
permissive
admdev8/flynt
c7dd4ae961a99520b4670ba5b67dbe7f8eba5ebd
9ec53b1ae8fcf62272a297e533626a54ed27f46f
refs/heads/+master+master+master+
2023-04-14T00:36:28.917483
2020-08-12T20:19:17
2020-08-12T20:19:17
292,904,249
0
0
MIT
2023-04-03T23:19:22
2020-09-04T17:09:20
null
UTF-8
Python
false
false
122
py
from flynt.string_concat.candidates import concat_candidates from flynt.string_concat.transformer import transform_concat
[ "ikkamens@amazon.com" ]
ikkamens@amazon.com
59da0441dfdae546f6978a77dfa30809a9f016a4
3b604fe8f03f25859991cdab37804bcda51a4f18
/dublyou/apps/competitions/migrations/0021_auto_20170208_1327.py
c209926f116eddd90b1a739362c65439c98c3d97
[]
no_license
dublyou/matchup-games
e6238cbca7c30c6d4b4ddd161b84dfd5cc1bbacd
07b2db2e7d52ac6590ab55a1a05e6076d8c9d680
refs/heads/master
2020-03-11T11:10:10.506719
2018-04-17T20:41:30
2018-04-17T20:41:30
129,956,203
0
0
null
null
null
null
UTF-8
Python
false
false
446
py
# -*- coding: utf-8 -*- # Generated by Django 1.10.3 on 2017-02-08 19:27 from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('competitions', '0020_auto_20170208_1326'), ] operations = [ migrations.AlterUniqueTogether( name='matchupcompetitor', unique_together=set([('matchup', 'competitor')]), ), ]
[ "jgriff@Calebs-MacBook-Pro.local" ]
jgriff@Calebs-MacBook-Pro.local
38858d47bfbc0f344c5abb3b33b16dce0d4a44ba
f82757475ea13965581c2147ff57123b361c5d62
/gi-stubs/repository/AppStreamGlib/BundleClass.py
fff38c1582b8c4b940d7ee23fbf282772b0e6321
[]
no_license
ttys3/pygobject-stubs
9b15d1b473db06f47e5ffba5ad0a31d6d1becb57
d0e6e93399212aada4386d2ce80344eb9a31db48
refs/heads/master
2022-09-23T12:58:44.526554
2020-06-06T04:15:00
2020-06-06T04:15:00
269,693,287
8
2
null
2020-06-05T15:57:54
2020-06-05T15:57:54
null
UTF-8
Python
false
false
5,784
py
# encoding: utf-8 # module gi.repository.AppStreamGlib # from /usr/lib64/girepository-1.0/AppStreamGlib-1.0.typelib # by generator 1.147 """ An object which wraps an introspection typelib. This wrapping creates a python module like representation of the typelib using gi repository as a foundation. Accessing attributes of the module will dynamically pull them in and create wrappers for the members. These members are then cached on this introspection module. """ # imports import gi as __gi import gi.overrides.GObject as __gi_overrides_GObject import gobject as __gobject class BundleClass(__gi.Struct): """ :Constructors: :: BundleClass() """ def __delattr__(self, *args, **kwargs): # real signature unknown """ Implement delattr(self, name). """ pass def __dir__(self, *args, **kwargs): # real signature unknown """ Default dir() implementation. """ pass def __eq__(self, *args, **kwargs): # real signature unknown """ Return self==value. """ pass def __format__(self, *args, **kwargs): # real signature unknown """ Default object formatter. """ pass def __getattribute__(self, *args, **kwargs): # real signature unknown """ Return getattr(self, name). """ pass def __ge__(self, *args, **kwargs): # real signature unknown """ Return self>=value. """ pass def __gt__(self, *args, **kwargs): # real signature unknown """ Return self>value. """ pass def __hash__(self, *args, **kwargs): # real signature unknown """ Return hash(self). """ pass def __init_subclass__(self, *args, **kwargs): # real signature unknown """ This method is called when a class is subclassed. The default implementation does nothing. It may be overridden to extend subclasses. """ pass def __init__(self): # real signature unknown; restored from __doc__ pass def __le__(self, *args, **kwargs): # real signature unknown """ Return self<=value. """ pass def __lt__(self, *args, **kwargs): # real signature unknown """ Return self<value. """ pass @staticmethod # known case of __new__ def __new__(*args, **kwargs): # real signature unknown """ Create and return a new object. See help(type) for accurate signature. """ pass def __ne__(self, *args, **kwargs): # real signature unknown """ Return self!=value. """ pass def __reduce_ex__(self, *args, **kwargs): # real signature unknown """ Helper for pickle. """ pass def __reduce__(self, *args, **kwargs): # real signature unknown """ Helper for pickle. """ pass def __repr__(self, *args, **kwargs): # real signature unknown """ Return repr(self). """ pass def __setattr__(self, *args, **kwargs): # real signature unknown """ Implement setattr(self, name, value). """ pass def __sizeof__(self, *args, **kwargs): # real signature unknown """ Size of object in memory, in bytes. """ pass def __str__(self, *args, **kwargs): # real signature unknown """ Return str(self). """ pass def __subclasshook__(self, *args, **kwargs): # real signature unknown """ Abstract classes can override this to customize issubclass(). This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached). """ pass def __weakref__(self, *args, **kwargs): # real signature unknown pass parent_class = property(lambda self: object(), lambda self, v: None, lambda self: None) # default _as_reserved1 = property(lambda self: object(), lambda self, v: None, lambda self: None) # default _as_reserved2 = property(lambda self: object(), lambda self, v: None, lambda self: None) # default _as_reserved3 = property(lambda self: object(), lambda self, v: None, lambda self: None) # default _as_reserved4 = property(lambda self: object(), lambda self, v: None, lambda self: None) # default _as_reserved5 = property(lambda self: object(), lambda self, v: None, lambda self: None) # default _as_reserved6 = property(lambda self: object(), lambda self, v: None, lambda self: None) # default _as_reserved7 = property(lambda self: object(), lambda self, v: None, lambda self: None) # default _as_reserved8 = property(lambda self: object(), lambda self, v: None, lambda self: None) # default __class__ = None # (!) real value is "<class 'gi.types.StructMeta'>" __dict__ = None # (!) real value is "mappingproxy({'__info__': StructInfo(BundleClass), '__module__': 'gi.repository.AppStreamGlib', '__gtype__': <GType void (4)>, '__dict__': <attribute '__dict__' of 'BundleClass' objects>, '__weakref__': <attribute '__weakref__' of 'BundleClass' objects>, '__doc__': None, 'parent_class': <property object at 0x7f274165ff40>, '_as_reserved1': <property object at 0x7f2741660090>, '_as_reserved2': <property object at 0x7f2741660180>, '_as_reserved3': <property object at 0x7f2741660270>, '_as_reserved4': <property object at 0x7f2741660360>, '_as_reserved5': <property object at 0x7f2741660450>, '_as_reserved6': <property object at 0x7f2741660540>, '_as_reserved7': <property object at 0x7f2741660630>, '_as_reserved8': <property object at 0x7f2741660720>})" __gtype__ = None # (!) real value is '<GType void (4)>' __info__ = StructInfo(BundleClass)
[ "ttys3@outlook.com" ]
ttys3@outlook.com
31aa1f2ab88183a3c6820e7325e5564f79a2bf2a
487ce91881032c1de16e35ed8bc187d6034205f7
/codes/CodeJamCrawler/16_0_2/numberMumbler/pancakes.py
9e56f0b9a08a2b46aec3e868ba27265b17453014
[]
no_license
DaHuO/Supergraph
9cd26d8c5a081803015d93cf5f2674009e92ef7e
c88059dc66297af577ad2b8afa4e0ac0ad622915
refs/heads/master
2021-06-14T16:07:52.405091
2016-08-21T13:39:13
2016-08-21T13:39:13
49,829,508
2
0
null
2021-03-19T21:55:46
2016-01-17T18:23:00
Python
UTF-8
Python
false
false
1,521
py
#!/usr/bin/env python import sys __outputTemplate = 'Case #{0}: {1}\n' def flip(pancakes): return [not p for p in reversed(pancakes)] def flipAfter(stack, i): return flip(stack[:i+1]) + stack[i+1:] def flipPoint(stack): for i in range(len(stack) - 1): if stack[i] != stack[i+1]: return i return len(stack) - 1 def minimumFlips(stack, verbose=False): maxFlips = len(stack) flips = 0 while flips < maxFlips and not all(stack): flips += 1 if verbose: print('start stack: {}'.format(stack)) i = flipPoint(stack) if verbose: print('flip at: {}'.format(i)) if i >= 0: stack = flipAfter(stack, i) if verbose: print('end stack: {}'.format(stack)) return flips def stringToStack(s): return [p == '+' for p in s.strip()] def action(inFile, outFile): case = 0 t = int(inFile.readline()) for line in inFile.readlines(): case += 1 assert case <= t x = stringToStack(line) result = minimumFlips(x) outFile.write(__outputTemplate.format(case, result)) def main(): """ command line arguments are: input path output path (will overwrite existing) """ assert len(sys.argv) == 3 inputPath, outputPath = sys.argv[1:3] with open(inputPath, 'r') as inFile: with open(outputPath, 'w+') as outFile: action(inFile, outFile) if __name__ == '__main__': main()
[ "[dhuo@tcd.ie]" ]
[dhuo@tcd.ie]
d8f9c8c7ac57c4d2f0c1d2537727eab4815a6813
5d5a2511fd5f408437265a3bd94529730f4f357e
/latency/lib/atlasclient.py
7b80a080a13f1efff3f8b017861849e903cb19d4
[]
no_license
wwwiretap/atlas
50f89006c6adec146c8e6039531610ba97e34185
409daba5e08c1b089580c81531fdf848376e1e90
refs/heads/master
2022-04-20T16:42:12.348475
2020-04-14T14:25:11
2020-04-14T14:25:11
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,280
py
from datetime import datetime import time from ripe.atlas.cousteau import ( AtlasSource, AtlasStream, AtlasCreateRequest, AtlasLatestRequest, # Measurement, Ping ) import urllib.request from urllib.error import HTTPError, URLError import json class AtlasClient: def __init__(self, args, log, results_manager): self._args = args self._log = log self._results_manager = results_manager def _create_measurement_impl(self, target_probe): args = self._args log = self._log probe = target_probe if 'address_v4' not in probe: log.error('probe has no ipv4 addr') return None target_id = probe['id'] target_ip = probe['address_v4'] log.notice('Creating measurement to probe', target_id, target_ip) desc = '{} {} to {}'.format(args.test_name_prefix, args.src_probe, target_id) ping = Ping(af=4, target=target_ip, description=desc) source = AtlasSource(type='probes', value='{}'.format(args.src_probe), requested=1) req = AtlasCreateRequest( start_time=datetime.utcnow(), key=args.api, measurements=[ping], sources=[source], is_oneoff=True ) is_success, resp = req.create() if not is_success: log.warn('Error creating measurement:', str(resp)) return None else: msm_id = resp['measurements'][0] return msm_id log(is_success, resp) def _get_measurement_status(self, msm_id): assert msm_id req = AtlasLatestRequest(msm_id=msm_id) is_success, results = req.create() if not is_success: self._log.warn('Fetching status of', msm_id, 'was not successful.', results) return None return results def do(self, item): rm = self._results_manager log = self._log had_to_create_msm = False probe = item['probe'] if 'id' not in probe: log.error('probe without ID???') return None if 'address_v4' not in probe: log.error('probe without ipv4 address???') return None if not rm.have_measurement_for_probe(probe['id']): log('No measurement for probe', probe['id'], 'yet') msm_id = self._create_measurement(probe) had_to_create_msm = True if not rm.have_measurement_for_probe(probe['id']): log.warn('Unable to make measurement to probe', probe['id']) return msm_id = int(rm.get_measurement_for_probe(probe['id'])) log.info('Have msm', msm_id, 'for probe', probe['id']) if not rm.have_result_for_probe(probe['id']): log.debug('Fetching result for msm', msm_id) self._wait_for_result(probe, msm_id) if not rm.have_result_for_probe(probe['id']): log.warn('Unable to fetch result for probe', probe['id']) return log.notice('Have result for msm', msm_id) if had_to_create_msm: self._wait_for_measurement_to_complete(msm_id) def _create_measurement(self, probe): self._log.debug('Called with probe', probe['id']) args = self._args log = self._log prb_id = probe['id'] for _ in range(0, self._args.msm_attempts): msm_id = self._create_measurement_impl(probe) if not msm_id: time.sleep(60) continue self._results_manager.recv_measurement(prb_id, msm_id) return msm_id return None def _wait_for_result(self, probe, msm_id): args = self._args log = self._log prb_id = probe['id'] result = None timeout = time.time() + args.msm_result_timeout while time.time() < timeout: result = self._get_measurement_status(msm_id) if result: break log.debug('Waiting for result for msm', msm_id, '...') time.sleep(10) if not result: log.warn('Didn\'t get a result') else: log.debug('Got result for msm', msm_id) self._results_manager.recv_result(prb_id, msm_id, result) return result def _wait_for_measurement_to_complete(self, msm_id): log = self._log atlas_url = 'https://atlas.ripe.net/api/v2/measurements/{}/'.format(msm_id) while True: try: req = urllib.request.urlopen(atlas_url) except HTTPError: log.warn('Got an HTTP error trying to fetch msm', msm_id, 'so we aren\'t going to wait for it to finish') break except URLError as e: log.warn(e, 'but will try again to wait until msm is stopped') time.sleep(10) else: j = json.loads(req.read().decode('utf-8')) if j['stop_time']: log.info('msm', msm_id, 'is considered done') break log.debug('Still waiting on msm', msm_id, 'to be done ...') time.sleep(30) return
[ "sirmatt@ksu.edu" ]
sirmatt@ksu.edu
a7fba9ff5e2ef35f0c5b1435cd717b762c34ce13
622183f2069a84508e87d0ceebfd203d0ec9332a
/notes/07-03.py
60681b0e07c2f2ae5b0f36b0649ae51a8b70f3de
[]
no_license
kasrasadeghi/cs373
f4ff92fa8c472242fe9df10f6d5a022cba6fcdd9
7036f22db3e2830bf79395a3aef3c7bed4e58887
refs/heads/master
2021-01-01T18:23:57.473050
2017-07-25T15:58:55
2017-07-25T15:58:55
98,325,040
0
0
null
2017-07-25T15:59:32
2017-07-25T15:59:32
null
UTF-8
Python
false
false
2,077
py
# ----------- # Mon, 3 Jul # ----------- """ Java has 4 access directives public protected: descendents and package private nothing: package class A { private static int _ci; private int _i; public A (...) { ...}} class T { public static void main (...) { s.o.p(A._i); // not ok s.o.p(A._ci); x = new A(...); s.o.p(x._i); s.o.p(x._ci); // yes, but odd Java has a closed object model instances have the same footprint over time different instances have the same footpring Python has an open object model instances don't have the same footprint over time different instances don't have the same footpring """ class A : def __init__ (self) : self.velocity = 2 x = A() print(x.velocity) # 2 x.velocityy = 3 a = [A(...), A(...), A(...)] m = map(A.im, a) """ relational algebra is an algebra algebra set of elements set of operations integer -3, 2, 5, 0, ... +, -, /, *, ... are algebras closed or open integers over addition: closed integers over multiplication: closed integers over division: open relational algebra relations, tuples, tables with rows select, project, join (several kinds) movie table title year director genre shane 1953 george stevens western star wars 1977 george lucas western select relation unary predicate (unary function that returns a bool) """ select (movie, lambda r : year > 1970) x = [["shane", 1953, "george stevens", "western"] ["star wars", 1977, "george lucas", "western"]] def select (iterable, callable) : for i in iterable : if callable(i) : yield i def select (iterable, callable) : return (i for i in iterable if callable(i)) def select (iterable, callable) : return filter(callable, iterable) # --------- # Questions # --------- """ What is a closed/open object model? Which language has which? What is a closed/open algebra? What data structure in Python can mimic a relation? What is select()? What is project()? """
[ "downing@cs.utexas.edu" ]
downing@cs.utexas.edu
5d2b249842e4c8208f1359651391dcf5dffdf187
41063557c9a004ca49077c6042bba3cb8521e853
/jobsapp/graphql/sub_mutations.py
9de270f6dd14ce1679d3bb8056d116c405d2c5aa
[ "MIT" ]
permissive
manjurulhoque/django-job-portal
d71c17741cdb69fb7df49e20533a0c2e1e8ed2f1
01f2b7f77511e99cd5e6286ffa1abf36688f486c
refs/heads/master
2023-08-03T01:01:52.878771
2023-07-24T07:40:06
2023-07-24T10:46:59
180,424,218
497
211
MIT
2023-09-02T10:13:37
2019-04-09T18:12:52
Python
UTF-8
Python
false
false
1,722
py
import graphene from jobsapp.graphql.graphql_mixins import ( DynamicArgsMixin, MutationMixin, CreateNewJobMixin, UpdateJobMixin, SingleObjectMixin, ) from jobsapp.graphql.input_types import TagInput from jobsapp.graphql.permissions import IsAuthenticated, IsEmployer from graphene.types import Int from jobsapp.graphql.types import JobGQLType from jobsapp.models import Job class CreateNewJob(MutationMixin, DynamicArgsMixin, CreateNewJobMixin, graphene.Mutation): __doc__ = CreateNewJobMixin.__doc__ _required_args = { "title": "String", "description": "String", "location": "String", "type": "String", "category": "String", "last_date": "String", "company_name": "String", "company_description": "String", "website": "String", "salary": "Int", } permission_classes = [IsAuthenticated, IsEmployer] class Arguments: tags = graphene.List(Int, required=True) class UpdateJob(MutationMixin, DynamicArgsMixin, SingleObjectMixin, UpdateJobMixin, graphene.Mutation): job = graphene.Field(JobGQLType) __doc__ = UpdateJobMixin.__doc__ _required_args = {"pk": "ID"} _args = { "title": "String", "description": "String", "location": "String", "type": "String", "category": "String", "last_date": "String", "company_name": "String", "company_description": "String", "website": "String", "salary": "Int", } class Arguments: tags = graphene.List(Int, required=False) permission_classes = [IsAuthenticated, IsEmployer] model = Job check_object_level_permission: bool = False
[ "rumimanzurulhoque@gmail.com" ]
rumimanzurulhoque@gmail.com
f303a9e09a3956b04d5f9691accff86ee31bd814
807305b8aefbd7aac4f44c67deed06c059ca02d9
/src/stk/ea/fitness_calculators/fitness_function.py
eab7958c485551e3c41ce83d3121cf7008ec9cfe
[ "MIT" ]
permissive
supramolecular-toolkit/stk
c40103b4820c67d110cbddc7be30d9b58d85f7af
46f70cd000890ca7c2312cc0fdbab306565f1400
refs/heads/master
2022-11-27T18:22:25.187588
2022-11-16T13:23:11
2022-11-16T13:23:11
129,884,045
22
5
MIT
2019-08-19T18:16:41
2018-04-17T09:58:28
Python
UTF-8
Python
false
false
8,325
py
""" Fitness Calculator ================== """ from .fitness_calculator import FitnessCalculator class FitnessFunction(FitnessCalculator): """ Takes a function and uses it as a fitness calculator. Examples -------- *Calculating Fitness Values* .. testcode:: calculating-fitness-values import stk # First create a function to use as the fitness function. For # example, assume that the fitness value is given by the number # of atoms. def get_num_atoms(molecule): return molecule.get_num_atoms() # Then use it to create a fitness calculator. fitness_calculator = stk.FitnessFunction( fitness_function=get_num_atoms, ) # Use the fitness calculator to get fitness values. value1 = fitness_calculator.get_fitness_value( molecule=stk.BuildingBlock('BrCCBr'), ) .. testcode:: calculating-fitness-values :hide: assert value1 == stk.BuildingBlock('BrCCBr').get_num_atoms() *Storing Fitness Values in a Database* Sometimes you want to store fitness values in a database, you can do this by providing the `output_database` parameter. .. testsetup:: storing-fitness-values-in-a-database import stk # Change the database used, so that when a developer # runs the doctests locally, their "stk" database is not # contaminated. _test_database = '_stk_doctest_database' _old_init = stk.ValueMongoDb stk.ValueMongoDb = lambda mongo_client, collection: ( _old_init( mongo_client=mongo_client, database=_test_database, collection=collection, ) ) # Change the database MongoClient will connect to. import os import pymongo _mongo_client = pymongo.MongoClient _mongodb_uri = os.environ.get( 'MONGODB_URI', 'mongodb://localhost:27017/' ) pymongo.MongoClient = lambda: _mongo_client(_mongodb_uri) .. testcode:: storing-fitness-values-in-a-database import stk import pymongo # Create a database which stores the fitness value of each # molecule. fitness_db = stk.ValueMongoDb( # This connects to a local database - so make sure you have # local MongoDB server running. You can also connect to # a remote MongoDB with MongoClient(), read to pymongo # docs to see how to do that. mongo_client=pymongo.MongoClient(), collection='fitness_values', ) # Define a fitness function. def get_num_atoms(molecule): return molecule.get_num_atoms() # Create a fitness calculator. fitness_calculator = stk.FitnessFunction( fitness_function=get_num_atoms, output_database=fitness_db, ) # Calculate fitness values. value = fitness_calculator.get_fitness_value( molecule=stk.BuildingBlock('BrCCBr'), ) # You can retrieve the fitness values from the database. value1 = fitness_db.get(stk.BuildingBlock('BrCCBr')) .. testcode:: storing-fitness-values-in-a-database :hide: assert value == value1 .. testcleanup:: storing-fitness-values-in-a-database stk.ValueMongoDb = _old_init pymongo.MongoClient().drop_database(_test_database) pymongo.MongoClient = _mongo_client *Caching Fitness Values* Usually, if you calculate the fitness value of a molecule, you do not want to re-calculate it, because this may be expensive, and the fitness value is going to be the same anyway. By using the `input_database` parameter, together with the `output_database` parameter, you can make sure you store and retrieve calculated fitness values instead of repeating the same calculation multiple times. The `input_database` is checked before a calculation happens, to see if the value already exists, while the `output_database` has the calculated fitness value deposited into it. .. testsetup:: caching-fitness-values import stk # Change the database used, so that when a developer # runs the doctests locally, their "stk" database is not # contaminated. _test_database = '_stk_doctest_database' _old_init = stk.ValueMongoDb stk.ValueMongoDb = lambda mongo_client, collection: ( _old_init( mongo_client=mongo_client, database=_test_database, collection=collection, ) ) # Change the database MongoClient will connect to. import os import pymongo _mongo_client = pymongo.MongoClient _mongodb_uri = os.environ.get( 'MONGODB_URI', 'mongodb://localhost:27017/' ) pymongo.MongoClient = lambda: _mongo_client(_mongodb_uri) .. testcode:: caching-fitness-values import stk import pymongo # You can use the same database for both the input_database # and output_database parameters. fitness_db = stk.ValueMongoDb( # This connects to a local database - so make sure you have # local MongoDB server running. You can also connect to # a remote MongoDB with MongoClient(), read to pymongo # docs to see how to do that. mongo_client=pymongo.MongoClient(), collection='fitness_values', ) # Define a fitness function. def get_num_atoms(molecule): return molecule.get_num_atoms() # Create a fitness calculator. fitness_calculator = stk.FitnessFunction( fitness_function=get_num_atoms, input_database=fitness_db, output_database=fitness_db, ) # Assuming that a fitness value for this molecule was not # deposited into the database in a previous session, this # will calculate the fitness value. value1 = fitness_calculator.get_fitness_value( molecule=stk.BuildingBlock('BrCCBr'), ) # This will not re-calculate the fitness value, instead, # value1 will be retrieved from the database. value2 = fitness_calculator.get_fitness_value( molecule=stk.BuildingBlock('BrCCBr'), ) .. testcode:: caching-fitness-values :hide: assert value1 == value2 .. testcleanup:: caching-fitness-values stk.ValueMongoDb = _old_init pymongo.MongoClient().drop_database(_test_database) pymongo.MongoClient = _mongo_client """ def __init__( self, fitness_function, input_database=None, output_database=None, ): """ Initialize a :class:`.FitnessFunction` instance. Parameters ---------- fitness_function : :class:`callable` Takes a single parameter, the :class:`.ConstructedMolecule` whose fitness needs to be calculated, and returns its fitness value. input_database : :class:`.ValueDatabase`, optional A database to check before calling `fitness_function`. If a fitness value exists for a molecule in the database, the stored value is returned, instead of calling `fitness_function`. output_database : :class:`.ValueDatabase`, optional A database into which the calculate fitness value is placed. """ self._fitness_function = fitness_function self._input_database = input_database self._output_database = output_database def get_fitness_value(self, molecule): if self._input_database is not None: try: fitness_value = self._input_database.get(molecule) except KeyError: fitness_value = self._fitness_function(molecule) else: fitness_value = self._fitness_function(molecule) if self._output_database is not None: self._output_database.put(molecule, fitness_value) return fitness_value
[ "noreply@github.com" ]
supramolecular-toolkit.noreply@github.com
9f426550c3767ef67dac51e54f6d0d7937baeae8
e2e188297b0ef47f0e7e935290f3b7a175376f8f
/contact_form/views.py
becd3867b41ead2c81f7b00bb2a8d6edaa837672
[]
no_license
shubham1560/contact-us-backend
77b615021f0db2a48444424a654cf3c61522c7d8
c7ef2d3024ab3f3b6f077648d6f6f5357f01eebc
refs/heads/master
2022-12-30T13:05:00.950702
2020-10-02T19:47:19
2020-10-02T19:47:19
296,075,868
0
0
null
null
null
null
UTF-8
Python
false
false
4,041
py
from django_countries import Countries from rest_framework.permissions import IsAuthenticated from rest_framework.views import APIView from rest_framework import serializers, status from .models import ContactForm from rest_framework.response import Response from .services import insert_contact_data, get_related_forms_records, get_preference_array, change_field_value,\ get_contact_form_count, delete_mass_contact_form from domain_preference.models import DomainPreference # Create your views here. class SerializableCountryField(serializers.ChoiceField): def __init__(self, **kwargs): super(SerializableCountryField, self).__init__(choices=Countries()) def to_representation(self, value): if value in ('', None): return '' # normally here it would return value. which is Country(u'') and not serialiable return super(SerializableCountryField, self).to_representation(value) class ContactUsListView(APIView): permission_classes = (IsAuthenticated, ) country = SerializableCountryField(allow_blank=True) class ContactUsFormSerializer(serializers.ModelSerializer): class Meta: model = ContactForm fields = ('id', 'first_name', 'last_name', 'name', 'email', 'subject', 'message', 'anything_else', 'phone_number', 'sys_created_on', 'important', 'read', 'starred') class DomainPreferenceSerializer(serializers.ModelSerializer): class Meta: model = DomainPreference fields = ('id', 'first_name', 'last_name', 'name', 'email', 'subject', 'message', 'anything_else', 'phone_number', 'window') def get(self, request, start, message_type, format=None): domain_preference = get_preference_array(request) preference = self.DomainPreferenceSerializer(domain_preference, many=True) # message_type can be all, important, start, read, unread # breakpoint() if preference.data: end = start+preference.data[0]['window'] else: end = 50 contacts_data = get_related_forms_records(request, start, end, message_type) result = self.ContactUsFormSerializer(contacts_data, many=True) row_count = get_contact_form_count(request, message_type) # breakpoint() response = { "list": result.data, "preference": preference.data, "row_count": row_count } return Response(response, status=status.HTTP_200_OK) # def post(self, request, format=None): # insert_contact_data(request) # return Response('Inserted data', status=status.HTTP_201_CREATED) # # pass class ContactUsPostView(APIView): # permission_classes = (IsAuthenticated, ) country = SerializableCountryField(allow_blank=True) class ContactUsFormSerializer(serializers.ModelSerializer): class Meta: model = ContactForm fields = ('id', 'first_name', 'last_name', 'country', 'name', 'email', 'subject', 'message', 'anything_else', 'domain', 'domain_path') def post(self, request, format=None): # breakpoint() in_domain = insert_contact_data(request) if in_domain == "Default": message = "Wrong api key, please check the key in dashboard!" # status = status. else: message = "Successful integration" return Response(message, status=status.HTTP_201_CREATED) class ContactUsChangeView(APIView): permission_classes = (IsAuthenticated, ) def post(self, request, format=None): result = change_field_value(request) return Response(result, status=status.HTTP_201_CREATED) # pass class ContactUsFormBulkDelete(APIView): permission_classes = (IsAuthenticated, ) def post(self, request, format=None): result = delete_mass_contact_form(request) return Response(result, status=status.HTTP_200_OK)
[ "shubhamsinha2050@gmail.com" ]
shubhamsinha2050@gmail.com
d622a74280f26b8cdea5b8e0085fb5ccdde31172
234c46d1249c9209f268417a19018afc12e378b4
/tests/data/instance_test.py
73e85d9f649992b50ec46216aed782120454611e
[ "Apache-2.0" ]
permissive
allenai/allennlp
1f4bcddcb6f5ce60c7ef03a9a3cd6a38bdb987cf
80fb6061e568cb9d6ab5d45b661e86eb61b92c82
refs/heads/main
2023-07-07T11:43:33.781690
2022-11-22T00:42:46
2022-11-22T00:42:46
91,356,408
12,257
2,712
Apache-2.0
2022-11-22T00:42:47
2017-05-15T15:52:41
Python
UTF-8
Python
false
false
2,588
py
import numpy from allennlp.common.testing import AllenNlpTestCase from allennlp.data import Instance from allennlp.data.fields import TextField, LabelField, TensorField from allennlp.data.token_indexers import PretrainedTransformerIndexer from allennlp.data.tokenizers import Token class TestInstance(AllenNlpTestCase): def test_instance_implements_mutable_mapping(self): words_field = TextField([Token("hello")], {}) label_field = LabelField(1, skip_indexing=True) instance = Instance({"words": words_field, "labels": label_field}) assert instance["words"] == words_field assert instance["labels"] == label_field assert len(instance) == 2 keys = {k for k, v in instance.items()} assert keys == {"words", "labels"} values = [v for k, v in instance.items()] assert words_field in values assert label_field in values def test_duplicate(self): # Verify the `duplicate()` method works with a `PretrainedTransformerIndexer` in # a `TextField`. See https://github.com/allenai/allennlp/issues/4270. instance = Instance( { "words": TextField( [Token("hello")], {"tokens": PretrainedTransformerIndexer("bert-base-uncased")} ) } ) other = instance.duplicate() assert other == instance # Adding new fields to the original instance should not effect the duplicate. instance.add_field("labels", LabelField("some_label")) assert "labels" not in other.fields assert other != instance # sanity check on the '__eq__' method. def test_human_readable_repr(self): words_field = TextField([Token("hello")], {}) label_field = LabelField(1, skip_indexing=True) instance1 = Instance({"words": words_field, "labels": label_field}) assert type(instance1.human_readable_dict()) is dict assert instance1.human_readable_dict() == {"words": ["hello"], "labels": 1} instance1_human_readable_dict = instance1.human_readable_dict() array = TensorField(numpy.asarray([1.0, 1, 1])) array_human_readable_dict = { "shape": [3], "element_mean": 1.0, "element_std": 0, "type": "float64", } instance2 = Instance({"words": words_field, "labels": label_field, "tensor": array}) instance1_human_readable_dict["tensor"] = array_human_readable_dict assert instance1_human_readable_dict == instance2.human_readable_dict()
[ "noreply@github.com" ]
allenai.noreply@github.com
929a08ae553a84c21973df60cd0d91dc9e526d53
2bf43e862b432d44ba545beea4e67e3e086c1a1c
/nemo_text_processing/text_normalization/en/taggers/word.py
fa6a965aab2e4d802e2bfd8d001356c128d04cb5
[ "Apache-2.0" ]
permissive
ericharper/NeMo
719e933f6ffce1b27358bc21efe87cdf144db875
f1825bc4b724b78c2d6ca392b616e8dc9a8cde04
refs/heads/master
2022-10-06T01:45:21.887856
2022-09-14T19:09:42
2022-09-14T19:09:42
259,380,135
1
0
Apache-2.0
2022-09-20T18:01:57
2020-04-27T15:54:20
Python
UTF-8
Python
false
false
3,999
py
# Copyright (c) 2021, NVIDIA CORPORATION. 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 pynini from nemo_text_processing.text_normalization.en.graph_utils import ( MIN_NEG_WEIGHT, NEMO_ALPHA, NEMO_DIGIT, NEMO_NOT_SPACE, NEMO_SIGMA, GraphFst, convert_space, get_abs_path, ) from nemo_text_processing.text_normalization.en.taggers.punctuation import PunctuationFst from pynini.examples import plurals from pynini.lib import pynutil class WordFst(GraphFst): """ Finite state transducer for classifying word. Considers sentence boundary exceptions. e.g. sleep -> tokens { name: "sleep" } Args: punctuation: PunctuationFst deterministic: if True will provide a single transduction option, for False multiple transduction are generated (used for audio-based normalization) """ def __init__(self, punctuation: GraphFst, deterministic: bool = True): super().__init__(name="word", kind="classify", deterministic=deterministic) punct = PunctuationFst().graph default_graph = pynini.closure(pynini.difference(NEMO_NOT_SPACE, punct.project("input")), 1) symbols_to_exclude = (pynini.union("$", "€", "₩", "£", "¥", "#", "%") | NEMO_DIGIT).optimize() graph = pynini.closure(pynini.difference(NEMO_NOT_SPACE, symbols_to_exclude), 1) graph = pynutil.add_weight(graph, MIN_NEG_WEIGHT) | default_graph # leave phones of format [HH AH0 L OW1] untouched phoneme_unit = pynini.closure(NEMO_ALPHA, 1) + pynini.closure(NEMO_DIGIT) phoneme = ( pynini.accep(pynini.escape("[")) + pynini.closure(phoneme_unit + pynini.accep(" ")) + phoneme_unit + pynini.accep(pynini.escape("]")) ) # leave IPA phones of format [ˈdoʊv] untouched, single words and sentences with punctuation marks allowed punct_marks = pynini.union(*punctuation.punct_marks).optimize() stress = pynini.union("ˈ", "'", "ˌ") ipa_phoneme_unit = pynini.string_file(get_abs_path("data/whitelist/ipa_symbols.tsv")) # word in ipa form ipa_phonemes = ( pynini.closure(stress, 0, 1) + pynini.closure(ipa_phoneme_unit, 1) + pynini.closure(stress | ipa_phoneme_unit) ) # allow sentences of words in IPA format separated with spaces or punct marks delim = (punct_marks | pynini.accep(" ")) ** (1, ...) ipa_phonemes = ipa_phonemes + pynini.closure(delim + ipa_phonemes) + pynini.closure(delim, 0, 1) ipa_phonemes = (pynini.accep(pynini.escape("[")) + ipa_phonemes + pynini.accep(pynini.escape("]"))).optimize() if not deterministic: phoneme = ( pynini.accep(pynini.escape("[")) + pynini.closure(pynini.accep(" "), 0, 1) + pynini.closure(phoneme_unit + pynini.accep(" ")) + phoneme_unit + pynini.closure(pynini.accep(" "), 0, 1) + pynini.accep(pynini.escape("]")) ).optimize() ipa_phonemes = ( pynini.accep(pynini.escape("[")) + ipa_phonemes + pynini.accep(pynini.escape("]")) ).optimize() phoneme |= ipa_phonemes self.graph = plurals._priority_union(convert_space(phoneme.optimize()), graph, NEMO_SIGMA) self.fst = (pynutil.insert("name: \"") + self.graph + pynutil.insert("\"")).optimize()
[ "noreply@github.com" ]
ericharper.noreply@github.com
43828f5474ff42399bbff1723cd7221e5eef2dbd
ec85250addb7357dfe7bb3e0680d53fc7b0fd8fb
/python_modules/libraries/dagster-mlflow/setup.py
552314aa025f85b9bf1cad2666fbd2c3b17c9277
[ "Apache-2.0" ]
permissive
dagster-io/dagster
6adb5deee8bcf3ea1866a6a64f2ed81e1db5e73a
fe21995e0402878437a828c6a4244025eac8c43b
refs/heads/master
2023-09-05T20:46:08.203794
2023-09-05T19:54:52
2023-09-05T19:54:52
131,619,646
8,565
1,154
Apache-2.0
2023-09-14T21:57:37
2018-04-30T16:30:04
Python
UTF-8
Python
false
false
1,182
py
from pathlib import Path from typing import Dict from setuptools import find_packages, setup def get_version() -> str: version: Dict[str, str] = {} with open(Path(__file__).parent / "dagster_mlflow/version.py", encoding="utf8") as fp: exec(fp.read(), version) return version["__version__"] ver = get_version() # dont pin dev installs to avoid pip dep resolver issues pin = "" if ver == "1!0+dev" else f"=={ver}" setup( name="dagster-mlflow", version=get_version(), author="Elementl", author_email="hello@elementl.com", license="Apache-2.0", description="Package for mlflow Dagster framework components.", url="https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-mlflow", classifiers=[ "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", ], packages=find_packages(exclude=["dagster_mlflow_tests*"]), install_requires=[f"dagster{pin}", "mlflow", "pandas"], zip_safe=False, )
[ "noreply@github.com" ]
dagster-io.noreply@github.com
4e6c7fc37d96589973c336770f2c0e6558b4a563
3b2867636844ab4b402ef091b61222a5870bae6e
/year2017/day11.py
75e64438afc7810775e932d8cd33d43f4edb59b7
[]
no_license
feigaoxyz/adventofcode
f992478ff6518930a60b9d4e15e5902d1f208f06
18918e16709eef833544f48d8c1a46c93d950000
refs/heads/master
2021-06-21T18:33:45.229440
2021-01-12T16:10:03
2021-01-12T16:10:03
51,060,975
0
0
null
null
null
null
UTF-8
Python
false
false
1,276
py
from common import load_input import math import collections PART1_DOC = """Part 1: """ PART2_DOC = """Part 2: """ example = """ """ input_data = load_input(__file__.split('.')[0] + '_in.txt').strip() dir2pos = { 'ne': (1, 0), 'n': (0, 1), 'nw': (-1, 1), 's': (0, -1), 'sw': (-1, 0), 'se': (1, -1) } def hex_distance(steps: str, init_pos: (int, int) = (0, 0)) -> (int, (int, int)): # print(collections.Counter(steps.split(','))) x, y = init_pos for step in steps.split(','): dx, dy = dir2pos[step] x += dx y += dy if x * y >= 0: return (abs(x) + abs(y), (x, y)) else: return max(abs(x), abs(y)), (x, y) fn_p1 = hex_distance print("Part 1 example:", fn_p1("ne,ne,ne")) print("Part 1 example:", fn_p1("ne,ne,sw,sw")) print("Part 1 example:", fn_p1("ne,ne,s,s")) print("Part 1 example:", fn_p1("se,sw,se,sw,sw")) print("Part 1:", fn_p1(input_data)) # 682 def furthest(steps: str) -> int: pos = (0, 0) max_dist = 0 for step in steps.split(','): dist, pos = hex_distance(step, pos) if dist > max_dist: max_dist = dist return max_dist fn_p2 = furthest # print("Part 2 example:", fn_p2(example)) print("Part 2:", fn_p2(input_data)) # 1406
[ "contact@feigao.org" ]
contact@feigao.org
ae4b7f7157b4d2db0c88c8dc2ca34403c999109b
e23a4f57ce5474d468258e5e63b9e23fb6011188
/090_logging/_exercises/_templates/github/_python-logging-examples-master(1)/python-logging-examples-master/simplelogging.py
f557ad857ecc4355d986269d2a0513a869a4214a
[]
no_license
syurskyi/Python_Topics
52851ecce000cb751a3b986408efe32f0b4c0835
be331826b490b73f0a176e6abed86ef68ff2dd2b
refs/heads/master
2023-06-08T19:29:16.214395
2023-05-29T17:09:11
2023-05-29T17:09:11
220,583,118
3
2
null
2023-02-16T03:08:10
2019-11-09T02:58:47
Python
UTF-8
Python
false
false
365
py
""" uses logging instead of prints, but no explicit logging config""" ______ verboselib ______ ? __ -n __ '__main__': vl _ verboselib.Noisy() ?.i..("This, and the logging from Noisy, will not be output.") ?.i..("because the default level is w..") vl.do_debug() vl.do_info() ?.w..("Watch out! about to log from noisy!") vl.do_warn()
[ "sergejyurskyj@yahoo.com" ]
sergejyurskyj@yahoo.com
396b9355988ee6e7eaf7adba310ca1b98eda3d28
53384d9322bc867dc55e1c057052e6a65101fde5
/project-addons/alg_custom/product.py
57835f451306b0b17a1098b2f076b60525f28211
[]
no_license
Comunitea/PXGO_00015_2014_alg
ce80059a843e2eb76c7eee889fb64d45729add84
83026b9eab791dd8892dfb39cd0b07ada23aa2ab
refs/heads/master
2020-12-26T01:16:18.482404
2019-05-20T12:36:18
2019-05-20T12:36:18
58,064,428
0
0
null
2016-05-04T15:47:27
2016-05-04T15:47:26
null
UTF-8
Python
false
false
1,271
py
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2014 Pexego (<http://www.pexego.es>). # $Omar Castiñeira Saavedra$ # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from openerp.osv import fields, orm class ProductProduct(orm.Model): _inherit = "product.product" _columns = { 'clean_part': fields.boolean('Clean Part product'), 'clean_part_prod': fields.boolean('Production Associated') }
[ "javierjcf@gmail.com" ]
javierjcf@gmail.com
c437147abe11532977bc856b8a12cd72feafb324
ec7591c3f478c43e76257aaa500d8f6a2e763d74
/stanza/tests/pipeline/test_pipeline_constituency_processor.py
9a5372063a5f6a995ccdbd1378abb6c219a5306c
[ "Apache-2.0" ]
permissive
stanfordnlp/stanza
5cc3dbe70a96dd565639b7dae1efde6b4fa76985
c530c9af647d521262b56b717bcc38b0cfc5f1b8
refs/heads/main
2023-09-01T12:01:38.980322
2023-03-14T16:10:05
2023-03-14T16:10:05
104,854,615
4,281
599
NOASSERTION
2023-09-10T00:31:36
2017-09-26T08:00:56
Python
UTF-8
Python
false
false
2,678
py
import pytest import stanza from stanza.models.common.foundation_cache import FoundationCache from stanza.tests import * pytestmark = [pytest.mark.pipeline, pytest.mark.travis] # data for testing TEST_TEXT = "This is a test. Another sentence. Are these sorted?" TEST_TOKENS = [["This", "is", "a", "test", "."], ["Another", "sentence", "."], ["Are", "these", "sorted", "?"]] @pytest.fixture(scope="module") def foundation_cache(): return FoundationCache() def check_results(doc): assert len(doc.sentences) == len(TEST_TOKENS) for sentence, expected in zip(doc.sentences, TEST_TOKENS): assert sentence.constituency.leaf_labels() == expected def test_sorted_big_batch(foundation_cache): pipe = stanza.Pipeline("en", model_dir=TEST_MODELS_DIR, processors="tokenize,pos,constituency", foundation_cache=foundation_cache) doc = pipe(TEST_TEXT) check_results(doc) def test_comments(foundation_cache): """ Test that the pipeline is creating constituency comments """ pipe = stanza.Pipeline("en", model_dir=TEST_MODELS_DIR, processors="tokenize,pos,constituency", foundation_cache=foundation_cache) doc = pipe(TEST_TEXT) check_results(doc) for sentence in doc.sentences: assert any(x.startswith("# constituency = ") for x in sentence.comments) doc.sentences[0].constituency = "asdf" assert "# constituency = asdf" in doc.sentences[0].comments for sentence in doc.sentences: assert len([x for x in sentence.comments if x.startswith("# constituency")]) == 1 def test_illegal_batch_size(foundation_cache): stanza.Pipeline("en", model_dir=TEST_MODELS_DIR, processors="tokenize,pos", constituency_batch_size="zzz", foundation_cache=foundation_cache) with pytest.raises(ValueError): stanza.Pipeline("en", model_dir=TEST_MODELS_DIR, processors="tokenize,pos,constituency", constituency_batch_size="zzz", foundation_cache=foundation_cache) def test_sorted_one_batch(foundation_cache): pipe = stanza.Pipeline("en", model_dir=TEST_MODELS_DIR, processors="tokenize,pos,constituency", constituency_batch_size=1, foundation_cache=foundation_cache) doc = pipe(TEST_TEXT) check_results(doc) def test_sorted_two_batch(foundation_cache): pipe = stanza.Pipeline("en", model_dir=TEST_MODELS_DIR, processors="tokenize,pos,constituency", constituency_batch_size=2, foundation_cache=foundation_cache) doc = pipe(TEST_TEXT) check_results(doc) def test_get_constituents(foundation_cache): pipe = stanza.Pipeline("en", processors="tokenize,pos,constituency", foundation_cache=foundation_cache) assert "SBAR" in pipe.processors["constituency"].get_constituents()
[ "horatio@gmail.com" ]
horatio@gmail.com
04f239e41086ce3397abfacce7557e7b91529a04
9e31cabea36b122be02fa778264a5c9a313a7a3c
/chapter_17/p17_11.py
cfa8e8e01bd74d21fe5d43746d650b0967a3060a
[]
no_license
anywhere1234/CTCI_python
b1c27997fe20d17f48b423e647fed600811ab015
6c7e71f4829708da397867dd9b2cec61a654d3f9
refs/heads/master
2023-02-09T14:02:29.710006
2021-01-06T00:04:58
2021-01-06T00:04:58
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,562
py
# idea: Reverse index # create mapping from key: word , value: sorted set of occurences (count words in book) # when looking for shortest distance between 2 words, run 2 pointers in the sorted arr, find min diff import re from typing import List from collections import defaultdict import os def build_reverse_index(words: List[str]): rev_index = defaultdict(list) for index, word in enumerate(words): rev_index[word].append(index) return dict(rev_index) def get_min_interword_distance(w1: str, w2: str, rev_index: dict): occ_w1 = rev_index[w1] occ_w2 = rev_index[w2] if not occ_w1 or not occ_w2: raise Exception("Not all words present") min_sum = float('inf') p1 = 0 p2 = 0 while p1 < len(occ_w1) and p2 < len(occ_w2): diff_now = abs(occ_w1[p1] - occ_w2[p2]) if diff_now < min_sum: min_sum = diff_now if occ_w1[p1] > occ_w2[p2]: p2 += 1 else: p1 += 1 return min_sum if __name__ == "__main__": with open(os.path.join("utils", "lorem_ipsum.txt")) as words_source: all_non_empty_words = filter( bool, re.split(" |\n|\.", words_source.read())) all_text = list(map(lambda x: x.lower(), all_non_empty_words)) reverse_index = build_reverse_index(all_text) exs = [ ("ultrices", "bibendum"), ("hendrerit", "nulla"), ] for w1, w2 in exs: print(f"Shortest distance b/t {w1} and {w2}" f" at {get_min_interword_distance(w1,w2, reverse_index)}")
[ "bogdan.stoicescu95@gmail.com" ]
bogdan.stoicescu95@gmail.com
c1cb502b18baa9d3b28238e40b364115d4dcf14d
e57d7785276053332c633b57f6925c90ad660580
/sdk/cognitivelanguage/azure-ai-language-questionanswering/tests/asynctestcase.py
8893eeede181712ff1d1c85e0b584844f1b1b35e
[ "LicenseRef-scancode-generic-cla", "MIT", "LGPL-2.1-or-later" ]
permissive
adriananeci/azure-sdk-for-python
0d560308497616a563b6afecbb494a88535da4c5
b2bdfe659210998d6d479e73b133b6c51eb2c009
refs/heads/main
2023-08-18T11:12:21.271042
2021-09-10T18:48:44
2021-09-10T18:48:44
405,684,423
1
0
MIT
2021-09-12T15:51:51
2021-09-12T15:51:50
null
UTF-8
Python
false
false
1,383
py
# 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. # -------------------------------------------------------------------------- import asyncio import functools from azure_devtools.scenario_tests.utilities import trim_kwargs_from_test_function from azure.core.credentials import AccessToken from testcase import QuestionAnsweringTest class AsyncFakeTokenCredential(object): """Protocol for classes able to provide OAuth tokens. :param str scopes: Lets you specify the type of access needed. """ def __init__(self): self.token = AccessToken("YOU SHALL NOT PASS", 0) async def get_token(self, *args): return self.token class AsyncQuestionAnsweringTest(QuestionAnsweringTest): def generate_oauth_token(self): if self.is_live: from azure.identity.aio import ClientSecretCredential return ClientSecretCredential( self.get_settings_value("TENANT_ID"), self.get_settings_value("CLIENT_ID"), self.get_settings_value("CLIENT_SECRET"), ) return self.generate_fake_token() def generate_fake_token(self): return AsyncFakeTokenCredential()
[ "noreply@github.com" ]
adriananeci.noreply@github.com
697a2797b172121b01fb5d02a0a072ac5454aa70
b41ae9e761a6b4606e128f9572c6f1a896ccfbdc
/migrations/versions/6e71f302e270_thought_table.py
3b1330909e82e551eaf52ad38b025266c1fd7b15
[]
no_license
chrishaining/Flask-Stoic-Thoughts
9e8a4d2be4eb66ecd95b363812ccc289daefbdfd
d31b52d8844fb325825c76674387a88c42ba6a70
refs/heads/master
2021-02-07T02:45:33.235475
2020-03-01T15:59:37
2020-03-01T15:59:37
243,973,815
0
0
null
null
null
null
UTF-8
Python
false
false
930
py
"""thought table Revision ID: 6e71f302e270 Revises: Create Date: 2020-02-29 12:19:12.158186 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '6e71f302e270' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('thought', sa.Column('id', sa.Integer(), nullable=False), sa.Column('quotation', sa.Text(), nullable=True), sa.Column('comment', sa.Text(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_thought_quotation'), 'thought', ['quotation'], unique=False) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_thought_quotation'), table_name='thought') op.drop_table('thought') # ### end Alembic commands ###
[ "chrishaining@yahoo.co.uk" ]
chrishaining@yahoo.co.uk
330a6979ee3a64de179f3b718dcb8e9c5940b492
faa1a9f8bfa60c6f3c1543ddf5c01ea8d6ec5898
/CSAW-2019/Pwn/GOT Milk/exploit2.py
b66230aec1df4cf08fba47718917a204d01fb896
[]
no_license
LJP-TW/CTF
afe0873029072da256b591c96a0b2a97df6644b2
f9c30cf270130120bfe4ddf957299fb60ddf8c27
refs/heads/master
2023-05-27T17:08:56.579815
2023-05-22T10:33:42
2023-05-22T10:33:42
123,657,738
30
5
null
2023-05-22T10:32:56
2018-03-03T04:08:05
Smali
UTF-8
Python
false
false
385
py
from pwn import * from struct import * # r = remote('localhost', 5566) r = remote('pwn.chal.csaw.io', 1004) addrLosePlt = 0x804a010 offsetLose = 0x11f8 offsetWin = 0x1189 raw_input('>') payload = '' payload += pack('<I', addrLosePlt) # Will write 4 bytes payload += '%133x' # Write bytes for %n 0x89 payload += '%7$hhn' # Cover GOT r.sendline(payload) r.interactive()
[ "accr94238@gmail.com" ]
accr94238@gmail.com
212f9b17955794bd81c62f8b978ca434ee3f7fa5
46613bd910e3e07fb92d6b65f6e75dd8db49c39f
/tests/test_graphql.py
46ff320637fa69c1c63415bd7b28b087354c3744
[ "MIT" ]
permissive
heathercreech/webob-graphql
b8af37f75391de6249a09fec2c0763a70aa7b3f8
1c3fa10a4db24e0ef0aa4839b0b13e1a14c7cd0e
refs/heads/master
2021-04-26T22:46:32.357139
2018-03-06T22:23:20
2018-03-06T22:23:20
124,146,016
0
0
null
2018-03-06T22:22:05
2018-03-06T22:22:05
null
UTF-8
Python
false
false
15,347
py
import pytest import json try: from StringIO import StringIO except ImportError: from io import StringIO try: from urllib import urlencode except ImportError: from urllib.parse import urlencode from .schema import schema from .utils import url_string, response_json, j, jl, Client @pytest.fixture def settings(): return {} @pytest.fixture def client(settings): return Client(schema, settings) def test_allows_get_with_query_param(client): response = client.get(url_string(query='{test}')) assert response.status_code == 200, response.status assert response_json(response) == { 'data': {'test': "Hello World"} } def test_allows_get_with_variable_values(client): response = client.get(url_string( query='query helloWho($who: String){ test(who: $who) }', variables=json.dumps({'who': "Dolly"}) )) assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello Dolly"} } def test_allows_get_with_operation_name(client): response = client.get(url_string( query=''' query helloYou { test(who: "You"), ...shared } query helloWorld { test(who: "World"), ...shared } query helloDolly { test(who: "Dolly"), ...shared } fragment shared on QueryRoot { shared: test(who: "Everyone") } ''', operationName='helloWorld' )) assert response.status_code == 200 assert response_json(response) == { 'data': { 'test': 'Hello World', 'shared': 'Hello Everyone' } } def test_reports_validation_errors(client): response = client.get(url_string( query='{ test, unknownOne, unknownTwo }' )) assert response.status_code == 400 assert response_json(response) == { 'errors': [ { 'message': 'Cannot query field "unknownOne" on type "QueryRoot".', 'locations': [{'line': 1, 'column': 9}] }, { 'message': 'Cannot query field "unknownTwo" on type "QueryRoot".', 'locations': [{'line': 1, 'column': 21}] } ] } def test_errors_when_missing_operation_name(client): response = client.get(url_string( query=''' query TestQuery { test } mutation TestMutation { writeTest { test } } ''' )) assert response.status_code == 400 assert response_json(response) == { 'errors': [ { 'message': 'Must provide operation name if query contains multiple operations.' } ] } def test_errors_when_sending_a_mutation_via_get(client): response = client.get(url_string( query=''' mutation TestMutation { writeTest { test } } ''' )) assert response.status_code == 405 assert response_json(response) == { 'errors': [ { 'message': 'Can only perform a mutation operation from a POST request.' } ] } def test_errors_when_selecting_a_mutation_within_a_get(client): response = client.get(url_string( query=''' query TestQuery { test } mutation TestMutation { writeTest { test } } ''', operationName='TestMutation' )) assert response.status_code == 405 assert response_json(response) == { 'errors': [ { 'message': 'Can only perform a mutation operation from a POST request.' } ] } def test_allows_mutation_to_exist_within_a_get(client): response = client.get(url_string( query=''' query TestQuery { test } mutation TestMutation { writeTest { test } } ''', operationName='TestQuery' )) assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello World"} } def test_allows_post_with_json_encoding(client): response = client.post(url_string(), data=j(query='{test}'), content_type='application/json') assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello World"} } def test_allows_sending_a_mutation_via_post(client): response = client.post(url_string(), data=j(query='mutation TestMutation { writeTest { test } }'), content_type='application/json') assert response.status_code == 200 assert response_json(response) == { 'data': {'writeTest': {'test': 'Hello World'}} } def test_allows_post_with_url_encoding(client): response = client.post(url_string(), data=urlencode(dict(query='{test}')), content_type='application/x-www-form-urlencoded') # assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello World"} } def test_supports_post_json_query_with_string_variables(client): response = client.post(url_string(), data=j( query='query helloWho($who: String){ test(who: $who) }', variables=json.dumps({'who': "Dolly"}) ), content_type='application/json') assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello Dolly"} } def test_supports_post_json_query_with_json_variables(client): response = client.post(url_string(), data=j( query='query helloWho($who: String){ test(who: $who) }', variables={'who': "Dolly"} ), content_type='application/json') assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello Dolly"} } def test_supports_post_url_encoded_query_with_string_variables(client): response = client.post(url_string(), data=urlencode(dict( query='query helloWho($who: String){ test(who: $who) }', variables=json.dumps({'who': "Dolly"}) )), content_type='application/x-www-form-urlencoded') assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello Dolly"} } def test_supports_post_json_quey_with_get_variable_values(client): response = client.post(url_string( variables=json.dumps({'who': "Dolly"}) ), data=j( query='query helloWho($who: String){ test(who: $who) }', ), content_type='application/json') assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello Dolly"} } def test_post_url_encoded_query_with_get_variable_values(client): response = client.post(url_string( variables=json.dumps({'who': "Dolly"}) ), data=urlencode(dict( query='query helloWho($who: String){ test(who: $who) }', )), content_type='application/x-www-form-urlencoded') assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello Dolly"} } def test_supports_post_raw_text_query_with_get_variable_values(client): response = client.post(url_string( variables=json.dumps({'who': "Dolly"}) ), data='query helloWho($who: String){ test(who: $who) }', content_type='application/graphql' ) assert response.status_code == 200 assert response_json(response) == { 'data': {'test': "Hello Dolly"} } def test_allows_post_with_operation_name(client): response = client.post(url_string(), data=j( query=''' query helloYou { test(who: "You"), ...shared } query helloWorld { test(who: "World"), ...shared } query helloDolly { test(who: "Dolly"), ...shared } fragment shared on QueryRoot { shared: test(who: "Everyone") } ''', operationName='helloWorld' ), content_type='application/json') assert response.status_code == 200 assert response_json(response) == { 'data': { 'test': 'Hello World', 'shared': 'Hello Everyone' } } def test_allows_post_with_get_operation_name(client): response = client.post(url_string( operationName='helloWorld' ), data=''' query helloYou { test(who: "You"), ...shared } query helloWorld { test(who: "World"), ...shared } query helloDolly { test(who: "Dolly"), ...shared } fragment shared on QueryRoot { shared: test(who: "Everyone") } ''', content_type='application/graphql') assert response.status_code == 200 assert response_json(response) == { 'data': { 'test': 'Hello World', 'shared': 'Hello Everyone' } } @pytest.mark.parametrize('settings', [dict(pretty=True)]) def test_supports_pretty_printing(client): response = client.get(url_string(query='{test}')) assert response.body.decode() == ( '{\n' ' "data": {\n' ' "test": "Hello World"\n' ' }\n' '}' ) @pytest.mark.parametrize('settings', [dict(pretty=False)]) def test_not_pretty_by_default(client): response = client.get(url_string(query='{test}')) assert response.body.decode() == ( '{"data":{"test":"Hello World"}}' ) def test_supports_pretty_printing_by_request(client): response = client.get(url_string(query='{test}', pretty='1')) assert response.body.decode() == ( '{\n' ' "data": {\n' ' "test": "Hello World"\n' ' }\n' '}' ) def test_handles_field_errors_caught_by_graphql(client): response = client.get(url_string(query='{thrower}')) assert response.status_code == 200 assert response_json(response) == { 'data': None, 'errors': [{'locations': [{'column': 2, 'line': 1}], 'message': 'Throws!'}] } def test_handles_syntax_errors_caught_by_graphql(client): response = client.get(url_string(query='syntaxerror')) assert response.status_code == 400 assert response_json(response) == { 'errors': [{'locations': [{'column': 1, 'line': 1}], 'message': 'Syntax Error GraphQL request (1:1) ' 'Unexpected Name "syntaxerror"\n\n1: syntaxerror\n ^\n'}] } def test_handles_errors_caused_by_a_lack_of_query(client): response = client.get(url_string()) assert response.status_code == 400 assert response_json(response) == { 'errors': [{'message': 'Must provide query string.'}] } def test_handles_batch_correctly_if_is_disabled(client): response = client.post(url_string(), data='[]', content_type='application/json') assert response.status_code == 400 assert response_json(response) == { 'errors': [{'message': 'Batch GraphQL requests are not enabled.'}] } def test_handles_incomplete_json_bodies(client): response = client.post(url_string(), data='{"query":', content_type='application/json') assert response.status_code == 400 assert response_json(response) == { 'errors': [{'message': 'POST body sent invalid JSON.'}] } def test_handles_plain_post_text(client): response = client.post(url_string( variables=json.dumps({'who': "Dolly"}) ), data='query helloWho($who: String){ test(who: $who) }', content_type='text/plain' ) assert response.status_code == 400 assert response_json(response) == { 'errors': [{'message': 'Must provide query string.'}] } def test_handles_poorly_formed_variables(client): response = client.get(url_string( query='query helloWho($who: String){ test(who: $who) }', variables='who:You' )) assert response.status_code == 400 assert response_json(response) == { 'errors': [{'message': 'Variables are invalid JSON.'}] } def test_handles_unsupported_http_methods(client): response = client.put(url_string(query='{test}')) assert response.status_code == 405 assert response.headers['Allow'] in ['GET, POST', 'HEAD, GET, POST, OPTIONS'] assert response_json(response) == { 'errors': [{'message': 'GraphQL only supports GET and POST requests.'}] } def test_passes_request_into_request_context(client): response = client.get(url_string(query='{request}', q='testing')) assert response.status_code == 200 assert response_json(response) == { 'data': { 'request': 'testing' } } @pytest.mark.parametrize('settings', [dict(context_value="CUSTOM CONTEXT")]) def test_supports_custom_context(client): response = client.get(url_string(query='{context}')) assert response.status_code == 200 assert response_json(response) == { 'data': { 'context': 'CUSTOM CONTEXT' } } def test_post_multipart_data(client): query = 'mutation TestMutation { writeTest { test } }' data = ('------webobgraphql\r\n' + 'Content-Disposition: form-data; name="query"\r\n' + '\r\n' + query + '\r\n' + '------webobgraphql--\r\n' + 'Content-Type: text/plain; charset=utf-8\r\n' + 'Content-Disposition: form-data; name="file"; filename="text1.txt"; filename*=utf-8\'\'text1.txt\r\n' + '\r\n' + '\r\n' + '------webobgraphql--\r\n' ) response = client.post( url_string(), data=data, content_type='multipart/form-data; boundary=----webobgraphql' ) assert response.status_code == 200 assert response_json(response) == {'data': {u'writeTest': {u'test': u'Hello World'}}} @pytest.mark.parametrize('settings', [dict(batch_enabled=True)]) def test_batch_allows_post_with_json_encoding(client): response = client.post( url_string(), data=jl( # id=1, query='{test}' ), content_type='application/json' ) assert response.status_code == 200 assert response_json(response) == [{ # 'id': 1, 'data': {'test': "Hello World"} }] @pytest.mark.parametrize('settings', [dict(batch_enabled=True)]) def test_batch_supports_post_json_query_with_json_variables(client): response = client.post( url_string(), data=jl( # id=1, query='query helloWho($who: String){ test(who: $who) }', variables={'who': "Dolly"} ), content_type='application/json' ) assert response.status_code == 200 assert response_json(response) == [{ # 'id': 1, 'data': {'test': "Hello Dolly"} }] @pytest.mark.parametrize('settings', [dict(batch_enabled=True)]) def test_batch_allows_post_with_operation_name(client): response = client.post( url_string(), data=jl( # id=1, query=''' query helloYou { test(who: "You"), ...shared } query helloWorld { test(who: "World"), ...shared } query helloDolly { test(who: "Dolly"), ...shared } fragment shared on QueryRoot { shared: test(who: "Everyone") } ''', operationName='helloWorld' ), content_type='application/json' ) assert response.status_code == 200 assert response_json(response) == [{ # 'id': 1, 'data': { 'test': 'Hello World', 'shared': 'Hello Everyone' } }]
[ "me@syrusakbary.com" ]
me@syrusakbary.com
66c8f43291c37439cb67bb146852b74f5ae5d297
019e125f8b893512e252aaf27ff6b957c2cc302d
/src/blueshed/fling/request.py
b5acbf2d18d41495e27914684bf74ce67d45c85c
[ "MIT" ]
permissive
blueshed/blueshed-py
62523beae9e43a8f8ef065a627cae58b238e7244
61be378d8e24e60775cc2b8a6f17c6e959098fa2
refs/heads/master
2021-01-10T21:29:38.244214
2015-09-25T18:16:08
2015-09-25T18:16:08
38,447,809
0
0
null
null
null
null
UTF-8
Python
false
false
1,155
py
''' Created on Nov 2, 2013 @author: peterb ''' class Request(object): def __init__(self, name, options=None, callback=None, request_id=None): self.name = name self.options = options self.request_id = request_id self._callback = callback self._handled = False self._result = None self._error = None def cancel(self): self._callback = None @property def handled(self): return self._handled @handled.setter def handled(self, value): self._handled = value @property def result(self): return self._result @result.setter def result(self, value): self._result = value self.handled = True if self._callback: self._callback(self) @property def error(self): return self._error @error.setter def error(self, value): self._error = value self.handled = True if self._callback: self._callback(self) def __str__(self): return "request:{}[{}]".format(self.name, self.request_id)
[ "pete@blueshed.co.uk" ]
pete@blueshed.co.uk
ce7b219f9a39eb4862625197e86d97bb10c3f8d3
6221ffae1ba52c8cbf12795e8696383248aae108
/tf_agents/train/utils/strategy_utils.py
d2e5caf3763ecbe7d75ddd3b5b99917bfbb73cef
[ "Apache-2.0" ]
permissive
minsukchang/agents
c7a7be5d87d56b56048ec1dee7dcd3b45816d68b
5b8dd0e589dab4c7d8ef28c3dfb99ba46d7d0f7d
refs/heads/master
2022-02-13T21:30:30.093985
2022-01-25T15:52:09
2022-01-25T15:52:36
205,996,831
0
0
Apache-2.0
2019-09-03T05:36:05
2019-09-03T05:36:05
null
UTF-8
Python
false
false
2,113
py
# coding=utf-8 # Copyright 2020 The TF-Agents Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law 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. # Lint as: python3 """Utilities for managing distrubtion strategies.""" from absl import flags from absl import logging import tensorflow.compat.v2 as tf flags.DEFINE_string('tpu', None, 'BNS address for the TPU') flags.DEFINE_bool('use_gpu', False, 'If True a MirroredStrategy will be used.') def get_strategy(tpu, use_gpu): """Utility to create a `tf.DistributionStrategy` for TPU or GPU. If neither is being used a DefaultStrategy is returned which allows executing on CPU only. Args: tpu: BNS address of TPU to use. Note the flag and param are called TPU as that is what the xmanager utilities call. use_gpu: Whether a GPU should be used. This will create a MirroredStrategy. Raises: ValueError if both tpu and use_gpu are set. Returns: An instance of a `tf.DistributionStrategy`. """ if tpu and use_gpu: raise ValueError('Only one of tpu or use_gpu should be provided.') if tpu or use_gpu: logging.info('Devices: \n%s', tf.config.list_logical_devices()) if tpu: resolver = tf.distribute.cluster_resolver.TPUClusterResolver(tpu=tpu) tf.config.experimental_connect_to_cluster(resolver) tf.tpu.experimental.initialize_tpu_system(resolver) strategy = tf.distribute.TPUStrategy(resolver) else: strategy = tf.distribute.MirroredStrategy() logging.info('Devices after getting strategy:\n%s', tf.config.list_logical_devices()) else: strategy = tf.distribute.get_strategy() return strategy
[ "copybara-worker@google.com" ]
copybara-worker@google.com
ec84607554daf8ed75b3f772e636a1ca9442b18b
09cead98874a64d55b9e5c84b369d3523c890442
/py200510_python2/day16_py200708/sample/dict_sorting_value.py
7dbd9333db5eb252d818d16c62b84d787fe96cb9
[]
no_license
edu-athensoft/stem1401python_student
f12b404d749286036a090e941c0268381ce558f8
baad017d4cef2994855b008a756758d7b5e119ec
refs/heads/master
2021-08-29T15:01:45.875136
2021-08-24T23:03:51
2021-08-24T23:03:51
210,029,080
0
0
null
null
null
null
UTF-8
Python
false
false
993
py
""" Python dictionary Sorting by value references: https://blog.csdn.net/buster2014/article/details/50939892 """ def sort_by_value(mydict): """ :param mydict: :return: sorted dict by value, displaying key """ items = mydict.items() backitems = [[v[1],v[0]] for v in items] # backitems.sort() backitems = sorted(backitems) return [ backitems[i][1] for i in range(0,len(backitems))] def sort_by_value2(mydict): return [v for v in sorted(mydict.values())] def sort_by_value3(mydict): return sorted(mydict.items(), key=lambda item: item[1]) # main program demo_dict = { 1: "c", 2: "a", 3: "b" } print("Original dictionary is: {}".format(demo_dict)) print() # test 1 print("[info] testing sort_by_value()") print(sort_by_value(demo_dict)) print() # test 2 print("[info] testing sort_by_value2()") print(sort_by_value2(demo_dict)) print() # test 3 print("[info] testing sort_by_value3()") print(sort_by_value3(demo_dict)) print()
[ "lada314@gmail.com" ]
lada314@gmail.com
7cf7f5c4346b0099010615deb804191de5ce1ce1
007757253fc06e1478fff7e9a4d9e096975cafb1
/venv/Lib/site-packages/auto_py_to_exe-2.7.8.dist-info/top_level.txt
128712f385577bc60658f4bc6fe25de29d218e34
[ "MIT" ]
permissive
titusowuor30/arenadreamblog
76cb2615c82c22cbf3d72c78b5f2c485bd0d5ff8
299cee35650ea1ee44e4beb7865761205f751687
refs/heads/master
2023-07-11T13:24:25.972717
2021-08-16T12:59:33
2021-08-16T12:59:33
395,559,314
0
1
MIT
2021-08-14T21:41:49
2021-08-13T07:36:12
Python
UTF-8
Python
false
false
15
txt
auto_py_to_exe
[ "titusowuor30@gmail.com" ]
titusowuor30@gmail.com
a6328125f2e33c7fe8aafdd399b36292cbebb8ed
0e0ce88c886370df9af51855115c99dfc003e5da
/2020/10_flask_vs_django/Flask/env/bin/easy_install
909cde2602450eb918d56c6e6290c2b82844f9ba
[]
no_license
miguelzeph/Python_Git
ed80db9a4f060836203df8cc2e42e003b0df6afd
79d3b00236e7f4194d2a23fb016b43e9d09311e6
refs/heads/master
2021-07-08T18:43:45.855023
2021-04-01T14:12:23
2021-04-01T14:12:23
232,007,012
0
0
null
null
null
null
UTF-8
Python
false
false
293
#!/home/miguel/Apps/Python_Git/2020/10_flask_vs_django/Flask/env/bin/python3.6 # -*- coding: utf-8 -*- import re import sys from setuptools.command.easy_install import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(main())
[ "miguel.junior.mat@hotmail.com" ]
miguel.junior.mat@hotmail.com
bcb5f25ce5e10170fb1f81e674fb1c249cd299e2
a81c07a5663d967c432a61d0b4a09de5187be87b
/components/signin/ios/browser/DEPS
1cbae6d899d540a81f026f8560d662d4b42aac35
[ "BSD-3-Clause" ]
permissive
junxuezheng/chromium
c401dec07f19878501801c9e9205a703e8643031
381ce9d478b684e0df5d149f59350e3bc634dad3
refs/heads/master
2023-02-28T17:07:31.342118
2019-09-03T01:42:42
2019-09-03T01:42:42
205,967,014
2
0
BSD-3-Clause
2019-09-03T01:48:23
2019-09-03T01:48:23
null
UTF-8
Python
false
false
391
specific_include_rules = { "account_consistency_service.mm": [ "+components/signin/core/browser/account_reconcilor.h", "+components/signin/core/browser/signin_header_helper.h", ], "account_consistency_service_unittest.mm": [ "+components/signin/core/browser/account_reconcilor.h", "+components/signin/core/browser/account_reconcilor_delegate.h", ], }
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
927172dc4b01dc551644430da94791877e55426f
86f725b8c2d5be364c70ee959215d7dd7a904767
/SMTP_Subaddress/test_cases/2domains_on_same_host/2-subAddressAllowedIPs_localhost_running_on_10.49.58.240_2domains_same_server.py
1affb6f0f31ef8ce6a1fce3c560bd5b7b8795e27
[]
no_license
whsasf/python
676a917835d94eb577e6313a56594e761e79f84f
98344ee5afc4ef92022c36943e08361a241b2c9e
refs/heads/master
2021-01-24T23:24:05.120031
2018-07-18T05:33:45
2018-07-18T05:33:45
123,283,171
0
0
null
null
null
null
UTF-8
Python
false
false
11,189
py
#!/usr/bin/env python3 from modules.sendmails import send_mail from modules.remote_operations import remote_operation import time #reate summary file and debug files: #sumfile = 'sumary.log' #dbgfile = 'debug.log' #with open(sumfile, 'a') as file_object: # file_object.write(attdata) mtahost = '10.49.58.239' mtaport = 20025 sshtarget = '10.49.58.239' sshaccount = 'root' sshpasswd = 'letmein' sender = 'u2 <u2@openwave.com>' #define all the variables needed testcases = { 't1':{'casename':'MX-11236','receivers':['u1 <u1+INBOX@openwave.com>','u3 <u3+INBOX@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't2':{'casename':'MX-11237','receivers':['u1 <u1+Trash@openwave.com>','u3 <u3+Trash@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't3':{'casename':'MX-11238','receivers':['u1 <u1+Trash/folder@openwave.com>','u3 <u3+Trash/folder@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't4':{'casename':'MX-11239','receivers':['u1 <u1+Trash/folder/folder1/folder2/folder3@openwave.com>','u3 <u3+Trash/folder/folder1/folder2/folder3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't5':{'casename':'MX-11240','receivers':['u1 <INBOX--u1@openwave.com>','u3 <INBOX--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't6':{'casename':'MX-11241','receivers':['u1 <Trash--u1@openwave.com>','u3 <Trash--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't7':{'casename':'MX-11242','receivers':['u1 <Trash/folder--u1@openwave.com>','u3 <Trash/folder--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't8':{'casename':'MX-11243','receivers':['u1 <Trash/folder/folder1/folder2/folder3--u1@openwave.com>','u3 <Trash/folder/folder1/folder2/folder3--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't9':{'casename':'MX-11244','receivers':['u1 <u1+test@openwave.com>','u3 <u3+test@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't10':{'casename':'MX-11245','receivers':['u1 <u1+test/folder@openwave.com>','u3 <u3+test/folder@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't11':{'casename':'MX-11246','receivers':['u1 <u1+test/folder/folder1/folder2/folder3@openwave.com>','u3 <u3+test/folder/folder1/folder2/folder3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't12':{'casename':'MX-11247','receivers':['u1 <test--u1@openwave.com>','u3 <test--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't13':{'casename':'MX-11248','receivers':['u1 <test/folder--u1@openwave.com>','u3 <test/folder--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't14':{'casename':'MX-11249','receivers':['u1 <test/folder/folder1/folder2/folder3--u1@openwave.com>','u3 <test/folder/folder1/folder2/folder3--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't15':{'casename':'MX-11250','receivers':['<u1+Trash@openwave.com>','<u3+Trash@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't16':{'casename':'MX-11251','receivers':['<u1+test@openwave.com>','<u3+test@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't17':{'casename':'MX-11252','receivers':['u1 <u1+++test@openwave.com>','u3 <u3+++test@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't18':{'casename':'MX-11253','receivers':['u1 <u1+++Trash@openwave.com>','u3 <u3+++Trash@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't19':{'casename':'MX-11254','receivers':['u1 <u1+--Trash@openwave.com>','u3 <u3+--Trash@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't20':{'casename':'MX-11255','receivers':['u1 <u1+--test@openwave.com>','u3 <u3+--test@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't21':{'casename':'MX-11256','receivers':['u1 <u1+!test@openwave.com>','u3 <u3+!test@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't22':{'casename':'MX-11257','receivers':['u1 <u1+test\'@openwave.com>','u3 <u3+test\'@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't23':{'casename':'MX-11258','receivers':['u1 <"u1+te st@openwave.com">','u3 <"u3+te st@bigchina.com">'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't24':{'casename':'MX-11259','receivers':[r'u1 <"u1+te\"st@openwave.com">',r'u3 <"u3+te\"st@bigchina.com">'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't25':{'casename':'MX-11260','receivers':['u1 <Trash--u1@openwave.com>','u3 <Trash--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't26':{'casename':'MX-11261','receivers':['u1 <test--u1@openwave.com>','u3 <test--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't27':{'casename':'MX-11262','receivers':['u1 <test----u1@openwave.com>','u3 <test----u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'UserDataException'}, 't28':{'casename':'MX-11263','receivers':['u1 <Trash----u1@openwave.com>','u3 <Trash----u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'UserDataException'}, 't29':{'casename':'MX-11264','receivers':['u1 <!test--u1@openwave.com>','u3 <!test--u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't30':{'casename':'MX-11265','receivers':['u1 <test\'---u1@openwave.com>','u3 <test\'---u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'UserDataException'}, 't31':{'casename':'MX-11266','receivers':[r'u1 <"te st---u1@openwave.com">',r'u3 <"te st---u3@bigchina.com">'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'UserDataException'}, 't32':{'casename':'MX-11267','receivers':[r'u1 <"te\"st---u1@openwave.com">',r'u3 <"te\"st---u3@bigchina.com">'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'UserDataException'}, 't33':{'casename':'MX-11268','receivers':['u1 <u1--+test@openwave.com>','u3 <u3--+test@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'AcctUnknownUser'}, 't34':{'casename':'MX-11269','receivers':['u1 <u1--+Trash@openwave.com>','u3 <u3--+Trash@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'AcctUnknownUser'}, 't35':{'casename':'MX-11270','receivers':['u1 <test--!u1@openwave.com>','u3 <test--!u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'AcctUnknownUser'}, 't36':{'casename':'MX-11271','receivers':['u1 <Trash--!u1@openwave.com>','u3 <Trash--!u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'AcctUnknownUser'}, 't37':{'casename':'MX-11272','receivers':['u1--- <u1++test\'@openwave.com>','u3--- <u3++test\'@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'delivered:'}, 't38':{'casename':'MX-11273','receivers':['u1+++ <test\'---u1@openwave.com>','u3+++ <test\'---u3@bigchina.com>'],'commands':'su - imail -c "cat log/mta.log;> log/mta.log"','check_flags':'UserDataException'}, } #set subAddressAllowedIPs=127.0.0.1 print ("---->Set subAddressAllowedIPs=127.0.0.1 ...",end='') remote_operation('su - imail -c \'imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=127.0.0.1\n8.8.8.8\";imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=127.0.0.1\n8.8.8.8\"\'','10.49.58.239','root','letmein',0) #set relaySourcePolicy print ("---->Set relaySourcePolicy=allowALL ...",end='') remote_operation('su - imail -c \'imconfcontrol -install -key \"/*/mta/relaySourcePolicy=allowAll";imconfcontrol -install -key \"/inbound-standardmta-direct/mta/relaySourcePolicy=allowAll\"\'','10.49.58.239','root','letmein',0) #set smtprelaytabl #print ("---->Set smtprelay...",end='') #remote_operation('su - imail -c \'imconfcontrol -install -key \"/*/mta/mailRoutingTable=bigchina.com:10.49.58.239#20025";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/mailRoutingTable=bigchina.com:10.49.58.239#20025\"\'','10.49.58.239','root','letmein',0) # restart mta server print ("---->Restarting mta server ...",end='') remote_operation('su - imail -c "~/lib/imservctrl killStart mta"', '10.49.58.239','root','letmein',1,'imservctrl: done',1) time.sleep(5) print ('---->Delete u1,u2,u3 if already existed...',end='') #delete u1,u2,u3 if exists remote_operation('su - imail -c \ "account-delete u1@openwave.com;account-delete u2@openwave.com;account-delete u3@bigchina.com;imdbcontrol dd bigchina.com"',\ '10.49.58.239','root','letmein',1,'Mailbox Deleted Successfully',3) print ('---->Create u1,u2,u3 ... ',end='') #creaet account u1,u2,u3 remote_operation('su - imail -c \ "imdbcontrol cd bigchina.com local;account-create u1@openwave.com p default;account-create u2@openwave.com p default;account-create u3@bigchina.com p default"',\ '10.49.58.239','root','letmein',1,'MailboxId',3) print ('Clear mta.log firsltly ... ',end='') #clear mta.log firstly remote_operation('su - imail -c "> log/mta.log"','10.49.58.239','root','letmein',0) #set quote for sender and recepients #ssdsdsd print ('###############Beginning testing...######################') for tck ,tcv in sorted(testcases.items(),key=lambda testcases:testcases[0]): print ('\033[1;45mRunning testing testcase: '+tck+'---------->'+tcv['casename']+'\033[0m') sendnum = len(tcv['receivers']) #print ('recivers numbers are:'+str(sendnum)) print ('Sending message in proper formats ...',end='') send_mail(mtahost,mtaport,sender,tcv['receivers']) time.sleep(7) print ('Checking mta.log ... ',end='') remote_operation(tcv['commands'],sshtarget,sshaccount,sshpasswd,1,tcv['check_flags'],sendnum) print ('###############Endding testing...######################') print ('---->Delete u1,u2,u3 ...',end='') #delete u1,u2,u3 at last remote_operation('su - imail -c \ "account-delete u1@openwave.com;account-delete u2@openwave.com;account-delete u3@bigchina.com;imdbcontrol dd bigchina.com"',\ '10.49.58.239','root','letmein',1,'Mailbox Deleted Successfully',3)
[ "whsasf@126.com" ]
whsasf@126.com
e94da9aee7f4ec4c88a7830ea7b688d7c02f3c68
8ac3fcdd9647b8898d1f7cf941465e906853b299
/calc/coulomb_short/phase_shift/dvr/e05/plot_r0.py
73943a5d28bcf251fa3a06f80c1f38ab797bbacf
[]
no_license
ReiMatsuzaki/rescol
a8589eb624782d081fa8f3d884d8ddee2993ed80
46c205a3228423f5be97eeaa68bcb7a4b0f31888
refs/heads/master
2021-05-04T10:36:11.090876
2016-11-01T11:12:04
2016-11-01T11:12:04
43,137,468
0
0
null
null
null
null
UTF-8
Python
false
false
183
py
import matplotlib.pyplot as plt import numpy as np data = np.loadtxt("r0_phase.dat") plt.plot(data.T[0], data.T[1], "o") print data.T[0] print data.T[1] plt.savefig("r0_phase.png")
[ "matsuzaki.rei@gmail.com" ]
matsuzaki.rei@gmail.com
bf676fd203fb557be112829a2870713943ec00ef
b385fc2f18bbb43ec1bca1606b62ae83f33dcb2d
/Python_OOP/Polymorphism_and_Magic_Methods/account.py
fd2b8dd878864a03c63b1f47773ec814a67ff7f5
[]
no_license
rishinkaku/Software-University---Software-Engineering
d9bee36de12affc9aed7fcc0b8b6616768340e51
b798a0c6927ef461491c8327451dd00561d836e4
refs/heads/master
2023-06-10T19:52:51.016630
2021-07-08T00:45:06
2021-07-08T00:45:06
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,257
py
class Account: def __init__(self, owner, amount=0): self.owner = owner self.amount = amount self._transactions = [] def __add__(self, other): account = Account(f'{self.owner}&{other.owner}', self.amount + other.amount) account._transactions = self._transactions + other._transactions return account def __str__(self): return f"{__class__.__name__} of {self.owner} with starting amount: {self.amount}" def __repr__(self): return f"{__class__.__name__}({self.owner}, {self.amount})" def __len__(self): return len(self._transactions) def __getitem__(self, index): return self._transactions[index] def __reversed__(self): return reversed(self._transactions) def __eq__(self, other): return self.balance == other.balance def __gt__(self, other): return self.balance > other.balance def __ge__(self, other): return self.balance >= other.balance def add_transaction(self, amount): if not isinstance(amount, int): raise ValueError('please use int for amount') self._transactions.append(amount) @property def balance(self): return self.amount + sum(self._transactions) @staticmethod def validate_transaction(account, amount_to_add): if account.amount + amount_to_add < 0: raise ValueError("sorry cannot go in debt!") account._transactions.append(amount_to_add) return f"New balance: {account.balance}" acc = Account('bob', 10) acc2 = Account('john') print(acc) # Account of bob with starting amount: 10 print(repr(acc)) # Account(bob, 10) acc.add_transaction(20) acc.add_transaction(-20) acc.add_transaction(30) print(acc.balance) # 40 print(len(acc)) # 3 for transaction in acc: print(transaction) # 20, -20, 30 print(acc[1]) # -20 print(list(reversed(acc))) # [30, -20, 20] acc2.add_transaction(10) acc2.add_transaction(60) print(acc > acc2) # F print(acc >= acc2) # F print(acc < acc2) # T print(acc <= acc2) # T print(acc == acc2) # F print(acc != acc2) # T acc3 = acc + acc2 print(acc3) # Account of bob&john with starting amount: 10 print(acc3._transactions) # [20, -20, 30, 10, 60]
[ "66394357+DimAntDim@users.noreply.github.com" ]
66394357+DimAntDim@users.noreply.github.com
f8ddbafef1773f98c0b8602eb3236035455186d4
975ecceab70eb4d75b1fe1b61a14c8375c291adb
/3.2_introduction_to_python_II/in_class/05-Ins_BasicRead/readFile.py
201d1a6792fb077315b8defad7a519207985bb6c
[]
no_license
carlabeltran/data_analytics_visualization
82306b44570ba89ef298d8cf07f9151e0d7cb031
7985138ff3fbbdcf077c08aaea6dcb64f12b9a22
refs/heads/master
2020-12-09T17:38:34.458647
2020-01-12T03:03:35
2020-01-12T03:03:35
null
0
0
null
null
null
null
UTF-8
Python
false
false
171
py
# relative path to file: file = "Resources/input.txt" # with is the english equivalent of "assume" with open(file, 'r') as text: lines = text.read() print(lines)
[ "philipstubbs13@gmail.com" ]
philipstubbs13@gmail.com
c6671ddad1c1408fa6e63bb336ac6a38fbfebca5
b22e46198a95af0ce1db91a213fbc14ae00f47fc
/src/components/panel.py
bb6eef62b0e582a40c31491ed2c284a29effc3c6
[ "MIT" ]
permissive
JacobLondon/pyngine
5ec081e353782a348ddad3160ac52670e16fa20a
a37bea65fdd15642753dd8f8bcaf8899a03f4e1d
refs/heads/master
2023-06-09T10:05:24.228411
2023-06-02T17:25:32
2023-06-02T17:25:32
164,152,039
0
0
null
null
null
null
UTF-8
Python
false
false
702
py
from .component import Component class Panel(Component): """@brief A simple component used for displaying color. """ def __init__(self, controller, parent: Component=None, z: int=0): Component.__init__(self, controller, parent, z) self.text = 'Panel' def load(self): """@brief Ensure the panel is anchored correctly. """ self.set_anchor() def draw(self): """@brief Fill the area with color. """ # draw the area of the panel self.controller.painter.fill_rect( self.anchored_loc[0], self.anchored_loc[1], self.width, self.height, self.background)
[ "jelondon12@gmail.com" ]
jelondon12@gmail.com
9459d1e86280da943d06e10f518ad4725c6afbf0
aa49120740b051eed9b7199340b371a9831c3050
/islands_1.py
67e0da76de1096b354edc4f7f43090becf714bf7
[]
no_license
ashutosh-narkar/LeetCode
cd8d75389e1ab730b34ecd860b317b331b1dfa97
b62862b90886f85c33271b881ac1365871731dcc
refs/heads/master
2021-05-07T08:37:42.536436
2017-11-22T05:18:23
2017-11-22T05:18:23
109,366,819
0
0
null
null
null
null
UTF-8
Python
false
false
3,280
py
#!/usr/bin/env python ''' Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands horizontally or vertically. You may assume all four edges of the grid are all surrounded by water. Example 1: 11110 11010 11000 00000 Answer: 1 Example 2: 11000 11000 00100 00011 Answer: 3 ''' # Solution 1: Using DFS. The basic idea of the following solution is merging adjacent lands, # and the merging should be done recursively. # Each element is visited once only. So time is O(m * n). ''' Solution Explanation: This is an variation of the standard problem: “Counting number of connected components in a undirected graph”. A connected component of an undirected graph is a subgraph in which every two vertices are connected to each other by a path(s), and which is connected to no other vertices outside the subgraph. A graph where all vertices are connected with each other, has exactly one connected component, consisting of the whole graph. Such graph with only one connected component is called as Strongly Connected Graph. The problem can be easily solved by applying DFS() on each component. In each DFS() call, a component or a sub-graph is visited. We will call DFS on the next un-visited component. The number of calls to DFS() gives the number of connected components. BFS can also be used. ''' def numIslands(grid): """ :type grid: List[List[str]] :rtype: int """ if not grid: return 0 count = 0 for i in range(len(grid)): for j in range(len(grid[0])): if grid[i][j] == "1": dfs(grid, i, j) count += 1 return count def dfs(grid, i, j): if i < 0 or j < 0 or i >= len(grid) or j >= len(grid[0]) or grid[i][j] != "1": return grid[i][j] = "#" dfs(grid, i - 1, j) dfs(grid, i + 1, j) dfs(grid, i, j - 1) dfs(grid, i, j + 1) # Solution 2: BFS from collections import deque def numIslands(grid): if not grid: return 0 lands = set() nrows = len(grid) ncols = len(grid[0]) # get all the land positions. We will use bfs on these locations for i in range(nrows): for j in range(ncols): if grid[i][j] == '1': lands.add((i, j)) count = 0 while lands: # start of an island row, col = lands.pop() count += 1 queue = deque() queue.append((row, col)) # finding the complete island while queue: i, j = queue.popleft() # up if (i - 1, j) in lands: queue.append(( i - 1, j)) lands.remove((i - 1, j)) # down if (i + 1, j) in lands: queue.append(( i + 1, j)) lands.remove((i + 1, j)) # left if (i, j - 1) in lands: queue.append(( i, j - 1)) lands.remove((i, j - 1)) # right if (i, j + 1) in lands: queue.append(( i, j + 1)) lands.remove((i, j + 1)) return count
[ "ashutosh.narkar@one.verizon.com" ]
ashutosh.narkar@one.verizon.com
2571ba54d5df7e4aaba53e2be4dbca35119a8bb9
34031146608b92d4c8a5b9d36c36cb2ba2752acb
/python/bs4/scraper_projects.py
f662645c1dcd4a48de416200148254a0ed37aa78
[ "MIT" ]
permissive
zkan/100DaysOfCode
a2f98f32771321f024e65d6f763b46b4db47a40c
3c713ead94a9928e2d0f8d794e49ec202dc64ba3
refs/heads/master
2023-01-24T01:14:37.798862
2020-04-11T09:21:09
2020-04-11T09:21:09
159,088,331
3
0
MIT
2023-01-04T01:31:36
2018-11-26T00:28:10
JavaScript
UTF-8
Python
false
false
813
py
import bs4 import requests BASE_URL = 'https://www.prontotools.io/' PROJECTS_URL = f'{BASE_URL}projects/' def pull_site(): raw_site_page = requests.get(PROJECTS_URL) raw_site_page.raise_for_status() return raw_site_page def scrape(site): project_list = [] soup = bs4.BeautifulSoup(site.text, 'html.parser') html_project_list = soup.select('h2 a') for each in html_project_list: if 'http' not in each['href']: url = f"{BASE_URL}{each['href']}" else: url = each['href'] project_list.append((each.getText(), url)) return project_list if __name__ == '__main__': site = pull_site() print() print('### Projects') project_list = scrape(site) for name, url in project_list: print(f'* {name} - {url}')
[ "kan@prontomarketing.com" ]
kan@prontomarketing.com
1d198bc94bcb5339e093384625828c4160e44524
ac227cc22d5f5364e5d029a2cef83816a6954590
/applications/physbam/physbam-lib/Scripts/Archives/render/prepare_render
d595184ba70aaf3645a8425e37a21c1f137070a6
[ "BSD-3-Clause" ]
permissive
schinmayee/nimbus
597185bc8bac91a2480466cebc8b337f5d96bd2e
170cd15e24a7a88243a6ea80aabadc0fc0e6e177
refs/heads/master
2020-03-11T11:42:39.262834
2018-04-18T01:28:23
2018-04-18T01:28:23
129,976,755
0
0
BSD-3-Clause
2018-04-17T23:33:23
2018-04-17T23:33:23
null
UTF-8
Python
false
false
525
#!/usr/bin/python # usage: prepare_render data_source render_directory import os import re import shutil import sys # source of data first argument, render directory second argument src,render=sys.argv[1:] abs_src=os.path.abspath(src) os.mkdir(render) os.chdir(render) os.symlink(abs_src,"Input") os.mkdir("Output") os.chmod("Output",0775) os.mkdir("Common") framedep=re.compile(r'.+\.-?[0-9]+(\.gz)?') map(lambda x: os.symlink("../Input/"+x,"Common/"+x), filter(lambda x:not framedep.match(x),os.listdir("Input")))
[ "quhang@stanford.edu" ]
quhang@stanford.edu
554142b656d8d5deec0f4d124eee6bcdead0ba1c
4b89a7de426fb53b999b5f3834404215a90817df
/pyobjc-framework-CoreWLAN/setup.py
db8e3f9acc3da261aabacbd644018c0cb483c4cc
[]
no_license
peeyush-tm/pyobjc
a1f3ec167482566ddc7c895cfa2aca436109cf66
da488946f6cc67a83dcc26c04484ca4f10fabc82
refs/heads/master
2021-01-20T19:26:06.015044
2016-05-22T14:53:37
2016-05-22T14:53:37
60,502,688
2
0
null
null
null
null
UTF-8
Python
false
false
1,125
py
''' Wrappers for the "CoreWLAN" framework on MacOS X. These wrappers don't include documentation, please check Apple's documention for information on how to use this framework and PyObjC's documentation for general tips and tricks regarding the translation between Python and (Objective-)C frameworks ''' import os from pyobjc_setup import setup, Extension VERSION="3.2a1" setup( name='pyobjc-framework-CoreWLAN', version=VERSION, description = "Wrappers for the framework CoreWLAN on Mac OS X", long_description=__doc__, packages = [ "CoreWLAN" ], setup_requires = [ 'pyobjc-core>=' + VERSION, ], install_requires = [ 'pyobjc-core>=' + VERSION, 'pyobjc-framework-Cocoa>=' + VERSION, ], ext_modules = [ Extension("CoreWLAN._CoreWLAN", [ "Modules/_CoreWLAN.m" ], extra_link_args=["-framework", "CoreWLAN"], depends=[ os.path.join('Modules', fn) for fn in os.listdir('Modules') if fn.startswith('_CoreWLAN') ] ), ], min_os_level="10.6", )
[ "ronaldoussoren@mac.com" ]
ronaldoussoren@mac.com
4927f0567834e6f5706c9a64a772fcd7bd34f7b1
bd0cabc8f76d6861e6cc13c72eb178d3e9b697b7
/adwords_python3_examples_10.1.0/v201710/basic_operations/update_campaign.py
d2404134ccd5503d6b237c63298f3e9146d0a651
[ "MIT" ]
permissive
xyla-io/hazel
4d8334766b6176bda21c99fefd4cfb64f05ffc5d
260ce906761d8b808c21ca61b44cc71ca3329e8c
refs/heads/main
2022-12-27T13:57:07.421062
2020-10-14T19:01:16
2020-10-14T19:01:16
304,109,218
0
0
null
null
null
null
UTF-8
Python
false
false
1,757
py
#!/usr/bin/env python # # Copyright 2016 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://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. """This example updates a campaign by setting its status to PAUSED. To get campaigns, run get_campaigns.py. The LoadFromStorage method is pulling credentials and properties from a "googleads.yaml" file. By default, it looks for this file in your home directory. For more information, see the "Caching authentication information" section of our README. """ from googleads import adwords CAMPAIGN_ID = 'INSERT_CAMPAIGN_ID_HERE' def main(client, campaign_id): # Initialize appropriate service. campaign_service = client.GetService('CampaignService', version='v201710') # Construct operations and update campaign. operations = [{ 'operator': 'SET', 'operand': { 'id': campaign_id, 'status': 'PAUSED' } }] campaigns = campaign_service.mutate(operations) # Display results. for campaign in campaigns['value']: print(('Campaign with name "%s" and id "%s" was updated.' % (campaign['name'], campaign['id']))) if __name__ == '__main__': # Initialize client object. adwords_client = adwords.AdWordsClient.LoadFromStorage() main(adwords_client, CAMPAIGN_ID)
[ "gregory@incipia.co" ]
gregory@incipia.co
533f0946b24008dd61bcc13df296b0ba6c623059
b85de5b2a65baa6b67666c65b4e059bf6caaaf6a
/CodeKata/BetweenRange.py
11e7a801b3d26fb459047a4e980df8ef473e2dd4
[]
no_license
ar95314/Guvi-1
319189d4317aa0c2075e02ca71777c8587eb847b
ef6da1cfd18714adc3acf023314e481ebe326d4e
refs/heads/master
2020-07-07T02:35:49.526732
2019-07-17T18:03:44
2019-07-17T18:03:44
null
0
0
null
null
null
null
UTF-8
Python
false
false
134
py
num=int(input()) sr,er=map(int,input().split()) for i in range (sr+1,er): if num==i: print('yes') break else: print('no')
[ "noreply@github.com" ]
ar95314.noreply@github.com
eab6dc3cbf21c0c830a8a59d2b7a7cec4fc073f4
003372621424577306aff35de88f7366fcc4baa0
/sa_tools_core/libs/qcloud/qcloudsdkbmlb/DescribeBmForwardRulesRequest.py
8f21d2009e66002bf33ae7d5ef23a2bc5d1b1ae4
[]
no_license
stoensin/sa-tools-core
ab28ca5f7a8d5703952db9e6554b104682507964
c0faeef4de8ba677817384d88cb107ad2308c03e
refs/heads/master
2020-07-11T06:59:33.224305
2019-08-22T07:36:46
2019-08-22T07:36:46
204,472,284
1
0
null
2019-08-26T12:36:18
2019-08-26T12:36:18
null
UTF-8
Python
false
false
826
py
# -*- coding: utf-8 -*- from ..qcloudsdkcore.request import Request class DescribeBmForwardRulesRequest(Request): def __init__(self): super(DescribeBmForwardRulesRequest, self).__init__( 'bmlb', 'qcloudcliV1', 'DescribeBmForwardRules', 'bmlb.api.qcloud.com') def get_domainIds(self): return self.get_params().get('domainIds') def set_domainIds(self, domainIds): self.add_param('domainIds', domainIds) def get_listenerId(self): return self.get_params().get('listenerId') def set_listenerId(self, listenerId): self.add_param('listenerId', listenerId) def get_loadBalancerId(self): return self.get_params().get('loadBalancerId') def set_loadBalancerId(self, loadBalancerId): self.add_param('loadBalancerId', loadBalancerId)
[ "tclh123@gmail.com" ]
tclh123@gmail.com
cf2d19b4928717ef00cf356b37153917f6e9fbcf
621a40fa363dc0c32c96a4c8fdfe9142877e2ff1
/ietf/wsgi.py
d82a32446861073c43c2f4d1a7d2e60d4fd0ab64
[ "BSD-3-Clause", "LicenseRef-scancode-unknown-license-reference" ]
permissive
omunroe-com/ietfdb2
d9c40bebe4b25059f810c70dd1370cca30cb3c36
aeaae292fbd55aca1b6043227ec105e67d73367f
refs/heads/master
2020-04-04T21:05:56.067430
2018-11-05T09:08:27
2018-11-05T09:08:27
156,273,382
2
0
null
null
null
null
UTF-8
Python
false
false
1,960
py
""" WSGI configuration for the datatracker. The following apache datatracker configuration has been used together with a datatracker checkout of trunk@ under /srv/www/ietfdb/ to run this on a development server using mod_wsgi under apache. For a production server, additional access restrictions are needed for the secretariat tools. ---- # This directive must be set globally, not inside <Virtualhost/>: WSGIPythonEggs /var/www/.python-eggs/ <VirtualHost *:80> ServerName tracker.tools.ietf.org ServerSignature Off CustomLog /var/log/apache2/tracker.tools.ietf.org-access.log full ErrorLog /var/log/apache2/tracker.tools.ietf.org-error.log DocumentRoot "/srv/www/ietfdb/static/" Alias /robots.tx /srv/www/ietfdb/static/dev/robots.txt AliasMatch "^/((favicon.ico|images|css|js|media|secretariat)(.*))$" /srv/www/ietfdb/static/$1 WSGIScriptAlias / /srv/www/ietfdb/ietf/wsgi.py <Location "/accounts/login"> AuthType Digest AuthName "IETF" AuthUserFile /var/local/loginmgr/digest AuthGroupFile /var/local/loginmgr/groups AuthDigestDomain http://tools.ietf.org/ Require valid-user </Location> </VirtualHost> ---- """ import os import sys import syslog path = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) syslog.openlog("datatracker", syslog.LOG_PID, syslog.LOG_USER) # Virtualenv support virtualenv_activation = os.path.join(path, "env", "bin", "activate_this.py") if os.path.exists(virtualenv_activation): syslog.syslog("Starting datatracker wsgi with virtualenv %s" % os.path.dirname(os.path.dirname(virtualenv_activation))) execfile(virtualenv_activation, dict(__file__=virtualenv_activation)) else: syslog.syslog("Starting datatracker wsgi without virtualenv") if not path in sys.path: sys.path.insert(0, path) os.environ.setdefault("DJANGO_SETTINGS_MODULE", "ietf.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
[ "henrik@levkowetz.com" ]
henrik@levkowetz.com
f533ae7916cf74894cb0ece8950764f06b0f5adc
b04791ac170876f94cfe9a021512916296e088ba
/reddit/management/commands/populate_test_data.py
c4156f7579ed585873b595b6c89f8eeb18acf392
[ "Apache-2.0" ]
permissive
imapex/suggestions
6cb88856f11b6ba2ecac9cde89f8a829a099ba10
292c04e72023269075ce1dba7af0314f2adf3785
refs/heads/master
2023-01-10T11:32:58.301709
2020-06-10T14:49:36
2020-06-10T14:49:36
65,758,745
0
0
Apache-2.0
2022-12-26T20:14:50
2016-08-15T19:27:17
Python
UTF-8
Python
false
false
3,742
py
from random import choice, randint from string import ascii_letters as letters from django.contrib.auth.models import User from django.core.management.base import BaseCommand from reddit.models import Comment from reddit.models import Submission from users.models import RedditUser class Command(BaseCommand): help = 'Generates tests data' def add_arguments(self, parser): parser.add_argument('--thread_count', type=int, default=10) parser.add_argument('--root_comments', type=int, default=10) def handle(self, *args, **options): self.thread_count = options['thread_count'] self.root_comments = options['root_comments'] self. random_usernames = [self.get_random_username() for _ in range(100)] for index, _ in enumerate(range(self.thread_count)): print("Thread {} out of {}".format(str(index), self.thread_count)) selftext = self.get_random_sentence() title = self.get_random_sentence(max_words=100, max_word_len=10) author = self.get_or_create_author(choice(self.random_usernames)) ups = randint(0, 1000) url = None downs = int(ups) / 2 comments = 0 submission = Submission(author=author, title=title, url=url, text=selftext, ups=int(ups), downs=downs, score=ups - downs, comment_count=comments) submission.generate_html() submission.save() for _ in range(self.root_comments): print("Adding thread comments...") comment_author = self.get_or_create_author(choice(self.random_usernames)) raw_text = self.get_random_sentence(max_words=100) new_comment = Comment.create(comment_author, raw_text, submission) new_comment.save() another_child = choice([True, False]) while another_child: self.add_replies(new_comment) another_child = choice([True, False]) def get_random_username(self, length=6): return ''.join(choice(letters) for _ in range(length)) def get_random_sentence(min_words=3, max_words=50, min_word_len=3, max_word_len=15): sentence = '' for _ in range(0, randint(min_words, max_words)): sentence += ''.join(choice(letters) for i in range(randint(min_word_len, max_word_len))) sentence += ' ' return sentence def get_or_create_author(self, username): try: user = User.objects.get(username=username) author = RedditUser.objects.get(user=user) except (User.DoesNotExist, RedditUser.DoesNotExist): print("Creating user {}".format(username)) new_author = User(username=username) new_author.set_password(username) new_author.save() author = RedditUser(user=new_author) author.save() return author def add_replies(self, root_comment, depth=1): if depth > 5: return comment_author = self.get_or_create_author(choice(self.random_usernames)) raw_text = self.get_random_sentence() new_comment = Comment.create(comment_author, raw_text, root_comment) new_comment.save() if choice([True, False]): self.add_replies(new_comment, depth + 1)
[ "kecorbin@cisco.com" ]
kecorbin@cisco.com
5260fa0a6723d36ec984dccb197382d2f047b7b0
c50e7eb190802d7849c0d0cea02fb4d2f0021777
/src/networkcloud/azext_networkcloud/aaz/latest/networkcloud/cluster/metricsconfiguration/_delete.py
571d8251f68cc3f61f8f9fe63aa571dd843e1012
[ "LicenseRef-scancode-generic-cla", "MIT" ]
permissive
Azure/azure-cli-extensions
c1615b19930bba7166c282918f166cd40ff6609c
b8c2cf97e991adf0c0a207d810316b8f4686dc29
refs/heads/main
2023-08-24T12:40:15.528432
2023-08-24T09:17:25
2023-08-24T09:17:25
106,580,024
336
1,226
MIT
2023-09-14T10:48:57
2017-10-11T16:27:31
Python
UTF-8
Python
false
false
6,008
py
# -------------------------------------------------------------------------------------------- # 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 aaz-dev-tools # -------------------------------------------------------------------------------------------- # pylint: skip-file # flake8: noqa from azure.cli.core.aaz import * @register_command( "networkcloud cluster metricsconfiguration delete", confirmation="Are you sure you want to perform this operation?", ) class Delete(AAZCommand): """Delete the metrics configuration of the provided cluster. :example: Delete metrics configuration of cluster az networkcloud cluster metricsconfiguration delete --cluster-name "clusterName" --resource-group "resourceGroupName" """ _aaz_info = { "version": "2023-07-01", "resources": [ ["mgmt-plane", "/subscriptions/{}/resourcegroups/{}/providers/microsoft.networkcloud/clusters/{}/metricsconfigurations/{}", "2023-07-01"], ] } AZ_SUPPORT_NO_WAIT = True def _handler(self, command_args): super()._handler(command_args) return self.build_lro_poller(self._execute_operations, None) _args_schema = None @classmethod def _build_arguments_schema(cls, *args, **kwargs): if cls._args_schema is not None: return cls._args_schema cls._args_schema = super()._build_arguments_schema(*args, **kwargs) # define Arg Group "" _args_schema = cls._args_schema _args_schema.cluster_name = AAZStrArg( options=["--cluster-name"], help="The name of the cluster.", required=True, id_part="name", fmt=AAZStrArgFormat( pattern="^([a-zA-Z0-9][a-zA-Z0-9-_]{0,28}[a-zA-Z0-9])$", ), ) _args_schema.metrics_configuration_name = AAZStrArg( options=["-n", "--name", "--metrics-configuration-name"], help="The name of the metrics configuration for the cluster.", required=True, id_part="child_name_1", fmt=AAZStrArgFormat( pattern="^default$", ), ) _args_schema.resource_group = AAZResourceGroupNameArg( required=True, ) return cls._args_schema def _execute_operations(self): self.pre_operations() yield self.MetricsConfigurationsDelete(ctx=self.ctx)() self.post_operations() @register_callback def pre_operations(self): pass @register_callback def post_operations(self): pass class MetricsConfigurationsDelete(AAZHttpOperation): CLIENT_TYPE = "MgmtClient" def __call__(self, *args, **kwargs): request = self.make_request() session = self.client.send_request(request=request, stream=False, **kwargs) if session.http_response.status_code in [202]: return self.client.build_lro_polling( self.ctx.args.no_wait, session, self.on_200, self.on_error, lro_options={"final-state-via": "location"}, path_format_arguments=self.url_parameters, ) if session.http_response.status_code in [200]: return self.client.build_lro_polling( self.ctx.args.no_wait, session, self.on_200, self.on_error, lro_options={"final-state-via": "location"}, path_format_arguments=self.url_parameters, ) if session.http_response.status_code in [204]: return self.client.build_lro_polling( self.ctx.args.no_wait, session, self.on_204, self.on_error, lro_options={"final-state-via": "location"}, path_format_arguments=self.url_parameters, ) return self.on_error(session.http_response) @property def url(self): return self.client.format_url( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.NetworkCloud/clusters/{clusterName}/metricsConfigurations/{metricsConfigurationName}", **self.url_parameters ) @property def method(self): return "DELETE" @property def error_format(self): return "MgmtErrorFormat" @property def url_parameters(self): parameters = { **self.serialize_url_param( "clusterName", self.ctx.args.cluster_name, required=True, ), **self.serialize_url_param( "metricsConfigurationName", self.ctx.args.metrics_configuration_name, required=True, ), **self.serialize_url_param( "resourceGroupName", self.ctx.args.resource_group, required=True, ), **self.serialize_url_param( "subscriptionId", self.ctx.subscription_id, required=True, ), } return parameters @property def query_parameters(self): parameters = { **self.serialize_query_param( "api-version", "2023-07-01", required=True, ), } return parameters def on_200(self, session): pass def on_204(self, session): pass class _DeleteHelper: """Helper class for Delete""" __all__ = ["Delete"]
[ "noreply@github.com" ]
Azure.noreply@github.com
63cff687d76aaf00d18be6d51f31afe48a5829e0
e87d793b3a5facc6e54e0263fbd67703e1fbb382
/duckietown-world-venv/lib/python3.7/site-packages/geometry/manifolds/translation_group.py
e130e22128d84c5fe827461ccc4e730831887428
[]
no_license
llingg/behaviour-benchmarking
a860bbe709309e13f3e1133d916944882199a40f
85bbf1a9c2c628ba74480fe7abac3804d6afdac4
refs/heads/v1
2022-10-06T08:21:29.068329
2020-06-11T07:02:46
2020-06-11T07:02:46
259,622,704
0
0
null
2020-06-02T17:52:46
2020-04-28T11:52:08
C++
UTF-8
Python
false
false
2,334
py
# coding=utf-8 from contracts import contract from geometry.poses import extract_pieces, pose_from_rotation_translation, \ rotation_translation_from_pose from geometry.utils.numpy_backport import assert_allclose import numpy as np from .differentiable_manifold import DifferentiableManifold from .euclidean import R from .matrix_lie_group import MatrixLieGroup from .translation_algebra import tran __all__ = ['TranG', 'Tran', 'Tran1', 'Tran2', 'Tran3'] class TranG(MatrixLieGroup): ''' The translation subgroup of SE(n). ''' @contract(n='1|2|3') def __init__(self, n): algebra = tran[n] MatrixLieGroup.__init__(self, n=n + 1, algebra=algebra, dimension=n) self.En = R[n] DifferentiableManifold.isomorphism(self, algebra, self.algebra_from_group, self.group_from_algebra, itype='lie') def __repr__(self): # return 'Tran(%s)' % (self.n - 1) return 'Tr%s' % (self.n - 1) def belongs(self, x): # TODO: explicit R, t, zero, one = extract_pieces(x) # @UnusedVariable assert_allclose(R, np.eye(self.n - 1)) assert_allclose(zero, 0, err_msg='I expect the lower row to be 0.') assert_allclose(one, 1, err_msg='Bottom-right must be 1.') @contract(returns='belongs') def sample_uniform(self): t = self.En.sample_uniform() return pose_from_rotation_translation(np.eye(self.n - 1), t) def friendly(self, a): t = rotation_translation_from_pose(a)[1] return 'Tran(%s)' % (self.En.friendly(t)) def logmap(self, base, p): return base, p - base def expmap(self, bv): base, vel = bv return base + vel def algebra_from_group(self, g): a = np.zeros((self.n, self.n)) a[:-1, -1] = g[:-1, -1] return a def group_from_algebra(self, a): g = np.eye(self.n) g[:-1, -1] = a[:-1, -1] return g def interesting_points(self): points = [] for t in self.En.interesting_points(): p = pose_from_rotation_translation(np.eye(self.n - 1), t) points.append(p) return points Tran1 = TranG(1) Tran2 = TranG(2) Tran3 = TranG(3) Tran = {1: Tran1, 2: Tran2, 3: Tran3}
[ "linggl@student.ethz.ch" ]
linggl@student.ethz.ch
0de8c0b935ae6683187554cf72eba6595cdaa7c6
c68310a6f4a424445081df96a4674da69baf26d6
/8.- Functions/greet_users.py
3cc961a85b706c6e3d6736adcbae3fc2a4d96c69
[]
no_license
martincastro1575/python
d955fcbe300d3e47961ee2e194b815ac8a691d8e
2d170eb03ef562f2cc10399a5291790138a6ba0b
refs/heads/main
2023-02-15T17:25:33.233133
2021-01-15T15:30:09
2021-01-15T15:30:09
321,970,825
0
0
null
null
null
null
UTF-8
Python
false
false
257
py
def greet_users(names): '''Print a simple greeting to each user in the list ''' for name in names: msg = f"Hello, {name.title()}!!!" print(msg) usernames = ['martin', 'maria', 'ines','pedro','carlos','marita'] greet_users(usernames)
[ "martin.castro1575@gmail.com" ]
martin.castro1575@gmail.com
09f1f32060b30f3d31ee10840ebbf8c3e82c6fad
606431d6a2ff8f9d589e71c4f17813a094a169dc
/user_management/migrations/0005_userprofile.py
9c7772d71ba570e18e914bf34741f253783e5566
[]
no_license
kumar109-beep/Analytica
057f71a1ac7ff2408c5d3f0e9dd04cf26581101b
0270b0f52f4711c0d800f2591793fb2310f4437e
refs/heads/main
2023-08-12T14:25:54.722446
2021-09-26T15:44:13
2021-09-26T15:44:13
410,265,846
0
0
null
null
null
null
UTF-8
Python
false
false
802
py
# Generated by Django 2.2.1 on 2019-12-10 13:05 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('user_management', '0004_delete_user'), ] operations = [ migrations.CreateModel( name='UserProfile', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('avatar', models.ImageField(upload_to='images')), ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], ), ]
[ "rk468335@gmail.com" ]
rk468335@gmail.com
9f8f1c53af5aa38f6cda7ad07e16813879a9098e
85a9ffeccb64f6159adbd164ff98edf4ac315e33
/pysnmp/CAREL-ug40cdz-MIB.py
b095de4efa752fccf97399505cbcceda9f582c77
[ "Apache-2.0" ]
permissive
agustinhenze/mibs.snmplabs.com
5d7d5d4da84424c5f5a1ed2752f5043ae00019fb
1fc5c07860542b89212f4c8ab807057d9a9206c7
refs/heads/master
2020-12-26T12:41:41.132395
2019-08-16T15:51:41
2019-08-16T15:53:57
237,512,469
0
0
Apache-2.0
2020-01-31T20:41:36
2020-01-31T20:41:35
null
UTF-8
Python
false
false
43,178
py
# # PySNMP MIB module CAREL-ug40cdz-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/CAREL-ug40cdz-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:29:25 2019 # On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4 # Using Python version 3.7.3 (default, Mar 27 2019, 09:23:15) # OctetString, Integer, ObjectIdentifier = mibBuilder.importSymbols("ASN1", "OctetString", "Integer", "ObjectIdentifier") NamedValues, = mibBuilder.importSymbols("ASN1-ENUMERATION", "NamedValues") ValueSizeConstraint, ValueRangeConstraint, ConstraintsUnion, SingleValueConstraint, ConstraintsIntersection = mibBuilder.importSymbols("ASN1-REFINEMENT", "ValueSizeConstraint", "ValueRangeConstraint", "ConstraintsUnion", "SingleValueConstraint", "ConstraintsIntersection") ModuleCompliance, NotificationGroup, ObjectGroup = mibBuilder.importSymbols("SNMPv2-CONF", "ModuleCompliance", "NotificationGroup", "ObjectGroup") sysContact, sysName, sysLocation = mibBuilder.importSymbols("SNMPv2-MIB", "sysContact", "sysName", "sysLocation") Integer32, iso, Counter32, Counter64, TimeTicks, NotificationType, ObjectIdentity, MibIdentifier, MibScalar, MibTable, MibTableRow, MibTableColumn, enterprises, Bits, IpAddress, Unsigned32, Gauge32, ModuleIdentity = mibBuilder.importSymbols("SNMPv2-SMI", "Integer32", "iso", "Counter32", "Counter64", "TimeTicks", "NotificationType", "ObjectIdentity", "MibIdentifier", "MibScalar", "MibTable", "MibTableRow", "MibTableColumn", "enterprises", "Bits", "IpAddress", "Unsigned32", "Gauge32", "ModuleIdentity") DisplayString, TextualConvention = mibBuilder.importSymbols("SNMPv2-TC", "DisplayString", "TextualConvention") ug40cdzMIB = ModuleIdentity((1, 3, 6, 1, 4, 1, 9839, 2, 1)) ug40cdzMIB.setRevisions(('2006-04-11 16:45',)) if mibBuilder.loadTexts: ug40cdzMIB.setLastUpdated('200604111645Z') if mibBuilder.loadTexts: ug40cdzMIB.setOrganization('CAREL SpA') carel = MibIdentifier((1, 3, 6, 1, 4, 1, 9839)) systm = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 1)) agentRelease = MibScalar((1, 3, 6, 1, 4, 1, 9839, 1, 1), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: agentRelease.setStatus('current') agentCode = MibScalar((1, 3, 6, 1, 4, 1, 9839, 1, 2), Integer32()).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: agentCode.setStatus('current') instruments = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2)) webGateInfo = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0)) agentParameters = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 1)) netSize = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(1, 16))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: netSize.setStatus('current') baudRate = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 1, 2), Integer32().subtype(subtypeSpec=ConstraintsUnion(ValueRangeConstraint(1200, 1200), ValueRangeConstraint(2400, 2400), ValueRangeConstraint(4800, 4800), ValueRangeConstraint(9600, 9600), ValueRangeConstraint(19200, 19200), ))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: baudRate.setStatus('current') unitTypeGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 2)) unit1_Type = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 2, 1), DisplayString()).setLabel("unit1-Type").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: unit1_Type.setStatus('current') unitCodeGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 3)) unit1_Code = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 3, 1), Integer32()).setLabel("unit1-Code").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: unit1_Code.setStatus('current') unitSoftwareReleaseGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 4)) unit1_SoftwareRelease = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 4, 1), Integer32()).setLabel("unit1-SoftwareRelease").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: unit1_SoftwareRelease.setStatus('current') unitMinSoftwareReleaseGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 5)) unit1_MinSoftwareRelease = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 5, 1), Integer32()).setLabel("unit1-MinSoftwareRelease").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: unit1_MinSoftwareRelease.setStatus('current') unitMaxSoftwareReleaseGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 6)) unit1_MaxSoftwareRelease = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 6, 1), Integer32()).setLabel("unit1-MaxSoftwareRelease").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: unit1_MaxSoftwareRelease.setStatus('current') unitNoAnswerCounterGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 7)) unit1_NoAnswerCounter = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 7, 1), Integer32()).setLabel("unit1-NoAnswerCounter").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: unit1_NoAnswerCounter.setStatus('current') unitErrorChecksumCounterGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 8)) unit1_ErrorChecksumCounter = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 8, 1), Integer32()).setLabel("unit1-ErrorChecksumCounter").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: unit1_ErrorChecksumCounter.setStatus('current') unitTimeoutCounterGroup = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 0, 9)) unit1_TimeoutCounter = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 0, 9, 1), Integer32()).setLabel("unit1-TimeoutCounter").setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: unit1_TimeoutCounter.setStatus('current') digitalObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1)) systemOn = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: systemOn.setStatus('current') compressore1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: compressore1.setStatus('current') compressore2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: compressore2.setStatus('current') compressore3 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: compressore3.setStatus('current') compressore4 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: compressore4.setStatus('current') heating1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: heating1.setStatus('current') heating2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: heating2.setStatus('current') hotGasCoil = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: hotGasCoil.setStatus('current') dehumidification = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: dehumidification.setStatus('current') humidification = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: humidification.setStatus('current') emerg = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: emerg.setStatus('current') alarmAccess = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmAccess.setStatus('current') alarmRoomHT = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 21), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmRoomHT.setStatus('current') alarmRoomLT = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 22), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmRoomLT.setStatus('current') alarmRoomHH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmRoomHH.setStatus('current') alarmRoomLH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmRoomLH.setStatus('current') alarmRoomEAP = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmRoomEAP.setStatus('current') alarmFilter = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 26), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmFilter.setStatus('current') alarmFlood = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmFlood.setStatus('current') alarmAirFlow = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 28), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmAirFlow.setStatus('current') alarmHeater = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 29), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHeater.setStatus('current') alarmHP1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 30), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHP1.setStatus('current') alarmHP2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 31), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHP2.setStatus('current') alarmLP1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 32), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmLP1.setStatus('current') alarmLP2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 33), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmLP2.setStatus('current') alarmEXV1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 34), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmEXV1.setStatus('current') alarmEXV2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 35), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmEXV2.setStatus('current') alarmPSE = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 36), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmPSE.setStatus('current') alarmSmokeFire = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 37), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmSmokeFire.setStatus('current') alarmLAN = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 38), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmLAN.setStatus('current') alarmHUHC = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 39), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHUHC.setStatus('current') alarmHUPL = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 40), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHUPL.setStatus('current') alarmHUWL = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 41), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHUWL.setStatus('current') alarmCWDHT = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 42), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmCWDHT.setStatus('current') alarmCWF = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 43), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmCWF.setStatus('current') alarmCWFF = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 44), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmCWFF.setStatus('current') alarmCWHT = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 45), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmCWHT.setStatus('current') alarmRTS = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 46), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmRTS.setStatus('current') alarmHWS = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 47), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHWS.setStatus('current') alarmCWS = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 48), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmCWS.setStatus('current') alarmOTS = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 49), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmOTS.setStatus('current') alarmDTS = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 50), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmDTS.setStatus('current') alarmRHS = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 51), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmRHS.setStatus('current') alarmCWOTS = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 52), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmCWOTS.setStatus('current') alarmC1Hours = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 53), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmC1Hours.setStatus('current') alarmC2Hours = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 54), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmC2Hours.setStatus('current') alarmC3Hours = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 55), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmC3Hours.setStatus('current') alarmC4Hours = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 56), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmC4Hours.setStatus('current') alarmFilterHours = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 57), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmFilterHours.setStatus('current') alarmHeat1Hours = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 58), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHeat1Hours.setStatus('current') alarmHeat2Hours = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 59), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHeat2Hours.setStatus('current') alarmHumHours = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 60), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHumHours.setStatus('current') alarmUnitHours = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 61), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmUnitHours.setStatus('current') alarmDI2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 62), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmDI2.setStatus('current') alarmDI4 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 63), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmDI4.setStatus('current') alarmDI6 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 64), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmDI6.setStatus('current') alarmHum = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 65), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmHum.setStatus('current') alarmGeneral = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 66), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmGeneral.setStatus('current') alarm2ndLevel = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 67), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarm2ndLevel.setStatus('current') alarmA = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 68), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmA.setStatus('current') alarmB = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 69), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmB.setStatus('current') alarmC = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 70), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readonly") if mibBuilder.loadTexts: alarmC.setStatus('current') selDXCW = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 71), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: selDXCW.setStatus('current') selSW = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 72), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: selSW.setStatus('current') systemOnOff = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 75), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: systemOnOff.setStatus('current') resetAlarm = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 76), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetAlarm.setStatus('current') resetHrsFilt = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 77), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetHrsFilt.setStatus('current') resetHrC1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 78), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetHrC1.setStatus('current') resetHrC2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 79), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetHrC2.setStatus('current') resetHrC3 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 80), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetHrC3.setStatus('current') resetHrC4 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 81), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetHrC4.setStatus('current') resetStC1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 82), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetStC1.setStatus('current') resetStC2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 83), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetStC2.setStatus('current') resetStC3 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 84), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetStC3.setStatus('current') resetStC4 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 85), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetStC4.setStatus('current') resetHrH1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 86), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetHrH1.setStatus('current') resetHrH2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 87), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetHrH2.setStatus('current') resetStH1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 88), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetStH1.setStatus('current') resetStH2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 89), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetStH2.setStatus('current') resetHrHU = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 90), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetHrHU.setStatus('current') resetStHU = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 91), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetStHU.setStatus('current') resetHrACU = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 92), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: resetHrACU.setStatus('current') sleepmode = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 95), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: sleepmode.setStatus('current') smtest = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 96), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: smtest.setStatus('current') enablemeanT = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 1, 97), Integer32().subtype(subtypeSpec=ValueRangeConstraint(0, 1))).setUnits('N/A').setMaxAccess("readwrite") if mibBuilder.loadTexts: enablemeanT.setStatus('current') analogObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2)) roomTemp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: roomTemp.setStatus('current') outdoorTemp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: outdoorTemp.setStatus('current') deliveryTemp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: deliveryTemp.setStatus('current') cwTemp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: cwTemp.setStatus('current') hwTemp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: hwTemp.setStatus('current') roomRH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readonly") if mibBuilder.loadTexts: roomRH.setStatus('current') cwoTemp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: cwoTemp.setStatus('current') evapPress1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('bar').setMaxAccess("readwrite") if mibBuilder.loadTexts: evapPress1.setStatus('current') evapPress2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('bar').setMaxAccess("readwrite") if mibBuilder.loadTexts: evapPress2.setStatus('current') suctTemp1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 10), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: suctTemp1.setStatus('current') suctTemp2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 11), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: suctTemp2.setStatus('current') evapTemp1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: evapTemp1.setStatus('current') evapTemp2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: evapTemp2.setStatus('current') ssh1 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: ssh1.setStatus('current') ssh2 = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readonly") if mibBuilder.loadTexts: ssh2.setStatus('current') coolRamp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('%').setMaxAccess("readonly") if mibBuilder.loadTexts: coolRamp.setStatus('current') heatRamp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('%').setMaxAccess("readonly") if mibBuilder.loadTexts: heatRamp.setStatus('current') fanSpeed = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('%').setMaxAccess("readonly") if mibBuilder.loadTexts: fanSpeed.setStatus('current') coolSetP = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: coolSetP.setStatus('current') coolDiff = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 21), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: coolDiff.setStatus('current') cool2SetP = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 22), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: cool2SetP.setStatus('current') heatSetP = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: heatSetP.setStatus('current') heat2SetP = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: heat2SetP.setStatus('current') heatDiff = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: heatDiff.setStatus('current') thrsHT = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 26), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C x10').setMaxAccess("readwrite") if mibBuilder.loadTexts: thrsHT.setStatus('current') thrsLT = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C x10').setMaxAccess("readwrite") if mibBuilder.loadTexts: thrsLT.setStatus('current') smCoolSetp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 28), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: smCoolSetp.setStatus('current') smHeatSetp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 29), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: smHeatSetp.setStatus('current') cwDehumSetp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 30), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: cwDehumSetp.setStatus('current') cwHtThrsh = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 31), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: cwHtThrsh.setStatus('current') cwModeSetp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 32), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: cwModeSetp.setStatus('current') radcoolSpES = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 33), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: radcoolSpES.setStatus('current') radcoolSpDX = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 34), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: radcoolSpDX.setStatus('current') delTempLimit = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 35), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C x10').setMaxAccess("readwrite") if mibBuilder.loadTexts: delTempLimit.setStatus('current') dtAutChgMLT = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 2, 36), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('degrees C').setMaxAccess("readwrite") if mibBuilder.loadTexts: dtAutChgMLT.setStatus('current') integerObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3)) filterWorkH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 1), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: filterWorkH.setStatus('current') unitWorkH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 2), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: unitWorkH.setStatus('current') compr1WorkH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 3), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: compr1WorkH.setStatus('current') compr2WorkH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 4), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: compr2WorkH.setStatus('current') compr3WorkH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 5), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: compr3WorkH.setStatus('current') compr4WorkH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 6), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: compr4WorkH.setStatus('current') heat1WorkH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 7), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: heat1WorkH.setStatus('current') heat2WorkH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 8), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: heat2WorkH.setStatus('current') humiWorkH = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 9), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readonly") if mibBuilder.loadTexts: humiWorkH.setStatus('current') dehumPband = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 12), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: dehumPband.setStatus('current') humidPband = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 13), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: humidPband.setStatus('current') hhAlarmThrsh = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 14), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: hhAlarmThrsh.setStatus('current') lhAlarmThrsh = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 15), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: lhAlarmThrsh.setStatus('current') dehumSetp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 16), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: dehumSetp.setStatus('current') smDehumSetp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 17), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: smDehumSetp.setStatus('current') humidSetp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 18), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: humidSetp.setStatus('current') smHumidSetp = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 19), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('rH%').setMaxAccess("readwrite") if mibBuilder.loadTexts: smHumidSetp.setStatus('current') pwOnDelay = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 20), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('s').setMaxAccess("readwrite") if mibBuilder.loadTexts: pwOnDelay.setStatus('current') regulDelay = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 21), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('s').setMaxAccess("readwrite") if mibBuilder.loadTexts: regulDelay.setStatus('current') lowPdelay = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 22), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('s').setMaxAccess("readwrite") if mibBuilder.loadTexts: lowPdelay.setStatus('current') thAlarmdelay = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 23), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('min').setMaxAccess("readwrite") if mibBuilder.loadTexts: thAlarmdelay.setStatus('current') regExcTime = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 24), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('min').setMaxAccess("readwrite") if mibBuilder.loadTexts: regExcTime.setStatus('current') stdbyTime = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 25), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('h').setMaxAccess("readwrite") if mibBuilder.loadTexts: stdbyTime.setStatus('current') lanUnit = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 27), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('n').setMaxAccess("readwrite") if mibBuilder.loadTexts: lanUnit.setStatus('current') smCycleTime = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 28), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('min').setMaxAccess("readwrite") if mibBuilder.loadTexts: smCycleTime.setStatus('current') exv1steps = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 29), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('n').setMaxAccess("readonly") if mibBuilder.loadTexts: exv1steps.setStatus('current') exv2steps = MibScalar((1, 3, 6, 1, 4, 1, 9839, 2, 1, 3, 30), Integer32().subtype(subtypeSpec=ValueRangeConstraint(-32767, 32767))).setUnits('n').setMaxAccess("readonly") if mibBuilder.loadTexts: exv2steps.setStatus('current') mibBuilder.exportSymbols("CAREL-ug40cdz-MIB", coolDiff=coolDiff, alarmCWOTS=alarmCWOTS, unit1_MaxSoftwareRelease=unit1_MaxSoftwareRelease, cool2SetP=cool2SetP, alarmCWHT=alarmCWHT, ug40cdzMIB=ug40cdzMIB, humidPband=humidPband, webGateInfo=webGateInfo, smCoolSetp=smCoolSetp, alarmGeneral=alarmGeneral, alarmAccess=alarmAccess, resetHrC4=resetHrC4, alarmHeater=alarmHeater, compr1WorkH=compr1WorkH, systemOn=systemOn, alarmRoomHH=alarmRoomHH, alarmPSE=alarmPSE, regExcTime=regExcTime, heat2SetP=heat2SetP, unit1_TimeoutCounter=unit1_TimeoutCounter, resetHrC1=resetHrC1, alarmLP1=alarmLP1, resetHrACU=resetHrACU, dehumPband=dehumPband, heating2=heating2, resetStC4=resetStC4, resetStC3=resetStC3, compressore1=compressore1, heat1WorkH=heat1WorkH, alarmEXV2=alarmEXV2, compr3WorkH=compr3WorkH, heating1=heating1, alarmHUPL=alarmHUPL, alarmDTS=alarmDTS, alarmDI4=alarmDI4, resetStC2=resetStC2, evapPress1=evapPress1, unitSoftwareReleaseGroup=unitSoftwareReleaseGroup, digitalObjects=digitalObjects, dehumSetp=dehumSetp, radcoolSpDX=radcoolSpDX, compr4WorkH=compr4WorkH, lowPdelay=lowPdelay, unit1_ErrorChecksumCounter=unit1_ErrorChecksumCounter, resetHrH1=resetHrH1, systm=systm, alarmCWFF=alarmCWFF, cwHtThrsh=cwHtThrsh, unitWorkH=unitWorkH, alarmRTS=alarmRTS, unit1_Type=unit1_Type, alarmUnitHours=alarmUnitHours, enablemeanT=enablemeanT, suctTemp2=suctTemp2, alarmA=alarmA, smHeatSetp=smHeatSetp, smtest=smtest, alarmB=alarmB, cwDehumSetp=cwDehumSetp, alarmC=alarmC, alarmRHS=alarmRHS, resetHrH2=resetHrH2, baudRate=baudRate, alarmCWS=alarmCWS, unit1_Code=unit1_Code, unitTypeGroup=unitTypeGroup, dtAutChgMLT=dtAutChgMLT, resetHrC2=resetHrC2, alarmCWDHT=alarmCWDHT, instruments=instruments, alarmFilterHours=alarmFilterHours, alarmDI2=alarmDI2, alarmHeat2Hours=alarmHeat2Hours, sleepmode=sleepmode, lhAlarmThrsh=lhAlarmThrsh, cwModeSetp=cwModeSetp, emerg=emerg, compressore3=compressore3, agentCode=agentCode, agentParameters=agentParameters, unitNoAnswerCounterGroup=unitNoAnswerCounterGroup, evapTemp1=evapTemp1, resetStH1=resetStH1, PYSNMP_MODULE_ID=ug40cdzMIB, alarmSmokeFire=alarmSmokeFire, coolRamp=coolRamp, alarmRoomHT=alarmRoomHT, alarmHumHours=alarmHumHours, resetStH2=resetStH2, alarmHum=alarmHum, fanSpeed=fanSpeed, roomRH=roomRH, alarmHeat1Hours=alarmHeat1Hours, ssh1=ssh1, cwoTemp=cwoTemp, thrsLT=thrsLT, suctTemp1=suctTemp1, humidification=humidification, netSize=netSize, unitCodeGroup=unitCodeGroup, humidSetp=humidSetp, heatSetP=heatSetP, resetHrC3=resetHrC3, unit1_MinSoftwareRelease=unit1_MinSoftwareRelease, resetHrsFilt=resetHrsFilt, unit1_NoAnswerCounter=unit1_NoAnswerCounter, filterWorkH=filterWorkH, unitMinSoftwareReleaseGroup=unitMinSoftwareReleaseGroup, roomTemp=roomTemp, compressore4=compressore4, alarmHP2=alarmHP2, systemOnOff=systemOnOff, exv2steps=exv2steps, resetStC1=resetStC1, dehumidification=dehumidification, unitTimeoutCounterGroup=unitTimeoutCounterGroup, outdoorTemp=outdoorTemp, alarm2ndLevel=alarm2ndLevel, alarmAirFlow=alarmAirFlow, alarmCWF=alarmCWF, heatDiff=heatDiff, alarmHWS=alarmHWS, heat2WorkH=heat2WorkH, unitErrorChecksumCounterGroup=unitErrorChecksumCounterGroup, selSW=selSW, cwTemp=cwTemp, resetHrHU=resetHrHU, humiWorkH=humiWorkH, coolSetP=coolSetP, alarmLAN=alarmLAN, alarmHP1=alarmHP1, alarmRoomEAP=alarmRoomEAP, lanUnit=lanUnit, selDXCW=selDXCW, evapPress2=evapPress2, agentRelease=agentRelease, resetStHU=resetStHU, unit1_SoftwareRelease=unit1_SoftwareRelease, alarmRoomLH=alarmRoomLH, alarmEXV1=alarmEXV1, delTempLimit=delTempLimit, unitMaxSoftwareReleaseGroup=unitMaxSoftwareReleaseGroup, thAlarmdelay=thAlarmdelay, heatRamp=heatRamp, evapTemp2=evapTemp2, thrsHT=thrsHT, smHumidSetp=smHumidSetp, compr2WorkH=compr2WorkH, radcoolSpES=radcoolSpES, hotGasCoil=hotGasCoil, resetAlarm=resetAlarm, carel=carel, analogObjects=analogObjects, alarmHUHC=alarmHUHC, alarmC3Hours=alarmC3Hours, compressore2=compressore2, stdbyTime=stdbyTime, integerObjects=integerObjects, pwOnDelay=pwOnDelay, smCycleTime=smCycleTime, alarmLP2=alarmLP2, alarmC1Hours=alarmC1Hours, alarmOTS=alarmOTS, alarmFilter=alarmFilter, alarmDI6=alarmDI6, alarmHUWL=alarmHUWL, regulDelay=regulDelay, alarmC4Hours=alarmC4Hours, exv1steps=exv1steps, hhAlarmThrsh=hhAlarmThrsh, alarmFlood=alarmFlood, alarmC2Hours=alarmC2Hours, deliveryTemp=deliveryTemp, alarmRoomLT=alarmRoomLT, hwTemp=hwTemp, ssh2=ssh2, smDehumSetp=smDehumSetp)
[ "dcwangmit01@gmail.com" ]
dcwangmit01@gmail.com
90c1cdf8950b6acf443223a67548294405a3c392
3cedc7c1519d3b013aad9ec4e6a6ee7834da7589
/python_code/需求实践/0009/s1.py
c11e05606eaace80e31655dcaad195d382a79373
[]
no_license
hzrg/songqin_course
53437100669ee93d2ac5ecae5de938b1a4007d7f
05e422ce34a42fd6d3819722a19252f8005e79ed
refs/heads/master
2022-02-09T13:27:59.871400
2019-06-13T06:08:45
2019-06-13T06:08:45
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,146
py
from random import randint import time,os import threading class Tiger: classname = 'tiger' def __init__(self): self.weight = 200 def roar(self): print('wow!!!') self.weight -= 5 def feed(self,food): if food == 'meat': self.weight += 10 print('正确,体重 + 10') else : self.weight -= 10 print('太惨了,体重 - 10') class Sheep: classname = 'sheep' def __init__(self): self.weight = 100 def roar(self): print('mie~~') self.weight -= 5 def feed(self,food): if food == 'grass': self.weight += 10 print('正确,体重 + 10') else : self.weight -= 10 print('太惨了,体重 - 10') class Room: def __init__(self,num,animal): self.num = num self.animal = animal rooms = [] for no in range(10): if randint(0,1) == 0: ani = Tiger() else: ani = Sheep() room = Room(no+1,ani) rooms.append(room) def count_thread(): # 记录下游戏开始时间 startTime = time.time() while True: time.sleep(0.1) curTime = time.time() if (curTime - startTime) > 20: break print(u'游戏结束') for room in rooms: print(u'房间%s, 里面是%s,体重%s' % (room.num, room.animal.classname, room.animal.weight)) os._exit(0) t = threading.Thread(target=count_thread) t.start() # 循环做如下事情 while True: # 提示房间号,让用户选择 敲门 还是 喂食 curRoomIdx = randint(0,9) room = rooms[curRoomIdx] print('当前来到房间%s,敲门【q】还是喂食【w】' % room.num) ch = input() # 如果选择敲门:...... if ch == 'q': room.animal.roar() # 如果选择喂食:...... elif ch == 'w': print('请输入食物:') food = input() room.animal.feed(food)
[ "1174497735@qq.com" ]
1174497735@qq.com
10521b84e52cdff6f2ef557b34b83273d4874d18
7b5828edda7751700ca7002b40a214e39e5f48a8
/EA/core/sims4/log.py
fe7bf0cafc9bab236d45d1037b763c994673b2e9
[]
no_license
daniela-venuta/Sims-4-Python-Script-Workspace
54c33dac02f84daed66f46b7307f222fede0fa62
f408b28fb34626b2e3b2953152343d591a328d66
refs/heads/main
2023-03-29T18:08:39.202803
2021-03-30T19:00:42
2021-03-30T19:00:42
353,111,243
1
0
null
null
null
null
UTF-8
Python
false
false
21,403
py
import _trace import builtins import datetime import inspect import os import re import sys import textwrap import traceback from sims4.console_colors import ConsoleColor from singletons import DEFAULT import debug_breakpoint import macros import sims4.console_colors ERROR_DIALOG_MESSAGE_LINELENGTH = 120 TYPE_ASSERT = _trace.TYPE_ASSERT TYPE_VERIFY = _trace.TYPE_VERIFY TYPE_TRACE = _trace.TYPE_TRACE TYPE_FAIL = _trace.TYPE_FAIL TYPE_LOG = _trace.TYPE_LOG LEVEL_UNDEFINED = _trace.LEVEL_UNDEFINED LEVEL_DEBUG = _trace.LEVEL_DEBUG LEVEL_INFO = _trace.LEVEL_INFO LEVEL_WARN = _trace.LEVEL_WARN LEVEL_ERROR = _trace.LEVEL_ERROR LEVEL_EXCEPTION = _trace.LEVEL_FATAL LEVEL_FATAL = _trace.LEVEL_FATAL RESULT_NONE = _trace.RESULT_NONE RESULT_BREAK = _trace.RESULT_BREAK RESULT_DISABLE = _trace.RESULT_DISABLE ASSERT_RESULT_RETRY = 2 ASSERT_RESULT_IGNORE = 3 ASSERT_RESULT_DISABLE = 5 CONSOLE_COLORS = {LEVEL_EXCEPTION: ConsoleColor.YELLOW | ConsoleColor.BG_DARK_RED, LEVEL_ERROR: ConsoleColor.RED, LEVEL_WARN: ConsoleColor.YELLOW, (LEVEL_INFO, 'Always'): ConsoleColor.BLUE, (LEVEL_INFO, 'Status'): ConsoleColor.GREEN} DEFAULT_STACK_TRACE_BLACKLIST = frozenset({'log.py', 'gsi_dump_handlers.py', 'developer_commands.py', 'dump.py'}) DEFAULT_STACK_TRACE_VARIABLE_STR_SIZE_LIMIT = 1024 sim_error_dialog_enabled = True sim_error_dialog_ignore = set() callback_on_error_or_exception = None callback_on_error_in_progress = False GSI_DUMP_STR = '[GSI_DUMP]' config = _trace.config reset = _trace.reset set_level = _trace.set_level if hasattr(_trace, 'should_trace'): should_trace = _trace.should_trace else: def should_trace(trace_type, group, level): return True ring_bell_on_exception = False def call_callback_on_error_or_exception(message): global callback_on_error_in_progress if not callback_on_error_in_progress: try: callback_on_error_in_progress = True callback_on_error_or_exception(message) except: pass finally: callback_on_error_in_progress = False def get_console_color(level, group): key = (level, group) if key in CONSOLE_COLORS: return CONSOLE_COLORS[key] else: key = level if key in CONSOLE_COLORS: return CONSOLE_COLORS[key] return -1 def get_log_zone(): from sims4.zone_utils import zone_numbers zone_id = sims4.zone_utils.zone_id return zone_numbers[zone_id] def format_exc(exc=None): if exc is None: tb = traceback.format_exc() else: tb = ''.join(traceback.format_exception(type(exc), exc, exc.__traceback__)) return tb def message(message, *args, owner=None): if owner: message = ('[{owner}] ' + message).format(*args, owner=owner) elif args: message = message.format(*args) frame = sys._getframe(1) return _trace.trace(TYPE_TRACE, message, frame=frame) def log(group, message, *args, level, frame=DEFAULT, owner=None): if owner: message = ('[{owner}] ' + message).format(*args, owner=owner) elif args: message = message.format(*args) if frame is DEFAULT: frame = sys._getframe(1) return _trace.trace(TYPE_LOG, message, group, level, get_log_zone(), frame, color=get_console_color(level, group)) def blank_line(group, level, frame, ring_bell=False): bell = '\x07' if ring_bell else '' if frame is DEFAULT: frame = sys._getframe(1) _trace.trace(TYPE_LOG, bell + '\r' + '\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t', group, level, get_log_zone(), frame, color=ConsoleColor.BG_YELLOW | ConsoleColor.DARK_RED) def exception(group, message, *args, exc=None, log_current_callstack=True, frame=DEFAULT, use_format_stack=False, level=LEVEL_EXCEPTION, owner=None): if owner: message = ('[{owner}] ' + message).format(*args, owner=owner) elif args: message = message.format(*args) if frame is DEFAULT: frame = sys._getframe(1) if exc is None: (exc_type, exc, exc_tb) = sys.exc_info() log_current_callstack_prefix = '' else: exc_type = type(exc) exc_tb = exc.__traceback__ log_current_callstack_prefix = 'Caught and logged:\n' if callback_on_error_or_exception is not None: message = GSI_DUMP_STR + message tb = format_exc(exc) if use_format_stack: dialog_text = ''.join(traceback.format_stack(frame)) else: dialog_text = tb if exc is not None: try: headline = str(exc) except: headline = '<unprintable exception {}>'.format(type(exc).__name__) match = re.match("'NoneType' object has no attribute '(.*)'", headline) if match: attr = match.group(1) offending_line = tb.splitlines()[-2] match = re.match('\\s*(?:.* = |if |elif |else |for |while )?(.+)\\.{}\\b.*'.format(attr), offending_line) if match: headline = '"{}" was unexpectedly None'.format(match.group(1)) classname = exc_type.__name__ if classname in headline: headline = ' ({})'.format(headline) elif headline: headline = ' ({}: {})'.format(classname, headline) else: headline = ' ({})'.format(classname) message += headline message_base = message tbx = tb.split('\n', 1) tbxx = tbx[1].rsplit('\n', 2) message += '\n' + tbx[0] + '\n' if log_current_callstack: message += log_current_callstack_prefix last_tb = exc_tb while last_tb.tb_next: last_tb = last_tb.tb_next message = generate_message_with_callstack(message, frame=last_tb.tb_frame) else: message += tbxx[0] message += tbxx[1] exc_tb = None blank_line(group, level, frame, ring_bell=ring_bell_on_exception) _trace.trace(TYPE_LOG, message, group, level, get_log_zone(), frame, color=get_console_color(level, group)) call_callback_on_error_or_exception(message) errorLog = '<report><version>2</version><sessionid>%s</sessionid><type>desync</type>' errorLog += '<sku>%s</sku><createtime>' errorLog += datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') errorLog += '</createtime><buildsignature>%s</buildsignature>' errorLog += '<categoryid>%s</categoryid>' errorLog += '<desyncid>%s</desyncid>' errorLog += '<systemconfig/><screenshot/>' errorLog += '<desyncdata>%s</desyncdata></report>\n' _trace.log_exception(errorLog, message, frame) sim_error_dialog(message_base, exc_tb, dialog_text, level=level) def sim_error_dialog(message, exc_tb, exc_tb_text, level=LEVEL_EXCEPTION): global sim_error_dialog_enabled return if level < LEVEL_ERROR: return exc_fname = 'unknown' exc_line = 0 if exc_tb is not None: cur_frame = exc_tb depth = 0 max_depth = 100 while cur_frame and depth < max_depth: depth += 1 exc_line = cur_frame.tb_lineno exc_fname = cur_frame.tb_frame.f_code.co_filename cur_frame = cur_frame.tb_next exc_loc = (exc_fname, exc_line) if exc_loc in sim_error_dialog_ignore: return sim_id = 0 obj_id_list = [] exc_tb_text = exc_tb_text.replace('\n', os.linesep) message = textwrap.fill(message, width=ERROR_DIALOG_MESSAGE_LINELENGTH) message = message.replace('\n', os.linesep) result = _trace.show_sim_error(message, exc_tb_text, sim_id, obj_id_list) if result == ASSERT_RESULT_DISABLE: sim_error_dialog_enabled = False elif result == ASSERT_RESULT_IGNORE: sim_error_dialog_ignore.add(exc_loc) def generate_message_with_callstack(message, *args, frame=DEFAULT, owner=None, std_format=True, blacklist=DEFAULT_STACK_TRACE_BLACKLIST, variable_size_limit=DEFAULT_STACK_TRACE_VARIABLE_STR_SIZE_LIMIT): if owner: message = ('[{owner}] ' + message).format(*args, owner=owner) elif args: message = message.format(*args) if frame is DEFAULT: frame = sys._getframe(1) if std_format: tb = traceback.format_stack(frame) tb = ''.join(tb) return '{0}\n{1}'.format(message, tb) stack = [] while frame: stack.append(frame) frame = frame.f_back stack.reverse() for frame in stack: co_filename = frame.f_code.co_filename if blacklist and any(blacklisted_string in co_filename for blacklisted_string in blacklist): pass else: message += '\n File "{}", line {}, in {}'.format(co_filename, frame.f_lineno, frame.f_code.co_name) longest_key = sorted([len(key) for key in frame.f_locals.keys()], reverse=True) if not longest_key: pass else: longest_key_format = '\n {:>' + str(longest_key[0]) + '} : ' message += ' [' for (key, value) in frame.f_locals.items(): message += longest_key_format.format(key) try: value_str = str(value) if len(value_str) > variable_size_limit: value_str = '"' + value_str[:variable_size_limit] + '..."' message += value_str + ',' except: message += '<error formatting>,' message = message[:-1] message += ']' message += '\n' return message def callstack(group, message, *args, level=LEVEL_DEBUG, frame=DEFAULT, owner=None): if frame is DEFAULT: frame = sys._getframe(1) msg = generate_message_with_callstack(message, *args, frame=frame, owner=owner) _trace.trace(TYPE_LOG, msg, group, level, get_log_zone(), frame, color=get_console_color(level, group)) vars(builtins)['_macro_should_trace'] = should_trace vars(builtins)['_macro_trace'] = _trace.trace vars(builtins)['_macro_get_log_zone'] = get_log_zone vars(builtins)['_macro_getframe'] = sys._getframe vars(builtins)['_macro_ConsoleColor'] = ConsoleColor vars(builtins)['_macro_get_console_color'] = get_console_color @macros.macro def debug(group, message, *args, owner=None, trigger_breakpoint=False): pass @macros.macro def info(group, message, *args, owner=None, trigger_breakpoint=False): pass @macros.macro def warn(group, message, *args, owner=None, trigger_breakpoint=False): pass @macros.macro def error(group, message, *args, owner=None, trigger_breakpoint=False): pass @macros.macro def always(group, message, *args, owner=None, color:int=150, trigger_breakpoint=False): if owner: message = ('[{owner}] ' + message).format(*args, owner=owner) elif args: message = message.format(*args) _macro_trace(4, message, group, color, _macro_get_log_zone(), _macro_getframe(1), color=_macro_get_console_color(color, group)) @macros.macro def assert_log(group, condition, message, *args, owner=None, trigger_breakpoint=False): pass @macros.macro def assert_raise(group, condition, message, *args, owner=None, trigger_breakpoint=False): if not condition: if owner: message = ('[{group}] [{owner}] ' + message).format(*args, group=group, owner=owner) else: message = ('[{group}] ' + message).format(*args, group=group) raise AssertionError(message) class StackVar: def __init__(self, attr_names, check_privates=True, check_locals=True): self._attr_names = set(attr_names) self._check_privates = check_privates self._check_locals = check_locals self._attr_values = {} self._find_values() def __repr__(self): debug_str = '\n\nStackVar: ' if self._attr_values: debug_str += '\n\tFound: ' for (attr_name, attr_value) in self._attr_values.items(): debug_str += '\n\t\t' debug_str += attr_name + ' = ' + str(attr_value) if self._attr_names: debug_str += '\n\tNot Found: ' for attr_name in self._attr_names: debug_str += '\n\t\t' debug_str += attr_name return debug_str + '\n' def _find_values(self): stack_frame = sys._getframe(2) while stack_frame and self._attr_names: for attr_name in self._attr_names.copy(): attr_value = None info_name = None stack_self = stack_frame.f_locals.get('self', None) if stack_self is not None: if hasattr(stack_self, attr_name): attr_value = getattr(stack_self, attr_name) info_name = '(' + str(stack_self) + ').' + attr_name if self._check_privates: private_attr_name = '_{}'.format(attr_name) if hasattr(stack_self, private_attr_name): attr_value = getattr(stack_self, private_attr_name) info_name = '(' + str(stack_self) + ').' + private_attr_name if attr_name in stack_frame.f_locals.keys(): attr_value = stack_frame.f_locals.get(attr_name) info_name = 'Local Var ' + attr_name if attr_value is None and self._check_locals and attr_value is not None: self._attr_values[info_name] = attr_value self._attr_names.discard(attr_name) stack_frame = stack_frame.f_back @macros.macro class Logger: suppress = False def __init__(self, group, *, default_owner=None, key_words=None): self.group = group self.default_owner = default_owner self.key_words = None def log(self, message, *args, level, owner=None, trigger_breakpoint=False): pass def debug(self, message, *args, owner=None, trigger_breakpoint=False): pass def info(self, message, *args, owner=None, trigger_breakpoint=False): pass def warn(self, message, *args, owner=None, trigger_breakpoint=False): pass def error(self, message, *args, owner=None, trigger_breakpoint=False, trigger_callback_on_error_or_exception=True): pass def always(self, message, *args, owner=None, color:int=150, trigger_breakpoint=False): owner = owner or self.default_owner if owner: if args: message = ('[{owner}] ' + message).format(*args, owner=owner) else: message = '[' + owner + '] ' + message elif args: message = message.format(*args) if self.key_words is not None and not any(key_word in message.lower() for key_word in self.key_words): return _macro_trace(4, message, self.group, color, _macro_get_log_zone(), _macro_getframe(1), color=_macro_get_console_color(color, self.group)) def exception(self, message, *args, exc=None, log_current_callstack=True, level=150, owner=None, trigger_breakpoint=False): if Logger.suppress: return if exc is None: try: frame1 = _macro_getframe(1) frame = _macro_getframe(2) except: frame = frame1 else: frame = _macro_getframe(1) owner = owner or self.default_owner sims4.log.exception(self.group, message, *args, exc=exc, log_current_callstack=log_current_callstack, frame=frame, owner=owner, level=level) def callstack(self, message, *args, level=25, owner=None, trigger_breakpoint=False, trigger_gsi_dump=True): if Logger.suppress: return owner = owner or self.default_owner sims4.log.callstack(self.group, message, *args, level=level, owner=owner, frame=_macro_getframe(1)) if trigger_gsi_dump and level == LEVEL_ERROR: call_callback_on_error_or_exception(message) def assert_log(self, condition, message, *args, **kwargs): if not condition: self.error(message, *args, **kwargs) def assert_raise(self, condition, message, *args, owner=None, trigger_breakpoint=False, **kwargs): if not condition: owner = owner or self.default_owner message = ('[{group}] [{owner}] ' + message).format(*args, group=self.group, owner=owner) raise AssertionError(message) class _BaseLogger: __slots__ = ('group', 'default_owner') def __init__(self, group, default_owner=None): self.group = group self.default_owner = default_owner def __repr__(self): return 'Logger({}, default_owner={})'.format(self.group, self.default_owner) def log(self, *args, **kwargs): raise NotImplementedError def _log_for_level(level): def log_for_level(self, *args, **kwargs): return self.log(*args, level=level, **kwargs) return log_for_level debug = _log_for_level(LEVEL_DEBUG) info = _log_for_level(LEVEL_INFO) warn = _log_for_level(LEVEL_WARN) error = _log_for_level(LEVEL_ERROR) del _log_for_level def exception(self, message, *args, exc=None, **kwargs): message += '\n{}' args += (format_exc(exc),) return self.log(message, *args, exc=exc, **kwargs) def callstack(self, message, *args, **kwargs): message = generate_message_with_callstack(message, *args, **kwargs) return self.log(message, *args, **kwargs) def assert_log(self, condition, message, *args, level=LEVEL_ERROR, **kwargs): if not condition: self.log(message, *args, level=level, **kwargs) def assert_raise(self, condition, message, *args, owner=None, **kwargs): if not condition: owner = owner or self.default_owner message = ('[{group}] [{owner}] ' + message).format(*args, group=self.group, owner=owner) raise AssertionError(message) class LoggerClass(_BaseLogger): __slots__ = () def log(self, message, *args, level, frame=DEFAULT, owner=None, trigger_breakpoint=False, **kwargs): owner = owner or self.default_owner if owner: message = ('[{owner}] ' + message).format(*args, owner=owner) elif args: message = message.format(*args) if frame is DEFAULT: frame = sys._getframe(2) return _trace.trace(TYPE_LOG, message, self.group, level, get_log_zone(), frame) def exception(self, *args, exc=None, owner=None, **kwargs): if exc is None: frame = _macro_getframe(2) else: frame = _macro_getframe(1) owner = owner or self.default_owner return exception(self.group, *args, exc=exc, frame=frame, owner=owner, **kwargs) def callstack(self, *args, owner=None, **kwargs): frame = sys._getframe(1) owner = owner or self.default_owner return callstack(self.group, *args, frame=frame, owner=owner, **kwargs) class ProductionLogger(_BaseLogger): __slots__ = () def log(self, message, *args, level=LEVEL_DEBUG, owner=None, **kwargs): frame = sys._getframe(1) owner = owner or self.default_owner if owner: message = ('[{owner}] ' + message).format(*args, owner=owner) elif args: message = message.format(*args) return _trace.prod_trace(TYPE_LOG, message, self.group, level, frame) class CheatLogger(_BaseLogger): __slots__ = ('output',) def __init__(self, group, connection, *, default_owner=None): from sims4.commands import Output self.output = Output(connection) self.group = group self.default_owner = default_owner def log(self, message, *args, owner=None, level=None, **kwargs): owner = owner or self.default_owner if owner: message = ('[{owner}] ' + message).format(*args, owner=owner) elif args: message = message.format(*args) return self.output(message) class OverrideTrace: def __init__(self, new_trace, suppress_colors=False): self._new_trace = new_trace self._old_trace = None self._suppress_colors = suppress_colors def __enter__(self): self._old_trace = _trace.trace _trace.trace = self._new_trace self._old_colors = sims4.console_colors.colors_enabled sims4.console_colors.colors_enabled = not self._suppress_colors OverrideTrace._fixup_builtins() def __exit__(self, exc_type, exc_value, tb): if self._old_trace is not None: _trace.trace = self._old_trace self._old_trace = None sims4.console_colors.colors_enabled = self._old_colors OverrideTrace._fixup_builtins() @staticmethod def _fixup_builtins(): if '_macro_trace' in vars(builtins): vars(builtins)['_macro_trace'] = _trace.trace
[ "44103490+daniela-venuta@users.noreply.github.com" ]
44103490+daniela-venuta@users.noreply.github.com
ba9fdc8a9c428a06447e06ac290ad3850f306c47
c21bb569e67bedc7aa49052f3847a14a30ba7a34
/request-response/connects-reconnects.py
3cd39b1453501a8f383b4f41a5e1d9da4d303708
[]
no_license
jdavid54/mqtt
b268ba44b02a7ce3da98c8fe2c8d460f2afa3466
9cbb62dd1cba67e37111b7f60cfd163127023225
refs/heads/main
2023-03-26T22:00:44.030664
2021-03-25T12:51:24
2021-03-25T12:51:24
351,430,504
0
0
null
null
null
null
UTF-8
Python
false
false
3,869
py
#! python3.4 ###demo code provided by Steve Cope at www.steves-internet-guide.com ##email steve@steves-internet-guide.com ###Free to use for any purpose """ demo connect and reconnect scipt """ import paho.mqtt.client as mqtt import time import logging import sys def on_connect(client, userdata, flags, rc): logging.debug("Connected flags"+str(flags)+"result code "\ +str(rc)+"client1_id") if rc==0: client.connected_flag=True #client.subscribe("house/bulb1") else: client.bad_connection_flag=True def on_disconnect(client, userdata,flags, rc=0): print("DisConnected flags"+"result code "+str(rc)) client.connected_flag=False def Connect(client,broker,port,keepalive): connflag=False print("connecting ",broker) badcount=0 # counter for bad connection attempts while not connflag: logging.info("connecting to broker "+str(broker)) try: res=client.connect(broker,port,keepalive) #connect to broker if res==0: connflag=True return 0 else: logging.debug("connection failed ",res) badcount +=1 if badcount==3: return -1 raise SystemExit #give up except: client.badconnection_flag=True logging.debug("connection failed") badcount +=1 if badcount==3: return -1 raise SystemExit #give up return 0 #####end connecting def wait_for(client,msgType,period=1,wait_time=10): wcount=0 while True: logging.info("waiting"+ msgType) if msgType=="CONNACK": if client.on_connect: if client.connected_flag: return True if client.bad_connection_flag: # return False if msgType=="SUBACK": if client.on_subscribe: if client.suback_flag: return True if msgType=="MESSAGE": if client.on_message: return True if msgType=="PUBACK": if client.on_publish: if client.puback_flag: return True if not client.running_loop: client.loop(.01) #check for messages manually time.sleep(period) #print("loop flag ",client.running_loop) wcount+=1 if wcount>wait_time: print("return from wait loop taken too long") return False return True ########### loglevel="DEBUG" logging.basicConfig(level=loglevel) #error logging #use DEBUG,INFO,WARNING,ERROR client=mqtt.Client("P11") ###set flags in client object mqtt.Client.bad_connection_flag=False mqtt.Client.connected_flag=False mqtt.Client.disconnect_flag=False #### broker="192.168.1.85" #need to change this port=1883 keepalive=60 client.loop_start ###set callbacks client.on_connect=on_connect client.on_disconnect=on_disconnect client.running_loop=False #needed by wait_for loop run_flag=True client.loop_start() #start a loop if not client.connected_flag: #flag set in on_connect callback if Connect(client,broker,port,keepalive) !=-1: if not wait_for(client,"CONNACK"): run_flag=False #need to take action to quit else: run_flag=False #need to take action to quit count=0 retry_count=0 while run_flag: if client.connected_flag:#check for connection print("in loop would pub and sub here",count) count+=1 else: retry_count+=1 if retry_count>=3: run_flag=False #break from loop time.sleep(2) client.loop_stop() client.disconnect()
[ "noreply@github.com" ]
jdavid54.noreply@github.com
8a8c8fb458ebd30685be185e7c17605ae2080f24
d591bb7008596b8f6ca1e8cf371c47c3132f805a
/factory/turnoverZNQ/apps.py
6467dea4eed4899cb3bcbe7c4dd8a0b50180d6d9
[]
no_license
RockJohnson503/factory-python
755d898e3676ef649e1b66633c9e65a8b3a0f45a
02a61e92fb6be190c24a6a12a27dc4ec707a82d9
refs/heads/master
2020-05-17T18:02:25.139307
2020-01-11T09:45:23
2020-01-11T09:45:23
183,872,719
1
0
null
null
null
null
UTF-8
Python
false
false
94
py
from django.apps import AppConfig class TurnoverConfig(AppConfig): name = 'turnoverZNQ'
[ "836867547@qq.com" ]
836867547@qq.com
a060c6575714e291ae36cdd14ad5c48804650a45
8955dfe19f98cd9302480159adc63700adaeb498
/middle/210 Course Schedule II.py
c65770d106091d22ccf1794ca816d0b06f2145b7
[]
no_license
VRER1997/leetcode_python
9e8c30433f2d304290cfb6e782513c8eceee5d4f
43f392286ee01c7a229a3a12c3ff04e9f4fc7ddc
refs/heads/master
2020-04-22T09:25:30.802846
2019-08-16T07:19:25
2019-08-16T07:19:25
170,271,747
1
0
null
null
null
null
UTF-8
Python
false
false
894
py
from typing import List class Solution: def findOrder(self, numCourses: int, prerequisites: List[List[int]]) -> List[int]: indegrees = [0 for i in range(numCourses)] edges = [[] for i in range(numCourses)] for front, tail in prerequisites: indegrees[front] += 1 edges[tail].append(front) courses = set(range(numCourses)) flag = True order = [] while flag and len(courses): flag = False removeList = [] for x in courses: if indegrees[x] == 0: for node in edges[x]: indegrees[node] -= 1 removeList.append(x) order.append(x) flag = True for x in removeList: courses.remove(x) return order if len(courses) == 0 else []
[ "1216778435@qq.com" ]
1216778435@qq.com
6a805fc5ea0fbab49b44d56ddf37fa7800c1fb7c
af497bbfe8c3131c235df1b3087a90c28c89891e
/ocr.py
d844c329aa7c4854cb984e402728abf8eaaf9163
[ "blessing" ]
permissive
snwhd/retrotracker
48e8c2286534f3c2a5057b936c4e39c3082860cd
ad0ce011e2e8a0d13f3479085b2c4e0fecbe5712
refs/heads/master
2023-09-01T22:49:45.452343
2021-11-19T11:39:22
2021-11-19T11:39:22
428,159,095
1
0
null
null
null
null
UTF-8
Python
false
false
2,840
py
#!/usr/bin/env python3 from __future__ import annotations from PIL import Image, ImageFilter import PIL.ImageOps import pyscreenshot as ImageGrab import pytesseract import unidecode import logging import re from typing import ( Generator, List, Optional, Tuple, ) import warnings warnings.filterwarnings('ignore', category=Warning) from monsterdetector import MonsterDetector IGNORE_REGEX = re.compile(r'(meal\)|Sa 0\))') # replace common ocr mistakes INT_TRANS = str.maketrans( 'olis&y?', '0115677' ) class OCR: def __init__( self, x: int, y: int, w: int, h: int, ) -> None: self.monster_detector = MonsterDetector() self.previous_text: Optional[str] = None self.previous_line: Optional[str] = None self.x = x self.y = y self.w = w self.h = h @staticmethod def parse_int(s: str) -> int: if s == 'psu': # this is a really weird but consistent edge case: return 20 return int(s.translate(INT_TRANS)) def screen_capture(self) -> Image: return ImageGrab.grab(bbox=[ self.x, self.y, self.x + self.w, self.y + self.h, ]) def set_bbox(self, x: int, y: int, w: int, h: int) -> None: self.x = x self.y = y self.w = w self.h = h def capture_string(self) -> str: image = self.screen_capture() r, g, b, a = image.split() image = Image.merge('RGB', (r, g, b)) image = PIL.ImageOps.invert(image) image = image.filter(ImageFilter.BLUR) # image.save('/tmp/mmo.png') return pytesseract.image_to_string(image) # # retroMMO specific stuff # def gen_retrommo_lines(self) -> Generator[str, None, None]: text = unidecode.unidecode(self.capture_string().strip()) # avoid duplicate captures if text != self.previous_text: self.previous_text = text for line in self.gen_split_lines(text): # avoid duplicate lines if line != self.previous_line: self.previous_line = line logging.debug(line) yield line def gen_split_lines( self, text: str, ) -> Generator[str, None, None]: for s in text.split('\n'): s = s.strip() if s != '' and len(s) > 5 and not self.ignore(s): yield s.lower() def ignore( self, text: str, ) -> bool: return IGNORE_REGEX.match(text) is not None # # Optical Monster Recognition # def identify_monsters(self) -> List[str]: image = self.screen_capture() return self.monster_detector.identify(image)
[ "none@none" ]
none@none
13c83e704be21926ea5bc174a5765b317dd2f572
bc2cdb1e438efaf67131e975ac4db80b4dc43385
/src/private/code_publish/migrations/0035_auto_20190820_1620.py
8ede163f1e401882d63da5678df8b7718aec6268
[]
no_license
Shadow-linux/ops-for-study
cf4d55409ebc6f27d454bea60886cd154c994484
115b567948d25a64e423a6cdc89bc8337896afe2
refs/heads/master
2023-01-14T13:35:56.880896
2019-09-23T05:01:31
2019-09-23T05:01:31
209,781,758
2
0
null
2023-01-04T10:55:45
2019-09-20T12:08:11
Python
UTF-8
Python
false
false
582
py
# Generated by Django 2.0.1 on 2019-08-20 16:20 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('code_publish', '0034_auto_20190820_1542'), ] operations = [ migrations.RemoveField( model_name='codepublishlockenvapp', name='app_name', ), migrations.AddField( model_name='codepublishlockenvapp', name='app_name_id', field=models.CharField(help_text='AppNameID from cp_main_conf', max_length=128, null=True), ), ]
[ "liangyedong@qipeipu.com" ]
liangyedong@qipeipu.com
2d87b7dc3bd7a65fa908062504c72c3ce7cd675d
c5276ac07e88486a54c63eb323324998c09577df
/Week-06/double-linked-list.py
f58183e1dd94c1e13620d8bcb0c3fce212b052fa
[]
no_license
PWA-GouldA/Advanced-Programming-Python
c4831d414ffa80fae22b8fc338f28752f98fecee
144c9ee8adf732d441e45cf5fd0edaee6362e9b0
refs/heads/master
2022-12-10T17:28:04.484910
2019-05-21T11:16:43
2019-05-21T11:16:43
172,685,932
0
0
null
null
null
null
UTF-8
Python
false
false
4,194
py
# for Garbage collection import gc class Node: def __init__(self, next=None, prev=None, data=None): self.next = next # reference to next node in DLL self.prev = prev # reference to previous node in DLL self.data = data class DoublyLinkedList: def __init__(self): self.head = None # Function to delete a node in a Doubly Linked List. # head_ref --> pointer to head node pointer. # dele --> pointer to node to be deleted def deleteNode(self, dele): # Base Case if self.head is None or dele is None: return # If node to be deleted is head node if self.head == dele: self.head = dele.next # Change next only if node to be deleted is NOT the last node if dele.next is not None: dele.next.prev = dele.prev # Change prev only if node to be deleted is NOT the first node if dele.prev is not None: dele.prev.next = dele.next # Finally, free the memory occupied by dele # Call python garbage collector gc.collect() # Given a reference to the head of a list and an integer, inserts a new node on the front of list def push(self, new_data): # 1. Allocates node # 2. Put the data in it new_node = Node(data=new_data) # 3. Make next of new node as head and # previous as None (already None) new_node.next = self.head # 4. change prev of head node to new_node if self.head is not None: self.head.prev = new_node # 5. move the head to point to the new node self.head = new_node def printList(self, node): while (node is not None): print(node.data, '<-> ', end='') node = node.next # This code is contributed by Nikhil Kumar Singh(nickzuck_007) # Given a node as prev_node, insert # a new node after the given node def insertAfter(self, prev_node, new_data): # 1. check if the given prev_node is NULL if prev_node is None: print("This node doesn't exist in DLL") return # 2. allocate node & 3. put in the data new_node = Node(data=new_data) # 4. Make next of new node as next of prev_node new_node.next = prev_node.next # 5. Make the next of prev_node as new_node prev_node.next = new_node # 6. Make prev_node as previous of new_node new_node.prev = prev_node # 7. Change previous of new_node's next node */ if new_node.next is not None: new_node.next.prev = new_node # This code is contributed by jatinreaper # Add a node at the end of the DLL def append(self, new_data): # 1. allocate node 2. put in the data new_node = Node(data=new_data) last = self.head # 3. This new node is going to be the # last node, so make next of it as NULL new_node.next = None # 4. If the Linked List is empty, then # make the new node as head if self.head is None: new_node.prev = None self.head = new_node return # 5. Else traverse till the last node while (last.next is not None): last = last.next # 6. Change the next of last node last.next = new_node # 7. Make last node as previous of new node */ new_node.prev = last # This code is contributed by jatinreaper # Driver program to test the above functions # Start with empty list dll = DoublyLinkedList() # Let us create the doubly linked list 10<->8<->4<->2 dll.push(2) dll.push(4) dll.push(8) dll.push(10) dll.push(12) print("Original Linked List") print(dll.printList(dll.head)) # delete nodes from doubly linked list dll.deleteNode(dll.head) dll.deleteNode(dll.head.next) dll.deleteNode(dll.head.next) # Modified linked list will be NULL<-8->NULL print("Modified Linked List") print(dll.printList(dll.head))
[ "Adrian.Gould@nmtafe.wa.edu.au" ]
Adrian.Gould@nmtafe.wa.edu.au
1768e183d070071c2b91c9f32da2a06fa66c06cd
9e988c0dfbea15cd23a3de860cb0c88c3dcdbd97
/sdBs/AllRun/pg_0921+161/sdB_PG_0921+161_coadd.py
b87a80c0a5c0fa3529741039dad7d6fea6e532c4
[]
no_license
tboudreaux/SummerSTScICode
73b2e5839b10c0bf733808f4316d34be91c5a3bd
4dd1ffbb09e0a599257d21872f9d62b5420028b0
refs/heads/master
2021-01-20T18:07:44.723496
2016-08-08T16:49:53
2016-08-08T16:49:53
65,221,159
0
0
null
null
null
null
UTF-8
Python
false
false
430
py
from gPhoton.gMap import gMap def main(): gMap(band="NUV", skypos=[141.158875,15.888608], skyrange=[0.0333333333333,0.0333333333333], stepsz = 30., cntfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sdBs/sdB_PG_0921+161/sdB_PG_0921+161_movie_count.fits", cntcoaddfile="/data2/fleming/GPHOTON_OUTPUT/LIGHTCURVES/sdB/sdB_PG_0921+161/sdB_PG_0921+161_count_coadd.fits", overwrite=True, verbose=3) if __name__ == "__main__": main()
[ "thomas@boudreauxmail.com" ]
thomas@boudreauxmail.com
10c66a03d36f6b880b761caf0e85aae4b93527e4
1698b29429675292393f294ad554dac8efed3e6b
/03_Web/Django/9_16/posts/urls.py
23f991e0df302dd0302c78804e752a34b1a3676e
[]
no_license
bcking92/TIL
3daa87e95b6c39413f9c62787c35987804e8dd89
60b99cac73820d8af3e050d54f26f1f22a32748d
refs/heads/master
2023-01-12T10:07:36.042506
2021-04-12T22:55:10
2021-04-12T22:55:10
195,767,319
0
0
null
2023-01-05T00:40:55
2019-07-08T08:17:14
Jupyter Notebook
UTF-8
Python
false
false
595
py
from django.urls import path from . import views app_name = 'posts' urlpatterns = [ path('', views.index, name='home'), path('create/', views.create, name='create'), path('detail/<int:num>/', views.detail, name='detail'), path('update/<int:num>/', views.update, name='update'), path('delete/<int:num>/', views.delete, name='delete'), path('comment/<int:num>/', views.create_comment, name='comment'), path('comment/delete/<int:num>/', views.delete_comment, name='delete_comment'), path('comment/update/<int:num>/', views.update_comment, name='update_comment'), ]
[ "bcking92@gmail.com" ]
bcking92@gmail.com
b200b6b34858f1c775663ce36035ce4a1cd60ddd
e87aec694108cb1f76716260daf569bcb8091958
/fluo/management/commands/initdb.py
2218dbebe83cc324702648674b438d6b2643add4
[ "MIT" ]
permissive
rsalmaso/django-fluo
a283b8f75769ac6e57fa321c607819899e0c31c8
340e3b4f9c1b4b09feccefb9b3ab2d26d59fac2b
refs/heads/master
2023-01-12T01:37:06.975318
2020-12-01T17:13:11
2020-12-01T17:13:11
48,948,936
1
0
null
null
null
null
UTF-8
Python
false
false
2,385
py
# Copyright (C) 2007-2020, Raffaele Salmaso <raffaele@salmaso.org> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. from django.core.management import call_command from ..database import DatabaseCommand class Command(DatabaseCommand): help = "(Re)create and initialize database with common data" message = """You have requested to create "%(name)s" database. This will IRREVERSIBLY DELETE all data currently in the "%(name)s" database if already exists, and then will create a new database. Are you sure you want to do this?""" error_message = """Database %(name)s couldn't be dropped. Possible reasons: * The database isn't running or isn't configured correctly. * The database is in use by another user. The full error: %(error)s""" def add_arguments(self, parser): super().add_arguments(parser) parser.add_argument( "--noadmin", "--no-admin", action="store_false", dest="noadmin", default=True, help="Tells Django to NOT create a default admin user.", ) def execute_sql(self, backend, **options): backend.dropdb() backend.createdb() def migrate(self): call_command("migrate") def post_execute(self, **options): self.migrate() if options.get("noadmin"): call_command("load_admin_data")
[ "raffaele@salmaso.org" ]
raffaele@salmaso.org
7a8f3b331abb0388558fef49ee6fc8e4700bb9a0
2f98aa7e5bfc2fc5ef25e4d5cfa1d7802e3a7fae
/python/python_1745.py
8be3774af3fd8986d303c185e1cec8b0ab238544
[]
no_license
AK-1121/code_extraction
cc812b6832b112e3ffcc2bb7eb4237fd85c88c01
5297a4a3aab3bb37efa24a89636935da04a1f8b6
refs/heads/master
2020-05-23T08:04:11.789141
2015-10-22T19:19:40
2015-10-22T19:19:40
null
0
0
null
null
null
null
UTF-8
Python
false
false
72
py
# How to check if a page is displaying a specific <img> tag &lt;img&gt;
[ "ubuntu@ip-172-31-7-228.us-west-2.compute.internal" ]
ubuntu@ip-172-31-7-228.us-west-2.compute.internal
fba96643b6ce7ca44beb319570113d6db4766071
85744222aed3e2d77d7c01d037839804f857db95
/SWEA/1940.py
49ad1f61622bce45b29bde22394ef214751da4ad
[]
no_license
porciuscato/study_algorithm
7c86367afab75943cf2de9f0bccc62659fdc6aae
fecf67f8028410c7d59fcc9a037667a169684cf4
refs/heads/master
2023-08-21T17:55:39.179551
2021-10-22T03:57:50
2021-10-22T03:57:50
195,784,098
0
0
null
null
null
null
UTF-8
Python
false
false
474
py
import sys sys.stdin = open('1940.txt', 'r') for T in range(1, int(input()) + 1): N = int(input()) answer = 0 velocity = 0 for n in range(N): inputs = list(map(int, input().split())) state = inputs[0] if state == 1: velocity += inputs[1] elif state == 2: velocity -= inputs[1] if velocity < 0: velocity = 0 answer += velocity print('#{} {}'.format(T, answer))
[ "mpcato@naver.com" ]
mpcato@naver.com
77d095fcd57cbf06b3de67806420aa9c3b4b53d4
c56c153e90fa7ae04e8e84410fc6cb3aef1bc800
/base.R
5ce8b978749c7f7ac5143b46e420fc5fdba80d0f
[]
no_license
yiyusheng/TC_koubei
7215d483f9e09982a59c90a9836100e56abb9e25
a02cee69fb49bd89cd561b64d73c47ddde5a2f57
refs/heads/master
2021-01-11T22:33:38.949377
2017-02-17T09:01:47
2017-02-17T09:01:47
78,988,198
0
0
null
null
null
null
UTF-8
Python
false
false
3,193
r
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # Filename: base.R # # Description: commenly used function in this project # # Copyright (c) 2017, Yusheng Yi <yiyusheng.hust@gmail.com> # # Version 1.0 # # Initial created: 2017-01-16 21:44:43 # # Last modified: 2017-01-19 11:23:32 # # # get_shop <- function(id,sp = shop_pay){ subset(sp,shop_id %in% id) } mse <- function(x,y){ mean((x-y)**2) } plot_week_aggra <- function(df){ if(!is.data.frame(df))df <- smp_aggra[[df]] p <- ggplot(df, aes(x=1:nrow(df), y=smp_mean, group = 1)) + geom_errorbar(aes(ymin=smp_mean-smp_sd, ymax=smp_mean+smp_sd), width=.1) + geom_line() + geom_point() + xlab('weeks') + ylab('mean') + ggtitle(df$shop_id[1]) ggsave(p,file = file.path(dir_data,'figure','week_aggra',paste(df$shop_id[1],'.jpg',sep=''))) return(p) } arimaX <- function(df,test_start){ dfa <- subset(df,uni_time < test_start) dfb <- subset(df,uni_time >= test_start) fit_mean <- auto.arima(dfa$smp_mean,D = 1,trace = F, max.P = 0,max.Q = 0,max.p = 20,max.q = 20, ic = 'aic') fit_sd <- auto.arima(dfa$smp_sd,D = 1,trace = F, max.P = 0,max.Q = 0,max.p = 20,max.q = 20, ic = 'aic') pred_mean <- forecast.Arima(fit_mean,h = 2)$mean[1:2] pred_sd <- forecast.Arima(fit_sd,h = 2)$mean[1:2] real_mean <- dfb$smp_mean real_sd <- dfb$smp_sd # last_mean <- rep(dfa$smp_mean[which.max(dfa$uni_time)],2) # last_sd <- rep(dfa$smp_sd[which.max(dfa$uni_time)],2) # last_mean <- dfa$smp_mean[(nrow(dfa)-1):nrow(dfa)] # last_sd <- dfa$smp_sd[(nrow(dfa)-1):nrow(dfa)] # last_mean <- rep(mean(dfa$smp_mean[(nrow(dfa)-1):nrow(dfa)]),2) # last_sd <- rep(mean(dfa$smp_sd[(nrow(dfa)-1):nrow(dfa)]),2) last_mean <- predict(fit_mean,dfa$smp_mean[(nrow(dfa)-3):nrow(dfa)]) last_sd <- predict(fit_mean,dfa$smp_sd[(nrow(dfa)-3):nrow(dfa)]) error_mean1 <- mse(real_mean,pred_mean) error_mean2 <- mse(real_mean,last_mean) error_sd1 <- mse(real_sd,pred_sd) error_sd2 <- mse(real_sd,last_sd) cat(sprintf('%d\n',fct2num(df$shop_id[1]))) data.frame(em1 = error_mean1,em2 = error_mean2,es1 = error_sd1,es2 = error_sd2) } # rescale x to a new mu and sigma rescale <- function(x,mu,sigma){ mu0 <- mean(x) sigma0 <- sd(x) (x-mu0)*sigma/sigma0 + mu } # predict mean of next week with combination of last 4 weeks gen_fit_glm <- function(){ comb_start <- test_start - 90*86400 last_weeks <- 4 gen_last_Nweeks_train <- function(df,attr){ # cat(sprintf('%d\n',fct2num(df$shop_id[1]))) dfa <- subset(df,uni_time < test_start & uni_time >= comb_start) if(nrow(dfa) < 5)return(NULL) dfb <- subset(df,uni_time >= test_start) m <- matrix(0,nrow(dfa)-last_weeks,last_weeks+1) for(i in 1:nrow(m)){ m[i,] <- dfa[[attr]][i:(i+4)] } m } train_mean <- data.frame(do.call(rbind,lapply(smp_aggra,gen_last_Nweeks_train,attr = 'smp_mean'))) train_sd <- data.frame(do.call(rbind,lapply(smp_aggra,gen_last_Nweeks_train,attr = 'smp_sd'))) fit_mean <- glm(X5~.,data =train_mean,family = 'gaussian') fit_sd <- glm(X5~.,data =train_sd,family = 'gaussian') list(fit_mean,fit_sd) }
[ "yiyusheng.hust@gmail.com" ]
yiyusheng.hust@gmail.com
e8ee10c0cb8e27441f73f177ccfd1b2e8b699934
f7d2114152ec5c8e283b6bfbb9feeb5a4337eb71
/ACL054400-python37/samples/CH10/object_serialization/dvdlib_pickle.py
fb242f95931ac4828b258ec9149bac400dcd4d4c
[]
no_license
faustfu/hello_python
f5759ff6bf87694e6ba472349f4263bc8ad479b0
1487e60e2d9307e1a0ebffbf26d8e075da806a39
refs/heads/master
2021-02-10T18:01:50.450295
2020-11-20T02:17:18
2020-11-20T02:17:18
244,406,161
0
0
null
null
null
null
UTF-8
Python
false
false
851
py
import pickle class DVD: def __init__(self, title: str, year: int, duration: int, director: str) -> None: self.title = title self.year = year self.duration = duration self.director = director self.filename = self.title.replace(' ', '_') + '.pickle' def save(self): with open(self.filename, 'wb') as fh: pickle.dump(self, fh) @staticmethod def load(filename: str) -> 'DVD': with open(filename, 'rb') as fh: return pickle.load(fh) def __str__(self): return repr(self) def __repr__(self): return "DVD('{0}', {1}, {2}, '{3}')".format( self.title, self.year, self.duration, self.director) dvd1 = DVD('Birds', 2018, 8, 'Justin Lin') dvd1.save() dvd2 = DVD.load('Birds.pickle') print(dvd2)
[ "faust.fu@gmail.com" ]
faust.fu@gmail.com
a01a1ee288b6cd45c7e9248a7c0527e5b595153e
6fa7f99d3d3d9b177ef01ebf9a9da4982813b7d4
/QB6kPXQkFgMkzcc2h_16.py
3ac2d588f5b7c292966309deac97e107d2c7f2c0
[]
no_license
daniel-reich/ubiquitous-fiesta
26e80f0082f8589e51d359ce7953117a3da7d38c
9af2700dbe59284f5697e612491499841a6c126f
refs/heads/master
2023-04-05T06:40:37.328213
2021-04-06T20:17:44
2021-04-06T20:17:44
355,318,759
0
0
null
null
null
null
UTF-8
Python
false
false
182
py
def remove_abc(txt): if "a" in txt.lower() or "b" in txt.lower() or "c" in txt.lower(): return txt.replace("a", "").replace("b", "").replace("c", "") else: return None
[ "daniel.reich@danielreichs-MacBook-Pro.local" ]
daniel.reich@danielreichs-MacBook-Pro.local
7e39932d9b6d14371a3a3a197aaff1225753b296
8200c609ae9c78af2848237f1c43e54b8560e87b
/tests/test_minres.py
80012f3468411040939b76c6609ecd9259e1600f
[ "MIT" ]
permissive
christian-cahig/krylov
ecf07f50000ac6c8441f0713693f52df337240db
b6bb7e01e0d3409dbd506ec8d232a5da19e3e7ca
refs/heads/main
2023-04-28T16:52:50.887796
2021-05-21T18:54:08
2021-05-21T18:54:08
null
0
0
null
null
null
null
UTF-8
Python
false
false
830
py
import pytest import krylov from .helpers import assert_consistent from .linear_problems import hermitian_indefinite, hpd from .linear_problems import spd_dense as spd from .linear_problems import spd_rhs_0, spd_rhs_0sol0, symmetric_indefinite @pytest.mark.parametrize( "A_b", [ spd((5,)), spd((5, 1)), spd((5, 3)), spd_rhs_0((5,)), spd_rhs_0sol0(), hpd(), symmetric_indefinite(), hermitian_indefinite(), ], ) def test_minres(A_b): A, b = A_b callback_counter = 0 def callback(x, r): nonlocal callback_counter callback_counter += 1 sol, info = krylov.minres(A, b, tol=1.0e-7, callback=callback) assert callback_counter == info.numsteps + 1 assert info.success assert_consistent(A, b, info, sol, 1.0e-7)
[ "nico.schloemer@gmail.com" ]
nico.schloemer@gmail.com
21044048461cf0140e43fca4b8b0dbbcda7b32d9
c31c8095ce4d4e9686e3e7ad6b004342e49671fa
/forum/migrations/0086_auto_20190124_1403.py
d90ca9f50c660347e4e531ec4f61dbeda976fe51
[]
no_license
Lionalisk/arrakambre
7bcc96dea2ca2a471572bfb1646256f1382ce25b
2caece9be5eebf21ddfa87a6c821c32b5d5019a2
refs/heads/master
2020-12-07T19:31:24.471090
2020-01-09T10:14:29
2020-01-09T10:14:29
232,782,172
0
0
null
null
null
null
UTF-8
Python
false
false
828
py
# Generated by Django 2.1.3 on 2019-01-24 13:03 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('forum', '0085_auto_20190124_1221'), ] operations = [ migrations.AddField( model_name='perso', name='classe_principale', field=models.ForeignKey(default=1, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='classe_principale', to='forum.Categorie_competence'), ), migrations.AddField( model_name='perso', name='classe_secondaire', field=models.ForeignKey(default=2, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='classe_secondaire', to='forum.Categorie_competence'), ), ]
[ "lionel.varaire@free.fr" ]
lionel.varaire@free.fr
3ec923644ba27f03e70f29eba4ecb470b4167106
6df9a960c0a4e2049b5932938a83ee82d4516412
/databases_2/m2m-relations/articles/views.py
1ceee601e7e1fec92b9fb7cad031c5bb5f236bf9
[]
no_license
alekseykonotop/dj_hw
9585f0d42ec95d31f5eeae09b953e5f195bc9ee7
6752361d007d777127eb77445d45da58332e0223
refs/heads/master
2021-07-19T06:30:04.333018
2019-09-21T18:12:38
2019-09-21T18:12:38
177,439,677
0
0
null
2020-06-05T22:56:52
2019-03-24T16:24:46
Python
UTF-8
Python
false
false
223
py
from django.views.generic import ListView from .models import Article, Category, Compilation class ArticleListView(ListView): template_name = 'articles/news.html' model = Article ordering = '-published_at'
[ "alekseykonotop@gmail.com" ]
alekseykonotop@gmail.com
041df02d4c1cb214bc633d627071a694b88f2500
99b2aff89dcec2f43cee32a6bdd4c0c43d6c51fa
/src/pytezos/michelson/instructions/__init__.py
ab84dc488ef90063a0ec8975b4ef10d992552b94
[ "MIT" ]
permissive
baking-bad/pytezos
c4248bde49a5b05521b8cc51eeca588b1a721660
19747e3acec2141f06e812025673f497fc07e2d4
refs/heads/master
2023-07-06T21:57:09.572985
2023-07-05T11:45:27
2023-07-05T11:45:27
169,243,460
115
43
MIT
2023-07-04T16:28:09
2019-02-05T13:12:50
Python
UTF-8
Python
false
false
8,126
py
from pytezos.michelson.instructions.adt import CarInstruction from pytezos.michelson.instructions.adt import CdrInstruction from pytezos.michelson.instructions.adt import GetnInstruction from pytezos.michelson.instructions.adt import LeftInstruction from pytezos.michelson.instructions.adt import PairInstruction from pytezos.michelson.instructions.adt import RightInstruction from pytezos.michelson.instructions.adt import UnpairInstruction from pytezos.michelson.instructions.adt import UpdatenInstruction from pytezos.michelson.instructions.arithmetic import AbsInstruction from pytezos.michelson.instructions.arithmetic import AddInstruction from pytezos.michelson.instructions.arithmetic import BytesInstruction from pytezos.michelson.instructions.arithmetic import EdivInstruction from pytezos.michelson.instructions.arithmetic import IntInstruction from pytezos.michelson.instructions.arithmetic import IsNatInstruction from pytezos.michelson.instructions.arithmetic import LslInstruction from pytezos.michelson.instructions.arithmetic import LsrInstruction from pytezos.michelson.instructions.arithmetic import MulInstruction from pytezos.michelson.instructions.arithmetic import NatInstruction from pytezos.michelson.instructions.arithmetic import NegInstruction from pytezos.michelson.instructions.boolean import AndInstruction from pytezos.michelson.instructions.boolean import NotInstruction from pytezos.michelson.instructions.boolean import OrInstruction from pytezos.michelson.instructions.boolean import XorInstruction from pytezos.michelson.instructions.compare import CompareInstruction from pytezos.michelson.instructions.compare import EqInstruction from pytezos.michelson.instructions.compare import GeInstruction from pytezos.michelson.instructions.compare import GtInstruction from pytezos.michelson.instructions.compare import LeInstruction from pytezos.michelson.instructions.compare import LtInstruction from pytezos.michelson.instructions.compare import NeqInstruction from pytezos.michelson.instructions.control import ApplyInstruction from pytezos.michelson.instructions.control import DipInstruction from pytezos.michelson.instructions.control import DipnInstruction from pytezos.michelson.instructions.control import ExecInstruction from pytezos.michelson.instructions.control import FailwithInstruction from pytezos.michelson.instructions.control import IfConsInstruction from pytezos.michelson.instructions.control import IfInstruction from pytezos.michelson.instructions.control import IfLeftInstruction from pytezos.michelson.instructions.control import IfNoneInstruction from pytezos.michelson.instructions.control import IterInstruction from pytezos.michelson.instructions.control import LambdaInstruction from pytezos.michelson.instructions.control import LambdaRecInstruction from pytezos.michelson.instructions.control import LoopInstruction from pytezos.michelson.instructions.control import LoopLeftInstruction from pytezos.michelson.instructions.control import MapInstruction from pytezos.michelson.instructions.control import PushInstruction from pytezos.michelson.instructions.crypto import Blake2bInstruction from pytezos.michelson.instructions.crypto import CheckSignatureInstruction from pytezos.michelson.instructions.crypto import HashKeyInstruction from pytezos.michelson.instructions.crypto import KeccakInstruction from pytezos.michelson.instructions.crypto import PairingCheckInstruction from pytezos.michelson.instructions.crypto import SaplingEmptyStateInstruction from pytezos.michelson.instructions.crypto import SaplingVerifyUpdateInstruction from pytezos.michelson.instructions.crypto import Sha3Instruction from pytezos.michelson.instructions.crypto import Sha256Instruction from pytezos.michelson.instructions.crypto import Sha512Instruction from pytezos.michelson.instructions.generic import ConcatInstruction from pytezos.michelson.instructions.generic import NeverInstruction from pytezos.michelson.instructions.generic import PackInstruction from pytezos.michelson.instructions.generic import SizeInstruction from pytezos.michelson.instructions.generic import SliceInstruction from pytezos.michelson.instructions.generic import UnitInstruction from pytezos.michelson.instructions.generic import UnpackInstruction from pytezos.michelson.instructions.jupyter import BeginInstruction from pytezos.michelson.instructions.jupyter import BigMapDiffInstruction from pytezos.michelson.instructions.jupyter import CommitInstruction from pytezos.michelson.instructions.jupyter import DebugInstruction from pytezos.michelson.instructions.jupyter import DropAllInstruction from pytezos.michelson.instructions.jupyter import DumpAllInstruction from pytezos.michelson.instructions.jupyter import DumpInstruction from pytezos.michelson.instructions.jupyter import PatchInstruction from pytezos.michelson.instructions.jupyter import PatchValueInstruction from pytezos.michelson.instructions.jupyter import PrintInstruction from pytezos.michelson.instructions.jupyter import ResetInstruction from pytezos.michelson.instructions.jupyter import ResetValueInstruction from pytezos.michelson.instructions.jupyter import RunInstruction from pytezos.michelson.instructions.stack import DigInstruction from pytezos.michelson.instructions.stack import DropInstruction from pytezos.michelson.instructions.stack import DropnInstruction from pytezos.michelson.instructions.stack import DugInstruction from pytezos.michelson.instructions.stack import DupInstruction from pytezos.michelson.instructions.stack import DupnInstruction from pytezos.michelson.instructions.stack import PushInstruction from pytezos.michelson.instructions.stack import RenameInstruction from pytezos.michelson.instructions.stack import SwapInstruction from pytezos.michelson.instructions.struct import ConsInstruction from pytezos.michelson.instructions.struct import EmptyBigMapInstruction from pytezos.michelson.instructions.struct import EmptyMapInstruction from pytezos.michelson.instructions.struct import EmptySetInstruction from pytezos.michelson.instructions.struct import GetAndUpdateInstruction from pytezos.michelson.instructions.struct import GetInstruction from pytezos.michelson.instructions.struct import MemInstruction from pytezos.michelson.instructions.struct import NilInstruction from pytezos.michelson.instructions.struct import NoneInstruction from pytezos.michelson.instructions.struct import SomeInstruction from pytezos.michelson.instructions.struct import UpdateInstruction from pytezos.michelson.instructions.tezos import AddressInstruction from pytezos.michelson.instructions.tezos import AmountInstruction from pytezos.michelson.instructions.tezos import BalanceInstruction from pytezos.michelson.instructions.tezos import ChainIdInstruction from pytezos.michelson.instructions.tezos import ContractInstruction from pytezos.michelson.instructions.tezos import CreateContractInstruction from pytezos.michelson.instructions.tezos import ImplicitAccountInstruction from pytezos.michelson.instructions.tezos import MinBlockTimeInstruction from pytezos.michelson.instructions.tezos import NowInstruction from pytezos.michelson.instructions.tezos import SelfAddressInstruction from pytezos.michelson.instructions.tezos import SelfInstruction from pytezos.michelson.instructions.tezos import SenderInstruction from pytezos.michelson.instructions.tezos import SetDelegateInstruction from pytezos.michelson.instructions.tezos import SourceInstruction from pytezos.michelson.instructions.tezos import TotalVotingPowerInstruction from pytezos.michelson.instructions.tezos import TransferTokensInstruction from pytezos.michelson.instructions.tezos import VotingPowerInstruction from pytezos.michelson.instructions.ticket import JoinTicketsInstruction from pytezos.michelson.instructions.ticket import ReadTicketInstruction from pytezos.michelson.instructions.ticket import SplitTicketInstruction from pytezos.michelson.instructions.ticket import TicketInstruction from pytezos.michelson.instructions.tzt import BigMapInstruction from pytezos.michelson.instructions.tzt import StackEltInstruction
[ "noreply@github.com" ]
baking-bad.noreply@github.com
f2e5aa16489de06496939150e81354951081ef4a
7615cb2a3d19a998ada9ed7994a5c304b65ad760
/HandlingButtonClicks.py
e0a4f00751140ac3392837403b1d7f2c5920d2f8
[]
no_license
sadiqulislam/GUI-Tkinter
61ae812443f51a21b84033b31997c9a50f8d78cf
ab37e78c9f5f27f9b79b5908055391d3dd923c58
refs/heads/master
2021-01-02T09:55:01.743688
2020-02-11T16:55:21
2020-02-11T16:55:21
239,565,289
0
0
null
null
null
null
UTF-8
Python
false
false
166
py
from tkinter import * root = Tk() def click(): print("You Clicked Here") button1 = Button(root,text="Click Here",command=click) button1.pack() root.mainloop()
[ "sishishir2015@gmail.com" ]
sishishir2015@gmail.com
6a79b2cad508e9b03721168440cfa6c8f0590b3f
41a3baf733d7b701bdd3600bf4f7aa227060785f
/q7_8.py
316c41be5d7362b1017efed0e21cae99d30f8a4d
[]
no_license
domspad/ctci_solutions
7a8264ef26fd2209adaed005cc0c8f0d6538ab05
6a3af811732f62a613f7fa884f5ae0e0a9e64132
refs/heads/master
2021-01-02T09:38:05.278621
2015-03-11T05:28:29
2015-03-11T05:28:29
30,838,140
0
0
null
null
null
null
UTF-8
Python
false
false
2,412
py
""" # Chapter 7: Object-oriented Design # Problem 2: Othello is played as follows: Each Othello piece is white on one side and black on the other When a piece is surrounded by its opponents on both the left and right sides, or both the top and bottom, it is said to be captured and its color is flipped On your turn, you must capture at least one of your opponent’s pieces The game ends when either user has no more valid moves, and the win is assigned to the person with the most pieces Implement the object oriented design for Othello """ ################################################################################ ################################################################################ ################################################################################ # SOLUTIONS """ Solution 1 : designed for 2 players only one main class that hides a lot of inner functions when started, runs continously until game is over """ class Question(object) : white = 1 black = 2 def start(self) : """ Sets up board into valid starting positions """ def _won(self) : """ Retunrns winner if any, else 0 """ def _canGo(self, color) : """ returns True if color has valid move on his turn, else false """ def _isValid(self, color, pos) : """ returns true if pos is local move for color """ def _getMove(self, color) : """ prompts player for move, exception is invalid input """ def _addMove(self, color, pos) : """ adds valid move to the board, and updates pieces on board """ def _printBoard(self) : """ prints current state of board """ def _game(self) : """ runs continously until a player wins """ self._printBoard() while(self._won() == 0) : valid = False while(not valid) : try : self._getMove() valid = True except : print "enter valid coordinate" self._printBoard() if self._won() != 3 : if self._won() == 1 : print "white won" else : print "black won" else : print "draw!" """ Solution 2 : Setting up like we did for the card game in peter norvig's class """ class Game(object) : def __init__(self) : def newGame(self, numPlayers, size) : def getTurn() : def isFinished() : class Board(object) : def __init__(self) : def getMoves(self, color) : def setMove(self, color, loc) : def printBoard(self) : #player is strategy function
[ "domspad@umich.edu" ]
domspad@umich.edu
9c03847e0d6865a99ca8a01dffb1c2d0f7edd4db
184d8b600b66ceed4e065878447fd3b99d137a48
/SAN/san_eval.py
60938ea99585b075c384a071f438c62d9397c7a0
[ "MIT" ]
permissive
arnoldjair/landmark-detection
10d45bcdfbb469a3f59fb7d3916fe508fc0b150f
1ad9db7d94397d81898f6f7c05abe76806d3d85e
refs/heads/master
2023-03-07T20:06:57.594994
2021-02-15T02:56:49
2021-02-15T02:57:44
261,280,519
0
0
MIT
2020-05-04T19:48:14
2020-05-04T19:48:13
null
UTF-8
Python
false
false
4,894
py
############################################################## ### Copyright (c) 2018-present, Xuanyi Dong ### ### Style Aggregated Network for Facial Landmark Detection ### ### Computer Vision and Pattern Recognition, 2018 ### ############################################################## from __future__ import division import os, sys, time, random, argparse, PIL from pathlib import Path from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True # please use Pillow 4.0.0 or it may fail for some images from os import path as osp import numbers, numpy as np import init_path import torch import models import datasets from visualization import draw_image_by_points from san_vision import transforms from utils import time_string, time_for_file, get_model_infos def evaluate(args): if not args.cpu: assert torch.cuda.is_available(), 'CUDA is not available.' torch.backends.cudnn.enabled = True torch.backends.cudnn.benchmark = True print ('The image is {:}'.format(args.image)) print ('The model is {:}'.format(args.model)) snapshot = Path(args.model) assert snapshot.exists(), 'The model path {:} does not exist' print ('The face bounding box is {:}'.format(args.face)) assert len(args.face) == 4, 'Invalid face input : {:}'.format(args.face) if args.cpu: snapshot = torch.load(snapshot, map_location='cpu') else : snapshot = torch.load(snapshot) mean_fill = tuple( [int(x*255) for x in [0.5, 0.5, 0.5] ] ) normalize = transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]) param = snapshot['args'] eval_transform = transforms.Compose([transforms.PreCrop(param.pre_crop_expand), transforms.TrainScale2WH((param.crop_width, param.crop_height)), transforms.ToTensor(), normalize]) net = models.__dict__[param.arch](param.modelconfig, None) if not args.cpu: net = net.cuda() weights = models.remove_module_dict(snapshot['state_dict']) net.load_state_dict(weights) dataset = datasets.GeneralDataset(eval_transform, param.sigma, param.downsample, param.heatmap_type, param.dataset_name) dataset.reset(param.num_pts) print ('[{:}] prepare the input data'.format(time_string())) [image, _, _, _, _, _, cropped_size], meta = dataset.prepare_input(args.image, args.face) print ('[{:}] prepare the input data done'.format(time_string())) print ('Net : \n{:}'.format(net)) # network forward with torch.no_grad(): if args.cpu: inputs = image.unsqueeze(0) else : inputs = image.unsqueeze(0).cuda() batch_heatmaps, batch_locs, batch_scos, _ = net(inputs) #print ('input-shape : {:}'.format(inputs.shape)) flops, params = get_model_infos(net, inputs.shape, None) print ('\nIN-shape : {:}, FLOPs : {:} MB, Params : {:}.'.format(list(inputs.shape), flops, params)) flops, params = get_model_infos(net, None, inputs) print ('\nIN-shape : {:}, FLOPs : {:} MB, Params : {:}.'.format(list(inputs.shape), flops, params)) print ('[{:}] the network forward done'.format(time_string())) # obtain the locations on the image in the orignial size cpu = torch.device('cpu') np_batch_locs, np_batch_scos, cropped_size = batch_locs.to(cpu).numpy(), batch_scos.to(cpu).numpy(), cropped_size.numpy() locations, scores = np_batch_locs[0,:-1,:], np.expand_dims(np_batch_scos[0,:-1], -1) scale_h, scale_w = cropped_size[0] * 1. / inputs.size(-2) , cropped_size[1] * 1. / inputs.size(-1) locations[:, 0], locations[:, 1] = locations[:, 0] * scale_w + cropped_size[2], locations[:, 1] * scale_h + cropped_size[3] prediction = np.concatenate((locations, scores), axis=1).transpose(1,0) for i in range(param.num_pts): point = prediction[:, i] print ('The coordinate of {:02d}/{:02d}-th points : ({:.1f}, {:.1f}), score = {:.3f}'.format(i, param.num_pts, float(point[0]), float(point[1]), float(point[2]))) if args.save_path: image = draw_image_by_points(args.image, prediction, 1, (255,0,0), False, False) image.save( args.save_path ) print ('save image with landmarks into {:}'.format(args.save_path)) print('finish san evaluation on a single image : {:}'.format(args.image)) if __name__ == '__main__': parser = argparse.ArgumentParser(description='Evaluate a single image by the trained model', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--image', type=str, help='The evaluation image path.') parser.add_argument('--model', type=str, help='The snapshot to the saved detector.') parser.add_argument('--face', nargs='+', type=float, help='The coordinate [x1,y1,x2,y2] of a face') parser.add_argument('--save_path', type=str, help='The path to save the visualization results') parser.add_argument('--cpu', action='store_true', help='Use CPU or not.') args = parser.parse_args() evaluate(args)
[ "280835372@qq.com" ]
280835372@qq.com
2a3797f3bed09887087024272f762da60f75cf0c
d66818f4b951943553826a5f64413e90120e1fae
/hackerearth/Data Structures/Disjoint Data Structures/Basics of Disjoint Data Structures/Utkarsh and Sub Array Xor/test.py
27983cd92535eaaa15d7a1cf008205989e6f294e
[ "MIT" ]
permissive
HBinhCT/Q-project
0f80cd15c9945c43e2e17072416ddb6e4745e7fa
19923cbaa3c83c670527899ece5c3ad31bcebe65
refs/heads/master
2023-08-30T08:59:16.006567
2023-08-29T15:30:21
2023-08-29T15:30:21
247,630,603
8
1
MIT
2020-07-22T01:20:23
2020-03-16T06:48:02
Python
UTF-8
Python
false
false
587
py
import io import unittest from contextlib import redirect_stdout from unittest.mock import patch class TestQ(unittest.TestCase): @patch('sys.stdin.readline', side_effect=[ '5 3', '1 1', '2 3', '5 5', ]) def test_case_0(self, input_mock=None): text_trap = io.StringIO() with redirect_stdout(text_trap): import solution self.assertEqual(text_trap.getvalue(), '16\n' + '8\n' + '4\n') if __name__ == '__main__': unittest.main()
[ "hbinhct@gmail.com" ]
hbinhct@gmail.com
f310095a1ac0eb8cfb8178e08cc8ef0bc17261cd
70f564990215f47b139a777826f211477e9b44f6
/plan2vec/plotting/visualize_pairs_2d.py
baba4ce4a5bc3ae7fadfd4c5f4a7a5b08a1d0a2a
[]
no_license
geyang/plan2vec
de87f2d77732c4aacdefd00067ebebacb7cd763f
aeeb50aed3d7da4c266b4ca163e96d4c0747e3c1
refs/heads/master
2022-11-16T03:40:42.638239
2022-10-28T04:01:29
2022-10-28T04:01:29
261,273,420
65
3
null
null
null
null
UTF-8
Python
false
false
8,191
py
import numpy.ma as ma def visualize_neighbors(xs, ns, key=None): """ Visualizing points, and their neighbors in the dataset :param xs: Size(batch_n, 2) :param ns: Size(batch_n, k, 2), k being the number of neighbors to show :param key: The path to save the figure to :return: """ import matplotlib.pyplot as plt assert len(xs) == len(ns), "state samples and be neighbors need to have the same length" DPI = 300 title = "neighbors" plt.figure(figsize=(3, 3), dpi=DPI, ) plt.title(title) k = xs.shape[0] for i, (x, neighbors) in enumerate(zip(xs, ns)): alpha = (i + 1) / (k + 1) # note: marker size = points/inch * actual axial size. plt.plot(x[0], x[1], "o", c="black", alpha=alpha, markersize=DPI * 0.015 * 2, mec="none") for n in neighbors: plt.plot([x[0], n[0]], [x[1], n[1]], "-", c='black', alpha=alpha, linewidth=3, mec='none') plt.xlim(-0.3, 0.3) plt.ylim(-0.3, 0.3) plt.gca().set_aspect('equal') if key is None: plt.show() else: from ml_logger import logger logger.savefig(key) plt.close() def visualize_start_goal(starts, goals, key=None): """ Visualizing the start and the goals :param starts: Size(batch_n, 2) :param goals: Size(batch_n, 2) :param key: The path to save the figure to :return: """ import matplotlib.pyplot as plt assert len(starts) == len(goals), "starts and goals need to have the same length" DPI = 300 title = "Start and Goals" plt.figure(figsize=(3, 3), dpi=DPI, ) plt.title(title) k = goals.shape[0] for i, (x, g) in enumerate(zip(starts, goals)): alpha = (i + 1) / (k + 1) # note: marker size = points/inch * actual axial size. plt.plot(g[0], g[1], "o", c="black", alpha=alpha, markersize=DPI * 0.015 * 2, mec="none") plt.plot([x[0], g[0]], [x[1], g[1]], "-", c='black', alpha=alpha, linewidth=3, mec='none') plt.xlim(-0.3, 0.3) plt.ylim(-0.3, 0.3) plt.gca().set_aspect('equal') if key is None: plt.show() else: from ml_logger import logger logger.savefig(key) plt.close() def visualize_latent_plans(xs, goals, done, key=None): """ Visualizing the sample trajectories in a 2-dimensional domain We use the done flags to :param xs: Size(B, n, 2) :param goals: Size(B, n, 2) :param done: Size(B, n, 2) :param key: The path to save the figure to :return: """ import matplotlib.pyplot as plt colors = ['#49b8ff', '#66c56c', '#f4b247'] DPI = 300 title = "Trajectory Distribution" plt.figure(figsize=(3, 3), dpi=DPI, ) plt.title(title) n, k, *_ = xs.shape for i in range(k): alpha = (i + 1) / (k + 1) # alpha = 0.7 x, g, d = ma.array(xs[:, i]), ma.array(goals[:, i]), done[:, i] x[d] = ma.masked g[d] = ma.masked c = colors[i % len(colors)] plt.plot(g[:, 0], g[:, 1], "o", c="red", alpha=0.7 / (n + 1), markersize=DPI * 0.04 * 2, mec="none") plt.plot(ma.array(x[:, 0]), ma.array(x[:, 1]), 'o-', c="#23aaff", alpha=alpha, linewidth=2, markersize=DPI * 0.01 * 2, mec="none") plt.xlim(-0.3, 0.3) plt.ylim(-0.3, 0.3) plt.gca().set_aspect('equal') if key is None: plt.show() else: from ml_logger import logger logger.savefig(key) plt.close() def visualize_trajectories_2d(paths, key=None): """ Visualizing the sample trajectories in a 2-dimensional domain :param paths: the dictionary of the sampled dataset :param key: The path to save the figure to :return: """ import matplotlib.pyplot as plt DPI = 300 title = "Trajectory Distribution" plt.figure(figsize=(3, 3), dpi=DPI, ) plt.title(title) goals = paths['obs']["goal"][:1] k = goals.shape[1] # note: marker size = points/inch * actual axial size. plt.plot(goals[:, :, 0], goals[:, :, 1], "o", c="red", alpha=0.7, markersize=DPI * 0.04 * 2, mec="none") trajs = paths['obs']["x"] # todo: ues different color for different trajectories # note: marker size = points/inch * actual axial size. plt.plot(trajs[:, :, 0], trajs[:, :, 1], 'o-', c="#23aaff", alpha=10 / k, linewidth=2, markersize=DPI * 0.01 * 2, mec="none") plt.xlim(-0.3, 0.3) plt.ylim(-0.3, 0.3) plt.gca().set_aspect('equal') if key is None: plt.show() else: from ml_logger import logger logger.savefig(key) plt.close() def visualize_skewed_trajectories(paths, key=None): """ Visualizing the sample trajectories in a 2-dimensional domain :param paths: the dictionary of the sampled dataset :param key: The path to save the figure to :return: """ import matplotlib.pyplot as plt DPI = 300 title = "Trajectory Distribution" plt.figure(figsize=(3, 3), dpi=DPI, ) plt.title(title) goals = paths['obs']["goal"][:1] k = goals.shape[1] # note: marker size = points/inch * actual axial size. if k < 10: plt.plot(goals[:, :, 0], goals[:, :, 1], "o", c="gray", alpha=0.1, markersize=DPI * 0.04 * 2, mec="none") trajs = paths['obs']["x"] k = trajs.shape[1] colors = ['#23aaff'] if k > 10 else ['#49b8ff', '#66c56c', '#f4b247'] from ge_world.c_maze import good_goal good = np.array([good_goal(_) for _ in trajs.reshape(-1, 2)]).reshape(trajs.shape[:2]) # todo: ues different color for different trajectories # note: marker size = points/inch * actual axial size. for i, traj in enumerate(np.swapaxes(trajs, 0, 1)): plt.plot(traj[:, 0], traj[:, 1], '-', c=colors[i % len(colors)], alpha=0.5 if k < 10 else (10. / k), linewidth=2) for i, (traj, g) in enumerate(zip(np.swapaxes(trajs, 0, 1), np.swapaxes(good, 0, 1))): c = list(np.where(g, colors[i % len(colors)], "red")) plt.scatter(traj[:, 0], traj[:, 1], s=DPI * 0.05 * 2, c=c, marker='o', alpha=0.8 if k < 10 else (10. / k), linewidth=2, edgecolors="none") plt.xlim(-0.3, 0.3) plt.ylim(-0.3, 0.3) plt.gca().set_aspect('equal') if key is None: plt.show() else: from ml_logger import logger logger.savefig(key) plt.close() if __name__ == "__main__": from tqdm import trange import numpy as np from plan2vec.mdp.sampler import path_gen_fn from plan2vec.mdp.helpers import make_env from plan2vec.mdp.wrappers.subproc_vec_env import SubprocVecEnv from ge_world import IS_PATCHED assert IS_PATCHED is True, "need patch" envs = SubprocVecEnv([make_env('CMazeDiscreteIdLess-v0', i) for i in trange(500)]) random_pi = lambda ob, goal, *_: np.random.randint(0, 8, size=[len(ob)]) rev_a_dict = {(-0.5, -0.5): 0, (-0.5, 0): 1, (-0.5, 0.5): 2, (0, -0.5): 3, (0, 0.5): 4, (0.5, -0.5): 5, (0.5, 0): 6, (0.5, 0.5): 7} def homing_pi(ob, goal): act = map(tuple, 0.5 * abs(np.array(goal) - np.array(ob)) / (np.array(goal) - np.array(ob))) return [rev_a_dict[a] for a in act] eps = 0.1 def greedy_pi(ob, goal): if np.random.rand(1) < eps: return random_pi(ob, goal) return homing_pi(ob, goal) # servo_pi = lambda ob, goal, *_: rev_a_dict[ # tuple(0.5 * abs(np.array(goal) - np.array(ob)) / (np.array(goal) - np.array(ob)))] rand_path_gen = path_gen_fn(envs, greedy_pi, "x", "goal", all_keys=['x', 'goal']) next(rand_path_gen) p = rand_path_gen.send(50) # a, b = p['obs']['x'][:2, 0] # b - a # print(p['x']) # visualize_trajectories_2d(p, f"./figures/CMaze trajectories (fixed).png") # visualize_trajectories_2d(p, f"./figures/CMaze trajectories (homing).png") # visualize_trajectories_2d(p, f"./figures/CMaze trajectories (greedy {eps}).png") visualize_skewed_trajectories(p, f"figures/CMaze rejected goals (500).png") # visualize_skewed_trajectories(p)
[ "yangge1987@gmail.com" ]
yangge1987@gmail.com
0dec8f63058472db6eff1fc379f5f8579e6dab45
7b5828edda7751700ca7002b40a214e39e5f48a8
/EA/simulation/interactions/picker/picker_pie_menu_interaction.py
8769291d17aacc068029716f6b93552f0757e5f9
[]
no_license
daniela-venuta/Sims-4-Python-Script-Workspace
54c33dac02f84daed66f46b7307f222fede0fa62
f408b28fb34626b2e3b2953152343d591a328d66
refs/heads/main
2023-03-29T18:08:39.202803
2021-03-30T19:00:42
2021-03-30T19:00:42
353,111,243
1
0
null
null
null
null
UTF-8
Python
false
false
3,817
py
from event_testing.results import TestResult from objects.base_interactions import ProxyInteraction from sims4.utils import flexmethod, classproperty from singletons import DEFAULT class _PickerPieMenuProxyInteraction(ProxyInteraction): INSTANCE_SUBCLASSES_ONLY = True @classproperty def proxy_name(cls): return '[PickerRow]' @classmethod def generate(cls, proxied_affordance, picker_row_data): result = super().generate(proxied_affordance) result.picker_row_data = picker_row_data if hasattr(proxied_affordance, 'funds_source'): result.register_cost_gain_strings_callbacks(proxied_affordance.funds_source.get_cost_string, proxied_affordance.funds_source.get_gain_string) return result @classmethod def potential_interactions(cls, target, context, **kwargs): yield cls.generate_aop(target, context, **kwargs) @classmethod def _test(cls, target, context, **kwargs): result = super()._test(target, context, **kwargs) if not result: return result if cls.picker_row_data.is_enable: tooltip = None else: tooltip = cls.picker_row_data.row_tooltip if cls.pie_menu_option.show_disabled_item else None return TestResult(cls.picker_row_data.is_enable, influence_by_active_mood=cls.picker_row_data.pie_menu_influence_by_active_mood, tooltip=tooltip) @flexmethod def get_display_tooltip(cls, inst, override=None, context=DEFAULT, **kwargs): inst_or_cls = inst if inst is not None else cls context = inst.context if context is DEFAULT else context tooltip = inst_or_cls.display_tooltip if override.new_display_tooltip is not None: tooltip = override.new_display_tooltip if override is not None and tooltip is None: tooltip = inst_or_cls.picker_row_data.row_tooltip if tooltip is not None: tooltip = inst_or_cls.create_localized_string(tooltip, context=context, **kwargs) return tooltip @flexmethod def get_pie_menu_category(cls, inst, **kwargs): inst_or_cls = inst if inst is not None else cls if inst_or_cls.pie_menu_option.force_pie_menu_category: return inst_or_cls.pie_menu_option.pie_menu_category return inst_or_cls.picker_row_data.pie_menu_category or inst_or_cls.pie_menu_option.pie_menu_category @flexmethod def _get_name(cls, inst, target=DEFAULT, context=DEFAULT, **kwargs): inst_or_cls = inst if inst is not None else cls display_name = inst_or_cls.pie_menu_option.pie_menu_name (override_tunable, _) = inst_or_cls.get_name_override_and_test_result(target=target, context=context) if override_tunable.new_display_name is not None: display_name = override_tunable.new_display_name display_name = inst_or_cls.create_localized_string(display_name, inst_or_cls.picker_row_data.name, target=target, context=context, **kwargs) price = getattr(inst_or_cls.picker_row_data, 'price', 0) if override_tunable is not None and price > 0: if inst_or_cls.picker_row_data.is_discounted: price = inst_or_cls.picker_row_data.discounted_price cost_name_factory = inst_or_cls.get_cost_name_factory() display_name = cost_name_factory(display_name, price) return display_name def _run_interaction_gen(self, timeline): yield from super()._run_interaction_gen(timeline) ingredient_data = self._kwargs.get('recipe_ingredients_map') self.on_choice_selected(self.picker_row_data.tag, ingredient_data=ingredient_data, ingredient_check=ingredient_data is not None) return True
[ "44103490+daniela-venuta@users.noreply.github.com" ]
44103490+daniela-venuta@users.noreply.github.com
0f6ed1a800cc6996f60226a18705142f486db303
21b07f788809bce4bc7d917b429018b53d71a5b1
/esp32/ioboard-test-sparkfun/network_rtc_2.py
cbc831f221eb08ca88a785b316fbdade9e06d1b2
[]
no_license
pascal1062/micropython
f4008b87b7addfb0908b90dac2f12f67b9feb411
1968240d15f4a046e5ba71308ab46a927457685f
refs/heads/main
2023-07-17T17:59:18.893905
2021-08-29T15:23:10
2021-08-29T15:23:10
401,066,763
0
0
null
null
null
null
UTF-8
Python
false
false
964
py
def set_time(): import network import urequests import ujson from machine import RTC url = "http://192.168.0.90:1880/currenttime" wifi = network.WLAN(network.STA_IF) rtc = RTC() if wifi.isconnected(): response = urequests.get(url) if response.status_code == 200: # query success print("JSON response:\n" + response.text) # parse JSON parsed = ujson.loads(response.text) # you can also use parsed = response.json() datetime_str = str(parsed["datetime"]) year = int(datetime_str[0:4]) month = int(datetime_str[5:7]) day = int(datetime_str[8:10]) hour = int(datetime_str[11:13]) minute = int(datetime_str[14:16]) second = int(datetime_str[17:19]) subsecond = 0 rtc.datetime((year, month, day, 0, hour, minute, second, subsecond)) print("RTC updated\n") #End
[ "noreply@github.com" ]
pascal1062.noreply@github.com
942731729f219217e64b0c6be4991e8bfd33277f
7e2529fec680006e01d3688bb33115e9a97ee1ac
/hackerrank/cutTheSticks.py
e62c609436c1bd910f791d9e510f2136d8c6cc9f
[]
no_license
JamesWo/Algorithms
d3c6155e655e40704d42084b7d2236eb01ccb91c
e4a13f06b3902f23389e89f00832886a495ced42
refs/heads/master
2021-01-17T06:09:35.968583
2016-08-03T17:05:54
2016-08-03T17:05:54
36,084,351
1
0
null
null
null
null
UTF-8
Python
false
false
499
py
#https://www.hackerrank.com/challenges/cut-the-sticks # Enter your code here. Read input from STDIN. Print output to STDOUT numSticks = input() print numSticks remainingSticks = numSticks sticks = map(int, raw_input().split(" ")) sticks.sort() index = 0 while (index+1) < len(sticks): index += 1 remainingSticks -= 1 currCount = 0 value = sticks[index] while sticks[index] == sticks[index-1]: index += 1 remainingSticks -= 1 print remainingSticks
[ "jameswo@berkeley.edu" ]
jameswo@berkeley.edu
6ee04f7cced2a9753d6e71a556a2acec738e5dd2
68fda43868893bbc11a27a95f2d5d2670757a90e
/FitHome_monitor/config/test_config.py
e19093250441b744fa9b286c6fc6817229a1e6ee
[]
no_license
BitKnitting/energy_monitor_firmware
ad08da322a6fb514ec6bc95489874c32630cca69
6ec2d6e44a6aaf9350222146e82cef8c9798b636
refs/heads/master
2020-06-16T16:57:45.682787
2019-12-30T00:14:11
2019-12-30T00:14:11
195,643,120
1
0
null
null
null
null
UTF-8
Python
false
false
125
py
from config import read_config, add_creds monitor_name = read_config('monitor') print(monitor_name) add_creds('ssid', 'pwd')
[ "farmerrobbie@freshsalad.today" ]
farmerrobbie@freshsalad.today
64de19db9c16d1cb37f188e8734ed6bc7a683bc3
df2cbe914f463ad050d7ed26194424afbe3a0a52
/addons/l10n_ar/models/res_partner_bank.py
5f5104c356fdebe62bc9b36b803cb5a652bb8da7
[ "Apache-2.0" ]
permissive
SHIVJITH/Odoo_Machine_Test
019ed339e995be980606a2d87a63312ddc18e706
310497a9872db7844b521e6dab5f7a9f61d365a4
refs/heads/main
2023-07-16T16:23:14.300656
2021-08-29T11:48:36
2021-08-29T11:48:36
401,010,175
0
0
Apache-2.0
2021-08-29T10:13:58
2021-08-29T10:13:58
null
UTF-8
Python
false
false
1,675
py
# Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, api, _ from odoo.exceptions import ValidationError import logging _logger = logging.getLogger(__name__) try: from stdnum.ar.cbu import validate as validate_cbu except ImportError: import stdnum _logger.warning("stdnum.ar.cbu is avalaible from stdnum >= 1.6. The one installed is %s" % stdnum.__version__) def validate_cbu(number): def _check_digit(number): """Calculate the check digit.""" weights = (3, 1, 7, 9) check = sum(int(n) * weights[i % 4] for i, n in enumerate(reversed(number))) return str((10 - check) % 10) number = stdnum.util.clean(number, ' -').strip() if len(number) != 22: raise ValidationError('Invalid Length') if not number.isdigit(): raise ValidationError('Invalid Format') if _check_digit(number[:7]) != number[7]: raise ValidationError('Invalid Checksum') if _check_digit(number[8:-1]) != number[-1]: raise ValidationError('Invalid Checksum') return number class ResPartnerBank(models.Model): _inherit = 'res.partner.bank' @api.model def _get_supported_account_types(self): """ Add new account type named cbu used in Argentina """ res = super()._get_supported_account_types() res.append(('cbu', _('CBU'))) return res @api.model def retrieve_acc_type(self, acc_number): try: validate_cbu(acc_number) except Exception: return super().retrieve_acc_type(acc_number) return 'cbu'
[ "36736117+SHIVJITH@users.noreply.github.com" ]
36736117+SHIVJITH@users.noreply.github.com
5aae22ecc57ea7a2762bc110ed3a55a913519a92
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03206/s703219007.py
7f5518d8fe01a2da04eacbbfed3dad911913847c
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
77
py
d=int(input()) s="Christmas" for i in range(25,d,-1): s=s+" Eve" print(s)
[ "66529651+Aastha2104@users.noreply.github.com" ]
66529651+Aastha2104@users.noreply.github.com
f20051d3520c006f6e93f0dd5d0c2b82242fdb65
8633ec7985ffd7f849210b93bc20e632f8ae8707
/rereco/additional_rereco/EvtGeneration/conf_files_cmsdr/SingleEl/SingleElectronPt10_RECO.py
9580777303bf223fbc588f75970dc744677249b6
[]
no_license
liis/el_track
2ed5b3b7a64d57473328df0e5faf28808bab6166
cd7978e5fa95d653bab5825b940911b465172c1a
refs/heads/master
2016-09-10T20:09:07.882261
2015-01-08T14:41:59
2015-01-08T14:41:59
14,494,773
0
0
null
null
null
null
UTF-8
Python
false
false
3,851
py
# Auto generated configuration file # using: # Revision: 1.19 # Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v # with command line options: --customise SLHCUpgradeSimulations/Configuration/postLS1Customs.customisePostLS1 --conditions PRE_STA71_V4::All -s RAW2DIGI,L1Reco,RECO --datatier GEN-SIM-RECO-RECODEBUG -n -1 --magField 38T_PostLS1 --eventcontent RECODEBUG --io ./outfiles/testing/SingleElectronPt10_RECO.io --python ./conf_files_cmsdr/testing/SingleElectronPt10_RECO.py --filein file:./outfiles/testing/SingleElectronPt10_RAW.root --fileout file:./outfiles/testing/SingleElectronPt10_RECO.root import FWCore.ParameterSet.Config as cms process = cms.Process('RECO') # import of standard configurations process.load('Configuration.StandardSequences.Services_cff') process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') process.load('FWCore.MessageService.MessageLogger_cfi') process.load('Configuration.EventContent.EventContent_cff') process.load('SimGeneral.MixingModule.mixNoPU_cfi') process.load('Configuration.StandardSequences.GeometryRecoDB_cff') process.load('Configuration.StandardSequences.MagneticField_38T_PostLS1_cff') process.load('Configuration.StandardSequences.RawToDigi_cff') process.load('Configuration.StandardSequences.L1Reco_cff') process.load('Configuration.StandardSequences.Reconstruction_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) ) # Input source process.source = cms.Source("PoolSource", secondaryFileNames = cms.untracked.vstring(), fileNames = cms.untracked.vstring('file:SingleElectronPt10_RAW.root') ) process.options = cms.untracked.PSet( ) # Production Info process.configurationMetadata = cms.untracked.PSet( version = cms.untracked.string('$Revision: 1.19 $'), annotation = cms.untracked.string('--customise nevts:-1'), name = cms.untracked.string('Applications') ) # Output definition outfile="SingleElectronPt10_RECO.root" print "Saving output to: " + outfile process.RECODEBUGoutput = cms.OutputModule("PoolOutputModule", splitLevel = cms.untracked.int32(0), eventAutoFlushCompressedSize = cms.untracked.int32(5242880), outputCommands = process.RECODEBUGEventContent.outputCommands, fileName = cms.untracked.string('file:' + outfile ), dataset = cms.untracked.PSet( filterName = cms.untracked.string(''), dataTier = cms.untracked.string('GEN-SIM-RECO-RECODEBUG') ) ) # Additional output definition # Other statements from Configuration.AlCa.GlobalTag import GlobalTag process.GlobalTag = GlobalTag(process.GlobalTag, 'PRE_STA71_V4::All', '') process.RECODEBUGoutput.outputCommands.append('keep *PSimHits_g4SimHits_*_*') # needed for SimHitTPAssocProducer (not saved in RECODEBUG, but only in FEVTDEBUG) # Path and EndPath definitions process.raw2digi_step = cms.Path(process.RawToDigi) process.L1Reco_step = cms.Path(process.L1Reco) process.reconstruction_step = cms.Path(process.reconstruction) process.endjob_step = cms.EndPath(process.endOfProcess) process.RECODEBUGoutput_step = cms.EndPath(process.RECODEBUGoutput) # Schedule definition process.schedule = cms.Schedule(process.raw2digi_step,process.L1Reco_step,process.reconstruction_step,process.endjob_step,process.RECODEBUGoutput_step) # customisation of the process. # Automatic addition of the customisation function from SLHCUpgradeSimulations.Configuration.postLS1Customs from SLHCUpgradeSimulations.Configuration.postLS1Customs import customisePostLS1 #call to customisation function customisePostLS1 imported from SLHCUpgradeSimulations.Configuration.postLS1Customs process = customisePostLS1(process) # End of customisation functions
[ "polaarrebane@gmail.com" ]
polaarrebane@gmail.com