1
1
#![ no_implicit_prelude]
2
2
#![ allow( unused_variables) ]
3
3
4
- #[ :: pyo3:: pyclass]
4
+ #[ crate :: pyclass]
5
+ #[ pyo3( pyo3_path = "crate" ) ]
5
6
pub struct Dummy ;
6
7
7
- #[ :: pyo3:: pyclass]
8
+ #[ crate :: pyclass]
9
+ #[ pyo3( pyo3_path = "crate" ) ]
8
10
pub struct DummyIter ;
9
11
10
- #[ :: pyo3:: pymethods]
12
+ #[ crate :: pymethods]
13
+ #[ pyo3( pyo3_path = "crate" ) ]
11
14
impl Dummy {
12
15
//////////////////////
13
16
// Basic customization
@@ -20,8 +23,8 @@ impl Dummy {
20
23
"Dummy"
21
24
}
22
25
23
- fn __bytes__ < ' py > ( & self , py : :: pyo3 :: Python < ' py > ) -> & ' py :: pyo3 :: types:: PyBytes {
24
- :: pyo3 :: types:: PyBytes :: new ( py, & [ 0 ] )
26
+ fn __bytes__ < ' py > ( & self , py : crate :: Python < ' py > ) -> & ' py crate :: types:: PyBytes {
27
+ crate :: types:: PyBytes :: new ( py, & [ 0 ] )
25
28
}
26
29
27
30
fn __format__ ( & self , format_spec : :: std:: string:: String ) -> :: std:: string:: String {
@@ -60,20 +63,20 @@ impl Dummy {
60
63
// Customizing attribute access
61
64
//////////////////////
62
65
63
- fn __getattr__ ( & self , name : :: std:: string:: String ) -> & :: pyo3 :: PyAny {
66
+ fn __getattr__ ( & self , name : :: std:: string:: String ) -> & crate :: PyAny {
64
67
:: std:: panic!( "unimplemented isn't hygienic before 1.50" )
65
68
}
66
69
67
- fn __getattribute__ ( & self , name : :: std:: string:: String ) -> & :: pyo3 :: PyAny {
70
+ fn __getattribute__ ( & self , name : :: std:: string:: String ) -> & crate :: PyAny {
68
71
:: std:: panic!( "unimplemented isn't hygienic before 1.50" )
69
72
}
70
73
71
74
fn __setattr__ ( & mut self , name : :: std:: string:: String , value : :: std:: string:: String ) { }
72
75
73
76
fn __delattr__ ( & mut self , name : :: std:: string:: String ) { }
74
77
75
- fn __dir__ < ' py > ( & self , py : :: pyo3 :: Python < ' py > ) -> & ' py :: pyo3 :: types:: PyList {
76
- :: pyo3 :: types:: PyList :: new ( py, :: std:: vec![ 0_u8 ] )
78
+ fn __dir__ < ' py > ( & self , py : crate :: Python < ' py > ) -> & ' py crate :: types:: PyList {
79
+ crate :: types:: PyList :: new ( py, :: std:: vec![ 0_u8 ] )
77
80
}
78
81
79
82
//////////////////////
@@ -82,17 +85,17 @@ impl Dummy {
82
85
83
86
fn __get__ (
84
87
& self ,
85
- instance : & :: pyo3 :: PyAny ,
86
- owner : & :: pyo3 :: PyAny ,
87
- ) -> :: pyo3 :: PyResult < & :: pyo3 :: PyAny > {
88
+ instance : & crate :: PyAny ,
89
+ owner : & crate :: PyAny ,
90
+ ) -> crate :: PyResult < & crate :: PyAny > {
88
91
:: std:: panic!( "unimplemented isn't hygienic before 1.50" )
89
92
}
90
93
91
- fn __set__ ( & self , instance : & :: pyo3 :: PyAny , owner : & :: pyo3 :: PyAny ) { }
94
+ fn __set__ ( & self , instance : & crate :: PyAny , owner : & crate :: PyAny ) { }
92
95
93
- fn __delete__ ( & self , instance : & :: pyo3 :: PyAny ) { }
96
+ fn __delete__ ( & self , instance : & crate :: PyAny ) { }
94
97
95
- fn __set_name__ ( & self , owner : & :: pyo3 :: PyAny , name : & :: pyo3 :: PyAny ) { }
98
+ fn __set_name__ ( & self , owner : & crate :: PyAny , name : & crate :: PyAny ) { }
96
99
97
100
//////////////////////
98
101
// Implementing Descriptors
@@ -102,24 +105,24 @@ impl Dummy {
102
105
0
103
106
}
104
107
105
- fn __getitem__ ( & self , key : u32 ) -> :: pyo3 :: PyResult < u32 > {
106
- :: std:: result:: Result :: Err ( :: pyo3 :: exceptions:: PyKeyError :: new_err ( "boo" ) )
108
+ fn __getitem__ ( & self , key : u32 ) -> crate :: PyResult < u32 > {
109
+ :: std:: result:: Result :: Err ( crate :: exceptions:: PyKeyError :: new_err ( "boo" ) )
107
110
}
108
111
109
112
fn __setitem__ ( & self , key : u32 , value : u32 ) { }
110
113
111
114
fn __delitem__ ( & self , key : u32 ) { }
112
115
113
- fn __iter__ ( _: :: pyo3 :: pycell:: PyRef < Self > , py : :: pyo3 :: Python ) -> :: pyo3 :: Py < DummyIter > {
114
- :: pyo3 :: Py :: new ( py, DummyIter { } ) . unwrap ( )
116
+ fn __iter__ ( _: crate :: pycell:: PyRef < Self > , py : crate :: Python ) -> crate :: Py < DummyIter > {
117
+ crate :: Py :: new ( py, DummyIter { } ) . unwrap ( )
115
118
}
116
119
117
120
fn __next__ ( & mut self ) -> :: std:: option:: Option < ( ) > {
118
121
:: std:: option:: Option :: None
119
122
}
120
123
121
- fn __reversed__ ( slf : :: pyo3 :: pycell:: PyRef < Self > , py : :: pyo3 :: Python ) -> :: pyo3 :: Py < DummyIter > {
122
- :: pyo3 :: Py :: new ( py, DummyIter { } ) . unwrap ( )
124
+ fn __reversed__ ( slf : crate :: pycell:: PyRef < Self > , py : crate :: Python ) -> crate :: Py < DummyIter > {
125
+ crate :: Py :: new ( py, DummyIter { } ) . unwrap ( )
123
126
}
124
127
125
128
fn __contains__ ( & self , item : u32 ) -> bool {
@@ -142,12 +145,12 @@ impl Dummy {
142
145
Dummy { }
143
146
}
144
147
145
- fn __truediv__ ( & self , _other : & Self ) -> :: pyo3 :: PyResult < ( ) > {
146
- :: std:: result:: Result :: Err ( :: pyo3 :: exceptions:: PyZeroDivisionError :: new_err ( "boo" ) )
148
+ fn __truediv__ ( & self , _other : & Self ) -> crate :: PyResult < ( ) > {
149
+ :: std:: result:: Result :: Err ( crate :: exceptions:: PyZeroDivisionError :: new_err ( "boo" ) )
147
150
}
148
151
149
- fn __floordiv__ ( & self , _other : & Self ) -> :: pyo3 :: PyResult < ( ) > {
150
- :: std:: result:: Result :: Err ( :: pyo3 :: exceptions:: PyZeroDivisionError :: new_err ( "boo" ) )
152
+ fn __floordiv__ ( & self , _other : & Self ) -> crate :: PyResult < ( ) > {
153
+ :: std:: result:: Result :: Err ( crate :: exceptions:: PyZeroDivisionError :: new_err ( "boo" ) )
151
154
}
152
155
153
156
fn __mod__ ( & self , _other : & Self ) -> u32 {
@@ -194,12 +197,12 @@ impl Dummy {
194
197
Dummy { }
195
198
}
196
199
197
- fn __rtruediv__ ( & self , _other : & Self ) -> :: pyo3 :: PyResult < ( ) > {
198
- :: std:: result:: Result :: Err ( :: pyo3 :: exceptions:: PyZeroDivisionError :: new_err ( "boo" ) )
200
+ fn __rtruediv__ ( & self , _other : & Self ) -> crate :: PyResult < ( ) > {
201
+ :: std:: result:: Result :: Err ( crate :: exceptions:: PyZeroDivisionError :: new_err ( "boo" ) )
199
202
}
200
203
201
- fn __rfloordiv__ ( & self , _other : & Self ) -> :: pyo3 :: PyResult < ( ) > {
202
- :: std:: result:: Result :: Err ( :: pyo3 :: exceptions:: PyZeroDivisionError :: new_err ( "boo" ) )
204
+ fn __rfloordiv__ ( & self , _other : & Self ) -> crate :: PyResult < ( ) > {
205
+ :: std:: result:: Result :: Err ( crate :: exceptions:: PyZeroDivisionError :: new_err ( "boo" ) )
203
206
}
204
207
205
208
fn __rmod__ ( & self , _other : & Self ) -> u32 {
@@ -258,24 +261,24 @@ impl Dummy {
258
261
259
262
fn __ior__ ( & mut self , other : & Self ) { }
260
263
261
- fn __neg__ ( slf : :: pyo3 :: pycell:: PyRef < Self > ) -> :: pyo3 :: pycell:: PyRef < Self > {
264
+ fn __neg__ ( slf : crate :: pycell:: PyRef < Self > ) -> crate :: pycell:: PyRef < Self > {
262
265
slf
263
266
}
264
267
265
- fn __pos__ ( slf : :: pyo3 :: pycell:: PyRef < Self > ) -> :: pyo3 :: pycell:: PyRef < Self > {
268
+ fn __pos__ ( slf : crate :: pycell:: PyRef < Self > ) -> crate :: pycell:: PyRef < Self > {
266
269
slf
267
270
}
268
271
269
- fn __abs__ ( slf : :: pyo3 :: pycell:: PyRef < Self > ) -> :: pyo3 :: pycell:: PyRef < Self > {
272
+ fn __abs__ ( slf : crate :: pycell:: PyRef < Self > ) -> crate :: pycell:: PyRef < Self > {
270
273
slf
271
274
}
272
275
273
- fn __invert__ ( slf : :: pyo3 :: pycell:: PyRef < Self > ) -> :: pyo3 :: pycell:: PyRef < Self > {
276
+ fn __invert__ ( slf : crate :: pycell:: PyRef < Self > ) -> crate :: pycell:: PyRef < Self > {
274
277
slf
275
278
}
276
279
277
- fn __complex__ < ' py > ( & self , py : :: pyo3 :: Python < ' py > ) -> & ' py :: pyo3 :: types:: PyComplex {
278
- :: pyo3 :: types:: PyComplex :: from_doubles ( py, 0.0 , 0.0 )
280
+ fn __complex__ < ' py > ( & self , py : crate :: Python < ' py > ) -> & ' py crate :: types:: PyComplex {
281
+ crate :: types:: PyComplex :: from_doubles ( py, 0.0 , 0.0 )
279
282
}
280
283
281
284
fn __int__ ( & self ) -> u32 {
@@ -314,17 +317,17 @@ impl Dummy {
314
317
315
318
fn __exit__ (
316
319
& mut self ,
317
- exc_type : & :: pyo3 :: PyAny ,
318
- exc_value : & :: pyo3 :: PyAny ,
319
- traceback : & :: pyo3 :: PyAny ,
320
+ exc_type : & crate :: PyAny ,
321
+ exc_value : & crate :: PyAny ,
322
+ traceback : & crate :: PyAny ,
320
323
) {
321
324
}
322
325
323
326
//////////////////////
324
327
// Awaitable Objects
325
328
//////////////////////
326
329
327
- fn __await__ ( slf : :: pyo3 :: pycell:: PyRef < Self > ) -> :: pyo3 :: pycell:: PyRef < Self > {
330
+ fn __await__ ( slf : crate :: pycell:: PyRef < Self > ) -> crate :: pycell:: PyRef < Self > {
328
331
slf
329
332
}
330
333
@@ -333,8 +336,8 @@ impl Dummy {
333
336
// Asynchronous Iterators
334
337
//////////////////////
335
338
336
- fn __aiter__ ( slf : :: pyo3 :: pycell:: PyRef < Self > , py : :: pyo3 :: Python ) -> :: pyo3 :: Py < DummyIter > {
337
- :: pyo3 :: Py :: new ( py, DummyIter { } ) . unwrap ( )
339
+ fn __aiter__ ( slf : crate :: pycell:: PyRef < Self > , py : crate :: Python ) -> crate :: Py < DummyIter > {
340
+ crate :: Py :: new ( py, DummyIter { } ) . unwrap ( )
338
341
}
339
342
340
343
fn __anext__ ( & mut self ) -> :: std:: option:: Option < ( ) > {
@@ -349,9 +352,9 @@ impl Dummy {
349
352
350
353
fn __aexit__ (
351
354
& mut self ,
352
- exc_type : & :: pyo3 :: PyAny ,
353
- exc_value : & :: pyo3 :: PyAny ,
354
- traceback : & :: pyo3 :: PyAny ,
355
+ exc_type : & crate :: PyAny ,
356
+ exc_value : & crate :: PyAny ,
357
+ traceback : & crate :: PyAny ,
355
358
) {
356
359
}
357
360
@@ -362,13 +365,13 @@ impl Dummy {
362
365
#[ staticmethod]
363
366
fn staticmethod ( ) { }
364
367
#[ classmethod]
365
- fn clsmethod ( _: & :: pyo3 :: types:: PyType ) { }
368
+ fn clsmethod ( _: & crate :: types:: PyType ) { }
366
369
#[ args( args = "*" , kwds = "**" ) ]
367
370
fn __call__ (
368
371
& self ,
369
- _args : & :: pyo3 :: types:: PyTuple ,
370
- _kwds : :: std:: option:: Option < & :: pyo3 :: types:: PyDict > ,
371
- ) -> :: pyo3 :: PyResult < i32 > {
372
+ _args : & crate :: types:: PyTuple ,
373
+ _kwds : :: std:: option:: Option < & crate :: types:: PyDict > ,
374
+ ) -> crate :: PyResult < i32 > {
372
375
:: std:: panic!( "unimplemented isn't hygienic before 1.50" )
373
376
}
374
377
#[ new]
@@ -391,8 +394,8 @@ impl Dummy {
391
394
fn __richcmp__ (
392
395
& self ,
393
396
other : & Self ,
394
- op : :: pyo3 :: class:: basic:: CompareOp ,
395
- ) -> :: pyo3 :: PyResult < bool > {
397
+ op : crate :: class:: basic:: CompareOp ,
398
+ ) -> crate :: PyResult < bool > {
396
399
:: std:: result:: Result :: Ok ( false )
397
400
}
398
401
// PyGcProtocol
0 commit comments