How to use setter method in storybook-root

Best JavaScript code snippet using storybook-root

setup_db.py

Source:setup_db.py Github

copy

Full Screen

1import os2import logging3import sqlite34import traceback5from hyo2.abc.lib.helper import Helper6from hyo2.soundspeed.base.basedb import BaseDb7from hyo2.soundspeed.base.setup_sql import CREATE_SETTINGS, CREATE_SETTINGS_VIEW, CREATE_CLIENT_LIST, \8 RENAME_SETTINGS, RENAME_CLIENT_LIST, DROP_OLD_SETTINGS, DROP_OLD_CLIENT_LIST, DROP_SETTINGS_VIEW, \9 V1_V5_COPY_SETTINGS, V1_V5_COPY_CLIENT_LIST10logger = logging.getLogger(__name__)11class SetupDb(BaseDb):12 def __init__(self, data_folder, db_file="setup.db", use_setup_name=None):13 self.data_folder = data_folder14 db_path = os.path.join(data_folder, db_file)15 super(SetupDb, self).__init__(db_path=db_path)16 self.reconnect_or_create()17 self._check_default_setup()18 self.use_setup_name = use_setup_name19 def update_from_v1_to_v5(self):20 if not self.conn:21 logger.error("Missing db connection")22 return False23 try:24 with self.conn:25 self.conn.execute(""" PRAGMA foreign_keys = 0""")26 with self.conn:27 self.conn.execute(RENAME_SETTINGS)28 self.conn.execute(RENAME_CLIENT_LIST)29 self.conn.execute(DROP_SETTINGS_VIEW)30 self.conn.execute(CREATE_SETTINGS)31 self.conn.execute(CREATE_CLIENT_LIST)32 self.conn.execute(CREATE_SETTINGS_VIEW)33 with self.conn:34 self.conn.execute(V1_V5_COPY_SETTINGS)35 self.conn.execute(V1_V5_COPY_CLIENT_LIST)36 self.conn.execute(DROP_OLD_SETTINGS)37 self.conn.execute(DROP_OLD_CLIENT_LIST)38 with self.conn:39 if self.conn.execute(""" PRAGMA foreign_keys """):40 # logger.info("foreign keys active")41 pass42 else:43 logger.error("foreign keys not active")44 return False45 return True46 except sqlite3.Error as e:47 traceback.print_exc()48 logger.error("during building tables, %s: %s" % (type(e), e))49 return False50 def build_tables(self):51 if not self.conn:52 logger.error("Missing db connection")53 return False54 try:55 with self.conn:56 if self.conn.execute(""" PRAGMA foreign_keys """):57 # logger.info("foreign keys active")58 pass59 else:60 logger.error("foreign keys not active")61 return False62 self.conn.execute(CREATE_SETTINGS)63 self.conn.execute(CREATE_CLIENT_LIST)64 self.conn.execute(CREATE_SETTINGS_VIEW)65 return True66 except sqlite3.Error as e:67 logger.error("during building tables, %s: %s" % (type(e), e))68 return False69 def open_folder(self):70 Helper.explore_folder(self.data_folder)71 # --- setup stuff72 def _check_default_setup(self):73 """Check for the presence of default settings, creating them if missing and not other setups. """74 if len(self.setup_list) == 0:75 logger.debug("creating default setup")76 default_setup = "default"77 if not self.setup_exists(default_setup):78 self.add_setup(setup_name=default_setup)79 self.activate_setup(setup_name=default_setup)80 # noinspection SqlResolve81 def setup_exists(self, setup_name):82 """Check if the passed profile exists"""83 try:84 ret = self.conn.execute(""" SELECT COUNT(id) FROM general WHERE setup_name=? """,85 (setup_name,)).fetchone()86 # logger.info("found %d settings named %s" % (ret[0], setup_name))87 if ret[0] == 0:88 return False89 else:90 return True91 except sqlite3.Error as e:92 raise RuntimeError("%s: %s" % (type(e), e))93 # noinspection SqlResolve94 def add_setup(self, setup_name):95 """ Add setting with passed name and default values."""96 with self.conn:97 try:98 logger.info("inserting %s settings with default values" % setup_name)99 # create a default settings record100 self.conn.execute(""" INSERT INTO general (setup_name) VALUES(?) """, (setup_name,))101 # retrieve settings id102 ret = self.conn.execute(""" SELECT id FROM general WHERE setup_name=? """,103 (setup_name,)).fetchone()104 # logger.info("%s settings id: %s" % (setup_name, ret[0]))105 # add default client list106 self.conn.execute(""" INSERT INTO client_list (setup_id) VALUES(?) """, (ret[0],))107 # logger.info("inserted %s settings values" % setup_name)108 return True109 except sqlite3.Error as e:110 logger.error("%s: %s" % (type(e), e))111 return False112 # noinspection SqlResolve113 def delete_setup(self, setup_name):114 """ Delete a profile (if not active)."""115 with self.conn:116 try:117 # check if active118 ret = self.conn.execute(""" SELECT setup_status FROM general WHERE setup_name=? """,119 (setup_name,)).fetchone()120 # logger.info("%s settings status: %s" % (setup_name, ret))121 if ret == "active":122 raise RuntimeError("Attempt to delete active profile (%s)" % setup_name)123 # create a default settings record124 self.conn.execute(""" DELETE FROM general WHERE setup_name=? """, (setup_name,))125 # logger.info("deleted profile: %s" % setup_name)126 except sqlite3.Error as e:127 logger.error("%s: %s" % (type(e), e))128 return False129 # noinspection SqlResolve130 def activate_setup(self, setup_name):131 """Activate a profile, if it exists"""132 if not self.setup_exists(setup_name):133 return False134 with self.conn:135 try:136 # set all the values to inactive137 self.conn.execute(""" UPDATE general SET setup_status="inactive" """)138 # set active just the passed profile139 self.conn.execute(""" UPDATE general SET setup_status="active" WHERE setup_name=? """, (setup_name,))140 # logger.info("activated profile: %s" % setup_name)141 except sqlite3.Error as e:142 logger.error("%s: %s" % (type(e), e))143 return False144 # noinspection SqlResolve145 @property146 def active_setup_id(self):147 """ Retrieve the active settings id """148 if self.use_setup_name is None:149 ret = self.conn.execute(""" SELECT id FROM general WHERE setup_status="active" """).fetchone()150 return ret[0]151 # logger.debug('using setup name: %s' % self.use_setup_name)152 ret = self.conn.execute(""" SELECT id FROM general WHERE setup_name=? """,153 (self.use_setup_name,)).fetchone()154 return ret[0]155 # noinspection SqlResolve156 def setup_id_from_setup_name(self, setup_name):157 ret = self.conn.execute(""" SELECT id FROM general WHERE setup_name=? """,158 (setup_name,)).fetchone()159 return ret[0]160 # --- clients list161 # noinspection SqlResolve162 @property163 def client_list(self):164 ret = self.conn.execute(""" SELECT id, name, ip, port, protocol FROM client_list WHERE setup_id=? """,165 (self.active_setup_id,)).fetchall()166 # logger.info("SSP clients: %s" % len(ret))167 return ret168 # noinspection SqlResolve169 def client_exists(self, client_name):170 """Check if the passed profile exists"""171 try:172 ret = self.conn.execute(""" SELECT COUNT(id) FROM client_list WHERE name=? """,173 (client_name,)).fetchone()174 # logger.info("found %s clients named %s" % (ret[0], client_name))175 if ret[0] == 0:176 return False177 else:178 return True179 except sqlite3.Error as e:180 raise RuntimeError("%s: %s" % (type(e), e))181 # noinspection SqlResolve182 def add_client(self, client_name, client_ip="127.0.0.1", client_port=4001, client_protocol="SIS"):183 """Add client with passed name and default values."""184 with self.conn:185 try:186 self.conn.execute(""" INSERT INTO client_list (setup_id, name, ip, port, protocol)187 VALUES(?, ?, ?, ?, ?) """,188 (self.active_setup_id, client_name, client_ip, client_port, client_protocol))189 # logger.info("inserted %s client values" % client_name, client_ip, client_port, client_protocol)190 except sqlite3.Error as e:191 logger.error("%s: %s" % (type(e), e))192 return False193 # noinspection SqlResolve194 def delete_client(self, client_name):195 """Delete a client."""196 with self.conn:197 try:198 self.conn.execute(""" DELETE FROM client_list WHERE name=? AND setup_id=?""",199 (client_name, self.active_setup_id,))200 # logger.info("deleted client: %s" % client_name)201 except sqlite3.Error as e:202 logger.error("%s: %s" % (type(e), e))203 return False204 # noinspection SqlResolve205 def delete_clients(self):206 """Delete all clients."""207 with self.conn:208 try:209 self.conn.execute(""" DELETE FROM client_list WHERE setup_id=?""",210 (self.active_setup_id,))211 # logger.info("deleted clients")212 except sqlite3.Error as e:213 logger.error("%s: %s" % (type(e), e))214 return False215 # --- setup list216 # noinspection SqlResolve217 @property218 def setup_list(self):219 ret = self.conn.execute(""" SELECT id, setup_name, setup_status, setup_version FROM general """).fetchall()220 # logger.info("Profiles list: %s" % len(ret))221 return ret222 # --- templates223 def _getter_int(self, attrib):224 r = self.conn.execute(""" SELECT """ + attrib + """ FROM general WHERE id=? """,225 (self.active_setup_id,)).fetchone()226 # logger.info("%s = %d" % (attrib, r[0]))227 return r[0]228 def _setter_int(self, attrib, value):229 with self.conn:230 try:231 self.conn.execute(""" UPDATE general SET """ + attrib + """=? WHERE id=? """,232 (value, self.active_setup_id,))233 except sqlite3.Error as e:234 logger.error("while setting %s, %s: %s" % (attrib, type(e), e))235 # logger.info("%s = %d" % (attrib, value))236 def _getter_str(self, attrib):237 r = self.conn.execute(""" SELECT """ + attrib + """ FROM general WHERE id=? """,238 (self.active_setup_id,)).fetchone()239 # logger.info("%s = %s" % (attrib, r[0]))240 return r[0]241 def _setter_str(self, attrib, value):242 with self.conn:243 try:244 self.conn.execute(""" UPDATE general SET """ + attrib + """=? WHERE id=? """,245 (value, self.active_setup_id,))246 except sqlite3.Error as e:247 logger.error("while setting %s, %s: %s" % (attrib, type(e), e))248 # logger.info("%s = %s" % (attrib, value))249 def _getter_bool(self, attrib: str):250 # logger.error("bool attrib: %s" % type(attrib))251 r = self.conn.execute(""" SELECT """ + attrib + """ FROM general WHERE id=? """,252 (self.active_setup_id,)).fetchone()253 # logger.info("%s = %s" % (attrib, r[0]))254 if isinstance(r[0], str):255 return r[0] == "True"256 else:257 return r[0] == 1258 def _setter_bool(self, attrib: str, value: bool) -> None:259 # required to check whether we are using the old str boolean260 r = self.conn.execute(""" SELECT """ + attrib + """ FROM general WHERE id=? """,261 (self.active_setup_id,)).fetchone()262 # logger.info("%s = %s" % (attrib, r[0]))263 if isinstance(r[0], str):264 is_str = True265 else:266 is_str = False267 with self.conn:268 if value:269 if is_str:270 value = "True"271 else:272 value = 1273 else:274 if is_str:275 value = "False"276 else:277 value = 0278 try:279 self.conn.execute(""" UPDATE general SET """ + attrib + """=? WHERE id=? """,280 (value, self.active_setup_id,))281 except sqlite3.Error as e:282 logger.error("while setting %s, %s: %s" % (attrib, type(e), e))283 # logger.info("%s = %s" % (attrib, value))284 # --- active library version285 @property286 def setup_version(self):287 return self._getter_int("setup_version")288 @setup_version.setter289 def setup_version(self, value):290 self._setter_int("setup_version", value)291 # --- active setup name292 @property293 def setup_name(self):294 return self._getter_str("setup_name")295 @setup_name.setter296 def setup_name(self, value):297 self._setter_str("setup_name", value)298 # --- active setup status299 @property300 def setup_status(self):301 return self._getter_str("setup_status")302 # --- use_woa09303 @property304 def use_woa09(self):305 return self._getter_bool("use_woa09")306 @use_woa09.setter307 def use_woa09(self, value):308 self._setter_bool("use_woa09", value)309 # --- use_woa13310 @property311 def use_woa13(self):312 return self._getter_bool("use_woa13")313 @use_woa13.setter314 def use_woa13(self, value):315 self._setter_bool("use_woa13", value)316 # --- use_woa18317 @property318 def use_woa18(self):319 return self._getter_bool("use_woa18")320 @use_woa18.setter321 def use_woa18(self, value):322 self._setter_bool("use_woa18", value)323 # --- use_rtofs324 @property325 def use_rtofs(self):326 return self._getter_bool("use_rtofs")327 @use_rtofs.setter328 def use_rtofs(self, value):329 self._setter_bool("use_rtofs", value)330 # --- use_gomofs331 @property332 def use_gomofs(self):333 return self._getter_bool("use_gomofs")334 @use_gomofs.setter335 def use_gomofs(self, value):336 self._setter_bool("use_gomofs", value)337 # --- ssp_extension_source338 @property339 def ssp_extension_source(self):340 return self._getter_str("ssp_extension_source")341 @ssp_extension_source.setter342 def ssp_extension_source(self, value):343 self._setter_str("ssp_extension_source", value)344 # --- ssp_salinity_source345 @property346 def ssp_salinity_source(self):347 return self._getter_str("ssp_salinity_source")348 @ssp_salinity_source.setter349 def ssp_salinity_source(self, value):350 self._setter_str("ssp_salinity_source", value)351 # --- ssp_temp_sal_source352 @property353 def ssp_temp_sal_source(self):354 return self._getter_str("ssp_temp_sal_source")355 @ssp_temp_sal_source.setter356 def ssp_temp_sal_source(self, value):357 self._setter_str("ssp_temp_sal_source", value)358 # --- ssp_up_or_down359 @property360 def ssp_up_or_down(self):361 return self._getter_str("ssp_up_or_down")362 @ssp_up_or_down.setter363 def ssp_up_or_down(self, value):364 self._setter_str("ssp_up_or_down", value)365 # --- use_sis4366 @property367 def use_sis4(self):368 return self._getter_bool("use_sis")369 @use_sis4.setter370 def use_sis4(self, value):371 self._setter_bool("use_sis", value)372 # --- use_sis5373 @property374 def use_sis5(self):375 return self._getter_bool("use_sis5")376 @use_sis5.setter377 def use_sis5(self, value):378 self._setter_bool("use_sis5", value)379 # --- use_sippican380 @property381 def use_sippican(self):382 return self._getter_bool("use_sippican")383 @use_sippican.setter384 def use_sippican(self, value):385 self._setter_bool("use_sippican", value)386 # --- use_mvp387 @property388 def use_mvp(self):389 return self._getter_bool("use_mvp")390 @use_mvp.setter391 def use_mvp(self, value):392 self._setter_bool("use_mvp", value)393 # --- rx_max_wait_time394 @property395 def rx_max_wait_time(self):396 return self._getter_int("rx_max_wait_time")397 @rx_max_wait_time.setter398 def rx_max_wait_time(self, value):399 self._setter_int("rx_max_wait_time", value)400 # --- sis_listen_port401 @property402 def sis_listen_port(self):403 return self._getter_int("sis_listen_port")404 @sis_listen_port.setter405 def sis_listen_port(self, value):406 self._setter_int("sis_listen_port", value)407 # --- sis_listen_timeout408 @property409 def sis_listen_timeout(self):410 return self._getter_int("sis_listen_timeout")411 @sis_listen_timeout.setter412 def sis_listen_timeout(self, value):413 self._setter_int("sis_listen_timeout", value)414 # --- sis_auto_apply_manual_casts415 @property416 def sis_auto_apply_manual_casts(self):417 return self._getter_bool("sis_auto_apply_manual_casts")418 @sis_auto_apply_manual_casts.setter419 def sis_auto_apply_manual_casts(self, value):420 self._setter_bool("sis_auto_apply_manual_casts", value)421 # --- sippican_listen_port422 @property423 def sippican_listen_port(self):424 return self._getter_int("sippican_listen_port")425 @sippican_listen_port.setter426 def sippican_listen_port(self, value):427 self._setter_int("sippican_listen_port", value)428 # --- sippican_listen_timeout429 @property430 def sippican_listen_timeout(self):431 return self._getter_int("sippican_listen_timeout")432 @sippican_listen_timeout.setter433 def sippican_listen_timeout(self, value):434 self._setter_int("sippican_listen_timeout", value)435 # --- mvp_ip_address436 @property437 def mvp_ip_address(self):438 return self._getter_str("mvp_ip_address")439 @mvp_ip_address.setter440 def mvp_ip_address(self, value):441 self._setter_str("mvp_ip_address", value)442 # --- mvp_listen_port443 @property444 def mvp_listen_port(self):445 return self._getter_int("mvp_listen_port")446 @mvp_listen_port.setter447 def mvp_listen_port(self, value):448 self._setter_int("mvp_listen_port", value)449 # --- mvp_listen_timeout450 @property451 def mvp_listen_timeout(self):452 return self._getter_int("mvp_listen_timeout")453 @mvp_listen_timeout.setter454 def mvp_listen_timeout(self, value):455 self._setter_int("mvp_listen_timeout", value)456 # --- mvp_transmission_protocol457 @property458 def mvp_transmission_protocol(self):459 return self._getter_str("mvp_transmission_protocol")460 @mvp_transmission_protocol.setter461 def mvp_transmission_protocol(self, value):462 self._setter_str("mvp_transmission_protocol", value)463 # --- mvp_format464 @property465 def mvp_format(self):466 return self._getter_str("mvp_format")467 @mvp_format.setter468 def mvp_format(self, value):469 self._setter_str("mvp_format", value)470 # --- mvp_winch_port471 @property472 def mvp_winch_port(self):473 return self._getter_int("mvp_winch_port")474 @mvp_winch_port.setter475 def mvp_winch_port(self, value):476 self._setter_int("mvp_winch_port", value)477 # --- mvp_fish_port478 @property479 def mvp_fish_port(self):480 return self._getter_int("mvp_fish_port")481 @mvp_fish_port.setter482 def mvp_fish_port(self, value):483 self._setter_int("mvp_fish_port", value)484 # --- mvp_nav_port485 @property486 def mvp_nav_port(self):487 return self._getter_int("mvp_nav_port")488 @mvp_nav_port.setter489 def mvp_nav_port(self, value):490 self._setter_int("mvp_nav_port", value)491 # --- mvp_system_port492 @property493 def mvp_system_port(self):494 return self._getter_int("mvp_system_port")495 @mvp_system_port.setter496 def mvp_system_port(self, value):497 self._setter_int("mvp_system_port", value)498 # --- mvp_sw_version499 @property500 def mvp_sw_version(self):501 return self._getter_str("mvp_sw_version")502 @mvp_sw_version.setter503 def mvp_sw_version(self, value):504 self._setter_str("mvp_sw_version", value)505 # --- mvp_instrument506 @property507 def mvp_instrument(self):508 return self._getter_str("mvp_instrument")509 @mvp_instrument.setter510 def mvp_instrument(self, value):511 self._setter_str("mvp_instrument", value)512 # --- mvp_instrument_id513 @property514 def mvp_instrument_id(self):515 return self._getter_str("mvp_instrument_id")516 @mvp_instrument_id.setter517 def mvp_instrument_id(self, value):518 self._setter_str("mvp_instrument_id", value)519 # --- server_source520 @property521 def server_source(self):522 return self._getter_str("server_source")523 @server_source.setter524 def server_source(self, value):525 self._setter_str("server_source", value)526 # --- server_apply_surface_sound_speed527 @property528 def server_apply_surface_sound_speed(self):529 return self._getter_bool("server_apply_surface_sound_speed")530 @server_apply_surface_sound_speed.setter531 def server_apply_surface_sound_speed(self, value):532 self._setter_bool("server_apply_surface_sound_speed", value)533 # --- server_max_failed_attempts534 @property535 def server_max_failed_attempts(self):536 return self._getter_int("server_max_failed_attempts")537 @server_max_failed_attempts.setter538 def server_max_failed_attempts(self, value):539 self._setter_int("server_max_failed_attempts", value)540 # --- current_project541 @property542 def current_project(self):543 return self._getter_str("current_project")544 @current_project.setter545 def current_project(self, value):546 self._setter_str("current_project", value)547 # --- custom_projects_folder548 @property549 def custom_projects_folder(self):550 return self._getter_str("custom_projects_folder")551 @custom_projects_folder.setter552 def custom_projects_folder(self, value):553 self._setter_str("custom_projects_folder", value)554 # --- custom_outputs_folder555 @property556 def custom_outputs_folder(self):557 return self._getter_str("custom_outputs_folder")558 @custom_outputs_folder.setter559 def custom_outputs_folder(self, value):560 self._setter_str("custom_outputs_folder", value)561 # --- custom_woa09_folder562 @property563 def custom_woa09_folder(self):564 return self._getter_str("custom_woa09_folder")565 @custom_woa09_folder.setter566 def custom_woa09_folder(self, value):567 self._setter_str("custom_woa09_folder", value)568 # --- custom_woa13_folder569 @property570 def custom_woa13_folder(self):571 return self._getter_str("custom_woa13_folder")572 @custom_woa13_folder.setter573 def custom_woa13_folder(self, value):574 self._setter_str("custom_woa13_folder", value)575 # --- custom_woa18_folder576 @property577 def custom_woa18_folder(self):578 return self._getter_str("custom_woa18_folder")579 @custom_woa18_folder.setter580 def custom_woa18_folder(self, value):581 self._setter_str("custom_woa18_folder", value)582 # --- noaa tools583 @property584 def noaa_tools(self):585 return self._getter_bool("noaa_tools")586 @noaa_tools.setter587 def noaa_tools(self, value):588 self._setter_bool("noaa_tools", value)589 # --- default_institution590 @property591 def default_institution(self):592 return self._getter_str("default_institution")593 @default_institution.setter594 def default_institution(self, value):595 self._setter_str("default_institution", value)596 # --- default_survey597 @property598 def default_survey(self):599 return self._getter_str("default_survey")600 @default_survey.setter601 def default_survey(self, value):602 self._setter_str("default_survey", value)603 # --- default_vessel604 @property605 def default_vessel(self):606 return self._getter_str("default_vessel")607 @default_vessel.setter608 def default_vessel(self, value):609 self._setter_str("default_vessel", value)610 # --- auto_apply_default_metadata611 @property612 def auto_apply_default_metadata(self):613 return self._getter_bool("auto_apply_default_metadata")614 @auto_apply_default_metadata.setter615 def auto_apply_default_metadata(self, value):...

Full Screen

Full Screen

rocket builder.py

Source:rocket builder.py Github

copy

Full Screen

1import time2from mcpi.minecraft import Minecraft3import minecraftstuff as mcstuff4mc = Minecraft.create()5rocketPos = mc.player.getTilePos()6rocketPos.z = rocketPos.z + 17rocketPos.y = rocketPos.y + 18blockSetter = mcstuff.MinecraftShape(mc, rocketPos)9lava = 1110ironBlock = 4211blockSetter.setBlock(-2,0,0,lava)12blockSetter.setBlock(-3,0,0,lava)13blockSetter.setBlock(-4,0,0,lava)14blockSetter.setBlock(-5,0,0,lava)15blockSetter.setBlock(-6,0,0,lava)16blockSetter.setBlock(-7,0,0,lava)17blockSetter.setBlock(-8,0,0,lava)18blockSetter.setBlock(-9,0,0,lava)19blockSetter.setBlock(2,0,0,lava)20blockSetter.setBlock(3,0,0,lava)21blockSetter.setBlock(4,0,0,lava)22blockSetter.setBlock(5,0,0,lava)23blockSetter.setBlock(6,0,0,lava)24blockSetter.setBlock(7,0,0,lava)25blockSetter.setBlock(8,0,0,lava)26blockSetter.setBlock(9,0,0,lava)27blockSetter.setBlock(-2,1,0,lava)28blockSetter.setBlock(-3,1,0,lava)29blockSetter.setBlock(-4,1,0,lava)30blockSetter.setBlock(-5,1,0,lava)31blockSetter.setBlock(-6,1,0,lava)32blockSetter.setBlock(-7,1,0,lava)33blockSetter.setBlock(-8,1,0,lava)34blockSetter.setBlock(-9,1,0,lava)35blockSetter.setBlock(2,1,0,lava)36blockSetter.setBlock(3,1,0,lava)37blockSetter.setBlock(4,1,0,lava)38blockSetter.setBlock(5,1,0,lava)39blockSetter.setBlock(6,1,0,lava)40blockSetter.setBlock(7,1,0,lava)41blockSetter.setBlock(8,1,0,lava)42blockSetter.setBlock(9,1,0,lava)43blockSetter.setBlock(-2,2,0,lava)44blockSetter.setBlock(-3,2,0,lava)45blockSetter.setBlock(-4,2,0,lava)46blockSetter.setBlock(-5,2,0,lava)47blockSetter.setBlock(-6,2,0,lava)48blockSetter.setBlock(-7,2,0,lava)49blockSetter.setBlock(-8,2,0,lava)50blockSetter.setBlock(-9,2,0,lava)51blockSetter.setBlock(2,2,0,lava)52blockSetter.setBlock(3,2,0,lava)53blockSetter.setBlock(4,2,0,lava)54blockSetter.setBlock(5,2,0,lava)55blockSetter.setBlock(6,2,0,lava)56blockSetter.setBlock(7,2,0,lava)57blockSetter.setBlock(8,2,0,lava)58blockSetter.setBlock(9,2,0,lava)59blockSetter.setBlock(-2,3,0,lava)60blockSetter.setBlock(-3,3,0,lava)61blockSetter.setBlock(-4,3,0,lava)62blockSetter.setBlock(-5,3,0,lava)63blockSetter.setBlock(-6,3,0,lava)64blockSetter.setBlock(-7,3,0,lava)65blockSetter.setBlock(-8,3,0,lava)66blockSetter.setBlock(-9,3,0,lava)67blockSetter.setBlock(2,3,0,lava)68blockSetter.setBlock(3,3,0,lava)69blockSetter.setBlock(4,3,0,lava)70blockSetter.setBlock(5,3,0,lava)71blockSetter.setBlock(6,3,0,lava)72blockSetter.setBlock(7,3,0,lava)73blockSetter.setBlock(8,3,0,lava)74blockSetter.setBlock(9,3,0,lava)75blockSetter.setBlock(-2,4,0,lava)76blockSetter.setBlock(-3,4,0,lava)77blockSetter.setBlock(-4,4,0,lava)78blockSetter.setBlock(-5,4,0,lava)79blockSetter.setBlock(-6,4,0,lava)80blockSetter.setBlock(-7,4,0,lava)81blockSetter.setBlock(-8,4,0,lava)82blockSetter.setBlock(-9,4,0,lava)83blockSetter.setBlock(2,4,0,lava)84blockSetter.setBlock(3,4,0,lava)85blockSetter.setBlock(4,4,0,lava)86blockSetter.setBlock(5,4,0,lava)87blockSetter.setBlock(6,4,0,lava)88blockSetter.setBlock(7,4,0,lava)89blockSetter.setBlock(8,4,0,lava)90blockSetter.setBlock(9,4,0,lava)91blockSetter.setBlock(-2,5,0,lava)92blockSetter.setBlock(-3,5,0,lava)93blockSetter.setBlock(-4,5,0,lava)94blockSetter.setBlock(-5,5,0,lava)95blockSetter.setBlock(-6,5,0,lava)96blockSetter.setBlock(-7,5,0,lava)97blockSetter.setBlock(-8,5,0,lava)98blockSetter.setBlock(-9,5,0,lava)99blockSetter.setBlock(2,5,0,lava)100blockSetter.setBlock(3,5,0,lava)101blockSetter.setBlock(4,5,0,lava)102blockSetter.setBlock(5,5,0,lava)103blockSetter.setBlock(6,5,0,lava)104blockSetter.setBlock(7,5,0,lava)105blockSetter.setBlock(8,5,0,lava)106blockSetter.setBlock(9,5,0,lava)107blockSetter.setBlock(-2,6,0,lava)108blockSetter.setBlock(-3,6,0,lava)109blockSetter.setBlock(-4,6,0,lava)110blockSetter.setBlock(-5,6,0,lava)111blockSetter.setBlock(-6,6,0,lava)112blockSetter.setBlock(-7,6,0,lava)113blockSetter.setBlock(-8,6,0,lava)114blockSetter.setBlock(-9,6,0,lava)115blockSetter.setBlock(2,6,0,lava)116blockSetter.setBlock(3,6,0,lava)117blockSetter.setBlock(4,6,0,lava)118blockSetter.setBlock(5,6,0,lava)119blockSetter.setBlock(6,6,0,lava)120blockSetter.setBlock(7,6,0,lava)121blockSetter.setBlock(8,6,0,lava)122blockSetter.setBlock(9,6,0,lava)123blockSetter.setBlock(-2,7,0,lava)124blockSetter.setBlock(-3,7,0,lava)125blockSetter.setBlock(-4,7,0,lava)126blockSetter.setBlock(-5,7,0,lava)127blockSetter.setBlock(-6,7,0,lava)128blockSetter.setBlock(-7,7,0,lava)129blockSetter.setBlock(-8,7,0,lava)130blockSetter.setBlock(-9,7,0,lava)131blockSetter.setBlock(2,7,0,lava)132blockSetter.setBlock(3,7,0,lava)133blockSetter.setBlock(4,7,0,lava)134blockSetter.setBlock(5,7,0,lava)135blockSetter.setBlock(6,7,0,lava)136blockSetter.setBlock(7,7,0,lava)137blockSetter.setBlock(8,7,0,lava)138blockSetter.setBlock(9,7,0,lava)139blockSetter.setBlock(-2,8,0,lava)140blockSetter.setBlock(-3,8,0,lava)141blockSetter.setBlock(-4,8,0,lava)142blockSetter.setBlock(-5,8,0,lava)143blockSetter.setBlock(-6,8,0,lava)144blockSetter.setBlock(-7,8,0,lava)145blockSetter.setBlock(-8,8,0,lava)146blockSetter.setBlock(-9,8,0,lava)147blockSetter.setBlock(2,8,0,lava)148blockSetter.setBlock(3,8,0,lava)149blockSetter.setBlock(4,8,0,lava)150blockSetter.setBlock(5,8,0,lava)151blockSetter.setBlock(6,8,0,lava)152blockSetter.setBlock(7,8,0,lava)153blockSetter.setBlock(8,8,0,lava)154blockSetter.setBlock(9,8,0,lava)155blockSetter.setBlock(-3,9,0,ironBlock)156blockSetter.setBlock(-4,9,0,ironBlock)157blockSetter.setBlock(-5,9,0,ironBlock)158blockSetter.setBlock(-6,9,0,ironBlock)159blockSetter.setBlock(-7,9,0,ironBlock)160blockSetter.setBlock(3,9,0,ironBlock)161blockSetter.setBlock(4,9,0,ironBlock)162blockSetter.setBlock(5,9,0,ironBlock)163blockSetter.setBlock(6,9,0,ironBlock)164blockSetter.setBlock(7,9,0,ironBlock)165blockSetter.setBlock(-3,10,0,ironBlock)166blockSetter.setBlock(-4,10,0,ironBlock)167blockSetter.setBlock(-5,10,0,ironBlock)168blockSetter.setBlock(-6,10,0,ironBlock)169blockSetter.setBlock(-7,10,0,ironBlock)170blockSetter.setBlock(3,10,0,ironBlock)171blockSetter.setBlock(4,10,0,ironBlock)172blockSetter.setBlock(5,10,0,ironBlock)173blockSetter.setBlock(6,10,0,ironBlock)174blockSetter.setBlock(7,10,0,ironBlock)175blockSetter.setBlock(-3,11,0,ironBlock)176blockSetter.setBlock(-4,11,0,ironBlock)177blockSetter.setBlock(-5,11,0,ironBlock)178blockSetter.setBlock(-6,11,0,ironBlock)179blockSetter.setBlock(-7,11,0,ironBlock)180blockSetter.setBlock(3,11,0,ironBlock)181blockSetter.setBlock(4,11,0,ironBlock)182blockSetter.setBlock(5,11,0,ironBlock)183blockSetter.setBlock(6,11,0,ironBlock)184blockSetter.setBlock(7,11,0,ironBlock)185blockSetter.setBlock(-3,12,0,ironBlock)186blockSetter.setBlock(-4,12,0,ironBlock)187blockSetter.setBlock(-5,12- железо188blockSetter.setBlock(-6,12,0,ironBlock)189blockSetter.setBlock(-7,12,0,ironBlock)190blockSetter.setBlock(3,12,0,ironBlock)191blockSetter.setBlock(4,12,0,ironBlock)192blockSetter.setBlock(5,12,0,ironBlock)193blockSetter.setBlock(6,12,0,ironBlock)194blockSetter.setBlock(7,12,0,ironBlock)195blockSetter.setBlock(-3,13,0,ironBlock)196blockSetter.setBlock(-4,13,0,ironBlock)197blockSetter.setBlock(-5,13,0,ironBlock)198blockSetter.setBlock(-6,13,0,ironBlock)199blockSetter.setBlock(-7,13,0,ironBlock)200blockSetter.setBlock(3,13,0,ironBlock)201blockSetter.setBlock(4,13,0,ironBlock)202blockSetter.setBlock(5,13,0,ironBlock)203blockSetter.setBlock(6,13,0,ironBlock)204blockSetter.setBlock(7,13,0,ironBlock)205blockSetter.setBlock(-3,14,0,ironBlock)206blockSetter.setBlock(-4,14,0,ironBlock)207blockSetter.setBlock(-5,14,0,ironBlock)208blockSetter.setBlock(-6,14,0,ironBlock)209blockSetter.setBlock(-7,14,0,ironBlock)210blockSetter.setBlock(3,14,0,ironBlock)211blockSetter.setBlock(4,14,0,ironBlock)212blockSetter.setBlock(5,14,0,ironBlock)213blockSetter.setBlock(6,14,0,ironBlock)214blockSetter.setBlock(7,14,0,ironBlock)215blockSetter.setBlock(-3,15,0,ironBlock)216blockSetter.setBlock(-4,15,0,ironBlock)217blockSetter.setBlock(-5,15,0,ironBlock)218blockSetter.setBlock(-6,15,0,ironBlock)219blockSetter.setBlock(-7,15,0,ironBlock)220blockSetter.setBlock(3,15,0,ironBlock)221blockSetter.setBlock(4,15,0,ironBlock)222blockSetter.setBlock(5,15,0,ironBlock)223blockSetter.setBlock(6,15,0,ironBlock)224blockSetter.setBlock(7,15,0,ironBlock)225blockSetter.setBlock(-5,13,0,ironBlock)226blockSetter.setBlock(-5,14,0,ironBlock)227blockSetter.setBlock(-5,15,0,ironBlock)228blockSetter.setBlock(-5,16,0,ironBlock)229blockSetter.setBlock(-5,17,0,ironBlock)230blockSetter.setBlock(-5,18,0,ironBlock)231blockSetter.setBlock(-5,19,0,ironBlock)232blockSetter.setBlock(-5,20,0,ironBlock)233blockSetter.setBlock(-5,21,0,ironBlock)234blockSetter.setBlock(-5,22,0,ironBlock)235blockSetter.setBlock(-5,23,0,ironBlock)236blockSetter.setBlock(-5,24,0,ironBlock)237blockSetter.setBlock(-5,25,0,ironBlock)238blockSetter.setBlock(-4,13,0,ironBlock)239blockSetter.setBlock(-4,14,0,ironBlock)240blockSetter.setBlock(-4,15,0,ironBlock)241blockSetter.setBlock(-4,16,0,ironBlock)242blockSetter.setBlock(-4,17,0,ironBlock)243blockSetter.setBlock(-4,18,0,ironBlock)244blockSetter.setBlock(-4,19,0,ironBlock)245blockSetter.setBlock(-4,20,0,ironBlock)246blockSetter.setBlock(-4,21,0,ironBlock)247blockSetter.setBlock(-4,22,0,ironBlock)248blockSetter.setBlock(-4,23,0,ironBlock)249blockSetter.setBlock(-4,24,0,ironBlock)250blockSetter.setBlock(-4,25,0,ironBlock)251blockSetter.setBlock(-3,13,0,ironBlock)252blockSetter.setBlock(-3,14,0,ironBlock)253blockSetter.setBlock(-3,15,0,ironBlock)254blockSetter.setBlock(-3,16,0,ironBlock)255blockSetter.setBlock(-3,17,0,ironBlock)256blockSetter.setBlock(-3,18,0,ironBlock)257blockSetter.setBlock(-3,19,0,ironBlock)258blockSetter.setBlock(-3,20,0,ironBlock)259blockSetter.setBlock(-3,21,0,ironBlock)260blockSetter.setBlock(-3,22,0,ironBlock)261blockSetter.setBlock(-3,23,0,ironBlock)262blockSetter.setBlock(-3,24,0,ironBlock)263blockSetter.setBlock(-3,25,0,ironBlock)264blockSetter.setBlock(-2,13,0,ironBlock)265blockSetter.setBlock(-2,14,0,ironBlock)266blockSetter.setBlock(-2,15,0,ironBlock)267blockSetter.setBlock(-2,16,0,ironBlock)268blockSetter.setBlock(-2,17,0,ironBlock)269blockSetter.setBlock(-2,18,0,ironBlock)270blockSetter.setBlock(-2,19,0,ironBlock)271blockSetter.setBlock(-2,20,0,ironBlock)272blockSetter.setBlock(-2,21,0,ironBlock)273blockSetter.setBlock(-2,22,0,ironBlock)274blockSetter.setBlock(-2,23,0,ironBlock)275blockSetter.setBlock(-2,24,0,ironBlock)276blockSetter.setBlock(-2,25,0,ironBlock)277blockSetter.setBlock(-1,13,0,ironBlock)278blockSetter.setBlock(-1,14,0,ironBlock)279blockSetter.setBlock(-1,15,0,ironBlock)280blockSetter.setBlock(-1,16,0,ironBlock)281blockSetter.setBlock(-1,17,0,ironBlock)282blockSetter.setBlock(-1,18,0,ironBlock)283blockSetter.setBlock(-1,19,0,ironBlock)284blockSetter.setBlock(-1,20,0,ironBlock)285blockSetter.setBlock(-1,21,0,ironBlock)286blockSetter.setBlock(-1,22,0,ironBlock)287blockSetter.setBlock(-1,23,0,ironBlock)288blockSetter.setBlock(-1,24,0,ironBlock)289blockSetter.setBlock(-1,25,0,ironBlock)290blockSetter.setBlock(0,13,0,ironBlock)291blockSetter.setBlock(0,14,0,ironBlock)292blockSetter.setBlock(0,15,0,ironBlock)293blockSetter.setBlock(0,16,0,ironBlock)294blockSetter.setBlock(0,17,0,ironBlock)295blockSetter.setBlock(0,18,0,ironBlock)296blockSetter.setBlock(0,19,0,ironBlock)297blockSetter.setBlock(0,20,0,ironBlock)298blockSetter.setBlock(0,21,0,ironBlock)299blockSetter.setBlock(0,22,0,ironBlock)300blockSetter.setBlock(0,23,0,ironBlock)301blockSetter.setBlock(0,24,0,ironBlock)302blockSetter.setBlock(0,25,0,ironBlock)303blockSetter.setBlock(1,13,0,ironBlock)304blockSetter.setBlock(1,14,0,ironBlock)305blockSetter.setBlock(1,15,0,ironBlock)306blockSetter.setBlock(1,16,0,ironBlock)307blockSetter.setBlock(1,17,0,ironBlock)308blockSetter.setBlock(1,18,0,ironBlock)309blockSetter.setBlock(1,19,0,ironBlock)310blockSetter.setBlock(1,20,0,ironBlock)311blockSetter.setBlock(1,21,0,ironBlock)312blockSetter.setBlock(1,22,0,ironBlock)313blockSetter.setBlock(1,23,0,ironBlock)314blockSetter.setBlock(1,24,0,ironBlock)315blockSetter.setBlock(1,25,0,ironBlock)316blockSetter.setBlock(2,13,0,ironBlock)317blockSetter.setBlock(2,14,0,ironBlock)318blockSetter.setBlock(2,15,0,ironBlock)319blockSetter.setBlock(2,16,0,ironBlock)320blockSetter.setBlock(2,17,0,ironBlock)321blockSetter.setBlock(2,18,0,ironBlock)322blockSetter.setBlock(2,19,0,ironBlock)323blockSetter.setBlock(2,20,0,ironBlock)324blockSetter.setBlock(2,21,0,ironBlock)325blockSetter.setBlock(2,22,0,ironBlock)326blockSetter.setBlock(2,23,0,ironBlock)327blockSetter.setBlock(2,24,0,ironBlock)328blockSetter.setBlock(2,25,0,ironBlock)329blockSetter.setBlock(3,13,0,ironBlock)330blockSetter.setBlock(3,14,0,ironBlock)331blockSetter.setBlock(3,15,0,ironBlock)332blockSetter.setBlock(3,16,0,ironBlock)333blockSetter.setBlock(3,17,0,ironBlock)334blockSetter.setBlock(3,18,0,ironBlock)335blockSetter.setBlock(3,19,0,ironBlock)336blockSetter.setBlock(3,20,0,ironBlock)337blockSetter.setBlock(3,21,0,ironBlock)338blockSetter.setBlock(3,22,0,ironBlock)339blockSetter.setBlock(3,23,0,ironBlock)340blockSetter.setBlock(3,24,0,ironBlock)341blockSetter.setBlock(3,25,0,ironBlock)342blockSetter.setBlock(4,13,0,ironBlock)343blockSetter.setBlock(4,14,0,ironBlock)344blockSetter.setBlock(4,15,0,ironBlock)345blockSetter.setBlock(4,16,0,ironBlock)346blockSetter.setBlock(4,17,0,ironBlock)347blockSetter.setBlock(4,18,0,ironBlock)348blockSetter.setBlock(4,19,0,ironBlock)349blockSetter.setBlock(4,20,0,ironBlock)350blockSetter.setBlock(4,21,0,ironBlock)351blockSetter.setBlock(4,22,0,ironBlock)352blockSetter.setBlock(4,23,0,ironBlock)353blockSetter.setBlock(4,24,0,ironBlock)354blockSetter.setBlock(4,25,0,ironBlock)355blockSetter.setBlock(5,13,0,ironBlock)356blockSetter.setBlock(5,14,0,ironBlock)357blockSetter.setBlock(5,15,0,ironBlock)358blockSetter.setBlock(5,16,0,ironBlock)359blockSetter.setBlock(5,17,0,ironBlock)360blockSetter.setBlock(5,18,0,ironBlock)361blockSetter.setBlock(5,19,0,ironBlock)362blockSetter.setBlock(5,20,0,ironBlock)363blockSetter.setBlock(5,21,0,ironBlock)364blockSetter.setBlock(5,22,0,ironBlock)365blockSetter.setBlock(5,23,0,ironBlock)366blockSetter.setBlock(5,24,0,ironBlock)367blockSetter.setBlock(5,25,0,ironBlock)368blockSetter.setBlock(-4,26,0,ironBlock)369blockSetter.setBlock(-3,26,0,ironBlock)370blockSetter.setBlock(-2,26,0,ironBlock)371blockSetter.setBlock(-1,26,0,ironBlock)372blockSetter.setBlock(0,26,0,ironBlock)373blockSetter.setBlock(1,26,0,ironBlock)374blockSetter.setBlock(2,26,0,ironBlock)375blockSetter.setBlock(3,26,0,ironBlock)376blockSetter.setBlock(4,26,0,ironBlock)377blockSetter.setBlock(-3,27,0,ironBlock)378blockSetter.setBlock(-2,27,0,ironBlock)379blockSetter.setBlock(-1,27,0,ironBlock)380blockSetter.setBlock(0,27,0,ironBlock)381blockSetter.setBlock(1,27,0,ironBlock)382blockSetter.setBlock(2,27,0,ironBlock)383blockSetter.setBlock(3,27,0,ironBlock)384blockSetter.setBlock(-2,28,0,ironBlock)385blockSetter.setBlock(-2,29,0,ironBlock)386blockSetter.setBlock(-1,28,0,ironBlock)387blockSetter.setBlock(-1,29,0,ironBlock)388blockSetter.setBlock(0,28,0,ironBlock)389blockSetter.setBlock(0,29,0,ironBlock)390blockSetter.setBlock(1,28,0,ironBlock)391blockSetter.setBlock(1,29,0,ironBlock)392blockSetter.setBlock(2,28,0,ironBlock)393blockSetter.setBlock(2,29,0,ironBlock)394blockSetter.setBlock(-1,30,0,ironBlock)395blockSetter.setBlock(-1,31,0,ironBlock)396blockSetter.setBlock(-1,32,0,ironBlock)397blockSetter.setBlock(-1,33,0,ironBlock)398blockSetter.setBlock(-1,34,0,ironBlock)399blockSetter.setBlock(0,30,0,ironBlock)400blockSetter.setBlock(0,31,0,ironBlock)401blockSetter.setBlock(0,32,0,ironBlock)402blockSetter.setBlock(0,33,0,ironBlock)403blockSetter.setBlock(0,34,0,ironBlock)404blockSetter.setBlock(1,30,0,ironBlock)405blockSetter.setBlock(1,31,0,ironBlock)406blockSetter.setBlock(1,32,0,ironBlock)407blockSetter.setBlock(1,33,0,ironBlock)408blockSetter.setBlock(1,34,0,ironBlock)409blockSetter.setBlock(0,35,0,ironBlock)410blockSetter.setBlock(0,36,0,ironBlock)411for i in range(100):412 time.sleep(1)413 rocketShape.moveBy(0,1,0)...

Full Screen

Full Screen

wallpaper.py

Source:wallpaper.py Github

copy

Full Screen

...145 def __str__(self):146 return 'Cannot set wallpaper for %s' % self.environment147148149def get_wallpaper_setter():150 environment = de.get_desktop_environment()151 152 if environment in wallpaper_setters:153 return wallpaper_setters[environment](environment)154 155 return WallpaperSetter(environment)156157158def set_wallpaper(filename):159 wallpaper_setter = get_wallpaper_setter()160 if wallpaper_setter is not None:161 try:162 wallpaper_setter.set_wallpaper(filename)163 print("Wallpaper set to: %s" % filename)164 except:165 raise166 #print("ERROROROROROROROROR")167 #return WallpaperSetterError(wallpaper_setter.environment)168 else:169 return WallpaperSetterError(wallpaper_setter.environment)170171if __name__ == '__main__':172 if len(sys.argv) > 1:173 set_wallpaper(sys.argv[1]) ...

Full Screen

Full Screen

allgettersetters.js

Source:allgettersetters.js Github

copy

Full Screen

1/*2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.4 *5 * This code is free software; you can redistribute it and/or modify it6 * under the terms of the GNU General Public License version 2 only, as7 * published by the Free Software Foundation.8 *9 * This code is distributed in the hope that it will be useful, but WITHOUT10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License12 * version 2 for more details (a copy is included in the LICENSE file that13 * accompanied this code).14 *15 * You should have received a copy of the GNU General Public License version16 * 2 along with this work; if not, write to the Free Software Foundation,17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.18 *19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA20 * or visit www.oracle.com if you need additional information or have any21 * questions.22 */23/**24 * Exercise all setters on standard objects.25 *26 * @test27 * @run28 */29function checkGetterSetter(obj, expectError) {30 while (obj != undefined && obj != null) {31 var properties = Object.getOwnPropertyNames(obj);32 for (var i in properties) {33 var prop = properties[i];34 try {35 if (!/\d.*/.test(prop)) {36 eval("obj." + prop + " = " + "obj." + prop + ";");37 }38 obj[prop] = obj[prop];39 } catch (e) {40 if (!expectError || !(e instanceof TypeError)) {41 fail(e + ": " + obj.toString() +"." + prop, e);42 }43 }44 }45 obj = Object.getPrototypeOf(obj);46 }47}48// objects49checkGetterSetter([2, 23]);50checkGetterSetter(new Boolean(true));51checkGetterSetter(new Date(0));52checkGetterSetter(new Error());53checkGetterSetter(new EvalError());54if (typeof JSAdapter != 'undefined') {55 checkGetterSetter(new JSAdapter({}));56}57if (typeof JavaImporter != 'undefined') {58 checkGetterSetter(new JavaImporter(java.io));59}60checkGetterSetter(function() {});61checkGetterSetter(new Number(42));62checkGetterSetter(new Object());63checkGetterSetter(new RangeError());64checkGetterSetter(new ReferenceError());65checkGetterSetter(/nashorn/);66checkGetterSetter(new String('hello'));67checkGetterSetter(new SyntaxError());68checkGetterSetter(new TypeError());69checkGetterSetter(new URIError());70// constructors and prototypes71checkGetterSetter(Array);72checkGetterSetter(Array.prototype);73checkGetterSetter(Boolean);74checkGetterSetter(Boolean.prototype);75checkGetterSetter(Error);76checkGetterSetter(Error.prototype);77checkGetterSetter(EvalError);78checkGetterSetter(EvalError.prototype);79checkGetterSetter(Function);80checkGetterSetter(Function.prototype);81if (typeof JSAdapter != 'undefined') {82 checkGetterSetter(JSAdapter);83 checkGetterSetter(JSAdapter.prototype);84}85if (typeof JavaImporter != 'undefined') {86 checkGetterSetter(JavaImporter);87 checkGetterSetter(JavaImporter.prototype);88}89checkGetterSetter(Number);90checkGetterSetter(Number.prototype);91checkGetterSetter(Object);92checkGetterSetter(Object.prototype);93checkGetterSetter(RangeError);94checkGetterSetter(RangeError.prototype);95checkGetterSetter(ReferenceError);96checkGetterSetter(ReferenceError.prototype);97checkGetterSetter(RegExp);98checkGetterSetter(RegExp.prototype);99checkGetterSetter(String);100checkGetterSetter(String.prototype);101checkGetterSetter(SyntaxError);102checkGetterSetter(SyntaxError.prototype);103checkGetterSetter(TypeError);104checkGetterSetter(TypeError.prototype);105checkGetterSetter(URIError);106checkGetterSetter(URIError.prototype);107// misc. objects108checkGetterSetter(this);109if (typeof Packages != 'undefined') {110 checkGetterSetter(Packages);111 checkGetterSetter(java);112 checkGetterSetter(javax);113}114if (typeof Java != 'undefined') {115 checkGetterSetter(Java);116 checkGetterSetter(Java.prototype);117}118if (typeof Debug != 'undefined') {119 checkGetterSetter(Debug);120}121checkGetterSetter((function() { return arguments; })());122// TypeError expected on certain property getter/setter for strict arguments123checkGetterSetter((function() { 'use strict'; return arguments; })(), true);124checkGetterSetter(JSON);125checkGetterSetter(JSON.prototype);126checkGetterSetter(Math);...

Full Screen

Full Screen

setter_types.py

Source:setter_types.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2from crossword_hints import application3from crossword_hints.models.crossword_hints import setter_types4from jur_ldap_login.models.users import users5from jur_ldap_login.controllers.login import load_user6from flask import request, flash, redirect, render_template7from flask_login import login_required, current_user8from peewee import *9from datetime import date, timedelta, datetime10from crossword_hints.views.crossword_hints import *11""" """12""" Setter types """13""" """14@application.route("/setter-types/", methods=["GET"], defaults={'page': 1})15@application.route('/setter-types/page/<int:page>')16def setter_types_index(page):17 count = setter_types.select(fn.COUNT(setter_types.rowid)).scalar()18 offset = ((int(page)-1) * application.config['PER_PAGE'])19 rs = setter_types.select().limit(application.config['PER_PAGE']).offset(offset).order_by(fn.Lower(setter_types.name))20 if not rs and page != 1:21 return(render_template('errors/409.html', errmsg="Requested page out of bounds"), 409 )22 return render_template('setter-types/index.html',23 stypes=rs.dicts(),24 pagination=Pagination(page, application.config['PER_PAGE'], count),25 r=request)26@application.route("/setter-types/<int:id>", methods=["GET"])27def setter_types_show(id):28 rs = setter_types.get(setter_types.rowid == id)29 return render_template('setter-types/show.html', stype=rs, r=request)30@application.route("/setter-types/new", methods=["GET", "POST"])31@login_required32def setter_types_new():33 if request.method == "GET":34 stype={'name': "New setter type", 'description': 'Brief description of this type of setter'}35 return(render_template('setter-types/new.html', stype=stype, r=request, sbmt='Save new setter type'))36 (rc, fdata) = sanitize_input(request.form)37 if not rc == "":38 flash(rc)39 return(render_template('setter-types/new.html', stype=fdata, r=request, sbmt=request.form['submit']))40 st = setter_types(name=fdata['name'], description=fdata['description'])41 st.save()42 log = ("name: %s\ndescription: %s" % (fdata['name'], fdata['description']))43 add_log(users.get_name(current_user), 'insert', 'setter_types', st.rowid, log)44 flash("Saved new setter type, %s" % fdata['name'])45 return redirect('/setter-types')46@application.route("/setter-types/<int:id>/edit", methods=["GET", "POST"])47@login_required48def setter_types_edit(id):49 if request.method == "GET":50 try:51 rs = setter_types.get(setter_types.rowid == id)52 except DoesNotExist:53 flash("Cannot find setter type record for id, %s." % id)54 return(redirect('/setter-types'))55 return(render_template('setter-types/edit.html', stype=rs, r=request, sbmt='Update setter type'))56 (rc, fdata) = sanitize_input(request.form)57 if not rc == "":58 flash(rc)59 return(render_template('setter-types/edit.html', stype=fdata, r=request, sbmt=request.form['submit']))60 st = setter_types(rowid=id, name=fdata['name'],61 description=fdata['description'],62 updated_at=datetime.now())63 st.save()64 log = ("name: %s\ndescription: %s" % (fdata['name'], fdata['description']))65 add_log(users.get_name(current_user), 'update]', 'setter_types', id, log)66 flash("Updated setter type, %s" % fdata['name'])67 return(redirect('/setter-types'))68@application.route("/setter-types/<int:id>/delete", methods=["GET"])69@login_required70def setter_types_delete(id):71 try:72 rs = setter_types.get(setter_types.rowid == id)73 except DoesNotExist:74 flash("Cannot find setter type record for id, %s." % id)75 return(redirect('/setter-types'))76 log = ("name: %s\ndescription: %s" % (rs.name, rs.description))77 rs.delete_instance()78 add_log(users.get_name(current_user), 'delete', 'setter_types', rs.rowid, log)79 flash("Deleted setter type, %s" % rs.name)...

Full Screen

Full Screen

config_loader.py

Source:config_loader.py Github

copy

Full Screen

1import configparser2import json3mandatory = {}4class DefaultSetter:5 def __init__(self, dictionary):6 self.dictionary = dictionary7 def __setitem__(self, key, value):8 if key not in self.dictionary:9 if value is mandatory:10 raise ValueError(f" Argument --> {key} was mandatory but is not there")11 else:12 self.dictionary[key] = value13 def __getitem__(self, key):14 if key not in self.dictionary:15 self.dictionary[key] = {}16 return DefaultSetter(self.dictionary[key])17def load_json_config(config_path):18 file = open(config_path) 19 config = json.load(file)20 default_setter = DefaultSetter(config)21 default_setter["name"] = mandatory22 default_setter["train"]["lr"] = mandatory23 default_setter["train"]["dataset"] = mandatory24 default_setter["train"]["num_steps"] = mandatory25 default_setter["train"]["batch_size"] = mandatory26 default_setter["train"]["image_size"] = mandatory27 default_setter["train"]["validation"] = mandatory28 default_setter["train"]["restore_ckpt"] = None29 #default_setter.__getitem__("train").__setitem__("iter", 12)30 default_setter["train"]["iters"] = 1231 default_setter["train"]["gamma"] = mandatory32 #default_setter.__setitem__("wdecay", 0.0005)33 #default_setter["wdecay"] = 0.000534 default_setter["train"]["wdecay"] = mandatory35 default_setter["mixed_precision"] = False36 default_setter["gpus"] = [0]37 default_setter["epsilon"] = 1e-838 default_setter["add_noise"] = False39 default_setter["clip"] = 1.040 default_setter["dropout"] = 0.041 default_setter["small"] = False42 default_setter["current_phase"] = 043 default_setter["current_steps"] = -144 default_setter["position_only"] = False45 default_setter["position_and_content"] = False46 default_setter["num_heads"] = 147 # parameters related to training schedule are not mandatory. Also no default values are needed.48 return config49def cpy_args_to_config(args):50 config = {}51 config["name"] = args.name52 config["epsilon"] = args.epsilon53 config["clip"] = args.clip54 config["dropout"] = args.dropout55 config["small"] = args.small56 config["gpus"] = args.gpus57 config["add_noise"] = args.add_noise58 config["mixed_precision"] = args.mixed_precision59 config["val_freq"] = args.val_freq60 config["print_freq"] = args.print_freq61 config["train"] = {}62 config["train"]["gamma"] = [args.gamma]63 config["train"]["wdecay"] = [args.wdecay]64 config["train"]["validation"] = [args.validation]65 config["train"]["num_steps"] = [args.num_steps]66 config["train"]["lr"] = [args.lr]67 config["train"]["image_size"] = [args.image_size]68 config["train"]["batch_size"] = [args.batch_size]69 config["train"]["dataset"] = [args.dataset]70 config["train"]["restore_ckpt"] = args.restore_ckpt71 config["train"]["iters"] = args.iters72 config["current_phase"] = args.current_phase73 config["current_steps"] = args.current_steps74 return config75def cpy_eval_args_to_config(args):76 config = {}77 config["model"] = args.model78 config["small"] = args.small79 config["dataset"] = args.dataset80 config["mixed_precision"] = args.mixed_precision81 config["alternate_corr"] = args.alternate_corr...

Full Screen

Full Screen

fn-name-accessor-set.js

Source:fn-name-accessor-set.js Github

copy

Full Screen

1// Copyright (C) Copyright 2015 the V8 project authors. All rights reserved.2// This code is governed by the BSD license found in the LICENSE file.3/*---4es6id: 14.3.95description: Assignment of function `name` attribute ("set" accessor)6info: >7 MethodDefinition :8 set PropertyName ( PropertySetParameterList ) { FunctionBody }9 [...]10 7. Perform SetFunctionName(closure, propKey, "set").11includes: [propertyHelper.js]12features: [Symbol]13---*/14var namedSym = Symbol('test262');15var anonSym = Symbol();16var setter;17class A {18 set id(_) {}19 set [anonSym](_) {}20 set [namedSym](_) {}21 static set id(_) {}22 static set [anonSym](_) {}23 static set [namedSym](_) {}24}25setter = Object.getOwnPropertyDescriptor(A.prototype, 'id').set;26assert.sameValue(setter.name, 'set id');27verifyNotEnumerable(setter, 'name');28verifyNotWritable(setter, 'name');29verifyConfigurable(setter, 'name');30setter = Object.getOwnPropertyDescriptor(A.prototype, anonSym).set;31assert.sameValue(setter.name, 'set ');32verifyNotEnumerable(setter, 'name');33verifyNotWritable(setter, 'name');34verifyConfigurable(setter, 'name');35setter = Object.getOwnPropertyDescriptor(A.prototype, namedSym).set;36assert.sameValue(setter.name, 'set [test262]');37verifyNotEnumerable(setter, 'name');38verifyNotWritable(setter, 'name');39verifyConfigurable(setter, 'name');40setter = Object.getOwnPropertyDescriptor(A, 'id').set;41assert.sameValue(setter.name, 'set id');42verifyNotEnumerable(setter, 'name');43verifyNotWritable(setter, 'name');44verifyConfigurable(setter, 'name');45setter = Object.getOwnPropertyDescriptor(A, anonSym).set;46assert.sameValue(setter.name, 'set ');47verifyNotEnumerable(setter, 'name');48verifyNotWritable(setter, 'name');49verifyConfigurable(setter, 'name');50setter = Object.getOwnPropertyDescriptor(A, namedSym).set;51assert.sameValue(setter.name, 'set [test262]');52verifyNotEnumerable(setter, 'name');53verifyNotWritable(setter, 'name');...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { setRoot } from 'storybook-root'2import { getRoot } from 'storybook-root'3export const parameters = {4 docs: {5 iframeUrl: `${getRoot()}/iframe.html?id=`,6 },7}

Full Screen

Using AI Code Generation

copy

Full Screen

1import { setRoot } from 'storybook-root';2const root = setRoot(document.getElementById('root'));3import { getRoot } from 'storybook-root';4const root = getRoot();5import { setRoot } from 'storybook-root';6const root = setRoot(document.getElementById('root'));7import { getRoot } from 'storybook-root';8const root = getRoot();9import { setRoot } from 'storybook-root';10const root = setRoot(document.getElementById('root'));11import { getRoot } from 'storybook-root';12const root = getRoot();13import { setRoot } from 'storybook-root';14const root = setRoot(document.getElementById('root'));15import { getRoot } from 'storybook-root';16const root = getRoot();17import { setRoot } from 'storybook-root';18const root = setRoot(document.getElementById('root'));19import { getRoot } from 'storybook-root';20const root = getRoot();21import { setRoot } from 'storybook-root';22const root = setRoot(document.getElementById('root'));23import { getRoot } from 'storybook-root';24const root = getRoot();25import { setRoot } from 'storybook-root';26const root = setRoot(document.getElementById('root'));27import { getRoot } from 'storybook-root';28const root = getRoot();

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withKnobs } from '@storybook/addon-knobs'2import { withRoot } from 'storybook-addon-root'3import { withTests } from '@storybook/addon-jest'4import { withA11y } from '@storybook/addon-a11y'5import { withInfo } from '@storybook/addon-info'6import { addDecorator } from '@storybook/react'7import { configure } from '@storybook/react'8import { addParameters } from '@storybook/react'9import { setOptions } from '@storybook/addon-options'10import { withThemesProvider } from 'storybook-addon-styled-component-theme'11import { setDefaults } from 'storybook-addon-jsx'12import { withOptions } from '@storybook/addon-options'13import { addReadme } from 'storybook-readme'14import { withConsole } from '@storybook/addon-console'15import { withPropsTable } from 'storybook-addon-react-docgen'16import { withViewport } from '@storybook/addon-viewport'17import { withBackgrounds } from '@storybook/addon-backgrounds'18import { withPerformance } from 'storybook-addon-performance'19import { withLinks } from '@storybook/addon-links'20import { withScreenshot } from 'storycap'21import { withContexts } from '@storybook/addon-contexts/react'22import { withGraphQL } from 'storybook-addon-graphql'23import { withCsf } from 'storybook-addon-csf'24import { withCssResources } from '@storybook/addon-cssresources'25import { withActions } from '@storybook/addon-actions'26import { withContexts } from '@storybook/addon-contexts/react'27import { withViewport } from '@storybook/addon-viewport'28import { withTests } from '@storybook/addon-jest'29import { withBackgrounds } from '@storybook/addon-backgrounds'30import { withInfo } from '@storybook/addon-info'31import { withA11y } from '@storybook/addon-a11y'32import { withKnobs } from '@storybook/addon-knobs'33import { withRoot } from 'storybook-addon-root'34import { withPerformance } from 'storybook-addon-performance'35import { withScreenshot } from 'storycap'36import { withGraphQL } from 'storybook-addon-graphql'37import { withCsf } from 'storybook-addon-csf'38import { withCssResources } from '@storybook/addon-cssresources'39import { withActions } from '@storybook/addon-actions'40import { withConsole } from '@

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRoot = require('storybook-root');2storybookRoot.setRootPath('path/to/storybook-root');3const storybookRoot = require('storybook-root');4storybookRoot.getRootPath();5const storybookRoot = require('storybook-root');6storybookRoot.setRootPath('path/to/storybook-root');7const storybookRoot = require('storybook-root');8storybookRoot.getRootPath();9const storybookRoot = require('storybook-root');10storybookRoot.setRootPath('path/to/storybook-root');11const storybookRoot = require('storybook-root');12storybookRoot.getRootPath();13const storybookRoot = require('storybook-root');14storybookRoot.setRootPath('path/to/storybook-root');15const storybookRoot = require('storybook-root');16storybookRoot.getRootPath();17const storybookRoot = require('storybook-root');18storybookRoot.setRootPath('path/to/storybook-root');19const storybookRoot = require('storybook-root');20storybookRoot.getRootPath();21const storybookRoot = require('storybook-root');22storybookRoot.setRootPath('path/to/storybook-root');23const storybookRoot = require('storybook-root');24storybookRoot.getRootPath();25const storybookRoot = require('storybook-root');26storybookRoot.setRootPath('path/to/storybook-root');27const storybookRoot = require('storybook-root');28storybookRoot.getRootPath();29const storybookRoot = require('storybook-root');30storybookRoot.setRootPath('path/to/storybook-root');31const storybookRoot = require('storybook-root');32storybookRoot.getRootPath();33const storybookRoot = require('storybook-root');34storybookRoot.setRootPath('path/to/storybook-root');35const storybookRoot = require('storybook-root');36storybookRoot.getRootPath();37const storybookRoot = require('storybook-root');38storybookRoot.setRootPath('path/to/storybook-root');39const storybookRoot = require('storybook-root');40storybookRoot.getRootPath();

Full Screen

Using AI Code Generation

copy

Full Screen

1import { setStorybookRoot } from 'storybook-root';2setStorybookRoot('storybook');3import { getStorybookRoot } from 'storybook-root';4getStorybookRoot();5import { getStorybookRoot } from 'storybook-root';6import { configure } from '@storybook/react';7const req = require.context(getStorybookRoot(), true, /\.stories\.js$/);8function loadStories() {9 req.keys().forEach(filename => req(filename));10}11configure(loadStories, module);12import { getStorybookRoot } from 'storybook-root';13import { configure } from '@storybook/react';14const req = require.context(getStorybookRoot(), true, /\.stories\.js$/);15function loadStories() {16 req.keys().forEach(filename => req(filename));17}18configure(loadStories, module);19import React from 'react';20import { storiesOf } from '@storybook/react';21import { linkTo } from '@storybook/addon-links';22import { Welcome } from '@storybook/react/demo';23storiesOf('Welcome', module).add('to Storybook', () => <Welcome showApp={linkTo('Button')} />);24import React from 'react';25import { storiesOf } from '@storybook/react';26import { action } from '@storybook/addon-actions';27import { Button } from '@storybook/react/demo';28storiesOf('Button', module)29 .add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>)30 .add('with some emoji', () => (31 <Button onClick={action('clicked')}>32 ));33import React from 'react';34import { storiesOf } from '@storybook/react';35import { action } from '@storybook/addon-actions';36import { Button } from '@storybook/react/demo';37storiesOf('Button', module)38 .add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>)39 .add('with some emoji', () => (40 <Button onClick={action('clicked')}>

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful