Does anybody know of a tool that will take a module as input, look for
any wildcard imports, and then identify what symbols in the module come
from which wildcard import? It could then expand out the from module
import * to from module import foo, bar. It might need to ask the user
on this, since they might want the wildcard import for something
special, but it would still be *much* nicer then expanding the imports
out by hand.
Apologies ahead of time if I've missed something obvious. I did spend
some quality time with google, and couldn't find anything.
cheers,
--keith 2 1428
Keith Jackson wrote: Does anybody know of a tool that will take a module as input, look for any wildcard imports, and then identify what symbols in the module come from which wildcard import? It could then expand out the from module import * to from module import foo, bar. It might need to ask the user on this, since they might want the wildcard import for something special, but it would still be *much* nicer then expanding the imports out by hand.
Apologies ahead of time if I've missed something obvious. I did spend some quality time with google, and couldn't find anything.
No - and given that you could do
--- module.py ---
import random
for i in xrange(random.r andint(10, 100)):
globals()["FOO%i" % i] = "hallo"
--- module.py ---
there is not a chance of such a tool being more than a heuristic. Such
things only work in a static typed world where you know the number of
declarations.
Diez
Sorry but I doesn't understand your need. If you need a ''dinamic''
import, you can use __import__(modu le) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul Rubin |
last post by:
That's what the Python style guides advise. They don't seem to like
def frob(x):
import re
if re.search('sdfxyz', x): ...
instead preferring that you pollute your module's global namespace
with the names of all your imports. What's the point of that? It
gets worse when you want to do something like
|
by: svilen |
last post by:
hello again.
i'm now into using python instead of another language(s) for
describing structures of data, including names, structure,
type-checks, conversions, value-validations, metadata etc. And i have
things to offer, and to request.
And a lot of ideas, but who needs them....
here's an example (from type_struct.py):
|
by: dody suria wijaya |
last post by:
I found this problem when trying to split a module into two.
Here's an example:
==============
#Module a (a.py):
from b import *
class Main: pass
==============
==============
|
by: Terry Hancock |
last post by:
I've been trying to use "happydoc" to document a source
tree that I'm working on. It does pretty much what I want,
except:
Version 2.1:
Creates a weird directory structure for the HTML pages
it generates -- they embed the full path to the working
copy of the sources, which, beyond just being ugly,
would be pretty annoying for a collaborative project
(each collaborator's copy would produce documentation
|
by: micklee74 |
last post by:
hi
is there something like an automatic debugger module available in
python? Say if i enable this auto debugger, it is able to run thru the
whole python program, print variable values at each point, or print
calls to functions..etc...just like the pdb module, but now it's
automatic.
thanks
| |
by: Connelly Barnes |
last post by:
Hi,
I wrote the 'autoimp' module , which allows you to import lazy modules:
from autoimp import * (Import lazy wrapper objects around all modules; "lazy
modules" will turn into normal modules when an attribute
is first accessed with getattr()).
from autoimp import A, B (Import specific lazy module wrapper objects).
The main point of autoimp is to make usage of the interactive Python prompt
|
by: Niels L Ellegaard |
last post by:
Is there a module that allows me to find errors that occur due to copy
by reference? I am looking for something like the following:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
CopyByReferenceError: Variable b refers to variable a, so please do not
change variable a.
Does such a module exist?
Would it be possible to code such a module?
|
by: Silfheed |
last post by:
Heyas
So we have the following situation: we have a testee.py that we want
to automatically test out and verifiy that it is worthy of being
deployed. We want our tester.py to test the code for testee.py
without changing the code for testee.py. testee.py has a module in it
that we want to mock in some tests and in others use the real module.
/foo.py: (real module)
class bar:
|
by: Fredrik Lundh |
last post by:
Jeff Dyke wrote:
so how did that processing use the "mymodulename" name?
the calling method has nothing to do with what's considered to be a
local variable in the method being called, so that only means that the
name is indeed available in the global scope.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |