gnuradio / gnuradio

GNU Radio – the Free and Open Software Radio Ecosystem
https://gnuradio.org
GNU General Public License v3.0
5.02k stars 1.9k forks source link

python: replace star imports in python modules #1466

Open noc0lour opened 6 years ago

noc0lour commented 6 years ago

In some submodules (e.g. analog) __init__.py has a lot of star imports to submodules which makes tracing the called function hard. Clashing function names in the submodule can also occur without noticing it.

Replacing star imports with named imports in __init__.py would make clean which functions are intended to be in the top-level package.

mbr0wn commented 6 years ago

We should, in general, aim for a high PyLint score. It would flag star imports. Could we somehow integrate this into BuildBot?

noc0lour commented 6 years ago
Raw metrics
-----------

+----------+-------+------+---------+-----------+
|type      |number |%     |previous |difference |
+==========+=======+======+=========+===========+
|code      |123787 |44.38 |NC       |NC         |
+----------+-------+------+---------+-----------+
|docstring |63092  |22.62 |NC       |NC         |
+----------+-------+------+---------+-----------+
|comment   |5975   |2.14  |NC       |NC         |
+----------+-------+------+---------+-----------+
|empty     |86058  |30.85 |NC       |NC         |
+----------+-------+------+---------+-----------+

Duplication
-----------

+-------------------------+------+---------+-----------+
|                         |now   |previous |difference |
+=========================+======+=========+===========+
|nb duplicated lines      |11326 |NC       |NC         |
+-------------------------+------+---------+-----------+
|percent duplicated lines |4.064 |NC       |NC         |
+-------------------------+------+---------+-----------+

Messages by category
--------------------

+-----------+-------+---------+-----------+
|type       |number |previous |difference |
+===========+=======+=========+===========+
|convention |24826  |NC       |NC         |
+-----------+-------+---------+-----------+
|refactor   |2262   |NC       |NC         |
+-----------+-------+---------+-----------+
|warning    |12576  |NC       |NC         |
+-----------+-------+---------+-----------+
|error      |45434  |NC       |NC         |
+-----------+-------+---------+-----------+

% errors / warnings by module
-----------------------------

+-------------------------------------------------+------+--------+---------+-----------+
|module                                           |error |warning |refactor |convention |
+=================================================+======+========+=========+===========+
|gnuradio.filter.filter_swig                      |7.98  |1.69    |5.17     |4.25       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.dtv.dtv_swig                            |7.83  |1.69    |8.58     |4.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.blocks_swig3                     |7.03  |1.53    |5.08     |2.80       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.blocks_swig2                     |6.74  |1.50    |5.44     |2.34       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.analog_swig                      |6.71  |1.65    |3.98     |2.56       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.trellis.trellis_swig1                   |6.69  |1.30    |6.90     |9.85       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.blocks_swig5                     |6.21  |1.64    |5.08     |2.51       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.digital_swig0                   |5.41  |1.65    |4.95     |3.98       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.blocks_swig1                     |5.33  |1.15    |3.49     |2.18       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.blocks_swig4                     |4.82  |1.13    |3.45     |1.89       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.trellis.trellis_swig0                   |4.74  |1.15    |4.91     |4.80       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.qtgui_swig                        |4.49  |1.14    |3.40     |2.15       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.digital_swig1                   |3.88  |0.87    |2.52     |1.85       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.blocks_swig0                     |3.43  |0.79    |2.21     |1.35       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.digital_swig2                   |3.12  |1.10    |2.48     |1.91       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.fec_swig                            |2.64  |0.82    |3.18     |1.74       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.runtime_swig                         |2.35  |0.60    |1.64     |2.60       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.pyqt_filter_stacked              |2.29  |2.32    |0.13     |2.30       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.uhd.uhd_swig                            |1.87  |0.42    |1.37     |1.68       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.zeromq.zeromq_swig                      |1.73  |0.42    |2.39     |0.70       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.filter_design                    |0.88  |0.72    |0.49     |2.66       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.pyqt_filter                             |0.63  |0.80    |0.13     |0.65       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fft.fft_swig                            |0.63  |0.28    |1.50     |0.25       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.pyqt_plot                               |0.31  |0.42    |0.09     |0.33       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.audio.audio_swig                        |0.29  |0.10    |0.27     |0.17       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.polezero_plot                    |0.23  |0.33    |0.27     |0.62       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.banditems                        |0.15  |0.12    |0.49     |1.10       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fcd.fcd_swig                            |0.13  |0.07    |7.12     |0.12       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_form                         |0.11  |0.35    |0.13     |0.21       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Actions                         |0.11  |0.03    |0.18     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.PropsDialog                     |0.09  |0.11    |0.09     |0.05       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Dialogs                         |0.08  |0.04    |0.27     |0.14       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.VariableEditor                  |0.07  |0.14    |0.22     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Bars                            |0.07  |0.02    |0.09     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Param                           |0.07  |0.10    |0.04     |0.14       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.idealbanditems                   |0.06  |0.02    |0.04     |0.68       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.MainWindow                      |0.05  |0.11    |0.22     |0.12       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.FileDialogs                     |0.05  |0.08    |0.04     |0.12       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.uhd.uhd_app                             |0.04  |0.03    |0.18     |0.22       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_spectrogram_form             |0.04  |0.14    |0.04     |0.07       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.fir_design                       |0.04  |0.13    |0.13     |1.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.range                             |0.04  |0.02    |0.31     |0.16       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_time_raster_form             |0.04  |0.12    |0.04     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.BlockTreeWindow                 |0.03  |0.10    |0.09     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.NotebookPage                    |0.03  |0.05    |0.04     |0.05       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.ParserErrorsDialog              |0.03  |0.01    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.ActionHandler                   |0.03  |0.68    |0.27     |0.27       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.polar.helper_functions              |0.03  |0.02    |0.00     |0.21       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.ParseXML                       |0.03  |0.02    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_psd_form                     |0.02  |0.13    |0.00     |0.05       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.Constants                      |0.02  |0.00    |0.13     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.polar.channel_construction_awgn     |0.02  |0.14    |0.00     |0.28       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.ofdm_txrx                       |0.01  |0.04    |0.31     |0.94       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.pfb                              |0.01  |0.03    |0.13     |0.31       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.DrawingArea                     |0.01  |0.20    |0.09     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.uhd.__init__                            |0.01  |0.10    |0.04     |0.19       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.freqz                               |0.01  |4.60    |0.13     |0.21       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_time_raster_base             |0.01  |0.33    |0.09     |0.17       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_time_base                    |0.01  |0.32    |0.09     |0.18       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.fm_emph                          |0.01  |0.16    |0.04     |0.11       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Block                           |0.01  |0.11    |0.09     |0.28       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.FlowGraph                       |0.01  |0.07    |0.27     |0.33       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_time_form                    |0.01  |0.06    |0.00     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_spectrogram_base             |0.01  |0.33    |0.09     |0.14       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_psd_base                     |0.01  |0.33    |0.09     |0.15       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.polar.channel_construction          |0.01  |0.19    |0.00     |0.09       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.gr_threading_24                      |0.01  |0.12    |0.35     |0.38       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.gr_threading_23                      |0.01  |0.11    |0.31     |0.38       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_constellation_form           |0.01  |0.09    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.soft_dec_lut_gen                |0.01  |0.02    |0.04     |0.10       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.main                                |0.01  |0.02    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.bandgraphicsview                 |0.01  |0.01    |0.04     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Platform                        |0.01  |0.01    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.LDPC.Generate_LDPC_matrix_functions |0.00  |8.06    |0.40     |1.28       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.plot_base                         |0.00  |0.26    |0.04     |0.18       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.extended_decoder                    |0.00  |0.19    |0.13     |0.10       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.extended_tagged_decoder             |0.00  |0.17    |0.18     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.gateway                              |0.00  |0.14    |0.22     |0.25       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.zeromq.rpc_manager                      |0.00  |0.04    |0.04     |0.07       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Element                         |0.00  |0.02    |0.13     |0.22       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.tag_utils                            |0.00  |0.02    |0.13     |0.13       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.grc_xml_generator               |0.00  |0.01    |0.09     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.zeromq.probe_manager                    |0.00  |0.01    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.icons_rc                         |0.00  |0.00    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.plot_fft_base                           |0.00  |7.55    |0.13     |0.21       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.plot_psd_base                           |0.00  |7.55    |0.04     |0.26       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.plot_data                               |0.00  |7.52    |0.04     |0.12       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Constants                       |0.00  |0.56    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.modtool_help                    |0.00  |0.22    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.trellis.fsm_utils                       |0.00  |0.10    |0.09     |0.81       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Port                            |0.00  |0.08    |0.04     |0.16       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.bpsk                            |0.00  |0.06    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.ofdm_sync_ml                    |0.00  |0.05    |0.13     |0.25       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.bercurve_generator                  |0.00  |0.04    |0.09     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.api_object                       |0.00  |0.03    |0.00     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.util                              |0.00  |0.02    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.freq_xlating_fft_filter          |0.00  |0.01    |0.04     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.blocks_swig                      |0.00  |9.26    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.LDPC.Generate_LDPC_matrix           |0.00  |4.74    |0.00     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.digital_swig                    |0.00  |3.93    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.trellis.trellis_swig                    |0.00  |2.76    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.__init__                             |0.00  |0.49    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.__init__                        |0.00  |0.40    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.templates                       |0.00  |0.33    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.__init__                            |0.00  |0.32    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.Block                          |0.00  |0.30    |0.31     |0.31       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.pubsub                               |0.00  |0.29    |0.04     |0.14       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.parser_cc_block                 |0.00  |0.28    |0.18     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.Param                          |0.00  |0.25    |0.40     |0.27       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.bitflip                             |0.00  |0.25    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.FlowGraph                      |0.00  |0.22    |0.31     |0.13       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.wfm_rcv_pll                      |0.00  |0.21    |0.04     |0.18       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.wfm_rcv_fmdet                    |0.00  |0.21    |0.04     |0.15       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.gr_threading                         |0.00  |0.21    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.gfsk                            |0.00  |0.20    |0.18     |0.21       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.gmsk                            |0.00  |0.20    |0.13     |0.20       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.__init__                         |0.00  |0.20    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Connection                      |0.00  |0.18    |0.09     |0.15       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.LDPC.__init__                       |0.00  |0.17    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.capillary_threaded_encoder          |0.00  |0.17    |0.04     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.generator.Generator            |0.00  |0.15    |0.09     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.modtool_rm                      |0.00  |0.14    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.modtool_disable                 |0.00  |0.14    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.daemon                              |0.00  |0.14    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.__init__                            |0.00  |0.14    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.__init__                        |0.00  |0.13    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.ofdm                            |0.00  |0.11    |0.35     |0.18       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.modtool_rename                  |0.00  |0.11    |0.04     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.cpm                             |0.00  |0.10    |0.09     |0.28       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fft.logpwrfft                           |0.00  |0.10    |0.04     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.__init__                         |0.00  |0.10    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.Port                           |0.00  |0.10    |0.13     |0.11       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.qam                             |0.00  |0.09    |0.09     |0.19       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.qam_constellations              |0.00  |0.09    |0.00     |0.43       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.cmakefile_editor                |0.00  |0.09    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr_xmlrunner                            |0.00  |0.08    |0.40     |0.11       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.ofdm_receiver                   |0.00  |0.07    |0.22     |0.21       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.modtool_add                     |0.00  |0.07    |0.04     |0.18       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.dtv.atsc_rx                             |0.00  |0.07    |0.04     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.standard_squelch                 |0.00  |0.06    |0.09     |0.16       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.modtool_base                    |0.00  |0.06    |0.09     |0.11       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.Platform                       |0.00  |0.06    |0.09     |0.10       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.am_demod                         |0.00  |0.06    |0.00     |0.05       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.hexint                              |0.00  |0.06    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.pkt                             |0.00  |0.06    |0.09     |0.09       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.nbfm_tx                          |0.00  |0.06    |0.04     |0.05       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.code_generator                  |0.00  |0.06    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.extended_encoder                    |0.00  |0.06    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.dtv.__init__                            |0.00  |0.06    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.generic_mod_demod               |0.00  |0.05    |0.31     |0.13       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr_unittest                             |0.00  |0.05    |0.13     |0.22       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.packet_utils                    |0.00  |0.05    |0.09     |7.31       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.ofdm_sync_pnac                  |0.00  |0.05    |0.04     |0.14       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.ofdm_sync_pn                    |0.00  |0.05    |0.04     |0.11       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.utils.complexity               |0.00  |0.05    |0.04     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Preferences                     |0.00  |0.05    |0.00     |0.12       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.psk                             |0.00  |0.05    |0.00     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.utils.expr_utils               |0.00  |0.05    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.__init__                         |0.00  |0.05    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.modtool_newmod                  |0.00  |0.05    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.nbfm_rx                          |0.00  |0.05    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.zeromq.__init__                         |0.00  |0.05    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.qtgui.__init__                          |0.00  |0.05    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.modtool_info                    |0.00  |0.04    |0.09     |0.05       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.wfm_tx                           |0.00  |0.04    |0.04     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.top_block                            |0.00  |0.04    |0.04     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.modtool_makexml                 |0.00  |0.04    |0.00     |0.05       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.extended_tagged_encoder             |0.00  |0.04    |0.00     |0.05       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.wfm_rcv                          |0.00  |0.04    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.utils.extract_docs             |0.00  |0.04    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.optfir                           |0.00  |0.03    |0.53     |0.54       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.qpsk                            |0.00  |0.03    |0.09     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.ofdm_packet_utils               |0.00  |0.03    |0.04     |7.29       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.polar.channel_construction_bec      |0.00  |0.03    |0.04     |0.16       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.rational_resampler               |0.00  |0.03    |0.04     |0.07       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.eng_option                              |0.00  |0.03    |0.00     |0.07       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.filter.filterbank                       |0.00  |0.03    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.dtv.atsc_rx_filter                      |0.00  |0.03    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.generator.FlowGraphProxy       |0.00  |0.03    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fcd.__init__                            |0.00  |0.03    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.trellis.__init__                        |0.00  |0.03    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fft.__init__                            |0.00  |0.03    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.audio.__init__                          |0.00  |0.03    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.utils.__init__                 |0.00  |0.03    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.fec_test                            |0.00  |0.02    |0.09     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.polar.__init__                      |0.00  |0.02    |0.04     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.analog.fm_demod                         |0.00  |0.02    |0.04     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.psk_constellations              |0.00  |0.02    |0.00     |0.21       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.seq_with_cursor                     |0.00  |0.02    |0.00     |0.11       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.modulation_utils                |0.00  |0.02    |0.00     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.Connection                     |0.00  |0.02    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.extended_async_encoder              |0.00  |0.02    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.utils.odict                    |0.00  |0.02    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.uhd.uhd_siggen_base                     |0.00  |0.02    |0.18     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.qamlike                         |0.00  |0.02    |0.09     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Utils                           |0.00  |0.02    |0.04     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.capillary_threaded_decoder          |0.00  |0.02    |0.04     |0.08       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.msgq_runner                         |0.00  |0.02    |0.04     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.gnuplot_freqz                       |0.00  |0.02    |0.00     |0.12       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.Messages                       |0.00  |0.02    |0.00     |0.10       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Executor                        |0.00  |0.02    |0.00     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.threaded_encoder                    |0.00  |0.02    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Config                          |0.00  |0.02    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.hier_block2                          |0.00  |0.02    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.StateCache                      |0.00  |0.02    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.stream_to_vector_decimator       |0.00  |0.02    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.blocks.parse_file_metadata              |0.00  |0.01    |0.13     |0.15       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.utils.alignment                 |0.00  |0.01    |0.13     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.Element                        |0.00  |0.01    |0.13     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.scm                             |0.00  |0.01    |0.09     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.external_editor                 |0.00  |0.01    |0.04     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.eng_notation                            |0.00  |0.01    |0.04     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.utils.epy_block_io             |0.00  |0.01    |0.04     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.crc                             |0.00  |0.01    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.fec.threaded_decoder                    |0.00  |0.01    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.Colors                          |0.00  |0.01    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.generator.__init__             |0.00  |0.01    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.ofdm_sync_fixed                 |0.00  |0.00    |0.04     |0.06       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.utils.tagged_streams            |0.00  |0.00    |0.00     |0.09       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gr.packet_utils                         |0.00  |0.00    |0.00     |0.07       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.mathmisc                            |0.00  |0.00    |0.00     |0.05       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.utils.mod_codes                 |0.00  |0.00    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.utils.gray_code                 |0.00  |0.00    |0.00     |0.04       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio                                         |0.00  |0.00    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.socket_stuff                        |0.00  |0.00    |0.00     |0.03       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.utils.__init__                  |0.00  |0.00    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.digital.constellation_map_generator     |0.00  |0.00    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.modtool.util_functions                  |0.00  |0.00    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.os_read_exactly                     |0.00  |0.00    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.gru.listmisc                            |0.00  |0.00    |0.00     |0.02       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.Config                         |0.00  |0.00    |0.00     |0.01       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.gui.__init__                        |0.00  |0.00    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.core.__init__                       |0.00  |0.00    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.grc.__main__                            |0.00  |0.00    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+
|gnuradio.eng_arg                                 |0.00  |0.00    |0.00     |0.00       |
+-------------------------------------------------+------+--------+---------+-----------+

Messages
--------

+--------------------------------+------------+
|message id                      |occurrences |
+================================+============+
|no-member                       |44746       |
+--------------------------------+------------+
|invalid-name                    |10002       |
+--------------------------------+------------+
|line-too-long                   |6726        |
+--------------------------------+------------+
|unused-wildcard-import          |6642        |
+--------------------------------+------------+
|bad-whitespace                  |4788        |
+--------------------------------+------------+
|unused-argument                 |1228        |
+--------------------------------+------------+
|missing-docstring               |1153        |
+--------------------------------+------------+
|bad-continuation                |1053        |
+--------------------------------+------------+
|broad-except                    |707         |
+--------------------------------+------------+
|unnecessary-semicolon           |695         |
+--------------------------------+------------+
|access-member-before-definition |652         |
+--------------------------------+------------+
|no-staticmethod-decorator       |649         |
+--------------------------------+------------+
|too-many-public-methods         |599         |
+--------------------------------+------------+
|attribute-defined-outside-init  |582         |
+--------------------------------+------------+
|bad-indentation                 |566         |
+--------------------------------+------------+
|redefined-builtin               |559         |
+--------------------------------+------------+
|superfluous-parens              |468         |
+--------------------------------+------------+
|relative-import                 |377         |
+--------------------------------+------------+
|too-many-arguments              |341         |
+--------------------------------+------------+
|too-few-public-methods          |265         |
+--------------------------------+------------+
|trailing-whitespace             |189         |
+--------------------------------+------------+
|mixed-indentation               |173         |
+--------------------------------+------------+
|duplicate-code                  |159         |
+--------------------------------+------------+
|wildcard-import                 |140         |
+--------------------------------+------------+
|redefined-outer-name            |136         |
+--------------------------------+------------+
|anomalous-backslash-in-string   |129         |
+--------------------------------+------------+
|multiple-statements             |118         |
+--------------------------------+------------+
|protected-access                |108         |
+--------------------------------+------------+
|unused-variable                 |102         |
+--------------------------------+------------+
|unused-import                   |91          |
+--------------------------------+------------+
|super-init-not-called           |82          |
+--------------------------------+------------+
|deprecated-lambda               |81          |
+--------------------------------+------------+
|wrong-import-position           |71          |
+--------------------------------+------------+
|trailing-newlines               |64          |
+--------------------------------+------------+
|wrong-import-order              |61          |
+--------------------------------+------------+
|too-many-instance-attributes    |56          |
+--------------------------------+------------+
|too-many-locals                 |50          |
+--------------------------------+------------+
|bare-except                     |49          |
+--------------------------------+------------+
|no-self-use                     |48          |
+--------------------------------+------------+
|too-many-branches               |28          |
+--------------------------------+------------+
|too-many-statements             |26          |
+--------------------------------+------------+
|redefined-variable-type         |26          |
+--------------------------------+------------+
|fixme                           |25          |
+--------------------------------+------------+
|ungrouped-imports               |23          |
+--------------------------------+------------+
|too-many-lines                  |23          |
+--------------------------------+------------+
|unidiomatic-typecheck           |20          |
+--------------------------------+------------+
|consider-using-enumerate        |19          |
+--------------------------------+------------+
|undefined-loop-variable         |15          |
+--------------------------------+------------+
|multiple-imports                |15          |
+--------------------------------+------------+
|undefined-variable              |14          |
+--------------------------------+------------+
|using-constant-test             |13          |
+--------------------------------+------------+
|singleton-comparison            |11          |
+--------------------------------+------------+
|old-style-class                 |11          |
+--------------------------------+------------+
|pointless-string-statement      |9           |
+--------------------------------+------------+
|global-statement                |9           |
+--------------------------------+------------+
|function-redefined              |9           |
+--------------------------------+------------+
|eval-used                       |9           |
+--------------------------------+------------+
|abstract-method                 |9           |
+--------------------------------+------------+
|dangerous-default-value         |7           |
+--------------------------------+------------+
|arguments-differ                |7           |
+--------------------------------+------------+
|method-hidden                   |6           |
+--------------------------------+------------+
|too-many-ancestors              |5           |
+--------------------------------+------------+
|exec-used                       |5           |
+--------------------------------+------------+
|bad-staticmethod-argument       |4           |
+--------------------------------+------------+
|unneeded-not                    |3           |
+--------------------------------+------------+
|unnecessary-lambda              |3           |
+--------------------------------+------------+
|too-many-return-statements      |3           |
+--------------------------------+------------+
|reimported                      |3           |
+--------------------------------+------------+
|missing-final-newline           |3           |
+--------------------------------+------------+
|bad-super-call                  |3           |
+--------------------------------+------------+
|too-many-nested-blocks          |2           |
+--------------------------------+------------+
|simplifiable-if-statement       |2           |
+--------------------------------+------------+
|redefine-in-handler             |2           |
+--------------------------------+------------+
|not-callable                    |2           |
+--------------------------------+------------+
|no-name-in-module               |2           |
+--------------------------------+------------+
|no-classmethod-decorator        |2           |
+--------------------------------+------------+
|misplaced-comparison-constant   |2           |
+--------------------------------+------------+
|global-variable-undefined       |2           |
+--------------------------------+------------+
|bad-classmethod-argument        |2           |
+--------------------------------+------------+
|useless-else-on-loop            |1           |
+--------------------------------+------------+
|unused-format-string-argument   |1           |
+--------------------------------+------------+
|too-many-boolean-expressions    |1           |
+--------------------------------+------------+
|redundant-unittest-assert       |1           |
+--------------------------------+------------+
|no-init                         |1           |
+--------------------------------+------------+
|format-combined-specification   |1           |
+--------------------------------+------------+
|expression-not-assigned         |1           |
+--------------------------------+------------+
|empty-docstring                 |1           |
+--------------------------------+------------+
|cell-var-from-loop              |1           |
+--------------------------------+------------+

Global evaluation
-----------------
Your code has been rated at -12.93/10

I don't think we want to check the swig generated parts, but yes integrating in buildbot is a good idea

sanchit97 commented 6 years ago

Hi! I am interested in doing this task. Can you point out any explicit examples where I can learn a little about the task?

balister commented 6 years ago

I ran $ grep "import *" -r * and got a bunch of hits. See if that can get you started.

marcusmueller commented 6 years ago

@sanchit97 checking back on you: Because you said you'd take on this task, we'd be willing to help you. So, how's it going? Is there any problem that you need help with?

sanchit97 commented 6 years ago

@marcusmueller Thanks for checking in. I tried finding all the star imports in the whole repo. The occurrences of such imports ran >150 in number. So, I was wondering if all of them have to be manually checked and changed? Another thing is if encountering something like "from numpy import *". Does this need to be changed or not?

marcusmueller commented 6 years ago

I'd say, yes.

By the way, from numpy import * is a prime example of something that shouldn't be done with a star import – for example, because numpy.sum then overrides the python built-in sum, which is a recipe for bugs.

Note that nobody's expecting you to get completely rid of all star imports at once. Start with a branch that gets rid of all star imports in gnuradio-runtime, for example. Or, find all __init__.py, and get rid all star imports that are not from xyz_swig import *; then do a separate round and get rid of all the swig star imports. Something like that – make a start, don't stress yourself too much. Better do two pull requests than one, in case we have feedback for the first one that changes how you'd do the second.

Oh, another note: See how @noc0lour just proposed we do this? He saw an opportunity to improve code quality and "noted that down" here. Feel free to do the same, if you see something else that would be good to improve.

Anyway, happy hacking!

noc0lour commented 6 years ago

Heh, I didn't have a specific proposal for improving the code here. I was tracking down some issue and got annoyed by looking through modules which might import this specific function/class. I like the from foo import bar, baz syntax.

To find out where functions in e.g. gnuradio.digital are coming from you can use something like this:

In [1]: from gnuradio import digital

In [2]: from inspect import getmodule

In [3]: for fun, point in digital.__dict__.iteritems():
   ...:     print("{}: {}".format(fun, getmodule(point)))

And then you can sort getmodule(point) in a clever way and replace star imports for that particular submodule with from submodule import foo,bar. A switch to this syntax will also require for new functions/modules/blocks which should be present in the top level module to be added manually.

Edit: Sorted output which will make this task pretty easy, but tedious:

In [8]: for key, value in sorted(digital.__dict__.iteritems(), key=lambda (k,v): (v,k)):
    print("{}: {}".format(key, getmodule(value)))

It is not even clear which functions/classes are nedded/used by other modules ore Out-of-Tree Modules etc.

lakshmanaram commented 6 years ago

Hey! If the work hasn't been started on this issue or isn't progressing, I'd like to take it up. Please confirm @sanchit97

sanchit97 commented 6 years ago

@lakshmanaram I started some work, but feel free to go ahead.

nishithshah2211 commented 6 years ago

Hey! If the work hasn't been started on this issue or isn't progressing, I'd like to take it up. Please confirm @lakshmanaram

neilsh commented 6 years ago

looks like somebody has a PR fixing a handful of files: https://github.com/gnuradio/gnuradio/pull/1491

marcusmueller commented 2 years ago

this being 4 years old: @noc0lour could you re-run your analysis?

marcusmueller commented 8 months ago

Ignoring all __init__.py (where, upon a somewhat cursory glance, this all seems intentional), all doxygen-generated code:

gr-blocks/grc/blocks_ctrlport_viewer.block.yml
12:    imports: from gnuradio.ctrlport.monitor import *

gr-blocks/grc/blocks_ctrlport_performance.block.yml
12:    imports: from gnuradio.ctrlport.monitor import *

gr-filter/python/filter/design/filter_design.py
63:    from gnuradio.filter.banditems import *
69:    from gnuradio.filter.polezero_plot import *
76:#     from gnuradio.filter.idealbanditems import *
81:    from gnuradio.filter.api_object import *
87:    from gnuradio.filter.fir_design import *

gr-dtv/python/dtv/atsc_rx.py
23:from .atsc_rx_filter import *

grc/gui/Constants.py
12:from ..core.Constants import *

gnuradio-runtime/python/gnuradio/ctrlport/gr-ctrlport-monitor
20:from gnuradio.ctrlport.GrDataPlotter import *

gnuradio-runtime/python/gnuradio/ctrlport/gr-perf-monitorx
48:from gnuradio.ctrlport.GrDataPlotter import *

so, yeah, this persists, but at lower priority