_id
stringlengths
2
7
title
stringlengths
1
88
partition
stringclasses
3 values
text
stringlengths
75
19.8k
language
stringclasses
1 value
meta_information
dict
q45400
CrabGateway.get_straat_by_id
train
def get_straat_by_id(self, id): ''' Retrieve a `straat` by the Id. :param integer id: The id of the `straat`. :rtype: :class:`Straat` ''' def creator(): res = crab_gateway_request( self.client, 'GetStraatnaamWithStatusByStraatnaamId', id ...
python
{ "resource": "" }
q45401
CrabGateway.list_huisnummers_by_straat
train
def list_huisnummers_by_straat(self, straat, sort=1): ''' List all `huisnummers` in a `Straat`. :param straat: The :class:`Straat` for which the \ `huisnummers` are wanted. :rtype: A :class: `list` of :class:`Huisnummer` ''' try: id = straat.id ...
python
{ "resource": "" }
q45402
CrabGateway.list_huisnummers_by_perceel
train
def list_huisnummers_by_perceel(self, perceel, sort=1): ''' List all `huisnummers` on a `Pereel`. Generally there will only be one, but multiples are possible. :param perceel: The :class:`Perceel` for which the \ `huisnummers` are wanted. :rtype: A :class: `list` of...
python
{ "resource": "" }
q45403
CrabGateway.get_huisnummer_by_id
train
def get_huisnummer_by_id(self, id): ''' Retrieve a `huisnummer` by the Id. :param integer id: the Id of the `huisnummer` :rtype: :class:`Huisnummer` ''' def creator(): res = crab_gateway_request( self.client, 'GetHuisnummerWithStatusByHuisnumm...
python
{ "resource": "" }
q45404
CrabGateway.get_postkanton_by_huisnummer
train
def get_postkanton_by_huisnummer(self, huisnummer): ''' Retrieve a `postkanton` by the Huisnummer. :param huisnummer: The :class:`Huisnummer` for which the `postkanton` \ is wanted. :rtype: :class:`Postkanton` ''' try: id = huisnummer.id ...
python
{ "resource": "" }
q45405
CrabGateway.get_wegobject_by_id
train
def get_wegobject_by_id(self, id): ''' Retrieve a `Wegobject` by the Id. :param integer id: the Id of the `Wegobject` :rtype: :class:`Wegobject` ''' def creator(): res = crab_gateway_request( self.client, 'GetWegobjectByIdentificatorWegobject'...
python
{ "resource": "" }
q45406
CrabGateway.get_wegsegment_by_id
train
def get_wegsegment_by_id(self, id): ''' Retrieve a `wegsegment` by the Id. :param integer id: the Id of the `wegsegment` :rtype: :class:`Wegsegment` ''' def creator(): res = crab_gateway_request( self.client, 'GetWegsegmentById...
python
{ "resource": "" }
q45407
CrabGateway.get_terreinobject_by_id
train
def get_terreinobject_by_id(self, id): ''' Retrieve a `Terreinobject` by the Id. :param integer id: the Id of the `Terreinobject` :rtype: :class:`Terreinobject` ''' def creator(): res = crab_gateway_request( self.client, 'GetTe...
python
{ "resource": "" }
q45408
CrabGateway.get_perceel_by_id
train
def get_perceel_by_id(self, id): ''' Retrieve a `Perceel` by the Id. :param string id: the Id of the `Perceel` :rtype: :class:`Perceel` ''' def creator(): res = crab_gateway_request( self.client, 'GetPerceelByIdentificatorPerceel', id ...
python
{ "resource": "" }
q45409
CrabGateway.get_gebouw_by_id
train
def get_gebouw_by_id(self, id): ''' Retrieve a `Gebouw` by the Id. :param integer id: the Id of the `Gebouw` :rtype: :class:`Gebouw` ''' def creator(): res = crab_gateway_request( self.client, 'GetGebouwByIdentificatorGebouw', id )...
python
{ "resource": "" }
q45410
CrabGateway.get_subadres_by_id
train
def get_subadres_by_id(self, id): ''' Retrieve a `Subadres` by the Id. :param integer id: the Id of the `Subadres` :rtype: :class:`Subadres` ''' def creator(): res = crab_gateway_request( self.client, 'GetSubadresWithStatusBySubadresId', id ...
python
{ "resource": "" }
q45411
CrabGateway.get_adrespositie_by_id
train
def get_adrespositie_by_id(self, id): ''' Retrieve a `Adrespositie` by the Id. :param integer id: the Id of the `Adrespositie` :rtype: :class:`Adrespositie` ''' def creator(): res = crab_gateway_request( self.client, 'GetAdrespositieByAdrespos...
python
{ "resource": "" }
q45412
Perceel.postadressen
train
def postadressen(self): ''' Returns the postadressen for this Perceel. Will only take the huisnummers with status `inGebruik` into account. :rtype: list ''' return [h.postadres for h in self.huisnummers if h.status.id == '3']
python
{ "resource": "" }
q45413
salt_ssh
train
def salt_ssh(project, target, module, args=None, kwargs=None): """ Execute a `salt-ssh` command """ cmd = ['salt-ssh'] cmd.extend(generate_salt_cmd(target, module, args, kwargs)) cmd.append('--state-output=mixed') cmd.append('--roster-file=%s' % project.roster_path) cmd.append('--config-...
python
{ "resource": "" }
q45414
salt_master
train
def salt_master(project, target, module, args=None, kwargs=None): """ Execute a `salt` command in the head node """ client = project.cluster.head.ssh_client cmd = ['salt'] cmd.extend(generate_salt_cmd(target, module, args, kwargs)) cmd.append('--timeout=300') cmd.append('--state-output=...
python
{ "resource": "" }
q45415
getenv
train
def getenv(name, **kwargs): """ Retrieves environment variable by name and casts the value to desired type. If desired type is list or tuple - uses separator to split the value. """ default_value = kwargs.pop('default', None) desired_type = kwargs.pop('type', str) list_separator = kwargs.pop...
python
{ "resource": "" }
q45416
generate_network
train
def generate_network(user=None, reset=False): """ Assemble the network connections for a given user """ token = collect_token() try: gh = login(token=token) root_user = gh.user(user) except Exception, e: # Failed to login using the token, github3.models.GitHubError ...
python
{ "resource": "" }
q45417
Element.load_xml_attrs
train
def load_xml_attrs(self): """ Load XML attributes as object attributes. :returns: List of parsed attributes. :rtype: list """ attrs_list = list() if hasattr(self, 'xml_element'): xml_attrs = self.xml_element.attrib for variable, value i...
python
{ "resource": "" }
q45418
Element.get_namespace_and_tag
train
def get_namespace_and_tag(name): """ Separates the namespace and tag from an element. :param str name: Tag. :returns: Namespace URI and Tag namespace. :rtype: tuple """ if isinstance(name, str): if name[0] == "{": uri, ignore, tag = n...
python
{ "resource": "" }
q45419
Mechanism.write_command
train
def write_command(cls, writer, name, buffers=()): """ Write a command to the specified writer. :param writer: The writer to use. :param name: The command name. :param buffers: The buffers to writer. """ assert len(name) < 256 body_len = len(name) + 1 + s...
python
{ "resource": "" }
q45420
Mechanism._expect_command
train
async def _expect_command(cls, reader, name): """ Expect a command. :param reader: The reader to use. :returns: The command data. """ size_type = struct.unpack('B', await reader.readexactly(1))[0] if size_type == 0x04: size = struct.unpack('!B', awai...
python
{ "resource": "" }
q45421
Fourier.phase_shifted_coefficients
train
def phase_shifted_coefficients(amplitude_coefficients, form='cos', shift=0.0): r""" Converts Fourier coefficients from the amplitude form to the phase-shifted form, as either a sine or cosine series. Amplitude form: .. math:: m(t) ...
python
{ "resource": "" }
q45422
Repository._execute
train
def _execute(self, command, stdin=None, stdout=subprocess.PIPE): """Executes the specified command relative to the repository root. Returns a tuple containing the return code and the process output. """ process = subprocess.Popen(command, shell=True, cwd=self.root_path, stdin=stdin, stdo...
python
{ "resource": "" }
q45423
choices
train
def choices(klass): """ Decorator to set `CHOICES` and other attributes """ _choices = [] for attr in user_attributes(klass.Meta): val = getattr(klass.Meta, attr) setattr(klass, attr, val[0]) _choices.append((val[0], val[1])) setattr(klass, 'CHOICES', tuple(_choices)) ...
python
{ "resource": "" }
q45424
drop_db
train
def drop_db(): " Drop all tables. " from ..ext import db if prompt_bool("Are you sure? You will lose all your data!"): db.drop_all() # Evolution support from flask import current_app from flaskext.evolution import db as evolution_db evolution_db.init_app(current_ap...
python
{ "resource": "" }
q45425
NamespaceForm.clean_prefix
train
def clean_prefix(self): """ Validates the prefix """ if self.instance.fixed: return self.instance.prefix prefix = self.cleaned_data['prefix'] if not namespace.is_ncname(prefix): raise forms.ValidationError("This is an invalid prefix") ret...
python
{ "resource": "" }
q45426
NamespaceForm.clean_uri
train
def clean_uri(self): """ Validates the URI """ if self.instance.fixed: return self.instance.uri uri = self.cleaned_data['uri'] # todo: URI validation return uri
python
{ "resource": "" }
q45427
MakesiteParser.as_dict
train
def as_dict(self, section='Main', **kwargs): """Return template context from configs. """ items = super(MakesiteParser, self).items(section, **kwargs) return dict(items)
python
{ "resource": "" }
q45428
config_oauth
train
def config_oauth(app): " Configure oauth support. " for name in PROVIDERS: config = app.config.get('OAUTH_%s' % name.upper()) if not config: continue if not name in oauth.remote_apps: remote_app = oauth.remote_app(name, **config) else: remo...
python
{ "resource": "" }
q45429
cached_instance
train
def cached_instance(model, timeout=None, **filters): """ Auto cached model instance. """ if isinstance(model, basestring): model = _str_to_model(model) cache_key = generate_cache_key(model, **filters) return get_cached(cache_key, model.objects.select_related().get, kwargs=filters)
python
{ "resource": "" }
q45430
cached_query
train
def cached_query(qs, timeout=None): """ Auto cached queryset and generate results. """ cache_key = generate_cache_key(qs) return get_cached(cache_key, list, args=(qs,), timeout=None)
python
{ "resource": "" }
q45431
clean_cache
train
def clean_cache(cached, **kwargs): " Generate cache key and clean cached value. " if isinstance(cached, basestring): cached = _str_to_model(cached) cache_key = generate_cache_key(cached, **kwargs) cache.delete(cache_key)
python
{ "resource": "" }
q45432
generate_cache_key
train
def generate_cache_key(cached, **kwargs): """ Auto generate cache key for model or queryset """ if isinstance(cached, QuerySet): key = str(cached.query) elif isinstance(cached, (Model, ModelBase)): key = '%s.%s:%s' % (cached._meta.app_label, cached._meta.mod...
python
{ "resource": "" }
q45433
clean_cache_key
train
def clean_cache_key(key): """ Replace spaces with '-' and hash if length is greater than 250. """ cache_key = re.sub(r'\s+', '-', key) cache_key = smart_str(cache_key) if len(cache_key) > 200: cache_key = cache_key[:150] + '-' + hashlib.md5(cache_key).hexdigest() return cache_key
python
{ "resource": "" }
q45434
collect_static_files
train
def collect_static_files(src_map, dst): """ Collect all static files and move them into a temporary location. This is very similar to the ``collectstatic`` command. """ for rel_src, abs_src in src_map.iteritems(): abs_dst = os.path.join(dst, rel_src) copy_file(abs_src, abs_dst)
python
{ "resource": "" }
q45435
apply_preprocessors
train
def apply_preprocessors(root, src, dst, processors): """ Preprocessors operate based on the source filename, and apply to each file individually. """ matches = [(pattern, cmds) for pattern, cmds in processors.iteritems() if fnmatch(src, pattern)] if not matches: return False params ...
python
{ "resource": "" }
q45436
apply_postcompilers
train
def apply_postcompilers(root, src_list, dst, processors): """ Postcompilers operate based on the destination filename. They operate on a collection of files, and are expected to take a list of 1+ inputs and generate a single output. """ dst_file = os.path.join(root, dst) matches = [(pattern, cm...
python
{ "resource": "" }
q45437
set_model_internal_data
train
def set_model_internal_data(model, original_data, modified_data, deleted_data): """ Set internal data to model. """ model.__original_data__ = original_data list(map(model._prepare_child, model.__original_data__)) model.__modified_data__ = modified_data list(map(model._prepare_child, model._...
python
{ "resource": "" }
q45438
DirtyModelMeta.process_base_field
train
def process_base_field(cls, field, key): """ Preprocess field instances. :param field: Field object :param key: Key where field was found """ if not field.name: field.name = key elif key != field.name: if not isinstance(field.alias, list):...
python
{ "resource": "" }
q45439
BaseModel.set_field_value
train
def set_field_value(self, name, value): """ Set the value to the field modified_data """ name = self.get_real_name(name) if not name or not self._can_write_field(name): return if name in self.__deleted_fields__: self.__deleted_fields__.remove(nam...
python
{ "resource": "" }
q45440
BaseModel.get_field_value
train
def get_field_value(self, name): """ Get the field value from the modified data or the original one """ name = self.get_real_name(name) if not name or name in self.__deleted_fields__: return None modified = self.__modified_data__.get(name) if modified...
python
{ "resource": "" }
q45441
BaseModel.delete_field_value
train
def delete_field_value(self, name): """ Mark this field to be deleted """ name = self.get_real_name(name) if name and self._can_write_field(name): if name in self.__modified_data__: self.__modified_data__.pop(name) if name in self.__origi...
python
{ "resource": "" }
q45442
BaseModel.reset_field_value
train
def reset_field_value(self, name): """ Resets value of a field """ name = self.get_real_name(name) if name and self._can_write_field(name): if name in self.__modified_data__: del self.__modified_data__[name] if name in self.__deleted_fiel...
python
{ "resource": "" }
q45443
BaseModel.is_modified_field
train
def is_modified_field(self, name): """ Returns whether a field is modified or not """ name = self.get_real_name(name) if name in self.__modified_data__ or name in self.__deleted_fields__: return True try: return self.get_field_value(name).is_modi...
python
{ "resource": "" }
q45444
BaseModel.export_data
train
def export_data(self): """ Get the results with the modified_data """ result = {} data = self.__original_data__.copy() data.update(self.__modified_data__) for key, value in data.items(): if key in self.__deleted_fields__: continue ...
python
{ "resource": "" }
q45445
BaseModel.export_modified_data
train
def export_modified_data(self): """ Get the modified data """ # TODO: why None? Try to get a better flag result = {key: None for key in self.__deleted_fields__} for key, value in self.__modified_data__.items(): if key in result.keys(): continu...
python
{ "resource": "" }
q45446
BaseModel.export_modifications
train
def export_modifications(self): """ Returns model modifications. """ result = {} for key, value in self.__modified_data__.items(): try: result[key] = value.export_data() except AttributeError: result[key] = value ...
python
{ "resource": "" }
q45447
BaseModel.get_original_field_value
train
def get_original_field_value(self, name): """ Returns original field value or None """ name = self.get_real_name(name) try: value = self.__original_data__[name] except KeyError: return None try: return value.export_original_da...
python
{ "resource": "" }
q45448
BaseModel.export_original_data
train
def export_original_data(self): """ Get the original data """ return {key: self.get_original_field_value(key) for key in self.__original_data__.keys()}
python
{ "resource": "" }
q45449
BaseModel.export_deleted_fields
train
def export_deleted_fields(self): """ Resturns a list with any deleted fields form original data. In tree models, deleted fields on children will be appended. """ result = self.__deleted_fields__.copy() for key, value in self.__original_data__.items(): if key ...
python
{ "resource": "" }
q45450
BaseModel.flat_data
train
def flat_data(self): """ Pass all the data from modified_data to original_data """ def flat_field(value): """ Flat field data """ try: value.flat_data() return value except AttributeError: ...
python
{ "resource": "" }
q45451
BaseModel.clear
train
def clear(self): """ Clears all the data in the object, keeping original data """ self.__modified_data__ = {} self.__deleted_fields__ = [field for field in self.__original_data__.keys()]
python
{ "resource": "" }
q45452
BaseModel.get_fields
train
def get_fields(self): """ Returns used fields of model """ result = [key for key in self.__original_data__.keys() if key not in self.__deleted_fields__] result.extend([key for key in self.__modified_data__.keys() if key not in result and k...
python
{ "resource": "" }
q45453
BaseModel.is_modified
train
def is_modified(self): """ Returns whether model is modified or not """ if len(self.__modified_data__) or len(self.__deleted_fields__): return True for value in self.__original_data__.values(): try: if value.is_modified(): ...
python
{ "resource": "" }
q45454
BaseDynamicModel._get_field_type
train
def _get_field_type(self, key, value): """ Helper to create field object based on value type """ if isinstance(value, bool): return BooleanField(name=key) elif isinstance(value, int): return IntegerField(name=key) elif isinstance(value, float): ...
python
{ "resource": "" }
q45455
HashMapModel.copy
train
def copy(self): """ Creates a copy of model """ return self.__class__(field_type=self.get_field_type(), data=self.export_data())
python
{ "resource": "" }
q45456
FastDynamicModel.get_current_structure
train
def get_current_structure(self): """ Returns a dictionary with model field objects. :return: dict """ struct = self.__class__.get_structure() struct.update(self.__field_types__) return struct
python
{ "resource": "" }
q45457
SSHClient.connect
train
def connect(self): """Connect to host """ try: self.client.connect(self.host, username=self.username, password=self.password, port=self.port, pkey=self.pkey, timeout=self.timeout) except sock_gaierror, ex: rais...
python
{ "resource": "" }
q45458
SSHClient.exec_command
train
def exec_command(self, command, sudo=False, **kwargs): """Wrapper to paramiko.SSHClient.exec_command """ channel = self.client.get_transport().open_session() # stdin = channel.makefile('wb') stdout = channel.makefile('rb') stderr = channel.makefile_stderr('rb') i...
python
{ "resource": "" }
q45459
SSHClient.make_sftp
train
def make_sftp(self): """Make SFTP client from open transport""" transport = self.client.get_transport() transport.open_session() return paramiko.SFTPClient.from_transport(transport)
python
{ "resource": "" }
q45460
Version.str_to_time
train
def str_to_time(self): """ Formats a XCCDF dateTime string to a datetime object. :returns: datetime object. :rtype: datetime.datetime """ return datetime(*list(map(int, re.split(r'-|:|T', self.time))))
python
{ "resource": "" }
q45461
Version.update_xml_element
train
def update_xml_element(self): """ Updates the xml element contents to matches the instance contents :returns: Updated XML element :rtype: lxml.etree._Element """ if not hasattr(self, 'xml_element'): self.xml_element = etree.Element(self.name, nsmap=NSMAP) ...
python
{ "resource": "" }
q45462
get_base_modules
train
def get_base_modules(): " Get list of installed modules. " return sorted(filter( lambda x: op.isdir(op.join(MOD_DIR, x)), listdir(MOD_DIR)))
python
{ "resource": "" }
q45463
print_header
train
def print_header(msg, sep='='): " More strong message " LOGGER.info("\n%s\n%s" % (msg, ''.join(sep for _ in msg)))
python
{ "resource": "" }
q45464
which
train
def which(program): " Check program is exists. " head, _ = op.split(program) if head: if is_exe(program): return program else: for path in environ["PATH"].split(pathsep): exe_file = op.join(path, program) if is_exe(exe_file): return e...
python
{ "resource": "" }
q45465
call
train
def call(cmd, shell=True, **kwargs): " Run shell command. " LOGGER.debug("Cmd: %s" % cmd) check_call(cmd, shell=shell, stdout=LOGFILE_HANDLER.stream, **kwargs)
python
{ "resource": "" }
q45466
gen_template_files
train
def gen_template_files(path): " Generate relative template pathes. " path = path.rstrip(op.sep) for root, _, files in walk(path): for f in filter(lambda x: not x in (TPLNAME, CFGNAME), files): yield op.relpath(op.join(root, f), path)
python
{ "resource": "" }
q45467
get_config
train
def get_config( config_path=CONFIG_PATH ): """ Get the config """ parser = SafeConfigParser() parser.read( config_path ) config_dir = os.path.dirname(config_path) immutable_key = False key_id = None blockchain_id = None hostname = socket.gethostname() wallet = None ...
python
{ "resource": "" }
q45468
file_key_lookup
train
def file_key_lookup( blockchain_id, index, hostname, key_id=None, config_path=CONFIG_PATH, wallet_keys=None ): """ Get the file-encryption GPG key for the given blockchain ID, by index. if index == 0, then give back the current key if index > 0, then give back an older (revoked) key. if key_id is g...
python
{ "resource": "" }
q45469
file_key_retire
train
def file_key_retire( blockchain_id, file_key, config_path=CONFIG_PATH, wallet_keys=None ): """ Retire the given key. Move it to the head of the old key bundle list @file_key should be data returned by file_key_lookup Return {'status': True} on success Return {'error': ...} on error """ con...
python
{ "resource": "" }
q45470
file_encrypt
train
def file_encrypt( blockchain_id, hostname, recipient_blockchain_id_and_hosts, input_path, output_path, passphrase=None, config_path=CONFIG_PATH, wallet_keys=None ): """ Encrypt a file for a set of recipients. @recipient_blockchain_id_and_hosts must contain a list of (blockchain_id, hostname) Return {'st...
python
{ "resource": "" }
q45471
file_sign
train
def file_sign( blockchain_id, hostname, input_path, passphrase=None, config_path=CONFIG_PATH, wallet_keys=None ): """ Sign a file with the current blockchain ID's host's public key. @config_path should be for the *client*, not blockstack-file Return {'status': True, 'sender_key_id': ..., 'sig': ...} on ...
python
{ "resource": "" }
q45472
file_verify
train
def file_verify( sender_blockchain_id, sender_key_id, input_path, sig, config_path=CONFIG_PATH, wallet_keys=None ): """ Verify that a file was signed with the given blockchain ID @config_path should be for the *client*, not blockstack-file Return {'status': True} on succes Return {'error': ...} on e...
python
{ "resource": "" }
q45473
sanitize_latex
train
def sanitize_latex(string): """ Sanitize a string for input to LaTeX. Replacements taken from `Stack Overflow <http://stackoverflow.com/questions/2627135/how-do-i-sanitize-latex-input>`_ **Parameters** string: str **Returns** sanitized_string: str """ sanitized_string = stri...
python
{ "resource": "" }
q45474
Conneg.get_renderers
train
def get_renderers(self, request, context=None, template_name=None, accept_header=None, formats=None, default_format=None, fallback_formats=None, early=False): """ Returns a list of renderer functions in the order they should be tried. Tries th...
python
{ "resource": "" }
q45475
set_secret_key
train
def set_secret_key(token): """ Initializes a Authentication and sets it as the new default global authentication. It also performs some checks before saving the authentication. :Example >>> # Expected format for secret key: >>> import payplug >>> payplug.set_secret_key('sk_test_somerandomc...
python
{ "resource": "" }
q45476
Payment.retrieve
train
def retrieve(payment_id): """ Retrieve a payment from its id. :param payment_id: The payment id :type payment_id: string :return: The payment resource :rtype: resources.Payment """ http_client = HttpClient() response, __ = http_client.get(routes....
python
{ "resource": "" }
q45477
Payment.abort
train
def abort(payment): """ Abort a payment from its id. :param payment: The payment id or payment object :type payment: string|Payment :return: The payment resource :rtype: resources.Payment """ if isinstance(payment, resources.Payment): payment...
python
{ "resource": "" }
q45478
Payment.create
train
def create(**data): """ Create a Payment request. :param data: data required to create the payment :return: The payment resource :rtype resources.Payment """ http_client = HttpClient() response, _ = http_client.post(routes.url(routes.PAYMENT_RESOURCE), d...
python
{ "resource": "" }
q45479
Payment.list
train
def list(per_page=None, page=None): """ List of payments. You have to handle pagination manually :param page: the page number :type page: int|None :param per_page: number of payment per page. It's a good practice to increase this number if you know that you will need a l...
python
{ "resource": "" }
q45480
Refund.retrieve
train
def retrieve(payment, refund_id): """ Retrieve a refund from a payment and the refund id. :param payment: The payment id or the payment object :type payment: resources.Payment|string :param refund_id: The refund id :type refund_id: string :return: The refund res...
python
{ "resource": "" }
q45481
Refund.create
train
def create(payment, **data): """ Create a refund on a payment. :param payment: Either the payment object or the payment id you want to refund. :type payment: resources.Payment|string :param data: data required to create the refund :return: The refund resource :r...
python
{ "resource": "" }
q45482
Refund.list
train
def list(payment): """ List all the refunds for a payment. :param payment: The payment object or the payment id :type payment: resources.Payment|string :return: A collection of refunds :rtype resources.APIResourceCollection """ if isinstance(payment, res...
python
{ "resource": "" }
q45483
Customer.retrieve
train
def retrieve(customer_id): """ Retrieve a customer from its id. :param customer_id: The customer id :type customer_id: string :return: The customer resource :rtype: resources.Customer """ http_client = HttpClient() response, __ = http_client.get(...
python
{ "resource": "" }
q45484
Customer.delete
train
def delete(customer): """ Delete a customer from its id. :param customer: The customer id or object :type customer: string|Customer """ if isinstance(customer, resources.Customer): customer = customer.id http_client = HttpClient() http_client...
python
{ "resource": "" }
q45485
Customer.update
train
def update(customer, **data): """ Update a customer from its id. :param customer: The customer id or object :type customer: string|Customer :param data: The data you want to update :return: The customer resource :rtype resources.Customer """ if i...
python
{ "resource": "" }
q45486
Customer.create
train
def create(**data): """ Create a customer. :param data: data required to create the customer :return: The customer resource :rtype resources.Customer """ http_client = HttpClient() response, _ = http_client.post(routes.url(routes.CUSTOMER_RESOURCE), data...
python
{ "resource": "" }
q45487
Card.retrieve
train
def retrieve(customer, card_id): """ Retrieve a card from its id. :param customer: The customer id or object :type customer: string|Customer :param card_id: The card id :type card_id: string :return: The customer resource :rtype: resources.Card "...
python
{ "resource": "" }
q45488
Card.delete
train
def delete(customer, card): """ Delete a card from its id. :param customer: The customer id or object :type customer: string|Customer :param card: The card id or object :type card: string|Card """ if isinstance(customer, resources.Customer): c...
python
{ "resource": "" }
q45489
Card.create
train
def create(customer, **data): """ Create a card instance. :param customer: the customer id or object :type customer: string|Customer :param data: data required to create the card :return: The card resource :rtype resources.Card """ if isinstance(...
python
{ "resource": "" }
q45490
Card.list
train
def list(customer, per_page=None, page=None): """ List of cards. You have to handle pagination manually for the moment. :param customer: the customer id or object :type customer: string|Customer :param page: the page number :type page: int|None :param per_page: n...
python
{ "resource": "" }
q45491
IsoDateTimeField.strptime
train
def strptime(self, value, format): """ By default, parse datetime with TZ. If TZ is False, convert datetime to local time and disable TZ """ value = force_str(value) if format == ISO_8601: try: parsed = parse_datetime(value) if...
python
{ "resource": "" }
q45492
find_data_files
train
def find_data_files(source, target, patterns): """ Locates the specified data-files and returns the matches in a data_files compatible format. source is the root of the source data tree. Use '' or '.' for current directory. target is the root of the target data tree. Use '' or '.' f...
python
{ "resource": "" }
q45493
Entity.cache
train
def cache(self): """Query or return the Graph API representation of this resource.""" if not self._cache: self._cache = self.graph.get('%s' % self.id) return self._cache
python
{ "resource": "" }
q45494
capakey_rest_gateway_request
train
def capakey_rest_gateway_request(url, headers={}, params={}): ''' Utility function that helps making requests to the CAPAKEY REST service. :param string url: URL to request. :param dict headers: Headers to send with the URL. :param dict params: Parameters to send with the URL. :returns: Result ...
python
{ "resource": "" }
q45495
CapakeyRestGateway.list_gemeenten
train
def list_gemeenten(self, sort=1): ''' List all `gemeenten` in Vlaanderen. :param integer sort: What field to sort on. :rtype: A :class:`list` of :class:`Gemeente`. ''' def creator(): url = self.base_url + '/municipality' h = self.base_headers ...
python
{ "resource": "" }
q45496
CapakeyRestGateway.list_kadastrale_afdelingen
train
def list_kadastrale_afdelingen(self): ''' List all `kadastrale afdelingen` in Flanders. :param integer sort: Field to sort on. :rtype: A :class:`list` of :class:`Afdeling`. ''' def creator(): gemeentes = self.list_gemeenten() res = [] ...
python
{ "resource": "" }
q45497
CapakeyRestGateway.list_kadastrale_afdelingen_by_gemeente
train
def list_kadastrale_afdelingen_by_gemeente(self, gemeente, sort=1): ''' List all `kadastrale afdelingen` in a `gemeente`. :param gemeente: The :class:`Gemeente` for which the \ `afdelingen` are wanted. :param integer sort: Field to sort on. :rtype: A :class:`list` of...
python
{ "resource": "" }
q45498
CapakeyRestGateway.get_kadastrale_afdeling_by_id
train
def get_kadastrale_afdeling_by_id(self, aid): ''' Retrieve a 'kadastrale afdeling' by id. :param aid: An id of a `kadastrale afdeling`. :rtype: A :class:`Afdeling`. ''' def creator(): url = self.base_url + '/department/%s' % (aid) h = self.base_h...
python
{ "resource": "" }
q45499
CapakeyRestGateway.list_secties_by_afdeling
train
def list_secties_by_afdeling(self, afdeling): ''' List all `secties` in a `kadastrale afdeling`. :param afdeling: The :class:`Afdeling` for which the `secties` are \ wanted. Can also be the id of and `afdeling`. :rtype: A :class:`list` of `Sectie`. ''' try: ...
python
{ "resource": "" }