partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Vehicle.wait_for_alt
Wait for the vehicle to reach the specified altitude. Wait for the vehicle to get within epsilon meters of the given altitude. If rel is True (the default), use the global_relative_frame. If rel is False, use the global_frame. If timeout is nonzero, raise a TimeoutError if the specifie...
dronekit/__init__.py
def wait_for_alt(self, alt, epsilon=0.1, rel=True, timeout=None): '''Wait for the vehicle to reach the specified altitude. Wait for the vehicle to get within epsilon meters of the given altitude. If rel is True (the default), use the global_relative_frame. If rel is False, use the glob...
def wait_for_alt(self, alt, epsilon=0.1, rel=True, timeout=None): '''Wait for the vehicle to reach the specified altitude. Wait for the vehicle to get within epsilon meters of the given altitude. If rel is True (the default), use the global_relative_frame. If rel is False, use the glob...
[ "Wait", "for", "the", "vehicle", "to", "reach", "the", "specified", "altitude", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2080-L2113
[ "def", "wait_for_alt", "(", "self", ",", "alt", ",", "epsilon", "=", "0.1", ",", "rel", "=", "True", ",", "timeout", "=", "None", ")", ":", "def", "get_alt", "(", ")", ":", "if", "rel", ":", "alt", "=", "self", ".", "location", ".", "global_relativ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.simple_takeoff
Take off and fly the vehicle to the specified altitude (in metres) and then wait for another command. .. note:: This function should only be used on Copter vehicles. The vehicle must be in GUIDED mode and armed before this is called. There is no mechanism for notification when t...
dronekit/__init__.py
def simple_takeoff(self, alt=None): """ Take off and fly the vehicle to the specified altitude (in metres) and then wait for another command. .. note:: This function should only be used on Copter vehicles. The vehicle must be in GUIDED mode and armed before this is called...
def simple_takeoff(self, alt=None): """ Take off and fly the vehicle to the specified altitude (in metres) and then wait for another command. .. note:: This function should only be used on Copter vehicles. The vehicle must be in GUIDED mode and armed before this is called...
[ "Take", "off", "and", "fly", "the", "vehicle", "to", "the", "specified", "altitude", "(", "in", "metres", ")", "and", "then", "wait", "for", "another", "command", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2121-L2147
[ "def", "simple_takeoff", "(", "self", ",", "alt", "=", "None", ")", ":", "if", "alt", "is", "not", "None", ":", "altitude", "=", "float", "(", "alt", ")", "if", "math", ".", "isnan", "(", "altitude", ")", "or", "math", ".", "isinf", "(", "altitude"...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.simple_goto
Go to a specified global location (:py:class:`LocationGlobal` or :py:class:`LocationGlobalRelative`). There is no mechanism for notification when the target location is reached, and if another command arrives before that point that will be executed immediately. You can optionally set the desir...
dronekit/__init__.py
def simple_goto(self, location, airspeed=None, groundspeed=None): ''' Go to a specified global location (:py:class:`LocationGlobal` or :py:class:`LocationGlobalRelative`). There is no mechanism for notification when the target location is reached, and if another command arrives before t...
def simple_goto(self, location, airspeed=None, groundspeed=None): ''' Go to a specified global location (:py:class:`LocationGlobal` or :py:class:`LocationGlobalRelative`). There is no mechanism for notification when the target location is reached, and if another command arrives before t...
[ "Go", "to", "a", "specified", "global", "location", "(", ":", "py", ":", "class", ":", "LocationGlobal", "or", ":", "py", ":", "class", ":", "LocationGlobalRelative", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2149-L2199
[ "def", "simple_goto", "(", "self", ",", "location", ",", "airspeed", "=", "None", ",", "groundspeed", "=", "None", ")", ":", "if", "isinstance", "(", "location", ",", "LocationGlobalRelative", ")", ":", "frame", "=", "mavutil", ".", "mavlink", ".", "MAV_FR...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.send_capabilties_request
An alias for send_capabilities_request. The word "capabilities" was misspelled in previous versions of this code. This is simply an alias to send_capabilities_request using the legacy name.
dronekit/__init__.py
def send_capabilties_request(self, vehicle, name, m): '''An alias for send_capabilities_request. The word "capabilities" was misspelled in previous versions of this code. This is simply an alias to send_capabilities_request using the legacy name. ''' return self.send_capabilitie...
def send_capabilties_request(self, vehicle, name, m): '''An alias for send_capabilities_request. The word "capabilities" was misspelled in previous versions of this code. This is simply an alias to send_capabilities_request using the legacy name. ''' return self.send_capabilitie...
[ "An", "alias", "for", "send_capabilities_request", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2302-L2308
[ "def", "send_capabilties_request", "(", "self", ",", "vehicle", ",", "name", ",", "m", ")", ":", "return", "self", ".", "send_capabilities_request", "(", "vehicle", ",", "name", ",", "m", ")" ]
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.send_capabilities_request
Request an AUTOPILOT_VERSION packet
dronekit/__init__.py
def send_capabilities_request(self, vehicle, name, m): '''Request an AUTOPILOT_VERSION packet''' capability_msg = vehicle.message_factory.command_long_encode(0, 0, mavutil.mavlink.MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES, 0, 1, 0, 0, 0, 0, 0, 0) vehicle.send_mavlink(capability_msg)
def send_capabilities_request(self, vehicle, name, m): '''Request an AUTOPILOT_VERSION packet''' capability_msg = vehicle.message_factory.command_long_encode(0, 0, mavutil.mavlink.MAV_CMD_REQUEST_AUTOPILOT_CAPABILITIES, 0, 1, 0, 0, 0, 0, 0, 0) vehicle.send_mavlink(capability_msg)
[ "Request", "an", "AUTOPILOT_VERSION", "packet" ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2310-L2313
[ "def", "send_capabilities_request", "(", "self", ",", "vehicle", ",", "name", ",", "m", ")", ":", "capability_msg", "=", "vehicle", ".", "message_factory", ".", "command_long_encode", "(", "0", ",", "0", ",", "mavutil", ".", "mavlink", ".", "MAV_CMD_REQUEST_AU...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.play_tune
Play a tune on the vehicle
dronekit/__init__.py
def play_tune(self, tune): '''Play a tune on the vehicle''' msg = self.message_factory.play_tune_encode(0, 0, tune) self.send_mavlink(msg)
def play_tune(self, tune): '''Play a tune on the vehicle''' msg = self.message_factory.play_tune_encode(0, 0, tune) self.send_mavlink(msg)
[ "Play", "a", "tune", "on", "the", "vehicle" ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2315-L2318
[ "def", "play_tune", "(", "self", ",", "tune", ")", ":", "msg", "=", "self", ".", "message_factory", ".", "play_tune_encode", "(", "0", ",", "0", ",", "tune", ")", "self", ".", "send_mavlink", "(", "msg", ")" ]
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.wait_ready
Waits for specified attributes to be populated from the vehicle (values are initially ``None``). This is typically called "behind the scenes" to ensure that :py:func:`connect` does not return until attributes have populated (via the ``wait_ready`` parameter). You can also use it after connecting to ...
dronekit/__init__.py
def wait_ready(self, *types, **kwargs): """ Waits for specified attributes to be populated from the vehicle (values are initially ``None``). This is typically called "behind the scenes" to ensure that :py:func:`connect` does not return until attributes have populated (via the ``wait_rea...
def wait_ready(self, *types, **kwargs): """ Waits for specified attributes to be populated from the vehicle (values are initially ``None``). This is typically called "behind the scenes" to ensure that :py:func:`connect` does not return until attributes have populated (via the ``wait_rea...
[ "Waits", "for", "specified", "attributes", "to", "be", "populated", "from", "the", "vehicle", "(", "values", "are", "initially", "None", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2320-L2384
[ "def", "wait_ready", "(", "self", ",", "*", "types", ",", "*", "*", "kwargs", ")", ":", "timeout", "=", "kwargs", ".", "get", "(", "'timeout'", ",", "30", ")", "raise_exception", "=", "kwargs", ".", "get", "(", "'raise_exception'", ",", "True", ")", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.reboot
Requests an autopilot reboot by sending a ``MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN`` command.
dronekit/__init__.py
def reboot(self): """Requests an autopilot reboot by sending a ``MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN`` command.""" reboot_msg = self.message_factory.command_long_encode( 0, 0, # target_system, target_component mavutil.mavlink.MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, # command ...
def reboot(self): """Requests an autopilot reboot by sending a ``MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN`` command.""" reboot_msg = self.message_factory.command_long_encode( 0, 0, # target_system, target_component mavutil.mavlink.MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN, # command ...
[ "Requests", "an", "autopilot", "reboot", "by", "sending", "a", "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", "command", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2386-L2399
[ "def", "reboot", "(", "self", ")", ":", "reboot_msg", "=", "self", ".", "message_factory", ".", "command_long_encode", "(", "0", ",", "0", ",", "# target_system, target_component", "mavutil", ".", "mavlink", ".", "MAV_CMD_PREFLIGHT_REBOOT_SHUTDOWN", ",", "# command"...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.send_calibrate_magnetometer
Request magnetometer calibration.
dronekit/__init__.py
def send_calibrate_magnetometer(self): """Request magnetometer calibration.""" # ArduPilot requires the MAV_CMD_DO_START_MAG_CAL command, only present in the ardupilotmega.xml definition if self._autopilot_type == mavutil.mavlink.MAV_AUTOPILOT_ARDUPILOTMEGA: calibration_command = se...
def send_calibrate_magnetometer(self): """Request magnetometer calibration.""" # ArduPilot requires the MAV_CMD_DO_START_MAG_CAL command, only present in the ardupilotmega.xml definition if self._autopilot_type == mavutil.mavlink.MAV_AUTOPILOT_ARDUPILOTMEGA: calibration_command = se...
[ "Request", "magnetometer", "calibration", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2418-L2449
[ "def", "send_calibrate_magnetometer", "(", "self", ")", ":", "# ArduPilot requires the MAV_CMD_DO_START_MAG_CAL command, only present in the ardupilotmega.xml definition", "if", "self", ".", "_autopilot_type", "==", "mavutil", ".", "mavlink", ".", "MAV_AUTOPILOT_ARDUPILOTMEGA", ":"...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.send_calibrate_accelerometer
Request accelerometer calibration. :param simple: if True, perform simple accelerometer calibration
dronekit/__init__.py
def send_calibrate_accelerometer(self, simple=False): """Request accelerometer calibration. :param simple: if True, perform simple accelerometer calibration """ calibration_command = self.message_factory.command_long_encode( self._handler.target_system, 0, # target_system,...
def send_calibrate_accelerometer(self, simple=False): """Request accelerometer calibration. :param simple: if True, perform simple accelerometer calibration """ calibration_command = self.message_factory.command_long_encode( self._handler.target_system, 0, # target_system,...
[ "Request", "accelerometer", "calibration", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2451-L2469
[ "def", "send_calibrate_accelerometer", "(", "self", ",", "simple", "=", "False", ")", ":", "calibration_command", "=", "self", ".", "message_factory", ".", "command_long_encode", "(", "self", ".", "_handler", ".", "target_system", ",", "0", ",", "# target_system, ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Vehicle.send_calibrate_barometer
Request barometer calibration.
dronekit/__init__.py
def send_calibrate_barometer(self): """Request barometer calibration.""" calibration_command = self.message_factory.command_long_encode( self._handler.target_system, 0, # target_system, target_component mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION, # command 0, #...
def send_calibrate_barometer(self): """Request barometer calibration.""" calibration_command = self.message_factory.command_long_encode( self._handler.target_system, 0, # target_system, target_component mavutil.mavlink.MAV_CMD_PREFLIGHT_CALIBRATION, # command 0, #...
[ "Request", "barometer", "calibration", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2488-L2503
[ "def", "send_calibrate_barometer", "(", "self", ")", ":", "calibration_command", "=", "self", ".", "message_factory", ".", "command_long_encode", "(", "self", ".", "_handler", ".", "target_system", ",", "0", ",", "# target_system, target_component", "mavutil", ".", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Gimbal.rotate
Rotate the gimbal to a specific vector. .. code-block:: python #Point the gimbal straight down vehicle.gimbal.rotate(-90, 0, 0) :param pitch: Gimbal pitch in degrees relative to the vehicle (see diagram for :ref:`attitude <figure_attitude>`). A value of 0 represent...
dronekit/__init__.py
def rotate(self, pitch, roll, yaw): """ Rotate the gimbal to a specific vector. .. code-block:: python #Point the gimbal straight down vehicle.gimbal.rotate(-90, 0, 0) :param pitch: Gimbal pitch in degrees relative to the vehicle (see diagram for :ref:`attitude...
def rotate(self, pitch, roll, yaw): """ Rotate the gimbal to a specific vector. .. code-block:: python #Point the gimbal straight down vehicle.gimbal.rotate(-90, 0, 0) :param pitch: Gimbal pitch in degrees relative to the vehicle (see diagram for :ref:`attitude...
[ "Rotate", "the", "gimbal", "to", "a", "specific", "vector", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2587-L2617
[ "def", "rotate", "(", "self", ",", "pitch", ",", "roll", ",", "yaw", ")", ":", "msg", "=", "self", ".", "_vehicle", ".", "message_factory", ".", "mount_configure_encode", "(", "0", ",", "1", ",", "# target system, target component", "mavutil", ".", "mavlink"...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Gimbal.target_location
Point the gimbal at a specific region of interest (ROI). .. code-block:: python #Set the camera to track the current home location. vehicle.gimbal.target_location(vehicle.home_location) The target position must be defined in a :py:class:`LocationGlobalRelative` or :py:class:`L...
dronekit/__init__.py
def target_location(self, roi): """ Point the gimbal at a specific region of interest (ROI). .. code-block:: python #Set the camera to track the current home location. vehicle.gimbal.target_location(vehicle.home_location) The target position must be defined in ...
def target_location(self, roi): """ Point the gimbal at a specific region of interest (ROI). .. code-block:: python #Set the camera to track the current home location. vehicle.gimbal.target_location(vehicle.home_location) The target position must be defined in ...
[ "Point", "the", "gimbal", "at", "a", "specific", "region", "of", "interest", "(", "ROI", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2619-L2667
[ "def", "target_location", "(", "self", ",", "roi", ")", ":", "# set gimbal to targeting mode", "msg", "=", "self", ".", "_vehicle", ".", "message_factory", ".", "mount_configure_encode", "(", "0", ",", "1", ",", "# target system, target component", "mavutil", ".", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Gimbal.release
Release control of the gimbal to the user (RC Control). This should be called once you've finished controlling the mount with either :py:func:`rotate` or :py:func:`target_location`. Control will automatically be released if you change vehicle mode.
dronekit/__init__.py
def release(self): """ Release control of the gimbal to the user (RC Control). This should be called once you've finished controlling the mount with either :py:func:`rotate` or :py:func:`target_location`. Control will automatically be released if you change vehicle mode. """ ...
def release(self): """ Release control of the gimbal to the user (RC Control). This should be called once you've finished controlling the mount with either :py:func:`rotate` or :py:func:`target_location`. Control will automatically be released if you change vehicle mode. """ ...
[ "Release", "control", "of", "the", "gimbal", "to", "the", "user", "(", "RC", "Control", ")", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2669-L2683
[ "def", "release", "(", "self", ")", ":", "msg", "=", "self", ".", "_vehicle", ".", "message_factory", ".", "mount_configure_encode", "(", "0", ",", "1", ",", "# target system, target component", "mavutil", ".", "mavlink", ".", "MAV_MOUNT_MODE_RC_TARGETING", ",", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Parameters.add_attribute_listener
Add a listener callback on a particular parameter. The callback can be removed using :py:func:`remove_attribute_listener`. .. note:: The :py:func:`on_attribute` decorator performs the same operation as this method, but with a more elegant syntax. Use ``add_attribute_listener``...
dronekit/__init__.py
def add_attribute_listener(self, attr_name, *args, **kwargs): """ Add a listener callback on a particular parameter. The callback can be removed using :py:func:`remove_attribute_listener`. .. note:: The :py:func:`on_attribute` decorator performs the same operation as this ...
def add_attribute_listener(self, attr_name, *args, **kwargs): """ Add a listener callback on a particular parameter. The callback can be removed using :py:func:`remove_attribute_listener`. .. note:: The :py:func:`on_attribute` decorator performs the same operation as this ...
[ "Add", "a", "listener", "callback", "on", "a", "particular", "parameter", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2774-L2813
[ "def", "add_attribute_listener", "(", "self", ",", "attr_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "attr_name", "=", "attr_name", ".", "upper", "(", ")", "return", "super", "(", "Parameters", ",", "self", ")", ".", "add_attribute_listener...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Parameters.remove_attribute_listener
Remove a paremeter listener that was previously added using :py:func:`add_attribute_listener`. For example to remove the ``thr_min_callback()`` callback function: .. code:: python vehicle.parameters.remove_attribute_listener('thr_min', thr_min_callback) See :ref:`vehicle_state_ob...
dronekit/__init__.py
def remove_attribute_listener(self, attr_name, *args, **kwargs): """ Remove a paremeter listener that was previously added using :py:func:`add_attribute_listener`. For example to remove the ``thr_min_callback()`` callback function: .. code:: python vehicle.parameters.remov...
def remove_attribute_listener(self, attr_name, *args, **kwargs): """ Remove a paremeter listener that was previously added using :py:func:`add_attribute_listener`. For example to remove the ``thr_min_callback()`` callback function: .. code:: python vehicle.parameters.remov...
[ "Remove", "a", "paremeter", "listener", "that", "was", "previously", "added", "using", ":", "py", ":", "func", ":", "add_attribute_listener", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2815-L2832
[ "def", "remove_attribute_listener", "(", "self", ",", "attr_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "attr_name", "=", "attr_name", ".", "upper", "(", ")", "return", "super", "(", "Parameters", ",", "self", ")", ".", "remove_attribute_li...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
Parameters.on_attribute
Decorator for parameter listeners. .. note:: There is no way to remove a listener added with this decorator. Use :py:func:`add_attribute_listener` if you need to be able to remove the :py:func:`listener <remove_attribute_listener>`. The callback function is invoked...
dronekit/__init__.py
def on_attribute(self, attr_name, *args, **kwargs): """ Decorator for parameter listeners. .. note:: There is no way to remove a listener added with this decorator. Use :py:func:`add_attribute_listener` if you need to be able to remove the :py:func:`listener...
def on_attribute(self, attr_name, *args, **kwargs): """ Decorator for parameter listeners. .. note:: There is no way to remove a listener added with this decorator. Use :py:func:`add_attribute_listener` if you need to be able to remove the :py:func:`listener...
[ "Decorator", "for", "parameter", "listeners", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2838-L2872
[ "def", "on_attribute", "(", "self", ",", "attr_name", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "attr_name", "=", "attr_name", ".", "upper", "(", ")", "return", "super", "(", "Parameters", ",", "self", ")", ".", "on_attribute", "(", "attr_na...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
CommandSequence.download
Download all waypoints from the vehicle. The download is asynchronous. Use :py:func:`wait_ready()` to block your thread until the download is complete.
dronekit/__init__.py
def download(self): ''' Download all waypoints from the vehicle. The download is asynchronous. Use :py:func:`wait_ready()` to block your thread until the download is complete. ''' self.wait_ready() self._vehicle._ready_attrs.remove('commands') self._vehicle._wp_lo...
def download(self): ''' Download all waypoints from the vehicle. The download is asynchronous. Use :py:func:`wait_ready()` to block your thread until the download is complete. ''' self.wait_ready() self._vehicle._ready_attrs.remove('commands') self._vehicle._wp_lo...
[ "Download", "all", "waypoints", "from", "the", "vehicle", ".", "The", "download", "is", "asynchronous", ".", "Use", ":", "py", ":", "func", ":", "wait_ready", "()", "to", "block", "your", "thread", "until", "the", "download", "is", "complete", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2959-L2967
[ "def", "download", "(", "self", ")", ":", "self", ".", "wait_ready", "(", ")", "self", ".", "_vehicle", ".", "_ready_attrs", ".", "remove", "(", "'commands'", ")", "self", ".", "_vehicle", ".", "_wp_loaded", "=", "False", "self", ".", "_vehicle", ".", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
CommandSequence.clear
Clear the command list. This command will be sent to the vehicle only after you call :py:func:`upload() <Vehicle.commands.upload>`.
dronekit/__init__.py
def clear(self): ''' Clear the command list. This command will be sent to the vehicle only after you call :py:func:`upload() <Vehicle.commands.upload>`. ''' # Add home point again. self.wait_ready() home = None try: home = self._vehicle._wplo...
def clear(self): ''' Clear the command list. This command will be sent to the vehicle only after you call :py:func:`upload() <Vehicle.commands.upload>`. ''' # Add home point again. self.wait_ready() home = None try: home = self._vehicle._wplo...
[ "Clear", "the", "command", "list", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2978-L2995
[ "def", "clear", "(", "self", ")", ":", "# Add home point again.", "self", ".", "wait_ready", "(", ")", "home", "=", "None", "try", ":", "home", "=", "self", ".", "_vehicle", ".", "_wploader", ".", "wp", "(", "0", ")", "except", ":", "pass", "self", "...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
CommandSequence.add
Add a new command (waypoint) at the end of the command list. .. note:: Commands are sent to the vehicle only after you call ::py:func:`upload() <Vehicle.commands.upload>`. :param Command cmd: The command to be added.
dronekit/__init__.py
def add(self, cmd): ''' Add a new command (waypoint) at the end of the command list. .. note:: Commands are sent to the vehicle only after you call ::py:func:`upload() <Vehicle.commands.upload>`. :param Command cmd: The command to be added. ''' self.wait_re...
def add(self, cmd): ''' Add a new command (waypoint) at the end of the command list. .. note:: Commands are sent to the vehicle only after you call ::py:func:`upload() <Vehicle.commands.upload>`. :param Command cmd: The command to be added. ''' self.wait_re...
[ "Add", "a", "new", "command", "(", "waypoint", ")", "at", "the", "end", "of", "the", "command", "list", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L2997-L3010
[ "def", "add", "(", "self", ",", "cmd", ")", ":", "self", ".", "wait_ready", "(", ")", "self", ".", "_vehicle", ".", "_handler", ".", "fix_targets", "(", "cmd", ")", "self", ".", "_vehicle", ".", "_wploader", ".", "add", "(", "cmd", ",", "comment", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
CommandSequence.upload
Call ``upload()`` after :py:func:`adding <CommandSequence.add>` or :py:func:`clearing <CommandSequence.clear>` mission commands. After the return from ``upload()`` any writes are guaranteed to have completed (or thrown an exception) and future reads will see their effects. :param int timeout: ...
dronekit/__init__.py
def upload(self, timeout=None): """ Call ``upload()`` after :py:func:`adding <CommandSequence.add>` or :py:func:`clearing <CommandSequence.clear>` mission commands. After the return from ``upload()`` any writes are guaranteed to have completed (or thrown an exception) and future reads w...
def upload(self, timeout=None): """ Call ``upload()`` after :py:func:`adding <CommandSequence.add>` or :py:func:`clearing <CommandSequence.clear>` mission commands. After the return from ``upload()`` any writes are guaranteed to have completed (or thrown an exception) and future reads w...
[ "Call", "upload", "()", "after", ":", "py", ":", "func", ":", "adding", "<CommandSequence", ".", "add", ">", "or", ":", "py", ":", "func", ":", "clearing", "<CommandSequence", ".", "clear", ">", "mission", "commands", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/dronekit/__init__.py#L3012-L3032
[ "def", "upload", "(", "self", ",", "timeout", "=", "None", ")", ":", "if", "self", ".", "_vehicle", ".", "_wpts_dirty", ":", "self", ".", "_vehicle", ".", "_master", ".", "waypoint_clear_all_send", "(", ")", "start_time", "=", "time", ".", "time", "(", ...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
arm_and_takeoff_nogps
Arms vehicle and fly to aTargetAltitude without GPS data.
examples/set_attitude_target/set_attitude_target.py
def arm_and_takeoff_nogps(aTargetAltitude): """ Arms vehicle and fly to aTargetAltitude without GPS data. """ ##### CONSTANTS ##### DEFAULT_TAKEOFF_THRUST = 0.7 SMOOTH_TAKEOFF_THRUST = 0.6 print("Basic pre-arm checks") # Don't let the user try to arm until autopilot is ready # If y...
def arm_and_takeoff_nogps(aTargetAltitude): """ Arms vehicle and fly to aTargetAltitude without GPS data. """ ##### CONSTANTS ##### DEFAULT_TAKEOFF_THRUST = 0.7 SMOOTH_TAKEOFF_THRUST = 0.6 print("Basic pre-arm checks") # Don't let the user try to arm until autopilot is ready # If y...
[ "Arms", "vehicle", "and", "fly", "to", "aTargetAltitude", "without", "GPS", "data", "." ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/set_attitude_target/set_attitude_target.py#L44-L85
[ "def", "arm_and_takeoff_nogps", "(", "aTargetAltitude", ")", ":", "##### CONSTANTS #####", "DEFAULT_TAKEOFF_THRUST", "=", "0.7", "SMOOTH_TAKEOFF_THRUST", "=", "0.6", "print", "(", "\"Basic pre-arm checks\"", ")", "# Don't let the user try to arm until autopilot is ready", "# If y...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
send_attitude_target
use_yaw_rate: the yaw can be controlled using yaw_angle OR yaw_rate. When one is used, the other is ignored by Ardupilot. thrust: 0 <= thrust <= 1, as a fraction of maximum vertical thrust. Note that as of Copter 3.5, thrust = 0.5 triggers a special case in the code for mai...
examples/set_attitude_target/set_attitude_target.py
def send_attitude_target(roll_angle = 0.0, pitch_angle = 0.0, yaw_angle = None, yaw_rate = 0.0, use_yaw_rate = False, thrust = 0.5): """ use_yaw_rate: the yaw can be controlled using yaw_angle OR yaw_rate. When one is used, the other is ignored...
def send_attitude_target(roll_angle = 0.0, pitch_angle = 0.0, yaw_angle = None, yaw_rate = 0.0, use_yaw_rate = False, thrust = 0.5): """ use_yaw_rate: the yaw can be controlled using yaw_angle OR yaw_rate. When one is used, the other is ignored...
[ "use_yaw_rate", ":", "the", "yaw", "can", "be", "controlled", "using", "yaw_angle", "OR", "yaw_rate", ".", "When", "one", "is", "used", "the", "other", "is", "ignored", "by", "Ardupilot", ".", "thrust", ":", "0", "<", "=", "thrust", "<", "=", "1", "as"...
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/set_attitude_target/set_attitude_target.py#L87-L114
[ "def", "send_attitude_target", "(", "roll_angle", "=", "0.0", ",", "pitch_angle", "=", "0.0", ",", "yaw_angle", "=", "None", ",", "yaw_rate", "=", "0.0", ",", "use_yaw_rate", "=", "False", ",", "thrust", "=", "0.5", ")", ":", "if", "yaw_angle", "is", "No...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
set_attitude
Note that from AC3.3 the message should be re-sent more often than every second, as an ATTITUDE_TARGET order has a timeout of 1s. In AC3.2.1 and earlier the specified attitude persists until it is canceled. The code below should work on either version. Sending the message multiple times is the recommend...
examples/set_attitude_target/set_attitude_target.py
def set_attitude(roll_angle = 0.0, pitch_angle = 0.0, yaw_angle = None, yaw_rate = 0.0, use_yaw_rate = False, thrust = 0.5, duration = 0): """ Note that from AC3.3 the message should be re-sent more often than every second, as an ATTITUDE_TARGET order has a timeout of 1s. ...
def set_attitude(roll_angle = 0.0, pitch_angle = 0.0, yaw_angle = None, yaw_rate = 0.0, use_yaw_rate = False, thrust = 0.5, duration = 0): """ Note that from AC3.3 the message should be re-sent more often than every second, as an ATTITUDE_TARGET order has a timeout of 1s. ...
[ "Note", "that", "from", "AC3", ".", "3", "the", "message", "should", "be", "re", "-", "sent", "more", "often", "than", "every", "second", "as", "an", "ATTITUDE_TARGET", "order", "has", "a", "timeout", "of", "1s", ".", "In", "AC3", ".", "2", ".", "1",...
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/set_attitude_target/set_attitude_target.py#L116-L138
[ "def", "set_attitude", "(", "roll_angle", "=", "0.0", ",", "pitch_angle", "=", "0.0", ",", "yaw_angle", "=", "None", ",", "yaw_rate", "=", "0.0", ",", "use_yaw_rate", "=", "False", ",", "thrust", "=", "0.5", ",", "duration", "=", "0", ")", ":", "send_a...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
to_quaternion
Convert degrees to quaternions
examples/set_attitude_target/set_attitude_target.py
def to_quaternion(roll = 0.0, pitch = 0.0, yaw = 0.0): """ Convert degrees to quaternions """ t0 = math.cos(math.radians(yaw * 0.5)) t1 = math.sin(math.radians(yaw * 0.5)) t2 = math.cos(math.radians(roll * 0.5)) t3 = math.sin(math.radians(roll * 0.5)) t4 = math.cos(math.radians(pitch * 0...
def to_quaternion(roll = 0.0, pitch = 0.0, yaw = 0.0): """ Convert degrees to quaternions """ t0 = math.cos(math.radians(yaw * 0.5)) t1 = math.sin(math.radians(yaw * 0.5)) t2 = math.cos(math.radians(roll * 0.5)) t3 = math.sin(math.radians(roll * 0.5)) t4 = math.cos(math.radians(pitch * 0...
[ "Convert", "degrees", "to", "quaternions" ]
dronekit/dronekit-python
python
https://github.com/dronekit/dronekit-python/blob/91c147fa61f521f5fff5d0cee06d07ed93614af8/examples/set_attitude_target/set_attitude_target.py#L140-L156
[ "def", "to_quaternion", "(", "roll", "=", "0.0", ",", "pitch", "=", "0.0", ",", "yaw", "=", "0.0", ")", ":", "t0", "=", "math", ".", "cos", "(", "math", ".", "radians", "(", "yaw", "*", "0.5", ")", ")", "t1", "=", "math", ".", "sin", "(", "ma...
91c147fa61f521f5fff5d0cee06d07ed93614af8
train
SumBasicSummarizer._compute_tf
Computes the normalized term frequency as explained in http://www.tfidf.com/
sumy/summarizers/sum_basic.py
def _compute_tf(self, sentences): """ Computes the normalized term frequency as explained in http://www.tfidf.com/ """ content_words = self._get_all_content_words_in_doc(sentences) content_words_count = len(content_words) content_words_freq = self._compute_word_freq(conte...
def _compute_tf(self, sentences): """ Computes the normalized term frequency as explained in http://www.tfidf.com/ """ content_words = self._get_all_content_words_in_doc(sentences) content_words_count = len(content_words) content_words_freq = self._compute_word_freq(conte...
[ "Computes", "the", "normalized", "term", "frequency", "as", "explained", "in", "http", ":", "//", "www", ".", "tfidf", ".", "com", "/" ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/sum_basic.py#L59-L67
[ "def", "_compute_tf", "(", "self", ",", "sentences", ")", ":", "content_words", "=", "self", ".", "_get_all_content_words_in_doc", "(", "sentences", ")", "content_words_count", "=", "len", "(", "content_words", ")", "content_words_freq", "=", "self", ".", "_comput...
099ab4938e2c1b6a011297375586bac2953641b9
train
f_score
Computation of F-Score measure. It is computed as F(E) = ( (W^2 + 1) * P(E) * R(E) ) / ( W^2 * P(E) + R(E) ), where: - P(E) is precision metrics of extract E. - R(E) is recall metrics of extract E. - W is a weighting factor that favours P(E) metrics when W > 1 and favours R(E) metrics when W < 1....
sumy/evaluation/coselection.py
def f_score(evaluated_sentences, reference_sentences, weight=1.0): """ Computation of F-Score measure. It is computed as F(E) = ( (W^2 + 1) * P(E) * R(E) ) / ( W^2 * P(E) + R(E) ), where: - P(E) is precision metrics of extract E. - R(E) is recall metrics of extract E. - W is a weighting factor ...
def f_score(evaluated_sentences, reference_sentences, weight=1.0): """ Computation of F-Score measure. It is computed as F(E) = ( (W^2 + 1) * P(E) * R(E) ) / ( W^2 * P(E) + R(E) ), where: - P(E) is precision metrics of extract E. - R(E) is recall metrics of extract E. - W is a weighting factor ...
[ "Computation", "of", "F", "-", "Score", "measure", ".", "It", "is", "computed", "as", "F", "(", "E", ")", "=", "(", "(", "W^2", "+", "1", ")", "*", "P", "(", "E", ")", "*", "R", "(", "E", ")", ")", "/", "(", "W^2", "*", "P", "(", "E", "...
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/evaluation/coselection.py#L7-L35
[ "def", "f_score", "(", "evaluated_sentences", ",", "reference_sentences", ",", "weight", "=", "1.0", ")", ":", "p", "=", "precision", "(", "evaluated_sentences", ",", "reference_sentences", ")", "r", "=", "recall", "(", "evaluated_sentences", ",", "reference_sente...
099ab4938e2c1b6a011297375586bac2953641b9
train
_len_lcs
Returns the length of the Longest Common Subsequence between sequences x and y. Source: http://www.algorithmist.com/index.php/Longest_Common_Subsequence :param x: sequence of words :param y: sequence of words :returns integer: Length of LCS between x and y
sumy/evaluation/rouge.py
def _len_lcs(x, y): """ Returns the length of the Longest Common Subsequence between sequences x and y. Source: http://www.algorithmist.com/index.php/Longest_Common_Subsequence :param x: sequence of words :param y: sequence of words :returns integer: Length of LCS between x and y """ ...
def _len_lcs(x, y): """ Returns the length of the Longest Common Subsequence between sequences x and y. Source: http://www.algorithmist.com/index.php/Longest_Common_Subsequence :param x: sequence of words :param y: sequence of words :returns integer: Length of LCS between x and y """ ...
[ "Returns", "the", "length", "of", "the", "Longest", "Common", "Subsequence", "between", "sequences", "x", "and", "y", ".", "Source", ":", "http", ":", "//", "www", ".", "algorithmist", ".", "com", "/", "index", ".", "php", "/", "Longest_Common_Subsequence" ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/evaluation/rouge.py#L42-L54
[ "def", "_len_lcs", "(", "x", ",", "y", ")", ":", "table", "=", "_lcs", "(", "x", ",", "y", ")", "n", ",", "m", "=", "_get_index_of_lcs", "(", "x", ",", "y", ")", "return", "table", "[", "n", ",", "m", "]" ]
099ab4938e2c1b6a011297375586bac2953641b9
train
_recon_lcs
Returns the Longest Subsequence between x and y. Source: http://www.algorithmist.com/index.php/Longest_Common_Subsequence :param x: sequence of words :param y: sequence of words :returns sequence: LCS of x and y
sumy/evaluation/rouge.py
def _recon_lcs(x, y): """ Returns the Longest Subsequence between x and y. Source: http://www.algorithmist.com/index.php/Longest_Common_Subsequence :param x: sequence of words :param y: sequence of words :returns sequence: LCS of x and y """ table = _lcs(x, y) def _recon(i, j): ...
def _recon_lcs(x, y): """ Returns the Longest Subsequence between x and y. Source: http://www.algorithmist.com/index.php/Longest_Common_Subsequence :param x: sequence of words :param y: sequence of words :returns sequence: LCS of x and y """ table = _lcs(x, y) def _recon(i, j): ...
[ "Returns", "the", "Longest", "Subsequence", "between", "x", "and", "y", ".", "Source", ":", "http", ":", "//", "www", ".", "algorithmist", ".", "com", "/", "index", ".", "php", "/", "Longest_Common_Subsequence" ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/evaluation/rouge.py#L81-L104
[ "def", "_recon_lcs", "(", "x", ",", "y", ")", ":", "table", "=", "_lcs", "(", "x", ",", "y", ")", "def", "_recon", "(", "i", ",", "j", ")", ":", "if", "i", "==", "0", "or", "j", "==", "0", ":", "return", "[", "]", "elif", "x", "[", "i", ...
099ab4938e2c1b6a011297375586bac2953641b9
train
_f_lcs
Computes the LCS-based F-measure score Source: http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf :param llcs: Length of LCS :param m: number of words in reference summary :param n: number of words in candidate summary :returns float: LCS-based F-me...
sumy/evaluation/rouge.py
def _f_lcs(llcs, m, n): """ Computes the LCS-based F-measure score Source: http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf :param llcs: Length of LCS :param m: number of words in reference summary :param n: number of words in candidate summar...
def _f_lcs(llcs, m, n): """ Computes the LCS-based F-measure score Source: http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf :param llcs: Length of LCS :param m: number of words in reference summary :param n: number of words in candidate summar...
[ "Computes", "the", "LCS", "-", "based", "F", "-", "measure", "score", "Source", ":", "http", ":", "//", "research", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "um", "/", "people", "/", "cyl", "/", "download", "/", "papers", "/", "roug...
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/evaluation/rouge.py#L167-L183
[ "def", "_f_lcs", "(", "llcs", ",", "m", ",", "n", ")", ":", "r_lcs", "=", "llcs", "/", "m", "p_lcs", "=", "llcs", "/", "n", "beta", "=", "p_lcs", "/", "r_lcs", "num", "=", "(", "1", "+", "(", "beta", "**", "2", ")", ")", "*", "r_lcs", "*", ...
099ab4938e2c1b6a011297375586bac2953641b9
train
rouge_l_sentence_level
Computes ROUGE-L (sentence level) of two text collections of sentences. http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf Calculated according to: R_lcs = LCS(X,Y)/m P_lcs = LCS(X,Y)/n F_lcs = ((1 + beta^2)*R_lcs*P_lcs) / (R_lcs + (beta^2) * P_lcs)...
sumy/evaluation/rouge.py
def rouge_l_sentence_level(evaluated_sentences, reference_sentences): """ Computes ROUGE-L (sentence level) of two text collections of sentences. http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf Calculated according to: R_lcs = LCS(X,Y)/m P_lc...
def rouge_l_sentence_level(evaluated_sentences, reference_sentences): """ Computes ROUGE-L (sentence level) of two text collections of sentences. http://research.microsoft.com/en-us/um/people/cyl/download/papers/ rouge-working-note-v1.3.1.pdf Calculated according to: R_lcs = LCS(X,Y)/m P_lc...
[ "Computes", "ROUGE", "-", "L", "(", "sentence", "level", ")", "of", "two", "text", "collections", "of", "sentences", ".", "http", ":", "//", "research", ".", "microsoft", ".", "com", "/", "en", "-", "us", "/", "um", "/", "people", "/", "cyl", "/", ...
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/evaluation/rouge.py#L186-L217
[ "def", "rouge_l_sentence_level", "(", "evaluated_sentences", ",", "reference_sentences", ")", ":", "if", "len", "(", "evaluated_sentences", ")", "<=", "0", "or", "len", "(", "reference_sentences", ")", "<=", "0", ":", "raise", "(", "ValueError", "(", "\"Collecti...
099ab4938e2c1b6a011297375586bac2953641b9
train
_union_lcs
Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For example, if r_i= w1 w2 w3 w4 w5, and C contains two sentences: c1 = w1 w2 w6 w7 w8 and c2 = w1 w3 w8 w9 w5, then the longest common subsequence of r_i and c1 is ...
sumy/evaluation/rouge.py
def _union_lcs(evaluated_sentences, reference_sentence): """ Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For example, if r_i= w1 w2 w3 w4 w5, and C contains two sentences: c1 = w1 w2 w6 w7 w8 and c2 = w1 ...
def _union_lcs(evaluated_sentences, reference_sentence): """ Returns LCS_u(r_i, C) which is the LCS score of the union longest common subsequence between reference sentence ri and candidate summary C. For example, if r_i= w1 w2 w3 w4 w5, and C contains two sentences: c1 = w1 w2 w6 w7 w8 and c2 = w1 ...
[ "Returns", "LCS_u", "(", "r_i", "C", ")", "which", "is", "the", "LCS", "score", "of", "the", "union", "longest", "common", "subsequence", "between", "reference", "sentence", "ri", "and", "candidate", "summary", "C", ".", "For", "example", "if", "r_i", "=",...
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/evaluation/rouge.py#L220-L251
[ "def", "_union_lcs", "(", "evaluated_sentences", ",", "reference_sentence", ")", ":", "if", "len", "(", "evaluated_sentences", ")", "<=", "0", ":", "raise", "(", "ValueError", "(", "\"Collections must contain at least 1 sentence.\"", ")", ")", "lcs_union", "=", "set...
099ab4938e2c1b6a011297375586bac2953641b9
train
TfDocumentModel.magnitude
Lenght/norm/magnitude of vector representation of document. This is usually denoted by ||d||.
sumy/models/tf.py
def magnitude(self): """ Lenght/norm/magnitude of vector representation of document. This is usually denoted by ||d||. """ return math.sqrt(sum(t**2 for t in self._terms.values()))
def magnitude(self): """ Lenght/norm/magnitude of vector representation of document. This is usually denoted by ||d||. """ return math.sqrt(sum(t**2 for t in self._terms.values()))
[ "Lenght", "/", "norm", "/", "magnitude", "of", "vector", "representation", "of", "document", ".", "This", "is", "usually", "denoted", "by", "||d||", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/models/tf.py#L29-L34
[ "def", "magnitude", "(", "self", ")", ":", "return", "math", ".", "sqrt", "(", "sum", "(", "t", "**", "2", "for", "t", "in", "self", ".", "_terms", ".", "values", "(", ")", ")", ")" ]
099ab4938e2c1b6a011297375586bac2953641b9
train
TfDocumentModel.most_frequent_terms
Returns ``count`` of terms sorted by their frequency in descending order. :parameter int count: Max. number of returned terms. Value 0 means no limit (default).
sumy/models/tf.py
def most_frequent_terms(self, count=0): """ Returns ``count`` of terms sorted by their frequency in descending order. :parameter int count: Max. number of returned terms. Value 0 means no limit (default). """ # sort terms by number of occurrences in descendin...
def most_frequent_terms(self, count=0): """ Returns ``count`` of terms sorted by their frequency in descending order. :parameter int count: Max. number of returned terms. Value 0 means no limit (default). """ # sort terms by number of occurrences in descendin...
[ "Returns", "count", "of", "terms", "sorted", "by", "their", "frequency", "in", "descending", "order", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/models/tf.py#L40-L58
[ "def", "most_frequent_terms", "(", "self", ",", "count", "=", "0", ")", ":", "# sort terms by number of occurrences in descending order", "terms", "=", "sorted", "(", "self", ".", "_terms", ".", "items", "(", ")", ",", "key", "=", "lambda", "i", ":", "-", "i...
099ab4938e2c1b6a011297375586bac2953641b9
train
TfDocumentModel.normalized_term_frequency
Returns normalized frequency of term in document. http://nlp.stanford.edu/IR-book/html/htmledition/maximum-tf-normalization-1.html :parameter float smooth: 0.0 <= smooth <= 1.0, generally set to 0.4, although some early work used the value 0.5. The term is a smoothing term ...
sumy/models/tf.py
def normalized_term_frequency(self, term, smooth=0.0): """ Returns normalized frequency of term in document. http://nlp.stanford.edu/IR-book/html/htmledition/maximum-tf-normalization-1.html :parameter float smooth: 0.0 <= smooth <= 1.0, generally set to 0.4, although some ...
def normalized_term_frequency(self, term, smooth=0.0): """ Returns normalized frequency of term in document. http://nlp.stanford.edu/IR-book/html/htmledition/maximum-tf-normalization-1.html :parameter float smooth: 0.0 <= smooth <= 1.0, generally set to 0.4, although some ...
[ "Returns", "normalized", "frequency", "of", "term", "in", "document", ".", "http", ":", "//", "nlp", ".", "stanford", ".", "edu", "/", "IR", "-", "book", "/", "html", "/", "htmledition", "/", "maximum", "-", "tf", "-", "normalization", "-", "1", ".", ...
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/models/tf.py#L69-L85
[ "def", "normalized_term_frequency", "(", "self", ",", "term", ",", "smooth", "=", "0.0", ")", ":", "frequency", "=", "self", ".", "term_frequency", "(", "term", ")", "/", "self", ".", "_max_frequency", "return", "smooth", "+", "(", "1.0", "-", "smooth", ...
099ab4938e2c1b6a011297375586bac2953641b9
train
EdmundsonCueMethod._count_words
Counts number of bonus/stigma words. :param iterable words: Collection of words. :returns pair: Tuple with number of words (bonus words, stigma words).
sumy/summarizers/edmundson_cue.py
def _count_words(self, words): """ Counts number of bonus/stigma words. :param iterable words: Collection of words. :returns pair: Tuple with number of words (bonus words, stigma words). """ bonus_words_count = 0 stigma_words_count = 0 ...
def _count_words(self, words): """ Counts number of bonus/stigma words. :param iterable words: Collection of words. :returns pair: Tuple with number of words (bonus words, stigma words). """ bonus_words_count = 0 stigma_words_count = 0 ...
[ "Counts", "number", "of", "bonus", "/", "stigma", "words", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/edmundson_cue.py#L32-L50
[ "def", "_count_words", "(", "self", ",", "words", ")", ":", "bonus_words_count", "=", "0", "stigma_words_count", "=", "0", "for", "word", "in", "words", ":", "if", "word", "in", "self", ".", "_bonus_words", ":", "bonus_words_count", "+=", "1", "if", "word"...
099ab4938e2c1b6a011297375586bac2953641b9
train
cached_property
Decorator that converts a method into memoized property. The decorator works as expected only for classes with attribute '__dict__' and immutable properties.
sumy/utils.py
def cached_property(getter): """ Decorator that converts a method into memoized property. The decorator works as expected only for classes with attribute '__dict__' and immutable properties. """ @wraps(getter) def decorator(self): key = "_cached_property_" + getter.__name__ ...
def cached_property(getter): """ Decorator that converts a method into memoized property. The decorator works as expected only for classes with attribute '__dict__' and immutable properties. """ @wraps(getter) def decorator(self): key = "_cached_property_" + getter.__name__ ...
[ "Decorator", "that", "converts", "a", "method", "into", "memoized", "property", ".", "The", "decorator", "works", "as", "expected", "only", "for", "classes", "with", "attribute", "__dict__", "and", "immutable", "properties", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/utils.py#L42-L57
[ "def", "cached_property", "(", "getter", ")", ":", "@", "wraps", "(", "getter", ")", "def", "decorator", "(", "self", ")", ":", "key", "=", "\"_cached_property_\"", "+", "getter", ".", "__name__", "if", "not", "hasattr", "(", "self", ",", "key", ")", "...
099ab4938e2c1b6a011297375586bac2953641b9
train
cosine_similarity
Computes cosine similarity of two text documents. Each document has to be represented as TF model of non-empty document. :returns float: 0 <= cos <= 1, where 0 means independence and 1 means exactly the same.
sumy/evaluation/content_based.py
def cosine_similarity(evaluated_model, reference_model): """ Computes cosine similarity of two text documents. Each document has to be represented as TF model of non-empty document. :returns float: 0 <= cos <= 1, where 0 means independence and 1 means exactly the same. """ if no...
def cosine_similarity(evaluated_model, reference_model): """ Computes cosine similarity of two text documents. Each document has to be represented as TF model of non-empty document. :returns float: 0 <= cos <= 1, where 0 means independence and 1 means exactly the same. """ if no...
[ "Computes", "cosine", "similarity", "of", "two", "text", "documents", ".", "Each", "document", "has", "to", "be", "represented", "as", "TF", "model", "of", "non", "-", "empty", "document", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/evaluation/content_based.py#L9-L33
[ "def", "cosine_similarity", "(", "evaluated_model", ",", "reference_model", ")", ":", "if", "not", "(", "isinstance", "(", "evaluated_model", ",", "TfModel", ")", "and", "isinstance", "(", "reference_model", ",", "TfModel", ")", ")", ":", "raise", "ValueError", ...
099ab4938e2c1b6a011297375586bac2953641b9
train
unit_overlap
Computes unit overlap of two text documents. Documents has to be represented as TF models of non-empty document. :returns float: 0 <= overlap <= 1, where 0 means no match and 1 means exactly the same.
sumy/evaluation/content_based.py
def unit_overlap(evaluated_model, reference_model): """ Computes unit overlap of two text documents. Documents has to be represented as TF models of non-empty document. :returns float: 0 <= overlap <= 1, where 0 means no match and 1 means exactly the same. """ if not (isinstance...
def unit_overlap(evaluated_model, reference_model): """ Computes unit overlap of two text documents. Documents has to be represented as TF models of non-empty document. :returns float: 0 <= overlap <= 1, where 0 means no match and 1 means exactly the same. """ if not (isinstance...
[ "Computes", "unit", "overlap", "of", "two", "text", "documents", ".", "Documents", "has", "to", "be", "represented", "as", "TF", "models", "of", "non", "-", "empty", "document", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/evaluation/content_based.py#L36-L57
[ "def", "unit_overlap", "(", "evaluated_model", ",", "reference_model", ")", ":", "if", "not", "(", "isinstance", "(", "evaluated_model", ",", "TfModel", ")", "and", "isinstance", "(", "reference_model", ",", "TfModel", ")", ")", ":", "raise", "ValueError", "("...
099ab4938e2c1b6a011297375586bac2953641b9
train
LsaSummarizer._create_dictionary
Creates mapping key = word, value = row index
sumy/summarizers/lsa.py
def _create_dictionary(self, document): """Creates mapping key = word, value = row index""" words = map(self.normalize_word, document.words) unique_words = frozenset(self.stem_word(w) for w in words if w not in self._stop_words) return dict((w, i) for i, w in enumerate(unique_words))
def _create_dictionary(self, document): """Creates mapping key = word, value = row index""" words = map(self.normalize_word, document.words) unique_words = frozenset(self.stem_word(w) for w in words if w not in self._stop_words) return dict((w, i) for i, w in enumerate(unique_words))
[ "Creates", "mapping", "key", "=", "word", "value", "=", "row", "index" ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/lsa.py#L55-L60
[ "def", "_create_dictionary", "(", "self", ",", "document", ")", ":", "words", "=", "map", "(", "self", ".", "normalize_word", ",", "document", ".", "words", ")", "unique_words", "=", "frozenset", "(", "self", ".", "stem_word", "(", "w", ")", "for", "w", ...
099ab4938e2c1b6a011297375586bac2953641b9
train
LsaSummarizer._create_matrix
Creates matrix of shape |unique words|×|sentences| where cells contains number of occurences of words (rows) in senteces (cols).
sumy/summarizers/lsa.py
def _create_matrix(self, document, dictionary): """ Creates matrix of shape |unique words|×|sentences| where cells contains number of occurences of words (rows) in senteces (cols). """ sentences = document.sentences words_count = len(dictionary) sentences_count =...
def _create_matrix(self, document, dictionary): """ Creates matrix of shape |unique words|×|sentences| where cells contains number of occurences of words (rows) in senteces (cols). """ sentences = document.sentences words_count = len(dictionary) sentences_count =...
[ "Creates", "matrix", "of", "shape", "|unique", "words|×|sentences|", "where", "cells", "contains", "number", "of", "occurences", "of", "words", "(", "rows", ")", "in", "senteces", "(", "cols", ")", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/lsa.py#L62-L87
[ "def", "_create_matrix", "(", "self", ",", "document", ",", "dictionary", ")", ":", "sentences", "=", "document", ".", "sentences", "words_count", "=", "len", "(", "dictionary", ")", "sentences_count", "=", "len", "(", "sentences", ")", "if", "words_count", ...
099ab4938e2c1b6a011297375586bac2953641b9
train
LsaSummarizer._compute_term_frequency
Computes TF metrics for each sentence (column) in the given matrix. You can read more about smoothing parameter at URL below: http://nlp.stanford.edu/IR-book/html/htmledition/maximum-tf-normalization-1.html
sumy/summarizers/lsa.py
def _compute_term_frequency(self, matrix, smooth=0.4): """ Computes TF metrics for each sentence (column) in the given matrix. You can read more about smoothing parameter at URL below: http://nlp.stanford.edu/IR-book/html/htmledition/maximum-tf-normalization-1.html """ as...
def _compute_term_frequency(self, matrix, smooth=0.4): """ Computes TF metrics for each sentence (column) in the given matrix. You can read more about smoothing parameter at URL below: http://nlp.stanford.edu/IR-book/html/htmledition/maximum-tf-normalization-1.html """ as...
[ "Computes", "TF", "metrics", "for", "each", "sentence", "(", "column", ")", "in", "the", "given", "matrix", ".", "You", "can", "read", "more", "about", "smoothing", "parameter", "at", "URL", "below", ":", "http", ":", "//", "nlp", ".", "stanford", ".", ...
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/lsa.py#L89-L106
[ "def", "_compute_term_frequency", "(", "self", ",", "matrix", ",", "smooth", "=", "0.4", ")", ":", "assert", "0.0", "<=", "smooth", "<", "1.0", "max_word_frequencies", "=", "numpy", ".", "max", "(", "matrix", ",", "axis", "=", "0", ")", "rows", ",", "c...
099ab4938e2c1b6a011297375586bac2953641b9
train
TextRankSummarizer._create_matrix
Create a stochastic matrix for TextRank. Element at row i and column j of the matrix corresponds to the similarity of sentence i and j, where the similarity is computed as the number of common words between them, divided by their sum of logarithm of their lengths. After such matrix is created, ...
sumy/summarizers/text_rank.py
def _create_matrix(self, document): """Create a stochastic matrix for TextRank. Element at row i and column j of the matrix corresponds to the similarity of sentence i and j, where the similarity is computed as the number of common words between them, divided by their sum of logarithm o...
def _create_matrix(self, document): """Create a stochastic matrix for TextRank. Element at row i and column j of the matrix corresponds to the similarity of sentence i and j, where the similarity is computed as the number of common words between them, divided by their sum of logarithm o...
[ "Create", "a", "stochastic", "matrix", "for", "TextRank", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/text_rank.py#L51-L76
[ "def", "_create_matrix", "(", "self", ",", "document", ")", ":", "sentences_as_words", "=", "[", "self", ".", "_to_words_set", "(", "sent", ")", "for", "sent", "in", "document", ".", "sentences", "]", "sentences_count", "=", "len", "(", "sentences_as_words", ...
099ab4938e2c1b6a011297375586bac2953641b9
train
KLSummarizer.compute_tf
Computes the normalized term frequency as explained in http://www.tfidf.com/ :type sentences: [sumy.models.dom.Sentence]
sumy/summarizers/kl.py
def compute_tf(self, sentences): """ Computes the normalized term frequency as explained in http://www.tfidf.com/ :type sentences: [sumy.models.dom.Sentence] """ content_words = self._get_all_content_words_in_doc(sentences) content_words_count = len(content_words) ...
def compute_tf(self, sentences): """ Computes the normalized term frequency as explained in http://www.tfidf.com/ :type sentences: [sumy.models.dom.Sentence] """ content_words = self._get_all_content_words_in_doc(sentences) content_words_count = len(content_words) ...
[ "Computes", "the", "normalized", "term", "frequency", "as", "explained", "in", "http", ":", "//", "www", ".", "tfidf", ".", "com", "/" ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/kl.py#L56-L66
[ "def", "compute_tf", "(", "self", ",", "sentences", ")", ":", "content_words", "=", "self", ".", "_get_all_content_words_in_doc", "(", "sentences", ")", "content_words_count", "=", "len", "(", "content_words", ")", "content_words_freq", "=", "self", ".", "_compute...
099ab4938e2c1b6a011297375586bac2953641b9
train
KLSummarizer._kl_divergence
Note: Could import scipy.stats and use scipy.stats.entropy(doc_freq, summary_freq) but this gives equivalent value without the import
sumy/summarizers/kl.py
def _kl_divergence(self, summary_freq, doc_freq): """ Note: Could import scipy.stats and use scipy.stats.entropy(doc_freq, summary_freq) but this gives equivalent value without the import """ sum_val = 0 for w in summary_freq: frequency = doc_freq.get(w) ...
def _kl_divergence(self, summary_freq, doc_freq): """ Note: Could import scipy.stats and use scipy.stats.entropy(doc_freq, summary_freq) but this gives equivalent value without the import """ sum_val = 0 for w in summary_freq: frequency = doc_freq.get(w) ...
[ "Note", ":", "Could", "import", "scipy", ".", "stats", "and", "use", "scipy", ".", "stats", ".", "entropy", "(", "doc_freq", "summary_freq", ")", "but", "this", "gives", "equivalent", "value", "without", "the", "import" ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/kl.py#L92-L103
[ "def", "_kl_divergence", "(", "self", ",", "summary_freq", ",", "doc_freq", ")", ":", "sum_val", "=", "0", "for", "w", "in", "summary_freq", ":", "frequency", "=", "doc_freq", ".", "get", "(", "w", ")", "if", "frequency", ":", "# missing or zero = no frequen...
099ab4938e2c1b6a011297375586bac2953641b9
train
LuhnSummarizer.__remove_trailing_zeros
Removes trailing zeroes from indexable collection of numbers
sumy/summarizers/luhn.py
def __remove_trailing_zeros(self, collection): """Removes trailing zeroes from indexable collection of numbers""" index = len(collection) - 1 while index >= 0 and collection[index] == 0: index -= 1 return collection[:index + 1]
def __remove_trailing_zeros(self, collection): """Removes trailing zeroes from indexable collection of numbers""" index = len(collection) - 1 while index >= 0 and collection[index] == 0: index -= 1 return collection[:index + 1]
[ "Removes", "trailing", "zeroes", "from", "indexable", "collection", "of", "numbers" ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/luhn.py#L79-L85
[ "def", "__remove_trailing_zeros", "(", "self", ",", "collection", ")", ":", "index", "=", "len", "(", "collection", ")", "-", "1", "while", "index", ">=", "0", "and", "collection", "[", "index", "]", "==", "0", ":", "index", "-=", "1", "return", "colle...
099ab4938e2c1b6a011297375586bac2953641b9
train
LexRankSummarizer._create_matrix
Creates matrix of shape |sentences|×|sentences|.
sumy/summarizers/lex_rank.py
def _create_matrix(self, sentences, threshold, tf_metrics, idf_metrics): """ Creates matrix of shape |sentences|×|sentences|. """ # create matrix |sentences|×|sentences| filled with zeroes sentences_count = len(sentences) matrix = numpy.zeros((sentences_count, sentences_c...
def _create_matrix(self, sentences, threshold, tf_metrics, idf_metrics): """ Creates matrix of shape |sentences|×|sentences|. """ # create matrix |sentences|×|sentences| filled with zeroes sentences_count = len(sentences) matrix = numpy.zeros((sentences_count, sentences_c...
[ "Creates", "matrix", "of", "shape", "|sentences|×|sentences|", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/lex_rank.py#L91-L117
[ "def", "_create_matrix", "(", "self", ",", "sentences", ",", "threshold", ",", "tf_metrics", ",", "idf_metrics", ")", ":", "# create matrix |sentences|×|sentences| filled with zeroes", "sentences_count", "=", "len", "(", "sentences", ")", "matrix", "=", "numpy", ".", ...
099ab4938e2c1b6a011297375586bac2953641b9
train
LexRankSummarizer.cosine_similarity
We compute idf-modified-cosine(sentence1, sentence2) here. It's cosine similarity of these two sentences (vectors) A, B computed as cos(x, y) = A . B / (|A| . |B|) Sentences are represented as vector TF*IDF metrics. :param sentence1: Iterable object where every item represents word ...
sumy/summarizers/lex_rank.py
def cosine_similarity(sentence1, sentence2, tf1, tf2, idf_metrics): """ We compute idf-modified-cosine(sentence1, sentence2) here. It's cosine similarity of these two sentences (vectors) A, B computed as cos(x, y) = A . B / (|A| . |B|) Sentences are represented as vector TF*IDF metrics. ...
def cosine_similarity(sentence1, sentence2, tf1, tf2, idf_metrics): """ We compute idf-modified-cosine(sentence1, sentence2) here. It's cosine similarity of these two sentences (vectors) A, B computed as cos(x, y) = A . B / (|A| . |B|) Sentences are represented as vector TF*IDF metrics. ...
[ "We", "compute", "idf", "-", "modified", "-", "cosine", "(", "sentence1", "sentence2", ")", "here", ".", "It", "s", "cosine", "similarity", "of", "these", "two", "sentences", "(", "vectors", ")", "A", "B", "computed", "as", "cos", "(", "x", "y", ")", ...
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/summarizers/lex_rank.py#L120-L157
[ "def", "cosine_similarity", "(", "sentence1", ",", "sentence2", ",", "tf1", ",", "tf2", ",", "idf_metrics", ")", ":", "unique_words1", "=", "frozenset", "(", "sentence1", ")", "unique_words2", "=", "frozenset", "(", "sentence2", ")", "common_words", "=", "uniq...
099ab4938e2c1b6a011297375586bac2953641b9
train
unicode_compatible
Decorator for unicode compatible classes. Method ``__unicode__`` has to be implemented to work decorator as expected.
sumy/_compat.py
def unicode_compatible(cls): """ Decorator for unicode compatible classes. Method ``__unicode__`` has to be implemented to work decorator as expected. """ if PY3: cls.__str__ = cls.__unicode__ cls.__bytes__ = lambda self: self.__str__().encode("utf-8") else: cls.__str__ =...
def unicode_compatible(cls): """ Decorator for unicode compatible classes. Method ``__unicode__`` has to be implemented to work decorator as expected. """ if PY3: cls.__str__ = cls.__unicode__ cls.__bytes__ = lambda self: self.__str__().encode("utf-8") else: cls.__str__ =...
[ "Decorator", "for", "unicode", "compatible", "classes", ".", "Method", "__unicode__", "has", "to", "be", "implemented", "to", "work", "decorator", "as", "expected", "." ]
miso-belica/sumy
python
https://github.com/miso-belica/sumy/blob/099ab4938e2c1b6a011297375586bac2953641b9/sumy/_compat.py#L38-L49
[ "def", "unicode_compatible", "(", "cls", ")", ":", "if", "PY3", ":", "cls", ".", "__str__", "=", "cls", ".", "__unicode__", "cls", ".", "__bytes__", "=", "lambda", "self", ":", "self", ".", "__str__", "(", ")", ".", "encode", "(", "\"utf-8\"", ")", "...
099ab4938e2c1b6a011297375586bac2953641b9
train
to_weld_type
Summary Args: weld_type (TYPE): Description dim (TYPE): Description Returns: TYPE: Description
python/grizzly/grizzly/lazy_op.py
def to_weld_type(weld_type, dim): """Summary Args: weld_type (TYPE): Description dim (TYPE): Description Returns: TYPE: Description """ for i in xrange(dim): weld_type = WeldVec(weld_type) return weld_type
def to_weld_type(weld_type, dim): """Summary Args: weld_type (TYPE): Description dim (TYPE): Description Returns: TYPE: Description """ for i in xrange(dim): weld_type = WeldVec(weld_type) return weld_type
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/lazy_op.py#L6-L18
[ "def", "to_weld_type", "(", "weld_type", ",", "dim", ")", ":", "for", "i", "in", "xrange", "(", "dim", ")", ":", "weld_type", "=", "WeldVec", "(", "weld_type", ")", "return", "weld_type" ]
8ddd6db6b28878bef0892da44b1d2002b564389c
train
LazyOpResult.evaluate
Summary Args: verbose (bool, optional): Description decode (bool, optional): Description Returns: TYPE: Description
python/grizzly/grizzly/lazy_op.py
def evaluate(self, verbose=True, decode=True, passes=None, num_threads=1, apply_experimental_transforms=False): """Summary Args: verbose (bool, optional): Description decode (bool, optional): Description Returns: TYPE: Description ""...
def evaluate(self, verbose=True, decode=True, passes=None, num_threads=1, apply_experimental_transforms=False): """Summary Args: verbose (bool, optional): Description decode (bool, optional): Description Returns: TYPE: Description ""...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/lazy_op.py#L43-L64
[ "def", "evaluate", "(", "self", ",", "verbose", "=", "True", ",", "decode", "=", "True", ",", "passes", "=", "None", ",", "num_threads", "=", "1", ",", "apply_experimental_transforms", "=", "False", ")", ":", "if", "isinstance", "(", "self", ".", "expr",...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._gen_weldobj
Generating a new weldarray from a given arr for self. @arr: weldarray or ndarray. - weldarray: Just update the weldobject with the context from the weldarray. - ndarray: Add the given array to the context of the weldobject. Sets self.name and self.weldobj.
python/numpy/weldnumpy/weldarray.py
def _gen_weldobj(self, arr): ''' Generating a new weldarray from a given arr for self. @arr: weldarray or ndarray. - weldarray: Just update the weldobject with the context from the weldarray. - ndarray: Add the given array to the context of the weldobject. ...
def _gen_weldobj(self, arr): ''' Generating a new weldarray from a given arr for self. @arr: weldarray or ndarray. - weldarray: Just update the weldobject with the context from the weldarray. - ndarray: Add the given array to the context of the weldobject. ...
[ "Generating", "a", "new", "weldarray", "from", "a", "given", "arr", "for", "self", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L192-L211
[ "def", "_gen_weldobj", "(", "self", ",", "arr", ")", ":", "self", ".", "weldobj", "=", "WeldObject", "(", "NumpyArrayEncoder", "(", ")", ",", "NumpyArrayDecoder", "(", ")", ")", "if", "isinstance", "(", "arr", ",", "weldarray", ")", ":", "self", ".", "...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._process_ufunc_inputs
Helper function for __array_ufunc__ that deals with the input/output checks and determines if this should be relegated to numpy's implementation or not. @input_args: args to __array_ufunc__ @outputs: specified outputs. @ret: Bool, If weld supports the given input/output format or not - ...
python/numpy/weldnumpy/weldarray.py
def _process_ufunc_inputs(self, input_args, outputs): ''' Helper function for __array_ufunc__ that deals with the input/output checks and determines if this should be relegated to numpy's implementation or not. @input_args: args to __array_ufunc__ @outputs: specified outputs. ...
def _process_ufunc_inputs(self, input_args, outputs): ''' Helper function for __array_ufunc__ that deals with the input/output checks and determines if this should be relegated to numpy's implementation or not. @input_args: args to __array_ufunc__ @outputs: specified outputs. ...
[ "Helper", "function", "for", "__array_ufunc__", "that", "deals", "with", "the", "input", "/", "output", "checks", "and", "determines", "if", "this", "should", "be", "relegated", "to", "numpy", "s", "implementation", "or", "not", ".", "@input_args", ":", "args"...
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L213-L268
[ "def", "_process_ufunc_inputs", "(", "self", ",", "input_args", ",", "outputs", ")", ":", "if", "len", "(", "input_args", ")", ">", "2", ":", "return", "False", "arrays", "=", "[", "]", "scalars", "=", "[", "]", "for", "i", "in", "input_args", ":", "...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._handle_numpy
relegate responsibility of executing ufunc to numpy.
python/numpy/weldnumpy/weldarray.py
def _handle_numpy(self, ufunc, method, input_args, outputs, kwargs): ''' relegate responsibility of executing ufunc to numpy. ''' # Relegating the work to numpy. If input arg is weldarray, evaluate it, # and convert to ndarray before passing to super() for i, arg_ in enum...
def _handle_numpy(self, ufunc, method, input_args, outputs, kwargs): ''' relegate responsibility of executing ufunc to numpy. ''' # Relegating the work to numpy. If input arg is weldarray, evaluate it, # and convert to ndarray before passing to super() for i, arg_ in enum...
[ "relegate", "responsibility", "of", "executing", "ufunc", "to", "numpy", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L292-L320
[ "def", "_handle_numpy", "(", "self", ",", "ufunc", ",", "method", ",", "input_args", ",", "outputs", ",", "kwargs", ")", ":", "# Relegating the work to numpy. If input arg is weldarray, evaluate it,", "# and convert to ndarray before passing to super()", "for", "i", ",", "a...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._handle_call
TODO: add description
python/numpy/weldnumpy/weldarray.py
def _handle_call(self, ufunc, input_args, outputs): ''' TODO: add description ''' # if output is not None, choose the first one - since we don't support any ops with # multiple outputs. if outputs: output = outputs[0] else: output = None # check for suppo...
def _handle_call(self, ufunc, input_args, outputs): ''' TODO: add description ''' # if output is not None, choose the first one - since we don't support any ops with # multiple outputs. if outputs: output = outputs[0] else: output = None # check for suppo...
[ "TODO", ":", "add", "description" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L322-L346
[ "def", "_handle_call", "(", "self", ",", "ufunc", ",", "input_args", ",", "outputs", ")", ":", "# if output is not None, choose the first one - since we don't support any ops with", "# multiple outputs.", "if", "outputs", ":", "output", "=", "outputs", "[", "0", "]", "e...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._handle_reduce
TODO: describe. TODO: For multi-dimensional case, might need extra work here if the reduction is being performed only along a certain axis. We force evaluation at the end of the reduction - weird errors if we don't. This seems safer anyway. np supports reduce only for binary ops.
python/numpy/weldnumpy/weldarray.py
def _handle_reduce(self, ufunc, input_args, outputs): ''' TODO: describe. TODO: For multi-dimensional case, might need extra work here if the reduction is being performed only along a certain axis. We force evaluation at the end of the reduction - weird errors if we don't. This s...
def _handle_reduce(self, ufunc, input_args, outputs): ''' TODO: describe. TODO: For multi-dimensional case, might need extra work here if the reduction is being performed only along a certain axis. We force evaluation at the end of the reduction - weird errors if we don't. This s...
[ "TODO", ":", "describe", ".", "TODO", ":", "For", "multi", "-", "dimensional", "case", "might", "need", "extra", "work", "here", "if", "the", "reduction", "is", "being", "performed", "only", "along", "a", "certain", "axis", ".", "We", "force", "evaluation"...
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L348-L362
[ "def", "_handle_reduce", "(", "self", ",", "ufunc", ",", "input_args", ",", "outputs", ")", ":", "# input_args[0] must be self so it can be ignored.", "assert", "len", "(", "input_args", ")", "==", "1", "if", "outputs", ":", "output", "=", "outputs", "[", "0", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._reduce_op
TODO: support for multidimensional arrays.
python/numpy/weldnumpy/weldarray.py
def _reduce_op(self, op, result=None): ''' TODO: support for multidimensional arrays. ''' template = 'result(for({arr},merger[{type}, {op}], |b, i, e| merge(b, e)))' self.weldobj.weld_code = template.format(arr = self.weldobj.weld_code, ...
def _reduce_op(self, op, result=None): ''' TODO: support for multidimensional arrays. ''' template = 'result(for({arr},merger[{type}, {op}], |b, i, e| merge(b, e)))' self.weldobj.weld_code = template.format(arr = self.weldobj.weld_code, ...
[ "TODO", ":", "support", "for", "multidimensional", "arrays", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L364-L372
[ "def", "_reduce_op", "(", "self", ",", "op", ",", "result", "=", "None", ")", ":", "template", "=", "'result(for({arr},merger[{type}, {op}], |b, i, e| merge(b, e)))'", "self", ".", "weldobj", ".", "weld_code", "=", "template", ".", "format", "(", "arr", "=", "se...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._get_result
Creating a new result weldarray from self. If self is view into a weldarray, then evaluate the parent first as self would not be storing the ops that have been registered to it (only base_array would store those).
python/numpy/weldnumpy/weldarray.py
def _get_result(self): ''' Creating a new result weldarray from self. If self is view into a weldarray, then evaluate the parent first as self would not be storing the ops that have been registered to it (only base_array would store those). ''' if self._weldarray_view: ...
def _get_result(self): ''' Creating a new result weldarray from self. If self is view into a weldarray, then evaluate the parent first as self would not be storing the ops that have been registered to it (only base_array would store those). ''' if self._weldarray_view: ...
[ "Creating", "a", "new", "result", "weldarray", "from", "self", ".", "If", "self", "is", "view", "into", "a", "weldarray", "then", "evaluate", "the", "parent", "first", "as", "self", "would", "not", "be", "storing", "the", "ops", "that", "have", "been", "...
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L416-L427
[ "def", "_get_result", "(", "self", ")", ":", "if", "self", ".", "_weldarray_view", ":", "idx", "=", "self", ".", "_weldarray_view", ".", "idx", "result", "=", "weldarray", "(", "self", ".", "_weldarray_view", ".", "parent", ".", "_eval", "(", ")", "[", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._unary_op
@unop: str, weld IR for the given function. @result: output array. Create a new array, and updates weldobj.weld_code with the code for unop.
python/numpy/weldnumpy/weldarray.py
def _unary_op(self, unop, result=None): ''' @unop: str, weld IR for the given function. @result: output array. Create a new array, and updates weldobj.weld_code with the code for unop. ''' def _update_array_unary_op(res, unop): ''' @res: w...
def _unary_op(self, unop, result=None): ''' @unop: str, weld IR for the given function. @result: output array. Create a new array, and updates weldobj.weld_code with the code for unop. ''' def _update_array_unary_op(res, unop): ''' @res: w...
[ "@unop", ":", "str", "weld", "IR", "for", "the", "given", "function", ".", "@result", ":", "output", "array", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L429-L460
[ "def", "_unary_op", "(", "self", ",", "unop", ",", "result", "=", "None", ")", ":", "def", "_update_array_unary_op", "(", "res", ",", "unop", ")", ":", "'''\n @res: weldarray to be updated.\n @unop: str, operator applied to res.\n '''", "tem...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._scalar_binary_op
Helper function for _binary_op. @other, scalar values (i32, i64, f32, f64). @result: weldarray to store results in.
python/numpy/weldnumpy/weldarray.py
def _scalar_binary_op(self, other, binop, result): ''' Helper function for _binary_op. @other, scalar values (i32, i64, f32, f64). @result: weldarray to store results in. ''' template = 'map({arr}, |z: {type}| z {binop} {other}{suffix})' weld_type = result._weld_t...
def _scalar_binary_op(self, other, binop, result): ''' Helper function for _binary_op. @other, scalar values (i32, i64, f32, f64). @result: weldarray to store results in. ''' template = 'map({arr}, |z: {type}| z {binop} {other}{suffix})' weld_type = result._weld_t...
[ "Helper", "function", "for", "_binary_op", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L462-L475
[ "def", "_scalar_binary_op", "(", "self", ",", "other", ",", "binop", ",", "result", ")", ":", "template", "=", "'map({arr}, |z: {type}| z {binop} {other}{suffix})'", "weld_type", "=", "result", ".", "_weld_type", ".", "__str__", "(", ")", "result", ".", "weldobj",...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
weldarray._update_views_binary
@result: weldarray that is being updated @other: weldarray or scalar. (result binop other) @binop: str, operation to perform. FIXME: the common indexing pattern for parent/child in _update_view might be too expensive (uses if statements (unneccessary checks when updating child) and woul...
python/numpy/weldnumpy/weldarray.py
def _update_views_binary(self, result, other, binop): ''' @result: weldarray that is being updated @other: weldarray or scalar. (result binop other) @binop: str, operation to perform. FIXME: the common indexing pattern for parent/child in _update_view might be too expensive ...
def _update_views_binary(self, result, other, binop): ''' @result: weldarray that is being updated @other: weldarray or scalar. (result binop other) @binop: str, operation to perform. FIXME: the common indexing pattern for parent/child in _update_view might be too expensive ...
[ "@result", ":", "weldarray", "that", "is", "being", "updated", "@other", ":", "weldarray", "or", "scalar", ".", "(", "result", "binop", "other", ")", "@binop", ":", "str", "operation", "to", "perform", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldarray.py#L493-L515
[ "def", "_update_views_binary", "(", "self", ",", "result", ",", "other", ",", "binop", ")", ":", "update_str_template", "=", "'{e2}{binop}e'", "v", "=", "result", ".", "_weldarray_view", "if", "isinstance", "(", "other", ",", "weldarray", ")", ":", "lookup_ind...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
DataFrameWeld._get_column_names
Summary Returns: TYPE: Description
python/grizzly/grizzly/dataframeweld.py
def _get_column_names(self): """Summary Returns: TYPE: Description """ column_names = set() for column in self.df: column_names.add(column) for column in self.unmaterialized_cols: column_names.add(column) return list(column_nam...
def _get_column_names(self): """Summary Returns: TYPE: Description """ column_names = set() for column in self.df: column_names.add(column) for column in self.unmaterialized_cols: column_names.add(column) return list(column_nam...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/dataframeweld.py#L127-L138
[ "def", "_get_column_names", "(", "self", ")", ":", "column_names", "=", "set", "(", ")", "for", "column", "in", "self", ".", "df", ":", "column_names", ".", "add", "(", "column", ")", "for", "column", "in", "self", ".", "unmaterialized_cols", ":", "colum...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
DataFrameWeld.filter
Summary Args: grouping_column_name (TYPE): Description Returns: TYPE: Description
python/grizzly/grizzly/dataframeweld.py
def filter(self, predicates): """Summary Args: grouping_column_name (TYPE): Description Returns: TYPE: Description """ tys = [] for col_name, raw_column in self.raw_columns.items(): dtype = str(raw_column.dtype) if dtype =...
def filter(self, predicates): """Summary Args: grouping_column_name (TYPE): Description Returns: TYPE: Description """ tys = [] for col_name, raw_column in self.raw_columns.items(): dtype = str(raw_column.dtype) if dtype =...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/dataframeweld.py#L140-L175
[ "def", "filter", "(", "self", ",", "predicates", ")", ":", "tys", "=", "[", "]", "for", "col_name", ",", "raw_column", "in", "self", ".", "raw_columns", ".", "items", "(", ")", ":", "dtype", "=", "str", "(", "raw_column", ".", "dtype", ")", "if", "...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
DataFrameWeldExpr.evaluate
Summary Returns: TYPE: Description
python/grizzly/grizzly/dataframeweld.py
def evaluate(self, verbose=True, passes=None): """Summary Returns: TYPE: Description """ if self.is_pivot: index, pivot, columns = LazyOpResult( self.expr, self.weld_type, 0 ).evaluate(verbose=verbose, p...
def evaluate(self, verbose=True, passes=None): """Summary Returns: TYPE: Description """ if self.is_pivot: index, pivot, columns = LazyOpResult( self.expr, self.weld_type, 0 ).evaluate(verbose=verbose, p...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/dataframeweld.py#L421-L455
[ "def", "evaluate", "(", "self", ",", "verbose", "=", "True", ",", "passes", "=", "None", ")", ":", "if", "self", ".", "is_pivot", ":", "index", ",", "pivot", ",", "columns", "=", "LazyOpResult", "(", "self", ".", "expr", ",", "self", ".", "weld_type"...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
SeriesWeld.sort_values
Sorts the values of this series
python/grizzly/grizzly/seriesweld.py
def sort_values(self, ascending=False): """ Sorts the values of this series """ if self.index_type is not None: index_expr = grizzly_impl.get_field(self.expr, 0) column_expr = grizzly_impl.get_field(self.expr, 1) zip_expr = grizzly_impl.zip_columns([index_exp...
def sort_values(self, ascending=False): """ Sorts the values of this series """ if self.index_type is not None: index_expr = grizzly_impl.get_field(self.expr, 0) column_expr = grizzly_impl.get_field(self.expr, 1) zip_expr = grizzly_impl.zip_columns([index_exp...
[ "Sorts", "the", "values", "of", "this", "series" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L151-L173
[ "def", "sort_values", "(", "self", ",", "ascending", "=", "False", ")", ":", "if", "self", ".", "index_type", "is", "not", "None", ":", "index_expr", "=", "grizzly_impl", ".", "get_field", "(", "self", ".", "expr", ",", "0", ")", "column_expr", "=", "g...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
SeriesWeld.unique
Summary Returns: TYPE: Description
python/grizzly/grizzly/seriesweld.py
def unique(self): """Summary Returns: TYPE: Description """ return SeriesWeld( grizzly_impl.unique( self.expr, self.weld_type ), self.weld_type, self.df, self.column_name )
def unique(self): """Summary Returns: TYPE: Description """ return SeriesWeld( grizzly_impl.unique( self.expr, self.weld_type ), self.weld_type, self.df, self.column_name )
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L176-L190
[ "def", "unique", "(", "self", ")", ":", "return", "SeriesWeld", "(", "grizzly_impl", ".", "unique", "(", "self", ".", "expr", ",", "self", ".", "weld_type", ")", ",", "self", ".", "weld_type", ",", "self", ".", "df", ",", "self", ".", "column_name", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
SeriesWeld.lower
Summary Returns: TYPE: Description
python/grizzly/grizzly/seriesweld.py
def lower(self): """Summary Returns: TYPE: Description """ # TODO : Bug in nested map operating on strings # TODO : Check that self.weld_type is a string type vectype = self.weld_type if isinstance(vectype, WeldVec): elem_type = vectype.el...
def lower(self): """Summary Returns: TYPE: Description """ # TODO : Bug in nested map operating on strings # TODO : Check that self.weld_type is a string type vectype = self.weld_type if isinstance(vectype, WeldVec): elem_type = vectype.el...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L192-L213
[ "def", "lower", "(", "self", ")", ":", "# TODO : Bug in nested map operating on strings", "# TODO : Check that self.weld_type is a string type", "vectype", "=", "self", ".", "weld_type", "if", "isinstance", "(", "vectype", ",", "WeldVec", ")", ":", "elem_type", "=", "ve...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
SeriesWeld.contains
Summary Returns: TYPE: Description
python/grizzly/grizzly/seriesweld.py
def contains(self, string): """Summary Returns: TYPE: Description """ # Check that self.weld_type is a string type vectype = self.weld_type if isinstance(vectype, WeldVec): elem_type = vectype.elemType if isinstance(elem_type, WeldChar): ...
def contains(self, string): """Summary Returns: TYPE: Description """ # Check that self.weld_type is a string type vectype = self.weld_type if isinstance(vectype, WeldVec): elem_type = vectype.elemType if isinstance(elem_type, WeldChar): ...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L215-L236
[ "def", "contains", "(", "self", ",", "string", ")", ":", "# Check that self.weld_type is a string type", "vectype", "=", "self", ".", "weld_type", "if", "isinstance", "(", "vectype", ",", "WeldVec", ")", ":", "elem_type", "=", "vectype", ".", "elemType", "if", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
SeriesWeld.prod
Summary Returns: TYPE: Description
python/grizzly/grizzly/seriesweld.py
def prod(self): """Summary Returns: TYPE: Description """ return LazyOpResult( grizzly_impl.aggr( self.expr, "*", 1, self.weld_type ), self.weld_type, 0 )
def prod(self): """Summary Returns: TYPE: Description """ return LazyOpResult( grizzly_impl.aggr( self.expr, "*", 1, self.weld_type ), self.weld_type, 0 )
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L251-L266
[ "def", "prod", "(", "self", ")", ":", "return", "LazyOpResult", "(", "grizzly_impl", ".", "aggr", "(", "self", ".", "expr", ",", "\"*\"", ",", "1", ",", "self", ".", "weld_type", ")", ",", "self", ".", "weld_type", ",", "0", ")" ]
8ddd6db6b28878bef0892da44b1d2002b564389c
train
SeriesWeld.sum
Summary Returns: TYPE: Description
python/grizzly/grizzly/seriesweld.py
def sum(self): """Summary Returns: TYPE: Description """ return LazyOpResult( grizzly_impl.aggr( self.expr, "+", 0, self.weld_type ), self.weld_type, 0 )
def sum(self): """Summary Returns: TYPE: Description """ return LazyOpResult( grizzly_impl.aggr( self.expr, "+", 0, self.weld_type ), self.weld_type, 0 )
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L268-L283
[ "def", "sum", "(", "self", ")", ":", "return", "LazyOpResult", "(", "grizzly_impl", ".", "aggr", "(", "self", ".", "expr", ",", "\"+\"", ",", "0", ",", "self", ".", "weld_type", ")", ",", "self", ".", "weld_type", ",", "0", ")" ]
8ddd6db6b28878bef0892da44b1d2002b564389c
train
SeriesWeld.count
Summary Returns: TYPE: Description
python/grizzly/grizzly/seriesweld.py
def count(self): """Summary Returns: TYPE: Description """ return LazyOpResult( grizzly_impl.count( self.expr, self.weld_type ), WeldInt(), 0 )
def count(self): """Summary Returns: TYPE: Description """ return LazyOpResult( grizzly_impl.count( self.expr, self.weld_type ), WeldInt(), 0 )
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L301-L314
[ "def", "count", "(", "self", ")", ":", "return", "LazyOpResult", "(", "grizzly_impl", ".", "count", "(", "self", ".", "expr", ",", "self", ".", "weld_type", ")", ",", "WeldInt", "(", ")", ",", "0", ")" ]
8ddd6db6b28878bef0892da44b1d2002b564389c
train
SeriesWeld.mask
Summary Args: predicates (TYPE): Description new_value (TYPE): Description Returns: TYPE: Description
python/grizzly/grizzly/seriesweld.py
def mask(self, predicates, new_value): """Summary Args: predicates (TYPE): Description new_value (TYPE): Description Returns: TYPE: Description """ if isinstance(predicates, SeriesWeld): predicates = predicates.expr return...
def mask(self, predicates, new_value): """Summary Args: predicates (TYPE): Description new_value (TYPE): Description Returns: TYPE: Description """ if isinstance(predicates, SeriesWeld): predicates = predicates.expr return...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L316-L338
[ "def", "mask", "(", "self", ",", "predicates", ",", "new_value", ")", ":", "if", "isinstance", "(", "predicates", ",", "SeriesWeld", ")", ":", "predicates", "=", "predicates", ".", "expr", "return", "SeriesWeld", "(", "grizzly_impl", ".", "mask", "(", "sel...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
SeriesWeld.add
Summary Args: other (TYPE): Description Returns: TYPE: Description
python/grizzly/grizzly/seriesweld.py
def add(self, other): """Summary Args: other (TYPE): Description Returns: TYPE: Description """ if isinstance(other, SeriesWeld): other = other.expr return SeriesWeld( grizzly_impl.element_wise_op( self.exp...
def add(self, other): """Summary Args: other (TYPE): Description Returns: TYPE: Description """ if isinstance(other, SeriesWeld): other = other.expr return SeriesWeld( grizzly_impl.element_wise_op( self.exp...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L354-L375
[ "def", "add", "(", "self", ",", "other", ")", ":", "if", "isinstance", "(", "other", ",", "SeriesWeld", ")", ":", "other", "=", "other", ".", "expr", "return", "SeriesWeld", "(", "grizzly_impl", ".", "element_wise_op", "(", "self", ".", "expr", ",", "o...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
StringSeriesWeld.slice
Summary Args: start (TYPE): Description size (TYPE): Description Returns: TYPE: Description
python/grizzly/grizzly/seriesweld.py
def slice(self, start, size): """Summary Args: start (TYPE): Description size (TYPE): Description Returns: TYPE: Description """ return SeriesWeld( grizzly_impl.slice( self.expr, start, ...
def slice(self, start, size): """Summary Args: start (TYPE): Description size (TYPE): Description Returns: TYPE: Description """ return SeriesWeld( grizzly_impl.slice( self.expr, start, ...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/seriesweld.py#L686-L706
[ "def", "slice", "(", "self", ",", "start", ",", "size", ")", ":", "return", "SeriesWeld", "(", "grizzly_impl", ".", "slice", "(", "self", ".", "expr", ",", "start", ",", "size", ",", "self", ".", "weld_type", ")", ",", "self", ".", "weld_type", ",", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
WeldObject.update
Update this context. if value is another context, the names from that context are added into this one. Otherwise, a new name is assigned and returned. TODO tys for inputs.
python/pyweld/weld/weldobject.py
def update(self, value, tys=None, override=True): """ Update this context. if value is another context, the names from that context are added into this one. Otherwise, a new name is assigned and returned. TODO tys for inputs. """ if isinstance(value, WeldObject):...
def update(self, value, tys=None, override=True): """ Update this context. if value is another context, the names from that context are added into this one. Otherwise, a new name is assigned and returned. TODO tys for inputs. """ if isinstance(value, WeldObject):...
[ "Update", "this", "context", ".", "if", "value", "is", "another", "context", "the", "names", "from", "that", "context", "are", "added", "into", "this", "one", ".", "Otherwise", "a", "new", "name", "is", "assigned", "and", "returned", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/pyweld/weld/weldobject.py#L107-L127
[ "def", "update", "(", "self", ",", "value", ",", "tys", "=", "None", ",", "override", "=", "True", ")", ":", "if", "isinstance", "(", "value", ",", "WeldObject", ")", ":", "self", ".", "context", ".", "update", "(", "value", ".", "context", ")", "e...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
GroupByWeld.sum
Summary Returns: TYPE: Description
python/grizzly/grizzly/groupbyweld.py
def sum(self): """Summary Returns: TYPE: Description """ return GroupedDataFrameWeld( grizzly_impl.groupby_sum( self.columns, self.column_types, self.grouping_columns, self.grouping_column_types ...
def sum(self): """Summary Returns: TYPE: Description """ return GroupedDataFrameWeld( grizzly_impl.groupby_sum( self.columns, self.column_types, self.grouping_columns, self.grouping_column_types ...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/groupbyweld.py#L81-L98
[ "def", "sum", "(", "self", ")", ":", "return", "GroupedDataFrameWeld", "(", "grizzly_impl", ".", "groupby_sum", "(", "self", ".", "columns", ",", "self", ".", "column_types", ",", "self", ".", "grouping_columns", ",", "self", ".", "grouping_column_types", ")",...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
GroupByWeld.sort_values
Summary Returns: TYPE: Description
python/grizzly/grizzly/groupbyweld.py
def sort_values(self, by, ascending=True): """Summary Returns: TYPE: Description """ if len(self.column_types) == 1: vec_type = [WeldVec(self.column_types[0])] else: vec_type = [WeldVec(WeldStruct(self.column_types))] if len(self.colu...
def sort_values(self, by, ascending=True): """Summary Returns: TYPE: Description """ if len(self.column_types) == 1: vec_type = [WeldVec(self.column_types[0])] else: vec_type = [WeldVec(WeldStruct(self.column_types))] if len(self.colu...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/groupbyweld.py#L100-L129
[ "def", "sort_values", "(", "self", ",", "by", ",", "ascending", "=", "True", ")", ":", "if", "len", "(", "self", ".", "column_types", ")", "==", "1", ":", "vec_type", "=", "[", "WeldVec", "(", "self", ".", "column_types", "[", "0", "]", ")", "]", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
GroupByWeld.size
Returns the sizes of the groups as series. Returns: TYPE: Description
python/grizzly/grizzly/groupbyweld.py
def size(self): """Returns the sizes of the groups as series. Returns: TYPE: Description """ if len(self.grouping_column_types) > 1: index_type = WeldStruct([self.grouping_column_types]) # Figure out what to use for multi-key index name # ...
def size(self): """Returns the sizes of the groups as series. Returns: TYPE: Description """ if len(self.grouping_column_types) > 1: index_type = WeldStruct([self.grouping_column_types]) # Figure out what to use for multi-key index name # ...
[ "Returns", "the", "sizes", "of", "the", "groups", "as", "series", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/groupbyweld.py#L139-L162
[ "def", "size", "(", "self", ")", ":", "if", "len", "(", "self", ".", "grouping_column_types", ")", ">", "1", ":", "index_type", "=", "WeldStruct", "(", "[", "self", ".", "grouping_column_types", "]", ")", "# Figure out what to use for multi-key index name", "# i...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
GroupedDataFrameWeld.get_column
Summary Args: column_name (TYPE): Description column_type (TYPE): Description index (TYPE): Description Returns: TYPE: Description
python/grizzly/grizzly/groupbyweld.py
def get_column(self, column_name, column_type, index, verbose=True): """Summary Args: column_name (TYPE): Description column_type (TYPE): Description index (TYPE): Description Returns: TYPE: Description """ return LazyOpResult( ...
def get_column(self, column_name, column_type, index, verbose=True): """Summary Args: column_name (TYPE): Description column_type (TYPE): Description index (TYPE): Description Returns: TYPE: Description """ return LazyOpResult( ...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/groupbyweld.py#L236-L255
[ "def", "get_column", "(", "self", ",", "column_name", ",", "column_type", ",", "index", ",", "verbose", "=", "True", ")", ":", "return", "LazyOpResult", "(", "grizzly_impl", ".", "get_column", "(", "self", ".", "expr", ",", "self", ".", "weld_type", ",", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
GroupedDataFrameWeld.reset_index
Flattens the grouped data structure. #TODO: The parameters here are meaningless Flattens the grouped data structure. What is returned is a DataFrameWeld object.
python/grizzly/grizzly/groupbyweld.py
def reset_index(self, inplace=True, drop=True): """ Flattens the grouped data structure. #TODO: The parameters here are meaningless Flattens the grouped data structure. What is returned is a DataFrameWeld object. """ if len(self.column_types) == 1: vectype =...
def reset_index(self, inplace=True, drop=True): """ Flattens the grouped data structure. #TODO: The parameters here are meaningless Flattens the grouped data structure. What is returned is a DataFrameWeld object. """ if len(self.column_types) == 1: vectype =...
[ "Flattens", "the", "grouped", "data", "structure", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/groupbyweld.py#L257-L285
[ "def", "reset_index", "(", "self", ",", "inplace", "=", "True", ",", "drop", "=", "True", ")", ":", "if", "len", "(", "self", ".", "column_types", ")", "==", "1", ":", "vectype", "=", "self", ".", "column_types", "[", "0", "]", "if", "isinstance", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
GroupedDataFrameWeld.evaluate
Summary Returns: TYPE: Description
python/grizzly/grizzly/groupbyweld.py
def evaluate(self, verbose=True, passes=None): """Summary Returns: TYPE: Description """ i = 0 exprs = [] for column_name in self.column_names: if len(self.column_names) > 1: index = "1.$%d" % i else: in...
def evaluate(self, verbose=True, passes=None): """Summary Returns: TYPE: Description """ i = 0 exprs = [] for column_name in self.column_names: if len(self.column_names) > 1: index = "1.$%d" % i else: in...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/groupbyweld.py#L287-L329
[ "def", "evaluate", "(", "self", ",", "verbose", "=", "True", ",", "passes", "=", "None", ")", ":", "i", "=", "0", "exprs", "=", "[", "]", "for", "column_name", "in", "self", ".", "column_names", ":", "if", "len", "(", "self", ".", "column_names", "...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
GroupByWeldSeries.std
Standard deviation Note that is by default normalizd by n - 1 # TODO, what does pandas do for multiple grouping columns? # Currently we are just going to use one grouping column
python/grizzly/grizzly/groupbyweld.py
def std(self): """Standard deviation Note that is by default normalizd by n - 1 # TODO, what does pandas do for multiple grouping columns? # Currently we are just going to use one grouping column """ std_expr = grizzly_impl.groupby_std( [self.column], ...
def std(self): """Standard deviation Note that is by default normalizd by n - 1 # TODO, what does pandas do for multiple grouping columns? # Currently we are just going to use one grouping column """ std_expr = grizzly_impl.groupby_std( [self.column], ...
[ "Standard", "deviation" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/groupbyweld.py#L349-L382
[ "def", "std", "(", "self", ")", ":", "std_expr", "=", "grizzly_impl", ".", "groupby_std", "(", "[", "self", ".", "column", "]", ",", "[", "self", ".", "column_type", "]", ",", "self", ".", "grouping_columns", ",", "self", ".", "grouping_column_types", ")...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
WeldModule.run
WeldContext is currently hidden from the Python API. We create a new context per Weld run and give ownership of it to the resulting value. NOTE: This can leak the context if the result of the Weld run is an error.
python/pyweld/weld/bindings.py
def run(self, conf, arg, err): """ WeldContext is currently hidden from the Python API. We create a new context per Weld run and give ownership of it to the resulting value. NOTE: This can leak the context if the result of the Weld run is an error. """ weld_conte...
def run(self, conf, arg, err): """ WeldContext is currently hidden from the Python API. We create a new context per Weld run and give ownership of it to the resulting value. NOTE: This can leak the context if the result of the Weld run is an error. """ weld_conte...
[ "WeldContext", "is", "currently", "hidden", "from", "the", "Python", "API", ".", "We", "create", "a", "new", "context", "per", "Weld", "run", "and", "give", "ownership", "of", "it", "to", "the", "resulting", "value", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/pyweld/weld/bindings.py#L53-L72
[ "def", "run", "(", "self", ",", "conf", ",", "arg", ",", "err", ")", ":", "weld_context_new", "=", "weld", ".", "weld_context_new", "weld_context_new", ".", "argtypes", "=", "[", "c_weld_conf", "]", "weld_context_new", ".", "restype", "=", "c_weld_context", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
aggr
Computes the aggregate of elements in the array. Args: array (WeldObject / Numpy.ndarray): Input array to aggregate op (str): Op string used to aggregate the array (+ / *) initial_value (int): Initial value for aggregation ty (WeldType): Type of each element in the input array ...
python/grizzly/grizzly/numpy_weld_impl.py
def aggr(array, op, initial_value, ty): """ Computes the aggregate of elements in the array. Args: array (WeldObject / Numpy.ndarray): Input array to aggregate op (str): Op string used to aggregate the array (+ / *) initial_value (int): Initial value for aggregation ty (Weld...
def aggr(array, op, initial_value, ty): """ Computes the aggregate of elements in the array. Args: array (WeldObject / Numpy.ndarray): Input array to aggregate op (str): Op string used to aggregate the array (+ / *) initial_value (int): Initial value for aggregation ty (Weld...
[ "Computes", "the", "aggregate", "of", "elements", "in", "the", "array", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/numpy_weld_impl.py#L53-L85
[ "def", "aggr", "(", "array", ",", "op", ",", "initial_value", ",", "ty", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "array_var", "=", "weld_obj", ".", "update", "(", "array", ")", "if", "isinstance", "(", "array", "...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
dot
Computes the dot product between a matrix and a vector. Args: matrix (WeldObject / Numpy.ndarray): 2-d input matrix vector (WeldObject / Numpy.ndarray): 1-d input vector ty (WeldType): Type of each element in the input matrix and vector Returns: A WeldObject representing this c...
python/grizzly/grizzly/numpy_weld_impl.py
def dot(matrix, vector, matrix_ty, vector_ty): """ Computes the dot product between a matrix and a vector. Args: matrix (WeldObject / Numpy.ndarray): 2-d input matrix vector (WeldObject / Numpy.ndarray): 1-d input vector ty (WeldType): Type of each element in the input matrix and ve...
def dot(matrix, vector, matrix_ty, vector_ty): """ Computes the dot product between a matrix and a vector. Args: matrix (WeldObject / Numpy.ndarray): 2-d input matrix vector (WeldObject / Numpy.ndarray): 1-d input vector ty (WeldType): Type of each element in the input matrix and ve...
[ "Computes", "the", "dot", "product", "between", "a", "matrix", "and", "a", "vector", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/numpy_weld_impl.py#L88-L142
[ "def", "dot", "(", "matrix", ",", "vector", ",", "matrix_ty", ",", "vector_ty", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "matrix_var", "=", "weld_obj", ".", "update", "(", "matrix", ")", "if", "isinstance", "(", "ma...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
exp
Computes the per-element exponenet of the passed-in array. Args: array (WeldObject / Numpy.ndarray): Input array ty (WeldType): Type of each element in the input array Returns: A WeldObject representing this computation
python/grizzly/grizzly/numpy_weld_impl.py
def exp(array, ty): """ Computes the per-element exponenet of the passed-in array. Args: array (WeldObject / Numpy.ndarray): Input array ty (WeldType): Type of each element in the input array Returns: A WeldObject representing this computation """ weld_obj = WeldObject(...
def exp(array, ty): """ Computes the per-element exponenet of the passed-in array. Args: array (WeldObject / Numpy.ndarray): Input array ty (WeldType): Type of each element in the input array Returns: A WeldObject representing this computation """ weld_obj = WeldObject(...
[ "Computes", "the", "per", "-", "element", "exponenet", "of", "the", "passed", "-", "in", "array", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/numpy_weld_impl.py#L145-L170
[ "def", "exp", "(", "array", ",", "ty", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "array_var", "=", "weld_obj", ".", "update", "(", "array", ")", "if", "isinstance", "(", "array", ",", "WeldObject", ")", ":", "array...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
is_view_child
Checks the base address of the given arrays to figure out if child and par have overlapping memory regions.
python/numpy/weldnumpy/weldnumpy.py
def is_view_child(view, par): ''' Checks the base address of the given arrays to figure out if child and par have overlapping memory regions. ''' if par.base is None: # par is the base array. return view.base is par else: # par is a view of another array as well! ...
def is_view_child(view, par): ''' Checks the base address of the given arrays to figure out if child and par have overlapping memory regions. ''' if par.base is None: # par is the base array. return view.base is par else: # par is a view of another array as well! ...
[ "Checks", "the", "base", "address", "of", "the", "given", "arrays", "to", "figure", "out", "if", "child", "and", "par", "have", "overlapping", "memory", "regions", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldnumpy.py#L24-L35
[ "def", "is_view_child", "(", "view", ",", "par", ")", ":", "if", "par", ".", "base", "is", "None", ":", "# par is the base array.", "return", "view", ".", "base", "is", "par", "else", ":", "# par is a view of another array as well!", "# view can only be a child of p...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
get_supported_binary_ops
Returns a dictionary of the Weld supported binary ops, with values being their Weld symbol.
python/numpy/weldnumpy/weldnumpy.py
def get_supported_binary_ops(): ''' Returns a dictionary of the Weld supported binary ops, with values being their Weld symbol. ''' binary_ops = {} binary_ops[np.add.__name__] = '+' binary_ops[np.subtract.__name__] = '-' binary_ops[np.multiply.__name__] = '*' binary_ops[np.divide.__name_...
def get_supported_binary_ops(): ''' Returns a dictionary of the Weld supported binary ops, with values being their Weld symbol. ''' binary_ops = {} binary_ops[np.add.__name__] = '+' binary_ops[np.subtract.__name__] = '-' binary_ops[np.multiply.__name__] = '*' binary_ops[np.divide.__name_...
[ "Returns", "a", "dictionary", "of", "the", "Weld", "supported", "binary", "ops", "with", "values", "being", "their", "Weld", "symbol", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldnumpy.py#L44-L53
[ "def", "get_supported_binary_ops", "(", ")", ":", "binary_ops", "=", "{", "}", "binary_ops", "[", "np", ".", "add", ".", "__name__", "]", "=", "'+'", "binary_ops", "[", "np", ".", "subtract", ".", "__name__", "]", "=", "'-'", "binary_ops", "[", "np", "...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
get_supported_unary_ops
Returns a dictionary of the Weld supported unary ops, with values being their Weld symbol.
python/numpy/weldnumpy/weldnumpy.py
def get_supported_unary_ops(): ''' Returns a dictionary of the Weld supported unary ops, with values being their Weld symbol. ''' unary_ops = {} unary_ops[np.exp.__name__] = 'exp' unary_ops[np.log.__name__] = 'log' unary_ops[np.sqrt.__name__] = 'sqrt' return unary_ops
def get_supported_unary_ops(): ''' Returns a dictionary of the Weld supported unary ops, with values being their Weld symbol. ''' unary_ops = {} unary_ops[np.exp.__name__] = 'exp' unary_ops[np.log.__name__] = 'log' unary_ops[np.sqrt.__name__] = 'sqrt' return unary_ops
[ "Returns", "a", "dictionary", "of", "the", "Weld", "supported", "unary", "ops", "with", "values", "being", "their", "Weld", "symbol", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/numpy/weldnumpy/weldnumpy.py#L55-L63
[ "def", "get_supported_unary_ops", "(", ")", ":", "unary_ops", "=", "{", "}", "unary_ops", "[", "np", ".", "exp", ".", "__name__", "]", "=", "'exp'", "unary_ops", "[", "np", ".", "log", ".", "__name__", "]", "=", "'log'", "unary_ops", "[", "np", ".", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
WeldVec.ctype_class
Summary Returns: TYPE: Description
python/pyweld/weld/types.py
def ctype_class(self): """Summary Returns: TYPE: Description """ def vec_factory(elemType): """Summary Args: elemType (TYPE): Description Returns: TYPE: Description """ class Vec(St...
def ctype_class(self): """Summary Returns: TYPE: Description """ def vec_factory(elemType): """Summary Args: elemType (TYPE): Description Returns: TYPE: Description """ class Vec(St...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/pyweld/weld/types.py#L242-L268
[ "def", "ctype_class", "(", "self", ")", ":", "def", "vec_factory", "(", "elemType", ")", ":", "\"\"\"Summary\n\n Args:\n elemType (TYPE): Description\n\n Returns:\n TYPE: Description\n \"\"\"", "class", "Vec", "(", "Struc...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
WeldStruct.ctype_class
Summary Returns: TYPE: Description
python/pyweld/weld/types.py
def ctype_class(self): """Summary Returns: TYPE: Description """ def struct_factory(field_types): """Summary Args: field_types (TYPE): Description Returns: TYPE: Description """ cla...
def ctype_class(self): """Summary Returns: TYPE: Description """ def struct_factory(field_types): """Summary Args: field_types (TYPE): Description Returns: TYPE: Description """ cla...
[ "Summary" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/pyweld/weld/types.py#L297-L322
[ "def", "ctype_class", "(", "self", ")", ":", "def", "struct_factory", "(", "field_types", ")", ":", "\"\"\"Summary\n\n Args:\n field_types (TYPE): Description\n\n Returns:\n TYPE: Description\n \"\"\"", "class", "Struct", "...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
get_field
Fetch a field from a struct expr
python/grizzly/grizzly/grizzly_impl.py
def get_field(expr, field): """ Fetch a field from a struct expr """ weld_obj = WeldObject(encoder_, decoder_) struct_var = weld_obj.update(expr) if isinstance(expr, WeldObject): struct_var = expr.obj_id weld_obj.dependencies[struct_var] = expr weld_template = """ %(stru...
def get_field(expr, field): """ Fetch a field from a struct expr """ weld_obj = WeldObject(encoder_, decoder_) struct_var = weld_obj.update(expr) if isinstance(expr, WeldObject): struct_var = expr.obj_id weld_obj.dependencies[struct_var] = expr weld_template = """ %(stru...
[ "Fetch", "a", "field", "from", "a", "struct", "expr" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/grizzly_impl.py#L14-L31
[ "def", "get_field", "(", "expr", ",", "field", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "struct_var", "=", "weld_obj", ".", "update", "(", "expr", ")", "if", "isinstance", "(", "expr", ",", "WeldObject", ")", ":", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
mask
Returns a new array, with each element in the original array satisfying the passed-in predicate set to `new_value` Args: array (WeldObject / Numpy.ndarray): Input array predicates (WeldObject / Numpy.ndarray<bool>): Predicate set new_value (WeldObject / Numpy.ndarray / str): mask value ...
python/grizzly/grizzly/grizzly_impl.py
def mask(array, predicates, new_value, ty): """ Returns a new array, with each element in the original array satisfying the passed-in predicate set to `new_value` Args: array (WeldObject / Numpy.ndarray): Input array predicates (WeldObject / Numpy.ndarray<bool>): Predicate set n...
def mask(array, predicates, new_value, ty): """ Returns a new array, with each element in the original array satisfying the passed-in predicate set to `new_value` Args: array (WeldObject / Numpy.ndarray): Input array predicates (WeldObject / Numpy.ndarray<bool>): Predicate set n...
[ "Returns", "a", "new", "array", "with", "each", "element", "in", "the", "original", "array", "satisfying", "the", "passed", "-", "in", "predicate", "set", "to", "new_value" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/grizzly_impl.py#L106-L152
[ "def", "mask", "(", "array", ",", "predicates", ",", "new_value", ",", "ty", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "array_var", "=", "weld_obj", ".", "update", "(", "array", ")", "if", "isinstance", "(", "array",...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
filter
Returns a new array, with each element in the original array satisfying the passed-in predicate set to `new_value` Args: array (WeldObject / Numpy.ndarray): Input array predicates (WeldObject / Numpy.ndarray<bool>): Predicate set ty (WeldType): Type of each element in the input array ...
python/grizzly/grizzly/grizzly_impl.py
def filter(array, predicates, ty=None): """ Returns a new array, with each element in the original array satisfying the passed-in predicate set to `new_value` Args: array (WeldObject / Numpy.ndarray): Input array predicates (WeldObject / Numpy.ndarray<bool>): Predicate set ty (W...
def filter(array, predicates, ty=None): """ Returns a new array, with each element in the original array satisfying the passed-in predicate set to `new_value` Args: array (WeldObject / Numpy.ndarray): Input array predicates (WeldObject / Numpy.ndarray<bool>): Predicate set ty (W...
[ "Returns", "a", "new", "array", "with", "each", "element", "in", "the", "original", "array", "satisfying", "the", "passed", "-", "in", "predicate", "set", "to", "new_value" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/grizzly_impl.py#L155-L193
[ "def", "filter", "(", "array", ",", "predicates", ",", "ty", "=", "None", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "array_var", "=", "weld_obj", ".", "update", "(", "array", ")", "if", "isinstance", "(", "array", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
pivot_filter
Returns a new array, with each element in the original array satisfying the passed-in predicate set to `new_value` Args: array (WeldObject / Numpy.ndarray): Input array predicates (WeldObject / Numpy.ndarray<bool>): Predicate set ty (WeldType): Type of each element in the input array ...
python/grizzly/grizzly/grizzly_impl.py
def pivot_filter(pivot_array, predicates, ty=None): """ Returns a new array, with each element in the original array satisfying the passed-in predicate set to `new_value` Args: array (WeldObject / Numpy.ndarray): Input array predicates (WeldObject / Numpy.ndarray<bool>): Predicate set ...
def pivot_filter(pivot_array, predicates, ty=None): """ Returns a new array, with each element in the original array satisfying the passed-in predicate set to `new_value` Args: array (WeldObject / Numpy.ndarray): Input array predicates (WeldObject / Numpy.ndarray<bool>): Predicate set ...
[ "Returns", "a", "new", "array", "with", "each", "element", "in", "the", "original", "array", "satisfying", "the", "passed", "-", "in", "predicate", "set", "to", "new_value" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/grizzly_impl.py#L195-L247
[ "def", "pivot_filter", "(", "pivot_array", ",", "predicates", ",", "ty", "=", "None", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "pivot_array_var", "=", "weld_obj", ".", "update", "(", "pivot_array", ")", "if", "isinstanc...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
element_wise_op
Operation of series and other, element-wise (binary operator add) Args: array (WeldObject / Numpy.ndarray): Input array other (WeldObject / Numpy.ndarray): Second Input array op (str): Op string used to compute element-wise operation (+ / *) ty (WeldType): Type of each element in th...
python/grizzly/grizzly/grizzly_impl.py
def element_wise_op(array, other, op, ty): """ Operation of series and other, element-wise (binary operator add) Args: array (WeldObject / Numpy.ndarray): Input array other (WeldObject / Numpy.ndarray): Second Input array op (str): Op string used to compute element-wise operation (+...
def element_wise_op(array, other, op, ty): """ Operation of series and other, element-wise (binary operator add) Args: array (WeldObject / Numpy.ndarray): Input array other (WeldObject / Numpy.ndarray): Second Input array op (str): Op string used to compute element-wise operation (+...
[ "Operation", "of", "series", "and", "other", "element", "-", "wise", "(", "binary", "operator", "add", ")" ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/grizzly_impl.py#L298-L333
[ "def", "element_wise_op", "(", "array", ",", "other", ",", "op", ",", "ty", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "array_var", "=", "weld_obj", ".", "update", "(", "array", ")", "if", "isinstance", "(", "array", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
unzip_columns
Zip together multiple columns. Args: columns (WeldObject / Numpy.ndarray): lust of columns Returns: A WeldObject representing this computation
python/grizzly/grizzly/grizzly_impl.py
def unzip_columns(expr, column_types): """ Zip together multiple columns. Args: columns (WeldObject / Numpy.ndarray): lust of columns Returns: A WeldObject representing this computation """ weld_obj = WeldObject(encoder_, decoder_) column_appenders = [] struct_fields = ...
def unzip_columns(expr, column_types): """ Zip together multiple columns. Args: columns (WeldObject / Numpy.ndarray): lust of columns Returns: A WeldObject representing this computation """ weld_obj = WeldObject(encoder_, decoder_) column_appenders = [] struct_fields = ...
[ "Zip", "together", "multiple", "columns", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/grizzly_impl.py#L335-L374
[ "def", "unzip_columns", "(", "expr", ",", "column_types", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "column_appenders", "=", "[", "]", "struct_fields", "=", "[", "]", "result_fields", "=", "[", "]", "for", "i", ",", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
sort
Sorts the vector. If the field parameter is provided then the sort operators on a vector of structs where the sort key is the field of the struct. Args: expr (WeldObject) field (Int)
python/grizzly/grizzly/grizzly_impl.py
def sort(expr, field = None, keytype=None, ascending=True): """ Sorts the vector. If the field parameter is provided then the sort operators on a vector of structs where the sort key is the field of the struct. Args: expr (WeldObject) field (Int) """ weld_obj = WeldObject(en...
def sort(expr, field = None, keytype=None, ascending=True): """ Sorts the vector. If the field parameter is provided then the sort operators on a vector of structs where the sort key is the field of the struct. Args: expr (WeldObject) field (Int) """ weld_obj = WeldObject(en...
[ "Sorts", "the", "vector", ".", "If", "the", "field", "parameter", "is", "provided", "then", "the", "sort", "operators", "on", "a", "vector", "of", "structs", "where", "the", "sort", "key", "is", "the", "field", "of", "the", "struct", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/grizzly_impl.py#L376-L407
[ "def", "sort", "(", "expr", ",", "field", "=", "None", ",", "keytype", "=", "None", ",", "ascending", "=", "True", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "expr_var", "=", "weld_obj", ".", "update", "(", "expr", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
slice_vec
Slices the vector. Args: expr (WeldObject) start (Long) stop (Long)
python/grizzly/grizzly/grizzly_impl.py
def slice_vec(expr, start, stop): """ Slices the vector. Args: expr (WeldObject) start (Long) stop (Long) """ weld_obj = WeldObject(encoder_, decoder_) expr_var = weld_obj.update(expr) if isinstance(expr, WeldObject): expr_var = expr.obj_id weld_obj.depend...
def slice_vec(expr, start, stop): """ Slices the vector. Args: expr (WeldObject) start (Long) stop (Long) """ weld_obj = WeldObject(encoder_, decoder_) expr_var = weld_obj.update(expr) if isinstance(expr, WeldObject): expr_var = expr.obj_id weld_obj.depend...
[ "Slices", "the", "vector", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/grizzly_impl.py#L409-L431
[ "def", "slice_vec", "(", "expr", ",", "start", ",", "stop", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "expr_var", "=", "weld_obj", ".", "update", "(", "expr", ")", "if", "isinstance", "(", "expr", ",", "WeldObject", ...
8ddd6db6b28878bef0892da44b1d2002b564389c
train
zip_columns
Zip together multiple columns. Args: columns (WeldObject / Numpy.ndarray): lust of columns Returns: A WeldObject representing this computation
python/grizzly/grizzly/grizzly_impl.py
def zip_columns(columns): """ Zip together multiple columns. Args: columns (WeldObject / Numpy.ndarray): lust of columns Returns: A WeldObject representing this computation """ weld_obj = WeldObject(encoder_, decoder_) column_vars = [] for column in columns: col...
def zip_columns(columns): """ Zip together multiple columns. Args: columns (WeldObject / Numpy.ndarray): lust of columns Returns: A WeldObject representing this computation """ weld_obj = WeldObject(encoder_, decoder_) column_vars = [] for column in columns: col...
[ "Zip", "together", "multiple", "columns", "." ]
weld-project/weld
python
https://github.com/weld-project/weld/blob/8ddd6db6b28878bef0892da44b1d2002b564389c/python/grizzly/grizzly/grizzly_impl.py#L433-L467
[ "def", "zip_columns", "(", "columns", ")", ":", "weld_obj", "=", "WeldObject", "(", "encoder_", ",", "decoder_", ")", "column_vars", "=", "[", "]", "for", "column", "in", "columns", ":", "col_var", "=", "weld_obj", ".", "update", "(", "column", ")", "if"...
8ddd6db6b28878bef0892da44b1d2002b564389c