Datasets:

Modalities:
Tabular
Text
Formats:
parquet
Libraries:
Datasets
pandas
Dataset Viewer
Auto-converted to Parquet Duplicate
function_name
stringlengths
1
63
docstring
stringlengths
50
5.89k
masked_code
stringlengths
50
882k
implementation
stringlengths
169
12.9k
start_line
int32
1
14.6k
end_line
int32
16
14.6k
file_content
stringlengths
274
882k
add_collision_mesh
Add a collision mesh to the planning scene. Parameters ---------- collision_mesh : :class:`compas_fab.robots.CollisionMesh` Object containing the collision mesh to be added. options : dict, optional Unused parameter. Returns ------- ``None``
from __future__ import absolute_import from __future__ import division from __future__ import print_function from compas.utilities import await_callback from compas_fab.backends.interfaces import AddCollisionMesh from compas_fab.backends.ros.messages import ApplyPlanningSceneRequest from compas_fab.backends.ros.messa...
def add_collision_mesh(self, collision_mesh, options=None): """Add a collision mesh to the planning scene. Parameters ---------- collision_mesh : :class:`compas_fab.robots.CollisionMesh` Object containing the collision mesh to be added. options : dict, optional ...
31
49
from __future__ import absolute_import from __future__ import division from __future__ import print_function from compas.utilities import await_callback from compas_fab.backends.interfaces import AddCollisionMesh from compas_fab.backends.ros.messages import ApplyPlanningSceneRequest from compas_fab.backends.ros.messa...
get_init_code
Gets initial latent codes as the start point for optimization. The input image is assumed to have already been preprocessed, meaning to have shape [self.G.image_channels, self.G.resolution, self.G.resolution], channel order `self.G.channel_order`, and pixel range [self.G.min_val, self.G.max_val].
# python 3.7 """Utility functions to invert a given image back to a latent code.""" from tqdm import tqdm import cv2 import numpy as np import torch from models.stylegan_generator import StyleGANGenerator from models.stylegan_encoder import StyleGANEncoder from models.perceptual_model import PerceptualModel __all__...
def get_init_code(self, image): """Gets initial latent codes as the start point for optimization. The input image is assumed to have already been preprocessed, meaning to have shape [self.G.image_channels, self.G.resolution, self.G.resolution], channel order `self.G.channel_order`, and pixel range [s...
131
142
# python 3.7 """Utility functions to invert a given image back to a latent code.""" from tqdm import tqdm import cv2 import numpy as np import torch from models.stylegan_generator import StyleGANGenerator from models.stylegan_encoder import StyleGANEncoder from models.perceptual_model import PerceptualModel __all__...
state
A decorator that identifies which methods are states. The presence of the farc_state attr, not the value of the attr, determines statehood. The Spy debugging system uses the farc_state attribute to determine which methods inside a class are actually states. Other uses of the attribute may come in the future.
import asyncio import collections import math import signal import sys from functools import wraps class Spy(object): """Spy is the debugging system for farc. farc contains a handful of Spy.on_*() methods placed at useful locations in the framework. It is up to a Spy driver (such as the included VcdSp...
def state(func): """A decorator that identifies which methods are states. The presence of the farc_state attr, not the value of the attr, determines statehood. The Spy debugging system uses the farc_state attribute to determine which methods inside a class are actually states...
168
183
import asyncio import collections import math import signal import sys from functools import wraps class Spy(object): """Spy is the debugging system for farc. farc contains a handful of Spy.on_*() methods placed at useful locations in the framework. It is up to a Spy driver (such as the included VcdSp...
subscribe
Adds the given Ahsm to the subscriber table list for the given signal. The argument, signame, is a string of the name of the Signal to which the Ahsm is subscribing. Using a string allows the Signal to be created in the registry if it is not already.
import asyncio import collections import math import signal import sys from functools import wraps class Spy(object): """Spy is the debugging system for farc. farc contains a handful of Spy.on_*() methods placed at useful locations in the framework. It is up to a Spy driver (such as the included VcdSp...
@staticmethod def subscribe(signame, act): """Adds the given Ahsm to the subscriber table list for the given signal. The argument, signame, is a string of the name of the Signal to which the Ahsm is subscribing. Using a string allows the Signal to be created in the registry if ...
439
449
import asyncio import collections import math import signal import sys from functools import wraps class Spy(object): """Spy is the debugging system for farc. farc contains a handful of Spy.on_*() methods placed at useful locations in the framework. It is up to a Spy driver (such as the included VcdSp...
timeEventCallback
"The callback function for all TimeEvents.\nPosts the event to the event's target Ahsm.\nIf the Time(...TRUNCATED)
"import asyncio\nimport collections\nimport math\nimport signal\nimport sys\nfrom functools import w(...TRUNCATED)
" @staticmethod\n def timeEventCallback(tm_event, expiration):\n \"\"\"The callback fun(...TRUNCATED)
538
571
"import asyncio\nimport collections\nimport math\nimport signal\nimport sys\nfrom functools import w(...TRUNCATED)
_apply_relativistic_doppler_shift
"Given a `SpectralQuantity` and a velocity, return a new `SpectralQuantity`\nthat is Doppler shifted(...TRUNCATED)
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
"def _apply_relativistic_doppler_shift(scoord, velocity):\n \"\"\"\n Given a `SpectralQuantity(...TRUNCATED)
53
85
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
_validate_coordinate
"Checks the type of the frame and whether a velocity differential and a\ndistance has been defined o(...TRUNCATED)
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
" @staticmethod\n def _validate_coordinate(coord, label=''):\n \"\"\"\n Checks t(...TRUNCATED)
247
299
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
replicate
"Return a replica of the `SpectralCoord`, optionally changing the\nvalues or attributes.\n\nNote tha(...TRUNCATED)
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
" def replicate(self, value=None, unit=None,\n observer=None, target=None,\n (...TRUNCATED)
301
374
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
_normalized_position_vector
"Calculate the normalized position vector between two frames.\n\nParameters\n----------\nobserver : (...TRUNCATED)
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
" @staticmethod\n def _normalized_position_vector(observer, target):\n \"\"\"\n (...TRUNCATED)
519
546
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
with_radial_velocity_shift
"Apply a velocity shift to this spectral coordinate.\n\nThe shift can be provided as a redshift (flo(...TRUNCATED)
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
" def with_radial_velocity_shift(self, target_shift=None, observer_shift=None):\n \"\"\"\n(...TRUNCATED)
635
716
"import warnings\nfrom textwrap import indent\n\nimport astropy.units as u\nimport numpy as np\nfrom(...TRUNCATED)
End of preview. Expand in Data Studio

Stack-Smol-Docstrings

This dataset contains Python functions extracted from the-stack-smol, filtered for high-quality docstrings and implementations. Each sample includes the function's docstring, implementation, and a masked version of the code where the function is replaced with a comment.

The dataset is designed for code completion tasks where a model needs to restore a function that has been replaced with a comment. The model is provided with:

  1. The full file context with the function replaced by a comment
  2. The docstring of the function
  3. The function name

The model's task is to generate code that replaces the comment with a proper implementation of the function based on the docstring and surrounding context.

Dataset Structure

Each sample contains:

  • function_name: Name of the function
  • docstring: The function's docstring
  • masked_code: The full file with the function replaced by a comment
  • implementation: The original function implementation
  • start_line: The starting line number of the function in the original file
  • end_line: The ending line number of the function in the original file
  • file_content: The full original file content

Quality Filtering

Functions are filtered based on:

  • Docstring quality (length, structure, descriptiveness)
  • Implementation quality (no SQL strings, reasonable number of variables, sufficient complexity)
Downloads last month
10