Skip to content

Commit e60c3f9

Browse files
authored
Merge pull request #3 from kakeruzoku/dev
fix import
2 parents effa4a8 + e7a15ab commit e60c3f9

File tree

10 files changed

+61
-57
lines changed

10 files changed

+61
-57
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
# 0.x.x
99
## 0.0.x
10+
### 0.0.2
11+
- **[Fix]** Importを修正
12+
1013
### 0.0.1
1114
- **[Other]** 共有
1215
- **[Add]** クラスの追加

scapi/__init__.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Created by kakeruzoku / https://github.com/kakeruzoku/scapi
22
# Special Thanks: Timmccool / https://github.com/TimMcCool/scratchattach
33
__version__ = "0.0.1"
4-
from others.common import (
4+
from .others.common import (
55
create_ClientSession,
66
Response,
77
Requests,
@@ -12,44 +12,44 @@
1212
empty_project_json,
1313
BIG
1414
)
15-
from others.error import *
15+
from .others.error import *
1616
del TYPE_CHECKING
17-
from others.other_api import (
17+
from .others.other_api import (
1818
get_csrf_token_sync
1919
)
20-
from sites.base import (
20+
from .sites.base import (
2121
_BaseSiteAPI,
2222
get_object as _get_object,
2323
get_object_iterator as _get_object_iterator,
2424
get_comment_iterator as _get_comment_iterator,
2525
get_count as _get_count
2626
)
27-
from sites.comment import (
27+
from .sites.comment import (
2828
CommentData,
2929
Comment,
3030
UserComment
3131
)
32-
from sites.project import (
32+
from .sites.project import (
3333
Project,
3434
get_project,
3535
create_Partial_Project,
3636
explore_projects,
3737
search_projects
3838
)
39-
from sites.session import (
39+
from .sites.session import (
4040
SessionStatus,
4141
Session,
4242
session_login,
4343
login
4444
)
45-
from sites.studio import (
45+
from .sites.studio import (
4646
Studio,
4747
get_studio,
4848
create_Partial_Studio,
4949
explore_studios,
5050
search_studios
5151
)
52-
from sites.user import (
52+
from .sites.user import (
5353
User,
5454
get_user,
5555
create_Partial_User

scapi/others/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import datetime
22
import aiohttp
33
from multidict import CIMultiDictProxy, CIMultiDict
4-
from others import error as exceptions
4+
from . import error as exceptions
55
import json
66

77

scapi/others/error.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from typing import TYPE_CHECKING
22
if TYPE_CHECKING:
3-
from others.common import Response
4-
from sites.base import _BaseSiteAPI
3+
from .common import Response
4+
from ..sites.base import _BaseSiteAPI
55

66
"""
77
階層表記

scapi/sites/base.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
from typing import TYPE_CHECKING, Any, AsyncGenerator, Literal
33
import random
44

5-
import others.common as common
6-
from others import error as exception
5+
from ..others import common as common
6+
from ..others import error as exception
77

88
if TYPE_CHECKING:
9-
from sites.session import Session as Scratch_Session
10-
from sites.comment import Comment
11-
from sites.studio import Studio
12-
from sites.project import Project
9+
from .session import Session as Scratch_Session
10+
from .comment import Comment
11+
from .studio import Studio
12+
from .project import Project
1313

1414
class _BaseSiteAPI(ABC):
1515
raise_class = exception.ObjectNotFound
@@ -128,7 +128,7 @@ async def get_comment_iterator(
128128
max_limit=40,
129129
add_params:dict={},
130130
) -> AsyncGenerator["Comment",None]:
131-
from sites.comment import Comment
131+
from .comment import Comment
132132
for i in range(offset,offset+limit,max_limit):
133133
l = await common.api_iterative(
134134
plece.ClientSession,url,

scapi/sites/comment.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
from typing import AsyncGenerator, Literal, TypedDict, TYPE_CHECKING, overload
44
import warnings
55

6-
import others.common as common
7-
import others.error as exception
8-
import sites.base as base
6+
from ..others import common
7+
from ..others import error as exception
8+
from . import base
99

1010
if TYPE_CHECKING:
11-
from sites.session import Session
12-
from sites.user import User
13-
from sites.studio import Studio
14-
from sites.project import Project
11+
from .session import Session
12+
from .user import User
13+
from .studio import Studio
14+
from .project import Project
1515

1616
class CommentData(TypedDict):
1717
place:"Project|Studio"
@@ -30,9 +30,9 @@ def __init__(
3030
scratch_session:"Session|None"=None,
3131
**entries
3232
) -> None:
33-
from sites.user import User
34-
from sites.studio import Studio
35-
from sites.project import Project
33+
from .user import User
34+
from .studio import Studio
35+
from .project import Project
3636

3737
self.place:Project|Studio = data.get("place")
3838
self.id:int = data.get("id")
@@ -76,7 +76,7 @@ def _is_me_raise(self) -> None:
7676
raise exception.NoPermission
7777

7878
def _update_from_dict(self, data:dict) -> None:
79-
from sites.user import User
79+
from .user import User
8080
self.parent_id = data.get("parent_id",self.parent_id)
8181
self.commentee_id = data.get("commentee_id",self.commentee_id)
8282
self.content = data.get("content",self.content)

scapi/sites/project.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
from typing import AsyncGenerator, TYPE_CHECKING
44

55

6-
import others.common as common
7-
import others.error as exception
8-
import sites.base as base
9-
from sites.comment import Comment
6+
from ..others import common
7+
from ..others import error as exception
8+
from . import base
9+
from .comment import Comment
1010

1111
if TYPE_CHECKING:
12-
from sites.session import Session
13-
from sites.user import User
14-
from sites.studio import Studio
12+
from .session import Session
13+
from .user import User
14+
from .studio import Studio
1515

1616
class Project(base._BaseSiteAPI):
1717
raise_class = exception.ObjectNotFound
@@ -51,7 +51,7 @@ def __init__(
5151
self.remix_root:int|None = None
5252

5353
def _update_from_dict(self, data:dict) -> None:
54-
from sites.user import User
54+
from .user import User
5555
_author:dict = data.get("author",{})
5656
self.author = User(self.ClientSession,_author.get("username",None),self.Session)
5757
self.author._update_from_dict(_author)
@@ -137,7 +137,7 @@ async def download(self) -> dict:
137137
def studios(self, *, limit=40, offset=0) -> AsyncGenerator["Studio",None]:
138138
common.no_data_checker(self.author)
139139
common.no_data_checker(self.author.username)
140-
from sites.studio import Studio
140+
from .studio import Studio
141141
return base.get_object_iterator(
142142
self.ClientSession,f"https://api.scratch.mit.edu/users/{self.author.username}/projects/{self.id}/studios",
143143
None,Studio,self.Session,
@@ -187,7 +187,7 @@ def create_Partial_Project(project_id:int,author_name:"str|None"=None,*,ClientSe
187187
ClientSession = common.create_ClientSession(ClientSession)
188188
_project = Project(ClientSession,project_id)
189189
if author_name is not None:
190-
from sites.user import create_Partial_User
190+
from .user import create_Partial_User
191191
_project.author = create_Partial_User(author_name,ClientSession=ClientSession)
192192
return _project
193193

scapi/sites/session.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import datetime
22
import re
33
import warnings
4-
import others.other_api as other_api
5-
import others.common as common
6-
import others.error as exception
7-
from sites import base
8-
from sites import user,project,studio
4+
5+
from ..others import other_api
6+
from ..others import common
7+
from ..others import error as exception
8+
from . import base
9+
from . import user,project,studio
910

1011

1112
class SessionStatus:

scapi/sites/studio.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
from typing import AsyncGenerator, TYPE_CHECKING
44

55

6-
import others.common as common
7-
import others.error as exception
8-
import sites.base as base
9-
from sites.comment import Comment
6+
from ..others import common as common
7+
from ..others import error as exception
8+
from . import base
9+
from .comment import Comment
1010

1111
if TYPE_CHECKING:
12-
from sites.session import Session
13-
from sites.user import User
12+
from .session import Session
13+
from .user import User
1414

1515
class Studio(base._BaseSiteAPI):
1616
raise_class = exception.StudioNotFound

scapi/sites/user.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import random
33
from typing import AsyncGenerator, TypedDict, TYPE_CHECKING
44

5-
from others import common
6-
import others.error as exception
7-
import sites.base as base
8-
import sites.project as project
9-
import sites.comment as comment
5+
from ..others import common
6+
from ..others import error as exception
7+
from . import base
8+
from . import project
9+
from . import comment
1010
import bs4
1111

1212
if TYPE_CHECKING:
13-
from sites.session import Session
13+
from .session import Session
1414

1515

1616
class User(base._BaseSiteAPI):

0 commit comments

Comments
 (0)