comentarios, se remueve requirements_dev.txt
FossilOrigin-Name: 22450fbe7fb9f02c4723c2820d9b7bc3e0d7018a4cb900bdc4f6867e4550951f
This commit is contained in:
		@@ -79,20 +79,17 @@ class FeXML(FachoXML):
 | 
				
			|||||||
        super().__init__("{%s}%s" % (namespace, root),
 | 
					        super().__init__("{%s}%s" % (namespace, root),
 | 
				
			||||||
                         nsmap=NAMESPACES)
 | 
					                         nsmap=NAMESPACES)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self._cn = root.rstrip('/')
 | 
					 | 
				
			||||||
        #self.find_or_create_element(self._cn)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @classmethod
 | 
					    @classmethod
 | 
				
			||||||
    def from_string(cls, document: str) -> 'FeXML':
 | 
					    def from_string(cls, document: str) -> 'FeXML':
 | 
				
			||||||
        return super().from_string(document, namespaces=NAMESPACES)
 | 
					        return super().from_string(document, namespaces=NAMESPACES)
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    def tostring(self, **kw):
 | 
					    def tostring(self, **kw):
 | 
				
			||||||
 | 
					        # MACHETE(bit4bit) la DIAN espera que la etiqueta raiz no este en un namespace
 | 
				
			||||||
        return super().tostring(**kw)\
 | 
					        return super().tostring(**kw)\
 | 
				
			||||||
            .replace("fe:", "")\
 | 
					            .replace("fe:", "")\
 | 
				
			||||||
            .replace("xmlns:fe", "xmlns")
 | 
					            .replace("xmlns:fe", "xmlns")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
class DianXMLExtensionCUDFE(FachoXMLExtension):
 | 
					class DianXMLExtensionCUDFE(FachoXMLExtension):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __init__(self, invoice, tipo_ambiente = AMBIENTE_PRUEBAS):
 | 
					    def __init__(self, invoice, tipo_ambiente = AMBIENTE_PRUEBAS):
 | 
				
			||||||
@@ -463,10 +460,18 @@ class DianZIP:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return filename
 | 
					        return filename
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # DEPRECATED usar add_xml
 | 
				
			||||||
    def add_invoice_xml(self, name, xml_data):
 | 
					    def add_invoice_xml(self, name, xml_data):
 | 
				
			||||||
        return self.add_xml(name, xml_data)
 | 
					        return self.add_xml(name, xml_data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __enter__(self):
 | 
					    def __enter__(self):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Facilita el uso de esta manera:
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        f = open('xxx', 'rb')
 | 
				
			||||||
 | 
					        with DianZIP(f) as zip:
 | 
				
			||||||
 | 
					          zip.add_invoice_xml('name', 'data xml')
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
        return self
 | 
					        return self
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def __exit__(self, type, value, traceback):
 | 
					    def __exit__(self, type, value, traceback):
 | 
				
			||||||
@@ -483,24 +488,25 @@ class DianXMLExtensionSignerVerifier:
 | 
				
			|||||||
            self._passphrase = passphrase.encode('utf-8')
 | 
					            self._passphrase = passphrase.encode('utf-8')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def verify_string(self, document):
 | 
					    def verify_string(self, document):
 | 
				
			||||||
 | 
					        # Obtener FachoXML
 | 
				
			||||||
        xml = LXMLBuilder.from_string(document)
 | 
					        xml = LXMLBuilder.from_string(document)
 | 
				
			||||||
        fachoxml = FachoXML(xml,nsmap=NAMESPACES)
 | 
					        fachoxml = FachoXML(xml,nsmap=NAMESPACES)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Obtener Signature
 | 
				
			||||||
        signature = fachoxml.builder.xpath(fachoxml.root, '//ds:Signature')
 | 
					        signature = fachoxml.builder.xpath(fachoxml.root, '//ds:Signature')
 | 
				
			||||||
        assert signature is not None
 | 
					        assert signature is not None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # Se mueve Signature a elemento raiz para realizar verificaion
 | 
				
			||||||
        signature.getparent().remove(signature)
 | 
					        signature.getparent().remove(signature)
 | 
				
			||||||
        fachoxml.root.append(signature)
 | 
					        fachoxml.root.append(signature)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ctx = xades.XAdESContext()
 | 
					        # Verificar archivo usando Signature
 | 
				
			||||||
 | 
					 | 
				
			||||||
        pkcs12_data = self._pkcs12_path_or_bytes
 | 
					        pkcs12_data = self._pkcs12_path_or_bytes
 | 
				
			||||||
        if isinstance(self._pkcs12_path_or_bytes, str):
 | 
					        if isinstance(self._pkcs12_path_or_bytes, str):
 | 
				
			||||||
            pkcs12_data = open(self._pkcs12_path_or_bytes, 'rb').read()
 | 
					            pkcs12_data = open(self._pkcs12_path_or_bytes, 'rb').read()
 | 
				
			||||||
 | 
					        ctx = xades.XAdESContext()
 | 
				
			||||||
        ctx.load_pkcs12(OpenSSL.crypto.load_pkcs12(pkcs12_data,
 | 
					        ctx.load_pkcs12(OpenSSL.crypto.load_pkcs12(pkcs12_data,
 | 
				
			||||||
                                                   self._passphrase))
 | 
					                                                   self._passphrase))
 | 
				
			||||||
 | 
					 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            if self._mockpolicy:
 | 
					            if self._mockpolicy:
 | 
				
			||||||
                with mock_xades_policy():
 | 
					                with mock_xades_policy():
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,13 +0,0 @@
 | 
				
			|||||||
pip==18.1
 | 
					 | 
				
			||||||
bumpversion==0.5.3
 | 
					 | 
				
			||||||
wheel==0.32.1
 | 
					 | 
				
			||||||
watchdog==0.9.0
 | 
					 | 
				
			||||||
flake8==3.5.0
 | 
					 | 
				
			||||||
tox==3.5.2
 | 
					 | 
				
			||||||
coverage==4.5.1
 | 
					 | 
				
			||||||
Sphinx==1.8.1
 | 
					 | 
				
			||||||
twine==1.12.1
 | 
					 | 
				
			||||||
xmlsec==1.3.8
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
pytest==3.8.2
 | 
					 | 
				
			||||||
pytest-runner==4.2
 | 
					 | 
				
			||||||
							
								
								
									
										3
									
								
								setup.py
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								setup.py
									
									
									
									
									
								
							@@ -20,13 +20,12 @@ requirements = ['Click>=6.0',
 | 
				
			|||||||
                'pyOpenSSL==20.0.1',
 | 
					                'pyOpenSSL==20.0.1',
 | 
				
			||||||
                'xmlsig==0.1.7',
 | 
					                'xmlsig==0.1.7',
 | 
				
			||||||
                'xades==0.2.2',
 | 
					                'xades==0.2.2',
 | 
				
			||||||
                'mock>=2.0.0',
 | 
					 | 
				
			||||||
                'xmlsec==1.3.12',
 | 
					                'xmlsec==1.3.12',
 | 
				
			||||||
                'xmlschema>=1.8']
 | 
					                'xmlschema>=1.8']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
setup_requirements = ['pytest-runner', ]
 | 
					setup_requirements = ['pytest-runner', ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
test_requirements = ['pytest', ]
 | 
					test_requirements = ['pytest', 'mock>=2.0.0']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
setup(
 | 
					setup(
 | 
				
			||||||
    author="Jovany Leandro G.C",
 | 
					    author="Jovany Leandro G.C",
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user