@@ -225,7 +225,7 @@ def pin_read(self, name, version: Optional[str] = None, hash: Optional[str] = No
225225 meta , self .construct_path ([pin_name , meta .version .version ])
226226 )
227227
228- def pin_write (
228+ def _pin_store (
229229 self ,
230230 x ,
231231 name : Optional [str ] = None ,
@@ -236,32 +236,6 @@ def pin_write(
236236 versioned : Optional [bool ] = None ,
237237 created : Optional [datetime ] = None ,
238238 ) -> Meta :
239- """Write a pin object to the board.
240-
241- Parameters
242- ----------
243- x:
244- An object (e.g. a pandas DataFrame) to pin.
245- name:
246- Pin name.
247- type:
248- File type used to save `x` to disk. May be "csv", "arrow", "parquet",
249- "joblib", "json", or "file".
250- title:
251- A title for the pin; most important for shared boards so that others
252- can understand what the pin contains. If omitted, a brief description
253- of the contents will be automatically generated.
254- description:
255- A detailed description of the pin contents.
256- metadata:
257- A dictionary containing additional metadata to store with the pin.
258- This gets stored on the Meta.user field.
259- versioned:
260- Whether the pin should be versioned. Defaults to versioning.
261- created:
262- A date to store in the Meta.created field. This field may be used as
263- part of the pin version name.
264- """
265239
266240 if type == "feather" :
267241 warn_deprecated (
@@ -334,6 +308,54 @@ def pin_write(
334308
335309 return meta
336310
311+ def pin_write (
312+ self ,
313+ x ,
314+ name : Optional [str ] = None ,
315+ type : Optional [str ] = None ,
316+ title : Optional [str ] = None ,
317+ description : Optional [str ] = None ,
318+ metadata : Optional [Mapping ] = None ,
319+ versioned : Optional [bool ] = None ,
320+ created : Optional [datetime ] = None ,
321+ ) -> Meta :
322+ """Write a pin object to the board.
323+
324+ Parameters
325+ ----------
326+ x:
327+ An object (e.g. a pandas DataFrame) to pin.
328+ name:
329+ Pin name.
330+ type:
331+ File type used to save `x` to disk. May be "csv", "arrow", "parquet",
332+ "joblib", "json", or "file".
333+ title:
334+ A title for the pin; most important for shared boards so that others
335+ can understand what the pin contains. If omitted, a brief description
336+ of the contents will be automatically generated.
337+ description:
338+ A detailed description of the pin contents.
339+ metadata:
340+ A dictionary containing additional metadata to store with the pin.
341+ This gets stored on the Meta.user field.
342+ versioned:
343+ Whether the pin should be versioned. Defaults to versioning.
344+ created:
345+ A date to store in the Meta.created field. This field may be used as
346+ part of the pin version name.
347+ """
348+
349+ if type == "file" :
350+ raise NotImplementedError (
351+ ".pin_write() does not support type='file'. "
352+ "Use .pin_upload() to save a file as a pin."
353+ )
354+
355+ return self ._pin_store (
356+ x , name , type , title , description , metadata , versioned , created
357+ )
358+
337359 def pin_download (self , name , version = None , hash = None ) -> Sequence [str ]:
338360 """Download the files contained in a pin.
339361
@@ -380,7 +402,7 @@ def pin_upload(self, paths, name=None, title=None, description=None, metadata=No
380402 using [](`~pins.boards.BaseBoard.pin_download`).
381403 """
382404
383- return self .pin_write (
405+ return self ._pin_store (
384406 paths ,
385407 name ,
386408 type = "file" ,
0 commit comments