Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pep8-ify function names #32

Open
eric-wieser opened this issue Jul 20, 2016 · 5 comments
Open

pep8-ify function names #32

eric-wieser opened this issue Jul 20, 2016 · 5 comments

Comments

@eric-wieser
Copy link
Contributor

Following on from this comment.

So instead of

task.CfgSampClkTiming(
    source=None,
    rate=1,
    activeEdge=daq.Val_Rising,
    sampleMode=daq.Val_FiniteSamps,
    sampsPerChan=1
)

it would become

task.cfg_sample_clk_timing(
    source=None,
    rate=1,
    active_edge=PyDAQmx.VAL_RISING,
    sample_mode=PyDAQmx.VAL_FINITE_SAMPS,
    samps_per_chan=1
)

This potentially raises the issue that the module name should be PEP8'd as well, becoming the much easier to type pydaqmx

@eric-wieser
Copy link
Contributor Author

@clade's remark from that thread:

I hesitate to rename the function using the PEP8 for two reasons : the documentation is not available for Python but in C. The second reason is that functions are closer to C functions than to python functions. I have in mind to write real python function (for example to remove the byref and returns the value). In this case I will rename the function using the PEP8

@petebachant
Copy link
Contributor

petebachant commented Jul 20, 2016

Maybe for the next major release (v2.0.0), the package name should also be changed to pydaqmx for similar reasons.

@eric-wieser
Copy link
Contributor Author

eric-wieser commented Jul 20, 2016

That needn't wait - the switch could be made right now, and a reasonably simple PyDAQmx.py containing from pydaqmx import * added, assuming __all__ doesn't interfere with things

@clade
Copy link
Owner

clade commented Jul 21, 2016

The dev2 branch is a tentative to pep8-ify the package.

The setup.py should install two package : the main one (pydaqmx) and a legacy one (PyDAQmx) that depends on the first one.

Changing the name of the all the functions, constant and arguments was not easy so I have decided to completely change the structure of the package and to use object to create the functions.

You can see the functions and constants with the commands :

import pydaqmx
print pydaqmx.functions.__all__
print pydaqmx.constants.__all__
print pydaqmx.cfg_samp_clk_timing.__doc__

@clade
Copy link
Owner

clade commented Jul 22, 2016

The dev2 branch is now tested.

For example :

with pydaqmx.Task() as t:
    t.create_ai_voltage_chan("dev1/ai0","",pydaqmx.VAL_CFG_DEFAULT,-10.0,10.0,pydaqmx.VAL_VOLTS,None)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants