← back to York Reprice 2026 08

__pycache__/enrich-onboard.cpython-314.pyc

99 lines

+
a�jn(��:
�Rt^RIt^RIt^RIt^RIt^RIt^RIt^RIt^RI	H
t
^RIHt^RI
tRt]P P#]R4t]P P#]R4t]P(!]RR7]P*!]!]P P#]R	444t]P*!]!]P P#]R
444Uu0uFqR,kK
	uptRR�R
R�RR�RR�RR�RR�RR�RR�RR�RR�RR�RR�RR�RR�RR�/t]!]P744t]P:!]Uu.uFp]V,NK	up]R7tRt Rt!Rt"R�Rlt#R R!R"R#R$R%R&R'R(R)R*R+R,R-R.R/R0R%R1R2R3R4R5R6R7R8R9R:/t$R;R<R=R>R?R@RARBRCRDRERFRGRRHRIRJRKRLRMRNRORPRRQRRRSRT/t%RURVRWRXRYRZR[R\R]RR^RIR_R>R`RTRaRV/	t&R�Uu.uF
q"]9gKVNK	upt'Rbt(R�t)Rct*^t+^t,^t-.t.]
!4t/^t0^t1]
!4t2]3!]4EFwt4t5]5Rd,t6.t7Ret8]"!]5Rf,4t]#!]^Rg7t9]9Rh,t:.t;]9FEt<] !]<Ri,4t=];P}Rj]=Ri]<Ri,P4Rk]<Rk,/4KG	]3!]:^Rl7F&wt@t<]<Ri,]6Rm]@Rn2&]<Rk,]6Rm]@Ro2&K(	]P�!];R�Rp7]6Rq&]9^,Ri,]6Rr&]9^,Ri,]6Rs&] !]9^,Ri,4t8]8]6Rt&];Rh,Uu.uFq3Rj,NK
	upt7]-]B!]94,
t-]+^,
t+.tF]'FtG]FP}]G4K	]6P�RwRe4tI](!]$P�]I44tJ]J'd]FP}]J4M]I'd]2]I;;,^,
uu&](!]%P�]6P�RxRe444tK]K'd]FP}]K4](!]&P�]6P�RyRe444tL]L'd]FP}]L4]M!4tN]FUu.uF&q"]N9dK]NP�V4'dK$VNK(	uptF]F]5Rz&]FFtG]/]G;;,^,
uu&K	]B!]F4^8�d
]0^,
t0]*!]6]7]84tP]P]5R{&]1]B!]P4,
t1]4^,^2,^8XgEK�]Q!R|]4^,R}]B!]4R~]+R],R�2	RR�7EK	]P�!]]!]P P#]R�4R�4R�Rp7]P�!].]!]P P#]R�4R�4^R�7]B!]4tS]Q!R�4]Q!R�]+R�],R�]-]T!]+^4,R�
24]Q!R�]0R}]SR�24]Q!R�4]/P�^
4FwtGt<]Q!R�]<R�
R�]G24K	]Q!R�4]2P�4FwtVt<]Q!R�]<R�
R�]V24K	]Q!R�]1]S,R�
R�24]Q!R�4R#uupiuupiuupiuupi ]Cd@tD],^,
t,].P}Ru]5Ru,Rf]5Rf,Rv]E!]D4/4RtDADELORtDADii;iuupi)�u�York Phase-1 enrichment: PIL median-cut color-hex, collection routing, tag derivation.
$0 local — PIL/numpy for hex, deterministic hex->name, live-verified collection handles.N)�Counter)�Imagez//Users/macstudio3/Projects/york-reprice-2026-08�dataz	img-cacheT)�exist_okzonboard-payloads.jsonzlive-collections.json�handle�Whitez	Off-White�Beige�Tan�Brown�Gray�Black�Blue�Navy�Teal�Green�Gold�Red�Pink�Purple��dtypec�d�\VR,^4p\VR,^4p\VR,^4p\P!\\P!WV.\
R7,
^,P
^R74p\\VP44,#):��N:r�N:r�Nr)�axis)	�int�np�sqrt�NAMEV�array�float�sum�NAMES�argmin)�hexstr�r�g�b�ds&    �A/Users/macstudio3/Projects/york-reprice-2026-08/enrich-onboard.py�hex_to_namer,'sz���F�3�K���A��V�C�[��!4�Q�#�f�S�k�"�:M�a�
���%�"�(�(�A��7��7�7�!�;�@�@�a�@�H�I�A���Q�X�X�Z��!�!�c��RP\V^,4\V^,4\V^,44#)z#{:02X}{:02X}{:02X})�formatr)�rgbs&r+�
rgb_to_hexr1,s/�� �'�'��C��F��C��A��K��C��F��L�Lr-c�z�\P!VP44P4R,p\P
P
VPR4^,4^,P4pVR	9dRp\P
P\W,4p\P
PV4'd'\P
PV4^8�dV#\PPVRR/R7p\PP!V^-R7;_uu_4pVP#4pRRR4\%VR4;_uu_4qwP'X4RRR4V# +'giL?;i +'giT#;i)
:N�N�?z.imgz
User-AgentzMozilla/5.0 DW-local-enrich)�headers)�timeoutN�wb)z.jpgz.jpegz.pngz.webpz.gifz.bmp)�hashlib�sha256�encode�	hexdigest�os�path�splitext�split�lower�join�	IMG_CACHE�exists�getsize�urllib�request�Request�urlopen�read�open�write)�url�key�extr=�req�respr�fs&       r+�fetch_imagerR0s��
�.�.�����
&�
0�
0�
2�3�
7�C�
�'�'�
�
�3�9�9�S�>�!�,�
-�a�
0�
6�
6�
8�C�
�?�?�V��
�7�7�<�<�	�3�7�+�D�	�w�w�~�~�d��������� 5�� 9���
�.�.�
 �
 ��|�<Y�.Z�
 �
[�C�	���	�	��R�	�	0�	0�D��y�y�{��
1�	
�d�4���A�w�w�t�}���K�
1�	0��	���K�s�F�;F)�F&	�)F:	c	�X�\P!V4PR4pVPR4VP	V\P
R7pVP
4p\VP44p\VP44p.pVP4Fzwr�WH^,,q�V^,^,,q�V^,^,,p\RV	,V,^4p
VPR\W�V34RV
/4K|	V#)�RGB)�colors�methodgY@�hex�pct)��rY)rrJ�convert�	thumbnail�quantize�	MEDIANCUT�
getpaletter�getdatar#�values�most_common�round�appendr1)r=�k�im�q�pal�counts�total�out�idx�cntr'r(r)rXs&&            r+�dominant_colorsrm>s���	���D�	�	!�	!�%�	(�B��L�L���
���1�U�_�_��5�A�
�,�,�.�C�
�Q�Y�Y�[�
!�F���
�
�� �E�
�C��&�&�(����A��J���A��a��L��#�a�%��'�l�!��E�#�I�e�O�Q�'���
�
�E�:�q�1�g�.��s�;�<�)�
�Jr-�Greyszgrey-silver�Blueszblue-wallpaperzWhites & Off-Whiteszwarm-whites-ivory-1�Brownszbrown-wallpaper-collection�Beigesz beige-cream-wallpaper-collection�Greenszgreen-wallpaper-collection�Blacks�black�	Metallicszmetallic-wallpaper-collection�Neutrals�Purpleszpurple-wallcovering-collection�Redszred-wallpaper-collection�Oranges�orange�Yellowszyellow-wallpaper-collection�Pinkszpink-wallcovering-collection�Naturalszgrasscloth-natural-fiber�Traditional�traditional�Modern�modern�Transitionalztransitional-wallpaper�Glamznaturally-glamorous�Lodgez!rustic-charm-wallpaper-collection�	Masculine�	Whimsicalznovelty-wallpaper-collection�	Farmhousezfarmhouse-wallpaper�Bohemian�bohemian�Nauticalzcoastal-nautical-1�Eclectic�Sceniczmurals-scenics�Abstract�abstractzTexture Patternzeven-more-textures�Stripes�stripes�Damask�damask�
Geometrics�	geometriczSmall Prints�Novelty�Toile�GraphicszFabric & Woven Texturesc�0�V'dV\9dV#R#�N)�live_handles)�hs&r+�verifyr��s���q�L�(�1�3�t�3r-c�0�\4pVPR4VPR4VPR4VPR4'dVPVR,4VPR4'dVPVR,4VPR4VPR4VPRR4pV'dVPV4VFqSPV4K	V'dVPR	V,4VPR
R4pV'dVPV4VPRR4pV'dVPV4VPRR4pV'dHVPV4VP4P	R
4'dVPR4VPR
4R9dVPR4VPRR4pV'dVPV4VPRR4;'gRp	RF9p
V
P4V	P49gK(VPV
4K;	\RV44#)�Wallcovering�PatternzJeffrey Stevenszcustom.parent_brandzcustom.brand_name�display_variant�USA�custom.color_family�zcolor:�specs.style�
specs.patternzcustom.backing�nonz	Non-Woven�Naturalzcustom.collection_namezcustom.pattern_namec3�a"�TF|oS'gK
\S4P4'gK.\;QJd#V3Rl\4F'gKRM	RM!V3Rl\44'dKxSx�K~	R#5i)c3�Z<"�TF q\S4P49x�K"	R#5ir�)�strr@)�.0r*�ts& �r+�	<genexpr>�(derive_tags.<locals>.<genexpr>.<genexpr>�s����E�9�a�3�q�6�<�<�>�1�9�s�(+TFN)r��strip�any�	LEAK_DENY)r�r�s&@r+r��derive_tags.<locals>.<genexpr>�sI����G�T��Q�!�3�q�6�<�<�>�!��#�E�9�E�#�#�#�E�9�E�E��!�T�s �
B�B�
B�B�B�=
B)r})�
Paperweave�
Grasscloth�Striper��Floral�Leaf�	Geometric�Texture�Weave�Linen�Silk�Faux)�set�add�getr@�
startswith�sorted)�mf�color_names�bg_name�tags�cf�cn�st�pat�bk�pn�ws&&&        r+�derive_tagsr��s����5�D��H�H�^���H�H�Y���H�H�
��	�v�v�#�$�$�d�h�h�r�2G�/H�&I�	�v�v�!�"�"�D�H�H�R�0C�-D�$E��H�H�
���H�H�U�O�	���%�b�	)�B�	�4�8�8�B�<���8�8�B�<�k������'�)�*�	���
�b�	!�B�	�4�8�8�B�<�
�&�&���
$�C�
�D�H�H�S�M�	��� ��	$�B�	������
�8�8�:� � ��'�'����+�)>�	�v�v�m��
�-�t�x�x�	�/B�	���(��	,�B�	�4�8�8�B�<�
�&�&�&�r�
*�
0�
0�b�B�
~���7�7�9����
�"�D�H�H�Q�K���G�T�G�G�Gr-�
metafieldsr��image)rd:NrNrW�namerX)�startz
custom.color_�_hex�_percentage)�
separatorszcustom.color_detailszcustom.color_hexzglobal.color_hexzcustom.background_color�mfr_sku�errorr�r�r��collectionsr�z  [�/z
] color-done=z failed=z  $0 (local))�flushzonboard-payloads-enriched.jsonr�zonboard-color-fail-list.json)�indentz
===== ENRICHMENT SUMMARY =====zcolor: z done / z- failed image download; avg colors/product = z.2fz
collections: z routed >=1ztop-10 handle frequency:z   �4dz  z!color_family with NO live handle:z
tags: avg z
 tags/productu($0 (local) — PIL/numpy, no metered API)��r�r�)������)�����)����)�x�U�<)�r�r�)�r�r�)r��n�)��-�Z)�(�r�)�F�r�)rY��P)�r�r�)��r��)r�r�r�)�)zjeffrey-stevensz$jeffrey-stevens-wallpaper-collection)
�brewster�	wallquest�
chesapeake�nextwall�seabrook�	command54z
command 54�desima�carlstenznicolette mayer)�,�:)W�__doc__�jsonr<�sysr8�urllib.requestrE�io�timer�r�PILr�numpyr�ROOTr=rA�DATArB�makedirs�loadrJ�payloadsr��NAMED�list�keysr$r!r"r r,r1rRrm�COLOR_FAMILY_HANDLE�STYLE_HANDLE�PATTERN_HANDLE�VENDOR_HANDLESr�r�r��done�failed�total_colors�	fail_list�handle_freq�	routed_ct�	tag_total�missing_family�	enumerate�i�pr�r�r��cols�top3�details�c�nmrcr@�n�dumps�len�	Exception�er��handlesr�r��fam�ch�sh�phr��seenr�r��print�dump�N�maxrarQ)r'r)r�r*s0000r+�<module>r8s'��^�7�7�7�7����8��	�w�w�|�|�D�&�!���G�G�L�L��{�+�	����I��%��9�9�T�"�'�'�,�,�t�-D�E�F�G��%)�Y�Y�t�B�G�G�L�L��G^�4_�/`�%a�b�%a��(���%a�b��
�-��-��-�	�-��+�
�-��*�
�,�
�*�
�,��+�
�,�	�+�
�-��,�	��"	
�U�Z�Z�\���
���E�*�E�q�%��(�(�E�*�%�8��"�
M���&�=��+��0��7��=��7��7��:��0�
�;�
�5�
�8�
�8��9���&�/��]��X��-�
�*��8��T��3��*��Z��)��T��%��Z���&�+�
�y��x��{��t�
�5��}��z��3�
��X�m�W��`l�[l�!�!�W�m��4�
Q�	�$G�N��q��q�,�
�	��I��
�	�
�	��y���X��C�A�a�	
�<��B��K�B�G�U��1�W�:�&���t�q�)���B�x�����A��Q�u�X�&�B��N�N�F�2�e�A�e�H�N�N�,<�U�1�U�8�L�M���T��+�C�A�a�*+�E�(�B��q�c��&�'�12�5��B��q�c��-�.�,�&*�Z�Z��I�%N��!�"�!%�a�������!%�a��������d�1�g�e�n�-��(/��$�%�*1�"�+�6�+�Q��y�y�+�6����D�	�!����	��
�G�
��W�^�^�A�.�^�
�&�&�&�r�
*�C�	�#�'�'��,�	-�B�	�7�>�>�"��	��s��q� ��	�� � ����
�b�!9�:�	;�B�	�7�>�>�"��	��"�"�2�6�6�/�"�#=�>�	?�B�	�7�>�>�"��	��D�G�N�G�q��I�����!����G�N���A�m��
��k�!�n�a�'�n�W�
�7�|�Q��	�1��	��r�;��0�D��A�f�I�
��T���I�	�!��r�z�Q��
��A�a�C�5��#�h�-��
�d�V�8�F�8�<�X�`d�e�e�k�p�	�	�(�D������d�+K�L�S�Q�^g�h��	�	�)�T�"�'�'�,�,�t�,J�K�C�P�YZ�[��h�-���(�)����v�X�f�X�%R�S_�`c�dh�ij�`k�Sk�lo�Rp�q�r��
�i�[��!��K�0�1�� �!��"�"�2�&�C�A�a���A�b�6��A�3�.?�(@�&��)�*��%�%�'�C�A�a���Q�r�F�"�Q�C�/@�)A�'��
�9�Q�;�s�#�=�1�2��0�1��cc��,+��xn��b7���U��!������)�A�i�L���7��G�C�PQ�F�S�T�T��U��"OsU�#X;�=Y�:Y�Y�DY�Y
�&Y�Z�Z�.Z�
Y�Z�4Z�Z