{ "info": { "author": "Elison M\u00e1rcio Correa", "author_email": "marcioinfo.correa@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Read Positional Files from a config Files:\n\nEasy two-way conversion between Python dictionaries and fixed-width files.\n\nThis module has also proven useful for \"debugging\" a fixed-width spec -- an invalid configuration reports an error that may not be obvious from reading the spec document.\n\nRequires a 'config' dictonary. See unit tests for full example.\n\n\n```CONFIG SAMPLE = {\n \"Tipo_registro\": {\n \"required\": True,\n \"type\": \"integer\",\n \"start_pos\": 1,\n \"end_pos\": 1\n },\n\n \"estabelecimento_matriz\": {\n \"required\": True,\n \"type\": \"integer\",\n \"start_pos\": 2,\n \"end_pos\": 11,\n \"length\": 10,\n },\n\n \"data_processamento\": {\n \"required\": True,\n \"type\": \"integer\",\n \"start_pos\": 12,\n \"end_pos\": 19,\n \"length\": 8,\n\n },\n\n \"Periodo_inicial\": {\n \"type\": \"integer\",\n \"start_pos\": 20,\n \"end_pos\": 27,\n \"length\": 8,\n \"required\": True\n },\n\n \"Periodo_final\": {\n \"type\": \"integer\",\n \"start_pos\": 28,\n \"end_pos\": 35,\n \"length\": 8,\n \"required\": True\n },\n\n \"sequencia\": {\n \"type\": \"integer\",\n \"start_pos\": 36,\n \"end_pos\": 42,\n \"length\": 7,\n \"required\": True\n },\n\n \"empresa_adquirente\": {\n \"required\": True,\n \"type\": \"string\",\n \"start_pos\": 43,\n \"end_pos\": 47,\n \"length\": 5\n },\n\n \"opcao_extrato\": {\n \"required\": True,\n \"type\": \"integer\",\n \"start_pos\": 48,\n \"end_pos\": 49,\n \"length\": 2\n },\n\n \"van\": {\n \"required\": True,\n \"type\": \"string\",\n \"start_pos\": 50,\n \"end_pos\": 50,\n \"length\": 1\n },\n\n \"caixa_postal\": {\n \"required\": False,\n \"type\": \"string\",\n \"start_pos\": 51,\n \"end_pos\": 70,\n \"length\": 20\n },\n\n \"vers\u00e3o_layout\": {\n \"required\": False,\n \"type\": \"integer\",\n \"start_pos\": 71,\n \"end_pos\": 73,\n \"length\": 3\n }\n}\n\n\ndef test_fw_to_dict():\n \"\"\"\n Pass in a line and receive dictionary.\n \"\"\"\n\n fw_config = deepcopy(layouts.TIPO2CONFIG)\n\n fw_obj = FixedWidth(fw_config)\n fw_obj.line = (\"210274391334190626532930******311000020190626+00000000352340103 R64061 79398900000000000001600000000000000000000000000000000000000129000454 00000019177510012466900000010001001 05 \")\n\n values = fw_obj.data\n\n valid = fw_obj.is_valid\n\n\n\n print(values)\n print(valid)\n\n\ntest_fw_to_dict()\n```\n\nNotes:\n\n- A field must have a start_pos and either an end_pos or a length. If both an end_pos and a length are provided, they must not conflict.\n\n- A field may not have a default value if it is required.\n\n- Supported types are string, integer, and decimal.\n\nLicense: BSD", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/marcioinfo/PositionalFilesReader", "keywords": "Edi Parse", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "readEdi", "package_url": "https://pypi.org/project/readEdi/", "platform": "", "project_url": "https://pypi.org/project/readEdi/", "project_urls": { "Homepage": "https://github.com/marcioinfo/PositionalFilesReader" }, "release_url": "https://pypi.org/project/readEdi/1.2/", "requires_dist": null, "requires_python": "", "summary": "Two-way fixed-width <--> Python dict converter.", "version": "1.2" }, "last_serial": 5771854, "releases": { "1.2": [ { "comment_text": "", "digests": { "md5": "802b564dcb899cf913ab6a57d2b24023", "sha256": "b2669f357be49e161e2ffa9ea9d7428888b7b049d5c2fb7f8947d3a95e39c5ee" }, "downloads": -1, "filename": "readEdi-1.2.tar.gz", "has_sig": false, "md5_digest": "802b564dcb899cf913ab6a57d2b24023", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2328, "upload_time": "2019-09-02T17:03:27", "url": "https://files.pythonhosted.org/packages/ef/9a/8c87cc74a70869000e275892b5004b96db1430f81d2a7d920d159f3024ba/readEdi-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "802b564dcb899cf913ab6a57d2b24023", "sha256": "b2669f357be49e161e2ffa9ea9d7428888b7b049d5c2fb7f8947d3a95e39c5ee" }, "downloads": -1, "filename": "readEdi-1.2.tar.gz", "has_sig": false, "md5_digest": "802b564dcb899cf913ab6a57d2b24023", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2328, "upload_time": "2019-09-02T17:03:27", "url": "https://files.pythonhosted.org/packages/ef/9a/8c87cc74a70869000e275892b5004b96db1430f81d2a7d920d159f3024ba/readEdi-1.2.tar.gz" } ] }