<div dir="ltr"><div>Hola,</div><div><br></div><div>En mi opinión, el comportamiento que tiene el IDE me parece el correcto. La función create_random_user espera una instancia de IUserRepository (que hereda de IRepository), pero le estás entregando una instancia de IRepository. Como IUserRepository es quien hereda de IRepository, se puede esperar que IUserRepository incluya métodos u otras cosas que la clase base (IRepository) no contiene, de ahí el warning.</div><div><br></div><div>Si fuese al revés (create_random_user espera instancia de la clase base IRepository y le entregas instancia de cualquier otra clase que hereda de IRepository) sí que no debería dar warning.</div><div>Podrías crear un tipo con Union que incluya todas las clases que se le pueden entregar a la función como parámetro. Igual hay alguna otra solución que yo desconozca.</div><div><br></div><div>Saludos.<br></div><div><br></div><div><br></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">El mié, 9 dic 2020 a las 2:47, Artur Costa (<<a href="mailto:acosta@alicebiometrics.com">acosta@alicebiometrics.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hola,<div><br></div><div>Primer mensaje a la lista, así que... encantado :)</div><div><br></div><div>Disclaimer, si este no es el canal para compartir estas dudas y es mejor el slack por ejemplo, disculpad.</div><div><br></div><div>Bueno, al lío. Uso el PyCharm como IDE y desde hace un tiempo me muestra un warning que mete un poco de ruido en los constructores semánticos con los que trabajo.</div><div><br></div><div><div><img src="cid:ii_ki5qcb5e0" alt="pycharm_warning.png" width="542" height="130"><br></div></div><div><br></div><div>Parece que es un tema de que PyCharm no es capaz de resolver una herencia doble. He creado un snippet rápido en github como ejemplo</div><div><br></div><div><a href="https://github.com/acostapazo/typing-inheritance-example" target="_blank">https://github.com/acostapazo/typing-inheritance-example</a><br></div><div><br></div><div>He buscado acerca del tema, pero quizás no estoy enfocando bien el tiro. Entiendo que es una limitación del IDE, pero no lo tengo claro. ¿Alguna recomendación de por dónde tirar? ¿Desactivo ese warning en PyCharm y me voy a descansar?</div><div><br></div><div>Un saludo,</div><div>Artur<br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><img src="https://lh5.googleusercontent.com/YFMV_g1g7ZPdll3RrQkXkOUxVOc2CFWWdBD85Qxrs7_SOBO17IBXWi3bZQhNHATr-U-GQVd8CZD0XvnwK0cLaHI1c_0TXwwgalpzY7UCZIzD5Nf5ZsZRBlv-0SW_T4ePZqEK9UYW" style="border: medium none; --darkreader-inline-border-top:currentcolor; --darkreader-inline-border-right:currentcolor; --darkreader-inline-border-bottom:currentcolor; --darkreader-inline-border-left:currentcolor;" width="267" height="80"></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:10pt;font-family:Arial;color:rgb(0,0,255);background-color:transparent;font-weight:700;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Artur Costa Pazo</span></p><p style="line-height:1.84896;margin-top:0pt;margin-bottom:0pt"><font style="--darkreader-inline-color:#e8e6e3;" face="Arial" color="#000000"><span style="font-size:12px;white-space:pre-wrap">Engineering Manager</span></font></p><p dir="ltr" style="line-height:1.84896;margin-top:0pt;margin-bottom:0pt"><span style="font-size:9pt;font-family:Arial;color:rgb(0,0,255);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Ph.</span><span style="font-size:9pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"> (+34) 986 120 430</span><span style="font-size:9pt;font-family:Arial;color:rgb(0,0,255);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"> Ext</span><span style="font-size:9pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">. 3020</span></p><p dir="ltr" style="line-height:1.44;margin-top:0pt;margin-bottom:8pt"><span style="font-size:9.5pt;font-family:Arial;color:rgb(17,85,204);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"><a href="mailto:acosta@alicebiometrics.com" target="_blank">acosta@alicebiometrics.com</a></span><span style="font-size:11pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"> </span><span style="font-size:9pt;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"> |  </span><a href="https://www.alicebiometrics.com/" style="text-decoration:none" target="_blank"><span style="font-size:9.5pt;font-family:Arial;color:rgb(17,85,204);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">www.alicebiometrics.com</span></a></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:7pt;font-family:Arial;color:rgb(166,166,166);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">Take care of the environment. Try not to print this email.</span></p><p dir="ltr" style="font-size:12.8px;line-height:1.5408;margin-top:0pt;margin-bottom:0pt"><span></span></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-size:7pt;font-family:Arial;color:rgb(166,166,166);background-color:transparent;font-weight:400;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">The information contained in this email message may be confidential information, and may also be the subject of legal professional privilege. If you are not the intended recipient, any use, interference with, disclosure or copying of this material is unauthorized and prohibited. Please inform us immediately and destroy the email. Thank you for your cooperation.</span></p></div></div></div></div></div></div></div></div></div>
_______________________________________________<br>
Asociación Python España: <a href="https://www.es.python.org/" rel="noreferrer" target="_blank">https://www.es.python.org/</a><br>
Python Vigo: <a href="https://www.python-vigo.es/" rel="noreferrer" target="_blank">https://www.python-vigo.es/</a><br>
Vigo mailing list<br>
<a href="mailto:Vigo@lists.es.python.org" target="_blank">Vigo@lists.es.python.org</a><br>
<a href="https://lists.es.python.org/listinfo/vigo" rel="noreferrer" target="_blank">https://lists.es.python.org/listinfo/vigo</a><br>
</blockquote></div></div>