tendril.sourcing.vendors module¶
Vendors module documentation (tendril.sourcing.vendors
)¶
-
class
tendril.sourcing.vendors.
SearchResult
¶ Bases:
tuple
A
collections.namedtuple
used internally to pass around (sub)search results conveniently.-
_asdict
()¶ Return a new OrderedDict which maps field names to their values
-
_fields
= ('success', 'parts', 'strategy')¶
-
classmethod
_make
(iterable, new=<built-in method __new__ of type object at 0x906d60>, len=<built-in function len>)¶ Make a new SearchResult object from a sequence or iterable
-
_replace
(_self, **kwds)¶ Return a new SearchResult object replacing specified fields with new values
-
parts
¶ Alias for field number 1
-
strategy
¶ Alias for field number 2
-
success
¶ Alias for field number 0
-
-
class
tendril.sourcing.vendors.
SearchPart
¶ Bases:
tuple
A
collections.namedtuple
used internally to pass around part data conveniently.-
_asdict
()¶ Return a new OrderedDict which maps field names to their values
-
_fields
= ('pno', 'mfgpno', 'package', 'ns', 'unitp', 'minqty', 'raw')¶
-
classmethod
_make
(iterable, new=<built-in method __new__ of type object at 0x906d60>, len=<built-in function len>)¶ Make a new SearchPart object from a sequence or iterable
-
_replace
(_self, **kwds)¶ Return a new SearchPart object replacing specified fields with new values
-
mfgpno
¶ Alias for field number 1
-
minqty
¶ Alias for field number 5
-
ns
¶ Alias for field number 3
-
package
¶ Alias for field number 2
-
pno
¶ Alias for field number 0
-
raw
¶ Alias for field number 6
-
unitp
¶ Alias for field number 4
-
-
class
tendril.sourcing.vendors.
SourcingInfo
¶ Bases:
tuple
A
collections.namedtuple
used internally to pass around sourcing information for a single ident from a single vendor at a specified quantity.-
_asdict
()¶ Return a new OrderedDict which maps field names to their values
-
_fields
= ('vobj', 'vpart', 'oqty', 'nbprice', 'ubprice', 'effprice', 'urationale', 'olduprice')¶
-
classmethod
_make
(iterable, new=<built-in method __new__ of type object at 0x906d60>, len=<built-in function len>)¶ Make a new SourcingInfo object from a sequence or iterable
-
_replace
(_self, **kwds)¶ Return a new SourcingInfo object replacing specified fields with new values
-
effprice
¶ Alias for field number 5
-
nbprice
¶ Alias for field number 3
-
olduprice
¶ Alias for field number 7
-
oqty
¶ Alias for field number 2
-
ubprice
¶ Alias for field number 4
-
urationale
¶ Alias for field number 6
-
vobj
¶ Alias for field number 0
-
vpart
¶ Alias for field number 1
-
-
exception
tendril.sourcing.vendors.
VendorPartRetrievalError
[source]¶ Bases:
exceptions.Exception
-
exception
tendril.sourcing.vendors.
VendorPartPricingError
[source]¶ Bases:
exceptions.Exception
-
exception
tendril.sourcing.vendors.
DBPartDataUnusable
[source]¶ Bases:
exceptions.Exception
-
class
tendril.sourcing.vendors.
VendorInvoiceLine
(invoice, ident, vpno, unitp, qty, desc=None)[source]¶ Bases:
object
-
desc
¶
-
ident
¶
-
vpno
¶
-
unitprice
¶
-
extendedprice
¶
-
effectiveprice
¶
-
qty
¶
-
-
class
tendril.sourcing.vendors.
VendorInvoice
(vendor, inv_no, inv_date)[source]¶ Bases:
object
-
vendor_name
¶
-
currency
¶
-
inv_no
¶
-
inv_date
¶
-
linecount
¶
-
lines
¶
-
extendedtotal
¶
-
effectivetotal
¶
-
-
class
tendril.sourcing.vendors.
VendorOrder
(vendor, orderref)[source]¶ Bases:
object
-
lines
¶
-
orderref
¶
-
-
class
tendril.sourcing.vendors.
VendorPrice
(moq, price, currency_def, oqmultiple=1)[source]¶ Bases:
object
-
moq
¶
-
oqmultiple
¶
-
unit_price
¶
-
exch_rate
¶
-
is_foreign
¶
-
-
class
tendril.sourcing.vendors.
VendorPartBase
(vpno, ident, vendor, max_age=-1, shell_only=False)[source]¶ Bases:
object
-
last_updated
¶
-
vpno
¶
-
vqtyavail
¶
-
vparturl
¶
-
manufacturer
¶
-
mpartno
¶
-
vpartdesc
¶
-
ident
¶
-
pkgqty
¶
-
abs_moq
¶
-
vpart_url
¶
-
prices
¶
-
effective_prices
¶
-
detailed_prices
¶
-
-
class
tendril.sourcing.vendors.
VendorElnPartBase
(vpno, ident, vendor, max_age, shell_only=False)[source]¶ Bases:
tendril.sourcing.vendors.VendorPartBase
-
package
¶
-
datasheet
¶
-
-
class
tendril.sourcing.vendors.
VendorBase
(name, dname, pclass, mappath=None, currency_code='INR', currency_symbol='xe2x82xb9', vendorlogo=None, sname=None, is_manufacturer=None, vtype=None)[source]¶ Bases:
object
-
_vendorlogo
= None¶
-
_partclass
¶ alias of
VendorPartBase
-
_invoiceclass
¶ alias of
VendorInvoice
-
_type
= 'BASE'¶
-
_url_base
= None¶
-
name
¶
-
sname
¶
-
cname
¶
-
pclass
¶
-
type
¶
-
is_manufacturer
¶
-
mappath
¶
-
map
¶
-
currency
¶
-
additional_costs
¶
-
logo
¶
-
url_base
¶
-
order_baseprice
¶
-
static
_filter_results_unfiltered
(parts)[source]¶ Given a list of
vendors.SearchPart
instances, returns avendors.SearchResult
instance, whoseparts
attribute includes a list of part numbers.If any of the part numbers are not listed as Non-Stocked, only the Stocked results are returned along with the strategy
UNFILTERED
.If all of the part numbers are listed as Non-Stocked, then all the part numbers are returned with the strategy
UNFILTERED_ALLOW_NS
.Return type: vendors.SearchResult
-
static
_find_exact_match_package
(parts, value)[source]¶ Given a list of
vendors.SearchPart
instances and a known value, returns avendors.SearchResult
instance, whoseparts
attribute includes only the package of the part whose manufacturer part number (mfgpno
) exactly matches the given value, if such an exact match can be found.The
vendors.SearchResult
returned on success has it’s strategy attribute set toEXACT_MATCH_FFP
.Return type: vendors.SearchResult
-
static
_find_consensus_package
(parts)[source]¶ Given a list of
vendors.SearchPart
instances, returns avendors.SearchResult
instance, whose ‘parts’ attribute includes only the consensus package of all the parts in the provided list, if such a consensus can be reached.The
vendors.SearchResult
returned on success has it’s strategy attribute set toCONSENSUS_FP_MATCH
.Return type: vendors.SearchResult
-
static
_filter_results_bycpackage
(parts, cpackage, strategy)[source]¶ Given a list of
vendors.SearchPart
instances, and a consensus package string, returns avendors.SearchResult
instance, whoseparts
attribute includes the part numbers of all the parts in the provided list whose package attribute matches the consensus package.When used in the correct context, this function uses cpackage instead of the original footprint. cpackage is itself extracted from the result table, and therefore greatly decreases (though not eliminates) the odds of false negatives.
A strategy is accepted as the third argument to this function, and is returned within the
vendors.SearchResult
, with modification to append_ALLOW_NS
if necessary.Parameters: cpackage (str) – A consensus or exact match package. Return type: vendors.SearchResult
-
static
_filter_results_byfootprint
(parts, footprint)[source]¶ Given a list of
vendors.SearchPart
instances and the target footprint, returns avendors.SearchResult
instance, whoseparts
attribute includes part numbers for all parts in the provided list whose package attribute contains the provided footprint.This is a last ditch effort. Due to the diversity in package nomenclature, this has a very low likelihood of success without an exceptionally well curated symbol library. The
vendors.SearchResult
returned on success has it’s strategy attribute set toNAIVE_FP_MATCH
orNAIVE_FP_MATCH_ALLOW_NS
.Return type: vendors.SearchResult
-
_filter_results
(parts, value, footprint)[source]¶ Given a list of
vendors.SearchPart
, and the target value and footprint, returns avendors.SearchResult
instance, whoseparts
attribute includes part numbers for all parts in the provided list matching the required value and footprint.The filtering is done in the following sequence :
- If the first part in
parts
contains no package information or the provided targetfootprint
isNone
, then filtering is done solely using_filter_results_unfiltered()
. - If an exact match package (
_find_exact_match_package()
) or consensus package (_find_consensus_package()
) is found, it is used ascpackage
and filtered using_filter_results_bycpackage()
. - If none of the previous conditions were met,
_filter_results_byfootprint()
is used.
The returned
vendors.SearchResult
instance always has itsstatus
attribute set toTrue
, and thestrategy
attribute is passed along unmodified from the inner filter function.- If the first part in
-
static
_remove_duplicates
(parts)[source]¶ Given a list of
vendors.SearchPart
instances, this function removes any duplicates that may have crept in. In this case, the necessary and sufficient condition for twovendors.SearchPart
instances to be duplicates of each other is that they have the same vendor part number (pno
).
-
_process_results
(parts, value, footprint)[source]¶ Processes a list of
vendors.SearchPart
instances, using_remove_duplicates()
and_filter_results()
, and returns thevendors.SearchResult
instance returned by_filter_results()
.
-