How to use the shortuuid.uuid function in shortuuid

To help you get started, we’ve selected a few shortuuid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github caffeinehit / django-inviter / inviter / tests.py View on Github external
def setUp(self):
        self.original_email_backend = settings.EMAIL_BACKEND
        settings.EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
        self.inviter = User.objects.create(username=shortuuid.uuid())
        self.existing = User.objects.create(username=shortuuid.uuid(),
            email='existing@example.com')
github higlass / higlass / notebooks / create_gene_counts.py View on Github external
(refseqid_refgene_count.map(lambda x: "{name}\t{chrom}\t{strand}\t{txStart}\t{txEnd}\t{genomeTxStart}\t{genomeTxEnd}\t{cdsStart}\t{cdsEnd}\t{exonCount}\t{exonStarts}\t{exonEnds}\t{geneName}\t{count}\t{uid}"
                                .format(count=x[1][1]['count'],uid=shortuuid.uuid(), **x[1][0]))
     .saveAsTextFile(outfile))
github alexander-lee / blockchain / fullclient.py View on Github external
"""
===========
 MAIN CODE
===========
"""

parser = argparse.ArgumentParser()
parser.add_argument('-n', type=str, help='node name')
parser.add_argument('-p', type=int, help='port number (default: 5000)')
parser.add_argument('--file', type=str, help='specified file storing the blockchain (default: \'blockchain.json\')')
parser.add_argument('-o', type=str, help='output file without requiring an initial blockchain file to read from (default: \'blockchain.json\')')

args = parser.parse_args()
node_id = uuid()

if __name__ == '__main__':
    # Load Blockchain File
    filename = args.file
    if filename:
        data = json.load(open(filename))
        blockchain = Blockchain(data['chain'], data['tx_info'])
    else:
        filename = args.o
        blockchain = Blockchain()

    node = BlockchainNode(
        name=args.n or f'node-{node_id}',
        port=args.p or 5000,
        blockchain=blockchain
    )
github ourresearch / total-impact-webapp / totalimpactwebapp / reference_set.py View on Github external
def __init__(self, **kwargs):
        if not "refset_id" in kwargs:
            shortuuid.set_alphabet('abcdefghijklmnopqrstuvwxyz1234567890')
            self.refset_id = shortuuid.uuid()[0:24]

        if not "created" in kwargs:
            self.created = datetime.datetime.utcnow()
        super(ReferenceSetList, self).__init__(**kwargs)
github ourresearch / oadoi / models / badge.py View on Github external
def __init__(self, assigned=True, **kwargs):
        self.id = shortuuid.uuid()[0:10]
        self.created = datetime.datetime.utcnow().isoformat()
        self.assigned = assigned
        self.products = {}
        super(Badge, self).__init__(**kwargs)
github ourresearch / total-impact-core / totalimpact / item.py View on Github external
def __init__(self, **kwargs):
        # logger.debug(u"new Item {kwargs}".format(
        #     kwargs=kwargs))                

        if "tiid" in kwargs:
            self.tiid = kwargs["tiid"]
        else:
            shortuuid.set_alphabet('abcdefghijklmnopqrstuvwxyz1234567890')
            self.tiid = shortuuid.uuid()[0:24]
       
        now = datetime.datetime.utcnow()
        if "created" in kwargs:
            self.created = kwargs["created"]
        else:   
            self.created = now
        if "last_modified" in kwargs:
            self.last_modified = kwargs["last_modified"]
        else:   
            self.last_modified = now
        if "last_update_run" in kwargs:
            self.last_update_run = kwargs["last_update_run"]
        else:   
            self.last_update_run = now

        super(Item, self).__init__(**kwargs)
github BitCurator / bitcurator-access-webtools / bcaw / model_uuid.py View on Github external
def _new_id():
    full = shortuuid.uuid()
    return full[:10]
github ImperialCollegeLondon / django-drf-filepond / django_drf_filepond / views.py View on Github external
def _get_file_id():
    file_id = shortuuid.uuid()
    return file_id
github sfdye / ntusurvey / survey / models.py View on Github external
def __init__(self, *args, **kwargs):
        super(Survey, self).__init__(*args, **kwargs)
        if not self.key:
            self.key = shortuuid.uuid()
        if not self.last_modified:
            self.last_modified = datetime.now()
        if kwargs.get('title'):
            self.title = kwargs['title']
github blha303 / question / question.py View on Github external
def reverify(nick):
    id = shortuuid.uuid()
    VERIFY[id] = nick
    if airgram_check(USERS[nick]["email"], id, msg="Please reverify your Airgram account for Question. Swipe here to verify"):
        return jsonify(status="ok")
    else:
        return err_resp(error=404, text="An error occured while verifying your Airgram account.")