当前位置: 首页>>代码示例>>Python>>正文


Python baseline.Baseline方法代码示例

本文整理汇总了Python中baseline.Baseline方法的典型用法代码示例。如果您正苦于以下问题:Python baseline.Baseline方法的具体用法?Python baseline.Baseline怎么用?Python baseline.Baseline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在baseline的用法示例。


在下文中一共展示了baseline.Baseline方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_list_attributes_photo

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_list_attributes_photo(self):
        """Verify that calling dir() on a camera photo lists the expected EXIF attributes."""
        with open(os.path.join(os.path.dirname(__file__), 'grand_canyon.jpg'), 'rb') as image_file:
            image = Image(image_file)
        dunder_dir_text = '\n'.join(textwrap.wrap(repr(sorted(dir(image))), 90))
        self.assertEqual(dunder_dir_text, Baseline("""
            ['<unknown EXIF tag 59932>', '<unknown EXIF tag 59933>', '_exif_ifd_pointer',
            '_gps_ifd_pointer', '_segments', 'aperture_value', 'brightness_value', 'color_space',
            'components_configuration', 'compression', 'datetime', 'datetime_digitized',
            'datetime_original', 'delete', 'delete_all', 'exif_version', 'exposure_bias_value',
            'exposure_mode', 'exposure_program', 'exposure_time', 'f_number', 'flash',
            'flashpix_version', 'focal_length', 'focal_length_in_35mm_film', 'get', 'get_file',
            'get_thumbnail', 'gps_altitude', 'gps_altitude_ref', 'gps_datestamp', 'gps_dest_bearing',
            'gps_dest_bearing_ref', 'gps_horizontal_positioning_error', 'gps_img_direction',
            'gps_img_direction_ref', 'gps_latitude', 'gps_latitude_ref', 'gps_longitude',
            'gps_longitude_ref', 'gps_speed', 'gps_speed_ref', 'gps_timestamp', 'has_exif',
            'jpeg_interchange_format', 'jpeg_interchange_format_length', 'lens_make', 'lens_model',
            'lens_specification', 'make', 'maker_note', 'metering_mode', 'model', 'orientation',
            'photographic_sensitivity', 'pixel_x_dimension', 'pixel_y_dimension', 'resolution_unit',
            'scene_capture_type', 'scene_type', 'sensing_method', 'shutter_speed_value', 'software',
            'subject_area', 'subsec_time_digitized', 'subsec_time_original', 'white_balance',
            'x_resolution', 'y_and_c_positioning', 'y_resolution']
            """)) 
开发者ID:TNThieding,项目名称:exif,代码行数:25,代码来源:test_dunder_dir.py

示例2: test_delete_all_tags

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_delete_all_tags(self):
        """Verify deleting all EXIF tags from the Image object."""
        self.image.delete_all()

        segment_hex = binascii.hexlify(self.image._segments['APP1'].get_segment_bytes()).decode("utf-8").upper()
        self.assertEqual('\n'.join(textwrap.wrap(segment_hex, 90)), DELETE_ALL_HEX_BASELINE)

        with TemporaryFile("w+b") as temporary_file_stream:
            temporary_file_stream.write(self.image.get_file())
            temporary_file_stream.seek(0)
            reloaded_image = Image(temporary_file_stream)

        dunder_dir_text = '\n'.join(textwrap.wrap(repr(sorted(dir(reloaded_image))), 90))
        self.assertEqual(dunder_dir_text, Baseline("""
            ['<unknown EXIF tag 59932>', '_segments', 'delete', 'delete_all', 'get', 'get_file',
            'get_thumbnail', 'has_exif']
            """)) 
开发者ID:TNThieding,项目名称:exif,代码行数:19,代码来源:test_delete_exif.py

示例3: get_baseline

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def get_baseline(self):
    cls = (baseline.UnifiedBaseline if self.objective == 'upcl' else
           baseline.Baseline)
    return cls(self.env_spec, self.internal_dim,
               input_prev_actions=self.input_prev_actions,
               input_time_step=self.input_time_step,
               input_policy_state=self.recurrent,  # may want to change this
               n_hidden_layers=self.value_hidden_layers,
               hidden_dim=self.internal_dim,
               tau=self.tau) 
开发者ID:ringringyi,项目名称:DOTA_models,代码行数:12,代码来源:trainer.py

示例4: test_list_attributes_simple

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_list_attributes_simple(self):
        """Verify that calling dir() on a simple image lists the expected EXIF attributes."""
        with open(os.path.join(os.path.dirname(__file__), 'noise.jpg'), 'rb') as image_file:
            image = Image(image_file)
        dunder_dir_text = '\n'.join(textwrap.wrap(repr(sorted(dir(image))), 90))
        self.assertEqual(dunder_dir_text, Baseline("""
            ['_exif_ifd_pointer', '_segments', 'color_space', 'compression', 'datetime', 'delete',
            'delete_all', 'get', 'get_file', 'get_thumbnail', 'has_exif', 'jpeg_interchange_format',
            'jpeg_interchange_format_length', 'orientation', 'pixel_x_dimension', 'pixel_y_dimension',
            'resolution_unit', 'software', 'x_resolution', 'y_resolution']
            """)) 
开发者ID:TNThieding,项目名称:exif,代码行数:13,代码来源:test_dunder_dir.py

示例5: test_modify

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_modify():
    """Verify that modifying tags updates the tag values as expected."""
    with open(os.path.join(os.path.dirname(__file__), 'little_endian.jpg'), 'rb') as image_file:
        image = Image(image_file)

    image.model = "Modified"
    assert image.model == "Modified"

    image.gps_longitude = (12.0, 34.0, 56.789)
    assert str(image.gps_longitude) == Baseline("""(12.0, 34.0, 56.789)""")

    segment_hex = binascii.hexlify(image._segments['APP1'].get_segment_bytes()).decode("utf-8").upper()
    assert '\n'.join(textwrap.wrap(segment_hex, 90)) == LITTLE_ENDIAN_MODIFY_BASELINE 
开发者ID:TNThieding,项目名称:exif,代码行数:15,代码来源:test_little_endian.py

示例6: test_index_modifier

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_index_modifier(self):
        """Test modifying attributes using index syntax."""
        self.image["model"] = "MyCamera"
        self.assertEqual(self.image.model, Baseline("""MyCamera""")) 
开发者ID:TNThieding,项目名称:exif,代码行数:6,代码来源:test_modify_exif.py

示例7: test_modify_ascii_same_len

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_modify_ascii_same_len(self):
        """Verify that writing a same length string to an ASCII tag updates the tag."""
        self.image.model = "MyCamera"
        self.assertEqual(self.image.model, Baseline("""MyCamera"""))

        segment_hex = binascii.hexlify(self.image._segments['APP1'].get_segment_bytes()).decode("utf-8").upper()
        self.assertEqual('\n'.join(textwrap.wrap(segment_hex, 90)),
                         MODIFY_ASCII_SAME_LEN_HEX_BASELINE) 
开发者ID:TNThieding,项目名称:exif,代码行数:10,代码来源:test_modify_exif.py

示例8: test_modify_ascii_to_intra_ifd

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_modify_ascii_to_intra_ifd(self):
        """Verify writing a shorter string that can fit in the IFD tag."""
        self.image.model = "Cam"
        self.assertEqual(self.image.model, Baseline("""Cam"""))

        segment_hex = binascii.hexlify(self.image._segments['APP1'].get_segment_bytes()).decode("utf-8").upper()
        self.assertEqual('\n'.join(textwrap.wrap(segment_hex, 90)),
                         MODIFY_ASCII_TO_INTRA_IFD_BASELINE) 
开发者ID:TNThieding,项目名称:exif,代码行数:10,代码来源:test_modify_exif.py

示例9: test_modify_orientation

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_modify_orientation(self):
        """Verify that modifying the orientation (a short tag) updates the tag value as expected."""
        assert self.image.orientation == 1
        assert repr(self.image.orientation) == Baseline("""<Orientation.TOP_LEFT: 1>""")

        self.image.orientation = 6
        assert self.image.orientation == 6

        segment_hex = binascii.hexlify(self.image._segments['APP1'].get_segment_bytes()).decode("utf-8").upper()
        self.assertEqual('\n'.join(textwrap.wrap(segment_hex, 90)),
                         ROTATED_GRAND_CANYON_HEX) 
开发者ID:TNThieding,项目名称:exif,代码行数:13,代码来源:test_modify_exif.py

示例10: test_modify_rational

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_modify_rational(self):
        """Verify that modifying RATIONAL tags updates the tag values as expected."""
        self.image.gps_altitude = 123.456789
        self.assertEqual(str(self.image.gps_altitude), Baseline("""123.456789"""))
        self.image.gps_latitude = (41.0, 36.0, 33.786)
        self.assertEqual(str(self.image.gps_latitude), Baseline("""(41.0, 36.0, 33.786)"""))

        segment_hex = binascii.hexlify(self.image._segments['APP1'].get_segment_bytes()).decode("utf-8").upper()
        self.assertEqual('\n'.join(textwrap.wrap(segment_hex, 90)),
                         MODIFY_RATIONAL_HEX_BASELINE) 
开发者ID:TNThieding,项目名称:exif,代码行数:12,代码来源:test_modify_exif.py

示例11: test_modify_srational

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_modify_srational(self):
        """Verify that modifying a SRATIONAL tag updates the tag value as expected."""
        self.image.brightness_value = -2.468
        self.assertEqual(str(self.image.brightness_value), Baseline("""-2.468"""))

        segment_hex = binascii.hexlify(self.image._segments['APP1'].get_segment_bytes()).decode("utf-8").upper()
        self.assertEqual('\n'.join(textwrap.wrap(segment_hex, 90)),
                         MODIFY_SRATIONAL_HEX_BASELINE) 
开发者ID:TNThieding,项目名称:exif,代码行数:10,代码来源:test_modify_exif.py

示例12: test_set_method

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_set_method(self):
        """Test behavior when setting tags using the ``set()`` method."""
        self.image.set("model", "MyCamera")
        self.assertEqual(self.image.model, Baseline("""MyCamera""")) 
开发者ID:TNThieding,项目名称:exif,代码行数:6,代码来源:test_modify_exif.py

示例13: test_get_method

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_get_method():
    """Test behavior when accessing tags using the ``get()`` method."""
    with open(os.path.join(os.path.dirname(__file__), 'grand_canyon.jpg'), 'rb') as image_file:
        image = Image(image_file)

    assert image.get('fake_attribute') is None
    assert image.get('light_source', default=-1) == -1  # tag not in image
    assert image.get('make') == Baseline("""Apple""") 
开发者ID:TNThieding,项目名称:exif,代码行数:10,代码来源:test_read_exif.py

示例14: test_index_accessor

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_index_accessor():
    """Test accessing attributes using index syntax."""
    with open(os.path.join(os.path.dirname(__file__), 'grand_canyon.jpg'), 'rb') as image_file:
        image = Image(image_file)

    assert image["datetime"] == Baseline("""2018:03:12 10:12:07""") 
开发者ID:TNThieding,项目名称:exif,代码行数:8,代码来源:test_read_exif.py

示例15: test_modify_ascii_same_len

# 需要导入模块: import baseline [as 别名]
# 或者: from baseline import Baseline [as 别名]
def test_modify_ascii_same_len(self):
        """Verify that writing a same length string to an ASCII tag updates the tag."""
        # pylint: disable=protected-access
        self.image.user_comment = "Updated user comment."
        self.assertEqual(self.image.user_comment, Baseline("""Updated user comment."""))

        segment_hex = binascii.hexlify(self.image._segments['APP1'].get_segment_bytes()).decode("utf-8").upper()
        self.assertEqual('\n'.join(textwrap.wrap(segment_hex, 90)),
                         MODIFY_USER_COMMENT_BASELINE) 
开发者ID:TNThieding,项目名称:exif,代码行数:11,代码来源:test_user_comment.py


注:本文中的baseline.Baseline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。