Comments (6)
You are right. who is not used. We can remove that line.
Merci !
Regarding the docstring, I'm heading toward this, hoping it will be clearer.
"""
point is either the ID of the writeable point entity, or an instance of
the writeable point entity to retrieve the write status of or write a
value to.
To retrieve the write status of the point, value, duration and level are required to be None.
To write to a point, value and level are required and duration is optional.
"""
Function will become
def _on_point_write(self, point, level, val, who, duration, callback, **kwargs):
args = {"id": self._obj_to_ref(point)}
if level is None:
if (val is not None) or (duration is not None):
raise ValueError(
"You tried writing a value without specifying a level (or specified a duration without providing a level neither a value. Please provide required level. If trying to retrieve write status of the point, provide None as value, duration and level"
)
else:
args.update({"level": level, "val": val})
if who is not None:
args["who"] = who
if duration is not None:
args["duration"] = duration
return self._get_grid("pointWrite", callback, args=args, **kwargs)
from pyhaystack.
What if you explicitly pass who=None
?
from pyhaystack.
Forgot to ask, using this in skyspark ? nhaystack or widesky ?
from pyhaystack.
What if you explicitly pass
who=None
?
Nevermind... it'll be overridden...
from pyhaystack.
Please, try the develop branch where I modified the behaviour so who will be reset to None in the case where level is None.
from pyhaystack.
Sorry for not replying earlier. Just saw the change here
- Does it make sense to change the error message to remove the requirement for
who
to beNone
as the value forwho
will not be considered iflevel
isNone
. - In the first part of the if statement, you set
who
to beNone
, but that does seem to be used - is that line needed?
With these suggestions, the on_point_write
method would become:
def _on_point_write(self, point, level, val, who, duration, callback, **kwargs):
args = {"id": self._obj_to_ref(point)}
if level is None: # Ignore value for who as it may be username
if (val is not None) or (duration is not None):
raise ValueError(
"If level is None, val and duration must be None too."
)
else:
args.update({"level": level, "val": val})
if who is not None:
args["who"] = who
if duration is not None:
args["duration"] = duration
return self._get_grid("pointWrite", callback, args=args, **kwargs)
It may also be worth updating the docstring of the point_write
method to reflect the change: If level is None, the val and duration parameters should be None too, the write status of the point is retrieved.
from pyhaystack.
Related Issues (20)
- Issue with NaN values HOT 3
- Implement __await__ on operation classes HOT 5
- Breaking change from SkySpark 3.0.27 to 3.0.28 HOT 15
- LDAP login on SkySpark 3.0.28 HOT 6
- Axon eval(hisClear) requires POST, not GET with skyspark HOT 2
- Why was the Haystack read Op split into get_entity and find_entity? HOT 2
- hszinc.zincparser.ZincParseException: Failed to parse: Expected end of text, found '"' (line:6, col:1) HOT 2
- Pint error? HOT 3
- Possible error while fetching data from a Niagara server hosted on HTTPS HOT 2
- Parsing issue evalOrReadAll(\"ruleSparkSwivel([@nav:equip.all], toSpan(\\\"yesterday\\\"), [], {})\") HOT 2
- Use query function for Naigara4 nHaystack Server HOT 4
- Project Haxall HOT 1
- pyhaystack.util.state.NotReadyError HOT 10
- Niagara 4.9 | Possible breaking change for login HOT 2
- SkySpark Authentication HOT 3
- Writing histories to SkySpark HOT 4
- Skyspark needs post requests instead of get requests for his_read HOT 12
- Watch_poll does not use argument refresh HOT 2
- Implementation of ability to add new entities? HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pyhaystack.