Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osmaxx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ifs
geometalab
osmaxx
Commits
4ec711de
Commit
4ec711de
authored
8 years ago
by
Raphael Das Gupta
Browse files
Options
Downloads
Patches
Plain Diff
refactoring: base OutputFormat on namedtuple
parent
2e32b907
No related branches found
No related tags found
1 merge request
!835
refactoring: base OutputFormat on namedtuple
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
osmaxx/conversion_api/formats.py
+14
-31
14 additions, 31 deletions
osmaxx/conversion_api/formats.py
with
14 additions
and
31 deletions
osmaxx/conversion_api/formats.py
+
14
−
31
View file @
4ec711de
import
uuid
from
collections
import
OrderedDict
from
collections
import
OrderedDict
,
namedtuple
from
django.utils.translation
import
gettext
as
_
FGDB
,
SHAPEFILE
,
GPKG
,
SPATIALITE
,
GARMIN
,
PBF
=
'
fgdb
'
,
'
shapefile
'
,
'
gpkg
'
,
'
spatialite
'
,
'
garmin
'
,
'
pbf
'
class
OutputFormat
:
def
__init__
(
self
,
*
,
long_identifier
,
verbose_name
,
archive_file_name_identifier
,
abbreviations
,
is_white_box
,
layer_filename_extension
=
None
):
self
.
_long_identifier
=
long_identifier
self
.
_verbose_name
=
verbose_name
self
.
_archive_file_name_identifier
=
archive_file_name_identifier
self
.
_abbreviations
=
abbreviations
self
.
_is_white_box
=
is_white_box
self
.
_layer_filename_extension
=
layer_filename_extension
_OutputFormatBase
=
namedtuple
(
'
OutputFormatBase
'
,
[
'
long_identifier
'
,
'
verbose_name
'
,
'
archive_file_name_identifier
'
,
'
abbreviations
'
,
'
is_white_box
'
,
'
layer_filename_extension
'
,
]
)
_OutputFormatBase
.
__new__
.
__defaults__
=
(
None
,)
# This makes the last field (i.e. layer_filename_extension) optional.
@property
def
long_identifier
(
self
):
return
self
.
_long_identifier
@property
def
verbose_name
(
self
):
return
self
.
_verbose_name
@property
def
archive_file_name_identifier
(
self
):
return
self
.
_archive_file_name_identifier
@property
def
abbreviations
(
self
):
return
self
.
_abbreviations
@property
def
layer_filename_extension
(
self
):
return
self
.
_layer_filename_extension
class
OutputFormat
(
_OutputFormatBase
):
@property
def
qgis_datasource_separator
(
self
):
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment