body_hash
stringlengths
64
64
body
stringlengths
23
109k
docstring
stringlengths
1
57k
path
stringlengths
4
198
name
stringlengths
1
115
repository_name
stringlengths
7
111
repository_stars
float64
0
191k
lang
stringclasses
1 value
body_without_docstring
stringlengths
14
108k
unified
stringlengths
45
133k
011c07a5452afd434cf4a9d8c53e4f6b4451a7a03c15b612df652192dbe4fb4c
def measure_curvature_real(self, ploty, left_fit_cr, right_fit_cr): '\n Calculates the curvature of polynomial functions in meters.\n ' ym_per_pix = (30 / 720) xm_per_pix = (3.7 / 700) y_eval = np.max(ploty) left_curverad = (((1 + (((((2 * left_fit_cr[0]) * y_eval) * ym_per_pix) + left...
Calculates the curvature of polynomial functions in meters.
source/lane_detection.py
measure_curvature_real
48cfu/CarND-Advanced-Lane-Lines
0
python
def measure_curvature_real(self, ploty, left_fit_cr, right_fit_cr): '\n \n ' ym_per_pix = (30 / 720) xm_per_pix = (3.7 / 700) y_eval = np.max(ploty) left_curverad = (((1 + (((((2 * left_fit_cr[0]) * y_eval) * ym_per_pix) + left_fit_cr[1]) ** 2)) ** 1.5) / np.absolute((2 * left_fit_cr[0...
def measure_curvature_real(self, ploty, left_fit_cr, right_fit_cr): '\n \n ' ym_per_pix = (30 / 720) xm_per_pix = (3.7 / 700) y_eval = np.max(ploty) left_curverad = (((1 + (((((2 * left_fit_cr[0]) * y_eval) * ym_per_pix) + left_fit_cr[1]) ** 2)) ** 1.5) / np.absolute((2 * left_fit_cr[0...
3122e139e7b6179257f162146050e6fb9170de90294ba72847059eae6e94e5e8
def process_image(self, img_original): ' \n first undistort\n ' img_undistorted = self.camera.undistort(img_original) '\n Get combined binary image\n ' (combined_binary, color_binary) = self.camera.binary_from_combined_thresholds(img_undistorted, self.sobel_kernel, self.thres...
first undistort
source/lane_detection.py
process_image
48cfu/CarND-Advanced-Lane-Lines
0
python
def process_image(self, img_original): ' \n \n ' img_undistorted = self.camera.undistort(img_original) '\n Get combined binary image\n ' (combined_binary, color_binary) = self.camera.binary_from_combined_thresholds(img_undistorted, self.sobel_kernel, self.thresh_color_s_chann...
def process_image(self, img_original): ' \n \n ' img_undistorted = self.camera.undistort(img_original) '\n Get combined binary image\n ' (combined_binary, color_binary) = self.camera.binary_from_combined_thresholds(img_undistorted, self.sobel_kernel, self.thresh_color_s_chann...
ee7c312816904c8840538fe7bcacfd486984f2e4caf3282db53e03b497dc8e80
def __next__(self): '\n\t\tGets the next event in the buffer,\n\t\totherwise raises StopIteration\n\t\t' if (len(self._buffer) > 0): return self._buffer.pop(0) else: raise StopIteration
Gets the next event in the buffer, otherwise raises StopIteration
src/pyrtc/transport.py
__next__
IsaacDorenkamp/PyRTC
0
python
def __next__(self): '\n\t\tGets the next event in the buffer,\n\t\totherwise raises StopIteration\n\t\t' if (len(self._buffer) > 0): return self._buffer.pop(0) else: raise StopIteration
def __next__(self): '\n\t\tGets the next event in the buffer,\n\t\totherwise raises StopIteration\n\t\t' if (len(self._buffer) > 0): return self._buffer.pop(0) else: raise StopIteration<|docstring|>Gets the next event in the buffer, otherwise raises StopIteration<|endoftext|>
3078caf0b7bd479cd5786c593f5ba89b59dab04bd2201102d75924bac55be1d7
def post(self, evt): '\n\t\tAdd an event to the buffer.\n\t\t' self._buffer.append(evt)
Add an event to the buffer.
src/pyrtc/transport.py
post
IsaacDorenkamp/PyRTC
0
python
def post(self, evt): '\n\t\t\n\t\t' self._buffer.append(evt)
def post(self, evt): '\n\t\t\n\t\t' self._buffer.append(evt)<|docstring|>Add an event to the buffer.<|endoftext|>
1fb8af2865ef3afc5139da190cbeb0feb82cd4cecdb62dad8ebeb48ab18af0a3
@property def pending(self): '\n\t\tTrue if there are events in\n\t\tthe buffer, False otherwise\n\n\t\t:type: bool\n\t\t' return len(self._buffer)
True if there are events in the buffer, False otherwise :type: bool
src/pyrtc/transport.py
pending
IsaacDorenkamp/PyRTC
0
python
@property def pending(self): '\n\t\tTrue if there are events in\n\t\tthe buffer, False otherwise\n\n\t\t:type: bool\n\t\t' return len(self._buffer)
@property def pending(self): '\n\t\tTrue if there are events in\n\t\tthe buffer, False otherwise\n\n\t\t:type: bool\n\t\t' return len(self._buffer)<|docstring|>True if there are events in the buffer, False otherwise :type: bool<|endoftext|>
23506dfcdc8653604b0109d083afddfeb552448ce77f7002dd0daaacfac84af2
def __init__(self, cli_sock): '\n\t\tCreates a WebSocket connection\n\t\tover the given socket.\n\n\t\t:param cli_sock: The socket to send data through.\n\t\t:type cli_sock: socket\n\t\t' self._sock = cli_sock self._conn = WSConnection(ConnectionType.SERVER) self._closed = False self._receivers = []
Creates a WebSocket connection over the given socket. :param cli_sock: The socket to send data through. :type cli_sock: socket
src/pyrtc/transport.py
__init__
IsaacDorenkamp/PyRTC
0
python
def __init__(self, cli_sock): '\n\t\tCreates a WebSocket connection\n\t\tover the given socket.\n\n\t\t:param cli_sock: The socket to send data through.\n\t\t:type cli_sock: socket\n\t\t' self._sock = cli_sock self._conn = WSConnection(ConnectionType.SERVER) self._closed = False self._receivers = []
def __init__(self, cli_sock): '\n\t\tCreates a WebSocket connection\n\t\tover the given socket.\n\n\t\t:param cli_sock: The socket to send data through.\n\t\t:type cli_sock: socket\n\t\t' self._sock = cli_sock self._conn = WSConnection(ConnectionType.SERVER) self._closed = False self._receivers = []...
ab239c5e7bcdfffb0a51390251699070d136d32489f9b919a13a1118b03fd497
def add_receiver(self, receiver): '\n\t\tAdds a target for received events.\n\n\t\t:param receiver: The event target.\n\t\t:type receiver: EventReceiver\n\t\t' if isinstance(receiver, EventReceiver): self._receivers.append(receiver) else: raise TypeError('receiver must be an instance of Even...
Adds a target for received events. :param receiver: The event target. :type receiver: EventReceiver
src/pyrtc/transport.py
add_receiver
IsaacDorenkamp/PyRTC
0
python
def add_receiver(self, receiver): '\n\t\tAdds a target for received events.\n\n\t\t:param receiver: The event target.\n\t\t:type receiver: EventReceiver\n\t\t' if isinstance(receiver, EventReceiver): self._receivers.append(receiver) else: raise TypeError('receiver must be an instance of Even...
def add_receiver(self, receiver): '\n\t\tAdds a target for received events.\n\n\t\t:param receiver: The event target.\n\t\t:type receiver: EventReceiver\n\t\t' if isinstance(receiver, EventReceiver): self._receivers.append(receiver) else: raise TypeError('receiver must be an instance of Even...
220c0a8713ab5800e4c6e1d1da9be680d4db8b6ea137079249f72b821203c632
@property def open(self): '\n\t\tWhether the connection is open.\n\n\t\t:type: bool\n\t\t' return ((self._conn.state == ConnectionState.OPEN) and (not self._closed))
Whether the connection is open. :type: bool
src/pyrtc/transport.py
open
IsaacDorenkamp/PyRTC
0
python
@property def open(self): '\n\t\tWhether the connection is open.\n\n\t\t:type: bool\n\t\t' return ((self._conn.state == ConnectionState.OPEN) and (not self._closed))
@property def open(self): '\n\t\tWhether the connection is open.\n\n\t\t:type: bool\n\t\t' return ((self._conn.state == ConnectionState.OPEN) and (not self._closed))<|docstring|>Whether the connection is open. :type: bool<|endoftext|>
f636a3f8737563c6ab4cf6c028e06b3d2e922ba0d47ca40d8898bffbaac42f48
def close(self, status=1000): '\n\t\tCloses the WebSocket connection with the specified status\n\t\t(1000, the all-ok status code for WebSocket closure)\n\n\t\t:param status: The status code to close with.\n\t\t:type status: int\n\t\t' if (self._conn.state != ConnectionState.OPEN): raise ValueError('Web...
Closes the WebSocket connection with the specified status (1000, the all-ok status code for WebSocket closure) :param status: The status code to close with. :type status: int
src/pyrtc/transport.py
close
IsaacDorenkamp/PyRTC
0
python
def close(self, status=1000): '\n\t\tCloses the WebSocket connection with the specified status\n\t\t(1000, the all-ok status code for WebSocket closure)\n\n\t\t:param status: The status code to close with.\n\t\t:type status: int\n\t\t' if (self._conn.state != ConnectionState.OPEN): raise ValueError('Web...
def close(self, status=1000): '\n\t\tCloses the WebSocket connection with the specified status\n\t\t(1000, the all-ok status code for WebSocket closure)\n\n\t\t:param status: The status code to close with.\n\t\t:type status: int\n\t\t' if (self._conn.state != ConnectionState.OPEN): raise ValueError('Web...
e4d15175281f3fe86ba1c8822b1576171be71ff5d75a73fd3d6b806299ccf67f
def close_raw(self): '\n\t\tA safe close function that will cleanly close\n\t\tthe socket if the WebSocket connection state is\n\t\tnot open.\n\t\t' if (self._conn.state == ConnectionState.OPEN): self.close() else: self._closed = True self._sock.close()
A safe close function that will cleanly close the socket if the WebSocket connection state is not open.
src/pyrtc/transport.py
close_raw
IsaacDorenkamp/PyRTC
0
python
def close_raw(self): '\n\t\tA safe close function that will cleanly close\n\t\tthe socket if the WebSocket connection state is\n\t\tnot open.\n\t\t' if (self._conn.state == ConnectionState.OPEN): self.close() else: self._closed = True self._sock.close()
def close_raw(self): '\n\t\tA safe close function that will cleanly close\n\t\tthe socket if the WebSocket connection state is\n\t\tnot open.\n\t\t' if (self._conn.state == ConnectionState.OPEN): self.close() else: self._closed = True self._sock.close()<|docstring|>A safe close funct...
f88492f9c5ce83f2622fd67aa49e4d3c94045f40ab01a13ab7a408d2a1c9b1a1
def send(self, data): '\n\t\tSend data over the WebSocket connection.\n\t\tMay be a str or bytes, but the ws.proto\n\t\tMessage counterparts are accepted as well.\n\t\t' if isinstance(data, str): message = events.TextMessage(data) elif isinstance(data, bytes): message = events.BytesMessage(d...
Send data over the WebSocket connection. May be a str or bytes, but the ws.proto Message counterparts are accepted as well.
src/pyrtc/transport.py
send
IsaacDorenkamp/PyRTC
0
python
def send(self, data): '\n\t\tSend data over the WebSocket connection.\n\t\tMay be a str or bytes, but the ws.proto\n\t\tMessage counterparts are accepted as well.\n\t\t' if isinstance(data, str): message = events.TextMessage(data) elif isinstance(data, bytes): message = events.BytesMessage(d...
def send(self, data): '\n\t\tSend data over the WebSocket connection.\n\t\tMay be a str or bytes, but the ws.proto\n\t\tMessage counterparts are accepted as well.\n\t\t' if isinstance(data, str): message = events.TextMessage(data) elif isinstance(data, bytes): message = events.BytesMessage(d...
6d5389d1f6d2d7878c8c01f609f2ff0c0a5f01cfa1d6a002b93c3cd989ca2dbc
def receive(self): '\n\t\tReceives all available data from\n\t\tsocket, then posts all all events\n\t\tto all added receivers.\n\t\t' if self._closed: return while can_read(self._sock): data = self._sock.recv(2048) if (not data): self._closed = True return ...
Receives all available data from socket, then posts all all events to all added receivers.
src/pyrtc/transport.py
receive
IsaacDorenkamp/PyRTC
0
python
def receive(self): '\n\t\tReceives all available data from\n\t\tsocket, then posts all all events\n\t\tto all added receivers.\n\t\t' if self._closed: return while can_read(self._sock): data = self._sock.recv(2048) if (not data): self._closed = True return ...
def receive(self): '\n\t\tReceives all available data from\n\t\tsocket, then posts all all events\n\t\tto all added receivers.\n\t\t' if self._closed: return while can_read(self._sock): data = self._sock.recv(2048) if (not data): self._closed = True return ...
32f68ed93a7e5049488c813cfe0566c1e209a2c3323d28678e52099a5fd88029
def getAppNameFromProcessID(processID, includeExt=False): "Finds out the application name of the given process.\n\t@param processID: the ID of the process handle of the application you wish to get the name of.\n\t@type processID: int\n\t@param includeExt: C{True} to include the extension of the application's execut...
Finds out the application name of the given process. @param processID: the ID of the process handle of the application you wish to get the name of. @type processID: int @param includeExt: C{True} to include the extension of the application's executable filename, C{False} to exclude it. @type window: bool @returns: appl...
source/appModuleHandler.py
getAppNameFromProcessID
lukaszgo1/nvda
1,592
python
def getAppNameFromProcessID(processID, includeExt=False): "Finds out the application name of the given process.\n\t@param processID: the ID of the process handle of the application you wish to get the name of.\n\t@type processID: int\n\t@param includeExt: C{True} to include the extension of the application's execut...
def getAppNameFromProcessID(processID, includeExt=False): "Finds out the application name of the given process.\n\t@param processID: the ID of the process handle of the application you wish to get the name of.\n\t@type processID: int\n\t@param includeExt: C{True} to include the extension of the application's execut...
cc13c268f3360662e82557b66cafea0741941619e7626ec707e28702889d06b3
def getAppModuleFromProcessID(processID): "Finds the appModule that is for the given process ID. The module is also cached for later retreavals.\n\t@param processID: The ID of the process for which you wish to find the appModule.\n\t@type processID: int\n\t@returns: the appModule, or None if there isn't one\n\t@rty...
Finds the appModule that is for the given process ID. The module is also cached for later retreavals. @param processID: The ID of the process for which you wish to find the appModule. @type processID: int @returns: the appModule, or None if there isn't one @rtype: appModule
source/appModuleHandler.py
getAppModuleFromProcessID
lukaszgo1/nvda
1,592
python
def getAppModuleFromProcessID(processID): "Finds the appModule that is for the given process ID. The module is also cached for later retreavals.\n\t@param processID: The ID of the process for which you wish to find the appModule.\n\t@type processID: int\n\t@returns: the appModule, or None if there isn't one\n\t@rty...
def getAppModuleFromProcessID(processID): "Finds the appModule that is for the given process ID. The module is also cached for later retreavals.\n\t@param processID: The ID of the process for which you wish to find the appModule.\n\t@type processID: int\n\t@returns: the appModule, or None if there isn't one\n\t@rty...
87830874a7e9b31b6e800d797a26da1ecc3b3fa34c61be0b6720bd8c337a542a
def update(processID, helperLocalBindingHandle=None, inprocRegistrationHandle=None): 'Tries to load a new appModule for the given process ID if need be.\n\t@param processID: the ID of the process.\n\t@type processID: int\n\t@param helperLocalBindingHandle: an optional RPC binding handle pointing to the RPC server f...
Tries to load a new appModule for the given process ID if need be. @param processID: the ID of the process. @type processID: int @param helperLocalBindingHandle: an optional RPC binding handle pointing to the RPC server for this process @param inprocRegistrationHandle: an optional rpc context handle representing succes...
source/appModuleHandler.py
update
lukaszgo1/nvda
1,592
python
def update(processID, helperLocalBindingHandle=None, inprocRegistrationHandle=None): 'Tries to load a new appModule for the given process ID if need be.\n\t@param processID: the ID of the process.\n\t@type processID: int\n\t@param helperLocalBindingHandle: an optional RPC binding handle pointing to the RPC server f...
def update(processID, helperLocalBindingHandle=None, inprocRegistrationHandle=None): 'Tries to load a new appModule for the given process ID if need be.\n\t@param processID: the ID of the process.\n\t@type processID: int\n\t@param helperLocalBindingHandle: an optional RPC binding handle pointing to the RPC server f...
76270be0b1044e0277976e6cdf5786bf218b77c4be6d7fa96a6cad7abe5bec8a
def cleanup(): 'Removes any appModules from the cache whose process has died.\n\t' for deadMod in [mod for mod in runningTable.values() if (not mod.isAlive)]: log.debug(('application %s closed' % deadMod.appName)) del runningTable[deadMod.processID] if (deadMod in set((o.appModule for o ...
Removes any appModules from the cache whose process has died.
source/appModuleHandler.py
cleanup
lukaszgo1/nvda
1,592
python
def cleanup(): '\n\t' for deadMod in [mod for mod in runningTable.values() if (not mod.isAlive)]: log.debug(('application %s closed' % deadMod.appName)) del runningTable[deadMod.processID] if (deadMod in set((o.appModule for o in (api.getFocusAncestors() + [api.getFocusObject()]) if (o a...
def cleanup(): '\n\t' for deadMod in [mod for mod in runningTable.values() if (not mod.isAlive)]: log.debug(('application %s closed' % deadMod.appName)) del runningTable[deadMod.processID] if (deadMod in set((o.appModule for o in (api.getFocusAncestors() + [api.getFocusObject()]) if (o a...
0d4197bf31674091adfc174819e0954c665bccded290b8918fd1f4d61c9ccadd
def fetchAppModule(processID, appName): 'Returns an appModule found in the appModules directory, for the given application name.\n\t@param processID: process ID for it to be associated with\n\t@type processID: integer\n\t@param appName: the application name for which an appModule should be found.\n\t@type appName: ...
Returns an appModule found in the appModules directory, for the given application name. @param processID: process ID for it to be associated with @type processID: integer @param appName: the application name for which an appModule should be found. @type appName: str @returns: the appModule, or None if not found @rtype:...
source/appModuleHandler.py
fetchAppModule
lukaszgo1/nvda
1,592
python
def fetchAppModule(processID, appName): 'Returns an appModule found in the appModules directory, for the given application name.\n\t@param processID: process ID for it to be associated with\n\t@type processID: integer\n\t@param appName: the application name for which an appModule should be found.\n\t@type appName: ...
def fetchAppModule(processID, appName): 'Returns an appModule found in the appModules directory, for the given application name.\n\t@param processID: process ID for it to be associated with\n\t@type processID: integer\n\t@param appName: the application name for which an appModule should be found.\n\t@type appName: ...
0349bc6050e035a30bc42485d58d5afde0b9823c97240b467b21085d7bc736ae
def reloadAppModules(): 'Reloads running appModules.\n\tespecially, it clears the cache of running appModules and deletes them from sys.modules.\n\tEach appModule will then be reloaded immediately.\n\t' global appModules state = [] for mod in runningTable.values(): state.append({key: getattr(mod...
Reloads running appModules. especially, it clears the cache of running appModules and deletes them from sys.modules. Each appModule will then be reloaded immediately.
source/appModuleHandler.py
reloadAppModules
lukaszgo1/nvda
1,592
python
def reloadAppModules(): 'Reloads running appModules.\n\tespecially, it clears the cache of running appModules and deletes them from sys.modules.\n\tEach appModule will then be reloaded immediately.\n\t' global appModules state = [] for mod in runningTable.values(): state.append({key: getattr(mod...
def reloadAppModules(): 'Reloads running appModules.\n\tespecially, it clears the cache of running appModules and deletes them from sys.modules.\n\tEach appModule will then be reloaded immediately.\n\t' global appModules state = [] for mod in runningTable.values(): state.append({key: getattr(mod...
f021e9113a84bb85a0a02a44a59c38dc886941ffdcdc6690260057e8e4f86e07
def initialize(): 'Initializes the appModule subsystem. \n\t' global NVDAProcessID, _importers NVDAProcessID = os.getpid() config.addConfigDirsToPythonPackagePath(appModules) _importers = list(pkgutil.iter_importers('appModules.__init__'))
Initializes the appModule subsystem.
source/appModuleHandler.py
initialize
lukaszgo1/nvda
1,592
python
def initialize(): ' \n\t' global NVDAProcessID, _importers NVDAProcessID = os.getpid() config.addConfigDirsToPythonPackagePath(appModules) _importers = list(pkgutil.iter_importers('appModules.__init__'))
def initialize(): ' \n\t' global NVDAProcessID, _importers NVDAProcessID = os.getpid() config.addConfigDirsToPythonPackagePath(appModules) _importers = list(pkgutil.iter_importers('appModules.__init__'))<|docstring|>Initializes the appModule subsystem.<|endoftext|>
929d52a32672d67dac6067d562671c3c726c84be0472f5d874e6cb2d0070e589
def getWmiProcessInfo(processId): 'Retrieve the WMI Win32_Process class instance for a given process.\n\tFor details about the available properties, see\n\thttp://msdn.microsoft.com/en-us/library/aa394372%28v=vs.85%29.aspx\n\t@param processId: The id of the process in question.\n\t@type processId: int\n\t@return: T...
Retrieve the WMI Win32_Process class instance for a given process. For details about the available properties, see http://msdn.microsoft.com/en-us/library/aa394372%28v=vs.85%29.aspx @param processId: The id of the process in question. @type processId: int @return: The WMI Win32_Process class instance. @raise LookupErro...
source/appModuleHandler.py
getWmiProcessInfo
lukaszgo1/nvda
1,592
python
def getWmiProcessInfo(processId): 'Retrieve the WMI Win32_Process class instance for a given process.\n\tFor details about the available properties, see\n\thttp://msdn.microsoft.com/en-us/library/aa394372%28v=vs.85%29.aspx\n\t@param processId: The id of the process in question.\n\t@type processId: int\n\t@return: T...
def getWmiProcessInfo(processId): 'Retrieve the WMI Win32_Process class instance for a given process.\n\tFor details about the available properties, see\n\thttp://msdn.microsoft.com/en-us/library/aa394372%28v=vs.85%29.aspx\n\t@param processId: The id of the process in question.\n\t@type processId: int\n\t@return: T...
940c44d3339af26614fd96c2f4750589e7b1f1f4c86f2ce2f67d9ba56f67b9cc
def _setProductInfo(self): 'Set productName and productVersion attributes.\n\t\tThere are at least two ways of obtaining product info for an app:\n\t\t* Package info for hosted apps\n\t\t* File version info for other apps and for some hosted apps\n\t\t' if (not self.processHandle): raise RuntimeError('p...
Set productName and productVersion attributes. There are at least two ways of obtaining product info for an app: * Package info for hosted apps * File version info for other apps and for some hosted apps
source/appModuleHandler.py
_setProductInfo
lukaszgo1/nvda
1,592
python
def _setProductInfo(self): 'Set productName and productVersion attributes.\n\t\tThere are at least two ways of obtaining product info for an app:\n\t\t* Package info for hosted apps\n\t\t* File version info for other apps and for some hosted apps\n\t\t' if (not self.processHandle): raise RuntimeError('p...
def _setProductInfo(self): 'Set productName and productVersion attributes.\n\t\tThere are at least two ways of obtaining product info for an app:\n\t\t* Package info for hosted apps\n\t\t* File version info for other apps and for some hosted apps\n\t\t' if (not self.processHandle): raise RuntimeError('p...
4538a5a2f97a147d3ad5fdbfe890cb2599317e1a7fc1a7a6c3b2147a14dce4b1
def terminate(self): 'Terminate this app module.\n\t\tThis is called to perform any clean up when this app module is being destroyed.\n\t\tSubclasses should call the superclass method first.\n\t\t' winKernel.closeHandle(self.processHandle) if getattr(self, '_helperPreventDisconnect', False): return ...
Terminate this app module. This is called to perform any clean up when this app module is being destroyed. Subclasses should call the superclass method first.
source/appModuleHandler.py
terminate
lukaszgo1/nvda
1,592
python
def terminate(self): 'Terminate this app module.\n\t\tThis is called to perform any clean up when this app module is being destroyed.\n\t\tSubclasses should call the superclass method first.\n\t\t' winKernel.closeHandle(self.processHandle) if getattr(self, '_helperPreventDisconnect', False): return ...
def terminate(self): 'Terminate this app module.\n\t\tThis is called to perform any clean up when this app module is being destroyed.\n\t\tSubclasses should call the superclass method first.\n\t\t' winKernel.closeHandle(self.processHandle) if getattr(self, '_helperPreventDisconnect', False): return ...
587a3556d6152980ef447825de9baa21ac2070add8b5e49830e8f1441dff3d0b
def chooseNVDAObjectOverlayClasses(self, obj, clsList): 'Choose NVDAObject overlay classes for a given NVDAObject.\n\t\tThis is called when an NVDAObject is being instantiated after L{NVDAObjects.NVDAObject.findOverlayClasses} has been called on the API-level class.\n\t\tThis allows an AppModule to add or remove ov...
Choose NVDAObject overlay classes for a given NVDAObject. This is called when an NVDAObject is being instantiated after L{NVDAObjects.NVDAObject.findOverlayClasses} has been called on the API-level class. This allows an AppModule to add or remove overlay classes. See L{NVDAObjects.NVDAObject.findOverlayClasses} for det...
source/appModuleHandler.py
chooseNVDAObjectOverlayClasses
lukaszgo1/nvda
1,592
python
def chooseNVDAObjectOverlayClasses(self, obj, clsList): 'Choose NVDAObject overlay classes for a given NVDAObject.\n\t\tThis is called when an NVDAObject is being instantiated after L{NVDAObjects.NVDAObject.findOverlayClasses} has been called on the API-level class.\n\t\tThis allows an AppModule to add or remove ov...
def chooseNVDAObjectOverlayClasses(self, obj, clsList): 'Choose NVDAObject overlay classes for a given NVDAObject.\n\t\tThis is called when an NVDAObject is being instantiated after L{NVDAObjects.NVDAObject.findOverlayClasses} has been called on the API-level class.\n\t\tThis allows an AppModule to add or remove ov...
8ca58ed9830719a5ba3a9f9eac71b05802464e645cce3a055cc90f8cace4b60a
def _get_appPath(self): "Returns the full path for the executable e.g. 'C:\\Windows\\explorer.exe' for Explorer.\n\t\t@rtype: str\n\t\t" size = ctypes.wintypes.DWORD(ctypes.wintypes.MAX_PATH) path = ctypes.create_unicode_buffer(size.value) winKernel.kernel32.QueryFullProcessImageNameW(self.processHandle...
Returns the full path for the executable e.g. 'C:\Windows\explorer.exe' for Explorer. @rtype: str
source/appModuleHandler.py
_get_appPath
lukaszgo1/nvda
1,592
python
def _get_appPath(self): "Returns the full path for the executable e.g. 'C:\\Windows\\explorer.exe' for Explorer.\n\t\t@rtype: str\n\t\t" size = ctypes.wintypes.DWORD(ctypes.wintypes.MAX_PATH) path = ctypes.create_unicode_buffer(size.value) winKernel.kernel32.QueryFullProcessImageNameW(self.processHandle...
def _get_appPath(self): "Returns the full path for the executable e.g. 'C:\\Windows\\explorer.exe' for Explorer.\n\t\t@rtype: str\n\t\t" size = ctypes.wintypes.DWORD(ctypes.wintypes.MAX_PATH) path = ctypes.create_unicode_buffer(size.value) winKernel.kernel32.QueryFullProcessImageNameW(self.processHandle...
7995ab1b4a4d301efb42dc77943ddded13a996f59d5ab8b3961637196cf76dda
def _get_is64BitProcess(self): 'Whether the underlying process is a 64 bit process.\n\t\t@rtype: bool\n\t\t' if (os.environ.get('PROCESSOR_ARCHITEW6432') not in ('AMD64', 'ARM64')): self.is64BitProcess = False return False try: processMachine = ctypes.wintypes.USHORT() if (ct...
Whether the underlying process is a 64 bit process. @rtype: bool
source/appModuleHandler.py
_get_is64BitProcess
lukaszgo1/nvda
1,592
python
def _get_is64BitProcess(self): 'Whether the underlying process is a 64 bit process.\n\t\t@rtype: bool\n\t\t' if (os.environ.get('PROCESSOR_ARCHITEW6432') not in ('AMD64', 'ARM64')): self.is64BitProcess = False return False try: processMachine = ctypes.wintypes.USHORT() if (ct...
def _get_is64BitProcess(self): 'Whether the underlying process is a 64 bit process.\n\t\t@rtype: bool\n\t\t' if (os.environ.get('PROCESSOR_ARCHITEW6432') not in ('AMD64', 'ARM64')): self.is64BitProcess = False return False try: processMachine = ctypes.wintypes.USHORT() if (ct...
f897e134f3987751cca80e705b6f2c738a3d447e3cf1180775e0a346539d53b2
def _get_isWindowsStoreApp(self): 'Whether this process is a Windows Store (immersive) process.\n\t\tAn immersive process is a Windows app that runs inside a Windows Runtime (WinRT) container.\n\t\tThese include Windows store apps on Windows 8 and 8.1,\n\t\tand Universal Windows Platform (UWP) apps on Windows 10.\n...
Whether this process is a Windows Store (immersive) process. An immersive process is a Windows app that runs inside a Windows Runtime (WinRT) container. These include Windows store apps on Windows 8 and 8.1, and Universal Windows Platform (UWP) apps on Windows 10. A special case is a converted desktop app distributed o...
source/appModuleHandler.py
_get_isWindowsStoreApp
lukaszgo1/nvda
1,592
python
def _get_isWindowsStoreApp(self): 'Whether this process is a Windows Store (immersive) process.\n\t\tAn immersive process is a Windows app that runs inside a Windows Runtime (WinRT) container.\n\t\tThese include Windows store apps on Windows 8 and 8.1,\n\t\tand Universal Windows Platform (UWP) apps on Windows 10.\n...
def _get_isWindowsStoreApp(self): 'Whether this process is a Windows Store (immersive) process.\n\t\tAn immersive process is a Windows app that runs inside a Windows Runtime (WinRT) container.\n\t\tThese include Windows store apps on Windows 8 and 8.1,\n\t\tand Universal Windows Platform (UWP) apps on Windows 10.\n...
a8bb4af541081a4957a4d19e6ffc387c14305051903a600120201094e74ab58d
def _get_appArchitecture(self): 'Returns the target architecture for the specified app.\n\t\tThis is useful for detecting X86/X64 apps running on ARM64 releases of Windows 10.\n\t\tThe following strings are returned:\n\t\t* x86: 32-bit x86 app on 32-bit or 64-bit Windows.\n\t\t* AMD64: x64 app on x64 or ARM64 Windo...
Returns the target architecture for the specified app. This is useful for detecting X86/X64 apps running on ARM64 releases of Windows 10. The following strings are returned: * x86: 32-bit x86 app on 32-bit or 64-bit Windows. * AMD64: x64 app on x64 or ARM64 Windows. * ARM: 32-bit ARM app on ARM64 Windows. * ARM64: 64-b...
source/appModuleHandler.py
_get_appArchitecture
lukaszgo1/nvda
1,592
python
def _get_appArchitecture(self): 'Returns the target architecture for the specified app.\n\t\tThis is useful for detecting X86/X64 apps running on ARM64 releases of Windows 10.\n\t\tThe following strings are returned:\n\t\t* x86: 32-bit x86 app on 32-bit or 64-bit Windows.\n\t\t* AMD64: x64 app on x64 or ARM64 Windo...
def _get_appArchitecture(self): 'Returns the target architecture for the specified app.\n\t\tThis is useful for detecting X86/X64 apps running on ARM64 releases of Windows 10.\n\t\tThe following strings are returned:\n\t\t* x86: 32-bit x86 app on 32-bit or 64-bit Windows.\n\t\t* AMD64: x64 app on x64 or ARM64 Windo...
b9bf84444a16f770ce192b16572d0e641e6c87966947e0e707be78ff6ce150bf
def isGoodUIAWindow(self, hwnd): "\n\t\treturns C{True} if the UIA implementation of the given window must be used, regardless whether native or not.\n\t\tThis function is the counterpart of and takes precedence over L{isBadUIAWindow}.\n\t\tIf both functions return C{False}, the decision of whether to use UIA for t...
returns C{True} if the UIA implementation of the given window must be used, regardless whether native or not. This function is the counterpart of and takes precedence over L{isBadUIAWindow}. If both functions return C{False}, the decision of whether to use UIA for the window is left to core. Warning: this may be called...
source/appModuleHandler.py
isGoodUIAWindow
lukaszgo1/nvda
1,592
python
def isGoodUIAWindow(self, hwnd): "\n\t\treturns C{True} if the UIA implementation of the given window must be used, regardless whether native or not.\n\t\tThis function is the counterpart of and takes precedence over L{isBadUIAWindow}.\n\t\tIf both functions return C{False}, the decision of whether to use UIA for t...
def isGoodUIAWindow(self, hwnd): "\n\t\treturns C{True} if the UIA implementation of the given window must be used, regardless whether native or not.\n\t\tThis function is the counterpart of and takes precedence over L{isBadUIAWindow}.\n\t\tIf both functions return C{False}, the decision of whether to use UIA for t...
bacf996363d4af067ba555c6aa4b7345a7a47bcf77edb2eca7f9819d01a16faa
def isBadUIAWindow(self, hwnd): "\n\t\treturns C{True} if the UIA implementation of the given window must be ignored due to it being broken in some way.\n\t\tThis function is the counterpart of L{isGoodUIAWindow}.\n\t\tWhen both functions return C{True}, L{isGoodUIAWindow} takes precedence.\n\t\tIf both functions r...
returns C{True} if the UIA implementation of the given window must be ignored due to it being broken in some way. This function is the counterpart of L{isGoodUIAWindow}. When both functions return C{True}, L{isGoodUIAWindow} takes precedence. If both functions return C{False}, the decision of whether to use UIA for the...
source/appModuleHandler.py
isBadUIAWindow
lukaszgo1/nvda
1,592
python
def isBadUIAWindow(self, hwnd): "\n\t\treturns C{True} if the UIA implementation of the given window must be ignored due to it being broken in some way.\n\t\tThis function is the counterpart of L{isGoodUIAWindow}.\n\t\tWhen both functions return C{True}, L{isGoodUIAWindow} takes precedence.\n\t\tIf both functions r...
def isBadUIAWindow(self, hwnd): "\n\t\treturns C{True} if the UIA implementation of the given window must be ignored due to it being broken in some way.\n\t\tThis function is the counterpart of L{isGoodUIAWindow}.\n\t\tWhen both functions return C{True}, L{isGoodUIAWindow} takes precedence.\n\t\tIf both functions r...
3dfe5d4b75c9917a540c11268493dbe84e0d3aee608ad2a8a3a427f1a6e16698
def shouldProcessUIAPropertyChangedEvent(self, sender, propertyId): "\n\t\tDetermines whether NVDA should process a UIA property changed event.\n\t\tReturning False will cause the event to be dropped completely. This can be\n\t\tused to work around UIA implementations which flood events and cause poor\n\t\tperforma...
Determines whether NVDA should process a UIA property changed event. Returning False will cause the event to be dropped completely. This can be used to work around UIA implementations which flood events and cause poor performance. Returning True means that the event will be processed, but it might still be rejected lat...
source/appModuleHandler.py
shouldProcessUIAPropertyChangedEvent
lukaszgo1/nvda
1,592
python
def shouldProcessUIAPropertyChangedEvent(self, sender, propertyId): "\n\t\tDetermines whether NVDA should process a UIA property changed event.\n\t\tReturning False will cause the event to be dropped completely. This can be\n\t\tused to work around UIA implementations which flood events and cause poor\n\t\tperforma...
def shouldProcessUIAPropertyChangedEvent(self, sender, propertyId): "\n\t\tDetermines whether NVDA should process a UIA property changed event.\n\t\tReturning False will cause the event to be dropped completely. This can be\n\t\tused to work around UIA implementations which flood events and cause poor\n\t\tperforma...
e1a7a23863cef84d76549ef072c33c7e9fee4ff29d27a81ea52cbfee7074eb6f
def dumpOnCrash(self): 'Request that this process writes a minidump when it crashes for debugging.\n\t\tThis should only be called if instructed by a developer.\n\t\t' path = os.path.join(tempfile.gettempdir(), ('nvda_crash_%s_%d.dmp' % (self.appName, self.processID))) NVDAHelper.localLib.nvdaInProcUtils_du...
Request that this process writes a minidump when it crashes for debugging. This should only be called if instructed by a developer.
source/appModuleHandler.py
dumpOnCrash
lukaszgo1/nvda
1,592
python
def dumpOnCrash(self): 'Request that this process writes a minidump when it crashes for debugging.\n\t\tThis should only be called if instructed by a developer.\n\t\t' path = os.path.join(tempfile.gettempdir(), ('nvda_crash_%s_%d.dmp' % (self.appName, self.processID))) NVDAHelper.localLib.nvdaInProcUtils_du...
def dumpOnCrash(self): 'Request that this process writes a minidump when it crashes for debugging.\n\t\tThis should only be called if instructed by a developer.\n\t\t' path = os.path.join(tempfile.gettempdir(), ('nvda_crash_%s_%d.dmp' % (self.appName, self.processID))) NVDAHelper.localLib.nvdaInProcUtils_du...
e03931ee746013ca06be72760d28f7460e062d750ee7e82517dbb5a8fd96e02f
def _get_statusBar(self): 'Retrieve the status bar object of the application.\n\t\tIf C{NotImplementedError} is raised, L{api.getStatusBar} will resort to\n\t\tperform a lookup by position.\n\t\tIf C{None} is returned, L{GlobalCommands.script_reportStatusLine} will\n\t\tin turn resort to reading the bottom line of ...
Retrieve the status bar object of the application. If C{NotImplementedError} is raised, L{api.getStatusBar} will resort to perform a lookup by position. If C{None} is returned, L{GlobalCommands.script_reportStatusLine} will in turn resort to reading the bottom line of text written to the display. @rtype: NVDAObject
source/appModuleHandler.py
_get_statusBar
lukaszgo1/nvda
1,592
python
def _get_statusBar(self): 'Retrieve the status bar object of the application.\n\t\tIf C{NotImplementedError} is raised, L{api.getStatusBar} will resort to\n\t\tperform a lookup by position.\n\t\tIf C{None} is returned, L{GlobalCommands.script_reportStatusLine} will\n\t\tin turn resort to reading the bottom line of ...
def _get_statusBar(self): 'Retrieve the status bar object of the application.\n\t\tIf C{NotImplementedError} is raised, L{api.getStatusBar} will resort to\n\t\tperform a lookup by position.\n\t\tIf C{None} is returned, L{GlobalCommands.script_reportStatusLine} will\n\t\tin turn resort to reading the bottom line of ...
f16fcef3f707c671529528b42a7e07a46ac220401bbba15d97b7fd436a8e0493
def _get_statusBarTextInfo(self): 'Retrieve a L{TextInfo} positioned at the status bar of the application.\n\t\tThis is used by L{GlobalCommands.script_reportStatusLine} in cases where\n\t\tL{api.getStatusBar} could not locate a proper L{NVDAObject} for the\n\t\tstatus bar.\n\t\tFor this method to get called, L{_ge...
Retrieve a L{TextInfo} positioned at the status bar of the application. This is used by L{GlobalCommands.script_reportStatusLine} in cases where L{api.getStatusBar} could not locate a proper L{NVDAObject} for the status bar. For this method to get called, L{_get_statusBar} must return C{None}. @rtype: TextInfo
source/appModuleHandler.py
_get_statusBarTextInfo
lukaszgo1/nvda
1,592
python
def _get_statusBarTextInfo(self): 'Retrieve a L{TextInfo} positioned at the status bar of the application.\n\t\tThis is used by L{GlobalCommands.script_reportStatusLine} in cases where\n\t\tL{api.getStatusBar} could not locate a proper L{NVDAObject} for the\n\t\tstatus bar.\n\t\tFor this method to get called, L{_ge...
def _get_statusBarTextInfo(self): 'Retrieve a L{TextInfo} positioned at the status bar of the application.\n\t\tThis is used by L{GlobalCommands.script_reportStatusLine} in cases where\n\t\tL{api.getStatusBar} could not locate a proper L{NVDAObject} for the\n\t\tstatus bar.\n\t\tFor this method to get called, L{_ge...
a67eb90bb703cc829a0d281ec67e60bf27810fa33f5d2065b2985255219a8492
@pytest.mark.parametrize('schema, schemas, expected_name, expected_schema', TESTS) @pytest.mark.schemas @pytest.mark.helper def test_(schema, schemas, expected_name, expected_schema): '\n GIVEN schema, schemas and expected name and schema\n WHEN calculate_property_schema is called with the schema and schemas\...
GIVEN schema, schemas and expected name and schema WHEN calculate_property_schema is called with the schema and schemas THEN the expected name and schema is returned.
tests/open_alchemy/schemas/helpers/association/test_calculate_property_schema.py
test_
sfxsalem/OpenAlchemy
40
python
@pytest.mark.parametrize('schema, schemas, expected_name, expected_schema', TESTS) @pytest.mark.schemas @pytest.mark.helper def test_(schema, schemas, expected_name, expected_schema): '\n GIVEN schema, schemas and expected name and schema\n WHEN calculate_property_schema is called with the schema and schemas\...
@pytest.mark.parametrize('schema, schemas, expected_name, expected_schema', TESTS) @pytest.mark.schemas @pytest.mark.helper def test_(schema, schemas, expected_name, expected_schema): '\n GIVEN schema, schemas and expected name and schema\n WHEN calculate_property_schema is called with the schema and schemas\...
755e0e6965a8380bfbbd75236d2262b5eb5e42fdbb82d727f5b943f083895f73
def model_with_weights(model, weights, skip_mismatch): " Load weights for model.\n\n Args\n model : The model to load weights for.\n weights : The weights to load.\n skip_mismatch : If True, skips layers whose shape of weights doesn't match with the model.\n " if (weight...
Load weights for model. Args model : The model to load weights for. weights : The weights to load. skip_mismatch : If True, skips layers whose shape of weights doesn't match with the model.
src/networks/get_model.py
model_with_weights
skyimager/aqvs
1
python
def model_with_weights(model, weights, skip_mismatch): " Load weights for model.\n\n Args\n model : The model to load weights for.\n weights : The weights to load.\n skip_mismatch : If True, skips layers whose shape of weights doesn't match with the model.\n " if (weight...
def model_with_weights(model, weights, skip_mismatch): " Load weights for model.\n\n Args\n model : The model to load weights for.\n weights : The weights to load.\n skip_mismatch : If True, skips layers whose shape of weights doesn't match with the model.\n " if (weight...
8f6ea779e9743077a0b13daeadbfcecd2731a3e12301d0d29a96bd4f1222bcf9
def create_models(backbone_retinanet, num_classes, weights, multi_gpu=0, freeze_backbone=False, lr=1e-05, config=None): ' Creates three models (model, training_model, prediction_model).\n\n Args\n backbone_retinanet : A function to call to create a retinanet model with a given backbone.\n num_class...
Creates three models (model, training_model, prediction_model). Args backbone_retinanet : A function to call to create a retinanet model with a given backbone. num_classes : The number of classes to train. weights : The weights to load into the model. multi_gpu : The number o...
src/networks/get_model.py
create_models
skyimager/aqvs
1
python
def create_models(backbone_retinanet, num_classes, weights, multi_gpu=0, freeze_backbone=False, lr=1e-05, config=None): ' Creates three models (model, training_model, prediction_model).\n\n Args\n backbone_retinanet : A function to call to create a retinanet model with a given backbone.\n num_class...
def create_models(backbone_retinanet, num_classes, weights, multi_gpu=0, freeze_backbone=False, lr=1e-05, config=None): ' Creates three models (model, training_model, prediction_model).\n\n Args\n backbone_retinanet : A function to call to create a retinanet model with a given backbone.\n num_class...
eea5ff563a8a364cdf258169548aca0529bbfb0d95b25eb4033da69f6d4cb1f1
def load_module(name): '\n Loads and returns the module with name.\n The difference is that this function also adds\n the Python ast to each function in the module\n along the way.\n ' findex = function_index(name) m = importlib.import_module(name) add_ast(m, findex) return m
Loads and returns the module with name. The difference is that this function also adds the Python ast to each function in the module along the way.
sallyforth/module_loader.py
load_module
russolsen/sallyforth
13
python
def load_module(name): '\n Loads and returns the module with name.\n The difference is that this function also adds\n the Python ast to each function in the module\n along the way.\n ' findex = function_index(name) m = importlib.import_module(name) add_ast(m, findex) return m
def load_module(name): '\n Loads and returns the module with name.\n The difference is that this function also adds\n the Python ast to each function in the module\n along the way.\n ' findex = function_index(name) m = importlib.import_module(name) add_ast(m, findex) return m<|docstri...
efbf76cf58f328dbb2a3d1932eebd709e6ed51898ded8ecec75ff8fd2d4155fe
def concat_functions(function_asts, name='generated_function'): "\n Given an array of function AST objects,\n attempt to produce a new function whose\n body is the concatenation of the existing functions.\n Note that the new function will take the same number\n of arguments as the first function on t...
Given an array of function AST objects, attempt to produce a new function whose body is the concatenation of the existing functions. Note that the new function will take the same number of arguments as the first function on the list. Returns None if it's unable to build the new function.
sallyforth/module_loader.py
concat_functions
russolsen/sallyforth
13
python
def concat_functions(function_asts, name='generated_function'): "\n Given an array of function AST objects,\n attempt to produce a new function whose\n body is the concatenation of the existing functions.\n Note that the new function will take the same number\n of arguments as the first function on t...
def concat_functions(function_asts, name='generated_function'): "\n Given an array of function AST objects,\n attempt to produce a new function whose\n body is the concatenation of the existing functions.\n Note that the new function will take the same number\n of arguments as the first function on t...
86b0a5bc6e2cba5715d4863e50e54581a7a5601728214a009032cfbb9dddede7
def get_root_uuid(zf: zipfile.ZipFile) -> UUID: "\n Returns the root UUID for a QIIME 2 Archive.\n\n There's no particular reason we use the first filename here. All QIIME 2\n Artifacts store their contents in a directory named with the Artifact's\n UUID, so we can get the UUID of an artifact by taking...
Returns the root UUID for a QIIME 2 Archive. There's no particular reason we use the first filename here. All QIIME 2 Artifacts store their contents in a directory named with the Artifact's UUID, so we can get the UUID of an artifact by taking the first part of the filepath of any file in the zip archive.
provenance_lib/util.py
get_root_uuid
ChrisKeefe/provenance_py
1
python
def get_root_uuid(zf: zipfile.ZipFile) -> UUID: "\n Returns the root UUID for a QIIME 2 Archive.\n\n There's no particular reason we use the first filename here. All QIIME 2\n Artifacts store their contents in a directory named with the Artifact's\n UUID, so we can get the UUID of an artifact by taking...
def get_root_uuid(zf: zipfile.ZipFile) -> UUID: "\n Returns the root UUID for a QIIME 2 Archive.\n\n There's no particular reason we use the first filename here. All QIIME 2\n Artifacts store their contents in a directory named with the Artifact's\n UUID, so we can get the UUID of an artifact by taking...
4cfedc88403caf5d4fb83af2dd49f934808f34ebb57e09268fcc7bc7d9aa30b2
def test_amplitude_to_DB_itemwise_clamps(self): "Ensure that the clamps are separate for each spectrogram in a batch.\n\n The clamp was determined per-batch in a prior implementation, which\n meant it was determined by the loudest item, thus items weren't\n independent. See:\n\n https://...
Ensure that the clamps are separate for each spectrogram in a batch. The clamp was determined per-batch in a prior implementation, which meant it was determined by the loudest item, thus items weren't independent. See: https://github.com/pytorch/audio/issues/994
test/torchaudio_unittest/batch_consistency_test.py
test_amplitude_to_DB_itemwise_clamps
jieruan02/audio
0
python
def test_amplitude_to_DB_itemwise_clamps(self): "Ensure that the clamps are separate for each spectrogram in a batch.\n\n The clamp was determined per-batch in a prior implementation, which\n meant it was determined by the loudest item, thus items weren't\n independent. See:\n\n https://...
def test_amplitude_to_DB_itemwise_clamps(self): "Ensure that the clamps are separate for each spectrogram in a batch.\n\n The clamp was determined per-batch in a prior implementation, which\n meant it was determined by the loudest item, thus items weren't\n independent. See:\n\n https://...
bcc9509787301a64cd0f4d43fc965af98d75a263ac64c01f9e29843fd1456ab9
def test_amplitude_to_DB_not_channelwise_clamps(self): 'Check that clamps are applied per-item, not per channel.' amplitude_mult = 20.0 amin = 1e-10 ref = 1.0 db_mult = math.log10(max(amin, ref)) top_db = 40.0 torch.manual_seed(0) spec = (torch.rand([1, 2, 100, 100]) * 200) spec[(:, ...
Check that clamps are applied per-item, not per channel.
test/torchaudio_unittest/batch_consistency_test.py
test_amplitude_to_DB_not_channelwise_clamps
jieruan02/audio
0
python
def test_amplitude_to_DB_not_channelwise_clamps(self): amplitude_mult = 20.0 amin = 1e-10 ref = 1.0 db_mult = math.log10(max(amin, ref)) top_db = 40.0 torch.manual_seed(0) spec = (torch.rand([1, 2, 100, 100]) * 200) spec[(:, 0)] += 50 specwise_dbs = F.amplitude_to_DB(spec, ampli...
def test_amplitude_to_DB_not_channelwise_clamps(self): amplitude_mult = 20.0 amin = 1e-10 ref = 1.0 db_mult = math.log10(max(amin, ref)) top_db = 40.0 torch.manual_seed(0) spec = (torch.rand([1, 2, 100, 100]) * 200) spec[(:, 0)] += 50 specwise_dbs = F.amplitude_to_DB(spec, ampli...
47f443e90d53cb3c077635bc54125f454bace162f127a1422d3e375bd2345ea5
def __jura_bin(self): 'Return jura binary invocation command' (_, self.runconfig) = tempfile.mkstemp(suffix='.conf', prefix='arcctl.jura.') self.logger.debug('Dumping runtime configuration for Jura to %s', self.runconfig) self.arcconfig.save_run_config(self.runconfig) x509_cert_dir = self.arcconfig....
Return jura binary invocation command
src/utils/python/arc/control/Accounting.py
__jura_bin
davidgcameron/arc
0
python
def __jura_bin(self): (_, self.runconfig) = tempfile.mkstemp(suffix='.conf', prefix='arcctl.jura.') self.logger.debug('Dumping runtime configuration for Jura to %s', self.runconfig) self.arcconfig.save_run_config(self.runconfig) x509_cert_dir = self.arcconfig.get_value('x509_cert_dir', 'common') ...
def __jura_bin(self): (_, self.runconfig) = tempfile.mkstemp(suffix='.conf', prefix='arcctl.jura.') self.logger.debug('Dumping runtime configuration for Jura to %s', self.runconfig) self.arcconfig.save_run_config(self.runconfig) x509_cert_dir = self.arcconfig.get_value('x509_cert_dir', 'common') ...
f882159d8218d7037189c112cab26aab5bc25d146f4399c20eb8714bc3c23b07
def __ensure_accounting_db(self, args): 'Ensure accounting database availabiliy' if self.archive.db_exists(): self.archive.db_connection_init() elif args.db_init: self.logger.info('Migrating Jura archive to accounting database') self.archive.process_records() else: self.l...
Ensure accounting database availabiliy
src/utils/python/arc/control/Accounting.py
__ensure_accounting_db
davidgcameron/arc
0
python
def __ensure_accounting_db(self, args): if self.archive.db_exists(): self.archive.db_connection_init() elif args.db_init: self.logger.info('Migrating Jura archive to accounting database') self.archive.process_records() else: self.logger.error('Accounting database is not ...
def __ensure_accounting_db(self, args): if self.archive.db_exists(): self.archive.db_connection_init() elif args.db_init: self.logger.info('Migrating Jura archive to accounting database') self.archive.process_records() else: self.logger.error('Accounting database is not ...
54b90b7dfcef327def384c2b37a00653a6ea84d1854eaf1cef0d6984bb22f71c
def get_cache_obj(obj_type): '获取缓存对象' if (obj_type not in cache_dict): cache_dict.update({obj_type: obj_type()}) return cache_dict.setdefault(obj_type)
获取缓存对象
sql_faker/sql_faker/cache_dict.py
get_cache_obj
lkmc2/python-sql-faker
12
python
def get_cache_obj(obj_type): if (obj_type not in cache_dict): cache_dict.update({obj_type: obj_type()}) return cache_dict.setdefault(obj_type)
def get_cache_obj(obj_type): if (obj_type not in cache_dict): cache_dict.update({obj_type: obj_type()}) return cache_dict.setdefault(obj_type)<|docstring|>获取缓存对象<|endoftext|>
bd34dad0925e481d4ce270c5fd5535b1cfdbbd05eed2940f098ca5f01a6b996f
def pickup_features_fn(df, ts_column, start_date, end_date): '\n Computes the pickup_features feature group.\n To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs.\n ' df = filter_df_by_ts(df, ts_column, start_date, end_date) pickupzip_features = df.groupB...
Computes the pickup_features feature group. To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs.
src/week3-mlflow-projects/Feature Store Taxi example notebook.py
pickup_features_fn
Erica233/databricks-zero-to-mlops
9
python
def pickup_features_fn(df, ts_column, start_date, end_date): '\n Computes the pickup_features feature group.\n To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs.\n ' df = filter_df_by_ts(df, ts_column, start_date, end_date) pickupzip_features = df.groupB...
def pickup_features_fn(df, ts_column, start_date, end_date): '\n Computes the pickup_features feature group.\n To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs.\n ' df = filter_df_by_ts(df, ts_column, start_date, end_date) pickupzip_features = df.groupB...
c26224eaee482e805ab39a7422ddd55f51fe9a51a1cee3cd5e60cb3c1589751d
def dropoff_features_fn(df, ts_column, start_date, end_date): '\n Computes the dropoff_features feature group.\n To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs.\n ' df = filter_df_by_ts(df, ts_column, start_date, end_date) dropoffzip_features = df.gro...
Computes the dropoff_features feature group. To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs.
src/week3-mlflow-projects/Feature Store Taxi example notebook.py
dropoff_features_fn
Erica233/databricks-zero-to-mlops
9
python
def dropoff_features_fn(df, ts_column, start_date, end_date): '\n Computes the dropoff_features feature group.\n To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs.\n ' df = filter_df_by_ts(df, ts_column, start_date, end_date) dropoffzip_features = df.gro...
def dropoff_features_fn(df, ts_column, start_date, end_date): '\n Computes the dropoff_features feature group.\n To restrict features to a time range, pass in ts_column, start_date, and/or end_date as kwargs.\n ' df = filter_df_by_ts(df, ts_column, start_date, end_date) dropoffzip_features = df.gro...
f6a5e19db2310e0d189661bbee3898ff12196bbc1da445175940849fa90e7d95
def rounded_unix_timestamp(dt, num_minutes=15): '\n Ceilings datetime dt to interval num_minutes, then returns the unix timestamp.\n ' nsecs = (((dt.minute * 60) + dt.second) + (dt.microsecond * 1e-06)) delta = ((math.ceil((nsecs / (60 * num_minutes))) * (60 * num_minutes)) - nsecs) return int((dt...
Ceilings datetime dt to interval num_minutes, then returns the unix timestamp.
src/week3-mlflow-projects/Feature Store Taxi example notebook.py
rounded_unix_timestamp
Erica233/databricks-zero-to-mlops
9
python
def rounded_unix_timestamp(dt, num_minutes=15): '\n \n ' nsecs = (((dt.minute * 60) + dt.second) + (dt.microsecond * 1e-06)) delta = ((math.ceil((nsecs / (60 * num_minutes))) * (60 * num_minutes)) - nsecs) return int((dt + timedelta(seconds=delta)).timestamp())
def rounded_unix_timestamp(dt, num_minutes=15): '\n \n ' nsecs = (((dt.minute * 60) + dt.second) + (dt.microsecond * 1e-06)) delta = ((math.ceil((nsecs / (60 * num_minutes))) * (60 * num_minutes)) - nsecs) return int((dt + timedelta(seconds=delta)).timestamp())<|docstring|>Ceilings datetime dt to ...
6236444f2109350c4c42cff76fdc4e05f44c2a4f50245c0251b8b028c810d328
@pytest.fixture(scope='session', autouse=True) def shim_settings(): 'Override DGP Application settings object so as not to pollute the regular\n settings when testing.\n\n This fixture will be automatically called, and will delete the settings ini\n file at the conclusion of the test session.\n ' se...
Override DGP Application settings object so as not to pollute the regular settings when testing. This fixture will be automatically called, and will delete the settings ini file at the conclusion of the test session.
tests/conftest.py
shim_settings
DynamicGravitySystems/DGP
7
python
@pytest.fixture(scope='session', autouse=True) def shim_settings(): 'Override DGP Application settings object so as not to pollute the regular\n settings when testing.\n\n This fixture will be automatically called, and will delete the settings ini\n file at the conclusion of the test session.\n ' se...
@pytest.fixture(scope='session', autouse=True) def shim_settings(): 'Override DGP Application settings object so as not to pollute the regular\n settings when testing.\n\n This fixture will be automatically called, and will delete the settings ini\n file at the conclusion of the test session.\n ' se...
404d9ba3a65164611899449d20d072795289199daed2e74eeb5eb233fac8d71d
def excepthook(type_, value, traceback_): 'This allows IDE to properly display unhandled exceptions which are\n otherwise silently ignored as the application is terminated.\n Override default excepthook with\n >>> sys.excepthook = excepthook\n\n See Also\n --------\n\n http://pyqt.sourceforge.net/...
This allows IDE to properly display unhandled exceptions which are otherwise silently ignored as the application is terminated. Override default excepthook with >>> sys.excepthook = excepthook See Also -------- http://pyqt.sourceforge.net/Docs/PyQt5/incompatibilities.html
tests/conftest.py
excepthook
DynamicGravitySystems/DGP
7
python
def excepthook(type_, value, traceback_): 'This allows IDE to properly display unhandled exceptions which are\n otherwise silently ignored as the application is terminated.\n Override default excepthook with\n >>> sys.excepthook = excepthook\n\n See Also\n --------\n\n http://pyqt.sourceforge.net/...
def excepthook(type_, value, traceback_): 'This allows IDE to properly display unhandled exceptions which are\n otherwise silently ignored as the application is terminated.\n Override default excepthook with\n >>> sys.excepthook = excepthook\n\n See Also\n --------\n\n http://pyqt.sourceforge.net/...
5e943eb2481e866ec62ca91a928475481ca7ac2911baf02240ef14c76e186b3c
@pytest.fixture() def project(project_factory, tmpdir): 'This fixture constructs a project model with a flight, gravimeter,\n DataSet (and its children - DataFile/DataSegment) for testing the serialization\n and de-serialization of a fleshed out project.\n ' return project_factory('TestProject', tmpdir...
This fixture constructs a project model with a flight, gravimeter, DataSet (and its children - DataFile/DataSegment) for testing the serialization and de-serialization of a fleshed out project.
tests/conftest.py
project
DynamicGravitySystems/DGP
7
python
@pytest.fixture() def project(project_factory, tmpdir): 'This fixture constructs a project model with a flight, gravimeter,\n DataSet (and its children - DataFile/DataSegment) for testing the serialization\n and de-serialization of a fleshed out project.\n ' return project_factory('TestProject', tmpdir...
@pytest.fixture() def project(project_factory, tmpdir): 'This fixture constructs a project model with a flight, gravimeter,\n DataSet (and its children - DataFile/DataSegment) for testing the serialization\n and de-serialization of a fleshed out project.\n ' return project_factory('TestProject', tmpdir...
e0c453f6170cf3c33784651a94677d6e2dcf0ebeaea1e40dc8d05762ee69e1b2
@pytest.fixture() def batch_executor(): 'To use this fixture, replace batch_executor.batch_fn with your own\n batch function.' def batch_fn(inputs): raise NotImplemented batch_executor = BatchExecutor(batch_fn=batch_fn) (yield batch_executor) batch_executor.close()
To use this fixture, replace batch_executor.batch_fn with your own batch function.
tests/test_batch_executor.py
batch_executor
TheRakeshPurohit/open_vision_capsules
2
python
@pytest.fixture() def batch_executor(): 'To use this fixture, replace batch_executor.batch_fn with your own\n batch function.' def batch_fn(inputs): raise NotImplemented batch_executor = BatchExecutor(batch_fn=batch_fn) (yield batch_executor) batch_executor.close()
@pytest.fixture() def batch_executor(): 'To use this fixture, replace batch_executor.batch_fn with your own\n batch function.' def batch_fn(inputs): raise NotImplemented batch_executor = BatchExecutor(batch_fn=batch_fn) (yield batch_executor) batch_executor.close()<|docstring|>To use thi...
e745995b71760656fa54302184fa0ce732a2bdce216130aaa41503baf67d000c
def batch_fn_base(inputs: List[int], raises: bool) -> Generator[(Any, None, None)]: 'Process results and yield them as they are processed\n\n This function is to be used as a base for other test cases for batch_fn\n variants.\n\n :param inputs: A list of inputs\n :param raises: If True, raises an error ...
Process results and yield them as they are processed This function is to be used as a base for other test cases for batch_fn variants. :param inputs: A list of inputs :param raises: If True, raises an error on the 5th input. If False, no exception will be raised.
tests/test_batch_executor.py
batch_fn_base
TheRakeshPurohit/open_vision_capsules
2
python
def batch_fn_base(inputs: List[int], raises: bool) -> Generator[(Any, None, None)]: 'Process results and yield them as they are processed\n\n This function is to be used as a base for other test cases for batch_fn\n variants.\n\n :param inputs: A list of inputs\n :param raises: If True, raises an error ...
def batch_fn_base(inputs: List[int], raises: bool) -> Generator[(Any, None, None)]: 'Process results and yield them as they are processed\n\n This function is to be used as a base for other test cases for batch_fn\n variants.\n\n :param inputs: A list of inputs\n :param raises: If True, raises an error ...
5ac5887c8a377a1487e6ab96f2062f5829f7dd5fe1d8debcb6aa912e4c243189
def batch_fn_returns_list(inputs: List[int]) -> List[Any]: 'Process results and yield them at the end, as a list.' return list(batch_fn_base(inputs, raises=False))
Process results and yield them at the end, as a list.
tests/test_batch_executor.py
batch_fn_returns_list
TheRakeshPurohit/open_vision_capsules
2
python
def batch_fn_returns_list(inputs: List[int]) -> List[Any]: return list(batch_fn_base(inputs, raises=False))
def batch_fn_returns_list(inputs: List[int]) -> List[Any]: return list(batch_fn_base(inputs, raises=False))<|docstring|>Process results and yield them at the end, as a list.<|endoftext|>
38ad3021da59f6224bee6c0570dca8b18ba611dff451932813279039b4b6aa9d
@pytest.mark.parametrize(argnames=['batch_fn', 'expect_partial_results'], argvalues=[(batch_fn_returns_generator_raises, True), (batch_fn_returns_list_raises, False)]) def test_exceptions_during_batch_fn(batch_executor, batch_fn, expect_partial_results): 'Test that BatchExecutor catches exceptions that occur in the...
Test that BatchExecutor catches exceptions that occur in the batch_fn and propagates them through the requests Future objects. If an exception occurs after processing some of the batch, the expectation is that the unprocessed inputs of the batch will get an exception set (expect_partial_results=True). If the exception...
tests/test_batch_executor.py
test_exceptions_during_batch_fn
TheRakeshPurohit/open_vision_capsules
2
python
@pytest.mark.parametrize(argnames=['batch_fn', 'expect_partial_results'], argvalues=[(batch_fn_returns_generator_raises, True), (batch_fn_returns_list_raises, False)]) def test_exceptions_during_batch_fn(batch_executor, batch_fn, expect_partial_results): 'Test that BatchExecutor catches exceptions that occur in the...
@pytest.mark.parametrize(argnames=['batch_fn', 'expect_partial_results'], argvalues=[(batch_fn_returns_generator_raises, True), (batch_fn_returns_list_raises, False)]) def test_exceptions_during_batch_fn(batch_executor, batch_fn, expect_partial_results): 'Test that BatchExecutor catches exceptions that occur in the...
df55c7a05a6d58db453173a20debd96166b73739160bb180f9b7cbe48fa79e17
@pytest.mark.parametrize(argnames=['batch_fn'], argvalues=[(batch_fn_returns_generator,), (batch_fn_returns_list,)]) def test_relevant_input_outputs_match(batch_executor, batch_fn): 'Test the output for any given input is routed to the correct\n Future object. ' batch_executor.batch_fn = batch_fn request...
Test the output for any given input is routed to the correct Future object.
tests/test_batch_executor.py
test_relevant_input_outputs_match
TheRakeshPurohit/open_vision_capsules
2
python
@pytest.mark.parametrize(argnames=['batch_fn'], argvalues=[(batch_fn_returns_generator,), (batch_fn_returns_list,)]) def test_relevant_input_outputs_match(batch_executor, batch_fn): 'Test the output for any given input is routed to the correct\n Future object. ' batch_executor.batch_fn = batch_fn request...
@pytest.mark.parametrize(argnames=['batch_fn'], argvalues=[(batch_fn_returns_generator,), (batch_fn_returns_list,)]) def test_relevant_input_outputs_match(batch_executor, batch_fn): 'Test the output for any given input is routed to the correct\n Future object. ' batch_executor.batch_fn = batch_fn request...
25998d71b2fc513a0ce02f9f762bca55172e7a66cc170b55debf1b54a5768f3b
def __init__(self, objective, parameter, optimizer): '\n :param objective: an Objective object\n :param parameter: an Parameter object\n :param optimizer: the optimization algorithm\n ' self.__objective = objective self.__parameter = parameter self.__optimizer = optimizer
:param objective: an Objective object :param parameter: an Parameter object :param optimizer: the optimization algorithm
zoopt/algos/high_dimensionality_handling/sre_optimization.py
__init__
IcarusWizard/ZOOpt
403
python
def __init__(self, objective, parameter, optimizer): '\n :param objective: an Objective object\n :param parameter: an Parameter object\n :param optimizer: the optimization algorithm\n ' self.__objective = objective self.__parameter = parameter self.__optimizer = optimizer
def __init__(self, objective, parameter, optimizer): '\n :param objective: an Objective object\n :param parameter: an Parameter object\n :param optimizer: the optimization algorithm\n ' self.__objective = objective self.__parameter = parameter self.__optimizer = optimizer<|do...
a90d7f2e9249977cb437e5605c975cd27c7f93f13f0d7073c2bc2f88588100fe
def opt(self): '\n Sequential random embedding optimization.\n\n :return: the best solution of the optimization\n ' dim = self.__objective.get_dim() res = [] iteration = self.__parameter.get_num_sre() new_obj = copy.deepcopy(self.__objective) new_par = copy.deepcopy(self.__p...
Sequential random embedding optimization. :return: the best solution of the optimization
zoopt/algos/high_dimensionality_handling/sre_optimization.py
opt
IcarusWizard/ZOOpt
403
python
def opt(self): '\n Sequential random embedding optimization.\n\n :return: the best solution of the optimization\n ' dim = self.__objective.get_dim() res = [] iteration = self.__parameter.get_num_sre() new_obj = copy.deepcopy(self.__objective) new_par = copy.deepcopy(self.__p...
def opt(self): '\n Sequential random embedding optimization.\n\n :return: the best solution of the optimization\n ' dim = self.__objective.get_dim() res = [] iteration = self.__parameter.get_num_sre() new_obj = copy.deepcopy(self.__objective) new_par = copy.deepcopy(self.__p...
21319c7c784a0e08c9c8377a6bbcb334185eb0ace885406889d30630222dc770
def test_make_gradient_2d(self): '\n Function creates a dummy file with a 2D gradient.\n :return: True\n ' print('[INFO] Making 2d image filled with gradient squares.') x = np.arange(16).reshape(16, 1) pixel_array = ((x + x.T) * 16) pixel_array = np.tile(pixel_array, (4, 4)) ...
Function creates a dummy file with a 2D gradient. :return: True
test_converter.py
test_make_gradient_2d
In1th/j-pet-format-converter
1
python
def test_make_gradient_2d(self): '\n Function creates a dummy file with a 2D gradient.\n :return: True\n ' print('[INFO] Making 2d image filled with gradient squares.') x = np.arange(16).reshape(16, 1) pixel_array = ((x + x.T) * 16) pixel_array = np.tile(pixel_array, (4, 4)) ...
def test_make_gradient_2d(self): '\n Function creates a dummy file with a 2D gradient.\n :return: True\n ' print('[INFO] Making 2d image filled with gradient squares.') x = np.arange(16).reshape(16, 1) pixel_array = ((x + x.T) * 16) pixel_array = np.tile(pixel_array, (4, 4)) ...
3203976e355eb84b3c1165c2af11213090176c703f732686e7246bb4328483dc
def test_make_gradient_3d(self): '\n Function creates a dummy file with a 2D gradient, repeated on 4 slices.\n :return: \n ' print('[INFO] Making 3d image filled with gradient squares.') x = np.arange(16).reshape(16, 1) pixel_array = ((x + x.T) * 16) pixel_array = np.tile(pixel_...
Function creates a dummy file with a 2D gradient, repeated on 4 slices. :return:
test_converter.py
test_make_gradient_3d
In1th/j-pet-format-converter
1
python
def test_make_gradient_3d(self): '\n Function creates a dummy file with a 2D gradient, repeated on 4 slices.\n :return: \n ' print('[INFO] Making 3d image filled with gradient squares.') x = np.arange(16).reshape(16, 1) pixel_array = ((x + x.T) * 16) pixel_array = np.tile(pixel_...
def test_make_gradient_3d(self): '\n Function creates a dummy file with a 2D gradient, repeated on 4 slices.\n :return: \n ' print('[INFO] Making 3d image filled with gradient squares.') x = np.arange(16).reshape(16, 1) pixel_array = ((x + x.T) * 16) pixel_array = np.tile(pixel_...
f79eac047d02a561a784259fb89f4c909b6870a5e0d7a501d2fe732b410b6b89
def variable_summaries(var): 'Attach a lot of summaries to a Tensor (for TensorBoard visualization).' with tf.name_scope('summaries'): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean)
Attach a lot of summaries to a Tensor (for TensorBoard visualization).
captcha_cnn/main.py
variable_summaries
leafsummer/captcha-tensorflow
823
python
def variable_summaries(var): with tf.name_scope('summaries'): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean)
def variable_summaries(var): with tf.name_scope('summaries'): mean = tf.reduce_mean(var) tf.summary.scalar('mean', mean)<|docstring|>Attach a lot of summaries to a Tensor (for TensorBoard visualization).<|endoftext|>
07470f8ecbdb6a27daa5897bb0de162f86bad37acb622b480d04baf9aa3f9fd6
def main(): 'reading json from api' groundctrl = urllib.request.urlopen(MAJORTOM) helmet = groundctrl.read() helmetson = json.loads(helmet.decode('utf-8')) print(('People in space: ' + str(helmetson['number']))) for astro in helmetson['people']: print(((astro['name'] + ' on the ') + astr...
reading json from api
iss/requests-ride_iss2.py
main
nebiutadele/2022-02-28-Alta3-Python
0
python
def main(): groundctrl = urllib.request.urlopen(MAJORTOM) helmet = groundctrl.read() helmetson = json.loads(helmet.decode('utf-8')) print(('People in space: ' + str(helmetson['number']))) for astro in helmetson['people']: print(((astro['name'] + ' on the ') + astro['craft']))
def main(): groundctrl = urllib.request.urlopen(MAJORTOM) helmet = groundctrl.read() helmetson = json.loads(helmet.decode('utf-8')) print(('People in space: ' + str(helmetson['number']))) for astro in helmetson['people']: print(((astro['name'] + ' on the ') + astro['craft']))<|docstring...
e5c0865e7c4282d2d5f95fd494dfa8f5c0d0762e769903c2c7d4283a9011e171
def load(file, *, bitmap=None, palette=None): 'Loads a GIF image from the open ``file``.\n\n Returns tuple of bitmap object and palette object.\n\n :param object bitmap: Type to store bitmap data. Must have API similar to `displayio.Bitmap`.\n Will be skipped if None\n :param object palett...
Loads a GIF image from the open ``file``. Returns tuple of bitmap object and palette object. :param object bitmap: Type to store bitmap data. Must have API similar to `displayio.Bitmap`. Will be skipped if None :param object palette: Type to store the palette. Must have API similar to `displayio.Palette`. Will be...
adafruit_imageload/gif.py
load
cogliano/Adafruit_CircuitPython_ImageLoad
0
python
def load(file, *, bitmap=None, palette=None): 'Loads a GIF image from the open ``file``.\n\n Returns tuple of bitmap object and palette object.\n\n :param object bitmap: Type to store bitmap data. Must have API similar to `displayio.Bitmap`.\n Will be skipped if None\n :param object palett...
def load(file, *, bitmap=None, palette=None): 'Loads a GIF image from the open ``file``.\n\n Returns tuple of bitmap object and palette object.\n\n :param object bitmap: Type to store bitmap data. Must have API similar to `displayio.Bitmap`.\n Will be skipped if None\n :param object palett...
c0ca6e114db16c5bac61ad4a52d588df30b58c1ebaa9b4e42421dae6d79b5ace
def _read_frame(file, bitmap): 'Read a signle frame and apply it to the bitmap.' (ddx, ddy, width, _, flags) = struct.unpack('<HHHHB', file.read(9)) if ((flags & 64) != 0): raise NotImplementedError('Interlacing not supported') if ((flags & 128) != 0): palette_size = (1 << ((flags & 7) +...
Read a signle frame and apply it to the bitmap.
adafruit_imageload/gif.py
_read_frame
cogliano/Adafruit_CircuitPython_ImageLoad
0
python
def _read_frame(file, bitmap): (ddx, ddy, width, _, flags) = struct.unpack('<HHHHB', file.read(9)) if ((flags & 64) != 0): raise NotImplementedError('Interlacing not supported') if ((flags & 128) != 0): palette_size = (1 << ((flags & 7) + 1)) for _ in range(palette_size): ...
def _read_frame(file, bitmap): (ddx, ddy, width, _, flags) = struct.unpack('<HHHHB', file.read(9)) if ((flags & 64) != 0): raise NotImplementedError('Interlacing not supported') if ((flags & 128) != 0): palette_size = (1 << ((flags & 7) + 1)) for _ in range(palette_size): ...
6dfd5464971ba33fd8392ce860c52d2cdf73fda53a671ef35e2fac2a1fc362ae
def _read_blockstream(file): 'Read a block from a file.' while True: size = file.read(1)[0] if (size == 0): break for _ in range(size): (yield file.read(1)[0])
Read a block from a file.
adafruit_imageload/gif.py
_read_blockstream
cogliano/Adafruit_CircuitPython_ImageLoad
0
python
def _read_blockstream(file): while True: size = file.read(1)[0] if (size == 0): break for _ in range(size): (yield file.read(1)[0])
def _read_blockstream(file): while True: size = file.read(1)[0] if (size == 0): break for _ in range(size): (yield file.read(1)[0])<|docstring|>Read a block from a file.<|endoftext|>
b94a340b06884cda7e81e5382d23f13b20dbd3abfb1ac0869dfd64bdddd0b7b3
def lzw_decode(data, code_size): 'Decode LZW-compressed data.' dictionary = LZWDict(code_size) bit = 0 byte = next(data) try: while True: code = 0 for i in range(dictionary.code_len): code |= (((byte >> bit) & 1) << i) bit += 1 ...
Decode LZW-compressed data.
adafruit_imageload/gif.py
lzw_decode
cogliano/Adafruit_CircuitPython_ImageLoad
0
python
def lzw_decode(data, code_size): dictionary = LZWDict(code_size) bit = 0 byte = next(data) try: while True: code = 0 for i in range(dictionary.code_len): code |= (((byte >> bit) & 1) << i) bit += 1 if (bit >= 8): ...
def lzw_decode(data, code_size): dictionary = LZWDict(code_size) bit = 0 byte = next(data) try: while True: code = 0 for i in range(dictionary.code_len): code |= (((byte >> bit) & 1) << i) bit += 1 if (bit >= 8): ...
544008555665dcc896e8d0d18b9e8ab3afa6eae39ed33dfc3b4a9aa9d5a88d50
def clear(self): 'Reset the dictionary to default codes.' self.last = b'' self.code_len = (self.code_size + 1) self.codes[:] = []
Reset the dictionary to default codes.
adafruit_imageload/gif.py
clear
cogliano/Adafruit_CircuitPython_ImageLoad
0
python
def clear(self): self.last = b self.code_len = (self.code_size + 1) self.codes[:] = []
def clear(self): self.last = b self.code_len = (self.code_size + 1) self.codes[:] = []<|docstring|>Reset the dictionary to default codes.<|endoftext|>
7dd102bac3ceab04f61fbe0dfa1be374848b922f9c5f52a8ee0c4694cd1112fc
def decode(self, code): 'Decode a code.' if (code == self.clear_code): self.clear() return b'' elif (code == self.end_code): raise EndOfData() elif (code < self.clear_code): value = bytes([code]) elif (code <= (len(self.codes) + self.end_code)): value = self.c...
Decode a code.
adafruit_imageload/gif.py
decode
cogliano/Adafruit_CircuitPython_ImageLoad
0
python
def decode(self, code): if (code == self.clear_code): self.clear() return b elif (code == self.end_code): raise EndOfData() elif (code < self.clear_code): value = bytes([code]) elif (code <= (len(self.codes) + self.end_code)): value = self.codes[((code - self...
def decode(self, code): if (code == self.clear_code): self.clear() return b elif (code == self.end_code): raise EndOfData() elif (code < self.clear_code): value = bytes([code]) elif (code <= (len(self.codes) + self.end_code)): value = self.codes[((code - self...
e1eec171553ab751a2a59fed7746ee60e521ddfa980899c9c9df70ca2773cc33
def __str__(self) -> str: 'Allows to use a color code inside f-strings without the need for .value.' return str.__str__(self)
Allows to use a color code inside f-strings without the need for .value.
src/_pytask/enums.py
__str__
pytask-dev/pytask
41
python
def __str__(self) -> str: return str.__str__(self)
def __str__(self) -> str: return str.__str__(self)<|docstring|>Allows to use a color code inside f-strings without the need for .value.<|endoftext|>
8dcb182f811366591053106cd26853910f07ea3511186ee5c1c246846972c9a1
@app.command() def setup(): '\n Setup environment for maestro\n ' install_dependencies() setup_docker() copy_workspace_file()
Setup environment for maestro
maestro_cli/__init__.py
setup
RJ-SMTR/maestro
3
python
@app.command() def setup(): '\n \n ' install_dependencies() setup_docker() copy_workspace_file()
@app.command() def setup(): '\n \n ' install_dependencies() setup_docker() copy_workspace_file()<|docstring|>Setup environment for maestro<|endoftext|>
465c4d8f81bcc121fca70dcade8adf32b27a7f2ac2076612d94989c7fbab2482
@app.command() def up(): '\n Run maestro setup locally\n ' load_env_file('.env_local') run_threaded(run_daemon)() run_threaded(run_dagit)() run_threaded(run_grpc)()
Run maestro setup locally
maestro_cli/__init__.py
up
RJ-SMTR/maestro
3
python
@app.command() def up(): '\n \n ' load_env_file('.env_local') run_threaded(run_daemon)() run_threaded(run_dagit)() run_threaded(run_grpc)()
@app.command() def up(): '\n \n ' load_env_file('.env_local') run_threaded(run_daemon)() run_threaded(run_dagit)() run_threaded(run_grpc)()<|docstring|>Run maestro setup locally<|endoftext|>
71015ec34690646935172bcb60f082d4c303661969b6f8ae61377c5b0b4324ae
@app.command() def down(): '\n Shutdown local setup\n ' docker_down()
Shutdown local setup
maestro_cli/__init__.py
down
RJ-SMTR/maestro
3
python
@app.command() def down(): '\n \n ' docker_down()
@app.command() def down(): '\n \n ' docker_down()<|docstring|>Shutdown local setup<|endoftext|>
96f0419bf8fcee38672fb521c0a3115df7ee7d28b2562b04237d629235a79642
def __init__(self, xknx: XKNX, group_address: (GroupAddressesType | None)=None, group_address_state: (GroupAddressesType | None)=None, sync_state: (((bool | int) | float) | str)=True, device_name: (str | None)=None, feature_name: str='Value', after_update_cb: (AsyncCallbackType | None)=None): 'Initialize remote val...
Initialize remote value of KNX DPT 7.001.
xknx/remote_value/remote_value_dpt_2_byte_unsigned.py
__init__
wagner-tech/xknx
179
python
def __init__(self, xknx: XKNX, group_address: (GroupAddressesType | None)=None, group_address_state: (GroupAddressesType | None)=None, sync_state: (((bool | int) | float) | str)=True, device_name: (str | None)=None, feature_name: str='Value', after_update_cb: (AsyncCallbackType | None)=None): super().__init__(...
def __init__(self, xknx: XKNX, group_address: (GroupAddressesType | None)=None, group_address_state: (GroupAddressesType | None)=None, sync_state: (((bool | int) | float) | str)=True, device_name: (str | None)=None, feature_name: str='Value', after_update_cb: (AsyncCallbackType | None)=None): super().__init__(...
a42669e5e6e88bc101ffdcf56c6691530793b29179212eb76bf4ccfd8d99ad11
def payload_valid(self, payload: ((DPTArray | DPTBinary) | None)) -> (DPTArray | None): 'Test if telegram payload may be parsed.' return (payload if (isinstance(payload, DPTArray) and (len(payload.value) == 2)) else None)
Test if telegram payload may be parsed.
xknx/remote_value/remote_value_dpt_2_byte_unsigned.py
payload_valid
wagner-tech/xknx
179
python
def payload_valid(self, payload: ((DPTArray | DPTBinary) | None)) -> (DPTArray | None): return (payload if (isinstance(payload, DPTArray) and (len(payload.value) == 2)) else None)
def payload_valid(self, payload: ((DPTArray | DPTBinary) | None)) -> (DPTArray | None): return (payload if (isinstance(payload, DPTArray) and (len(payload.value) == 2)) else None)<|docstring|>Test if telegram payload may be parsed.<|endoftext|>
c1e2bbc12cafd03bd4593879c011a5feeec8e7c8afd31a5b3c5d9276b01a15d6
def to_knx(self, value: int) -> DPTArray: 'Convert value to payload.' return DPTArray(DPT2ByteUnsigned.to_knx(value))
Convert value to payload.
xknx/remote_value/remote_value_dpt_2_byte_unsigned.py
to_knx
wagner-tech/xknx
179
python
def to_knx(self, value: int) -> DPTArray: return DPTArray(DPT2ByteUnsigned.to_knx(value))
def to_knx(self, value: int) -> DPTArray: return DPTArray(DPT2ByteUnsigned.to_knx(value))<|docstring|>Convert value to payload.<|endoftext|>
5c0411177be36a49af869d207c356ab299a171792d48c2f11df0936a5645ce86
def from_knx(self, payload: DPTArray) -> int: 'Convert current payload to value.' return DPT2ByteUnsigned.from_knx(payload.value)
Convert current payload to value.
xknx/remote_value/remote_value_dpt_2_byte_unsigned.py
from_knx
wagner-tech/xknx
179
python
def from_knx(self, payload: DPTArray) -> int: return DPT2ByteUnsigned.from_knx(payload.value)
def from_knx(self, payload: DPTArray) -> int: return DPT2ByteUnsigned.from_knx(payload.value)<|docstring|>Convert current payload to value.<|endoftext|>
09a67dec0c11d39f677b40c7ec8dfc6130fd2ed4298278d7ec60bf2ce616978d
@mock.patch('datahub.core.thread_pool._executor.submit', _synchronous_executor_submit) @mock.patch('sentry_sdk.capture_exception') def test_error_raises_exception(mock_capture_exception): '\n Test that if an error occurs whilst executing a thread pool task,\n the exception is raised and sent to sentry.\n '...
Test that if an error occurs whilst executing a thread pool task, the exception is raised and sent to sentry.
datahub/core/test/test_thread_pool.py
test_error_raises_exception
Staberinde/data-hub-api
6
python
@mock.patch('datahub.core.thread_pool._executor.submit', _synchronous_executor_submit) @mock.patch('sentry_sdk.capture_exception') def test_error_raises_exception(mock_capture_exception): '\n Test that if an error occurs whilst executing a thread pool task,\n the exception is raised and sent to sentry.\n '...
@mock.patch('datahub.core.thread_pool._executor.submit', _synchronous_executor_submit) @mock.patch('sentry_sdk.capture_exception') def test_error_raises_exception(mock_capture_exception): '\n Test that if an error occurs whilst executing a thread pool task,\n the exception is raised and sent to sentry.\n '...
a4571a1fb2f490898503044a039eecb02d9cf884ddf18392f95bdd0f5575d016
def call_subprocess_Popen(command, **params): '\n Utility function to work around windows behavior that open windows\n ' startupinfo = None if (os.name == 'nt'): startupinfo = subprocess.STARTUPINFO() try: startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW excep...
Utility function to work around windows behavior that open windows
theano/misc/windows.py
call_subprocess_Popen
laurent-dinh/Theano
11
python
def call_subprocess_Popen(command, **params): '\n \n ' startupinfo = None if (os.name == 'nt'): startupinfo = subprocess.STARTUPINFO() try: startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW except AttributeError: startupinfo.dwFlags |= subprocess._s...
def call_subprocess_Popen(command, **params): '\n \n ' startupinfo = None if (os.name == 'nt'): startupinfo = subprocess.STARTUPINFO() try: startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW except AttributeError: startupinfo.dwFlags |= subprocess._s...
ac7d386d9367a5530570c9afd59c7d8f1e395edb3e65f386ff2357919b3408d5
def regex_replace(s, find, replace): 'A non-optimal implementation of a regex filter' return re.sub(find, replace, s)
A non-optimal implementation of a regex filter
mailinglists/sympa/start.py
regex_replace
c-holtermann/Mailu
0
python
def regex_replace(s, find, replace): return re.sub(find, replace, s)
def regex_replace(s, find, replace): return re.sub(find, replace, s)<|docstring|>A non-optimal implementation of a regex filter<|endoftext|>
6bc0cf55cead0e19a7508ace90de6c1dea51e275e0849b22b9aad7e727d06dcc
def generate_tfrecords(): '\n\n :return:\n ' producer = lanenet_data_feed_pipline.LaneNetDataProducer() producer.generate_tfrecords() return
:return:
tools/make_tusimple_tfrecords.py
generate_tfrecords
mageofboy/lanenet-lane-detection
0
python
def generate_tfrecords(): '\n\n \n ' producer = lanenet_data_feed_pipline.LaneNetDataProducer() producer.generate_tfrecords() return
def generate_tfrecords(): '\n\n \n ' producer = lanenet_data_feed_pipline.LaneNetDataProducer() producer.generate_tfrecords() return<|docstring|>:return:<|endoftext|>
54fb76a70e71d2dc9c66aa113d3ddff5c9fd11696e09d9eb63e027f61aff6c5c
def createRay(start, end): '\n start: 2d point coordinate\n end: 2d point coordinate\n ' ray = Arrow(np.array([start[0], start[1], 0]), np.array([end[0], end[1], 0]), buff=0) ray.set_stroke(color=BLACK, width=1, opacity=1) return ray
start: 2d point coordinate end: 2d point coordinate
examples/geometry/utils.py
createRay
beidongjiedeguang/manim-express
12
python
def createRay(start, end): '\n start: 2d point coordinate\n end: 2d point coordinate\n ' ray = Arrow(np.array([start[0], start[1], 0]), np.array([end[0], end[1], 0]), buff=0) ray.set_stroke(color=BLACK, width=1, opacity=1) return ray
def createRay(start, end): '\n start: 2d point coordinate\n end: 2d point coordinate\n ' ray = Arrow(np.array([start[0], start[1], 0]), np.array([end[0], end[1], 0]), buff=0) ray.set_stroke(color=BLACK, width=1, opacity=1) return ray<|docstring|>start: 2d point coordinate end: 2d point coordina...
8a51bde1f94c47f58d8fcc98f6282e90692c5e76ce04c353b4f71da8803cff72
def get_circ_normal(point, origin): '3d inputs' print(point, origin, 'point and origin') (point, origin) = (np.array(point), np.array(origin)) normal = np.array([(point[0] - origin[0]), (point[1] - origin[1]), (point[2] - origin[2])]) return normalize(normal)
3d inputs
examples/geometry/utils.py
get_circ_normal
beidongjiedeguang/manim-express
12
python
def get_circ_normal(point, origin): print(point, origin, 'point and origin') (point, origin) = (np.array(point), np.array(origin)) normal = np.array([(point[0] - origin[0]), (point[1] - origin[1]), (point[2] - origin[2])]) return normalize(normal)
def get_circ_normal(point, origin): print(point, origin, 'point and origin') (point, origin) = (np.array(point), np.array(origin)) normal = np.array([(point[0] - origin[0]), (point[1] - origin[1]), (point[2] - origin[2])]) return normalize(normal)<|docstring|>3d inputs<|endoftext|>
7dc818973f8fb1be6c07729d32be5f15d1aadd87f7b77dad85a5629bafe18d99
def theta_def_to_sca(theta_def): '本函数已正确实施' kp = int(((PI - theta_def) / (2 * PI))) var = (theta_def % (2 * PI)) if (abs(var) < PI): q = 1 else: q = (- 1) theta_sca = ((theta_def + ((2 * np.pi) * kp)) / q) return (theta_sca, q)
本函数已正确实施
examples/geometry/utils.py
theta_def_to_sca
beidongjiedeguang/manim-express
12
python
def theta_def_to_sca(theta_def): kp = int(((PI - theta_def) / (2 * PI))) var = (theta_def % (2 * PI)) if (abs(var) < PI): q = 1 else: q = (- 1) theta_sca = ((theta_def + ((2 * np.pi) * kp)) / q) return (theta_sca, q)
def theta_def_to_sca(theta_def): kp = int(((PI - theta_def) / (2 * PI))) var = (theta_def % (2 * PI)) if (abs(var) < PI): q = 1 else: q = (- 1) theta_sca = ((theta_def + ((2 * np.pi) * kp)) / q) return (theta_sca, q)<|docstring|>本函数已正确实施<|endoftext|>
104917a22182ff39ff00d79b480f5ef11d9a41993bd6f286c43a90253e4ee30e
def as_json(self): 'The method return as json.' return jsonify({'id': self.id, 'plan_id': self.plan_id, 'company_id': self.company_id, 'name': self.name, 'description': self.description, 'maternity': self.maternity, 'transplant': self.transplant, 'cost_admin': self.cost_admin, 'price': self.price, 'url_info': s...
The method return as json.
pgs_api/models/plan.py
as_json
quemao18/PGS_API
0
python
def as_json(self): return jsonify({'id': self.id, 'plan_id': self.plan_id, 'company_id': self.company_id, 'name': self.name, 'description': self.description, 'maternity': self.maternity, 'transplant': self.transplant, 'cost_admin': self.cost_admin, 'price': self.price, 'url_info': self.url_info})
def as_json(self): return jsonify({'id': self.id, 'plan_id': self.plan_id, 'company_id': self.company_id, 'name': self.name, 'description': self.description, 'maternity': self.maternity, 'transplant': self.transplant, 'cost_admin': self.cost_admin, 'price': self.price, 'url_info': self.url_info})<|docstring|>T...
73a0926b71816c2c74a4559e4ab0dea3b54afddf483b08569b417293f4fe258d
def is_authorized_to(self, action): 'The method is authorized' return (action in self.claims)
The method is authorized
pgs_api/models/plan.py
is_authorized_to
quemao18/PGS_API
0
python
def is_authorized_to(self, action): return (action in self.claims)
def is_authorized_to(self, action): return (action in self.claims)<|docstring|>The method is authorized<|endoftext|>
6726a17540b3d254328d0cbeda6d894f773cfe5a1fc81fadd47c488870ff346b
def update_price(self, price): 'The method for update price' self.price = price self.save() return True
The method for update price
pgs_api/models/plan.py
update_price
quemao18/PGS_API
0
python
def update_price(self, price): self.price = price self.save() return True
def update_price(self, price): self.price = price self.save() return True<|docstring|>The method for update price<|endoftext|>
9e7f492c76276215ee41bbfbdafee2106425419decba9ae9e9d0a929f0789402
def update_status(self): 'The method for update email' if self.status: new_status = False else: new_status = True self.status = new_status self.save() return True
The method for update email
pgs_api/models/plan.py
update_status
quemao18/PGS_API
0
python
def update_status(self): if self.status: new_status = False else: new_status = True self.status = new_status self.save() return True
def update_status(self): if self.status: new_status = False else: new_status = True self.status = new_status self.save() return True<|docstring|>The method for update email<|endoftext|>
6f7475b0befbb438cff68b8e18b8b397d2f9fc3664c8360036a4f94aab62a9d8
def update_plan(self, data): 'The method for update plan' self.name = data['name'] self.description = data['description'] self.maternity = data['maternity'] self.transplant = data['transplant'] self.cost_admin = data['cost_admin'] self.price = data['price'] self.url_info = data['url_info...
The method for update plan
pgs_api/models/plan.py
update_plan
quemao18/PGS_API
0
python
def update_plan(self, data): self.name = data['name'] self.description = data['description'] self.maternity = data['maternity'] self.transplant = data['transplant'] self.cost_admin = data['cost_admin'] self.price = data['price'] self.url_info = data['url_info'] self.date_modified = ...
def update_plan(self, data): self.name = data['name'] self.description = data['description'] self.maternity = data['maternity'] self.transplant = data['transplant'] self.cost_admin = data['cost_admin'] self.price = data['price'] self.url_info = data['url_info'] self.date_modified = ...
b26c749e5cacfc0af39ee994eaac28cd85272c60266256ef1f4456c91b203273
def get_identity(self): 'The method for get identity' return SessionIdentity(self.company_id, self.plan_id, self.name, self.description, self.price, self.transplant, self.maternity, self.cost_admin, self.url_info)
The method for get identity
pgs_api/models/plan.py
get_identity
quemao18/PGS_API
0
python
def get_identity(self): return SessionIdentity(self.company_id, self.plan_id, self.name, self.description, self.price, self.transplant, self.maternity, self.cost_admin, self.url_info)
def get_identity(self): return SessionIdentity(self.company_id, self.plan_id, self.name, self.description, self.price, self.transplant, self.maternity, self.cost_admin, self.url_info)<|docstring|>The method for get identity<|endoftext|>
d3f1776893671dbf1a3b8c5b72e5161aaab436da85de86a0677a6d4ffbe0c9b8
def get_plan(self): 'The method for get plan' data = Plan.objects.get(plan_id=self.plan_id) if data: return data return None
The method for get plan
pgs_api/models/plan.py
get_plan
quemao18/PGS_API
0
python
def get_plan(self): data = Plan.objects.get(plan_id=self.plan_id) if data: return data return None
def get_plan(self): data = Plan.objects.get(plan_id=self.plan_id) if data: return data return None<|docstring|>The method for get plan<|endoftext|>
547407add9c65f0637cfbf403e510f73bba5eb7fbdc968a8e1a04a81127ed8f9
def get_plans(): 'The method for get plans' data = Plan.objects.all() if data: return data return None
The method for get plans
pgs_api/models/plan.py
get_plans
quemao18/PGS_API
0
python
def get_plans(): data = Plan.objects.all() if data: return data return None
def get_plans(): data = Plan.objects.all() if data: return data return None<|docstring|>The method for get plans<|endoftext|>
987a0247279c7ebae98db5fbb7d545287fc92f8f37b5f7d58fec60ea6ecfc992
def delete(self): 'The method for delete ' plan = Plan.objects.get(plan_id=self.plan_id).delete() return True
The method for delete
pgs_api/models/plan.py
delete
quemao18/PGS_API
0
python
def delete(self): ' ' plan = Plan.objects.get(plan_id=self.plan_id).delete() return True
def delete(self): ' ' plan = Plan.objects.get(plan_id=self.plan_id).delete() return True<|docstring|>The method for delete<|endoftext|>
a2ce66d9b0babbb0adc729aaa474bbbcc1a3d1e891bd17dbb3a3634fc05f667e
def get_plans_country(): 'The method for get plans' data = Plan.objects.get(country_id=self.country_id) if data: return data return None
The method for get plans
pgs_api/models/plan.py
get_plans_country
quemao18/PGS_API
0
python
def get_plans_country(): data = Plan.objects.get(country_id=self.country_id) if data: return data return None
def get_plans_country(): data = Plan.objects.get(country_id=self.country_id) if data: return data return None<|docstring|>The method for get plans<|endoftext|>
49e72552904c08f8d28550b469716f0c12ab35b7c26c4b7b54661b7107c5ba87
def findMissingRanges(self, nums, lower, upper): '\n :type nums: List[int]\n :type lower: int\n :type upper: int\n :rtype: List[str]\n ' start = lower ranges = [] for num in nums: if (num > start): ranges.append((start, (num - 1))) start = (...
:type nums: List[int] :type lower: int :type upper: int :rtype: List[str]
Leetcode/163_find_missing_ranges/find_missing_ranges.py
findMissingRanges
web-tools42/Interview
13
python
def findMissingRanges(self, nums, lower, upper): '\n :type nums: List[int]\n :type lower: int\n :type upper: int\n :rtype: List[str]\n ' start = lower ranges = [] for num in nums: if (num > start): ranges.append((start, (num - 1))) start = (...
def findMissingRanges(self, nums, lower, upper): '\n :type nums: List[int]\n :type lower: int\n :type upper: int\n :rtype: List[str]\n ' start = lower ranges = [] for num in nums: if (num > start): ranges.append((start, (num - 1))) start = (...
769a944863580db47774b3ea6ec5029736580d3cc9a917f738c74e087afd1fa8
def construct_address(host, port, route, args): "\n {host}:{port}{route}?{'&'.join(args)}\n\n :param str host: '0.0.0.0'\n :param str port: '5000'\n :param str route: '/store/file/here'\n :param list[str] args: ['a=b', 'c=d']\n " return f"http://{host}:{port}{route}?{'&'.jo...
{host}:{port}{route}?{'&'.join(args)} :param str host: '0.0.0.0' :param str port: '5000' :param str route: '/store/file/here' :param list[str] args: ['a=b', 'c=d']
microservices/frontend/main.py
construct_address
scott-sattler/RESTful-project
0
python
def construct_address(host, port, route, args): "\n {host}:{port}{route}?{'&'.join(args)}\n\n :param str host: '0.0.0.0'\n :param str port: '5000'\n :param str route: '/store/file/here'\n :param list[str] args: ['a=b', 'c=d']\n " return f"http://{host}:{port}{route}?{'&'.jo...
def construct_address(host, port, route, args): "\n {host}:{port}{route}?{'&'.join(args)}\n\n :param str host: '0.0.0.0'\n :param str port: '5000'\n :param str route: '/store/file/here'\n :param list[str] args: ['a=b', 'c=d']\n " return f"http://{host}:{port}{route}?{'&'.jo...
d9ca203ea8f44c85b7e631d1a05b20861a9a7cab6560034c2b966dba21ee9859
def auroc_ood(values_in: np.ndarray, values_out: np.ndarray) -> float: '\n Implementation of Area-under-Curve metric for out-of-distribution detection.\n The higher the value the better.\n\n Args:\n values_in: Maximal confidences (i.e. maximum probability per each sample)\n for in-domain ...
Implementation of Area-under-Curve metric for out-of-distribution detection. The higher the value the better. Args: values_in: Maximal confidences (i.e. maximum probability per each sample) for in-domain data. values_out: Maximal confidences (i.e. maximum probability per each sample) for out-of...
shifthappens/tasks/utils.py
auroc_ood
shift-happens-benchmark/iclr-2022
0
python
def auroc_ood(values_in: np.ndarray, values_out: np.ndarray) -> float: '\n Implementation of Area-under-Curve metric for out-of-distribution detection.\n The higher the value the better.\n\n Args:\n values_in: Maximal confidences (i.e. maximum probability per each sample)\n for in-domain ...
def auroc_ood(values_in: np.ndarray, values_out: np.ndarray) -> float: '\n Implementation of Area-under-Curve metric for out-of-distribution detection.\n The higher the value the better.\n\n Args:\n values_in: Maximal confidences (i.e. maximum probability per each sample)\n for in-domain ...
f193859af9b6fa3c3442f5b678c3ecca78aa3188095268c37c4b5c8cc43ecf8c
def fpr_at_tpr(values_in: np.ndarray, values_out: np.ndarray, tpr: float) -> float: '\n Calculates the FPR at a particular TRP for out-of-distribution detection.\n The lower the value the better.\n\n Args:\n values_in: Maximal confidences (i.e. maximum probability per each sample)\n for i...
Calculates the FPR at a particular TRP for out-of-distribution detection. The lower the value the better. Args: values_in: Maximal confidences (i.e. maximum probability per each sample) for in-domain data. values_out: Maximal confidences (i.e. maximum probability per each sample) for out-of-dom...
shifthappens/tasks/utils.py
fpr_at_tpr
shift-happens-benchmark/iclr-2022
0
python
def fpr_at_tpr(values_in: np.ndarray, values_out: np.ndarray, tpr: float) -> float: '\n Calculates the FPR at a particular TRP for out-of-distribution detection.\n The lower the value the better.\n\n Args:\n values_in: Maximal confidences (i.e. maximum probability per each sample)\n for i...
def fpr_at_tpr(values_in: np.ndarray, values_out: np.ndarray, tpr: float) -> float: '\n Calculates the FPR at a particular TRP for out-of-distribution detection.\n The lower the value the better.\n\n Args:\n values_in: Maximal confidences (i.e. maximum probability per each sample)\n for i...
28ed736c4d6111066679b27152623ce4677fe20993bf2b193a10f7c9ee97567a
def populate_all(service_id: str=None, service_name: str=None): 'Gets the oncall for a given service id or name.' if True: print('Done populate_all') elif False: service = pypd.Service.find(query=service_name) if (not service): raise DispatchPluginException(f'No on-call s...
Gets the oncall for a given service id or name.
src/dispatch/plugins/kandbox_data_generator/service.py
populate_all
alibaba/easydispatch
11
python
def populate_all(service_id: str=None, service_name: str=None): if True: print('Done populate_all') elif False: service = pypd.Service.find(query=service_name) if (not service): raise DispatchPluginException(f'No on-call service found with service name: {service_name}') ...
def populate_all(service_id: str=None, service_name: str=None): if True: print('Done populate_all') elif False: service = pypd.Service.find(query=service_name) if (not service): raise DispatchPluginException(f'No on-call service found with service name: {service_name}') ...
bcb98f530dd31c438ab69f87c65c3ba105c4290226545af17a3ba4122ca77f88
def create_only_or_exclude_filter(ap, short_flag: str, long_flag: str, description: str, **kwargs) -> None: '\n An helper method to reduce redundant code and thus reduce copy paste errors\n ' if (len(short_flag) != 1): raise Exception('short_flag needs to be a single character') mutex = ap.add...
An helper method to reduce redundant code and thus reduce copy paste errors
src/shell_command_logger/cli/search.py
create_only_or_exclude_filter
six-two/shell-command-logger
0
python
def create_only_or_exclude_filter(ap, short_flag: str, long_flag: str, description: str, **kwargs) -> None: '\n \n ' if (len(short_flag) != 1): raise Exception('short_flag needs to be a single character') mutex = ap.add_mutually_exclusive_group() mutex.add_argument(f'-{short_flag.lower()}'...
def create_only_or_exclude_filter(ap, short_flag: str, long_flag: str, description: str, **kwargs) -> None: '\n \n ' if (len(short_flag) != 1): raise Exception('short_flag needs to be a single character') mutex = ap.add_mutually_exclusive_group() mutex.add_argument(f'-{short_flag.lower()}'...
3c182bcab6eb2e8d65acac425778303d973d1e0661b67faf6bfa292f5c6a0930
def populate_agrument_parser(ap) -> None: '\n Populates an argparse.ArgumentParser or an subcommand argument parser\n ' create_only_or_exclude_filter(ap, 's', 'status-codes', 'with one of the given status codes. Programs terminated by internal errors have status code -1', type=int) create_only_or_excl...
Populates an argparse.ArgumentParser or an subcommand argument parser
src/shell_command_logger/cli/search.py
populate_agrument_parser
six-two/shell-command-logger
0
python
def populate_agrument_parser(ap) -> None: '\n \n ' create_only_or_exclude_filter(ap, 's', 'status-codes', 'with one of the given status codes. Programs terminated by internal errors have status code -1', type=int) create_only_or_exclude_filter(ap, 'u', 'users', 'run by one of the given users') mut...
def populate_agrument_parser(ap) -> None: '\n \n ' create_only_or_exclude_filter(ap, 's', 'status-codes', 'with one of the given status codes. Programs terminated by internal errors have status code -1', type=int) create_only_or_exclude_filter(ap, 'u', 'users', 'run by one of the given users') mut...
f496d19784ee36ed0af81637af70724b01a07d9cabafc4569ce81cb79dccccfa
def subcommand_main(args) -> int: '\n This method expects the parsed arguments from an argument parser that was set up with `populate_agrument_parser()`.\n It returns an unix-like status code (0 -> success, everything else -> error).\n ' scl_config = sanitize_config(load_config()) search_results = ...
This method expects the parsed arguments from an argument parser that was set up with `populate_agrument_parser()`. It returns an unix-like status code (0 -> success, everything else -> error).
src/shell_command_logger/cli/search.py
subcommand_main
six-two/shell-command-logger
0
python
def subcommand_main(args) -> int: '\n This method expects the parsed arguments from an argument parser that was set up with `populate_agrument_parser()`.\n It returns an unix-like status code (0 -> success, everything else -> error).\n ' scl_config = sanitize_config(load_config()) search_results = ...
def subcommand_main(args) -> int: '\n This method expects the parsed arguments from an argument parser that was set up with `populate_agrument_parser()`.\n It returns an unix-like status code (0 -> success, everything else -> error).\n ' scl_config = sanitize_config(load_config()) search_results = ...