Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
minijson
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
minijson
Commits
d1631724
Commit
d1631724
authored
3 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
refactor: deduplication + fixed PyPy's deploy
parent
2e071518
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
.travis.yml
+1
-1
1 addition, 1 deletion
.travis.yml
Dockerfile
+1
-1
1 addition, 1 deletion
Dockerfile
README.md
+2
-0
2 additions, 0 deletions
README.md
docs/changelog.md
+5
-0
5 additions, 0 deletions
docs/changelog.md
minijson.pyx
+17
-21
17 additions, 21 deletions
minijson.pyx
setup.cfg
+1
-1
1 addition, 1 deletion
setup.cfg
with
27 additions
and
24 deletions
.travis.yml
+
1
−
1
View file @
d1631724
...
...
@@ -131,7 +131,7 @@ jobs:
before_script
:
-
sudo apt-get update
-
sudo apt-get install -y patchelf
-
pypy3 -m pip install wheel auditwheel twine doctor-wheel cython
-
pypy3 -m pip install
-U
wheel auditwheel twine doctor-wheel cython
script
:
-
pypy3 setup.py bdist_wheel
-
cd dist
...
...
This diff is collapsed.
Click to expand it.
Dockerfile
+
1
−
1
View file @
d1631724
FROM
python:3.8
RUN
apt-get update
&&
\
apt-get install -y patchelf
RUN
python
-m
pip
install
Cython pytest coverage pytest-cov
auditwheel doctor-wheel twine
RUN
python
-m
pip
install
Cython pytest coverage pytest-cov
WORKDIR
/tmp/compile
ADD
. /tmp/compile/
...
...
This diff is collapsed.
Click to expand it.
README.md
+
2
−
0
View file @
d1631724
...
...
@@ -28,3 +28,5 @@ Alternatively, you can
and I'll do my best to compile a wheel for you.
In order to do that you must have
`Cython`
installed.
Run the Dockerfile to launch unit tests locally.
This diff is collapsed.
Click to expand it.
docs/changelog.md
+
5
−
0
View file @
d1631724
Changelog
=========
v2.9
----
*
minor refactor: code deduplication
v2.8
----
...
...
This diff is collapsed.
Click to expand it.
minijson.pyx
+
17
−
21
View file @
d1631724
...
...
@@ -341,7 +341,7 @@ cdef class MiniJSONEncoder:
self
.
use_double
=
use_double
self
.
use_strict_order
=
use_strict_order
def
should_double_be_used
(
self
,
y
)
->
bool
:
def
should_double_be_used
(
self
,
y
:
float
)
->
bool
:
"""
A function that you are meant to overload that will decide on a per-case basis
which representation should be used for given number.
...
...
@@ -514,18 +514,17 @@ cdef class MiniJSONEncoder:
cio
.
write
(
b
'
\x12
'
)
cio
.
write
(
STRUCT_L
.
pack
(
length
))
length
=
5
data
=
data
.
items
()
if
self
.
use_strict_order
:
items
=
list
(
data
.
items
())
items
.
sort
()
for
field_name
,
elem
in
items
:
cio
.
write
(
bytearray
([
len
(
field_name
)]))
cio
.
write
(
field_name
.
encode
(
'
utf-8
'
))
length
+=
self
.
dump
(
elem
,
cio
)
else
:
for
field_name
,
elem
in
data
.
items
():
cio
.
write
(
bytearray
([
len
(
field_name
)]))
cio
.
write
(
field_name
.
encode
(
'
utf-8
'
))
length
+=
self
.
dump
(
elem
,
cio
)
data
=
list
(
data
)
data
.
sort
()
# sort implicitly will sort it by first value, which is the key
for
field_name
,
elem
in
data
:
cio
.
write
(
bytearray
([
len
(
field_name
)]))
cio
.
write
(
field_name
.
encode
(
'
utf-8
'
))
length
+=
self
.
dump
(
elem
,
cio
)
return
length
else
:
if
length
<=
0xF
:
...
...
@@ -542,16 +541,13 @@ cdef class MiniJSONEncoder:
cio
.
write
(
b
'
\x13
'
)
cio
.
write
(
STRUCT_L
.
pack
(
length
))
offset
=
5
data
=
data
.
items
()
if
self
.
use_strict_order
:
items
=
list
(
data
.
items
())
items
.
sort
()
for
key
,
value
in
items
:
offset
+=
self
.
dump
(
key
,
cio
)
offset
+=
self
.
dump
(
value
,
cio
)
else
:
for
key
,
value
in
data
.
items
():
offset
+=
self
.
dump
(
key
,
cio
)
offset
+=
self
.
dump
(
value
,
cio
)
data
=
list
(
data
)
data
.
sort
()
# sort implicitly will sort it by first value, which is the key
for
key
,
value
in
data
:
offset
+=
self
.
dump
(
key
,
cio
)
offset
+=
self
.
dump
(
value
,
cio
)
return
offset
else
:
v
=
self
.
default
(
data
)
...
...
This diff is collapsed.
Click to expand it.
setup.cfg
+
1
−
1
View file @
d1631724
# coding:
utf-8
[metadata]
version
= 2.
8
version
= 2.
9a1
name
= minijson
long_description
= file: README.md
long_description_content_type
= text/markdown; charset=UTF-8
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment