Best JavaScript code snippet using devicefarmer-stf
file_io_test.py
Source:file_io_test.py
1# This Python file uses the following encoding: utf-82# Copyright 2015 The TensorFlow Authors. All Rights Reserved.3#4# Licensed under the Apache License, Version 2.0 (the "License");5# you may not use this file except in compliance with the License.6# You may obtain a copy of the License at7#8# http://www.apache.org/licenses/LICENSE-2.09#10# Unless required by applicable law or agreed to in writing, software11# distributed under the License is distributed on an "AS IS" BASIS,12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.13# See the License for the specific language governing permissions and14# limitations under the License.15# =============================================================================16"""Testing File IO operations in file_io.py."""17from __future__ import absolute_import18from __future__ import division19from __future__ import print_function20import os.path21import numpy as np22from tensorflow.python.framework import errors23from tensorflow.python.lib.io import file_io24from tensorflow.python.platform import gfile25from tensorflow.python.platform import test26class FileIoTest(test.TestCase):27 def setUp(self):28 self._base_dir = os.path.join(self.get_temp_dir(), "base_dir")29 file_io.create_dir(self._base_dir)30 def tearDown(self):31 file_io.delete_recursively(self._base_dir)32 def testEmptyFilename(self):33 f = file_io.FileIO("", mode="r")34 with self.assertRaises(errors.NotFoundError):35 _ = f.read()36 def testFileDoesntExist(self):37 file_path = os.path.join(self._base_dir, "temp_file")38 self.assertFalse(file_io.file_exists(file_path))39 with self.assertRaises(errors.NotFoundError):40 _ = file_io.read_file_to_string(file_path)41 def testWriteToString(self):42 file_path = os.path.join(self._base_dir, "temp_file")43 file_io.write_string_to_file(file_path, "testing")44 self.assertTrue(file_io.file_exists(file_path))45 file_contents = file_io.read_file_to_string(file_path)46 self.assertEqual("testing", file_contents)47 def testAtomicWriteStringToFile(self):48 file_path = os.path.join(self._base_dir, "temp_file")49 file_io.atomic_write_string_to_file(file_path, "testing")50 self.assertTrue(file_io.file_exists(file_path))51 file_contents = file_io.read_file_to_string(file_path)52 self.assertEqual("testing", file_contents)53 def testAtomicWriteStringToFileOverwriteFalse(self):54 file_path = os.path.join(self._base_dir, "temp_file")55 file_io.atomic_write_string_to_file(file_path, "old", overwrite=False)56 with self.assertRaises(errors.AlreadyExistsError):57 file_io.atomic_write_string_to_file(file_path, "new", overwrite=False)58 file_contents = file_io.read_file_to_string(file_path)59 self.assertEqual("old", file_contents)60 file_io.delete_file(file_path)61 file_io.atomic_write_string_to_file(file_path, "new", overwrite=False)62 file_contents = file_io.read_file_to_string(file_path)63 self.assertEqual("new", file_contents)64 def testReadBinaryMode(self):65 file_path = os.path.join(self._base_dir, "temp_file")66 file_io.write_string_to_file(file_path, "testing")67 with file_io.FileIO(file_path, mode="rb") as f:68 self.assertEqual(b"testing", f.read())69 def testWriteBinaryMode(self):70 file_path = os.path.join(self._base_dir, "temp_file")71 file_io.FileIO(file_path, "wb").write("testing")72 with file_io.FileIO(file_path, mode="r") as f:73 self.assertEqual("testing", f.read())74 def testAppend(self):75 file_path = os.path.join(self._base_dir, "temp_file")76 with file_io.FileIO(file_path, mode="w") as f:77 f.write("begin\n")78 with file_io.FileIO(file_path, mode="a") as f:79 f.write("a1\n")80 with file_io.FileIO(file_path, mode="a") as f:81 f.write("a2\n")82 with file_io.FileIO(file_path, mode="r") as f:83 file_contents = f.read()84 self.assertEqual("begin\na1\na2\n", file_contents)85 def testMultipleFiles(self):86 file_prefix = os.path.join(self._base_dir, "temp_file")87 for i in range(5000):88 f = file_io.FileIO(file_prefix + str(i), mode="w+")89 f.write("testing")90 f.flush()91 self.assertEqual("testing", f.read())92 f.close()93 def testMultipleWrites(self):94 file_path = os.path.join(self._base_dir, "temp_file")95 with file_io.FileIO(file_path, mode="w") as f:96 f.write("line1\n")97 f.write("line2")98 file_contents = file_io.read_file_to_string(file_path)99 self.assertEqual("line1\nline2", file_contents)100 def testFileWriteBadMode(self):101 file_path = os.path.join(self._base_dir, "temp_file")102 with self.assertRaises(errors.PermissionDeniedError):103 file_io.FileIO(file_path, mode="r").write("testing")104 def testFileReadBadMode(self):105 file_path = os.path.join(self._base_dir, "temp_file")106 file_io.FileIO(file_path, mode="w").write("testing")107 self.assertTrue(file_io.file_exists(file_path))108 with self.assertRaises(errors.PermissionDeniedError):109 file_io.FileIO(file_path, mode="w").read()110 def testFileDelete(self):111 file_path = os.path.join(self._base_dir, "temp_file")112 file_io.FileIO(file_path, mode="w").write("testing")113 file_io.delete_file(file_path)114 self.assertFalse(file_io.file_exists(file_path))115 def testFileDeleteFail(self):116 file_path = os.path.join(self._base_dir, "temp_file")117 with self.assertRaises(errors.NotFoundError):118 file_io.delete_file(file_path)119 def testGetMatchingFiles(self):120 dir_path = os.path.join(self._base_dir, "temp_dir")121 file_io.create_dir(dir_path)122 files = ["file1.txt", "file2.txt", "file3.txt", "file*.txt"]123 for name in files:124 file_path = os.path.join(dir_path, name)125 file_io.FileIO(file_path, mode="w").write("testing")126 expected_match = [os.path.join(dir_path, name) for name in files]127 self.assertItemsEqual(128 file_io.get_matching_files(os.path.join(dir_path, "file*.txt")),129 expected_match)130 self.assertItemsEqual(file_io.get_matching_files(tuple()), [])131 files_subset = [132 os.path.join(dir_path, files[0]), os.path.join(dir_path, files[2])133 ]134 self.assertItemsEqual(135 file_io.get_matching_files(files_subset), files_subset)136 file_io.delete_recursively(dir_path)137 self.assertFalse(file_io.file_exists(os.path.join(dir_path, "file3.txt")))138 def testCreateRecursiveDir(self):139 dir_path = os.path.join(self._base_dir, "temp_dir/temp_dir1/temp_dir2")140 file_io.recursive_create_dir(dir_path)141 file_io.recursive_create_dir(dir_path) # repeat creation142 file_path = os.path.join(dir_path, "temp_file")143 file_io.FileIO(file_path, mode="w").write("testing")144 self.assertTrue(file_io.file_exists(file_path))145 file_io.delete_recursively(os.path.join(self._base_dir, "temp_dir"))146 self.assertFalse(file_io.file_exists(file_path))147 def testCopy(self):148 file_path = os.path.join(self._base_dir, "temp_file")149 file_io.FileIO(file_path, mode="w").write("testing")150 copy_path = os.path.join(self._base_dir, "copy_file")151 file_io.copy(file_path, copy_path)152 self.assertTrue(file_io.file_exists(copy_path))153 f = file_io.FileIO(file_path, mode="r")154 self.assertEqual("testing", f.read())155 self.assertEqual(7, f.tell())156 def testCopyOverwrite(self):157 file_path = os.path.join(self._base_dir, "temp_file")158 file_io.FileIO(file_path, mode="w").write("testing")159 copy_path = os.path.join(self._base_dir, "copy_file")160 file_io.FileIO(copy_path, mode="w").write("copy")161 file_io.copy(file_path, copy_path, overwrite=True)162 self.assertTrue(file_io.file_exists(copy_path))163 self.assertEqual("testing", file_io.FileIO(file_path, mode="r").read())164 def testCopyOverwriteFalse(self):165 file_path = os.path.join(self._base_dir, "temp_file")166 file_io.FileIO(file_path, mode="w").write("testing")167 copy_path = os.path.join(self._base_dir, "copy_file")168 file_io.FileIO(copy_path, mode="w").write("copy")169 with self.assertRaises(errors.AlreadyExistsError):170 file_io.copy(file_path, copy_path, overwrite=False)171 def testRename(self):172 file_path = os.path.join(self._base_dir, "temp_file")173 file_io.FileIO(file_path, mode="w").write("testing")174 rename_path = os.path.join(self._base_dir, "rename_file")175 file_io.rename(file_path, rename_path)176 self.assertTrue(file_io.file_exists(rename_path))177 self.assertFalse(file_io.file_exists(file_path))178 def testRenameOverwrite(self):179 file_path = os.path.join(self._base_dir, "temp_file")180 file_io.FileIO(file_path, mode="w").write("testing")181 rename_path = os.path.join(self._base_dir, "rename_file")182 file_io.FileIO(rename_path, mode="w").write("rename")183 file_io.rename(file_path, rename_path, overwrite=True)184 self.assertTrue(file_io.file_exists(rename_path))185 self.assertFalse(file_io.file_exists(file_path))186 def testRenameOverwriteFalse(self):187 file_path = os.path.join(self._base_dir, "temp_file")188 file_io.FileIO(file_path, mode="w").write("testing")189 rename_path = os.path.join(self._base_dir, "rename_file")190 file_io.FileIO(rename_path, mode="w").write("rename")191 with self.assertRaises(errors.AlreadyExistsError):192 file_io.rename(file_path, rename_path, overwrite=False)193 self.assertTrue(file_io.file_exists(rename_path))194 self.assertTrue(file_io.file_exists(file_path))195 def testDeleteRecursivelyFail(self):196 fake_dir_path = os.path.join(self._base_dir, "temp_dir")197 with self.assertRaises(errors.NotFoundError):198 file_io.delete_recursively(fake_dir_path)199 def testIsDirectory(self):200 dir_path = os.path.join(self._base_dir, "test_dir")201 # Failure for a non-existing dir.202 self.assertFalse(file_io.is_directory(dir_path))203 file_io.create_dir(dir_path)204 self.assertTrue(file_io.is_directory(dir_path))205 file_path = os.path.join(dir_path, "test_file")206 file_io.FileIO(file_path, mode="w").write("test")207 # False for a file.208 self.assertFalse(file_io.is_directory(file_path))209 # Test that the value returned from `stat()` has `is_directory` set.210 file_statistics = file_io.stat(dir_path)211 self.assertTrue(file_statistics.is_directory)212 def testListDirectory(self):213 dir_path = os.path.join(self._base_dir, "test_dir")214 file_io.create_dir(dir_path)215 files = ["file1.txt", "file2.txt", "file3.txt"]216 for name in files:217 file_path = os.path.join(dir_path, name)218 file_io.FileIO(file_path, mode="w").write("testing")219 subdir_path = os.path.join(dir_path, "sub_dir")220 file_io.create_dir(subdir_path)221 subdir_file_path = os.path.join(subdir_path, "file4.txt")222 file_io.FileIO(subdir_file_path, mode="w").write("testing")223 dir_list = file_io.list_directory(dir_path)224 self.assertItemsEqual(files + ["sub_dir"], dir_list)225 def testListDirectoryFailure(self):226 dir_path = os.path.join(self._base_dir, "test_dir")227 with self.assertRaises(errors.NotFoundError):228 file_io.list_directory(dir_path)229 def _setupWalkDirectories(self, dir_path):230 # Creating a file structure as follows231 # test_dir -> file: file1.txt; dirs: subdir1_1, subdir1_2, subdir1_3232 # subdir1_1 -> file: file3.txt233 # subdir1_2 -> dir: subdir2234 file_io.create_dir(dir_path)235 file_io.FileIO(236 os.path.join(dir_path, "file1.txt"), mode="w").write("testing")237 sub_dirs1 = ["subdir1_1", "subdir1_2", "subdir1_3"]238 for name in sub_dirs1:239 file_io.create_dir(os.path.join(dir_path, name))240 file_io.FileIO(241 os.path.join(dir_path, "subdir1_1/file2.txt"),242 mode="w").write("testing")243 file_io.create_dir(os.path.join(dir_path, "subdir1_2/subdir2"))244 def testWalkInOrder(self):245 dir_path = os.path.join(self._base_dir, "test_dir")246 self._setupWalkDirectories(dir_path)247 # Now test the walk (in_order = True)248 all_dirs = []249 all_subdirs = []250 all_files = []251 for (w_dir, w_subdirs, w_files) in file_io.walk(dir_path, in_order=True):252 all_dirs.append(w_dir)253 all_subdirs.append(w_subdirs)254 all_files.append(w_files)255 self.assertItemsEqual(all_dirs, [dir_path] + [256 os.path.join(dir_path, item)257 for item in258 ["subdir1_1", "subdir1_2", "subdir1_2/subdir2", "subdir1_3"]259 ])260 self.assertEqual(dir_path, all_dirs[0])261 self.assertLess(262 all_dirs.index(os.path.join(dir_path, "subdir1_2")),263 all_dirs.index(os.path.join(dir_path, "subdir1_2/subdir2")))264 self.assertItemsEqual(all_subdirs[1:5], [[], ["subdir2"], [], []])265 self.assertItemsEqual(all_subdirs[0],266 ["subdir1_1", "subdir1_2", "subdir1_3"])267 self.assertItemsEqual(all_files, [["file1.txt"], ["file2.txt"], [], [], []])268 self.assertLess(269 all_files.index(["file1.txt"]), all_files.index(["file2.txt"]))270 def testWalkPostOrder(self):271 dir_path = os.path.join(self._base_dir, "test_dir")272 self._setupWalkDirectories(dir_path)273 # Now test the walk (in_order = False)274 all_dirs = []275 all_subdirs = []276 all_files = []277 for (w_dir, w_subdirs, w_files) in file_io.walk(dir_path, in_order=False):278 all_dirs.append(w_dir)279 all_subdirs.append(w_subdirs)280 all_files.append(w_files)281 self.assertItemsEqual(all_dirs, [282 os.path.join(dir_path, item)283 for item in284 ["subdir1_1", "subdir1_2/subdir2", "subdir1_2", "subdir1_3"]285 ] + [dir_path])286 self.assertEqual(dir_path, all_dirs[4])287 self.assertLess(288 all_dirs.index(os.path.join(dir_path, "subdir1_2/subdir2")),289 all_dirs.index(os.path.join(dir_path, "subdir1_2")))290 self.assertItemsEqual(all_subdirs[0:4], [[], [], ["subdir2"], []])291 self.assertItemsEqual(all_subdirs[4],292 ["subdir1_1", "subdir1_2", "subdir1_3"])293 self.assertItemsEqual(all_files, [["file2.txt"], [], [], [], ["file1.txt"]])294 self.assertLess(295 all_files.index(["file2.txt"]), all_files.index(["file1.txt"]))296 def testWalkFailure(self):297 dir_path = os.path.join(self._base_dir, "test_dir")298 # Try walking a directory that wasn't created.299 all_dirs = []300 all_subdirs = []301 all_files = []302 for (w_dir, w_subdirs, w_files) in file_io.walk(dir_path, in_order=False):303 all_dirs.append(w_dir)304 all_subdirs.append(w_subdirs)305 all_files.append(w_files)306 self.assertItemsEqual(all_dirs, [])307 self.assertItemsEqual(all_subdirs, [])308 self.assertItemsEqual(all_files, [])309 def testStat(self):310 file_path = os.path.join(self._base_dir, "temp_file")311 file_io.FileIO(file_path, mode="w").write("testing")312 file_statistics = file_io.stat(file_path)313 os_statistics = os.stat(file_path)314 self.assertEqual(7, file_statistics.length)315 self.assertEqual(316 int(os_statistics.st_mtime), int(file_statistics.mtime_nsec / 1e9))317 self.assertFalse(file_statistics.is_directory)318 def testReadLine(self):319 file_path = os.path.join(self._base_dir, "temp_file")320 with file_io.FileIO(file_path, mode="r+") as f:321 f.write("testing1\ntesting2\ntesting3\n\ntesting5")322 self.assertEqual(36, f.size())323 self.assertEqual("testing1\n", f.readline())324 self.assertEqual("testing2\n", f.readline())325 self.assertEqual("testing3\n", f.readline())326 self.assertEqual("\n", f.readline())327 self.assertEqual("testing5", f.readline())328 self.assertEqual("", f.readline())329 def testRead(self):330 file_path = os.path.join(self._base_dir, "temp_file")331 with file_io.FileIO(file_path, mode="r+") as f:332 f.write("testing1\ntesting2\ntesting3\n\ntesting5")333 self.assertEqual(36, f.size())334 self.assertEqual("testing1\n", f.read(9))335 self.assertEqual("testing2\n", f.read(9))336 self.assertEqual("t", f.read(1))337 self.assertEqual("esting3\n\ntesting5", f.read())338 def testTell(self):339 file_path = os.path.join(self._base_dir, "temp_file")340 with file_io.FileIO(file_path, mode="r+") as f:341 f.write("testing1\ntesting2\ntesting3\n\ntesting5")342 self.assertEqual(0, f.tell())343 self.assertEqual("testing1\n", f.readline())344 self.assertEqual(9, f.tell())345 self.assertEqual("testing2\n", f.readline())346 self.assertEqual(18, f.tell())347 self.assertEqual("testing3\n", f.readline())348 self.assertEqual(27, f.tell())349 self.assertEqual("\n", f.readline())350 self.assertEqual(28, f.tell())351 self.assertEqual("testing5", f.readline())352 self.assertEqual(36, f.tell())353 self.assertEqual("", f.readline())354 self.assertEqual(36, f.tell())355 def testSeek(self):356 file_path = os.path.join(self._base_dir, "temp_file")357 with file_io.FileIO(file_path, mode="r+") as f:358 f.write("testing1\ntesting2\ntesting3\n\ntesting5")359 self.assertEqual("testing1\n", f.readline())360 self.assertEqual(9, f.tell())361 # Seek to 18362 f.seek(18)363 self.assertEqual(18, f.tell())364 self.assertEqual("testing3\n", f.readline())365 # Seek back to 9366 f.seek(9)367 self.assertEqual(9, f.tell())368 self.assertEqual("testing2\n", f.readline())369 f.seek(0)370 self.assertEqual(0, f.tell())371 self.assertEqual("testing1\n", f.readline())372 with self.assertRaises(errors.InvalidArgumentError):373 f.seek(-1)374 with self.assertRaises(TypeError):375 f.seek()376 # TODO(jhseu): Delete after position deprecation.377 with self.assertRaises(TypeError):378 f.seek(offset=0, position=0)379 f.seek(position=9)380 self.assertEqual(9, f.tell())381 self.assertEqual("testing2\n", f.readline())382 def testSeekFromWhat(self):383 file_path = os.path.join(self._base_dir, "temp_file")384 with file_io.FileIO(file_path, mode="r+") as f:385 f.write("testing1\ntesting2\ntesting3\n\ntesting5")386 self.assertEqual("testing1\n", f.readline())387 self.assertEqual(9, f.tell())388 # Seek to 18389 f.seek(9, 1)390 self.assertEqual(18, f.tell())391 self.assertEqual("testing3\n", f.readline())392 # Seek back to 9393 f.seek(9, 0)394 self.assertEqual(9, f.tell())395 self.assertEqual("testing2\n", f.readline())396 f.seek(-f.size(), 2)397 self.assertEqual(0, f.tell())398 self.assertEqual("testing1\n", f.readline())399 with self.assertRaises(errors.InvalidArgumentError):400 f.seek(0, 3)401 def testReadingIterator(self):402 file_path = os.path.join(self._base_dir, "temp_file")403 data = ["testing1\n", "testing2\n", "testing3\n", "\n", "testing5"]404 with file_io.FileIO(file_path, mode="r+") as f:405 f.write("".join(data))406 actual_data = []407 for line in f:408 actual_data.append(line)409 self.assertSequenceEqual(actual_data, data)410 def testReadlines(self):411 file_path = os.path.join(self._base_dir, "temp_file")412 data = ["testing1\n", "testing2\n", "testing3\n", "\n", "testing5"]413 f = file_io.FileIO(file_path, mode="r+")414 f.write("".join(data))415 f.flush()416 lines = f.readlines()417 self.assertSequenceEqual(lines, data)418 def testUTF8StringPath(self):419 file_path = os.path.join(self._base_dir, "UTF8æµè¯_file")420 file_io.write_string_to_file(file_path, "testing")421 with file_io.FileIO(file_path, mode="rb") as f:422 self.assertEqual(b"testing", f.read())423 def testEof(self):424 """Test that reading past EOF does not raise an exception."""425 file_path = os.path.join(self._base_dir, "temp_file")426 f = file_io.FileIO(file_path, mode="r+")427 content = "testing"428 f.write(content)429 f.flush()430 self.assertEqual(content, f.read(len(content) + 1))431 def testUTF8StringPathExists(self):432 file_path = os.path.join(self._base_dir, "UTF8æµè¯_file_exist")433 file_io.write_string_to_file(file_path, "testing")434 v = file_io.file_exists(file_path)435 self.assertEqual(v, True)436 def testFilecmp(self):437 file1 = os.path.join(self._base_dir, "file1")438 file_io.write_string_to_file(file1, "This is a sentence\n" * 100)439 file2 = os.path.join(self._base_dir, "file2")440 file_io.write_string_to_file(file2, "This is another sentence\n" * 100)441 file3 = os.path.join(self._base_dir, "file3")442 file_io.write_string_to_file(file3, u"This is another sentence\n" * 100)443 self.assertFalse(file_io.filecmp(file1, file2))444 self.assertTrue(file_io.filecmp(file2, file3))445 def testFilecmpSameSize(self):446 file1 = os.path.join(self._base_dir, "file1")447 file_io.write_string_to_file(file1, "This is a sentence\n" * 100)448 file2 = os.path.join(self._base_dir, "file2")449 file_io.write_string_to_file(file2, "This is b sentence\n" * 100)450 file3 = os.path.join(self._base_dir, "file3")451 file_io.write_string_to_file(file3, u"This is b sentence\n" * 100)452 self.assertFalse(file_io.filecmp(file1, file2))453 self.assertTrue(file_io.filecmp(file2, file3))454 def testFilecmpBinary(self):455 file1 = os.path.join(self._base_dir, "file1")456 file_io.FileIO(file1, "wb").write("testing\n\na")457 file2 = os.path.join(self._base_dir, "file2")458 file_io.FileIO(file2, "wb").write("testing\n\nb")459 file3 = os.path.join(self._base_dir, "file3")460 file_io.FileIO(file3, "wb").write("testing\n\nb")461 file4 = os.path.join(self._base_dir, "file4")462 file_io.FileIO(file4, "wb").write("testing\n\ntesting")463 self.assertFalse(file_io.filecmp(file1, file2))464 self.assertFalse(file_io.filecmp(file1, file4))465 self.assertTrue(file_io.filecmp(file2, file3))466 def testFileCrc32(self):467 file1 = os.path.join(self._base_dir, "file1")468 file_io.write_string_to_file(file1, "This is a sentence\n" * 100)469 crc1 = file_io.file_crc32(file1)470 file2 = os.path.join(self._base_dir, "file2")471 file_io.write_string_to_file(file2, "This is another sentence\n" * 100)472 crc2 = file_io.file_crc32(file2)473 file3 = os.path.join(self._base_dir, "file3")474 file_io.write_string_to_file(file3, "This is another sentence\n" * 100)475 crc3 = file_io.file_crc32(file3)476 self.assertTrue(crc1 != crc2)477 self.assertEqual(crc2, crc3)478 def testFileCrc32WithBytes(self):479 file1 = os.path.join(self._base_dir, "file1")480 file_io.write_string_to_file(file1, "This is a sentence\n" * 100)481 crc1 = file_io.file_crc32(file1, block_size=24)482 file2 = os.path.join(self._base_dir, "file2")483 file_io.write_string_to_file(file2, "This is another sentence\n" * 100)484 crc2 = file_io.file_crc32(file2, block_size=24)485 file3 = os.path.join(self._base_dir, "file3")486 file_io.write_string_to_file(file3, "This is another sentence\n" * 100)487 crc3 = file_io.file_crc32(file3, block_size=-1)488 self.assertTrue(crc1 != crc2)489 self.assertEqual(crc2, crc3)490 def testFileCrc32Binary(self):491 file1 = os.path.join(self._base_dir, "file1")492 file_io.FileIO(file1, "wb").write("testing\n\n")493 crc1 = file_io.file_crc32(file1)494 file2 = os.path.join(self._base_dir, "file2")495 file_io.FileIO(file2, "wb").write("testing\n\n\n")496 crc2 = file_io.file_crc32(file2)497 file3 = os.path.join(self._base_dir, "file3")498 file_io.FileIO(file3, "wb").write("testing\n\n\n")499 crc3 = file_io.file_crc32(file3)500 self.assertTrue(crc1 != crc2)501 self.assertEqual(crc2, crc3)502 def testMatchingFilesPermission(self):503 # Create top level directory test_dir.504 dir_path = os.path.join(self._base_dir, "test_dir")505 file_io.create_dir(dir_path)506 # Create second level directories `noread` and `any`.507 noread_path = os.path.join(dir_path, "noread")508 file_io.create_dir(noread_path)509 any_path = os.path.join(dir_path, "any")510 file_io.create_dir(any_path)511 files = ["file1.txt", "file2.txt", "file3.txt"]512 for name in files:513 file_path = os.path.join(any_path, name)514 file_io.FileIO(file_path, mode="w").write("testing")515 file_path = os.path.join(noread_path, "file4.txt")516 file_io.FileIO(file_path, mode="w").write("testing")517 # Change noread to noread access.518 os.chmod(noread_path, 0)519 expected_match = [os.path.join(any_path, name) for name in files]520 self.assertItemsEqual(521 file_io.get_matching_files(os.path.join(dir_path, "*", "file*.txt")),522 expected_match)523 # Change noread back so that it could be cleaned during tearDown.524 os.chmod(noread_path, 0o777)525 def testFileSeekableWithZip(self):526 # Note: Test case for GitHub issue 27276, issue only exposed in python 3.7+.527 filename = os.path.join(self._base_dir, "a.npz")528 np.savez_compressed(filename, {"a": 1, "b": 2})529 with gfile.GFile(filename, "rb") as f:530 info = np.load(f, allow_pickle=True)531 _ = [i for i in info.items()]532 def testHasAtomicMove(self):533 self.assertTrue(file_io.has_atomic_move("/a/b/c"))534if __name__ == "__main__":...
PFB.js
Source:PFB.js
1// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild23(function (root, factory) {4 if (typeof define === 'function' && define.amd) {5 define(['kaitai-struct/KaitaiStream'], factory);6 } else if (typeof module === 'object' && module.exports) {7 module.exports = factory(require('kaitai-struct/KaitaiStream'));8 } else {9 root.Pfb = factory(root.KaitaiStream);10 }11}(typeof self !== 'undefined' ? self : this, function (KaitaiStream) {12var Pfb = (function() {13 function Pfb(_io, _parent, _root) {14 this._io = _io;15 this._parent = _parent;16 this._root = _root || this;1718 this._read();19 }20 Pfb.prototype._read = function() {21 this.magic = this._io.readU4le();22 this.unknown1 = this._io.readU4le();23 this.unknown2 = this._io.readU4le();24 this.unknown3 = this._io.readU4le();25 this.nodes = [];26 for (var i = 0; i < 8; i++) {27 this.nodes.push(new Node(this._io, this, this._root));28 }29 }3031 var CoordsList = Pfb.CoordsList = (function() {32 function CoordsList(_io, _parent, _root) {33 this._io = _io;34 this._parent = _parent;35 this._root = _root || this;3637 this._read();38 }39 CoordsList.prototype._read = function() {40 this.size = this._io.readU4le();41 this.unk1 = this._io.readU4le();42 this.unk2 = this._io.readU4le();43 this.list = [];44 for (var i = 0; i < this.size; i++) {45 this.list.push(new CoordinatePair(this._io, this, this._root));46 }47 }4849 return CoordsList;50 })();5152 var NormalsList = Pfb.NormalsList = (function() {53 function NormalsList(_io, _parent, _root) {54 this._io = _io;55 this._parent = _parent;56 this._root = _root || this;5758 this._read();59 }60 NormalsList.prototype._read = function() {61 this.size = this._io.readU4le();62 this.unk1 = this._io.readU4le();63 this.unk2 = this._io.readU4le();64 this.elements = [];65 for (var i = 0; i < this.size; i++) {66 this.elements.push(new Normal(this._io, this, this._root));67 }68 }6970 return NormalsList;71 })();7273 var Vertex = Pfb.Vertex = (function() {74 function Vertex(_io, _parent, _root) {75 this._io = _io;76 this._parent = _parent;77 this._root = _root || this;7879 this._read();80 }81 Vertex.prototype._read = function() {82 this.x = this._io.readF4le();83 this.y = this._io.readF4le();84 this.z = this._io.readF4le();85 }8687 return Vertex;88 })();8990 var LengthsList = Pfb.LengthsList = (function() {91 function LengthsList(_io, _parent, _root) {92 this._io = _io;93 this._parent = _parent;94 this._root = _root || this;9596 this._read();97 }98 LengthsList.prototype._read = function() {99 this.size = this._io.readU4le();100 this.unk1 = this._io.readU4le();101 this.unk2 = this._io.readU4le();102 this.elements = [];103 for (var i = 0; i < this.size; i++) {104 this.elements.push(this._io.readU4le());105 }106 }107108 return LengthsList;109 })();110111 var Geosets = Pfb.Geosets = (function() {112 function Geosets(_io, _parent, _root) {113 this._io = _io;114 this._parent = _parent;115 this._root = _root || this;116117 this._read();118 }119 Geosets.prototype._read = function() {120 this.count = this._io.readU4le();121 this.size = this._io.readU4le();122 this.geosets = [];123 for (var i = 0; i < this.count; i++) {124 this.geosets.push(new Geoset(this._io, this, this._root));125 }126 }127128 return Geosets;129 })();130131 var Materials = Pfb.Materials = (function() {132 function Materials(_io, _parent, _root) {133 this._io = _io;134 this._parent = _parent;135 this._root = _root || this;136137 this._read();138 }139 Materials.prototype._read = function() {140 this.count = this._io.readU4le();141 this.size = this._io.readU4le();142 this.materials = this._io.readBytes((this.count * 4));143 }144145 return Materials;146 })();147148 var Normal = Pfb.Normal = (function() {149 function Normal(_io, _parent, _root) {150 this._io = _io;151 this._parent = _parent;152 this._root = _root || this;153154 this._read();155 }156 Normal.prototype._read = function() {157 this.nx = this._io.readF4le();158 this.ny = this._io.readF4le();159 this.nz = this._io.readF4le();160 }161162 return Normal;163 })();164165 var Color = Pfb.Color = (function() {166 function Color(_io, _parent, _root) {167 this._io = _io;168 this._parent = _parent;169 this._root = _root || this;170171 this._read();172 }173 Color.prototype._read = function() {174 this.r = this._io.readF4le();175 this.g = this._io.readF4le();176 this.b = this._io.readF4le();177 this.a = this._io.readF4le();178 }179180 return Color;181 })();182183 var VertexLists = Pfb.VertexLists = (function() {184 function VertexLists(_io, _parent, _root) {185 this._io = _io;186 this._parent = _parent;187 this._root = _root || this;188189 this._read();190 }191 VertexLists.prototype._read = function() {192 this.count = this._io.readU4le();193 this.totalSize = this._io.readU4le();194 this.lists = [];195 for (var i = 0; i < this.count; i++) {196 this.lists.push(new VertexList(this._io, this, this._root));197 }198 }199200 return VertexLists;201 })();202203 var TextcoordLists = Pfb.TextcoordLists = (function() {204 function TextcoordLists(_io, _parent, _root) {205 this._io = _io;206 this._parent = _parent;207 this._root = _root || this;208209 this._read();210 }211 TextcoordLists.prototype._read = function() {212 this.count = this._io.readU4le();213 this.totalSize = this._io.readU4le();214 this.lists = [];215 for (var i = 0; i < this.count; i++) {216 this.lists.push(new CoordsList(this._io, this, this._root));217 }218 }219220 return TextcoordLists;221 })();222223 var CoordinatePair = Pfb.CoordinatePair = (function() {224 function CoordinatePair(_io, _parent, _root) {225 this._io = _io;226 this._parent = _parent;227 this._root = _root || this;228229 this._read();230 }231 CoordinatePair.prototype._read = function() {232 this.s = this._io.readF4le();233 this.t = this._io.readF4le();234 }235236 return CoordinatePair;237 })();238239 var VertexList = Pfb.VertexList = (function() {240 function VertexList(_io, _parent, _root) {241 this._io = _io;242 this._parent = _parent;243 this._root = _root || this;244245 this._read();246 }247 VertexList.prototype._read = function() {248 this.size = this._io.readU4le();249 this.unk1 = this._io.readU4le();250 this.unk2 = this._io.readU4le();251 this.elements = [];252 for (var i = 0; i < this.size; i++) {253 this.elements.push(new Vertex(this._io, this, this._root));254 }255 }256257 return VertexList;258 })();259260 var ColorsLists = Pfb.ColorsLists = (function() {261 function ColorsLists(_io, _parent, _root) {262 this._io = _io;263 this._parent = _parent;264 this._root = _root || this;265266 this._read();267 }268 ColorsLists.prototype._read = function() {269 this.count = this._io.readU4le();270 this.totalSize = this._io.readU4le();271 this.lists = [];272 for (var i = 0; i < this.count; i++) {273 this.lists.push(new ColorsList(this._io, this, this._root));274 }275 }276277 return ColorsLists;278 })();279280 var ColorsList = Pfb.ColorsList = (function() {281 function ColorsList(_io, _parent, _root) {282 this._io = _io;283 this._parent = _parent;284 this._root = _root || this;285286 this._read();287 }288 ColorsList.prototype._read = function() {289 this.size = this._io.readU4le();290 this.unk1 = this._io.readU4le();291 this.unk2 = this._io.readU4le();292 this.elements = [];293 for (var i = 0; i < this.size; i++) {294 this.elements.push(new Color(this._io, this, this._root));295 }296 }297298 return ColorsList;299 })();300301 var Geoset = Pfb.Geoset = (function() {302 function Geoset(_io, _parent, _root) {303 this._io = _io;304 this._parent = _parent;305 this._root = _root || this;306307 this._read();308 }309 Geoset.prototype._read = function() {310 this.stripType = this._io.readU4le();311 this.numStrip = this._io.readU4le();312 this.lengthListId = this._io.readS4le();313 this.unk1 = this._io.readU4le();314 this.unk2 = this._io.readU4le();315 this.unk3 = this._io.readU4le();316 this.unk4 = this._io.readU4le();317 this.unk5 = this._io.readU4le();318 this.geostateId = this._io.readU4le();319 this.data6b = this._io.readU4le();320 this.data7 = this._io.readU4le();321 this.data8 = this._io.readU4le();322 this.mask = this._io.readU4le();323 this.data9 = this._io.readU4le();324 this.num = this._io.readU4le();325 this.vec0 = this._io.readF4le();326 this.vec1 = this._io.readF4le();327 this.vec2 = this._io.readF4le();328 this.vec3 = this._io.readF4le();329 this.vec4 = this._io.readF4le();330 this.vec5 = this._io.readF4le();331 }332333 return Geoset;334 })();335336 var Node = Pfb.Node = (function() {337 function Node(_io, _parent, _root) {338 this._io = _io;339 this._parent = _parent;340 this._root = _root || this;341342 this._read();343 }344 Node.prototype._read = function() {345 this.type = this._io.readU4le();346 switch (this.type) {347 case 10:348 this.contents = new Geosets(this._io, this, this._root);349 break;350 case 17:351 this.contents = new TUnknown(this._io, this, this._root);352 break;353 case 0:354 this.contents = new TUnknown(this._io, this, this._root);355 break;356 case 4:357 this.contents = new LenghtsLists(this._io, this, this._root);358 break;359 case 6:360 this.contents = new ColorsLists(this._io, this, this._root);361 break;362 case 7:363 this.contents = new NormalsLists(this._io, this, this._root);364 break;365 case 1:366 this.contents = new Textures(this._io, this, this._root);367 break;368 case 27:369 this.contents = new TUnknown(this._io, this, this._root);370 break;371 case 12:372 this.contents = new TUnknown(this._io, this, this._root);373 break;374 case 3:375 this.contents = new TUnknown(this._io, this, this._root);376 break;377 case 5:378 this.contents = new VertexLists(this._io, this, this._root);379 break;380 case 8:381 this.contents = new TextcoordLists(this._io, this, this._root);382 break;383 case 9:384 this.contents = new TUnknown(this._io, this, this._root);385 break;386 case 18:387 this.contents = new TUnknown(this._io, this, this._root);388 break;389 case 2:390 this.contents = new TUnknown(this._io, this, this._root);391 break;392 }393 }394395 return Node;396 })();397398 var Textures = Pfb.Textures = (function() {399 function Textures(_io, _parent, _root) {400 this._io = _io;401 this._parent = _parent;402 this._root = _root || this;403404 this._read();405 }406 Textures.prototype._read = function() {407 this.count = this._io.readU4le();408 this.totalSize = this._io.readU4le();409 this.textures = [];410 for (var i = 0; i < this.count; i++) {411 this.textures.push(new Texture(this._io, this, this._root));412 }413 }414415 return Textures;416 })();417418 var Geostates = Pfb.Geostates = (function() {419 function Geostates(_io, _parent, _root) {420 this._io = _io;421 this._parent = _parent;422 this._root = _root || this;423424 this._read();425 }426 Geostates.prototype._read = function() {427 this.count = this._io.readU4le();428 this.totalSize = this._io.readU4le();429 this.geostates = this._io.readBytes(this.totalSize);430 }431432 return Geostates;433 })();434435 var Texture = Pfb.Texture = (function() {436 function Texture(_io, _parent, _root) {437 this._io = _io;438 this._parent = _parent;439 this._root = _root || this;440441 this._read();442 }443 Texture.prototype._read = function() {444 this.filename = new PfbString(this._io, this, this._root);445 this.contents = this._io.readBytes(((Math.floor(this._parent.totalSize / this._parent.count) - this.filename.len) - 4));446 }447448 return Texture;449 })();450451 var LenghtsLists = Pfb.LenghtsLists = (function() {452 function LenghtsLists(_io, _parent, _root) {453 this._io = _io;454 this._parent = _parent;455 this._root = _root || this;456457 this._read();458 }459 LenghtsLists.prototype._read = function() {460 this.count = this._io.readU4le();461 this.totalSize = this._io.readU4le();462 this.lists = [];463 for (var i = 0; i < this.count; i++) {464 this.lists.push(new LengthsList(this._io, this, this._root));465 }466 }467468 return LenghtsLists;469 })();470471 var PfbString = Pfb.PfbString = (function() {472 function PfbString(_io, _parent, _root) {473 this._io = _io;474 this._parent = _parent;475 this._root = _root || this;476477 this._read();478 }479 PfbString.prototype._read = function() {480 this.len = this._io.readU4le();481 this.contents = KaitaiStream.bytesToStr(this._io.readBytes(this.len), "ASCII");482 }483484 return PfbString;485 })();486487 var NormalsLists = Pfb.NormalsLists = (function() {488 function NormalsLists(_io, _parent, _root) {489 this._io = _io;490 this._parent = _parent;491 this._root = _root || this;492493 this._read();494 }495 NormalsLists.prototype._read = function() {496 this.count = this._io.readU4le();497 this.totalSize = this._io.readU4le();498 this.lists = [];499 for (var i = 0; i < this.count; i++) {500 this.lists.push(new NormalsList(this._io, this, this._root));501 }502 }503504 return NormalsLists;505 })();506507 var TUnknown = Pfb.TUnknown = (function() {508 function TUnknown(_io, _parent, _root) {509 this._io = _io;510 this._parent = _parent;511 this._root = _root || this;512513 this._read();514 }515 TUnknown.prototype._read = function() {516 this.count = this._io.readU4le();517 this.totalSize = this._io.readU4le();518 this.body = this._io.readBytes(this.totalSize);519 }520521 return TUnknown;522 })();523524 return Pfb;525})();526return Pfb;
...
asupan.js
Source:asupan.js
1[2{"result":"http://sansekai.my.id/ptl_repost/120416207_674661289840975_7238538460676645249_n.mp4"},3{"result":"http://sansekai.my.id/ptl_repost/120443017_225738842307010_1507614018538871668_n.mp4"},4{"result":"http://sansekai.my.id/ptl_repost/120506710_129730895516659_9090102890235113922_n.mp4"},5{"result":"http://sansekai.my.id/ptl_repost/120518115_3382156938497131_2702539154432231938_n.mp4"},6{"result":"http://sansekai.my.id/ptl_repost/120533450_988960268238482_4908300175960396265_n.mp4"},7{"result":"http://sansekai.my.id/ptl_repost/120554993_913582535835353_7937155730001219945_n.mp4"},8{"result":"http://sansekai.my.id/ptl_repost/120565745_258483202099028_1831534734126408497_n.mp4"},9{"result":"http://sansekai.my.id/ptl_repost/120570166_2716242608644571_5562452335611050430_n.mp4"},10{"result":"http://sansekai.my.id/ptl_repost/120571358_3743879342322868_4731152347084614368_n.mp4"},11{"result":"http://sansekai.my.id/ptl_repost/120571938_198275171805822_8506241533969509004_n.mp4"},12{"result":"http://sansekai.my.id/ptl_repost/120573034_128654721967389_1837144340570017830_n.mp4"},13{"result":"http://sansekai.my.id/ptl_repost/120574217_2707319792866165_3682328392840010261_n.mp4"},14{"result":"http://sansekai.my.id/ptl_repost/120575986_151816433263092_6600262966520398271_n.mp4"},15{"result":"http://sansekai.my.id/ptl_repost/120582400_339926344091433_2581248581156693603_n.mp4"},16{"result":"http://sansekai.my.id/ptl_repost/120583739_1060190921079212_3898520254664507328_n.mp4"},17{"result":"http://sansekai.my.id/ptl_repost/120587415_638776546998307_3091093882267818607_n.mp4"},18{"result":"http://sansekai.my.id/ptl_repost/120589771_752670855329266_5064573607465519463_n.mp4"},19{"result":"http://sansekai.my.id/ptl_repost/120613860_3393110177444352_4287165838359264124_n.mp4"},20{"result":"http://sansekai.my.id/ptl_repost/120614859_768632723701773_5662521620734316774_n.mp4"},21{"result":"http://sansekai.my.id/ptl_repost/120615019_149392973357031_6254963333779779708_n.mp4"},22{"result":"http://sansekai.my.id/ptl_repost/120664457_338629710563119_6615226849280369453_n.mp4"},23{"result":"http://sansekai.my.id/ptl_repost/120670762_191033325874671_8168246094200167609_n.mp4"},24{"result":"http://sansekai.my.id/ptl_repost/120678112_971693299972883_1648826221504742220_n.mp4"},25{"result":"http://sansekai.my.id/ptl_repost/120682363_1181866688854694_4233466354892721595_n.mp4"},26{"result":"http://sansekai.my.id/ptl_repost/120698858_1302470566751609_3736999773452225729_n.mp4"},27{"result":"http://sansekai.my.id/ptl_repost/120707049_337981777304231_3152650741169851669_n.mp4"},28{"result":"http://sansekai.my.id/ptl_repost/120714412_680680702806959_2149499366562729814_n.mp4"},29{"result":"http://sansekai.my.id/ptl_repost/120678112_971693299972883_1648826221504742220_n.mp4"},30{"result":"http://sansekai.my.id/ptl_repost/120682363_1181866688854694_4233466354892721595_n.mp4"},31{"result":"http://sansekai.my.id/ptl_repost/120698858_1302470566751609_3736999773452225729_n.mp4"},32{"result":"://e.top4top.io/m_1930wespy0.mp4"},33{"result":"://e.top4top.io/m_19303zfi20.mp4"},34{"result":"://j.top4top.io/m_1930t00kx0.mp4"},35{"result":"://e.top4top.io/m_1930kx7hi0.mp4"},36{"result":"://c.top4top.io/m_19307g6kd0.mp4"},37{"result":"://f.top4top.io/m_19306yk4c0.mp4"},38{"result":"://i.top4top.io/m_1930y1u780.mp4"},39{"result":"://j.top4top.io/m_1930ilsyy0.mp4"},40{"result":"://i.top4top.io/m_19301948b0.mp4"},41{"result":"://d.top4top.io/m_1930zg8460.mp4"},42{"result":"://i.top4top.io/m_19301yozl0.mp4"},43{"result":"://g.top4top.io/m_1930qjr2q0.mp4"},44{"result":"://l.top4top.io/m_1930x1wp50.mp4"},45{"result":"://a.top4top.io/m_1930zr1041.mp4"},46{"result":"://b.top4top.io/m_1930s29hq2.mp4"},47{"result":"://a.top4top.io/m_1930kbo0y0.mp4"},48{"result":"://j.top4top.io/m_1930xek9z0.mp4"},49{"result":"://i.top4top.io/m_1930s7gb80.mp4"},50{"result":"://c.top4top.io/m_1930w0dbu0.mp4"},51{"result":"://d.top4top.io/m_1930xu4kd1.mp4"},52{"result":"://a.top4top.io/m_1930zw2nb0.mp4"},53{"result":"://b.top4top.io/m_1930eybjj1.mp4"},54{"result":"://g.top4top.io/m_1930fmx330.mp4"},55{"result":"://l.top4top.io/m_1930gnlam0.mp4"},56{"result":"://g.top4top.io/m_1930twwu50.mp4"},57{"result":"://l.top4top.io/m_1930qkeh70.mp4"},58{"result":"://l.top4top.io/m_1930wefm20.mp4"},59{"result":"://a.top4top.io/m_1930idzd51.mp4"},60{"result":"://d.top4top.io/m_2062ec3r60.mp4"},61{"result":"https://e.top4top.io/m_1930ns2zo0.mp4"},62{"result":"https://k.top4top.io/m_1930j9i810.mp4"},63{"result":"https://f.top4top.io/m_1930wtj580.mp4"},64{"result":"https://d.top4top.io/m_1930a2isv0.mp4"},65{"result":"https://e.top4top.io/m_1930wbgc41.mp4"},66{"result":"https://f.top4top.io/m_1930urbj02.mp4"},67{"result":"https://b.top4top.io/m_1930ceiqv0.mp4"},68{"result":"https://i.top4top.io/m_1931a0z6o0.mp4"},69{"result":"https://a.top4top.io/m_193190b500.mp4"},70{"result":"https://b.top4top.io/m_1931dcixz1.mp4"},71{"result":"https://g.top4top.io/m_19317gpjp0.mp4"},72{"result":"https://i.top4top.io/m_1931cc22w1.mp4"},73{"result":"https://j.top4top.io/m_1931xn6412.mp4"},74{"result":"https://g.top4top.io/m_1931silxz0.mp4"},75{"result":"https://h.top4top.io/m_1931as4mg1.mp4"},76{"result":"https://i.top4top.io/m_1931p9j5v0.mp4"},77{"result":"https://e.top4top.io/m_1931mgeuy0.mp4"},78{"result":"https://f.top4top.io/m_1931lw9381.mp4"},79{"result":"https://g.top4top.io/m_1931vm0dk2.mp4"},80{"result":"https://h.top4top.io/m_1931fiv8x3.mp4"},81{"result":"https://b.top4top.io/m_1931jm3dt0.mp4"},82{"result":"https://e.top4top.io/m_1931i7yag1.mp4"},83{"result":"https://f.top4top.io/m_1931dr5ya2.mp4"},84{"result":"https://g.top4top.io/m_193172kpg3.mp4"},85{"result":"https://h.top4top.io/m_1931j3b224.mp4"},86{"result":"https://j.top4top.io/m_19317ykt25.mp4"},87{"result":"https://k.top4top.io/m_1931o0vh16.mp4"},88{"result":"https://l.top4top.io/m_1931ssfbn7.mp4"},89{"result":"https://a.top4top.io/m_19318t7458.mp4"},90{"result":"https://b.top4top.io/m_1931vhu759.mp4"},91{"result":"https://b.top4top.io/m_1930thxw90.mp4"},92{"result":"https://d.top4top.io/m_1930pezhp0.mp4"},93{"result":"https://c.top4top.io/m_1930cjgbx0.mp4"},94{"result":"https://b.top4top.io/m_1930v6vhg0.mp4"},95{"result":"https://f.top4top.io/m_1930uh7ud0.mp4"},96{"result":"https://a.top4top.io/m_1930c9cpb0.mp4"},97{"result":"https://k.top4top.io/m_19308amkf0.mp4"},98{"result":"https://d.top4top.io/m_1930wjaq60.mp4"},99{"result":"https://i.top4top.io/m_1930n2um40.mp4"},100{"result":"https://i.top4top.io/m_1930e14pi0.mp4"},101{"result":"https://i.top4top.io/m_1930w6lwf0.mp4"},102{"result":"https://e.top4top.io/m_19307autl0.mp4"},103{"result":"https://d.top4top.io/m_1930i6tfc0.mp4"},104{"result":"https://c.top4top.io/m_1930qmr7u0.mp4"},105{"result":"https://d.top4top.io/m_1930itbte1.mp4"},106{"result":"https://i.top4top.io/m_1930ze4oq0.mp4"},107{"result":"https://j.top4top.io/m_1930kkqyh1.mp4"},108{"result":"https://f.top4top.io/m_1930zevlz0.mp4"},109{"result":"https://g.top4top.io/m_1930q0apu1.mp4"},110{"result":"https://h.top4top.io/m_1930trfsv2.mp4"},111{"result":"https://l.top4top.io/m_1931ufrul0.mp4"},112{"result":"https://a.top4top.io/m_1931jbdpk1.mp4"},113{"result":"https://c.top4top.io/m_1931aj9nm2.mp4"},114{"result":"https://d.top4top.io/m_1931cnsal3.mp4"},115{"result":"https://e.top4top.io/m_1931d4kc74.mp4"},116{"result":"https://f.top4top.io/m_1931bih8q5.mp4"},117{"result":"https://g.top4top.io/m_1931xx7aa6.mp4"},118{"result":"https://h.top4top.io/m_1931g3zsq7.mp4"},119{"result":"https://a.top4top.io/m_1931m74wd0.mp4"},120{"result":"https://b.top4top.io/m_1931p8tfm1.mp4"},121{"result":"https://e.top4top.io/m_1931aj8iv0.mp4"},122{"result":"https://f.top4top.io/m_1931szguy1.mp4"},123{"result":"https://g.top4top.io/m_1931l73ry2.mp4"},124{"result":"https://h.top4top.io/m_1931yhznj3.mp4"},125{"result":"https://i.top4top.io/m_1931kmtp34.mp4"},126{"result":"https://j.top4top.io/m_1931snhdg5.mp4"},127{"result":"https://k.top4top.io/m_1931ay1jz6.mp4"},128{"result":"https://l.top4top.io/m_1931x70mk7.mp4"},129{"result":"https://a.top4top.io/m_19319mvvf8.mp4"},130{"result":"https://b.top4top.io/m_1931icmzd9.mp4"},131{"result":"https://h.top4top.io/m_19316oo0s0.mp4"},132{"result":"https://i.top4top.io/m_1931cvvpt1.mp4"},133{"result":"https://b.top4top.io/m_1931yxodg0.mp4"},134{"result":"https://k.top4top.io/m_193161p380.mp4"},135{"result":"https://l.top4top.io/m_1931i4g3p1.mp4"},136{"result":"https://a.top4top.io/m_1931tjlio2.mp4"},137{"result":"https://g.top4top.io/m_1931z2mc40.mp4"},138{"result":"https://h.top4top.io/m_1931auyof1.mp4"},139{"result":"https://i.top4top.io/m_19315hrle2.mp4"},140{"result":"https://j.top4top.io/m_1931xul5a3.mp4"},141{"result":"https://l.top4top.io/m_1931o92nr0.mp4"},142{"result":"https://a.top4top.io/m_1931j1rh21.mp4"},143{"result":"https://b.top4top.io/m_1931iaqpg2.mp4"},144{"result":"https://c.top4top.io/m_1931s5zlj3.mp4"},145{"result":"https://d.top4top.io/m_1931x0g5a4.mp4"},146{"result":"https://i.top4top.io/m_1931oj76n0.mp4"},147{"result":"https://j.top4top.io/m_19319gl3d1.mp4"},148{"result":"https://k.top4top.io/m_1931u52cq2.mp4"},149{"result":"https://l.top4top.io/m_1931mvgj73.mp4"},150{"result":"https://a.top4top.io/m_1931u07oz4.mp4"},151{"result":"https://j.top4top.io/m_1931h1fo60.mp4"},152{"result":"https://k.top4top.io/m_1931mro3u1.mp4"},153{"result":"https://l.top4top.io/m_1931kx0ac2.mp4"},154{"result":"https://a.top4top.io/m_1931g9ezq3.mp4"},155{"result":"https://b.top4top.io/m_1931plin14.mp4"},156{"result":"https://c.top4top.io/m_1931aaxri5.mp4"},157{"result":"https://d.top4top.io/m_1931ijzzn6.mp4"},158{"result":"https://e.top4top.io/m_1931ugycd7.mp4"},159{"result":"https://f.top4top.io/m_1931l14nk8.mp4"},160{"result":"https://g.top4top.io/m_1931crgqt9.mp4"},161{"result":"https://g.top4top.io/m_2080isjz00.mp4"},162{"result":"https://h.top4top.io/m_2080sw2vr0.mp4"},163{"result":"https://e.top4top.io/m_2080g02070.mp4"},164{"result":"https://j.top4top.io/m_2080olloo6.mp4"},165{"result":"https://i.top4top.io/m_2080ulaoy5.mp4"},166{"result":"https://h.top4top.io/m_2080px33c4.mp4"},167{"result":"https://g.top4top.io/m_2080kpb6l3.mp4"},168{"result":"https://f.top4top.io/m_20803iuor2.mp4"},169{"result":"https://e.top4top.io/m_2080qcpsz1.mp4"},170{"result":"https://d.top4top.io/m_2080p6j6e0.mp4"},171{"result":"https://b.top4top.io/m_20808q0mz2.mp4"},172{"result":"https://a.top4top.io/m_2080mpkv91.mp4"},173{"result":"https://l.top4top.io/m_2080wz0gu0.mp4"},174{"result":"https://b.top4top.io/m_20816emsu0.mp4"},175{"result":"https://a.top4top.io/m_208198wob6.mp4"},176{"result":"https://l.top4top.io/m_208112xxw5.mp4"},177{"result":"https://k.top4top.io/m_2081iapdc4.mp4"},178{"result":"https://i.top4top.io/m_2081oix7n3.mp4"},179{"result":"https://h.top4top.io/m_2081zhpp72.mp4"},180{"result":"https://g.top4top.io/m_2081tbnan1.mp4"},181{"result":"https://f.top4top.io/m_20811tyi00.mp4"},182{"result":"https://a.top4top.io/m_20812zy9o0.mp4"}...
Vst.js
Source:Vst.js
1// This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild2(function (root, factory) {3 if (typeof define === 'function' && define.amd) {4 define(['kaitai-struct/KaitaiStream'], factory);5 } else if (typeof module === 'object' && module.exports) {6 module.exports = factory(require('kaitai-struct/KaitaiStream'));7 } else {8 root.Vst = factory(root.KaitaiStream);9 }10}(this, function (KaitaiStream) {11var Vst = (function() {12 function Vst(_io, _parent, _root) {13 this._io = _io;14 this._parent = _parent;15 this._root = _root || this;16 this._read();17 }18 Vst.prototype._read = function() {19 this.vistaHeader = new VstHeader(this._io, this, this._root);20 this.boundingBox = new BoundingBox(this._io, this, this._root);21 this.textureRef = this._io.readBytes(2048);22 this.coordinateSystem = this._io.readBytes(4096);23 }24 var VstHeader = Vst.VstHeader = (function() {25 function VstHeader(_io, _parent, _root) {26 this._io = _io;27 this._parent = _parent;28 this._root = _root || this;29 this._read();30 }31 VstHeader.prototype._read = function() {32 this.magic = this._io.readBytes(3);33 if (!((KaitaiStream.byteArrayCompare(this.magic, [86, 83, 84]) == 0))) {34 throw new KaitaiStream.ValidationNotEqualError([86, 83, 84], this.magic, this._io, "/types/vst_header/seq/0");35 }36 this.end = KaitaiStream.bytesToStr(this._io.readBytes(1), "ASCII");37 this.endianness = this._io.readU4le();38 this.major = this._io.readU4le();39 this.minor = this._io.readU4le();40 this.implId = this._io.readU4le();41 this.res = this._io.readU8le();42 this.texturesCount = this._io.readU4le();43 this.vertexCount = this._io.readU4le();44 this.lodsCount = this._io.readU4le();45 }46 return VstHeader;47 })();48 var Vertex = Vst.Vertex = (function() {49 function Vertex(_io, _parent, _root) {50 this._io = _io;51 this._parent = _parent;52 this._root = _root || this;53 this._read();54 }55 Vertex.prototype._read = function() {56 this.s = this._io.readF4le();57 this.t = this._io.readF4le();58 this.x = this._io.readF4le();59 this.y = this._io.readF4le();60 this.z = this._io.readF4le();61 }62 return Vertex;63 })();64 var LodHeader = Vst.LodHeader = (function() {65 function LodHeader(_io, _parent, _root) {66 this._io = _io;67 this._parent = _parent;68 this._root = _root || this;69 this._read();70 }71 LodHeader.prototype._read = function() {72 this.size = this._io.readU4le();73 this.reserved = this._io.readU8le();74 this.vertexCount = this._io.readU4le();75 this.threshold = this._io.readF4le();76 this.patchesCount = this._io.readU4le();77 this.highestVertex = this._io.readU4le();78 }79 return LodHeader;80 })();81 var Lod = Vst.Lod = (function() {82 function Lod(_io, _parent, _root) {83 this._io = _io;84 this._parent = _parent;85 this._root = _root || this;86 this._read();87 }88 Lod.prototype._read = function() {89 this.header = new LodHeader(this._io, this, this._root);90 this.boundingBox = new BoundingBox(this._io, this, this._root);91 this.patches = new Array(this.header.patchesCount);92 for (var i = 0; i < this.header.patchesCount; i++) {93 this.patches[i] = new Patch(this._io, this, this._root);94 }95 }96 return Lod;97 })();98 var VertexList = Vst.VertexList = (function() {99 function VertexList(_io, _parent, _root) {100 this._io = _io;101 this._parent = _parent;102 this._root = _root || this;103 this._read();104 }105 VertexList.prototype._read = function() {106 this.vertex = new Vertex(this._io, this, this._root);107 }108 return VertexList;109 })();110 var PatchHeader = Vst.PatchHeader = (function() {111 function PatchHeader(_io, _parent, _root) {112 this._io = _io;113 this._parent = _parent;114 this._root = _root || this;115 this._read();116 }117 PatchHeader.prototype._read = function() {118 this.reserved = this._io.readU8le();119 this.patchType = this._io.readU4le();120 this.textureIndex = this._io.readU4le();121 this.stripsCount = this._io.readU4le();122 this.indexCount = this._io.readU4le();123 }124 return PatchHeader;125 })();126 var BoundingBox = Vst.BoundingBox = (function() {127 function BoundingBox(_io, _parent, _root) {128 this._io = _io;129 this._parent = _parent;130 this._root = _root || this;131 this._read();132 }133 BoundingBox.prototype._read = function() {134 this.xmin = this._io.readF4le();135 this.ymin = this._io.readF4le();136 this.zmin = this._io.readF4le();137 this.xmax = this._io.readF4le();138 this.ymax = this._io.readF4le();139 this.zmax = this._io.readF4le();140 }141 return BoundingBox;142 })();143 var Patch = Vst.Patch = (function() {144 function Patch(_io, _parent, _root) {145 this._io = _io;146 this._parent = _parent;147 this._root = _root || this;148 this._read();149 }150 Patch.prototype._read = function() {151 this.header = new PatchHeader(this._io, this, this._root);152 this.trianglesStripsLengths = new Array(this.header.stripsCount);153 for (var i = 0; i < this.header.stripsCount; i++) {154 this.trianglesStripsLengths[i] = this._io.readU4le();155 }156 this.pointersToVertexOfFaces = new Array(this.header.indexCount);157 for (var i = 0; i < this.header.indexCount; i++) {158 this.pointersToVertexOfFaces[i] = this._io.readU4le();159 }160 }161 return Patch;162 })();163 Object.defineProperty(Vst.prototype, 'vertices', {164 get: function() {165 if (this._m_vertices !== undefined)166 return this._m_vertices;167 this._m_vertices = new Array(this.vistaHeader.vertexCount);168 for (var i = 0; i < this.vistaHeader.vertexCount; i++) {169 this._m_vertices[i] = new Vertex(this._io, this, this._root);170 }171 return this._m_vertices;172 }173 });174 Object.defineProperty(Vst.prototype, 'lods', {175 get: function() {176 if (this._m_lods !== undefined)177 return this._m_lods;178 var _pos = this._io.pos;179 this._io.seek(((((40 + 24) + (this.textureRef.length * this.vistaHeader.texturesCount)) + this.coordinateSystem.length) + ((this.vistaHeader.vertexCount * 4) * 5)));180 this._m_lods = new Array(this.vistaHeader.lodsCount);181 for (var i = 0; i < this.vistaHeader.lodsCount; i++) {182 this._m_lods[i] = new Lod(this._io, this, this._root);183 }184 this._io.seek(_pos);185 return this._m_lods;186 }187 });188 return Vst;189})();190return Vst;...
iterio.py
Source:iterio.py
1# -*- coding: utf-8 -*-2"""3 werkzeug.testsuite.iterio4 ~~~~~~~~~~~~~~~~~~~~~~~~~5 Tests the iterio object.6 :copyright: (c) 2014 by Armin Ronacher.7 :license: BSD, see LICENSE for more details.8"""9import unittest10from functools import partial11from werkzeug.testsuite import WerkzeugTestCase12from werkzeug.contrib.iterio import IterIO, greenlet13class IterOTestSuite(WerkzeugTestCase):14 def test_basic_native(self):15 io = IterIO(["Hello", "World", "1", "2", "3"])16 self.assert_equal(io.tell(), 0)17 self.assert_equal(io.read(2), "He")18 self.assert_equal(io.tell(), 2)19 self.assert_equal(io.read(3), "llo")20 self.assert_equal(io.tell(), 5)21 io.seek(0)22 self.assert_equal(io.read(5), "Hello")23 self.assert_equal(io.tell(), 5)24 self.assert_equal(io._buf, "Hello")25 self.assert_equal(io.read(), "World123")26 self.assert_equal(io.tell(), 13)27 io.close()28 assert io.closed29 io = IterIO(["Hello\n", "World!"])30 self.assert_equal(io.readline(), 'Hello\n')31 self.assert_equal(io._buf, 'Hello\n')32 self.assert_equal(io.read(), 'World!')33 self.assert_equal(io._buf, 'Hello\nWorld!')34 self.assert_equal(io.tell(), 12)35 io.seek(0)36 self.assert_equal(io.readlines(), ['Hello\n', 'World!'])37 io = IterIO(["foo\n", "bar"])38 io.seek(-4, 2)39 self.assert_equal(io.read(4), '\nbar')40 self.assert_raises(IOError, io.seek, 2, 100)41 io.close()42 self.assert_raises(ValueError, io.read)43 def test_basic_bytes(self):44 io = IterIO([b"Hello", b"World", b"1", b"2", b"3"])45 self.assert_equal(io.tell(), 0)46 self.assert_equal(io.read(2), b"He")47 self.assert_equal(io.tell(), 2)48 self.assert_equal(io.read(3), b"llo")49 self.assert_equal(io.tell(), 5)50 io.seek(0)51 self.assert_equal(io.read(5), b"Hello")52 self.assert_equal(io.tell(), 5)53 self.assert_equal(io._buf, b"Hello")54 self.assert_equal(io.read(), b"World123")55 self.assert_equal(io.tell(), 13)56 io.close()57 assert io.closed58 io = IterIO([b"Hello\n", b"World!"])59 self.assert_equal(io.readline(), b'Hello\n')60 self.assert_equal(io._buf, b'Hello\n')61 self.assert_equal(io.read(), b'World!')62 self.assert_equal(io._buf, b'Hello\nWorld!')63 self.assert_equal(io.tell(), 12)64 io.seek(0)65 self.assert_equal(io.readlines(), [b'Hello\n', b'World!'])66 io = IterIO([b"foo\n", b"bar"])67 io.seek(-4, 2)68 self.assert_equal(io.read(4), b'\nbar')69 self.assert_raises(IOError, io.seek, 2, 100)70 io.close()71 self.assert_raises(ValueError, io.read)72 def test_basic_unicode(self):73 io = IterIO([u"Hello", u"World", u"1", u"2", u"3"])74 self.assert_equal(io.tell(), 0)75 self.assert_equal(io.read(2), u"He")76 self.assert_equal(io.tell(), 2)77 self.assert_equal(io.read(3), u"llo")78 self.assert_equal(io.tell(), 5)79 io.seek(0)80 self.assert_equal(io.read(5), u"Hello")81 self.assert_equal(io.tell(), 5)82 self.assert_equal(io._buf, u"Hello")83 self.assert_equal(io.read(), u"World123")84 self.assert_equal(io.tell(), 13)85 io.close()86 assert io.closed87 io = IterIO([u"Hello\n", u"World!"])88 self.assert_equal(io.readline(), u'Hello\n')89 self.assert_equal(io._buf, u'Hello\n')90 self.assert_equal(io.read(), u'World!')91 self.assert_equal(io._buf, u'Hello\nWorld!')92 self.assert_equal(io.tell(), 12)93 io.seek(0)94 self.assert_equal(io.readlines(), [u'Hello\n', u'World!'])95 io = IterIO([u"foo\n", u"bar"])96 io.seek(-4, 2)97 self.assert_equal(io.read(4), u'\nbar')98 self.assert_raises(IOError, io.seek, 2, 100)99 io.close()100 self.assert_raises(ValueError, io.read)101 def test_sentinel_cases(self):102 io = IterIO([])103 self.assert_strict_equal(io.read(), '')104 io = IterIO([], b'')105 self.assert_strict_equal(io.read(), b'')106 io = IterIO([], u'')107 self.assert_strict_equal(io.read(), u'')108 io = IterIO([])109 self.assert_strict_equal(io.read(), '')110 io = IterIO([b''])111 self.assert_strict_equal(io.read(), b'')112 io = IterIO([u''])113 self.assert_strict_equal(io.read(), u'')114 io = IterIO([])115 self.assert_strict_equal(io.readline(), '')116 io = IterIO([], b'')117 self.assert_strict_equal(io.readline(), b'')118 io = IterIO([], u'')119 self.assert_strict_equal(io.readline(), u'')120 io = IterIO([])121 self.assert_strict_equal(io.readline(), '')122 io = IterIO([b''])123 self.assert_strict_equal(io.readline(), b'')124 io = IterIO([u''])125 self.assert_strict_equal(io.readline(), u'')126class IterITestSuite(WerkzeugTestCase):127 def test_basic(self):128 def producer(out):129 out.write('1\n')130 out.write('2\n')131 out.flush()132 out.write('3\n')133 iterable = IterIO(producer)134 self.assert_equal(next(iterable), '1\n2\n')135 self.assert_equal(next(iterable), '3\n')136 self.assert_raises(StopIteration, next, iterable)137 def test_sentinel_cases(self):138 def producer_dummy_flush(out):139 out.flush()140 iterable = IterIO(producer_dummy_flush)141 self.assert_strict_equal(next(iterable), '')142 def producer_empty(out):143 pass144 iterable = IterIO(producer_empty)145 self.assert_raises(StopIteration, next, iterable)146 iterable = IterIO(producer_dummy_flush, b'')147 self.assert_strict_equal(next(iterable), b'')148 iterable = IterIO(producer_dummy_flush, u'')149 self.assert_strict_equal(next(iterable), u'')150def suite():151 suite = unittest.TestSuite()152 suite.addTest(unittest.makeSuite(IterOTestSuite))153 if greenlet is not None:154 suite.addTest(unittest.makeSuite(IterITestSuite))...
Using AI Code Generation
1var io = require('socket.io-client');2socket.on('connect', function(socket) { 3 console.log('Connected!');4});5socket.on('disconnect', function(socket) { 6 console.log('Disconnected!');7});8socket.on('connect', function(socket) { 9 console.log('Connected!');10});11socket.on('disconnect', function(socket) { 12 console.log('Disconnected!');13});14socket.on('connect', function(socket) { 15 console.log('Connected!');16});17socket.on('disconnect', function(socket) { 18 console.log('Disconnected!');19});20socket.on('connect', function(socket) { 21 console.log('Connected!');22});23socket.on('disconnect', function(socket) { 24 console.log('Disconnected!');25});26socket.on('connect', function(socket) { 27 console.log('Connected!');28});29socket.on('disconnect', function(socket) { 30 console.log('Disconnected!');31});32socket.on('connect', function(socket) { 33 console.log('Connected!');34});35socket.on('disconnect', function(socket) { 36 console.log('Disconnected!');37});38socket.on('connect', function(socket) { 39 console.log('Connected!');40});41socket.on('disconnect', function(socket) { 42 console.log('Disconnected!');43});44socket.on('connect', function(socket) { 45 console.log('Connected!');46});47socket.on('disconnect', function(socket) { 48 console.log('Disconnected!');49});50socket.on('connect', function(socket) { 51 console.log('Connected!');52});53socket.on('disconnect', function(socket) { 54 console.log('Disconnected!');55});56socket.on('connect', function(socket) { 57 console.log('Connected!');58});59socket.on('disconnect', function(socket) { 60 console.log('Disconnected!');61});62socket.on('
Using AI Code Generation
1var io = require('devicefarmer-stf').io;2socket.on('connect', function() {3 console.log('Connected!');4});5socket.on('disconnect', function() {6 console.log('Disconnected!');7});8socket.on('message', function(data) {9 console.log('Received message:', data);10});11socket.emit('message', 'Hello server!');12var stf = require('devicefarmer-stf');13socket.on('connect', function() {14 console.log('Connected!');15});16socket.on('disconnect', function() {17 console.log('Disconnected!');18});19socket.on('message', function(data) {20 console.log('Received message:', data);21});22socket.emit('message', 'Hello server!');
Using AI Code Generation
1var client = require('devicefarmer-stf-client');2var io = client.io;3var devicefarmer = require('devicefarmer-stf-client');4var client = devicefarmer.client;5var stf = client({6});7var devicefarmer = require('devicefarmer-stf-client');8var client = devicefarmer.client;9var stf = client({10});11stf.connect(function (err) {12 if (err) {13 console.error(err);14 return;15 }16 console.log('Connected to STF');17 stf.getDevices(function (err, devices) {18 if (err) {19 console.error(err);20 return;21 }22 console.log('Got devices');23 console.log(devices);24 });25});26[ { serial: 'emulator-5554',27 display: { width: 1080, height: 1920, rotation: 0 },28 phone: { number: null, operator: null },29 product: { name: 'sdk_phone_x86', model: 'Android SDK built for x86', brand: 'google', manufacturer: 'Google', device: 'generic_x86', board: 'goldfish', hardware: 'goldfish', serial: 'emulator-5554' },30 battery: { status: 2, health: 2, source: 1, level: 100, scale: 100, voltage: 0, temperature: 0, plugged: 0, technology: null, present: true },
Using AI Code Generation
1var io = require('socket.io-client');2socket.on('connect', function (data) {3 console.log("connected");4 socket.emit('login', { username: 'user', password: 'pass' });5 socket.emit('getDeviceList', { username: 'user', password: 'pass' });6 socket.on('getDeviceList', function (data) {7 console.log(data);8 });9});10socket.on('disconnect', function (data) {11 console.log("disconnected");12});13var io = require('socket.io-client');14socket.on('connect', function (data) {15 console.log("connected");16 socket.emit('login', { username: 'user', password: 'pass' });17 socket.emit('getDeviceList', { username: 'user', password: 'pass' });18 socket.on('getDeviceList', function (data) {19 console.log(data);20 });21});22socket.on('disconnect', function (data) {23 console.log("disconnected");24});25var io = require('socket.io-client');26socket.on('connect', function (data) {27 console.log("connected");28 socket.emit('login', { username: 'user', password: 'pass' });29 socket.emit('getDeviceList', { username: 'user', password: 'pass' });30 socket.on('getDeviceList', function (data) {31 console.log(data);32 });33});34socket.on('disconnect', function (data) {35 console.log("disconnected");36});37var io = require('socket.io-client');38socket.on('connect', function (data) {39 console.log("connected");40 socket.emit('login', { username: 'user', password: 'pass' });41 socket.emit('getDeviceList', { username: 'user', password: 'pass' });42 socket.on('getDeviceList', function (data) {43 console.log(data);44 });
Using AI Code Generation
1var io = require('socket.io-client');2socket.on('connect', function () {3 console.log("Connected");4 socket.emit('hello', { hello: 'world' });5});6socket.on('disconnect', function () {7 console.log("Disconnected");8});9socket.on('hello', function (data) {10 console.log(data);11});12var stf = require('stf-client');13client.on('connect', function () {14 console.log("Connected");15 client.emit('hello', { hello: 'world' });16});17client.on('disconnect', function () {18 console.log("Disconnected");19});20client.on('hello', function (data) {21 console.log(data);22});
Using AI Code Generation
1var df = require('devicefarmer-stf');2var io = df.io;3io.start(function(err, data) {4 if (err) {5 console.log(err);6 } else {7 console.log(data);8 }9});10var df = require('devicefarmer-stf');11var io = df.io;12io.start(function(err, data) {13 if (err) {14 console.log(err);15 } else {16 console.log(data);17 }18});19var df = require('devicefarmer-stf');20var io = df.io;21io.start(function(err, data) {22 if (err) {23 console.log(err);24 } else {25 console.log(data);26 }27});28var df = require('devicefarmer-stf');29var io = df.io;30io.start(function(err, data) {31 if (err) {32 console.log(err);33 } else {34 console.log(data);35 }36});37var df = require('devicefarmer-stf');38var io = df.io;39io.start(function(err, data) {40 if (err) {41 console.log(err);42 } else {43 console.log(data);44 }45});46var df = require('devicefarmer-stf');47var io = df.io;48io.start(function(err, data) {49 if (err) {50 console.log(err);51 } else {52 console.log(data);53 }54});55var df = require('
Using AI Code Generation
1var io = require('socket.io-client');2socket.emit('device', { serial: '0123456789ABCDEF' });3socket.on('message', function(data) {4 console.log(data);5});6socket.on('disconnect', function() {7 console.log('disconnected');8});9socket.on('connect', function() {10 console.log('connected');11});12socket.on('error', function(err) {13 console.log(err);14});15socket.on('connect_error', function(err) {16 console.log(err);17});18socket.on('connect_timeout', function(err) {19 console.log(err);20});21socket.on('reconnect', function(err) {22 console.log(err);23});24socket.on('reconnect_attempt', function(err) {25 console.log(err);26});27socket.on('reconnecting', function(err) {28 console.log(err);29});30socket.on('reconnect_error', function(err) {31 console.log(err);32});33socket.on('reconnect_failed', function(err) {34 console.log(err);35});36socket.on('ping', function(err) {37 console.log(err);38});39socket.on('pong', function(err) {40 console.log(err);41});42socket.on('connect', function() {43 console.log('connected');44 socket.emit('message', 'hello world');45});46socket.on('message', function(data) {47 console.log(data);48});49socket.on('disconnect', function() {50 console.log('disconnected');51});52socket.on('error', function(err) {53 console.log(err);54});55socket.on('connect_error', function(err) {56 console.log(err);57});58socket.on('connect_timeout', function(err) {59 console.log(err);60});61socket.on('reconnect', function(err) {62 console.log(err);63});64socket.on('reconnect_attempt', function(err) {65 console.log(err);66});67socket.on('reconnecting', function(err) {68 console.log(err);69});70socket.on('reconnect_error', function(err) {71 console.log(err);72});73socket.on('reconnect_failed', function(err) {74 console.log(err);75});76socket.on('ping', function(err) {77 console.log(err);78});79socket.on('pong', function(err) {80 console.log(err);81});82socket.on('connect', function() {83 console.log('connected');84 socket.emit('message', 'hello world');85});86socket.on('message', function(data) {
Using AI Code Generation
1const devicefarmer = require('devicefarmer-stf');2const io = devicefarmer.io;3const util = require('util');4io.on('connect', function(){5 console.log('connected');6 io.emit('ready', 'test');7});8io.on('error', function(error){9 console.log('error');10 console.log(error);11});12io.on('disconnect', function(){13 console.log('disconnected');14});15io.on('message', function(message){16 console.log('message');17 console.log(message);18});19io.on('ready', function(message){20 console.log('ready');21 console.log(message);22});23io.on('disconnect', function(){24 console.log('disconnected');25});26io.on('connect', function(){27 console.log('connected');28 io.emit('ready', 'test');29});30io.on('error', function(error){31 console.log('error');32 console.log(error);33});34io.on('disconnect', function(){35 console.log('disconnected');36});37io.on('message', function(message){38 console.log('message');39 console.log(message);40});41io.on('ready', function(message){42 console.log('ready');43 console.log(message);44});45io.on('disconnect', function(){46 console.log('disconnected');47});48io.on('connect', function(){49 console.log('connected');50 io.emit('ready', 'test');51});52io.on('error', function(error){53 console.log('error');54 console.log(error);55});56io.on('disconnect', function(){57 console.log('disconnected');58});59io.on('message', function(message){60 console.log('message');61 console.log(message);62});63io.on('ready', function(message){64 console.log('ready');65 console.log(message);66});67io.on('disconnect', function(){68 console.log('disconnected');69});70io.on('connect', function(){71 console.log('connected');72 io.emit('ready', 'test');73});74io.on('error', function(error){75 console.log('error');76 console.log(error);77});78io.on('disconnect', function(){79 console.log('disconnected');80});81io.on('message', function(message){82 console.log('message');83 console.log(message);84});85io.on('ready', function(message){86 console.log('ready');87 console.log(message);88});89io.on('disconnect', function(){90 console.log('disconnected');91});92io.on('connect', function(){93 console.log('connected');94 io.emit('
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!