Skip to content

Commit 94dc4dd

Browse files
committed
remove stringcase dependency
1 parent e4af5b7 commit 94dc4dd

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,3 @@ dataclasses >= 0.6
33
dataclasses-json >= 0.5.4
44
marshmallow >= 3.12.2
55
setuptools >= 57.1.0
6-
stringcase >= 1.2.0

servicestack/clients.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import decimal
33
import inspect
44
import json
5+
import re
56
from dataclasses_json import dataclass_json
67
from dataclasses import dataclass, field, fields, asdict, is_dataclass
78
from datetime import datetime, timedelta
@@ -14,7 +15,6 @@
1415
import requests
1516
from requests.exceptions import HTTPError
1617
from requests.models import Response
17-
from stringcase import camelcase, snakecase, uppercase
1818

1919
from servicestack.dtos import IReturn, IReturnVoid, IGet, IPost, IPut, IPatch, \
2020
IDelete, ResponseStatus, EmptyResponse, GetAccessToken, GetAccessTokenResponse
@@ -30,6 +30,26 @@
3030
SS_REFRESH_TOKEN_COOKIE = "ss-reftok"
3131

3232

33+
def lowercase(string): return str(string).lower()
34+
35+
36+
def uppercase(string): return str(string).upper()
37+
38+
39+
def snakecase(string):
40+
string = re.sub(r"[\-\.\s]", '_', str(string))
41+
if not string:
42+
return string
43+
return lowercase(string[0]) + re.sub(r"[A-Z]", lambda matched: '_' + lowercase(matched.group(0)), string[1:])
44+
45+
46+
def camelcase(string):
47+
string = re.sub(r"\w[\s\W]+\w", '', str(string))
48+
if not string:
49+
return string
50+
return lowercase(string[0]) + re.sub(r"[\-_\.\s]([a-z])", lambda matched: uppercase(matched.group(1)), string[1:])
51+
52+
3353
def _dump(obj):
3454
print("")
3555
for attr in dir(obj):

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@
55
with open("README.md", "r", encoding="utf-8") as fh:
66
long_description = fh.read()
77

8-
dependencies = ['dataclasses-json>=0.5.4','requests>=2.25.1']
8+
dependencies = ['requests>=2.25.1', 'dataclasses>=0.6', 'dataclasses-json>=0.5.4', 'marshmallow>=3.12.2']
99

1010
setuptools.setup(
1111
name="servicestack",
1212
version="0.0.1",
1313
author="ServiceStack, Inc.",
1414
author_email="[email protected]",
15-
description="ServiceStack Python Client",
15+
description="ServiceStack Python Service Clients",
1616
long_description=long_description,
1717
long_description_content_type="text/markdown",
1818
url="https://github.com/ServiceStack/servicestack-python",
1919
license="BSD-3-Clause",
2020
keywords='servicestack,client,dotnet',
2121
install_requires=dependencies,
2222
packages=setuptools.find_packages(),
23-
tests_require=['pytest','dataclasses-json>=0.5.4','requests>=2.25.1'],
23+
tests_require=['pytest', 'dataclasses>=0.6', 'dataclasses-json>=0.5.4', 'requests>=2.25.1'],
2424
classifiers=[
2525
'Intended Audience :: Developers',
2626
'License :: OSI Approved :: BSD License',

0 commit comments

Comments
 (0)