On Sat, Aug 21, 2021 at 3:35 PM Dan Stromberg wrote:
> On Tue, Aug 17, 2021 at 11:20 AM Chris Angelico wrote:
>
>> The main advantage of ast.parse() is that it no longer cares about
>> code layout, and it won't be fooled by an import statement inside a
>> docstring, or anything like that. It's a
On Tue, Aug 17, 2021 at 11:20 AM Chris Angelico wrote:
> The main advantage of ast.parse() is that it no longer cares about
> code layout, and it won't be fooled by an import statement inside a
> docstring, or anything like that. It's also pretty easy to handle
> multiple variants (note how "impo
On Wed, Aug 18, 2021 at 4:10 AM Barry Scott wrote:
>
> def allImports( self, module_name ):
> for line in f:
> words = line.strip().split()
> if words[0:1] == ['import']:
> all_imports.append( words[1] )
>
This will work for a lo
On Monday, 16 August 2021 16:13:47 BST Dan Stromberg wrote:
> Hi folks.
>
> I'm working on a large codebase that has at least one cyclic import.
>
> In case I end up needing to eliminate the cyclic imports, is there any sort
> of tool that will generate an import graph and output Just the cycles?
> In code that runs after the module has been imported (basically
> anything defined in a function that isn't called by code that runs at
> module time), you can expect the variables defined in the imported
> module to be available.
>
> If you have circular imports involved, making sure the modules
On Jun 27, 12:58 am, James <[EMAIL PROTECTED]> wrote:
> > # a.py
> > import b
> > # refer to b.b
>
> > # b.py
> > import a
> > # refer to a.a
>
> Thanks Dan, but that still doesn't work for me I'm afraid...
>
> I renamed the modules avoid name overloading -- a.py is now:
> import b
>
> class A():
>
Hallöchen!
James writes:
>> # a.py
>> import b
>> # refer to b.b
>>
>> # b.py
>> import a
>> # refer to a.a
>
> Thanks Dan, but that still doesn't work for me I'm afraid...
>
> I renamed the modules avoid name overloading -- a.py is now:
> import b
>
> class A():
> print('b.b_mod:', b.b_mod)
> # a.py
> import b
> # refer to b.b
>
> # b.py
> import a
> # refer to a.a
Thanks Dan, but that still doesn't work for me I'm afraid...
I renamed the modules avoid name overloading -- a.py is now:
import b
class A():
print('b.b_mod:', b.b_mod)
b is now defined, but b.b_mod isn't:
File "m
On Jun 26, 10:40 pm, James <[EMAIL PROTECTED]> wrote:
> Hi all,
> I'm looking for some advice dealing with cyclic, cross-package
> imports.
>
> I've created the following demo file structure:
> ./a/__init__.py
> ./a/a.py
> ./b/__init__.py
> ./b/b.py
> ./main.py
>
> a.py imports a class from b.py an