repo
stringclasses
85 values
path
stringlengths
8
121
func_name
stringlengths
1
82
original_string
stringlengths
112
65.5k
language
stringclasses
1 value
code
stringlengths
112
65.5k
code_tokens
listlengths
20
4.09k
docstring
stringlengths
3
46.3k
docstring_tokens
listlengths
1
564
sha
stringclasses
85 values
url
stringlengths
93
218
partition
stringclasses
1 value
fastai/fastai
fastai/vision/image.py
Image.flow
def flow(self)->FlowField: "Access the flow-field grid after applying queued affine transforms." if self._flow is None: self._flow = _affine_grid(self.shape) if self._affine_mat is not None: self._flow = _affine_mult(self._flow,self._affine_mat) self._affine_m...
python
def flow(self)->FlowField: "Access the flow-field grid after applying queued affine transforms." if self._flow is None: self._flow = _affine_grid(self.shape) if self._affine_mat is not None: self._flow = _affine_mult(self._flow,self._affine_mat) self._affine_m...
[ "def", "flow", "(", "self", ")", "->", "FlowField", ":", "if", "self", ".", "_flow", "is", "None", ":", "self", ".", "_flow", "=", "_affine_grid", "(", "self", ".", "shape", ")", "if", "self", ".", "_affine_mat", "is", "not", "None", ":", "self", "...
Access the flow-field grid after applying queued affine transforms.
[ "Access", "the", "flow", "-", "field", "grid", "after", "applying", "queued", "affine", "transforms", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L153-L160
train
fastai/fastai
fastai/vision/image.py
Image.lighting
def lighting(self, func:LightingFunc, *args:Any, **kwargs:Any): "Equivalent to `image = sigmoid(func(logit(image)))`." self.logit_px = func(self.logit_px, *args, **kwargs) return self
python
def lighting(self, func:LightingFunc, *args:Any, **kwargs:Any): "Equivalent to `image = sigmoid(func(logit(image)))`." self.logit_px = func(self.logit_px, *args, **kwargs) return self
[ "def", "lighting", "(", "self", ",", "func", ":", "LightingFunc", ",", "*", "args", ":", "Any", ",", "*", "*", "kwargs", ":", "Any", ")", ":", "self", ".", "logit_px", "=", "func", "(", "self", ".", "logit_px", ",", "*", "args", ",", "*", "*", ...
Equivalent to `image = sigmoid(func(logit(image)))`.
[ "Equivalent", "to", "image", "=", "sigmoid", "(", "func", "(", "logit", "(", "image", ")))", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L165-L168
train
fastai/fastai
fastai/vision/image.py
Image.pixel
def pixel(self, func:PixelFunc, *args, **kwargs)->'Image': "Equivalent to `image.px = func(image.px)`." self.px = func(self.px, *args, **kwargs) return self
python
def pixel(self, func:PixelFunc, *args, **kwargs)->'Image': "Equivalent to `image.px = func(image.px)`." self.px = func(self.px, *args, **kwargs) return self
[ "def", "pixel", "(", "self", ",", "func", ":", "PixelFunc", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "'Image'", ":", "self", ".", "px", "=", "func", "(", "self", ".", "px", ",", "*", "args", ",", "*", "*", "kwargs", ")", "return", ...
Equivalent to `image.px = func(image.px)`.
[ "Equivalent", "to", "image", ".", "px", "=", "func", "(", "image", ".", "px", ")", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L170-L173
train
fastai/fastai
fastai/vision/image.py
Image.coord
def coord(self, func:CoordFunc, *args, **kwargs)->'Image': "Equivalent to `image.flow = func(image.flow, image.size)`." self.flow = func(self.flow, *args, **kwargs) return self
python
def coord(self, func:CoordFunc, *args, **kwargs)->'Image': "Equivalent to `image.flow = func(image.flow, image.size)`." self.flow = func(self.flow, *args, **kwargs) return self
[ "def", "coord", "(", "self", ",", "func", ":", "CoordFunc", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "'Image'", ":", "self", ".", "flow", "=", "func", "(", "self", ".", "flow", ",", "*", "args", ",", "*", "*", "kwargs", ")", "retur...
Equivalent to `image.flow = func(image.flow, image.size)`.
[ "Equivalent", "to", "image", ".", "flow", "=", "func", "(", "image", ".", "flow", "image", ".", "size", ")", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L175-L178
train
fastai/fastai
fastai/vision/image.py
Image.affine
def affine(self, func:AffineFunc, *args, **kwargs)->'Image': "Equivalent to `image.affine_mat = image.affine_mat @ func()`." m = tensor(func(*args, **kwargs)).to(self.device) self.affine_mat = self.affine_mat @ m return self
python
def affine(self, func:AffineFunc, *args, **kwargs)->'Image': "Equivalent to `image.affine_mat = image.affine_mat @ func()`." m = tensor(func(*args, **kwargs)).to(self.device) self.affine_mat = self.affine_mat @ m return self
[ "def", "affine", "(", "self", ",", "func", ":", "AffineFunc", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "'Image'", ":", "m", "=", "tensor", "(", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", ")", ".", "to", "(", "self", ...
Equivalent to `image.affine_mat = image.affine_mat @ func()`.
[ "Equivalent", "to", "image", ".", "affine_mat", "=", "image", ".", "affine_mat" ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L180-L184
train
fastai/fastai
fastai/vision/image.py
Image.resize
def resize(self, size:Union[int,TensorImageSize])->'Image': "Resize the image to `size`, size can be a single int." assert self._flow is None if isinstance(size, int): size=(self.shape[0], size, size) if tuple(size)==tuple(self.shape): return self self.flow = _affine_grid(size) ...
python
def resize(self, size:Union[int,TensorImageSize])->'Image': "Resize the image to `size`, size can be a single int." assert self._flow is None if isinstance(size, int): size=(self.shape[0], size, size) if tuple(size)==tuple(self.shape): return self self.flow = _affine_grid(size) ...
[ "def", "resize", "(", "self", ",", "size", ":", "Union", "[", "int", ",", "TensorImageSize", "]", ")", "->", "'Image'", ":", "assert", "self", ".", "_flow", "is", "None", "if", "isinstance", "(", "size", ",", "int", ")", ":", "size", "=", "(", "sel...
Resize the image to `size`, size can be a single int.
[ "Resize", "the", "image", "to", "size", "size", "can", "be", "a", "single", "int", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L186-L192
train
fastai/fastai
fastai/vision/image.py
Image.affine_mat
def affine_mat(self)->AffineMatrix: "Get the affine matrix that will be applied by `refresh`." if self._affine_mat is None: self._affine_mat = torch.eye(3).to(self.device) return self._affine_mat
python
def affine_mat(self)->AffineMatrix: "Get the affine matrix that will be applied by `refresh`." if self._affine_mat is None: self._affine_mat = torch.eye(3).to(self.device) return self._affine_mat
[ "def", "affine_mat", "(", "self", ")", "->", "AffineMatrix", ":", "if", "self", ".", "_affine_mat", "is", "None", ":", "self", ".", "_affine_mat", "=", "torch", ".", "eye", "(", "3", ")", ".", "to", "(", "self", ".", "device", ")", "return", "self", ...
Get the affine matrix that will be applied by `refresh`.
[ "Get", "the", "affine", "matrix", "that", "will", "be", "applied", "by", "refresh", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L195-L199
train
fastai/fastai
fastai/vision/image.py
Image.logit_px
def logit_px(self)->LogitTensorImage: "Get logit(image.px)." if self._logit_px is None: self._logit_px = logit_(self.px) return self._logit_px
python
def logit_px(self)->LogitTensorImage: "Get logit(image.px)." if self._logit_px is None: self._logit_px = logit_(self.px) return self._logit_px
[ "def", "logit_px", "(", "self", ")", "->", "LogitTensorImage", ":", "if", "self", ".", "_logit_px", "is", "None", ":", "self", ".", "_logit_px", "=", "logit_", "(", "self", ".", "px", ")", "return", "self", ".", "_logit_px" ]
Get logit(image.px).
[ "Get", "logit", "(", "image", ".", "px", ")", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L204-L207
train
fastai/fastai
fastai/vision/image.py
Image.show
def show(self, ax:plt.Axes=None, figsize:tuple=(3,3), title:Optional[str]=None, hide_axis:bool=True, cmap:str=None, y:Any=None, **kwargs): "Show image on `ax` with `title`, using `cmap` if single-channel, overlaid with optional `y`" cmap = ifnone(cmap, defaults.cmap) ax = show_imag...
python
def show(self, ax:plt.Axes=None, figsize:tuple=(3,3), title:Optional[str]=None, hide_axis:bool=True, cmap:str=None, y:Any=None, **kwargs): "Show image on `ax` with `title`, using `cmap` if single-channel, overlaid with optional `y`" cmap = ifnone(cmap, defaults.cmap) ax = show_imag...
[ "def", "show", "(", "self", ",", "ax", ":", "plt", ".", "Axes", "=", "None", ",", "figsize", ":", "tuple", "=", "(", "3", ",", "3", ")", ",", "title", ":", "Optional", "[", "str", "]", "=", "None", ",", "hide_axis", ":", "bool", "=", "True", ...
Show image on `ax` with `title`, using `cmap` if single-channel, overlaid with optional `y`
[ "Show", "image", "on", "ax", "with", "title", "using", "cmap", "if", "single", "-", "channel", "overlaid", "with", "optional", "y" ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L216-L222
train
fastai/fastai
fastai/vision/image.py
ImageSegment.show
def show(self, ax:plt.Axes=None, figsize:tuple=(3,3), title:Optional[str]=None, hide_axis:bool=True, cmap:str='tab20', alpha:float=0.5, **kwargs): "Show the `ImageSegment` on `ax`." ax = show_image(self, ax=ax, hide_axis=hide_axis, cmap=cmap, figsize=figsize, interpolatio...
python
def show(self, ax:plt.Axes=None, figsize:tuple=(3,3), title:Optional[str]=None, hide_axis:bool=True, cmap:str='tab20', alpha:float=0.5, **kwargs): "Show the `ImageSegment` on `ax`." ax = show_image(self, ax=ax, hide_axis=hide_axis, cmap=cmap, figsize=figsize, interpolatio...
[ "def", "show", "(", "self", ",", "ax", ":", "plt", ".", "Axes", "=", "None", ",", "figsize", ":", "tuple", "=", "(", "3", ",", "3", ")", ",", "title", ":", "Optional", "[", "str", "]", "=", "None", ",", "hide_axis", ":", "bool", "=", "True", ...
Show the `ImageSegment` on `ax`.
[ "Show", "the", "ImageSegment", "on", "ax", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L237-L242
train
fastai/fastai
fastai/vision/image.py
ImagePoints.clone
def clone(self): "Mimic the behavior of torch.clone for `ImagePoints` objects." return self.__class__(FlowField(self.size, self.flow.flow.clone()), scale=False, y_first=False)
python
def clone(self): "Mimic the behavior of torch.clone for `ImagePoints` objects." return self.__class__(FlowField(self.size, self.flow.flow.clone()), scale=False, y_first=False)
[ "def", "clone", "(", "self", ")", ":", "return", "self", ".", "__class__", "(", "FlowField", "(", "self", ".", "size", ",", "self", ".", "flow", ".", "flow", ".", "clone", "(", ")", ")", ",", "scale", "=", "False", ",", "y_first", "=", "False", "...
Mimic the behavior of torch.clone for `ImagePoints` objects.
[ "Mimic", "the", "behavior", "of", "torch", ".", "clone", "for", "ImagePoints", "objects", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L258-L260
train
fastai/fastai
fastai/vision/image.py
ImagePoints.flow
def flow(self)->FlowField: "Access the flow-field grid after applying queued affine and coord transforms." if self._affine_mat is not None: self._flow = _affine_inv_mult(self._flow, self._affine_mat) self._affine_mat = None self.transformed = True if len(self....
python
def flow(self)->FlowField: "Access the flow-field grid after applying queued affine and coord transforms." if self._affine_mat is not None: self._flow = _affine_inv_mult(self._flow, self._affine_mat) self._affine_mat = None self.transformed = True if len(self....
[ "def", "flow", "(", "self", ")", "->", "FlowField", ":", "if", "self", ".", "_affine_mat", "is", "not", "None", ":", "self", ".", "_flow", "=", "_affine_inv_mult", "(", "self", ".", "_flow", ",", "self", ".", "_affine_mat", ")", "self", ".", "_affine_m...
Access the flow-field grid after applying queued affine and coord transforms.
[ "Access", "the", "flow", "-", "field", "grid", "after", "applying", "queued", "affine", "and", "coord", "transforms", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L275-L285
train
fastai/fastai
fastai/vision/image.py
ImagePoints.coord
def coord(self, func:CoordFunc, *args, **kwargs)->'ImagePoints': "Put `func` with `args` and `kwargs` in `self.flow_func` for later." if 'invert' in kwargs: kwargs['invert'] = True else: warn(f"{func.__name__} isn't implemented for {self.__class__}.") self.flow_func.append(partial(func, ...
python
def coord(self, func:CoordFunc, *args, **kwargs)->'ImagePoints': "Put `func` with `args` and `kwargs` in `self.flow_func` for later." if 'invert' in kwargs: kwargs['invert'] = True else: warn(f"{func.__name__} isn't implemented for {self.__class__}.") self.flow_func.append(partial(func, ...
[ "def", "coord", "(", "self", ",", "func", ":", "CoordFunc", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "'ImagePoints'", ":", "if", "'invert'", "in", "kwargs", ":", "kwargs", "[", "'invert'", "]", "=", "True", "else", ":", "warn", "(", "f...
Put `func` with `args` and `kwargs` in `self.flow_func` for later.
[ "Put", "func", "with", "args", "and", "kwargs", "in", "self", ".", "flow_func", "for", "later", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L290-L295
train
fastai/fastai
fastai/vision/image.py
ImagePoints.pixel
def pixel(self, func:PixelFunc, *args, **kwargs)->'ImagePoints': "Equivalent to `self = func_flow(self)`." self = func(self, *args, **kwargs) self.transformed=True return self
python
def pixel(self, func:PixelFunc, *args, **kwargs)->'ImagePoints': "Equivalent to `self = func_flow(self)`." self = func(self, *args, **kwargs) self.transformed=True return self
[ "def", "pixel", "(", "self", ",", "func", ":", "PixelFunc", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "'ImagePoints'", ":", "self", "=", "func", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "transformed", ...
Equivalent to `self = func_flow(self)`.
[ "Equivalent", "to", "self", "=", "func_flow", "(", "self", ")", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L299-L303
train
fastai/fastai
fastai/vision/image.py
ImagePoints.resize
def resize(self, size:Union[int,TensorImageSize]) -> 'ImagePoints': "Resize the image to `size`, size can be a single int." if isinstance(size, int): size=(1, size, size) self._flow.size = size[1:] return self
python
def resize(self, size:Union[int,TensorImageSize]) -> 'ImagePoints': "Resize the image to `size`, size can be a single int." if isinstance(size, int): size=(1, size, size) self._flow.size = size[1:] return self
[ "def", "resize", "(", "self", ",", "size", ":", "Union", "[", "int", ",", "TensorImageSize", "]", ")", "->", "'ImagePoints'", ":", "if", "isinstance", "(", "size", ",", "int", ")", ":", "size", "=", "(", "1", ",", "size", ",", "size", ")", "self", ...
Resize the image to `size`, size can be a single int.
[ "Resize", "the", "image", "to", "size", "size", "can", "be", "a", "single", "int", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L308-L312
train
fastai/fastai
fastai/vision/image.py
ImagePoints.data
def data(self)->Tensor: "Return the points associated to this object." flow = self.flow #This updates flow before we test if some transforms happened if self.transformed: if 'remove_out' not in self.sample_kwargs or self.sample_kwargs['remove_out']: flow = _remove_poi...
python
def data(self)->Tensor: "Return the points associated to this object." flow = self.flow #This updates flow before we test if some transforms happened if self.transformed: if 'remove_out' not in self.sample_kwargs or self.sample_kwargs['remove_out']: flow = _remove_poi...
[ "def", "data", "(", "self", ")", "->", "Tensor", ":", "flow", "=", "self", ".", "flow", "#This updates flow before we test if some transforms happened", "if", "self", ".", "transformed", ":", "if", "'remove_out'", "not", "in", "self", ".", "sample_kwargs", "or", ...
Return the points associated to this object.
[ "Return", "the", "points", "associated", "to", "this", "object", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L315-L322
train
fastai/fastai
fastai/vision/image.py
ImagePoints.show
def show(self, ax:plt.Axes=None, figsize:tuple=(3,3), title:Optional[str]=None, hide_axis:bool=True, **kwargs): "Show the `ImagePoints` on `ax`." if ax is None: _,ax = plt.subplots(figsize=figsize) pnt = scale_flow(FlowField(self.size, self.data), to_unit=False).flow.flip(1) params = {'s...
python
def show(self, ax:plt.Axes=None, figsize:tuple=(3,3), title:Optional[str]=None, hide_axis:bool=True, **kwargs): "Show the `ImagePoints` on `ax`." if ax is None: _,ax = plt.subplots(figsize=figsize) pnt = scale_flow(FlowField(self.size, self.data), to_unit=False).flow.flip(1) params = {'s...
[ "def", "show", "(", "self", ",", "ax", ":", "plt", ".", "Axes", "=", "None", ",", "figsize", ":", "tuple", "=", "(", "3", ",", "3", ")", ",", "title", ":", "Optional", "[", "str", "]", "=", "None", ",", "hide_axis", ":", "bool", "=", "True", ...
Show the `ImagePoints` on `ax`.
[ "Show", "the", "ImagePoints", "on", "ax", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L324-L331
train
fastai/fastai
fastai/vision/image.py
ImageBBox.clone
def clone(self) -> 'ImageBBox': "Mimic the behavior of torch.clone for `Image` objects." flow = FlowField(self.size, self.flow.flow.clone()) return self.__class__(flow, scale=False, y_first=False, labels=self.labels, pad_idx=self.pad_idx)
python
def clone(self) -> 'ImageBBox': "Mimic the behavior of torch.clone for `Image` objects." flow = FlowField(self.size, self.flow.flow.clone()) return self.__class__(flow, scale=False, y_first=False, labels=self.labels, pad_idx=self.pad_idx)
[ "def", "clone", "(", "self", ")", "->", "'ImageBBox'", ":", "flow", "=", "FlowField", "(", "self", ".", "size", ",", "self", ".", "flow", ".", "flow", ".", "clone", "(", ")", ")", "return", "self", ".", "__class__", "(", "flow", ",", "scale", "=", ...
Mimic the behavior of torch.clone for `Image` objects.
[ "Mimic", "the", "behavior", "of", "torch", ".", "clone", "for", "Image", "objects", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L343-L346
train
fastai/fastai
fastai/vision/image.py
ImageBBox.create
def create(cls, h:int, w:int, bboxes:Collection[Collection[int]], labels:Collection=None, classes:dict=None, pad_idx:int=0, scale:bool=True)->'ImageBBox': "Create an ImageBBox object from `bboxes`." if isinstance(bboxes, np.ndarray) and bboxes.dtype == np.object: bboxes = np.array([bb for...
python
def create(cls, h:int, w:int, bboxes:Collection[Collection[int]], labels:Collection=None, classes:dict=None, pad_idx:int=0, scale:bool=True)->'ImageBBox': "Create an ImageBBox object from `bboxes`." if isinstance(bboxes, np.ndarray) and bboxes.dtype == np.object: bboxes = np.array([bb for...
[ "def", "create", "(", "cls", ",", "h", ":", "int", ",", "w", ":", "int", ",", "bboxes", ":", "Collection", "[", "Collection", "[", "int", "]", "]", ",", "labels", ":", "Collection", "=", "None", ",", "classes", ":", "dict", "=", "None", ",", "pad...
Create an ImageBBox object from `bboxes`.
[ "Create", "an", "ImageBBox", "object", "from", "bboxes", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L349-L358
train
fastai/fastai
fastai/vision/image.py
ImageBBox.show
def show(self, y:Image=None, ax:plt.Axes=None, figsize:tuple=(3,3), title:Optional[str]=None, hide_axis:bool=True, color:str='white', **kwargs): "Show the `ImageBBox` on `ax`." if ax is None: _,ax = plt.subplots(figsize=figsize) bboxes, lbls = self._compute_boxes() h,w = self.flo...
python
def show(self, y:Image=None, ax:plt.Axes=None, figsize:tuple=(3,3), title:Optional[str]=None, hide_axis:bool=True, color:str='white', **kwargs): "Show the `ImageBBox` on `ax`." if ax is None: _,ax = plt.subplots(figsize=figsize) bboxes, lbls = self._compute_boxes() h,w = self.flo...
[ "def", "show", "(", "self", ",", "y", ":", "Image", "=", "None", ",", "ax", ":", "plt", ".", "Axes", "=", "None", ",", "figsize", ":", "tuple", "=", "(", "3", ",", "3", ")", ",", "title", ":", "Optional", "[", "str", "]", "=", "None", ",", ...
Show the `ImageBBox` on `ax`.
[ "Show", "the", "ImageBBox", "on", "ax", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L376-L386
train
fastai/fastai
fastai/vision/image.py
Transform.calc
def calc(self, x:Image, *args:Any, **kwargs:Any)->Image: "Apply to image `x`, wrapping it if necessary." if self._wrap: return getattr(x, self._wrap)(self.func, *args, **kwargs) else: return self.func(x, *args, **kwargs)
python
def calc(self, x:Image, *args:Any, **kwargs:Any)->Image: "Apply to image `x`, wrapping it if necessary." if self._wrap: return getattr(x, self._wrap)(self.func, *args, **kwargs) else: return self.func(x, *args, **kwargs)
[ "def", "calc", "(", "self", ",", "x", ":", "Image", ",", "*", "args", ":", "Any", ",", "*", "*", "kwargs", ":", "Any", ")", "->", "Image", ":", "if", "self", ".", "_wrap", ":", "return", "getattr", "(", "x", ",", "self", ".", "_wrap", ")", "(...
Apply to image `x`, wrapping it if necessary.
[ "Apply", "to", "image", "x", "wrapping", "it", "if", "necessary", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/vision/image.py#L467-L470
train
fastai/fastai
fastai/datasets.py
url2path
def url2path(url, data=True, ext:str='.tgz'): "Change `url` to a path." name = url2name(url) return datapath4file(name, ext=ext, archive=False) if data else modelpath4file(name, ext=ext)
python
def url2path(url, data=True, ext:str='.tgz'): "Change `url` to a path." name = url2name(url) return datapath4file(name, ext=ext, archive=False) if data else modelpath4file(name, ext=ext)
[ "def", "url2path", "(", "url", ",", "data", "=", "True", ",", "ext", ":", "str", "=", "'.tgz'", ")", ":", "name", "=", "url2name", "(", "url", ")", "return", "datapath4file", "(", "name", ",", "ext", "=", "ext", ",", "archive", "=", "False", ")", ...
Change `url` to a path.
[ "Change", "url", "to", "a", "path", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L186-L189
train
fastai/fastai
fastai/datasets.py
modelpath4file
def modelpath4file(filename, ext:str='.tgz'): "Return model path to `filename`, checking locally first then in the config file." local_path = URLs.LOCAL_PATH/'models'/filename if local_path.exists() or local_path.with_suffix(ext).exists(): return local_path else: return Config.model_path()/filename
python
def modelpath4file(filename, ext:str='.tgz'): "Return model path to `filename`, checking locally first then in the config file." local_path = URLs.LOCAL_PATH/'models'/filename if local_path.exists() or local_path.with_suffix(ext).exists(): return local_path else: return Config.model_path()/filename
[ "def", "modelpath4file", "(", "filename", ",", "ext", ":", "str", "=", "'.tgz'", ")", ":", "local_path", "=", "URLs", ".", "LOCAL_PATH", "/", "'models'", "/", "filename", "if", "local_path", ".", "exists", "(", ")", "or", "local_path", ".", "with_suffix", ...
Return model path to `filename`, checking locally first then in the config file.
[ "Return", "model", "path", "to", "filename", "checking", "locally", "first", "then", "in", "the", "config", "file", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L193-L197
train
fastai/fastai
fastai/datasets.py
datapath4file
def datapath4file(filename, ext:str='.tgz', archive=True): "Return data path to `filename`, checking locally first then in the config file." local_path = URLs.LOCAL_PATH/'data'/filename if local_path.exists() or local_path.with_suffix(ext).exists(): return local_path elif archive: return Config.data_arc...
python
def datapath4file(filename, ext:str='.tgz', archive=True): "Return data path to `filename`, checking locally first then in the config file." local_path = URLs.LOCAL_PATH/'data'/filename if local_path.exists() or local_path.with_suffix(ext).exists(): return local_path elif archive: return Config.data_arc...
[ "def", "datapath4file", "(", "filename", ",", "ext", ":", "str", "=", "'.tgz'", ",", "archive", "=", "True", ")", ":", "local_path", "=", "URLs", ".", "LOCAL_PATH", "/", "'data'", "/", "filename", "if", "local_path", ".", "exists", "(", ")", "or", "loc...
Return data path to `filename`, checking locally first then in the config file.
[ "Return", "data", "path", "to", "filename", "checking", "locally", "first", "then", "in", "the", "config", "file", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L199-L204
train
fastai/fastai
fastai/datasets.py
download_data
def download_data(url:str, fname:PathOrStr=None, data:bool=True, ext:str='.tgz') -> Path: "Download `url` to destination `fname`." fname = Path(ifnone(fname, _url2tgz(url, data, ext=ext))) os.makedirs(fname.parent, exist_ok=True) if not fname.exists(): print(f'Downloading {url}') downloa...
python
def download_data(url:str, fname:PathOrStr=None, data:bool=True, ext:str='.tgz') -> Path: "Download `url` to destination `fname`." fname = Path(ifnone(fname, _url2tgz(url, data, ext=ext))) os.makedirs(fname.parent, exist_ok=True) if not fname.exists(): print(f'Downloading {url}') downloa...
[ "def", "download_data", "(", "url", ":", "str", ",", "fname", ":", "PathOrStr", "=", "None", ",", "data", ":", "bool", "=", "True", ",", "ext", ":", "str", "=", "'.tgz'", ")", "->", "Path", ":", "fname", "=", "Path", "(", "ifnone", "(", "fname", ...
Download `url` to destination `fname`.
[ "Download", "url", "to", "destination", "fname", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L206-L213
train
fastai/fastai
fastai/datasets.py
untar_data
def untar_data(url:str, fname:PathOrStr=None, dest:PathOrStr=None, data=True, force_download=False) -> Path: "Download `url` to `fname` if `dest` doesn't exist, and un-tgz to folder `dest`." dest = url2path(url, data) if dest is None else Path(dest)/url2name(url) fname = Path(ifnone(fname, _url2tgz(url, dat...
python
def untar_data(url:str, fname:PathOrStr=None, dest:PathOrStr=None, data=True, force_download=False) -> Path: "Download `url` to `fname` if `dest` doesn't exist, and un-tgz to folder `dest`." dest = url2path(url, data) if dest is None else Path(dest)/url2name(url) fname = Path(ifnone(fname, _url2tgz(url, dat...
[ "def", "untar_data", "(", "url", ":", "str", ",", "fname", ":", "PathOrStr", "=", "None", ",", "dest", ":", "PathOrStr", "=", "None", ",", "data", "=", "True", ",", "force_download", "=", "False", ")", "->", "Path", ":", "dest", "=", "url2path", "(",...
Download `url` to `fname` if `dest` doesn't exist, and un-tgz to folder `dest`.
[ "Download", "url", "to", "fname", "if", "dest", "doesn", "t", "exist", "and", "un", "-", "tgz", "to", "folder", "dest", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L221-L234
train
fastai/fastai
fastai/datasets.py
Config.get_key
def get_key(cls, key): "Get the path to `key` in the config file." return cls.get().get(key, cls.DEFAULT_CONFIG.get(key,None))
python
def get_key(cls, key): "Get the path to `key` in the config file." return cls.get().get(key, cls.DEFAULT_CONFIG.get(key,None))
[ "def", "get_key", "(", "cls", ",", "key", ")", ":", "return", "cls", ".", "get", "(", ")", ".", "get", "(", "key", ",", "cls", ".", "DEFAULT_CONFIG", ".", "get", "(", "key", ",", "None", ")", ")" ]
Get the path to `key` in the config file.
[ "Get", "the", "path", "to", "key", "in", "the", "config", "file", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L140-L142
train
fastai/fastai
fastai/datasets.py
Config.get
def get(cls, fpath=None, create_missing=True): "Retrieve the `Config` in `fpath`." fpath = _expand_path(fpath or cls.DEFAULT_CONFIG_PATH) if not fpath.exists() and create_missing: cls.create(fpath) assert fpath.exists(), f'Could not find config at: {fpath}. Please create' with op...
python
def get(cls, fpath=None, create_missing=True): "Retrieve the `Config` in `fpath`." fpath = _expand_path(fpath or cls.DEFAULT_CONFIG_PATH) if not fpath.exists() and create_missing: cls.create(fpath) assert fpath.exists(), f'Could not find config at: {fpath}. Please create' with op...
[ "def", "get", "(", "cls", ",", "fpath", "=", "None", ",", "create_missing", "=", "True", ")", ":", "fpath", "=", "_expand_path", "(", "fpath", "or", "cls", ".", "DEFAULT_CONFIG_PATH", ")", "if", "not", "fpath", ".", "exists", "(", ")", "and", "create_m...
Retrieve the `Config` in `fpath`.
[ "Retrieve", "the", "Config", "in", "fpath", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L165-L170
train
fastai/fastai
fastai/datasets.py
Config.create
def create(cls, fpath): "Creates a `Config` from `fpath`." fpath = _expand_path(fpath) assert(fpath.suffix == '.yml') if fpath.exists(): return fpath.parent.mkdir(parents=True, exist_ok=True) with open(fpath, 'w') as yaml_file: yaml.dump(cls.DEFAULT_CONFIG, ya...
python
def create(cls, fpath): "Creates a `Config` from `fpath`." fpath = _expand_path(fpath) assert(fpath.suffix == '.yml') if fpath.exists(): return fpath.parent.mkdir(parents=True, exist_ok=True) with open(fpath, 'w') as yaml_file: yaml.dump(cls.DEFAULT_CONFIG, ya...
[ "def", "create", "(", "cls", ",", "fpath", ")", ":", "fpath", "=", "_expand_path", "(", "fpath", ")", "assert", "(", "fpath", ".", "suffix", "==", "'.yml'", ")", "if", "fpath", ".", "exists", "(", ")", ":", "return", "fpath", ".", "parent", ".", "m...
Creates a `Config` from `fpath`.
[ "Creates", "a", "Config", "from", "fpath", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/datasets.py#L173-L180
train
fastai/fastai
fastai/callbacks/mixup.py
MixUpCallback.on_batch_begin
def on_batch_begin(self, last_input, last_target, train, **kwargs): "Applies mixup to `last_input` and `last_target` if `train`." if not train: return lambd = np.random.beta(self.alpha, self.alpha, last_target.size(0)) lambd = np.concatenate([lambd[:,None], 1-lambd[:,None]], 1).max(1) ...
python
def on_batch_begin(self, last_input, last_target, train, **kwargs): "Applies mixup to `last_input` and `last_target` if `train`." if not train: return lambd = np.random.beta(self.alpha, self.alpha, last_target.size(0)) lambd = np.concatenate([lambd[:,None], 1-lambd[:,None]], 1).max(1) ...
[ "def", "on_batch_begin", "(", "self", ",", "last_input", ",", "last_target", ",", "train", ",", "*", "*", "kwargs", ")", ":", "if", "not", "train", ":", "return", "lambd", "=", "np", ".", "random", ".", "beta", "(", "self", ".", "alpha", ",", "self",...
Applies mixup to `last_input` and `last_target` if `train`.
[ "Applies", "mixup", "to", "last_input", "and", "last_target", "if", "train", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/callbacks/mixup.py#L15-L33
train
fastai/fastai
fastai/tabular/transform.py
make_date
def make_date(df:DataFrame, date_field:str): "Make sure `df[field_name]` is of the right date type." field_dtype = df[date_field].dtype if isinstance(field_dtype, pd.core.dtypes.dtypes.DatetimeTZDtype): field_dtype = np.datetime64 if not np.issubdtype(field_dtype, np.datetime64): df[date...
python
def make_date(df:DataFrame, date_field:str): "Make sure `df[field_name]` is of the right date type." field_dtype = df[date_field].dtype if isinstance(field_dtype, pd.core.dtypes.dtypes.DatetimeTZDtype): field_dtype = np.datetime64 if not np.issubdtype(field_dtype, np.datetime64): df[date...
[ "def", "make_date", "(", "df", ":", "DataFrame", ",", "date_field", ":", "str", ")", ":", "field_dtype", "=", "df", "[", "date_field", "]", ".", "dtype", "if", "isinstance", "(", "field_dtype", ",", "pd", ".", "core", ".", "dtypes", ".", "dtypes", ".",...
Make sure `df[field_name]` is of the right date type.
[ "Make", "sure", "df", "[", "field_name", "]", "is", "of", "the", "right", "date", "type", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L10-L16
train
fastai/fastai
fastai/tabular/transform.py
cyclic_dt_feat_names
def cyclic_dt_feat_names(time:bool=True, add_linear:bool=False)->List[str]: "Return feature names of date/time cycles as produced by `cyclic_dt_features`." fs = ['cos','sin'] attr = [f'{r}_{f}' for r in 'weekday day_month month_year day_year'.split() for f in fs] if time: attr += [f'{r}_{f}' for r in 'h...
python
def cyclic_dt_feat_names(time:bool=True, add_linear:bool=False)->List[str]: "Return feature names of date/time cycles as produced by `cyclic_dt_features`." fs = ['cos','sin'] attr = [f'{r}_{f}' for r in 'weekday day_month month_year day_year'.split() for f in fs] if time: attr += [f'{r}_{f}' for r in 'h...
[ "def", "cyclic_dt_feat_names", "(", "time", ":", "bool", "=", "True", ",", "add_linear", ":", "bool", "=", "False", ")", "->", "List", "[", "str", "]", ":", "fs", "=", "[", "'cos'", ",", "'sin'", "]", "attr", "=", "[", "f'{r}_{f}'", "for", "r", "in...
Return feature names of date/time cycles as produced by `cyclic_dt_features`.
[ "Return", "feature", "names", "of", "date", "/", "time", "cycles", "as", "produced", "by", "cyclic_dt_features", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L18-L24
train
fastai/fastai
fastai/tabular/transform.py
cyclic_dt_features
def cyclic_dt_features(d:Union[date,datetime], time:bool=True, add_linear:bool=False)->List[float]: "Calculate the cos and sin of date/time cycles." tt,fs = d.timetuple(), [np.cos, np.sin] day_year,days_month = tt.tm_yday, calendar.monthrange(d.year, d.month)[1] days_year = 366 if calendar.isleap(d.year...
python
def cyclic_dt_features(d:Union[date,datetime], time:bool=True, add_linear:bool=False)->List[float]: "Calculate the cos and sin of date/time cycles." tt,fs = d.timetuple(), [np.cos, np.sin] day_year,days_month = tt.tm_yday, calendar.monthrange(d.year, d.month)[1] days_year = 366 if calendar.isleap(d.year...
[ "def", "cyclic_dt_features", "(", "d", ":", "Union", "[", "date", ",", "datetime", "]", ",", "time", ":", "bool", "=", "True", ",", "add_linear", ":", "bool", "=", "False", ")", "->", "List", "[", "float", "]", ":", "tt", ",", "fs", "=", "d", "."...
Calculate the cos and sin of date/time cycles.
[ "Calculate", "the", "cos", "and", "sin", "of", "date", "/", "time", "cycles", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L26-L41
train
fastai/fastai
fastai/tabular/transform.py
add_cyclic_datepart
def add_cyclic_datepart(df:DataFrame, field_name:str, prefix:str=None, drop:bool=True, time:bool=False, add_linear:bool=False): "Helper function that adds trigonometric date/time features to a date in the column `field_name` of `df`." make_date(df, field_name) field = df[field_name] prefix = ifnone(pref...
python
def add_cyclic_datepart(df:DataFrame, field_name:str, prefix:str=None, drop:bool=True, time:bool=False, add_linear:bool=False): "Helper function that adds trigonometric date/time features to a date in the column `field_name` of `df`." make_date(df, field_name) field = df[field_name] prefix = ifnone(pref...
[ "def", "add_cyclic_datepart", "(", "df", ":", "DataFrame", ",", "field_name", ":", "str", ",", "prefix", ":", "str", "=", "None", ",", "drop", ":", "bool", "=", "True", ",", "time", ":", "bool", "=", "False", ",", "add_linear", ":", "bool", "=", "Fal...
Helper function that adds trigonometric date/time features to a date in the column `field_name` of `df`.
[ "Helper", "function", "that", "adds", "trigonometric", "date", "/", "time", "features", "to", "a", "date", "in", "the", "column", "field_name", "of", "df", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L43-L53
train
fastai/fastai
fastai/tabular/transform.py
add_datepart
def add_datepart(df:DataFrame, field_name:str, prefix:str=None, drop:bool=True, time:bool=False): "Helper function that adds columns relevant to a date in the column `field_name` of `df`." make_date(df, field_name) field = df[field_name] prefix = ifnone(prefix, re.sub('[Dd]ate$', '', field_name)) at...
python
def add_datepart(df:DataFrame, field_name:str, prefix:str=None, drop:bool=True, time:bool=False): "Helper function that adds columns relevant to a date in the column `field_name` of `df`." make_date(df, field_name) field = df[field_name] prefix = ifnone(prefix, re.sub('[Dd]ate$', '', field_name)) at...
[ "def", "add_datepart", "(", "df", ":", "DataFrame", ",", "field_name", ":", "str", ",", "prefix", ":", "str", "=", "None", ",", "drop", ":", "bool", "=", "True", ",", "time", ":", "bool", "=", "False", ")", ":", "make_date", "(", "df", ",", "field_...
Helper function that adds columns relevant to a date in the column `field_name` of `df`.
[ "Helper", "function", "that", "adds", "columns", "relevant", "to", "a", "date", "in", "the", "column", "field_name", "of", "df", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L55-L66
train
fastai/fastai
fastai/tabular/transform.py
cont_cat_split
def cont_cat_split(df, max_card=20, dep_var=None)->Tuple[List,List]: "Helper function that returns column names of cont and cat variables from given df." cont_names, cat_names = [], [] for label in df: if label == dep_var: continue if df[label].dtype == int and df[label].unique().shape[0] > ...
python
def cont_cat_split(df, max_card=20, dep_var=None)->Tuple[List,List]: "Helper function that returns column names of cont and cat variables from given df." cont_names, cat_names = [], [] for label in df: if label == dep_var: continue if df[label].dtype == int and df[label].unique().shape[0] > ...
[ "def", "cont_cat_split", "(", "df", ",", "max_card", "=", "20", ",", "dep_var", "=", "None", ")", "->", "Tuple", "[", "List", ",", "List", "]", ":", "cont_names", ",", "cat_names", "=", "[", "]", ",", "[", "]", "for", "label", "in", "df", ":", "i...
Helper function that returns column names of cont and cat variables from given df.
[ "Helper", "function", "that", "returns", "column", "names", "of", "cont", "and", "cat", "variables", "from", "given", "df", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L106-L113
train
fastai/fastai
fastai/tabular/transform.py
Categorify.apply_train
def apply_train(self, df:DataFrame): "Transform `self.cat_names` columns in categorical." self.categories = {} for n in self.cat_names: df.loc[:,n] = df.loc[:,n].astype('category').cat.as_ordered() self.categories[n] = df[n].cat.categories
python
def apply_train(self, df:DataFrame): "Transform `self.cat_names` columns in categorical." self.categories = {} for n in self.cat_names: df.loc[:,n] = df.loc[:,n].astype('category').cat.as_ordered() self.categories[n] = df[n].cat.categories
[ "def", "apply_train", "(", "self", ",", "df", ":", "DataFrame", ")", ":", "self", ".", "categories", "=", "{", "}", "for", "n", "in", "self", ".", "cat_names", ":", "df", ".", "loc", "[", ":", ",", "n", "]", "=", "df", ".", "loc", "[", ":", "...
Transform `self.cat_names` columns in categorical.
[ "Transform", "self", ".", "cat_names", "columns", "in", "categorical", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L135-L140
train
fastai/fastai
fastai/tabular/transform.py
Normalize.apply_train
def apply_train(self, df:DataFrame): "Compute the means and stds of `self.cont_names` columns to normalize them." self.means,self.stds = {},{} for n in self.cont_names: assert is_numeric_dtype(df[n]), (f"""Cannot normalize '{n}' column as it isn't numerical. Are you s...
python
def apply_train(self, df:DataFrame): "Compute the means and stds of `self.cont_names` columns to normalize them." self.means,self.stds = {},{} for n in self.cont_names: assert is_numeric_dtype(df[n]), (f"""Cannot normalize '{n}' column as it isn't numerical. Are you s...
[ "def", "apply_train", "(", "self", ",", "df", ":", "DataFrame", ")", ":", "self", ".", "means", ",", "self", ".", "stds", "=", "{", "}", ",", "{", "}", "for", "n", "in", "self", ".", "cont_names", ":", "assert", "is_numeric_dtype", "(", "df", "[", ...
Compute the means and stds of `self.cont_names` columns to normalize them.
[ "Compute", "the", "means", "and", "stds", "of", "self", ".", "cont_names", "columns", "to", "normalize", "them", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/transform.py#L183-L190
train
fastai/fastai
fastai/tabular/data.py
def_emb_sz
def def_emb_sz(classes, n, sz_dict=None): "Pick an embedding size for `n` depending on `classes` if not given in `sz_dict`." sz_dict = ifnone(sz_dict, {}) n_cat = len(classes[n]) sz = sz_dict.get(n, int(emb_sz_rule(n_cat))) # rule of thumb return n_cat,sz
python
def def_emb_sz(classes, n, sz_dict=None): "Pick an embedding size for `n` depending on `classes` if not given in `sz_dict`." sz_dict = ifnone(sz_dict, {}) n_cat = len(classes[n]) sz = sz_dict.get(n, int(emb_sz_rule(n_cat))) # rule of thumb return n_cat,sz
[ "def", "def_emb_sz", "(", "classes", ",", "n", ",", "sz_dict", "=", "None", ")", ":", "sz_dict", "=", "ifnone", "(", "sz_dict", ",", "{", "}", ")", "n_cat", "=", "len", "(", "classes", "[", "n", "]", ")", "sz", "=", "sz_dict", ".", "get", "(", ...
Pick an embedding size for `n` depending on `classes` if not given in `sz_dict`.
[ "Pick", "an", "embedding", "size", "for", "n", "depending", "on", "classes", "if", "not", "given", "in", "sz_dict", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L17-L22
train
fastai/fastai
fastai/tabular/data.py
tabular_learner
def tabular_learner(data:DataBunch, layers:Collection[int], emb_szs:Dict[str,int]=None, metrics=None, ps:Collection[float]=None, emb_drop:float=0., y_range:OptRange=None, use_bn:bool=True, **learn_kwargs): "Get a `Learner` using `data`, with `metrics`, including a `TabularModel` created using the remaining ...
python
def tabular_learner(data:DataBunch, layers:Collection[int], emb_szs:Dict[str,int]=None, metrics=None, ps:Collection[float]=None, emb_drop:float=0., y_range:OptRange=None, use_bn:bool=True, **learn_kwargs): "Get a `Learner` using `data`, with `metrics`, including a `TabularModel` created using the remaining ...
[ "def", "tabular_learner", "(", "data", ":", "DataBunch", ",", "layers", ":", "Collection", "[", "int", "]", ",", "emb_szs", ":", "Dict", "[", "str", ",", "int", "]", "=", "None", ",", "metrics", "=", "None", ",", "ps", ":", "Collection", "[", "float"...
Get a `Learner` using `data`, with `metrics`, including a `TabularModel` created using the remaining params.
[ "Get", "a", "Learner", "using", "data", "with", "metrics", "including", "a", "TabularModel", "created", "using", "the", "remaining", "params", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L170-L176
train
fastai/fastai
fastai/tabular/data.py
TabularDataBunch.from_df
def from_df(cls, path, df:DataFrame, dep_var:str, valid_idx:Collection[int], procs:OptTabTfms=None, cat_names:OptStrList=None, cont_names:OptStrList=None, classes:Collection=None, test_df=None, bs:int=64, val_bs:int=None, num_workers:int=defaults.cpus, dl_tfms:Optional[Collection[Callab...
python
def from_df(cls, path, df:DataFrame, dep_var:str, valid_idx:Collection[int], procs:OptTabTfms=None, cat_names:OptStrList=None, cont_names:OptStrList=None, classes:Collection=None, test_df=None, bs:int=64, val_bs:int=None, num_workers:int=defaults.cpus, dl_tfms:Optional[Collection[Callab...
[ "def", "from_df", "(", "cls", ",", "path", ",", "df", ":", "DataFrame", ",", "dep_var", ":", "str", ",", "valid_idx", ":", "Collection", "[", "int", "]", ",", "procs", ":", "OptTabTfms", "=", "None", ",", "cat_names", ":", "OptStrList", "=", "None", ...
Create a `DataBunch` from `df` and `valid_idx` with `dep_var`. `kwargs` are passed to `DataBunch.create`.
[ "Create", "a", "DataBunch", "from", "df", "and", "valid_idx", "with", "dep_var", ".", "kwargs", "are", "passed", "to", "DataBunch", ".", "create", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L87-L101
train
fastai/fastai
fastai/tabular/data.py
TabularList.from_df
def from_df(cls, df:DataFrame, cat_names:OptStrList=None, cont_names:OptStrList=None, procs=None, **kwargs)->'ItemList': "Get the list of inputs in the `col` of `path/csv_name`." return cls(items=range(len(df)), cat_names=cat_names, cont_names=cont_names, procs=procs, inner_df=df.copy(), **kwargs)
python
def from_df(cls, df:DataFrame, cat_names:OptStrList=None, cont_names:OptStrList=None, procs=None, **kwargs)->'ItemList': "Get the list of inputs in the `col` of `path/csv_name`." return cls(items=range(len(df)), cat_names=cat_names, cont_names=cont_names, procs=procs, inner_df=df.copy(), **kwargs)
[ "def", "from_df", "(", "cls", ",", "df", ":", "DataFrame", ",", "cat_names", ":", "OptStrList", "=", "None", ",", "cont_names", ":", "OptStrList", "=", "None", ",", "procs", "=", "None", ",", "*", "*", "kwargs", ")", "->", "'ItemList'", ":", "return", ...
Get the list of inputs in the `col` of `path/csv_name`.
[ "Get", "the", "list", "of", "inputs", "in", "the", "col", "of", "path", "/", "csv_name", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L119-L121
train
fastai/fastai
fastai/tabular/data.py
TabularList.get_emb_szs
def get_emb_szs(self, sz_dict=None): "Return the default embedding sizes suitable for this data or takes the ones in `sz_dict`." return [def_emb_sz(self.classes, n, sz_dict) for n in self.cat_names]
python
def get_emb_szs(self, sz_dict=None): "Return the default embedding sizes suitable for this data or takes the ones in `sz_dict`." return [def_emb_sz(self.classes, n, sz_dict) for n in self.cat_names]
[ "def", "get_emb_szs", "(", "self", ",", "sz_dict", "=", "None", ")", ":", "return", "[", "def_emb_sz", "(", "self", ".", "classes", ",", "n", ",", "sz_dict", ")", "for", "n", "in", "self", ".", "cat_names", "]" ]
Return the default embedding sizes suitable for this data or takes the ones in `sz_dict`.
[ "Return", "the", "default", "embedding", "sizes", "suitable", "for", "this", "data", "or", "takes", "the", "ones", "in", "sz_dict", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L129-L131
train
fastai/fastai
fastai/tabular/data.py
TabularList.show_xys
def show_xys(self, xs, ys)->None: "Show the `xs` (inputs) and `ys` (targets)." from IPython.display import display, HTML items,names = [], xs[0].names + ['target'] for i, (x,y) in enumerate(zip(xs,ys)): res = [] cats = x.cats if len(x.cats.size()) > 0 else [] ...
python
def show_xys(self, xs, ys)->None: "Show the `xs` (inputs) and `ys` (targets)." from IPython.display import display, HTML items,names = [], xs[0].names + ['target'] for i, (x,y) in enumerate(zip(xs,ys)): res = [] cats = x.cats if len(x.cats.size()) > 0 else [] ...
[ "def", "show_xys", "(", "self", ",", "xs", ",", "ys", ")", "->", "None", ":", "from", "IPython", ".", "display", "import", "display", ",", "HTML", "items", ",", "names", "=", "[", "]", ",", "xs", "[", "0", "]", ".", "names", "+", "[", "'target'",...
Show the `xs` (inputs) and `ys` (targets).
[ "Show", "the", "xs", "(", "inputs", ")", "and", "ys", "(", "targets", ")", "." ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/fastai/tabular/data.py#L136-L151
train
fastai/fastai
courses/dl2/imdb_scripts/predict_with_classifier.py
load_model
def load_model(itos_filename, classifier_filename, num_classes): """Load the classifier and int to string mapping Args: itos_filename (str): The filename of the int to string mapping file (usually called itos.pkl) classifier_filename (str): The filename of the trained classifier Returns: ...
python
def load_model(itos_filename, classifier_filename, num_classes): """Load the classifier and int to string mapping Args: itos_filename (str): The filename of the int to string mapping file (usually called itos.pkl) classifier_filename (str): The filename of the trained classifier Returns: ...
[ "def", "load_model", "(", "itos_filename", ",", "classifier_filename", ",", "num_classes", ")", ":", "# load the int to string mapping file", "itos", "=", "pickle", ".", "load", "(", "Path", "(", "itos_filename", ")", ".", "open", "(", "'rb'", ")", ")", "# turn ...
Load the classifier and int to string mapping Args: itos_filename (str): The filename of the int to string mapping file (usually called itos.pkl) classifier_filename (str): The filename of the trained classifier Returns: string to int mapping, trained classifer model
[ "Load", "the", "classifier", "and", "int", "to", "string", "mapping" ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/courses/dl2/imdb_scripts/predict_with_classifier.py#L6-L38
train
fastai/fastai
courses/dl2/imdb_scripts/predict_with_classifier.py
softmax
def softmax(x): ''' Numpy Softmax, via comments on https://gist.github.com/stober/1946926 >>> res = softmax(np.array([0, 200, 10])) >>> np.sum(res) 1.0 >>> np.all(np.abs(res - np.array([0, 1, 0])) < 0.0001) True >>> res = softmax(np.array([[0, 200, 10], [0, 10, 200], [200, 0, 10]])) ...
python
def softmax(x): ''' Numpy Softmax, via comments on https://gist.github.com/stober/1946926 >>> res = softmax(np.array([0, 200, 10])) >>> np.sum(res) 1.0 >>> np.all(np.abs(res - np.array([0, 1, 0])) < 0.0001) True >>> res = softmax(np.array([[0, 200, 10], [0, 10, 200], [200, 0, 10]])) ...
[ "def", "softmax", "(", "x", ")", ":", "if", "x", ".", "ndim", "==", "1", ":", "x", "=", "x", ".", "reshape", "(", "(", "1", ",", "-", "1", ")", ")", "max_x", "=", "np", ".", "max", "(", "x", ",", "axis", "=", "1", ")", ".", "reshape", "...
Numpy Softmax, via comments on https://gist.github.com/stober/1946926 >>> res = softmax(np.array([0, 200, 10])) >>> np.sum(res) 1.0 >>> np.all(np.abs(res - np.array([0, 1, 0])) < 0.0001) True >>> res = softmax(np.array([[0, 200, 10], [0, 10, 200], [200, 0, 10]])) >>> np.sum(res, axis=1) ...
[ "Numpy", "Softmax", "via", "comments", "on", "https", ":", "//", "gist", ".", "github", ".", "com", "/", "stober", "/", "1946926" ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/courses/dl2/imdb_scripts/predict_with_classifier.py#L41-L61
train
fastai/fastai
courses/dl2/imdb_scripts/predict_with_classifier.py
predict_text
def predict_text(stoi, model, text): """Do the actual prediction on the text using the model and mapping files passed """ # prefix text with tokens: # xbos: beginning of sentence # xfld 1: we are using a single field here input_str = 'xbos xfld 1 ' + text # predictions are done...
python
def predict_text(stoi, model, text): """Do the actual prediction on the text using the model and mapping files passed """ # prefix text with tokens: # xbos: beginning of sentence # xfld 1: we are using a single field here input_str = 'xbos xfld 1 ' + text # predictions are done...
[ "def", "predict_text", "(", "stoi", ",", "model", ",", "text", ")", ":", "# prefix text with tokens:", "# xbos: beginning of sentence", "# xfld 1: we are using a single field here", "input_str", "=", "'xbos xfld 1 '", "+", "text", "# predictions are done on arrays of input.",...
Do the actual prediction on the text using the model and mapping files passed
[ "Do", "the", "actual", "prediction", "on", "the", "text", "using", "the", "model", "and", "mapping", "files", "passed" ]
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/courses/dl2/imdb_scripts/predict_with_classifier.py#L64-L100
train
fastai/fastai
courses/dl2/imdb_scripts/predict_with_classifier.py
predict_input
def predict_input(itos_filename, trained_classifier_filename, num_classes=2): """ Loads a model and produces predictions on arbitrary input. :param itos_filename: the path to the id-to-string mapping file :param trained_classifier_filename: the filename of the trained classifier; ...
python
def predict_input(itos_filename, trained_classifier_filename, num_classes=2): """ Loads a model and produces predictions on arbitrary input. :param itos_filename: the path to the id-to-string mapping file :param trained_classifier_filename: the filename of the trained classifier; ...
[ "def", "predict_input", "(", "itos_filename", ",", "trained_classifier_filename", ",", "num_classes", "=", "2", ")", ":", "# Check the itos file exists", "if", "not", "os", ".", "path", ".", "exists", "(", "itos_filename", ")", ":", "print", "(", "\"Could not find...
Loads a model and produces predictions on arbitrary input. :param itos_filename: the path to the id-to-string mapping file :param trained_classifier_filename: the filename of the trained classifier; typically ends with "clas_1.h5" :param num_classes: the number of cla...
[ "Loads", "a", "model", "and", "produces", "predictions", "on", "arbitrary", "input", ".", ":", "param", "itos_filename", ":", "the", "path", "to", "the", "id", "-", "to", "-", "string", "mapping", "file", ":", "param", "trained_classifier_filename", ":", "th...
9fb84a5cdefe5a766cdb792b8f5d8971737b7e67
https://github.com/fastai/fastai/blob/9fb84a5cdefe5a766cdb792b8f5d8971737b7e67/courses/dl2/imdb_scripts/predict_with_classifier.py#L103-L129
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
_make_w3c_caps
def _make_w3c_caps(caps): """Makes a W3C alwaysMatch capabilities object. Filters out capability names that are not in the W3C spec. Spec-compliant drivers will reject requests containing unknown capability names. Moves the Firefox profile, if present, from the old location to the new Firefox opti...
python
def _make_w3c_caps(caps): """Makes a W3C alwaysMatch capabilities object. Filters out capability names that are not in the W3C spec. Spec-compliant drivers will reject requests containing unknown capability names. Moves the Firefox profile, if present, from the old location to the new Firefox opti...
[ "def", "_make_w3c_caps", "(", "caps", ")", ":", "caps", "=", "copy", ".", "deepcopy", "(", "caps", ")", "profile", "=", "caps", ".", "get", "(", "'firefox_profile'", ")", "always_match", "=", "{", "}", "if", "caps", ".", "get", "(", "'proxy'", ")", "...
Makes a W3C alwaysMatch capabilities object. Filters out capability names that are not in the W3C spec. Spec-compliant drivers will reject requests containing unknown capability names. Moves the Firefox profile, if present, from the old location to the new Firefox options object. :Args: - ca...
[ "Makes", "a", "W3C", "alwaysMatch", "capabilities", "object", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L65-L95
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.file_detector_context
def file_detector_context(self, file_detector_class, *args, **kwargs): """ Overrides the current file detector (if necessary) in limited context. Ensures the original file detector is set afterwards. Example: with webdriver.file_detector_context(UselessFileDetector): ...
python
def file_detector_context(self, file_detector_class, *args, **kwargs): """ Overrides the current file detector (if necessary) in limited context. Ensures the original file detector is set afterwards. Example: with webdriver.file_detector_context(UselessFileDetector): ...
[ "def", "file_detector_context", "(", "self", ",", "file_detector_class", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "last_detector", "=", "None", "if", "not", "isinstance", "(", "self", ".", "file_detector", ",", "file_detector_class", ")", ":", "l...
Overrides the current file detector (if necessary) in limited context. Ensures the original file detector is set afterwards. Example: with webdriver.file_detector_context(UselessFileDetector): someinput.send_keys('/etc/hosts') :Args: - file_detector_class - Class ...
[ "Overrides", "the", "current", "file", "detector", "(", "if", "necessary", ")", "in", "limited", "context", ".", "Ensures", "the", "original", "file", "detector", "is", "set", "afterwards", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L168-L194
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.start_session
def start_session(self, capabilities, browser_profile=None): """ Creates a new session with the desired capabilities. :Args: - browser_name - The name of the browser to request. - version - Which browser version to request. - platform - Which platform to request the b...
python
def start_session(self, capabilities, browser_profile=None): """ Creates a new session with the desired capabilities. :Args: - browser_name - The name of the browser to request. - version - Which browser version to request. - platform - Which platform to request the b...
[ "def", "start_session", "(", "self", ",", "capabilities", ",", "browser_profile", "=", "None", ")", ":", "if", "not", "isinstance", "(", "capabilities", ",", "dict", ")", ":", "raise", "InvalidArgumentException", "(", "\"Capabilities must be a dictionary\"", ")", ...
Creates a new session with the desired capabilities. :Args: - browser_name - The name of the browser to request. - version - Which browser version to request. - platform - Which platform to request the browser on. - javascript_enabled - Whether the new session should support...
[ "Creates", "a", "new", "session", "with", "the", "desired", "capabilities", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L228-L262
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.create_web_element
def create_web_element(self, element_id): """Creates a web element with the specified `element_id`.""" return self._web_element_cls(self, element_id, w3c=self.w3c)
python
def create_web_element(self, element_id): """Creates a web element with the specified `element_id`.""" return self._web_element_cls(self, element_id, w3c=self.w3c)
[ "def", "create_web_element", "(", "self", ",", "element_id", ")", ":", "return", "self", ".", "_web_element_cls", "(", "self", ",", "element_id", ",", "w3c", "=", "self", ".", "w3c", ")" ]
Creates a web element with the specified `element_id`.
[ "Creates", "a", "web", "element", "with", "the", "specified", "element_id", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L277-L279
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.execute
def execute(self, driver_command, params=None): """ Sends a command to be executed by a command.CommandExecutor. :Args: - driver_command: The name of the command to execute as a string. - params: A dictionary of named parameters to send with the command. :Returns: ...
python
def execute(self, driver_command, params=None): """ Sends a command to be executed by a command.CommandExecutor. :Args: - driver_command: The name of the command to execute as a string. - params: A dictionary of named parameters to send with the command. :Returns: ...
[ "def", "execute", "(", "self", ",", "driver_command", ",", "params", "=", "None", ")", ":", "if", "self", ".", "session_id", "is", "not", "None", ":", "if", "not", "params", ":", "params", "=", "{", "'sessionId'", ":", "self", ".", "session_id", "}", ...
Sends a command to be executed by a command.CommandExecutor. :Args: - driver_command: The name of the command to execute as a string. - params: A dictionary of named parameters to send with the command. :Returns: The command's JSON response loaded into a dictionary object.
[ "Sends", "a", "command", "to", "be", "executed", "by", "a", "command", ".", "CommandExecutor", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L298-L324
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element_by_id
def find_element_by_id(self, id_): """Finds an element by id. :Args: - id\\_ - The id of the element to be found. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: ...
python
def find_element_by_id(self, id_): """Finds an element by id. :Args: - id\\_ - The id of the element to be found. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: ...
[ "def", "find_element_by_id", "(", "self", ",", "id_", ")", ":", "return", "self", ".", "find_element", "(", "by", "=", "By", ".", "ID", ",", "value", "=", "id_", ")" ]
Finds an element by id. :Args: - id\\_ - The id of the element to be found. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: :: element = driver.find_el...
[ "Finds", "an", "element", "by", "id", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L344-L361
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_elements_by_id
def find_elements_by_id(self, id_): """ Finds multiple elements by id. :Args: - id\\_ - The id of the elements to be found. :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: :: ...
python
def find_elements_by_id(self, id_): """ Finds multiple elements by id. :Args: - id\\_ - The id of the elements to be found. :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: :: ...
[ "def", "find_elements_by_id", "(", "self", ",", "id_", ")", ":", "return", "self", ".", "find_elements", "(", "by", "=", "By", ".", "ID", ",", "value", "=", "id_", ")" ]
Finds multiple elements by id. :Args: - id\\_ - The id of the elements to be found. :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: :: elements = driver.find_elements_by_id('foo')
[ "Finds", "multiple", "elements", "by", "id", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L363-L379
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element_by_xpath
def find_element_by_xpath(self, xpath): """ Finds an element by xpath. :Args: - xpath - The xpath locator of the element to find. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found ...
python
def find_element_by_xpath(self, xpath): """ Finds an element by xpath. :Args: - xpath - The xpath locator of the element to find. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found ...
[ "def", "find_element_by_xpath", "(", "self", ",", "xpath", ")", ":", "return", "self", ".", "find_element", "(", "by", "=", "By", ".", "XPATH", ",", "value", "=", "xpath", ")" ]
Finds an element by xpath. :Args: - xpath - The xpath locator of the element to find. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: :: element = driv...
[ "Finds", "an", "element", "by", "xpath", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L381-L399
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_elements_by_xpath
def find_elements_by_xpath(self, xpath): """ Finds multiple elements by xpath. :Args: - xpath - The xpath locator of the elements to be found. :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: ...
python
def find_elements_by_xpath(self, xpath): """ Finds multiple elements by xpath. :Args: - xpath - The xpath locator of the elements to be found. :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: ...
[ "def", "find_elements_by_xpath", "(", "self", ",", "xpath", ")", ":", "return", "self", ".", "find_elements", "(", "by", "=", "By", ".", "XPATH", ",", "value", "=", "xpath", ")" ]
Finds multiple elements by xpath. :Args: - xpath - The xpath locator of the elements to be found. :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: :: elements = driver.find_elements_...
[ "Finds", "multiple", "elements", "by", "xpath", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L401-L417
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element_by_link_text
def find_element_by_link_text(self, link_text): """ Finds an element by link text. :Args: - link_text: The text of the element to be found. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't...
python
def find_element_by_link_text(self, link_text): """ Finds an element by link text. :Args: - link_text: The text of the element to be found. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't...
[ "def", "find_element_by_link_text", "(", "self", ",", "link_text", ")", ":", "return", "self", ".", "find_element", "(", "by", "=", "By", ".", "LINK_TEXT", ",", "value", "=", "link_text", ")" ]
Finds an element by link text. :Args: - link_text: The text of the element to be found. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: :: element = dr...
[ "Finds", "an", "element", "by", "link", "text", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L419-L437
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_elements_by_link_text
def find_elements_by_link_text(self, text): """ Finds elements by link text. :Args: - link_text: The text of the elements to be found. :Returns: - list of webelement - a list with elements if any was found. an empty list if not :Usage: ...
python
def find_elements_by_link_text(self, text): """ Finds elements by link text. :Args: - link_text: The text of the elements to be found. :Returns: - list of webelement - a list with elements if any was found. an empty list if not :Usage: ...
[ "def", "find_elements_by_link_text", "(", "self", ",", "text", ")", ":", "return", "self", ".", "find_elements", "(", "by", "=", "By", ".", "LINK_TEXT", ",", "value", "=", "text", ")" ]
Finds elements by link text. :Args: - link_text: The text of the elements to be found. :Returns: - list of webelement - a list with elements if any was found. an empty list if not :Usage: :: elements = driver.find_elements_by_link_tex...
[ "Finds", "elements", "by", "link", "text", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L439-L455
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element_by_partial_link_text
def find_element_by_partial_link_text(self, link_text): """ Finds an element by a partial match of its link text. :Args: - link_text: The text of the element to partially match on. :Returns: - WebElement - the element if it was found :Raises: - NoSuc...
python
def find_element_by_partial_link_text(self, link_text): """ Finds an element by a partial match of its link text. :Args: - link_text: The text of the element to partially match on. :Returns: - WebElement - the element if it was found :Raises: - NoSuc...
[ "def", "find_element_by_partial_link_text", "(", "self", ",", "link_text", ")", ":", "return", "self", ".", "find_element", "(", "by", "=", "By", ".", "PARTIAL_LINK_TEXT", ",", "value", "=", "link_text", ")" ]
Finds an element by a partial match of its link text. :Args: - link_text: The text of the element to partially match on. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: ...
[ "Finds", "an", "element", "by", "a", "partial", "match", "of", "its", "link", "text", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L457-L475
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_elements_by_partial_link_text
def find_elements_by_partial_link_text(self, link_text): """ Finds elements by a partial match of their link text. :Args: - link_text: The text of the element to partial match on. :Returns: - list of webelement - a list with elements if any was found. an e...
python
def find_elements_by_partial_link_text(self, link_text): """ Finds elements by a partial match of their link text. :Args: - link_text: The text of the element to partial match on. :Returns: - list of webelement - a list with elements if any was found. an e...
[ "def", "find_elements_by_partial_link_text", "(", "self", ",", "link_text", ")", ":", "return", "self", ".", "find_elements", "(", "by", "=", "By", ".", "PARTIAL_LINK_TEXT", ",", "value", "=", "link_text", ")" ]
Finds elements by a partial match of their link text. :Args: - link_text: The text of the element to partial match on. :Returns: - list of webelement - a list with elements if any was found. an empty list if not :Usage: :: elements = ...
[ "Finds", "elements", "by", "a", "partial", "match", "of", "their", "link", "text", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L477-L493
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element_by_name
def find_element_by_name(self, name): """ Finds an element by name. :Args: - name: The name of the element to find. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: ...
python
def find_element_by_name(self, name): """ Finds an element by name. :Args: - name: The name of the element to find. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: ...
[ "def", "find_element_by_name", "(", "self", ",", "name", ")", ":", "return", "self", ".", "find_element", "(", "by", "=", "By", ".", "NAME", ",", "value", "=", "name", ")" ]
Finds an element by name. :Args: - name: The name of the element to find. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: :: element = driver.find_elem...
[ "Finds", "an", "element", "by", "name", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L495-L513
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_elements_by_name
def find_elements_by_name(self, name): """ Finds elements by name. :Args: - name: The name of the elements to find. :Returns: - list of webelement - a list with elements if any was found. an empty list if not :Usage: :: ...
python
def find_elements_by_name(self, name): """ Finds elements by name. :Args: - name: The name of the elements to find. :Returns: - list of webelement - a list with elements if any was found. an empty list if not :Usage: :: ...
[ "def", "find_elements_by_name", "(", "self", ",", "name", ")", ":", "return", "self", ".", "find_elements", "(", "by", "=", "By", ".", "NAME", ",", "value", "=", "name", ")" ]
Finds elements by name. :Args: - name: The name of the elements to find. :Returns: - list of webelement - a list with elements if any was found. an empty list if not :Usage: :: elements = driver.find_elements_by_name('foo')
[ "Finds", "elements", "by", "name", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L515-L531
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element_by_tag_name
def find_element_by_tag_name(self, name): """ Finds an element by tag name. :Args: - name - name of html tag (eg: h1, a, span) :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found ...
python
def find_element_by_tag_name(self, name): """ Finds an element by tag name. :Args: - name - name of html tag (eg: h1, a, span) :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found ...
[ "def", "find_element_by_tag_name", "(", "self", ",", "name", ")", ":", "return", "self", ".", "find_element", "(", "by", "=", "By", ".", "TAG_NAME", ",", "value", "=", "name", ")" ]
Finds an element by tag name. :Args: - name - name of html tag (eg: h1, a, span) :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: :: element = driver.fi...
[ "Finds", "an", "element", "by", "tag", "name", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L533-L551
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_elements_by_tag_name
def find_elements_by_tag_name(self, name): """ Finds elements by tag name. :Args: - name - name of html tag (eg: h1, a, span) :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: :: ...
python
def find_elements_by_tag_name(self, name): """ Finds elements by tag name. :Args: - name - name of html tag (eg: h1, a, span) :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: :: ...
[ "def", "find_elements_by_tag_name", "(", "self", ",", "name", ")", ":", "return", "self", ".", "find_elements", "(", "by", "=", "By", ".", "TAG_NAME", ",", "value", "=", "name", ")" ]
Finds elements by tag name. :Args: - name - name of html tag (eg: h1, a, span) :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: :: elements = driver.find_elements_by_tag_name('h1')
[ "Finds", "elements", "by", "tag", "name", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L553-L569
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element_by_class_name
def find_element_by_class_name(self, name): """ Finds an element by class name. :Args: - name: The class name of the element to find. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found...
python
def find_element_by_class_name(self, name): """ Finds an element by class name. :Args: - name: The class name of the element to find. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found...
[ "def", "find_element_by_class_name", "(", "self", ",", "name", ")", ":", "return", "self", ".", "find_element", "(", "by", "=", "By", ".", "CLASS_NAME", ",", "value", "=", "name", ")" ]
Finds an element by class name. :Args: - name: The class name of the element to find. :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: :: element = driv...
[ "Finds", "an", "element", "by", "class", "name", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L571-L589
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_elements_by_class_name
def find_elements_by_class_name(self, name): """ Finds elements by class name. :Args: - name: The class name of the elements to find. :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: ...
python
def find_elements_by_class_name(self, name): """ Finds elements by class name. :Args: - name: The class name of the elements to find. :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: ...
[ "def", "find_elements_by_class_name", "(", "self", ",", "name", ")", ":", "return", "self", ".", "find_elements", "(", "by", "=", "By", ".", "CLASS_NAME", ",", "value", "=", "name", ")" ]
Finds elements by class name. :Args: - name: The class name of the elements to find. :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: :: elements = driver.find_elements_by_class_name...
[ "Finds", "elements", "by", "class", "name", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L591-L607
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element_by_css_selector
def find_element_by_css_selector(self, css_selector): """ Finds an element by css selector. :Args: - css_selector - CSS selector string, ex: 'a.nav#home' :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the ...
python
def find_element_by_css_selector(self, css_selector): """ Finds an element by css selector. :Args: - css_selector - CSS selector string, ex: 'a.nav#home' :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the ...
[ "def", "find_element_by_css_selector", "(", "self", ",", "css_selector", ")", ":", "return", "self", ".", "find_element", "(", "by", "=", "By", ".", "CSS_SELECTOR", ",", "value", "=", "css_selector", ")" ]
Finds an element by css selector. :Args: - css_selector - CSS selector string, ex: 'a.nav#home' :Returns: - WebElement - the element if it was found :Raises: - NoSuchElementException - if the element wasn't found :Usage: :: elem...
[ "Finds", "an", "element", "by", "css", "selector", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L609-L627
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_elements_by_css_selector
def find_elements_by_css_selector(self, css_selector): """ Finds elements by css selector. :Args: - css_selector - CSS selector string, ex: 'a.nav#home' :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :...
python
def find_elements_by_css_selector(self, css_selector): """ Finds elements by css selector. :Args: - css_selector - CSS selector string, ex: 'a.nav#home' :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :...
[ "def", "find_elements_by_css_selector", "(", "self", ",", "css_selector", ")", ":", "return", "self", ".", "find_elements", "(", "by", "=", "By", ".", "CSS_SELECTOR", ",", "value", "=", "css_selector", ")" ]
Finds elements by css selector. :Args: - css_selector - CSS selector string, ex: 'a.nav#home' :Returns: - list of WebElement - a list with elements if any was found. An empty list if not :Usage: :: elements = driver.find_elements_by_c...
[ "Finds", "elements", "by", "css", "selector", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L629-L645
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.execute_script
def execute_script(self, script, *args): """ Synchronously Executes JavaScript in the current window/frame. :Args: - script: The JavaScript to execute. - \\*args: Any applicable arguments for your JavaScript. :Usage: :: driver.execute_scri...
python
def execute_script(self, script, *args): """ Synchronously Executes JavaScript in the current window/frame. :Args: - script: The JavaScript to execute. - \\*args: Any applicable arguments for your JavaScript. :Usage: :: driver.execute_scri...
[ "def", "execute_script", "(", "self", ",", "script", ",", "*", "args", ")", ":", "converted_args", "=", "list", "(", "args", ")", "command", "=", "None", "if", "self", ".", "w3c", ":", "command", "=", "Command", ".", "W3C_EXECUTE_SCRIPT", "else", ":", ...
Synchronously Executes JavaScript in the current window/frame. :Args: - script: The JavaScript to execute. - \\*args: Any applicable arguments for your JavaScript. :Usage: :: driver.execute_script('return document.title;')
[ "Synchronously", "Executes", "JavaScript", "in", "the", "current", "window", "/", "frame", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L647-L669
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.execute_async_script
def execute_async_script(self, script, *args): """ Asynchronously Executes JavaScript in the current window/frame. :Args: - script: The JavaScript to execute. - \\*args: Any applicable arguments for your JavaScript. :Usage: :: script = "va...
python
def execute_async_script(self, script, *args): """ Asynchronously Executes JavaScript in the current window/frame. :Args: - script: The JavaScript to execute. - \\*args: Any applicable arguments for your JavaScript. :Usage: :: script = "va...
[ "def", "execute_async_script", "(", "self", ",", "script", ",", "*", "args", ")", ":", "converted_args", "=", "list", "(", "args", ")", "if", "self", ".", "w3c", ":", "command", "=", "Command", ".", "W3C_EXECUTE_SCRIPT_ASYNC", "else", ":", "command", "=", ...
Asynchronously Executes JavaScript in the current window/frame. :Args: - script: The JavaScript to execute. - \\*args: Any applicable arguments for your JavaScript. :Usage: :: script = "var callback = arguments[arguments.length - 1]; " \\ ...
[ "Asynchronously", "Executes", "JavaScript", "in", "the", "current", "window", "/", "frame", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L671-L694
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.quit
def quit(self): """ Quits the driver and closes every associated window. :Usage: :: driver.quit() """ try: self.execute(Command.QUIT) finally: self.stop_client() self.command_executor.close()
python
def quit(self): """ Quits the driver and closes every associated window. :Usage: :: driver.quit() """ try: self.execute(Command.QUIT) finally: self.stop_client() self.command_executor.close()
[ "def", "quit", "(", "self", ")", ":", "try", ":", "self", ".", "execute", "(", "Command", ".", "QUIT", ")", "finally", ":", "self", ".", "stop_client", "(", ")", "self", ".", "command_executor", ".", "close", "(", ")" ]
Quits the driver and closes every associated window. :Usage: :: driver.quit()
[ "Quits", "the", "driver", "and", "closes", "every", "associated", "window", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L731-L744
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.current_window_handle
def current_window_handle(self): """ Returns the handle of the current window. :Usage: :: driver.current_window_handle """ if self.w3c: return self.execute(Command.W3C_GET_CURRENT_WINDOW_HANDLE)['value'] else: return s...
python
def current_window_handle(self): """ Returns the handle of the current window. :Usage: :: driver.current_window_handle """ if self.w3c: return self.execute(Command.W3C_GET_CURRENT_WINDOW_HANDLE)['value'] else: return s...
[ "def", "current_window_handle", "(", "self", ")", ":", "if", "self", ".", "w3c", ":", "return", "self", ".", "execute", "(", "Command", ".", "W3C_GET_CURRENT_WINDOW_HANDLE", ")", "[", "'value'", "]", "else", ":", "return", "self", ".", "execute", "(", "Com...
Returns the handle of the current window. :Usage: :: driver.current_window_handle
[ "Returns", "the", "handle", "of", "the", "current", "window", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L747-L759
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.window_handles
def window_handles(self): """ Returns the handles of all windows within the current session. :Usage: :: driver.window_handles """ if self.w3c: return self.execute(Command.W3C_GET_WINDOW_HANDLES)['value'] else: return s...
python
def window_handles(self): """ Returns the handles of all windows within the current session. :Usage: :: driver.window_handles """ if self.w3c: return self.execute(Command.W3C_GET_WINDOW_HANDLES)['value'] else: return s...
[ "def", "window_handles", "(", "self", ")", ":", "if", "self", ".", "w3c", ":", "return", "self", ".", "execute", "(", "Command", ".", "W3C_GET_WINDOW_HANDLES", ")", "[", "'value'", "]", "else", ":", "return", "self", ".", "execute", "(", "Command", ".", ...
Returns the handles of all windows within the current session. :Usage: :: driver.window_handles
[ "Returns", "the", "handles", "of", "all", "windows", "within", "the", "current", "session", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L762-L774
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.maximize_window
def maximize_window(self): """ Maximizes the current window that webdriver is using """ params = None command = Command.W3C_MAXIMIZE_WINDOW if not self.w3c: command = Command.MAXIMIZE_WINDOW params = {'windowHandle': 'current'} self.execute...
python
def maximize_window(self): """ Maximizes the current window that webdriver is using """ params = None command = Command.W3C_MAXIMIZE_WINDOW if not self.w3c: command = Command.MAXIMIZE_WINDOW params = {'windowHandle': 'current'} self.execute...
[ "def", "maximize_window", "(", "self", ")", ":", "params", "=", "None", "command", "=", "Command", ".", "W3C_MAXIMIZE_WINDOW", "if", "not", "self", ".", "w3c", ":", "command", "=", "Command", ".", "MAXIMIZE_WINDOW", "params", "=", "{", "'windowHandle'", ":",...
Maximizes the current window that webdriver is using
[ "Maximizes", "the", "current", "window", "that", "webdriver", "is", "using" ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L776-L785
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.get_cookie
def get_cookie(self, name): """ Get a single cookie by name. Returns the cookie if found, None if not. :Usage: :: driver.get_cookie('my_cookie') """ if self.w3c: try: return self.execute(Command.GET_COOKIE, {'name': name})...
python
def get_cookie(self, name): """ Get a single cookie by name. Returns the cookie if found, None if not. :Usage: :: driver.get_cookie('my_cookie') """ if self.w3c: try: return self.execute(Command.GET_COOKIE, {'name': name})...
[ "def", "get_cookie", "(", "self", ",", "name", ")", ":", "if", "self", ".", "w3c", ":", "try", ":", "return", "self", ".", "execute", "(", "Command", ".", "GET_COOKIE", ",", "{", "'name'", ":", "name", "}", ")", "[", "'value'", "]", "except", "NoSu...
Get a single cookie by name. Returns the cookie if found, None if not. :Usage: :: driver.get_cookie('my_cookie')
[ "Get", "a", "single", "cookie", "by", "name", ".", "Returns", "the", "cookie", "if", "found", "None", "if", "not", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L865-L884
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.implicitly_wait
def implicitly_wait(self, time_to_wait): """ Sets a sticky timeout to implicitly wait for an element to be found, or a command to complete. This method only needs to be called one time per session. To set the timeout for calls to execute_async_script, see set_script_time...
python
def implicitly_wait(self, time_to_wait): """ Sets a sticky timeout to implicitly wait for an element to be found, or a command to complete. This method only needs to be called one time per session. To set the timeout for calls to execute_async_script, see set_script_time...
[ "def", "implicitly_wait", "(", "self", ",", "time_to_wait", ")", ":", "if", "self", ".", "w3c", ":", "self", ".", "execute", "(", "Command", ".", "SET_TIMEOUTS", ",", "{", "'implicit'", ":", "int", "(", "float", "(", "time_to_wait", ")", "*", "1000", "...
Sets a sticky timeout to implicitly wait for an element to be found, or a command to complete. This method only needs to be called one time per session. To set the timeout for calls to execute_async_script, see set_script_timeout. :Args: - time_to_wait: Amount of time ...
[ "Sets", "a", "sticky", "timeout", "to", "implicitly", "wait", "for", "an", "element", "to", "be", "found", "or", "a", "command", "to", "complete", ".", "This", "method", "only", "needs", "to", "be", "called", "one", "time", "per", "session", ".", "To", ...
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L925-L945
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.set_script_timeout
def set_script_timeout(self, time_to_wait): """ Set the amount of time that the script should wait during an execute_async_script call before throwing an error. :Args: - time_to_wait: The amount of time to wait (in seconds) :Usage: :: dr...
python
def set_script_timeout(self, time_to_wait): """ Set the amount of time that the script should wait during an execute_async_script call before throwing an error. :Args: - time_to_wait: The amount of time to wait (in seconds) :Usage: :: dr...
[ "def", "set_script_timeout", "(", "self", ",", "time_to_wait", ")", ":", "if", "self", ".", "w3c", ":", "self", ".", "execute", "(", "Command", ".", "SET_TIMEOUTS", ",", "{", "'script'", ":", "int", "(", "float", "(", "time_to_wait", ")", "*", "1000", ...
Set the amount of time that the script should wait during an execute_async_script call before throwing an error. :Args: - time_to_wait: The amount of time to wait (in seconds) :Usage: :: driver.set_script_timeout(30)
[ "Set", "the", "amount", "of", "time", "that", "the", "script", "should", "wait", "during", "an", "execute_async_script", "call", "before", "throwing", "an", "error", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L947-L965
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.set_page_load_timeout
def set_page_load_timeout(self, time_to_wait): """ Set the amount of time to wait for a page load to complete before throwing an error. :Args: - time_to_wait: The amount of time to wait :Usage: :: driver.set_page_load_timeout(30) ...
python
def set_page_load_timeout(self, time_to_wait): """ Set the amount of time to wait for a page load to complete before throwing an error. :Args: - time_to_wait: The amount of time to wait :Usage: :: driver.set_page_load_timeout(30) ...
[ "def", "set_page_load_timeout", "(", "self", ",", "time_to_wait", ")", ":", "try", ":", "self", ".", "execute", "(", "Command", ".", "SET_TIMEOUTS", ",", "{", "'pageLoad'", ":", "int", "(", "float", "(", "time_to_wait", ")", "*", "1000", ")", "}", ")", ...
Set the amount of time to wait for a page load to complete before throwing an error. :Args: - time_to_wait: The amount of time to wait :Usage: :: driver.set_page_load_timeout(30)
[ "Set", "the", "amount", "of", "time", "to", "wait", "for", "a", "page", "load", "to", "complete", "before", "throwing", "an", "error", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L967-L986
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_element
def find_element(self, by=By.ID, value=None): """ Find an element given a By strategy and locator. Prefer the find_element_by_* methods when possible. :Usage: :: element = driver.find_element(By.ID, 'foo') :rtype: WebElement """ if s...
python
def find_element(self, by=By.ID, value=None): """ Find an element given a By strategy and locator. Prefer the find_element_by_* methods when possible. :Usage: :: element = driver.find_element(By.ID, 'foo') :rtype: WebElement """ if s...
[ "def", "find_element", "(", "self", ",", "by", "=", "By", ".", "ID", ",", "value", "=", "None", ")", ":", "if", "self", ".", "w3c", ":", "if", "by", "==", "By", ".", "ID", ":", "by", "=", "By", ".", "CSS_SELECTOR", "value", "=", "'[id=\"%s\"]'", ...
Find an element given a By strategy and locator. Prefer the find_element_by_* methods when possible. :Usage: :: element = driver.find_element(By.ID, 'foo') :rtype: WebElement
[ "Find", "an", "element", "given", "a", "By", "strategy", "and", "locator", ".", "Prefer", "the", "find_element_by_", "*", "methods", "when", "possible", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L988-L1014
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.find_elements
def find_elements(self, by=By.ID, value=None): """ Find elements given a By strategy and locator. Prefer the find_elements_by_* methods when possible. :Usage: :: elements = driver.find_elements(By.CLASS_NAME, 'foo') :rtype: list of WebElement ...
python
def find_elements(self, by=By.ID, value=None): """ Find elements given a By strategy and locator. Prefer the find_elements_by_* methods when possible. :Usage: :: elements = driver.find_elements(By.CLASS_NAME, 'foo') :rtype: list of WebElement ...
[ "def", "find_elements", "(", "self", ",", "by", "=", "By", ".", "ID", ",", "value", "=", "None", ")", ":", "if", "self", ".", "w3c", ":", "if", "by", "==", "By", ".", "ID", ":", "by", "=", "By", ".", "CSS_SELECTOR", "value", "=", "'[id=\"%s\"]'",...
Find elements given a By strategy and locator. Prefer the find_elements_by_* methods when possible. :Usage: :: elements = driver.find_elements(By.CLASS_NAME, 'foo') :rtype: list of WebElement
[ "Find", "elements", "given", "a", "By", "strategy", "and", "locator", ".", "Prefer", "the", "find_elements_by_", "*", "methods", "when", "possible", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1016-L1045
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.get_screenshot_as_file
def get_screenshot_as_file(self, filename): """ Saves a screenshot of the current window to a PNG image file. Returns False if there is any IOError, else returns True. Use full paths in your filename. :Args: - filename: The full path you wish to save your screensh...
python
def get_screenshot_as_file(self, filename): """ Saves a screenshot of the current window to a PNG image file. Returns False if there is any IOError, else returns True. Use full paths in your filename. :Args: - filename: The full path you wish to save your screensh...
[ "def", "get_screenshot_as_file", "(", "self", ",", "filename", ")", ":", "if", "not", "filename", ".", "lower", "(", ")", ".", "endswith", "(", "'.png'", ")", ":", "warnings", ".", "warn", "(", "\"name used for saved screenshot does not match file \"", "\"type. It...
Saves a screenshot of the current window to a PNG image file. Returns False if there is any IOError, else returns True. Use full paths in your filename. :Args: - filename: The full path you wish to save your screenshot to. This should end with a `.png` extension. ...
[ "Saves", "a", "screenshot", "of", "the", "current", "window", "to", "a", "PNG", "image", "file", ".", "Returns", "False", "if", "there", "is", "any", "IOError", "else", "returns", "True", ".", "Use", "full", "paths", "in", "your", "filename", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1054-L1080
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.set_window_size
def set_window_size(self, width, height, windowHandle='current'): """ Sets the width and height of the current window. (window.resizeTo) :Args: - width: the width in pixels to set the window to - height: the height in pixels to set the window to :Usage: ::...
python
def set_window_size(self, width, height, windowHandle='current'): """ Sets the width and height of the current window. (window.resizeTo) :Args: - width: the width in pixels to set the window to - height: the height in pixels to set the window to :Usage: ::...
[ "def", "set_window_size", "(", "self", ",", "width", ",", "height", ",", "windowHandle", "=", "'current'", ")", ":", "if", "self", ".", "w3c", ":", "if", "windowHandle", "!=", "'current'", ":", "warnings", ".", "warn", "(", "\"Only 'current' window is supporte...
Sets the width and height of the current window. (window.resizeTo) :Args: - width: the width in pixels to set the window to - height: the height in pixels to set the window to :Usage: :: driver.set_window_size(800,600)
[ "Sets", "the", "width", "and", "height", "of", "the", "current", "window", ".", "(", "window", ".", "resizeTo", ")" ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1122-L1143
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.get_window_size
def get_window_size(self, windowHandle='current'): """ Gets the width and height of the current window. :Usage: :: driver.get_window_size() """ command = Command.GET_WINDOW_SIZE if self.w3c: if windowHandle != 'current': ...
python
def get_window_size(self, windowHandle='current'): """ Gets the width and height of the current window. :Usage: :: driver.get_window_size() """ command = Command.GET_WINDOW_SIZE if self.w3c: if windowHandle != 'current': ...
[ "def", "get_window_size", "(", "self", ",", "windowHandle", "=", "'current'", ")", ":", "command", "=", "Command", ".", "GET_WINDOW_SIZE", "if", "self", ".", "w3c", ":", "if", "windowHandle", "!=", "'current'", ":", "warnings", ".", "warn", "(", "\"Only 'cur...
Gets the width and height of the current window. :Usage: :: driver.get_window_size()
[ "Gets", "the", "width", "and", "height", "of", "the", "current", "window", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1145-L1165
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.set_window_position
def set_window_position(self, x, y, windowHandle='current'): """ Sets the x,y position of the current window. (window.moveTo) :Args: - x: the x-coordinate in pixels to set the window position - y: the y-coordinate in pixels to set the window position :Usage: ...
python
def set_window_position(self, x, y, windowHandle='current'): """ Sets the x,y position of the current window. (window.moveTo) :Args: - x: the x-coordinate in pixels to set the window position - y: the y-coordinate in pixels to set the window position :Usage: ...
[ "def", "set_window_position", "(", "self", ",", "x", ",", "y", ",", "windowHandle", "=", "'current'", ")", ":", "if", "self", ".", "w3c", ":", "if", "windowHandle", "!=", "'current'", ":", "warnings", ".", "warn", "(", "\"Only 'current' window is supported for...
Sets the x,y position of the current window. (window.moveTo) :Args: - x: the x-coordinate in pixels to set the window position - y: the y-coordinate in pixels to set the window position :Usage: :: driver.set_window_position(0,0)
[ "Sets", "the", "x", "y", "position", "of", "the", "current", "window", ".", "(", "window", ".", "moveTo", ")" ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1167-L1190
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.get_window_position
def get_window_position(self, windowHandle='current'): """ Gets the x,y position of the current window. :Usage: :: driver.get_window_position() """ if self.w3c: if windowHandle != 'current': warnings.warn("Only 'current' w...
python
def get_window_position(self, windowHandle='current'): """ Gets the x,y position of the current window. :Usage: :: driver.get_window_position() """ if self.w3c: if windowHandle != 'current': warnings.warn("Only 'current' w...
[ "def", "get_window_position", "(", "self", ",", "windowHandle", "=", "'current'", ")", ":", "if", "self", ".", "w3c", ":", "if", "windowHandle", "!=", "'current'", ":", "warnings", ".", "warn", "(", "\"Only 'current' window is supported for W3C compatibile browsers.\"...
Gets the x,y position of the current window. :Usage: :: driver.get_window_position()
[ "Gets", "the", "x", "y", "position", "of", "the", "current", "window", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1192-L1209
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.set_window_rect
def set_window_rect(self, x=None, y=None, width=None, height=None): """ Sets the x, y coordinates of the window as well as height and width of the current window. This method is only supported for W3C compatible browsers; other browsers should use `set_window_position` and `set_w...
python
def set_window_rect(self, x=None, y=None, width=None, height=None): """ Sets the x, y coordinates of the window as well as height and width of the current window. This method is only supported for W3C compatible browsers; other browsers should use `set_window_position` and `set_w...
[ "def", "set_window_rect", "(", "self", ",", "x", "=", "None", ",", "y", "=", "None", ",", "width", "=", "None", ",", "height", "=", "None", ")", ":", "if", "not", "self", ".", "w3c", ":", "raise", "UnknownMethodException", "(", "\"set_window_rect is only...
Sets the x, y coordinates of the window as well as height and width of the current window. This method is only supported for W3C compatible browsers; other browsers should use `set_window_position` and `set_window_size`. :Usage: :: driver.set_window_rect(x=1...
[ "Sets", "the", "x", "y", "coordinates", "of", "the", "window", "as", "well", "as", "height", "and", "width", "of", "the", "current", "window", ".", "This", "method", "is", "only", "supported", "for", "W3C", "compatible", "browsers", ";", "other", "browsers...
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1223-L1245
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.file_detector
def file_detector(self, detector): """ Set the file detector to be used when sending keyboard input. By default, this is set to a file detector that does nothing. see FileDetector see LocalFileDetector see UselessFileDetector :Args: - detector: The dete...
python
def file_detector(self, detector): """ Set the file detector to be used when sending keyboard input. By default, this is set to a file detector that does nothing. see FileDetector see LocalFileDetector see UselessFileDetector :Args: - detector: The dete...
[ "def", "file_detector", "(", "self", ",", "detector", ")", ":", "if", "detector", "is", "None", ":", "raise", "WebDriverException", "(", "\"You may not set a file detector that is null\"", ")", "if", "not", "isinstance", "(", "detector", ",", "FileDetector", ")", ...
Set the file detector to be used when sending keyboard input. By default, this is set to a file detector that does nothing. see FileDetector see LocalFileDetector see UselessFileDetector :Args: - detector: The detector to use. Must not be None.
[ "Set", "the", "file", "detector", "to", "be", "used", "when", "sending", "keyboard", "input", ".", "By", "default", "this", "is", "set", "to", "a", "file", "detector", "that", "does", "nothing", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1252-L1268
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/webdriver.py
WebDriver.orientation
def orientation(self, value): """ Sets the current orientation of the device :Args: - value: orientation to set it to. :Usage: :: driver.orientation = 'landscape' """ allowed_values = ['LANDSCAPE', 'PORTRAIT'] if value.upper...
python
def orientation(self, value): """ Sets the current orientation of the device :Args: - value: orientation to set it to. :Usage: :: driver.orientation = 'landscape' """ allowed_values = ['LANDSCAPE', 'PORTRAIT'] if value.upper...
[ "def", "orientation", "(", "self", ",", "value", ")", ":", "allowed_values", "=", "[", "'LANDSCAPE'", ",", "'PORTRAIT'", "]", "if", "value", ".", "upper", "(", ")", "in", "allowed_values", ":", "self", ".", "execute", "(", "Command", ".", "SET_SCREEN_ORIEN...
Sets the current orientation of the device :Args: - value: orientation to set it to. :Usage: :: driver.orientation = 'landscape'
[ "Sets", "the", "current", "orientation", "of", "the", "device" ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/webdriver.py#L1283-L1299
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/errorhandler.py
ErrorHandler.check_response
def check_response(self, response): """ Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object. :Raises: If the response contains an error message. """ ...
python
def check_response(self, response): """ Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object. :Raises: If the response contains an error message. """ ...
[ "def", "check_response", "(", "self", ",", "response", ")", ":", "status", "=", "response", ".", "get", "(", "'status'", ",", "None", ")", "if", "status", "is", "None", "or", "status", "==", "ErrorCode", ".", "SUCCESS", ":", "return", "value", "=", "No...
Checks that a JSON response from the WebDriver does not have an error. :Args: - response - The JSON response from the WebDriver server as a dictionary object. :Raises: If the response contains an error message.
[ "Checks", "that", "a", "JSON", "response", "from", "the", "WebDriver", "does", "not", "have", "an", "error", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/errorhandler.py#L102-L236
train
SeleniumHQ/selenium
py/selenium/webdriver/support/wait.py
WebDriverWait.until
def until(self, method, message=''): """Calls the method provided with the driver as an argument until the \ return value does not evaluate to ``False``. :param method: callable(WebDriver) :param message: optional message for :exc:`TimeoutException` :returns: the result of the l...
python
def until(self, method, message=''): """Calls the method provided with the driver as an argument until the \ return value does not evaluate to ``False``. :param method: callable(WebDriver) :param message: optional message for :exc:`TimeoutException` :returns: the result of the l...
[ "def", "until", "(", "self", ",", "method", ",", "message", "=", "''", ")", ":", "screen", "=", "None", "stacktrace", "=", "None", "end_time", "=", "time", ".", "time", "(", ")", "+", "self", ".", "_timeout", "while", "True", ":", "try", ":", "valu...
Calls the method provided with the driver as an argument until the \ return value does not evaluate to ``False``. :param method: callable(WebDriver) :param message: optional message for :exc:`TimeoutException` :returns: the result of the last call to `method` :raises: :exc:`sele...
[ "Calls", "the", "method", "provided", "with", "the", "driver", "as", "an", "argument", "until", "the", "\\", "return", "value", "does", "not", "evaluate", "to", "False", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/support/wait.py#L62-L86
train
SeleniumHQ/selenium
py/selenium/webdriver/support/wait.py
WebDriverWait.until_not
def until_not(self, method, message=''): """Calls the method provided with the driver as an argument until the \ return value evaluates to ``False``. :param method: callable(WebDriver) :param message: optional message for :exc:`TimeoutException` :returns: the result of the last ...
python
def until_not(self, method, message=''): """Calls the method provided with the driver as an argument until the \ return value evaluates to ``False``. :param method: callable(WebDriver) :param message: optional message for :exc:`TimeoutException` :returns: the result of the last ...
[ "def", "until_not", "(", "self", ",", "method", ",", "message", "=", "''", ")", ":", "end_time", "=", "time", ".", "time", "(", ")", "+", "self", ".", "_timeout", "while", "True", ":", "try", ":", "value", "=", "method", "(", "self", ".", "_driver"...
Calls the method provided with the driver as an argument until the \ return value evaluates to ``False``. :param method: callable(WebDriver) :param message: optional message for :exc:`TimeoutException` :returns: the result of the last call to `method`, or ``True`` if `...
[ "Calls", "the", "method", "provided", "with", "the", "driver", "as", "an", "argument", "until", "the", "\\", "return", "value", "evaluates", "to", "False", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/support/wait.py#L88-L109
train
SeleniumHQ/selenium
py/selenium/webdriver/firefox/webdriver.py
WebDriver.quit
def quit(self): """Quits the driver and close every associated window.""" try: RemoteWebDriver.quit(self) except Exception: # We don't care about the message because something probably has gone wrong pass if self.w3c: self.service.stop() ...
python
def quit(self): """Quits the driver and close every associated window.""" try: RemoteWebDriver.quit(self) except Exception: # We don't care about the message because something probably has gone wrong pass if self.w3c: self.service.stop() ...
[ "def", "quit", "(", "self", ")", ":", "try", ":", "RemoteWebDriver", ".", "quit", "(", "self", ")", "except", "Exception", ":", "# We don't care about the message because something probably has gone wrong", "pass", "if", "self", ".", "w3c", ":", "self", ".", "serv...
Quits the driver and close every associated window.
[ "Quits", "the", "driver", "and", "close", "every", "associated", "window", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/webdriver.py#L178-L197
train
SeleniumHQ/selenium
py/selenium/webdriver/firefox/webdriver.py
WebDriver.context
def context(self, context): """Sets the context that Selenium commands are running in using a `with` statement. The state of the context on the server is saved before entering the block, and restored upon exiting it. :param context: Context, may be one of the class properties ...
python
def context(self, context): """Sets the context that Selenium commands are running in using a `with` statement. The state of the context on the server is saved before entering the block, and restored upon exiting it. :param context: Context, may be one of the class properties ...
[ "def", "context", "(", "self", ",", "context", ")", ":", "initial_context", "=", "self", ".", "execute", "(", "'GET_CONTEXT'", ")", ".", "pop", "(", "'value'", ")", "self", ".", "set_context", "(", "context", ")", "try", ":", "yield", "finally", ":", "...
Sets the context that Selenium commands are running in using a `with` statement. The state of the context on the server is saved before entering the block, and restored upon exiting it. :param context: Context, may be one of the class properties `CONTEXT_CHROME` or `CONTEXT_CONTENT`...
[ "Sets", "the", "context", "that", "Selenium", "commands", "are", "running", "in", "using", "a", "with", "statement", ".", "The", "state", "of", "the", "context", "on", "the", "server", "is", "saved", "before", "entering", "the", "block", "and", "restored", ...
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/webdriver.py#L209-L228
train
SeleniumHQ/selenium
py/selenium/webdriver/firefox/webdriver.py
WebDriver.install_addon
def install_addon(self, path, temporary=None): """ Installs Firefox addon. Returns identifier of installed addon. This identifier can later be used to uninstall addon. :param path: Absolute path to the addon that will be installed. :Usage: :: ...
python
def install_addon(self, path, temporary=None): """ Installs Firefox addon. Returns identifier of installed addon. This identifier can later be used to uninstall addon. :param path: Absolute path to the addon that will be installed. :Usage: :: ...
[ "def", "install_addon", "(", "self", ",", "path", ",", "temporary", "=", "None", ")", ":", "payload", "=", "{", "\"path\"", ":", "path", "}", "if", "temporary", "is", "not", "None", ":", "payload", "[", "\"temporary\"", "]", "=", "temporary", "return", ...
Installs Firefox addon. Returns identifier of installed addon. This identifier can later be used to uninstall addon. :param path: Absolute path to the addon that will be installed. :Usage: :: driver.install_addon('/path/to/firebug.xpi')
[ "Installs", "Firefox", "addon", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/webdriver.py#L230-L247
train
SeleniumHQ/selenium
py/selenium/webdriver/firefox/options.py
Options.binary
def binary(self, new_binary): """Sets location of the browser binary, either by string or ``FirefoxBinary`` instance. """ if not isinstance(new_binary, FirefoxBinary): new_binary = FirefoxBinary(new_binary) self._binary = new_binary
python
def binary(self, new_binary): """Sets location of the browser binary, either by string or ``FirefoxBinary`` instance. """ if not isinstance(new_binary, FirefoxBinary): new_binary = FirefoxBinary(new_binary) self._binary = new_binary
[ "def", "binary", "(", "self", ",", "new_binary", ")", ":", "if", "not", "isinstance", "(", "new_binary", ",", "FirefoxBinary", ")", ":", "new_binary", "=", "FirefoxBinary", "(", "new_binary", ")", "self", ".", "_binary", "=", "new_binary" ]
Sets location of the browser binary, either by string or ``FirefoxBinary`` instance.
[ "Sets", "location", "of", "the", "browser", "binary", "either", "by", "string", "or", "FirefoxBinary", "instance", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/options.py#L52-L59
train
SeleniumHQ/selenium
py/selenium/webdriver/firefox/options.py
Options.profile
def profile(self, new_profile): """Sets location of the browser profile to use, either by string or ``FirefoxProfile``. """ if not isinstance(new_profile, FirefoxProfile): new_profile = FirefoxProfile(new_profile) self._profile = new_profile
python
def profile(self, new_profile): """Sets location of the browser profile to use, either by string or ``FirefoxProfile``. """ if not isinstance(new_profile, FirefoxProfile): new_profile = FirefoxProfile(new_profile) self._profile = new_profile
[ "def", "profile", "(", "self", ",", "new_profile", ")", ":", "if", "not", "isinstance", "(", "new_profile", ",", "FirefoxProfile", ")", ":", "new_profile", "=", "FirefoxProfile", "(", "new_profile", ")", "self", ".", "_profile", "=", "new_profile" ]
Sets location of the browser profile to use, either by string or ``FirefoxProfile``.
[ "Sets", "location", "of", "the", "browser", "profile", "to", "use", "either", "by", "string", "or", "FirefoxProfile", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/options.py#L111-L118
train
SeleniumHQ/selenium
py/selenium/webdriver/firefox/options.py
Options.headless
def headless(self, value): """ Sets the headless argument Args: value: boolean value indicating to set the headless option """ if value is True: self._arguments.append('-headless') elif '-headless' in self._arguments: self._arguments.rem...
python
def headless(self, value): """ Sets the headless argument Args: value: boolean value indicating to set the headless option """ if value is True: self._arguments.append('-headless') elif '-headless' in self._arguments: self._arguments.rem...
[ "def", "headless", "(", "self", ",", "value", ")", ":", "if", "value", "is", "True", ":", "self", ".", "_arguments", ".", "append", "(", "'-headless'", ")", "elif", "'-headless'", "in", "self", ".", "_arguments", ":", "self", ".", "_arguments", ".", "r...
Sets the headless argument Args: value: boolean value indicating to set the headless option
[ "Sets", "the", "headless", "argument" ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/options.py#L128-L138
train
SeleniumHQ/selenium
py/selenium/webdriver/firefox/options.py
Options.to_capabilities
def to_capabilities(self): """Marshals the Firefox options to a `moz:firefoxOptions` object. """ # This intentionally looks at the internal properties # so if a binary or profile has _not_ been set, # it will defer to geckodriver to find the system Firefox # and g...
python
def to_capabilities(self): """Marshals the Firefox options to a `moz:firefoxOptions` object. """ # This intentionally looks at the internal properties # so if a binary or profile has _not_ been set, # it will defer to geckodriver to find the system Firefox # and g...
[ "def", "to_capabilities", "(", "self", ")", ":", "# This intentionally looks at the internal properties", "# so if a binary or profile has _not_ been set,", "# it will defer to geckodriver to find the system Firefox", "# and generate a fresh profile.", "caps", "=", "self", ".", "_caps", ...
Marshals the Firefox options to a `moz:firefoxOptions` object.
[ "Marshals", "the", "Firefox", "options", "to", "a", "moz", ":", "firefoxOptions", "object", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/firefox/options.py#L140-L167
train
SeleniumHQ/selenium
py/selenium/webdriver/remote/mobile.py
Mobile.set_network_connection
def set_network_connection(self, network): """ Set the network connection for the remote device. Example of setting airplane mode:: driver.mobile.set_network_connection(driver.mobile.AIRPLANE_MODE) """ mode = network.mask if isinstance(network, self.ConnectionType) ...
python
def set_network_connection(self, network): """ Set the network connection for the remote device. Example of setting airplane mode:: driver.mobile.set_network_connection(driver.mobile.AIRPLANE_MODE) """ mode = network.mask if isinstance(network, self.ConnectionType) ...
[ "def", "set_network_connection", "(", "self", ",", "network", ")", ":", "mode", "=", "network", ".", "mask", "if", "isinstance", "(", "network", ",", "self", ".", "ConnectionType", ")", "else", "network", "return", "self", ".", "ConnectionType", "(", "self",...
Set the network connection for the remote device. Example of setting airplane mode:: driver.mobile.set_network_connection(driver.mobile.AIRPLANE_MODE)
[ "Set", "the", "network", "connection", "for", "the", "remote", "device", "." ]
df40c28b41d4b3953f90eaff84838a9ac052b84a
https://github.com/SeleniumHQ/selenium/blob/df40c28b41d4b3953f90eaff84838a9ac052b84a/py/selenium/webdriver/remote/mobile.py#L52-L64
train