Search is not available for this dataset
identifier
stringlengths
1
155
parameters
stringlengths
2
6.09k
docstring
stringlengths
11
63.4k
docstring_summary
stringlengths
0
63.4k
function
stringlengths
29
99.8k
function_tokens
list
start_point
list
end_point
list
language
stringclasses
1 value
docstring_language
stringlengths
2
7
docstring_language_predictions
stringlengths
18
23
is_langid_reliable
stringclasses
2 values
xclOpen
(deviceIndex, logFileName, level)
xclOpen(): Open a device and obtain its handle :param deviceIndex: (unsigned int) Slot number of device 0 for first device, 1 for the second device... :param logFileName: (const char pointer) Log file to use for optional logging :param level: (int) Severity level of messages to log :return: device...
xclOpen(): Open a device and obtain its handle
def xclOpen(deviceIndex, logFileName, level): """ xclOpen(): Open a device and obtain its handle :param deviceIndex: (unsigned int) Slot number of device 0 for first device, 1 for the second device... :param logFileName: (const char pointer) Log file to use for optional logging :param level: (int) ...
[ "def", "xclOpen", "(", "deviceIndex", ",", "logFileName", ",", "level", ")", ":", "libc", ".", "xclOpen", ".", "restype", "=", "ctypes", ".", "POINTER", "(", "xclDeviceHandle", ")", "libc", ".", "xclOpen", ".", "argtypes", "=", "[", "ctypes", ".", "c_uin...
[ 170, 0 ]
[ 181, 56 ]
python
en
['en', 'error', 'th']
False
xclClose
(handle)
xclClose(): Close an opened device :param handle: (xclDeviceHandle) device handle :return: None
xclClose(): Close an opened device
def xclClose(handle): """ xclClose(): Close an opened device :param handle: (xclDeviceHandle) device handle :return: None """ libc.xclClose.restype = None libc.xclClose.argtype = xclDeviceHandle libc.xclClose(handle)
[ "def", "xclClose", "(", "handle", ")", ":", "libc", ".", "xclClose", ".", "restype", "=", "None", "libc", ".", "xclClose", ".", "argtype", "=", "xclDeviceHandle", "libc", ".", "xclClose", "(", "handle", ")" ]
[ 183, 0 ]
[ 192, 25 ]
python
en
['en', 'error', 'th']
False
xclResetDevice
(handle, kind)
xclResetDevice() - Reset a device or its CL :param handle: Device handle :param kind: Reset kind :return: 0 on success or appropriate error number
xclResetDevice() - Reset a device or its CL :param handle: Device handle :param kind: Reset kind :return: 0 on success or appropriate error number
def xclResetDevice(handle, kind): """ xclResetDevice() - Reset a device or its CL :param handle: Device handle :param kind: Reset kind :return: 0 on success or appropriate error number """ libc.xclResetDevice.restype = ctypes.c_int libc.xclResetDevice.argtypes = [xclDeviceHandle, ctypes....
[ "def", "xclResetDevice", "(", "handle", ",", "kind", ")", ":", "libc", ".", "xclResetDevice", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclResetDevice", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_int", "]", "libc"...
[ 194, 0 ]
[ 203, 37 ]
python
en
['en', 'error', 'th']
False
xclGetDeviceInfo2
(handle, info)
xclGetDeviceInfo2() - Obtain various bits of information from the device :param handle: (xclDeviceHandle) device handle :param info: (xclDeviceInfo pointer) Information record :return: 0 on success or appropriate error number
xclGetDeviceInfo2() - Obtain various bits of information from the device
def xclGetDeviceInfo2 (handle, info): """ xclGetDeviceInfo2() - Obtain various bits of information from the device :param handle: (xclDeviceHandle) device handle :param info: (xclDeviceInfo pointer) Information record :return: 0 on success or appropriate error number """ libc.xclGetDeviceI...
[ "def", "xclGetDeviceInfo2", "(", "handle", ",", "info", ")", ":", "libc", ".", "xclGetDeviceInfo2", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclGetDeviceInfo2", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "POINTER", "(...
[ 205, 0 ]
[ 216, 47 ]
python
en
['en', 'error', 'th']
False
xclGetUsageInfo
(handle, info)
xclGetUsageInfo() - Obtain usage information from the device :param handle: Device handle :param info: Information record :return: 0 on success or appropriate error number
xclGetUsageInfo() - Obtain usage information from the device :param handle: Device handle :param info: Information record :return: 0 on success or appropriate error number
def xclGetUsageInfo (handle, info): """ xclGetUsageInfo() - Obtain usage information from the device :param handle: Device handle :param info: Information record :return: 0 on success or appropriate error number """ libc.xclGetUsageInfo.restype = ctypes.c_int libc.xclGetUsageInfo.argtype...
[ "def", "xclGetUsageInfo", "(", "handle", ",", "info", ")", ":", "libc", ".", "xclGetUsageInfo", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclGetUsageInfo", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "POINTER", "(", "...
[ 218, 0 ]
[ 227, 45 ]
python
en
['en', 'error', 'th']
False
xclGetErrorStatus
(handle, info)
xclGetErrorStatus() - Obtain error information from the device :param handle: Device handle :param info: Information record :return: 0 on success or appropriate error number
xclGetErrorStatus() - Obtain error information from the device :param handle: Device handle :param info: Information record :return: 0 on success or appropriate error number
def xclGetErrorStatus(handle, info): """ xclGetErrorStatus() - Obtain error information from the device :param handle: Device handle :param info: Information record :return: 0 on success or appropriate error number """ libc.xclGetErrorStatus.restype = ctypes.c_int libc.xclGetErrorStatus....
[ "def", "xclGetErrorStatus", "(", "handle", ",", "info", ")", ":", "libc", ".", "xclGetErrorStatus", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclGetErrorStatus", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "POINTER", "(...
[ 229, 0 ]
[ 238, 47 ]
python
en
['en', 'error', 'th']
False
xclLoadXclBin
(handle, buf)
Download FPGA image (xclbin) to the device :param handle: (xclDeviceHandle) device handle :param buf: (void pointer) Pointer to device image (xclbin) in memory :return: 0 on success or appropriate error number Download FPGA image (AXLF) to the device. The PR bitstream is encapsulated inside x...
Download FPGA image (xclbin) to the device
def xclLoadXclBin(handle, buf): """ Download FPGA image (xclbin) to the device :param handle: (xclDeviceHandle) device handle :param buf: (void pointer) Pointer to device image (xclbin) in memory :return: 0 on success or appropriate error number Download FPGA image (AXLF) to the device. The PR...
[ "def", "xclLoadXclBin", "(", "handle", ",", "buf", ")", ":", "libc", ".", "xclLoadXclBin", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclLoadXclBin", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_void_p", "]", "return...
[ 240, 0 ]
[ 254, 42 ]
python
en
['en', 'error', 'th']
False
xclGetSectionInfo
(handle, info, size, kind, index)
xclGetSectionInfo() - Get Information from sysfs about the downloaded xclbin sections :param handle: Device handle :param info: Pointer to preallocated memory which will store the return value. :param size: Pointer to preallocated memory which will store the return size. :param kind: axlf_section_k...
xclGetSectionInfo() - Get Information from sysfs about the downloaded xclbin sections :param handle: Device handle :param info: Pointer to preallocated memory which will store the return value. :param size: Pointer to preallocated memory which will store the return size. :param kind: axlf_section_k...
def xclGetSectionInfo(handle, info, size, kind, index): """ xclGetSectionInfo() - Get Information from sysfs about the downloaded xclbin sections :param handle: Device handle :param info: Pointer to preallocated memory which will store the return value. :param size: Pointer to preallocated memory wh...
[ "def", "xclGetSectionInfo", "(", "handle", ",", "info", ",", "size", ",", "kind", ",", "index", ")", ":", "libc", ".", "xclGetSectionInfo", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclGetSectionInfo", ".", "argtypes", "=", "[", "xclDevice...
[ 256, 0 ]
[ 270, 66 ]
python
en
['en', 'error', 'th']
False
xclReClock2
(handle, region, targetFreqMHz)
xclReClock2() - Configure PR region frequencies :param handle: Device handle :param region: PR region (always 0) :param targetFreqMHz: Array of target frequencies in order for the Clock Wizards driving the PR region :return: 0 on success or appropriate error number
xclReClock2() - Configure PR region frequencies :param handle: Device handle :param region: PR region (always 0) :param targetFreqMHz: Array of target frequencies in order for the Clock Wizards driving the PR region :return: 0 on success or appropriate error number
def xclReClock2(handle, region, targetFreqMHz): """ xclReClock2() - Configure PR region frequencies :param handle: Device handle :param region: PR region (always 0) :param targetFreqMHz: Array of target frequencies in order for the Clock Wizards driving the PR region :return: 0 on success or app...
[ "def", "xclReClock2", "(", "handle", ",", "region", ",", "targetFreqMHz", ")", ":", "libc", ".", "xclReClock2", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclReClock2", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_ui...
[ 272, 0 ]
[ 282, 58 ]
python
en
['en', 'error', 'th']
False
xclLockDevice
(handle)
Get exclusive ownership of the device :param handle: (xclDeviceHandle) device handle :return: 0 on success or appropriate error number The lock is necessary before performing buffer migration, register access or bitstream downloads
Get exclusive ownership of the device
def xclLockDevice(handle): """ Get exclusive ownership of the device :param handle: (xclDeviceHandle) device handle :return: 0 on success or appropriate error number The lock is necessary before performing buffer migration, register access or bitstream downloads """ libc.xclLockDevice.rest...
[ "def", "xclLockDevice", "(", "handle", ")", ":", "libc", ".", "xclLockDevice", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclLockDevice", ".", "argtype", "=", "xclDeviceHandle", "return", "libc", ".", "xclLockDevice", "(", "handle", ")" ]
[ 284, 0 ]
[ 295, 37 ]
python
en
['en', 'error', 'th']
False
xclUnlockDevice
(handle)
xclUnlockDevice() - Release exclusive ownership of the device :param handle: (xclDeviceHandle) device handle :return: 0 on success or appropriate error number
xclUnlockDevice() - Release exclusive ownership of the device
def xclUnlockDevice(handle): """ xclUnlockDevice() - Release exclusive ownership of the device :param handle: (xclDeviceHandle) device handle :return: 0 on success or appropriate error number """ libc.xclUnlockDevice.restype = ctypes.c_int libc.xclUnlockDevice.argtype = xclDeviceHandle ...
[ "def", "xclUnlockDevice", "(", "handle", ")", ":", "libc", ".", "xclUnlockDevice", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclUnlockDevice", ".", "argtype", "=", "xclDeviceHandle", "return", "libc", ".", "xclUnlockDevice", "(", "handle", ")"...
[ 297, 0 ]
[ 306, 39 ]
python
en
['en', 'error', 'th']
False
xclOpenContext
(handle, xclbinId, ipIndex, shared)
xclOpenContext() - Create shared/exclusive context on compute units :param handle: Device handle :param xclbinId: UUID of the xclbin image running on the device :param ipIndex: IP/CU index in the IP LAYOUT array :param shared: Shared access or exclusive access :return: 0 on success or appropria...
xclOpenContext() - Create shared/exclusive context on compute units :param handle: Device handle :param xclbinId: UUID of the xclbin image running on the device :param ipIndex: IP/CU index in the IP LAYOUT array :param shared: Shared access or exclusive access :return: 0 on success or appropria...
def xclOpenContext(handle, xclbinId, ipIndex, shared): """ xclOpenContext() - Create shared/exclusive context on compute units :param handle: Device handle :param xclbinId: UUID of the xclbin image running on the device :param ipIndex: IP/CU index in the IP LAYOUT array :param shared: Shared acc...
[ "def", "xclOpenContext", "(", "handle", ",", "xclbinId", ",", "ipIndex", ",", "shared", ")", ":", "libc", ".", "xclOpenContext", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclOpenContext", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", ...
[ 308, 0 ]
[ 324, 71 ]
python
en
['en', 'error', 'th']
False
xclCloseContext
(handle, xclbinId, ipIndex)
xclCloseContext() - Close previously opened context :param handle: Device handle :param xclbinId: UUID of the xclbin image running on the device :param ipIndex: IP/CU index in the IP LAYOUT array :return: 0 on success or appropriate error number Close a previously allocated shared/exclusive co...
xclCloseContext() - Close previously opened context :param handle: Device handle :param xclbinId: UUID of the xclbin image running on the device :param ipIndex: IP/CU index in the IP LAYOUT array :return: 0 on success or appropriate error number
def xclCloseContext(handle, xclbinId, ipIndex): """ xclCloseContext() - Close previously opened context :param handle: Device handle :param xclbinId: UUID of the xclbin image running on the device :param ipIndex: IP/CU index in the IP LAYOUT array :return: 0 on success or appropriate error numbe...
[ "def", "xclCloseContext", "(", "handle", ",", "xclbinId", ",", "ipIndex", ")", ":", "libc", ".", "xclCloseContext", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclCloseContext", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".",...
[ 326, 0 ]
[ 338, 64 ]
python
en
['en', 'error', 'th']
False
xclUpgradeFirmware
(handle, fileName)
Update the device BPI PROM with new image :param handle: Device handle :param fileName: :return: 0 on success or appropriate error number
Update the device BPI PROM with new image :param handle: Device handle :param fileName: :return: 0 on success or appropriate error number
def xclUpgradeFirmware(handle, fileName): """ Update the device BPI PROM with new image :param handle: Device handle :param fileName: :return: 0 on success or appropriate error number """ libc.xclUpgradeFirmware.restype = ctypes.c_int libc.xclUpgradeFirmware.argtypes = [xclDeviceHandle, ...
[ "def", "xclUpgradeFirmware", "(", "handle", ",", "fileName", ")", ":", "libc", ".", "xclUpgradeFirmware", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclUpgradeFirmware", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_void_...
[ 340, 0 ]
[ 349, 52 ]
python
en
['en', 'error', 'th']
False
xclUpgradeFirmware2
(handle, file1, file2)
Update the device BPI PROM with new image with clearing bitstream :param handle: Device handle :param fileName: :return: 0 on success or appropriate error number
Update the device BPI PROM with new image with clearing bitstream :param handle: Device handle :param fileName: :return: 0 on success or appropriate error number
def xclUpgradeFirmware2(handle, file1, file2): """ Update the device BPI PROM with new image with clearing bitstream :param handle: Device handle :param fileName: :return: 0 on success or appropriate error number """ libc.xclUpgradeFirmware2.restype = ctypes.c_int libc.xclUpgradeFirmware...
[ "def", "xclUpgradeFirmware2", "(", "handle", ",", "file1", ",", "file2", ")", ":", "libc", ".", "xclUpgradeFirmware2", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclUpgradeFirmware2", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes",...
[ 351, 0 ]
[ 360, 57 ]
python
en
['en', 'error', 'th']
False
xclUpgradeFirmwareXSpi
(handle, fileName, index)
Update the device SPI PROM with new image :param handle: :param fileName: :param index: :return:
Update the device SPI PROM with new image :param handle: :param fileName: :param index: :return:
def xclUpgradeFirmwareXSpi (handle, fileName, index): """ Update the device SPI PROM with new image :param handle: :param fileName: :param index: :return: """ libc.xclUpgradeFirmwareXSpi.restype = ctypes.c_int libc.xclUpgradeFirmwareXSpi.argtypes = [xclDeviceHandle, ctypes.c_void_p, ...
[ "def", "xclUpgradeFirmwareXSpi", "(", "handle", ",", "fileName", ",", "index", ")", ":", "libc", ".", "xclUpgradeFirmwareXSpi", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclUpgradeFirmwareXSpi", ".", "argtypes", "=", "[", "xclDeviceHandle", ",",...
[ 362, 0 ]
[ 372, 63 ]
python
en
['en', 'error', 'th']
False
xclBootFPGA
(handle)
Boot the FPGA from PROM :param handle: Device handle :return: 0 on success or appropriate error number
Boot the FPGA from PROM :param handle: Device handle :return: 0 on success or appropriate error number
def xclBootFPGA(handle): """ Boot the FPGA from PROM :param handle: Device handle :return: 0 on success or appropriate error number """ libc.xclBootFPGA.restype = ctypes.c_int libc.xclBootFPGA.argtype = xclDeviceHandle return libc.xclBootFPGA(handle)
[ "def", "xclBootFPGA", "(", "handle", ")", ":", "libc", ".", "xclBootFPGA", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclBootFPGA", ".", "argtype", "=", "xclDeviceHandle", "return", "libc", ".", "xclBootFPGA", "(", "handle", ")" ]
[ 374, 0 ]
[ 382, 35 ]
python
en
['en', 'error', 'th']
False
xclRemoveAndScanFPGA
()
Write to /sys/bus/pci/devices/<deviceHandle>/remove and initiate a pci rescan by writing to /sys/bus/pci/rescan. :return:
Write to /sys/bus/pci/devices/<deviceHandle>/remove and initiate a pci rescan by writing to /sys/bus/pci/rescan. :return:
def xclRemoveAndScanFPGA(): """ Write to /sys/bus/pci/devices/<deviceHandle>/remove and initiate a pci rescan by writing to /sys/bus/pci/rescan. :return: """ libc.xclRemoveAndScanFPGA.restype = ctypes.c_int return libc.xclRemoveAndScanFPGA()
[ "def", "xclRemoveAndScanFPGA", "(", ")", ":", "libc", ".", "xclRemoveAndScanFPGA", ".", "restype", "=", "ctypes", ".", "c_int", "return", "libc", ".", "xclRemoveAndScanFPGA", "(", ")" ]
[ 384, 0 ]
[ 391, 38 ]
python
en
['en', 'error', 'th']
False
xclLogMsg
(handle, level, tag, format, *args)
Send message to log file as per settings in ini file. :param handle: (xclDeviceHandle) device handle :param level: (xrtLogMsgLevel) Severity level of the msg :param tag: (const char*) Tag supplied by the client, like "OCL", "XMA", etc. :param format: (const char *) Format of Msg string to write to...
Send message to log file as per settings in ini file.
def xclLogMsg(handle, level, tag, format, *args): """ Send message to log file as per settings in ini file. :param handle: (xclDeviceHandle) device handle :param level: (xrtLogMsgLevel) Severity level of the msg :param tag: (const char*) Tag supplied by the client, like "OCL", "XMA", etc. :para...
[ "def", "xclLogMsg", "(", "handle", ",", "level", ",", "tag", ",", "format", ",", "*", "args", ")", ":", "libc", ".", "xclAllocBO", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclAllocBO", ".", "argtypes", "=", "[", "xclDeviceHandle", ","...
[ 393, 0 ]
[ 406, 60 ]
python
en
['en', 'error', 'th']
False
xclAllocBO
(handle, size, unused, flags)
Allocate a BO of requested size with appropriate flags :param handle: (xclDeviceHandle) device handle :param size: (size_t) Size of buffer :param unused: (int) unused parameter present for legacy reasons :param flags: (unsigned int) Specify bank information, etc :return: BO handle
Allocate a BO of requested size with appropriate flags
def xclAllocBO(handle, size, unused, flags): """ Allocate a BO of requested size with appropriate flags :param handle: (xclDeviceHandle) device handle :param size: (size_t) Size of buffer :param unused: (int) unused parameter present for legacy reasons :param flags: (unsigned int) Specify bank ...
[ "def", "xclAllocBO", "(", "handle", ",", "size", ",", "unused", ",", "flags", ")", ":", "libc", ".", "xclAllocBO", ".", "restype", "=", "ctypes", ".", "c_uint", "libc", ".", "xclAllocBO", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", ...
[ 409, 0 ]
[ 421, 55 ]
python
en
['en', 'error', 'th']
False
xclAllocUserPtrBO
(handle, userptr, size, flags)
Allocate a BO using userptr provided by the user :param handle: Device handle :param userptr: Pointer to 4K aligned user memory :param size: Size of buffer :param flags: Specify bank information, etc :return: BO handle
Allocate a BO using userptr provided by the user :param handle: Device handle :param userptr: Pointer to 4K aligned user memory :param size: Size of buffer :param flags: Specify bank information, etc :return: BO handle
def xclAllocUserPtrBO(handle, userptr, size, flags): """ Allocate a BO using userptr provided by the user :param handle: Device handle :param userptr: Pointer to 4K aligned user memory :param size: Size of buffer :param flags: Specify bank information, etc :return: BO handle """ libc...
[ "def", "xclAllocUserPtrBO", "(", "handle", ",", "userptr", ",", "size", ",", "flags", ")", ":", "libc", ".", "xclAllocUserPtrBO", ".", "restype", "=", "ctypes", ".", "c_uint", "libc", ".", "xclAllocUserPtrBO", ".", "argtypes", "=", "[", "xclDeviceHandle", ",...
[ 423, 0 ]
[ 434, 63 ]
python
en
['en', 'error', 'th']
False
xclFreeBO
(handle, boHandle)
Free a previously allocated BO :param handle: device handle :param boHandle: BO handle
Free a previously allocated BO
def xclFreeBO(handle, boHandle): """ Free a previously allocated BO :param handle: device handle :param boHandle: BO handle """ libc.xclFreeBO.restype = None libc.xclFreeBO.argtypes = [xclDeviceHandle, ctypes.c_uint] libc.xclFreeBO(handle, boHandle)
[ "def", "xclFreeBO", "(", "handle", ",", "boHandle", ")", ":", "libc", ".", "xclFreeBO", ".", "restype", "=", "None", "libc", ".", "xclFreeBO", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_uint", "]", "libc", ".", "xclFreeBO", "(",...
[ 436, 0 ]
[ 445, 36 ]
python
en
['en', 'error', 'th']
False
xclWriteBO
(handle, boHandle, src, size, seek)
Copy-in user data to host backing storage of BO :param handle: Device handle :param boHandle: BO handle :param src: Source data pointer :param size: Size of data to copy :param seek: Offset within the BO :return: 0 on success or appropriate error number
Copy-in user data to host backing storage of BO :param handle: Device handle :param boHandle: BO handle :param src: Source data pointer :param size: Size of data to copy :param seek: Offset within the BO :return: 0 on success or appropriate error number
def xclWriteBO(handle, boHandle, src, size, seek): """ Copy-in user data to host backing storage of BO :param handle: Device handle :param boHandle: BO handle :param src: Source data pointer :param size: Size of data to copy :param seek: Offset within the BO :return: 0 on success or appr...
[ "def", "xclWriteBO", "(", "handle", ",", "boHandle", ",", "src", ",", "size", ",", "seek", ")", ":", "libc", ".", "xclWriteBO", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclWriteBO", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "...
[ 447, 0 ]
[ 459, 61 ]
python
en
['en', 'error', 'th']
False
xclReadBO
(handle, boHandle, dst, size, skip)
Copy-out user data from host backing storage of BO :param handle: Device handle :param boHandle: BO handle :param dst: Destination data pointer :param size: Size of data to copy :param skip: Offset within the BO :return: 0 on success or appropriate error number
Copy-out user data from host backing storage of BO :param handle: Device handle :param boHandle: BO handle :param dst: Destination data pointer :param size: Size of data to copy :param skip: Offset within the BO :return: 0 on success or appropriate error number
def xclReadBO(handle, boHandle, dst, size, skip): """ Copy-out user data from host backing storage of BO :param handle: Device handle :param boHandle: BO handle :param dst: Destination data pointer :param size: Size of data to copy :param skip: Offset within the BO :return: 0 on success ...
[ "def", "xclReadBO", "(", "handle", ",", "boHandle", ",", "dst", ",", "size", ",", "skip", ")", ":", "libc", ".", "xclReadBO", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclReadBO", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "cty...
[ 461, 0 ]
[ 473, 60 ]
python
en
['en', 'error', 'th']
False
xclMapBO
(handle, boHandle, write, buf_type='char', buf_size=1)
Memory map BO into user's address space :param handle: (xclDeviceHandle) device handle :param boHandle: (unsigned int) BO handle :param write: (boolean) READ only or READ/WRITE mapping :param buf_type: type of memory mapped buffer :param buf_size: size of buffer :return: (pointer) Memory m...
Memory map BO into user's address space
def xclMapBO(handle, boHandle, write, buf_type='char', buf_size=1): """ Memory map BO into user's address space :param handle: (xclDeviceHandle) device handle :param boHandle: (unsigned int) BO handle :param write: (boolean) READ only or READ/WRITE mapping :param buf_type: type of memory mapped...
[ "def", "xclMapBO", "(", "handle", ",", "boHandle", ",", "write", ",", "buf_type", "=", "'char'", ",", "buf_size", "=", "1", ")", ":", "if", "buf_type", "==", "'char'", ":", "prop", "=", "xclBOProperties", "(", ")", "xclGetBOProperties", "(", "handle", ",...
[ 475, 0 ]
[ 507, 14 ]
python
en
['en', 'error', 'th']
False
xclSyncBO
(handle, boHandle, direction, size, offset)
Synchronize buffer contents in requested direction :param handle: (xclDeviceHandle) device handle :param boHandle: (unsigned int) BO handle :param direction: (xclBOSyncDirection) To device or from device :param size: (size_t) Size of data to synchronize :param offset: (size_t) Offset within th...
Synchronize buffer contents in requested direction
def xclSyncBO(handle, boHandle, direction, size, offset): """ Synchronize buffer contents in requested direction :param handle: (xclDeviceHandle) device handle :param boHandle: (unsigned int) BO handle :param direction: (xclBOSyncDirection) To device or from device :param size: (size_t) Size of...
[ "def", "xclSyncBO", "(", "handle", ",", "boHandle", ",", "direction", ",", "size", ",", "offset", ")", ":", "libc", ".", "xclSyncBO", ".", "restype", "=", "ctypes", ".", "c_uint", "libc", ".", "xclSyncBO", ".", "argtypes", "=", "[", "xclDeviceHandle", ",...
[ 509, 0 ]
[ 522, 68 ]
python
en
['en', 'error', 'th']
False
xclCopyBO
(handle, dstBoHandle, srcBoHandle, size, dst_offset, src_offset)
Copy device buffer contents to another buffer :param handle: Device handle :param dstBoHandle: Destination BO handle :param srcBoHandle: Source BO handle :param size: Size of data to synchronize :param dst_offset: dst Offset within the BO :param src_offset: src Offset within the BO :r...
Copy device buffer contents to another buffer :param handle: Device handle :param dstBoHandle: Destination BO handle :param srcBoHandle: Source BO handle :param size: Size of data to synchronize :param dst_offset: dst Offset within the BO :param src_offset: src Offset within the BO :r...
def xclCopyBO(handle, dstBoHandle, srcBoHandle, size, dst_offset, src_offset): """ Copy device buffer contents to another buffer :param handle: Device handle :param dstBoHandle: Destination BO handle :param srcBoHandle: Source BO handle :param size: Size of data to synchronize :param dst_off...
[ "def", "xclCopyBO", "(", "handle", ",", "dstBoHandle", ",", "srcBoHandle", ",", "size", ",", "dst_offset", ",", "src_offset", ")", ":", "libc", ".", "xclCopyBO", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclCopyBO", ".", "argtypes", "=", ...
[ 524, 0 ]
[ 538, 82 ]
python
en
['en', 'error', 'th']
False
xclExportBO
(handle, boHandle)
Obtain DMA-BUF file descriptor for a BO :param handle: Device handle :param boHandle: BO handle which needs to be exported :return: File handle to the BO or standard errno
Obtain DMA-BUF file descriptor for a BO :param handle: Device handle :param boHandle: BO handle which needs to be exported :return: File handle to the BO or standard errno
def xclExportBO(handle, boHandle): """ Obtain DMA-BUF file descriptor for a BO :param handle: Device handle :param boHandle: BO handle which needs to be exported :return: File handle to the BO or standard errno """ libc.xclExportBO.restype = ctypes.c_int libc.xclExportBO.argtypes = [xclD...
[ "def", "xclExportBO", "(", "handle", ",", "boHandle", ")", ":", "libc", ".", "xclExportBO", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclExportBO", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_uint", "]", "return", ...
[ 540, 0 ]
[ 549, 45 ]
python
en
['en', 'error', 'th']
False
xclImportBO
(handle, fd, flags)
Obtain BO handle for a BO represented by DMA-BUF file descriptor :param handle: Device handle :param fd: File handle to foreign BO owned by another device which needs to be imported :param flags: Unused :return: BO handle of the imported BO Import a BO exported by another device. This oper...
Obtain BO handle for a BO represented by DMA-BUF file descriptor :param handle: Device handle :param fd: File handle to foreign BO owned by another device which needs to be imported :param flags: Unused :return: BO handle of the imported BO
def xclImportBO(handle, fd, flags): """ Obtain BO handle for a BO represented by DMA-BUF file descriptor :param handle: Device handle :param fd: File handle to foreign BO owned by another device which needs to be imported :param flags: Unused :return: BO handle of the imported BO Import a B...
[ "def", "xclImportBO", "(", "handle", ",", "fd", ",", "flags", ")", ":", "libc", ".", "xclImportBO", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclImportBO", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_int", ",", ...
[ 551, 0 ]
[ 564, 39 ]
python
en
['en', 'error', 'th']
False
xclGetBOProperties
(handle, boHandle, properties)
Obtain xclBOProperties struct for a BO :param handle: (xclDeviceHandle) device handle :param boHandle: (unsigned int) BO handle :param properties: BO properties struct pointer :return: 0 on success
Obtain xclBOProperties struct for a BO
def xclGetBOProperties(handle, boHandle, properties): """ Obtain xclBOProperties struct for a BO :param handle: (xclDeviceHandle) device handle :param boHandle: (unsigned int) BO handle :param properties: BO properties struct pointer :return: 0 on success """ libc.xclGetBOProperties.res...
[ "def", "xclGetBOProperties", "(", "handle", ",", "boHandle", ",", "properties", ")", ":", "libc", ".", "xclGetBOProperties", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclGetBOProperties", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "cty...
[ 566, 0 ]
[ 577, 64 ]
python
en
['en', 'error', 'th']
False
xclGetDeviceAddr
(handle, boHandle)
Get the physical address on the device This API is deprecated and will be removed in future release. New clients should use xclGetBOProperties() instead. :param handle: (xclDeviceHandle) device handle :param boHandle: (unsigned int) BO handle :return: uint64_t address of the BO on success ...
Get the physical address on the device
def xclGetDeviceAddr(handle, boHandle): """ Get the physical address on the device This API is deprecated and will be removed in future release. New clients should use xclGetBOProperties() instead. :param handle: (xclDeviceHandle) device handle :param boHandle: (unsigned int) BO handle :re...
[ "def", "xclGetDeviceAddr", "(", "handle", ",", "boHandle", ")", ":", "libc", ".", "xclGetBOProperties", ".", "restype", "=", "ctypes", ".", "c_uint64", "libc", ".", "xclGetBOProperties", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_uint...
[ 579, 0 ]
[ 592, 52 ]
python
en
['en', 'error', 'th']
False
xclUnmgdPread
(handle, flags, buf, size, offeset)
Perform unmanaged device memory read operation :param handle: Device handle :param flags: Unused :param buf: Destination data pointer :param size: Size of data to copy :param offeset: Absolute offset inside device :return: size of bytes read or appropriate error number This API may be ...
Perform unmanaged device memory read operation :param handle: Device handle :param flags: Unused :param buf: Destination data pointer :param size: Size of data to copy :param offeset: Absolute offset inside device :return: size of bytes read or appropriate error number
def xclUnmgdPread(handle, flags, buf, size, offeset): """ Perform unmanaged device memory read operation :param handle: Device handle :param flags: Unused :param buf: Destination data pointer :param size: Size of data to copy :param offeset: Absolute offset inside device :return: size of...
[ "def", "xclUnmgdPread", "(", "handle", ",", "flags", ",", "buf", ",", "size", ",", "offeset", ")", ":", "libc", ".", "xclUnmgdPread", ".", "restype", "=", "ctypes", ".", "c_size_t", "libc", ".", "xclUnmgdPread", ".", "argtypes", "=", "[", "xclDeviceHandle"...
[ 594, 0 ]
[ 610, 64 ]
python
en
['en', 'error', 'th']
False
xclUnmgdPwrite
(handle, flags, buf, size, offset)
Perform unmanaged device memory write operation :param handle: Device handle :param flags: Unused :param buf: Destination data pointer :param size: Size of data to copy :param offeset: Absolute offset inside device :return: size of bytes read or appropriate error number This API may be...
Perform unmanaged device memory write operation :param handle: Device handle :param flags: Unused :param buf: Destination data pointer :param size: Size of data to copy :param offeset: Absolute offset inside device :return: size of bytes read or appropriate error number
def xclUnmgdPwrite(handle, flags, buf, size, offset): """ Perform unmanaged device memory write operation :param handle: Device handle :param flags: Unused :param buf: Destination data pointer :param size: Size of data to copy :param offeset: Absolute offset inside device :return: size o...
[ "def", "xclUnmgdPwrite", "(", "handle", ",", "flags", ",", "buf", ",", "size", ",", "offset", ")", ":", "libc", ".", "xclUnmgdPwrite", ".", "restype", "=", "ctypes", ".", "c_size_t", "libc", ".", "xclUnmgdPwrite", ".", "argtypes", "=", "[", "xclDeviceHandl...
[ 612, 0 ]
[ 628, 64 ]
python
en
['en', 'error', 'th']
False
xclWrite
(handle, space, offset, hostBuf, size)
Perform register write operation :param handle: Device handle :param space: Address space :param offset: Offset in the address space :param hostBuf: Source data pointer :param size: Size of data to copy :return: size of bytes written or appropriate error number This API may be used to...
Perform register write operation :param handle: Device handle :param space: Address space :param offset: Offset in the address space :param hostBuf: Source data pointer :param size: Size of data to copy :return: size of bytes written or appropriate error number
def xclWrite(handle, space, offset, hostBuf, size): """ Perform register write operation :param handle: Device handle :param space: Address space :param offset: Offset in the address space :param hostBuf: Source data pointer :param size: Size of data to copy :return: size of bytes writt...
[ "def", "xclWrite", "(", "handle", ",", "space", ",", "offset", ",", "hostBuf", ",", "size", ")", ":", "libc", ".", "xclWrite", ".", "restype", "=", "ctypes", ".", "c_size_t", "libc", ".", "xclWrite", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "...
[ 630, 0 ]
[ 647, 62 ]
python
en
['en', 'error', 'th']
False
xclRead
(handle, space, offset, hostBuf, size)
Perform register write operation :param handle: Device handle :param space: Address space :param offset: Offset in the address space :param hostBuf: Destination data pointer :param size: Size of data to copy :return: size of bytes written or appropriate error number This API may be us...
Perform register write operation :param handle: Device handle :param space: Address space :param offset: Offset in the address space :param hostBuf: Destination data pointer :param size: Size of data to copy :return: size of bytes written or appropriate error number
def xclRead(handle, space, offset, hostBuf, size): """ Perform register write operation :param handle: Device handle :param space: Address space :param offset: Offset in the address space :param hostBuf: Destination data pointer :param size: Size of data to copy :return: size of bytes w...
[ "def", "xclRead", "(", "handle", ",", "space", ",", "offset", ",", "hostBuf", ",", "size", ")", ":", "libc", ".", "xclRead", ".", "restype", "=", "ctypes", ".", "c_size_t", "libc", ".", "xclRead", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "cty...
[ 649, 0 ]
[ 666, 61 ]
python
en
['en', 'error', 'th']
False
xclExecBuf
(handle, cmdBO)
xclExecBuf() - Submit an execution request to the embedded (or software) scheduler :param handle: Device handle :param cmdBO: BO handle containing command packet :return: 0 or standard error number Submit an exec buffer for execution. The exec buffer layout is defined by struct ert_packet whic...
xclExecBuf() - Submit an execution request to the embedded (or software) scheduler :param handle: Device handle :param cmdBO: BO handle containing command packet :return: 0 or standard error number
def xclExecBuf(handle, cmdBO): """ xclExecBuf() - Submit an execution request to the embedded (or software) scheduler :param handle: Device handle :param cmdBO: BO handle containing command packet :return: 0 or standard error number Submit an exec buffer for execution. The exec buffer layout is...
[ "def", "xclExecBuf", "(", "handle", ",", "cmdBO", ")", ":", "libc", ".", "xclExecBuf", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclExecBuf", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_uint", "]", "return", "lib...
[ 668, 0 ]
[ 680, 41 ]
python
en
['en', 'error', 'th']
False
xclExecBufWithWaitList
(handle, cmdBO, num_bo_in_wait_list, bo_wait_list)
Submit an execution request to the embedded (or software) scheduler :param handle: Device handle :param cmdBO:BO handle containing command packet :param num_bo_in_wait_list: Number of BO handles in wait list :param bo_wait_list: BO handles that must complete execution before cmdBO is started :r...
Submit an execution request to the embedded (or software) scheduler :param handle: Device handle :param cmdBO:BO handle containing command packet :param num_bo_in_wait_list: Number of BO handles in wait list :param bo_wait_list: BO handles that must complete execution before cmdBO is started :r...
def xclExecBufWithWaitList(handle, cmdBO, num_bo_in_wait_list, bo_wait_list): """ Submit an execution request to the embedded (or software) scheduler :param handle: Device handle :param cmdBO:BO handle containing command packet :param num_bo_in_wait_list: Number of BO handles in wait list :param...
[ "def", "xclExecBufWithWaitList", "(", "handle", ",", "cmdBO", ",", "num_bo_in_wait_list", ",", "bo_wait_list", ")", ":", "libc", ".", "xclExecBufWithWaitList", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclExecBufWithWaitList", ".", "argtypes", "="...
[ 682, 0 ]
[ 698, 88 ]
python
en
['en', 'error', 'th']
False
xclExecWait
(handle, timeoutMilliSec)
xclExecWait() - Wait for one or more execution events on the device :param handle: Device handle :param timeoutMilliSec: How long to wait for :return: Same code as poll system call Wait for notification from the hardware. The function essentially calls "poll" system call on the driver file ha...
xclExecWait() - Wait for one or more execution events on the device :param handle: Device handle :param timeoutMilliSec: How long to wait for :return: Same code as poll system call
def xclExecWait(handle, timeoutMilliSec): """ xclExecWait() - Wait for one or more execution events on the device :param handle: Device handle :param timeoutMilliSec: How long to wait for :return: Same code as poll system call Wait for notification from the hardware. The function essentially c...
[ "def", "xclExecWait", "(", "handle", ",", "timeoutMilliSec", ")", ":", "libc", ".", "xclExecWait", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclExecWait", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_int", "]", "ret...
[ 700, 0 ]
[ 713, 52 ]
python
en
['en', 'error', 'th']
False
xclRegisterInterruptNotify
(handle, userInterrupt, fd)
register *eventfdfile handle for a MSIX interrupt :param handle: Device handle :param userInterrupt: MSIX interrupt number :param fd: Eventfd handle :return: 0 on success or standard errno Support for non managed interrupts (interrupts from custom IPs). fd should be obtained from eventfd s...
register *eventfdfile handle for a MSIX interrupt :param handle: Device handle :param userInterrupt: MSIX interrupt number :param fd: Eventfd handle :return: 0 on success or standard errno
def xclRegisterInterruptNotify(handle, userInterrupt, fd): """ register *eventfdfile handle for a MSIX interrupt :param handle: Device handle :param userInterrupt: MSIX interrupt number :param fd: Eventfd handle :return: 0 on success or standard errno Support for non managed interrupts (int...
[ "def", "xclRegisterInterruptNotify", "(", "handle", ",", "userInterrupt", ",", "fd", ")", ":", "libc", ".", "xclRegisterInterruptNotify", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclRegisterInterruptNotify", ".", "argtypes", "=", "[", "xclDeviceH...
[ 715, 0 ]
[ 729, 69 ]
python
en
['en', 'error', 'th']
False
xclCreateWriteQueue
(handle, q_ctx, q_hdl)
Create Write Queue :param handle:Device handle :param q_ctx:Queue Context :param q_hdl:Queue handle :return: This is used to create queue based on information provided in Queue context. Queue handle is generated if creation successes. This feature will be enabled in a future release. ...
Create Write Queue :param handle:Device handle :param q_ctx:Queue Context :param q_hdl:Queue handle :return:
def xclCreateWriteQueue(handle, q_ctx, q_hdl): """ Create Write Queue :param handle:Device handle :param q_ctx:Queue Context :param q_hdl:Queue handle :return: This is used to create queue based on information provided in Queue context. Queue handle is generated if creation successes. ...
[ "def", "xclCreateWriteQueue", "(", "handle", ",", "q_ctx", ",", "q_hdl", ")", ":", "libc", ".", "xclCreateWriteQueue", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclCreateWriteQueue", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes",...
[ 746, 0 ]
[ 760, 57 ]
python
en
['en', 'error', 'th']
False
xclCreateReadQueue
(handle, q_ctx, q_hdl)
Create Read Queue :param handle:Device handle :param q_ctx:Queue Context :param q_hdl:Queue handle :return: This is used to create queue based on information provided in Queue context. Queue handle is generated if creation successes. This feature will be enabled in a future release. ...
Create Read Queue :param handle:Device handle :param q_ctx:Queue Context :param q_hdl:Queue handle :return:
def xclCreateReadQueue(handle, q_ctx, q_hdl): """ Create Read Queue :param handle:Device handle :param q_ctx:Queue Context :param q_hdl:Queue handle :return: This is used to create queue based on information provided in Queue context. Queue handle is generated if creation successes. ...
[ "def", "xclCreateReadQueue", "(", "handle", ",", "q_ctx", ",", "q_hdl", ")", ":", "libc", ".", "xclCreateReadQueue", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclCreateReadQueue", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ...
[ 762, 0 ]
[ 776, 56 ]
python
en
['en', 'error', 'th']
False
xclAllocQDMABuf
(handle, size, buf_hdl)
Allocate DMA buffer :param handle: Device handle :param size: Buffer handle :param buf_hdl: Buffer size :return: buffer pointer These functions allocate and free DMA buffers which is used for queue read and write. This feature will be enabled in a future release.
Allocate DMA buffer :param handle: Device handle :param size: Buffer handle :param buf_hdl: Buffer size :return: buffer pointer
def xclAllocQDMABuf(handle, size, buf_hdl): """ Allocate DMA buffer :param handle: Device handle :param size: Buffer handle :param buf_hdl: Buffer size :return: buffer pointer These functions allocate and free DMA buffers which is used for queue read and write. This feature will be enab...
[ "def", "xclAllocQDMABuf", "(", "handle", ",", "size", ",", "buf_hdl", ")", ":", "libc", ".", "xclAllocQDMABuf", ".", "restypes", "=", "ctypes", ".", "c_void_p", "libc", ".", "xclAllocQDMABuf", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".",...
[ 779, 0 ]
[ 792, 54 ]
python
en
['en', 'error', 'th']
False
xclFreeQDMABuf
(handle, buf_hdl)
Allocate DMA buffer :param handle: Device handle :param size: Buffer handle :param buf_hdl: Buffer size :return: buffer pointer These functions allocate and free DMA buffers which is used for queue read and write. This feature will be enabled in a future release.
Allocate DMA buffer :param handle: Device handle :param size: Buffer handle :param buf_hdl: Buffer size :return: buffer pointer
def xclFreeQDMABuf(handle, buf_hdl): """ Allocate DMA buffer :param handle: Device handle :param size: Buffer handle :param buf_hdl: Buffer size :return: buffer pointer These functions allocate and free DMA buffers which is used for queue read and write. This feature will be enabled in ...
[ "def", "xclFreeQDMABuf", "(", "handle", ",", "buf_hdl", ")", ":", "libc", ".", "xclFreeQDMABuf", ".", "restypes", "=", "ctypes", ".", "c_int", "libc", ".", "xclFreeQDMABuf", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_uint64", "]", ...
[ 794, 0 ]
[ 807, 47 ]
python
en
['en', 'error', 'th']
False
xclDestroyQueue
(handle, q_hdl)
Destroy Queue :param handle: Device handle :param q_hdl: Queue handle This function destroy Queue and release all resources. It returns -EBUSY if Queue is in running state. This feature will be enabled in a future release.
Destroy Queue :param handle: Device handle :param q_hdl: Queue handle
def xclDestroyQueue(handle, q_hdl): """ Destroy Queue :param handle: Device handle :param q_hdl: Queue handle This function destroy Queue and release all resources. It returns -EBUSY if Queue is in running state. This feature will be enabled in a future release. """ libc.xclDestroyQueue...
[ "def", "xclDestroyQueue", "(", "handle", ",", "q_hdl", ")", ":", "libc", ".", "xclDestroyQueue", ".", "restypes", "=", "ctypes", ".", "c_int", "libc", ".", "xclDestroyQueue", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_uint64", "]", ...
[ 809, 0 ]
[ 820, 46 ]
python
en
['en', 'error', 'th']
False
xclModifyQueue
(handle, q_hdl)
Modify Queue :param handle: Device handle :param q_hdl: Queue handle This function modifies Queue context on the fly. Modifying rid implies to program hardware traffic manager to connect Queue to the kernel pipe.
Modify Queue :param handle: Device handle :param q_hdl: Queue handle
def xclModifyQueue(handle, q_hdl): """ Modify Queue :param handle: Device handle :param q_hdl: Queue handle This function modifies Queue context on the fly. Modifying rid implies to program hardware traffic manager to connect Queue to the kernel pipe. """ libc.xclModifyQueue.restypes = ...
[ "def", "xclModifyQueue", "(", "handle", ",", "q_hdl", ")", ":", "libc", ".", "xclModifyQueue", ".", "restypes", "=", "ctypes", ".", "c_int", "libc", ".", "xclModifyQueue", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_uint64", "]", "...
[ 822, 0 ]
[ 833, 45 ]
python
en
['en', 'error', 'th']
False
xclStartQueue
(handle, q_hdl)
set Queue to running state :param handle: Device handle :param q_hdl: Queue handle This function set xclStartQueue to running state. xclStartQueue starts to process Read and Write requests.
set Queue to running state :param handle: Device handle :param q_hdl: Queue handle
def xclStartQueue(handle, q_hdl): """ set Queue to running state :param handle: Device handle :param q_hdl: Queue handle This function set xclStartQueue to running state. xclStartQueue starts to process Read and Write requests. """ libc.xclStartQueue.restypes = ctypes.c_int libc.xclStar...
[ "def", "xclStartQueue", "(", "handle", ",", "q_hdl", ")", ":", "libc", ".", "xclStartQueue", ".", "restypes", "=", "ctypes", ".", "c_int", "libc", ".", "xclStartQueue", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_uint64", "]", "ret...
[ 835, 0 ]
[ 845, 44 ]
python
en
['en', 'error', 'th']
False
xclStopQueue
(handle, q_hdl)
set Queue to init state :param handle: Device handle :param q_hdl: Queue handle This function set Queue to init state. all pending read and write requests will be flushed. wr_complete and rd_complete will be called with error wbe for flushed requests.
set Queue to init state :param handle: Device handle :param q_hdl: Queue handle
def xclStopQueue(handle, q_hdl): """ set Queue to init state :param handle: Device handle :param q_hdl: Queue handle This function set Queue to init state. all pending read and write requests will be flushed. wr_complete and rd_complete will be called with error wbe for flushed requests. ""...
[ "def", "xclStopQueue", "(", "handle", ",", "q_hdl", ")", ":", "libc", ".", "xclStopQueue", ".", "restypes", "=", "ctypes", ".", "c_int", "libc", ".", "xclStopQueue", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "c_uint64", "]", "return...
[ 847, 0 ]
[ 858, 43 ]
python
en
['en', 'error', 'th']
False
xclWriteQueue
(handle, q_hdl, wr_req)
write data to queue :param handle: Device handle :param q_hdl: Queue handle :param wr_req: write request :return: This function moves data from host memory. Based on the Queue type, data is written as stream or packet. Return: number of bytes been written or error code. stream Q...
write data to queue :param handle: Device handle :param q_hdl: Queue handle :param wr_req: write request :return:
def xclWriteQueue(handle, q_hdl, wr_req): """ write data to queue :param handle: Device handle :param q_hdl: Queue handle :param wr_req: write request :return: This function moves data from host memory. Based on the Queue type, data is written as stream or packet. Return: number of by...
[ "def", "xclWriteQueue", "(", "handle", ",", "q_hdl", ",", "wr_req", ")", ":", "libc", ".", "xclWriteQueue", ".", "restype", "=", "ctypes", ".", "c_ssize_t", "libc", ".", "xclWriteQueue", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "PO...
[ 903, 0 ]
[ 930, 52 ]
python
en
['en', 'error', 'th']
False
xclReadQueue
(handle, q_hdl, wr_req)
write data to queue :param handle: Device handle :param q_hdl: Queue handle :param wr_req: write request :return: This function moves data to host memory. Based on the Queue type, data is read as stream or packet. Return: number of bytes been read or error code. stream Queue: ...
write data to queue :param handle: Device handle :param q_hdl: Queue handle :param wr_req: write request :return:
def xclReadQueue(handle, q_hdl, wr_req): """ write data to queue :param handle: Device handle :param q_hdl: Queue handle :param wr_req: write request :return: This function moves data to host memory. Based on the Queue type, data is read as stream or packet. Return: number of bytes be...
[ "def", "xclReadQueue", "(", "handle", ",", "q_hdl", ",", "wr_req", ")", ":", "libc", ".", "xclReadQueue", ".", "restype", "=", "ctypes", ".", "c_ssize_t", "libc", ".", "xclReadQueue", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", ".", "POINT...
[ 932, 0 ]
[ 951, 51 ]
python
en
['en', 'error', 'th']
False
xclPollCompletion
(handle, min_compl, max_compl, comps, actual_compl, timeout)
for non-blocking read/write, check if there is any request been completed :param handle: device handle :param min_compl: unblock only when receiving min_compl completions :param max_compl: Max number of completion with one poll :param comps: :param actual_compl: :param timeout: timeout ...
for non-blocking read/write, check if there is any request been completed :param handle: device handle :param min_compl: unblock only when receiving min_compl completions :param max_compl: Max number of completion with one poll :param comps: :param actual_compl: :param timeout: timeout ...
def xclPollCompletion(handle, min_compl, max_compl, comps, actual_compl, timeout): """ for non-blocking read/write, check if there is any request been completed :param handle: device handle :param min_compl: unblock only when receiving min_compl completions :param max_compl: Max number of completion...
[ "def", "xclPollCompletion", "(", "handle", ",", "min_compl", ",", "max_compl", ",", "comps", ",", "actual_compl", ",", "timeout", ")", ":", "libc", ".", "xclPollCompletion", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclPollCompletion", ".", ...
[ 953, 0 ]
[ 967, 93 ]
python
en
['en', 'error', 'th']
False
xclRegRead
(handle, cu_index, offset, datap)
Read register in register space of a CU :param handle: Device handle :param cu_index: CU index :param offset: Offset in the register space :param datap: Pointer to where result will be saved :return: 0 or appropriate error number
Read register in register space of a CU :param handle: Device handle :param cu_index: CU index :param offset: Offset in the register space :param datap: Pointer to where result will be saved :return: 0 or appropriate error number
def xclRegRead(handle, cu_index, offset, datap): """ Read register in register space of a CU :param handle: Device handle :param cu_index: CU index :param offset: Offset in the register space :param datap: Pointer to where result will be saved :return: 0 or appropriate error number """ ...
[ "def", "xclRegRead", "(", "handle", ",", "cu_index", ",", "offset", ",", "datap", ")", ":", "libc", ".", "xclRegRead", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclRegRead", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", "....
[ 969, 0 ]
[ 980, 59 ]
python
en
['en', 'error', 'th']
False
xclRgWrite
(handle, cu_index, offset, data)
Write register in register space of a CU :param handle: Device handle :param cu_index: CU index :param offset: Offset in the register space :param data: Pointer to where result will be saved :return: 0 or appropriate error number
Write register in register space of a CU :param handle: Device handle :param cu_index: CU index :param offset: Offset in the register space :param data: Pointer to where result will be saved :return: 0 or appropriate error number
def xclRgWrite(handle, cu_index, offset, data): """ Write register in register space of a CU :param handle: Device handle :param cu_index: CU index :param offset: Offset in the register space :param data: Pointer to where result will be saved :return: 0 or appropriate error number """ ...
[ "def", "xclRgWrite", "(", "handle", ",", "cu_index", ",", "offset", ",", "data", ")", ":", "libc", ".", "xclRegRead", ".", "restype", "=", "ctypes", ".", "c_int", "libc", ".", "xclRegRead", ".", "argtypes", "=", "[", "xclDeviceHandle", ",", "ctypes", "."...
[ 982, 0 ]
[ 993, 58 ]
python
en
['en', 'error', 'th']
False
xclDebugReadIPStatus
(handle, type, debugResults)
:param handle: :param type: :param debugResults: :return:
def xclDebugReadIPStatus(handle, type, debugResults): """ :param handle: :param type: :param debugResults: :return: """ libc.xclDebugReadIPStatus.restype = ctypes.c_size_t libc.xclDebugReadIPStatus.argtypes = [xclDeviceHandle, ctypes.c_int, ctypes.c_void_p] return libc.xclDebugReadI...
[ "def", "xclDebugReadIPStatus", "(", "handle", ",", "type", ",", "debugResults", ")", ":", "libc", ".", "xclDebugReadIPStatus", ".", "restype", "=", "ctypes", ".", "c_size_t", "libc", ".", "xclDebugReadIPStatus", ".", "argtypes", "=", "[", "xclDeviceHandle", ",",...
[ 995, 0 ]
[ 1005, 64 ]
python
en
['en', 'error', 'th']
False
Hashes.__init__
(self, hashes=None)
:param hashes: A dict of algorithm names pointing to lists of allowed hex digests
:param hashes: A dict of algorithm names pointing to lists of allowed hex digests
def __init__(self, hashes=None): # type: (Dict[str, List[str]]) -> None """ :param hashes: A dict of algorithm names pointing to lists of allowed hex digests """ allowed = {} if hashes is not None: for alg, keys in hashes.items(): #...
[ "def", "__init__", "(", "self", ",", "hashes", "=", "None", ")", ":", "# type: (Dict[str, List[str]]) -> None", "allowed", "=", "{", "}", "if", "hashes", "is", "not", "None", ":", "for", "alg", ",", "keys", "in", "hashes", ".", "items", "(", ")", ":", ...
[ 30, 4 ]
[ 41, 31 ]
python
en
['en', 'error', 'th']
False
Hashes.is_hash_allowed
( self, hash_name, # type: str hex_digest, # type: str )
Return whether the given hex digest is allowed.
Return whether the given hex digest is allowed.
def is_hash_allowed( self, hash_name, # type: str hex_digest, # type: str ): # type: (...) -> bool """Return whether the given hex digest is allowed.""" return hex_digest in self._allowed.get(hash_name, [])
[ "def", "is_hash_allowed", "(", "self", ",", "hash_name", ",", "# type: str", "hex_digest", ",", "# type: str", ")", ":", "# type: (...) -> bool", "return", "hex_digest", "in", "self", ".", "_allowed", ".", "get", "(", "hash_name", ",", "[", "]", ")" ]
[ 68, 4 ]
[ 75, 61 ]
python
en
['en', 'en', 'en']
True
Hashes.check_against_chunks
(self, chunks)
Check good hashes against ones built from iterable of chunks of data. Raise HashMismatch if none match.
Check good hashes against ones built from iterable of chunks of data.
def check_against_chunks(self, chunks): # type: (Iterator[bytes]) -> None """Check good hashes against ones built from iterable of chunks of data. Raise HashMismatch if none match. """ gots = {} for hash_name in self._allowed.keys(): try: ...
[ "def", "check_against_chunks", "(", "self", ",", "chunks", ")", ":", "# type: (Iterator[bytes]) -> None", "gots", "=", "{", "}", "for", "hash_name", "in", "self", ".", "_allowed", ".", "keys", "(", ")", ":", "try", ":", "gots", "[", "hash_name", "]", "=", ...
[ 77, 4 ]
[ 99, 25 ]
python
en
['en', 'en', 'en']
True
Hashes.check_against_file
(self, file)
Check good hashes against a file-like object Raise HashMismatch if none match.
Check good hashes against a file-like object
def check_against_file(self, file): # type: (BinaryIO) -> None """Check good hashes against a file-like object Raise HashMismatch if none match. """ return self.check_against_chunks(read_chunks(file))
[ "def", "check_against_file", "(", "self", ",", "file", ")", ":", "# type: (BinaryIO) -> None", "return", "self", ".", "check_against_chunks", "(", "read_chunks", "(", "file", ")", ")" ]
[ 105, 4 ]
[ 112, 59 ]
python
en
['en', 'en', 'en']
True
Hashes.__nonzero__
(self)
Return whether I know any known-good hashes.
Return whether I know any known-good hashes.
def __nonzero__(self): # type: () -> bool """Return whether I know any known-good hashes.""" return bool(self._allowed)
[ "def", "__nonzero__", "(", "self", ")", ":", "# type: () -> bool", "return", "bool", "(", "self", ".", "_allowed", ")" ]
[ 119, 4 ]
[ 122, 34 ]
python
en
['en', 'en', 'en']
True
MissingHashes.__init__
(self)
Don't offer the ``hashes`` kwarg.
Don't offer the ``hashes`` kwarg.
def __init__(self): # type: () -> None """Don't offer the ``hashes`` kwarg.""" # Pass our favorite hash in to generate a "gotten hash". With the # empty list, it will never match, so an error will always raise. super().__init__(hashes={FAVORITE_HASH: []})
[ "def", "__init__", "(", "self", ")", ":", "# type: () -> None", "# Pass our favorite hash in to generate a \"gotten hash\". With the", "# empty list, it will never match, so an error will always raise.", "super", "(", ")", ".", "__init__", "(", "hashes", "=", "{", "FAVORITE_HASH"...
[ 155, 4 ]
[ 160, 52 ]
python
en
['en', 'en', 'sw']
True
log_response
(message, *args, response=None, request=None, logger=request_logger, level=None, exc_info=None)
Log errors based on HttpResponse status. Log 5xx responses as errors and 4xx responses as warnings (unless a level is given as a keyword argument). The HttpResponse status_code and the request are passed to the logger's extra parameter.
Log errors based on HttpResponse status.
def log_response(message, *args, response=None, request=None, logger=request_logger, level=None, exc_info=None): """ Log errors based on HttpResponse status. Log 5xx responses as errors and 4xx responses as warnings (unless a level is given as a keyword argument). The HttpResponse status_code and the ...
[ "def", "log_response", "(", "message", ",", "*", "args", ",", "response", "=", "None", ",", "request", "=", "None", ",", "logger", "=", "request_logger", ",", "level", "=", "None", ",", "exc_info", "=", "None", ")", ":", "# Check if the response has already ...
[ 200, 0 ]
[ 231, 36 ]
python
en
['en', 'error', 'th']
False
AdminEmailHandler.format_subject
(self, subject)
Escape CR and LF characters.
Escape CR and LF characters.
def format_subject(self, subject): """ Escape CR and LF characters. """ return subject.replace('\n', '\\n').replace('\r', '\\r')
[ "def", "format_subject", "(", "self", ",", "subject", ")", ":", "return", "subject", ".", "replace", "(", "'\\n'", ",", "'\\\\n'", ")", ".", "replace", "(", "'\\r'", ",", "'\\\\r'", ")" ]
[ 129, 4 ]
[ 133, 64 ]
python
en
['en', 'error', 'th']
False
ContentBased.__init__
(self, train_file=None, test_file=None, output_file=None, similarity_file=None, similarity_sep='\t', rank_length=10, as_binary=True, sep='\t', output_sep='\t')
Content Based Recommender for Item Recommendation Usage:: >> ContentBased(train, test, similarity_file=similarity_file).compute() :param train_file: File which contains the train set. This file needs to have at least 3 columns (user item feedback_value). :type tra...
Content Based Recommender for Item Recommendation
def __init__(self, train_file=None, test_file=None, output_file=None, similarity_file=None, similarity_sep='\t', rank_length=10, as_binary=True, sep='\t', output_sep='\t'): """ Content Based Recommender for Item Recommendation Usage:: >> ContentBased(train, test, ...
[ "def", "__init__", "(", "self", ",", "train_file", "=", "None", ",", "test_file", "=", "None", ",", "output_file", "=", "None", ",", "similarity_file", "=", "None", ",", "similarity_sep", "=", "'\\t'", ",", "rank_length", "=", "10", ",", "as_binary", "=", ...
[ 23, 4 ]
[ 72, 33 ]
python
en
['en', 'error', 'th']
False
ContentBased.init_model
(self)
Method to initialize the model. Create and read a similarity matrix
Method to initialize the model. Create and read a similarity matrix
def init_model(self): """ Method to initialize the model. Create and read a similarity matrix """ if self.similarity_file is not None: similarity = ReadFile(self.similarity_file, sep=self.similarity_sep, as_binary=False ).read_metadata_or_si...
[ "def", "init_model", "(", "self", ")", ":", "if", "self", ".", "similarity_file", "is", "not", "None", ":", "similarity", "=", "ReadFile", "(", "self", ".", "similarity_file", ",", "sep", "=", "self", ".", "similarity_sep", ",", "as_binary", "=", "False", ...
[ 74, 4 ]
[ 94, 78 ]
python
en
['en', 'error', 'th']
False
ContentBased.compute
(self, verbose=True, metrics=None, verbose_evaluation=True, as_table=False, table_sep='\t', n_ranks=None)
Extends compute method from BaseItemRecommendation. Method to run recommender algorithm :param verbose: Print recommender and database information :type verbose: bool, default True :param metrics: List of evaluation metrics :type metrics: list, default None :param ver...
Extends compute method from BaseItemRecommendation. Method to run recommender algorithm
def compute(self, verbose=True, metrics=None, verbose_evaluation=True, as_table=False, table_sep='\t', n_ranks=None): """ Extends compute method from BaseItemRecommendation. Method to run recommender algorithm :param verbose: Print recommender and database information :type verbose: boo...
[ "def", "compute", "(", "self", ",", "verbose", "=", "True", ",", "metrics", "=", "None", ",", "verbose_evaluation", "=", "True", ",", "as_table", "=", "False", ",", "table_sep", "=", "'\\t'", ",", "n_ranks", "=", "None", ")", ":", "super", "(", "Conten...
[ 119, 4 ]
[ 161, 111 ]
python
en
['en', 'error', 'th']
False
gcd
(p, q)
Returns the greatest common divisor of p and q >>> gcd(48, 180) 12
Returns the greatest common divisor of p and q
def gcd(p, q): """Returns the greatest common divisor of p and q >>> gcd(48, 180) 12 """ while q != 0: (p, q) = (q, p % q) return p
[ "def", "gcd", "(", "p", ",", "q", ")", ":", "while", "q", "!=", "0", ":", "(", "p", ",", "q", ")", "=", "(", "q", ",", "p", "%", "q", ")", "return", "p" ]
[ 29, 0 ]
[ 38, 12 ]
python
en
['en', 'en', 'en']
True
get_primality_testing_rounds
(number)
Returns minimum number of rounds for Miller-Rabing primality testing, based on number bitsize. According to NIST FIPS 186-4, Appendix C, Table C.3, minimum number of rounds of M-R testing, using an error probability of 2 ** (-100), for different p, q bitsizes are: * p, q bitsize: 512; rounds: 7 ...
Returns minimum number of rounds for Miller-Rabing primality testing, based on number bitsize.
def get_primality_testing_rounds(number): """Returns minimum number of rounds for Miller-Rabing primality testing, based on number bitsize. According to NIST FIPS 186-4, Appendix C, Table C.3, minimum number of rounds of M-R testing, using an error probability of 2 ** (-100), for different p, q bit...
[ "def", "get_primality_testing_rounds", "(", "number", ")", ":", "# Calculate number bitsize.", "bitsize", "=", "rsa", ".", "common", ".", "bit_size", "(", "number", ")", "# Set number of rounds.", "if", "bitsize", ">=", "1536", ":", "return", "3", "if", "bitsize",...
[ 41, 0 ]
[ 64, 13 ]
python
en
['en', 'en', 'en']
True
miller_rabin_primality_testing
(n, k)
Calculates whether n is composite (which is always correct) or prime (which theoretically is incorrect with error probability 4**-k), by applying Miller-Rabin primality testing. For reference and implementation example, see: https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test :param ...
Calculates whether n is composite (which is always correct) or prime (which theoretically is incorrect with error probability 4**-k), by applying Miller-Rabin primality testing.
def miller_rabin_primality_testing(n, k): """Calculates whether n is composite (which is always correct) or prime (which theoretically is incorrect with error probability 4**-k), by applying Miller-Rabin primality testing. For reference and implementation example, see: https://en.wikipedia.org/wiki...
[ "def", "miller_rabin_primality_testing", "(", "n", ",", "k", ")", ":", "# prevent potential infinite loop when d = 0", "if", "n", "<", "2", ":", "return", "False", "# Decompose (n - 1) to write it as (2 ** r) * d", "# While d is even, divide it by 2 and increase the exponent.", "...
[ 67, 0 ]
[ 117, 15 ]
python
en
['en', 'en', 'en']
True
is_prime
(number)
Returns True if the number is prime, and False otherwise. >>> is_prime(2) True >>> is_prime(42) False >>> is_prime(41) True
Returns True if the number is prime, and False otherwise.
def is_prime(number): """Returns True if the number is prime, and False otherwise. >>> is_prime(2) True >>> is_prime(42) False >>> is_prime(41) True """ # Check for small numbers. if number < 10: return number in {2, 3, 5, 7} # Check for even numbers. if not (n...
[ "def", "is_prime", "(", "number", ")", ":", "# Check for small numbers.", "if", "number", "<", "10", ":", "return", "number", "in", "{", "2", ",", "3", ",", "5", ",", "7", "}", "# Check for even numbers.", "if", "not", "(", "number", "&", "1", ")", ":"...
[ 120, 0 ]
[ 143, 56 ]
python
en
['en', 'en', 'en']
True
getprime
(nbits)
Returns a prime number that can be stored in 'nbits' bits. >>> p = getprime(128) >>> is_prime(p-1) False >>> is_prime(p) True >>> is_prime(p+1) False >>> from rsa import common >>> common.bit_size(p) == 128 True
Returns a prime number that can be stored in 'nbits' bits.
def getprime(nbits): """Returns a prime number that can be stored in 'nbits' bits. >>> p = getprime(128) >>> is_prime(p-1) False >>> is_prime(p) True >>> is_prime(p+1) False >>> from rsa import common >>> common.bit_size(p) == 128 True """ assert nbits > 3 # the l...
[ "def", "getprime", "(", "nbits", ")", ":", "assert", "nbits", ">", "3", "# the loop wil hang on too small numbers", "while", "True", ":", "integer", "=", "rsa", ".", "randnum", ".", "read_random_odd_int", "(", "nbits", ")", "# Test for primeness", "if", "is_prime"...
[ 146, 0 ]
[ 169, 26 ]
python
en
['en', 'en', 'en']
True
are_relatively_prime
(a, b)
Returns True if a and b are relatively prime, and False if they are not. >>> are_relatively_prime(2, 3) True >>> are_relatively_prime(2, 4) False
Returns True if a and b are relatively prime, and False if they are not.
def are_relatively_prime(a, b): """Returns True if a and b are relatively prime, and False if they are not. >>> are_relatively_prime(2, 3) True >>> are_relatively_prime(2, 4) False """ d = gcd(a, b) return d == 1
[ "def", "are_relatively_prime", "(", "a", ",", "b", ")", ":", "d", "=", "gcd", "(", "a", ",", "b", ")", "return", "d", "==", "1" ]
[ 174, 0 ]
[ 185, 17 ]
python
en
['en', 'en', 'en']
True
AdminSite.check
(self, app_configs)
Run the system checks on all ModelAdmins, except if they aren't customized at all.
Run the system checks on all ModelAdmins, except if they aren't customized at all.
def check(self, app_configs): """ Run the system checks on all ModelAdmins, except if they aren't customized at all. """ if app_configs is None: app_configs = apps.get_app_configs() app_configs = set(app_configs) # Speed up lookups below errors = [] ...
[ "def", "check", "(", "self", ",", "app_configs", ")", ":", "if", "app_configs", "is", "None", ":", "app_configs", "=", "apps", ".", "get_app_configs", "(", ")", "app_configs", "=", "set", "(", "app_configs", ")", "# Speed up lookups below", "errors", "=", "[...
[ 78, 4 ]
[ 92, 21 ]
python
en
['en', 'error', 'th']
False
AdminSite.register
(self, model_or_iterable, admin_class=None, **options)
Register the given model(s) with the given admin class. The model(s) should be Model classes, not instances. If an admin class isn't given, use ModelAdmin (the default admin options). If keyword arguments are given -- e.g., list_display -- apply them as options to the admin cl...
Register the given model(s) with the given admin class.
def register(self, model_or_iterable, admin_class=None, **options): """ Register the given model(s) with the given admin class. The model(s) should be Model classes, not instances. If an admin class isn't given, use ModelAdmin (the default admin options). If keyword arguments a...
[ "def", "register", "(", "self", ",", "model_or_iterable", ",", "admin_class", "=", "None", ",", "*", "*", "options", ")", ":", "admin_class", "=", "admin_class", "or", "ModelAdmin", "if", "isinstance", "(", "model_or_iterable", ",", "ModelBase", ")", ":", "m...
[ 94, 4 ]
[ 140, 64 ]
python
en
['en', 'error', 'th']
False
AdminSite.unregister
(self, model_or_iterable)
Unregister the given model(s). If a model isn't already registered, raise NotRegistered.
Unregister the given model(s).
def unregister(self, model_or_iterable): """ Unregister the given model(s). If a model isn't already registered, raise NotRegistered. """ if isinstance(model_or_iterable, ModelBase): model_or_iterable = [model_or_iterable] for model in model_or_iterable: ...
[ "def", "unregister", "(", "self", ",", "model_or_iterable", ")", ":", "if", "isinstance", "(", "model_or_iterable", ",", "ModelBase", ")", ":", "model_or_iterable", "=", "[", "model_or_iterable", "]", "for", "model", "in", "model_or_iterable", ":", "if", "model"...
[ 142, 4 ]
[ 153, 37 ]
python
en
['en', 'error', 'th']
False
AdminSite.is_registered
(self, model)
Check if a model class is registered with this `AdminSite`.
Check if a model class is registered with this `AdminSite`.
def is_registered(self, model): """ Check if a model class is registered with this `AdminSite`. """ return model in self._registry
[ "def", "is_registered", "(", "self", ",", "model", ")", ":", "return", "model", "in", "self", ".", "_registry" ]
[ 155, 4 ]
[ 159, 38 ]
python
en
['en', 'error', 'th']
False
AdminSite.add_action
(self, action, name=None)
Register an action to be available globally.
Register an action to be available globally.
def add_action(self, action, name=None): """ Register an action to be available globally. """ name = name or action.__name__ self._actions[name] = action self._global_actions[name] = action
[ "def", "add_action", "(", "self", ",", "action", ",", "name", "=", "None", ")", ":", "name", "=", "name", "or", "action", ".", "__name__", "self", ".", "_actions", "[", "name", "]", "=", "action", "self", ".", "_global_actions", "[", "name", "]", "="...
[ 161, 4 ]
[ 167, 43 ]
python
en
['en', 'error', 'th']
False
AdminSite.disable_action
(self, name)
Disable a globally-registered action. Raise KeyError for invalid names.
Disable a globally-registered action. Raise KeyError for invalid names.
def disable_action(self, name): """ Disable a globally-registered action. Raise KeyError for invalid names. """ del self._actions[name]
[ "def", "disable_action", "(", "self", ",", "name", ")", ":", "del", "self", ".", "_actions", "[", "name", "]" ]
[ 169, 4 ]
[ 173, 31 ]
python
en
['en', 'error', 'th']
False
AdminSite.get_action
(self, name)
Explicitly get a registered global action whether it's enabled or not. Raise KeyError for invalid names.
Explicitly get a registered global action whether it's enabled or not. Raise KeyError for invalid names.
def get_action(self, name): """ Explicitly get a registered global action whether it's enabled or not. Raise KeyError for invalid names. """ return self._global_actions[name]
[ "def", "get_action", "(", "self", ",", "name", ")", ":", "return", "self", ".", "_global_actions", "[", "name", "]" ]
[ 175, 4 ]
[ 180, 41 ]
python
en
['en', 'error', 'th']
False
AdminSite.actions
(self)
Get all the enabled actions as an iterable of (name, func).
Get all the enabled actions as an iterable of (name, func).
def actions(self): """ Get all the enabled actions as an iterable of (name, func). """ return self._actions.items()
[ "def", "actions", "(", "self", ")", ":", "return", "self", ".", "_actions", ".", "items", "(", ")" ]
[ 183, 4 ]
[ 187, 36 ]
python
en
['en', 'error', 'th']
False
AdminSite.has_permission
(self, request)
Return True if the given HttpRequest has permission to view *at least one* page in the admin site.
Return True if the given HttpRequest has permission to view *at least one* page in the admin site.
def has_permission(self, request): """ Return True if the given HttpRequest has permission to view *at least one* page in the admin site. """ return request.user.is_active and request.user.is_staff
[ "def", "has_permission", "(", "self", ",", "request", ")", ":", "return", "request", ".", "user", ".", "is_active", "and", "request", ".", "user", ".", "is_staff" ]
[ 189, 4 ]
[ 194, 63 ]
python
en
['en', 'error', 'th']
False
AdminSite.admin_view
(self, view, cacheable=False)
Decorator to create an admin view attached to this ``AdminSite``. This wraps the view and provides permission checking by calling ``self.has_permission``. You'll want to use this from within ``AdminSite.get_urls()``: class MyAdminSite(AdminSite): def get_u...
Decorator to create an admin view attached to this ``AdminSite``. This wraps the view and provides permission checking by calling ``self.has_permission``.
def admin_view(self, view, cacheable=False): """ Decorator to create an admin view attached to this ``AdminSite``. This wraps the view and provides permission checking by calling ``self.has_permission``. You'll want to use this from within ``AdminSite.get_urls()``: ...
[ "def", "admin_view", "(", "self", ",", "view", ",", "cacheable", "=", "False", ")", ":", "def", "inner", "(", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "not", "self", ".", "has_permission", "(", "request", ")", ":", "if"...
[ 196, 4 ]
[ 238, 42 ]
python
en
['en', 'error', 'th']
False
AdminSite.each_context
(self, request)
Return a dictionary of variables to put in the template context for *every* page in the admin site. For sites running on a subpath, use the SCRIPT_NAME value if site_url hasn't been customized.
Return a dictionary of variables to put in the template context for *every* page in the admin site.
def each_context(self, request): """ Return a dictionary of variables to put in the template context for *every* page in the admin site. For sites running on a subpath, use the SCRIPT_NAME value if site_url hasn't been customized. """ script_name = request.META['...
[ "def", "each_context", "(", "self", ",", "request", ")", ":", "script_name", "=", "request", ".", "META", "[", "'SCRIPT_NAME'", "]", "site_url", "=", "script_name", "if", "self", ".", "site_url", "==", "'/'", "and", "script_name", "else", "self", ".", "sit...
[ 300, 4 ]
[ 318, 9 ]
python
en
['en', 'error', 'th']
False
AdminSite.password_change
(self, request, extra_context=None)
Handle the "change password" task -- both form display and validation.
Handle the "change password" task -- both form display and validation.
def password_change(self, request, extra_context=None): """ Handle the "change password" task -- both form display and validation. """ from django.contrib.admin.forms import AdminPasswordChangeForm from django.contrib.auth.views import PasswordChangeView url = reverse('ad...
[ "def", "password_change", "(", "self", ",", "request", ",", "extra_context", "=", "None", ")", ":", "from", "django", ".", "contrib", ".", "admin", ".", "forms", "import", "AdminPasswordChangeForm", "from", "django", ".", "contrib", ".", "auth", ".", "views"...
[ 320, 4 ]
[ 335, 62 ]
python
en
['en', 'error', 'th']
False
AdminSite.password_change_done
(self, request, extra_context=None)
Display the "success" page after a password change.
Display the "success" page after a password change.
def password_change_done(self, request, extra_context=None): """ Display the "success" page after a password change. """ from django.contrib.auth.views import PasswordChangeDoneView defaults = { 'extra_context': {**self.each_context(request), **(extra_context or {})},...
[ "def", "password_change_done", "(", "self", ",", "request", ",", "extra_context", "=", "None", ")", ":", "from", "django", ".", "contrib", ".", "auth", ".", "views", "import", "PasswordChangeDoneView", "defaults", "=", "{", "'extra_context'", ":", "{", "*", ...
[ 337, 4 ]
[ 348, 66 ]
python
en
['en', 'error', 'th']
False
AdminSite.i18n_javascript
(self, request, extra_context=None)
Display the i18n JavaScript that the Django admin requires. `extra_context` is unused but present for consistency with the other admin views.
Display the i18n JavaScript that the Django admin requires.
def i18n_javascript(self, request, extra_context=None): """ Display the i18n JavaScript that the Django admin requires. `extra_context` is unused but present for consistency with the other admin views. """ return JavaScriptCatalog.as_view(packages=['django.contrib.admin'...
[ "def", "i18n_javascript", "(", "self", ",", "request", ",", "extra_context", "=", "None", ")", ":", "return", "JavaScriptCatalog", ".", "as_view", "(", "packages", "=", "[", "'django.contrib.admin'", "]", ")", "(", "request", ")" ]
[ 350, 4 ]
[ 357, 84 ]
python
en
['en', 'error', 'th']
False
AdminSite.logout
(self, request, extra_context=None)
Log out the user for the given HttpRequest. This should *not* assume the user is already logged in.
Log out the user for the given HttpRequest.
def logout(self, request, extra_context=None): """ Log out the user for the given HttpRequest. This should *not* assume the user is already logged in. """ from django.contrib.auth.views import LogoutView defaults = { 'extra_context': { **self....
[ "def", "logout", "(", "self", ",", "request", ",", "extra_context", "=", "None", ")", ":", "from", "django", ".", "contrib", ".", "auth", ".", "views", "import", "LogoutView", "defaults", "=", "{", "'extra_context'", ":", "{", "*", "*", "self", ".", "e...
[ 360, 4 ]
[ 379, 54 ]
python
en
['en', 'error', 'th']
False
AdminSite.login
(self, request, extra_context=None)
Display the login form for the given HttpRequest.
Display the login form for the given HttpRequest.
def login(self, request, extra_context=None): """ Display the login form for the given HttpRequest. """ if request.method == 'GET' and self.has_permission(request): # Already logged-in, redirect to admin index index_path = reverse('admin:index', current_app=self.n...
[ "def", "login", "(", "self", ",", "request", ",", "extra_context", "=", "None", ")", ":", "if", "request", ".", "method", "==", "'GET'", "and", "self", ".", "has_permission", "(", "request", ")", ":", "# Already logged-in, redirect to admin index", "index_path",...
[ 382, 4 ]
[ 413, 53 ]
python
en
['en', 'error', 'th']
False
AdminSite._build_app_dict
(self, request, label=None)
Build the app dictionary. The optional `label` parameter filters models of a specific app.
Build the app dictionary. The optional `label` parameter filters models of a specific app.
def _build_app_dict(self, request, label=None): """ Build the app dictionary. The optional `label` parameter filters models of a specific app. """ app_dict = {} if label: models = { m: m_a for m, m_a in self._registry.items() i...
[ "def", "_build_app_dict", "(", "self", ",", "request", ",", "label", "=", "None", ")", ":", "app_dict", "=", "{", "}", "if", "label", ":", "models", "=", "{", "m", ":", "m_a", "for", "m", ",", "m_a", "in", "self", ".", "_registry", ".", "items", ...
[ 431, 4 ]
[ 497, 23 ]
python
en
['en', 'error', 'th']
False
AdminSite.get_app_list
(self, request)
Return a sorted list of all the installed apps that have been registered in this site.
Return a sorted list of all the installed apps that have been registered in this site.
def get_app_list(self, request): """ Return a sorted list of all the installed apps that have been registered in this site. """ app_dict = self._build_app_dict(request) # Sort the apps alphabetically. app_list = sorted(app_dict.values(), key=lambda x: x['name'].l...
[ "def", "get_app_list", "(", "self", ",", "request", ")", ":", "app_dict", "=", "self", ".", "_build_app_dict", "(", "request", ")", "# Sort the apps alphabetically.", "app_list", "=", "sorted", "(", "app_dict", ".", "values", "(", ")", ",", "key", "=", "lamb...
[ 499, 4 ]
[ 513, 23 ]
python
en
['en', 'error', 'th']
False
AdminSite.index
(self, request, extra_context=None)
Display the main admin index page, which lists all of the installed apps that have been registered in this site.
Display the main admin index page, which lists all of the installed apps that have been registered in this site.
def index(self, request, extra_context=None): """ Display the main admin index page, which lists all of the installed apps that have been registered in this site. """ app_list = self.get_app_list(request) context = { **self.each_context(request), ...
[ "def", "index", "(", "self", ",", "request", ",", "extra_context", "=", "None", ")", ":", "app_list", "=", "self", ".", "get_app_list", "(", "request", ")", "context", "=", "{", "*", "*", "self", ".", "each_context", "(", "request", ")", ",", "'title'"...
[ 516, 4 ]
[ 533, 92 ]
python
en
['en', 'error', 'th']
False
_simple_domain_name_validator
(value)
Validate that the given value contains no whitespaces to prevent common typos.
Validate that the given value contains no whitespaces to prevent common typos.
def _simple_domain_name_validator(value): """ Validate that the given value contains no whitespaces to prevent common typos. """ checks = ((s in value) for s in string.whitespace) if any(checks): raise ValidationError( _("The domain name cannot contain any spaces or tabs."), ...
[ "def", "_simple_domain_name_validator", "(", "value", ")", ":", "checks", "=", "(", "(", "s", "in", "value", ")", "for", "s", "in", "string", ".", "whitespace", ")", "if", "any", "(", "checks", ")", ":", "raise", "ValidationError", "(", "_", "(", "\"Th...
[ 11, 0 ]
[ 21, 9 ]
python
en
['en', 'error', 'th']
False
clear_site_cache
(sender, **kwargs)
Clear the cache (if primed) each time a site is saved or deleted.
Clear the cache (if primed) each time a site is saved or deleted.
def clear_site_cache(sender, **kwargs): """ Clear the cache (if primed) each time a site is saved or deleted. """ instance = kwargs['instance'] using = kwargs['using'] try: del SITE_CACHE[instance.pk] except KeyError: pass try: del SITE_CACHE[Site.objects.using(us...
[ "def", "clear_site_cache", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "instance", "=", "kwargs", "[", "'instance'", "]", "using", "=", "kwargs", "[", "'using'", "]", "try", ":", "del", "SITE_CACHE", "[", "instance", ".", "pk", "]", "except", "Ke...
[ 102, 0 ]
[ 115, 12 ]
python
en
['en', 'error', 'th']
False
SiteManager.get_current
(self, request=None)
Return the current Site based on the SITE_ID in the project's settings. If SITE_ID isn't defined, return the site with domain matching request.get_host(). The ``Site`` object is cached the first time it's retrieved from the database.
Return the current Site based on the SITE_ID in the project's settings. If SITE_ID isn't defined, return the site with domain matching request.get_host(). The ``Site`` object is cached the first time it's retrieved from the database.
def get_current(self, request=None): """ Return the current Site based on the SITE_ID in the project's settings. If SITE_ID isn't defined, return the site with domain matching request.get_host(). The ``Site`` object is cached the first time it's retrieved from the database. ...
[ "def", "get_current", "(", "self", ",", "request", "=", "None", ")", ":", "from", "django", ".", "conf", "import", "settings", "if", "getattr", "(", "settings", ",", "'SITE_ID'", ",", "''", ")", ":", "site_id", "=", "settings", ".", "SITE_ID", "return", ...
[ 47, 4 ]
[ 66, 9 ]
python
en
['en', 'error', 'th']
False
SiteManager.clear_cache
(self)
Clear the ``Site`` object cache.
Clear the ``Site`` object cache.
def clear_cache(self): """Clear the ``Site`` object cache.""" global SITE_CACHE SITE_CACHE = {}
[ "def", "clear_cache", "(", "self", ")", ":", "global", "SITE_CACHE", "SITE_CACHE", "=", "{", "}" ]
[ 68, 4 ]
[ 71, 23 ]
python
en
['en', 'en', 'en']
True
_hash_of_file
(path: str, algorithm: str)
Return the hash digest of a file.
Return the hash digest of a file.
def _hash_of_file(path: str, algorithm: str) -> str: """Return the hash digest of a file.""" with open(path, 'rb') as archive: hash = hashlib.new(algorithm) for chunk in read_chunks(archive): hash.update(chunk) return hash.hexdigest()
[ "def", "_hash_of_file", "(", "path", ":", "str", ",", "algorithm", ":", "str", ")", "->", "str", ":", "with", "open", "(", "path", ",", "'rb'", ")", "as", "archive", ":", "hash", "=", "hashlib", ".", "new", "(", "algorithm", ")", "for", "chunk", "i...
[ 48, 0 ]
[ 54, 27 ]
python
en
['en', 'en', 'en']
True
Storage.open
(self, name, mode='rb')
Retrieve the specified file from storage.
Retrieve the specified file from storage.
def open(self, name, mode='rb'): """Retrieve the specified file from storage.""" return self._open(name, mode)
[ "def", "open", "(", "self", ",", "name", ",", "mode", "=", "'rb'", ")", ":", "return", "self", ".", "_open", "(", "name", ",", "mode", ")" ]
[ 35, 4 ]
[ 37, 37 ]
python
en
['en', 'en', 'en']
True
Storage.save
(self, name, content, max_length=None)
Save new content to the file specified by name. The content should be a proper File object or any Python file-like object, ready to be read from the beginning.
Save new content to the file specified by name. The content should be a proper File object or any Python file-like object, ready to be read from the beginning.
def save(self, name, content, max_length=None): """ Save new content to the file specified by name. The content should be a proper File object or any Python file-like object, ready to be read from the beginning. """ # Get the proper name for the file, as it will actually ...
[ "def", "save", "(", "self", ",", "name", ",", "content", ",", "max_length", "=", "None", ")", ":", "# Get the proper name for the file, as it will actually be saved.", "if", "name", "is", "None", ":", "name", "=", "content", ".", "name", "if", "not", "hasattr", ...
[ 39, 4 ]
[ 53, 40 ]
python
en
['en', 'error', 'th']
False
Storage.get_valid_name
(self, name)
Return a filename, based on the provided filename, that's suitable for use in the target storage system.
Return a filename, based on the provided filename, that's suitable for use in the target storage system.
def get_valid_name(self, name): """ Return a filename, based on the provided filename, that's suitable for use in the target storage system. """ return get_valid_filename(name)
[ "def", "get_valid_name", "(", "self", ",", "name", ")", ":", "return", "get_valid_filename", "(", "name", ")" ]
[ 57, 4 ]
[ 62, 39 ]
python
en
['en', 'error', 'th']
False
Storage.get_alternative_name
(self, file_root, file_ext)
Return an alternative filename, by adding an underscore and a random 7 character alphanumeric string (before the file extension, if one exists) to the filename.
Return an alternative filename, by adding an underscore and a random 7 character alphanumeric string (before the file extension, if one exists) to the filename.
def get_alternative_name(self, file_root, file_ext): """ Return an alternative filename, by adding an underscore and a random 7 character alphanumeric string (before the file extension, if one exists) to the filename. """ return '%s_%s%s' % (file_root, get_random_string(7...
[ "def", "get_alternative_name", "(", "self", ",", "file_root", ",", "file_ext", ")", ":", "return", "'%s_%s%s'", "%", "(", "file_root", ",", "get_random_string", "(", "7", ")", ",", "file_ext", ")" ]
[ 64, 4 ]
[ 70, 70 ]
python
en
['en', 'error', 'th']
False
Storage.get_available_name
(self, name, max_length=None)
Return a filename that's free on the target storage system and available for new content to be written to.
Return a filename that's free on the target storage system and available for new content to be written to.
def get_available_name(self, name, max_length=None): """ Return a filename that's free on the target storage system and available for new content to be written to. """ dir_name, file_name = os.path.split(name) if '..' in pathlib.PurePath(dir_name).parts: raise...
[ "def", "get_available_name", "(", "self", ",", "name", ",", "max_length", "=", "None", ")", ":", "dir_name", ",", "file_name", "=", "os", ".", "path", ".", "split", "(", "name", ")", "if", "'..'", "in", "pathlib", ".", "PurePath", "(", "dir_name", ")",...
[ 72, 4 ]
[ 103, 19 ]
python
en
['en', 'error', 'th']
False
Storage.generate_filename
(self, filename)
Validate the filename by calling get_valid_name() and return a filename to be passed to the save() method.
Validate the filename by calling get_valid_name() and return a filename to be passed to the save() method.
def generate_filename(self, filename): """ Validate the filename by calling get_valid_name() and return a filename to be passed to the save() method. """ # `filename` may include a path as returned by FileField.upload_to. dirname, filename = os.path.split(filename) ...
[ "def", "generate_filename", "(", "self", ",", "filename", ")", ":", "# `filename` may include a path as returned by FileField.upload_to.", "dirname", ",", "filename", "=", "os", ".", "path", ".", "split", "(", "filename", ")", "if", "'..'", "in", "pathlib", ".", "...
[ 105, 4 ]
[ 114, 85 ]
python
en
['en', 'error', 'th']
False