question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Device object and device `kwarg` for creation

See original GitHub issue

Hi,

When reading the section regarding devices, I stumbled upon the following note:

The only way to obtain a Device object is from the .device property on the array object, hence there is no Device object in the array API itself that can be instantiated to point to a specific physical or logical device.

I understood this, as users can never instantiate a Device object themselves. But in the paragraph inmediately above there are sentences like:

A device=None keyword for array creation functions, which takes an instance of a Device object.

A .to_device(device) method on the array object, with device again being a Device object, to move an array to a different device.

And both require a Device object, that according to the note, can’t be directly instantiated, or be obtained from elsewhere than a created array.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
emcastillocommented, Mar 30, 2021

Crystal clear! Thanks😄

1reaction
leofangcommented, Mar 30, 2021

That’s right. AFAIK the intention is to use device=a.device, i.e. when you already have a compliant array a and so you can use its device attribute. As for how to determine the device for the very first array, it is currently listed as out of scope, and each library will use its existing strategy for the choice of the default device, performing device management, etc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pynetbox - NetBox Python API client part 2 - creating objects |
– A list of dictionaries containing the properties of the objects to be created. **kwargs (str) – key/value strings representing properties on ...
Read more >
How To Use *args and **kwargs in Python 3 - DigitalOcean
In this tutorial, we will cover the syntax of working with *args and **kwargs as parameters within functions to pass a variable number...
Read more >
Endpoint — pynetbox 7.0.1.dev4+g74ae7e8 documentation
nb.dcim.devices.count() 87382 >>>. create (*args, **kwargs)¶. Creates an object on an endpoint. Allows for the creation of new objects on an endpoint.
Read more >
Introduction to Device Objects - Windows drivers
In this article. The operating system represents devices by device objects. One or more device objects are associated with each device.
Read more >
Python create device - ProgramCreek.com
HttpOperationError>` if the HTTP response status is not in [200]. :returns: Device object containing the created device. """ kwargs = { "device_id": ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found