code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def modify( cls, id: str, **params: Unpack["Location.ModifyParams"] ) -> "Location": """ Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. """ url = "%s/%s" % (cls.class_url(), sanitize_id(id)) ...
Updates a Location object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
modify
python
stripe/stripe-python
stripe/terminal/_location.py
https://github.com/stripe/stripe-python/blob/master/stripe/terminal/_location.py
MIT
def _cls_collect_inputs( cls, reader: str, **params: Unpack["Reader.CollectInputsParams"] ) -> "Reader": """ Initiates an input collection flow on a Reader. """ return cast( "Reader", cls._static_request( "post", "/v1/te...
Initiates an input collection flow on a Reader.
_cls_collect_inputs
python
stripe/stripe-python
stripe/terminal/_reader.py
https://github.com/stripe/stripe-python/blob/master/stripe/terminal/_reader.py
MIT
def modify( cls, id: str, **params: Unpack["Reader.ModifyParams"] ) -> "Reader": """ Updates a Reader object by setting the values of the parameters passed. Any parameters not provided will be left unchanged. """ url = "%s/%s" % (cls.class_url(), sanitize_id(id)) retu...
Updates a Reader object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.
modify
python
stripe/stripe-python
stripe/terminal/_reader.py
https://github.com/stripe/stripe-python/blob/master/stripe/terminal/_reader.py
MIT
def _cls_process_setup_intent( cls, reader: str, **params: Unpack["Reader.ProcessSetupIntentParams"] ) -> "Reader": """ Initiates a setup intent flow on a Reader. """ return cast( "Reader", cls._static_request( "post", "...
Initiates a setup intent flow on a Reader.
_cls_process_setup_intent
python
stripe/stripe-python
stripe/terminal/_reader.py
https://github.com/stripe/stripe-python/blob/master/stripe/terminal/_reader.py
MIT
def _cls_set_reader_display( cls, reader: str, **params: Unpack["Reader.SetReaderDisplayParams"] ) -> "Reader": """ Sets reader display to show cart details. """ return cast( "Reader", cls._static_request( "post", "/v1/t...
Sets reader display to show cart details.
_cls_set_reader_display
python
stripe/stripe-python
stripe/terminal/_reader.py
https://github.com/stripe/stripe-python/blob/master/stripe/terminal/_reader.py
MIT
def _cls_present_payment_method( cls, reader: str, **params: Unpack["Reader.PresentPaymentMethodParams"], ) -> "Reader": """ Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a tran...
Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.
_cls_present_payment_method
python
stripe/stripe-python
stripe/terminal/_reader.py
https://github.com/stripe/stripe-python/blob/master/stripe/terminal/_reader.py
MIT
def _cls_succeed_input_collection( cls, reader: str, **params: Unpack["Reader.SucceedInputCollectionParams"], ) -> "Reader": """ Use this endpoint to trigger a successful input collection on a simulated reader. """ return cast( ...
Use this endpoint to trigger a successful input collection on a simulated reader.
_cls_succeed_input_collection
python
stripe/stripe-python
stripe/terminal/_reader.py
https://github.com/stripe/stripe-python/blob/master/stripe/terminal/_reader.py
MIT
def _cls_timeout_input_collection( cls, reader: str, **params: Unpack["Reader.TimeoutInputCollectionParams"], ) -> "Reader": """ Use this endpoint to complete an input collection with a timeout error on a simulated reader. """ r...
Use this endpoint to complete an input collection with a timeout error on a simulated reader.
_cls_timeout_input_collection
python
stripe/stripe-python
stripe/terminal/_reader.py
https://github.com/stripe/stripe-python/blob/master/stripe/terminal/_reader.py
MIT
def create( self, params: "ConfirmationTokenService.CreateParams" = {}, options: RequestOptions = {}, ) -> ConfirmationToken: """ Creates a test mode Confirmation Token server side for your integration tests. """ return cast( ConfirmationToken, ...
Creates a test mode Confirmation Token server side for your integration tests.
create
python
stripe/stripe-python
stripe/test_helpers/_confirmation_token_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/_confirmation_token_service.py
MIT
def fund_cash_balance( self, customer: str, params: "CustomerService.FundCashBalanceParams", options: RequestOptions = {}, ) -> CustomerCashBalanceTransaction: """ Create an incoming testmode bank transfer """ return cast( CustomerCashBalan...
Create an incoming testmode bank transfer
fund_cash_balance
python
stripe/stripe-python
stripe/test_helpers/_customer_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/_customer_service.py
MIT
def _cls_advance( cls, test_clock: str, **params: Unpack["TestClock.AdvanceParams"] ) -> "TestClock": """ Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready. """ return cast( "TestClock", c...
Starts advancing a test clock to a specified time in the future. Advancement is done when status changes to Ready.
_cls_advance
python
stripe/stripe-python
stripe/test_helpers/_test_clock.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/_test_clock.py
MIT
def create(cls, **params: Unpack["TestClock.CreateParams"]) -> "TestClock": """ Creates a new test clock that can be attached to new customers and quotes. """ return cast( "TestClock", cls._static_request( "post", cls.class_url(), ...
Creates a new test clock that can be attached to new customers and quotes.
create
python
stripe/stripe-python
stripe/test_helpers/_test_clock.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/_test_clock.py
MIT
def list( cls, **params: Unpack["TestClock.ListParams"] ) -> ListObject["TestClock"]: """ Returns a list of your test clocks. """ result = cls._static_request( "get", cls.class_url(), params=params, ) if not isinstance(resul...
Returns a list of your test clocks.
list
python
stripe/stripe-python
stripe/test_helpers/_test_clock.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/_test_clock.py
MIT
def finalize_amount( self, authorization: str, params: "AuthorizationService.FinalizeAmountParams", options: RequestOptions = {}, ) -> Authorization: """ Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amou...
Finalize the amount on an Authorization prior to capture, when the initial authorization was for an estimated amount.
finalize_amount
python
stripe/stripe-python
stripe/test_helpers/issuing/_authorization_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_authorization_service.py
MIT
def respond( self, authorization: str, params: "AuthorizationService.RespondParams", options: RequestOptions = {}, ) -> Authorization: """ Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of le...
Respond to a fraud challenge on a testmode Issuing authorization, simulating either a confirmation of fraud or a correction of legitimacy.
respond
python
stripe/stripe-python
stripe/test_helpers/issuing/_authorization_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_authorization_service.py
MIT
def deliver_card( self, card: str, params: "CardService.DeliverCardParams" = {}, options: RequestOptions = {}, ) -> Card: """ Updates the shipping status of the specified Issuing Card object to delivered. """ return cast( Card, ...
Updates the shipping status of the specified Issuing Card object to delivered.
deliver_card
python
stripe/stripe-python
stripe/test_helpers/issuing/_card_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_card_service.py
MIT
def fail_card( self, card: str, params: "CardService.FailCardParams" = {}, options: RequestOptions = {}, ) -> Card: """ Updates the shipping status of the specified Issuing Card object to failure. """ return cast( Card, self._re...
Updates the shipping status of the specified Issuing Card object to failure.
fail_card
python
stripe/stripe-python
stripe/test_helpers/issuing/_card_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_card_service.py
MIT
def return_card( self, card: str, params: "CardService.ReturnCardParams" = {}, options: RequestOptions = {}, ) -> Card: """ Updates the shipping status of the specified Issuing Card object to returned. """ return cast( Card, sel...
Updates the shipping status of the specified Issuing Card object to returned.
return_card
python
stripe/stripe-python
stripe/test_helpers/issuing/_card_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_card_service.py
MIT
def ship_card( self, card: str, params: "CardService.ShipCardParams" = {}, options: RequestOptions = {}, ) -> Card: """ Updates the shipping status of the specified Issuing Card object to shipped. """ return cast( Card, self._re...
Updates the shipping status of the specified Issuing Card object to shipped.
ship_card
python
stripe/stripe-python
stripe/test_helpers/issuing/_card_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_card_service.py
MIT
def activate( self, personalization_design: str, params: "PersonalizationDesignService.ActivateParams" = {}, options: RequestOptions = {}, ) -> PersonalizationDesign: """ Updates the status of the specified testmode personalization design object to active. """...
Updates the status of the specified testmode personalization design object to active.
activate
python
stripe/stripe-python
stripe/test_helpers/issuing/_personalization_design_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_personalization_design_service.py
MIT
def deactivate( self, personalization_design: str, params: "PersonalizationDesignService.DeactivateParams" = {}, options: RequestOptions = {}, ) -> PersonalizationDesign: """ Updates the status of the specified testmode personalization design object to inactive. ...
Updates the status of the specified testmode personalization design object to inactive.
deactivate
python
stripe/stripe-python
stripe/test_helpers/issuing/_personalization_design_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_personalization_design_service.py
MIT
def reject( self, personalization_design: str, params: "PersonalizationDesignService.RejectParams", options: RequestOptions = {}, ) -> PersonalizationDesign: """ Updates the status of the specified testmode personalization design object to rejected. """ ...
Updates the status of the specified testmode personalization design object to rejected.
reject
python
stripe/stripe-python
stripe/test_helpers/issuing/_personalization_design_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_personalization_design_service.py
MIT
def create_force_capture( self, params: "TransactionService.CreateForceCaptureParams", options: RequestOptions = {}, ) -> Transaction: """ Allows the user to capture an arbitrary amount, also known as a forced capture. """ return cast( Transaction,...
Allows the user to capture an arbitrary amount, also known as a forced capture.
create_force_capture
python
stripe/stripe-python
stripe/test_helpers/issuing/_transaction_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_transaction_service.py
MIT
def create_unlinked_refund( self, params: "TransactionService.CreateUnlinkedRefundParams", options: RequestOptions = {}, ) -> Transaction: """ Allows the user to refund an arbitrary amount, also known as a unlinked refund. """ return cast( Transact...
Allows the user to refund an arbitrary amount, also known as a unlinked refund.
create_unlinked_refund
python
stripe/stripe-python
stripe/test_helpers/issuing/_transaction_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/issuing/_transaction_service.py
MIT
def present_payment_method( self, reader: str, params: "ReaderService.PresentPaymentMethodParams" = {}, options: RequestOptions = {}, ) -> Reader: """ Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refund...
Presents a payment method on a simulated reader. Can be used to simulate accepting a payment, saving a card or refunding a transaction.
present_payment_method
python
stripe/stripe-python
stripe/test_helpers/terminal/_reader_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/terminal/_reader_service.py
MIT
def succeed_input_collection( self, reader: str, params: "ReaderService.SucceedInputCollectionParams" = {}, options: RequestOptions = {}, ) -> Reader: """ Use this endpoint to trigger a successful input collection on a simulated reader. """ return cast...
Use this endpoint to trigger a successful input collection on a simulated reader.
succeed_input_collection
python
stripe/stripe-python
stripe/test_helpers/terminal/_reader_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/terminal/_reader_service.py
MIT
def timeout_input_collection( self, reader: str, params: "ReaderService.TimeoutInputCollectionParams" = {}, options: RequestOptions = {}, ) -> Reader: """ Use this endpoint to complete an input collection with a timeout error on a simulated reader. """ ...
Use this endpoint to complete an input collection with a timeout error on a simulated reader.
timeout_input_collection
python
stripe/stripe-python
stripe/test_helpers/terminal/_reader_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/terminal/_reader_service.py
MIT
def fail( self, id: str, params: "InboundTransferService.FailParams" = {}, options: RequestOptions = {}, ) -> InboundTransfer: """ Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. ...
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
fail
python
stripe/stripe-python
stripe/test_helpers/treasury/_inbound_transfer_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_inbound_transfer_service.py
MIT
def return_inbound_transfer( self, id: str, params: "InboundTransferService.ReturnInboundTransferParams" = {}, options: RequestOptions = {}, ) -> InboundTransfer: """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDeb...
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
return_inbound_transfer
python
stripe/stripe-python
stripe/test_helpers/treasury/_inbound_transfer_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_inbound_transfer_service.py
MIT
def succeed( self, id: str, params: "InboundTransferService.SucceedParams" = {}, options: RequestOptions = {}, ) -> InboundTransfer: """ Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing stat...
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
succeed
python
stripe/stripe-python
stripe/test_helpers/treasury/_inbound_transfer_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_inbound_transfer_service.py
MIT
def update( self, id: str, params: "OutboundPaymentService.UpdateParams", options: RequestOptions = {}, ) -> OutboundPayment: """ Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the cancel...
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
update
python
stripe/stripe-python
stripe/test_helpers/treasury/_outbound_payment_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_outbound_payment_service.py
MIT
def fail( self, id: str, params: "OutboundPaymentService.FailParams" = {}, options: RequestOptions = {}, ) -> OutboundPayment: """ Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state. ...
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
fail
python
stripe/stripe-python
stripe/test_helpers/treasury/_outbound_payment_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_outbound_payment_service.py
MIT
def post( self, id: str, params: "OutboundPaymentService.PostParams" = {}, options: RequestOptions = {}, ) -> OutboundPayment: """ Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state. ...
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
post
python
stripe/stripe-python
stripe/test_helpers/treasury/_outbound_payment_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_outbound_payment_service.py
MIT
def return_outbound_payment( self, id: str, params: "OutboundPaymentService.ReturnOutboundPaymentParams" = {}, options: RequestOptions = {}, ) -> OutboundPayment: """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must alre...
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
return_outbound_payment
python
stripe/stripe-python
stripe/test_helpers/treasury/_outbound_payment_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_outbound_payment_service.py
MIT
def update( self, outbound_transfer: str, params: "OutboundTransferService.UpdateParams", options: RequestOptions = {}, ) -> OutboundTransfer: """ Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cann...
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
update
python
stripe/stripe-python
stripe/test_helpers/treasury/_outbound_transfer_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_outbound_transfer_service.py
MIT
def fail( self, outbound_transfer: str, params: "OutboundTransferService.FailParams" = {}, options: RequestOptions = {}, ) -> OutboundTransfer: """ Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the proce...
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
fail
python
stripe/stripe-python
stripe/test_helpers/treasury/_outbound_transfer_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_outbound_transfer_service.py
MIT
def post( self, outbound_transfer: str, params: "OutboundTransferService.PostParams" = {}, options: RequestOptions = {}, ) -> OutboundTransfer: """ Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the proce...
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
post
python
stripe/stripe-python
stripe/test_helpers/treasury/_outbound_transfer_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_outbound_transfer_service.py
MIT
def return_outbound_transfer( self, outbound_transfer: str, params: "OutboundTransferService.ReturnOutboundTransferParams" = {}, options: RequestOptions = {}, ) -> OutboundTransfer: """ Transitions a test mode created OutboundTransfer to the returned status. The Outbo...
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
return_outbound_transfer
python
stripe/stripe-python
stripe/test_helpers/treasury/_outbound_transfer_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_outbound_transfer_service.py
MIT
def create( self, params: "ReceivedCreditService.CreateParams", options: RequestOptions = {}, ) -> ReceivedCredit: """ Use this endpoint to simulate a test mode ReceivedCredit initiated by a third party. In live mode, you can't directly create ReceivedCredits initiated by thi...
Use this endpoint to simulate a test mode ReceivedCredit initiated by a third party. In live mode, you can't directly create ReceivedCredits initiated by third parties.
create
python
stripe/stripe-python
stripe/test_helpers/treasury/_received_credit_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_received_credit_service.py
MIT
def create( self, params: "ReceivedDebitService.CreateParams", options: RequestOptions = {}, ) -> ReceivedDebit: """ Use this endpoint to simulate a test mode ReceivedDebit initiated by a third party. In live mode, you can't directly create ReceivedDebits initiated by third p...
Use this endpoint to simulate a test mode ReceivedDebit initiated by a third party. In live mode, you can't directly create ReceivedDebits initiated by third parties.
create
python
stripe/stripe-python
stripe/test_helpers/treasury/_received_debit_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/test_helpers/treasury/_received_debit_service.py
MIT
def create( cls, **params: Unpack["CreditReversal.CreateParams"] ) -> "CreditReversal": """ Reverses a ReceivedCredit and creates a CreditReversal object. """ return cast( "CreditReversal", cls._static_request( "post", c...
Reverses a ReceivedCredit and creates a CreditReversal object.
create
python
stripe/stripe-python
stripe/treasury/_credit_reversal.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_credit_reversal.py
MIT
def retrieve( cls, id: str, **params: Unpack["CreditReversal.RetrieveParams"] ) -> "CreditReversal": """ Retrieves the details of an existing CreditReversal by passing the unique CreditReversal ID from either the CreditReversal creation request or CreditReversal list """ inst...
Retrieves the details of an existing CreditReversal by passing the unique CreditReversal ID from either the CreditReversal creation request or CreditReversal list
retrieve
python
stripe/stripe-python
stripe/treasury/_credit_reversal.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_credit_reversal.py
MIT
def create( cls, **params: Unpack["DebitReversal.CreateParams"] ) -> "DebitReversal": """ Reverses a ReceivedDebit and creates a DebitReversal object. """ return cast( "DebitReversal", cls._static_request( "post", cls.cl...
Reverses a ReceivedDebit and creates a DebitReversal object.
create
python
stripe/stripe-python
stripe/treasury/_debit_reversal.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_debit_reversal.py
MIT
def _cls_close( cls, financial_account: str, **params: Unpack["FinancialAccount.CloseParams"], ) -> "FinancialAccount": """ Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attache...
Closes a FinancialAccount. A FinancialAccount can only be closed if it has a zero balance, has no pending InboundTransfers, and has canceled all attached Issuing cards.
_cls_close
python
stripe/stripe-python
stripe/treasury/_financial_account.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_financial_account.py
MIT
def create( cls, **params: Unpack["FinancialAccount.CreateParams"] ) -> "FinancialAccount": """ Creates a new FinancialAccount. Each connected account can have up to three FinancialAccounts by default. """ return cast( "FinancialAccount", cls._static_r...
Creates a new FinancialAccount. Each connected account can have up to three FinancialAccounts by default.
create
python
stripe/stripe-python
stripe/treasury/_financial_account.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_financial_account.py
MIT
def _cls_retrieve_features( cls, financial_account: str, **params: Unpack["FinancialAccount.RetrieveFeaturesParams"], ) -> "FinancialAccountFeatures": """ Retrieves Features information associated with the FinancialAccount. """ return cast( "Financ...
Retrieves Features information associated with the FinancialAccount.
_cls_retrieve_features
python
stripe/stripe-python
stripe/treasury/_financial_account.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_financial_account.py
MIT
def _cls_update_features( cls, financial_account: str, **params: Unpack["FinancialAccount.UpdateFeaturesParams"], ) -> "FinancialAccountFeatures": """ Updates the Features associated with a FinancialAccount. """ return cast( "FinancialAccountFeatur...
Updates the Features associated with a FinancialAccount.
_cls_update_features
python
stripe/stripe-python
stripe/treasury/_financial_account.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_financial_account.py
MIT
def list( cls, **params: Unpack["InboundTransfer.ListParams"] ) -> ListObject["InboundTransfer"]: """ Returns a list of InboundTransfers sent from the specified FinancialAccount. """ result = cls._static_request( "get", cls.class_url(), par...
Returns a list of InboundTransfers sent from the specified FinancialAccount.
list
python
stripe/stripe-python
stripe/treasury/_inbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_inbound_transfer.py
MIT
def retrieve( cls, id: str, **params: Unpack["InboundTransfer.RetrieveParams"] ) -> "InboundTransfer": """ Retrieves the details of an existing InboundTransfer. """ instance = cls(id, **params) instance.refresh() return instance
Retrieves the details of an existing InboundTransfer.
retrieve
python
stripe/stripe-python
stripe/treasury/_inbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_inbound_transfer.py
MIT
def _cls_fail( cls, id: str, **params: Unpack["InboundTransfer.FailParams"] ) -> "InboundTransfer": """ Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state. """ return cast( ...
Transitions a test mode created InboundTransfer to the failed status. The InboundTransfer must already be in the processing state.
_cls_fail
python
stripe/stripe-python
stripe/treasury/_inbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_inbound_transfer.py
MIT
def _cls_return_inbound_transfer( cls, id: str, **params: Unpack["InboundTransfer.ReturnInboundTransferParams"], ) -> "InboundTransfer": """ Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The In...
Marks the test mode InboundTransfer object as returned and links the InboundTransfer to a ReceivedDebit. The InboundTransfer must already be in the succeeded state.
_cls_return_inbound_transfer
python
stripe/stripe-python
stripe/treasury/_inbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_inbound_transfer.py
MIT
def _cls_succeed( cls, id: str, **params: Unpack["InboundTransfer.SucceedParams"] ) -> "InboundTransfer": """ Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state. """ retu...
Transitions a test mode created InboundTransfer to the succeeded status. The InboundTransfer must already be in the processing state.
_cls_succeed
python
stripe/stripe-python
stripe/treasury/_inbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_inbound_transfer.py
MIT
def list( cls, **params: Unpack["OutboundPayment.ListParams"] ) -> ListObject["OutboundPayment"]: """ Returns a list of OutboundPayments sent from the specified FinancialAccount. """ result = cls._static_request( "get", cls.class_url(), par...
Returns a list of OutboundPayments sent from the specified FinancialAccount.
list
python
stripe/stripe-python
stripe/treasury/_outbound_payment.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_payment.py
MIT
def retrieve( cls, id: str, **params: Unpack["OutboundPayment.RetrieveParams"] ) -> "OutboundPayment": """ Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID from either the OutboundPayment creation request or OutboundPayment list. """ ...
Retrieves the details of an existing OutboundPayment by passing the unique OutboundPayment ID from either the OutboundPayment creation request or OutboundPayment list.
retrieve
python
stripe/stripe-python
stripe/treasury/_outbound_payment.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_payment.py
MIT
def _cls_fail( cls, id: str, **params: Unpack["OutboundPayment.FailParams"] ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state. """ return cast( ...
Transitions a test mode created OutboundPayment to the failed status. The OutboundPayment must already be in the processing state.
_cls_fail
python
stripe/stripe-python
stripe/treasury/_outbound_payment.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_payment.py
MIT
def _cls_post( cls, id: str, **params: Unpack["OutboundPayment.PostParams"] ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state. """ return cast( ...
Transitions a test mode created OutboundPayment to the posted status. The OutboundPayment must already be in the processing state.
_cls_post
python
stripe/stripe-python
stripe/treasury/_outbound_payment.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_payment.py
MIT
def _cls_return_outbound_payment( cls, id: str, **params: Unpack["OutboundPayment.ReturnOutboundPaymentParams"], ) -> "OutboundPayment": """ Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in ...
Transitions a test mode created OutboundPayment to the returned status. The OutboundPayment must already be in the processing state.
_cls_return_outbound_payment
python
stripe/stripe-python
stripe/treasury/_outbound_payment.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_payment.py
MIT
def _cls_update( cls, id: str, **params: Unpack["OutboundPayment.UpdateParams"] ) -> "OutboundPayment": """ Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states. ...
Updates a test mode created OutboundPayment with tracking details. The OutboundPayment must not be cancelable, and cannot be in the canceled or failed states.
_cls_update
python
stripe/stripe-python
stripe/treasury/_outbound_payment.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_payment.py
MIT
def _cls_cancel( cls, outbound_transfer: str, **params: Unpack["OutboundTransfer.CancelParams"], ) -> "OutboundTransfer": """ An OutboundTransfer can be canceled if the funds have not yet been paid out. """ return cast( "OutboundTransfer", ...
An OutboundTransfer can be canceled if the funds have not yet been paid out.
_cls_cancel
python
stripe/stripe-python
stripe/treasury/_outbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_transfer.py
MIT
def list( cls, **params: Unpack["OutboundTransfer.ListParams"] ) -> ListObject["OutboundTransfer"]: """ Returns a list of OutboundTransfers sent from the specified FinancialAccount. """ result = cls._static_request( "get", cls.class_url(), ...
Returns a list of OutboundTransfers sent from the specified FinancialAccount.
list
python
stripe/stripe-python
stripe/treasury/_outbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_transfer.py
MIT
def retrieve( cls, id: str, **params: Unpack["OutboundTransfer.RetrieveParams"] ) -> "OutboundTransfer": """ Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list. """...
Retrieves the details of an existing OutboundTransfer by passing the unique OutboundTransfer ID from either the OutboundTransfer creation request or OutboundTransfer list.
retrieve
python
stripe/stripe-python
stripe/treasury/_outbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_transfer.py
MIT
def _cls_fail( cls, outbound_transfer: str, **params: Unpack["OutboundTransfer.FailParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing stat...
Transitions a test mode created OutboundTransfer to the failed status. The OutboundTransfer must already be in the processing state.
_cls_fail
python
stripe/stripe-python
stripe/treasury/_outbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_transfer.py
MIT
def _cls_post( cls, outbound_transfer: str, **params: Unpack["OutboundTransfer.PostParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing stat...
Transitions a test mode created OutboundTransfer to the posted status. The OutboundTransfer must already be in the processing state.
_cls_post
python
stripe/stripe-python
stripe/treasury/_outbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_transfer.py
MIT
def _cls_return_outbound_transfer( cls, outbound_transfer: str, **params: Unpack["OutboundTransfer.ReturnOutboundTransferParams"], ) -> "OutboundTransfer": """ Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfe...
Transitions a test mode created OutboundTransfer to the returned status. The OutboundTransfer must already be in the processing state.
_cls_return_outbound_transfer
python
stripe/stripe-python
stripe/treasury/_outbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_transfer.py
MIT
def _cls_update( cls, outbound_transfer: str, **params: Unpack["OutboundTransfer.UpdateParams"], ) -> "OutboundTransfer": """ Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be...
Updates a test mode created OutboundTransfer with tracking details. The OutboundTransfer must not be cancelable, and cannot be in the canceled or failed states.
_cls_update
python
stripe/stripe-python
stripe/treasury/_outbound_transfer.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_outbound_transfer.py
MIT
def retrieve( cls, id: str, **params: Unpack["ReceivedCredit.RetrieveParams"] ) -> "ReceivedCredit": """ Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list. """ instance = cls(id, **params) instance...
Retrieves the details of an existing ReceivedCredit by passing the unique ReceivedCredit ID from the ReceivedCredit list.
retrieve
python
stripe/stripe-python
stripe/treasury/_received_credit.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_received_credit.py
MIT
def create( cls, **params: Unpack["ReceivedCredit.CreateParams"] ) -> "ReceivedCredit": """ Use this endpoint to simulate a test mode ReceivedCredit initiated by a third party. In live mode, you can't directly create ReceivedCredits initiated by third parties. """...
Use this endpoint to simulate a test mode ReceivedCredit initiated by a third party. In live mode, you can't directly create ReceivedCredits initiated by third parties.
create
python
stripe/stripe-python
stripe/treasury/_received_credit.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_received_credit.py
MIT
def retrieve( cls, id: str, **params: Unpack["ReceivedDebit.RetrieveParams"] ) -> "ReceivedDebit": """ Retrieves the details of an existing ReceivedDebit by passing the unique ReceivedDebit ID from the ReceivedDebit list """ instance = cls(id, **params) instance.refre...
Retrieves the details of an existing ReceivedDebit by passing the unique ReceivedDebit ID from the ReceivedDebit list
retrieve
python
stripe/stripe-python
stripe/treasury/_received_debit.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_received_debit.py
MIT
def create( cls, **params: Unpack["ReceivedDebit.CreateParams"] ) -> "ReceivedDebit": """ Use this endpoint to simulate a test mode ReceivedDebit initiated by a third party. In live mode, you can't directly create ReceivedDebits initiated by third parties. """ ...
Use this endpoint to simulate a test mode ReceivedDebit initiated by a third party. In live mode, you can't directly create ReceivedDebits initiated by third parties.
create
python
stripe/stripe-python
stripe/treasury/_received_debit.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_received_debit.py
MIT
def retrieve( cls, id: str, **params: Unpack["Transaction.RetrieveParams"] ) -> "Transaction": """ Retrieves the details of an existing Transaction. """ instance = cls(id, **params) instance.refresh() return instance
Retrieves the details of an existing Transaction.
retrieve
python
stripe/stripe-python
stripe/treasury/_transaction.py
https://github.com/stripe/stripe-python/blob/master/stripe/treasury/_transaction.py
MIT
def create( self, params: "MeterEventAdjustmentService.CreateParams", options: RequestOptions = {}, ) -> MeterEventAdjustment: """ Creates a meter event adjustment to cancel a previously sent meter event. """ return cast( MeterEventAdjustment, ...
Creates a meter event adjustment to cancel a previously sent meter event.
create
python
stripe/stripe-python
stripe/v2/billing/_meter_event_adjustment_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/v2/billing/_meter_event_adjustment_service.py
MIT
def create( self, params: "MeterEventSessionService.CreateParams" = {}, options: RequestOptions = {}, ) -> MeterEventSession: """ Creates a meter event session to send usage on the high-throughput meter event stream. Authentication tokens are only valid for 15 minutes, so you...
Creates a meter event session to send usage on the high-throughput meter event stream. Authentication tokens are only valid for 15 minutes, so you will need to create a new meter event session when your token expires.
create
python
stripe/stripe-python
stripe/v2/billing/_meter_event_session_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/v2/billing/_meter_event_session_service.py
MIT
def ping( self, id: str, params: "EventDestinationService.PingParams" = {}, options: RequestOptions = {}, ) -> Event: """ Send a `ping` event to an event destination. """ return cast( Event, self._request( "post"...
Send a `ping` event to an event destination.
ping
python
stripe/stripe-python
stripe/v2/core/_event_destination_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/v2/core/_event_destination_service.py
MIT
def retrieve( self, id: str, params: "EventDestinationService.RetrieveParams" = {}, options: RequestOptions = {}, ) -> EventDestination: """ Retrieves the details of an event destination. """ return cast( EventDestination, self....
Retrieves the details of an event destination.
retrieve
python
stripe/stripe-python
stripe/v2/core/_event_destination_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/v2/core/_event_destination_service.py
MIT
def update( self, id: str, params: "EventDestinationService.UpdateParams" = {}, options: RequestOptions = {}, ) -> EventDestination: """ Update the details of an event destination. """ return cast( EventDestination, self._reques...
Update the details of an event destination.
update
python
stripe/stripe-python
stripe/v2/core/_event_destination_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/v2/core/_event_destination_service.py
MIT
def list( self, params: "EventService.ListParams", options: RequestOptions = {} ) -> ListObject[Event]: """ List events, going back up to 30 days. """ return cast( ListObject[Event], self._request( "get", "/v2/core/event...
List events, going back up to 30 days.
list
python
stripe/stripe-python
stripe/v2/core/_event_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/v2/core/_event_service.py
MIT
def retrieve( self, id: str, params: "EventService.RetrieveParams" = {}, options: RequestOptions = {}, ) -> Event: """ Retrieves the details of an event. """ return cast( Event, self._request( "get", ...
Retrieves the details of an event.
retrieve
python
stripe/stripe-python
stripe/v2/core/_event_service.py
https://github.com/stripe/stripe-python/blob/master/stripe/v2/core/_event_service.py
MIT
def test_removes_None_account( self, requestor, http_client_mock: HTTPClientMock ): """ important test! If there's no context on a retrieved event, it's important that passing `stripe-account: None` in the generated fetch_related_object doesn't actually send the null header ...
important test! If there's no context on a retrieved event, it's important that passing `stripe-account: None` in the generated fetch_related_object doesn't actually send the null header
test_removes_None_account
python
stripe/stripe-python
tests/test_api_requestor.py
https://github.com/stripe/stripe-python/blob/master/tests/test_api_requestor.py
MIT
async def test_httpx_request_async_https(self): """ Test to ensure that httpx https calls succeed by making a live test call to the public stripe API. """ method = "get" abs_url = "https://api.stripe.com/v1/balance" data = {} client = _http_client.HTTPXCl...
Test to ensure that httpx https calls succeed by making a live test call to the public stripe API.
test_httpx_request_async_https
python
stripe/stripe-python
tests/test_http_client.py
https://github.com/stripe/stripe-python/blob/master/tests/test_http_client.py
MIT
def parse_thin_event( self, stripe_client: stripe.StripeClient ) -> EventParser: """ helper to simplify parsing and validating events given a payload returns a function that has the client pre-bound """ def _parse_thin_event(payload: str): return stripe_c...
helper to simplify parsing and validating events given a payload returns a function that has the client pre-bound
parse_thin_event
python
stripe/stripe-python
tests/test_v2_event.py
https://github.com/stripe/stripe-python/blob/master/tests/test_v2_event.py
MIT
def build_dict(column_num=2, min_word_freq=0, train_dir="", test_dir=""): """ Build a word dictionary from the corpus, Keys of the dictionary are words, and values are zero-based IDs of these words. """ word_freq = collections.defaultdict(int) files = os.listdir(train_dir) for fi in files: ...
Build a word dictionary from the corpus, Keys of the dictionary are words, and values are zero-based IDs of these words.
build_dict
python
PaddlePaddle/PaddleRec
datasets/ag_news/text2paddle.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/ag_news/text2paddle.py
Apache-2.0
def filled_raw(self): "fill raw data with '-1' ,and spilt user, item, contex fields" train_path = self.raw_file_dir _mkdir_if_not_exist(self.raw_filled_file_dir) self.file_object = self.raw_filled_file_dir + '/PreRaw_data.txt' file_object_ = open(self.file_object, 'w') w...
fill raw data with '-1' ,and spilt user, item, contex fields
filled_raw
python
PaddlePaddle/PaddleRec
datasets/Avazu_flen/preprocess.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/Avazu_flen/preprocess.py
Apache-2.0
def generate_sample(self, line): """ Read the data line by line and process it as a dictionary """ def data_iter(): feat_idx, feat_value, label = self._process_line(line) s = "" for i in [('feat_idx', feat_idx), ('feat_value', feat_value), ...
Read the data line by line and process it as a dictionary
generate_sample
python
PaddlePaddle/PaddleRec
datasets/criteo/get_slot_data.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/criteo/get_slot_data.py
Apache-2.0
def feature_to_hdf(num_of_parts, file_prefix, feature_data_dir, hdf_data_dir): """ convert lib-svm feature files into hdf5 files (tables). using static method is for consistence with multi-processing version, which can not be packed into a class :param num_of_p...
convert lib-svm feature files into hdf5 files (tables). using static method is for consistence with multi-processing version, which can not be packed into a class :param num_of_parts: :param file_prefix: a prefix is suggested to identify train/test/valid/..., e.g. file_prefix='train...
feature_to_hdf
python
PaddlePaddle/PaddleRec
datasets/criteo_autofis/Criteo.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/criteo_autofis/Criteo.py
Apache-2.0
def bin_count(hdf_data_dir, file_prefix, num_of_parts): """ count positive/negative samples :param hdf_data_dir: :param file_prefix: see this param in feature_to_hdf() :param num_of_parts: :return: size of a dataset, positive samples, negative samples, positive ratio ...
count positive/negative samples :param hdf_data_dir: :param file_prefix: see this param in feature_to_hdf() :param num_of_parts: :return: size of a dataset, positive samples, negative samples, positive ratio
bin_count
python
PaddlePaddle/PaddleRec
datasets/criteo_autofis/Criteo.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/criteo_autofis/Criteo.py
Apache-2.0
def _files_iter_(self, gen_type='train', shuffle_block=False): """ iterate among hdf files(blocks). when the whole data set is finished, the iterator restarts from the beginning, thus the data stream will never stop :param gen_type: could be 'train', 'valid', or 'test'. when gen_type...
iterate among hdf files(blocks). when the whole data set is finished, the iterator restarts from the beginning, thus the data stream will never stop :param gen_type: could be 'train', 'valid', or 'test'. when gen_type='train' or 'valid', this file iterator will go through the tr...
_files_iter_
python
PaddlePaddle/PaddleRec
datasets/criteo_autofis/Criteo.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/criteo_autofis/Criteo.py
Apache-2.0
def __iter__(self, gen_type='train', batch_size=None, pos_ratio=None, val_ratio=0.0, shuffle_block=False, random_sample=False, split_fields=False, on_disk=True, squeez...
:param gen_type: 'train', 'valid', or 'test'. the valid set is partitioned from train set dynamically :param batch_size: :param pos_ratio: default value is decided by the dataset, which means you don't want to change is :param val_ratio: fraction of valid set from train set :pa...
__iter__
python
PaddlePaddle/PaddleRec
datasets/criteo_autofis/Criteo.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/criteo_autofis/Criteo.py
Apache-2.0
def generator(X, y, batch_size, shuffle=True): """ should be accessed only in private :param X: :param y: :param batch_size: :param shuffle: :return: """ num_of_batches = int(np.ceil(X.shape[0] * 1.0 / batch_size)) sample_index = np.arange(...
should be accessed only in private :param X: :param y: :param batch_size: :param shuffle: :return:
generator
python
PaddlePaddle/PaddleRec
datasets/criteo_autofis/Criteo.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/criteo_autofis/Criteo.py
Apache-2.0
def split_pos_neg(X, y): """ should be access only in private :param X: :param y: :return: """ posidx = (y == 1).reshape(-1) X_pos, y_pos = X[posidx], y[posidx] X_neg, y_neg = X[~posidx], y[~posidx] return X_pos, y_pos, X_neg, y_neg
should be access only in private :param X: :param y: :return:
split_pos_neg
python
PaddlePaddle/PaddleRec
datasets/criteo_autofis/Criteo.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/criteo_autofis/Criteo.py
Apache-2.0
def __init__(self, initialized=True): """ collect meta information, and produce hdf files if not exists :param initialized: write feature and hdf files if True """ self.initialized = initialized if not self.initialized: import h5py print('Got raw ...
collect meta information, and produce hdf files if not exists :param initialized: write feature and hdf files if True
__init__
python
PaddlePaddle/PaddleRec
datasets/criteo_autofis/Criteo.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/criteo_autofis/Criteo.py
Apache-2.0
def reader(): """ This function needs to be implemented by the user, based on data format """ features = line.rstrip('\n').split('\t') dense_feature = [] sparse_feature = [] for idx in continuous_range_: if features[id...
This function needs to be implemented by the user, based on data format
reader
python
PaddlePaddle/PaddleRec
datasets/criteo_lr/get_slot_data.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/criteo_lr/get_slot_data.py
Apache-2.0
def build_dict(args): """ proprocess the data, generate dictionary and save into dict_path. :param corpus_dir: the input data dir. :param dict_path: the generated dict path. the data in dict is "word count" :param min_count: :return: """ # word to count word_count = dict() for ...
proprocess the data, generate dictionary and save into dict_path. :param corpus_dir: the input data dir. :param dict_path: the generated dict path. the data in dict is "word count" :param min_count: :return:
build_dict
python
PaddlePaddle/PaddleRec
datasets/MIND/data/preprocess.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/MIND/data/preprocess.py
Apache-2.0
def get_train_data(filename, write_file, num_negatives): ''' Read .rating file and Return dok matrix. The first line of .rating file is: num_users\t num_items ''' # Get number of users and items num_users, num_items = 0, 0 with open(filename, "r") as f: line = f.readline(...
Read .rating file and Return dok matrix. The first line of .rating file is: num_users num_items
get_train_data
python
PaddlePaddle/PaddleRec
datasets/movielens_pinterest_NCF/get_train_data.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/movielens_pinterest_NCF/get_train_data.py
Apache-2.0
def create_NETFLIX_data_timesplit(all_data, train_min, train_max, test_min, test_max): """ Creates time-based split of NETFLIX data into train, and (validation, test) :param all_data: :param train_min: :param train_max: :param test_min: :param test_max: :return: """...
Creates time-based split of NETFLIX data into train, and (validation, test) :param all_data: :param train_min: :param train_max: :param test_min: :param test_max: :return:
create_NETFLIX_data_timesplit
python
PaddlePaddle/PaddleRec
datasets/Netflix_deeprec/netflix_data_convert.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/datasets/Netflix_deeprec/netflix_data_convert.py
Apache-2.0
def header(self, text, level, raw=None): """Rendering header/heading tags like ``<h1>`` ``<h2>``. :param text: rendered text content for the header. :param level: a number for the header level, for example: 1. :param raw: raw text content of the header. """ return '\n{0}...
Rendering header/heading tags like ``<h1>`` ``<h2>``. :param text: rendered text content for the header. :param level: a number for the header level, for example: 1. :param raw: raw text content of the header.
header
python
PaddlePaddle/PaddleRec
doc/markdown2rst.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/doc/markdown2rst.py
Apache-2.0
def list(self, body, ordered=True): """Rendering list tags like ``<ul>`` and ``<ol>``. :param body: body contents of the list. :param ordered: whether this list is ordered or not. """ mark = '#. ' if ordered else '* ' lines = body.splitlines() for i, line in enum...
Rendering list tags like ``<ul>`` and ``<ol>``. :param body: body contents of the list. :param ordered: whether this list is ordered or not.
list
python
PaddlePaddle/PaddleRec
doc/markdown2rst.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/doc/markdown2rst.py
Apache-2.0
def table(self, header, body): """Rendering table element. Wrap header and body in it. :param header: header part of the table. :param body: body part of the table. """ table = '\n.. list-table::\n' if header and not header.isspace(): table = (table + self.in...
Rendering table element. Wrap header and body in it. :param header: header part of the table. :param body: body part of the table.
table
python
PaddlePaddle/PaddleRec
doc/markdown2rst.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/doc/markdown2rst.py
Apache-2.0
def table_row(self, content): """Rendering a table row. Like ``<tr>``. :param content: content of current table row. """ contents = content.splitlines() if not contents: return '' clist = ['* ' + contents[0]] if len(contents) > 1: for c in...
Rendering a table row. Like ``<tr>``. :param content: content of current table row.
table_row
python
PaddlePaddle/PaddleRec
doc/markdown2rst.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/doc/markdown2rst.py
Apache-2.0
def codespan(self, text): """Rendering inline `code` text. :param text: text content for inline code. """ if '``' not in text: return '\ ``{}``\ '.format(text) else: # actually, docutils split spaces in literal return self._raw_html('<code cla...
Rendering inline `code` text. :param text: text content for inline code.
codespan
python
PaddlePaddle/PaddleRec
doc/markdown2rst.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/doc/markdown2rst.py
Apache-2.0
def link(self, link, title, text): """Rendering a given link with content and title. :param link: href link for ``<a>`` tag. :param title: title content for `title` attribute. :param text: text content for description. """ if self.anonymous_references: unders...
Rendering a given link with content and title. :param link: href link for ``<a>`` tag. :param title: title content for `title` attribute. :param text: text content for description.
link
python
PaddlePaddle/PaddleRec
doc/markdown2rst.py
https://github.com/PaddlePaddle/PaddleRec/blob/master/doc/markdown2rst.py
Apache-2.0