Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
product-uniqer
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
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
Recolic
product-uniqer
Commits
d49a5f5c
There was an error fetching the commit references. Please try again later.
Commit
d49a5f5c
authored
5 years ago
by
Recolic Keghart
Browse files
Options
Downloads
Patches
Plain Diff
bug fix
parent
0e86c23d
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
csv_preprocess.py
+5
-1
5 additions, 1 deletion
csv_preprocess.py
summerize-part-list/main.py
+10
-7
10 additions, 7 deletions
summerize-part-list/main.py
with
15 additions
and
8 deletions
csv_preprocess.py
+
5
−
1
View file @
d49a5f5c
...
...
@@ -48,7 +48,11 @@ def trim_npArr(np_bi_arr):
res
.
append
(
_trim_str
(
line
))
else
:
res
.
append
([
_trim_str
(
item
)
for
item
in
line
])
return
np
.
array
(
res
)
if
len
(
res
)
==
0
or
type
(
res
[
0
])
!=
list
:
return
np
.
array
([
res
])
else
:
return
np
.
array
(
res
)
import
pandas
...
...
This diff is collapsed.
Click to expand it.
summerize-part-list/main.py
+
10
−
7
View file @
d49a5f5c
...
...
@@ -151,19 +151,22 @@ def add_product(serial, _id, name, quantity, must_have_xlsx=False, allow_recursi
contMat
=
_new_contMat
############ dirty end
csv_preprocess
.
npmat2csv
(
contMat
,
csv_buf
)
# moved down #
csv_preprocess.npmat2csv(contMat, csv_buf)
# recursive part reference
if
allow_
recursive
_
part
_
ref
:
for
line
in
contMat
:
line
=
line
.
tolist
()[
0
]
part_name
=
line
[
config
.
part_name_col_index
]
for
line
in
contMat
:
#
recursive
part
ref
erence
if
allow_recursive_part_ref
:
line
_ar
=
line
.
tolist
()[
0
]
part_name
=
line
_ar
[
config
.
part_name_col_index
]
part_id
=
get_id_prefix_from_string
(
part_name
)
if
part_id
!=
''
:
if
part_id
.
startswith
(
_id
):
log_warn
(
'
Self-reference detected on part {}. Skipping recursive walking.
'
.
format
(
_id
))
else
:
add_product
(
serial
,
part_id
,
part_name
,
stoi
(
quantity
)
*
stoi
(
line
[
config
.
part_quantity_col_index
]),
allow_recursive_part_ref
=
config
.
allow_part_tree_reference
)
add_product
(
serial
,
part_id
,
part_name
,
stoi
(
quantity
)
*
stoi
(
line_ar
[
config
.
part_quantity_col_index
]),
allow_recursive_part_ref
=
config
.
allow_part_tree_reference
)
continue
# DO not put the parent material into csv_buf again!
# put line into csv_buf
csv_preprocess
.
npmat2csv
(
line
,
csv_buf
)
else
:
if
must_have_xlsx
:
name_and_id
=
'
{}({})
'
.
format
(
name
,
_id
)
...
...
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