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

exception tendril.sourcing.vendors.DBPartDataExpired[source]

Bases: tendril.sourcing.vendors.DBPartDataUnusable

exception tendril.sourcing.vendors.DBPartDataIncomplete[source]

Bases: tendril.sourcing.vendors.DBPartDataUnusable

exception tendril.sourcing.vendors.DBPartDataUnavailable[source]

Bases: tendril.sourcing.vendors.DBPartDataUnusable

class tendril.sourcing.vendors.VendorMapFileDB(vendor)[source]

Bases: tendril.entityhub.maps.MapFileBase

length()[source]
get_user_map()[source]
get_idents()[source]
get_map_time(canonical)[source]
get_canonical(partno)[source]
get_apartnos(canonical)[source]
get_upartnos(canonical)[source]
get_strategy(canonical)[source]
remove_apartno(partno, canonical)[source]
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
_acquire_lines()[source]
class tendril.sourcing.vendors.VendorOrder(vendor, orderref)[source]

Bases: object

add(line)[source]
lines
orderref
class tendril.sourcing.vendors.VendorPrice(moq, price, currency_def, oqmultiple=1)[source]

Bases: object

moq
oqmultiple
unit_price
extended_price(qty, allow_partial=False)[source]
exch_rate
is_foreign
class tendril.sourcing.vendors.VendorPartBase(vpno, ident, vendor, max_age=-1, shell_only=False)[source]

Bases: object

_populate(max_age=-1)[source]
commit(session=None)[source]
_commit_to_db(session)[source]
load_from_db(max_age, session=None)[source]
_load_from_db(max_age, session, expired_is_error=False)[source]
_get_data()[source]
add_price(price)[source]
last_updated
vpno
vqtyavail
vparturl
manufacturer
mpartno
vpartdesc
ident
pkgqty
abs_moq
vpart_url
prices
_get_additional_rates()[source]
_get_additional_price_components(price)[source]
_get_effective_price(price)[source]
get_effective_price(price)[source]
effective_prices
detailed_prices
get_price(qty)[source]
class tendril.sourcing.vendors.VendorElnPartBase(vpno, ident, vendor, max_age, shell_only=False)[source]

Bases: tendril.sourcing.vendors.VendorPartBase

_commit_to_db(session)[source]
_load_from_db(max_age, session, expired_is_error=False)[source]
_get_data()[source]
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

_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
url_base
get_idents()[source]
get_all_vpnos()[source]
get_all_vparts(max_age=-1)[source]
get_vpnos(ident, max_age=-1)[source]
search_vpnos(ident)[source]
get_vpart(vpartno, ident=None, max_age=-1)[source]
static _get_candidate_tcost(candidate, oqty)[source]
_get_candidate_isinfo(candidate, oqty)[source]
get_optimal_pricing(ident, rqty, get_all=False)[source]
add_order_additional_cost_component(desc, percent)[source]
get_effective_price(price)[source]
get_additional_costs(price)[source]
order_baseprice
add_order_baseprice_component(desc, value)[source]
add_to_order(line, orderref=None)[source]
_dump_open_order(path)[source]
_generate_purchase_order(path)[source]
finalize_order(path)[source]
static _filter_results_unfiltered(parts)[source]

Given a list of vendors.SearchPart instances, returns a vendors.SearchResult instance, whose parts 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 a vendors.SearchResult instance, whose parts 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 to EXACT_MATCH_FFP.

Return type:vendors.SearchResult
static _find_consensus_package(parts)[source]

Given a list of vendors.SearchPart instances, returns a vendors.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 to CONSENSUS_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 a vendors.SearchResult instance, whose parts 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 a vendors.SearchResult instance, whose parts 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 to NAIVE_FP_MATCH or NAIVE_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 a vendors.SearchResult instance, whose parts 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 :

The returned vendors.SearchResult instance always has its status attribute set to True, and the strategy attribute is passed along unmodified from the inner filter function.

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 two vendors.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 the vendors.SearchResult instance returned by _filter_results().