repo_name
stringlengths
7
94
repo_path
stringlengths
4
237
repo_head_hexsha
stringlengths
40
40
content
stringlengths
10
680k
apis
stringlengths
2
680k
jsayles/Porthole
porthole/management/commands/brocade.py
a4176aad632e319eba88dfbe40cb96a4c437725d
from django.core.management.base import BaseCommand, CommandError from django.conf import settings from porthole import models, brocade class Command(BaseCommand): help = "Command the Brocade switch stacks" args = "" requires_system_checks = False def add_arguments(self, parser): parser.add_argument( '--print_stacks', action='store_true', dest='print_stacks', help='Show the VLAN data from all switch stacks', ) def handle(self, *args, **options): if options['print_stacks']: self.print_stacks() def print_stacks(self): for s in models.SwitchStack.objects.all(): stack = brocade.SwitchStack(s.name, s.ip_address, s.raw_username, s.raw_password, port=s.port) stack.print_stack() print()
[((653, 685), 'porthole.models.SwitchStack.objects.all', 'models.SwitchStack.objects.all', ([], {}), '()\n', (683, 685), False, 'from porthole import models, brocade\n'), ((707, 797), 'porthole.brocade.SwitchStack', 'brocade.SwitchStack', (['s.name', 's.ip_address', 's.raw_username', 's.raw_password'], {'port': 's.port'}), '(s.name, s.ip_address, s.raw_username, s.raw_password,\n port=s.port)\n', (726, 797), False, 'from porthole import models, brocade\n')]
willjschmitt/joulia-webserver
joulia/unit_conversions_test.py
712decb749c2d1bda71af49ecab245378bf30078
"""Tests joulia.unit_conversions. """ from django.test import TestCase from joulia import unit_conversions class GramsToPoundsTest(TestCase): def test_grams_to_pounds(self): self.assertEquals(unit_conversions.grams_to_pounds(1000.0), 2.20462) class GramsToOuncesTest(TestCase): def test_grams_to_ounces(self): self.assertEquals(unit_conversions.grams_to_ounces(1000.0), 35.27392)
[((208, 248), 'joulia.unit_conversions.grams_to_pounds', 'unit_conversions.grams_to_pounds', (['(1000.0)'], {}), '(1000.0)\n', (240, 248), False, 'from joulia import unit_conversions\n'), ((358, 398), 'joulia.unit_conversions.grams_to_ounces', 'unit_conversions.grams_to_ounces', (['(1000.0)'], {}), '(1000.0)\n', (390, 398), False, 'from joulia import unit_conversions\n')]
zarif007/Blog-site
Django/blog/tests.py
e20e3f73fedbd7acb2f3d22398c36f3dcd4f88b4
from django.contrib.auth.models import User from django.test import TestCase from blog.models import Category, Post class Test_Create_Post(TestCase): @classmethod def setUpTestData(cls): test_category = Category.objects.create(name='django') testuser1 = User.objects.create_user( username='test-123', password='testpass' ) test_post = Post.objects.create(category_id=1, title='Post', excerpt='Excerpt', content='Content', slug='Slug', author_id=1, status='published') def test_blog_contenet(self): post = Post.postobjects.get(id=1) cat = Category.objects.get(id=1) author = f'{post.author}' excerpt = f'{post.excerpt}' title = f'{post.title}' content = f'{post.content}' status = f'{post.status}' self.assertEqual(author, 'test-123') self.assertEqual(title, 'Post') self.assertEqual(content, 'Content') self.assertEqual(status, 'published') self.assertEqual(str(post), 'Post') self.assertEqual(str(cat), 'django')
[((223, 261), 'blog.models.Category.objects.create', 'Category.objects.create', ([], {'name': '"""django"""'}), "(name='django')\n", (246, 261), False, 'from blog.models import Category, Post\n'), ((282, 348), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""test-123"""', 'password': '"""testpass"""'}), "(username='test-123', password='testpass')\n", (306, 348), False, 'from django.contrib.auth.models import User\n'), ((391, 528), 'blog.models.Post.objects.create', 'Post.objects.create', ([], {'category_id': '(1)', 'title': '"""Post"""', 'excerpt': '"""Excerpt"""', 'content': '"""Content"""', 'slug': '"""Slug"""', 'author_id': '(1)', 'status': '"""published"""'}), "(category_id=1, title='Post', excerpt='Excerpt', content\n ='Content', slug='Slug', author_id=1, status='published')\n", (410, 528), False, 'from blog.models import Category, Post\n'), ((623, 649), 'blog.models.Post.postobjects.get', 'Post.postobjects.get', ([], {'id': '(1)'}), '(id=1)\n', (643, 649), False, 'from blog.models import Category, Post\n'), ((664, 690), 'blog.models.Category.objects.get', 'Category.objects.get', ([], {'id': '(1)'}), '(id=1)\n', (684, 690), False, 'from blog.models import Category, Post\n')]
kreshuklab/hylfm-net
scripts/train_presets/beads.py
9f1013640e40e998674b65176023367b1e978782
from pathlib import Path from hylfm.hylfm_types import ( CriterionChoice, DatasetChoice, LRSchedThresMode, LRSchedulerChoice, MetricChoice, OptimizerChoice, PeriodUnit, ) from hylfm.model import HyLFM_Net from hylfm.train import train if __name__ == "__main__": train( dataset=DatasetChoice.beads_highc_b, batch_multiplier=2, batch_size=1, crit_apply_weight_above_threshold=False, crit_beta=1.0, crit_decay_weight_by=0.8, crit_decay_weight_every_unit=PeriodUnit.epoch, crit_decay_weight_every_value=1, crit_decay_weight_limit=1.0, crit_ms_ssim_weight=0.01, crit_threshold=0.5, crit_weight=0.001, criterion=CriterionChoice.WeightedSmoothL1, data_range=1.0, eval_batch_size=1, interpolation_order=2, lr_sched_factor=0.5, lr_sched_patience=10, lr_sched_thres=0.0001, lr_sched_thres_mode=LRSchedThresMode.abs, lr_scheduler=LRSchedulerChoice.ReduceLROnPlateau, max_epochs=10, model_weights=None, # Path() opt_lr=3e-4, opt_momentum=0.0, opt_weight_decay=0.0, optimizer=OptimizerChoice.Adam, patience=5, score_metric=MetricChoice.MS_SSIM, seed=None, validate_every_unit=PeriodUnit.epoch, validate_every_value=1, win_sigma=1.5, win_size=11, # model nnum=19, z_out=51, kernel2d=3, c00_2d=976, c01_2d=976, c02_2d=0, c03_2d=0, c04_2d=0, up0_2d=488, c10_2d=488, c11_2d=0, c12_2d=0, c13_2d=0, c14_2d=0, up1_2d=244, c20_2d=244, c21_2d=0, c22_2d=0, c23_2d=0, c24_2d=0, up2_2d=0, c30_2d=0, c31_2d=0, c32_2d=0, c33_2d=0, c34_2d=0, last_kernel2d=1, cin_3d=7, kernel3d=3, c00_3d=7, c01_3d=0, c02_3d=0, c03_3d=0, c04_3d=0, up0_3d=7, c10_3d=7, c11_3d=7, c12_3d=0, c13_3d=0, c14_3d=0, up1_3d=0, c20_3d=0, c21_3d=0, c22_3d=0, c23_3d=0, c24_3d=0, up2_3d=0, c30_3d=0, c31_3d=0, c32_3d=0, c33_3d=0, c34_3d=0, init_fn=HyLFM_Net.InitName.xavier_uniform_, final_activation=None, )
[((297, 1857), 'hylfm.train.train', 'train', ([], {'dataset': 'DatasetChoice.beads_highc_b', 'batch_multiplier': '(2)', 'batch_size': '(1)', 'crit_apply_weight_above_threshold': '(False)', 'crit_beta': '(1.0)', 'crit_decay_weight_by': '(0.8)', 'crit_decay_weight_every_unit': 'PeriodUnit.epoch', 'crit_decay_weight_every_value': '(1)', 'crit_decay_weight_limit': '(1.0)', 'crit_ms_ssim_weight': '(0.01)', 'crit_threshold': '(0.5)', 'crit_weight': '(0.001)', 'criterion': 'CriterionChoice.WeightedSmoothL1', 'data_range': '(1.0)', 'eval_batch_size': '(1)', 'interpolation_order': '(2)', 'lr_sched_factor': '(0.5)', 'lr_sched_patience': '(10)', 'lr_sched_thres': '(0.0001)', 'lr_sched_thres_mode': 'LRSchedThresMode.abs', 'lr_scheduler': 'LRSchedulerChoice.ReduceLROnPlateau', 'max_epochs': '(10)', 'model_weights': 'None', 'opt_lr': '(0.0003)', 'opt_momentum': '(0.0)', 'opt_weight_decay': '(0.0)', 'optimizer': 'OptimizerChoice.Adam', 'patience': '(5)', 'score_metric': 'MetricChoice.MS_SSIM', 'seed': 'None', 'validate_every_unit': 'PeriodUnit.epoch', 'validate_every_value': '(1)', 'win_sigma': '(1.5)', 'win_size': '(11)', 'nnum': '(19)', 'z_out': '(51)', 'kernel2d': '(3)', 'c00_2d': '(976)', 'c01_2d': '(976)', 'c02_2d': '(0)', 'c03_2d': '(0)', 'c04_2d': '(0)', 'up0_2d': '(488)', 'c10_2d': '(488)', 'c11_2d': '(0)', 'c12_2d': '(0)', 'c13_2d': '(0)', 'c14_2d': '(0)', 'up1_2d': '(244)', 'c20_2d': '(244)', 'c21_2d': '(0)', 'c22_2d': '(0)', 'c23_2d': '(0)', 'c24_2d': '(0)', 'up2_2d': '(0)', 'c30_2d': '(0)', 'c31_2d': '(0)', 'c32_2d': '(0)', 'c33_2d': '(0)', 'c34_2d': '(0)', 'last_kernel2d': '(1)', 'cin_3d': '(7)', 'kernel3d': '(3)', 'c00_3d': '(7)', 'c01_3d': '(0)', 'c02_3d': '(0)', 'c03_3d': '(0)', 'c04_3d': '(0)', 'up0_3d': '(7)', 'c10_3d': '(7)', 'c11_3d': '(7)', 'c12_3d': '(0)', 'c13_3d': '(0)', 'c14_3d': '(0)', 'up1_3d': '(0)', 'c20_3d': '(0)', 'c21_3d': '(0)', 'c22_3d': '(0)', 'c23_3d': '(0)', 'c24_3d': '(0)', 'up2_3d': '(0)', 'c30_3d': '(0)', 'c31_3d': '(0)', 'c32_3d': '(0)', 'c33_3d': '(0)', 'c34_3d': '(0)', 'init_fn': 'HyLFM_Net.InitName.xavier_uniform_', 'final_activation': 'None'}), '(dataset=DatasetChoice.beads_highc_b, batch_multiplier=2, batch_size=1,\n crit_apply_weight_above_threshold=False, crit_beta=1.0,\n crit_decay_weight_by=0.8, crit_decay_weight_every_unit=PeriodUnit.epoch,\n crit_decay_weight_every_value=1, crit_decay_weight_limit=1.0,\n crit_ms_ssim_weight=0.01, crit_threshold=0.5, crit_weight=0.001,\n criterion=CriterionChoice.WeightedSmoothL1, data_range=1.0,\n eval_batch_size=1, interpolation_order=2, lr_sched_factor=0.5,\n lr_sched_patience=10, lr_sched_thres=0.0001, lr_sched_thres_mode=\n LRSchedThresMode.abs, lr_scheduler=LRSchedulerChoice.ReduceLROnPlateau,\n max_epochs=10, model_weights=None, opt_lr=0.0003, opt_momentum=0.0,\n opt_weight_decay=0.0, optimizer=OptimizerChoice.Adam, patience=5,\n score_metric=MetricChoice.MS_SSIM, seed=None, validate_every_unit=\n PeriodUnit.epoch, validate_every_value=1, win_sigma=1.5, win_size=11,\n nnum=19, z_out=51, kernel2d=3, c00_2d=976, c01_2d=976, c02_2d=0, c03_2d\n =0, c04_2d=0, up0_2d=488, c10_2d=488, c11_2d=0, c12_2d=0, c13_2d=0,\n c14_2d=0, up1_2d=244, c20_2d=244, c21_2d=0, c22_2d=0, c23_2d=0, c24_2d=\n 0, up2_2d=0, c30_2d=0, c31_2d=0, c32_2d=0, c33_2d=0, c34_2d=0,\n last_kernel2d=1, cin_3d=7, kernel3d=3, c00_3d=7, c01_3d=0, c02_3d=0,\n c03_3d=0, c04_3d=0, up0_3d=7, c10_3d=7, c11_3d=7, c12_3d=0, c13_3d=0,\n c14_3d=0, up1_3d=0, c20_3d=0, c21_3d=0, c22_3d=0, c23_3d=0, c24_3d=0,\n up2_3d=0, c30_3d=0, c31_3d=0, c32_3d=0, c33_3d=0, c34_3d=0, init_fn=\n HyLFM_Net.InitName.xavier_uniform_, final_activation=None)\n', (302, 1857), False, 'from hylfm.train import train\n')]
CsekM8/LVH-THESIS
TrainingPreprocess/filtered_to_dataset.py
b0dc60daaf0825ad43951e6895289da4e3ed911b
import os import pickle from PIL import Image class PatientToImageFolder: def __init__(self, sourceFolder): self.sourceFolder = sourceFolder # How many patient with contrast SA for each pathology (used for classification) self.contrastSApathologyDict = {} # How many patient with contrast LA for each pathology (used for classification) self.contrastCH2pathologyDict = {} self.contrastCH3pathologyDict = {} self.contrastCH4pathologyDict = {} # How many patient with SA image (used for autoencoder training) self.totalSaImagePatientNum = 0 self.curSaImagePatientNum = 0 # How many patient with LA image (used for autoencoder training) self.totalCH2ImagePatientNum = 0 self.curCH2ImagePatientNum = 0 self.totalCH3ImagePatientNum = 0 self.curCH3ImagePatientNum = 0 self.totalCH4ImagePatientNum = 0 self.curCH4ImagePatientNum = 0 self.curContrastSaImagePatientNum = {} self.curContrastCH2ImagePatientNum = {} self.curContrastCH3ImagePatientNum = {} self.curContrastCH4ImagePatientNum = {} self.collectInfo() def collectInfo(self): for file in os.listdir(self.sourceFolder): if ".p" in file: tmpPat = pickle.load(open(os.path.join(self.sourceFolder, file), 'rb')) patho = tmpPat.pathology.strip() if "U18" in patho or "sport" in patho or "Normal" in patho: continue # elif "sport" in patho: # patho = "Sport" # elif "Normal" not in patho and "HCM" not in patho: # patho = "Other" if tmpPat.normalSaImages is not None: self.totalSaImagePatientNum += 1 if (tmpPat.contrastSaImages is not None and tmpPat.contrastLaImages.ch2Images is not None and tmpPat.contrastLaImages.ch3Images is not None and tmpPat.contrastLaImages.ch4Images is not None): if patho in self.contrastSApathologyDict: self.contrastSApathologyDict[patho] += 1 else: self.contrastSApathologyDict[patho] = 1 if patho in self.contrastCH2pathologyDict: self.contrastCH2pathologyDict[patho] += 1 else: self.contrastCH2pathologyDict[patho] = 1 if patho in self.contrastCH3pathologyDict: self.contrastCH3pathologyDict[patho] += 1 else: self.contrastCH3pathologyDict[patho] = 1 if patho in self.contrastCH4pathologyDict: self.contrastCH4pathologyDict[patho] += 1 else: self.contrastCH4pathologyDict[patho] = 1 if tmpPat.normalLaImages.ch2Images is not None: self.totalCH2ImagePatientNum += 1 if tmpPat.normalLaImages.ch3Images is not None: self.totalCH3ImagePatientNum += 1 if tmpPat.normalLaImages.ch4Images is not None: self.totalCH4ImagePatientNum += 1 for key in self.contrastSApathologyDict: self.curContrastSaImagePatientNum[key] = 0 for key in self.contrastCH2pathologyDict: self.curContrastCH2ImagePatientNum[key] = 0 for key in self.contrastCH3pathologyDict: self.curContrastCH3ImagePatientNum[key] = 0 for key in self.contrastCH4pathologyDict: self.curContrastCH4ImagePatientNum[key] = 0 def convertImage(self, image_2d): # if image_2d.min() > 254: # return None # Converting image from numpy array to PIL. pil_img = Image.fromarray(image_2d) if pil_img.getbbox() is None: return None return pil_img def createAutoEncoderImageFolderStructure(self, folderName): autoFolder = os.path.join(os.path.dirname(self.sourceFolder), folderName) autoTrainingFolder = os.path.join(autoFolder, "training") autoTestFolder = os.path.join(autoFolder, "test") os.makedirs(autoTrainingFolder) os.makedirs(autoTestFolder) return autoFolder, autoTrainingFolder, autoTestFolder def createClassificationImageFolderStructure(self, folderName): classFolder = os.path.join(os.path.dirname(self.sourceFolder), folderName) classTrainingFolder = os.path.join(classFolder, "training") classValidationFolder = os.path.join(classFolder, "validation") classTestFolder = os.path.join(classFolder, "test") classAllFolder = os.path.join(classFolder, 'all') os.makedirs(classTrainingFolder) os.makedirs(classValidationFolder) os.makedirs(classTestFolder) os.makedirs(classAllFolder) return classFolder, classTrainingFolder, classValidationFolder, classTestFolder, classAllFolder def saveImageForClassification(self, image, patientId, patho, testFolder, validationFolder, trainingFolder, axis, imPatho, curPatientNum, allFolder, pathologyDict): pil_img = self.convertImage(image[:, :]) if pil_img is not None: if (curPatientNum[patho] <= pathologyDict[patho] * 0.075 or (pathologyDict[patho] * 0.85 <= curPatientNum[patho] <= pathologyDict[patho] * 0.925)): imFolder = os.path.join(testFolder, imPatho) os.makedirs(imFolder, exist_ok=True) patientFolder = os.path.join(self.patientSeperatedTestFolder, imPatho + '_' + patientId) os.makedirs(patientFolder, exist_ok=True) elif ((pathologyDict[patho] * 0.075 <= curPatientNum[patho] <= pathologyDict[patho] * 0.15) or curPatientNum[patho] >= int(pathologyDict[patho] * 0.925)): imFolder = os.path.join(validationFolder, imPatho) os.makedirs(imFolder, exist_ok=True) patientFolder = os.path.join(self.patientSeperatedValidationFolder, imPatho + '_' + patientId) os.makedirs(patientFolder, exist_ok=True) else: imFolder = os.path.join(trainingFolder, imPatho) os.makedirs(imFolder, exist_ok=True) patientFolder = os.path.join(self.patientSeperatedTrainingFolder, imPatho + '_' + patientId) os.makedirs(patientFolder, exist_ok=True) axisFolder = os.path.join(patientFolder, axis) os.makedirs(axisFolder, exist_ok=True) pil_img.save(os.path.join(imFolder, "{}.png".format(patientId))) # pil_img.save(os.path.join(allFolder, "{}.png".format(patientId))) pil_img.save(os.path.join(axisFolder, "{}.png".format(patientId))) file = open(os.path.join(patientFolder, "pathology.txt"), "w") file.write("{}\n".format(patho)) file.close() def saveImageForAutoEncoder(self, images, patientId, testFolder, trainingFolder, curPatientNum, totalPatientNum, sliceIdx, frameIdx): if sliceIdx is not None: pil_img = self.convertImage(images[sliceIdx, frameIdx, :, :]) else: pil_img = self.convertImage(images[frameIdx, :, :]) if pil_img is not None: if (curPatientNum <= totalPatientNum * 0.1 or curPatientNum >= int(totalPatientNum * 0.9)): if sliceIdx is not None: pil_img.save(os.path.join(testFolder, "{}_{}_{}.png".format(patientId, sliceIdx, frameIdx))) else: pil_img.save(os.path.join(testFolder, "{}_{}.png".format(patientId, frameIdx))) else: if sliceIdx is not None: pil_img.save(os.path.join(trainingFolder, "{}_{}_{}.png".format(patientId, sliceIdx, frameIdx))) else: pil_img.save(os.path.join(trainingFolder, "{}_{}.png".format(patientId, frameIdx))) def createImageFolderDatasets(self): subfol = "only_abnormal" # autoSaFolder, autoSaTrainingFolder, autoSaTestFolder = self.createAutoEncoderImageFolderStructure( # "SaAutoEncoder") (contrastSaFolder, contrastSaTrainingFolder, contrastSaValidationFolder, contrastSaTestFolder, contrastSaAllFolder) = self.createClassificationImageFolderStructure( "{}/SaClassification".format(subfol)) # autoCH2Folder, autoCH2TrainingFolder, autoCH2TestFolder = self.createAutoEncoderImageFolderStructure( # "CH2AutoEncoder") (contrastCH2Folder, contrastCH2TrainingFolder, contrastCH2ValidationFolder, contrastCH2TestFolder, contrastCH2AllFolder) = self.createClassificationImageFolderStructure( "{}/CH2Classification".format(subfol)) # autoCH3Folder, autoCH3TrainingFolder, autoCH3TestFolder = self.createAutoEncoderImageFolderStructure( # "CH3AutoEncoder") (contrastCH3Folder, contrastCH3TrainingFolder, contrastCH3ValidationFolder, contrastCH3TestFolder, contrastCH3AllFolder) = self.createClassificationImageFolderStructure( "{}/CH3Classification".format(subfol)) # autoCH4Folder, autoCH4TrainingFolder, autoCH4TestFolder = self.createAutoEncoderImageFolderStructure( # "CH4AutoEncoder") (contrastCH4Folder, contrastCH4TrainingFolder, contrastCH4ValidationFolder, contrastCH4TestFolder, contrastCH4AllFolder) = self.createClassificationImageFolderStructure( "{}/CH4Classification".format(subfol)) self.patientSeperatedFolder = os.path.join(os.path.dirname(self.sourceFolder), '{}/patients'.format(subfol)) os.makedirs(self.patientSeperatedFolder) self.patientSeperatedTrainingFolder = os.path.join(self.patientSeperatedFolder, 'training') self.patientSeperatedValidationFolder = os.path.join(self.patientSeperatedFolder, 'validation') self.patientSeperatedTestFolder = os.path.join(self.patientSeperatedFolder, 'test') os.makedirs(self.patientSeperatedTrainingFolder) os.makedirs(self.patientSeperatedValidationFolder) os.makedirs(self.patientSeperatedTestFolder) for file in os.listdir(self.sourceFolder): if ".p" in file: tmpPat = pickle.load(open(os.path.join(self.sourceFolder, file), 'rb')) patho = tmpPat.pathology.strip() if "U18" in patho or "sport" in patho or "Normal" in patho: continue # elif "sport" in patho: # patho = "Sport" # elif "Normal" not in patho and "HCM" not in patho: # patho = "Other" imPatho = patho # if "sport" in patho: # imPatho = "Sport" # if "Normal" not in patho: # imPatho = "Hypertrophic" classificationReady = False if (tmpPat.contrastSaImages is not None and tmpPat.contrastLaImages.ch2Images is not None and tmpPat.contrastLaImages.ch3Images is not None and tmpPat.contrastLaImages.ch4Images is not None): classificationReady = True # if tmpPat.normalSaImages is not None: # for i in range(tmpPat.normalSaImages.shape[0]): # for j in range(tmpPat.normalSaImages.shape[1]): # self.saveImageForAutoEncoder(tmpPat.normalSaImages, tmpPat.patientID, autoSaTestFolder, # autoSaTrainingFolder, self.curSaImagePatientNum, # self.totalSaImagePatientNum, i, j) # self.curSaImagePatientNum += 1 if classificationReady: self.saveImageForClassification(tmpPat.contrastSaImages, tmpPat.patientID, patho, contrastSaTestFolder, contrastSaValidationFolder, contrastSaTrainingFolder, 'SA', imPatho, self.curContrastSaImagePatientNum, contrastSaAllFolder, self.contrastSApathologyDict) self.curContrastSaImagePatientNum[patho] += 1 # if tmpPat.normalLaImages.ch2Images is not None: # for i in range(tmpPat.normalLaImages.ch2Images.shape[0]): # self.saveImageForAutoEncoder(tmpPat.normalLaImages.ch2Images, tmpPat.patientID, # autoCH2TestFolder, # autoCH2TrainingFolder, self.curCH2ImagePatientNum, # self.totalCH2ImagePatientNum, None, i) # self.curCH2ImagePatientNum += 1 if classificationReady: self.saveImageForClassification(tmpPat.contrastLaImages.ch2Images, tmpPat.patientID, patho, contrastCH2TestFolder, contrastCH2ValidationFolder, contrastCH2TrainingFolder, 'CH2', imPatho, self.curContrastCH2ImagePatientNum, contrastCH2AllFolder, self.contrastCH2pathologyDict) self.curContrastCH2ImagePatientNum[patho] += 1 # if tmpPat.normalLaImages.ch3Images is not None: # for i in range(tmpPat.normalLaImages.ch3Images.shape[0]): # self.saveImageForAutoEncoder(tmpPat.normalLaImages.ch3Images, tmpPat.patientID, # autoCH3TestFolder, # autoCH3TrainingFolder, self.curCH3ImagePatientNum, # self.totalCH3ImagePatientNum, None, i) # self.curCH3ImagePatientNum += 1 if classificationReady: self.saveImageForClassification(tmpPat.contrastLaImages.ch3Images, tmpPat.patientID, patho, contrastCH3TestFolder, contrastCH3ValidationFolder, contrastCH3TrainingFolder, 'CH3', imPatho, self.curContrastCH3ImagePatientNum, contrastCH3AllFolder, self.contrastCH3pathologyDict) self.curContrastCH3ImagePatientNum[patho] += 1 # if tmpPat.normalLaImages.ch4Images is not None: # for i in range(tmpPat.normalLaImages.ch4Images.shape[0]): # self.saveImageForAutoEncoder(tmpPat.normalLaImages.ch4Images, tmpPat.patientID, # autoCH4TestFolder, # autoCH4TrainingFolder, self.curCH4ImagePatientNum, # self.totalCH4ImagePatientNum, None, i) # self.curCH4ImagePatientNum += 1 if classificationReady: self.saveImageForClassification(tmpPat.contrastLaImages.ch4Images, tmpPat.patientID, patho, contrastCH4TestFolder, contrastCH4ValidationFolder, contrastCH4TrainingFolder, 'CH4', imPatho, self.curContrastCH4ImagePatientNum, contrastCH4AllFolder, self.contrastCH4pathologyDict) self.curContrastCH4ImagePatientNum[patho] += 1 self.createLabelFileFromPathoDict(contrastSaFolder, self.contrastSApathologyDict) self.createLabelFileFromPathoDict(contrastCH2Folder, self.contrastCH2pathologyDict) self.createLabelFileFromPathoDict(contrastCH3Folder, self.contrastCH3pathologyDict) self.createLabelFileFromPathoDict(contrastCH4Folder, self.contrastCH4pathologyDict) def createLabelFileFromPathoDict(self, destination, pathoDict): file = open(os.path.join(destination, "pathologies.txt"), "w") for key in pathoDict: file.write("{}\n".format(key)) file.close() if __name__ == "__main__": sourceFolder = 'D:/BME/7felev/Szakdolgozat/whole_dataset/filtered_data' imageFolderArranger = PatientToImageFolder(sourceFolder) imageFolderArranger.createImageFolderDatasets()
[((1237, 1266), 'os.listdir', 'os.listdir', (['self.sourceFolder'], {}), '(self.sourceFolder)\n', (1247, 1266), False, 'import os\n'), ((3888, 3913), 'PIL.Image.fromarray', 'Image.fromarray', (['image_2d'], {}), '(image_2d)\n', (3903, 3913), False, 'from PIL import Image\n'), ((4176, 4212), 'os.path.join', 'os.path.join', (['autoFolder', '"""training"""'], {}), "(autoFolder, 'training')\n", (4188, 4212), False, 'import os\n'), ((4238, 4270), 'os.path.join', 'os.path.join', (['autoFolder', '"""test"""'], {}), "(autoFolder, 'test')\n", (4250, 4270), False, 'import os\n'), ((4280, 4311), 'os.makedirs', 'os.makedirs', (['autoTrainingFolder'], {}), '(autoTrainingFolder)\n', (4291, 4311), False, 'import os\n'), ((4320, 4347), 'os.makedirs', 'os.makedirs', (['autoTestFolder'], {}), '(autoTestFolder)\n', (4331, 4347), False, 'import os\n'), ((4593, 4630), 'os.path.join', 'os.path.join', (['classFolder', '"""training"""'], {}), "(classFolder, 'training')\n", (4605, 4630), False, 'import os\n'), ((4663, 4702), 'os.path.join', 'os.path.join', (['classFolder', '"""validation"""'], {}), "(classFolder, 'validation')\n", (4675, 4702), False, 'import os\n'), ((4729, 4762), 'os.path.join', 'os.path.join', (['classFolder', '"""test"""'], {}), "(classFolder, 'test')\n", (4741, 4762), False, 'import os\n'), ((4788, 4820), 'os.path.join', 'os.path.join', (['classFolder', '"""all"""'], {}), "(classFolder, 'all')\n", (4800, 4820), False, 'import os\n'), ((4830, 4862), 'os.makedirs', 'os.makedirs', (['classTrainingFolder'], {}), '(classTrainingFolder)\n', (4841, 4862), False, 'import os\n'), ((4871, 4905), 'os.makedirs', 'os.makedirs', (['classValidationFolder'], {}), '(classValidationFolder)\n', (4882, 4905), False, 'import os\n'), ((4914, 4942), 'os.makedirs', 'os.makedirs', (['classTestFolder'], {}), '(classTestFolder)\n', (4925, 4942), False, 'import os\n'), ((4951, 4978), 'os.makedirs', 'os.makedirs', (['classAllFolder'], {}), '(classAllFolder)\n', (4962, 4978), False, 'import os\n'), ((9947, 9987), 'os.makedirs', 'os.makedirs', (['self.patientSeperatedFolder'], {}), '(self.patientSeperatedFolder)\n', (9958, 9987), False, 'import os\n'), ((10034, 10087), 'os.path.join', 'os.path.join', (['self.patientSeperatedFolder', '"""training"""'], {}), "(self.patientSeperatedFolder, 'training')\n", (10046, 10087), False, 'import os\n'), ((10136, 10191), 'os.path.join', 'os.path.join', (['self.patientSeperatedFolder', '"""validation"""'], {}), "(self.patientSeperatedFolder, 'validation')\n", (10148, 10191), False, 'import os\n'), ((10234, 10283), 'os.path.join', 'os.path.join', (['self.patientSeperatedFolder', '"""test"""'], {}), "(self.patientSeperatedFolder, 'test')\n", (10246, 10283), False, 'import os\n'), ((10292, 10340), 'os.makedirs', 'os.makedirs', (['self.patientSeperatedTrainingFolder'], {}), '(self.patientSeperatedTrainingFolder)\n', (10303, 10340), False, 'import os\n'), ((10349, 10399), 'os.makedirs', 'os.makedirs', (['self.patientSeperatedValidationFolder'], {}), '(self.patientSeperatedValidationFolder)\n', (10360, 10399), False, 'import os\n'), ((10408, 10452), 'os.makedirs', 'os.makedirs', (['self.patientSeperatedTestFolder'], {}), '(self.patientSeperatedTestFolder)\n', (10419, 10452), False, 'import os\n'), ((10474, 10503), 'os.listdir', 'os.listdir', (['self.sourceFolder'], {}), '(self.sourceFolder)\n', (10484, 10503), False, 'import os\n'), ((4099, 4133), 'os.path.dirname', 'os.path.dirname', (['self.sourceFolder'], {}), '(self.sourceFolder)\n', (4114, 4133), False, 'import os\n'), ((4515, 4549), 'os.path.dirname', 'os.path.dirname', (['self.sourceFolder'], {}), '(self.sourceFolder)\n', (4530, 4549), False, 'import os\n'), ((6629, 6662), 'os.path.join', 'os.path.join', (['patientFolder', 'axis'], {}), '(patientFolder, axis)\n', (6641, 6662), False, 'import os\n'), ((6675, 6713), 'os.makedirs', 'os.makedirs', (['axisFolder'], {'exist_ok': '(True)'}), '(axisFolder, exist_ok=True)\n', (6686, 6713), False, 'import os\n'), ((9873, 9907), 'os.path.dirname', 'os.path.dirname', (['self.sourceFolder'], {}), '(self.sourceFolder)\n', (9888, 9907), False, 'import os\n'), ((16692, 16736), 'os.path.join', 'os.path.join', (['destination', '"""pathologies.txt"""'], {}), "(destination, 'pathologies.txt')\n", (16704, 16736), False, 'import os\n'), ((5577, 5610), 'os.path.join', 'os.path.join', (['testFolder', 'imPatho'], {}), '(testFolder, imPatho)\n', (5589, 5610), False, 'import os\n'), ((5627, 5663), 'os.makedirs', 'os.makedirs', (['imFolder'], {'exist_ok': '(True)'}), '(imFolder, exist_ok=True)\n', (5638, 5663), False, 'import os\n'), ((5696, 5768), 'os.path.join', 'os.path.join', (['self.patientSeperatedTestFolder', "(imPatho + '_' + patientId)"], {}), "(self.patientSeperatedTestFolder, imPatho + '_' + patientId)\n", (5708, 5768), False, 'import os\n'), ((5785, 5826), 'os.makedirs', 'os.makedirs', (['patientFolder'], {'exist_ok': '(True)'}), '(patientFolder, exist_ok=True)\n', (5796, 5826), False, 'import os\n'), ((6974, 7018), 'os.path.join', 'os.path.join', (['patientFolder', '"""pathology.txt"""'], {}), "(patientFolder, 'pathology.txt')\n", (6986, 7018), False, 'import os\n'), ((6039, 6078), 'os.path.join', 'os.path.join', (['validationFolder', 'imPatho'], {}), '(validationFolder, imPatho)\n', (6051, 6078), False, 'import os\n'), ((6095, 6131), 'os.makedirs', 'os.makedirs', (['imFolder'], {'exist_ok': '(True)'}), '(imFolder, exist_ok=True)\n', (6106, 6131), False, 'import os\n'), ((6164, 6242), 'os.path.join', 'os.path.join', (['self.patientSeperatedValidationFolder', "(imPatho + '_' + patientId)"], {}), "(self.patientSeperatedValidationFolder, imPatho + '_' + patientId)\n", (6176, 6242), False, 'import os\n'), ((6259, 6300), 'os.makedirs', 'os.makedirs', (['patientFolder'], {'exist_ok': '(True)'}), '(patientFolder, exist_ok=True)\n', (6270, 6300), False, 'import os\n'), ((6346, 6383), 'os.path.join', 'os.path.join', (['trainingFolder', 'imPatho'], {}), '(trainingFolder, imPatho)\n', (6358, 6383), False, 'import os\n'), ((6400, 6436), 'os.makedirs', 'os.makedirs', (['imFolder'], {'exist_ok': '(True)'}), '(imFolder, exist_ok=True)\n', (6411, 6436), False, 'import os\n'), ((6469, 6545), 'os.path.join', 'os.path.join', (['self.patientSeperatedTrainingFolder', "(imPatho + '_' + patientId)"], {}), "(self.patientSeperatedTrainingFolder, imPatho + '_' + patientId)\n", (6481, 6545), False, 'import os\n'), ((6562, 6603), 'os.makedirs', 'os.makedirs', (['patientFolder'], {'exist_ok': '(True)'}), '(patientFolder, exist_ok=True)\n', (6573, 6603), False, 'import os\n'), ((1339, 1376), 'os.path.join', 'os.path.join', (['self.sourceFolder', 'file'], {}), '(self.sourceFolder, file)\n', (1351, 1376), False, 'import os\n'), ((10576, 10613), 'os.path.join', 'os.path.join', (['self.sourceFolder', 'file'], {}), '(self.sourceFolder, file)\n', (10588, 10613), False, 'import os\n')]
Iolaum/Phi1337
scripts/pipeline/a06a_submission.py
c73b01cb85c0187ed5c23c672d4f3d05a6934a9f
import pandas as pd import numpy as np import pickle from sklearn.cross_validation import train_test_split from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error from math import sqrt from sklearn.svm import SVR from sklearn.svm import LinearSVR from sklearn.preprocessing import StandardScaler from sklearn.ensemble import RandomForestRegressor def prune(x): if x < 1: return 1 elif x > 3: return 3 else: return x def regression(reg_type, standardize_df, debug=False): # load model filename = '../../dataset/model_' + reg_type + '.pickle' lin_model = None with open(filename, 'rb') as f: lin_model = pickle.load(f) score_df_tst = pd.read_pickle('../../dataset/score_df_final_tst.pickle') # Fill NaN value # score_df = score_df.fillna(0.0) # The last column is the target X = np.array(score_df_tst) if standardize_df: print("Standardizing...") with open("../../dataset/scaler.pickle", 'rb') as handle: scaler = pickle.load(handle) X = scaler.transform(X) # Debug if debug: print("Score DataFrame") print(score_df) print("") print("Training Values") print(X) print("") print("Output Values") print(Y) print("") print("Shapes of X and Y") print(X.shape) print(Y.shape) # Debug if debug: print("XTR - XTS") print(xtr.shape) print(xts.shape) print("") print("YTR - YTS") print(ytr.shape) print(yts.shape) print("") yts_pred = lin_model.predict(X) #yts_error = sqrt(mean_squared_error(yts_pred, yts)) print("Prediction by (" + reg_type + ") on Test data have finished") # create submission file id_series = pd.read_csv('../../dataset/test.csv')['id'] submission_df = pd.DataFrame(id_series, columns=['id']) submission_df['relevance'] = yts_pred submission_df['relevance'] = submission_df['relevance'].map(lambda x: prune(x)) submission_df.to_csv('../../dataset/submission.csv', columns=['id', 'relevance'], index=False) if __name__ == "__main__": # Change between: # svr # linear # rfr regression_type = 'svr' standardize_df = True regression(regression_type, standardize_df, debug=False)
[((697, 754), 'pandas.read_pickle', 'pd.read_pickle', (['"""../../dataset/score_df_final_tst.pickle"""'], {}), "('../../dataset/score_df_final_tst.pickle')\n", (711, 754), True, 'import pandas as pd\n'), ((848, 870), 'numpy.array', 'np.array', (['score_df_tst'], {}), '(score_df_tst)\n', (856, 870), True, 'import numpy as np\n'), ((1706, 1745), 'pandas.DataFrame', 'pd.DataFrame', (['id_series'], {'columns': "['id']"}), "(id_series, columns=['id'])\n", (1718, 1745), True, 'import pandas as pd\n'), ((665, 679), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (676, 679), False, 'import pickle\n'), ((1645, 1682), 'pandas.read_csv', 'pd.read_csv', (['"""../../dataset/test.csv"""'], {}), "('../../dataset/test.csv')\n", (1656, 1682), True, 'import pandas as pd\n'), ((992, 1011), 'pickle.load', 'pickle.load', (['handle'], {}), '(handle)\n', (1003, 1011), False, 'import pickle\n')]
Carter-eng/SeniorDesign
Data Gathering/PythonPlottingScript.py
5305531d251ea749f909cc09eb1ccfe21714cebd
import numpy as np import serial import time import matplotlib.pyplot as plt def getData(): ser = serial.Serial('/dev/ttyACM7', 9600) sensorReadings = [] start = time.time() current = time.time() while current - start < 10: data =ser.readline() sensorReadings.append(float(data)) current = time.time() return sensorReadings def plotter(sensorReadings): plt.plot(sensorReadings) plt.ylabel('EEG Sensor sensorReadings') plt.show() if __name__ == '__main__': sensorReadings = getData() plotter(sensorReadings)
[((109, 144), 'serial.Serial', 'serial.Serial', (['"""/dev/ttyACM7"""', '(9600)'], {}), "('/dev/ttyACM7', 9600)\n", (122, 144), False, 'import serial\n'), ((183, 194), 'time.time', 'time.time', ([], {}), '()\n', (192, 194), False, 'import time\n'), ((210, 221), 'time.time', 'time.time', ([], {}), '()\n', (219, 221), False, 'import time\n'), ((424, 448), 'matplotlib.pyplot.plot', 'plt.plot', (['sensorReadings'], {}), '(sensorReadings)\n', (432, 448), True, 'import matplotlib.pyplot as plt\n'), ((454, 493), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""EEG Sensor sensorReadings"""'], {}), "('EEG Sensor sensorReadings')\n", (464, 493), True, 'import matplotlib.pyplot as plt\n'), ((499, 509), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (507, 509), True, 'import matplotlib.pyplot as plt\n'), ((348, 359), 'time.time', 'time.time', ([], {}), '()\n', (357, 359), False, 'import time\n')]
robinvoogt/text-sdk-python
Examples/Rich_Message_Example.py
1acd624991f396cc673dad22cfa3272b4b3fb53b
from CMText.TextClient import TextClient # Message to be send message = 'Examples message to be send' # Media to be send media = { "mediaName": "conversational-commerce", "mediaUri": "https://www.cm.com/cdn/cm/cm.png", "mimeType": "image/png" } # AllowedChannels in this case Whatsapp allowedChannels = ['Whatsapp'] # Recipients to = ['003156789000', '002134567890'] # Instantiate client with your own api-key client = TextClient(apikey=UNIQUE_API_KEY) # Add a Rich message to the queue client.AddRichMessage(message=message, from_='pythonSDK', to=to, allowedChannels=allowedChannels, media=media) # Send the messages response = client.send() # Print response print(response.text)
[((468, 501), 'CMText.TextClient.TextClient', 'TextClient', ([], {'apikey': 'UNIQUE_API_KEY'}), '(apikey=UNIQUE_API_KEY)\n', (478, 501), False, 'from CMText.TextClient import TextClient\n')]
Dmitry450/asynciogame
client/audio.py
47a2a118155805db37f2c3bd916bd6c68c504cff
import pygame from pygame.math import Vector2 class Sound: def __init__(self, manager, snd, volume=1.0): self.manager = manager self.snd = pygame.mixer.Sound(snd) self.snd.set_volume(1.0) self.ttl = snd.get_length() self.playing = True self.snd.play() def update(self, dtime): self.ttl -= dtime if self.ttl <= 0: self.playing = False class AttachedSound(Sound): def __init__(self, manager, snd, position, volume=1.0, fade_dist=1, min_volume=0.1): super().__init__(manager, snd) if not isinstance(position, Vector2): position = Vector2(position) self.position = position self.volume = volume self.fade_dist = fade_dist self.min_volume = min_volume def update(self, dtime): super().update(dtime) if self.playing and self.manager.track_object is not None: dist = self.position.distance_to(self.manager.track_object.position) volume = self.volume*self.fade_dist/dist if volume > self.min_volume: self.snd.set_volume(volume) else: self.snd.set_volume(0) class AudioManager: def __init__(self): self.loaded = {} self.sounds = [] self.track_object = None def play_sound(self, d): name = d["name"] if self.loaded.get(name) is None: self.loaded[name] = pygame.mixer.Sound(name) if d["type"] == "normal": self.sounds.append(Sound(self, self.loaded[name], volume=d.get("volume", 1.0))) # Actually sound can be "attached_to_position" and "attached_to_entity". # To avoid adding EntityManager reference into AudioManager, "position" # will be replaced by entity.position in Connection when sound event handled. # Anyway, d["type"] will be set to "attached" elif d["type"] == "attached": self.sounds.append(AttachedSound(self, self.loaded[name], d["position"], volume=d.get("volume", 1.0), fade_dist=d.get("fade_dist", 1), min_volume=d.get("min_volume", 0.1))) def update(self, dtime): for sound in self.sounds: sound.update(dtime) if not sound.playing: self.sounds.remove(sound)
[((166, 189), 'pygame.mixer.Sound', 'pygame.mixer.Sound', (['snd'], {}), '(snd)\n', (184, 189), False, 'import pygame\n'), ((707, 724), 'pygame.math.Vector2', 'Vector2', (['position'], {}), '(position)\n', (714, 724), False, 'from pygame.math import Vector2\n'), ((1613, 1637), 'pygame.mixer.Sound', 'pygame.mixer.Sound', (['name'], {}), '(name)\n', (1631, 1637), False, 'import pygame\n')]
MmeK/ganjoor-telegram-bot
bot/ganjoor/category_choose.py
3992bdd860ea3626dccd79b0c1993a3662e92aa5
# Copyright 2021 Mohammad Kazemi <kazemi.me.222@gmail.com>. # SPDX-License-Identifier: MIT # Telegram API framework core imports from collections import namedtuple from functools import partial from ganjoor.ganjoor import Ganjoor from telegram.ext import Dispatcher, CallbackContext from telegram import Update # Helper methods import from utils.logger import get_logger from utils.telegram.keyboards import category_keyboard # Telegram API framework handlers imports from telegram.ext import CallbackQueryHandler # Init logger logger = get_logger(__name__) CallbackData = namedtuple('CallbackData', "menu_name doto") def init(dispatcher: Dispatcher, ganjoor: Ganjoor): """Provide handlers initialization.""" dispatcher.add_handler(CallbackQueryHandler( partial(category_id, ganjoor=ganjoor), pattern=r'^category_*')) def category_id(update: Update, context: CallbackContext, ganjoor: Ganjoor) -> int: """Process a /start command.""" query = update.callback_query message_id = '_'.join(query.data.split('_')[2:]) cat_id = query.data.split('_')[1] cat = ganjoor.find_category_by_id(cat_id, with_poems=True) # query.answer() query.answer() context.bot.edit_message_reply_markup( inline_message_id=message_id, reply_markup=category_keyboard(cat, message_id)) # query.edit_reply_markup()
[((539, 559), 'utils.logger.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (549, 559), False, 'from utils.logger import get_logger\n'), ((575, 619), 'collections.namedtuple', 'namedtuple', (['"""CallbackData"""', '"""menu_name doto"""'], {}), "('CallbackData', 'menu_name doto')\n", (585, 619), False, 'from collections import namedtuple\n'), ((774, 811), 'functools.partial', 'partial', (['category_id'], {'ganjoor': 'ganjoor'}), '(category_id, ganjoor=ganjoor)\n', (781, 811), False, 'from functools import partial\n'), ((1285, 1319), 'utils.telegram.keyboards.category_keyboard', 'category_keyboard', (['cat', 'message_id'], {}), '(cat, message_id)\n', (1302, 1319), False, 'from utils.telegram.keyboards import category_keyboard\n')]
walterfan/snippets
python/util/md_utils.py
62f87720c411093fcff888f25b338afd1d99a6f9
import os import sys import struct import re import logging logging.basicConfig(stream=sys.stderr, level=logging.DEBUG) logger = logging.getLogger(__name__) def list_to_md(str_list): output = "" for str in str_list: output = output + "* %s \n" % str return output def str_to_md_list(the_str, sep): str_list = the_str.split(sep) output = "" for str in str_list: output = output + "* %s \n" % str return output
[((61, 120), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stderr', 'level': 'logging.DEBUG'}), '(stream=sys.stderr, level=logging.DEBUG)\n', (80, 120), False, 'import logging\n'), ((130, 157), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (147, 157), False, 'import logging\n')]
Josverl/micropython-stubber
board/main.py
3dc57ea9e957bd9f36fce6abfe051a2fa7ace522
import uos as os import time def countdown(): for i in range(5, 0, -1): print("start stubbing in {}...".format(i)) time.sleep(1) import createstubs # import stub_lvgl try: # only run import if no stubs yet os.listdir("stubs") print("stub folder was found, stubbing is not automatically started") except OSError: countdown()
[((247, 266), 'uos.listdir', 'os.listdir', (['"""stubs"""'], {}), "('stubs')\n", (257, 266), True, 'import uos as os\n'), ((137, 150), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (147, 150), False, 'import time\n')]
zipated/src
third_party/blink/tools/blinkpy/web_tests/breakpad/dump_reader_multipart_unittest.py
2b8388091c71e442910a21ada3d97ae8bc1845d3
# Copyright (C) 2013 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above # copyright notice, this list of conditions and the following disclaimer # in the documentation and/or other materials provided with the # distribution. # * Neither the name of Google Inc. nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import unittest from blinkpy.common.host import Host from blinkpy.common.host_mock import MockHost from blinkpy.web_tests.breakpad.dump_reader_multipart import DumpReaderMultipart class TestDumpReaderMultipart(unittest.TestCase): _MULTIPART_DUMP = [ '--boundary', 'Content-Disposition: form-data; name="prod"', '', 'content_shell', '--boundary', 'Content-Disposition: form-data; name="pid"', '', '4711', '--boundary', 'Content-Disposition: form-data; name="upload_file_minidump"; filename="dump"', 'Content-Type: application/octet-stream', '', 'MDMP', '--boundary--', ] def test_check_generate_breakpad_symbols_actually_exists(self): host = Host() dump_reader = DumpReaderMultipart(host, build_dir=None) self.assertTrue(host.filesystem.exists(dump_reader._path_to_generate_breakpad_symbols())) def test_check_is_functional_breakpad_tools_not_found(self): host = MockHost() build_dir = "/mock-checkout/out/Debug" host.filesystem.maybe_make_directory(build_dir) dump_reader = DumpReaderMultipart(host, build_dir) dump_reader._file_extension = lambda: 'dmp' dump_reader._binaries_to_symbolize = lambda: ['content_shell'] self.assertFalse(dump_reader.check_is_functional()) def test_get_pid_from_dump(self): host = MockHost() dump_file = '/crash-dumps/dump.dmp' expected_pid = '4711' host.filesystem.write_text_file(dump_file, "\r\n".join(TestDumpReaderMultipart._MULTIPART_DUMP)) build_dir = "/mock-checkout/out/Debug" host.filesystem.maybe_make_directory(build_dir) host.filesystem.exists = lambda x: True # The mock file object returned by open_binary_file_for_reading doesn't # have readline(), however, the real File object does. host.filesystem.open_binary_file_for_reading = host.filesystem.open_text_file_for_reading dump_reader = DumpReaderMultipart(host, build_dir) dump_reader._file_extension = lambda: 'dmp' dump_reader._binaries_to_symbolize = lambda: ['content_shell'] self.assertTrue(dump_reader.check_is_functional()) self.assertEqual(expected_pid, dump_reader._get_pid_from_dump(dump_file)) def test_get_stack_from_dump(self): host = MockHost() dump_file = '/crash-dumps/dump.dmp' host.filesystem.write_text_file(dump_file, "\r\n".join(TestDumpReaderMultipart._MULTIPART_DUMP)) build_dir = "/mock-checkout/out/Debug" host.filesystem.maybe_make_directory(build_dir) host.filesystem.exists = lambda x: True # The mock file object returned by open_binary_file_for_reading doesn't # have readline(), however, the real File object does. host.filesystem.open_binary_file_for_reading = host.filesystem.open_text_file_for_reading dump_reader = DumpReaderMultipart(host, build_dir) dump_reader._file_extension = lambda: 'dmp' dump_reader._binaries_to_symbolize = lambda: ['content_shell'] self.assertTrue(dump_reader.check_is_functional()) self.assertEqual("MOCK output of child process", dump_reader._get_stack_from_dump(dump_file)) self.assertEqual(2, len(host.executive.calls)) cmd_line = " ".join(host.executive.calls[0]) self.assertIn('generate_breakpad_symbols.py', cmd_line) cmd_line = " ".join(host.executive.calls[1]) self.assertIn('minidump_stackwalk', cmd_line)
[((2307, 2313), 'blinkpy.common.host.Host', 'Host', ([], {}), '()\n', (2311, 2313), False, 'from blinkpy.common.host import Host\n'), ((2336, 2377), 'blinkpy.web_tests.breakpad.dump_reader_multipart.DumpReaderMultipart', 'DumpReaderMultipart', (['host'], {'build_dir': 'None'}), '(host, build_dir=None)\n', (2355, 2377), False, 'from blinkpy.web_tests.breakpad.dump_reader_multipart import DumpReaderMultipart\n'), ((2557, 2567), 'blinkpy.common.host_mock.MockHost', 'MockHost', ([], {}), '()\n', (2565, 2567), False, 'from blinkpy.common.host_mock import MockHost\n'), ((2694, 2730), 'blinkpy.web_tests.breakpad.dump_reader_multipart.DumpReaderMultipart', 'DumpReaderMultipart', (['host', 'build_dir'], {}), '(host, build_dir)\n', (2713, 2730), False, 'from blinkpy.web_tests.breakpad.dump_reader_multipart import DumpReaderMultipart\n'), ((2969, 2979), 'blinkpy.common.host_mock.MockHost', 'MockHost', ([], {}), '()\n', (2977, 2979), False, 'from blinkpy.common.host_mock import MockHost\n'), ((3575, 3611), 'blinkpy.web_tests.breakpad.dump_reader_multipart.DumpReaderMultipart', 'DumpReaderMultipart', (['host', 'build_dir'], {}), '(host, build_dir)\n', (3594, 3611), False, 'from blinkpy.web_tests.breakpad.dump_reader_multipart import DumpReaderMultipart\n'), ((3933, 3943), 'blinkpy.common.host_mock.MockHost', 'MockHost', ([], {}), '()\n', (3941, 3943), False, 'from blinkpy.common.host_mock import MockHost\n'), ((4509, 4545), 'blinkpy.web_tests.breakpad.dump_reader_multipart.DumpReaderMultipart', 'DumpReaderMultipart', (['host', 'build_dir'], {}), '(host, build_dir)\n', (4528, 4545), False, 'from blinkpy.web_tests.breakpad.dump_reader_multipart import DumpReaderMultipart\n')]
SilverWingedSeraph/sws-dotfiles
scripts/emoji-to-scl.py
6bee2b2ece03439101848673d6bcd9196359f7c4
#!/usr/bin/python3 # -*- coding: utf-8 -*- from subprocess import Popen, PIPE emojis="""⛑🏻 Helmet With White Cross, Type-1-2 ⛑🏼 Helmet With White Cross, Type-3 ⛑🏽 Helmet With White Cross, Type-4 ⛑🏾 Helmet With White Cross, Type-5 ⛑🏿 Helmet With White Cross, Type-6 💏🏻 Kiss, Type-1-2 💏🏼 Kiss, Type-3 💏🏽 Kiss, Type-4 💏🏾 Kiss, Type-5 💏🏿 Kiss, Type-6 💑🏻 Couple With Heart, Type-1-2 💑🏼 Couple With Heart, Type-3 💑🏽 Couple With Heart, Type-4 💑🏾 Couple With Heart, Type-5 💑🏿 Couple With Heart, Type-6 ⛷🏻 Skier, Type-1-2 ⛷🏼 Skier, Type-3 ⛷🏽 Skier, Type-4 ⛷🏾 Skier, Type-5 ⛷🏿 Skier, Type-6 😀 Grinning Face 😁 Grinning Face With Smiling Eyes 😂 Face With Tears of Joy 🤣 Rolling on the Floor Laughing 😃 Smiling Face With Open Mouth 😄 Smiling Face With Open Mouth & Smiling Eyes 😅 Smiling Face With Open Mouth & Cold Sweat 😆 Smiling Face With Open Mouth & Closed Eyes 😉 Winking Face 😊 Smiling Face With Smiling Eyes 😋 Face Savouring Delicious Food 😎 Smiling Face With Sunglasses 😍 Smiling Face With Heart-Eyes 😘 Face Blowing a Kiss 😗 Kissing Face 😙 Kissing Face With Smiling Eyes 😚 Kissing Face With Closed Eyes ☺ Smiling Face 🙂 Slightly Smiling Face 🤗 Hugging Face 🤩 Star-Struck 🤔 Thinking Face 🤨 Face With Raised Eyebrow 😐 Neutral Face 😑 Expressionless Face 😶 Face Without Mouth 🙄 Face With Rolling Eyes 😏 Smirking Face 😣 Persevering Face 😥 Disappointed but Relieved Face 😮 Face With Open Mouth 🤐 Zipper-Mouth Face 😯 Hushed Face 😪 Sleepy Face 😫 Tired Face 😴 Sleeping Face 😌 Relieved Face 😛 Face With Stuck-Out Tongue 😜 Face With Stuck-Out Tongue & Winking Eye 😝 Face With Stuck-Out Tongue & Closed Eyes 🤤 Drooling Face 😒 Unamused Face 😓 Face With Cold Sweat 😔 Pensive Face 😕 Confused Face 🙃 Upside-Down Face 🤑 Money-Mouth Face 😲 Astonished Face ☹ Frowning Face 🙁 Slightly Frowning Face 😖 Confounded Face 😞 Disappointed Face 😟 Worried Face 😤 Face With Steam From Nose 😢 Crying Face 😭 Loudly Crying Face 😦 Frowning Face With Open Mouth 😧 Anguished Face 😨 Fearful Face 😩 Weary Face 🤯 Exploding Head 😬 Grimacing Face 😰 Face With Open Mouth & Cold Sweat 😱 Face Screaming in Fear 😳 Flushed Face 🤪 Crazy Face 😵 Dizzy Face 😡 Pouting Face 😠 Angry Face 🤬 Face With Symbols Over Mouth 😷 Face With Medical Mask 🤒 Face With Thermometer 🤕 Face With Head-Bandage 🤢 Nauseated Face 🤮 Face Vomiting 🤧 Sneezing Face 😇 Smiling Face With Halo 🤠 Cowboy Hat Face 🤡 Clown Face 🤥 Lying Face 🤫 Shushing Face 🤭 Face With Hand Over Mouth 🧐 Face With Monocle 🤓 Nerd Face 😈 Smiling Face With Horns 👿 Angry Face With Horns 👹 Ogre 👺 Goblin 💀 Skull ☠ Skull and Crossbones 👻 Ghost 👽 Alien 👾 Alien Monster 🤖 Robot Face 💩 Pile of Poo 😺 Smiling Cat Face With Open Mouth 😸 Grinning Cat Face With Smiling Eyes 😹 Cat Face With Tears of Joy 😻 Smiling Cat Face With Heart-Eyes 😼 Cat Face With Wry Smile 😽 Kissing Cat Face With Closed Eyes 🙀 Weary Cat Face 😿 Crying Cat Face 😾 Pouting Cat Face 🙈 See-No-Evil Monkey 🙉 Hear-No-Evil Monkey 🙊 Speak-No-Evil Monkey 👶 Baby 👶🏻 Baby: Light Skin Tone 👶🏼 Baby: Medium-Light Skin Tone 👶🏽 Baby: Medium Skin Tone 👶🏾 Baby: Medium-Dark Skin Tone 👶🏿 Baby: Dark Skin Tone 🧒 Child 🧒🏻 Child: Light Skin Tone 🧒🏼 Child: Medium-Light Skin Tone 🧒🏽 Child: Medium Skin Tone 🧒🏾 Child: Medium-Dark Skin Tone 🧒🏿 Child: Dark Skin Tone 👦 Boy 👦🏻 Boy: Light Skin Tone 👦🏼 Boy: Medium-Light Skin Tone 👦🏽 Boy: Medium Skin Tone 👦🏾 Boy: Medium-Dark Skin Tone 👦🏿 Boy: Dark Skin Tone 👧 Girl 👧🏻 Girl: Light Skin Tone 👧🏼 Girl: Medium-Light Skin Tone 👧🏽 Girl: Medium Skin Tone 👧🏾 Girl: Medium-Dark Skin Tone 👧🏿 Girl: Dark Skin Tone 🧑 Adult 🧑🏻 Adult: Light Skin Tone 🧑🏼 Adult: Medium-Light Skin Tone 🧑🏽 Adult: Medium Skin Tone 🧑🏾 Adult: Medium-Dark Skin Tone 🧑🏿 Adult: Dark Skin Tone 👨 Man 👨🏻 Man: Light Skin Tone 👨🏼 Man: Medium-Light Skin Tone 👨🏽 Man: Medium Skin Tone 👨🏾 Man: Medium-Dark Skin Tone 👨🏿 Man: Dark Skin Tone 👩 Woman 👩🏻 Woman: Light Skin Tone 👩🏼 Woman: Medium-Light Skin Tone 👩🏽 Woman: Medium Skin Tone 👩🏾 Woman: Medium-Dark Skin Tone 👩🏿 Woman: Dark Skin Tone 🧓 Older Adult 🧓🏻 Older Adult: Light Skin Tone 🧓🏼 Older Adult: Medium-Light Skin Tone 🧓🏽 Older Adult: Medium Skin Tone 🧓🏾 Older Adult: Medium-Dark Skin Tone 🧓🏿 Older Adult: Dark Skin Tone 👴 Old Man 👴🏻 Old Man: Light Skin Tone 👴🏼 Old Man: Medium-Light Skin Tone 👴🏽 Old Man: Medium Skin Tone 👴🏾 Old Man: Medium-Dark Skin Tone 👴🏿 Old Man: Dark Skin Tone 👵 Old Woman 👵🏻 Old Woman: Light Skin Tone 👵🏼 Old Woman: Medium-Light Skin Tone 👵🏽 Old Woman: Medium Skin Tone 👵🏾 Old Woman: Medium-Dark Skin Tone 👵🏿 Old Woman: Dark Skin Tone 👨‍⚕️ Man Health Worker 👨🏻‍⚕️ Man Health Worker: Light Skin Tone 👨🏼‍⚕️ Man Health Worker: Medium-Light Skin Tone 👨🏽‍⚕️ Man Health Worker: Medium Skin Tone 👨🏾‍⚕️ Man Health Worker: Medium-Dark Skin Tone 👨🏿‍⚕️ Man Health Worker: Dark Skin Tone 👩‍⚕️ Woman Health Worker 👩🏻‍⚕️ Woman Health Worker: Light Skin Tone 👩🏼‍⚕️ Woman Health Worker: Medium-Light Skin Tone 👩🏽‍⚕️ Woman Health Worker: Medium Skin Tone 👩🏾‍⚕️ Woman Health Worker: Medium-Dark Skin Tone 👩🏿‍⚕️ Woman Health Worker: Dark Skin Tone 👨‍🎓 Man Student 👨🏻‍🎓 Man Student: Light Skin Tone 👨🏼‍🎓 Man Student: Medium-Light Skin Tone 👨🏽‍🎓 Man Student: Medium Skin Tone 👨🏾‍🎓 Man Student: Medium-Dark Skin Tone 👨🏿‍🎓 Man Student: Dark Skin Tone 👩‍🎓 Woman Student 👩🏻‍🎓 Woman Student: Light Skin Tone 👩🏼‍🎓 Woman Student: Medium-Light Skin Tone 👩🏽‍🎓 Woman Student: Medium Skin Tone 👩🏾‍🎓 Woman Student: Medium-Dark Skin Tone 👩🏿‍🎓 Woman Student: Dark Skin Tone 👨‍🏫 Man Teacher 👨🏻‍🏫 Man Teacher: Light Skin Tone 👨🏼‍🏫 Man Teacher: Medium-Light Skin Tone 👨🏽‍🏫 Man Teacher: Medium Skin Tone 👨🏾‍🏫 Man Teacher: Medium-Dark Skin Tone 👨🏿‍🏫 Man Teacher: Dark Skin Tone 👩‍🏫 Woman Teacher 👩🏻‍🏫 Woman Teacher: Light Skin Tone 👩🏼‍🏫 Woman Teacher: Medium-Light Skin Tone 👩🏽‍🏫 Woman Teacher: Medium Skin Tone 👩🏾‍🏫 Woman Teacher: Medium-Dark Skin Tone 👩🏿‍🏫 Woman Teacher: Dark Skin Tone 👨‍⚖️ Man Judge 👨🏻‍⚖️ Man Judge: Light Skin Tone 👨🏼‍⚖️ Man Judge: Medium-Light Skin Tone 👨🏽‍⚖️ Man Judge: Medium Skin Tone 👨🏾‍⚖️ Man Judge: Medium-Dark Skin Tone 👨🏿‍⚖️ Man Judge: Dark Skin Tone 👩‍⚖️ Woman Judge 👩🏻‍⚖️ Woman Judge: Light Skin Tone 👩🏼‍⚖️ Woman Judge: Medium-Light Skin Tone 👩🏽‍⚖️ Woman Judge: Medium Skin Tone 👩🏾‍⚖️ Woman Judge: Medium-Dark Skin Tone 👩🏿‍⚖️ Woman Judge: Dark Skin Tone 👨‍🌾 Man Farmer 👨🏻‍🌾 Man Farmer: Light Skin Tone 👨🏼‍🌾 Man Farmer: Medium-Light Skin Tone 👨🏽‍🌾 Man Farmer: Medium Skin Tone 👨🏾‍🌾 Man Farmer: Medium-Dark Skin Tone 👨🏿‍🌾 Man Farmer: Dark Skin Tone 👩‍🌾 Woman Farmer 👩🏻‍🌾 Woman Farmer: Light Skin Tone 👩🏼‍🌾 Woman Farmer: Medium-Light Skin Tone 👩🏽‍🌾 Woman Farmer: Medium Skin Tone 👩🏾‍🌾 Woman Farmer: Medium-Dark Skin Tone 👩🏿‍🌾 Woman Farmer: Dark Skin Tone 👨‍🍳 Man Cook 👨🏻‍🍳 Man Cook: Light Skin Tone 👨🏼‍🍳 Man Cook: Medium-Light Skin Tone 👨🏽‍🍳 Man Cook: Medium Skin Tone 👨🏾‍🍳 Man Cook: Medium-Dark Skin Tone 👨🏿‍🍳 Man Cook: Dark Skin Tone 👩‍🍳 Woman Cook 👩🏻‍🍳 Woman Cook: Light Skin Tone 👩🏼‍🍳 Woman Cook: Medium-Light Skin Tone 👩🏽‍🍳 Woman Cook: Medium Skin Tone 👩🏾‍🍳 Woman Cook: Medium-Dark Skin Tone 👩🏿‍🍳 Woman Cook: Dark Skin Tone 👨‍🔧 Man Mechanic 👨🏻‍🔧 Man Mechanic: Light Skin Tone 👨🏼‍🔧 Man Mechanic: Medium-Light Skin Tone 👨🏽‍🔧 Man Mechanic: Medium Skin Tone 👨🏾‍🔧 Man Mechanic: Medium-Dark Skin Tone 👨🏿‍🔧 Man Mechanic: Dark Skin Tone 👩‍🔧 Woman Mechanic 👩🏻‍🔧 Woman Mechanic: Light Skin Tone 👩🏼‍🔧 Woman Mechanic: Medium-Light Skin Tone 👩🏽‍🔧 Woman Mechanic: Medium Skin Tone 👩🏾‍🔧 Woman Mechanic: Medium-Dark Skin Tone 👩🏿‍🔧 Woman Mechanic: Dark Skin Tone 👨‍🏭 Man Factory Worker 👨🏻‍🏭 Man Factory Worker: Light Skin Tone 👨🏼‍🏭 Man Factory Worker: Medium-Light Skin Tone 👨🏽‍🏭 Man Factory Worker: Medium Skin Tone 👨🏾‍🏭 Man Factory Worker: Medium-Dark Skin Tone 👨🏿‍🏭 Man Factory Worker: Dark Skin Tone 👩‍🏭 Woman Factory Worker 👩🏻‍🏭 Woman Factory Worker: Light Skin Tone 👩🏼‍🏭 Woman Factory Worker: Medium-Light Skin Tone 👩🏽‍🏭 Woman Factory Worker: Medium Skin Tone 👩🏾‍🏭 Woman Factory Worker: Medium-Dark Skin Tone 👩🏿‍🏭 Woman Factory Worker: Dark Skin Tone 👨‍💼 Man Office Worker 👨🏻‍💼 Man Office Worker: Light Skin Tone 👨🏼‍💼 Man Office Worker: Medium-Light Skin Tone 👨🏽‍💼 Man Office Worker: Medium Skin Tone 👨🏾‍💼 Man Office Worker: Medium-Dark Skin Tone 👨🏿‍💼 Man Office Worker: Dark Skin Tone 👩‍💼 Woman Office Worker 👩🏻‍💼 Woman Office Worker: Light Skin Tone 👩🏼‍💼 Woman Office Worker: Medium-Light Skin Tone 👩🏽‍💼 Woman Office Worker: Medium Skin Tone 👩🏾‍💼 Woman Office Worker: Medium-Dark Skin Tone 👩🏿‍💼 Woman Office Worker: Dark Skin Tone 👨‍🔬 Man Scientist 👨🏻‍🔬 Man Scientist: Light Skin Tone 👨🏼‍🔬 Man Scientist: Medium-Light Skin Tone 👨🏽‍🔬 Man Scientist: Medium Skin Tone 👨🏾‍🔬 Man Scientist: Medium-Dark Skin Tone 👨🏿‍🔬 Man Scientist: Dark Skin Tone 👩‍🔬 Woman Scientist 👩🏻‍🔬 Woman Scientist: Light Skin Tone 👩🏼‍🔬 Woman Scientist: Medium-Light Skin Tone 👩🏽‍🔬 Woman Scientist: Medium Skin Tone 👩🏾‍🔬 Woman Scientist: Medium-Dark Skin Tone 👩🏿‍🔬 Woman Scientist: Dark Skin Tone 👨‍💻 Man Technologist 👨🏻‍💻 Man Technologist: Light Skin Tone 👨🏼‍💻 Man Technologist: Medium-Light Skin Tone 👨🏽‍💻 Man Technologist: Medium Skin Tone 👨🏾‍💻 Man Technologist: Medium-Dark Skin Tone 👨🏿‍💻 Man Technologist: Dark Skin Tone 👩‍💻 Woman Technologist 👩🏻‍💻 Woman Technologist: Light Skin Tone 👩🏼‍💻 Woman Technologist: Medium-Light Skin Tone 👩🏽‍💻 Woman Technologist: Medium Skin Tone 👩🏾‍💻 Woman Technologist: Medium-Dark Skin Tone 👩🏿‍💻 Woman Technologist: Dark Skin Tone 👨‍🎤 Man Singer 👨🏻‍🎤 Man Singer: Light Skin Tone 👨🏼‍🎤 Man Singer: Medium-Light Skin Tone 👨🏽‍🎤 Man Singer: Medium Skin Tone 👨🏾‍🎤 Man Singer: Medium-Dark Skin Tone 👨🏿‍🎤 Man Singer: Dark Skin Tone 👩‍🎤 Woman Singer 👩🏻‍🎤 Woman Singer: Light Skin Tone 👩🏼‍🎤 Woman Singer: Medium-Light Skin Tone 👩🏽‍🎤 Woman Singer: Medium Skin Tone 👩🏾‍🎤 Woman Singer: Medium-Dark Skin Tone 👩🏿‍🎤 Woman Singer: Dark Skin Tone 👨‍🎨 Man Artist 👨🏻‍🎨 Man Artist: Light Skin Tone 👨🏼‍🎨 Man Artist: Medium-Light Skin Tone 👨🏽‍🎨 Man Artist: Medium Skin Tone 👨🏾‍🎨 Man Artist: Medium-Dark Skin Tone 👨🏿‍🎨 Man Artist: Dark Skin Tone 👩‍🎨 Woman Artist 👩🏻‍🎨 Woman Artist: Light Skin Tone 👩🏼‍🎨 Woman Artist: Medium-Light Skin Tone 👩🏽‍🎨 Woman Artist: Medium Skin Tone 👩🏾‍🎨 Woman Artist: Medium-Dark Skin Tone 👩🏿‍🎨 Woman Artist: Dark Skin Tone 👨‍✈️ Man Pilot 👨🏻‍✈️ Man Pilot: Light Skin Tone 👨🏼‍✈️ Man Pilot: Medium-Light Skin Tone 👨🏽‍✈️ Man Pilot: Medium Skin Tone 👨🏾‍✈️ Man Pilot: Medium-Dark Skin Tone 👨🏿‍✈️ Man Pilot: Dark Skin Tone 👩‍✈️ Woman Pilot 👩🏻‍✈️ Woman Pilot: Light Skin Tone 👩🏼‍✈️ Woman Pilot: Medium-Light Skin Tone 👩🏽‍✈️ Woman Pilot: Medium Skin Tone 👩🏾‍✈️ Woman Pilot: Medium-Dark Skin Tone 👩🏿‍✈️ Woman Pilot: Dark Skin Tone 👨‍🚀 Man Astronaut 👨🏻‍🚀 Man Astronaut: Light Skin Tone 👨🏼‍🚀 Man Astronaut: Medium-Light Skin Tone 👨🏽‍🚀 Man Astronaut: Medium Skin Tone 👨🏾‍🚀 Man Astronaut: Medium-Dark Skin Tone 👨🏿‍🚀 Man Astronaut: Dark Skin Tone 👩‍🚀 Woman Astronaut 👩🏻‍🚀 Woman Astronaut: Light Skin Tone 👩🏼‍🚀 Woman Astronaut: Medium-Light Skin Tone 👩🏽‍🚀 Woman Astronaut: Medium Skin Tone 👩🏾‍🚀 Woman Astronaut: Medium-Dark Skin Tone 👩🏿‍🚀 Woman Astronaut: Dark Skin Tone 👨‍🚒 Man Firefighter 👨🏻‍🚒 Man Firefighter: Light Skin Tone 👨🏼‍🚒 Man Firefighter: Medium-Light Skin Tone 👨🏽‍🚒 Man Firefighter: Medium Skin Tone 👨🏾‍🚒 Man Firefighter: Medium-Dark Skin Tone 👨🏿‍🚒 Man Firefighter: Dark Skin Tone 👩‍🚒 Woman Firefighter 👩🏻‍🚒 Woman Firefighter: Light Skin Tone 👩🏼‍🚒 Woman Firefighter: Medium-Light Skin Tone 👩🏽‍🚒 Woman Firefighter: Medium Skin Tone 👩🏾‍🚒 Woman Firefighter: Medium-Dark Skin Tone 👩🏿‍🚒 Woman Firefighter: Dark Skin Tone 👮 Police Officer 👮🏻 Police Officer: Light Skin Tone 👮🏼 Police Officer: Medium-Light Skin Tone 👮🏽 Police Officer: Medium Skin Tone 👮🏾 Police Officer: Medium-Dark Skin Tone 👮🏿 Police Officer: Dark Skin Tone 👮‍♂️ Man Police Officer 👮🏻‍♂️ Man Police Officer: Light Skin Tone 👮🏼‍♂️ Man Police Officer: Medium-Light Skin Tone 👮🏽‍♂️ Man Police Officer: Medium Skin Tone 👮🏾‍♂️ Man Police Officer: Medium-Dark Skin Tone 👮🏿‍♂️ Man Police Officer: Dark Skin Tone 👮‍♀️ Woman Police Officer 👮🏻‍♀️ Woman Police Officer: Light Skin Tone 👮🏼‍♀️ Woman Police Officer: Medium-Light Skin Tone 👮🏽‍♀️ Woman Police Officer: Medium Skin Tone 👮🏾‍♀️ Woman Police Officer: Medium-Dark Skin Tone 👮🏿‍♀️ Woman Police Officer: Dark Skin Tone 🕵 Detective 🕵🏻 Detective: Light Skin Tone 🕵🏼 Detective: Medium-Light Skin Tone 🕵🏽 Detective: Medium Skin Tone 🕵🏾 Detective: Medium-Dark Skin Tone 🕵🏿 Detective: Dark Skin Tone 🕵️‍♂️ Man Detective 🕵🏻‍♂️ Man Detective: Light Skin Tone 🕵🏼‍♂️ Man Detective: Medium-Light Skin Tone 🕵🏽‍♂️ Man Detective: Medium Skin Tone 🕵🏾‍♂️ Man Detective: Medium-Dark Skin Tone 🕵🏿‍♂️ Man Detective: Dark Skin Tone 🕵️‍♀️ Woman Detective 🕵🏻‍♀️ Woman Detective: Light Skin Tone 🕵🏼‍♀️ Woman Detective: Medium-Light Skin Tone 🕵🏽‍♀️ Woman Detective: Medium Skin Tone 🕵🏾‍♀️ Woman Detective: Medium-Dark Skin Tone 🕵🏿‍♀️ Woman Detective: Dark Skin Tone 💂 Guard 💂🏻 Guard: Light Skin Tone 💂🏼 Guard: Medium-Light Skin Tone 💂🏽 Guard: Medium Skin Tone 💂🏾 Guard: Medium-Dark Skin Tone 💂🏿 Guard: Dark Skin Tone 💂‍♂️ Man Guard 💂🏻‍♂️ Man Guard: Light Skin Tone 💂🏼‍♂️ Man Guard: Medium-Light Skin Tone 💂🏽‍♂️ Man Guard: Medium Skin Tone 💂🏾‍♂️ Man Guard: Medium-Dark Skin Tone 💂🏿‍♂️ Man Guard: Dark Skin Tone 💂‍♀️ Woman Guard 💂🏻‍♀️ Woman Guard: Light Skin Tone 💂🏼‍♀️ Woman Guard: Medium-Light Skin Tone 💂🏽‍♀️ Woman Guard: Medium Skin Tone 💂🏾‍♀️ Woman Guard: Medium-Dark Skin Tone 💂🏿‍♀️ Woman Guard: Dark Skin Tone 👷 Construction Worker 👷🏻 Construction Worker: Light Skin Tone 👷🏼 Construction Worker: Medium-Light Skin Tone 👷🏽 Construction Worker: Medium Skin Tone 👷🏾 Construction Worker: Medium-Dark Skin Tone 👷🏿 Construction Worker: Dark Skin Tone 👷‍♂️ Man Construction Worker 👷🏻‍♂️ Man Construction Worker: Light Skin Tone 👷🏼‍♂️ Man Construction Worker: Medium-Light Skin Tone 👷🏽‍♂️ Man Construction Worker: Medium Skin Tone 👷🏾‍♂️ Man Construction Worker: Medium-Dark Skin Tone 👷🏿‍♂️ Man Construction Worker: Dark Skin Tone 👷‍♀️ Woman Construction Worker 👷🏻‍♀️ Woman Construction Worker: Light Skin Tone 👷🏼‍♀️ Woman Construction Worker: Medium-Light Skin Tone 👷🏽‍♀️ Woman Construction Worker: Medium Skin Tone 👷🏾‍♀️ Woman Construction Worker: Medium-Dark Skin Tone 👷🏿‍♀️ Woman Construction Worker: Dark Skin Tone 🤴 Prince 🤴🏻 Prince: Light Skin Tone 🤴🏼 Prince: Medium-Light Skin Tone 🤴🏽 Prince: Medium Skin Tone 🤴🏾 Prince: Medium-Dark Skin Tone 🤴🏿 Prince: Dark Skin Tone 👸 Princess 👸🏻 Princess: Light Skin Tone 👸🏼 Princess: Medium-Light Skin Tone 👸🏽 Princess: Medium Skin Tone 👸🏾 Princess: Medium-Dark Skin Tone 👸🏿 Princess: Dark Skin Tone 👳 Person Wearing Turban 👳🏻 Person Wearing Turban: Light Skin Tone 👳🏼 Person Wearing Turban: Medium-Light Skin Tone 👳🏽 Person Wearing Turban: Medium Skin Tone 👳🏾 Person Wearing Turban: Medium-Dark Skin Tone 👳🏿 Person Wearing Turban: Dark Skin Tone 👳‍♂️ Man Wearing Turban 👳🏻‍♂️ Man Wearing Turban: Light Skin Tone 👳🏼‍♂️ Man Wearing Turban: Medium-Light Skin Tone 👳🏽‍♂️ Man Wearing Turban: Medium Skin Tone 👳🏾‍♂️ Man Wearing Turban: Medium-Dark Skin Tone 👳🏿‍♂️ Man Wearing Turban: Dark Skin Tone 👳‍♀️ Woman Wearing Turban 👳🏻‍♀️ Woman Wearing Turban: Light Skin Tone 👳🏼‍♀️ Woman Wearing Turban: Medium-Light Skin Tone 👳🏽‍♀️ Woman Wearing Turban: Medium Skin Tone 👳🏾‍♀️ Woman Wearing Turban: Medium-Dark Skin Tone 👳🏿‍♀️ Woman Wearing Turban: Dark Skin Tone 👲 Man With Chinese Cap 👲🏻 Man With Chinese Cap: Light Skin Tone 👲🏼 Man With Chinese Cap: Medium-Light Skin Tone 👲🏽 Man With Chinese Cap: Medium Skin Tone 👲🏾 Man With Chinese Cap: Medium-Dark Skin Tone 👲🏿 Man With Chinese Cap: Dark Skin Tone 🧕 Woman With Headscarf 🧕🏻 Person With Headscarf: Light Skin Tone 🧕🏼 Person With Headscarf: Medium-Light Skin Tone 🧕🏽 Person With Headscarf: Medium Skin Tone 🧕🏾 Person With Headscarf: Medium-Dark Skin Tone 🧕🏿 Person With Headscarf: Dark Skin Tone 🧔 Bearded Person 🧔🏻 Bearded Person: Light Skin Tone 🧔🏼 Bearded Person: Medium-Light Skin Tone 🧔🏽 Bearded Person: Medium Skin Tone 🧔🏾 Bearded Person: Medium-Dark Skin Tone 🧔🏿 Bearded Person: Dark Skin Tone 👱 Blond-Haired Person 👱🏻 Blond-Haired Person: Light Skin Tone 👱🏼 Blond-Haired Person: Medium-Light Skin Tone 👱🏽 Blond-Haired Person: Medium Skin Tone 👱🏾 Blond-Haired Person: Medium-Dark Skin Tone 👱🏿 Blond-Haired Person: Dark Skin Tone 👱‍♂️ Blond-Haired Man 👱🏻‍♂️ Blond-Haired Man: Light Skin Tone 👱🏼‍♂️ Blond-Haired Man: Medium-Light Skin Tone 👱🏽‍♂️ Blond-Haired Man: Medium Skin Tone 👱🏾‍♂️ Blond-Haired Man: Medium-Dark Skin Tone 👱🏿‍♂️ Blond-Haired Man: Dark Skin Tone 👱‍♀️ Blond-Haired Woman 👱🏻‍♀️ Blond-Haired Woman: Light Skin Tone 👱🏼‍♀️ Blond-Haired Woman: Medium-Light Skin Tone 👱🏽‍♀️ Blond-Haired Woman: Medium Skin Tone 👱🏾‍♀️ Blond-Haired Woman: Medium-Dark Skin Tone 👱🏿‍♀️ Blond-Haired Woman: Dark Skin Tone 🤵 Man in Tuxedo 🤵🏻 Man in Tuxedo: Light Skin Tone 🤵🏼 Man in Tuxedo: Medium-Light Skin Tone 🤵🏽 Man in Tuxedo: Medium Skin Tone 🤵🏾 Man in Tuxedo: Medium-Dark Skin Tone 🤵🏿 Man in Tuxedo: Dark Skin Tone 👰 Bride With Veil 👰🏻 Bride With Veil: Light Skin Tone 👰🏼 Bride With Veil: Medium-Light Skin Tone 👰🏽 Bride With Veil: Medium Skin Tone 👰🏾 Bride With Veil: Medium-Dark Skin Tone 👰🏿 Bride With Veil: Dark Skin Tone 🤰 Pregnant Woman 🤰🏻 Pregnant Woman: Light Skin Tone 🤰🏼 Pregnant Woman: Medium-Light Skin Tone 🤰🏽 Pregnant Woman: Medium Skin Tone 🤰🏾 Pregnant Woman: Medium-Dark Skin Tone 🤰🏿 Pregnant Woman: Dark Skin Tone 🤱 Breast-Feeding 🤱🏻 Breast-Feeding: Light Skin Tone 🤱🏼 Breast-Feeding: Medium-Light Skin Tone 🤱🏽 Breast-Feeding: Medium Skin Tone 🤱🏾 Breast-Feeding: Medium-Dark Skin Tone 🤱🏿 Breast-Feeding: Dark Skin Tone 👼 Baby Angel 👼🏻 Baby Angel: Light Skin Tone 👼🏼 Baby Angel: Medium-Light Skin Tone 👼🏽 Baby Angel: Medium Skin Tone 👼🏾 Baby Angel: Medium-Dark Skin Tone 👼🏿 Baby Angel: Dark Skin Tone 🎅 Santa Claus 🎅🏻 Santa Claus: Light Skin Tone 🎅🏼 Santa Claus: Medium-Light Skin Tone 🎅🏽 Santa Claus: Medium Skin Tone 🎅🏾 Santa Claus: Medium-Dark Skin Tone 🎅🏿 Santa Claus: Dark Skin Tone 🤶 Mrs. Claus 🤶🏻 Mrs. Claus: Light Skin Tone 🤶🏼 Mrs. Claus: Medium-Light Skin Tone 🤶🏽 Mrs. Claus: Medium Skin Tone 🤶🏾 Mrs. Claus: Medium-Dark Skin Tone 🤶🏿 Mrs. Claus: Dark Skin Tone 🧙 Mage 🧙🏻 Mage: Light Skin Tone 🧙🏼 Mage: Medium-Light Skin Tone 🧙🏽 Mage: Medium Skin Tone 🧙🏾 Mage: Medium-Dark Skin Tone 🧙🏿 Mage: Dark Skin Tone 🧙‍♀️ Woman Mage 🧙🏻‍♀️ Woman Mage: Light Skin Tone 🧙🏼‍♀️ Woman Mage: Medium-Light Skin Tone 🧙🏽‍♀️ Woman Mage: Medium Skin Tone 🧙🏾‍♀️ Woman Mage: Medium-Dark Skin Tone 🧙🏿‍♀️ Woman Mage: Dark Skin Tone 🧙‍♂️ Man Mage 🧙🏻‍♂️ Man Mage: Light Skin Tone 🧙🏼‍♂️ Man Mage: Medium-Light Skin Tone 🧙🏽‍♂️ Man Mage: Medium Skin Tone 🧙🏾‍♂️ Man Mage: Medium-Dark Skin Tone 🧙🏿‍♂️ Man Mage: Dark Skin Tone 🧚 Fairy 🧚🏻 Fairy: Light Skin Tone 🧚🏼 Fairy: Medium-Light Skin Tone 🧚🏽 Fairy: Medium Skin Tone 🧚🏾 Fairy: Medium-Dark Skin Tone 🧚🏿 Fairy: Dark Skin Tone 🧚‍♀️ Woman Fairy 🧚🏻‍♀️ Woman Fairy: Light Skin Tone 🧚🏼‍♀️ Woman Fairy: Medium-Light Skin Tone 🧚🏽‍♀️ Woman Fairy: Medium Skin Tone 🧚🏾‍♀️ Woman Fairy: Medium-Dark Skin Tone 🧚🏿‍♀️ Woman Fairy: Dark Skin Tone 🧚‍♂️ Man Fairy 🧚🏻‍♂️ Man Fairy: Light Skin Tone 🧚🏼‍♂️ Man Fairy: Medium-Light Skin Tone 🧚🏽‍♂️ Man Fairy: Medium Skin Tone 🧚🏾‍♂️ Man Fairy: Medium-Dark Skin Tone 🧚🏿‍♂️ Man Fairy: Dark Skin Tone 🧛 Vampire 🧛🏻 Vampire: Light Skin Tone 🧛🏼 Vampire: Medium-Light Skin Tone 🧛🏽 Vampire: Medium Skin Tone 🧛🏾 Vampire: Medium-Dark Skin Tone 🧛🏿 Vampire: Dark Skin Tone 🧛‍♀️ Woman Vampire 🧛🏻‍♀️ Woman Vampire: Light Skin Tone 🧛🏼‍♀️ Woman Vampire: Medium-Light Skin Tone 🧛🏽‍♀️ Woman Vampire: Medium Skin Tone 🧛🏾‍♀️ Woman Vampire: Medium-Dark Skin Tone 🧛🏿‍♀️ Woman Vampire: Dark Skin Tone 🧛‍♂️ Man Vampire 🧛🏻‍♂️ Man Vampire: Light Skin Tone 🧛🏼‍♂️ Man Vampire: Medium-Light Skin Tone 🧛🏽‍♂️ Man Vampire: Medium Skin Tone 🧛🏾‍♂️ Man Vampire: Medium-Dark Skin Tone 👯🏻 Woman With Bunny Ears, Type-1-2 👯🏼 Woman With Bunny Ears, Type-3 🧛🏿‍♂️ Man Vampire: Dark Skin Tone 👯🏽 Woman With Bunny Ears, Type-4 👯🏾 Woman With Bunny Ears, Type-5 🧜 Merperson 👯🏿 Woman With Bunny Ears, Type-6 🧜🏻 Merperson: Light Skin Tone 👯🏻‍♂️ Men With Bunny Ears Partying, Type-1-2 🧜🏼 Merperson: Medium-Light Skin Tone 👯🏼‍♂️ Men With Bunny Ears Partying, Type-3 🧜🏽 Merperson: Medium Skin Tone 👯🏽‍♂️ Men With Bunny Ears Partying, Type-4 🧜🏾 Merperson: Medium-Dark Skin Tone 👯🏾‍♂️ Men With Bunny Ears Partying, Type-5 🧜🏿 Merperson: Dark Skin Tone 👯🏿‍♂️ Men With Bunny Ears Partying, Type-6 🧜‍♀️ Mermaid 👯🏻‍♀️ Women With Bunny Ears Partying, Type-1-2 🧜🏻‍♀️ Mermaid: Light Skin Tone 👯🏼‍♀️ Women With Bunny Ears Partying, Type-3 🧜🏼‍♀️ Mermaid: Medium-Light Skin Tone 👯🏽‍♀️ Women With Bunny Ears Partying, Type-4 👯🏾‍♀️ Women With Bunny Ears Partying, Type-5 🧜🏽‍♀️ Mermaid: Medium Skin Tone 👯🏿‍♀️ Women With Bunny Ears Partying, Type-6 🧜🏾‍♀️ Mermaid: Medium-Dark Skin Tone 🧜🏿‍♀️ Mermaid: Dark Skin Tone 🧜‍♂️ Merman 🧜🏻‍♂️ Merman: Light Skin Tone 🧜🏼‍♂️ Merman: Medium-Light Skin Tone 👫🏻 Man and Woman Holding Hands, Type-1-2 🧜🏽‍♂️ Merman: Medium Skin Tone 👫🏼 Man and Woman Holding Hands, Type-3 👫🏽 Man and Woman Holding Hands, Type-4 🧜🏾‍♂️ Merman: Medium-Dark Skin Tone 👫🏾 Man and Woman Holding Hands, Type-5 👫🏿 Man and Woman Holding Hands, Type-6 🧜🏿‍♂️ Merman: Dark Skin Tone 👬🏻 Two Men Holding Hands, Type-1-2 🧝 Elf 👬🏼 Two Men Holding Hands, Type-3 👬🏽 Two Men Holding Hands, Type-4 🧝🏻 Elf: Light Skin Tone 👬🏾 Two Men Holding Hands, Type-5 🧝🏼 Elf: Medium-Light Skin Tone 👬🏿 Two Men Holding Hands, Type-6 🧝🏽 Elf: Medium Skin Tone 🧝🏾 Elf: Medium-Dark Skin Tone 👭🏻 Two Women Holding Hands, Type-1-2 🧝🏿 Elf: Dark Skin Tone 🧝‍♀️ Woman Elf 👭🏼 Two Women Holding Hands, Type-3 👭🏽 Two Women Holding Hands, Type-4 🧝🏻‍♀️ Woman Elf: Light Skin Tone 👭🏾 Two Women Holding Hands, Type-5 👭🏿 Two Women Holding Hands, Type-6 🧝🏼‍♀️ Woman Elf: Medium-Light Skin Tone 🧝🏽‍♀️ Woman Elf: Medium Skin Tone 🧝🏾‍♀️ Woman Elf: Medium-Dark Skin Tone 🧝🏿‍♀️ Woman Elf: Dark Skin Tone 🧝‍♂️ Man Elf 👪🏻 Family, Type-1-2 🧝🏻‍♂️ Man Elf: Light Skin Tone 👪🏼 Family, Type-3 👪🏽 Family, Type-4 🧝🏼‍♂️ Man Elf: Medium-Light Skin Tone 👪🏾 Family, Type-5 👪🏿 Family, Type-6 🧝🏽‍♂️ Man Elf: Medium Skin Tone 🧝🏾‍♂️ Man Elf: Medium-Dark Skin Tone 🧝🏿‍♂️ Man Elf: Dark Skin Tone 🧞 Genie 🧞‍♀️ Woman Genie 🧞‍♂️ Man Genie 🧟 Zombie 🧟‍♀️ Woman Zombie 🧟‍♂️ Man Zombie 🙍 Person Frowning 🙍🏻 Person Frowning: Light Skin Tone 🙍🏼 Person Frowning: Medium-Light Skin Tone 🙍🏽 Person Frowning: Medium Skin Tone 🙍🏾 Person Frowning: Medium-Dark Skin Tone 🙍🏿 Person Frowning: Dark Skin Tone 🙍‍♂️ Man Frowning 🙍🏻‍♂️ Man Frowning: Light Skin Tone 🏻 Light Skin Tone 🏼 Medium-Light Skin Tone 🙍🏼‍♂️ Man Frowning: Medium-Light Skin Tone 🏽 Medium Skin Tone 🙍🏽‍♂️ Man Frowning: Medium Skin Tone 🏾 Medium-Dark Skin Tone 🏿 Dark Skin Tone 🙍🏾‍♂️ Man Frowning: Medium-Dark Skin Tone 🙍🏿‍♂️ Man Frowning: Dark Skin Tone 🙍‍♀️ Woman Frowning 🙍🏻‍♀️ Woman Frowning: Light Skin Tone 🙍🏼‍♀️ Woman Frowning: Medium-Light Skin Tone 🙍🏽‍♀️ Woman Frowning: Medium Skin Tone 🙍🏾‍♀️ Woman Frowning: Medium-Dark Skin Tone 🙍🏿‍♀️ Woman Frowning: Dark Skin Tone 🙎 Person Pouting 🙎🏻 Person Pouting: Light Skin Tone 🙎🏼 Person Pouting: Medium-Light Skin Tone 🙎🏽 Person Pouting: Medium Skin Tone 🙎🏾 Person Pouting: Medium-Dark Skin Tone 🙎🏿 Person Pouting: Dark Skin Tone 🙎‍♂️ Man Pouting 🙎🏻‍♂️ Man Pouting: Light Skin Tone 🙎🏼‍♂️ Man Pouting: Medium-Light Skin Tone 🙎🏽‍♂️ Man Pouting: Medium Skin Tone 🙎🏾‍♂️ Man Pouting: Medium-Dark Skin Tone 🙎🏿‍♂️ Man Pouting: Dark Skin Tone 🙎‍♀️ Woman Pouting 🙎🏻‍♀️ Woman Pouting: Light Skin Tone 🙎🏼‍♀️ Woman Pouting: Medium-Light Skin Tone 🙎🏽‍♀️ Woman Pouting: Medium Skin Tone 🙎🏾‍♀️ Woman Pouting: Medium-Dark Skin Tone 🙎🏿‍♀️ Woman Pouting: Dark Skin Tone 🙅 Person Gesturing No 🙅🏻 Person Gesturing No: Light Skin Tone 🙅🏼 Person Gesturing No: Medium-Light Skin Tone 🙅🏽 Person Gesturing No: Medium Skin Tone 🙅🏾 Person Gesturing No: Medium-Dark Skin Tone 🙅🏿 Person Gesturing No: Dark Skin Tone 🙅‍♂️ Man Gesturing No 🙅🏻‍♂️ Man Gesturing No: Light Skin Tone 🙅🏼‍♂️ Man Gesturing No: Medium-Light Skin Tone 🙅🏽‍♂️ Man Gesturing No: Medium Skin Tone 🙅🏾‍♂️ Man Gesturing No: Medium-Dark Skin Tone 🙅🏿‍♂️ Man Gesturing No: Dark Skin Tone 🙅‍♀️ Woman Gesturing No 🙅🏻‍♀️ Woman Gesturing No: Light Skin Tone 🙅🏼‍♀️ Woman Gesturing No: Medium-Light Skin Tone 🙅🏽‍♀️ Woman Gesturing No: Medium Skin Tone 🙅🏾‍♀️ Woman Gesturing No: Medium-Dark Skin Tone 🙅🏿‍♀️ Woman Gesturing No: Dark Skin Tone 🙆 Person Gesturing OK 🙆🏻 Person Gesturing OK: Light Skin Tone 🙆🏼 Person Gesturing OK: Medium-Light Skin Tone 🙆🏽 Person Gesturing OK: Medium Skin Tone 🙆🏾 Person Gesturing OK: Medium-Dark Skin Tone 🙆🏿 Person Gesturing OK: Dark Skin Tone 🙆‍♂️ Man Gesturing OK 🙆🏻‍♂️ Man Gesturing OK: Light Skin Tone 🙆🏼‍♂️ Man Gesturing OK: Medium-Light Skin Tone 🙆🏽‍♂️ Man Gesturing OK: Medium Skin Tone 🙆🏾‍♂️ Man Gesturing OK: Medium-Dark Skin Tone 🙆🏿‍♂️ Man Gesturing OK: Dark Skin Tone 🙆‍♀️ Woman Gesturing OK 🙆🏻‍♀️ Woman Gesturing OK: Light Skin Tone 🙆🏼‍♀️ Woman Gesturing OK: Medium-Light Skin Tone 🙆🏽‍♀️ Woman Gesturing OK: Medium Skin Tone 🙆🏾‍♀️ Woman Gesturing OK: Medium-Dark Skin Tone 🙆🏿‍♀️ Woman Gesturing OK: Dark Skin Tone 💁 Person Tipping Hand 💁🏻 Person Tipping Hand: Light Skin Tone 💁🏼 Person Tipping Hand: Medium-Light Skin Tone 💁🏽 Person Tipping Hand: Medium Skin Tone 💁🏾 Person Tipping Hand: Medium-Dark Skin Tone 💁🏿 Person Tipping Hand: Dark Skin Tone 💁‍♂️ Man Tipping Hand 💁🏻‍♂️ Man Tipping Hand: Light Skin Tone 💁🏼‍♂️ Man Tipping Hand: Medium-Light Skin Tone 💁🏽‍♂️ Man Tipping Hand: Medium Skin Tone 💁🏾‍♂️ Man Tipping Hand: Medium-Dark Skin Tone 💁🏿‍♂️ Man Tipping Hand: Dark Skin Tone 💁‍♀️ Woman Tipping Hand 💁🏻‍♀️ Woman Tipping Hand: Light Skin Tone 💁🏼‍♀️ Woman Tipping Hand: Medium-Light Skin Tone 💁🏽‍♀️ Woman Tipping Hand: Medium Skin Tone 💁🏾‍♀️ Woman Tipping Hand: Medium-Dark Skin Tone 💁🏿‍♀️ Woman Tipping Hand: Dark Skin Tone 🙋 Person Raising Hand 🙋🏻 Person Raising Hand: Light Skin Tone 🙋🏼 Person Raising Hand: Medium-Light Skin Tone 🙋🏽 Person Raising Hand: Medium Skin Tone 🙋🏾 Person Raising Hand: Medium-Dark Skin Tone 🙋🏿 Person Raising Hand: Dark Skin Tone 🙋‍♂️ Man Raising Hand 🙋🏻‍♂️ Man Raising Hand: Light Skin Tone 🙋🏼‍♂️ Man Raising Hand: Medium-Light Skin Tone 🙋🏽‍♂️ Man Raising Hand: Medium Skin Tone 🙋🏾‍♂️ Man Raising Hand: Medium-Dark Skin Tone 🙋🏿‍♂️ Man Raising Hand: Dark Skin Tone 🙋‍♀️ Woman Raising Hand 🙋🏻‍♀️ Woman Raising Hand: Light Skin Tone 🙋🏼‍♀️ Woman Raising Hand: Medium-Light Skin Tone 🙋🏽‍♀️ Woman Raising Hand: Medium Skin Tone 🙋🏾‍♀️ Woman Raising Hand: Medium-Dark Skin Tone 🙋🏿‍♀️ Woman Raising Hand: Dark Skin Tone 🙇 Person Bowing 🙇🏻 Person Bowing: Light Skin Tone 🙇🏼 Person Bowing: Medium-Light Skin Tone 🙇🏽 Person Bowing: Medium Skin Tone 🙇🏾 Person Bowing: Medium-Dark Skin Tone 🙇🏿 Person Bowing: Dark Skin Tone 🙇‍♂️ Man Bowing 🙇🏻‍♂️ Man Bowing: Light Skin Tone 🤝🏻 Handshake, Type-1-2 🙇🏼‍♂️ Man Bowing: Medium-Light Skin Tone 🤝🏼 Handshake, Type-3 🤝🏽 Handshake, Type-4 🙇🏽‍♂️ Man Bowing: Medium Skin Tone 🤝🏾 Handshake, Type-5 🤝🏿 Handshake, Type-6 🙇🏾‍♂️ Man Bowing: Medium-Dark Skin Tone 🙇🏿‍♂️ Man Bowing: Dark Skin Tone 🙇‍♀️ Woman Bowing 🙇🏻‍♀️ Woman Bowing: Light Skin Tone 🙇🏼‍♀️ Woman Bowing: Medium-Light Skin Tone 🙇🏽‍♀️ Woman Bowing: Medium Skin Tone 🙇🏾‍♀️ Woman Bowing: Medium-Dark Skin Tone 🙇🏿‍♀️ Woman Bowing: Dark Skin Tone 🤦 Person Facepalming 🤦🏻 Person Facepalming: Light Skin Tone 🤦🏼 Person Facepalming: Medium-Light Skin Tone 🤦🏽 Person Facepalming: Medium Skin Tone 🤦🏾 Person Facepalming: Medium-Dark Skin Tone 🤦🏿 Person Facepalming: Dark Skin Tone 🤦‍♂️ Man Facepalming 🤦🏻‍♂️ Man Facepalming: Light Skin Tone 🤦🏼‍♂️ Man Facepalming: Medium-Light Skin Tone 🤦🏽‍♂️ Man Facepalming: Medium Skin Tone 🤦🏾‍♂️ Man Facepalming: Medium-Dark Skin Tone 🤦🏿‍♂️ Man Facepalming: Dark Skin Tone 🤦‍♀️ Woman Facepalming 🤦🏻‍♀️ Woman Facepalming: Light Skin Tone 🤦🏼‍♀️ Woman Facepalming: Medium-Light Skin Tone 🤦🏽‍♀️ Woman Facepalming: Medium Skin Tone 🤦🏾‍♀️ Woman Facepalming: Medium-Dark Skin Tone 🤦🏿‍♀️ Woman Facepalming: Dark Skin Tone 🤷 Person Shrugging 🤷🏻 Person Shrugging: Light Skin Tone 🤷🏼 Person Shrugging: Medium-Light Skin Tone 🤷🏽 Person Shrugging: Medium Skin Tone 🤷🏾 Person Shrugging: Medium-Dark Skin Tone 🤷🏿 Person Shrugging: Dark Skin Tone 🤷‍♂️ Man Shrugging 🤷🏻‍♂️ Man Shrugging: Light Skin Tone 🤷🏼‍♂️ Man Shrugging: Medium-Light Skin Tone 🤷🏽‍♂️ Man Shrugging: Medium Skin Tone 🤷🏾‍♂️ Man Shrugging: Medium-Dark Skin Tone 🤷🏿‍♂️ Man Shrugging: Dark Skin Tone 🤷‍♀️ Woman Shrugging 🤷🏻‍♀️ Woman Shrugging: Light Skin Tone 🤷🏼‍♀️ Woman Shrugging: Medium-Light Skin Tone 🤷🏽‍♀️ Woman Shrugging: Medium Skin Tone 🤷🏾‍♀️ Woman Shrugging: Medium-Dark Skin Tone 🤷🏿‍♀️ Woman Shrugging: Dark Skin Tone 💆 Person Getting Massage 💆🏻 Person Getting Massage: Light Skin Tone 💆🏼 Person Getting Massage: Medium-Light Skin Tone 💆🏽 Person Getting Massage: Medium Skin Tone 💆🏾 Person Getting Massage: Medium-Dark Skin Tone 💆🏿 Person Getting Massage: Dark Skin Tone 💆‍♂️ Man Getting Massage 💆🏻‍♂️ Man Getting Massage: Light Skin Tone 💆🏼‍♂️ Man Getting Massage: Medium-Light Skin Tone 💆🏽‍♂️ Man Getting Massage: Medium Skin Tone 💆🏾‍♂️ Man Getting Massage: Medium-Dark Skin Tone 💆🏿‍♂️ Man Getting Massage: Dark Skin Tone 💆‍♀️ Woman Getting Massage 💆🏻‍♀️ Woman Getting Massage: Light Skin Tone 💆🏼‍♀️ Woman Getting Massage: Medium-Light Skin Tone 💆🏽‍♀️ Woman Getting Massage: Medium Skin Tone 💆🏾‍♀️ Woman Getting Massage: Medium-Dark Skin Tone 💆🏿‍♀️ Woman Getting Massage: Dark Skin Tone 💇 Person Getting Haircut 💇🏻 Person Getting Haircut: Light Skin Tone 💇🏼 Person Getting Haircut: Medium-Light Skin Tone 💇🏽 Person Getting Haircut: Medium Skin Tone 💇🏾 Person Getting Haircut: Medium-Dark Skin Tone 💇🏿 Person Getting Haircut: Dark Skin Tone 💇‍♂️ Man Getting Haircut 💇🏻‍♂️ Man Getting Haircut: Light Skin Tone 💇🏼‍♂️ Man Getting Haircut: Medium-Light Skin Tone 💇🏽‍♂️ Man Getting Haircut: Medium Skin Tone 💇🏾‍♂️ Man Getting Haircut: Medium-Dark Skin Tone 💇🏿‍♂️ Man Getting Haircut: Dark Skin Tone 💇‍♀️ Woman Getting Haircut 💇🏻‍♀️ Woman Getting Haircut: Light Skin Tone 💇🏼‍♀️ Woman Getting Haircut: Medium-Light Skin Tone 💇🏽‍♀️ Woman Getting Haircut: Medium Skin Tone 💇🏾‍♀️ Woman Getting Haircut: Medium-Dark Skin Tone 💇🏿‍♀️ Woman Getting Haircut: Dark Skin Tone 🚶 Person Walking 🚶🏻 Person Walking: Light Skin Tone 🚶🏼 Person Walking: Medium-Light Skin Tone 🚶🏽 Person Walking: Medium Skin Tone 🚶🏾 Person Walking: Medium-Dark Skin Tone 🚶🏿 Person Walking: Dark Skin Tone 🚶‍♂️ Man Walking 🚶🏻‍♂️ Man Walking: Light Skin Tone 🚶🏼‍♂️ Man Walking: Medium-Light Skin Tone 🚶🏽‍♂️ Man Walking: Medium Skin Tone 🚶🏾‍♂️ Man Walking: Medium-Dark Skin Tone 🚶🏿‍♂️ Man Walking: Dark Skin Tone 🚶‍♀️ Woman Walking 🚶🏻‍♀️ Woman Walking: Light Skin Tone 🚶🏼‍♀️ Woman Walking: Medium-Light Skin Tone 🚶🏽‍♀️ Woman Walking: Medium Skin Tone 🚶🏾‍♀️ Woman Walking: Medium-Dark Skin Tone 🚶🏿‍♀️ Woman Walking: Dark Skin Tone 🏃 Person Running 🏃🏻 Person Running: Light Skin Tone 🏃🏼 Person Running: Medium-Light Skin Tone 🏃🏽 Person Running: Medium Skin Tone 🏃🏾 Person Running: Medium-Dark Skin Tone 🏃🏿 Person Running: Dark Skin Tone 🏃‍♂️ Man Running 🏃🏻‍♂️ Man Running: Light Skin Tone 🏃🏼‍♂️ Man Running: Medium-Light Skin Tone 🏃🏽‍♂️ Man Running: Medium Skin Tone 🏃🏾‍♂️ Man Running: Medium-Dark Skin Tone 🏃🏿‍♂️ Man Running: Dark Skin Tone 🏃‍♀️ Woman Running 🏃🏻‍♀️ Woman Running: Light Skin Tone 🏃🏼‍♀️ Woman Running: Medium-Light Skin Tone 🏃🏽‍♀️ Woman Running: Medium Skin Tone 🏃🏾‍♀️ Woman Running: Medium-Dark Skin Tone 🏃🏿‍♀️ Woman Running: Dark Skin Tone 💃 Woman Dancing 💃🏻 Woman Dancing: Light Skin Tone 💃🏼 Woman Dancing: Medium-Light Skin Tone 💃🏽 Woman Dancing: Medium Skin Tone 💃🏾 Woman Dancing: Medium-Dark Skin Tone 💃🏿 Woman Dancing: Dark Skin Tone 🕺 Man Dancing 🕺🏻 Man Dancing: Light Skin Tone 🕺🏼 Man Dancing: Medium-Light Skin Tone 🕺🏽 Man Dancing: Medium Skin Tone 🕺🏾 Man Dancing: Medium-Dark Skin Tone 🕺🏿 Man Dancing: Dark Skin Tone 👯 People With Bunny Ears Partying 👯‍♂️ Men With Bunny Ears Partying 👯‍♀️ Women With Bunny Ears Partying 🧖 Person in Steamy Room 🧖🏻 Person in Steamy Room: Light Skin Tone 🧖🏼 Person in Steamy Room: Medium-Light Skin Tone 🧖🏽 Person in Steamy Room: Medium Skin Tone 🧖🏾 Person in Steamy Room: Medium-Dark Skin Tone 🧖🏿 Person in Steamy Room: Dark Skin Tone 🧖‍♀️ Woman in Steamy Room 🧖🏻‍♀️ Woman in Steamy Room: Light Skin Tone 🧖🏼‍♀️ Woman in Steamy Room: Medium-Light Skin Tone 🧖🏽‍♀️ Woman in Steamy Room: Medium Skin Tone 🧖🏾‍♀️ Woman in Steamy Room: Medium-Dark Skin Tone 🧖🏿‍♀️ Woman in Steamy Room: Dark Skin Tone 🧖‍♂️ Man in Steamy Room 🧖🏻‍♂️ Man in Steamy Room: Light Skin Tone 🧖🏼‍♂️ Man in Steamy Room: Medium-Light Skin Tone 🧖🏽‍♂️ Man in Steamy Room: Medium Skin Tone 🧖🏾‍♂️ Man in Steamy Room: Medium-Dark Skin Tone 🧖🏿‍♂️ Man in Steamy Room: Dark Skin Tone 🧗 Person Climbing 🧗🏻 Person Climbing: Light Skin Tone 🧗🏼 Person Climbing: Medium-Light Skin Tone 🧗🏽 Person Climbing: Medium Skin Tone 🧗🏾 Person Climbing: Medium-Dark Skin Tone 🧗🏿 Person Climbing: Dark Skin Tone 🧗‍♀️ Woman Climbing 🧗🏻‍♀️ Woman Climbing: Light Skin Tone 🧗🏼‍♀️ Woman Climbing: Medium-Light Skin Tone 🧗🏽‍♀️ Woman Climbing: Medium Skin Tone 🧗🏾‍♀️ Woman Climbing: Medium-Dark Skin Tone 🧗🏿‍♀️ Woman Climbing: Dark Skin Tone 🧗‍♂️ Man Climbing 🧗🏻‍♂️ Man Climbing: Light Skin Tone 🧗🏼‍♂️ Man Climbing: Medium-Light Skin Tone 🧗🏽‍♂️ Man Climbing: Medium Skin Tone 🧗🏾‍♂️ Man Climbing: Medium-Dark Skin Tone 🧗🏿‍♂️ Man Climbing: Dark Skin Tone 🧘 Person in Lotus Position 🧘🏻 Person in Lotus Position: Light Skin Tone 🧘🏼 Person in Lotus Position: Medium-Light Skin Tone 🧘🏽 Person in Lotus Position: Medium Skin Tone 🧘🏾 Person in Lotus Position: Medium-Dark Skin Tone 🧘🏿 Person in Lotus Position: Dark Skin Tone 🧘‍♀️ Woman in Lotus Position 🧘🏻‍♀️ Woman in Lotus Position: Light Skin Tone 🧘🏼‍♀️ Woman in Lotus Position: Medium-Light Skin Tone 🧘🏽‍♀️ Woman in Lotus Position: Medium Skin Tone 🧘🏾‍♀️ Woman in Lotus Position: Medium-Dark Skin Tone 🧘🏿‍♀️ Woman in Lotus Position: Dark Skin Tone 🧘‍♂️ Man in Lotus Position 🧘🏻‍♂️ Man in Lotus Position: Light Skin Tone 🧘🏼‍♂️ Man in Lotus Position: Medium-Light Skin Tone 🧘🏽‍♂️ Man in Lotus Position: Medium Skin Tone 🧘🏾‍♂️ Man in Lotus Position: Medium-Dark Skin Tone 🧘🏿‍♂️ Man in Lotus Position: Dark Skin Tone 🛀 Person Taking Bath 🛀🏻 Person Taking Bath: Light Skin Tone 🛀🏼 Person Taking Bath: Medium-Light Skin Tone 🛀🏽 Person Taking Bath: Medium Skin Tone 🛀🏾 Person Taking Bath: Medium-Dark Skin Tone 🛀🏿 Person Taking Bath: Dark Skin Tone 🛌 Person in Bed 🛌🏻 Person in Bed: Light Skin Tone 🛌🏼 Person in Bed: Medium-Light Skin Tone 🛌🏽 Person in Bed: Medium Skin Tone 🛌🏾 Person in Bed: Medium-Dark Skin Tone 🛌🏿 Person in Bed: Dark Skin Tone 🕴 Man in Business Suit Levitating 🕴🏻 Man in Business Suit Levitating: Light Skin Tone 🕴🏼 Man in Business Suit Levitating: Medium-Light Skin Tone 🕴🏽 Man in Business Suit Levitating: Medium Skin Tone 🕴🏾 Man in Business Suit Levitating: Medium-Dark Skin Tone 🕴🏿 Man in Business Suit Levitating: Dark Skin Tone 🗣 Speaking Head 👤 Bust in Silhouette 👥 Busts in Silhouette 🤺 Person Fencing 🏇 Horse Racing 🏇🏻 Horse Racing: Light Skin Tone 🏇🏼 Horse Racing: Medium-Light Skin Tone 🏇🏽 Horse Racing: Medium Skin Tone 🏇🏾 Horse Racing: Medium-Dark Skin Tone 🏇🏿 Horse Racing: Dark Skin Tone ⛷ Skier 🏂 Snowboarder 🏂🏻 Snowboarder: Light Skin Tone 🏂🏼 Snowboarder: Medium-Light Skin Tone 🏂🏽 Snowboarder: Medium Skin Tone 🏂🏾 Snowboarder: Medium-Dark Skin Tone 🏂🏿 Snowboarder: Dark Skin Tone 🏌 Person Golfing 🏌🏻 Person Golfing: Light Skin Tone 🏌🏼 Person Golfing: Medium-Light Skin Tone 🏌🏽 Person Golfing: Medium Skin Tone 🏌🏾 Person Golfing: Medium-Dark Skin Tone 🏌🏿 Person Golfing: Dark Skin Tone 🏌️‍♂️ Man Golfing 🏌🏻‍♂️ Man Golfing: Light Skin Tone 🏌🏼‍♂️ Man Golfing: Medium-Light Skin Tone 🏌🏽‍♂️ Man Golfing: Medium Skin Tone 🏌🏾‍♂️ Man Golfing: Medium-Dark Skin Tone 🏌🏿‍♂️ Man Golfing: Dark Skin Tone 🏌️‍♀️ Woman Golfing 🏌🏻‍♀️ Woman Golfing: Light Skin Tone 🏌🏼‍♀️ Woman Golfing: Medium-Light Skin Tone 🏌🏽‍♀️ Woman Golfing: Medium Skin Tone 🏌🏾‍♀️ Woman Golfing: Medium-Dark Skin Tone 🏌🏿‍♀️ Woman Golfing: Dark Skin Tone 🏄 Person Surfing 🏄🏻 Person Surfing: Light Skin Tone 🏄🏼 Person Surfing: Medium-Light Skin Tone 🏄🏽 Person Surfing: Medium Skin Tone 🏄🏾 Person Surfing: Medium-Dark Skin Tone 🏄🏿 Person Surfing: Dark Skin Tone 🏄‍♂️ Man Surfing 🏄🏻‍♂️ Man Surfing: Light Skin Tone 🏄🏼‍♂️ Man Surfing: Medium-Light Skin Tone 🏄🏽‍♂️ Man Surfing: Medium Skin Tone 🏄🏾‍♂️ Man Surfing: Medium-Dark Skin Tone 🏄🏿‍♂️ Man Surfing: Dark Skin Tone 🏄‍♀️ Woman Surfing 🏄🏻‍♀️ Woman Surfing: Light Skin Tone 🏄🏼‍♀️ Woman Surfing: Medium-Light Skin Tone 🏄🏽‍♀️ Woman Surfing: Medium Skin Tone 🏄🏾‍♀️ Woman Surfing: Medium-Dark Skin Tone 🏄🏿‍♀️ Woman Surfing: Dark Skin Tone 🚣 Person Rowing Boat 🚣🏻 Person Rowing Boat: Light Skin Tone 🚣🏼 Person Rowing Boat: Medium-Light Skin Tone 🚣🏽 Person Rowing Boat: Medium Skin Tone 🚣🏾 Person Rowing Boat: Medium-Dark Skin Tone 🚣🏿 Person Rowing Boat: Dark Skin Tone 🚣‍♂️ Man Rowing Boat 🚣🏻‍♂️ Man Rowing Boat: Light Skin Tone 🚣🏼‍♂️ Man Rowing Boat: Medium-Light Skin Tone 🚣🏽‍♂️ Man Rowing Boat: Medium Skin Tone 🚣🏾‍♂️ Man Rowing Boat: Medium-Dark Skin Tone 🚣🏿‍♂️ Man Rowing Boat: Dark Skin Tone 🚣‍♀️ Woman Rowing Boat 🚣🏻‍♀️ Woman Rowing Boat: Light Skin Tone 🚣🏼‍♀️ Woman Rowing Boat: Medium-Light Skin Tone 🚣🏽‍♀️ Woman Rowing Boat: Medium Skin Tone 🚣🏾‍♀️ Woman Rowing Boat: Medium-Dark Skin Tone 🚣🏿‍♀️ Woman Rowing Boat: Dark Skin Tone 🏊 Person Swimming 🏊🏻 Person Swimming: Light Skin Tone 🏊🏼 Person Swimming: Medium-Light Skin Tone 🏊🏽 Person Swimming: Medium Skin Tone 🏊🏾 Person Swimming: Medium-Dark Skin Tone 🏊🏿 Person Swimming: Dark Skin Tone 🏊‍♂️ Man Swimming 🏊🏻‍♂️ Man Swimming: Light Skin Tone 🏊🏼‍♂️ Man Swimming: Medium-Light Skin Tone 🏊🏽‍♂️ Man Swimming: Medium Skin Tone 🏊🏾‍♂️ Man Swimming: Medium-Dark Skin Tone 🏊🏿‍♂️ Man Swimming: Dark Skin Tone 🏊‍♀️ Woman Swimming 🏊🏻‍♀️ Woman Swimming: Light Skin Tone 🏊🏼‍♀️ Woman Swimming: Medium-Light Skin Tone 🏊🏽‍♀️ Woman Swimming: Medium Skin Tone 🏊🏾‍♀️ Woman Swimming: Medium-Dark Skin Tone 🏊🏿‍♀️ Woman Swimming: Dark Skin Tone ⛹ Person Bouncing Ball ⛹🏻 Person Bouncing Ball: Light Skin Tone ⛹🏼 Person Bouncing Ball: Medium-Light Skin Tone ⛹🏽 Person Bouncing Ball: Medium Skin Tone ⛹🏾 Person Bouncing Ball: Medium-Dark Skin Tone ⛹🏿 Person Bouncing Ball: Dark Skin Tone ⛹️‍♂️ Man Bouncing Ball ⛹🏻‍♂️ Man Bouncing Ball: Light Skin Tone ⛹🏼‍♂️ Man Bouncing Ball: Medium-Light Skin Tone ⛹🏽‍♂️ Man Bouncing Ball: Medium Skin Tone ⛹🏾‍♂️ Man Bouncing Ball: Medium-Dark Skin Tone ⛹🏿‍♂️ Man Bouncing Ball: Dark Skin Tone ⛹️‍♀️ Woman Bouncing Ball ⛹🏻‍♀️ Woman Bouncing Ball: Light Skin Tone ⛹🏼‍♀️ Woman Bouncing Ball: Medium-Light Skin Tone ⛹🏽‍♀️ Woman Bouncing Ball: Medium Skin Tone ⛹🏾‍♀️ Woman Bouncing Ball: Medium-Dark Skin Tone ⛹🏿‍♀️ Woman Bouncing Ball: Dark Skin Tone 🏋 Person Lifting Weights 🏋🏻 Person Lifting Weights: Light Skin Tone 🏋🏼 Person Lifting Weights: Medium-Light Skin Tone 🏋🏽 Person Lifting Weights: Medium Skin Tone 🏋🏾 Person Lifting Weights: Medium-Dark Skin Tone 🏋🏿 Person Lifting Weights: Dark Skin Tone 🏋️‍♂️ Man Lifting Weights 🏋🏻‍♂️ Man Lifting Weights: Light Skin Tone 🏋🏼‍♂️ Man Lifting Weights: Medium-Light Skin Tone 🏋🏽‍♂️ Man Lifting Weights: Medium Skin Tone 🏋🏾‍♂️ Man Lifting Weights: Medium-Dark Skin Tone 🏋🏿‍♂️ Man Lifting Weights: Dark Skin Tone 🏋️‍♀️ Woman Lifting Weights 🏋🏻‍♀️ Woman Lifting Weights: Light Skin Tone 🏋🏼‍♀️ Woman Lifting Weights: Medium-Light Skin Tone 🏋🏽‍♀️ Woman Lifting Weights: Medium Skin Tone 🏋🏾‍♀️ Woman Lifting Weights: Medium-Dark Skin Tone 🏋🏿‍♀️ Woman Lifting Weights: Dark Skin Tone 🚴 Person Biking 🚴🏻 Person Biking: Light Skin Tone 🚴🏼 Person Biking: Medium-Light Skin Tone 🚴🏽 Person Biking: Medium Skin Tone 🚴🏾 Person Biking: Medium-Dark Skin Tone 🚴🏿 Person Biking: Dark Skin Tone 🚴‍♂️ Man Biking 🚴🏻‍♂️ Man Biking: Light Skin Tone 🚴🏼‍♂️ Man Biking: Medium-Light Skin Tone 🚴🏽‍♂️ Man Biking: Medium Skin Tone 🚴🏾‍♂️ Man Biking: Medium-Dark Skin Tone 🚴🏿‍♂️ Man Biking: Dark Skin Tone 🚴‍♀️ Woman Biking 🚴🏻‍♀️ Woman Biking: Light Skin Tone 🚴🏼‍♀️ Woman Biking: Medium-Light Skin Tone 🚴🏽‍♀️ Woman Biking: Medium Skin Tone 🚴🏾‍♀️ Woman Biking: Medium-Dark Skin Tone 🚴🏿‍♀️ Woman Biking: Dark Skin Tone 🚵 Person Mountain Biking 🚵🏻 Person Mountain Biking: Light Skin Tone 🚵🏼 Person Mountain Biking: Medium-Light Skin Tone 🚵🏽 Person Mountain Biking: Medium Skin Tone 🚵🏾 Person Mountain Biking: Medium-Dark Skin Tone 🚵🏿 Person Mountain Biking: Dark Skin Tone 🚵‍♂️ Man Mountain Biking 🚵🏻‍♂️ Man Mountain Biking: Light Skin Tone 🚵🏼‍♂️ Man Mountain Biking: Medium-Light Skin Tone 🚵🏽‍♂️ Man Mountain Biking: Medium Skin Tone 🚵🏾‍♂️ Man Mountain Biking: Medium-Dark Skin Tone 🚵🏿‍♂️ Man Mountain Biking: Dark Skin Tone 🚵‍♀️ Woman Mountain Biking 🚵🏻‍♀️ Woman Mountain Biking: Light Skin Tone 🚵🏼‍♀️ Woman Mountain Biking: Medium-Light Skin Tone 🚵🏽‍♀️ Woman Mountain Biking: Medium Skin Tone 🚵🏾‍♀️ Woman Mountain Biking: Medium-Dark Skin Tone 🚵🏿‍♀️ Woman Mountain Biking: Dark Skin Tone 🏎 Racing Car 🏍 Motorcycle 🤸 Person Cartwheeling 🤸🏻 Person Cartwheeling: Light Skin Tone 🤸🏼 Person Cartwheeling: Medium-Light Skin Tone 🤸🏽 Person Cartwheeling: Medium Skin Tone 🤸🏾 Person Cartwheeling: Medium-Dark Skin Tone 🤸🏿 Person Cartwheeling: Dark Skin Tone 🤸‍♂️ Man Cartwheeling 🤸🏻‍♂️ Man Cartwheeling: Light Skin Tone 🤸🏼‍♂️ Man Cartwheeling: Medium-Light Skin Tone 🤸🏽‍♂️ Man Cartwheeling: Medium Skin Tone 🤸🏾‍♂️ Man Cartwheeling: Medium-Dark Skin Tone 🤸🏿‍♂️ Man Cartwheeling: Dark Skin Tone 🤸‍♀️ Woman Cartwheeling 🤸🏻‍♀️ Woman Cartwheeling: Light Skin Tone 🤸🏼‍♀️ Woman Cartwheeling: Medium-Light Skin Tone 🤸🏽‍♀️ Woman Cartwheeling: Medium Skin Tone 🤸🏾‍♀️ Woman Cartwheeling: Medium-Dark Skin Tone 🤸🏿‍♀️ Woman Cartwheeling: Dark Skin Tone 🤼 People Wrestling 🤼‍♂️ Men Wrestling 🤼‍♀️ Women Wrestling 🤽 Person Playing Water Polo 🤽🏻 Person Playing Water Polo: Light Skin Tone 🤽🏼 Person Playing Water Polo: Medium-Light Skin Tone 🤽🏽 Person Playing Water Polo: Medium Skin Tone 🤽🏾 Person Playing Water Polo: Medium-Dark Skin Tone 🤽🏿 Person Playing Water Polo: Dark Skin Tone 🤽‍♂️ Man Playing Water Polo 🤽🏻‍♂️ Man Playing Water Polo: Light Skin Tone 🤽🏼‍♂️ Man Playing Water Polo: Medium-Light Skin Tone 🤽🏽‍♂️ Man Playing Water Polo: Medium Skin Tone 🤽🏾‍♂️ Man Playing Water Polo: Medium-Dark Skin Tone 🤽🏿‍♂️ Man Playing Water Polo: Dark Skin Tone 🤽‍♀️ Woman Playing Water Polo 🤽🏻‍♀️ Woman Playing Water Polo: Light Skin Tone 🤽🏼‍♀️ Woman Playing Water Polo: Medium-Light Skin Tone 🤽🏽‍♀️ Woman Playing Water Polo: Medium Skin Tone 🤽🏾‍♀️ Woman Playing Water Polo: Medium-Dark Skin Tone 🤽🏿‍♀️ Woman Playing Water Polo: Dark Skin Tone 🤾 Person Playing Handball 🤾🏻 Person Playing Handball: Light Skin Tone 🤾🏼 Person Playing Handball: Medium-Light Skin Tone 🤾🏽 Person Playing Handball: Medium Skin Tone 🤾🏾 Person Playing Handball: Medium-Dark Skin Tone 🤾🏿 Person Playing Handball: Dark Skin Tone 🤾‍♂️ Man Playing Handball 🤾🏻‍♂️ Man Playing Handball: Light Skin Tone 🤾🏼‍♂️ Man Playing Handball: Medium-Light Skin Tone 🤾🏽‍♂️ Man Playing Handball: Medium Skin Tone 🤾🏾‍♂️ Man Playing Handball: Medium-Dark Skin Tone 🤾🏿‍♂️ Man Playing Handball: Dark Skin Tone 🤾‍♀️ Woman Playing Handball 🤾🏻‍♀️ Woman Playing Handball: Light Skin Tone 🤾🏼‍♀️ Woman Playing Handball: Medium-Light Skin Tone 🤾🏽‍♀️ Woman Playing Handball: Medium Skin Tone 🤾🏾‍♀️ Woman Playing Handball: Medium-Dark Skin Tone 🤾🏿‍♀️ Woman Playing Handball: Dark Skin Tone 🤹 Person Juggling 🤹🏻 Person Juggling: Light Skin Tone 🤹🏼 Person Juggling: Medium-Light Skin Tone 🤹🏽 Person Juggling: Medium Skin Tone 🤹🏾 Person Juggling: Medium-Dark Skin Tone 🤹🏿 Person Juggling: Dark Skin Tone 🤹‍♂️ Man Juggling 🤹🏻‍♂️ Man Juggling: Light Skin Tone 🤹🏼‍♂️ Man Juggling: Medium-Light Skin Tone 🤹🏽‍♂️ Man Juggling: Medium Skin Tone 🤹🏾‍♂️ Man Juggling: Medium-Dark Skin Tone 🤹🏿‍♂️ Man Juggling: Dark Skin Tone 🤹‍♀️ Woman Juggling 🤹🏻‍♀️ Woman Juggling: Light Skin Tone 🤹🏼‍♀️ Woman Juggling: Medium-Light Skin Tone 🤹🏽‍♀️ Woman Juggling: Medium Skin Tone 🤹🏾‍♀️ Woman Juggling: Medium-Dark Skin Tone 🤹🏿‍♀️ Woman Juggling: Dark Skin Tone 🤼🏻 Wrestlers, Type-1-2 🤼🏼 Wrestlers, Type-3 👫 Man and Woman Holding Hands 🤼🏽 Wrestlers, Type-4 👬 Two Men Holding Hands 🤼🏾 Wrestlers, Type-5 👭 Two Women Holding Hands 🤼🏿 Wrestlers, Type-6 💏 Kiss 👩‍❤️‍💋‍👨 Kiss: Woman, Man 🤼🏻‍♂️ Men Wrestling, Type-1-2 🤼🏼‍♂️ Men Wrestling, Type-3 🤼🏽‍♂️ Men Wrestling, Type-4 👨‍❤️‍💋‍👨 Kiss: Man, Man 🤼🏾‍♂️ Men Wrestling, Type-5 🤼🏿‍♂️ Men Wrestling, Type-6 👩‍❤️‍💋‍👩 Kiss: Woman, Woman 🤼🏻‍♀️ Women Wrestling, Type-1-2 💑 Couple With Heart 🤼🏼‍♀️ Women Wrestling, Type-3 👩‍❤️‍👨 Couple With Heart: Woman, Man 🤼🏽‍♀️ Women Wrestling, Type-4 🤼🏾‍♀️ Women Wrestling, Type-5 👨‍❤️‍👨 Couple With Heart: Man, Man 🤼🏿‍♀️ Women Wrestling, Type-6 👩‍❤️‍👩 Couple With Heart: Woman, Woman 👪 Family 👨‍👩‍👦 Family: Man, Woman, Boy 👨‍👩‍👧 Family: Man, Woman, Girl 👨‍👩‍👧‍👦 Family: Man, Woman, Girl, Boy 👨‍👩‍👦‍👦 Family: Man, Woman, Boy, Boy 👨‍👩‍👧‍👧 Family: Man, Woman, Girl, Girl 👨‍👨‍👦 Family: Man, Man, Boy 👨‍👨‍👧 Family: Man, Man, Girl 👨‍👨‍👧‍👦 Family: Man, Man, Girl, Boy 👨‍👨‍👦‍👦 Family: Man, Man, Boy, Boy 👨‍👨‍👧‍👧 Family: Man, Man, Girl, Girl 👩‍👩‍👦 Family: Woman, Woman, Boy 👩‍👩‍👧 Family: Woman, Woman, Girl 👩‍👩‍👧‍👦 Family: Woman, Woman, Girl, Boy 👩‍👩‍👦‍👦 Family: Woman, Woman, Boy, Boy 👩‍👩‍👧‍👧 Family: Woman, Woman, Girl, Girl 👨‍👦 Family: Man, Boy 👨‍👦‍👦 Family: Man, Boy, Boy 👨‍👧 Family: Man, Girl 👨‍👧‍👦 Family: Man, Girl, Boy 👨‍👧‍👧 Family: Man, Girl, Girl 👩‍👦 Family: Woman, Boy 👩‍👦‍👦 Family: Woman, Boy, Boy 👩‍👧 Family: Woman, Girl 👩‍👧‍👦 Family: Woman, Girl, Boy 👩‍👧‍👧 Family: Woman, Girl, Girl 🤳 Selfie 🤳🏻 Selfie: Light Skin Tone 🤳🏼 Selfie: Medium-Light Skin Tone 🤳🏽 Selfie: Medium Skin Tone 🤳🏾 Selfie: Medium-Dark Skin Tone 🤳🏿 Selfie: Dark Skin Tone 💪 Flexed Biceps 💪🏻 Flexed Biceps: Light Skin Tone 💪🏼 Flexed Biceps: Medium-Light Skin Tone 💪🏽 Flexed Biceps: Medium Skin Tone 💪🏾 Flexed Biceps: Medium-Dark Skin Tone 💪🏿 Flexed Biceps: Dark Skin Tone 👈 Backhand Index Pointing Left 👈🏻 Backhand Index Pointing Left: Light Skin Tone 👈🏼 Backhand Index Pointing Left: Medium-Light Skin Tone 👈🏽 Backhand Index Pointing Left: Medium Skin Tone 👈🏾 Backhand Index Pointing Left: Medium-Dark Skin Tone 👈🏿 Backhand Index Pointing Left: Dark Skin Tone 👉 Backhand Index Pointing Right 👉🏻 Backhand Index Pointing Right: Light Skin Tone 👉🏼 Backhand Index Pointing Right: Medium-Light Skin Tone 👉🏽 Backhand Index Pointing Right: Medium Skin Tone 👉🏾 Backhand Index Pointing Right: Medium-Dark Skin Tone 👉🏿 Backhand Index Pointing Right: Dark Skin Tone ☝ Index Pointing Up ☝🏻 Index Pointing Up: Light Skin Tone ☝🏼 Index Pointing Up: Medium-Light Skin Tone ☝🏽 Index Pointing Up: Medium Skin Tone ☝🏾 Index Pointing Up: Medium-Dark Skin Tone ☝🏿 Index Pointing Up: Dark Skin Tone 👆 Backhand Index Pointing Up 👆🏻 Backhand Index Pointing Up: Light Skin Tone 👆🏼 Backhand Index Pointing Up: Medium-Light Skin Tone 👆🏽 Backhand Index Pointing Up: Medium Skin Tone 👆🏾 Backhand Index Pointing Up: Medium-Dark Skin Tone 👆🏿 Backhand Index Pointing Up: Dark Skin Tone 🖕 Middle Finger 🖕🏻 Middle Finger: Light Skin Tone 🖕🏼 Middle Finger: Medium-Light Skin Tone 🖕🏽 Middle Finger: Medium Skin Tone 🖕🏾 Middle Finger: Medium-Dark Skin Tone 🖕🏿 Middle Finger: Dark Skin Tone 👇 Backhand Index Pointing Down 👇🏻 Backhand Index Pointing Down: Light Skin Tone 👇🏼 Backhand Index Pointing Down: Medium-Light Skin Tone 👇🏽 Backhand Index Pointing Down: Medium Skin Tone 👇🏾 Backhand Index Pointing Down: Medium-Dark Skin Tone 👇🏿 Backhand Index Pointing Down: Dark Skin Tone ✌ Victory Hand ✌🏻 Victory Hand: Light Skin Tone ✌🏼 Victory Hand: Medium-Light Skin Tone ✌🏽 Victory Hand: Medium Skin Tone ✌🏾 Victory Hand: Medium-Dark Skin Tone ✌🏿 Victory Hand: Dark Skin Tone 🤞 Crossed Fingers 🤞🏻 Crossed Fingers: Light Skin Tone 🤞🏼 Crossed Fingers: Medium-Light Skin Tone 🤞🏽 Crossed Fingers: Medium Skin Tone 🤞🏾 Crossed Fingers: Medium-Dark Skin Tone 🤞🏿 Crossed Fingers: Dark Skin Tone 🖖 Vulcan Salute 🖖🏻 Vulcan Salute: Light Skin Tone 🖖🏼 Vulcan Salute: Medium-Light Skin Tone 🖖🏽 Vulcan Salute: Medium Skin Tone 🖖🏾 Vulcan Salute: Medium-Dark Skin Tone 🖖🏿 Vulcan Salute: Dark Skin Tone 🤘 Sign of the Horns 🤘🏻 Sign of the Horns: Light Skin Tone 🤘🏼 Sign of the Horns: Medium-Light Skin Tone 🤘🏽 Sign of the Horns: Medium Skin Tone 🤘🏾 Sign of the Horns: Medium-Dark Skin Tone 🤘🏿 Sign of the Horns: Dark Skin Tone 🤙 Call Me Hand 🤙🏻 Call Me Hand: Light Skin Tone 🤙🏼 Call Me Hand: Medium-Light Skin Tone 🤙🏽 Call Me Hand: Medium Skin Tone 🤙🏾 Call Me Hand: Medium-Dark Skin Tone 🤙🏿 Call Me Hand: Dark Skin Tone 🖐 Raised Hand With Fingers Splayed 🖐🏻 Raised Hand With Fingers Splayed: Light Skin Tone 🖐🏼 Raised Hand With Fingers Splayed: Medium-Light Skin Tone 🖐🏽 Raised Hand With Fingers Splayed: Medium Skin Tone 🖐🏾 Raised Hand With Fingers Splayed: Medium-Dark Skin Tone 🖐🏿 Raised Hand With Fingers Splayed: Dark Skin Tone ✋ Raised Hand ✋🏻 Raised Hand: Light Skin Tone ✋🏼 Raised Hand: Medium-Light Skin Tone ✋🏽 Raised Hand: Medium Skin Tone ✋🏾 Raised Hand: Medium-Dark Skin Tone ✋🏿 Raised Hand: Dark Skin Tone 👌 OK Hand 👌🏻 OK Hand: Light Skin Tone 👌🏼 OK Hand: Medium-Light Skin Tone 👌🏽 OK Hand: Medium Skin Tone 👌🏾 OK Hand: Medium-Dark Skin Tone 👌🏿 OK Hand: Dark Skin Tone 👍 Thumbs Up 👍🏻 Thumbs Up: Light Skin Tone 👍🏼 Thumbs Up: Medium-Light Skin Tone 👍🏽 Thumbs Up: Medium Skin Tone 👍🏾 Thumbs Up: Medium-Dark Skin Tone 👍🏿 Thumbs Up: Dark Skin Tone 👎 Thumbs Down 👎🏻 Thumbs Down: Light Skin Tone 👎🏼 Thumbs Down: Medium-Light Skin Tone 👎🏽 Thumbs Down: Medium Skin Tone 👎🏾 Thumbs Down: Medium-Dark Skin Tone 👎🏿 Thumbs Down: Dark Skin Tone ✊ Raised Fist ✊🏻 Raised Fist: Light Skin Tone ✊🏼 Raised Fist: Medium-Light Skin Tone ✊🏽 Raised Fist: Medium Skin Tone ✊🏾 Raised Fist: Medium-Dark Skin Tone ✊🏿 Raised Fist: Dark Skin Tone 👊 Oncoming Fist 👊🏻 Oncoming Fist: Light Skin Tone 👊🏼 Oncoming Fist: Medium-Light Skin Tone 👊🏽 Oncoming Fist: Medium Skin Tone 👊🏾 Oncoming Fist: Medium-Dark Skin Tone 👊🏿 Oncoming Fist: Dark Skin Tone 🤛 Left-Facing Fist 🤛🏻 Left-Facing Fist: Light Skin Tone 🤛🏼 Left-Facing Fist: Medium-Light Skin Tone 🤛🏽 Left-Facing Fist: Medium Skin Tone 🤛🏾 Left-Facing Fist: Medium-Dark Skin Tone 🤛🏿 Left-Facing Fist: Dark Skin Tone 🤜 Right-Facing Fist 🤜🏻 Right-Facing Fist: Light Skin Tone 🤜🏼 Right-Facing Fist: Medium-Light Skin Tone 🤜🏽 Right-Facing Fist: Medium Skin Tone 🤜🏾 Right-Facing Fist: Medium-Dark Skin Tone 🤜🏿 Right-Facing Fist: Dark Skin Tone 🤚 Raised Back of Hand 🤚🏻 Raised Back of Hand: Light Skin Tone 🤚🏼 Raised Back of Hand: Medium-Light Skin Tone 🤚🏽 Raised Back of Hand: Medium Skin Tone 🤚🏾 Raised Back of Hand: Medium-Dark Skin Tone 🤚🏿 Raised Back of Hand: Dark Skin Tone 👋 Waving Hand 👋🏻 Waving Hand: Light Skin Tone 👋🏼 Waving Hand: Medium-Light Skin Tone 👋🏽 Waving Hand: Medium Skin Tone 👋🏾 Waving Hand: Medium-Dark Skin Tone 👋🏿 Waving Hand: Dark Skin Tone 🤟 Love-You Gesture 🤟🏻 Love-You Gesture: Light Skin Tone 🤟🏼 Love-You Gesture: Medium-Light Skin Tone 🤟🏽 Love-You Gesture: Medium Skin Tone 🤟🏾 Love-You Gesture: Medium-Dark Skin Tone 🤟🏿 Love-You Gesture: Dark Skin Tone ✍ Writing Hand ✍🏻 Writing Hand: Light Skin Tone ✍🏼 Writing Hand: Medium-Light Skin Tone ✍🏽 Writing Hand: Medium Skin Tone ✍🏾 Writing Hand: Medium-Dark Skin Tone ✍🏿 Writing Hand: Dark Skin Tone 👏 Clapping Hands 👏🏻 Clapping Hands: Light Skin Tone 👏🏼 Clapping Hands: Medium-Light Skin Tone 👏🏽 Clapping Hands: Medium Skin Tone 👏🏾 Clapping Hands: Medium-Dark Skin Tone 👏🏿 Clapping Hands: Dark Skin Tone 👐 Open Hands 👐🏻 Open Hands: Light Skin Tone 👐🏼 Open Hands: Medium-Light Skin Tone 👐🏽 Open Hands: Medium Skin Tone 👐🏾 Open Hands: Medium-Dark Skin Tone 👐🏿 Open Hands: Dark Skin Tone 🙌 Raising Hands 🙌🏻 Raising Hands: Light Skin Tone 🙌🏼 Raising Hands: Medium-Light Skin Tone 🙌🏽 Raising Hands: Medium Skin Tone 🙌🏾 Raising Hands: Medium-Dark Skin Tone 🙌🏿 Raising Hands: Dark Skin Tone 🤲 Palms Up Together 🤲🏻 Palms Up Together: Light Skin Tone 🤲🏼 Palms Up Together: Medium-Light Skin Tone 🤲🏽 Palms Up Together: Medium Skin Tone 🤲🏾 Palms Up Together: Medium-Dark Skin Tone 🤲🏿 Palms Up Together: Dark Skin Tone 🙏 Folded Hands 🙏🏻 Folded Hands: Light Skin Tone 🙏🏼 Folded Hands: Medium-Light Skin Tone 🙏🏽 Folded Hands: Medium Skin Tone 🙏🏾 Folded Hands: Medium-Dark Skin Tone 🙏🏿 Folded Hands: Dark Skin Tone 🤝 Handshake 💅 Nail Polish 💅🏻 Nail Polish: Light Skin Tone 💅🏼 Nail Polish: Medium-Light Skin Tone 💅🏽 Nail Polish: Medium Skin Tone 💅🏾 Nail Polish: Medium-Dark Skin Tone 💅🏿 Nail Polish: Dark Skin Tone 👂 Ear 👂🏻 Ear: Light Skin Tone 👂🏼 Ear: Medium-Light Skin Tone 👂🏽 Ear: Medium Skin Tone 👂🏾 Ear: Medium-Dark Skin Tone 👂🏿 Ear: Dark Skin Tone 👃 Nose 👃🏻 Nose: Light Skin Tone 👃🏼 Nose: Medium-Light Skin Tone 👃🏽 Nose: Medium Skin Tone 👃🏾 Nose: Medium-Dark Skin Tone 👃🏿 Nose: Dark Skin Tone 👣 Footprints 👀 Eyes 👁 Eye 👁️‍🗨️ Eye in Speech Bubble 🧠 Brain 👅 Tongue 👄 Mouth 💋 Kiss Mark 💘 Heart With Arrow ❤ Red Heart 💓 Beating Heart 💔 Broken Heart 💕 Two Hearts 💖 Sparkling Heart 💗 Growing Heart 💙 Blue Heart 💚 Green Heart 💛 Yellow Heart 🧡 Orange Heart 💜 Purple Heart 🖤 Black Heart 💝 Heart With Ribbon 💞 Revolving Hearts 💟 Heart Decoration ❣ Heavy Heart Exclamation 💌 Love Letter 💤 Zzz 💢 Anger Symbol 💣 Bomb 💥 Collision 💦 Sweat Droplets 💨 Dashing Away 💫 Dizzy 💬 Speech Balloon 🗨 Left Speech Bubble 🗯 Right Anger Bubble 💭 Thought Balloon 🕳 Hole 👓 Glasses 🕶 Sunglasses 👔 Necktie 👕 T-Shirt 👖 Jeans 🧣 Scarf 🧤 Gloves 🧥 Coat 🧦 Socks 👗 Dress 👘 Kimono 👙 Bikini 👚 Woman’s Clothes 👛 Purse 👜 Handbag 👝 Clutch Bag 🛍 Shopping Bags 🎒 School Backpack 👞 Man’s Shoe 👟 Running Shoe 👠 High-Heeled Shoe 👡 Woman’s Sandal 👢 Woman’s Boot 👑 Crown 👒 Woman’s Hat 🎩 Top Hat 🎓 Graduation Cap 🧢 Billed Cap ⛑ Rescue Worker’s Helmet 📿 Prayer Beads 💄 Lipstick 💍 Ring 💎 Gem Stone 🐵 Monkey Face 🐒 Monkey 🦍 Gorilla 🐶 Dog Face 🐕 Dog 🐩 Poodle 🐺 Wolf Face 🦊 Fox Face 🐱 Cat Face 🐈 Cat 🦁 Lion Face 🐯 Tiger Face 🐅 Tiger 🐆 Leopard 🐴 Horse Face 🐎 Horse 🦄 Unicorn Face 🦓 Zebra 🦌 Deer 🐮 Cow Face 🐂 Ox 🐃 Water Buffalo 🐄 Cow 🐷 Pig Face 🐖 Pig 🐗 Boar 🐽 Pig Nose 🐏 Ram 🐑 Ewe 🐐 Goat 🐪 Camel 🐫 Two-Hump Camel 🦒 Giraffe 🐘 Elephant 🦏 Rhinoceros 🐭 Mouse Face 🐁 Mouse 🐀 Rat 🐹 Hamster Face 🐰 Rabbit Face 🐇 Rabbit 🐿 Chipmunk 🦔 Hedgehog 🦇 Bat 🐻 Bear Face 🐨 Koala 🐼 Panda Face 🐾 Paw Prints 🦃 Turkey 🐔 Chicken 🐓 Rooster 🐣 Hatching Chick 🐤 Baby Chick 🐥 Front-Facing Baby Chick 🐦 Bird 🐧 Penguin 🕊 Dove 🦅 Eagle 🦆 Duck 🦉 Owl 🐸 Frog Face 🐊 Crocodile 🐢 Turtle 🦎 Lizard 🐍 Snake 🐲 Dragon Face 🐉 Dragon 🦕 Sauropod 🦖 T-Rex 🐳 Spouting Whale 🐋 Whale 🐬 Dolphin 🐟 Fish 🐠 Tropical Fish 🐡 Blowfish 🦈 Shark 🐙 Octopus 🐚 Spiral Shell 🦀 Crab 🦐 Shrimp 🦑 Squid 🐌 Snail 🦋 Butterfly 🐛 Bug 🐜 Ant 🐝 Honeybee 🐞 Lady Beetle 🦗 Cricket 🕷 Spider 🕸 Spider Web 🦂 Scorpion 💐 Bouquet 🌸 Cherry Blossom 💮 White Flower 🏵 Rosette 🌹 Rose 🥀 Wilted Flower 🌺 Hibiscus 🌻 Sunflower 🌼 Blossom 🌷 Tulip 🌱 Seedling 🌲 Evergreen Tree 🌳 Deciduous Tree 🌴 Palm Tree 🌵 Cactus 🌾 Sheaf of Rice 🌿 Herb ☘ Shamrock 🍀 Four Leaf Clover 🍁 Maple Leaf 🍂 Fallen Leaf 🍃 Leaf Fluttering in Wind 🍇 Grapes 🍈 Melon 🍉 Watermelon 🍊 Tangerine 🍋 Lemon 🍌 Banana 🍍 Pineapple 🍎 Red Apple 🍏 Green Apple 🍐 Pear 🍑 Peach 🍒 Cherries 🍓 Strawberry 🥝 Kiwi Fruit 🍅 Tomato 🥥 Coconut 🥑 Avocado 🍆 Eggplant 🥔 Potato 🥕 Carrot 🌽 Ear of Corn 🌶 Hot Pepper 🥒 Cucumber 🥦 Broccoli 🍄 Mushroom 🥜 Peanuts 🌰 Chestnut 🍞 Bread 🥐 Croissant 🥖 Baguette Bread 🥨 Pretzel 🥞 Pancakes 🧀 Cheese Wedge 🍖 Meat on Bone 🍗 Poultry Leg 🥩 Cut of Meat 🥓 Bacon 🍔 Hamburger 🍟 French Fries 🍕 Pizza 🌭 Hot Dog 🥪 Sandwich 🌮 Taco 🌯 Burrito 🥙 Stuffed Flatbread 🥚 Egg 🍳 Cooking 🥘 Shallow Pan of Food 🍲 Pot of Food 🥣 Bowl With Spoon 🥗 Green Salad 🍿 Popcorn 🥫 Canned Food 🍱 Bento Box 🍘 Rice Cracker 🍙 Rice Ball 🍚 Cooked Rice 🍛 Curry Rice 🍜 Steaming Bowl 🍝 Spaghetti 🍠 Roasted Sweet Potato 🍢 Oden 🍣 Sushi 🍤 Fried Shrimp 🍥 Fish Cake With Swirl 🍡 Dango 🥟 Dumpling 🥠 Fortune Cookie 🥡 Takeout Box 🍦 Soft Ice Cream 🍧 Shaved Ice 🍨 Ice Cream 🍩 Doughnut 🍪 Cookie 🎂 Birthday Cake 🍰 Shortcake 🥧 Pie 🍫 Chocolate Bar 🍬 Candy 🍭 Lollipop 🍮 Custard 🍯 Honey Pot 🍼 Baby Bottle 🥛 Glass of Milk ☕ Hot Beverage 🍵 Teacup Without Handle 🍶 Sake 🍾 Bottle With Popping Cork 🍷 Wine Glass 🍸 Cocktail Glass 🍹 Tropical Drink 🍺 Beer Mug 🍻 Clinking Beer Mugs 🥂 Clinking Glasses 🥃 Tumbler Glass 🥤 Cup With Straw 🥢 Chopsticks 🍽 Fork and Knife With Plate 🍴 Fork and Knife 🥄 Spoon 🔪 Kitchen Knife 🏺 Amphora 🌍 Globe Showing Europe-Africa 🌎 Globe Showing Americas 🌏 Globe Showing Asia-Australia 🌐 Globe With Meridians 🗺 World Map 🗾 Map of Japan 🏔 Snow-Capped Mountain ⛰ Mountain 🌋 Volcano 🗻 Mount Fuji 🏕 Camping 🏖 Beach With Umbrella 🏜 Desert 🏝 Desert Island 🏞 National Park 🏟 Stadium 🏛 Classical Building 🏗 Building Construction 🏘 House 🏙 Cityscape 🏚 Derelict House 🏠 House 🏡 House With Garden 🏢 Office Building 🏣 Japanese Post Office 🏤 Post Office 🏥 Hospital 🏦 Bank 🏨 Hotel 🏩 Love Hotel 🏪 Convenience Store 🏫 School 🏬 Department Store 🏭 Factory 🏯 Japanese Castle 🏰 Castle 💒 Wedding 🗼 Tokyo Tower 🗽 Statue of Liberty ⛪ Church 🕌 Mosque 🕍 Synagogue ⛩ Shinto Shrine 🕋 Kaaba ⛲ Fountain ⛺ Tent 🌁 Foggy 🌃 Night With Stars 🌄 Sunrise Over Mountains 🌅 Sunrise 🌆 Cityscape at Dusk 🌇 Sunset 🌉 Bridge at Night ♨ Hot Springs 🌌 Milky Way 🎠 Carousel Horse 🎡 Ferris Wheel 🎢 Roller Coaster 💈 Barber Pole 🎪 Circus Tent 🎭 Performing Arts 🖼 Framed Picture 🎨 Artist Palette 🎰 Slot Machine 🚂 Locomotive 🚃 Railway Car 🚄 High-Speed Train 🚅 High-Speed Train With Bullet Nose 🚆 Train 🚇 Metro 🚈 Light Rail 🚉 Station 🚊 Tram 🚝 Monorail 🚞 Mountain Railway 🚋 Tram Car 🚌 Bus 🚍 Oncoming Bus 🚎 Trolleybus 🚐 Minibus 🚑 Ambulance 🚒 Fire Engine 🚓 Police Car 🚔 Oncoming Police Car 🚕 Taxi 🚖 Oncoming Taxi 🚗 Automobile 🚘 Oncoming Automobile 🚙 Sport Utility Vehicle 🚚 Delivery Truck 🚛 Articulated Lorry 🚜 Tractor 🚲 Bicycle 🛴 Kick Scooter 🛵 Motor Scooter 🚏 Bus Stop 🛣 Motorway 🛤 Railway Track ⛽ Fuel Pump 🚨 Police Car Light 🚥 Horizontal Traffic Light 🚦 Vertical Traffic Light 🚧 Construction 🛑 Stop Sign ⚓ Anchor ⛵ Sailboat 🛶 Canoe 🚤 Speedboat 🛳 Passenger Ship ⛴ Ferry 🛥 Motor Boat 🚢 Ship ✈ Airplane 🛩 Small Airplane 🛫 Airplane Departure 🛬 Airplane Arrival 💺 Seat 🚁 Helicopter 🚟 Suspension Railway 🚠 Mountain Cableway 🚡 Aerial Tramway 🛰 Satellite 🚀 Rocket 🛸 Flying Saucer 🛎 Bellhop Bell 🚪 Door 🛏 Bed 🛋 Couch and Lamp 🚽 Toilet 🚿 Shower 🛁 Bathtub ⌛ Hourglass ⏳ Hourglass With Flowing Sand ⌚ Watch ⏰ Alarm Clock ⏱ Stopwatch ⏲ Timer Clock 🕰 Mantelpiece Clock 🕛 Twelve O’clock 🕧 Twelve-Thirty 🕐 One O’clock 🕜 One-Thirty 🕑 Two O’clock 🕝 Two-Thirty 🕒 Three O’clock 🕞 Three-Thirty 🕓 Four O’clock 🕟 Four-Thirty 🕔 Five O’clock 🕠 Five-Thirty 🕕 Six O’clock 🕡 Six-Thirty 🕖 Seven O’clock 🕢 Seven-Thirty 🕗 Eight O’clock 🕣 Eight-Thirty 🕘 Nine O’clock 🕤 Nine-Thirty 🕙 Ten O’clock 🕥 Ten-Thirty 🕚 Eleven O’clock 🕦 Eleven-Thirty 🌑 New Moon 🌒 Waxing Crescent Moon 🌓 First Quarter Moon 🌔 Waxing Gibbous Moon 🌕 Full Moon 🌖 Waning Gibbous Moon 🌗 Last Quarter Moon 🌘 Waning Crescent Moon 🌙 Crescent Moon 🌚 New Moon Face 🌛 First Quarter Moon With Face 🌜 Last Quarter Moon With Face 🌡 Thermometer ☀ Sun 🌝 Full Moon With Face 🌞 Sun With Face ⭐ White Medium Star 🌟 Glowing Star 🌠 Shooting Star ☁ Cloud ⛅ Sun Behind Cloud ⛈ Cloud With Lightning and Rain 🌤 Sun Behind Small Cloud 🌥 Sun Behind Large Cloud 🌦 Sun Behind Rain Cloud 🌧 Cloud With Rain 🌨 Cloud With Snow 🌩 Cloud With Lightning 🌪 Tornado 🌫 Fog 🌬 Wind Face 🌀 Cyclone 🌈 Rainbow 🌂 Closed Umbrella ☂ Umbrella ☔ Umbrella With Rain Drops ⛱ Umbrella on Ground ⚡ High Voltage ❄ Snowflake ☃ Snowman ⛄ Snowman Without Snow ☄ Comet 🔥 Fire 💧 Droplet 🌊 Water Wave 🎃 Jack-O-Lantern 🎄 Christmas Tree 🎆 Fireworks 🎇 Sparkler ✨ Sparkles 🎈 Balloon 🎉 Party Popper 🎊 Confetti Ball 🎋 Tanabata Tree 🎍 Pine Decoration 🎎 Japanese Dolls 🎏 Carp Streamer 🎐 Wind Chime 🎑 Moon Viewing Ceremony 🎀 Ribbon 🎁 Wrapped Gift 🎗 Reminder Ribbon 🎟 Admission Tickets 🎫 Ticket 🎖 Military Medal 🏆 Trophy 🏅 Sports Medal 🥇 1st Place Medal 🥈 2nd Place Medal 🥉 3rd Place Medal ⚽ Soccer Ball ⚾ Baseball 🏀 Basketball 🏐 Volleyball 🏈 American Football 🏉 Rugby Football 🎾 Tennis 🎱 Pool 8 Ball 🎳 Bowling 🏏 Cricket 🏑 Field Hockey 🏒 Ice Hockey 🏓 Ping Pong 🏸 Badminton 🥊 Boxing Glove 🥋 Martial Arts Uniform 🥅 Goal Net 🎯 Direct Hit ⛳ Flag in Hole ⛸ Ice Skate 🎣 Fishing Pole 🎽 Running Shirt 🎿 Skis 🛷 Sled 🥌 Curling Stone 🎮 Video Game 🕹 Joystick 🎲 Game Die ♠ Spade Suit ♥ Heart Suit ♦ Diamond Suit ♣ Club Suit 🃏 Joker 🀄 Mahjong Red Dragon 🎴 Flower Playing Cards 🔇 Muted Speaker 🔈 Speaker Low Volume 🔉 Speaker Medium Volume 🔊 Speaker High Volume 📢 Loudspeaker 📣 Megaphone 📯 Postal Horn 🔔 Bell 🔕 Bell With Slash 🎼 Musical Score 🎵 Musical Note 🎶 Musical Notes 🎙 Studio Microphone 🎚 Level Slider 🎛 Control Knobs 🎤 Microphone 🎧 Headphone 📻 Radio 🎷 Saxophone 🎸 Guitar 🎹 Musical Keyboard 🎺 Trumpet 🎻 Violin 🥁 Drum 📱 Mobile Phone 📲 Mobile Phone With Arrow ☎ Telephone 📞 Telephone Receiver 📟 Pager 📠 Fax Machine 🔋 Battery 🔌 Electric Plug 💻 Laptop Computer 🖥 Desktop Computer 🖨 Printer ⌨ Keyboard 🖱 Computer Mouse 🖲 Trackball 💽 Computer Disk 💾 Floppy Disk 💿 Optical Disk 📀 DVD 🎥 Movie Camera 🎞 Film Frames 📽 Film Projector 🎬 Clapper Board 📺 Television 📷 Camera 📸 Camera With Flash 📹 Video Camera 📼 Videocassette 🔍 Left-Pointing Magnifying Glass 🔎 Right-Pointing Magnifying Glass 🔬 Microscope 🔭 Telescope 📡 Satellite Antenna 🕯 Candle 💡 Light Bulb 🔦 Flashlight 🏮 Red Paper Lantern 📔 Notebook With Decorative Cover 📕 Closed Book 📖 Open Book 📗 Green Book 📘 Blue Book 📙 Orange Book 📚 Books 📓 Notebook 📒 Ledger 📃 Page With Curl 📜 Scroll 📄 Page Facing Up 📰 Newspaper 🗞 Rolled-Up Newspaper 📑 Bookmark Tabs 🔖 Bookmark 🏷 Label 💰 Money Bag 💴 Yen Banknote 💵 Dollar Banknote 💶 Euro Banknote 💷 Pound Banknote 💸 Money With Wings 💳 Credit Card 💹 Chart Increasing With Yen 💱 Currency Exchange 💲 Heavy Dollar Sign ✉ Envelope 📧 E-Mail 📨 Incoming Envelope 📩 Envelope With Arrow 📤 Outbox Tray 📥 Inbox Tray 📦 Package 📫 Closed Mailbox With Raised Flag 📪 Closed Mailbox With Lowered Flag 📬 Open Mailbox With Raised Flag 📭 Open Mailbox With Lowered Flag 📮 Postbox 🗳 Ballot Box With Ballot ✏ Pencil ✒ Black Nib 🖋 Fountain Pen 🖊 Pen 🖌 Paintbrush 🖍 Crayon 📝 Memo 💼 Briefcase 📁 File Folder 📂 Open File Folder 🗂 Card Index Dividers 📅 Calendar 📆 Tear-Off Calendar 🗒 Spiral Notepad 🗓 Spiral Calendar 📇 Card Index 📈 Chart Increasing 📉 Chart Decreasing 📊 Bar Chart 📋 Clipboard 📌 Pushpin 📍 Round Pushpin 📎 Paperclip 🖇 Linked Paperclips 📏 Straight Ruler 📐 Triangular Ruler ✂ Scissors 🗃 Card File Box 🗄 File Cabinet 🗑 Wastebasket 🔒 Locked 🔓 Unlocked 🔏 Locked With Pen 🔐 Locked With Key 🔑 Key 🗝 Old Key 🔨 Hammer ⛏ Pick ⚒ Hammer and Pick 🛠 Hammer and Wrench 🗡 Dagger ⚔ Crossed Swords 🔫 Pistol 🏹 Bow and Arrow 🛡 Shield 🔧 Wrench 🔩 Nut and Bolt ⚙ Gear 🗜 Clamp ⚗ Alembic ⚖ Balance Scale 🔗 Link ⛓ Chains 💉 Syringe 💊 Pill 🚬 Cigarette ⚰ Coffin ⚱ Funeral Urn 🗿 Moai 🛢 Oil Drum 🔮 Crystal Ball 🛒 Shopping Cart 🏧 Atm Sign 🚮 Litter in Bin Sign 🚰 Potable Water ♿ Wheelchair Symbol 🚹 Men’s Room 🚺 Women’s Room 🚻 Restroom 🚼 Baby Symbol 🚾 Water Closet 🛂 Passport Control 🛃 Customs 🛄 Baggage Claim 🛅 Left Luggage ⚠ Warning 🚸 Children Crossing ⛔ No Entry 🚫 Prohibited 🚳 No Bicycles 🚭 No Smoking 🚯 No Littering 🚱 Non-Potable Water 🚷 No Pedestrians 📵 No Mobile Phones 🔞 No One Under Eighteen ☢ Radioactive ☣ Biohazard ⬆ Up Arrow ↗ Up-Right Arrow ➡ Right Arrow ↘ Down-Right Arrow ⬇ Down Arrow ↙ Down-Left Arrow ⬅ Left Arrow ↖ Up-Left Arrow ↕ Up-Down Arrow ↔ Left-Right Arrow ↩ Right Arrow Curving Left ↪ Left Arrow Curving Right ⤴ Right Arrow Curving Up ⤵ Right Arrow Curving Down 🔃 Clockwise Vertical Arrows 🔄 Anticlockwise Arrows Button 🔙 Back Arrow 🔚 End Arrow 🔛 On! Arrow 🔜 Soon Arrow 🔝 Top Arrow 🛐 Place of Worship ⚛ Atom Symbol 🕉 Om ✡ Star of David ☸ Wheel of Dharma ☯ Yin Yang ✝ Latin Cross ☦ Orthodox Cross ☪ Star and Crescent ☮ Peace Symbol 🕎 Menorah 🔯 Dotted Six-Pointed Star ♈ Aries ♉ Taurus ♊ Gemini ♋ Cancer ♌ Leo ♍ Virgo ♎ Libra ♏ Scorpius ♐ Sagittarius ♑ Capricorn ♒ Aquarius ♓ Pisces ⛎ Ophiuchus 🔀 Shuffle Tracks Button 🔁 Repeat Button 🔂 Repeat Single Button ▶ Play Button ⏩ Fast-Forward Button ⏭ Next Track Button ⏯ Play or Pause Button ◀ Reverse Button ⏪ Fast Reverse Button ⏮ Last Track Button 🔼 Up Button ⏫ Fast Up Button 🔽 Down Button ⏬ Fast Down Button ⏸ Pause Button ⏹ Stop Button ⏺ Record Button ⏏ Eject Button 🎦 Cinema 🔅 Dim Button 🔆 Bright Button 📶 Antenna Bars 📳 Vibration Mode 📴 Mobile Phone Off ♀ Female Sign ♂ Male Sign ⚕ Medical Symbol ♻ Recycling Symbol ⚜ Fleur-De-Lis 🔱 Trident Emblem 📛 Name Badge 🔰 Japanese Symbol for Beginner ⭕ Heavy Large Circle ✅ White Heavy Check Mark ☑ Ballot Box With Check ✔ Heavy Check Mark ✖ Heavy Multiplication X ❌ Cross Mark ❎ Cross Mark Button ➕ Heavy Plus Sign ➖ Heavy Minus Sign ➗ Heavy Division Sign ➰ Curly Loop ➿ Double Curly Loop 〽 Part Alternation Mark ✳ Eight-Spoked Asterisk ✴ Eight-Pointed Star ❇ Sparkle ‼ Double Exclamation Mark ⁉ Exclamation Question Mark ❓ Question Mark ❔ White Question Mark ❕ White Exclamation Mark ❗ Exclamation Mark 〰 Wavy Dash © Copyright ® Registered ™ Trade Mark #️⃣ Keycap Number Sign *️⃣ Keycap Asterisk 0️⃣ Keycap Digit Zero 1️⃣ Keycap Digit One 2️⃣ Keycap Digit Two 3️⃣ Keycap Digit Three 4️⃣ Keycap Digit Four 5️⃣ Keycap Digit Five 6️⃣ Keycap Digit Six 7️⃣ Keycap Digit Seven 8️⃣ Keycap Digit Eight 9️⃣ Keycap Digit Nine 🔟 Keycap 10 💯 Hundred Points 🔠 Input Latin Uppercase 🔡 Input Latin Lowercase 🔢 Input Numbers 🔣 Input Symbols 🔤 Input Latin Letters 🅰 A Button (blood Type) 🆎 Ab Button (blood Type) 🅱 B Button (blood Type) 🆑 CL Button 🆒 Cool Button 🆓 Free Button ℹ Information 🆔 ID Button Ⓜ Circled M 🆕 New Button 🆖 NG Button 🅾 O Button (blood Type) 🆗 OK Button 🅿 P Button 🆘 SOS Button 🆙 Up! Button 🆚 Vs Button 🈁 Japanese “here” Button 🈂 Japanese “service Charge” Button 🈷 Japanese “monthly Amount” Button 🈶 Japanese “not Free of Charge” Button 🈯 Japanese “reserved” Button 🉐 Japanese “bargain” Button 🈹 Japanese “discount” Button 🈚 Japanese “free of Charge” Button 🈲 Japanese “prohibited” Button 🉑 Japanese “acceptable” Button 🈸 Japanese “application” Button 🈴 Japanese “passing Grade” Button 🈳 Japanese “vacancy” Button ㊗ Japanese “congratulations” Button ㊙ Japanese “secret” Button 🈺 Japanese “open for Business” Button 🈵 Japanese “no Vacancy” Button ▪ Black Small Square ▫ White Small Square ◻ White Medium Square ◼ Black Medium Square ◽ White Medium-Small Square ◾ Black Medium-Small Square ⬛ Black Large Square ⬜ White Large Square 🔶 Large Orange Diamond 🔷 Large Blue Diamond 🔸 Small Orange Diamond 🔹 Small Blue Diamond 🔺 Red Triangle Pointed Up 🔻 Red Triangle Pointed Down 💠 Diamond With a Dot 🔘 Radio Button 🔲 Black Square Button 🔳 White Square Button ⚪ White Circle ⚫ Black Circle 🔴 Red Circle 🔵 Blue Circle 🏁 Chequered Flag 🚩 Triangular Flag 🎌 Crossed Flags 🏴 Black Flag 🏳 White Flag 🏳️‍🌈 Rainbow Flag 🇦🇨 Ascension Island 🇦🇩 Andorra 🇦🇪 United Arab Emirates 🇦🇫 Afghanistan 🇦🇬 Antigua & Barbuda 🇦🇮 Anguilla 🇦🇱 Albania 🇦🇲 Armenia 🇦🇴 Angola 🇦🇶 Antarctica 🇦🇷 Argentina 🇦🇸 American Samoa 🇦🇹 Austria 🇦🇺 Australia 🇦🇼 Aruba 🇦🇽 Åland Islands 🇦🇿 Azerbaijan 🇧🇦 Bosnia & Herzegovina 🇧🇧 Barbados 🇧🇩 Bangladesh 🇧🇪 Belgium 🇧🇫 Burkina Faso 🇧🇬 Bulgaria 🇧🇭 Bahrain 🇧🇮 Burundi 🇧🇯 Benin 🇧🇱 St. Barthélemy 🇧🇲 Bermuda 🇧🇳 Brunei 🇧🇴 Bolivia 🇧🇶 Caribbean Netherlands 🇧🇷 Brazil 🇧🇸 Bahamas 🇧🇹 Bhutan 🇧🇻 Bouvet Island 🇧🇼 Botswana 🇧🇾 Belarus 🇧🇿 Belize 🇨🇦 Canada 🇨🇨 Cocos (Keeling) Islands 🇨🇩 Congo - Kinshasa 🇨🇫 Central African Republic 🇨🇬 Congo - Brazzaville 🇨🇭 Switzerland 🇨🇮 Côte D’Ivoire 🇨🇰 Cook Islands 🇨🇱 Chile 🇨🇲 Cameroon 🇨🇳 China 🇨🇴 Colombia 🇨🇵 Clipperton Island 🇨🇷 Costa Rica 🇨🇺 Cuba 🇨🇻 Cape Verde 🇨🇼 Curaçao 🇨🇽 Christmas Island 🇨🇾 Cyprus 🇨🇿 Czechia 🇩🇪 Germany 🇩🇬 Diego Garcia 🇩🇯 Djibouti 🇩🇰 Denmark 🇩🇲 Dominica 🇩🇴 Dominican Republic 🇩🇿 Algeria 🇪🇦 Ceuta & Melilla 🇪🇨 Ecuador 🇪🇪 Estonia 🇪🇬 Egypt 🇪🇭 Western Sahara 🇪🇷 Eritrea 🇪🇸 Spain 🇪🇹 Ethiopia 🇪🇺 European Union 🇫🇮 Finland 🇫🇯 Fiji 🇫🇰 Falkland Islands 🇫🇲 Micronesia 🇫🇴 Faroe Islands 🇫🇷 France 🇬🇦 Gabon 🇬🇧 United Kingdom 🇬🇩 Grenada 🇬🇪 Georgia 🇬🇫 French Guiana 🇬🇬 Guernsey 🇬🇭 Ghana 🇬🇮 Gibraltar 🇬🇱 Greenland 🇬🇲 Gambia 🇬🇳 Guinea 🇬🇵 Guadeloupe 🇬🇶 Equatorial Guinea 🇬🇷 Greece 🇬🇸 South Georgia & South Sandwich Islands 🇬🇹 Guatemala 🇬🇺 Guam 🇬🇼 Guinea-Bissau 🇬🇾 Guyana 🇭🇰 Hong Kong Sar China 🇭🇲 Heard & Mcdonald Islands 🇭🇳 Honduras 🇭🇷 Croatia 🇭🇹 Haiti 🇭🇺 Hungary 🇮🇨 Canary Islands 🇮🇩 Indonesia 🇮🇪 Ireland 🇮🇱 Israel 🇮🇲 Isle of Man 🇮🇳 India 🇮🇴 British Indian Ocean Territory 🇮🇶 Iraq 🇮🇷 Iran 🇮🇸 Iceland 🇮🇹 Italy 🇯🇪 Jersey 🇯🇲 Jamaica 🇯🇴 Jordan 🇯🇵 Japan 🇰🇪 Kenya 🇰🇬 Kyrgyzstan 🇰🇭 Cambodia 🇰🇮 Kiribati 🇰🇲 Comoros 🇰🇳 St. Kitts & Nevis 🇰🇵 North Korea 🇰🇷 South Korea 🇰🇼 Kuwait 🇰🇾 Cayman Islands 🇰🇿 Kazakhstan 🇱🇦 Laos 🇱🇧 Lebanon 🇱🇨 St. Lucia 🇱🇮 Liechtenstein 🇱🇰 Sri Lanka 🇱🇷 Liberia 🇱🇸 Lesotho 🇱🇹 Lithuania 🇱🇺 Luxembourg 🇱🇻 Latvia 🇱🇾 Libya 🇲🇦 Morocco 🇲🇨 Monaco 🇲🇩 Moldova 🇲🇪 Montenegro 🇲🇫 St. Martin 🇲🇬 Madagascar 🇲🇭 Marshall Islands 🇲🇰 Macedonia 🇲🇱 Mali 🇲🇲 Myanmar (Burma) 🇲🇳 Mongolia 🇲🇴 Macau Sar China 🇲🇵 Northern Mariana Islands 🇲🇶 Martinique 🇲🇷 Mauritania 🇲🇸 Montserrat 🇲🇹 Malta 🇲🇺 Mauritius 🇲🇻 Maldives 🇲🇼 Malawi 🇲🇽 Mexico 🇲🇾 Malaysia 🇲🇿 Mozambique 🇳🇦 Namibia 🇳🇨 New Caledonia 🇳🇪 Niger 🇳🇫 Norfolk Island 🇳🇬 Nigeria 🇳🇮 Nicaragua 🇳🇱 Netherlands 🇳🇴 Norway 🇳🇵 Nepal 🇳🇷 Nauru 🇳🇺 Niue 🇳🇿 New Zealand 🇴🇲 Oman 🇵🇦 Panama 🇵🇪 Peru 🇵🇫 French Polynesia 🇵🇬 Papua New Guinea 🇵🇭 Philippines 🇵🇰 Pakistan 🇵🇱 Poland 🇵🇲 St. Pierre & Miquelon 🇵🇳 Pitcairn Islands 🇵🇷 Puerto Rico 🇵🇸 Palestinian Territories 🇵🇹 Portugal 🇵🇼 Palau 🇵🇾 Paraguay 🇶🇦 Qatar 🇷🇪 Réunion 🇷🇴 Romania 🇷🇸 Serbia 🇷🇺 Russia 🇷🇼 Rwanda 🇸🇦 Saudi Arabia 🇸🇧 Solomon Islands 🇸🇨 Seychelles 🇸🇩 Sudan 🇸🇪 Sweden 🇸🇬 Singapore 🇸🇭 St. Helena 🇸🇮 Slovenia 🇸🇯 Svalbard & Jan Mayen 🇸🇰 Slovakia 🇸🇱 Sierra Leone 🇸🇲 San Marino 🇸🇳 Senegal 🇸🇴 Somalia 🇸🇷 Suriname 🇸🇸 South Sudan 🇸🇹 São Tomé & Príncipe 🇸🇻 El Salvador 🇸🇽 Sint Maarten 🇸🇾 Syria 🇸🇿 Swaziland 🇹🇦 Tristan Da Cunha 🇹🇨 Turks & Caicos Islands 🇹🇩 Chad 🇹🇫 French Southern Territories 🇹🇬 Togo 🇹🇭 Thailand 🇹🇯 Tajikistan 🇹🇰 Tokelau 🇹🇱 Timor-Leste 🇹🇲 Turkmenistan 🇹🇳 Tunisia 🇹🇴 Tonga 🇹🇷 Turkey 🇹🇹 Trinidad & Tobago 🇹🇻 Tuvalu 🇹🇼 Taiwan 🇹🇿 Tanzania 🇺🇦 Ukraine 🇺🇬 Uganda 🇺🇲 U.S. Outlying Islands 🇺🇳 United Nations 🇺🇸 United States 🇺🇾 Uruguay 🇺🇿 Uzbekistan 🇻🇦 Vatican City 🇻🇨 St. Vincent & Grenadines 🇻🇪 Venezuela 🇻🇬 British Virgin Islands 🇻🇮 U.S. Virgin Islands 🇻🇳 Vietnam 🇻🇺 Vanuatu 🇼🇫 Wallis & Futuna 🇼🇸 Samoa 🇽🇰 Kosovo 🇾🇪 Yemen 🇾🇹 Mayotte 🇿🇦 South Africa 🇿🇲 Zambia 🇿🇼 Zimbabwe 🏴󠁧󠁢󠁥󠁮󠁧󠁿 Flag for England (GB-ENG) 🏴󠁧󠁢󠁳󠁣󠁴󠁿 Flag for Scotland (GB-SCT) 🏴󠁧󠁢󠁷󠁬󠁳󠁿 Flag for Wales (GB-WLS) 🥆 Rifle 🤻 Modern Pentathlon 🏴‍☠️ Pirate Flag 🇦 Regional Indicator Symbol Letter A 🇧 Regional Indicator Symbol Letter B 🇨 Regional Indicator Symbol Letter C 🇩 Regional Indicator Symbol Letter D 🇪 Regional Indicator Symbol Letter E 🇫 Regional Indicator Symbol Letter F 🇬 Regional Indicator Symbol Letter G 🇭 Regional Indicator Symbol Letter H 🇮 Regional Indicator Symbol Letter I 🇯 Regional Indicator Symbol Letter J 🇰 Regional Indicator Symbol Letter K 🇱 Regional Indicator Symbol Letter L 🇲 Regional Indicator Symbol Letter M 🇳 Regional Indicator Symbol Letter N 🇴 Regional Indicator Symbol Letter O 🇵 Regional Indicator Symbol Letter P 🇶 Regional Indicator Symbol Letter Q 🇷 Regional Indicator Symbol Letter R 🇸 Regional Indicator Symbol Letter S 🇹 Regional Indicator Symbol Letter T 🇺 Regional Indicator Symbol Letter U 🇻 Regional Indicator Symbol Letter V 🇼 Regional Indicator Symbol Letter W 🇽 Regional Indicator Symbol Letter X 🇾 Regional Indicator Symbol Letter Y 🇿 Regional Indicator Symbol Letter Z 🐱‍🐉 Dino Cat 🐱‍🚀 Astro Cat 🐱‍👤 Ninja Cat 🐱‍💻 Hacker Cat 🐱‍🏍 Stunt Cat 🐱‍👓 Hipster Cat ◯‍◯‍◯‍◯‍◯ Olympic Rings 🏴󠁮󠁲󠀰󠀵󠁿 Flag for Baiti (NR-05) 🏴󠁮󠁯󠀱󠀷󠁿 Flag for Nord-Trøndelag (NO-17) 🏴󠁮󠁯󠀱󠀲󠁿 Flag for Hordaland (NO-12) 🏴󠁮󠁯󠀰󠀲󠁿 Flag for Akershus (NO-02) 🏴󠁮󠁯󠀱󠀶󠁿 Flag for Sør-Trøndelag (NO-16) 🏴󠁮󠁯󠀰󠀸󠁿 Flag for Telemark (NO-08) 🏴󠁮󠁬󠁵󠁴󠁿 Flag for Utrecht (NL-UT) 🏴󠁮󠁯󠀱󠀵󠁿 Flag for Møre og Romsdal (NO-15) 🏴󠁮󠁯󠀲󠀱󠁿 Flag for Svalbard (NO-21) 🏴󠁮󠁰󠀴󠁿 Flag for Purwanchal (NP-4) 🏴󠁮󠁰󠀱󠁿 Flag for Central (NP-1) 🏴󠁮󠁯󠀰󠀳󠁿 Flag for Oslo (NO-03) 🏴󠁮󠁲󠀰󠀶󠁿 Flag for Boe (NR-06) 👨🏾‍👨🏾‍👦🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁮󠁬󠁮󠁢󠁿 Flag for North Brabant (NL-NB) 🏴󠁮󠁯󠀰󠀹󠁿 Flag for Aust-Agder (NO-09) 🏴󠁮󠁲󠀰󠀲󠁿 Flag for Anabar (NR-02) 🏴󠁮󠁬󠁬󠁩󠁿 Flag for Limburg (NL-LI) 🏴󠁮󠁯󠀰󠀶󠁿 Flag for Buskerud (NO-06) 🏴󠁮󠁯󠀰󠀴󠁿 Flag for Hedmark (NO-04) 🏴󠁮󠁯󠀰󠀷󠁿 Flag for Vestfold (NO-07) 🏴󠁮󠁲󠀰󠀴󠁿 Flag for Anibare (NR-04) 🏴󠁮󠁯󠀲󠀰󠁿 Flag for Finnmark (NO-20) 🏴󠁮󠁬󠁯󠁶󠁿 Flag for Overijssel (NL-OV) 🏴󠁮󠁯󠀱󠀱󠁿 Flag for Rogaland (NO-11) 🏴󠁮󠁯󠀰󠀱󠁿 Flag for Østfold (NO-01) 🏴󠁮󠁲󠀰󠀱󠁿 Flag for Aiwo (NR-01) 🏴󠁮󠁬󠁺󠁥󠁿 Flag for Zeeland (NL-ZE) 🏴󠁮󠁲󠀰󠀷󠁿 Flag for Buada (NR-07) 🏴󠁮󠁯󠀱󠀹󠁿 Flag for Troms (NO-19) 🏴󠁮󠁯󠀰󠀵󠁿 Flag for Oppland (NO-05) 🏴󠁮󠁰󠀲󠁿 Flag for Madhya Pashchimanchal (NP-2) 🏴󠁮󠁲󠀰󠀳󠁿 Flag for Anetan (NR-03) 🏴󠁮󠁰󠀳󠁿 Flag for Western (NP-3) 🏴󠁮󠁯󠀲󠀲󠁿 Flag for Jan Mayen (NO-22) 🏴󠁮󠁯󠀱󠀸󠁿 Flag for Nordland (NO-18) 🏴󠁰󠁡󠀱󠁿 Flag for Bocas del Toro (PA-1) 🏴󠁰󠁡󠀳󠁿 Flag for Colón (PA-3) 🏴󠁯󠁭󠁤󠁡󠁿 Flag for Ad Dakhiliyah (OM-DA) 🏴󠁯󠁭󠁭󠁡󠁿 Flag for Muscat (OM-MA) 🏴󠁮󠁲󠀰󠀹󠁿 Flag for Ewa (NR-09) 🏴󠁮󠁺󠁴󠁫󠁩󠁿 Flag for Taranaki (NZ-TKI) 🏴󠁮󠁲󠀱󠀰󠁿 Flag for Ijuw (NR-10) 🏴󠁮󠁺󠁷󠁴󠁣󠁿 Flag for West Coast (NZ-WTC) 🏴󠁮󠁺󠁳󠁴󠁬󠁿 Flag for Southland (NZ-STL) 🏴󠁮󠁺󠁴󠁡󠁳󠁿 Flag for Tasman (NZ-TAS) 🏴󠁮󠁺󠁭󠁷󠁴󠁿 Flag for Manawatu-Wanganui (NZ-MWT) 🏴󠁮󠁺󠁷󠁫󠁯󠁿 Flag for Waikato (NZ-WKO) 🏴󠁮󠁺󠁭󠁢󠁨󠁿 Flag for Marl (NZ-MBH) 🏴󠁮󠁺󠁢󠁯󠁰󠁿 Flag for Bay of Plenty (NZ-BOP) 🏴󠁮󠁲󠀱󠀲󠁿 Flag for Nibok (NR-12) 🏴󠁯󠁭󠁢󠁵󠁿 Flag for Al Buraimi (OM-BU) 🏴󠁮󠁺󠁡󠁵󠁫󠁿 Flag for Auckland (NZ-AUK) 🏴󠁯󠁭󠁳󠁪󠁿 Flag for Janub ash Sharqiyah (OM-SJ) 🏴󠁯󠁭󠁳󠁳󠁿 Flag for Shamal ash Sharqiyah (OM-SS) 🏴󠁰󠁡󠀲󠁿 Flag for Coclé (PA-2) 🏴󠁮󠁲󠀱󠀱󠁿 Flag for Meneng (NR-11) 🏴󠁰󠁡󠀱󠀰󠁿 Flag for West Panamá (PA-10) 🏴󠁯󠁭󠁺󠁡󠁿 Flag for Ad Dhahirah (OM-ZA) 🏴󠁮󠁺󠁮󠁴󠁬󠁿 Flag for Northland (NZ-NTL) 🏴󠁮󠁺󠁣󠁡󠁮󠁿 Flag for Canterbury (NZ-CAN) 🏴󠁮󠁺󠁧󠁩󠁳󠁿 Flag for Gisborne (NZ-GIS) 🏴󠁮󠁺󠁣󠁩󠁴󠁿 Flag for Chatham Islands (NZ-CIT) 🏴󠁮󠁲󠀱󠀳󠁿 Flag for Uaboe (NR-13) 🏴󠁮󠁲󠀰󠀸󠁿 Flag for Denigomodu (NR-08) 🏴󠁯󠁭󠁭󠁵󠁿 Flag for Musandam (OM-MU) 🏴󠁯󠁭󠁢󠁳󠁿 Flag for Shamal al Batinah (OM-BS) 🏴󠁮󠁺󠁨󠁫󠁢󠁿 Flag for Hawke’s Bay (NZ-HKB) 🏴󠁮󠁺󠁯󠁴󠁡󠁿 Flag for Otago (NZ-OTA) 🏴󠁯󠁭󠁢󠁪󠁿 Flag for Janub al Batinah (OM-BJ) 🏴󠁯󠁭󠁺󠁵󠁿 Flag for Dhofar (OM-ZU) 🏴󠁰󠁡󠀵󠁿 Flag for Darién (PA-5) 🏴󠁰󠁥󠁣󠁡󠁬󠁿 Flag for El Callao (PE-CAL) 🏴󠁰󠁡󠀶󠁿 Flag for Herrera (PA-6) 🏴󠁰󠁡󠁫󠁹󠁿 Flag for Guna Yala (PA-KY) 🏴󠁰󠁡󠁥󠁭󠁿 Flag for Emberá (PA-EM) 🏴󠁰󠁥󠁬󠁡󠁬󠁿 Flag for La Libertad (PE-LAL) 🏴󠁰󠁡󠀹󠁿 Flag for Veraguas (PA-9) 🏴󠁰󠁥󠁬󠁯󠁲󠁿 Flag for Loreto (PE-LOR) 🏴󠁰󠁥󠁡󠁭󠁡󠁿 Flag for Amazonas (PE-AMA) 🏴󠁰󠁡󠀴󠁿 Flag for Chiriquí (PA-4) 🏴󠁰󠁧󠁣󠁰󠁫󠁿 Flag for Chimbu (PG-CPK) 🏴󠁰󠁧󠁥󠁨󠁧󠁿 Flag for Eastern Highlands (PG-EHG) 🏴󠁰󠁥󠁳󠁡󠁭󠁿 Flag for San Martín (PE-SAM) 🏴󠁰󠁥󠁪󠁵󠁮󠁿 Flag for Junín (PE-JUN) 🏴󠁰󠁥󠁨󠁵󠁣󠁿 Flag for Huánuco (PE-HUC) 🏴󠁰󠁥󠁰󠁡󠁳󠁿 Flag for Pasco (PE-PAS) 🏴󠁰󠁡󠁮󠁢󠁿 Flag for Ngöbe-Buglé (PA-NB) 🏴󠁰󠁥󠁣󠁡󠁪󠁿 Flag for Cajamarca (PE-CAJ) 🏴󠁰󠁥󠁩󠁣󠁡󠁿 Flag for Ica (PE-ICA) 🏴󠁰󠁥󠁬󠁩󠁭󠁿 Flag for Lima Region (PE-LIM) 🏴󠁰󠁥󠁭󠁯󠁱󠁿 Flag for Moquegua (PE-MOQ) 🏴󠁰󠁥󠁰󠁵󠁮󠁿 Flag for Puno (PE-PUN) 🏴󠁰󠁥󠁵󠁣󠁡󠁿 Flag for Ucayali (PE-UCA) 🏴󠁰󠁥󠁬󠁭󠁡󠁿 Flag for Lima (PE-LMA) 🏴󠁰󠁥󠁰󠁩󠁵󠁿 Flag for Piura (PE-PIU) 🏴󠁰󠁥󠁴󠁵󠁭󠁿 Flag for Tumbes (PE-TUM) 🏴󠁰󠁥󠁣󠁵󠁳󠁿 Flag for Cusco (PE-CUS) 🏴󠁰󠁡󠀸󠁿 Flag for Panamá (PA-8) 🏴󠁰󠁥󠁴󠁡󠁣󠁿 Flag for Tacna (PE-TAC) 🏴󠁰󠁧󠁣󠁰󠁭󠁿 Flag for Central (PG-CPM) 🏴󠁰󠁡󠀷󠁿 Flag for Los Santos (PA-7) 🏴󠁰󠁥󠁬󠁡󠁭󠁿 Flag for Lambayeque (PE-LAM) 🏴󠁰󠁥󠁨󠁵󠁶󠁿 Flag for Huancavelica (PE-HUV) 🏴󠁰󠁥󠁡󠁮󠁣󠁿 Flag for Ancash (PE-ANC) 🏴󠁰󠁧󠁨󠁬󠁡󠁿 Flag for Hela (PG-HLA) 🏴󠁰󠁧󠁮󠁣󠁤󠁿 Flag for Port Moresby (PG-NCD) 🏴󠁰󠁫󠁩󠁳󠁿 Flag for Islamabad (PK-IS) 🏴󠁰󠁨󠀰󠀰󠁿 Flag for Metro Manila (PH-00) 🏴󠁰󠁨󠀰󠀵󠁿 Flag for Bicol (PH-05) 🏴󠁰󠁧󠁧󠁰󠁫󠁿 Flag for Gulf (PG-GPK) 🏴󠁰󠁨󠀰󠀹󠁿 Flag for Zamboanga Peninsula (PH-09) 🏴󠁰󠁧󠁮󠁳󠁢󠁿 Flag for Bougainville (PG-NSB) 🏴󠁰󠁫󠁧󠁢󠁿 Flag for Gilgit-Baltistan (PK-GB) 🏴󠁰󠁧󠁭󠁰󠁭󠁿 Flag for Madang (PG-MPM) 🏴󠁦󠁪󠁷󠁿 Flag for Western (FJ-W) 🏴󠁰󠁨󠀱󠀲󠁿 Flag for Soccsksargen (PH-12) 🏴󠁰󠁨󠀰󠀸󠁿 Flag for Eastern Visayas (PH-08) 🏴󠁰󠁧󠁥󠁰󠁷󠁿 Flag for Enga (PG-EPW) 🏴󠁰󠁧󠁭󠁢󠁡󠁿 Flag for Milne Bay (PG-MBA) 🏴󠁰󠁨󠀴󠀰󠁿 Flag for Calabarzon (PH-40) 🏴󠁰󠁧󠁪󠁷󠁫󠁿 Flag for Jiwaka (PG-JWK) 🏴󠁰󠁨󠀰󠀲󠁿 Flag for Cagayan Valley (PH-02) 👨🏿‍👨🏿‍👦🏿‍👧🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Boy: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁰󠁧󠁭󠁰󠁬󠁿 Flag for Morobe (PG-MPL) 🏴󠁰󠁨󠀱󠀰󠁿 Flag for Northern Mindanao (PH-10) 🏴󠁰󠁨󠀴󠀱󠁿 Flag for Mimaropa (PH-41) 🏴󠁰󠁫󠁢󠁡󠁿 Flag for Balochistan (PK-BA) 🏴󠁰󠁨󠀱󠀳󠁿 Flag for Caraga (PH-13) 🏴󠁰󠁧󠁥󠁳󠁷󠁿 Flag for East Sepik (PG-ESW) 🏴󠁰󠁨󠀰󠀶󠁿 Flag for Western Visayas (PH-06) 🏴󠁰󠁨󠀰󠀳󠁿 Flag for Central Luzon (PH-03) 🏴󠁰󠁨󠀱󠀴󠁿 Flag for Muslim Mindanao (PH-14) 🏴󠁰󠁧󠁳󠁨󠁭󠁿 Flag for Southern Highlands (PG-SHM) 🏴󠁰󠁧󠁷󠁰󠁤󠁿 Flag for Western (PG-WPD) 🏴󠁰󠁧󠁳󠁡󠁮󠁿 Flag for Sandaun (PG-SAN) 🏴󠁰󠁧󠁮󠁩󠁫󠁿 Flag for New Ireland (PG-NIK) 🏴󠁰󠁧󠁮󠁰󠁰󠁿 Flag for Oro (PG-NPP) 🏴󠁰󠁧󠁭󠁲󠁬󠁿 Flag for Manus (PG-MRL) 🏴󠁰󠁧󠁷󠁨󠁭󠁿 Flag for Western Highlands (PG-WHM) 🏴󠁰󠁨󠀱󠀱󠁿 Flag for Davao (PH-11) 🏴󠁰󠁫󠁰󠁢󠁿 Flag for Punjab (PK-PB) 🏴󠁰󠁬󠁰󠁭󠁿 Flag for Federal Capital Territory (PL-PM) 🏴󠁰󠁬󠁳󠁬󠁿 Flag for Silesia (PL-SL) 🏴󠁰󠁬󠁫󠁰󠁿 Flag for Kuyavian-Pomerania (PL-KP) 🏴󠁰󠁳󠁴󠁢󠁳󠁿 Flag for Tubas (PS-TBS) 🏴󠁰󠁳󠁲󠁢󠁨󠁿 Flag for Ramallah and al-Bireh (PS-RBH) 🏴󠁰󠁳󠁧󠁺󠁡󠁿 Flag for Gaza (PS-GZA) 🏴󠁰󠁳󠁲󠁦󠁨󠁿 Flag for Rafah (PS-RFH) 🏴󠁰󠁳󠁨󠁢󠁮󠁿 Flag for Hebron (PS-HBN) 🏴󠁰󠁬󠁰󠁤󠁿 Flag for Podlaskie (PL-PD) 🏴󠁰󠁬󠁰󠁫󠁿 Flag for Subcarpathia (PL-PK) 🏴󠁰󠁳󠁪󠁥󠁮󠁿 Flag for Jenin (PS-JEN) 🏴󠁰󠁬󠁤󠁳󠁿 Flag for Lower Silesian (PL-DS) 🏴󠁰󠁳󠁫󠁹󠁳󠁿 Flag for Khan Yunis (PS-KYS) 🏴󠁰󠁬󠁬󠁤󠁿 Flag for Łódź (PL-LD) 🏴󠁰󠁳󠁮󠁧󠁺󠁿 Flag for North Gaza (PS-NGZ) 🏴󠁰󠁬󠁺󠁰󠁿 Flag for West Pomerania (PL-ZP) 🏴󠁰󠁫󠁪󠁫󠁿 Flag for Azad Kashmir (PK-JK) 🏴󠁰󠁳󠁳󠁬󠁴󠁿 Flag for Salfit (PS-SLT) 🏴󠁰󠁬󠁭󠁺󠁿 Flag for Mazovia (PL-MZ) 🏴󠁰󠁬󠁭󠁡󠁿 Flag for Lesser Poland (PL-MA) 🏴󠁰󠁳󠁱󠁱󠁡󠁿 Flag for Qalqilya (PS-QQA) 🏴󠁰󠁴󠀰󠀱󠁿 Flag for Aveiro (PT-01) 🏴󠁰󠁬󠁷󠁰󠁿 Flag for Greater Poland (PL-WP) 🏴󠁰󠁬󠁯󠁰󠁿 Flag for Opole (PL-OP) 🏴󠁰󠁳󠁢󠁴󠁨󠁿 Flag for Bethlehem (PS-BTH) 🏴󠁰󠁫󠁫󠁰󠁿 Flag for Khyber Pakhtunkhwa (PK-KP) 🏴󠁰󠁳󠁴󠁫󠁭󠁿 Flag for Tulkarm (PS-TKM) 🏴󠁰󠁳󠁮󠁢󠁳󠁿 Flag for Nablus (PS-NBS) 🏴󠁰󠁬󠁷󠁮󠁿 Flag for Warmian-Masuria (PL-WN) 🏴󠁰󠁳󠁪󠁲󠁨󠁿 Flag for Jericho (PS-JRH) 🏴󠁰󠁫󠁳󠁤󠁿 Flag for Sindh (PK-SD) 🏴󠁰󠁬󠁬󠁵󠁿 Flag for Lublin (PL-LU) 🏴󠁰󠁳󠁪󠁥󠁭󠁿 Flag for Jerusalem (PS-JEM) 🏴󠁰󠁬󠁬󠁢󠁿 Flag for Lubusz (PL-LB) 🏴󠁰󠁬󠁳󠁫󠁿 Flag for Świętokrzyskie (PL-SK) 🏴󠁰󠁷󠀲󠀱󠀲󠁿 Flag for Melekeok (PW-212) 🏴󠁰󠁴󠀰󠀸󠁿 Flag for Faro (PT-08) 🏴󠁰󠁹󠀱󠀱󠁿 Flag for Central (PY-11) 🏴󠁰󠁴󠀰󠀷󠁿 Flag for Évora (PT-07) 🏴󠁰󠁷󠀲󠀲󠀸󠁿 Flag for Ngiwal (PW-228) 🏴󠁰󠁹󠀱󠀲󠁿 Flag for Ñeembucú (PY-12) 🏴󠁰󠁴󠀱󠀶󠁿 Flag for Viana do Castelo (PT-16) 🏴󠁰󠁴󠀱󠀱󠁿 Flag for Lisbon (PT-11) 🏴󠁰󠁹󠀱󠀵󠁿 Flag for Presidente Hayes (PY-15) 🏴󠁰󠁴󠀱󠀷󠁿 Flag for Vila Real (PT-17) 🏴󠁰󠁴󠀱󠀸󠁿 Flag for Viseu (PT-18) 🏴󠁰󠁷󠀰󠀰󠀴󠁿 Flag for Airai (PW-004) 🏴󠁰󠁹󠀱󠀳󠁿 Flag for Amambay (PY-13) 🏴󠁰󠁷󠀲󠀲󠀴󠁿 Flag for Ngatpang (PW-224) 🏴󠁰󠁴󠀰󠀶󠁿 Flag for Coimbra (PT-06) 🏴󠁰󠁴󠀱󠀲󠁿 Flag for Portalegre (PT-12) 🏴󠁰󠁷󠀳󠀵󠀰󠁿 Flag for Peleliu (PW-350) 🏴󠁰󠁷󠀲󠀲󠀲󠁿 Flag for Ngardmau (PW-222) 🏴󠁰󠁷󠀲󠀱󠀴󠁿 Flag for Ngaraard (PW-214) 🏴󠁰󠁹󠀱󠀴󠁿 Flag for Canindeyú (PY-14) 🏴󠁰󠁷󠀰󠀱󠀰󠁿 Flag for Angaur (PW-010) 🏴󠁰󠁷󠀳󠀷󠀰󠁿 Flag for Sonsorol (PW-370) 🏴󠁰󠁴󠀰󠀴󠁿 Flag for Bragança (PT-04) 🏴󠁰󠁴󠀰󠀵󠁿 Flag for Castelo Branco (PT-05) 🏴󠁰󠁴󠀱󠀴󠁿 Flag for Santarém (PT-14) 🏴󠁰󠁴󠀰󠀳󠁿 Flag for Braga (PT-03) 🏴󠁰󠁷󠀰󠀵󠀰󠁿 Flag for Hatohobei (PW-050) 🏴󠁰󠁷󠀱󠀵󠀰󠁿 Flag for Koror (PW-150) 🏴󠁰󠁹󠀱󠀰󠁿 Flag for Alto Paraná (PY-10) 🏴󠁰󠁷󠀲󠀲󠀷󠁿 Flag for Ngeremlengui (PW-227) 🏴󠁰󠁴󠀱󠀰󠁿 Flag for Leiria (PT-10) 🏴󠁰󠁴󠀱󠀳󠁿 Flag for Porto (PT-13) 🏴󠁰󠁴󠀱󠀵󠁿 Flag for Setúbal (PT-15) 🏴󠁰󠁷󠀰󠀰󠀲󠁿 Flag for Aimeliik (PW-002) 🏴󠁰󠁷󠀲󠀲󠀶󠁿 Flag for Ngchesar (PW-226) 🏴󠁰󠁴󠀰󠀹󠁿 Flag for Guarda (PT-09) 🏴󠁰󠁹󠀲󠁿 Flag for San Pedro (PY-2) 🏴󠁰󠁹󠀵󠁿 Flag for Caaguazú (PY-5) 🏴󠁰󠁹󠀴󠁿 Flag for Guairá (PY-4) 🏴󠁲󠁯󠁢󠁣󠁿 Flag for Bacău (RO-BC) 🏴󠁰󠁹󠀷󠁿 Flag for Itapúa (PY-7) 🏴󠁲󠁯󠁣󠁳󠁿 Flag for Caraș-Severin (RO-CS) 🏴󠁰󠁹󠀶󠁿 Flag for Caazapá (PY-6) 🏴󠁱󠁡󠁫󠁨󠁿 Flag for Al Khor (QA-KH) 🏴󠁲󠁯󠁣󠁶󠁿 Flag for Covasna (RO-CV) 🏴󠁲󠁯󠁡󠁢󠁿 Flag for Alba (RO-AB) 🏴󠁱󠁡󠁤󠁡󠁿 Flag for Doha (QA-DA) 🏴󠁲󠁯󠁤󠁪󠁿 Flag for Dolj (RO-DJ) 🏴󠁰󠁹󠀳󠁿 Flag for Cordillera (PY-3) 🏴󠁱󠁡󠁭󠁳󠁿 Flag for Madinat ash Shamal (QA-MS) 🏴󠁲󠁯󠁢󠁨󠁿 Flag for Bihor (RO-BH) 🏴󠁲󠁯󠁨󠁲󠁿 Flag for Harghita (RO-HR) 🏴󠁲󠁯󠁢󠁲󠁿 Flag for Brăila (RO-BR) 🏴󠁲󠁯󠁡󠁧󠁿 Flag for Argeș (RO-AG) 🏴󠁱󠁡󠁺󠁡󠁿 Flag for Al Daayen (QA-ZA) 🏴󠁲󠁯󠁢󠁮󠁿 Flag for Bistriţa-Năsăud (RO-BN) 🏴󠁲󠁯󠁣󠁬󠁿 Flag for Călărași (RO-CL) 🏴󠁰󠁹󠁡󠁳󠁵󠁿 Flag for Asunción (PY-ASU) 🏴󠁰󠁹󠀱󠁿 Flag for Concepción (PY-1) 🏴󠁲󠁯󠁢󠁴󠁿 Flag for Botoşani (RO-BT) 🏴󠁲󠁯󠁧󠁬󠁿 Flag for Galați (RO-GL) 🏴󠁲󠁯󠁧󠁲󠁿 Flag for Giurgiu (RO-GR) 🏴󠁰󠁹󠀱󠀹󠁿 Flag for Boquerón (PY-19) 🏴󠁰󠁹󠀸󠁿 Flag for Misiones (PY-8) 🏴󠁲󠁯󠁢󠁿 Flag for Bucharest (RO-B) 🏴󠁰󠁹󠀹󠁿 Flag for Paraguarí (PY-9) 🏴󠁱󠁡󠁲󠁡󠁿 Flag for Al Rayyan (QA-RA) 🏴󠁲󠁯󠁣󠁴󠁿 Flag for Constanța (RO-CT) 🏴󠁲󠁯󠁨󠁤󠁿 Flag for Hunedoara (RO-HD) 🏴󠁲󠁯󠁤󠁢󠁿 Flag for Dâmbovița (RO-DB) 🏴󠁲󠁯󠁡󠁲󠁿 Flag for Arad (RO-AR) 🏴󠁲󠁯󠁣󠁪󠁿 Flag for Cluj (RO-CJ) 🏴󠁲󠁯󠁢󠁺󠁿 Flag for Buzău (RO-BZ) 🏴󠁱󠁡󠁷󠁡󠁿 Flag for Al Wakrah (QA-WA) 🏴󠁲󠁯󠁶󠁬󠁿 Flag for Vâlcea (RO-VL) 🏴󠁲󠁯󠁩󠁳󠁿 Flag for Iași (RO-IS) 🏴󠁲󠁯󠁭󠁨󠁿 Flag for Mehedinți (RO-MH) 🏴󠁲󠁳󠁫󠁭󠁿 Flag for Kosovo-Metohija (RS-KM) 🏴󠁲󠁯󠁩󠁬󠁿 Flag for Ialomița (RO-IL) 🏴󠁲󠁯󠁴󠁲󠁿 Flag for Teleorman (RO-TR) 🏴󠁲󠁳󠀱󠀲󠁿 Flag for Šumadija (RS-12) 🏴󠁲󠁳󠀲󠀰󠁿 Flag for Nišava (RS-20) 🏴󠁲󠁵󠁡󠁬󠁿 Flag for Altai (RU-AL) 🏴󠁲󠁯󠁶󠁮󠁿 Flag for Vrancea (RO-VN) 🏴󠁲󠁯󠁶󠁳󠁿 Flag for Vaslui (RO-VS) 🏴󠁲󠁯󠁩󠁦󠁿 Flag for Ilfov (RO-IF) 🏴󠁲󠁳󠀰󠀸󠁿 Flag for Mačva (RS-08) 🏴󠁲󠁳󠀰󠀹󠁿 Flag for Kolubara (RS-09) 🏴󠁲󠁯󠁰󠁨󠁿 Flag for Prahova (RO-PH) 🏴󠁲󠁳󠀱󠀱󠁿 Flag for Braničevo (RS-11) 🏴󠁲󠁳󠀰󠀰󠁿 Flag for Beograd (RS-00) 🏴󠁲󠁳󠀱󠀵󠁿 Flag for Zaječar (RS-15) 🏴󠁲󠁳󠀱󠀷󠁿 Flag for Moravica (RS-17) 🏴󠁲󠁳󠀱󠀳󠁿 Flag for Pomoravlje (RS-13) 🏴󠁲󠁯󠁯󠁴󠁿 Flag for Olt (RO-OT) 🏴󠁲󠁯󠁳󠁭󠁿 Flag for Satu Mare (RO-SM) 🏴󠁲󠁳󠀲󠀱󠁿 Flag for Toplica (RS-21) 🏴󠁲󠁯󠁳󠁪󠁿 Flag for Sălaj (RO-SJ) 🏴󠁲󠁯󠁭󠁳󠁿 Flag for Mureş (RO-MS) 🏴󠁲󠁳󠀲󠀲󠁿 Flag for Pirot (RS-22) 🏴󠁲󠁳󠀱󠀹󠁿 Flag for Rasina (RS-19) 🏴󠁲󠁳󠀲󠀴󠁿 Flag for Pčinja (RS-24) 🏴󠁲󠁯󠁭󠁭󠁿 Flag for Maramureş (RO-MM) 🏴󠁲󠁯󠁳󠁶󠁿 Flag for Suceava (RO-SV) 🏴󠁲󠁳󠀱󠀸󠁿 Flag for Raška (RS-18) 🏴󠁲󠁳󠀱󠀴󠁿 Flag for Bor (RS-14) 🏴󠁲󠁳󠀱󠀰󠁿 Flag for Podunavlje (RS-10) 🏴󠁲󠁯󠁮󠁴󠁿 Flag for Neamţ (RO-NT) 🏴󠁲󠁳󠀱󠀶󠁿 Flag for Zlatibor (RS-16) 🏴󠁲󠁳󠁶󠁯󠁿 Flag for Vojvodina (RS-VO) 🏴󠁲󠁳󠀲󠀳󠁿 Flag for Jablanica (RS-23) 🏴󠁲󠁯󠁴󠁬󠁿 Flag for Tulcea (RO-TL) 🏴󠁲󠁵󠁡󠁤󠁿 Flag for Adygea (RU-AD) 🏴󠁲󠁯󠁴󠁭󠁿 Flag for Timiș (RO-TM) 👩🏼‍👦🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁲󠁵󠁫󠁣󠁿 Flag for Karachay-Cherkess (RU-KC) 🏴󠁲󠁵󠁫󠁫󠁿 Flag for Khakassia (RU-KK) 🏴󠁲󠁵󠁢󠁵󠁿 Flag for Buryat (RU-BU) 🏴󠁲󠁵󠁫󠁬󠁿 Flag for Kalmykia (RU-KL) 🏴󠁲󠁵󠁢󠁥󠁬󠁿 Flag for Belgorod (RU-BEL) 🏴󠁲󠁵󠁫󠁨󠁭󠁿 Flag for Khanty-Mansi (RU-KHM) 🏴󠁲󠁵󠁬󠁥󠁮󠁿 Flag for Leningrad (RU-LEN) 🏴󠁲󠁵󠁫󠁧󠁮󠁿 Flag for Kurgan (RU-KGN) 🏴󠁲󠁵󠁩󠁶󠁡󠁿 Flag for Ivanovo (RU-IVA) 🏴󠁲󠁵󠁩󠁮󠁿 Flag for Ingushetia (RU-IN) 🏴󠁲󠁵󠁫󠁩󠁲󠁿 Flag for Kirov (RU-KIR) 🏴󠁲󠁵󠁫󠁤󠁡󠁿 Flag for Krasnodar Krai (RU-KDA) 🏴󠁲󠁵󠁫󠁲󠁿 Flag for Karelia (RU-KR) 🏴󠁲󠁵󠁭󠁡󠁧󠁿 Flag for Magadan (RU-MAG) 🏴󠁲󠁵󠁫󠁹󠁡󠁿 Flag for Krasnoyarsk Krai (RU-KYA) 🏴󠁲󠁵󠁫󠁥󠁭󠁿 Flag for Kemerovo (RU-KEM) 🏴󠁲󠁵󠁡󠁳󠁴󠁿 Flag for Astrakhan (RU-AST) 🏴󠁲󠁵󠁡󠁭󠁵󠁿 Flag for Amur (RU-AMU) 🏴󠁲󠁵󠁭󠁯󠁿 Flag for Mordovia (RU-MO) 🏴󠁲󠁵󠁫󠁯󠁿 Flag for Komi (RU-KO) 🏴󠁲󠁵󠁣󠁨󠁥󠁿 Flag for Chelyabinsk (RU-CHE) 🏴󠁲󠁵󠁫󠁨󠁡󠁿 Flag for Khabarovsk Krai (RU-KHA) 🏴󠁲󠁵󠁫󠁲󠁳󠁿 Flag for Kursk (RU-KRS) 🏴󠁲󠁵󠁭󠁥󠁿 Flag for Mari El (RU-ME) 🏴󠁲󠁵󠁣󠁨󠁵󠁿 Flag for Chukotka Okrug (RU-CHU) 🏴󠁲󠁵󠁫󠁧󠁤󠁿 Flag for Kaliningrad (RU-KGD) 🏴󠁲󠁵󠁩󠁲󠁫󠁿 Flag for Irkutsk (RU-IRK) 🏴󠁲󠁵󠁫󠁬󠁵󠁿 Flag for Kaluga (RU-KLU) 🏴󠁲󠁵󠁫󠁢󠁿 Flag for Kabardino-Balkar (RU-KB) 🏴󠁲󠁵󠁬󠁩󠁰󠁿 Flag for Lipetsk (RU-LIP) 🏴󠁲󠁵󠁢󠁡󠁿 Flag for Bashkortostan (RU-BA) 🏴󠁲󠁵󠁣󠁵󠁿 Flag for Chuvash (RU-CU) 🏴󠁲󠁵󠁫󠁡󠁭󠁿 Flag for Kamchatka Krai (RU-KAM) 🏴󠁲󠁵󠁫󠁯󠁳󠁿 Flag for Kostroma (RU-KOS) 🏴󠁲󠁵󠁳󠁡󠁫󠁿 Flag for Sakhalin (RU-SAK) 🏴󠁲󠁵󠁴󠁶󠁥󠁿 Flag for Tver (RU-TVE) 🏴󠁲󠁵󠁮󠁶󠁳󠁿 Flag for Novosibirsk (RU-NVS) 🏴󠁲󠁵󠁶󠁬󠁡󠁿 Flag for Vladimir (RU-VLA) 🏴󠁲󠁵󠁯󠁲󠁬󠁿 Flag for Oryol (RU-ORL) 🏴󠁲󠁵󠁳󠁴󠁡󠁿 Flag for Stavropol Krai (RU-STA) 🏴󠁲󠁵󠁮󠁩󠁺󠁿 Flag for Nizhny Novgorod (RU-NIZ) 🏴󠁲󠁵󠁳󠁡󠁲󠁿 Flag for Saratov (RU-SAR) 🏴󠁲󠁵󠁯󠁲󠁥󠁿 Flag for Orenburg (RU-ORE) 🏴󠁲󠁵󠁮󠁥󠁮󠁿 Flag for Nenets (RU-NEN) 🏴󠁲󠁵󠁶󠁧󠁧󠁿 Flag for Volgograd (RU-VGG) 🏴󠁲󠁵󠁴󠁯󠁭󠁿 Flag for Tomsk (RU-TOM) 🏴󠁲󠁵󠁳󠁶󠁥󠁿 Flag for Sverdlovsk (RU-SVE) 🏴󠁲󠁵󠁳󠁰󠁥󠁿 Flag for Saint Petersburg (RU-SPE) 🏴󠁲󠁵󠁹󠁡󠁮󠁿 Flag for Yamalo-Nenets Okrug (RU-YAN) 🏴󠁲󠁵󠁳󠁡󠁿 Flag for Sakha (RU-SA) 🏴󠁲󠁵󠁭󠁯󠁷󠁿 Flag for Moscow (RU-MOW) 🏴󠁲󠁵󠁰󠁮󠁺󠁿 Flag for Penza (RU-PNZ) 🏴󠁲󠁵󠁳󠁭󠁯󠁿 Flag for Smolensk (RU-SMO) 🏴󠁲󠁵󠁴󠁡󠁿 Flag for Tatarstan (RU-TA) 🏴󠁲󠁵󠁶󠁬󠁧󠁿 Flag for Vologda (RU-VLG) 🏴󠁲󠁵󠁴󠁵󠁬󠁿 Flag for Tula (RU-TUL) 🏴󠁲󠁵󠁹󠁡󠁲󠁿 Flag for Yaroslavl (RU-YAR) 🏴󠁲󠁵󠁴󠁹󠁵󠁿 Flag for Tyumen (RU-TYU) 🏴󠁲󠁵󠁰󠁳󠁫󠁿 Flag for Pskov (RU-PSK) 🏴󠁲󠁵󠁵󠁤󠁿 Flag for Udmurt (RU-UD) 🏴󠁲󠁵󠁳󠁡󠁭󠁿 Flag for Samara (RU-SAM) 🏴󠁲󠁵󠁵󠁬󠁹󠁿 Flag for Ulyanovsk (RU-ULY) 🏴󠁲󠁵󠁲󠁹󠁡󠁿 Flag for Ryazan (RU-RYA) 🏴󠁲󠁵󠁯󠁭󠁳󠁿 Flag for Omsk (RU-OMS) 🏴󠁲󠁵󠁰󠁥󠁲󠁿 Flag for Perm Krai (RU-PER) 🏴󠁲󠁵󠁶󠁯󠁲󠁿 Flag for Voronezh (RU-VOR) 🏴󠁲󠁵󠁮󠁧󠁲󠁿 Flag for Novgorod (RU-NGR) 🏴󠁲󠁵󠁴󠁡󠁭󠁿 Flag for Tambov (RU-TAM) 🏴󠁲󠁵󠁴󠁹󠁿 Flag for Tuva (RU-TY) 🏴󠁲󠁵󠁲󠁯󠁳󠁿 Flag for Rostov (RU-ROS) 🏴󠁲󠁵󠁭󠁵󠁲󠁿 Flag for Murmansk (RU-MUR) 🏴󠁲󠁷󠀰󠀱󠁿 Flag for Kigali (RW-01) 🏴󠁳󠁣󠀰󠀳󠁿 Flag for Anse Etoile (SC-03) 🏴󠁳󠁢󠁩󠁳󠁿 Flag for Isabel (SB-IS) 🏴󠁳󠁣󠀰󠀲󠁿 Flag for Anse Boileau (SC-02) 🏴󠁳󠁡󠀰󠀷󠁿 Flag for Tabuk (SA-07) 🏴󠁳󠁢󠁧󠁵󠁿 Flag for Guadalcanal (SB-GU) 🏴󠁲󠁷󠀰󠀳󠁿 Flag for Northern (RW-03) 🏴󠁲󠁷󠀰󠀵󠁿 Flag for Southern (RW-05) 🏴󠁳󠁢󠁣󠁥󠁿 Flag for Central (SB-CE) 🏴󠁳󠁡󠀰󠀶󠁿 Flag for Ha’il (SA-06) 🏴󠁳󠁣󠀰󠀹󠁿 Flag for Bel Air (SC-09) 🏴󠁳󠁢󠁭󠁬󠁿 Flag for Malaita (SB-ML) 🏴󠁳󠁡󠀱󠀰󠁿 Flag for Najran (SA-10) 🏴󠁳󠁡󠀱󠀲󠁿 Flag for Al Jawf (SA-12) 🏴󠁳󠁢󠁣󠁴󠁿 Flag for Honiara (SB-CT) 🏴󠁳󠁢󠁷󠁥󠁿 Flag for Western (SB-WE) 🏴󠁳󠁡󠀰󠀸󠁿 Flag for Northern Borders (SA-08) 🏴󠁳󠁡󠀰󠀱󠁿 Flag for Riyadh (SA-01) 🏴󠁳󠁢󠁲󠁢󠁿 Flag for Rennell and Bellona (SB-RB) 🏴󠁳󠁣󠀰󠀴󠁿 Flag for Au Cap (SC-04) 🏴󠁲󠁷󠀰󠀲󠁿 Flag for Eastern (RW-02) 🏴󠁳󠁣󠀰󠀵󠁿 Flag for Anse Royale (SC-05) 🏴󠁲󠁵󠁹󠁥󠁶󠁿 Flag for Jewish (RU-YEV) 🏴󠁳󠁣󠀱󠀰󠁿 Flag for Bel Ombre (SC-10) 🏴󠁳󠁡󠀰󠀵󠁿 Flag for Al-Qassim (SA-05) 🏴󠁳󠁢󠁴󠁥󠁿 Flag for Temotu (SB-TE) 🏴󠁳󠁣󠀰󠀷󠁿 Flag for Baie Sainte Anne (SC-07) 🏴󠁳󠁢󠁣󠁨󠁿 Flag for Choiseul (SB-CH) 🏴󠁲󠁷󠀰󠀴󠁿 Flag for Western (RW-04) 🏴󠁳󠁢󠁭󠁫󠁿 Flag for Makira-Ulawa (SB-MK) 🏴󠁳󠁡󠀰󠀲󠁿 Flag for Makkah (SA-02) 🏴󠁳󠁡󠀰󠀹󠁿 Flag for Jizan (SA-09) 🏴󠁳󠁣󠀰󠀱󠁿 Flag for Anse aux Pins (SC-01) 🏴󠁳󠁡󠀰󠀴󠁿 Flag for Eastern (SA-04) 🏴󠁳󠁡󠀱󠀴󠁿 Flag for Asir (SA-14) 🏴󠁲󠁵󠁺󠁡󠁢󠁿 Flag for Zabaykalsky Krai (RU-ZAB) 🏴󠁳󠁣󠀰󠀸󠁿 Flag for Beau Vallon (SC-08) 🏴󠁳󠁡󠀰󠀳󠁿 Flag for Al Madinah (SA-03) 🏴󠁳󠁣󠀰󠀶󠁿 Flag for Baie Lazare (SC-06) 🏴󠁳󠁣󠀱󠀹󠁿 Flag for Plaisance (SC-19) 🏴󠁳󠁥󠁤󠁿 Flag for Södermanland (SE-D) 🏴󠁳󠁣󠀱󠀶󠁿 Flag for La Rivière Anglaise (SC-16) 🏴󠁳󠁣󠀲󠀲󠁿 Flag for Saint Louis (SC-22) 🏴󠁳󠁣󠀱󠀸󠁿 Flag for Mont Fleuri (SC-18) 🏴󠁳󠁤󠁮󠁯󠁿 Flag for Northern (SD-NO) 🏴󠁳󠁣󠀱󠀳󠁿 Flag for Grand’Anse Mahé (SC-13) 🏴󠁳󠁣󠀲󠀳󠁿 Flag for Takamaka (SC-23) 🏴󠁳󠁤󠁤󠁷󠁿 Flag for West Darfur (SD-DW) 🏴󠁳󠁤󠁧󠁤󠁿 Flag for Al Qadarif (SD-GD) 🏴󠁳󠁤󠁤󠁳󠁿 Flag for South Darfur (SD-DS) 🏴󠁳󠁤󠁮󠁲󠁿 Flag for River Nile (SD-NR) 🏴󠁳󠁤󠁧󠁫󠁿 Flag for West Kurdufan (SD-GK) 🏴󠁳󠁤󠁫󠁡󠁿 Flag for Kassala (SD-KA) 🏴󠁳󠁤󠁫󠁨󠁿 Flag for Khartoum (SD-KH) 🏴󠁳󠁣󠀱󠀵󠁿 Flag for La Digue (SC-15) 🏴󠁳󠁣󠀲󠀴󠁿 Flag for Les Mamelles (SC-24) 🏴󠁳󠁣󠀲󠀱󠁿 Flag for Port Glaud (SC-21) 🏴󠁳󠁥󠁡󠁣󠁿 Flag for Västerbotten (SE-AC) 🏴󠁳󠁥󠁦󠁿 Flag for Jönköping (SE-F) 🏴󠁳󠁥󠁡󠁢󠁿 Flag for Stockholm (SE-AB) 🏴󠁳󠁣󠀱󠀲󠁿 Flag for Glacis (SC-12) 🏴󠁳󠁣󠀲󠀰󠁿 Flag for Pointe La Rue (SC-20) 🏴󠁳󠁤󠁮󠁷󠁿 Flag for White Nile (SD-NW) 🏴󠁳󠁤󠁧󠁺󠁿 Flag for Al Jazirah (SD-GZ) 🏴󠁳󠁥󠁥󠁿 Flag for Östergötland (SE-E) 🏴󠁳󠁥󠁢󠁤󠁿 Flag for Norrbotten (SE-BD) 🏴󠁳󠁥󠁣󠁿 Flag for Uppsala (SE-C) 🏴󠁳󠁣󠀱󠀷󠁿 Flag for Mont Buxton (SC-17) 🏴󠁳󠁣󠀱󠀴󠁿 Flag for Grand’Anse Praslin (SC-14) 🏴󠁳󠁤󠁫󠁳󠁿 Flag for South Kurdufan (SD-KS) 🏴󠁳󠁣󠀱󠀱󠁿 Flag for Cascade (SC-11) 🏴󠁳󠁤󠁫󠁮󠁿 Flag for North Kurdufan (SD-KN) 🏴󠁳󠁤󠁳󠁩󠁿 Flag for Sennar (SD-SI) 🏴󠁳󠁤󠁤󠁥󠁿 Flag for East Darfur (SD-DE) 🏴󠁳󠁤󠁮󠁢󠁿 Flag for Blue Nile (SD-NB) 🏴󠁳󠁤󠁤󠁮󠁿 Flag for North Darfur (SD-DN) 🏴󠁳󠁤󠁤󠁣󠁿 Flag for Central Darfur (SD-DC) 🏴󠁳󠁥󠁵󠁿 Flag for Västmanland (SE-U) 🏴󠁳󠁥󠁳󠁿 Flag for Värmland (SE-S) 🏴󠁳󠁩󠀰󠀱󠀷󠁿 Flag for Črnomelj (SI-017) 🏴󠁳󠁥󠁹󠁿 Flag for Västernorrland (SE-Y) 🏴󠁳󠁧󠀰󠀵󠁿 Flag for South West (SG-05) 🏴󠁳󠁩󠀰󠀱󠀶󠁿 Flag for Črna na Koroškem (SI-016) 🏴󠁳󠁥󠁯󠁿 Flag for Västra Götaland (SE-O) 🏴󠁳󠁥󠁸󠁿 Flag for Gävleborg (SE-X) 🏴󠁳󠁧󠀰󠀲󠁿 Flag for North East (SG-02) 🏴󠁳󠁩󠀰󠀰󠀷󠁿 Flag for Brda (SI-007) 🏴󠁳󠁥󠁨󠁿 Flag for Kalmar (SE-H) 🏴󠁳󠁩󠀰󠀱󠀸󠁿 Flag for Destrnik (SI-018) 🏴󠁳󠁩󠀰󠀰󠀲󠁿 Flag for Beltinci (SI-002) 🏴󠁳󠁩󠀰󠀰󠀴󠁿 Flag for Bohinj (SI-004) 🏴󠁳󠁩󠀰󠀰󠀹󠁿 Flag for Brežice (SI-009) 🏴󠁳󠁧󠀰󠀳󠁿 Flag for North West (SG-03) 🏴󠁳󠁨󠁡󠁣󠁿 Flag for Ascension Island (SH-AC) 👩🏽‍👦🏽‍👶🏽 Family - Woman: Medium Skin Tone, Boy: Medium Skin Tone, Baby: Medium Skin Tone 🏴󠁳󠁩󠀰󠀱󠀲󠁿 Flag for Cerklje na Gorenjskem (SI-012) 🏴󠁳󠁩󠀰󠀱󠀳󠁿 Flag for Cerknica (SI-013) 🏴󠁳󠁩󠀰󠀰󠀶󠁿 Flag for Bovec (SI-006) 🏴󠁳󠁩󠀰󠀱󠀵󠁿 Flag for Črenšovci (SI-015) 🏴󠁳󠁥󠁧󠁿 Flag for Kronoberg (SE-G) 🏴󠁳󠁩󠀰󠀰󠀱󠁿 Flag for Ajdovščina (SI-001) 🏴󠁳󠁩󠀰󠀱󠀰󠁿 Flag for Tišina (SI-010) 🏴󠁳󠁧󠀰󠀴󠁿 Flag for South East (SG-04) 🏴󠁳󠁩󠀰󠀰󠀸󠁿 Flag for Brezovica (SI-008) 🏴󠁳󠁨󠁨󠁬󠁿 Flag for Saint Helena (SH-HL) 🏴󠁳󠁥󠁺󠁿 Flag for Jämtland (SE-Z) 🏴󠁳󠁥󠁩󠁿 Flag for Gotland (SE-I) 🏴󠁳󠁥󠁷󠁿 Flag for Dalarna (SE-W) 🏴󠁳󠁥󠁫󠁿 Flag for Blekinge (SE-K) 🏴󠁳󠁩󠀰󠀰󠀵󠁿 Flag for Borovnica (SI-005) 🏴󠁳󠁨󠁴󠁡󠁿 Flag for Tristan da Cunha (SH-TA) 🏴󠁳󠁩󠀰󠀰󠀳󠁿 Flag for Bled (SI-003) 🏴󠁳󠁩󠀰󠀱󠀴󠁿 Flag for Cerkno (SI-014) 🏴󠁳󠁥󠁴󠁿 Flag for Örebro (SE-T) 🏴󠁳󠁩󠀰󠀲󠀳󠁿 Flag for Domžale (SI-023) 🏴󠁳󠁩󠀰󠀴󠀰󠁿 Flag for Izola (SI-040) 🏴󠁳󠁩󠀰󠀵󠀶󠁿 Flag for Kuzma (SI-056) 🏴󠁳󠁩󠀰󠀲󠀵󠁿 Flag for Dravograd (SI-025) 🏴󠁳󠁩󠀰󠀲󠀶󠁿 Flag for Duplek (SI-026) 🏴󠁳󠁩󠀰󠀴󠀱󠁿 Flag for Jesenice (SI-041) 🏴󠁳󠁩󠀰󠀲󠀸󠁿 Flag for Gorišnica (SI-028) 🏴󠁳󠁩󠀰󠀲󠀹󠁿 Flag for Gornja Radgona (SI-029) 🏴󠁳󠁩󠀰󠀲󠀰󠁿 Flag for Dobrepolje (SI-020) 🏴󠁳󠁩󠀰󠀳󠀱󠁿 Flag for Gornji Petrovci (SI-031) 🏴󠁳󠁩󠀰󠀲󠀴󠁿 Flag for Dornava (SI-024) 🏴󠁳󠁩󠀰󠀳󠀴󠁿 Flag for Hrastnik (SI-034) 🏴󠁳󠁩󠀰󠀳󠀹󠁿 Flag for Ivančna Gorica (SI-039) 🏴󠁳󠁩󠀰󠀴󠀹󠁿 Flag for Komen (SI-049) 🏴󠁳󠁩󠀰󠀵󠀱󠁿 Flag for Kozje (SI-051) 🏴󠁳󠁩󠀰󠀱󠀹󠁿 Flag for Divača (SI-019) 🏴󠁳󠁩󠀰󠀳󠀶󠁿 Flag for Idrija (SI-036) 🏴󠁳󠁩󠀰󠀴󠀵󠁿 Flag for Kidričevo (SI-045) 🏴󠁳󠁩󠀰󠀴󠀶󠁿 Flag for Kobarid (SI-046) 🏴󠁳󠁩󠀰󠀴󠀷󠁿 Flag for Kobilje (SI-047) 🏴󠁳󠁩󠀰󠀵󠀰󠁿 Flag for Koper (SI-050) 🏴󠁳󠁩󠀰󠀳󠀷󠁿 Flag for Ig (SI-037) 🏴󠁳󠁩󠀰󠀵󠀵󠁿 Flag for Kungota (SI-055) 🏴󠁳󠁩󠀰󠀳󠀲󠁿 Flag for Grosuplje (SI-032) 🏴󠁳󠁩󠀰󠀲󠀱󠁿 Flag for Dobrova–Polhov Gradec (SI-021) 🏴󠁳󠁩󠀰󠀴󠀲󠁿 Flag for Juršinci (SI-042) 🏴󠁳󠁩󠀰󠀵󠀴󠁿 Flag for Krško (SI-054) 🏴󠁳󠁩󠀰󠀳󠀳󠁿 Flag for Šalovci (SI-033) 🏴󠁳󠁩󠀰󠀵󠀳󠁿 Flag for Kranjska Gora (SI-053) 🏴󠁳󠁩󠀰󠀴󠀸󠁿 Flag for Kočevje (SI-048) 🏴󠁳󠁩󠀰󠀳󠀸󠁿 Flag for Ilirska Bistrica (SI-038) 🏴󠁳󠁩󠀰󠀴󠀳󠁿 Flag for Kamnik (SI-043) 🏴󠁳󠁩󠀰󠀳󠀵󠁿 Flag for Hrpelje–Kozina (SI-035) 🏴󠁳󠁩󠀰󠀳󠀰󠁿 Flag for Gornji Grad (SI-030) 🏴󠁳󠁩󠀰󠀴󠀴󠁿 Flag for Kanal (SI-044) 🏴󠁳󠁩󠀰󠀲󠀲󠁿 Flag for Dol pri Ljubljani (SI-022) 🏴󠁳󠁩󠀰󠀸󠀹󠁿 Flag for Pesnica (SI-089) 🏴󠁳󠁩󠀰󠀹󠀰󠁿 Flag for Piran (SI-090) 🏴󠁳󠁩󠀰󠀷󠀴󠁿 Flag for Mežica (SI-074) 🏴󠁳󠁩󠀰󠀸󠀱󠁿 Flag for Muta (SI-081) 🏴󠁳󠁩󠀰󠀶󠀲󠁿 Flag for Ljubno (SI-062) 🏴󠁳󠁩󠀰󠀸󠀷󠁿 Flag for Ormož (SI-087) 🏴󠁳󠁩󠀰󠀹󠀴󠁿 Flag for Postojna (SI-094) 🏴󠁳󠁩󠀰󠀷󠀶󠁿 Flag for Mislinja (SI-076) 👩🏾‍👦🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁳󠁩󠀰󠀶󠀹󠁿 Flag for Majšperk (SI-069) 🏴󠁳󠁩󠀰󠀷󠀲󠁿 Flag for Mengeš (SI-072) 🏴󠁳󠁩󠀰󠀷󠀳󠁿 Flag for Metlika (SI-073) 🏴󠁳󠁩󠀰󠀷󠀷󠁿 Flag for Moravče (SI-077) 🏴󠁳󠁩󠀰󠀷󠀸󠁿 Flag for Moravske Toplice (SI-078) 🏴󠁳󠁩󠀰󠀶󠀱󠁿 Flag for Ljubljana (SI-061) 🏴󠁳󠁩󠀰󠀸󠀰󠁿 Flag for Murska Sobota (SI-080) 🏴󠁳󠁩󠀰󠀸󠀲󠁿 Flag for Naklo (SI-082) 🏴󠁳󠁩󠀰󠀸󠀴󠁿 Flag for Nova Gorica (SI-084) 🏴󠁳󠁩󠀰󠀸󠀸󠁿 Flag for Osilnica (SI-088) 🏴󠁳󠁩󠀰󠀹󠀱󠁿 Flag for Pivka (SI-091) 🏴󠁳󠁩󠀰󠀸󠀳󠁿 Flag for Nazarje (SI-083) 🏴󠁳󠁩󠀰󠀷󠀵󠁿 Flag for Miren–Kostanjevica (SI-075) 🏴󠁳󠁩󠀰󠀶󠀴󠁿 Flag for Logatec (SI-064) 🏴󠁳󠁩󠀰󠀶󠀰󠁿 Flag for Litija (SI-060) 🏴󠁳󠁩󠀰󠀷󠀰󠁿 Flag for Maribor (SI-070) 🏴󠁳󠁩󠀰󠀶󠀳󠁿 Flag for Ljutomer (SI-063) 🏴󠁳󠁩󠀰󠀶󠀶󠁿 Flag for Loški Potok (SI-066) 🏴󠁳󠁩󠀰󠀶󠀷󠁿 Flag for Luče (SI-067) 🏴󠁳󠁩󠀰󠀹󠀲󠁿 Flag for Podčetrtek (SI-092) 🏴󠁳󠁩󠀰󠀹󠀳󠁿 Flag for Podvelka (SI-093) 🏴󠁳󠁩󠀰󠀷󠀱󠁿 Flag for Medvode (SI-071) 🏴󠁳󠁩󠀰󠀶󠀵󠁿 Flag for Loška Dolina (SI-065) 🏴󠁳󠁩󠀰󠀵󠀷󠁿 Flag for Laško (SI-057) 🏴󠁳󠁩󠀰󠀵󠀹󠁿 Flag for Lendava (SI-059) 🏴󠁳󠁩󠀰󠀷󠀹󠁿 Flag for Mozirje (SI-079) 🏴󠁳󠁩󠀰󠀶󠀸󠁿 Flag for Lukovica (SI-068) 🏴󠁳󠁩󠀱󠀳󠀱󠁿 Flag for Tržič (SI-131) 🏴󠁳󠁩󠀱󠀱󠀸󠁿 Flag for Šentilj (SI-118) 🏴󠁳󠁩󠀰󠀹󠀸󠁿 Flag for Rače–Fram (SI-098) 🏴󠁳󠁩󠀰󠀹󠀷󠁿 Flag for Puconci (SI-097) 👩🏿‍👦🏿‍👶🏿 Family - Woman: Dark Skin Tone, Boy: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁳󠁩󠀱󠀰󠀵󠁿 Flag for Rogašovci (SI-105) 🏴󠁳󠁩󠀱󠀱󠀳󠁿 Flag for Slovenska Bistrica (SI-113) 🏴󠁳󠁩󠀱󠀰󠀷󠁿 Flag for Rogatec (SI-107) 🏴󠁳󠁩󠀰󠀹󠀶󠁿 Flag for Ptuj (SI-096) 🏴󠁳󠁩󠀱󠀱󠀹󠁿 Flag for Šentjernej (SI-119) 🏴󠁳󠁩󠀱󠀱󠀱󠁿 Flag for Sežana (SI-111) 🏴󠁳󠁩󠀱󠀲󠀳󠁿 Flag for Škofljica (SI-123) 🏴󠁳󠁩󠀱󠀱󠀲󠁿 Flag for Slovenj Gradec (SI-112) 🏴󠁳󠁩󠀱󠀱󠀵󠁿 Flag for Starše (SI-115) 🏴󠁳󠁩󠀱󠀱󠀶󠁿 Flag for Sveti Jurij (SI-116) 🏴󠁳󠁩󠀱󠀳󠀰󠁿 Flag for Trebnje (SI-130) 🏴󠁳󠁩󠀱󠀱󠀰󠁿 Flag for Sevnica (SI-110) 🏴󠁳󠁩󠀰󠀹󠀹󠁿 Flag for Radeče (SI-099) 🏴󠁳󠁩󠀱󠀲󠀱󠁿 Flag for Škocjan (SI-121) 🏴󠁳󠁩󠀱󠀲󠀴󠁿 Flag for Šmarje pri Jelšah (SI-124) 🏴󠁳󠁩󠀱󠀲󠀶󠁿 Flag for Šoštanj (SI-126) 🏴󠁳󠁩󠀱󠀲󠀷󠁿 Flag for Štore (SI-127) 🏴󠁳󠁩󠀱󠀰󠀶󠁿 Flag for Rogaška Slatina (SI-106) 🏴󠁳󠁩󠀰󠀹󠀵󠁿 Flag for Preddvor (SI-095) 🏴󠁳󠁩󠀱󠀳󠀲󠁿 Flag for Turnišče (SI-132) 🏴󠁳󠁩󠀱󠀰󠀲󠁿 Flag for Radovljica (SI-102) 🏴󠁳󠁩󠀱󠀰󠀸󠁿 Flag for Ruše (SI-108) 🏴󠁳󠁩󠀱󠀱󠀴󠁿 Flag for Slovenske Konjice (SI-114) 🏴󠁳󠁩󠀱󠀲󠀰󠁿 Flag for Šentjur (SI-120) 🏴󠁳󠁩󠀱󠀲󠀸󠁿 Flag for Tolmin (SI-128) 🏴󠁳󠁩󠀱󠀰󠀴󠁿 Flag for Ribnica (SI-104) 🏴󠁳󠁩󠀱󠀰󠀱󠁿 Flag for Radlje ob Dravi (SI-101) 🏴󠁳󠁩󠀱󠀲󠀹󠁿 Flag for Trbovlje (SI-129) 🏴󠁳󠁩󠀱󠀰󠀹󠁿 Flag for Semič (SI-109) 🏴󠁳󠁩󠀱󠀱󠀷󠁿 Flag for Šenčur (SI-117) 🏴󠁳󠁩󠀱󠀰󠀳󠁿 Flag for Ravne na Koroškem (SI-103) 🏴󠁳󠁩󠀱󠀶󠀹󠁿 Flag for Miklavž na Dravskem Polju (SI-169) 🏴󠁳󠁩󠀱󠀳󠀸󠁿 Flag for Vodice (SI-138) 🏴󠁳󠁩󠀱󠀳󠀳󠁿 Flag for Velenje (SI-133) 🏴󠁳󠁩󠀱󠀴󠀲󠁿 Flag for Zagorje ob Savi (SI-142) 🏴󠁳󠁩󠀱󠀴󠀱󠁿 Flag for Vuzenica (SI-141) 🏴󠁳󠁩󠀱󠀴󠀰󠁿 Flag for Vrhnika (SI-140) 👩🏻‍👧🏻 Family - Woman: Light Skin Tone, Girl: Light Skin Tone 🏴󠁳󠁩󠀱󠀴󠀶󠁿 Flag for Železniki (SI-146) 🏴󠁳󠁩󠀱󠀴󠀷󠁿 Flag for Žiri (SI-147) 🏴󠁳󠁩󠀱󠀴󠀸󠁿 Flag for Benedikt (SI-148) 🏴󠁳󠁩󠀱󠀳󠀴󠁿 Flag for Velike Lašče (SI-134) 🏴󠁳󠁩󠀱󠀳󠀷󠁿 Flag for Vitanje (SI-137) 🏴󠁳󠁩󠀱󠀶󠀴󠁿 Flag for Komenda (SI-164) 🏴󠁳󠁩󠀱󠀵󠀵󠁿 Flag for Dobrna (SI-155) 🏴󠁳󠁩󠀱󠀵󠀶󠁿 Flag for Dobrovnik (SI-156) 🏴󠁳󠁩󠀱󠀵󠀷󠁿 Flag for Dolenjske Toplice (SI-157) 🏴󠁳󠁩󠀱󠀵󠀹󠁿 Flag for Hajdina (SI-159) 🏴󠁳󠁩󠀱󠀷󠀱󠁿 Flag for Oplotnica (SI-171) 🏴󠁳󠁩󠀱󠀳󠀵󠁿 Flag for Videm (SI-135) 🏴󠁳󠁩󠀱󠀶󠀳󠁿 Flag for Jezersko (SI-163) 🏴󠁳󠁩󠀱󠀵󠀲󠁿 Flag for Cankova (SI-152) 🏴󠁳󠁩󠀱󠀶󠀵󠁿 Flag for Kostel (SI-165) 🏴󠁳󠁩󠀱󠀶󠀶󠁿 Flag for Križevci (SI-166) 🏴󠁳󠁩󠀱󠀳󠀹󠁿 Flag for Vojnik (SI-139) 🏴󠁳󠁩󠀱󠀶󠀸󠁿 Flag for Markovci (SI-168) 🏴󠁳󠁩󠀱󠀷󠀰󠁿 Flag for Mirna Peč (SI-170) 🏴󠁳󠁩󠀱󠀳󠀶󠁿 Flag for Vipava (SI-136) 🏴󠁳󠁩󠀱󠀶󠀲󠁿 Flag for Horjul (SI-162) 🏴󠁳󠁩󠀱󠀵󠀳󠁿 Flag for Cerkvenjak (SI-153) 🏴󠁳󠁩󠀱󠀵󠀰󠁿 Flag for Bloke (SI-150) 🏴󠁳󠁩󠀱󠀴󠀳󠁿 Flag for Zavrč (SI-143) 🏴󠁳󠁩󠀱󠀴󠀹󠁿 Flag for Bistrica ob Sotli (SI-149) 🏴󠁳󠁩󠀱󠀴󠀴󠁿 Flag for Zreče (SI-144) 🏴󠁳󠁩󠀱󠀶󠀱󠁿 Flag for Hodoš (SI-161) 🏴󠁳󠁩󠀱󠀶󠀰󠁿 Flag for Hoče–Slivnica (SI-160) 🏴󠁳󠁩󠀱󠀵󠀸󠁿 Flag for Grad (SI-158) 🏴󠁳󠁩󠀱󠀷󠀲󠁿 Flag for Podlehnik (SI-172) 🏴󠁳󠁩󠀱󠀹󠀶󠁿 Flag for Cirkulane (SI-196) 🏴󠁳󠁩󠀱󠀷󠀴󠁿 Flag for Prebold (SI-174) 🏴󠁳󠁩󠀱󠀷󠀶󠁿 Flag for Razkrižje (SI-176) 🏴󠁳󠁩󠀱󠀸󠀸󠁿 Flag for Veržej (SI-188) 🏴󠁳󠁩󠀱󠀹󠀰󠁿 Flag for Žalec (SI-190) 🏴󠁳󠁩󠀱󠀸󠀰󠁿 Flag for Solčava (SI-180) 🏴󠁳󠁩󠀱󠀸󠀱󠁿 Flag for Sveta Ana (SI-181) 🏴󠁳󠁩󠀱󠀸󠀳󠁿 Flag for Šempeter–Vrtojba (SI-183) 🏴󠁳󠁩󠀱󠀸󠀵󠁿 Flag for Trnovska Vas (SI-185) 🏴󠁳󠁩󠀱󠀷󠀹󠁿 Flag for Sodražica (SI-179) 🏴󠁳󠁩󠀱󠀹󠀸󠁿 Flag for Makole (SI-198) 🏴󠁳󠁩󠀲󠀰󠀳󠁿 Flag for Straža (SI-203) 🏴󠁳󠁩󠀱󠀷󠀸󠁿 Flag for Selnica ob Dravi (SI-178) 🏴󠁳󠁩󠀱󠀹󠀳󠁿 Flag for Žužemberk (SI-193) 🏴󠁳󠁩󠀱󠀹󠀷󠁿 Flag for Kostanjevica na Krki (SI-197) 🏴󠁳󠁩󠀱󠀷󠀵󠁿 Flag for Prevalje (SI-175) 🏴󠁳󠁩󠀱󠀹󠀴󠁿 Flag for Šmartno pri Litiji (SI-194) 🏴󠁳󠁩󠀱󠀹󠀱󠁿 Flag for Žetale (SI-191) 🏴󠁳󠁩󠀱󠀸󠀹󠁿 Flag for Vransko (SI-189) 🏴󠁳󠁩󠀲󠀰󠀱󠁿 Flag for Renče–Vogrsko (SI-201) 🏴󠁳󠁩󠀲󠀰󠀲󠁿 Flag for Središče ob Dravi (SI-202) 🏴󠁳󠁩󠀱󠀸󠀶󠁿 Flag for Trzin (SI-186) 🏴󠁳󠁩󠀲󠀰󠀴󠁿 Flag for Sveta Trojica v Slovenskih Goricah (SI-204) 🏴󠁳󠁩󠀲󠀰󠀵󠁿 Flag for Sveti Tomaž (SI-205) 🏴󠁳󠁩󠀱󠀷󠀷󠁿 Flag for Ribnica na Pohorju (SI-177) 🏴󠁳󠁩󠀲󠀰󠀷󠁿 Flag for Gorje (SI-207) 🏴󠁳󠁩󠀱󠀸󠀴󠁿 Flag for Tabor (SI-184) 🏴󠁳󠁩󠀱󠀹󠀹󠁿 Flag for Mokronog–Trebelno (SI-199) 🏴󠁳󠁩󠀱󠀷󠀳󠁿 Flag for Polzela (SI-173) 🏴󠁳󠁩󠀲󠀰󠀰󠁿 Flag for Poljčane (SI-200) 🏴󠁳󠁩󠀱󠀹󠀵󠁿 Flag for Apače (SI-195) 🏴󠁳󠁩󠀱󠀸󠀷󠁿 Flag for Velika Polana (SI-187) 🏴󠁳󠁫󠁴󠁡󠁿 Flag for Trnava (SK-TA) 🏴󠁳󠁩󠀲󠀰󠀹󠁿 Flag for Rečica ob Savinji (SI-209) 🏴󠁳󠁭󠀰󠀹󠁿 Flag for Serravalle (SM-09) 🏴󠁳󠁭󠀰󠀲󠁿 Flag for Chiesanuova (SM-02) 🏴󠁳󠁮󠁫󠁡󠁿 Flag for Kaffrine (SN-KA) 🏴󠁳󠁫󠁮󠁩󠁿 Flag for Nitra (SK-NI) 🏴󠁳󠁩󠀲󠀱󠀱󠁿 Flag for Šentrupert (SI-211) 🏴󠁳󠁭󠀰󠀶󠁿 Flag for Borgo Maggiore (SM-06) 🏴󠁳󠁫󠁫󠁩󠁿 Flag for Košice (SK-KI) 🏴󠁳󠁫󠁢󠁣󠁿 Flag for Banská Bystrica (SK-BC) 🏴󠁳󠁭󠀰󠀸󠁿 Flag for Montegiardino (SM-08) 🏴󠁳󠁮󠁤󠁫󠁿 Flag for Dakar (SN-DK) 🏴󠁳󠁫󠁰󠁶󠁿 Flag for Prešov (SK-PV) 🏴󠁳󠁩󠀲󠀱󠀲󠁿 Flag for Mirna (SI-212) 🏴󠁳󠁭󠀰󠀵󠁿 Flag for Fiorentino (SM-05) 🏴󠁳󠁮󠁴󠁨󠁿 Flag for Thiès (SN-TH) 🏴󠁳󠁩󠀲󠀱󠀳󠁿 Flag for Ankaran (SI-213) 🏴󠁳󠁮󠁴󠁣󠁿 Flag for Tambacounda (SN-TC) 🏴󠁳󠁮󠁦󠁫󠁿 Flag for Fatick (SN-FK) 🏴󠁳󠁫󠁴󠁣󠁿 Flag for Trenčín (SK-TC) 🏴󠁳󠁮󠁫󠁬󠁿 Flag for Kaolack (SN-KL) 🏴󠁳󠁭󠀰󠀴󠁿 Flag for Faetano (SM-04) 🏴󠁳󠁫󠁺󠁩󠁿 Flag for Žilina (SK-ZI) 🏴󠁳󠁬󠁳󠁿 Flag for Southern (SL-S) 🏴󠁳󠁮󠁳󠁥󠁿 Flag for Sédhiou (SN-SE) 🏴󠁳󠁫󠁢󠁬󠁿 Flag for Bratislava (SK-BL) 🏴󠁳󠁮󠁤󠁢󠁿 Flag for Diourbel (SN-DB) 🏴󠁳󠁮󠁫󠁥󠁿 Flag for Kédougou (SN-KE) 🏴󠁳󠁬󠁮󠁿 Flag for Northern (SL-N) 🏴󠁳󠁬󠁷󠁿 Flag for Western Area (SL-W) 🏴󠁳󠁮󠁭󠁴󠁿 Flag for Matam (SN-MT) 🏴󠁳󠁬󠁥󠁿 Flag for Eastern (SL-E) 🏴󠁳󠁭󠀰󠀱󠁿 Flag for Acquaviva (SM-01) 🏴󠁳󠁮󠁫󠁤󠁿 Flag for Kolda (SN-KD) 🏴󠁳󠁮󠁳󠁬󠁿 Flag for Saint-Louis (SN-SL) 🏴󠁳󠁭󠀰󠀷󠁿 Flag for San Marino (SM-07) 🏴󠁳󠁮󠁬󠁧󠁿 Flag for Louga (SN-LG) 🏴󠁳󠁭󠀰󠀳󠁿 Flag for Domagnano (SM-03) 🏴󠁳󠁳󠁥󠁥󠁿 Flag for Eastern Equatoria (SS-EE) 🏴󠁳󠁲󠁳󠁡󠁿 Flag for Saramacca (SR-SA) 👩🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁳󠁲󠁭󠁡󠁿 Flag for Marowijne (SR-MA) 🏴󠁳󠁯󠁪󠁤󠁿 Flag for Middle Juba (SO-JD) 🏴󠁳󠁯󠁭󠁵󠁿 Flag for Mudug (SO-MU) 🏴󠁳󠁯󠁳󠁨󠁿 Flag for Lower Shebelle (SO-SH) 🏴󠁳󠁯󠁨󠁩󠁿 Flag for Hiran (SO-HI) 🏴󠁳󠁳󠁥󠁣󠁿 Flag for Central Equatoria (SS-EC) 🏴󠁳󠁮󠁺󠁧󠁿 Flag for Ziguinchor (SN-ZG) 🏴󠁳󠁲󠁣󠁲󠁿 Flag for Coronie (SR-CR) 🏴󠁳󠁯󠁳󠁤󠁿 Flag for Middle Shebelle (SO-SD) 🏴󠁳󠁳󠁮󠁵󠁿 Flag for Upper Nile (SS-NU) 🏴󠁳󠁲󠁷󠁡󠁿 Flag for Wanica (SR-WA) 🏴󠁳󠁯󠁡󠁷󠁿 Flag for Awdal (SO-AW) 🏴󠁳󠁯󠁳󠁡󠁿 Flag for Sanaag (SO-SA) 🏴󠁳󠁯󠁪󠁨󠁿 Flag for Lower Juba (SO-JH) 🏴󠁳󠁳󠁬󠁫󠁿 Flag for Lakes (SS-LK) 🏴󠁳󠁳󠁷󠁲󠁿 Flag for Warrap (SS-WR) 🏴󠁳󠁴󠁰󠁿 Flag for Príncipe (ST-P) 🏴󠁳󠁲󠁳󠁩󠁿 Flag for Sipaliwini (SR-SI) 🏴󠁳󠁳󠁢󠁷󠁿 Flag for Western Bahr el Ghazal (SS-BW) 🏴󠁳󠁳󠁥󠁷󠁿 Flag for Western Equatoria (SS-EW) 🏴󠁳󠁯󠁢󠁲󠁿 Flag for Bari (SO-BR) 🏴󠁳󠁳󠁪󠁧󠁿 Flag for Jonglei (SS-JG) 🏴󠁳󠁲󠁰󠁭󠁿 Flag for Paramaribo (SR-PM) 🏴󠁳󠁲󠁣󠁭󠁿 Flag for Commewijne (SR-CM) 🏴󠁳󠁯󠁧󠁡󠁿 Flag for Galguduud (SO-GA) 🏴󠁳󠁲󠁮󠁩󠁿 Flag for Nickerie (SR-NI) 🏴󠁳󠁲󠁰󠁲󠁿 Flag for Para (SR-PR) 🏴󠁳󠁯󠁷󠁯󠁿 Flag for Woqooyi Galbeed (SO-WO) 🏴󠁳󠁯󠁧󠁥󠁿 Flag for Gedo (SO-GE) 🏴󠁳󠁯󠁢󠁹󠁿 Flag for Bay, Somalia (SO-BY) 🏴󠁳󠁲󠁢󠁲󠁿 Flag for Brokopondo (SR-BR) 🏴󠁳󠁯󠁮󠁵󠁿 Flag for Nugal (SO-NU) 🏴󠁳󠁯󠁴󠁯󠁿 Flag for Togdheer (SO-TO) 🏴󠁳󠁯󠁢󠁫󠁿 Flag for Bakool (SO-BK) 🏴󠁳󠁯󠁳󠁯󠁿 Flag for Sool (SO-SO) 🏴󠁳󠁺󠁨󠁨󠁿 Flag for Hhohho (SZ-HH) 🏴󠁴󠁤󠁥󠁯󠁿 Flag for Ennedi-Ouest (TD-EO) 🏴󠁴󠁤󠁧󠁲󠁿 Flag for Guéra (TD-GR) 🏴󠁳󠁺󠁳󠁨󠁿 Flag for Shiselweni (SZ-SH) 🏴󠁳󠁹󠁤󠁲󠁿 Flag for Daraa (SY-DR) 🏴󠁳󠁹󠁲󠁡󠁿 Flag for Ar-Raqqah (SY-RA) 🏴󠁳󠁶󠁳󠁯󠁿 Flag for Sonsonate (SV-SO) 🏴󠁳󠁶󠁵󠁮󠁿 Flag for La Unión (SV-UN) 🏴󠁳󠁶󠁳󠁭󠁿 Flag for San Miguel (SV-SM) 🏴󠁳󠁶󠁭󠁯󠁿 Flag for Morazán (SV-MO) 🏴󠁳󠁶󠁳󠁳󠁿 Flag for San Salvador (SV-SS) 🏴󠁳󠁹󠁤󠁹󠁿 Flag for Deir ez-Zor (SY-DY) 🏴󠁳󠁶󠁣󠁡󠁿 Flag for Cabañas (SV-CA) 🏴󠁳󠁺󠁬󠁵󠁿 Flag for Lubombo (SZ-LU) 🏴󠁳󠁶󠁣󠁨󠁿 Flag for Chalatenango (SV-CH) 🏴󠁳󠁹󠁲󠁤󠁿 Flag for Rif Dimashq (SY-RD) 🏴󠁳󠁹󠁴󠁡󠁿 Flag for Tartus (SY-TA) 🏴󠁴󠁤󠁢󠁯󠁿 Flag for Borkou (TD-BO) 🏴󠁳󠁺󠁭󠁡󠁿 Flag for Manzini (SZ-MA) 🏴󠁴󠁤󠁢󠁡󠁿 Flag for Batha (TD-BA) 🏴󠁳󠁹󠁨󠁩󠁿 Flag for Homs (SY-HI) 🏴󠁴󠁤󠁥󠁥󠁿 Flag for Ennedi-Est (TD-EE) 🏴󠁴󠁤󠁢󠁧󠁿 Flag for Bahr el Gazel (TD-BG) 🏴󠁴󠁤󠁫󠁡󠁿 Flag for Kanem (TD-KA) 🏴󠁳󠁹󠁨󠁭󠁿 Flag for Hama (SY-HM) 🏴󠁳󠁹󠁬󠁡󠁿 Flag for Latakia (SY-LA) 🏴󠁳󠁹󠁩󠁤󠁿 Flag for Idlib (SY-ID) 🏴󠁳󠁶󠁬󠁩󠁿 Flag for La Libertad (SV-LI) 🏴󠁳󠁹󠁨󠁬󠁿 Flag for Aleppo (SY-HL) 🏴󠁳󠁶󠁡󠁨󠁿 Flag for Ahuachapán (SV-AH) 🏴󠁴󠁤󠁣󠁢󠁿 Flag for Chari-Baguirmi (TD-CB) 🏴󠁳󠁶󠁰󠁡󠁿 Flag for La Paz (SV-PA) 🏴󠁳󠁹󠁳󠁵󠁿 Flag for As-Suwayda (SY-SU) 🏴󠁳󠁹󠁤󠁩󠁿 Flag for Damascus (SY-DI) 🏴󠁳󠁹󠁱󠁵󠁿 Flag for Quneitra (SY-QU) 🏴󠁳󠁹󠁨󠁡󠁿 Flag for Al-Hasakah (SY-HA) 🏴󠁳󠁶󠁳󠁡󠁿 Flag for Santa Ana (SV-SA) 🏴󠁳󠁶󠁣󠁵󠁿 Flag for Cuscatlán (SV-CU) 🏴󠁴󠁤󠁬󠁯󠁿 Flag for Logone Occidental (TD-LO) 🏴󠁴󠁨󠀲󠀲󠁿 Flag for Chanthaburi (TH-22) 🏴󠁴󠁤󠁭󠁥󠁿 Flag for Mayo-Kebbi Est (TD-ME) 🏴󠁴󠁤󠁭󠁣󠁿 Flag for Moyen-Chari (TD-MC) 🏴󠁴󠁤󠁬󠁲󠁿 Flag for Logone Oriental (TD-LR) 🏴󠁴󠁧󠁳󠁿 Flag for Savanes (TG-S) 🏴󠁴󠁨󠀱󠀴󠁿 Flag for Phra Nakhon Si Ayutthaya (TH-14) 🏴󠁴󠁧󠁣󠁿 Flag for Centrale (TG-C) 🏴󠁴󠁨󠀲󠀷󠁿 Flag for Sa Kaeo (TH-27) 🏴󠁴󠁨󠀱󠀲󠁿 Flag for Nonthaburi (TH-12) 🏴󠁴󠁨󠀳󠀱󠁿 Flag for Buri Ram (TH-31) 🏴󠁴󠁨󠀲󠀰󠁿 Flag for Chon Buri (TH-20) 🏴󠁴󠁤󠁳󠁩󠁿 Flag for Sila (TD-SI) 🏴󠁴󠁤󠁬󠁣󠁿 Flag for Lac (TD-LC) 🏴󠁴󠁨󠀲󠀱󠁿 Flag for Rayong (TH-21) 🏴󠁴󠁨󠀲󠀵󠁿 Flag for Prachin Buri (TH-25) 🏴󠁴󠁨󠀳󠀰󠁿 Flag for Nakhon Ratchasima (TH-30) 🏴󠁴󠁧󠁫󠁿 Flag for Kara (TG-K) 🏴󠁴󠁨󠀱󠀵󠁿 Flag for Ang Thong (TH-15) 🏴󠁴󠁨󠀱󠀰󠁿 Flag for Bangkok (TH-10) 🏴󠁴󠁤󠁭󠁡󠁿 Flag for Mandoul (TD-MA) 🏴󠁴󠁨󠀱󠀳󠁿 Flag for Pathum Thani (TH-13) 🏴󠁴󠁨󠀲󠀴󠁿 Flag for Chachoengsao (TH-24) 🏴󠁴󠁨󠀱󠀷󠁿 Flag for Sing Buri (TH-17) 🏴󠁴󠁤󠁭󠁯󠁿 Flag for Mayo-Kebbi Ouest (TD-MO) 🏴󠁴󠁤󠁯󠁤󠁿 Flag for Ouaddaï (TD-OD) 🏴󠁴󠁨󠀳󠀲󠁿 Flag for Surin (TH-32) 🏴󠁴󠁨󠀲󠀶󠁿 Flag for Nakhon Nayok (TH-26) 🏴󠁴󠁤󠁳󠁡󠁿 Flag for Salamat (TD-SA) 🏴󠁴󠁤󠁴󠁡󠁿 Flag for Tandjilé (TD-TA) 🏴󠁴󠁤󠁷󠁦󠁿 Flag for Wadi Fira (TD-WF) 🏴󠁴󠁨󠀱󠀹󠁿 Flag for Saraburi (TH-19) 🏴󠁴󠁨󠀱󠀱󠁿 Flag for Samut Prakan (TH-11) 🏴󠁴󠁤󠁴󠁩󠁿 Flag for Tibesti (TD-TI) 🏴󠁴󠁧󠁰󠁿 Flag for Plateaux (TG-P) 🏴󠁴󠁤󠁮󠁤󠁿 Flag for N’Djamena (TD-ND) 🏴󠁴󠁨󠀱󠀸󠁿 Flag for Chai Nat (TH-18) 🏴󠁴󠁨󠀶󠀲󠁿 Flag for Kamphaeng Phet (TH-62) 🏴󠁴󠁨󠀷󠀲󠁿 Flag for Suphanburi (TH-72) 🏴󠁴󠁨󠀷󠀴󠁿 Flag for Samut Sakhon (TH-74) 🏴󠁴󠁨󠀶󠀷󠁿 Flag for Phetchabun (TH-67) 🏴󠁴󠁨󠀷󠀱󠁿 Flag for Kanchanaburi (TH-71) 🏴󠁴󠁨󠀵󠀴󠁿 Flag for Phrae (TH-54) 🏴󠁴󠁨󠀶󠀳󠁿 Flag for Tak (TH-63) 🏴󠁴󠁨󠀴󠀸󠁿 Flag for Nakhon Phanom (TH-48) 🏴󠁴󠁨󠀵󠀲󠁿 Flag for Lampang (TH-52) 🏴󠁴󠁨󠀵󠀸󠁿 Flag for Mae Hong Son (TH-58) 🏴󠁴󠁨󠀴󠀷󠁿 Flag for Sakon Nakhon (TH-47) 🏴󠁴󠁨󠀵󠀶󠁿 Flag for Phayao (TH-56) 🏴󠁴󠁨󠀴󠀱󠁿 Flag for Udon Thani (TH-41) 🏴󠁴󠁨󠀴󠀹󠁿 Flag for Mukdahan (TH-49) 🏴󠁴󠁨󠀷󠀳󠁿 Flag for Nakhon Pathom (TH-73) 🏴󠁴󠁨󠀵󠀰󠁿 Flag for Chiang Mai (TH-50) 🏴󠁴󠁨󠀴󠀰󠁿 Flag for Khon Kaen (TH-40) 🏴󠁴󠁨󠀳󠀷󠁿 Flag for Amnat Charoen (TH-37) 🏴󠁴󠁨󠀷󠀰󠁿 Flag for Ratchaburi (TH-70) 🏴󠁴󠁨󠀳󠀵󠁿 Flag for Yasothon (TH-35) 🏴󠁴󠁨󠀵󠀱󠁿 Flag for Lamphun (TH-51) 🏴󠁴󠁨󠀴󠀲󠁿 Flag for Loei (TH-42) 🏴󠁴󠁨󠀶󠀰󠁿 Flag for Nakhon Sawan (TH-60) 🏴󠁴󠁨󠀳󠀴󠁿 Flag for Ubon Ratchathani (TH-34) 🏴󠁴󠁨󠀴󠀴󠁿 Flag for Maha Sarakham (TH-44) 🏴󠁴󠁨󠀴󠀵󠁿 Flag for Roi Et (TH-45) 🏴󠁴󠁨󠀴󠀶󠁿 Flag for Kalasin (TH-46) 🏴󠁴󠁨󠀶󠀶󠁿 Flag for Phichit (TH-66) 🏴󠁴󠁨󠀵󠀵󠁿 Flag for Nan (TH-55) 🏴󠁴󠁨󠀶󠀱󠁿 Flag for Uthai Thani (TH-61) 🏴󠁴󠁨󠀳󠀸󠁿 Flag for Bueng Kan (TH-38) 🏴󠁴󠁨󠀳󠀳󠁿 Flag for Si Sa Ket (TH-33) 🏴󠁴󠁨󠀳󠀹󠁿 Flag for Nong Bua Lam Phu (TH-39) 🏴󠁴󠁨󠀵󠀳󠁿 Flag for Uttaradit (TH-53) 🏴󠁴󠁨󠀵󠀷󠁿 Flag for Chiang Rai (TH-57) 🏴󠁴󠁨󠀶󠀴󠁿 Flag for Sukhothai (TH-64) 🏴󠁴󠁨󠀴󠀳󠁿 Flag for Nong Khai (TH-43) 🏴󠁴󠁨󠀶󠀵󠁿 Flag for Phitsanulok (TH-65) 🏴󠁴󠁬󠁥󠁲󠁿 Flag for Ermera (TL-ER) 🏴󠁴󠁬󠁯󠁥󠁿 Flag for Oecusse (TL-OE) 🏴󠁴󠁬󠁬󠁩󠁿 Flag for Liquiçá (TL-LI) 🏴󠁴󠁬󠁡󠁬󠁿 Flag for Aileu (TL-AL) 🏴󠁴󠁭󠁡󠁿 Flag for Ahal (TM-A) 🏴󠁴󠁨󠀸󠀴󠁿 Flag for Surat Thani (TH-84) 🏴󠁴󠁨󠀷󠀶󠁿 Flag for Phetchaburi (TH-76) 🏴󠁴󠁬󠁢󠁯󠁿 Flag for Bobonaro (TL-BO) 🏴󠁴󠁬󠁭󠁴󠁿 Flag for Manatuto (TL-MT) 🏴󠁴󠁪󠁫󠁴󠁿 Flag for Khatlon (TJ-KT) 🏴󠁴󠁬󠁡󠁮󠁿 Flag for Ainaro (TL-AN) 🏴󠁴󠁨󠀸󠀲󠁿 Flag for Phang Nga (TH-82) 🏴󠁴󠁬󠁣󠁯󠁿 Flag for Cova Lima (TL-CO) 🏴󠁴󠁮󠀱󠀱󠁿 Flag for Tunis (TN-11) 🏴󠁴󠁨󠀸󠀵󠁿 Flag for Ranong (TH-85) 🏴󠁴󠁨󠀸󠀰󠁿 Flag for Nakhon Si Thammarat (TH-80) 🏴󠁴󠁨󠀷󠀷󠁿 Flag for Prachuap Khiri Khan (TH-77) 🏴󠁴󠁪󠁤󠁵󠁿 Flag for Dushanbe (TJ-DU) 🏴󠁴󠁨󠀹󠀵󠁿 Flag for Yala (TH-95) 🏴󠁴󠁨󠀹󠀰󠁿 Flag for Songkhla (TH-90) 🏴󠁴󠁭󠁬󠁿 Flag for Lebap (TM-L) 🏴󠁴󠁨󠀹󠀶󠁿 Flag for Narathiwat (TH-96) 🏴󠁴󠁭󠁭󠁿 Flag for Mary (TM-M) 🏴󠁴󠁬󠁭󠁦󠁿 Flag for Manufahi (TL-MF) 👨🏼‍👨🏼‍👦🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁴󠁭󠁢󠁿 Flag for Balkan (TM-B) 🏴󠁴󠁬󠁢󠁡󠁿 Flag for Baucau (TL-BA) 🏴󠁴󠁪󠁲󠁡󠁿 Flag for Nohiyahoi Tobei Jumhurí (TJ-RA) 🏴󠁴󠁨󠀹󠀲󠁿 Flag for Trang (TH-92) 🏴󠁴󠁪󠁳󠁵󠁿 Flag for Sughd (TJ-SU) 🏴󠁴󠁬󠁶󠁩󠁿 Flag for Viqueque (TL-VI) 🏴󠁴󠁨󠀹󠀴󠁿 Flag for Pattani (TH-94) 🏴󠁴󠁨󠀸󠀱󠁿 Flag for Krabi (TH-81) 🏴󠁴󠁬󠁤󠁩󠁿 Flag for Dili (TL-DI) 🏴󠁴󠁨󠀸󠀳󠁿 Flag for Phuket (TH-83) 🏴󠁴󠁨󠀹󠀱󠁿 Flag for Satun (TH-91) 🏴󠁴󠁨󠁳󠁿 Flag for Pattaya (TH-S) 🏴󠁴󠁭󠁤󠁿 Flag for Daşoguz (TM-D) 🏴󠁴󠁮󠀴󠀱󠁿 Flag for Kairouan (TN-41) 🏴󠁴󠁮󠀵󠀲󠁿 Flag for Monastir (TN-52) 🏴󠁴󠁲󠀰󠀹󠁿 Flag for Aydın (TR-09) 🏴󠁴󠁮󠀳󠀱󠁿 Flag for Béja (TN-31) 🏴󠁴󠁲󠀰󠀷󠁿 Flag for Antalya (TR-07) 🏴󠁴󠁮󠀲󠀱󠁿 Flag for Nabeul (TN-21) 🏴󠁴󠁮󠀵󠀳󠁿 Flag for Mahdia (TN-53) 🏴󠁴󠁯󠀰󠀲󠁿 Flag for Haʻapai (TO-02) 🏴󠁴󠁲󠀰󠀵󠁿 Flag for Amasya (TR-05) 🏴󠁴󠁲󠀱󠀳󠁿 Flag for Bitlis (TR-13) 🏴󠁴󠁮󠀱󠀲󠁿 Flag for Ariana (TN-12) 🏴󠁴󠁮󠀷󠀳󠁿 Flag for Kebili (TN-73) 🏴󠁴󠁲󠀰󠀱󠁿 Flag for Adana (TR-01) 🏴󠁴󠁯󠀰󠀱󠁿 Flag for ʻEua (TO-01) 🏴󠁴󠁲󠀱󠀲󠁿 Flag for Bingöl (TR-12) 🏴󠁴󠁮󠀸󠀳󠁿 Flag for Tataouine (TN-83) 🏴󠁴󠁲󠀰󠀸󠁿 Flag for Artvin (TR-08) 🏴󠁴󠁮󠀵󠀱󠁿 Flag for Sousse (TN-51) 🏴󠁴󠁮󠀸󠀱󠁿 Flag for Gabès (TN-81) 🏴󠁴󠁲󠀰󠀴󠁿 Flag for Ağrı (TR-04) 🏴󠁴󠁲󠀱󠀱󠁿 Flag for Bilecik (TR-11) 🏴󠁴󠁮󠀳󠀲󠁿 Flag for Jendouba (TN-32) 🏴󠁴󠁯󠀰󠀴󠁿 Flag for Tongatapu (TO-04) 🏴󠁴󠁲󠀰󠀲󠁿 Flag for Adıyaman (TR-02) 🏴󠁴󠁮󠀳󠀳󠁿 Flag for Kef (TN-33) 🏴󠁴󠁮󠀲󠀲󠁿 Flag for Zaghouan (TN-22) 🏴󠁴󠁲󠀱󠀰󠁿 Flag for Balıkesir (TR-10) 🏴󠁴󠁮󠀱󠀳󠁿 Flag for Ben Arous (TN-13) 🏴󠁴󠁯󠀰󠀳󠁿 Flag for Niuas (TO-03) 🏴󠁴󠁮󠀷󠀲󠁿 Flag for Tozeur (TN-72) 🏴󠁴󠁮󠀱󠀴󠁿 Flag for Manouba (TN-14) 🏴󠁴󠁮󠀴󠀲󠁿 Flag for Kasserine (TN-42) 🏴󠁴󠁲󠀱󠀴󠁿 Flag for Bolu (TR-14) 🏴󠁴󠁮󠀳󠀴󠁿 Flag for Siliana (TN-34) 🏴󠁴󠁯󠀰󠀵󠁿 Flag for Vavaʻu (TO-05) 🏴󠁴󠁲󠀰󠀶󠁿 Flag for Ankara (TR-06) 🏴󠁴󠁮󠀶󠀱󠁿 Flag for Sfax (TN-61) 🏴󠁴󠁮󠀴󠀳󠁿 Flag for Sidi Bouzid (TN-43) 🏴󠁴󠁮󠀸󠀲󠁿 Flag for Medenine (TN-82) 🏴󠁴󠁮󠀲󠀳󠁿 Flag for Bizerte (TN-23) 🏴󠁴󠁲󠀲󠀴󠁿 Flag for Erzincan (TR-24) 🏴󠁴󠁲󠀴󠀶󠁿 Flag for Kahramanmaraş (TR-46) 🏴󠁴󠁲󠀳󠀶󠁿 Flag for Kars (TR-36) 🏴󠁴󠁲󠀵󠀱󠁿 Flag for Niğde (TR-51) 🏴󠁴󠁲󠀳󠀸󠁿 Flag for Kayseri (TR-38) 🏴󠁴󠁲󠀴󠀱󠁿 Flag for Kocaeli (TR-41) 🏴󠁴󠁲󠀱󠀸󠁿 Flag for Çankırı (TR-18) 🏴󠁴󠁲󠀴󠀸󠁿 Flag for Muğla (TR-48) 🏴󠁴󠁲󠀴󠀲󠁿 Flag for Konya (TR-42) 🏴󠁴󠁲󠀴󠀴󠁿 Flag for Malatya (TR-44) 🏴󠁴󠁲󠀲󠀹󠁿 Flag for Gümüşhane (TR-29) 🏴󠁴󠁲󠀲󠀲󠁿 Flag for Edirne (TR-22) 🏴󠁴󠁲󠀳󠀹󠁿 Flag for Kırklareli (TR-39) 🏴󠁴󠁲󠀲󠀷󠁿 Flag for Gaziantep (TR-27) 🏴󠁴󠁲󠀵󠀵󠁿 Flag for Samsun (TR-55) 🏴󠁴󠁲󠀲󠀱󠁿 Flag for Diyarbakır (TR-21) 🏴󠁴󠁲󠀱󠀶󠁿 Flag for Bursa (TR-16) 🏴󠁴󠁲󠀱󠀹󠁿 Flag for Çorum (TR-19) 🏴󠁴󠁲󠀵󠀲󠁿 Flag for Ordu (TR-52) 🏴󠁴󠁲󠀴󠀵󠁿 Flag for Manisa (TR-45) 🏴󠁴󠁲󠀲󠀵󠁿 Flag for Erzurum (TR-25) 🏴󠁴󠁲󠀱󠀵󠁿 Flag for Burdur (TR-15) 🏴󠁴󠁲󠀳󠀲󠁿 Flag for Isparta (TR-32) 🏴󠁴󠁲󠀳󠀴󠁿 Flag for Istanbul (TR-34) 🏴󠁴󠁲󠀳󠀰󠁿 Flag for Hakkâri (TR-30) 🏴󠁴󠁲󠀳󠀱󠁿 Flag for Hatay (TR-31) 🏴󠁴󠁲󠀴󠀹󠁿 Flag for Muş (TR-49) 🏴󠁴󠁲󠀳󠀳󠁿 Flag for Mersin (TR-33) 🏴󠁴󠁲󠀵󠀶󠁿 Flag for Siirt (TR-56) 🏴󠁴󠁲󠀵󠀰󠁿 Flag for Nevşehir (TR-50) 🏴󠁴󠁲󠀲󠀳󠁿 Flag for Elazığ (TR-23) 🏴󠁴󠁲󠀲󠀸󠁿 Flag for Giresun (TR-28) 🏴󠁴󠁲󠀲󠀰󠁿 Flag for Denizli (TR-20) 🏴󠁴󠁲󠀴󠀷󠁿 Flag for Mardin (TR-47) 🏴󠁴󠁲󠀳󠀷󠁿 Flag for Kastamonu (TR-37) 🏴󠁴󠁲󠀵󠀴󠁿 Flag for Sakarya (TR-54) 🏴󠁴󠁲󠀴󠀰󠁿 Flag for Kırşehir (TR-40) 🏴󠁴󠁲󠀱󠀷󠁿 Flag for Çanakkale (TR-17) 🏴󠁴󠁲󠀵󠀳󠁿 Flag for Rize (TR-53) 🏴󠁴󠁲󠀲󠀶󠁿 Flag for Eskişehir (TR-26) 🏴󠁴󠁲󠀶󠀵󠁿 Flag for Van (TR-65) 🏴󠁴󠁴󠁰󠁲󠁴󠁿 Flag for Princes Town (TT-PRT) 🏴󠁴󠁴󠁣󠁴󠁴󠁿 Flag for Couva-Tabaquite-Talparo (TT-CTT) 🏴󠁴󠁴󠁴󠁯󠁢󠁿 Flag for Tobago (TT-TOB) 🏴󠁴󠁲󠀶󠀳󠁿 Flag for Şanlıurfa (TR-63) 🏴󠁴󠁴󠁡󠁲󠁩󠁿 Flag for Arima (TT-ARI) 🏴󠁴󠁲󠀶󠀷󠁿 Flag for Zonguldak (TR-67) 🏴󠁴󠁴󠁳󠁩󠁰󠁿 Flag for Siparia (TT-SIP) 🏴󠁴󠁲󠀷󠀵󠁿 Flag for Ardahan (TR-75) 🏴󠁴󠁲󠀷󠀹󠁿 Flag for Kilis (TR-79) 🏴󠁴󠁴󠁰󠁯󠁳󠁿 Flag for Port of Spain (TT-POS) 🏴󠁴󠁲󠀶󠀸󠁿 Flag for Aksaray (TR-68) 🏴󠁴󠁴󠁤󠁭󠁮󠁿 Flag for Diego Martin (TT-DMN) 🏴󠁴󠁲󠀶󠀹󠁿 Flag for Bayburt (TR-69) 🏴󠁴󠁲󠀵󠀹󠁿 Flag for Tekirdağ (TR-59) 🏴󠁴󠁲󠀷󠀲󠁿 Flag for Batman (TR-72) 🏴󠁴󠁴󠁣󠁨󠁡󠁿 Flag for Chaguanas (TT-CHA) 🏴󠁴󠁲󠀸󠀰󠁿 Flag for Osmaniye (TR-80) 🏴󠁴󠁲󠀷󠀷󠁿 Flag for Yalova (TR-77) 🏴󠁴󠁴󠁳󠁪󠁬󠁿 Flag for San Juan-Laventille (TT-SJL) 🏴󠁴󠁲󠀷󠀸󠁿 Flag for Karabük (TR-78) 🏴󠁴󠁲󠀶󠀶󠁿 Flag for Yozgat (TR-66) 🏴󠁴󠁴󠁭󠁲󠁣󠁿 Flag for Mayaro-Rio Claro (TT-MRC) 🏴󠁴󠁲󠀶󠀴󠁿 Flag for Uşak (TR-64) 🏴󠁴󠁲󠀵󠀷󠁿 Flag for Sinop (TR-57) 🏴󠁴󠁴󠁴󠁵󠁰󠁿 Flag for Tunapuna-Piarco (TT-TUP) 🏴󠁴󠁲󠀷󠀴󠁿 Flag for Bartın (TR-74) 🏴󠁴󠁲󠀷󠀱󠁿 Flag for Kırıkkale (TR-71) 🏴󠁴󠁴󠁰󠁥󠁤󠁿 Flag for Penal-Debe (TT-PED) 🏴󠁴󠁲󠀷󠀶󠁿 Flag for Iğdır (TR-76) 🏴󠁴󠁲󠀷󠀳󠁿 Flag for Şırnak (TR-73) 🏴󠁴󠁲󠀶󠀱󠁿 Flag for Trabzon (TR-61) 🏴󠁴󠁴󠁰󠁴󠁦󠁿 Flag for Point Fortin (TT-PTF) 🏴󠁴󠁲󠀶󠀲󠁿 Flag for Tunceli (TR-62) 🏴󠁴󠁲󠀶󠀰󠁿 Flag for Tokat (TR-60) 🏴󠁴󠁲󠀷󠀰󠁿 Flag for Karaman (TR-70) 🏴󠁴󠁴󠁳󠁦󠁯󠁿 Flag for San Fernando (TT-SFO) 🏴󠁴󠁲󠀵󠀸󠁿 Flag for Sivas (TR-58) 🏴󠁴󠁺󠀰󠀷󠁿 Flag for Zanzibar North (TZ-07) 🏴󠁴󠁷󠁣󠁨󠁡󠁿 Flag for Changhua (TW-CHA) 🏴󠁴󠁶󠁶󠁡󠁩󠁿 Flag for Vaitupu (TV-VAI) 🏴󠁴󠁷󠁫󠁨󠁨󠁿 Flag for Kaohsiung (TW-KHH) 🏴󠁴󠁺󠀰󠀹󠁿 Flag for Kilimanjaro (TZ-09) 🏴󠁴󠁷󠁫󠁩󠁮󠁿 Flag for Kinmen (TW-KIN) 🏴󠁴󠁷󠁰󠁥󠁮󠁿 Flag for Penghu (TW-PEN) 🏴󠁴󠁷󠁴󠁮󠁮󠁿 Flag for Tainan (TW-TNN) 🏴󠁴󠁶󠁮󠁫󠁦󠁿 Flag for Nukufetau (TV-NKF) 🏴󠁴󠁺󠀰󠀸󠁿 Flag for Kigoma (TZ-08) 🏴󠁴󠁷󠁴󠁰󠁥󠁿 Flag for Taipei (TW-TPE) 🏴󠁴󠁷󠁰󠁩󠁦󠁿 Flag for Pingtung (TW-PIF) 🏴󠁴󠁷󠁩󠁬󠁡󠁿 Flag for Yilan (TW-ILA) 🏴󠁴󠁷󠁴󠁡󠁯󠁿 Flag for Taoyuan (TW-TAO) 🏴󠁴󠁺󠀰󠀳󠁿 Flag for Dodoma (TZ-03) 🏴󠁴󠁶󠁮󠁵󠁩󠁿 Flag for Nui (TV-NUI) 🏴󠁴󠁶󠁮󠁩󠁴󠁿 Flag for Niutao (TV-NIT) 🏴󠁴󠁺󠀰󠀶󠁿 Flag for North Pemba (TZ-06) 🏴󠁴󠁷󠁮󠁷󠁴󠁿 Flag for New Taipei (TW-NWT) 🏴󠁴󠁺󠀰󠀴󠁿 Flag for Iringa (TZ-04) 🏴󠁴󠁺󠀰󠀵󠁿 Flag for Kagera (TZ-05) 🏴󠁴󠁷󠁹󠁵󠁮󠁿 Flag for Yunlin (TW-YUN) 🏴󠁴󠁷󠁬󠁩󠁥󠁿 Flag for Lienchiang (TW-LIE) 🏴󠁴󠁶󠁮󠁭󠁧󠁿 Flag for Nanumanga (TV-NMG) 🏴󠁴󠁺󠀰󠀲󠁿 Flag for Dar es Salaam (TZ-02) 🏴󠁴󠁶󠁮󠁭󠁡󠁿 Flag for Nanumea (TV-NMA) 🏴󠁴󠁷󠁴󠁴󠁴󠁿 Flag for Taitung (TW-TTT) 🏴󠁴󠁷󠁮󠁡󠁮󠁿 Flag for Nantou (TW-NAN) 🏴󠁴󠁷󠁣󠁹󠁱󠁿 Flag for Chiayi (TW-CYQ) 🏴󠁴󠁺󠀰󠀱󠁿 Flag for Arusha (TZ-01) 🏴󠁴󠁷󠁨󠁵󠁡󠁿 Flag for Hualien (TW-HUA) 🏴󠁴󠁷󠁣󠁹󠁩󠁿 Flag for Chiayi County (TW-CYI) 🏴󠁴󠁷󠁴󠁸󠁧󠁿 Flag for Taichung (TW-TXG) 🏴󠁴󠁷󠁫󠁥󠁥󠁿 Flag for Keelung (TW-KEE) 🏴󠁴󠁷󠁭󠁩󠁡󠁿 Flag for Miaoli (TW-MIA) 🏴󠁵󠁡󠀴󠀳󠁿 Flag for Crimea (UA-43) 🏴󠁴󠁺󠀱󠀲󠁿 Flag for Lindi (TZ-12) 🏴󠁴󠁺󠀲󠀶󠁿 Flag for Manyara (TZ-26) 🏴󠁵󠁡󠀰󠀹󠁿 Flag for Luhanshchyna (UA-09) 🏴󠁴󠁺󠀲󠀰󠁿 Flag for Rukwa (TZ-20) 🏴󠁵󠁡󠀱󠀲󠁿 Flag for Dnipropetrovshchyna (UA-12) 🏴󠁵󠁡󠀰󠀷󠁿 Flag for Volyn (UA-07) 🏴󠁴󠁺󠀲󠀲󠁿 Flag for Shinyanga (TZ-22) 🏴󠁵󠁡󠀰󠀵󠁿 Flag for Vinnychchyna (UA-05) 🏴󠁴󠁺󠀲󠀱󠁿 Flag for Ruvuma (TZ-21) 🏴󠁴󠁺󠀲󠀸󠁿 Flag for Katavi (TZ-28) 🏴󠁵󠁡󠀲󠀳󠁿 Flag for Zaporizhzhya (UA-23) 🏴󠁵󠁡󠀳󠀲󠁿 Flag for Kyivshchyna (UA-32) 🏴󠁴󠁺󠀲󠀳󠁿 Flag for Singida (TZ-23) 🏴󠁴󠁺󠀲󠀴󠁿 Flag for Tabora (TZ-24) 🏴󠁴󠁺󠀱󠀳󠁿 Flag for Mara (TZ-13) 🏴󠁴󠁺󠀲󠀷󠁿 Flag for Geita (TZ-27) 🏴󠁴󠁺󠀳󠀰󠁿 Flag for Simiyu (TZ-30) 🏴󠁵󠁡󠀴󠀸󠁿 Flag for Mykolayivschyna (UA-48) 🏴󠁵󠁡󠀳󠀵󠁿 Flag for Kirovohradschyna (UA-35) 🏴󠁵󠁡󠀵󠀶󠁿 Flag for Rivnenshchyna (UA-56) 🏴󠁵󠁡󠀵󠀳󠁿 Flag for Poltavshchyna (UA-53) 🏴󠁴󠁺󠀱󠀴󠁿 Flag for Mbeya (TZ-14) 🏴󠁴󠁺󠀱󠀸󠁿 Flag for Mwanza (TZ-18) 🏴󠁵󠁡󠀲󠀱󠁿 Flag for Zakarpattia (UA-21) 🏴󠁴󠁺󠀱󠀰󠁿 Flag for South Pemba (TZ-10) 🏴󠁴󠁺󠀱󠀹󠁿 Flag for Pwani (TZ-19) 🏴󠁴󠁺󠀱󠀷󠁿 Flag for Mtwara (TZ-17) 🏴󠁵󠁡󠀴󠀰󠁿 Flag for Sevastopol (UA-40) 🏴󠁵󠁡󠀵󠀱󠁿 Flag for Odeshchyna (UA-51) 🏴󠁵󠁡󠀴󠀶󠁿 Flag for Lvivshchyna (UA-46) 🏴󠁵󠁡󠀱󠀴󠁿 Flag for Donechchyna (UA-14) 🏴󠁵󠁡󠀲󠀶󠁿 Flag for Prykarpattia (UA-26) 🏴󠁴󠁺󠀱󠀵󠁿 Flag for Zanzibar Urban/West (TZ-15) 🏴󠁴󠁺󠀱󠀶󠁿 Flag for Morogoro (TZ-16) 🏴󠁴󠁺󠀲󠀹󠁿 Flag for Njombe (TZ-29) 🏴󠁵󠁡󠀷󠀷󠁿 Flag for Chernivtsi Oblast (UA-77) 🏴󠁵󠁭󠀹󠀵󠁿 Flag for Palmyra Atoll (UM-95) 🏴󠁵󠁳󠁫󠁳󠁿 Flag for Kansas (US-KS) 👨🏽‍👨🏽‍👦🏽‍👶🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Boy: Medium Skin Tone, Baby: Medium Skin Tone 🏴󠁵󠁳󠁡󠁺󠁿 Flag for Arizona (US-AZ) 🏴󠁵󠁭󠀶󠀷󠁿 Flag for Johnston Atoll (UM-67) 🏴󠁵󠁡󠀷󠀴󠁿 Flag for Chernihivshchyna (UA-74) 🏴󠁵󠁭󠀸󠀴󠁿 Flag for Howland Island (UM-84) 🏴󠁵󠁳󠁧󠁡󠁿 Flag for Georgia (US-GA) 🏴󠁵󠁳󠁨󠁩󠁿 Flag for Hawaii (US-HI) 🏴󠁵󠁭󠀷󠀱󠁿 Flag for Midway Atoll (UM-71) 🏴󠁵󠁳󠁡󠁳󠁿 Flag for American Samoa (US-AS) 🏴󠁵󠁳󠁣󠁴󠁿 Flag for Connecticut (US-CT) 🏴󠁵󠁳󠁩󠁡󠁿 Flag for Iowa (US-IA) 🏴󠁵󠁡󠀶󠀱󠁿 Flag for Ternopilshchyna (UA-61) 🏴󠁵󠁧󠁮󠁿 Flag for Northern (UG-N) 🏴󠁵󠁳󠁧󠁵󠁿 Flag for Guam (US-GU) 🏴󠁵󠁭󠀸󠀱󠁿 Flag for Baker Island (UM-81) 🏴󠁵󠁧󠁥󠁿 Flag for Eastern (UG-E) 🏴󠁵󠁡󠀶󠀵󠁿 Flag for Khersonshchyna (UA-65) 🏴󠁵󠁡󠀵󠀹󠁿 Flag for Sumshchyna (UA-59) 🏴󠁵󠁳󠁩󠁮󠁿 Flag for Indiana (US-IN) 🏴󠁵󠁳󠁡󠁲󠁿 Flag for Arkansas (US-AR) 🏴󠁵󠁳󠁤󠁥󠁿 Flag for Delaware (US-DE) 🏴󠁵󠁡󠀶󠀳󠁿 Flag for Kharkivshchyna (UA-63) 🏴󠁵󠁳󠁡󠁬󠁿 Flag for Alabama (US-AL) 🏴󠁵󠁧󠁷󠁿 Flag for Western (UG-W) 🏴󠁵󠁡󠀶󠀸󠁿 Flag for Khmelnychchyna (UA-68) 🏴󠁵󠁭󠀷󠀶󠁿 Flag for Navassa Island (UM-76) 🏴󠁵󠁭󠀸󠀶󠁿 Flag for Jarvis Island (UM-86) 🏴󠁵󠁳󠁩󠁤󠁿 Flag for Idaho (US-ID) 🏴󠁵󠁭󠀸󠀹󠁿 Flag for Kingman Reef (UM-89) 🏴󠁵󠁳󠁦󠁬󠁿 Flag for Florida (US-FL) 🏴󠁵󠁭󠀷󠀹󠁿 Flag for Wake Island (UM-79) 🏴󠁵󠁳󠁩󠁬󠁿 Flag for Illinois (US-IL) 🏴󠁵󠁳󠁤󠁣󠁿 Flag for Washington DC (US-DC) 🏴󠁵󠁡󠀷󠀱󠁿 Flag for Cherkashchyna (UA-71) 🏴󠁵󠁳󠁮󠁹󠁿 Flag for New York (US-NY) 👨🏾‍👨🏾‍👦🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁵󠁳󠁮󠁣󠁿 Flag for North Carolina (US-NC) 🏴󠁵󠁳󠁭󠁳󠁿 Flag for Mississippi (US-MS) 🏴󠁵󠁳󠁭󠁡󠁿 Flag for Massachusetts (US-MA) 🏴󠁵󠁳󠁮󠁶󠁿 Flag for Nevada (US-NV) 🏴󠁵󠁳󠁷󠁩󠁿 Flag for Wisconsin (US-WI) 🏴󠁵󠁳󠁭󠁤󠁿 Flag for Maryland (US-MD) 🏴󠁵󠁳󠁮󠁭󠁿 Flag for New Mexico (US-NM) 🏴󠁵󠁳󠁰󠁲󠁿 Flag for Puerto Rico (US-PR) 🏴󠁵󠁳󠁵󠁭󠁿 Flag for U.S. Outlying Islands (US-UM) 🏴󠁵󠁳󠁷󠁹󠁿 Flag for Wyoming (US-WY) 🏴󠁵󠁳󠁯󠁨󠁿 Flag for Ohio (US-OH) 🏴󠁵󠁳󠁫󠁹󠁿 Flag for Kentucky (US-KY) 🏴󠁵󠁳󠁮󠁪󠁿 Flag for New Jersey (US-NJ) 🏴󠁵󠁳󠁯󠁲󠁿 Flag for Oregon (US-OR) 🏴󠁵󠁳󠁭󠁩󠁿 Flag for Michigan (US-MI) 🏴󠁵󠁳󠁶󠁩󠁿 Flag for U.S. Virgin Islands (US-VI) 🏴󠁵󠁳󠁭󠁯󠁿 Flag for Missouri (US-MO) 🏴󠁵󠁳󠁰󠁡󠁿 Flag for Pennsylvania (US-PA) 🏴󠁵󠁳󠁶󠁡󠁿 Flag for Virginia (US-VA) 🏴󠁵󠁹󠁡󠁲󠁿 Flag for Artigas (UY-AR) 🏴󠁵󠁹󠁣󠁡󠁿 Flag for Canelones (UY-CA) 🏴󠁵󠁳󠁷󠁡󠁿 Flag for Washington (US-WA) 🏴󠁵󠁳󠁳󠁣󠁿 Flag for South Carolina (US-SC) 🏴󠁵󠁳󠁭󠁥󠁿 Flag for Maine (US-ME) 🏴󠁵󠁳󠁬󠁡󠁿 Flag for Louisiana (US-LA) 🏴󠁵󠁳󠁭󠁮󠁿 Flag for Minnesota (US-MN) 🏴󠁵󠁳󠁲󠁩󠁿 Flag for Rhode Island (US-RI) 🏴󠁵󠁳󠁷󠁶󠁿 Flag for West Virginia (US-WV) 🏴󠁵󠁳󠁴󠁸󠁿 Flag for Texas (US-TX) 🏴󠁵󠁳󠁵󠁴󠁿 Flag for Utah (US-UT) 🏴󠁵󠁳󠁯󠁫󠁿 Flag for Oklahoma (US-OK) 🏴󠁵󠁳󠁮󠁨󠁿 Flag for New Hampshire (US-NH) 🏴󠁵󠁺󠁳󠁡󠁿 Flag for Samarqand (UZ-SA) 🏴󠁵󠁹󠁭󠁡󠁿 Flag for Maldonado (UY-MA) 🏴󠁵󠁺󠁮󠁧󠁿 Flag for Namangan (UZ-NG) 🏴󠁶󠁣󠀰󠀱󠁿 Flag for Charlotte (VC-01) 🏴󠁵󠁹󠁳󠁡󠁿 Flag for Salto (UY-SA) 🏴󠁵󠁹󠁣󠁬󠁿 Flag for Cerro Largo (UY-CL) 🏴󠁵󠁹󠁴󠁡󠁿 Flag for Tacuarembó (UY-TA) 🏴󠁶󠁥󠁡󠁿 Flag for Capital (VE-A) 🏴󠁶󠁥󠁢󠁿 Flag for Anzoátegui (VE-B) 🏴󠁶󠁣󠀰󠀲󠁿 Flag for Saint Andrew (VC-02) 🏴󠁵󠁹󠁳󠁯󠁿 Flag for Soriano (UY-SO) 🏴󠁵󠁹󠁲󠁯󠁿 Flag for Rocha (UY-RO) 🏴󠁶󠁣󠀰󠀳󠁿 Flag for Saint David (VC-03) 🏴󠁵󠁹󠁳󠁪󠁿 Flag for San José (UY-SJ) 🏴󠁵󠁹󠁦󠁤󠁿 Flag for Florida (UY-FD) 🏴󠁵󠁹󠁣󠁯󠁿 Flag for Colonia (UY-CO) 🏴󠁵󠁹󠁦󠁳󠁿 Flag for Flores (UY-FS) 🏴󠁵󠁺󠁸󠁯󠁿 Flag for Xorazm (UZ-XO) 🏴󠁵󠁹󠁤󠁵󠁿 Flag for Durazno (UY-DU) 🏴󠁵󠁺󠁡󠁮󠁿 Flag for Andijan (UZ-AN) 🏴󠁶󠁥󠁤󠁿 Flag for Aragua (VE-D) 🏴󠁵󠁺󠁳󠁩󠁿 Flag for Sirdaryo (UZ-SI) 🏴󠁵󠁹󠁰󠁡󠁿 Flag for Paysandú (UY-PA) 🏴󠁶󠁣󠀰󠀶󠁿 Flag for Grenadines (VC-06) 🏴󠁵󠁹󠁲󠁶󠁿 Flag for Rivera (UY-RV) 🏴󠁵󠁹󠁬󠁡󠁿 Flag for Lavalleja (UY-LA) 🏴󠁵󠁺󠁳󠁵󠁿 Flag for Surxondaryo (UZ-SU) 🏴󠁵󠁺󠁴󠁯󠁿 Flag for Tashkent Province (UZ-TO) 🏴󠁵󠁺󠁱󠁡󠁿 Flag for Qashqadaryo (UZ-QA) 🏴󠁵󠁹󠁴󠁴󠁿 Flag for Treinta y Tres (UY-TT) 🏴󠁵󠁹󠁭󠁯󠁿 Flag for Montevideo (UY-MO) 🏴󠁵󠁺󠁢󠁵󠁿 Flag for Bukhara (UZ-BU) 🏴󠁵󠁺󠁦󠁡󠁿 Flag for Fergana (UZ-FA) 🏴󠁵󠁺󠁱󠁲󠁿 Flag for Karakalpakstan (UZ-QR) 🏴󠁵󠁺󠁪󠁩󠁿 Flag for Jizzakh (UZ-JI) 🏴󠁵󠁹󠁲󠁮󠁿 Flag for Río Negro (UY-RN) 🏴󠁵󠁺󠁴󠁫󠁿 Flag for Tashkent (UZ-TK) 🏴󠁶󠁣󠀰󠀵󠁿 Flag for Saint Patrick (VC-05) 🏴󠁵󠁺󠁮󠁷󠁿 Flag for Navoiy (UZ-NW) 🏴󠁶󠁥󠁫󠁿 Flag for Lara (VE-K) 🏴󠁶󠁥󠁯󠁿 Flag for Nueva Esparta (VE-O) 🏴󠁶󠁥󠁳󠁿 Flag for Táchira (VE-S) 🏴󠁶󠁥󠁦󠁿 Flag for Bolívar (VE-F) 🏴󠁶󠁮󠀲󠀱󠁿 Flag for Thanh Hóa (VN-21) 🏴󠁶󠁮󠀱󠀴󠁿 Flag for Hòa Bình (VN-14) 🏴󠁶󠁥󠁪󠁿 Flag for Guárico (VE-J) 🏴󠁶󠁥󠁨󠁿 Flag for Cojedes (VE-H) 🏴󠁶󠁮󠀲󠀶󠁿 Flag for Thừa Thiên–Huế (VN-26) 🏴󠁶󠁥󠁰󠁿 Flag for Portuguesa (VE-P) 🏴󠁶󠁮󠀱󠀸󠁿 Flag for Ninh Bình (VN-18) 🏴󠁶󠁥󠁲󠁿 Flag for Sucre (VE-R) 🏴󠁶󠁮󠀰󠀱󠁿 Flag for Lai Châu (VN-01) 🏴󠁶󠁮󠀰󠀹󠁿 Flag for Lạng Sơn (VN-09) 🏴󠁶󠁥󠁭󠁿 Flag for Miranda (VE-M) 🏴󠁶󠁮󠀲󠀴󠁿 Flag for Quảng Bình (VN-24) 🏴󠁶󠁥󠁥󠁿 Flag for Barinas (VE-E) 🏴󠁶󠁥󠁮󠁿 Flag for Monagas (VE-N) 🏴󠁶󠁮󠀲󠀲󠁿 Flag for Nghệ An (VN-22) 🏴󠁶󠁮󠀰󠀲󠁿 Flag for Lào Cai (VN-02) 🏴󠁶󠁮󠀰󠀷󠁿 Flag for Tuyên Quang (VN-07) 🏴󠁶󠁮󠀰󠀵󠁿 Flag for Sơn La (VN-05) 🏴󠁶󠁮󠀲󠀰󠁿 Flag for Thái Bình (VN-20) 🏴󠁶󠁥󠁷󠁿 Flag for Federal Dependencies (VE-W) 🏴󠁶󠁮󠀲󠀹󠁿 Flag for Quảng Ngãi (VN-29) 🏴󠁶󠁥󠁬󠁿 Flag for Mérida (VE-L) 🏴󠁶󠁥󠁩󠁿 Flag for Falcón (VE-I) 🏴󠁶󠁮󠀰󠀴󠁿 Flag for Cao Bằng (VN-04) 🏴󠁶󠁥󠁺󠁿 Flag for Amazonas (VE-Z) 🏴󠁶󠁮󠀰󠀶󠁿 Flag for Yên Bái (VN-06) 🏴󠁶󠁮󠀲󠀳󠁿 Flag for Hà Tĩnh (VN-23) 🏴󠁶󠁮󠀲󠀸󠁿 Flag for Kon Tum (VN-28) 🏴󠁶󠁥󠁸󠁿 Flag for Vargas (VE-X) 🏴󠁶󠁥󠁵󠁿 Flag for Yaracuy (VE-U) 🏴󠁶󠁥󠁴󠁿 Flag for Trujillo (VE-T) 🏴󠁶󠁮󠀱󠀳󠁿 Flag for Quảng Ninh (VN-13) 🏴󠁶󠁮󠀰󠀳󠁿 Flag for Hà Giang (VN-03) 🏴󠁶󠁮󠀲󠀷󠁿 Flag for Quảng Nam (VN-27) 🏴󠁶󠁮󠀵󠀶󠁿 Flag for Bắc Ninh (VN-56) 🏴󠁶󠁮󠀳󠀶󠁿 Flag for Ninh Thuận (VN-36) 🏴󠁶󠁮󠀶󠀹󠁿 Flag for Thái Nguyên (VN-69) 🏴󠁶󠁮󠀶󠀷󠁿 Flag for Nam Định (VN-67) 🏴󠁶󠁮󠀳󠀵󠁿 Flag for Lâm Đồng (VN-35) 🏴󠁶󠁮󠀶󠀱󠁿 Flag for Hải Dương (VN-61) 🏴󠁶󠁮󠀵󠀲󠁿 Flag for Sóc Trăng (VN-52) 🏴󠁶󠁮󠀷󠀳󠁿 Flag for Hậu Giang (VN-73) 🏴󠁶󠁮󠀷󠀰󠁿 Flag for Vĩnh Phúc (VN-70) 🏴󠁶󠁮󠀵󠀰󠁿 Flag for Bến Tre (VN-50) 🏴󠁶󠁮󠀵󠀳󠁿 Flag for Bắc Kạn (VN-53) 🏴󠁶󠁮󠀵󠀴󠁿 Flag for Bắc Giang (VN-54) 🏴󠁶󠁮󠀳󠀳󠁿 Flag for Đắk Lắk (VN-33) 🏴󠁶󠁮󠀵󠀷󠁿 Flag for Bình Dương (VN-57) 🏴󠁶󠁮󠁤󠁮󠁿 Flag for Da Nang (VN-DN) 🏴󠁶󠁮󠀴󠀶󠁿 Flag for Tiền Giang (VN-46) 🏴󠁶󠁮󠀴󠀳󠁿 Flag for Bà Rịa–Vũng Tàu (VN-43) 🏴󠁶󠁮󠀷󠀱󠁿 Flag for Điện Biên (VN-71) 🏴󠁶󠁮󠀵󠀸󠁿 Flag for Bình Phước (VN-58) 🏴󠁶󠁮󠁣󠁴󠁿 Flag for Can Tho (VN-CT) 🏴󠁶󠁮󠀵󠀵󠁿 Flag for Bạc Liêu (VN-55) 🏴󠁶󠁮󠀳󠀲󠁿 Flag for Phú Yên (VN-32) 🏴󠁶󠁮󠀴󠀴󠁿 Flag for An Giang (VN-44) 🏴󠁶󠁮󠀶󠀳󠁿 Flag for Hà Nam (VN-63) 🏴󠁶󠁮󠀵󠀹󠁿 Flag for Cà Mau (VN-59) 🏴󠁶󠁮󠀴󠀷󠁿 Flag for Kiên Giang (VN-47) 🏴󠁶󠁮󠀳󠀴󠁿 Flag for Khánh Hòa (VN-34) 🏴󠁶󠁮󠀴󠀵󠁿 Flag for Đồng Tháp (VN-45) 🏴󠁶󠁮󠀳󠀹󠁿 Flag for Đồng Nai (VN-39) 🏴󠁶󠁮󠁨󠁮󠁿 Flag for Hanoi (VN-HN) 🏴󠁶󠁮󠀴󠀹󠁿 Flag for Vĩnh Long (VN-49) 🏴󠁶󠁮󠀶󠀸󠁿 Flag for Phú Thọ (VN-68) 🏴󠁶󠁮󠀳󠀷󠁿 Flag for Tây Ninh (VN-37) 🏴󠁶󠁮󠀳󠀰󠁿 Flag for Gia Lai (VN-30) 🏴󠁶󠁮󠀷󠀲󠁿 Flag for Đắk Nông (VN-72) 🏴󠁶󠁮󠀴󠀰󠁿 Flag for Bình Thuận (VN-40) 🏴󠁶󠁮󠀴󠀱󠁿 Flag for Long An (VN-41) 🏴󠁶󠁮󠀳󠀱󠁿 Flag for Bình Định (VN-31) 🏴󠁷󠁦󠁵󠁶󠁿 Flag for Uvea (WF-UV) 🏴󠁹󠁥󠁳󠁤󠁿 Flag for Sa’dah (YE-SD) 🏴󠁹󠁥󠁡󠁢󠁿 Flag for Abyan (YE-AB) 🏴󠁹󠁥󠁨󠁪󠁿 Flag for Hajjah (YE-HJ) 🏴󠁶󠁵󠁭󠁡󠁰󠁿 Flag for Malampa (VU-MAP) 🏴󠁷󠁳󠁡󠁴󠁿 Flag for Atua (WS-AT) 🏴󠁷󠁳󠁶󠁦󠁿 Flag for Va’a-o-Fonoti (WS-VF) 🏴󠁹󠁥󠁨󠁵󠁿 Flag for Al Hudaydah (YE-HU) 🏴󠁷󠁳󠁰󠁡󠁿 Flag for Palauli (WS-PA) 🏴󠁷󠁳󠁳󠁡󠁿 Flag for Satupa’itea (WS-SA) 🏴󠁹󠁥󠁤󠁡󠁿 Flag for Dhale (YE-DA) 🏴󠁭󠁬󠀶󠁿 Flag for Tombouctou (ML-6) 🏴󠁹󠁥󠁲󠁡󠁿 Flag for Raymah (YE-RA) 🏴󠁶󠁵󠁳󠁡󠁭󠁿 Flag for Sanma (VU-SAM) 🏴󠁷󠁦󠁡󠁬󠁿 Flag for Alo (WF-AL) 🏴󠁹󠁥󠁭󠁲󠁿 Flag for Al Mahrah (YE-MR) 👨🏻‍👨🏻‍👧🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Girl: Light Skin Tone 🏴󠁹󠁥󠁡󠁤󠁿 Flag for ’Adan (YE-AD) 🏴󠁹󠁥󠁳󠁨󠁿 Flag for Shabwah (YE-SH) 🏴󠁶󠁵󠁴󠁡󠁥󠁿 Flag for Tafea (VU-TAE) 🏴󠁹󠁥󠁡󠁭󠁿 Flag for Amran (YE-AM) 🏴󠁶󠁵󠁰󠁡󠁭󠁿 Flag for Penama (VU-PAM) 🏴󠁹󠁥󠁭󠁷󠁿 Flag for Al Mahwit (YE-MW) 🏴󠁷󠁳󠁧󠁥󠁿 Flag for Gaga’emauga (WS-GE) 🏴󠁹󠁥󠁨󠁤󠁿 Flag for Hadramaut (YE-HD) 🏴󠁷󠁳󠁡󠁬󠁿 Flag for Aiga-i-le-Tai (WS-AL) 🏴󠁹󠁥󠁭󠁡󠁿 Flag for Ma’rib (YE-MA) 🏴󠁹󠁥󠁢󠁡󠁿 Flag for Al Bayda (YE-BA) 🏴󠁶󠁮󠁨󠁰󠁿 Flag for Haiphong (VN-HP) 🏴󠁷󠁳󠁡󠁡󠁿 Flag for A’ana (WS-AA) 🏴󠁷󠁦󠁳󠁧󠁿 Flag for Sigave (WF-SG) 🏴󠁹󠁥󠁬󠁡󠁿 Flag for Lahij (YE-LA) 🏴󠁶󠁵󠁳󠁥󠁥󠁿 Flag for Shefa (VU-SEE) 🏴󠁹󠁥󠁩󠁢󠁿 Flag for Ibb (YE-IB) 🏴󠁶󠁵󠁴󠁯󠁢󠁿 Flag for Torba (VU-TOB) 🏴󠁹󠁥󠁪󠁡󠁿 Flag for Al Jawf (YE-JA) 🏴󠁷󠁳󠁴󠁵󠁿 Flag for Tuamasaga (WS-TU) 🏴󠁹󠁥󠁤󠁨󠁿 Flag for Dhamar (YE-DH) 🏴󠁺󠁡󠁷󠁣󠁿 Flag for Western Cape (ZA-WC) 🏴󠁹󠁥󠁳󠁵󠁿 Flag for Arkhabil Suqutra (YE-SU) 🏴󠁺󠁷󠁭󠁮󠁿 Flag for Matabeleland North (ZW-MN) 🏴󠁺󠁷󠁭󠁥󠁿 Flag for Mashonaland East (ZW-ME) 🏴󠁺󠁭󠀰󠀶󠁿 Flag for North-Western (ZM-06) 🏴󠁹󠁥󠁳󠁮󠁿 Flag for Sana’a (YE-SN) 🏴󠁺󠁡󠁬󠁰󠁿 Flag for Limpopo (ZA-LP) 🏴󠁺󠁭󠀰󠀳󠁿 Flag for Eastern (ZM-03) 🏴󠁺󠁷󠁭󠁩󠁿 Flag for Midlands (ZW-MI) 🏴󠁺󠁷󠁢󠁵󠁿 Flag for Bulawayo (ZW-BU) 🏴󠁺󠁭󠀰󠀵󠁿 Flag for Northern (ZM-05) 🏴󠁺󠁭󠀰󠀷󠁿 Flag for Southern (ZM-07) 🏴󠁺󠁡󠁦󠁳󠁿 Flag for Free (ZA-FS) 🏴󠁺󠁷󠁭󠁳󠁿 Flag for Matabeleland South (ZW-MS) 🏴󠁺󠁡󠁥󠁣󠁿 Flag for Eastern Cape (ZA-EC) 🏴󠁺󠁭󠀰󠀱󠁿 Flag for Western (ZM-01) 👨🏼‍👨🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁺󠁭󠀰󠀸󠁿 Flag for Copperbelt (ZM-08) 🏴󠁺󠁡󠁮󠁷󠁿 Flag for North West (ZA-NW) 🏴󠁺󠁭󠀱󠀰󠁿 Flag for Muchinga (ZM-10) 🏴󠁺󠁡󠁧󠁴󠁿 Flag for Gauteng (ZA-GT) 🏴󠁺󠁭󠀰󠀹󠁿 Flag for Lusaka (ZM-09) 🏴󠁺󠁭󠀰󠀲󠁿 Flag for Central (ZM-02) 🏴󠁺󠁡󠁮󠁣󠁿 Flag for Northern Cape (ZA-NC) 🏴󠁺󠁡󠁭󠁰󠁿 Flag for Mpumalanga (ZA-MP) 🏴󠁹󠁥󠁴󠁡󠁿 Flag for Taiz (YE-TA) 🏴󠁺󠁡󠁮󠁬󠁿 Flag for KwaZulu-Natal (ZA-NL) 🏴󠁺󠁷󠁭󠁡󠁿 Flag for Manicaland (ZW-MA) 🏴󠁺󠁷󠁭󠁶󠁿 Flag for Masvingo (ZW-MV) 🏴󠁺󠁭󠀰󠀴󠁿 Flag for Luapula (ZM-04) 🏴󠁺󠁷󠁭󠁷󠁿 Flag for Mashonaland West (ZW-MW) 🏴󠁺󠁷󠁨󠁡󠁿 Flag for Harare (ZW-HA) 👨🏽‍👨🏽‍👧🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Girl: Medium Skin Tone 👨🏾‍👨🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁦󠁲󠁰󠁤󠁬󠁿 Flag for Pays-de-la-Loire (FR-PDL) 🏴󠁬󠁴󠀲󠀰󠁿 Flag for Klaipėdos Municipality (LT-20) 🏴󠁧󠁲󠁭󠁿 Flag for Crete (GR-M) 󠁸 Tag Latin Small Letter X 🏴󠁩󠁲󠀲󠀱󠁿 Flag for Mazandaran (IR-21) 🏴󠁲󠁵󠁰󠁲󠁩󠁿 Flag for Primorsky Krai (RU-PRI) 🏴󠁪󠁰󠀰󠀷󠁿 Flag for Fukushima (JP-07) 🏴󠁣󠁡󠁭󠁢󠁿 Flag for Manitoba (CA-MB) 👨🏻‍👨🏻‍👦🏻‍👦🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Boy: Light Skin Tone, Boy: Light Skin Tone 👩🏻‍❤️‍👩🏻 Couple With Heart - Woman: Light Skin Tone, Woman: Light Skin Tone 🏴󠁣󠁡󠁱󠁣󠁿 Flag for Quebec (CA-QC) 👨‍👩‍👶 Family: Man, Woman, Baby 🏴󠁮󠁡󠁫󠁥󠁿 Flag for Kavango East (NA-KE) 🏴󠁭󠁸󠁳󠁬󠁰󠁿 Flag for San Luis Potosí (MX-SLP) 🏴󠁥󠁥󠀵󠀹󠁿 Flag for Lääne-Viru (EE-59) 🏴󠁬󠁲󠁢󠁧󠁿 Flag for Bong (LR-BG) 🏴󠁰󠁳󠁤󠁥󠁢󠁿 Flag for Deir al-Balah (PS-DEB) 👨🏿‍👨🏿‍👧🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁪󠁭󠀰󠀳󠁿 Flag for Saint Thomas (JM-03) 🏴󠁰󠁷󠀱󠀰󠀰󠁿 Flag for Kayangel (PW-100) 🏴󠁣󠁧󠀱󠀲󠁿 Flag for Pool (CG-12) 👨‍❤️‍👨🏾 Couple With Heart - Man, Man: Medium-Dark Skin Tone 🏴󠁥󠁳󠁩󠁢󠁿 Flag for Balearic Islands (ES-IB) 👩‍👨‍👦 Family: Woman, Man, Boy 🏴󠁦󠁩󠀱󠀸󠁿 Flag for Uusimaa (FI-18) 👨🏻‍👩🏻‍👦🏻‍👧🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Boy: Light Skin Tone, Girl: Light Skin Tone 🏴󠁢󠁲󠁣󠁥󠁿 Flag for Ceará (BR-CE) 👨‍👩‍👦‍👶 Family: Man, Woman, Boy, Baby 👨🏻‍👨🏻‍👧🏻‍👦🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Girl: Light Skin Tone, Boy: Light Skin Tone 🏴󠁭󠁫󠀲󠀵󠁿 Flag for Demir Hisar (MK-25) 🏴󠁣󠁬󠁡󠁮󠁿 Flag for Antofagasta (CL-AN) 🏴󠁢󠁢󠀰󠀱󠁿 Flag for Christ Church (BB-01) 🏴󠁥󠁥󠀳󠀷󠁿 Flag for Harju (EE-37) 👨🏿‍❤️‍💋‍👩🏽 Kiss - Man: Dark Skin Tone, Woman: Medium Skin Tone 🏴󠁮󠁲󠀱󠀴󠁿 Flag for Yaren (NR-14) 👩‍❤️‍👩🏻 Couple With Heart - Woman, Woman: Light Skin Tone 🏴󠁭󠁹󠀱󠀰󠁿 Flag for Selangor (MY-10) 👨🏼‍👨🏼‍👧🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁰󠁥󠁡󠁰󠁵󠁿 Flag for Apurímac (PE-APU) 👩‍👨‍👦‍👧 Family: Woman, Man, Boy, Girl 👨🏿‍👩🏿‍👧🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁧󠁥󠁡󠁢󠁿 Flag for Abkhazia (GE-AB) 🏴󠁬󠁩󠀰󠀸󠁿 Flag for Schellenberg (LI-08) 🏴󠁴󠁲󠀸󠀱󠁿 Flag for Düzce (TR-81) 👩🏾‍👧🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👩‍👨‍👶‍👦 Family: Woman, Man, Baby, Boy 🏴󠁭󠁸󠁳󠁯󠁮󠁿 Flag for Sonora (MX-SON) 🏴󠁣󠁩󠁳󠁭󠁿 Flag for Sassandra-Marahoué (CI-SM) 🏴󠁰󠁥󠁡󠁲󠁥󠁿 Flag for Arequipa (PE-ARE) 👩🏽‍❤️‍👩🏼 Couple With Heart - Woman: Medium Skin Tone, Woman: Medium-Light Skin Tone 🏴󠁣󠁧󠀱󠀱󠁿 Flag for Bouenza (CG-11) 🏴󠁪󠁭󠀱󠀴󠁿 Flag for Saint Catherine (JM-14) 🏴󠁳󠁩󠀱󠀲󠀲󠁿 Flag for Škofja Loka (SI-122) 👩🏻‍❤️‍💋‍👨🏼 Kiss - Woman: Light Skin Tone, Man: Medium-Light Skin Tone 🏴󠁴󠁷󠁨󠁳󠁺󠁿 Flag for Hsinchu (TW-HSZ) 👩🏼‍👧🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁬󠁫󠀳󠁿 Flag for Southern (LK-3) 👨‍❤️‍💋‍👨🏼 Kiss - Man, Man: Medium-Light Skin Tone 👨🏽‍👨🏽‍👧🏽‍👦🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Girl: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁮󠁩󠁬󠁥󠁿 Flag for León (NI-LE) 🏴󠁨󠁲󠀰󠀵󠁿 Flag for Varaždin (HR-05) 🏴󠁣󠁯󠁡󠁮󠁴󠁿 Flag for Antioquia (CO-ANT) 🏴󠁭󠁣󠁳󠁤󠁿 Flag for Sainte-Dévote Chapel (MC-SD) 🏴󠁭󠁫󠀶󠀱󠁿 Flag for Plasnica (MK-61) 👨🏾‍❤️‍👨🏻 Couple With Heart - Man: Medium-Dark Skin Tone, Man: Light Skin Tone 🏴󠁧󠁲󠁧󠁿 Flag for West Greece (GR-G) 🏴󠁭󠁶󠁮󠁯󠁿 Flag for North Province (MV-NO) 👨‍❤️‍👩🏻 Couple With Heart - Man, Woman: Light Skin Tone 🏴󠁶󠁥󠁣󠁿 Flag for Apure (VE-C) ☿️ Mercury 🏴󠁵󠁳󠁭󠁴󠁿 Flag for Montana (US-MT) 👩🏼‍❤️‍👨🏾 Couple With Heart - Woman: Medium-Light Skin Tone, Man: Medium-Dark Skin Tone 👨🏾‍👨🏾‍👧🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁥󠁣󠁥󠁿 Flag for Esmeraldas (EC-E) 🏴󠁤󠁺󠀰󠀸󠁿 Flag for Béchar (DZ-08) 🏴󠁮󠁬󠁮󠁨󠁿 Flag for North Holland (NL-NH) 🏴󠁦󠁲󠁢󠁬󠁿 Flag for St. Barthélemy (FR-BL) 🏴󠁣󠁦󠁵󠁫󠁿 Flag for Ouaka (CF-UK) 🏴󠁳󠁤󠁲󠁳󠁿 Flag for Red Sea (SD-RS) 🏴󠁭󠁸󠁴󠁡󠁢󠁿 Flag for Tabasco (MX-TAB) 🏴󠁣󠁮󠀹󠀲󠁿 Flag for Macau SAR China (CN-92) 🏴󠁨󠁵󠁥󠁧󠁿 Flag for Eger (HU-EG) 🏴󠁲󠁵󠁳󠁥󠁿 Flag for North Ossetia-Alania (RU-SE) 🏴󠁣󠁤󠁥󠁱󠁿 Flag for Équateur (CD-EQ) 👨🏿‍👨🏿‍👧🏿‍👦🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Girl: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁥󠁳󠁰󠁶󠁿 Flag for Basque Country (ES-PV) 👨🏽‍❤️‍💋‍👨🏻 Kiss - Man: Medium Skin Tone, Man: Light Skin Tone 🏴󠁴󠁮󠀷󠀱󠁿 Flag for Gafsa (TN-71) 🏴󠁦󠁩󠀰󠀶󠁿 Flag for Tavastia Proper (FI-06) 🏴󠁩󠁲󠀳󠀰󠁿 Flag for Razavi Khorasan (IR-30) 🏴󠁳󠁩󠀱󠀵󠀴󠁿 Flag for Dobje (SI-154) 👨🏼‍❤️‍💋‍👨🏻 Kiss - Man: Medium-Light Skin Tone, Man: Light Skin Tone 🏴󠁧󠁴󠁲󠁥󠁿 Flag for Retalhuleu (GT-RE) 🏴󠁫󠁩󠁬󠁿 Flag for Line Islands (KI-L) 🏴󠁩󠁲󠀰󠀲󠁿 Flag for West Azarbaijan (IR-02) 🏴󠁣󠁯󠁮󠁡󠁲󠁿 Flag for Nariño (CO-NAR) 🏴󠁺󠁷󠁭󠁣󠁿 Flag for Mashonaland Central (ZW-MC) 👨🏻‍❤️‍👨🏻 Couple With Heart - Man: Light Skin Tone, Man: Light Skin Tone 🏴󠁩󠁴󠀴󠀵󠁿 Flag for Emilia-Romagna (IT-45) 🏴󠁥󠁳󠁶󠁣󠁿 Flag for Valencian Community (ES-VC) 🏴󠁴󠁨󠀷󠀵󠁿 Flag for Samut Songkhram (TH-75) 🏴󠁦󠁲󠁩󠁤󠁦󠁿 Flag for Île-de-France (FR-IDF) 🏴󠁬󠁳󠁡󠁿 Flag for Maseru (LS-A) 🏴󠁫󠁥󠀲󠀵󠁿 Flag for Marsabit (KE-25) 🏴󠁤󠁺󠀰󠀱󠁿 Flag for Adrar (DZ-01) 🏴󠁳󠁶󠁵󠁳󠁿 Flag for Usulután (SV-US) 🏴󠁬󠁶󠀰󠀶󠀰󠁿 Flag for Mazsalaca (LV-060) 👩🏻‍❤️‍💋‍👩🏾 Kiss - Woman: Light Skin Tone, Woman: Medium-Dark Skin Tone 👨🏾‍👦🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁴󠁨󠀳󠀶󠁿 Flag for Chaiyaphum (TH-36) 🏴󠁰󠁨󠀰󠀷󠁿 Flag for Central Visayas (PH-07) 🏴󠁴󠁨󠀸󠀶󠁿 Flag for Chumphon (TH-86) 🏴󠁣󠁩󠁺󠁺󠁿 Flag for Zanzan (CI-ZZ) 🏴󠁥󠁳󠁣󠁬󠁿 Flag for Castile and León (ES-CL) 👨🏻‍👨🏻‍👧🏻‍👧🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Girl: Light Skin Tone, Girl: Light Skin Tone 🏴󠁳󠁡󠀱󠀱󠁿 Flag for Al Bahah (SA-11) 🏴󠁢󠁱󠁳󠁥󠁿 Flag for Sint Eustatius (BQ-SE) 🏴󠁦󠁩󠀰󠀱󠁿 Flag for Åland Islands (FI-01) 🏴󠁣󠁲󠁨󠁿 Flag for Heredia (CR-H) 🏴󠁴󠁲󠀴󠀳󠁿 Flag for Kütahya (TR-43) 🏴󠁷󠁳󠁶󠁳󠁿 Flag for Vaisigano (WS-VS) 👨🏿‍❤️‍💋‍👩🏼 Kiss - Man: Dark Skin Tone, Woman: Medium-Light Skin Tone 🏴󠁳󠁩󠀰󠀵󠀲󠁿 Flag for Kranj (SI-052) 🏴󠁶󠁥󠁶󠁿 Flag for Zulia (VE-V) 👩🏽‍❤️‍💋‍👨🏼 Kiss - Woman: Medium Skin Tone, Man: Medium-Light Skin Tone 🏴󠁬󠁵󠁣󠁡󠁿 Flag for Capellen (LU-CA) 👩🏽‍❤️‍👩🏾 Couple With Heart - Woman: Medium Skin Tone, Woman: Medium-Dark Skin Tone 👨🏼‍👨🏼‍👧🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁧󠁹󠁥󠁢󠁿 Flag for East Berbice-Corentyne (GY-EB) 🏴󠁴󠁨󠀱󠀶󠁿 Flag for Lopburi (TH-16) 🏴󠁭󠁴󠀲󠀵󠁿 Flag for Luqa (MT-25) 👨🏻‍❤️‍👨🏼 Couple With Heart - Man: Light Skin Tone, Man: Medium-Light Skin Tone 👨🏽‍👨🏽‍👧🏽‍👧🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Girl: Medium Skin Tone, Girl: Medium Skin Tone 👩🏻‍❤️‍👩🏽 Couple With Heart - Woman: Light Skin Tone, Woman: Medium Skin Tone 🏴󠁭󠁸󠁢󠁣󠁳󠁿 Flag for Baja California Sur (MX-BCS) 🏴󠁥󠁧󠁢󠁮󠁳󠁿 Flag for Beni Suef (EG-BNS) 🏴󠁴󠁨󠀹󠀳󠁿 Flag for Phatthalung (TH-93) 🏴󠁴󠁺󠀲󠀵󠁿 Flag for Tanga (TZ-25) 🏴󠁭󠁡󠀰󠀴󠁿 Flag for Oriental (MA-04) 👨🏾‍👨🏾‍👧🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👨🏿‍👩🏿‍👶🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁳󠁩󠀰󠀲󠀷󠁿 Flag for Gorenja Vas–Poljane (SI-027) 🏴󠁴󠁴󠁳󠁧󠁥󠁿 Flag for Sangre Grande (TT-SGE) 🏴󠁬󠁶󠀰󠀴󠀶󠁿 Flag for Koknese (LV-046) 🏴󠁳󠁩󠀰󠀸󠀶󠁿 Flag for Odranci (SI-086) 🏴󠁮󠁺󠁮󠁳󠁮󠁿 Flag for Nelson (NZ-NSN) 🏴󠁨󠁵󠁳󠁺󠁿 Flag for Szabolcs-Szatmár-Bereg (HU-SZ) 👩🏾‍❤️‍💋‍👨🏽 Kiss - Woman: Medium-Dark Skin Tone, Man: Medium Skin Tone 🏴󠁳󠁩󠀲󠀱󠀰󠁿 Flag for Sveti Jurij v Slovenskih Goricah (SI-210) ߷ NKo Symbol Gbakurunen 🏴󠁮󠁧󠁤󠁥󠁿 Flag for Delta (NG-DE) 🏴󠁭󠁤󠁣󠁳󠁿 Flag for Căușeni (MD-CS) 👩🏽‍👧🏽‍👦🏽 Family - Woman: Medium Skin Tone, Girl: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁣󠁵󠀹󠀹󠁿 Flag for Isla de la Juventud (CU-99) 🏴󠁫󠁨󠀲󠀰󠁿 Flag for Svay Rieng (KH-20) 🏴󠁴󠁤󠁨󠁬󠁿 Flag for Hadjer-Lamis (TD-HL) 🏴󠁪󠁰󠀲󠀱󠁿 Flag for Gifu (JP-21) 🏴󠁬󠁶󠀰󠀴󠀱󠁿 Flag for Jelgava Municipality (LV-041) 🏴󠁰󠁫󠁴󠁡󠁿 Flag for Federally Administered Tribal Areas (PK-TA) 🏴󠁭󠁴󠀶󠀲󠁿 Flag for Xewkija (MT-62) 🏴󠁭󠁲󠀱󠀰󠁿 Flag for Guidimaka (MR-10) 🏴󠁭󠁫󠀰󠀲󠁿 Flag for Aračinovo (MK-02) 🏴󠁳󠁩󠀲󠀰󠀸󠁿 Flag for Log–Dragomer (SI-208) 🏴󠁳󠁩󠀱󠀲󠀵󠁿 Flag for Šmartno ob Paki (SI-125) 🏴󠁣󠁯󠁤󠁣󠁿 Flag for Capital District (CO-DC) 🏴󠁬󠁶󠀱󠀰󠀶󠁿 Flag for Ventspils Municipality (LV-106) 🏴󠁭󠁶󠁳󠁣󠁿 Flag for South Central Province (MV-SC) 🏴󠁩󠁮󠁡󠁳󠁿 Flag for Assam (IN-AS) 🏴󠁬󠁴󠀰󠀲󠁿 Flag for Alytus Municipality (LT-02) 🏴󠁶󠁮󠀶󠀶󠁿 Flag for Hưng Yên (VN-66) 👨🏻‍👨🏻‍👧🏻‍👶🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Girl: Light Skin Tone, Baby: Light Skin Tone 👨🏼‍👨🏼‍👧🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁧󠁴󠁳󠁭󠁿 Flag for San Marcos (GT-SM) 👨🏼‍👨🏼‍👦🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁤󠁥󠁳󠁨󠁿 Flag for Schleswig-Holstein (DE-SH) 👨‍👨‍👶‍👧 Family: Man, Man, Baby, Girl ️ Variation Selector-16 👨🏽‍👨🏽‍👧🏽‍👶🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Girl: Medium Skin Tone, Baby: Medium Skin Tone 👨🏾‍👨🏾‍👧🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👨🏿‍👨🏿‍👧🏿‍👶🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Girl: Dark Skin Tone, Baby: Dark Skin Tone 👨🏻‍👨🏻‍👶🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Baby: Light Skin Tone 👨🏼‍👨🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👨🏽‍👨🏽‍👶🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Baby: Medium Skin Tone 👨🏾‍👨🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👨🏿‍👨🏿‍👶🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Baby: Dark Skin Tone 👩‍❤️‍👨🏿 Couple With Heart - Woman, Man: Dark Skin Tone 🏴󠁥󠁳󠁣󠁢󠁿 Flag for Cantabria (ES-CB) 🏴󠁳󠁳󠁵󠁹󠁿 Flag for Unity (SS-UY) 👩🏼‍👶🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👩🏽‍👶🏽‍👦🏽 Family - Woman: Medium Skin Tone, Baby: Medium Skin Tone, Boy: Medium Skin Tone 👩🏾‍👶🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👩🏿‍👶🏿‍👦🏿 Family - Woman: Dark Skin Tone, Baby: Dark Skin Tone, Boy: Dark Skin Tone 👩🏻‍👶🏻‍👧🏻 Family - Woman: Light Skin Tone, Baby: Light Skin Tone, Girl: Light Skin Tone 👩🏼‍👶🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👩🏽‍👶🏽‍👧🏽 Family - Woman: Medium Skin Tone, Baby: Medium Skin Tone, Girl: Medium Skin Tone 👩🏾‍👶🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👩🏽‍👶🏽‍👶🏽 Family - Woman: Medium Skin Tone, Baby: Medium Skin Tone, Baby: Medium Skin Tone 👩🏾‍👶🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👩🏿‍👶🏿‍👶🏿 Family - Woman: Dark Skin Tone, Baby: Dark Skin Tone, Baby: Dark Skin Tone 👩🏻‍👨🏻‍👦🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Boy: Light Skin Tone 👩🏼‍👨🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👩🏽‍👨🏽‍👦🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Boy: Medium Skin Tone 👩🏾‍👨🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👩🏿‍👨🏿‍👦🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Boy: Dark Skin Tone 👩🏻‍👨🏻‍👦🏻‍👦🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Boy: Light Skin Tone, Boy: Light Skin Tone 👩🏼‍👶🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👩🏼‍👨🏼‍👦🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👩🏽‍👨🏽‍👦🏽‍👦🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Boy: Medium Skin Tone, Boy: Medium Skin Tone 👩🏾‍👨🏾‍👦🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👩🏿‍👨🏿‍👦🏿‍👦🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Boy: Dark Skin Tone, Boy: Dark Skin Tone 👩🏽‍👨🏽‍👦🏽‍👧🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Boy: Medium Skin Tone, Girl: Medium Skin Tone 👩🏾‍👨🏾‍👦🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👩🏿‍👨🏿‍👦🏿‍👧🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Boy: Dark Skin Tone, Girl: Dark Skin Tone 👩🏼‍👨🏼‍👦🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👩🏽‍👨🏽‍👦🏽‍👶🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Boy: Medium Skin Tone, Baby: Medium Skin Tone 👩🏾‍👨🏾‍👦🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👩🏻‍👨🏻‍👧🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Girl: Light Skin Tone 👩🏽‍👨🏽‍👧🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Girl: Medium Skin Tone 👩🏻‍👨🏻‍👦🏻‍👶🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Boy: Light Skin Tone, Baby: Light Skin Tone 👩🏼‍👨🏼‍👦🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👩🏼‍👨🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👩🏻‍👨🏻‍👧🏻‍👦🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Girl: Light Skin Tone, Boy: Light Skin Tone 👩🏼‍👨🏼‍👧🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👩🏽‍👨🏽‍👧🏽‍👦🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Girl: Medium Skin Tone, Boy: Medium Skin Tone 👩🏾‍👨🏾‍👧🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👩🏿‍👨🏿‍👧🏿‍👦🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Girl: Dark Skin Tone, Boy: Dark Skin Tone 👩🏻‍👨🏻‍👧🏻‍👧🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Girl: Light Skin Tone, Girl: Light Skin Tone 👩🏽‍👨🏽‍👧🏽‍👧🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Girl: Medium Skin Tone, Girl: Medium Skin Tone 👩🏿‍👨🏿‍👧🏿‍👧🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Girl: Dark Skin Tone, Girl: Dark Skin Tone 👩🏻‍👨🏻‍👧🏻‍👶🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Girl: Light Skin Tone, Baby: Light Skin Tone 👩🏼‍👨🏼‍👧🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👩🏽‍👨🏽‍👧🏽‍👶🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Girl: Medium Skin Tone, Baby: Medium Skin Tone 👩🏾‍👨🏾‍👧🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👩🏿‍👨🏿‍👧🏿‍👶🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Girl: Dark Skin Tone, Baby: Dark Skin Tone 👩🏻‍👨🏻‍👶🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Baby: Light Skin Tone 👩🏼‍👨🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👩🏻‍👨🏻‍👶🏻‍👦🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Baby: Light Skin Tone, Boy: Light Skin Tone 👩🏼‍👨🏼‍👶🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👩🏾‍👨🏾‍👶🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👩🏿‍👨🏿‍👶🏿‍👦🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Baby: Dark Skin Tone, Boy: Dark Skin Tone 👩🏻‍👨🏻‍👶🏻‍👧🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Baby: Light Skin Tone, Girl: Light Skin Tone 👩🏼‍👨🏼‍👶🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👩🏽‍👨🏽‍👶🏽‍👧🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Baby: Medium Skin Tone, Girl: Medium Skin Tone 👩🏿‍👨🏿‍👶🏿‍👧🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Baby: Dark Skin Tone, Girl: Dark Skin Tone 👩🏻‍👨🏻‍👶🏻‍👶🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Baby: Light Skin Tone, Baby: Light Skin Tone 👩🏼‍👨🏼‍👶🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👩🏽‍👨🏽‍👶🏽‍👶🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Baby: Medium Skin Tone, Baby: Medium Skin Tone 👩🏾‍👨🏾‍👶🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👩🏿‍👨🏿‍👶🏿‍👶🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Baby: Dark Skin Tone, Baby: Dark Skin Tone 👩🏼‍👩🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👩🏻‍👩🏻‍👦🏻‍👧🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Boy: Light Skin Tone, Girl: Light Skin Tone 👩🏼‍👩🏼‍👦🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👩🏾‍👩🏾‍👦🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👩🏿‍👩🏿‍👦🏿‍👦🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Boy: Dark Skin Tone, Boy: Dark Skin Tone 👩🏿‍👩🏿‍👦🏿‍👶🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Boy: Dark Skin Tone, Baby: Dark Skin Tone 👩🏽‍👩🏽‍👦🏽‍👧🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Boy: Medium Skin Tone, Girl: Medium Skin Tone 👩🏾‍👩🏾‍👦🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👩🏿‍👩🏿‍👦🏿‍👧🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Boy: Dark Skin Tone, Girl: Dark Skin Tone 👩🏻‍👩🏻‍👦🏻‍👶🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Boy: Light Skin Tone, Baby: Light Skin Tone 👩🏼‍👩🏼‍👦🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👩🏽‍👩🏽‍👦🏽‍👶🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Boy: Medium Skin Tone, Baby: Medium Skin Tone 👩🏾‍👩🏾‍👦🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👩🏻‍👩🏻‍👧🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Girl: Light Skin Tone 👩🏼‍👩🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👩🏽‍👩🏽‍👦🏽‍👦🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Boy: Medium Skin Tone, Boy: Medium Skin Tone 👩🏽‍👩🏽‍👧🏽‍👦🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Girl: Medium Skin Tone, Boy: Medium Skin Tone 👩🏻‍👩🏻‍👧🏻‍👧🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Girl: Light Skin Tone, Girl: Light Skin Tone 👩🏽‍👩🏽‍👧🏽‍👧🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Girl: Medium Skin Tone, Girl: Medium Skin Tone 👩🏾‍👩🏾‍👧🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👩🏿‍👩🏿‍👧🏿‍👧🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Girl: Dark Skin Tone, Girl: Dark Skin Tone 👩🏻‍👩🏻‍👧🏻‍👶🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Girl: Light Skin Tone, Baby: Light Skin Tone 👩🏼‍👩🏼‍👧🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👩🏽‍👩🏽‍👧🏽‍👶🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Girl: Medium Skin Tone, Baby: Medium Skin Tone 👩🏾‍👩🏾‍👧🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👩🏿‍👩🏿‍👧🏿‍👶🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Girl: Dark Skin Tone, Baby: Dark Skin Tone 👩🏻‍👩🏻‍👶🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Baby: Light Skin Tone 👨🏾‍👩🏾‍👧🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👩🏼‍👩🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👩🏽‍👩🏽‍👶🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Baby: Medium Skin Tone 👩🏾‍👩🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👩🏿‍👩🏿‍👶🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Baby: Dark Skin Tone 👩🏻‍👩🏻‍👶🏻‍👦🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Baby: Light Skin Tone, Boy: Light Skin Tone 👩🏼‍👩🏼‍👶🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👩🏽‍👩🏽‍👶🏽‍👦🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Baby: Medium Skin Tone, Boy: Medium Skin Tone 👩🏾‍👩🏾‍👶🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👩🏿‍👩🏿‍👶🏿‍👦🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Baby: Dark Skin Tone, Boy: Dark Skin Tone 👩🏻‍👩🏻‍👶🏻‍👧🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Baby: Light Skin Tone, Girl: Light Skin Tone 👩🏽‍👩🏽‍👶🏽‍👧🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Baby: Medium Skin Tone, Girl: Medium Skin Tone 👩🏾‍👩🏾‍👶🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👩🏿‍👩🏿‍👶🏿‍👧🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Baby: Dark Skin Tone, Girl: Dark Skin Tone 👩🏻‍👩🏻‍👶🏻‍👶🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Baby: Light Skin Tone, Baby: Light Skin Tone 👩🏼‍👩🏼‍👶🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👩🏽‍👩🏽‍👶🏽‍👶🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Baby: Medium Skin Tone, Baby: Medium Skin Tone 👩🏾‍👩🏾‍👶🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👩🏿‍👩🏿‍👶🏿‍👶🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Baby: Dark Skin Tone, Baby: Dark Skin Tone 👩🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁩󠁤󠁭󠁬󠁿 Flag for Maluku Islands (ID-ML) 👩🏿‍👶🏿‍👧🏿 Family - Woman: Dark Skin Tone, Baby: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁤󠁫󠀸󠀳󠁿 Flag for Southern Denmark (DK-83) 🏴󠁭󠁫󠀸󠀵󠁿 Flag for Skopje (MK-85) 👨🏼‍❤️‍💋‍👩 Kiss - Man: Medium-Light Skin Tone, Woman 🏴󠁰󠁴󠀰󠀲󠁿 Flag for Beja (PT-02) 🏴󠁩󠁴󠀸󠀸󠁿 Flag for Sardinia (IT-88) 🏴󠁤󠁥󠁢󠁹󠁿 Flag for Bavaria (DE-BY) 🏴󠁰󠁧󠁥󠁢󠁲󠁿 Flag for East New Britain (PG-EBR) 🏴󠁩󠁴󠀳󠀲󠁿 Flag for Trentino-South Tyrol (IT-32) 🏴󠁵󠁳󠁴󠁮󠁿 Flag for Tennessee (US-TN) 🏴󠁣󠁡󠁳󠁫󠁿 Flag for Saskatchewan (CA-SK) 🏴󠁴󠁶󠁦󠁵󠁮󠁿 Flag for Funafuti (TV-FUN) 🏴󠁴󠁪󠁧󠁢󠁿 Flag for Gorno-Badakhshan (TJ-GB) 🏴󠁳󠁯󠁢󠁮󠁿 Flag for Banaadir (SO-BN) 🏴󠁳󠁩󠀱󠀰󠀰󠁿 Flag for Radenci (SI-100) 🏴󠁤󠁥󠁢󠁷󠁿 Flag for Baden-Württemberg (DE-BW) 👩🏿‍👧🏿 Family - Woman: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁶󠁥󠁧󠁿 Flag for Carabobo (VE-G) ‍ Zero Width Joiner 🏴󠁫󠁥󠀳󠀱󠁿 Flag for Nakuru (KE-31) 🏴󠁴󠁧󠁭󠁿 Flag for Maritime (TG-M) 🏴󠁮󠁧󠁢󠁯󠁿 Flag for Borno (NG-BO) 🏴󠁭󠁤󠁳󠁮󠁿 Flag for Transnistria (MD-SN) 🏴󠁩󠁲󠀰󠀷󠁿 Flag for Tehran (IR-07) 🏴󠁲󠁵󠁤󠁡󠁿 Flag for Dagestan (RU-DA) 🏴󠁯󠁭󠁷󠁵󠁿 Flag for Al Wusta (OM-WU) 🏴󠁣󠁺󠀴󠀲󠁿 Flag for Ústecký kraj (CZ-42) 🏴󠁭󠁹󠀱󠀴󠁿 Flag for Kuala Lumpur (MY-14) 🏴󠁰󠁥󠁡󠁹󠁡󠁿 Flag for Ayacucho (PE-AYA) 🏴󠁵󠁡󠀳󠀰󠁿 Flag for Kiev (UA-30) 🏴󠁡󠁧󠀰󠀸󠁿 Flag for Saint Philip (AG-08) 🏴󠁭󠁴󠀲󠀹󠁿 Flag for Mdina (MT-29) 🏴󠁧󠁢󠁮󠁩󠁲󠁿 Flag for Northern Ireland (GB-NIR) 🏴󠁦󠁲󠁡󠁲󠁡󠁿 Flag for Auvergne-Rhône-Alpes (FR-ARA) 🏴󠁭󠁸󠁤󠁵󠁲󠁿 Flag for Durango (MX-DUR) 👨🏼‍👩🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁬󠁫󠀵󠁿 Flag for Eastern (LK-5) 🏴󠁮󠁧󠁯󠁧󠁿 Flag for Ogun (NG-OG) 🏴󠁬󠁹󠁪󠁩󠁿 Flag for Jafara (LY-JI) 🏴󠁳󠁥󠁭󠁿 Flag for Skåne (SE-M) 👨🏽‍👩🏽‍👧🏽‍👦🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Girl: Medium Skin Tone, Boy: Medium Skin Tone 👩🏾‍👩🏾‍👧🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁢󠁲󠁭󠁳󠁿 Flag for Mato Grosso do Sul (BR-MS) 🏴󠁧󠁴󠁳󠁲󠁿 Flag for Santa Rosa (GT-SR) 👨🏼‍👩🏼‍👧🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁳󠁩󠀱󠀵󠀱󠁿 Flag for Braslovče (SI-151) 🏴󠁰󠁴󠀳󠀰󠁿 Flag for Madeira (PT-30) 🏴󠁳󠁶󠁳󠁶󠁿 Flag for San Vicente (SV-SV) 🏴󠁩󠁲󠀳󠀲󠁿 Flag for Alborz (IR-32) 🏴󠁷󠁳󠁦󠁡󠁿 Flag for Fa’asaleleaga (WS-FA) 👨🏼‍👨🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁣󠁡󠁮󠁬󠁿 Flag for Newfoundland and Labrador (CA-NL) 🏴󠁧󠁲󠁪󠁿 Flag for Peloponnese (GR-J) 🏴󠁮󠁬󠁳󠁸󠁿 Flag for Sint Maarten (NL-SX) 🏴󠁭󠁴󠀴󠀸󠁿 Flag for St. Julian’s (MT-48) 🏴󠁮󠁧󠁡󠁤󠁿 Flag for Adamawa (NG-AD) 👩🏿‍👩🏿‍👧🏿‍👦🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Girl: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁳󠁴󠁳󠁿 Flag for São Tomé (ST-S) 👩🏻‍👩🏻‍👧🏻‍👦🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Girl: Light Skin Tone, Boy: Light Skin Tone 🏴󠁬󠁶󠀰󠀱󠀰󠁿 Flag for Auce (LV-010) 🏴󠁰󠁨󠀱󠀵󠁿 Flag for Cordillera Administrative (PH-15) 🏴󠁪󠁰󠀱󠀸󠁿 Flag for Fukui (JP-18) 👨🏿‍👩🏿‍👦🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁧󠁥󠁫󠁡󠁿 Flag for Kakheti (GE-KA) 🏴󠁫󠁲󠀴󠀹󠁿 Flag for Jeju (KR-49) 🏴󠁭󠁡󠀱󠀳󠁿 Flag for Souss-Massa-Drâa (MA-13) 🏴󠁬󠁶󠀰󠀳󠀷󠁿 Flag for Inčukalns (LV-037) 🏴󠁦󠁲󠁴󠁦󠁿 Flag for French Southern Territories (FR-TF) 🏴󠁭󠁸󠁲󠁯󠁯󠁿 Flag for Quintana Roo (MX-ROO) 👩🏻‍👶🏻‍👶🏻 Family - Woman: Light Skin Tone, Baby: Light Skin Tone, Baby: Light Skin Tone 👨🏾‍👨🏾‍👦🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁨󠁵󠁧󠁳󠁿 Flag for Győr-Moson-Sopron (HU-GS) 👩🏿‍👩🏿‍👧🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Girl: Dark Skin Tone 👩🏻‍👩🏻‍👦🏻‍👦🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Boy: Light Skin Tone, Boy: Light Skin Tone  Shibuya 👩‍❤️‍👨🏽 Couple With Heart - Woman, Man: Medium Skin Tone 🏴󠁷󠁳󠁧󠁩󠁿 Flag for Gaga’ifomauga (WS-GI) 🏴󠁨󠁴󠁮󠁥󠁿 Flag for Nord-Est (HT-NE) 🏴󠁳󠁧󠀰󠀱󠁿 Flag for Central Singapore (SG-01) 🏴󠁥󠁣󠁴󠁿 Flag for Tungurahua (EC-T) # Number Sign 👨🏻‍👨🏻‍👶🏻‍👦🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Baby: Light Skin Tone, Boy: Light Skin Tone 1 Digit One 🏴󠁢󠁯󠁴󠁿 Flag for Tarija (BO-T) 👨🏾‍👩🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁢󠁩󠁣󠁩󠁿 Flag for Cibitoke (BI-CI) 🏴󠁭󠁶󠁵󠁳󠁿 Flag for Upper South Province (MV-US) 🏴󠁡󠁤󠀰󠀲󠁿 Flag for Canillo (AD-02) 🏴󠁡󠁦󠁢󠁡󠁭󠁿 Flag for Bamyan (AF-BAM) 🏴󠁡󠁤󠀰󠀳󠁿 Flag for Encamp (AD-03) 🏴󠁵󠁳󠁭󠁰󠁿 Flag for Northern Mariana Islands (US-MP) 🏴󠁬󠁶󠀰󠀱󠀲󠁿 Flag for Babīte (LV-012) 🏴󠁥󠁣󠁸󠁿 Flag for Cotopaxi (EC-X) 🏴󠁧󠁡󠀴󠁿 Flag for Ngounié (GA-4) * Asterisk 󠁺 Tag Latin Small Letter Z 🏴󠁡󠁤󠀰󠀴󠁿 Flag for La Massana (AD-04) 󠀳 Tag Digit Three 👩🏼‍❤️‍💋‍👩🏻 Kiss - Woman: Medium-Light Skin Tone, Woman: Light Skin Tone 🏴󠁭󠁥󠀰󠀳󠁿 Flag for Berane (ME-03) 👨🏿‍❤️‍💋‍👨🏽 Kiss - Man: Dark Skin Tone, Man: Medium Skin Tone 🏴󠁤󠁯󠀳󠀷󠁿 Flag for El Valle (DO-37) 👩🏾‍❤️‍👩🏻 Couple With Heart - Woman: Medium-Dark Skin Tone, Woman: Light Skin Tone 🏴󠁫󠁥󠀰󠀱󠁿 Flag for Baringo (KE-01) 🏴󠁹󠁥󠁳󠁡󠁿 Flag for Amanat Al Asimah (YE-SA) 👨🏼‍👨🏼‍👶🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 󠀲 Tag Digit Two 🏴󠁭󠁴󠀲󠀰󠁿 Flag for Senglea (MT-20) 🕴️‍♀️ Woman in Business Suit Levitating 🏴󠁣󠁦󠁨󠁭󠁿 Flag for Haut-Mbomou (CF-HM) 󠀱 Tag Digit One 󠀴 Tag Digit Four 🏴󠁡󠁺󠁡󠁢󠁳󠁿 Flag for Absheron (AZ-ABS) 6 Digit Six 🏴󠁬󠁡󠁳󠁶󠁿 Flag for Savannakhet (LA-SV) 🏴󠁭󠁬󠀱󠁿 Flag for Kayes (ML-1) 🏴󠁡󠁥󠁡󠁺󠁿 Flag for Abu Dhabi (AE-AZ) 🏴󠁥󠁳󠁡󠁳󠁿 Flag for Asturias (ES-AS) 🏴󠁩󠁱󠁫󠁩󠁿 Flag for Kirkuk (IQ-KI) 👩‍❤️‍👩🏽 Couple With Heart - Woman, Woman: Medium Skin Tone 🏴󠁤󠁥󠁢󠁥󠁿 Flag for Berlin (DE-BE) 8 Digit Eight 🏴󠁡󠁤󠀰󠀸󠁿 Flag for Escaldes-Engordany (AD-08) 🏴󠁣󠁮󠀶󠀴󠁿 Flag for Ningxia (CN-64) 🏴󠁥󠁣󠁦󠁿 Flag for Cañar (EC-F) 🏴󠁡󠁥󠁡󠁪󠁿 Flag for Ajman (AE-AJ) 🕴🏻‍♀️ Woman in Business Suit Levitating: Light Skin Tone 👨🏻‍❤️‍💋‍👩 Kiss - Man: Light Skin Tone, Woman 󠀸 Tag Digit Eight 🏴󠁩󠁲󠀱󠀴󠁿 Flag for Fars (IR-14) 🏴󠁡󠁥󠁦󠁵󠁿 Flag for Fujairah (AE-FU) 👨🏼‍👦🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁨󠁲󠀱󠀰󠁿 Flag for Virovitica-Podravina (HR-10) 󠁩 Tag Latin Small Letter I 7 Digit Seven 󠀷 Tag Digit Seven 󠁥 Tag Latin Small Letter E 👩🏼‍👩🏼‍👧🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁭󠁨󠁴󠁿 Flag for Ratak Chain (MH-T) 🏴󠁡󠁥󠁳󠁨󠁿 Flag for Sharjah (AE-SH) 󠁦 Tag Latin Small Letter F 🏴󠁬󠁴󠀵󠀷󠁿 Flag for Vilniaus Municipality (LT-57) 🏴󠁩󠁳󠀴󠁿 Flag for Westfjords (IS-4) 🏴󠁣󠁡󠁢󠁣󠁿 Flag for British Columbia (CA-BC) 4 Digit Four 🏴󠁡󠁦󠁢󠁡󠁬󠁿 Flag for Balkh (AF-BAL) 👨‍👶‍👦 Family: Man, Baby, Boy 🏴󠁴󠁷󠁨󠁳󠁱󠁿 Flag for Hsinchu County (TW-HSQ) 👩‍👶‍👧 Family: Woman, Baby, Girl 🏴󠁭󠁸󠁪󠁡󠁬󠁿 Flag for Jalisco (MX-JAL) 🏴󠁫󠁥󠀱󠀸󠁿 Flag for Kitui (KE-18) 🏴󠁰󠁴󠀲󠀰󠁿 Flag for Azores (PT-20) 🏴󠁩󠁮󠁭󠁮󠁿 Flag for Manipur (IN-MN) 🏴󠁡󠁦󠁢󠁤󠁳󠁿 Flag for Badakhshan (AF-BDS) 👩🏻‍❤️‍👩🏼 Couple With Heart - Woman: Light Skin Tone, Woman: Medium-Light Skin Tone 🏴󠁡󠁤󠀰󠀵󠁿 Flag for Ordino (AD-05) 👩🏽‍❤️‍💋‍👩 Kiss - Woman: Medium Skin Tone, Woman 🏴󠁡󠁦󠁢󠁧󠁬󠁿 Flag for Baghlan (AF-BGL) 🏴󠁮󠁧󠁣󠁲󠁿 Flag for Cross River (NG-CR) 🏴󠁵󠁳󠁣󠁯󠁿 Flag for Colorado (US-CO) 󠁴 Tag Latin Small Letter T 🏴󠁭󠁫󠀶󠀴󠁿 Flag for Radoviš (MK-64) 🏴󠁮󠁺󠁷󠁧󠁮󠁿 Flag for Wellington (NZ-WGN) 👨🏽‍👨🏽‍👶🏽‍👦🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Baby: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁩󠁲󠀱󠀶󠁿 Flag for Kurdistan (IR-16) 👨🏽‍❤️‍💋‍👨🏿 Kiss - Man: Medium Skin Tone, Man: Dark Skin Tone 󠁳 Tag Latin Small Letter S 👩‍👶‍👶 Family: Woman, Baby, Baby 🏴󠁡󠁦󠁤󠁡󠁹󠁿 Flag for Daykundi (AF-DAY) 👨🏻‍❤️‍💋‍👨🏾 Kiss - Man: Light Skin Tone, Man: Medium-Dark Skin Tone 🏴󠁡󠁦󠁦󠁲󠁡󠁿 Flag for Farah (AF-FRA) 󠁱 Tag Latin Small Letter Q 🏴󠁧󠁴󠁧󠁵󠁿 Flag for Guatemala (GT-GU) 🏴󠁣󠁨󠁴󠁧󠁿 Flag for Thurgau (CH-TG) 🏴󠁲󠁵󠁣󠁥󠁿 Flag for Chechen (RU-CE) 󠀵 Tag Digit Five 🏴󠁡󠁦󠁧󠁨󠁯󠁿 Flag for Ghōr (AF-GHO) 🏴󠁡󠁴󠀹󠁿 Flag for Vienna (AT-9) 🏴󠁡󠁦󠁧󠁨󠁡󠁿 Flag for Ghazni (AF-GHA) 󠁵 Tag Latin Small Letter U 🏴󠁢󠁷󠁧󠁡󠁿 Flag for Gaborone (BW-GA) 󠁹 Tag Latin Small Letter Y 󠁿 Cancel Tag 󠁷 Tag Latin Small Letter W 👩🏽‍❤️‍👩🏿 Couple With Heart - Woman: Medium Skin Tone, Woman: Dark Skin Tone 🏴󠁣󠁯󠁡󠁭󠁡󠁿 Flag for Amazonas (CO-AMA) 󠁮 Tag Latin Small Letter N 👩‍❤️‍💋‍👩🏽 Kiss - Woman, Woman: Medium Skin Tone 👨‍👶 Family: Man, Baby 🏴󠁡󠁴󠀱󠁿 Flag for Burgenland (AT-1) 🏴󠁡󠁦󠁨󠁥󠁬󠁿 Flag for Helmand (AF-HEL) 󠀶 Tag Digit Six 🏴󠁡󠁦󠁪󠁯󠁷󠁿 Flag for Jowzjan (AF-JOW) 🧕‍♀️ Woman With Headscarf 󠁢 Tag Latin Small Letter B 󠀰 Tag Digit Zero 🏴󠁡󠁦󠁨󠁥󠁲󠁿 Flag for Herat (AF-HER) 🏴󠁧󠁤󠀰󠀵󠁿 Flag for Saint Mark (GD-05) 3 Digit Three 󠁧 Tag Latin Small Letter G 🕴🏾‍♀️ Woman in Business Suit Levitating: Medium-Dark Skin Tone 👩🏽‍❤️‍💋‍👨🏽 Kiss - Woman: Medium Skin Tone, Man: Medium Skin Tone 🏴󠁵󠁳󠁡󠁫󠁿 Flag for Alaska (US-AK) 󠁲 Tag Latin Small Letter R 🏴󠁴󠁬󠁬󠁡󠁿 Flag for Lautém (TL-LA) 🏴󠁡󠁦󠁫󠁡󠁢󠁿 Flag for Kabul (AF-KAB) 👨‍❤️‍💋‍👨🏿 Kiss - Man, Man: Dark Skin Tone 🧕‍♂️ Man With Headscarf 󠁶 Tag Latin Small Letter V 󠁤 Tag Latin Small Letter D 🏴󠁡󠁦󠁫󠁡󠁮󠁿 Flag for Kandahar (AF-KAN) 🏴󠁡󠁦󠁫󠁡󠁰󠁿 Flag for Kapisa (AF-KAP) 🏴󠁭󠁣󠁳󠁲󠁿 Flag for Saint Roman (MC-SR) 🏴󠁥󠁥󠀳󠀹󠁿 Flag for Hiiu (EE-39) 󠁭 Tag Latin Small Letter M 🏴󠁡󠁦󠁫󠁨󠁯󠁿 Flag for Khost (AF-KHO) 🧕🏻‍♂️ Man With Headscarf: Light Skin Tone 🏴󠁡󠁦󠁫󠁤󠁺󠁿 Flag for Kunduz (AF-KDZ) 👩🏿‍❤️‍👨 Couple With Heart - Woman: Dark Skin Tone, Man 🏴󠁵󠁳󠁳󠁤󠁿 Flag for South Dakota (US-SD) 🏴󠁡󠁦󠁢󠁤󠁧󠁿 Flag for Badghis (AF-BDG) 🏴󠁩󠁳󠀸󠁿 Flag for Southern (IS-8) 🏴󠁡󠁦󠁫󠁮󠁲󠁿 Flag for Kunar (AF-KNR) 👨‍👨‍👶‍👶 Family: Man, Man, Baby, Baby 🏴󠁪󠁰󠀱󠀳󠁿 Flag for Tokyo (JP-13) 🏴󠁡󠁦󠁬󠁡󠁧󠁿 Flag for Laghman (AF-LAG) 🧕🏽‍♂️ Man With Headscarf: Medium Skin Tone 🏴󠁡󠁦󠁬󠁯󠁧󠁿 Flag for Logar (AF-LOG) 5 Digit Five 󠁣 Tag Latin Small Letter C 🏴󠁡󠁦󠁦󠁹󠁢󠁿 Flag for Faryab (AF-FYB) 󠁰 Tag Latin Small Letter P 🏴󠁡󠁦󠁮󠁡󠁮󠁿 Flag for Nangarhar (AF-NAN) 󠀹 Tag Digit Nine 🏴󠁥󠁳󠁮󠁣󠁿 Flag for Navarra Chartered Community (ES-NC) 👩🏼‍👦🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁭󠁸󠁮󠁡󠁹󠁿 Flag for Nayarit (MX-NAY) 🏴󠁢󠁲󠁰󠁥󠁿 Flag for Pernambuco (BR-PE) 🏴󠁩󠁴󠀷󠀲󠁿 Flag for Campania (IT-72) 🧕🏾‍♂️ Man With Headscarf: Medium-Dark Skin Tone 👩🏽‍❤️‍💋‍👩🏾 Kiss - Woman: Medium Skin Tone, Woman: Medium-Dark Skin Tone 🏴󠁡󠁦󠁮󠁵󠁲󠁿 Flag for Nuristan (AF-NUR) 👨‍👨‍👧‍👶 Family: Man, Man, Girl, Baby 🏴󠁰󠁧󠁷󠁢󠁫󠁿 Flag for West New Britain (PG-WBK) 👨🏼‍👩🏼‍👧🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁧󠁹󠁵󠁤󠁿 Flag for Upper Demerara-Berbice (GY-UD) 👨‍❤️‍💋‍👩 Kiss - Man, Woman 🏴󠁥󠁴󠁡󠁦󠁿 Flag for Afar (ET-AF) 🏴󠁡󠁦󠁰󠁡󠁲󠁿 Flag for Parwan (AF-PAR) 🏴󠁡󠁦󠁮󠁩󠁭󠁿 Flag for Nimruz (AF-NIM) 🏴󠁨󠁲󠀰󠀴󠁿 Flag for Karlovac (HR-04) 🏴󠁡󠁦󠁰󠁩󠁡󠁿 Flag for Paktia (AF-PIA) 🧕🏿‍♂️ Man With Headscarf: Dark Skin Tone 🧕🏼‍♂️ Man With Headscarf: Medium-Light Skin Tone 🏴󠁭󠁸󠁢󠁣󠁮󠁿 Flag for Baja California (MX-BCN) 🏴󠁡󠁦󠁰󠁫󠁡󠁿 Flag for Paktika (AF-PKA) 🏴󠁫󠁩󠁰󠁿 Flag for Phoenix Islands (KI-P) 󠁯 Tag Latin Small Letter O 🏴󠁡󠁦󠁰󠁡󠁮󠁿 Flag for Panjshir (AF-PAN) 🏴󠁣󠁨󠁴󠁩󠁿 Flag for Ticino (CH-TI) 🏴󠁳󠁩󠀱󠀹󠀲󠁿 Flag for Žirovnica (SI-192) 🏴󠁳󠁥󠁮󠁿 Flag for Halland (SE-N) 󠁪 Tag Latin Small Letter J 👩🏽‍❤️‍💋‍👩🏻 Kiss - Woman: Medium Skin Tone, Woman: Light Skin Tone 👨🏾‍👨🏾‍👶🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👨🏿‍👨🏿‍👶🏿‍👦🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Baby: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁳󠁳󠁢󠁮󠁿 Flag for Northern Bahr el Ghazal (SS-BN) 👨🏽‍❤️‍💋‍👩 Kiss - Man: Medium Skin Tone, Woman 🏴󠁣󠁦󠁢󠁫󠁿 Flag for Basse-Kotto (CF-BK) 👨‍❤️‍👨🏻 Couple With Heart - Man, Man: Light Skin Tone 👨🏽‍❤️‍👨 Couple With Heart - Man: Medium Skin Tone, Man 🏴󠁬󠁹󠁢󠁵󠁿 Flag for Butnan (LY-BU) 👩‍👶 Family: Woman, Baby 🏴󠁬󠁫󠀹󠁿 Flag for Sabaragamuwa (LK-9) 🏴󠁡󠁦󠁳󠁡󠁭󠁿 Flag for Samangan (AF-SAM) 🏴󠁴󠁶󠁮󠁫󠁬󠁿 Flag for Nukulaelae (TV-NKL) 🏴󠁡󠁥󠁲󠁫󠁿 Flag for Ras al-Khaimah (AE-RK) 🏴󠁥󠁳󠁣󠁥󠁿 Flag for Ceuta (ES-CE) 🏴󠁡󠁥󠁤󠁵󠁿 Flag for Dubai (AE-DU) 👨🏻‍👨🏻‍👶🏻‍👧🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Baby: Light Skin Tone, Girl: Light Skin Tone 🏴󠁪󠁰󠀴󠀷󠁿 Flag for Okinawa (JP-47) 🏴󠁡󠁦󠁳󠁡󠁲󠁿 Flag for Sar-e Pol (AF-SAR) 👩🏼‍👩🏼‍👦🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 󠁬 Tag Latin Small Letter L 🏴󠁡󠁦󠁵󠁲󠁵󠁿 Flag for Urozgan (AF-URU) 9 Digit Nine 👩🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👨‍❤️‍💋‍👨🏽 Kiss - Man, Man: Medium Skin Tone 🏴󠁤󠁭󠀰󠀶󠁿 Flag for Saint Joseph (DM-06) 🏴󠁡󠁧󠀰󠀴󠁿 Flag for Saint John (AG-04) 🏴󠁣󠁯󠁶󠁩󠁤󠁿 Flag for Vichada (CO-VID) 🏴󠁰󠁷󠀲󠀱󠀸󠁿 Flag for Ngarchelong (PW-218) 🏴󠁲󠁵󠁡󠁲󠁫󠁿 Flag for Arkhangelsk (RU-ARK) 🏴󠁡󠁦󠁺󠁡󠁢󠁿 Flag for Zabul (AF-ZAB) 🏴󠁡󠁧󠀰󠀳󠁿 Flag for Saint George (AG-03) 🏴󠁩󠁴󠀲󠀵󠁿 Flag for Lombardy (IT-25) 👨🏻‍❤️‍💋‍👨🏻 Kiss - Man: Light Skin Tone, Man: Light Skin Tone 🏴󠁣󠁺󠀵󠀳󠁿 Flag for Pardubický kraj (CZ-53) 🏴󠁡󠁧󠀰󠀶󠁿 Flag for Saint Paul (AG-06) 🏴󠁶󠁮󠀵󠀱󠁿 Flag for Trà Vinh (VN-51) 👩‍👨‍👶‍👧 Family: Woman, Man, Baby, Girl 🏴󠁫󠁲󠀴󠀸󠁿 Flag for South Gyeongsang (KR-48) 🏴󠁡󠁧󠀰󠀵󠁿 Flag for Saint Mary (AG-05) 🏴󠁧󠁲󠁫󠁿 Flag for North Aegean (GR-K) 👩‍👩‍👶‍👧 Family: Woman, Woman, Baby, Girl 🏴󠁥󠁣󠁺󠁿 Flag for Zamora-Chinchipe (EC-Z) 🏴󠁮󠁩󠁭󠁳󠁿 Flag for Masaya (NI-MS) 🏴󠁫󠁩󠁧󠁿 Flag for Gilbert Islands (KI-G) 🏴󠁭󠁸󠁣󠁨󠁨󠁿 Flag for Chihuahua (MX-CHH) 👨🏼‍👨🏼‍👶🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👨🏽‍👨🏽‍👶🏽‍👧🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Baby: Medium Skin Tone, Girl: Medium Skin Tone 👩🏽‍👧🏽‍👧🏽 Family - Woman: Medium Skin Tone, Girl: Medium Skin Tone, Girl: Medium Skin Tone 👩‍👨‍👶‍👶 Family: Woman, Man, Baby, Baby 🏴󠁡󠁧󠀱󠀱󠁿 Flag for Redonda (AG-11) 👩‍👩‍👶 Family: Woman, Woman, Baby 👨‍❤️‍💋‍👩🏻 Kiss - Man, Woman: Light Skin Tone 👨‍❤️‍💋‍👨🏾 Kiss - Man, Man: Medium-Dark Skin Tone 🏴󠁡󠁬󠀰󠀱󠁿 Flag for Berat County (AL-01) 󠁡 Tag Latin Small Letter A 🏴󠁡󠁧󠀱󠀰󠁿 Flag for Barbuda (AG-10) 🏴󠁣󠁯󠁳󠁡󠁰󠁿 Flag for San Andrés & Providencia (CO-SAP) 🏴󠁡󠁬󠀰󠀳󠁿 Flag for Elbasan County (AL-03) 👨🏾‍👨🏾‍👶🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👨🏿‍👨🏿‍👦🏿‍👶🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Boy: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁩󠁮󠁫󠁡󠁿 Flag for Karnataka (IN-KA) 🏴󠁡󠁬󠀰󠀵󠁿 Flag for Gjirokastër County (AL-05) 🏴󠁪󠁰󠀰󠀱󠁿 Flag for Hokkaidō (JP-01) 👩🏾‍👨🏾‍👶🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁵󠁧󠁣󠁿 Flag for Central (UG-C) 👨🏼‍❤️‍💋‍👨 Kiss - Man: Medium-Light Skin Tone, Man 🏴󠁡󠁬󠀰󠀲󠁿 Flag for Durrës County (AL-02) 🏴󠁡󠁬󠀰󠀴󠁿 Flag for Fier County (AL-04) 🏴󠁡󠁬󠀰󠀶󠁿 Flag for Korçë County (AL-06) 🏴󠁰󠁹󠀱󠀶󠁿 Flag for Alto Paraguay (PY-16) 🏴󠁡󠁬󠀰󠀷󠁿 Flag for Kukës County (AL-07) 👨🏿‍❤️‍💋‍👨 Kiss - Man: Dark Skin Tone, Man 🏴󠁧󠁹󠁵󠁴󠁿 Flag for Upper Takutu-Upper Essequibo (GY-UT) 👨🏾‍👶🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👨🏿‍👨🏿‍👶🏿‍👧🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Baby: Dark Skin Tone, Girl: Dark Skin Tone 👨🏻‍👨🏻‍👶🏻‍👶🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Baby: Light Skin Tone, Baby: Light Skin Tone 🏴󠁡󠁬󠀰󠀹󠁿 Flag for Dibër County (AL-09) 🏴󠁡󠁬󠀰󠀸󠁿 Flag for Lezhë County (AL-08) 👨🏼‍👨🏼‍👶🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁡󠁬󠀱󠀱󠁿 Flag for Tirana County (AL-11) 🏴󠁡󠁤󠀰󠀶󠁿 Flag for Sant Julià de Lòria (AD-06) 🏴󠁢󠁲󠁢󠁡󠁿 Flag for Bahia (BR-BA) 🏴󠁡󠁬󠀱󠀰󠁿 Flag for Shkodër County (AL-10) 👩‍❤️‍💋‍👨🏿 Kiss - Woman, Man: Dark Skin Tone 👨🏽‍👨🏽‍👶🏽‍👶🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Baby: Medium Skin Tone, Baby: Medium Skin Tone 👨🏾‍👨🏾‍👶🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👩‍❤️‍💋‍👨🏽 Kiss - Woman, Man: Medium Skin Tone 🏴󠁡󠁬󠀱󠀲󠁿 Flag for Vlorë County (AL-12) 🏴󠁴󠁨󠀲󠀳󠁿 Flag for Trat (TH-23) 🏴󠁡󠁭󠁧󠁲󠁿 Flag for Gegharkunik (AM-GR) 👨🏿‍👨🏿‍👶🏿‍👶🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Baby: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁡󠁭󠁡󠁧󠁿 Flag for Aragatsotn (AM-AG) 🏴󠁡󠁭󠁡󠁲󠁿 Flag for Ararat (AM-AR) 🏴󠁡󠁭󠁥󠁲󠁿 Flag for Yerevan (AM-ER) 🏴󠁡󠁭󠁫󠁴󠁿 Flag for Kotayk (AM-KT) 🏴󠁦󠁲󠁣󠁯󠁲󠁿 Flag for Corse (FR-COR) 🏴󠁡󠁭󠁡󠁶󠁿 Flag for Armavir (AM-AV) 👩‍❤️‍💋‍👩🏿 Kiss - Woman, Woman: Dark Skin Tone 🏴󠁢󠁲󠁭󠁧󠁿 Flag for Minas Gerais (BR-MG) 🏴󠁣󠁧󠀱󠀶󠁿 Flag for Pointe-Noire (CG-16) 🏴󠁡󠁭󠁬󠁯󠁿 Flag for Lori (AM-LO) 🏴󠁤󠁺󠀲󠀱󠁿 Flag for Skikda (DZ-21) 🏴󠁡󠁭󠁳󠁨󠁿 Flag for Shirak (AM-SH) 👩‍❤️‍💋‍👩🏾 Kiss - Woman, Woman: Medium-Dark Skin Tone 🏴󠁡󠁤󠀰󠀷󠁿 Flag for Andorra la Vella (AD-07) 🏴󠁲󠁵󠁡󠁬󠁴󠁿 Flag for Altai Krai (RU-ALT) 🏴󠁳󠁩󠀱󠀶󠀷󠁿 Flag for Lovrenc na Pohorju (SI-167) 👩‍❤️‍💋‍👩🏼 Kiss - Woman, Woman: Medium-Light Skin Tone 👨🏿‍❤️‍💋‍👩🏻 Kiss - Man: Dark Skin Tone, Woman: Light Skin Tone 🏴󠁬󠁴󠁰󠁮󠁿 Flag for Panevėžys County (LT-PN) 🏴󠁤󠁯󠀳󠀵󠁿 Flag for Cibao Norte (DO-35) 🏴󠁮󠁯󠀱󠀰󠁿 Flag for Vest-Agder (NO-10) 👨‍❤️‍💋‍👩🏿 Kiss - Man, Woman: Dark Skin Tone 🏴󠁡󠁭󠁶󠁤󠁿 Flag for Vayots Dzor (AM-VD) 👩🏻‍❤️‍💋‍👩🏻 Kiss - Woman: Light Skin Tone, Woman: Light Skin Tone 🏴󠁵󠁳󠁶󠁴󠁿 Flag for Vermont (US-VT) 👨🏽‍❤️‍💋‍👨 Kiss - Man: Medium Skin Tone, Man 🏴󠁡󠁯󠁢󠁧󠁯󠁿 Flag for Bengo (AO-BGO) 👩🏻‍❤️‍💋‍👩 Kiss - Woman: Light Skin Tone, Woman 🏴󠁣󠁯󠁭󠁥󠁴󠁿 Flag for Meta (CO-MET) 🏴󠁮󠁬󠁢󠁱󠀲󠁿 Flag for Saba (NL-BQ2) 👩🏽‍❤️‍💋‍👩🏼 Kiss - Woman: Medium Skin Tone, Woman: Medium-Light Skin Tone 👨🏽‍👩🏽‍👦🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁡󠁯󠁢󠁧󠁵󠁿 Flag for Benguela (AO-BGU) 🏴󠁣󠁯󠁳󠁵󠁣󠁿 Flag for Sucre (CO-SUC) 🏴󠁡󠁯󠁣󠁣󠁵󠁿 Flag for Cuando Cubango (AO-CCU) 🏴󠁰󠁥󠁭󠁤󠁤󠁿 Flag for Madre de Dios (PE-MDD) 🏴󠁣󠁨󠁶󠁤󠁿 Flag for Vaud (CH-VD) 🏴󠁡󠁯󠁢󠁩󠁥󠁿 Flag for Bié (AO-BIE) 🏴󠁡󠁯󠁣󠁡󠁢󠁿 Flag for Cabinda (AO-CAB) 🏴󠁡󠁯󠁨󠁵󠁩󠁿 Flag for Huíla (AO-HUI) 🏴󠁡󠁯󠁣󠁵󠁳󠁿 Flag for Cuanza Sul (AO-CUS) 👨‍❤️‍💋‍👩🏽 Kiss - Man, Woman: Medium Skin Tone 👩‍👩‍👦‍👶 Family: Woman, Woman, Boy, Baby 🏴󠁡󠁯󠁨󠁵󠁡󠁿 Flag for Huambo (AO-HUA) 👨🏼‍❤️‍👩🏾 Couple With Heart - Man: Medium-Light Skin Tone, Woman: Medium-Dark Skin Tone 🏴󠁣󠁹󠀰󠀶󠁿 Flag for Kyrenia (CY-06) 👩🏼‍❤️‍💋‍👨🏻 Kiss - Woman: Medium-Light Skin Tone, Man: Light Skin Tone 🏴󠁡󠁥󠁵󠁱󠁿 Flag for Umm al-Quwain (AE-UQ) 🏴󠁡󠁯󠁬󠁳󠁵󠁿 Flag for Lunda Sul (AO-LSU) 🏴󠁬󠁲󠁣󠁭󠁿 Flag for Grand Cape Mount (LR-CM) 🏴󠁡󠁯󠁬󠁮󠁯󠁿 Flag for Lunda Norte (AO-LNO) 👩🏽‍❤️‍👨🏿 Couple With Heart - Woman: Medium Skin Tone, Man: Dark Skin Tone 👨🏾‍❤️‍👩🏾 Couple With Heart - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone 🏴󠁡󠁯󠁣󠁮󠁯󠁿 Flag for Cuanza Norte (AO-CNO) 🏴󠁡󠁯󠁭󠁡󠁬󠁿 Flag for Malanje (AO-MAL) 👩🏼‍❤️‍💋‍👩 Kiss - Woman: Medium-Light Skin Tone, Woman 👨🏼‍👩🏼‍👦🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁡󠁯󠁭󠁯󠁸󠁿 Flag for Moxico (AO-MOX) 🏴󠁡󠁯󠁮󠁡󠁭󠁿 Flag for Namibe (AO-NAM) 👨🏾‍👩🏾‍👦🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 󠁫 Tag Latin Small Letter K 🕴🏼‍♀️ Woman in Business Suit Levitating: Medium-Light Skin Tone 🏴󠁡󠁲󠁡󠁿 Flag for Salta (AR-A) 👨🏾‍👩🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁣󠁤󠁬󠁵󠁿 Flag for Lualaba (CD-LU) 🏴󠁡󠁲󠁢󠁿 Flag for Buenos Aires Province (AR-B) 👨🏿‍👩🏿‍👦🏿‍👦🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Boy: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁡󠁲󠁤󠁿 Flag for San Luis (AR-D) 🏴󠁡󠁯󠁺󠁡󠁩󠁿 Flag for Zaire (AO-ZAI) 🏴󠁴󠁲󠀰󠀳󠁿 Flag for Afyonkarahisar (TR-03) 0 Digit Zero 🏴󠁶󠁮󠀲󠀵󠁿 Flag for Quảng Trị (VN-25) 🕴🏿‍♀️ Woman in Business Suit Levitating: Dark Skin Tone 🏴󠁡󠁯󠁵󠁩󠁧󠁿 Flag for Uíge (AO-UIG) 👩🏾‍👧🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁵󠁡󠀱󠀸󠁿 Flag for Zhytomyrshchyna (UA-18) 👨🏾‍❤️‍💋‍👨🏽 Kiss - Man: Medium-Dark Skin Tone, Man: Medium Skin Tone 🏴󠁣󠁯󠁣󠁥󠁳󠁿 Flag for Cesar (CO-CES) 🏴󠁡󠁭󠁳󠁵󠁿 Flag for Syunik (AM-SU) 🏴󠁡󠁲󠁥󠁿 Flag for Entre Ríos (AR-E) 👨🏿‍❤️‍💋‍👩 Kiss - Man: Dark Skin Tone, Woman 🏴󠁡󠁲󠁦󠁿 Flag for La Rioja (AR-F) 🏴󠁫󠁺󠁶󠁯󠁳󠁿 Flag for East Kazakhstan (KZ-VOS) 🏴󠁡󠁦󠁷󠁡󠁲󠁿 Flag for Maidan Wardak (AF-WAR) 🏴󠁡󠁲󠁪󠁿 Flag for San Juan (AR-J) 👩🏾‍👩🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁡󠁯󠁬󠁵󠁡󠁿 Flag for Luanda (AO-LUA) 🏴󠁡󠁲󠁬󠁿 Flag for La Pampa (AR-L) 👩🏼‍❤️‍💋‍👩🏽 Kiss - Woman: Medium-Light Skin Tone, Woman: Medium Skin Tone 👨🏼‍👩🏼‍👦🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👨🏼‍👩🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁡󠁲󠁫󠁿 Flag for Catamarca (AR-K) 🏴󠁡󠁲󠁲󠁿 Flag for Río Negro (AR-R) 🏴󠁡󠁲󠁨󠁿 Flag for Chaco (AR-H) 🏴󠁡󠁲󠁰󠁿 Flag for Formosa (AR-P) 🏴󠁡󠁲󠁭󠁿 Flag for Mendoza (AR-M) 🏴󠁡󠁲󠁮󠁿 Flag for Misiones (AR-N) 🏴󠁡󠁲󠁱󠁿 Flag for Neuquén (AR-Q) 👨🏽‍👩🏽‍👦🏽‍👧🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Boy: Medium Skin Tone, Girl: Medium Skin Tone 🏴󠁡󠁲󠁴󠁿 Flag for Tucumán (AR-T) 🏴󠁡󠁲󠁳󠁿 Flag for Santa Fe (AR-S) 🏴󠁡󠁲󠁷󠁿 Flag for Corrientes (AR-W) 🏴󠁡󠁲󠁹󠁿 Flag for Jujuy (AR-Y) 🏴󠁡󠁲󠁶󠁿 Flag for Tierra del Fuego (AR-V) 🏴󠁡󠁲󠁵󠁿 Flag for Chubut (AR-U) 🏴󠁡󠁲󠁸󠁿 Flag for Córdoba (AR-X) 🏴󠁡󠁲󠁺󠁿 Flag for Santa Cruz (AR-Z) 🏴󠁡󠁲󠁧󠁿 Flag for Santiago del Estero (AR-G) 🏴󠁡󠁴󠀲󠁿 Flag for Carinthia (AT-2) 🏴󠁣󠁨󠁢󠁬󠁿 Flag for Basel-Landschaft (CH-BL) 👩🏿‍👧🏿‍👧🏿 Family - Woman: Dark Skin Tone, Girl: Dark Skin Tone, Girl: Dark Skin Tone 👨🏻‍👩🏻‍👦🏻‍👶🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Boy: Light Skin Tone, Baby: Light Skin Tone 👩🏻‍👧🏻‍👶🏻 Family - Woman: Light Skin Tone, Girl: Light Skin Tone, Baby: Light Skin Tone 👨‍👨‍👦‍👧 Family: Man, Man, Boy, Girl 🏴󠁡󠁴󠀳󠁿 Flag for Lower Austria (AT-3) 👩‍👶‍👦 Family: Woman, Baby, Boy 🏴󠁭󠁲󠀱󠀳󠁿 Flag for Nouakchott Ouest (MR-13) 👨🏼‍👩🏼‍👦🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁣󠁦󠁭󠁢󠁿 Flag for Mbomou (CF-MB) 🏴󠁡󠁴󠀶󠁿 Flag for Styria (AT-6) 🏴󠁰󠁨󠀰󠀱󠁿 Flag for Ilocos (PH-01) 🏴󠁡󠁴󠀷󠁿 Flag for Tyrol (AT-7) 🏴󠁣󠁮󠀵󠀲󠁿 Flag for Guizhou (CN-52) 🏴󠁬󠁡󠁸󠁳󠁿 Flag for Xaisomboun (LA-XS) 🏴󠁡󠁴󠀸󠁿 Flag for Vorarlberg (AT-8) 👨🏼‍👨🏼‍👦🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁡󠁴󠀵󠁿 Flag for Salzburg (AT-5) 👨🏿‍👩🏿‍👦🏿‍👧🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Boy: Dark Skin Tone, Girl: Dark Skin Tone 👩‍👩‍👶‍👶 Family: Woman, Woman, Baby, Baby 👩‍👨‍👧‍👦 Family: Woman, Man, Girl, Boy 👩‍👨‍👧 Family: Woman, Man, Girl 👩‍👦‍👶 Family: Woman, Boy, Baby 🏴󠁡󠁵󠁮󠁳󠁷󠁿 Flag for New South Wales (AU-NSW) 👩‍👨‍👧‍👶 Family: Woman, Man, Girl, Baby 👩🏽‍👧🏽‍👶🏽 Family - Woman: Medium Skin Tone, Girl: Medium Skin Tone, Baby: Medium Skin Tone 🏴󠁡󠁵󠁮󠁴󠁿 Flag for Northern Territory (AU-NT) 👩🏿‍👧🏿‍👦🏿 Family - Woman: Dark Skin Tone, Girl: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁡󠁵󠁱󠁬󠁤󠁿 Flag for Queensland (AU-QLD) 2 Digit Two 👩‍👨‍👧‍👧 Family: Woman, Man, Girl, Girl 👩🏼‍👧🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁡󠁴󠀴󠁿 Flag for Upper Austria (AT-4) 🏴󠁧󠁲󠁡󠁿 Flag for East Macedonia and Thrace (GR-A) 👨🏽‍👩🏽‍👦🏽‍👶🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Boy: Medium Skin Tone, Baby: Medium Skin Tone 👨🏾‍👩🏾‍👦🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👨‍👶‍👧 Family: Man, Baby, Girl 👨🏻‍👩🏻‍👧🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Girl: Light Skin Tone 👨🏿‍👩🏿‍👦🏿‍👶🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Boy: Dark Skin Tone, Baby: Dark Skin Tone 👩‍👨‍👶 Family: Woman, Man, Baby 🏴󠁵󠁳󠁮󠁥󠁿 Flag for Nebraska (US-NE) 🏴󠁡󠁺󠁡󠁧󠁡󠁿 Flag for Agstafa (AZ-AGA) 🏴󠁡󠁦󠁴󠁡󠁫󠁿 Flag for Takhar (AF-TAK) 🏴󠁡󠁵󠁷󠁡󠁿 Flag for Western Australia (AU-WA) 🏴󠁡󠁺󠁡󠁧󠁣󠁿 Flag for Aghjabadi (AZ-AGC) 🏴󠁡󠁺󠁡󠁳󠁴󠁿 Flag for Astara (AZ-AST) 🏴󠁡󠁺󠁢󠁡󠁬󠁿 Flag for Balakan (AZ-BAL) 👩‍❤️‍💋‍👨🏼 Kiss - Woman, Man: Medium-Light Skin Tone 🏴󠁵󠁳󠁣󠁡󠁿 Flag for California (US-CA) 🏴󠁡󠁺󠁡󠁧󠁳󠁿 Flag for Agdash (AZ-AGS) 🏴󠁡󠁺󠁢󠁡󠁿 Flag for Baku (AZ-BA) 👨🏻‍❤️‍💋‍👩🏿 Kiss - Man: Light Skin Tone, Woman: Dark Skin Tone 🏴󠁡󠁵󠁶󠁩󠁣󠁿 Flag for Victoria (AU-VIC) 🏴󠁡󠁺󠁡󠁧󠁭󠁿 Flag for Agdam (AZ-AGM) 👨🏻‍👧🏻 Family - Man: Light Skin Tone, Girl: Light Skin Tone 🏴󠁡󠁺󠁢󠁡󠁲󠁿 Flag for Barda (AZ-BAR) 👨🏽‍👩🏽‍👧🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Girl: Medium Skin Tone 👩🏾‍👧🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁡󠁺󠁡󠁧󠁵󠁿 Flag for Agsu (AZ-AGU) 🏴󠁣󠁤󠁴󠁡󠁿 Flag for Tanganyika (CD-TA) 👩🏻‍❤️‍👨🏼 Couple With Heart - Woman: Light Skin Tone, Man: Medium-Light Skin Tone 🏴󠁡󠁺󠁢󠁩󠁬󠁿 Flag for Bilasuvar (AZ-BIL) 🏴󠁡󠁺󠁣󠁡󠁬󠁿 Flag for Jalilabad (AZ-CAL) 🏴󠁡󠁺󠁣󠁡󠁢󠁿 Flag for Jabrayil (AZ-CAB) 🏴󠁡󠁺󠁢󠁥󠁹󠁿 Flag for Beylagan (AZ-BEY) 🏴󠁳󠁩󠀰󠀸󠀵󠁿 Flag for Novo Mesto (SI-085) 🏴󠁣󠁧󠀹󠁿 Flag for Niari (CG-9) 🏴󠁡󠁺󠁤󠁡󠁳󠁿 Flag for Dashkasan (AZ-DAS) 🏴󠁡󠁺󠁦󠁵󠁺󠁿 Flag for Fizuli (AZ-FUZ) 👩🏿‍❤️‍💋‍👨🏽 Kiss - Woman: Dark Skin Tone, Man: Medium Skin Tone 👨🏿‍❤️‍👨🏾 Couple With Heart - Man: Dark Skin Tone, Man: Medium-Dark Skin Tone 🏴󠁡󠁺󠁧󠁯󠁹󠁿 Flag for Goychay (AZ-GOY) 🏴󠁡󠁺󠁧󠁯󠁲󠁿 Flag for Goranboy (AZ-GOR) 🏴󠁡󠁺󠁧󠁡󠁿 Flag for Ganja (AZ-GA) 🏴󠁱󠁡󠁵󠁳󠁿 Flag for Umm Salal (QA-US) 🏴󠁦󠁪󠁥󠁿 Flag for Eastern (FJ-E) 🏴󠁡󠁺󠁧󠁹󠁧󠁿 Flag for Goygol (AZ-GYG) 🏴󠁡󠁺󠁨󠁡󠁣󠁿 Flag for Hajigabul (AZ-HAC) 👩🏿‍❤️‍💋‍👩 Kiss - Woman: Dark Skin Tone, Woman 🏴󠁬󠁶󠀰󠀷󠀷󠁿 Flag for Rēzekne Municipality (LV-077) 🏴󠁡󠁵󠁡󠁣󠁴󠁿 Flag for Australian Capital Territory (AU-ACT) 👨🏽‍❤️‍💋‍👩🏾 Kiss - Man: Medium Skin Tone, Woman: Medium-Dark Skin Tone 🏴󠁮󠁧󠁦󠁣󠁿 Flag for Federal Capital Territory (NG-FC) 🏴󠁲󠁵󠁢󠁲󠁹󠁿 Flag for Bryansk (RU-BRY) 🏴󠁡󠁭󠁴󠁶󠁿 Flag for Tavush (AM-TV) 🏴󠁥󠁣󠁳󠁤󠁿 Flag for Santo Domingo de los Tsáchilas (EC-SD) 👩🏼‍❤️‍👩 Couple With Heart - Woman: Medium-Light Skin Tone, Woman 🏴󠁡󠁺󠁩󠁭󠁩󠁿 Flag for Imishli (AZ-IMI) 🏴󠁴󠁭󠁳󠁿 Flag for Aşgabat (TM-S) 👨‍❤️‍👩🏾 Couple With Heart - Man, Woman: Medium-Dark Skin Tone 🏴󠁬󠁡󠁸󠁥󠁿 Flag for Sekong (LA-XE) 🏴󠁲󠁯󠁧󠁪󠁿 Flag for Gorj (RO-GJ) 👨🏻‍❤️‍👨 Couple With Heart - Man: Light Skin Tone, Man 🏴󠁡󠁺󠁫󠁵󠁲󠁿 Flag for Kurdamir (AZ-KUR) 👩🏻‍👨🏻‍👦🏻‍👧🏻 Family - Woman: Light Skin Tone, Man: Light Skin Tone, Boy: Light Skin Tone, Girl: Light Skin Tone 🏴󠁡󠁺󠁫󠁡󠁬󠁿 Flag for Kalbajar (AZ-KAL) 🏴󠁡󠁺󠁧󠁡󠁤󠁿 Flag for Gadabay (AZ-GAD) 🏴󠁡󠁺󠁬󠁡󠁣󠁿 Flag for Lachin (AZ-LAC) 🏴󠁡󠁺󠁬󠁡󠁿 Flag for Lankaran (AZ-LA) 🏴󠁶󠁮󠁳󠁧󠁿 Flag for Ho Chi Minh City (VN-SG) 🏴󠁡󠁺󠁬󠁥󠁲󠁿 Flag for Lerik (AZ-LER) 🏴󠁡󠁺󠁭󠁩󠁿 Flag for Mingachevir (AZ-MI) 👩🏾‍👨🏾‍👧🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁡󠁺󠁮󠁡󠁿 Flag for Naftalan (AZ-NA) 🏴󠁡󠁺󠁭󠁡󠁳󠁿 Flag for Masally (AZ-MAS) 👨‍❤️‍👩 Couple With Heart - Man, Woman 🏴󠁡󠁺󠁬󠁡󠁮󠁿 Flag for Lankaran District (AZ-LAN) 👩🏼‍👨🏼‍👧🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👩🏽‍❤️‍💋‍👨🏾 Kiss - Woman: Medium Skin Tone, Man: Medium-Dark Skin Tone 👩🏿‍👧🏿‍👶🏿 Family - Woman: Dark Skin Tone, Girl: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁡󠁺󠁮󠁥󠁦󠁿 Flag for Neftchala (AZ-NEF) 🏴󠁡󠁺󠁮󠁸󠁿 Flag for Nakhchivan AR (AZ-NX) 🏴󠁳󠁩󠀰󠀱󠀱󠁿 Flag for Celje (SI-011) 🏴󠁬󠁴󠀳󠀲󠁿 Flag for Panevėžio Municipality (LT-32) 👩🏿‍❤️‍💋‍👩🏽 Kiss - Woman: Dark Skin Tone, Woman: Medium Skin Tone 👨🏻‍❤️‍👩🏿 Couple With Heart - Man: Light Skin Tone, Woman: Dark Skin Tone 🏴󠁡󠁺󠁩󠁳󠁭󠁿 Flag for Ismailli (AZ-ISM) 󠁨 Tag Latin Small Letter H 👩🏾‍❤️‍👨🏻 Couple With Heart - Woman: Medium-Dark Skin Tone, Man: Light Skin Tone 👩🏻‍👶🏻 Family - Woman: Light Skin Tone, Baby: Light Skin Tone 🏴󠁣󠁦󠁮󠁭󠁿 Flag for Nana-Mambéré (CF-NM) 🏴󠁡󠁺󠁱󠁯󠁢󠁿 Flag for Gobustan (AZ-QOB) 👩🏿‍❤️‍💋‍👨🏻 Kiss - Woman: Dark Skin Tone, Man: Light Skin Tone 👩🏿‍❤️‍💋‍👩🏿 Kiss - Woman: Dark Skin Tone, Woman: Dark Skin Tone 🏴󠁡󠁺󠁱󠁢󠁩󠁿 Flag for Qubadli (AZ-QBI) 🏴󠁡󠁺󠁱󠁡󠁺󠁿 Flag for Qazakh (AZ-QAZ) 🏴󠁲󠁯󠁢󠁶󠁿 Flag for Braşov (RO-BV) 👨‍👩‍👧‍👶 Family: Man, Woman, Girl, Baby 🏴󠁡󠁺󠁱󠁢󠁡󠁿 Flag for Quba (AZ-QBA) 🏴󠁡󠁺󠁱󠁡󠁢󠁿 Flag for Qabala (AZ-QAB) 🏴󠁣󠁨󠁵󠁲󠁿 Flag for Uri (CH-UR) 🏴󠁡󠁺󠁯󠁧󠁵󠁿 Flag for Oghuz (AZ-OGU) 🏴󠁡󠁺󠁱󠁡󠁸󠁿 Flag for Qakh (AZ-QAX) 🏴󠁳󠁩󠀲󠀰󠀶󠁿 Flag for Šmarješke Toplice (SI-206) 👨🏾‍❤️‍💋‍👩🏿 Kiss - Man: Medium-Dark Skin Tone, Woman: Dark Skin Tone 🏴󠁡󠁧󠀰󠀷󠁿 Flag for Saint Peter (AG-07) 👨🏻‍👩🏻‍👧🏻‍👧🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Girl: Light Skin Tone, Girl: Light Skin Tone 🏴󠁬󠁲󠁭󠁹󠁿 Flag for Maryland (LR-MY) 🏴󠁡󠁵󠁳󠁡󠁿 Flag for South Australia (AU-SA) 🏴󠁡󠁺󠁱󠁵󠁳󠁿 Flag for Qusar (AZ-QUS) 🏴󠁡󠁺󠁳󠁡󠁢󠁿 Flag for Sabirabad (AZ-SAB) 👨‍❤️‍👩🏽 Couple With Heart - Man, Woman: Medium Skin Tone 👨‍❤️‍👩🏼 Couple With Heart - Man, Woman: Medium-Light Skin Tone 🏴󠁡󠁺󠁳󠁡󠁴󠁿 Flag for Saatly (AZ-SAT) 🏴󠁡󠁺󠁳󠁢󠁮󠁿 Flag for Shabran (AZ-SBN) 👨🏼‍❤️‍👩🏽 Couple With Heart - Man: Medium-Light Skin Tone, Woman: Medium Skin Tone 🏴󠁡󠁺󠁳󠁡󠁫󠁿 Flag for Shaki District (AZ-SAK) 🏴󠁣󠁯󠁣󠁡󠁳󠁿 Flag for Casanare (CO-CAS) 👨‍👩‍👶‍👶 Family: Man, Woman, Baby, Baby 🏴󠁡󠁺󠁳󠁲󠁿 Flag for Shirvan (AZ-SR) 🏴󠁡󠁺󠁳󠁵󠁳󠁿 Flag for Shusha (AZ-SUS) 🏴󠁣󠁨󠁶󠁳󠁿 Flag for Valais (CH-VS) 👩🏽‍👶🏽 Family - Woman: Medium Skin Tone, Baby: Medium Skin Tone 👩🏻‍❤️‍💋‍👨🏿 Kiss - Woman: Light Skin Tone, Man: Dark Skin Tone 🏴󠁡󠁺󠁳󠁡󠁿 Flag for Shaki (AZ-SA) 🏴󠁦󠁲󠁭󠁱󠁿 Flag for Martinique (FR-MQ) 🏴󠁡󠁺󠁳󠁭󠁿 Flag for Sumqayit (AZ-SM) 🏴󠁡󠁺󠁳󠁩󠁹󠁿 Flag for Siazan (AZ-SIY) 🏴󠁡󠁺󠁳󠁭󠁩󠁿 Flag for Shamakhi (AZ-SMI) 👩🏿‍❤️‍💋‍👨 Kiss - Woman: Dark Skin Tone, Man 🏴󠁡󠁺󠁳󠁭󠁸󠁿 Flag for Samukh (AZ-SMX) 👨🏻‍👩🏻‍👧🏻‍👶🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Girl: Light Skin Tone, Baby: Light Skin Tone 🏴󠁡󠁺󠁴󠁯󠁶󠁿 Flag for Tovuz (AZ-TOV) 🏴󠁡󠁺󠁸󠁡󠁣󠁿 Flag for Khachmaz (AZ-XAC) 🏴󠁡󠁺󠁵󠁣󠁡󠁿 Flag for Ujar (AZ-UCA) 🏴󠁡󠁺󠁴󠁡󠁲󠁿 Flag for Tartar (AZ-TAR) 👨🏿‍❤️‍💋‍👨🏻 Kiss - Man: Dark Skin Tone, Man: Light Skin Tone 👩🏼‍👧🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👨🏽‍👩🏽‍👧🏽‍👶🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Girl: Medium Skin Tone, Baby: Medium Skin Tone 🏴󠁡󠁺󠁸󠁩󠁺󠁿 Flag for Khizi (AZ-XIZ) 👨🏽‍❤️‍👨🏼 Couple With Heart - Man: Medium Skin Tone, Man: Medium-Light Skin Tone 🏴󠁡󠁺󠁸󠁣󠁩󠁿 Flag for Khojali (AZ-XCI) 🏴󠁶󠁥󠁹󠁿 Flag for Delta Amacuro (VE-Y) 🏴󠁡󠁺󠁸󠁡󠁿 Flag for Stepanakert (AZ-XA) 🏴󠁡󠁺󠁹󠁡󠁲󠁿 Flag for Yardymli (AZ-YAR) 🏴󠁡󠁺󠁹󠁥󠁶󠁿 Flag for Yevlakh District (AZ-YEV) 🏴󠁡󠁺󠁺󠁡󠁱󠁿 Flag for Zaqatala (AZ-ZAQ) 👩🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁡󠁺󠁹󠁥󠁿 Flag for Yevlakh (AZ-YE) 🏴󠁢󠁡󠁢󠁩󠁨󠁿 Flag for Federation of Bosnia and Herzegovina (BA-BIH) 🏴󠁡󠁺󠁺󠁡󠁲󠁿 Flag for Zardab (AZ-ZAR) 🏴󠁡󠁺󠁳󠁡󠁬󠁿 Flag for Salyan (AZ-SAL) 🏴󠁣󠁨󠁺󠁧󠁿 Flag for Zug (CH-ZG) 👨🏾‍👩🏾‍👧🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 👨🏿‍👩🏿‍👧🏿‍👶🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Girl: Dark Skin Tone, Baby: Dark Skin Tone 👩🏿‍👶🏿 Family - Woman: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁢󠁡󠁳󠁲󠁰󠁿 Flag for Republika Srpska (BA-SRP) 👨🏽‍❤️‍👩 Couple With Heart - Man: Medium Skin Tone, Woman 👨🏻‍👩🏻‍👶🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Baby: Light Skin Tone 🏴󠁥󠁳󠁡󠁮󠁿 Flag for Andalusia (ES-AN) 👨🏼‍👩🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁢󠁢󠀰󠀴󠁿 Flag for Saint James (BB-04) 👨🏾‍❤️‍👩🏼 Couple With Heart - Man: Medium-Dark Skin Tone, Woman: Medium-Light Skin Tone 🏴󠁢󠁢󠀰󠀳󠁿 Flag for Saint George (BB-03) 🏴󠁢󠁢󠀰󠀲󠁿 Flag for Saint Andrew (BB-02) 👨‍👩‍👶‍👦 Family: Man, Woman, Baby, Boy 👨🏽‍👩🏽‍👶🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Baby: Medium Skin Tone 🏴󠁢󠁢󠀰󠀵󠁿 Flag for Saint John (BB-05) 👨🏾‍👩🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁢󠁢󠀰󠀶󠁿 Flag for Saint Joseph (BB-06) 🏴󠁬󠁫󠀱󠁿 Flag for Western (LK-1) 🏴󠁢󠁹󠁢󠁲󠁿 Flag for Brest (BY-BR) 🏴󠁡󠁺󠁳󠁫󠁲󠁿 Flag for Shamkir (AZ-SKR) 🏴󠁢󠁢󠀰󠀷󠁿 Flag for Saint Lucy (BB-07) 👩🏻‍👶🏻‍👦🏻 Family - Woman: Light Skin Tone, Baby: Light Skin Tone, Boy: Light Skin Tone 🏴󠁥󠁳󠁣󠁭󠁿 Flag for Castile-La Mancha (ES-CM) 🏴󠁢󠁢󠀱󠀰󠁿 Flag for Saint Philip (BB-10) 🏴󠁶󠁣󠀰󠀴󠁿 Flag for Saint George (VC-04) 👨🏻‍👩🏻‍👶🏻‍👦🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Baby: Light Skin Tone, Boy: Light Skin Tone 👩🏻‍👧🏻‍👧🏻 Family - Woman: Light Skin Tone, Girl: Light Skin Tone, Girl: Light Skin Tone 🏴󠁢󠁤󠁡󠁿 Flag for Barisal (BD-A) 🏴󠁡󠁺󠁺󠁡󠁮󠁿 Flag for Zangilan (AZ-ZAN) 🏴󠁪󠁭󠀰󠀱󠁿 Flag for Kingston (JM-01) 👨🏼‍👩🏼‍👶🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁢󠁤󠁥󠁿 Flag for Rajshahi Division (BD-E) 🏴󠁢󠁤󠁦󠁿 Flag for Rangpur Division (BD-F) 🏴󠁢󠁤󠁣󠁿 Flag for Dhaka Division (BD-C) 🏴󠁢󠁤󠁤󠁿 Flag for Khulna Division (BD-D) 🏴󠁢󠁢󠀰󠀹󠁿 Flag for Saint Peter (BB-09) 🏴󠁳󠁩󠀰󠀵󠀸󠁿 Flag for Lenart (SI-058) 👩🏼‍👶🏼 Family - Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁢󠁦󠀰󠀲󠁿 Flag for Cascades (BF-02) 🏴󠁢󠁤󠁨󠁿 Flag for Mymensingh Division (BD-H) 🏴󠁢󠁥󠁷󠁡󠁬󠁿 Flag for Wallonia (BE-WAL) 🏴󠁭󠁵󠁢󠁲󠁿 Flag for Beau-Bassin Rose-Hill (MU-BR) 🏴󠁢󠁦󠀰󠀴󠁿 Flag for Centre-Est (BF-04) 🏴󠁣󠁮󠀹󠀱󠁿 Flag for Hong Kong SAR China (CN-91) 🏴󠁢󠁦󠀰󠀱󠁿 Flag for Boucle du Mouhoun (BF-01) 🏴󠁢󠁦󠀰󠀳󠁿 Flag for Centre (BF-03) 🏴󠁤󠁫󠀸󠀲󠁿 Flag for Central Denmark (DK-82) 🏴󠁢󠁦󠀰󠀷󠁿 Flag for Centre-Sud (BF-07) 👨🏽‍👩🏽‍👶🏽‍👦🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Baby: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁢󠁦󠀰󠀶󠁿 Flag for Centre-Ouest (BF-06) 🏴󠁢󠁦󠀰󠀵󠁿 Flag for Centre-Nord (BF-05) 🏴󠁢󠁢󠀰󠀸󠁿 Flag for Saint Michael (BB-08) 🏴󠁢󠁢󠀱󠀱󠁿 Flag for Saint Thomas (BB-11) 👨🏽‍❤️‍👩🏿 Couple With Heart - Man: Medium Skin Tone, Woman: Dark Skin Tone 🏴󠁢󠁦󠀰󠀸󠁿 Flag for Est (BF-08) 🏴󠁢󠁥󠁢󠁲󠁵󠁿 Flag for Brussels (BE-BRU) 🏴󠁢󠁤󠁧󠁿 Flag for Sylhet Division (BD-G) 🏴󠁢󠁦󠀱󠀱󠁿 Flag for Plateau-Central (BF-11) 🏴󠁢󠁤󠁢󠁿 Flag for Chittagong Division (BD-B) 🏴󠁢󠁦󠀱󠀳󠁿 Flag for Sud-Ouest (BF-13) 👨🏾‍👩🏾‍👶🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁢󠁧󠀰󠀵󠁿 Flag for Vidin (BG-05) 🏴󠁢󠁧󠀰󠀳󠁿 Flag for Varna (BG-03) 👨🏿‍❤️‍👩🏽 Couple With Heart - Man: Dark Skin Tone, Woman: Medium Skin Tone 🏴󠁢󠁧󠀰󠀲󠁿 Flag for Burgas (BG-02) 🏴󠁢󠁦󠀱󠀰󠁿 Flag for Nord (BF-10) 🏴󠁢󠁧󠀰󠀴󠁿 Flag for Veliko Tarnovo (BG-04) 👨🏽‍👩🏽‍👧🏽‍👧🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Girl: Medium Skin Tone, Girl: Medium Skin Tone 🏴󠁢󠁧󠀰󠀷󠁿 Flag for Gabrovo (BG-07) 👨🏿‍👩🏿‍👶🏿‍👦🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Baby: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁢󠁧󠀰󠀸󠁿 Flag for Dobrich (BG-08) 🏴󠁢󠁦󠀱󠀲󠁿 Flag for Sahel (BF-12) 🏴󠁡󠁵󠁴󠁡󠁳󠁿 Flag for Tasmania (AU-TAS) 👨🏿‍❤️‍👩🏻 Couple With Heart - Man: Dark Skin Tone, Woman: Light Skin Tone 👩🏻‍👧🏻‍👦🏻 Family - Woman: Light Skin Tone, Girl: Light Skin Tone, Boy: Light Skin Tone 👨🏻‍👩🏻‍👶🏻‍👧🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Baby: Light Skin Tone, Girl: Light Skin Tone 👨🏼‍👩🏼‍👶🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👨🏾‍❤️‍💋‍👩🏾 Kiss - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone 🏴󠁡󠁺󠁸󠁶󠁤󠁿 Flag for Khojavend (AZ-XVD) 🏴󠁢󠁧󠀱󠀱󠁿 Flag for Lovech (BG-11) 🏴󠁣󠁬󠁬󠁩󠁿 Flag for Libertador General Bernardo O’Higgins (CL-LI) 🏴󠁢󠁧󠀱󠀳󠁿 Flag for Pazardzhik (BG-13) 👨🏿‍❤️‍👩🏿 Couple With Heart - Man: Dark Skin Tone, Woman: Dark Skin Tone 🏴󠁢󠁧󠀱󠀴󠁿 Flag for Pernik (BG-14) 🏴󠁢󠁧󠀱󠀰󠁿 Flag for Kyustendil (BG-10) 🏴󠁥󠁧󠁢󠁡󠁿 Flag for Red Sea (EG-BA) 🏴󠁴󠁺󠀱󠀱󠁿 Flag for Zanzibar Central/South (TZ-11) 👨🏿‍👩🏿‍👧🏿‍👦🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Girl: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁢󠁧󠀱󠀵󠁿 Flag for Pleven (BG-15) 👨🏿‍👨🏿‍👦🏿‍👦🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Boy: Dark Skin Tone, Boy: Dark Skin Tone 👨🏽‍👩🏽‍👶🏽‍👧🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Baby: Medium Skin Tone, Girl: Medium Skin Tone 🏴󠁢󠁧󠀲󠀱󠁿 Flag for Smolyan (BG-21) 🏴󠁢󠁧󠀰󠀱󠁿 Flag for Blagoevgrad (BG-01) 🏴󠁤󠁺󠀳󠀴󠁿 Flag for Bordj Bou Arréridj (DZ-34) 🏴󠁢󠁧󠀱󠀶󠁿 Flag for Plovdiv (BG-16) 🏴󠁣󠁩󠁶󠁢󠁿 Flag for Vallée du Bandama (CI-VB) 🏴󠁢󠁧󠀱󠀹󠁿 Flag for Silistra (BG-19) 👩‍❤️‍👨🏼 Couple With Heart - Woman, Man: Medium-Light Skin Tone 🏴󠁢󠁧󠀱󠀷󠁿 Flag for Razgrad (BG-17) 👨🏾‍❤️‍👨 Couple With Heart - Man: Medium-Dark Skin Tone, Man 🏴󠁡󠁯󠁣󠁮󠁮󠁿 Flag for Cunene (AO-CNN) 🏴󠁢󠁧󠀲󠀰󠁿 Flag for Sliven (BG-20) 🧕🏻‍♀️ Woman With Headscarf: Light Skin Tone 🏴󠁢󠁧󠀲󠀵󠁿 Flag for Targovishte (BG-25) 👩🏼‍👩🏼‍👶🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👨🏾‍👩🏾‍👶🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁢󠁧󠀲󠀳󠁿 Flag for Sofia District (BG-23) 🏴󠁢󠁧󠀲󠀲󠁿 Flag for Sofia (BG-22) 👨🏿‍👩🏿‍👧🏿‍👧🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Girl: Dark Skin Tone, Girl: Dark Skin Tone 👨🏻‍❤️‍💋‍👩🏾 Kiss - Man: Light Skin Tone, Woman: Medium-Dark Skin Tone 🧕🏽‍♀️ Woman With Headscarf: Medium Skin Tone 🏴󠁢󠁧󠀲󠀸󠁿 Flag for Yambol (BG-28) 🏴󠁢󠁨󠀱󠀳󠁿 Flag for Capital (BH-13) 🏴󠁢󠁧󠀲󠀶󠁿 Flag for Haskovo (BG-26) 🏴󠁬󠁩󠀰󠀷󠁿 Flag for Schaan (LI-07) 👨🏿‍👩🏿‍👶🏿‍👧🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Baby: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁢󠁨󠀱󠀵󠁿 Flag for Muharraq (BH-15) 🏴󠁢󠁨󠀱󠀴󠁿 Flag for Southern (BH-14) 🧕🏾‍♀️ Woman With Headscarf: Medium-Dark Skin Tone 🏴󠁲󠁯󠁳󠁢󠁿 Flag for Sibiu (RO-SB) 🧕🏼‍♀️ Woman With Headscarf: Medium-Light Skin Tone 👩🏻‍❤️‍👨🏿 Couple With Heart - Woman: Light Skin Tone, Man: Dark Skin Tone 🏴󠁢󠁨󠀱󠀷󠁿 Flag for Northern (BH-17) 🏴󠁢󠁩󠁢󠁢󠁿 Flag for Bubanza (BI-BB) 👩🏻‍❤️‍👩 Couple With Heart - Woman: Light Skin Tone, Woman 🏴󠁢󠁥󠁶󠁬󠁧󠁿 Flag for Flanders (BE-VLG) 👩🏽‍👧🏽 Family - Woman: Medium Skin Tone, Girl: Medium Skin Tone 👨🏻‍👩🏻‍👶🏻‍👶🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Baby: Light Skin Tone, Baby: Light Skin Tone 🏴󠁢󠁩󠁢󠁭󠁿 Flag for Bujumbura (BI-BM) 🧕🏿‍♀️ Woman With Headscarf: Dark Skin Tone 🏴󠁢󠁩󠁢󠁬󠁿 Flag for Bujumbura Rural (BI-BL) 👨🏾‍❤️‍💋‍👩🏽 Kiss - Man: Medium-Dark Skin Tone, Woman: Medium Skin Tone 👨🏼‍👩🏼‍👶🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👨🏻‍👨🏻‍👦🏻‍👶🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Boy: Light Skin Tone, Baby: Light Skin Tone 🏴󠁢󠁩󠁣󠁡󠁿 Flag for Cankuzo (BI-CA) 🏴󠁢󠁧󠀱󠀲󠁿 Flag for Montana (BG-12) 🏴󠁬󠁶󠀰󠀸󠀵󠁿 Flag for Sala (LV-085) ⃣ Combining Enclosing Keycap 🏴󠁢󠁩󠁢󠁲󠁿 Flag for Bururi (BI-BR) 🏴󠁢󠁧󠀰󠀹󠁿 Flag for Kardzhali (BG-09) 🏴󠁢󠁩󠁲󠁭󠁿 Flag for Rumonge (BI-RM) 🏴󠁮󠁬󠁡󠁷󠁿 Flag for Aruba (NL-AW) 🏴󠁢󠁩󠁭󠁹󠁿 Flag for Muyinga (BI-MY) 🏴󠁢󠁩󠁲󠁴󠁿 Flag for Rutana (BI-RT) 🏴󠁢󠁩󠁲󠁹󠁿 Flag for Ruyigi (BI-RY) 🏴󠁢󠁩󠁫󠁩󠁿 Flag for Kirundo (BI-KI) 🏴󠁢󠁩󠁫󠁹󠁿 Flag for Kayanza (BI-KY) 🏴󠁢󠁩󠁭󠁷󠁿 Flag for Mwaro (BI-MW) 🏴󠁢󠁧󠀲󠀷󠁿 Flag for Shumen (BG-27) 🏴󠁢󠁩󠁮󠁧󠁿 Flag for Ngozi (BI-NG) 🏴󠁢󠁩󠁫󠁲󠁿 Flag for Karuzi (BI-KR) 🏴󠁢󠁩󠁭󠁵󠁿 Flag for Muramvya (BI-MU) 🏴󠁭󠁡󠀱󠀵󠁿 Flag for Laâyoune-Boujdour-Sakia El Hamra (MA-15) 👨🏽‍👩🏽‍👶🏽‍👶🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Baby: Medium Skin Tone, Baby: Medium Skin Tone 👩🏾‍👨🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👨🏾‍👩🏾‍👶🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁢󠁪󠁤󠁯󠁿 Flag for Donga (BJ-DO) 👩🏽‍👨🏽‍👶🏽‍👦🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Baby: Medium Skin Tone, Boy: Medium Skin Tone 👨🏽‍❤️‍💋‍👩🏼 Kiss - Man: Medium Skin Tone, Woman: Medium-Light Skin Tone 🏴󠁦󠁲󠁨󠁤󠁦󠁿 Flag for Hauts-de-France (FR-HDF) 🏴󠁢󠁪󠁡󠁬󠁿 Flag for Alibori (BJ-AL) 🏴󠁢󠁪󠁡󠁫󠁿 Flag for Atakora (BJ-AK) 👨🏿‍👩🏿‍👶🏿‍👶🏿 Family - Man: Dark Skin Tone, Woman: Dark Skin Tone, Baby: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁢󠁪󠁬󠁩󠁿 Flag for Littoral (BJ-LI) 🏴󠁢󠁪󠁢󠁯󠁿 Flag for Borgou (BJ-BO) 👩‍👩‍👧‍👶 Family: Woman, Woman, Girl, Baby 🏴󠁵󠁳󠁮󠁤󠁿 Flag for North Dakota (US-ND) 👨🏼‍❤️‍💋‍👨🏾 Kiss - Man: Medium-Light Skin Tone, Man: Medium-Dark Skin Tone 🏴󠁢󠁪󠁫󠁯󠁿 Flag for Kouffo (BJ-KO) 🏴󠁢󠁪󠁰󠁬󠁿 Flag for Plateau (BJ-PL) 🏴󠁧󠁤󠀱󠀰󠁿 Flag for Carriacou and Petite Martinique (GD-10) 🏴󠁢󠁪󠁺󠁯󠁿 Flag for Zou (BJ-ZO) 👩🏼‍❤️‍👨🏻 Couple With Heart - Woman: Medium-Light Skin Tone, Man: Light Skin Tone 👩🏽‍❤️‍👨🏽 Couple With Heart - Woman: Medium Skin Tone, Man: Medium Skin Tone 👨🏽‍❤️‍👩🏼 Couple With Heart - Man: Medium Skin Tone, Woman: Medium-Light Skin Tone 👩🏽‍❤️‍👨🏻 Couple With Heart - Woman: Medium Skin Tone, Man: Light Skin Tone 🏴󠁬󠁢󠁢󠁩󠁿 Flag for Beqaa (LB-BI) 🏴󠁢󠁮󠁴󠁥󠁿 Flag for Temburong (BN-TE) 👩🏻‍👦🏻 Family - Woman: Light Skin Tone, Boy: Light Skin Tone 🏴󠁢󠁮󠁴󠁵󠁿 Flag for Tutong (BN-TU) 🏴󠁢󠁮󠁢󠁭󠁿 Flag for Brunei-Muara (BN-BM) 👨🏻‍👩🏻‍👦🏻‍👦🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Boy: Light Skin Tone, Boy: Light Skin Tone 🏴󠁢󠁧󠀰󠀶󠁿 Flag for Vratsa (BG-06) 👩🏽‍❤️‍👨🏼 Couple With Heart - Woman: Medium Skin Tone, Man: Medium-Light Skin Tone 🏴󠁢󠁯󠁢󠁿 Flag for Beni (BO-B) 🏴󠁢󠁮󠁢󠁥󠁿 Flag for Belait (BN-BE) 👩🏼‍❤️‍👨 Couple With Heart - Woman: Medium-Light Skin Tone, Man 🏴󠁢󠁪󠁯󠁵󠁿 Flag for Ouémé (BJ-OU) 👩🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁳󠁣󠀲󠀵󠁿 Flag for Roche Caiman (SC-25) 👩🏻‍❤️‍👨🏾 Couple With Heart - Woman: Light Skin Tone, Man: Medium-Dark Skin Tone 🏴󠁢󠁯󠁣󠁿 Flag for Cochabamba (BO-C) 👨🏾‍👩🏾‍👧🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁢󠁯󠁮󠁿 Flag for Pando (BO-N) 👩🏽‍❤️‍👩🏻 Couple With Heart - Woman: Medium Skin Tone, Woman: Light Skin Tone 👩🏾‍❤️‍👨🏽 Couple With Heart - Woman: Medium-Dark Skin Tone, Man: Medium Skin Tone 🏴󠁢󠁯󠁨󠁿 Flag for Chuquisaca (BO-H) 🏴󠁢󠁯󠁬󠁿 Flag for La Paz (BO-L) 🏴󠁭󠁮󠀰󠀳󠀹󠁿 Flag for Khentii (MN-039) 🕴🏽‍♀️ Woman in Business Suit Levitating: Medium Skin Tone 🏴󠁭󠁫󠀲󠀷󠁿 Flag for Dolneni (MK-27) 🏴󠁢󠁧󠀲󠀴󠁿 Flag for Stara Zagora (BG-24) 👩🏽‍👦🏽 Family - Woman: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁩󠁲󠀱󠀳󠁿 Flag for Sistan and Baluchestan (IR-13) 👩🏾‍❤️‍👨🏼 Couple With Heart - Woman: Medium-Dark Skin Tone, Man: Medium-Light Skin Tone 🏴󠁢󠁯󠁰󠁿 Flag for Potosí (BO-P) 🏴󠁢󠁱󠁢󠁯󠁿 Flag for Bonaire (BQ-BO) 👩‍❤️‍💋‍👨🏻 Kiss - Woman, Man: Light Skin Tone 👩🏾‍❤️‍👨 Couple With Heart - Woman: Medium-Dark Skin Tone, Man 👩🏼‍👦🏼‍👦🏼 Family - Woman: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁢󠁡󠁢󠁲󠁣󠁿 Flag for Brčko District (BA-BRC) 🏴󠁢󠁱󠁳󠁡󠁿 Flag for Saba (BQ-SA) 👩🏽‍❤️‍👨🏾 Couple With Heart - Woman: Medium Skin Tone, Man: Medium-Dark Skin Tone 👩🏾‍❤️‍👨🏿 Couple With Heart - Woman: Medium-Dark Skin Tone, Man: Dark Skin Tone 🏴󠁢󠁲󠁡󠁣󠁿 Flag for Acre (BR-AC) 🏴󠁢󠁩󠁧󠁩󠁿 Flag for Gitega (BI-GI) 👩🏿‍👦🏿 Family - Woman: Dark Skin Tone, Boy: Dark Skin Tone 👩🏿‍❤️‍👨🏻 Couple With Heart - Woman: Dark Skin Tone, Man: Light Skin Tone 🏴󠁢󠁲󠁡󠁭󠁿 Flag for Amazonas (BR-AM) 🏴󠁡󠁲󠁣󠁿 Flag for Buenos Aires (AR-C) 👨🏼‍👩🏼‍👧🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👨🏼‍❤️‍💋‍👨🏼 Kiss - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone 🏴󠁢󠁲󠁥󠁳󠁿 Flag for Espírito Santo (BR-ES) 👨🏿‍❤️‍💋‍👨🏾 Kiss - Man: Dark Skin Tone, Man: Medium-Dark Skin Tone 👨🏼‍❤️‍💋‍👨🏽 Kiss - Man: Medium-Light Skin Tone, Man: Medium Skin Tone 👩🏾‍👦🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👨🏻‍❤️‍👩 Couple With Heart - Man: Light Skin Tone, Woman 👨🏿‍❤️‍💋‍👩🏾 Kiss - Man: Dark Skin Tone, Woman: Medium-Dark Skin Tone 👩🏻‍❤️‍💋‍👩🏽 Kiss - Woman: Light Skin Tone, Woman: Medium Skin Tone 👨🏼‍❤️‍💋‍👨🏿 Kiss - Man: Medium-Light Skin Tone, Man: Dark Skin Tone 👩🏽‍👦🏽‍👦🏽 Family - Woman: Medium Skin Tone, Boy: Medium Skin Tone, Boy: Medium Skin Tone 👩🏿‍❤️‍👩🏼 Couple With Heart - Woman: Dark Skin Tone, Woman: Medium-Light Skin Tone 🏴󠁢󠁲󠁭󠁡󠁿 Flag for Maranhão (BR-MA) 👩🏿‍❤️‍👩🏽 Couple With Heart - Woman: Dark Skin Tone, Woman: Medium Skin Tone 👩🏿‍❤️‍👩 Couple With Heart - Woman: Dark Skin Tone, Woman 🏴󠁢󠁲󠁡󠁰󠁿 Flag for Amapá (BR-AP) 👨🏽‍❤️‍👨🏻 Couple With Heart - Man: Medium Skin Tone, Man: Light Skin Tone 👩🏻‍❤️‍💋‍👨🏻 Kiss - Woman: Light Skin Tone, Man: Light Skin Tone 👨🏽‍❤️‍💋‍👨🏽 Kiss - Man: Medium Skin Tone, Man: Medium Skin Tone 👩🏿‍❤️‍💋‍👩🏻 Kiss - Woman: Dark Skin Tone, Woman: Light Skin Tone 👨🏽‍❤️‍💋‍👩🏿 Kiss - Man: Medium Skin Tone, Woman: Dark Skin Tone 👩🏼‍❤️‍💋‍👨🏾 Kiss - Woman: Medium-Light Skin Tone, Man: Medium-Dark Skin Tone 👨🏿‍❤️‍💋‍👨🏼 Kiss - Man: Dark Skin Tone, Man: Medium-Light Skin Tone 👨🏾‍❤️‍💋‍👨🏿 Kiss - Man: Medium-Dark Skin Tone, Man: Dark Skin Tone 👩🏽‍❤️‍💋‍👩🏿 Kiss - Woman: Medium Skin Tone, Woman: Dark Skin Tone 👩🏼‍❤️‍💋‍👨🏿 Kiss - Woman: Medium-Light Skin Tone, Man: Dark Skin Tone 👨🏽‍❤️‍💋‍👩🏽 Kiss - Man: Medium Skin Tone, Woman: Medium Skin Tone 👨🏾‍❤️‍💋‍👨🏼 Kiss - Man: Medium-Dark Skin Tone, Man: Medium-Light Skin Tone 👨🏽‍❤️‍💋‍👩🏻 Kiss - Man: Medium Skin Tone, Woman: Light Skin Tone 👨🏾‍❤️‍💋‍👨 Kiss - Man: Medium-Dark Skin Tone, Man 👨🏾‍❤️‍💋‍👨🏾 Kiss - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone 👩‍❤️‍💋‍👨🏾 Kiss - Woman, Man: Medium-Dark Skin Tone 👩‍❤️‍💋‍👩🏻 Kiss - Woman, Woman: Light Skin Tone 👩🏽‍❤️‍💋‍👨🏻 Kiss - Woman: Medium Skin Tone, Man: Light Skin Tone 👩🏿‍❤️‍💋‍👨🏿 Kiss - Woman: Dark Skin Tone, Man: Dark Skin Tone 👩🏻‍❤️‍💋‍👩🏿 Kiss - Woman: Light Skin Tone, Woman: Dark Skin Tone 👩🏻‍❤️‍💋‍👩🏼 Kiss - Woman: Light Skin Tone, Woman: Medium-Light Skin Tone 👩🏾‍❤️‍💋‍👩🏿 Kiss - Woman: Medium-Dark Skin Tone, Woman: Dark Skin Tone 👩🏾‍❤️‍💋‍👩 Kiss - Woman: Medium-Dark Skin Tone, Woman 👩🏾‍❤️‍💋‍👩🏻 Kiss - Woman: Medium-Dark Skin Tone, Woman: Light Skin Tone 👩🏻‍❤️‍👨 Couple With Heart - Woman: Light Skin Tone, Man 👩🏻‍👩🏻‍👦🏻 Family - Woman: Light Skin Tone, Woman: Light Skin Tone, Boy: Light Skin Tone 👩🏾‍❤️‍💋‍👨🏾 Kiss - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone 👨🏻‍❤️‍👨🏽 Couple With Heart - Man: Light Skin Tone, Man: Medium Skin Tone 🏴󠁢󠁲󠁭󠁴󠁿 Flag for Mato Grosso (BR-MT) 👨🏽‍❤️‍👩🏻 Couple With Heart - Man: Medium Skin Tone, Woman: Light Skin Tone 👨‍❤️‍👨🏿 Couple With Heart - Man, Man: Dark Skin Tone 👩🏿‍❤️‍💋‍👨🏼 Kiss - Woman: Dark Skin Tone, Man: Medium-Light Skin Tone 👩🏿‍❤️‍💋‍👩🏾 Kiss - Woman: Dark Skin Tone, Woman: Medium-Dark Skin Tone 👩🏻‍👦🏻‍👧🏻 Family - Woman: Light Skin Tone, Boy: Light Skin Tone, Girl: Light Skin Tone 🏴󠁢󠁯󠁳󠁿 Flag for Santa Cruz (BO-S) 👨🏻‍❤️‍👩🏽 Couple With Heart - Man: Light Skin Tone, Woman: Medium Skin Tone 👨🏽‍❤️‍👩🏽 Couple With Heart - Man: Medium Skin Tone, Woman: Medium Skin Tone 👩🏾‍❤️‍💋‍👩🏽 Kiss - Woman: Medium-Dark Skin Tone, Woman: Medium Skin Tone 🏴󠁢󠁪󠁣󠁯󠁿 Flag for Collines (BJ-CO) 👨🏻‍👩🏻‍👦🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Boy: Light Skin Tone 👨‍❤️‍👨🏽 Couple With Heart - Man, Man: Medium Skin Tone 👨🏾‍👩🏾‍👦🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👨🏼‍❤️‍👨 Couple With Heart - Man: Medium-Light Skin Tone, Man 👨🏾‍❤️‍👩🏽 Couple With Heart - Man: Medium-Dark Skin Tone, Woman: Medium Skin Tone 🏴󠁢󠁲󠁰󠁡󠁿 Flag for Pará (BR-PA) 👩🏽‍👦🏽‍👧🏽 Family - Woman: Medium Skin Tone, Boy: Medium Skin Tone, Girl: Medium Skin Tone 👨🏼‍❤️‍👨🏼 Couple With Heart - Man: Medium-Light Skin Tone, Man: Medium-Light Skin Tone 👨🏿‍❤️‍👨🏻 Couple With Heart - Man: Dark Skin Tone, Man: Light Skin Tone 👩🏽‍❤️‍👩🏽 Couple With Heart - Woman: Medium Skin Tone, Woman: Medium Skin Tone 👨🏾‍❤️‍👨🏽 Couple With Heart - Man: Medium-Dark Skin Tone, Man: Medium Skin Tone 👨🏽‍❤️‍👨🏽 Couple With Heart - Man: Medium Skin Tone, Man: Medium Skin Tone 👨🏻‍❤️‍👩🏼 Couple With Heart - Man: Light Skin Tone, Woman: Medium-Light Skin Tone 👨🏾‍❤️‍👩🏿 Couple With Heart - Man: Medium-Dark Skin Tone, Woman: Dark Skin Tone 👨🏾‍❤️‍👨🏼 Couple With Heart - Man: Medium-Dark Skin Tone, Man: Medium-Light Skin Tone 👩🏾‍❤️‍💋‍👩🏾 Kiss - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone 👩🏼‍❤️‍👩🏻 Couple With Heart - Woman: Medium-Light Skin Tone, Woman: Light Skin Tone 👨🏿‍❤️‍👩🏼 Couple With Heart - Man: Dark Skin Tone, Woman: Medium-Light Skin Tone 👨🏼‍❤️‍👨🏾 Couple With Heart - Man: Medium-Light Skin Tone, Man: Medium-Dark Skin Tone 👨🏽‍❤️‍👨🏾 Couple With Heart - Man: Medium Skin Tone, Man: Medium-Dark Skin Tone 👩‍❤️‍👨🏾 Couple With Heart - Woman, Man: Medium-Dark Skin Tone 🏴󠁢󠁲󠁡󠁬󠁿 Flag for Alagoas (BR-AL) 👩‍❤️‍👨🏻 Couple With Heart - Woman, Man: Light Skin Tone 🏴󠁢󠁦󠀰󠀹󠁿 Flag for Hauts-Bassins (BF-09) 👨🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👩🏾‍❤️‍👩🏾 Couple With Heart - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone 🏴󠁢󠁲󠁲󠁪󠁿 Flag for Rio de Janeiro (BR-RJ) 👨🏾‍❤️‍💋‍👩🏻 Kiss - Man: Medium-Dark Skin Tone, Woman: Light Skin Tone 🏴󠁢󠁲󠁲󠁯󠁿 Flag for Rondônia (BR-RO) 👨🏾‍❤️‍👨🏿 Couple With Heart - Man: Medium-Dark Skin Tone, Man: Dark Skin Tone 👨🏽‍👦🏽 Family - Man: Medium Skin Tone, Boy: Medium Skin Tone 👨🏼‍❤️‍👨🏽 Couple With Heart - Man: Medium-Light Skin Tone, Man: Medium Skin Tone 🏴󠁢󠁲󠁰󠁩󠁿 Flag for Piauí (BR-PI) 👨🏽‍👩🏽‍👦🏽‍👦🏽 Family - Man: Medium Skin Tone, Woman: Medium Skin Tone, Boy: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁢󠁲󠁲󠁮󠁿 Flag for Rio Grande do Norte (BR-RN) 👩🏻‍❤️‍👨🏻 Couple With Heart - Woman: Light Skin Tone, Man: Light Skin Tone 👨🏻‍👦🏻 Family - Man: Light Skin Tone, Boy: Light Skin Tone 👩🏼‍❤️‍👩🏾 Couple With Heart - Woman: Medium-Light Skin Tone, Woman: Medium-Dark Skin Tone 👨🏿‍❤️‍👩🏾 Couple With Heart - Man: Dark Skin Tone, Woman: Medium-Dark Skin Tone 🏴󠁢󠁲󠁳󠁥󠁿 Flag for Sergipe (BR-SE) 🏴󠁢󠁲󠁰󠁲󠁿 Flag for Paraná (BR-PR) 👨🏿‍👦🏿 Family - Man: Dark Skin Tone, Boy: Dark Skin Tone 👩🏼‍❤️‍👩🏽 Couple With Heart - Woman: Medium-Light Skin Tone, Woman: Medium Skin Tone 👩🏾‍❤️‍👩🏼 Couple With Heart - Woman: Medium-Dark Skin Tone, Woman: Medium-Light Skin Tone 🏴󠁲󠁵󠁭󠁯󠁳󠁿 Flag for Moscow Province (RU-MOS) 👩🏽‍❤️‍💋‍👩🏽 Kiss - Woman: Medium Skin Tone, Woman: Medium Skin Tone 👩🏿‍👦🏿‍👦🏿 Family - Woman: Dark Skin Tone, Boy: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁢󠁲󠁳󠁰󠁿 Flag for São Paulo (BR-SP) 🏴󠁩󠁲󠀰󠀱󠁿 Flag for East Azerbaijan (IR-01) 🏴󠁢󠁲󠁲󠁳󠁿 Flag for Rio Grande do Sul (BR-RS) 👩🏼‍❤️‍👨🏿 Couple With Heart - Woman: Medium-Light Skin Tone, Man: Dark Skin Tone 🏴󠁮󠁯󠀱󠀴󠁿 Flag for Sogn og Fjordane (NO-14) 🏴󠁢󠁲󠁴󠁯󠁿 Flag for Tocantins (BR-TO) 🏴󠁳󠁩󠀱󠀸󠀲󠁿 Flag for Sveti Andraž v Slovenskih Goricah (SI-182) 👨🏼‍❤️‍👩🏻 Couple With Heart - Man: Medium-Light Skin Tone, Woman: Light Skin Tone 👨🏿‍❤️‍👨🏽 Couple With Heart - Man: Dark Skin Tone, Man: Medium Skin Tone 👨🏽‍👦🏽‍👦🏽 Family - Man: Medium Skin Tone, Boy: Medium Skin Tone, Boy: Medium Skin Tone 👨🏿‍👦🏿‍👦🏿 Family - Man: Dark Skin Tone, Boy: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁢󠁳󠁢󠁩󠁿 Flag for Bimini (BS-BI) 👨🏿‍❤️‍👩 Couple With Heart - Man: Dark Skin Tone, Woman 👩🏻‍👦🏻‍👦🏻 Family - Woman: Light Skin Tone, Boy: Light Skin Tone, Boy: Light Skin Tone 🏴󠁢󠁲󠁲󠁲󠁿 Flag for Roraima (BR-RR) 🏴󠁢󠁯󠁯󠁿 Flag for Oruro (BO-O) 🏴󠁢󠁳󠁥󠁸󠁿 Flag for Exuma (BS-EX) 👨🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👩🏽‍❤️‍👨 Couple With Heart - Woman: Medium Skin Tone, Man 🏴󠁢󠁳󠁣󠁥󠁿 Flag for Central Eleuthera (BS-CE) 🏴󠁢󠁳󠁢󠁹󠁿 Flag for Berry Islands (BS-BY) 🏴󠁢󠁩󠁭󠁡󠁿 Flag for Makamba (BI-MA) 🏴󠁢󠁲󠁤󠁦󠁿 Flag for Federal District (BR-DF) 👩🏻‍❤️‍👩🏾 Couple With Heart - Woman: Light Skin Tone, Woman: Medium-Dark Skin Tone 👨🏼‍❤️‍💋‍👩🏼 Kiss - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone 🏴󠁢󠁳󠁣󠁯󠁿 Flag for Central Abaco (BS-CO) 🏴󠁢󠁳󠁥󠁧󠁿 Flag for East Grand Bahama (BS-EG) 🏴󠁢󠁳󠁣󠁳󠁿 Flag for Central Andros (BS-CS) 👨🏻‍👦🏻‍👧🏻 Family - Man: Light Skin Tone, Boy: Light Skin Tone, Girl: Light Skin Tone 🏴󠁢󠁳󠁣󠁫󠁿 Flag for Crooked Island (BS-CK) 🏴󠁢󠁳󠁢󠁰󠁿 Flag for Black Point (BS-BP) 👨🏼‍👦🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👨🏽‍👦🏽‍👧🏽 Family - Man: Medium Skin Tone, Boy: Medium Skin Tone, Girl: Medium Skin Tone 👩🏿‍❤️‍👨🏾 Couple With Heart - Woman: Dark Skin Tone, Man: Medium-Dark Skin Tone 👩🏾‍❤️‍💋‍👨🏼 Kiss - Woman: Medium-Dark Skin Tone, Man: Medium-Light Skin Tone 🏴󠁢󠁳󠁮󠁥󠁿 Flag for North Eleuthera (BS-NE) 🏴󠁢󠁳󠁮󠁯󠁿 Flag for North Abaco (BS-NO) 🏴󠁢󠁳󠁭󠁧󠁿 Flag for Mayaguana (BS-MG) 👨🏾‍👦🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👨🏼‍❤️‍💋‍👩🏻 Kiss - Man: Medium-Light Skin Tone, Woman: Light Skin Tone 🏴󠁢󠁳󠁧󠁣󠁿 Flag for Grand Cay (BS-GC) 🏴󠁢󠁳󠁦󠁰󠁿 Flag for Freeport (BS-FP) 🏴󠁢󠁳󠁩󠁮󠁿 Flag for Inagua (BS-IN) 🏴󠁢󠁳󠁨󠁴󠁿 Flag for Hope Town (BS-HT) 👩🏾‍❤️‍👩🏿 Couple With Heart - Woman: Medium-Dark Skin Tone, Woman: Dark Skin Tone 🏴󠁢󠁳󠁬󠁩󠁿 Flag for Long Island (BS-LI) 👨🏿‍👦🏿‍👧🏿 Family - Man: Dark Skin Tone, Boy: Dark Skin Tone, Girl: Dark Skin Tone 👨🏾‍❤️‍👩 Couple With Heart - Man: Medium-Dark Skin Tone, Woman 👩🏿‍❤️‍👨🏿 Couple With Heart - Woman: Dark Skin Tone, Man: Dark Skin Tone 👨🏻‍👦🏻‍👶🏻 Family - Man: Light Skin Tone, Boy: Light Skin Tone, Baby: Light Skin Tone 👨‍👨‍👶 Family: Man, Man, Baby 👩‍👧‍👶 Family: Woman, Girl, Baby 👨‍👦‍👶 Family: Man, Boy, Baby 👨‍👨‍👶‍👦 Family: Man, Man, Baby, Boy 👨‍👦‍👧 Family: Man, Boy, Girl 👨‍👶‍👶 Family: Man, Baby, Baby 🏴󠁢󠁳󠁲󠁩󠁿 Flag for Ragged Island (BS-RI) 👩🏿‍❤️‍👩🏿 Couple With Heart - Woman: Dark Skin Tone, Woman: Dark Skin Tone 👩🏿‍❤️‍👨🏽 Couple With Heart - Woman: Dark Skin Tone, Man: Medium Skin Tone 👩🏼‍❤️‍👨🏼 Couple With Heart - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone 🏴󠁢󠁳󠁮󠁳󠁿 Flag for North Andros (BS-NS) 👩🏿‍❤️‍👩🏻 Couple With Heart - Woman: Dark Skin Tone, Woman: Light Skin Tone 👨🏻‍❤️‍💋‍👨 Kiss - Man: Light Skin Tone, Man 🏴󠁢󠁳󠁳󠁡󠁿 Flag for South Andros (BS-SA) 👨🏻‍❤️‍💋‍👨🏼 Kiss - Man: Light Skin Tone, Man: Medium-Light Skin Tone 🏴󠁢󠁳󠁳󠁥󠁿 Flag for South Eleuthera (BS-SE) 👨🏼‍👦🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👨🏻‍❤️‍💋‍👩🏻 Kiss - Man: Light Skin Tone, Woman: Light Skin Tone 👨🏼‍❤️‍💋‍👩🏾 Kiss - Man: Medium-Light Skin Tone, Woman: Medium-Dark Skin Tone 👨🏾‍❤️‍💋‍👩🏼 Kiss - Man: Medium-Dark Skin Tone, Woman: Medium-Light Skin Tone 👨🏾‍❤️‍💋‍👨🏻 Kiss - Man: Medium-Dark Skin Tone, Man: Light Skin Tone 🏴󠁢󠁲󠁳󠁣󠁿 Flag for Santa Catarina (BR-SC) 👩‍👩‍👦‍👧 Family: Woman, Woman, Boy, Girl 👨‍❤️‍💋‍👩🏾 Kiss - Man, Woman: Medium-Dark Skin Tone 🏴󠁢󠁳󠁲󠁣󠁿 Flag for Rum Cay (BS-RC) 👩‍👩‍👶‍👦 Family: Woman, Woman, Baby, Boy 👨🏻‍❤️‍💋‍👩🏽 Kiss - Man: Light Skin Tone, Woman: Medium Skin Tone 🏴󠁢󠁳󠁣󠁩󠁿 Flag for Cat Island (BS-CI) 👩🏽‍❤️‍👩 Couple With Heart - Woman: Medium Skin Tone, Woman 👨🏽‍👦🏽‍👶🏽 Family - Man: Medium Skin Tone, Boy: Medium Skin Tone, Baby: Medium Skin Tone 👩‍👨‍👦‍👶 Family: Woman, Man, Boy, Baby 👨🏾‍❤️‍💋‍👩 Kiss - Man: Medium-Dark Skin Tone, Woman 👨‍❤️‍💋‍👨🏻 Kiss - Man, Man: Light Skin Tone 👨🏻‍❤️‍💋‍👨🏿 Kiss - Man: Light Skin Tone, Man: Dark Skin Tone 👨🏼‍❤️‍💋‍👩🏽 Kiss - Man: Medium-Light Skin Tone, Woman: Medium Skin Tone 👨🏾‍👦🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁢󠁳󠁳󠁯󠁿 Flag for South Abaco (BS-SO) 👩🏾‍❤️‍💋‍👩🏼 Kiss - Woman: Medium-Dark Skin Tone, Woman: Medium-Light Skin Tone 👨🏻‍❤️‍👨🏿 Couple With Heart - Man: Light Skin Tone, Man: Dark Skin Tone 👨🏿‍❤️‍💋‍👨🏿 Kiss - Man: Dark Skin Tone, Man: Dark Skin Tone 👩🏾‍❤️‍💋‍👨🏿 Kiss - Woman: Medium-Dark Skin Tone, Man: Dark Skin Tone 👩🏼‍❤️‍💋‍👨🏽 Kiss - Woman: Medium-Light Skin Tone, Man: Medium Skin Tone 👩🏾‍❤️‍💋‍👨🏻 Kiss - Woman: Medium-Dark Skin Tone, Man: Light Skin Tone 👩🏽‍❤️‍💋‍👨 Kiss - Woman: Medium Skin Tone, Man 👨‍👧‍👶 Family: Man, Girl, Baby 👩🏻‍❤️‍💋‍👨🏾 Kiss - Woman: Light Skin Tone, Man: Medium-Dark Skin Tone 👨‍❤️‍👨🏼 Couple With Heart - Man, Man: Medium-Light Skin Tone 👩🏼‍❤️‍💋‍👩🏼 Kiss - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone 👨🏿‍❤️‍💋‍👩🏿 Kiss - Man: Dark Skin Tone, Woman: Dark Skin Tone 👨‍❤️‍💋‍👩🏼 Kiss - Man, Woman: Medium-Light Skin Tone 🏴󠁣󠁩󠁡󠁢󠁿 Flag for Abidjan (CI-AB) 👩🏻‍❤️‍💋‍👨 Kiss - Woman: Light Skin Tone, Man 👩🏼‍❤️‍💋‍👩🏾 Kiss - Woman: Medium-Light Skin Tone, Woman: Medium-Dark Skin Tone 👨🏻‍❤️‍💋‍👩🏼 Kiss - Man: Light Skin Tone, Woman: Medium-Light Skin Tone 👩🏽‍❤️‍💋‍👨🏿 Kiss - Woman: Medium Skin Tone, Man: Dark Skin Tone 👩🏿‍❤️‍💋‍👩🏼 Kiss - Woman: Dark Skin Tone, Woman: Medium-Light Skin Tone 👩🏿‍❤️‍💋‍👨🏾 Kiss - Woman: Dark Skin Tone, Man: Medium-Dark Skin Tone 👩🏼‍❤️‍💋‍👨 Kiss - Woman: Medium-Light Skin Tone, Man 👩‍❤️‍👩🏾 Couple With Heart - Woman, Woman: Medium-Dark Skin Tone 👨🏿‍❤️‍👨🏼 Couple With Heart - Man: Dark Skin Tone, Man: Medium-Light Skin Tone 👨🏿‍👦🏿‍👶🏿 Family - Man: Dark Skin Tone, Boy: Dark Skin Tone, Baby: Dark Skin Tone 👨🏼‍❤️‍👩🏼 Couple With Heart - Man: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone 👩🏼‍❤️‍👨🏽 Couple With Heart - Woman: Medium-Light Skin Tone, Man: Medium Skin Tone 🏴󠁢󠁳󠁳󠁷󠁿 Flag for Spanish Wells (BS-SW) 👨🏿‍❤️‍👨🏿 Couple With Heart - Man: Dark Skin Tone, Man: Dark Skin Tone 👨🏼‍❤️‍👨🏿 Couple With Heart - Man: Medium-Light Skin Tone, Man: Dark Skin Tone 👨🏼‍❤️‍👩 Couple With Heart - Man: Medium-Light Skin Tone, Woman 👩🏼‍❤️‍👩🏼 Couple With Heart - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone 👨🏼‍❤️‍👨🏻 Couple With Heart - Man: Medium-Light Skin Tone, Man: Light Skin Tone 👨🏾‍❤️‍👨🏾 Couple With Heart - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone 👩‍❤️‍👩🏼 Couple With Heart - Woman, Woman: Medium-Light Skin Tone 👨🏼‍❤️‍👩🏿 Couple With Heart - Man: Medium-Light Skin Tone, Woman: Dark Skin Tone 👨🏻‍❤️‍👨🏾 Couple With Heart - Man: Light Skin Tone, Man: Medium-Dark Skin Tone 👨🏽‍❤️‍👩🏾 Couple With Heart - Man: Medium Skin Tone, Woman: Medium-Dark Skin Tone 👩‍❤️‍👩🏿 Couple With Heart - Woman, Woman: Dark Skin Tone 👨🏽‍❤️‍👨🏿 Couple With Heart - Man: Medium Skin Tone, Man: Dark Skin Tone 👨‍👨‍👦‍👶 Family: Man, Man, Boy, Baby 👨🏿‍❤️‍👨 Couple With Heart - Man: Dark Skin Tone, Man 👩🏻‍❤️‍👩🏿 Couple With Heart - Woman: Light Skin Tone, Woman: Dark Skin Tone 🏴󠁢󠁳󠁳󠁳󠁿 Flag for San Salvador (BS-SS) 🏴󠁢󠁴󠀱󠀴󠁿 Flag for Samtse (BT-14) 👩🏻‍❤️‍👨🏽 Couple With Heart - Woman: Light Skin Tone, Man: Medium Skin Tone 👩🏼‍❤️‍👩🏿 Couple With Heart - Woman: Medium-Light Skin Tone, Woman: Dark Skin Tone 👨‍❤️‍👩🏿 Couple With Heart - Man, Woman: Dark Skin Tone 🏴󠁢󠁴󠀱󠀱󠁿 Flag for Paro (BT-11) 👨🏻‍❤️‍👩🏾 Couple With Heart - Man: Light Skin Tone, Woman: Medium-Dark Skin Tone 👨🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁢󠁴󠀱󠀵󠁿 Flag for Thimphu (BT-15) 👩🏾‍❤️‍👩🏽 Couple With Heart - Woman: Medium-Dark Skin Tone, Woman: Medium Skin Tone 🏴󠁢󠁳󠁷󠁧󠁿 Flag for West Grand Bahama (BS-WG) 🏴󠁢󠁴󠀱󠀳󠁿 Flag for Haa (BT-13) 🏴󠁢󠁴󠀱󠀲󠁿 Flag for Chukha (BT-12) 👨🏻‍❤️‍💋‍👨🏽 Kiss - Man: Light Skin Tone, Man: Medium Skin Tone 👨🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 👨🏽‍👧🏽 Family - Man: Medium Skin Tone, Girl: Medium Skin Tone 🏴󠁢󠁳󠁡󠁫󠁿 Flag for Acklins (BS-AK) 🏴󠁢󠁴󠀳󠀲󠁿 Flag for Trongsa (BT-32) 🏴󠁢󠁴󠀴󠀱󠁿 Flag for Trashigang (BT-41) 🏴󠁢󠁴󠀲󠀳󠁿 Flag for Punakha (BT-23) 🏴󠁢󠁴󠀲󠀴󠁿 Flag for Wangdue Phodrang (BT-24) 🏴󠁢󠁴󠀳󠀳󠁿 Flag for Bumthang (BT-33) 🏴󠁢󠁴󠀳󠀴󠁿 Flag for Zhemgang (BT-34) 👩🏼‍❤️‍💋‍👨🏼 Kiss - Woman: Medium-Light Skin Tone, Man: Medium-Light Skin Tone 🏴󠁢󠁴󠀴󠀲󠁿 Flag for Mongar (BT-42) 🏴󠁢󠁲󠁰󠁢󠁿 Flag for Paraíba (BR-PB) 👩🏿‍❤️‍👨🏼 Couple With Heart - Woman: Dark Skin Tone, Man: Medium-Light Skin Tone 🏴󠁣󠁨󠁺󠁨󠁿 Flag for Zürich (CH-ZH) 🏴󠁢󠁴󠀳󠀱󠁿 Flag for Sarpang (BT-31) 🏴󠁢󠁴󠀲󠀲󠁿 Flag for Dagana (BT-22) 👩🏻‍❤️‍💋‍👨🏽 Kiss - Woman: Light Skin Tone, Man: Medium Skin Tone 👨🏿‍👨🏿‍👧🏿‍👧🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Girl: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁢󠁷󠁣󠁥󠁿 Flag for Central (BW-CE) 🏴󠁢󠁴󠁧󠁡󠁿 Flag for Gasa (BT-GA) 🏴󠁢󠁷󠁣󠁨󠁿 Flag for Chobe (BW-CH) 🏴󠁢󠁴󠀴󠀵󠁿 Flag for Samdrup Jongkhar (BT-45) 🏴󠁢󠁷󠁦󠁲󠁿 Flag for Francistown (BW-FR) 🏴󠁢󠁴󠀴󠀴󠁿 Flag for Lhuntse (BT-44) 🏴󠁢󠁴󠁴󠁹󠁿 Flag for Trashiyangtse (BT-TY) 🏴󠁢󠁴󠀲󠀱󠁿 Flag for Tsirang (BT-21) 🏴󠁢󠁴󠀴󠀳󠁿 Flag for Pemagatshel (BT-43) 👨🏿‍👧🏿 Family - Man: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁢󠁷󠁮󠁥󠁿 Flag for North East (BW-NE) 🏴󠁢󠁷󠁫󠁬󠁿 Flag for Kgatleng (BW-KL) 🏴󠁢󠁷󠁫󠁧󠁿 Flag for Kgalagadi (BW-KG) 🏴󠁢󠁷󠁳󠁥󠁿 Flag for South East (BW-SE) 🏴󠁢󠁷󠁫󠁷󠁿 Flag for Kweneng (BW-KW) 👨🏻‍👧🏻‍👦🏻 Family - Man: Light Skin Tone, Girl: Light Skin Tone, Boy: Light Skin Tone 🏴󠁢󠁷󠁮󠁷󠁿 Flag for North West (BW-NW) 🏴󠁢󠁷󠁪󠁷󠁿 Flag for Jwaneng (BW-JW) 🏴󠁢󠁳󠁭󠁣󠁿 Flag for Mangrove Cay (BS-MC) 👩🏼‍❤️‍💋‍👩🏿 Kiss - Woman: Medium-Light Skin Tone, Woman: Dark Skin Tone 🏴󠁢󠁷󠁧󠁨󠁿 Flag for Ghanzi (BW-GH) 👨🏻‍❤️‍👩🏻 Couple With Heart - Man: Light Skin Tone, Woman: Light Skin Tone 🏴󠁢󠁪󠁡󠁱󠁿 Flag for Atlantique (BJ-AQ) 👨🏼‍👧🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 👨🏾‍👧🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 👨🏿‍👧🏿‍👦🏿 Family - Man: Dark Skin Tone, Girl: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁢󠁷󠁳󠁯󠁿 Flag for Southern (BW-SO) 👨🏽‍👧🏽‍👦🏽 Family - Man: Medium Skin Tone, Girl: Medium Skin Tone, Boy: Medium Skin Tone 👩🏾‍❤️‍👩 Couple With Heart - Woman: Medium-Dark Skin Tone, Woman 👨‍👩‍👶‍👧 Family: Man, Woman, Baby, Girl 👨🏽‍❤️‍💋‍👨🏾 Kiss - Man: Medium Skin Tone, Man: Medium-Dark Skin Tone 🏴󠁢󠁷󠁳󠁴󠁿 Flag for Sowa Town (BW-ST) 🏴󠁢󠁷󠁳󠁰󠁿 Flag for Selibe Phikwe (BW-SP) 👩🏿‍❤️‍👩🏾 Couple With Heart - Woman: Dark Skin Tone, Woman: Medium-Dark Skin Tone 👩‍👨‍👦‍👦 Family: Woman, Man, Boy, Boy 👩🏿‍👨🏿‍👦🏿‍👶🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Boy: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁢󠁹󠁨󠁭󠁿 Flag for Minsk (BY-HM) 🏴󠁢󠁹󠁨󠁯󠁿 Flag for Homel (BY-HO) 👨🏻‍👦🏻‍👦🏻 Family - Man: Light Skin Tone, Boy: Light Skin Tone, Boy: Light Skin Tone 👨🏻‍👩🏻‍👧🏻‍👦🏻 Family - Man: Light Skin Tone, Woman: Light Skin Tone, Girl: Light Skin Tone, Boy: Light Skin Tone 🏴󠁴󠁲󠀳󠀵󠁿 Flag for Izmir (TR-35) 🏴󠁢󠁹󠁨󠁲󠁿 Flag for Hrodna (BY-HR) 🏴󠁢󠁹󠁭󠁡󠁿 Flag for Magileu (BY-MA) 🏴󠁢󠁹󠁭󠁩󠁿 Flag for Minsk Region (BY-MI) 👨🏼‍❤️‍💋‍👩🏿 Kiss - Man: Medium-Light Skin Tone, Woman: Dark Skin Tone 👨🏾‍❤️‍👩🏻 Couple With Heart - Man: Medium-Dark Skin Tone, Woman: Light Skin Tone 🏴󠁢󠁺󠁢󠁺󠁿 Flag for Belize (BZ-BZ) 🏴󠁢󠁷󠁬󠁯󠁿 Flag for Lobatse (BW-LO) 👩‍👦‍👧 Family: Woman, Boy, Girl 👨🏼‍👧🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁢󠁳󠁭󠁩󠁿 Flag for Moore’s Island (BS-MI) 🏴󠁢󠁪󠁭󠁯󠁿 Flag for Mono (BJ-MO) 👨🏽‍👧🏽‍👧🏽 Family - Man: Medium Skin Tone, Girl: Medium Skin Tone, Girl: Medium Skin Tone 🏴󠁢󠁹󠁶󠁩󠁿 Flag for Vitebsk (BY-VI) 🏴󠁢󠁺󠁳󠁣󠁿 Flag for Stann Creek (BZ-SC) 👨🏾‍👧🏾‍👧🏾 Family - Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁢󠁺󠁣󠁺󠁬󠁿 Flag for Corozal (BZ-CZL) 👨🏻‍👧🏻‍👶🏻 Family - Man: Light Skin Tone, Girl: Light Skin Tone, Baby: Light Skin Tone 👨🏿‍👧🏿‍👧🏿 Family - Man: Dark Skin Tone, Girl: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁢󠁺󠁴󠁯󠁬󠁿 Flag for Toledo (BZ-TOL) 🏴󠁮󠁰󠀵󠁿 Flag for Sudur Pashchimanchal (NP-5) 🏴󠁢󠁳󠁨󠁩󠁿 Flag for Harbour Island (BS-HI) 🏴󠁣󠁡󠁡󠁢󠁿 Flag for Alberta (CA-AB) 👩🏾‍❤️‍👨🏾 Couple With Heart - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone 👨🏽‍❤️‍💋‍👨🏼 Kiss - Man: Medium Skin Tone, Man: Medium-Light Skin Tone 🏴󠁬󠁡󠁶󠁩󠁿 Flag for Vientiane Province (LA-VI) 👨‍👩‍👦‍👧 Family: Man, Woman, Boy, Girl 👨🏻‍👧🏻‍👧🏻 Family - Man: Light Skin Tone, Girl: Light Skin Tone, Girl: Light Skin Tone 👨🏼‍👧🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 👨🏽‍👧🏽‍👶🏽 Family - Man: Medium Skin Tone, Girl: Medium Skin Tone, Baby: Medium Skin Tone 🏴󠁣󠁡󠁰󠁥󠁿 Flag for Prince Edward Island (CA-PE) 🏴󠁣󠁤󠁫󠁧󠁿 Flag for Kwango (CD-KG) 🏴󠁣󠁡󠁮󠁳󠁿 Flag for Nova Scotia (CA-NS) 👨🏾‍👧🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁣󠁤󠁨󠁵󠁿 Flag for Haut-Uélé (CD-HU) 🏴󠁣󠁤󠁢󠁣󠁿 Flag for Bas-Congo (CD-BC) 🏴󠁣󠁤󠁳󠁵󠁿 Flag for Sud-Ubangi (CD-SU) 🏴󠁣󠁤󠁭󠁡󠁿 Flag for Maniema (CD-MA) 🏴󠁣󠁤󠁳󠁡󠁿 Flag for Sankuru (CD-SA) 🏴󠁣󠁤󠁴󠁵󠁿 Flag for Tshuapa (CD-TU) 🏴󠁣󠁡󠁹󠁴󠁿 Flag for Yukon (CA-YT) 🏴󠁣󠁤󠁭󠁯󠁿 Flag for Mongala (CD-MO) 🏴󠁣󠁦󠁢󠁢󠁿 Flag for Bamingui-Bangoran (CF-BB) 🏴󠁣󠁤󠁭󠁮󠁿 Flag for Mai-Ndombe (CD-MN) 🏴󠁣󠁡󠁮󠁵󠁿 Flag for Nunavut (CA-NU) 🏴󠁣󠁤󠁫󠁬󠁿 Flag for Kwilu (CD-KL) 🏴󠁣󠁡󠁮󠁢󠁿 Flag for New Brunswick (CA-NB) 🏴󠁣󠁦󠁢󠁧󠁦󠁿 Flag for Bangui (CF-BGF) 🏴󠁣󠁤󠁫󠁮󠁿 Flag for Kinshasa (CD-KN) 🏴󠁣󠁤󠁮󠁫󠁿 Flag for North Kivu (CD-NK) 🏴󠁣󠁡󠁮󠁴󠁿 Flag for Northwest Territories (CA-NT) 🏴󠁣󠁤󠁴󠁯󠁿 Flag for Tshopo (CD-TO) 🏴󠁣󠁤󠁢󠁵󠁿 Flag for Bas-Uélé (CD-BU) 🏴󠁣󠁤󠁨󠁬󠁿 Flag for Haut-Lomami (CD-HL) 🏴󠁣󠁤󠁨󠁫󠁿 Flag for Haut-Katanga (CD-HK) 🏴󠁣󠁤󠁫󠁥󠁿 Flag for Kasaï-Oriental (CD-KE) 🏴󠁣󠁤󠁳󠁫󠁿 Flag for South Kivu (CD-SK) 🏴󠁣󠁡󠁯󠁮󠁿 Flag for Ontario (CA-ON) 🏴󠁣󠁦󠁡󠁣󠁿 Flag for Ouham (CF-AC) 🏴󠁣󠁦󠁨󠁳󠁿 Flag for Mambéré-Kadéï (CF-HS) 🏴󠁣󠁤󠁫󠁣󠁿 Flag for Kasaï Central (CD-KC) 🏴󠁣󠁤󠁮󠁵󠁿 Flag for Nord-Ubangi (CD-NU) 🏴󠁣󠁤󠁫󠁳󠁿 Flag for Kasaï (CD-KS) 🏴󠁣󠁤󠁩󠁴󠁿 Flag for Ituri (CD-IT) 🏴󠁣󠁨󠁢󠁥󠁿 Flag for Bern (CH-BE) 🏴󠁣󠁧󠀲󠁿 Flag for Lékoumou (CG-2) 🏴󠁣󠁨󠁡󠁩󠁿 Flag for Appenzell Innerrhoden (CH-AI) 🏴󠁣󠁦󠁭󠁰󠁿 Flag for Ombella-M’Poko (CF-MP) 👨🏻‍👶🏻 Family - Man: Light Skin Tone, Baby: Light Skin Tone 🏴󠁣󠁦󠁫󠁧󠁿 Flag for Kémo (CF-KG) 🏴󠁣󠁧󠀱󠀳󠁿 Flag for Sangha (CG-13) 🏴󠁣󠁨󠁬󠁵󠁿 Flag for Lucerne (CH-LU) 🏴󠁣󠁨󠁧󠁥󠁿 Flag for Geneva (CH-GE) 🏴󠁣󠁨󠁮󠁷󠁿 Flag for Nidwalden (CH-NW) 🏴󠁣󠁧󠀵󠁿 Flag for Kouilou (CG-5) 🏴󠁣󠁧󠀷󠁿 Flag for Likouala (CG-7) 🏴󠁣󠁧󠁢󠁺󠁶󠁿 Flag for Brazzaville (CG-BZV) 🏴󠁣󠁨󠁳󠁨󠁿 Flag for Schaffhausen (CH-SH) 🏴󠁣󠁤󠁬󠁯󠁿 Flag for Lomami (CD-LO) 🏴󠁣󠁨󠁡󠁲󠁿 Flag for Appenzell Ausserrhoden (CH-AR) 🏴󠁣󠁨󠁳󠁺󠁿 Flag for Schwyz (CH-SZ) 🏴󠁣󠁨󠁮󠁥󠁿 Flag for Neuchâtel (CH-NE) 🏴󠁣󠁦󠁯󠁰󠁿 Flag for Ouham-Pendé (CF-OP) 🏴󠁣󠁨󠁧󠁲󠁿 Flag for Graubünden (CH-GR) 🏴󠁣󠁨󠁳󠁯󠁿 Flag for Solothurn (CH-SO) 🏴󠁣󠁨󠁦󠁲󠁿 Flag for Fribourg (CH-FR) 🏴󠁣󠁧󠀱󠀴󠁿 Flag for Plateaux (CG-14) 🏴󠁣󠁦󠁳󠁥󠁿 Flag for Sangha-Mbaéré (CF-SE) 👨🏿‍👧🏿‍👶🏿 Family - Man: Dark Skin Tone, Girl: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁣󠁨󠁡󠁧󠁿 Flag for Aargau (CH-AG) 🏴󠁣󠁧󠀱󠀵󠁿 Flag for Cuvette-Ouest (CG-15) 🏴󠁣󠁨󠁳󠁧󠁿 Flag for St. Gallen (CH-SG) 🏴󠁣󠁧󠀸󠁿 Flag for Cuvette (CG-8) 🏴󠁣󠁨󠁯󠁷󠁿 Flag for Obwalden (CH-OW) 🏴󠁣󠁨󠁢󠁳󠁿 Flag for Basel-Stadt (CH-BS) 🏴󠁣󠁦󠁬󠁢󠁿 Flag for Lobaye (CF-LB) 🏴󠁣󠁬󠁶󠁳󠁿 Flag for Valparaíso (CL-VS) 🏴󠁣󠁭󠁮󠁷󠁿 Flag for Northwest (CM-NW) 🏴󠁣󠁩󠁤󠁮󠁿 Flag for Denguélé (CI-DN) 🏴󠁣󠁭󠁮󠁯󠁿 Flag for North (CM-NO) 🏴󠁣󠁩󠁹󠁭󠁿 Flag for Yamoussoukro (CI-YM) 🏴󠁣󠁭󠁥󠁳󠁿 Flag for East (CM-ES) 👨🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁣󠁩󠁷󠁲󠁿 Flag for Woroba (CI-WR) 🏴󠁣󠁩󠁬󠁧󠁿 Flag for Lagunes (CI-LG) 🏴󠁣󠁩󠁧󠁤󠁿 Flag for Gôh-Djiboua (CI-GD) 🏴󠁣󠁩󠁣󠁭󠁿 Flag for Comoé (CI-CM) 🏴󠁣󠁭󠁳󠁷󠁿 Flag for Southwest (CM-SW) 🏴󠁣󠁬󠁢󠁩󠁿 Flag for Bío Bío (CL-BI) 🏴󠁣󠁬󠁡󠁩󠁿 Flag for Aysén (CL-AI) 🏴󠁣󠁬󠁲󠁭󠁿 Flag for Santiago Metropolitan (CL-RM) 🏴󠁣󠁬󠁴󠁡󠁿 Flag for Tarapacá (CL-TA) 🏴󠁣󠁭󠁳󠁵󠁿 Flag for South (CM-SU) 🏴󠁣󠁬󠁡󠁴󠁿 Flag for Atacama (CL-AT) 🏴󠁣󠁮󠀱󠀲󠁿 Flag for Tianjin (CN-12) 🏴󠁣󠁩󠁬󠁣󠁿 Flag for Lacs (CI-LC) 🏴󠁣󠁬󠁣󠁯󠁿 Flag for Coquimbo (CL-CO) 🏴󠁣󠁬󠁡󠁰󠁿 Flag for Arica y Parinacota (CL-AP) 🏴󠁣󠁭󠁬󠁴󠁿 Flag for Littoral (CM-LT) 🏴󠁣󠁭󠁣󠁥󠁿 Flag for Centre (CM-CE) 🏴󠁣󠁭󠁥󠁮󠁿 Flag for Far North (CM-EN) 🏴󠁣󠁬󠁭󠁡󠁿 Flag for Magallanes Region (CL-MA) 🏴󠁣󠁬󠁭󠁬󠁿 Flag for Maule (CL-ML) 🏴󠁣󠁩󠁭󠁧󠁿 Flag for Montagnes (CI-MG) 🏴󠁣󠁩󠁢󠁳󠁿 Flag for Bas-Sassandra (CI-BS) 🏴󠁣󠁭󠁡󠁤󠁿 Flag for Adamawa (CM-AD) 🏴󠁣󠁬󠁬󠁲󠁿 Flag for Los Ríos (CL-LR) 🏴󠁣󠁭󠁯󠁵󠁿 Flag for West (CM-OU) 🏴󠁣󠁩󠁳󠁶󠁿 Flag for Savanes (CI-SV) 🏴󠁣󠁬󠁬󠁬󠁿 Flag for Los Lagos (CL-LL) 🏴󠁣󠁮󠀳󠀷󠁿 Flag for Shandong (CN-37) 🏴󠁣󠁮󠀶󠀲󠁿 Flag for Gansu (CN-62) 🏴󠁣󠁮󠀳󠀱󠁿 Flag for Shanghai (CN-31) 🏴󠁣󠁮󠀳󠀶󠁿 Flag for Jiangxi (CN-36) 🏴󠁣󠁮󠀷󠀱󠁿 Flag for Taiwan (CN-71) 🏴󠁣󠁯󠁢󠁯󠁹󠁿 Flag for Boyacá (CO-BOY) 🏴󠁣󠁮󠀱󠀱󠁿 Flag for Beijing (CN-11) 🏴󠁢󠁧󠀱󠀸󠁿 Flag for Ruse (BG-18) 🏴󠁣󠁮󠀴󠀴󠁿 Flag for Guangdong (CN-44) 🏴󠁣󠁮󠀶󠀳󠁿 Flag for Qinghai (CN-63) 🏴󠁣󠁮󠀲󠀳󠁿 Flag for Heilongjiang (CN-23) 🏴󠁣󠁮󠀵󠀱󠁿 Flag for Sichuan (CN-51) 🏴󠁣󠁯󠁣󠁡󠁬󠁿 Flag for Caldas (CO-CAL) 🏴󠁣󠁯󠁢󠁯󠁬󠁿 Flag for Bolívar (CO-BOL) 🏴󠁣󠁮󠀵󠀳󠁿 Flag for Yunnan (CN-53) 🏴󠁣󠁯󠁡󠁴󠁬󠁿 Flag for Atlántico (CO-ATL) 🏴󠁣󠁮󠀴󠀲󠁿 Flag for Hubei (CN-42) 🏴󠁣󠁮󠀲󠀲󠁿 Flag for Jilin (CN-22) 🏴󠁣󠁯󠁣󠁡󠁱󠁿 Flag for Caquetá (CO-CAQ) 🏴󠁣󠁮󠀳󠀳󠁿 Flag for Zhejiang (CN-33) 🏴󠁣󠁮󠀱󠀳󠁿 Flag for Hebei (CN-13) 🏴󠁣󠁮󠀱󠀵󠁿 Flag for Inner Mongolia (CN-15) 🏴󠁣󠁮󠀴󠀳󠁿 Flag for Hunan (CN-43) 🏴󠁣󠁦󠁨󠁫󠁿 Flag for Haute-Kotto (CF-HK) 🏴󠁣󠁮󠀶󠀵󠁿 Flag for Xinjiang (CN-65) 🏴󠁣󠁮󠀵󠀰󠁿 Flag for Chongqing (CN-50) 🏴󠁣󠁮󠀴󠀵󠁿 Flag for Guangxi (CN-45) 🏴󠁣󠁮󠀵󠀴󠁿 Flag for Tibet (CN-54) 🏴󠁣󠁮󠀳󠀲󠁿 Flag for Jiangsu (CN-32) 🏴󠁣󠁯󠁡󠁲󠁡󠁿 Flag for Arauca (CO-ARA) 🏴󠁣󠁮󠀳󠀵󠁿 Flag for Fujian (CN-35) 🏴󠁣󠁮󠀴󠀱󠁿 Flag for Henan (CN-41) 🏴󠁣󠁮󠀴󠀶󠁿 Flag for Hainan (CN-46) 🏴󠁣󠁮󠀱󠀴󠁿 Flag for Shanxi (CN-14) 🏴󠁣󠁯󠁭󠁡󠁧󠁿 Flag for Magdalena (CO-MAG) 🏴󠁣󠁯󠁣󠁨󠁯󠁿 Flag for Chocó (CO-CHO) 🏴󠁣󠁯󠁧󠁵󠁡󠁿 Flag for Guainía (CO-GUA) 🏴󠁣󠁯󠁣󠁯󠁲󠁿 Flag for Córdoba (CO-COR) 🏴󠁣󠁯󠁰󠁵󠁴󠁿 Flag for Putumayo (CO-PUT) 🏴󠁣󠁯󠁳󠁡󠁮󠁿 Flag for Santander (CO-SAN) 🏴󠁣󠁵󠀰󠀵󠁿 Flag for Villa Clara (CU-05) 🏴󠁣󠁯󠁶󠁡󠁣󠁿 Flag for Valle del Cauca (CO-VAC) 🏴󠁣󠁯󠁱󠁵󠁩󠁿 Flag for Quindío (CO-QUI) 🏴󠁣󠁯󠁲󠁩󠁳󠁿 Flag for Risaralda (CO-RIS) 🏴󠁣󠁯󠁣󠁵󠁮󠁿 Flag for Cundinamarca (CO-CUN) 👨🏽‍👶🏽 Family - Man: Medium Skin Tone, Baby: Medium Skin Tone 🏴󠁣󠁲󠁡󠁿 Flag for Alajuela (CR-A) 🏴󠁣󠁲󠁰󠁿 Flag for Puntarenas (CR-P) 🏴󠁣󠁯󠁨󠁵󠁩󠁿 Flag for Huila (CO-HUI) 🏴󠁣󠁯󠁶󠁡󠁵󠁿 Flag for Vaupés (CO-VAU) 🏴󠁣󠁯󠁣󠁡󠁵󠁿 Flag for Cauca (CO-CAU) 🏴󠁣󠁵󠀰󠀷󠁿 Flag for Sancti Spíritus (CU-07) 🏴󠁣󠁲󠁬󠁿 Flag for Limón (CR-L) 🏴󠁣󠁯󠁮󠁳󠁡󠁿 Flag for Norte de Santander (CO-NSA) 🏴󠁣󠁵󠀰󠀴󠁿 Flag for Matanzas (CU-04) 🏴󠁣󠁲󠁧󠁿 Flag for Guanacaste (CR-G) 🏴󠁣󠁵󠀰󠀳󠁿 Flag for Havana (CU-03) 👩🏾‍❤️‍💋‍👨 Kiss - Woman: Medium-Dark Skin Tone, Man 🏴󠁣󠁵󠀰󠀸󠁿 Flag for Ciego de Ávila (CU-08) 🏴󠁣󠁯󠁴󠁯󠁬󠁿 Flag for Tolima (CO-TOL) 🏴󠁣󠁵󠀰󠀹󠁿 Flag for Camagüey (CU-09) 🏴󠁣󠁵󠀰󠀶󠁿 Flag for Cienfuegos (CU-06) 🏴󠁣󠁯󠁧󠁵󠁶󠁿 Flag for Guaviare (CO-GUV) 🏴󠁢󠁺󠁣󠁹󠁿 Flag for Cayo (BZ-CY) 🏴󠁥󠁴󠁳󠁮󠁿 Flag for Southern Nations, Nationalities, and Peoples (ET-SN) 🏴󠁣󠁵󠀰󠀱󠁿 Flag for Pinar del Río (CU-01) 🏴󠁣󠁲󠁳󠁪󠁿 Flag for San José (CR-SJ) 🏴󠁣󠁲󠁣󠁿 Flag for Cartago (CR-C) 🏴󠁣󠁯󠁬󠁡󠁧󠁿 Flag for La Guajira (CO-LAG) 🏴󠁣󠁹󠀰󠀲󠁿 Flag for Limassol (CY-02) 🏴󠁤󠁥󠁮󠁩󠁿 Flag for Lower Saxony (DE-NI) 🏴󠁢󠁺󠁯󠁷󠁿 Flag for Orange Walk (BZ-OW) 🏴󠁣󠁺󠀶󠀳󠁿 Flag for Kraj Vysočina (CZ-63) 🏴󠁣󠁺󠀵󠀱󠁿 Flag for Liberecký kraj (CZ-51) 🏴󠁣󠁵󠀱󠀰󠁿 Flag for Las Tunas (CU-10) 🏴󠁣󠁵󠀱󠀳󠁿 Flag for Santiago de Cuba (CU-13) 👨🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁣󠁹󠀰󠀱󠁿 Flag for Nicosia (CY-01) 🏴󠁣󠁺󠀲󠀰󠁿 Flag for Středočeský kraj (CZ-20) 🏴󠁣󠁦󠁶󠁫󠁿 Flag for Vakaga (CF-VK) 🏴󠁣󠁺󠀵󠀲󠁿 Flag for Královéhradecký kraj (CZ-52) 🏴󠁣󠁺󠀴󠀱󠁿 Flag for Karlovarský kraj (CZ-41) 🏴󠁣󠁵󠀱󠀵󠁿 Flag for Artemisa (CU-15) 🏴󠁣󠁹󠀰󠀴󠁿 Flag for Famagusta (CY-04) 🏴󠁤󠁥󠁨󠁢󠁿 Flag for Bremen (DE-HB) 🏴󠁤󠁥󠁨󠁥󠁿 Flag for Hesse (DE-HE) 🏴󠁣󠁵󠀱󠀱󠁿 Flag for Holguín (CU-11) 👨🏿‍👶🏿 Family - Man: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁣󠁺󠀸󠀰󠁿 Flag for Moravskoslezský kraj (CZ-80) 🏴󠁣󠁺󠀳󠀱󠁿 Flag for Jihočeský kraj (CZ-31) 🏴󠁣󠁨󠁧󠁬󠁿 Flag for Glarus (CH-GL) 🏴󠁣󠁺󠀱󠀰󠁿 Flag for Praha, Hlavní mešto (CZ-10) 🏴󠁣󠁹󠀰󠀳󠁿 Flag for Larnaca (CY-03) 🏴󠁤󠁥󠁨󠁨󠁿 Flag for Hamburg (DE-HH) 🏴󠁤󠁥󠁭󠁶󠁿 Flag for Mecklenburg-Vorpommern (DE-MV) 🏴󠁣󠁶󠁢󠁿 Flag for Barlavento Islands (CV-B) 🏴󠁣󠁶󠁳󠁿 Flag for Sotavento Islands (CV-S) 🏴󠁣󠁵󠀱󠀶󠁿 Flag for Mayabeque (CU-16) 🏴󠁣󠁺󠀷󠀱󠁿 Flag for Olomoucký kraj (CZ-71) 🏴󠁣󠁵󠀱󠀴󠁿 Flag for Guantánamo (CU-14) 🏴󠁤󠁥󠁢󠁢󠁿 Flag for Brandenburg (DE-BB) 🏴󠁣󠁺󠀳󠀲󠁿 Flag for Plzeňský kraj (CZ-32) 🏴󠁤󠁪󠁡󠁳󠁿 Flag for Ali Sabieh (DJ-AS) 🏴󠁤󠁥󠁲󠁰󠁿 Flag for Rhineland-Palatinate (DE-RP) 🏴󠁤󠁥󠁳󠁮󠁿 Flag for Saxony (DE-SN) 🏴󠁤󠁫󠀸󠀵󠁿 Flag for Zealand (DK-85) 🏴󠁤󠁥󠁳󠁴󠁿 Flag for Saxony-Anhalt (DE-ST) 🏴󠁤󠁺󠀰󠀲󠁿 Flag for Chlef (DZ-02) 🏴󠁤󠁭󠀰󠀷󠁿 Flag for Saint Luke (DM-07) 🏴󠁤󠁪󠁡󠁲󠁿 Flag for Arta (DJ-AR) 🏴󠁤󠁫󠀸󠀴󠁿 Flag for Capital Region (DK-84) 🏴󠁤󠁭󠀱󠀰󠁿 Flag for Saint Paul (DM-10) 🏴󠁤󠁯󠀳󠀶󠁿 Flag for Cibao Sur (DO-36) 🏴󠁤󠁯󠀳󠀸󠁿 Flag for Enriquillo (DO-38) 🏴󠁤󠁭󠀰󠀹󠁿 Flag for Saint Patrick (DM-09) 🏴󠁤󠁯󠀳󠀴󠁿 Flag for Cibao Noroeste (DO-34) 🏴󠁤󠁯󠀳󠀳󠁿 Flag for Cibao Nordeste (DO-33) 🏴󠁤󠁭󠀰󠀵󠁿 Flag for Saint John (DM-05) 🏴󠁤󠁯󠀴󠀲󠁿 Flag for Yuma (DO-42) 🏴󠁤󠁪󠁯󠁢󠁿 Flag for Obock (DJ-OB) 🏴󠁤󠁥󠁴󠁨󠁿 Flag for Thuringia (DE-TH) 🏴󠁤󠁯󠀴󠀰󠁿 Flag for Ozama (DO-40) 🏴󠁤󠁥󠁳󠁬󠁿 Flag for Saarland (DE-SL) 🏴󠁤󠁭󠀰󠀴󠁿 Flag for Saint George (DM-04) 🏴󠁤󠁭󠀰󠀳󠁿 Flag for Saint David (DM-03) 🏴󠁤󠁭󠀰󠀲󠁿 Flag for Saint Andrew (DM-02) 🏴󠁤󠁪󠁤󠁩󠁿 Flag for Dikhil (DJ-DI) 🏴󠁤󠁭󠀰󠀸󠁿 Flag for Saint Mark (DM-08) 🏴󠁤󠁪󠁴󠁡󠁿 Flag for Tadjourah (DJ-TA) 🏴󠁤󠁭󠀱󠀱󠁿 Flag for Saint Peter (DM-11) 🏴󠁤󠁯󠀴󠀱󠁿 Flag for Valdesia (DO-41) 🏴󠁤󠁯󠀳󠀹󠁿 Flag for Higüamo (DO-39) 🏴󠁤󠁺󠀰󠀳󠁿 Flag for Laghouat (DZ-03) 🏴󠁤󠁺󠀲󠀸󠁿 Flag for M’Sila (DZ-28) 🏴󠁤󠁺󠀳󠀳󠁿 Flag for Illizi (DZ-33) 👩🏿‍👨🏿‍👧🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁤󠁺󠀱󠀵󠁿 Flag for Tizi Ouzou (DZ-15) 🏴󠁤󠁺󠀱󠀴󠁿 Flag for Tiaret (DZ-14) 🏴󠁤󠁺󠀱󠀹󠁿 Flag for Sétif (DZ-19) 🏴󠁤󠁺󠀱󠀷󠁿 Flag for Djelfa (DZ-17) 🏴󠁤󠁺󠀲󠀵󠁿 Flag for Constantine (DZ-25) 🏴󠁤󠁺󠀲󠀴󠁿 Flag for Guelma (DZ-24) 🏴󠁤󠁺󠀴󠀲󠁿 Flag for Tipasa (DZ-42) 🏴󠁤󠁺󠀰󠀵󠁿 Flag for Batna (DZ-05) 🏴󠁤󠁺󠀱󠀲󠁿 Flag for Tébessa (DZ-12) 🏴󠁤󠁺󠀰󠀷󠁿 Flag for Biskra (DZ-07) 🏴󠁤󠁺󠀳󠀰󠁿 Flag for Ouargla (DZ-30) 🏴󠁤󠁺󠀲󠀲󠁿 Flag for Sidi Bel Abbès (DZ-22) 🏴󠁤󠁺󠀱󠀱󠁿 Flag for Tamanghasset (DZ-11) 🏴󠁤󠁺󠀲󠀶󠁿 Flag for Médéa (DZ-26) 🏴󠁤󠁺󠀳󠀲󠁿 Flag for El Bayadh (DZ-32) 🏴󠁤󠁺󠀴󠀰󠁿 Flag for Khenchela (DZ-40) 🏴󠁤󠁺󠀳󠀸󠁿 Flag for Tissemsilt (DZ-38) 🏴󠁤󠁺󠀳󠀹󠁿 Flag for El Oued (DZ-39) 🏴󠁤󠁺󠀴󠀱󠁿 Flag for Souk Ahras (DZ-41) 🏴󠁤󠁺󠀱󠀳󠁿 Flag for Tlemcen (DZ-13) 🏴󠁤󠁺󠀰󠀶󠁿 Flag for Béjaïa (DZ-06) 🏴󠁤󠁺󠀴󠀳󠁿 Flag for Mila (DZ-43) 🏴󠁤󠁺󠀲󠀰󠁿 Flag for Saïda (DZ-20) 🏴󠁤󠁺󠀳󠀱󠁿 Flag for Oran (DZ-31) 🏴󠁤󠁺󠀱󠀰󠁿 Flag for Bouira (DZ-10) 🏴󠁤󠁺󠀳󠀵󠁿 Flag for Boumerdès (DZ-35) 🏴󠁤󠁺󠀳󠀶󠁿 Flag for El Tarf (DZ-36) 🏴󠁤󠁺󠀱󠀶󠁿 Flag for Algiers (DZ-16) 🏴󠁤󠁺󠀳󠀷󠁿 Flag for Tindouf (DZ-37) 🏴󠁤󠁺󠀲󠀳󠁿 Flag for Annaba (DZ-23) 🏴󠁤󠁺󠀰󠀹󠁿 Flag for Blida (DZ-09) 🏴󠁤󠁺󠀰󠀴󠁿 Flag for Oum El Bouaghi (DZ-04) 🏴󠁤󠁺󠀲󠀷󠁿 Flag for Mostaganem (DZ-27) 🏴󠁥󠁣󠁨󠁿 Flag for Chimborazo (EC-H) 🏴󠁤󠁺󠀴󠀷󠁿 Flag for Ghardaïa (DZ-47) 🏴󠁥󠁣󠁢󠁿 Flag for Bolívar (EC-B) 🏴󠁥󠁣󠁣󠁿 Flag for Carchi (EC-C) 🏴󠁤󠁺󠀴󠀴󠁿 Flag for Aïn Defla (DZ-44) 🏴󠁣󠁹󠀰󠀵󠁿 Flag for Paphos (CY-05) 🏴󠁤󠁺󠀴󠀸󠁿 Flag for Relizane (DZ-48) 🏴󠁥󠁣󠁳󠁿 Flag for Morona-Santiago (EC-S) 🏴󠁣󠁨󠁪󠁵󠁿 Flag for Jura (CH-JU) 🏴󠁥󠁣󠁳󠁥󠁿 Flag for Santa Elena (EC-SE) 🏴󠁥󠁥󠀵󠀷󠁿 Flag for Lääne (EE-57) 🏴󠁥󠁣󠁩󠁿 Flag for Imbabura (EC-I) 🏴󠁤󠁺󠀴󠀶󠁿 Flag for Aïn Témouchent (DZ-46) 🏴󠁥󠁣󠁷󠁿 Flag for Galápagos (EC-W) 🏴󠁥󠁣󠁮󠁿 Flag for Napo (EC-N) 👨🏽‍👶🏽‍👦🏽 Family - Man: Medium Skin Tone, Baby: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁥󠁥󠀶󠀷󠁿 Flag for Pärnu (EE-67) 🏴󠁥󠁥󠀷󠀸󠁿 Flag for Tartu (EE-78) 🏴󠁥󠁣󠁡󠁿 Flag for Azuay (EC-A) 🏴󠁥󠁣󠁭󠁿 Flag for Manabí (EC-M) 🏴󠁥󠁣󠁯󠁿 Flag for El Oro (EC-O) 🏴󠁥󠁣󠁰󠁿 Flag for Pichincha (EC-P) 🏴󠁥󠁥󠀷󠀰󠁿 Flag for Rapla (EE-70) 🏴󠁥󠁥󠀷󠀴󠁿 Flag for Saare (EE-74) 👨🏾‍👶🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁥󠁥󠀶󠀵󠁿 Flag for Põlva (EE-65) 🏴󠁥󠁣󠁹󠁿 Flag for Pastaza (EC-Y) 🏴󠁥󠁣󠁧󠁿 Flag for Guayas (EC-G) 🏴󠁥󠁣󠁲󠁿 Flag for Los Ríos (EC-R) 🏴󠁥󠁣󠁵󠁿 Flag for Sucumbíos (EC-U) 🏴󠁥󠁥󠀴󠀹󠁿 Flag for Jõgeva (EE-49) 🏴󠁥󠁥󠀸󠀲󠁿 Flag for Valga (EE-82) 🏴󠁥󠁣󠁬󠁿 Flag for Loja (EC-L) 🏴󠁥󠁣󠁤󠁿 Flag for Orellana (EC-D) 👨🏼‍👶🏼‍👦🏼 Family - Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Boy: Medium-Light Skin Tone 🏴󠁤󠁺󠀴󠀵󠁿 Flag for Naama (DZ-45) 🏴󠁥󠁥󠀵󠀱󠁿 Flag for Järva (EE-51) 🏴󠁥󠁧󠁳󠁩󠁮󠁿 Flag for North Sinai (EG-SIN) 🏴󠁥󠁧󠁪󠁳󠁿 Flag for South Sinai (EG-JS) 🏴󠁥󠁧󠁫󠁮󠁿 Flag for Qena (EG-KN) 🏴󠁥󠁥󠀸󠀴󠁿 Flag for Viljandi (EE-84) 🏴󠁥󠁧󠁩󠁳󠁿 Flag for Ismailia (EG-IS) 🏴󠁥󠁧󠁡󠁳󠁮󠁿 Flag for Aswan (EG-ASN) 🏴󠁥󠁧󠁤󠁫󠁿 Flag for Dakahlia (EG-DK) 🏴󠁥󠁧󠁧󠁨󠁿 Flag for Gharbia (EG-GH) 🏴󠁥󠁧󠁢󠁨󠁿 Flag for Beheira (EG-BH) 🏴󠁥󠁥󠀸󠀶󠁿 Flag for Võru (EE-86) 🏴󠁥󠁧󠁡󠁳󠁴󠁿 Flag for Asyut (EG-AST) 🏴󠁥󠁧󠁫󠁢󠁿 Flag for Qalyubia (EG-KB) 🏴󠁥󠁧󠁧󠁺󠁿 Flag for Giza (EG-GZ) 👨🏿‍👶🏿‍👦🏿 Family - Man: Dark Skin Tone, Baby: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁥󠁲󠁡󠁮󠁿 Flag for Anseba (ER-AN) 🏴󠁥󠁧󠁫󠁦󠁳󠁿 Flag for Kafr el-Sheikh (EG-KFS) 🏴󠁥󠁧󠁭󠁴󠁿 Flag for Matrouh (EG-MT) 🏴󠁥󠁲󠁧󠁢󠁿 Flag for Gash-Barka (ER-GB) 🏴󠁥󠁧󠁭󠁮󠁿 Flag for Minya (EG-MN) 🏴󠁥󠁧󠁡󠁬󠁸󠁿 Flag for Alexandria (EG-ALX) 🏴󠁥󠁲󠁤󠁫󠁿 Flag for Southern Red Sea (ER-DK) 🏴󠁥󠁧󠁰󠁴󠁳󠁿 Flag for Port Said (EG-PTS) 🏴󠁥󠁧󠁳󠁨󠁧󠁿 Flag for Sohag (EG-SHG) 🏴󠁥󠁧󠁷󠁡󠁤󠁿 Flag for New Valley (EG-WAD) 🏴󠁥󠁲󠁳󠁫󠁿 Flag for Northern Red Sea (ER-SK) 🏴󠁥󠁧󠁳󠁵󠁺󠁿 Flag for Suez (EG-SUZ) 🏴󠁥󠁧󠁭󠁮󠁦󠁿 Flag for Monufia (EG-MNF) 🏴󠁥󠁧󠁬󠁸󠁿 Flag for Luxor (EG-LX) 🏴󠁥󠁲󠁭󠁡󠁿 Flag for Maekel (ER-MA) 🏴󠁥󠁧󠁤󠁴󠁿 Flag for Damietta (EG-DT) 🏴󠁥󠁧󠁳󠁨󠁲󠁿 Flag for Al Sharqia (EG-SHR) 🏴󠁥󠁧󠁦󠁹󠁭󠁿 Flag for Faiyum (EG-FYM) 🏴󠁥󠁲󠁤󠁵󠁿 Flag for Debub (ER-DU) 🏴󠁥󠁳󠁡󠁲󠁿 Flag for Aragon (ES-AR) 🏴󠁣󠁮󠀳󠀴󠁿 Flag for Anhui (CN-34) 🏴󠁤󠁫󠀸󠀱󠁿 Flag for Northern Denmark (DK-81) 👨🏻‍👶🏻‍👧🏻 Family - Man: Light Skin Tone, Baby: Light Skin Tone, Girl: Light Skin Tone 👨🏼‍👶🏼‍👧🏼 Family - Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 👨🏽‍👶🏽‍👧🏽 Family - Man: Medium Skin Tone, Baby: Medium Skin Tone, Girl: Medium Skin Tone 🏴󠁥󠁴󠁴󠁩󠁿 Flag for Tigray (ET-TI) 🏴󠁣󠁮󠀲󠀱󠁿 Flag for Liaoning (CN-21) 🏴󠁥󠁴󠁧󠁡󠁿 Flag for Gambela (ET-GA) 🏴󠁥󠁳󠁭󠁬󠁿 Flag for Melilla (ES-ML) 🏴󠁥󠁳󠁭󠁣󠁿 Flag for Murcia Region (ES-MC) 🏴󠁦󠁩󠀱󠀰󠁿 Flag for Lapland (FI-10) 🏴󠁦󠁩󠀰󠀷󠁿 Flag for Central Ostrobothnia (FI-07) 🏴󠁥󠁴󠁡󠁭󠁿 Flag for Amhara (ET-AM) 🏴󠁥󠁴󠁢󠁥󠁿 Flag for Benishangul-Gumuz (ET-BE) 🏴󠁥󠁴󠁯󠁲󠁿 Flag for Oromia (ET-OR) 🏴󠁥󠁳󠁲󠁩󠁿 Flag for La Rioja (ES-RI) 🏴󠁤󠁪󠁤󠁪󠁿 Flag for Djibouti (DJ-DJ) 🏴󠁥󠁳󠁭󠁤󠁿 Flag for Madrid Autonomous Community (ES-MD) 🏴󠁥󠁴󠁤󠁤󠁿 Flag for Dire Dawa (ET-DD) 🏴󠁤󠁺󠀲󠀹󠁿 Flag for Mascara (DZ-29) 🏴󠁦󠁩󠀰󠀵󠁿 Flag for Kainuu (FI-05) 🏴󠁦󠁩󠀰󠀹󠁿 Flag for Kymenlaakso (FI-09) 🏴󠁦󠁩󠀰󠀳󠁿 Flag for Southern Ostrobothnia (FI-03) 🏴󠁦󠁩󠀱󠀱󠁿 Flag for Pirkanmaa (FI-11) 🏴󠁦󠁩󠀰󠀴󠁿 Flag for Southern Savonia (FI-04) 🏴󠁦󠁩󠀱󠀳󠁿 Flag for North Karelia (FI-13) 🏴󠁦󠁩󠀰󠀲󠁿 Flag for South Karelia (FI-02) 🏴󠁥󠁴󠁨󠁡󠁿 Flag for Harari (ET-HA) 🏴󠁣󠁺󠀷󠀲󠁿 Flag for Zlínský kraj (CZ-72) 🏴󠁥󠁴󠁳󠁯󠁿 Flag for Somali (ET-SO) 🏴󠁥󠁳󠁣󠁴󠁿 Flag for Catalonia (ES-CT) 🏴󠁦󠁭󠁫󠁳󠁡󠁿 Flag for Kosrae (FM-KSA) 🏴󠁦󠁲󠁮󠁣󠁿 Flag for New Caledonia (FR-NC) 🏴󠁦󠁲󠁯󠁣󠁣󠁿 Flag for Occitanie (FR-OCC) 🏴󠁦󠁲󠁰󠁡󠁣󠁿 Flag for Provence-Alpes-Côte-d’Azur (FR-PAC) 🏴󠁦󠁩󠀱󠀵󠁿 Flag for Northern Savonia (FI-15) 🏴󠁦󠁭󠁴󠁲󠁫󠁿 Flag for Chuuk (FM-TRK) 🏴󠁦󠁲󠁢󠁦󠁣󠁿 Flag for Bourgogne-Franche-Comté (FR-BFC) 🏴󠁦󠁩󠀱󠀴󠁿 Flag for Northern Ostrobothnia (FI-14) 🏴󠁦󠁪󠁲󠁿 Flag for Rotuma (FJ-R) 🏴󠁦󠁲󠁭󠁡󠁹󠁿 Flag for Mayotte (FR-MAY) 🏴󠁦󠁲󠁮󠁡󠁱󠁿 Flag for Nouvelle-Aquitaine (FR-NAQ) 🏴󠁦󠁪󠁣󠁿 Flag for Central (FJ-C) 🏴󠁦󠁲󠁧󠁥󠁳󠁿 Flag for Grand-Est (FR-GES) 🏴󠁦󠁪󠁮󠁿 Flag for Northern (FJ-N) 🏴󠁦󠁲󠁧󠁵󠁡󠁿 Flag for Guadeloupe (FR-GUA) 🏴󠁦󠁭󠁹󠁡󠁰󠁿 Flag for Yap (FM-YAP) 🏴󠁦󠁲󠁢󠁲󠁥󠁿 Flag for Bretagne (FR-BRE) 🏴󠁦󠁲󠁰󠁦󠁿 Flag for French Polynesia (FR-PF) 🏴󠁦󠁲󠁮󠁯󠁲󠁿 Flag for Normandie (FR-NOR) 🏴󠁦󠁲󠁧󠁦󠁿 Flag for French Guiana (FR-GF) 🏴󠁦󠁲󠁣󠁶󠁬󠁿 Flag for Centre-Val de Loire (FR-CVL) 🏴󠁦󠁲󠁣󠁰󠁿 Flag for Clipperton Island (FR-CP) 🏴󠁦󠁲󠁭󠁦󠁿 Flag for St. Martin (FR-MF) 🏴󠁦󠁩󠀱󠀶󠁿 Flag for Päijänne Tavastia (FI-16) 🏴󠁦󠁩󠀱󠀹󠁿 Flag for Southwest Finland (FI-19) 🏴󠁦󠁲󠁬󠁲󠁥󠁿 Flag for La Réunion (FR-LRE) 🏴󠁦󠁩󠀱󠀷󠁿 Flag for Satakunta (FI-17) 🏴󠁧󠁥󠁳󠁫󠁿 Flag for Shida Kartli (GE-SK) 🏴󠁧󠁡󠀳󠁿 Flag for Moyen-Ogooué (GA-3) 👨🏿‍👶🏿‍👧🏿 Family - Man: Dark Skin Tone, Baby: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁧󠁤󠀰󠀳󠁿 Flag for Saint George (GD-03) 🏴󠁧󠁡󠀵󠁿 Flag for Nyanga (GA-5) 🏴󠁧󠁡󠀶󠁿 Flag for Ogooué-Ivindo (GA-6) 🏴󠁧󠁨󠁢󠁡󠁿 Flag for Brong-Ahafo (GH-BA) 🏴󠁧󠁡󠀲󠁿 Flag for Haut-Ogooué (GA-2) 🏴󠁧󠁤󠀰󠀱󠁿 Flag for Saint Andrew (GD-01) 🏴󠁧󠁤󠀰󠀶󠁿 Flag for Saint Patrick (GD-06) 🏴󠁥󠁳󠁧󠁡󠁿 Flag for Galicia (ES-GA) 🏴󠁦󠁲󠁷󠁦󠁿 Flag for Wallis & Futuna (FR-WF) 👨🏻‍👶🏻‍👶🏻 Family - Man: Light Skin Tone, Baby: Light Skin Tone, Baby: Light Skin Tone 🏴󠁦󠁲󠁰󠁭󠁿 Flag for St. Pierre & Miquelon (FR-PM) 🏴󠁧󠁤󠀰󠀴󠁿 Flag for Saint John (GD-04) 🏴󠁧󠁥󠁴󠁢󠁿 Flag for Tbilisi (GE-TB) 👨🏼‍👶🏼‍👶🏼 Family - Man: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone, Baby: Medium-Light Skin Tone 🏴󠁧󠁤󠀰󠀲󠁿 Flag for Saint David (GD-02) 🏴󠁧󠁥󠁧󠁵󠁿 Flag for Guria (GE-GU) 🏴󠁧󠁡󠀹󠁿 Flag for Woleu-Ntem (GA-9) 🏴󠁧󠁥󠁲󠁬󠁿 Flag for Racha-Lechkhumi and Kvemo Svaneti (GE-RL) 🏴󠁧󠁥󠁳󠁪󠁿 Flag for Samtskhe-Javakheti (GE-SJ) 🏴󠁧󠁥󠁭󠁭󠁿 Flag for Mtskheta-Mtianeti (GE-MM) 🏴󠁧󠁥󠁩󠁭󠁿 Flag for Imereti (GE-IM) 🏴󠁧󠁡󠀸󠁿 Flag for Ogooué-Maritime (GA-8) 🏴󠁣󠁮󠀶󠀱󠁿 Flag for Shaanxi (CN-61) 🏴󠁧󠁨󠁡󠁡󠁿 Flag for Greater Accra (GH-AA) 🏴󠁣󠁺󠀶󠀴󠁿 Flag for Jihomoravský kraj (CZ-64) 🏴󠁧󠁥󠁡󠁪󠁿 Flag for Adjara (GE-AJ) 🏴󠁧󠁥󠁳󠁺󠁿 Flag for Samegrelo-Zemo Svaneti (GE-SZ) 🏴󠁧󠁡󠀱󠁿 Flag for Estuaire (GA-1) 🏴󠁧󠁡󠀷󠁿 Flag for Ogooué-Lolo (GA-7) 🏴󠁧󠁮󠁤󠁿 Flag for Kindia Region (GN-D) 🏴󠁧󠁮󠁭󠁿 Flag for Mamou Region (GN-M) 👨🏽‍👶🏽‍👶🏽 Family - Man: Medium Skin Tone, Baby: Medium Skin Tone, Baby: Medium Skin Tone 🏴󠁧󠁬󠁱󠁡󠁿 Flag for Qaasuitsup (GL-QA) 🏴󠁧󠁭󠁮󠁿 Flag for North Bank Division (GM-N) 🏴󠁧󠁬󠁳󠁭󠁿 Flag for Sermersooq (GL-SM) 🏴󠁧󠁨󠁮󠁰󠁿 Flag for Northern (GH-NP) 🏴󠁧󠁲󠁦󠁿 Flag for Ionian Islands (GR-F) 🏴󠁧󠁲󠁨󠁿 Flag for Central Greece (GR-H) 🏴󠁧󠁨󠁣󠁰󠁿 Flag for Central (GH-CP) 🏴󠁧󠁮󠁫󠁿 Flag for Kankan Region (GN-K) 🏴󠁧󠁲󠁬󠁿 Flag for South Aegean (GR-L) 🏴󠁧󠁲󠁩󠁿 Flag for Attica (GR-I) 🏴󠁧󠁭󠁵󠁿 Flag for Upper River Division (GM-U) 🏴󠁧󠁨󠁥󠁰󠁿 Flag for Eastern (GH-EP) 🏴󠁧󠁮󠁮󠁿 Flag for Nzérékoré Region (GN-N) 🏴󠁧󠁨󠁷󠁰󠁿 Flag for Western (GH-WP) 🏴󠁧󠁲󠁣󠁿 Flag for West Macedonia (GR-C) 🏴󠁧󠁱󠁣󠁿 Flag for Río Muni (GQ-C) 🏴󠁧󠁭󠁬󠁿 Flag for Lower River Division (GM-L) 🏴󠁧󠁨󠁵󠁥󠁿 Flag for Upper East (GH-UE) 🏴󠁧󠁮󠁣󠁿 Flag for Conakry (GN-C) 🏴󠁧󠁲󠁢󠁿 Flag for Central Macedonia (GR-B) 🏴󠁧󠁭󠁭󠁿 Flag for Central River Division (GM-M) 🏴󠁧󠁨󠁵󠁷󠁿 Flag for Upper West (GH-UW) 🏴󠁧󠁬󠁫󠁵󠁿 Flag for Kujalleq (GL-KU) 🏴󠁧󠁮󠁢󠁿 Flag for Boké Region (GN-B) 🏴󠁧󠁬󠁱󠁥󠁿 Flag for Qeqqata (GL-QE) 🏴󠁧󠁲󠁤󠁿 Flag for Epirus (GR-D) 🏴󠁧󠁨󠁡󠁨󠁿 Flag for Ashanti (GH-AH) 🏴󠁧󠁨󠁴󠁶󠁿 Flag for Volta (GH-TV) 🏴󠁧󠁲󠀶󠀹󠁿 Flag for Mount Athos (GR-69) 🏴󠁧󠁱󠁩󠁿 Flag for Insular (GQ-I) 🏴󠁧󠁭󠁷󠁿 Flag for West Coast Division (GM-W) 🏴󠁧󠁭󠁢󠁿 Flag for Banjul (GM-B) 🏴󠁧󠁮󠁬󠁿 Flag for Labé Region (GN-L) 🏴󠁧󠁲󠁥󠁿 Flag for Thessaly (GR-E) 🏴󠁧󠁮󠁦󠁿 Flag for Faranah Region (GN-F) 🏴󠁧󠁹󠁣󠁵󠁿 Flag for Cuyuni-Mazaruni (GY-CU) 🏴󠁨󠁮󠁡󠁴󠁿 Flag for Atlántida (HN-AT) 👨🏾‍👶🏾‍👶🏾 Family - Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁧󠁴󠁨󠁵󠁿 Flag for Huehuetenango (GT-HU) 🏴󠁧󠁴󠁡󠁶󠁿 Flag for Alta Verapaz (GT-AV) 🏴󠁧󠁴󠁰󠁲󠁿 Flag for El Progreso (GT-PR) 🏴󠁧󠁷󠁮󠁿 Flag for Norte (GW-N) 🏴󠁧󠁴󠁳󠁵󠁿 Flag for Suchitepéquez (GT-SU) 🏴󠁧󠁹󠁰󠁭󠁿 Flag for Pomeroon-Supenaam (GY-PM) 🏴󠁧󠁴󠁩󠁺󠁿 Flag for Izabal (GT-IZ) 🏴󠁧󠁹󠁰󠁴󠁿 Flag for Potaro-Siparuni (GY-PT) 🏴󠁧󠁴󠁱󠁺󠁿 Flag for Quetzaltenango (GT-QZ) 🏴󠁧󠁴󠁣󠁭󠁿 Flag for Chimaltenango (GT-CM) 🏴󠁥󠁴󠁡󠁡󠁿 Flag for Addis Ababa (ET-AA) 🏴󠁧󠁷󠁢󠁳󠁿 Flag for Bissau (GW-BS) 🏴󠁧󠁴󠁱󠁣󠁿 Flag for Quiché (GT-QC) 🏴󠁧󠁴󠁴󠁯󠁿 Flag for Totonicapán (GT-TO) 🏴󠁧󠁹󠁢󠁡󠁿 Flag for Barima-Waini (GY-BA) 🏴󠁧󠁹󠁥󠁳󠁿 Flag for Essequibo Islands-West Demerara (GY-ES) 👨🏿‍👶🏿‍👶🏿 Family - Man: Dark Skin Tone, Baby: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁨󠁮󠁣󠁨󠁿 Flag for Choluteca (HN-CH) 🏴󠁧󠁹󠁤󠁥󠁿 Flag for Demerara-Mahaica (GY-DE) 👨🏻‍👨🏻‍👦🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Boy: Light Skin Tone 🏴󠁧󠁴󠁳󠁡󠁿 Flag for Sacatepéquez (GT-SA) 🏴󠁧󠁴󠁪󠁵󠁿 Flag for Jutiapa (GT-JU) 🏴󠁧󠁴󠁣󠁱󠁿 Flag for Chiquimula (GT-CQ) 🏴󠁧󠁴󠁢󠁶󠁿 Flag for Baja Verapaz (GT-BV) 🏴󠁧󠁴󠁥󠁳󠁿 Flag for Escuintla (GT-ES) 🏴󠁧󠁴󠁺󠁡󠁿 Flag for Zacapa (GT-ZA) 🏴󠁧󠁷󠁳󠁿 Flag for Sul (GW-S) 🏴󠁧󠁷󠁬󠁿 Flag for Leste (GW-L) 🏴󠁧󠁴󠁪󠁡󠁿 Flag for Jalapa (GT-JA) 🏴󠁧󠁴󠁰󠁥󠁿 Flag for Petén (GT-PE) 🏴󠁧󠁴󠁳󠁯󠁿 Flag for Sololá (GT-SO) 🏴󠁨󠁮󠁣󠁭󠁿 Flag for Comayagua (HN-CM) 🏴󠁨󠁲󠀰󠀶󠁿 Flag for Koprivnica-Križevci (HR-06) 🏴󠁨󠁮󠁣󠁰󠁿 Flag for Copán (HN-CP) 🏴󠁨󠁮󠁩󠁢󠁿 Flag for Bay Islands (HN-IB) 🏴󠁨󠁲󠀰󠀹󠁿 Flag for Lika-Senj (HR-09) 🏴󠁨󠁮󠁳󠁢󠁿 Flag for Santa Bárbara (HN-SB) 🏴󠁨󠁮󠁩󠁮󠁿 Flag for Intibucá (HN-IN) 🏴󠁨󠁮󠁦󠁭󠁿 Flag for Francisco Morazán (HN-FM) 🏴󠁨󠁲󠀰󠀱󠁿 Flag for Zagreb County (HR-01) 🏴󠁨󠁮󠁣󠁬󠁿 Flag for Colón (HN-CL) 🏴󠁨󠁴󠁣󠁥󠁿 Flag for Centre (HT-CE) 🏴󠁨󠁲󠀰󠀸󠁿 Flag for Primorje-Gorski Kotar (HR-08) 🏴󠁨󠁮󠁬󠁥󠁿 Flag for Lempira (HN-LE) 🏴󠁨󠁲󠀱󠀴󠁿 Flag for Osijek-Baranja (HR-14) 🏴󠁨󠁲󠀱󠀲󠁿 Flag for Brod-Posavina (HR-12) 🏴󠁨󠁲󠀱󠀷󠁿 Flag for Split-Dalmatia (HR-17) 🏴󠁨󠁮󠁯󠁬󠁿 Flag for Olancho (HN-OL) 🏴󠁨󠁮󠁬󠁰󠁿 Flag for La Paz (HN-LP) 🏴󠁨󠁲󠀲󠀰󠁿 Flag for Međimurje (HR-20) 🏴󠁨󠁮󠁥󠁰󠁿 Flag for El Paraíso (HN-EP) 🏴󠁨󠁲󠀲󠀱󠁿 Flag for Zagreb (HR-21) 🏴󠁨󠁲󠀱󠀵󠁿 Flag for Šibenik-Knin (HR-15) 🏴󠁥󠁥󠀴󠀴󠁿 Flag for Ida-Viru (EE-44) 🏴󠁨󠁮󠁣󠁲󠁿 Flag for Cortés (HN-CR) 🏴󠁨󠁲󠀰󠀳󠁿 Flag for Sisak-Moslavina (HR-03) 🏴󠁨󠁲󠀱󠀳󠁿 Flag for Zadar (HR-13) 🏴󠁨󠁲󠀱󠀸󠁿 Flag for Istria (HR-18) 🏴󠁨󠁲󠀰󠀲󠁿 Flag for Krapina-Zagorje (HR-02) 🏴󠁨󠁲󠀱󠀶󠁿 Flag for Vukovar-Syrmia (HR-16) 🏴󠁨󠁮󠁹󠁯󠁿 Flag for Yoro (HN-YO) 🏴󠁨󠁴󠁡󠁲󠁿 Flag for Artibonite (HT-AR) 🏴󠁨󠁮󠁧󠁤󠁿 Flag for Gracias a Dios (HN-GD) 🏴󠁨󠁮󠁶󠁡󠁿 Flag for Valle (HN-VA) 🏴󠁤󠁺󠀱󠀸󠁿 Flag for Jijel (DZ-18) 🏴󠁨󠁲󠀱󠀹󠁿 Flag for Dubrovnik-Neretva (HR-19) 🏴󠁨󠁲󠀱󠀱󠁿 Flag for Požega-Slavonia (HR-11) 🏴󠁨󠁲󠀰󠀷󠁿 Flag for Bjelovar-Bilogora (HR-07) 🏴󠁨󠁮󠁯󠁣󠁿 Flag for Ocotepeque (HN-OC) 🏴󠁨󠁵󠁢󠁵󠁿 Flag for Budapest (HU-BU) 🏴󠁨󠁵󠁨󠁶󠁿 Flag for Hódmezővásárhely (HU-HV) 🏴󠁨󠁵󠁦󠁥󠁿 Flag for Fejér (HU-FE) 🏴󠁨󠁵󠁢󠁡󠁿 Flag for Baranya (HU-BA) 🏴󠁨󠁵󠁳󠁦󠁿 Flag for Székesfehérvár (HU-SF) 🏴󠁨󠁵󠁢󠁺󠁿 Flag for Borsod-Abaúj-Zemplén (HU-BZ) 🏴󠁨󠁵󠁣󠁳󠁿 Flag for Csongrád (HU-CS) 🏴󠁨󠁵󠁳󠁮󠁿 Flag for Sopron (HU-SN) 🏴󠁨󠁵󠁤󠁵󠁿 Flag for Dunaújváros (HU-DU) 🏴󠁨󠁵󠁫󠁶󠁿 Flag for Kaposvár (HU-KV) 🏴󠁨󠁵󠁮󠁹󠁿 Flag for Nyíregyháza (HU-NY) 🏴󠁨󠁵󠁨󠁢󠁿 Flag for Hajdú-Bihar (HU-HB) 🏴󠁨󠁴󠁯󠁵󠁿 Flag for Ouest (HT-OU) 🏴󠁨󠁵󠁳󠁤󠁿 Flag for Szeged (HU-SD) 🏴󠁨󠁵󠁰󠁥󠁿 Flag for Pest (HU-PE) 🏴󠁨󠁵󠁫󠁥󠁿 Flag for Komárom-Esztergom (HU-KE) 🏴󠁨󠁵󠁮󠁫󠁿 Flag for Nagykanizsa (HU-NK) 🏴󠁨󠁴󠁧󠁡󠁿 Flag for Grand’Anse (HT-GA) 🏴󠁨󠁵󠁢󠁣󠁿 Flag for Békéscsaba (HU-BC) 🏴󠁨󠁴󠁳󠁤󠁿 Flag for Sud (HT-SD) 🏴󠁨󠁴󠁮󠁯󠁿 Flag for Nord-Ouest (HT-NO) 🏴󠁨󠁵󠁨󠁥󠁿 Flag for Heves (HU-HE) 🏴󠁨󠁵󠁢󠁫󠁿 Flag for Bács-Kiskun (HU-BK) 🏴󠁨󠁵󠁭󠁩󠁿 Flag for Miskolc (HU-MI) 🏴󠁨󠁵󠁥󠁲󠁿 Flag for Érd (HU-ER) 👨🏽‍👨🏽‍👦🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁨󠁴󠁮󠁩󠁿 Flag for Nippes (HT-NI) 🏴󠁨󠁵󠁳󠁫󠁿 Flag for Szolnok (HU-SK) 🏴󠁨󠁴󠁮󠁤󠁿 Flag for Nord (HT-ND) 🏴󠁨󠁴󠁳󠁥󠁿 Flag for Sud-Est (HT-SE) 🏴󠁨󠁵󠁪󠁮󠁿 Flag for Jász-Nagykun-Szolnok (HU-JN) 🏴󠁨󠁵󠁰󠁳󠁿 Flag for Pécs (HU-PS) 🏴󠁨󠁵󠁫󠁭󠁿 Flag for Kecskemét (HU-KM) 🏴󠁨󠁵󠁤󠁥󠁿 Flag for Debrecen (HU-DE) 🏴󠁨󠁵󠁢󠁥󠁿 Flag for Békés (HU-BE) 🏴󠁨󠁵󠁮󠁯󠁿 Flag for Nógrád (HU-NO) 🏴󠁨󠁵󠁳󠁨󠁿 Flag for Szombathely (HU-SH) 🏴󠁨󠁵󠁧󠁹󠁿 Flag for Győr (HU-GY) 🏴󠁩󠁤󠁮󠁵󠁿 Flag for Lesser Sunda Islands (ID-NU) 🏴󠁨󠁵󠁴󠁢󠁿 Flag for Tatabánya (HU-TB) 🏴󠁩󠁤󠁪󠁷󠁿 Flag for Java (ID-JW) 🏴󠁩󠁮󠁣󠁨󠁿 Flag for Chandigarh (IN-CH) 🏴󠁩󠁮󠁧󠁪󠁿 Flag for Gujarat (IN-GJ) 🏴󠁩󠁥󠁬󠁿 Flag for Leinster (IE-L) 🏴󠁨󠁵󠁺󠁡󠁿 Flag for Zala (HU-ZA) 🏴󠁩󠁮󠁤󠁤󠁿 Flag for Daman and Diu (IN-DD) 🏴󠁩󠁬󠁴󠁡󠁿 Flag for Tel Aviv District (IL-TA) 🏴󠁩󠁤󠁳󠁬󠁿 Flag for Sulawesi (ID-SL) 🏴󠁩󠁮󠁡󠁲󠁿 Flag for Arunachal Pradesh (IN-AR) 🏴󠁨󠁵󠁶󠁥󠁿 Flag for Veszprém County (HU-VE) 🏴󠁩󠁮󠁡󠁮󠁿 Flag for Andaman and Nicobar Islands (IN-AN) 🏴󠁨󠁵󠁳󠁯󠁿 Flag for Somogy (HU-SO) 🏴󠁨󠁵󠁶󠁡󠁿 Flag for Vas (HU-VA) 🏴󠁩󠁬󠁪󠁭󠁿 Flag for Jerusalem (IL-JM) 🏴󠁩󠁮󠁤󠁮󠁿 Flag for Dadra and Nagar Haveli (IN-DN) 🏴󠁨󠁵󠁶󠁭󠁿 Flag for Veszprém (HU-VM) 🏴󠁨󠁵󠁳󠁴󠁿 Flag for Salgótarján (HU-ST) 🏴󠁩󠁮󠁣󠁴󠁿 Flag for Chhattisgarh (IN-CT) 🏴󠁩󠁥󠁵󠁿 Flag for Ulster (IE-U) 🏴󠁩󠁮󠁤󠁬󠁿 Flag for Delhi (IN-DL) 🏴󠁩󠁥󠁭󠁿 Flag for Munster (IE-M) 🏴󠁩󠁥󠁣󠁿 Flag for Connacht (IE-C) 🏴󠁩󠁬󠁨󠁡󠁿 Flag for Haifa District (IL-HA) 🏴󠁩󠁤󠁫󠁡󠁿 Flag for Kalimantan (ID-KA) 🏴󠁩󠁮󠁧󠁡󠁿 Flag for Goa (IN-GA) 🏴󠁩󠁤󠁳󠁭󠁿 Flag for Sumatra (ID-SM) 🏴󠁩󠁤󠁰󠁰󠁿 Flag for Papua Islands (ID-PP) 🏴󠁨󠁵󠁳󠁳󠁿 Flag for Szekszárd (HU-SS) 🏴󠁩󠁬󠁺󠁿 Flag for Northern District (IL-Z) 🏴󠁨󠁵󠁴󠁯󠁿 Flag for Tolna (HU-TO) 🏴󠁩󠁬󠁭󠁿 Flag for Central District (IL-M) 🏴󠁩󠁬󠁤󠁿 Flag for Southern District (IL-D) 🏴󠁩󠁮󠁢󠁲󠁿 Flag for Bihar (IN-BR) 🏴󠁨󠁵󠁺󠁥󠁿 Flag for Zalaegerszeg (HU-ZE) 🏴󠁩󠁮󠁡󠁰󠁿 Flag for Andhra Pradesh (IN-AP) 🏴󠁩󠁱󠁤󠁡󠁿 Flag for Dohuk (IQ-DA) 🏴󠁩󠁮󠁪󠁨󠁿 Flag for Jharkhand (IN-JH) 🏴󠁩󠁮󠁫󠁬󠁿 Flag for Kerala (IN-KL) 🏴󠁩󠁮󠁷󠁢󠁿 Flag for West Bengal (IN-WB) 🏴󠁩󠁮󠁯󠁲󠁿 Flag for Odisha (IN-OR) 🏴󠁩󠁮󠁰󠁹󠁿 Flag for Puducherry (IN-PY) 🏴󠁩󠁱󠁫󠁡󠁿 Flag for Karbala (IQ-KA) 🏴󠁩󠁱󠁳󠁤󠁿 Flag for Saladin (IQ-SD) 🏴󠁩󠁮󠁭󠁺󠁿 Flag for Mizoram (IN-MZ) 🏴󠁩󠁮󠁨󠁰󠁿 Flag for Himachal Pradesh (IN-HP) 🏴󠁩󠁮󠁭󠁰󠁿 Flag for Madhya Pradesh (IN-MP) 🏴󠁩󠁮󠁰󠁢󠁿 Flag for Punjab (IN-PB) 🏴󠁩󠁮󠁮󠁬󠁿 Flag for Nagaland (IN-NL) 🏴󠁩󠁱󠁱󠁡󠁿 Flag for Al-Qādisiyyah (IQ-QA) 🏴󠁩󠁱󠁤󠁩󠁿 Flag for Diyala (IQ-DI) 🏴󠁩󠁱󠁮󠁩󠁿 Flag for Nineveh (IQ-NI) 🏴󠁩󠁱󠁤󠁱󠁿 Flag for Dhi Qar (IQ-DQ) 🏴󠁩󠁮󠁭󠁬󠁿 Flag for Meghalaya (IN-ML) 🏴󠁩󠁮󠁴󠁮󠁿 Flag for Tamil Nadu (IN-TN) 🏴󠁩󠁱󠁮󠁡󠁿 Flag for Najaf (IQ-NA) 🏴󠁩󠁱󠁭󠁵󠁿 Flag for Al Muthanna (IQ-MU) 🏴󠁩󠁮󠁴󠁧󠁿 Flag for Telangana (IN-TG) 🏴󠁩󠁮󠁨󠁲󠁿 Flag for Haryana (IN-HR) 🏴󠁩󠁮󠁵󠁴󠁿 Flag for Uttarakhand (IN-UT) 🏴󠁩󠁮󠁴󠁲󠁿 Flag for Tripura (IN-TR) 🏴󠁩󠁱󠁢󠁧󠁿 Flag for Baghdad (IQ-BG) 🏴󠁩󠁮󠁬󠁤󠁿 Flag for Lakshadweep (IN-LD) 🏴󠁩󠁱󠁭󠁡󠁿 Flag for Maysan (IQ-MA) 🏴󠁩󠁱󠁢󠁡󠁿 Flag for Basra (IQ-BA) 🏴󠁩󠁱󠁡󠁲󠁿 Flag for Erbil (IQ-AR) 🏴󠁩󠁮󠁭󠁨󠁿 Flag for Maharashtra (IN-MH) 🏴󠁩󠁱󠁡󠁮󠁿 Flag for Al Anbar (IQ-AN) 🏴󠁩󠁮󠁳󠁫󠁿 Flag for Sikkim (IN-SK) 🏴󠁩󠁱󠁢󠁢󠁿 Flag for Babylon (IQ-BB) 🏴󠁩󠁮󠁵󠁰󠁿 Flag for Uttar Pradesh (IN-UP) 🏴󠁩󠁱󠁳󠁵󠁿 Flag for Sulaymaniyah (IQ-SU) 🏴󠁩󠁮󠁲󠁪󠁿 Flag for Rajasthan (IN-RJ) 🏴󠁩󠁮󠁪󠁫󠁿 Flag for Jammu and Kashmir (IN-JK) 🏴󠁩󠁲󠀰󠀸󠁿 Flag for Chaharmahal and Bakhtiari (IR-08) 🏴󠁩󠁲󠀲󠀶󠁿 Flag for Qom (IR-26) 🏴󠁩󠁳󠀱󠁿 Flag for Capital (IS-1) 👨🏾‍👨🏾‍👦🏾 Family - Man: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁩󠁲󠀰󠀳󠁿 Flag for Ardabil (IR-03) 🏴󠁩󠁲󠀲󠀵󠁿 Flag for Yazd (IR-25) 🏴󠁩󠁲󠀲󠀹󠁿 Flag for South Khorasan (IR-29) 👨🏿‍👨🏿‍👦🏿 Family - Man: Dark Skin Tone, Man: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁩󠁲󠀲󠀴󠁿 Flag for Hamadan (IR-24) 🏴󠁧󠁹󠁭󠁡󠁿 Flag for Mahaica-Berbice (GY-MA) 🏴󠁩󠁳󠀳󠁿 Flag for Western (IS-3) 🏴󠁩󠁲󠀲󠀷󠁿 Flag for Golestan (IR-27) 🏴󠁩󠁲󠀱󠀱󠁿 Flag for Zanjan (IR-11) 🏴󠁩󠁲󠀲󠀰󠁿 Flag for Lorestan (IR-20) 🏴󠁩󠁲󠀱󠀷󠁿 Flag for Kermanshah (IR-17) 🏴󠁩󠁲󠀱󠀸󠁿 Flag for Kohgiluyeh and Boyer-Ahmad (IR-18) 🏴󠁥󠁧󠁣󠁿 Flag for Cairo (EG-C) 🏴󠁩󠁲󠀳󠀱󠁿 Flag for North Khorasan (IR-31) 🏴󠁩󠁲󠀰󠀶󠁿 Flag for Bushehr (IR-06) 🏴󠁥󠁳󠁥󠁸󠁿 Flag for Extremadura (ES-EX) 🏴󠁥󠁳󠁣󠁮󠁿 Flag for Canary Islands (ES-CN) 🏴󠁩󠁳󠀷󠁿 Flag for Eastern (IS-7) 🏴󠁩󠁲󠀰󠀵󠁿 Flag for Ilam (IR-05) 🏴󠁩󠁲󠀲󠀸󠁿 Flag for Qazvin (IR-28) 🏴󠁩󠁲󠀰󠀴󠁿 Flag for Isfahan (IR-04) 🏴󠁩󠁲󠀱󠀵󠁿 Flag for Kerman (IR-15) 🏴󠁩󠁲󠀲󠀳󠁿 Flag for Hormozgan (IR-23) 🏴󠁩󠁱󠁷󠁡󠁿 Flag for Wasit (IQ-WA) 🏴󠁩󠁴󠀲󠀱󠁿 Flag for Piedmont (IT-21) 🏴󠁩󠁳󠀶󠁿 Flag for Northeastern (IS-6) 🏴󠁩󠁳󠀵󠁿 Flag for Northwestern (IS-5) 🏴󠁩󠁲󠀲󠀲󠁿 Flag for Markazi (IR-22) 🏴󠁩󠁲󠀱󠀹󠁿 Flag for Gilan (IR-19) 🏴󠁩󠁲󠀱󠀰󠁿 Flag for Khuzestan (IR-10) 🏴󠁩󠁲󠀱󠀲󠁿 Flag for Semnan (IR-12) 🏴󠁩󠁳󠀲󠁿 Flag for Southern Peninsula (IS-2) 🏴󠁪󠁭󠀱󠀲󠁿 Flag for Manchester (JM-12) 🏴󠁪󠁯󠁩󠁲󠁿 Flag for Irbid (JO-IR) 🏴󠁪󠁭󠀰󠀵󠁿 Flag for Saint Mary (JM-05) 🏴󠁩󠁴󠀷󠀷󠁿 Flag for Basilicata (IT-77) 🏴󠁩󠁴󠀳󠀶󠁿 Flag for Friuli–Venezia Giulia (IT-36) 🏴󠁪󠁭󠀱󠀳󠁿 Flag for Clarendon (JM-13) 🏴󠁩󠁴󠀵󠀷󠁿 Flag for Marche (IT-57) 🏴󠁪󠁭󠀰󠀴󠁿 Flag for Portland (JM-04) 🏴󠁩󠁴󠀸󠀲󠁿 Flag for Sicily (IT-82) 🏴󠁩󠁴󠀳󠀴󠁿 Flag for Veneto (IT-34) 🏴󠁩󠁴󠀶󠀵󠁿 Flag for Abruzzo (IT-65) 🏴󠁩󠁴󠀶󠀷󠁿 Flag for Molise (IT-67) 🏴󠁪󠁯󠁢󠁡󠁿 Flag for Balqa (JO-BA) 🏴󠁩󠁴󠀷󠀵󠁿 Flag for Apulia (IT-75) 🏴󠁩󠁴󠀷󠀸󠁿 Flag for Calabria (IT-78) 🏴󠁩󠁴󠀵󠀲󠁿 Flag for Tuscany (IT-52) 🏴󠁪󠁭󠀰󠀹󠁿 Flag for Hanover (JM-09) 🏴󠁪󠁭󠀰󠀲󠁿 Flag for Saint Andrew (JM-02) 🏴󠁪󠁯󠁡󠁴󠁿 Flag for Tafilah (JO-AT) 🏴󠁩󠁴󠀵󠀵󠁿 Flag for Umbria (IT-55) 🏴󠁪󠁭󠀰󠀸󠁿 Flag for Saint James (JM-08) 🏴󠁪󠁭󠀰󠀶󠁿 Flag for Saint Ann (JM-06) 🏴󠁪󠁭󠀱󠀱󠁿 Flag for Saint Elizabeth (JM-11) 🏴󠁪󠁯󠁡󠁺󠁿 Flag for Zarqa (JO-AZ) 🏴󠁦󠁩󠀱󠀲󠁿 Flag for Ostrobothnia (FI-12) 🏴󠁩󠁴󠀶󠀲󠁿 Flag for Lazio (IT-62) 🏴󠁪󠁯󠁡󠁪󠁿 Flag for Ajloun (JO-AJ) 🏴󠁩󠁴󠀴󠀲󠁿 Flag for Liguria (IT-42) 🏴󠁪󠁭󠀰󠀷󠁿 Flag for Trelawny (JM-07) 🏴󠁪󠁯󠁡󠁱󠁿 Flag for Aqaba (JO-AQ) 🏴󠁪󠁯󠁪󠁡󠁿 Flag for Jerash (JO-JA) 🏴󠁪󠁯󠁡󠁭󠁿 Flag for Amman (JO-AM) 🏴󠁩󠁴󠀲󠀳󠁿 Flag for Aosta Valley (IT-23) 🏴󠁪󠁭󠀱󠀰󠁿 Flag for Westmoreland (JM-10) 🏴󠁪󠁰󠀰󠀸󠁿 Flag for Ibaraki (JP-08) 🏴󠁪󠁯󠁭󠁤󠁿 Flag for Madaba (JO-MD) 🏴󠁪󠁰󠀳󠀲󠁿 Flag for Shimane (JP-32) 🏴󠁪󠁰󠀲󠀶󠁿 Flag for Kyōto (JP-26) 🏴󠁣󠁬󠁡󠁲󠁿 Flag for Araucanía (CL-AR) 🏴󠁪󠁰󠀰󠀹󠁿 Flag for Tochigi (JP-09) 🏴󠁪󠁰󠀰󠀵󠁿 Flag for Akita (JP-05) 🏴󠁪󠁰󠀱󠀲󠁿 Flag for Chiba (JP-12) 🏴󠁪󠁰󠀰󠀴󠁿 Flag for Miyagi (JP-04) 🏴󠁪󠁰󠀱󠀵󠁿 Flag for Niigata (JP-15) 🏴󠁪󠁰󠀱󠀶󠁿 Flag for Toyama (JP-16) 🏴󠁪󠁰󠀲󠀳󠁿 Flag for Aichi (JP-23) 🏴󠁪󠁰󠀳󠀶󠁿 Flag for Tokushima (JP-36) 🏴󠁪󠁰󠀲󠀰󠁿 Flag for Nagano (JP-20) 🏴󠁪󠁰󠀳󠀱󠁿 Flag for Tottori (JP-31) 🏴󠁪󠁰󠀰󠀳󠁿 Flag for Iwate (JP-03) 🏴󠁪󠁰󠀳󠀳󠁿 Flag for Okayama (JP-33) 🏴󠁪󠁰󠀱󠀷󠁿 Flag for Ishikawa (JP-17) 🏴󠁪󠁰󠀳󠀰󠁿 Flag for Wakayama (JP-30) 🏴󠁪󠁰󠀱󠀰󠁿 Flag for Gunma (JP-10) 🏴󠁪󠁯󠁭󠁡󠁿 Flag for Mafraq (JO-MA) 🏴󠁪󠁰󠀳󠀵󠁿 Flag for Yamaguchi (JP-35) 🏴󠁣󠁵󠀱󠀲󠁿 Flag for Granma (CU-12) 🏴󠁪󠁰󠀲󠀵󠁿 Flag for Shiga (JP-25) 🏴󠁪󠁰󠀰󠀲󠁿 Flag for Aomori (JP-02) 🏴󠁪󠁰󠀱󠀱󠁿 Flag for Saitama (JP-11) 🏴󠁪󠁰󠀲󠀹󠁿 Flag for Nara (JP-29) 🏴󠁪󠁰󠀱󠀹󠁿 Flag for Yamanashi (JP-19) 🏴󠁪󠁰󠀳󠀴󠁿 Flag for Hiroshima (JP-34) 🏴󠁪󠁯󠁭󠁮󠁿 Flag for Ma’an (JO-MN) 🏴󠁪󠁰󠀲󠀲󠁿 Flag for Shizuoka (JP-22) 🏴󠁪󠁰󠀲󠀷󠁿 Flag for Ōsaka (JP-27) 🏴󠁪󠁰󠀲󠀴󠁿 Flag for Mie (JP-24) 🏴󠁪󠁰󠀰󠀶󠁿 Flag for Yamagata (JP-06) 🏴󠁪󠁰󠀲󠀸󠁿 Flag for Hyōgo (JP-28) 🏴󠁪󠁯󠁫󠁡󠁿 Flag for Karak (JO-KA) 🏴󠁪󠁰󠀳󠀸󠁿 Flag for Ehime (JP-38) 🏴󠁪󠁰󠀱󠀴󠁿 Flag for Kanagawa (JP-14) 🏴󠁪󠁰󠀳󠀷󠁿 Flag for Kagawa (JP-37) 🏴󠁫󠁥󠀰󠀷󠁿 Flag for Garissa (KE-07) 🏴󠁫󠁥󠀲󠀴󠁿 Flag for Mandera (KE-24) 🏴󠁪󠁰󠀴󠀶󠁿 Flag for Kagoshima (JP-46) 🏴󠁫󠁥󠀱󠀷󠁿 Flag for Kisumu (KE-17) 🏴󠁫󠁥󠀱󠀴󠁿 Flag for Kilifi (KE-14) 🏴󠁫󠁥󠀱󠀵󠁿 Flag for Kirinyaga (KE-15) 🏴󠁫󠁥󠀱󠀰󠁿 Flag for Kajiado (KE-10) 🏴󠁫󠁥󠀰󠀳󠁿 Flag for Bungoma (KE-03) 🏴󠁫󠁥󠀳󠀲󠁿 Flag for Nandi (KE-32) 🏴󠁫󠁥󠀱󠀳󠁿 Flag for Kiambu (KE-13) 🏴󠁫󠁥󠀲󠀰󠁿 Flag for Laikipia (KE-20) 🏴󠁫󠁥󠀲󠀱󠁿 Flag for Lamu (KE-21) 🏴󠁪󠁰󠀴󠀰󠁿 Flag for Fukuoka (JP-40) 🏴󠁫󠁥󠀰󠀴󠁿 Flag for Busia (KE-04) 🏴󠁪󠁰󠀴󠀱󠁿 Flag for Saga (JP-41) 🏴󠁫󠁥󠀲󠀷󠁿 Flag for Migori (KE-27) 🏴󠁫󠁥󠀰󠀶󠁿 Flag for Embu (KE-06) 👩🏾‍👦🏾‍👧🏾 Family - Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone, Girl: Medium-Dark Skin Tone 🏴󠁫󠁥󠀱󠀲󠁿 Flag for Kericho (KE-12) 🏴󠁫󠁥󠀰󠀹󠁿 Flag for Isiolo (KE-09) 🏴󠁫󠁥󠀱󠀹󠁿 Flag for Kwale (KE-19) 🏴󠁪󠁰󠀴󠀲󠁿 Flag for Nagasaki (JP-42) 🏴󠁫󠁥󠀳󠀰󠁿 Flag for Nairobi County (KE-30) 🏴󠁫󠁥󠀲󠀳󠁿 Flag for Makueni (KE-23) 🏴󠁫󠁥󠀲󠀹󠁿 Flag for Murang’a (KE-29) 🏴󠁪󠁰󠀳󠀹󠁿 Flag for Kōchi (JP-39) 🏴󠁫󠁥󠀰󠀲󠁿 Flag for Bomet (KE-02) 🏴󠁫󠁥󠀲󠀸󠁿 Flag for Mombasa (KE-28) 🏴󠁫󠁥󠀰󠀸󠁿 Flag for Homa Bay (KE-08) 🏴󠁫󠁥󠀱󠀱󠁿 Flag for Kakamega (KE-11) 🏴󠁫󠁥󠀲󠀲󠁿 Flag for Machakos (KE-22) 🏴󠁫󠁥󠀱󠀶󠁿 Flag for Kisii (KE-16) 🏴󠁫󠁥󠀰󠀵󠁿 Flag for Elgeyo-Marakwet (KE-05) 🏴󠁪󠁰󠀴󠀴󠁿 Flag for Ōita (JP-44) 🏴󠁫󠁥󠀳󠀳󠁿 Flag for Narok (KE-33) 🏴󠁫󠁥󠀲󠀶󠁿 Flag for Meru (KE-26) 🏴󠁪󠁰󠀴󠀳󠁿 Flag for Kumamoto (JP-43) 🏴󠁪󠁰󠀴󠀵󠁿 Flag for Miyazaki (JP-45) 🏴󠁫󠁨󠀱󠀹󠁿 Flag for Stung Treng (KH-19) 🏴󠁫󠁥󠀳󠀷󠁿 Flag for Samburu (KE-37) 🏴󠁫󠁥󠀴󠀷󠁿 Flag for West Pokot (KE-47) 🏴󠁫󠁥󠀳󠀹󠁿 Flag for Taita-Taveta (KE-39) 🏴󠁫󠁨󠀱󠀴󠁿 Flag for Prey Veng (KH-14) 🏴󠁫󠁥󠀴󠀱󠁿 Flag for Tharaka-Nithi (KE-41) 🏴󠁫󠁧󠁯󠁿 Flag for Osh Region (KG-O) 🏴󠁫󠁨󠀲󠀵󠁿 Flag for Tbong Khmum (KH-25) 🏴󠁫󠁧󠁴󠁿 Flag for Talas (KG-T) 🏴󠁫󠁨󠀱󠀲󠁿 Flag for Phnom Penh (KH-12) 🏴󠁫󠁧󠁧󠁢󠁿 Flag for Bishkek (KG-GB) 🏴󠁫󠁥󠀴󠀴󠁿 Flag for Uasin Gishu (KE-44) 🏴󠁫󠁨󠀲󠀳󠁿 Flag for Kep (KH-23) 🏴󠁫󠁨󠀱󠀰󠁿 Flag for Kratié (KH-10) 🏴󠁫󠁨󠀲󠀱󠁿 Flag for Takéo (KH-21) 🏴󠁫󠁨󠀲󠁿 Flag for Battambang (KH-2) 🏴󠁫󠁥󠀳󠀶󠁿 Flag for Nyeri (KE-36) 🏴󠁫󠁨󠀱󠀳󠁿 Flag for Preah Vihear (KH-13) 🏴󠁫󠁥󠀴󠀰󠁿 Flag for Tana River (KE-40) 🏴󠁫󠁨󠀲󠀴󠁿 Flag for Pailin (KH-24) 🏴󠁫󠁨󠀱󠀶󠁿 Flag for Ratanakiri (KH-16) 🏴󠁫󠁨󠀲󠀲󠁿 Flag for Oddar Meanchey (KH-22) 🏴󠁫󠁥󠀴󠀲󠁿 Flag for Trans Nzoia (KE-42) 🏴󠁫󠁨󠀱󠀸󠁿 Flag for Sihanoukville (KH-18) 🏴󠁫󠁥󠀴󠀵󠁿 Flag for Vihiga (KE-45) 🏴󠁫󠁧󠁧󠁯󠁿 Flag for Osh (KG-GO) 🏴󠁫󠁧󠁢󠁿 Flag for Batken (KG-B) 🏴󠁫󠁧󠁪󠁿 Flag for Jalal-Abad (KG-J) 🏴󠁫󠁨󠀱󠀱󠁿 Flag for Mondulkiri (KH-11) 🏴󠁫󠁨󠀱󠀷󠁿 Flag for Siem Reap (KH-17) 🏴󠁫󠁥󠀴󠀳󠁿 Flag for Turkana (KE-43) 🏴󠁫󠁨󠀱󠁿 Flag for Banteay Meanchey (KH-1) 🏴󠁫󠁧󠁮󠁿 Flag for Naryn (KG-N) 🏴󠁫󠁥󠀳󠀵󠁿 Flag for Nyandarua (KE-35) 🏴󠁫󠁥󠀳󠀸󠁿 Flag for Siaya (KE-38) 🏴󠁫󠁥󠀳󠀴󠁿 Flag for Nyamira (KE-34) 🏴󠁫󠁨󠀱󠀵󠁿 Flag for Pursat (KH-15) 🏴󠁫󠁥󠀴󠀶󠁿 Flag for Wajir (KE-46) 🏴󠁫󠁧󠁹󠁿 Flag for Issyk-Kul (KG-Y) 🏴󠁫󠁧󠁣󠁿 Flag for Chuy (KG-C) 🏴󠁫󠁭󠁭󠁿 Flag for Mohéli (KM-M) 🏴󠁫󠁲󠀱󠀱󠁿 Flag for Seoul (KR-11) 🏴󠁫󠁨󠀴󠁿 Flag for Kampong Chhnang (KH-4) 🏴󠁫󠁲󠀳󠀰󠁿 Flag for Daejeon (KR-30) 🏴󠁫󠁰󠀰󠀵󠁿 Flag for South Hwanghae (KP-05) 🏴󠁫󠁨󠀷󠁿 Flag for Kampot (KH-7) 🏴󠁫󠁮󠁮󠁿 Flag for Nevis (KN-N) 🏴󠁫󠁰󠀰󠀴󠁿 Flag for Chagang (KP-04) 🏴󠁫󠁲󠀴󠀶󠁿 Flag for South Jeolla (KR-46) 🏴󠁫󠁰󠀰󠀶󠁿 Flag for North Hwanghae (KP-06) 🏴󠁫󠁮󠁫󠁿 Flag for Saint Kitts (KN-K) 🏴󠁫󠁨󠀵󠁿 Flag for Kampong Speu (KH-5) 🏴󠁫󠁲󠀴󠀵󠁿 Flag for North Jeolla (KR-45) 🏴󠁫󠁰󠀰󠀳󠁿 Flag for North Pyongan (KP-03) 🏴󠁫󠁨󠀹󠁿 Flag for Koh Kong (KH-9) 🏴󠁫󠁰󠀰󠀷󠁿 Flag for Kangwon (KP-07) 🏴󠁫󠁲󠀲󠀶󠁿 Flag for Busan (KR-26) 🏴󠁫󠁲󠀲󠀹󠁿 Flag for Gwangju City (KR-29) 🏴󠁫󠁨󠀳󠁿 Flag for Kampong Cham (KH-3) 🏴󠁫󠁲󠀴󠀳󠁿 Flag for North Chungcheong (KR-43) 🏴󠁫󠁨󠀸󠁿 Flag for Kandal (KH-8) 🏴󠁫󠁨󠀶󠁿 Flag for Kampong Thom (KH-6) 🏴󠁫󠁰󠀱󠀰󠁿 Flag for Ryanggang (KP-10) 🏴󠁫󠁰󠀰󠀲󠁿 Flag for South Pyongan (KP-02) 🏴󠁫󠁭󠁧󠁿 Flag for Grande Comore (KM-G) 🏴󠁫󠁰󠀰󠀸󠁿 Flag for South Hamgyong (KP-08) 🏴󠁫󠁰󠀱󠀳󠁿 Flag for Rason (KP-13) 🏴󠁫󠁲󠀲󠀷󠁿 Flag for Daegu (KR-27) 🏴󠁫󠁲󠀲󠀸󠁿 Flag for Incheon (KR-28) 🏴󠁫󠁲󠀴󠀲󠁿 Flag for Gangwon (KR-42) 🏴󠁫󠁰󠀰󠀱󠁿 Flag for Pyongyang (KP-01) 🏴󠁫󠁲󠀳󠀱󠁿 Flag for Ulsan (KR-31) 🏴󠁫󠁲󠀴󠀴󠁿 Flag for South Chungcheong (KR-44) 🏴󠁫󠁭󠁡󠁿 Flag for Anjouan (KM-A) 🏴󠁫󠁲󠀴󠀱󠁿 Flag for Gyeonggi (KR-41) 🏴󠁫󠁲󠀴󠀷󠁿 Flag for North Gyeongsang (KR-47) 🏴󠁫󠁰󠀰󠀹󠁿 Flag for North Hamgyong (KP-09) 🏴󠁬󠁡󠁨󠁯󠁿 Flag for Houaphanh (LA-HO) 🏴󠁫󠁺󠁢󠁡󠁹󠁿 Flag for Bayqongyr (KZ-BAY) 🏴󠁬󠁡󠁣󠁨󠁿 Flag for Champasak (LA-CH) 🏴󠁬󠁡󠁶󠁴󠁿 Flag for Vientiane (LA-VT) 🏴󠁫󠁷󠁨󠁡󠁿 Flag for Hawalli (KW-HA) 🏴󠁬󠁡󠁰󠁨󠁿 Flag for Phongsaly (LA-PH) 🏴󠁫󠁺󠁰󠁡󠁶󠁿 Flag for Pavlodar (KZ-PAV) 🏴󠁫󠁺󠁡󠁬󠁭󠁿 Flag for Almaty Region (KZ-ALM) 🏴󠁫󠁷󠁫󠁵󠁿 Flag for Al Asimah (KW-KU) 🏴󠁬󠁡󠁢󠁫󠁿 Flag for Bokeo (LA-BK) 🏴󠁬󠁡󠁡󠁴󠁿 Flag for Attapeu (LA-AT) 🏴󠁫󠁺󠁡󠁫󠁴󠁿 Flag for Aktobe (KZ-AKT) 🏴󠁫󠁺󠁡󠁴󠁹󠁿 Flag for Atyrau (KZ-ATY) 🏴󠁫󠁷󠁪󠁡󠁿 Flag for Al Jahra (KW-JA) 🏴󠁬󠁡󠁢󠁬󠁿 Flag for Bolikhamsai (LA-BL) 🏴󠁬󠁡󠁯󠁵󠁿 Flag for Oudomxay (LA-OU) 🏴󠁫󠁺󠁭󠁡󠁮󠁿 Flag for Mangystau (KZ-MAN) 🏴󠁫󠁺󠁺󠁡󠁰󠁿 Flag for West Kazakhstan (KZ-ZAP) 🏴󠁫󠁺󠁺󠁨󠁡󠁿 Flag for Jambyl (KZ-ZHA) 🏴󠁫󠁺󠁡󠁳󠁴󠁿 Flag for Astana (KZ-AST) 🏴󠁬󠁡󠁬󠁰󠁿 Flag for Luang Prabang (LA-LP) 🏴󠁫󠁷󠁦󠁡󠁿 Flag for Al Farwaniyah (KW-FA) 🏴󠁫󠁺󠁫󠁵󠁳󠁿 Flag for Kostanay (KZ-KUS) 🏴󠁫󠁺󠁡󠁬󠁡󠁿 Flag for Almaty (KZ-ALA) 🏴󠁫󠁺󠁫󠁡󠁲󠁿 Flag for Karagandy (KZ-KAR) 🏴󠁫󠁺󠁫󠁺󠁹󠁿 Flag for Kyzylorda (KZ-KZY) 🏴󠁬󠁡󠁳󠁬󠁿 Flag for Salavan (LA-SL) 🏴󠁬󠁡󠁬󠁭󠁿 Flag for Luang Namtha (LA-LM) 🏴󠁫󠁲󠀵󠀰󠁿 Flag for Sejong (KR-50) 🏴󠁫󠁷󠁭󠁵󠁿 Flag for Mubarak Al-Kabeer (KW-MU) 🏴󠁫󠁺󠁳󠁥󠁶󠁿 Flag for North Kazakhstan (KZ-SEV) 👩🏿‍👦🏿‍👧🏿 Family - Woman: Dark Skin Tone, Boy: Dark Skin Tone, Girl: Dark Skin Tone 🏴󠁫󠁷󠁡󠁨󠁿 Flag for Al Ahmadi (KW-AH) 🏴󠁬󠁡󠁫󠁨󠁿 Flag for Khammouane (LA-KH) 🏴󠁫󠁺󠁡󠁫󠁭󠁿 Flag for Akmola (KZ-AKM) 🏴󠁫󠁺󠁹󠁵󠁺󠁿 Flag for South Kazakhstan (KZ-YUZ) 🏴󠁬󠁩󠀰󠀹󠁿 Flag for Triesen (LI-09) 👨🏽‍👨🏽‍👦🏽‍👦🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Boy: Medium Skin Tone, Boy: Medium Skin Tone 👩🏻‍👦🏻‍👶🏻 Family - Woman: Light Skin Tone, Boy: Light Skin Tone, Baby: Light Skin Tone 🏴󠁬󠁫󠀷󠁿 Flag for North Central (LK-7) 🏴󠁬󠁡󠁸󠁡󠁿 Flag for Sainyabuli (LA-XA) 🏴󠁬󠁢󠁡󠁫󠁿 Flag for Akkar (LB-AK) 🏴󠁬󠁣󠀰󠀷󠁿 Flag for Laborie (LC-07) 🏴󠁬󠁣󠀰󠀶󠁿 Flag for Gros Islet (LC-06) 🏴󠁬󠁢󠁡󠁳󠁿 Flag for North (LB-AS) 🏴󠁬󠁩󠀰󠀱󠁿 Flag for Balzers (LI-01) 🏴󠁬󠁫󠀲󠁿 Flag for Central (LK-2) 🏴󠁬󠁩󠀰󠀴󠁿 Flag for Mauren (LI-04) 🏴󠁬󠁢󠁮󠁡󠁿 Flag for Nabatieh (LB-NA) 🏴󠁬󠁣󠀰󠀵󠁿 Flag for Dennery (LC-05) 🏴󠁬󠁢󠁪󠁡󠁿 Flag for South (LB-JA) 🏴󠁬󠁩󠀱󠀱󠁿 Flag for Vaduz (LI-11) 🏴󠁬󠁣󠀰󠀲󠁿 Flag for Castries (LC-02) 🏴󠁬󠁫󠀸󠁿 Flag for Uva (LK-8) 🏴󠁬󠁩󠀱󠀰󠁿 Flag for Triesenberg (LI-10) 🏴󠁬󠁩󠀰󠀵󠁿 Flag for Planken (LI-05) 🏴󠁬󠁣󠀱󠀱󠁿 Flag for Vieux Fort (LC-11) 🏴󠁬󠁢󠁢󠁨󠁿 Flag for Baalbek-Hermel (LB-BH) 🏴󠁬󠁫󠀶󠁿 Flag for North Western (LK-6) 🏴󠁬󠁩󠀰󠀶󠁿 Flag for Ruggell (LI-06) 🏴󠁬󠁣󠀰󠀸󠁿 Flag for Micoud (LC-08) 🏴󠁬󠁩󠀰󠀲󠁿 Flag for Eschen (LI-02) 🏴󠁬󠁣󠀱󠀲󠁿 Flag for Canaries (LC-12) 🏴󠁬󠁢󠁢󠁡󠁿 Flag for Beirut (LB-BA) 🏴󠁬󠁡󠁸󠁩󠁿 Flag for Xiangkhouang (LA-XI) 🏴󠁬󠁣󠀱󠀰󠁿 Flag for Soufrière (LC-10) 🏴󠁬󠁣󠀰󠀱󠁿 Flag for Anse la Raye (LC-01) 🏴󠁬󠁣󠀰󠀳󠁿 Flag for Choiseul (LC-03) 🏴󠁬󠁩󠀰󠀳󠁿 Flag for Gamprin (LI-03) 🏴󠁬󠁫󠀴󠁿 Flag for Northern (LK-4) 🏴󠁬󠁲󠁧󠁢󠁿 Flag for Grand Bassa (LR-GB) 🏴󠁬󠁲󠁧󠁰󠁿 Flag for Gbarpolu (LR-GP) 🏴󠁬󠁲󠁧󠁧󠁿 Flag for Grand Gedeh (LR-GG) 🏴󠁬󠁴󠀱󠀲󠁿 Flag for Jurbarkas (LT-12) 🏴󠁬󠁲󠁮󠁩󠁿 Flag for Nimba (LR-NI) 🏴󠁦󠁩󠀰󠀸󠁿 Flag for Central Finland (FI-08) 🏴󠁬󠁴󠀱󠀰󠁿 Flag for Jonava (LT-10) 🏴󠁬󠁲󠁭󠁧󠁿 Flag for Margibi (LR-MG) 🏴󠁬󠁲󠁳󠁩󠁿 Flag for Sinoe (LR-SI) 🏴󠁬󠁲󠁭󠁯󠁿 Flag for Montserrado (LR-MO) 🏴󠁬󠁴󠀱󠀶󠁿 Flag for Kaunas (LT-16) 🏴󠁬󠁳󠁫󠁿 Flag for Thaba-Tseka (LS-K) 🏴󠁬󠁴󠀰󠀵󠁿 Flag for Birštonas (LT-05) 🏴󠁬󠁳󠁦󠁿 Flag for Mohale’s Hoek (LS-F) 🏴󠁬󠁲󠁢󠁭󠁿 Flag for Bomi (LR-BM) 🏴󠁬󠁴󠀰󠀷󠁿 Flag for Druskininkai (LT-07) 🏴󠁬󠁴󠀱󠀴󠁿 Flag for Kalvarija (LT-14) 🏴󠁬󠁴󠀱󠀵󠁿 Flag for Kauno Municipality (LT-15) 🏴󠁬󠁳󠁨󠁿 Flag for Qacha’s Nek (LS-H) 🏴󠁬󠁴󠀰󠀴󠁿 Flag for Anykščiai (LT-04) 🏴󠁬󠁳󠁣󠁿 Flag for Leribe (LS-C) 🏴󠁬󠁴󠀱󠀱󠁿 Flag for Joniškis (LT-11) 🏴󠁬󠁲󠁬󠁯󠁿 Flag for Lofa (LR-LO) 🏴󠁬󠁲󠁲󠁩󠁿 Flag for Rivercess (LR-RI) 🏴󠁬󠁴󠀱󠀳󠁿 Flag for Kaišiadorys (LT-13) 🏴󠁬󠁴󠀰󠀸󠁿 Flag for Elektrėnai (LT-08) 🏴󠁬󠁲󠁧󠁫󠁿 Flag for Grand Kru (LR-GK) 🏴󠁬󠁳󠁤󠁿 Flag for Berea (LS-D) 🏴󠁬󠁳󠁧󠁿 Flag for Quthing (LS-G) 🏴󠁬󠁳󠁢󠁿 Flag for Butha-Buthe (LS-B) 🏴󠁬󠁴󠀰󠀱󠁿 Flag for Akmenė (LT-01) 🏴󠁬󠁴󠀰󠀹󠁿 Flag for Ignalina (LT-09) 🏴󠁬󠁳󠁥󠁿 Flag for Mafeteng (LS-E) 🏴󠁬󠁳󠁪󠁿 Flag for Mokhotlong (LS-J) 🏴󠁬󠁴󠀰󠀳󠁿 Flag for Alytus (LT-03) 🏴󠁬󠁴󠀰󠀶󠁿 Flag for Biržai (LT-06) 🏴󠁣󠁦󠁫󠁢󠁿 Flag for Nana-Grébizi (CF-KB) 🏴󠁬󠁲󠁲󠁧󠁿 Flag for River Gee (LR-RG) 🏴󠁬󠁴󠀵󠀴󠁿 Flag for Utena (LT-54) 🏴󠁬󠁴󠀲󠀷󠁿 Flag for Molėtai (LT-27) 🏴󠁬󠁴󠀴󠀱󠁿 Flag for Šakiai (LT-41) 🏴󠁬󠁴󠀱󠀹󠁿 Flag for Kelmė (LT-19) 🏴󠁬󠁴󠀲󠀳󠁿 Flag for Kupiškis (LT-23) 🏴󠁬󠁴󠀵󠀶󠁿 Flag for Vilkaviškis (LT-56) 🏴󠁬󠁴󠀲󠀸󠁿 Flag for Neringa (LT-28) 🏴󠁬󠁴󠀳󠀳󠁿 Flag for Panevėžys (LT-33) 🏴󠁬󠁴󠀲󠀹󠁿 Flag for Pagėgiai (LT-29) 🏴󠁬󠁴󠀴󠀳󠁿 Flag for Šiaulių Municipality (LT-43) 🏴󠁬󠁴󠀳󠀱󠁿 Flag for Palanga (LT-31) 🏴󠁬󠁴󠀱󠀸󠁿 Flag for Kėdainiai (LT-18) 🏴󠁬󠁴󠀴󠀰󠁿 Flag for Rokiškis (LT-40) 🏴󠁬󠁴󠀴󠀵󠁿 Flag for Šilalė (LT-45) 🏴󠁬󠁴󠀵󠀲󠁿 Flag for Trakai (LT-52) 🏴󠁦󠁭󠁰󠁮󠁩󠁿 Flag for Pohnpei (FM-PNI) 🏴󠁬󠁴󠀳󠀶󠁿 Flag for Prienai (LT-36) 🏴󠁬󠁴󠀵󠀱󠁿 Flag for Telšiai (LT-51) 🏴󠁬󠁴󠀲󠀱󠁿 Flag for Klaipėda (LT-21) 🏴󠁬󠁴󠀱󠀷󠁿 Flag for Kazlų Rūda (LT-17) 🏴󠁬󠁴󠀴󠀷󠁿 Flag for Širvintos (LT-47) 🏴󠁬󠁴󠀳󠀰󠁿 Flag for Pakruojis (LT-30) 🏴󠁬󠁴󠀴󠀴󠁿 Flag for Šiauliai (LT-44) 🏴󠁬󠁴󠀲󠀲󠁿 Flag for Kretinga (LT-22) 🏴󠁬󠁴󠀴󠀶󠁿 Flag for Šilutė (LT-46) 🏴󠁬󠁴󠀴󠀲󠁿 Flag for Šalčininkai (LT-42) 🏴󠁬󠁴󠀳󠀸󠁿 Flag for Raseiniai (LT-38) 🏴󠁬󠁴󠀵󠀵󠁿 Flag for Varėna (LT-55) 🏴󠁬󠁴󠀳󠀴󠁿 Flag for Pasvalys (LT-34) 🏴󠁬󠁴󠀳󠀵󠁿 Flag for Plungė (LT-35) 🏴󠁬󠁴󠀴󠀹󠁿 Flag for Švenčionys (LT-49) 🏴󠁬󠁴󠀳󠀷󠁿 Flag for Radviliškis (LT-37) 🏴󠁬󠁴󠀲󠀴󠁿 Flag for Lazdijai (LT-24) 🏴󠁬󠁴󠀵󠀰󠁿 Flag for Tauragė (LT-50) 🏴󠁬󠁴󠀴󠀸󠁿 Flag for Skuodas (LT-48) 🏴󠁬󠁴󠀵󠀳󠁿 Flag for Ukmergė (LT-53) 🏴󠁬󠁴󠀳󠀹󠁿 Flag for Rietavas (LT-39) 🏴󠁬󠁴󠀲󠀵󠁿 Flag for Marijampolė (LT-25) 🏴󠁬󠁴󠀲󠀶󠁿 Flag for Mažeikiai (LT-26) 🏴󠁬󠁶󠀰󠀱󠀳󠁿 Flag for Baldone (LV-013) 🏴󠁬󠁴󠁶󠁬󠁿 Flag for Vilnius County (LT-VL) 🏴󠁬󠁶󠀰󠀰󠀶󠁿 Flag for Alsunga (LV-006) 🏴󠁬󠁴󠀵󠀸󠁿 Flag for Vilnius (LT-58) 🏴󠁬󠁴󠁴󠁡󠁿 Flag for Tauragė County (LT-TA) 🏴󠁬󠁴󠁵󠁴󠁿 Flag for Utena County (LT-UT) 🏴󠁬󠁶󠀰󠀰󠀲󠁿 Flag for Aizkraukle (LV-002) 🏴󠁬󠁵󠁤󠁩󠁿 Flag for Diekirch (LU-DI) 🏴󠁬󠁴󠁭󠁲󠁿 Flag for Marijampolė County (LT-MR) 👩🏽‍👨🏽‍👶🏽 Family - Woman: Medium Skin Tone, Man: Medium Skin Tone, Baby: Medium Skin Tone 🏴󠁬󠁴󠁳󠁡󠁿 Flag for Šiauliai County (LT-SA) 🏴󠁬󠁵󠁥󠁣󠁿 Flag for Echternach (LU-EC) 🏴󠁬󠁵󠁲󠁤󠁿 Flag for Redange (LU-RD) 🏴󠁬󠁵󠁣󠁬󠁿 Flag for Clervaux (LU-CL) 🏴󠁬󠁴󠀵󠀹󠁿 Flag for Visaginas (LT-59) 🏴󠁬󠁶󠀰󠀰󠀹󠁿 Flag for Ape (LV-009) 🏴󠁬󠁶󠀰󠀰󠀸󠁿 Flag for Amata (LV-008) 🏴󠁬󠁴󠁡󠁬󠁿 Flag for Alytus County (LT-AL) 🏴󠁬󠁵󠁧󠁲󠁿 Flag for Grevenmacher (LU-GR) 🏴󠁬󠁶󠀰󠀰󠀱󠁿 Flag for Aglona (LV-001) 🏴󠁬󠁵󠁭󠁥󠁿 Flag for Mersch (LU-ME) 🏴󠁬󠁵󠁶󠁤󠁿 Flag for Vianden (LU-VD) 🏴󠁬󠁶󠀰󠀰󠀵󠁿 Flag for Aloja (LV-005) 🏴󠁬󠁢󠁪󠁬󠁿 Flag for Mount Lebanon (LB-JL) 🏴󠁬󠁴󠁫󠁵󠁿 Flag for Kaunas County (LT-KU) 🏴󠁬󠁴󠀶󠀰󠁿 Flag for Zarasai (LT-60) 🏴󠁬󠁵󠁷󠁩󠁿 Flag for Wiltz (LU-WI) 🏴󠁬󠁶󠀰󠀱󠀱󠁿 Flag for Ādaži (LV-011) 🏴󠁬󠁵󠁬󠁵󠁿 Flag for Luxembourg (LU-LU) 🏴󠁬󠁴󠁴󠁥󠁿 Flag for Telšiai County (LT-TE) 🏴󠁬󠁶󠀰󠀰󠀷󠁿 Flag for Alūksne (LV-007) 🏴󠁬󠁵󠁲󠁭󠁿 Flag for Remich (LU-RM) 🏴󠁬󠁶󠀰󠀰󠀴󠁿 Flag for Aknīste (LV-004) 🏴󠁬󠁵󠁥󠁳󠁿 Flag for Esch-sur-Alzette (LU-ES) 🏴󠁬󠁶󠀰󠀰󠀳󠁿 Flag for Aizpute (LV-003) 🏴󠁬󠁴󠁫󠁬󠁿 Flag for Klaipėda County (LT-KL) 🏴󠁬󠁶󠀰󠀲󠀷󠁿 Flag for Dundaga (LV-027) 🏴󠁬󠁶󠀰󠀴󠀰󠁿 Flag for Jaunpils (LV-040) 🏴󠁬󠁶󠀰󠀱󠀹󠁿 Flag for Burtnieki (LV-019) 🏴󠁬󠁶󠀰󠀱󠀵󠁿 Flag for Balvi (LV-015) 🏴󠁬󠁶󠀰󠀱󠀷󠁿 Flag for Beverīna (LV-017) 🏴󠁬󠁶󠀰󠀲󠀵󠁿 Flag for Daugavpils Municipality (LV-025) 🏴󠁬󠁶󠀰󠀲󠀱󠁿 Flag for Cesvaine (LV-021) 🏴󠁬󠁶󠀰󠀳󠀶󠁿 Flag for Ilūkste (LV-036) 🏴󠁬󠁶󠀰󠀵󠀰󠁿 Flag for Kuldīga (LV-050) 🏴󠁬󠁶󠀰󠀳󠀲󠁿 Flag for Grobiņa (LV-032) 🏴󠁬󠁶󠀰󠀳󠀳󠁿 Flag for Gulbene (LV-033) 🏴󠁬󠁶󠀰󠀴󠀳󠁿 Flag for Kandava (LV-043) 🏴󠁬󠁶󠀰󠀱󠀸󠁿 Flag for Brocēni (LV-018) 🏴󠁬󠁶󠀰󠀴󠀸󠁿 Flag for Krimulda (LV-048) 🏴󠁬󠁶󠀰󠀲󠀰󠁿 Flag for Carnikava (LV-020) 🏴󠁬󠁶󠀰󠀴󠀹󠁿 Flag for Krustpils (LV-049) 👩🏾‍👨🏾‍👶🏾 Family - Woman: Medium-Dark Skin Tone, Man: Medium-Dark Skin Tone, Baby: Medium-Dark Skin Tone 🏴󠁬󠁶󠀰󠀲󠀶󠁿 Flag for Dobele (LV-026) 🏴󠁬󠁶󠀰󠀴󠀵󠁿 Flag for Kocēni (LV-045) 🏴󠁬󠁶󠀰󠀳󠀱󠁿 Flag for Garkalne (LV-031) 🏴󠁬󠁶󠀰󠀳󠀰󠁿 Flag for Ērgļi (LV-030) 🏴󠁬󠁶󠀰󠀲󠀸󠁿 Flag for Durbe (LV-028) 🏴󠁬󠁶󠀰󠀴󠀷󠁿 Flag for Krāslava (LV-047) 🏴󠁬󠁶󠀰󠀲󠀴󠁿 Flag for Dagda (LV-024) 🏴󠁬󠁶󠀰󠀳󠀸󠁿 Flag for Jaunjelgava (LV-038) 🏴󠁬󠁶󠀰󠀱󠀶󠁿 Flag for Bauska (LV-016) 🏴󠁬󠁶󠀰󠀱󠀴󠁿 Flag for Baltinava (LV-014) 🏴󠁬󠁶󠀰󠀴󠀲󠁿 Flag for Jēkabpils Municipality (LV-042) 🏴󠁬󠁶󠀰󠀳󠀹󠁿 Flag for Jaunpiebalga (LV-039) 🏴󠁬󠁶󠀰󠀲󠀲󠁿 Flag for Cēsis (LV-022) 🏴󠁬󠁶󠀰󠀳󠀴󠁿 Flag for Iecava (LV-034) 🏴󠁬󠁶󠀰󠀵󠀱󠁿 Flag for Ķegums (LV-051) 🏴󠁬󠁶󠀰󠀳󠀵󠁿 Flag for Ikšķile (LV-035) 🏴󠁬󠁶󠀰󠀲󠀳󠁿 Flag for Cibla (LV-023) 🏴󠁬󠁶󠀰󠀴󠀴󠁿 Flag for Kārsava (LV-044) 🏴󠁬󠁶󠀰󠀲󠀹󠁿 Flag for Engure (LV-029) 🏴󠁬󠁶󠀰󠀵󠀵󠁿 Flag for Līgatne (LV-055) 🏴󠁬󠁶󠀰󠀶󠀶󠁿 Flag for Nīca (LV-066) 🏴󠁬󠁶󠀰󠀶󠀱󠁿 Flag for Mālpils (LV-061) 🏴󠁧󠁥󠁫󠁫󠁿 Flag for Kvemo Kartli (GE-KK) 🏴󠁬󠁶󠀰󠀷󠀰󠁿 Flag for Pārgauja (LV-070) 🏴󠁬󠁶󠀰󠀵󠀳󠁿 Flag for Lielvārde (LV-053) 🏴󠁬󠁶󠀰󠀷󠀲󠁿 Flag for Pļaviņas (LV-072) 🏴󠁬󠁶󠀰󠀷󠀱󠁿 Flag for Pāvilosta (LV-071) 🏴󠁬󠁶󠀰󠀵󠀹󠁿 Flag for Madona (LV-059) 🏴󠁬󠁶󠀰󠀷󠀶󠁿 Flag for Rauna (LV-076) 🏴󠁬󠁶󠀰󠀵󠀴󠁿 Flag for Limbaži (LV-054) 🏴󠁬󠁶󠀰󠀶󠀴󠁿 Flag for Naukšēni (LV-064) 🏴󠁬󠁶󠀰󠀵󠀲󠁿 Flag for Ķekava (LV-052) 🏴󠁬󠁶󠀰󠀸󠀷󠁿 Flag for Salaspils (LV-087) 🏴󠁬󠁶󠀰󠀶󠀳󠁿 Flag for Mērsrags (LV-063) 🏴󠁬󠁶󠀰󠀶󠀸󠁿 Flag for Olaine (LV-068) 🏴󠁬󠁶󠀰󠀷󠀹󠁿 Flag for Roja (LV-079) 🏴󠁬󠁶󠀰󠀸󠀱󠁿 Flag for Rucava (LV-081) 🏴󠁬󠁶󠀰󠀸󠀲󠁿 Flag for Rugāji (LV-082) 🏴󠁬󠁶󠀰󠀶󠀷󠁿 Flag for Ogre (LV-067) 🏴󠁬󠁶󠀰󠀸󠀴󠁿 Flag for Rūjiena (LV-084) 🏴󠁬󠁶󠀰󠀸󠀹󠁿 Flag for Saulkrasti (LV-089) 🏴󠁬󠁶󠀰󠀸󠀸󠁿 Flag for Saldus (LV-088) 🏴󠁬󠁶󠀰󠀸󠀳󠁿 Flag for Rundāle (LV-083) 🏴󠁬󠁶󠀰󠀶󠀵󠁿 Flag for Nereta (LV-065) 🏴󠁬󠁶󠀰󠀶󠀹󠁿 Flag for Ozolnieki (LV-069) 🏴󠁬󠁶󠀰󠀸󠀰󠁿 Flag for Ropaži (LV-080) 🏴󠁬󠁶󠀰󠀷󠀸󠁿 Flag for Riebiņi (LV-078) 🏴󠁬󠁶󠀰󠀵󠀶󠁿 Flag for Līvāni (LV-056) 🏴󠁬󠁶󠀰󠀷󠀵󠁿 Flag for Priekuļi (LV-075) 🏴󠁬󠁶󠀰󠀵󠀸󠁿 Flag for Ludza (LV-058) 🏴󠁬󠁶󠀰󠀹󠀰󠁿 Flag for Sēja (LV-090) 🏴󠁬󠁶󠀰󠀷󠀴󠁿 Flag for Priekule (LV-074) 🏴󠁬󠁶󠀰󠀵󠀷󠁿 Flag for Lubāna (LV-057) 🏴󠁬󠁶󠀰󠀸󠀶󠁿 Flag for Salacgrīva (LV-086) 🏴󠁬󠁶󠀰󠀶󠀲󠁿 Flag for Mārupe (LV-062) 🏴󠁬󠁶󠀰󠀷󠀳󠁿 Flag for Preiļi (LV-073) 🏴󠁬󠁶󠀱󠀰󠀷󠁿 Flag for Viesīte (LV-107) 🏴󠁬󠁶󠀰󠀹󠀴󠁿 Flag for Smiltene (LV-094) 🏴󠁬󠁹󠁫󠁦󠁿 Flag for Kufra (LY-KF) 🏴󠁬󠁶󠁤󠁧󠁶󠁿 Flag for Daugavpils (LV-DGV) 🏴󠁬󠁶󠀰󠀹󠀹󠁿 Flag for Tukums (LV-099) 👩🏿‍👨🏿‍👶🏿 Family - Woman: Dark Skin Tone, Man: Dark Skin Tone, Baby: Dark Skin Tone 🏴󠁬󠁶󠁬󠁰󠁸󠁿 Flag for Liepāja (LV-LPX) 🏴󠁬󠁶󠀱󠀰󠀱󠁿 Flag for Valka (LV-101) 🏴󠁬󠁶󠀱󠀰󠀳󠁿 Flag for Vārkava (LV-103) 🏴󠁬󠁹󠁭󠁢󠁿 Flag for Murqub (LY-MB) 🏴󠁬󠁶󠁶󠁥󠁮󠁿 Flag for Ventspils (LV-VEN) 🏴󠁬󠁹󠁪󠁡󠁿 Flag for Jabal al Akhdar (LY-JA) 🏴󠁬󠁶󠁪󠁫󠁢󠁿 Flag for Jēkabpils (LV-JKB) 🏴󠁬󠁶󠀰󠀹󠀱󠁿 Flag for Sigulda (LV-091) 🏴󠁬󠁹󠁪󠁧󠁿 Flag for Jabal al Gharbi (LY-JG) 🏴󠁬󠁹󠁧󠁴󠁿 Flag for Ghat (LY-GT) 🏴󠁬󠁶󠀰󠀹󠀵󠁿 Flag for Stopiņi (LV-095) 🏴󠁬󠁶󠁲󠁩󠁸󠁿 Flag for Riga (LV-RIX) 🏴󠁬󠁹󠁤󠁲󠁿 Flag for Derna (LY-DR) 🏴󠁬󠁶󠀱󠀰󠀰󠁿 Flag for Vaiņode (LV-100) 🏴󠁬󠁶󠀱󠀰󠀲󠁿 Flag for Varakļāni (LV-102) 🏴󠁬󠁶󠁪󠁥󠁬󠁿 Flag for Jelgava (LV-JEL) 🏴󠁬󠁶󠀰󠀹󠀲󠁿 Flag for Skrīveri (LV-092) 🏴󠁬󠁶󠀰󠀹󠀷󠁿 Flag for Talsi (LV-097) 🏴󠁬󠁶󠁶󠁭󠁲󠁿 Flag for Valmiera (LV-VMR) 🏴󠁬󠁹󠁢󠁡󠁿 Flag for Benghazi (LY-BA) 🏴󠁬󠁶󠁲󠁥󠁺󠁿 Flag for Rēzekne (LV-REZ) 🏴󠁬󠁶󠀰󠀹󠀳󠁿 Flag for Skrunda (LV-093) 🏴󠁬󠁶󠀱󠀱󠀰󠁿 Flag for Zilupe (LV-110) 🏴󠁬󠁶󠀰󠀹󠀶󠁿 Flag for Strenči (LV-096) 🏴󠁬󠁹󠁪󠁵󠁿 Flag for Jufra (LY-JU) 🏴󠁬󠁶󠀱󠀰󠀴󠁿 Flag for Vecpiebalga (LV-104) 🏴󠁬󠁶󠀱󠀰󠀵󠁿 Flag for Vecumnieki (LV-105) 🏴󠁬󠁶󠀱󠀰󠀸󠁿 Flag for Viļaka (LV-108) 🏴󠁬󠁶󠁪󠁵󠁲󠁿 Flag for Jūrmala (LV-JUR) 🏴󠁬󠁶󠀱󠀰󠀹󠁿 Flag for Viļāni (LV-109) 🏴󠁬󠁶󠀰󠀹󠀸󠁿 Flag for Tērvete (LV-098) 🏴󠁭󠁡󠀰󠀸󠁿 Flag for Grand Casablanca (MA-08) 🏴󠁬󠁹󠁭󠁪󠁿 Flag for Marj (LY-MJ) 🏴󠁬󠁹󠁷󠁡󠁿 Flag for Al Wahat (LY-WA) 🏴󠁭󠁣󠁭󠁣󠁿 Flag for Monte Carlo (MC-MC) 🏴󠁭󠁡󠀱󠀴󠁿 Flag for Guelmim-Es Semara (MA-14) 🏴󠁬󠁹󠁺󠁡󠁿 Flag for Zawiya (LY-ZA) 🏴󠁭󠁡󠀰󠀲󠁿 Flag for Gharb-Chrarda-Béni Hssen (MA-02) 🏴󠁭󠁡󠀱󠀱󠁿 Flag for Marrakesh-Tensift-El Haouz (MA-11) 🏴󠁭󠁡󠀱󠀰󠁿 Flag for Doukkala-Abda (MA-10) 👩🏽‍👩🏽‍👦🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Boy: Medium Skin Tone 🏴󠁭󠁡󠀰󠀷󠁿 Flag for Rabat-Salé-Zemmour-Zaer (MA-07) 🏴󠁭󠁡󠀱󠀶󠁿 Flag for Oued Ed-Dahab-Lagouira (MA-16) 🏴󠁬󠁹󠁮󠁬󠁿 Flag for Nalut (LY-NL) 🏴󠁬󠁹󠁳󠁢󠁿 Flag for Sabha (LY-SB) 🏴󠁭󠁡󠀰󠀳󠁿 Flag for Taza-Al Hoceima-Taounate (MA-03) 🏴󠁭󠁣󠁪󠁥󠁿 Flag for Jardin Exotique de Monaco (MC-JE) 🏴󠁬󠁹󠁷󠁳󠁿 Flag for Wadi al Shatii (LY-WS) 🏴󠁭󠁣󠁬󠁡󠁿 Flag for Larvotto (MC-LA) 🏴󠁬󠁹󠁮󠁱󠁿 Flag for Nuqat al Khams (LY-NQ) 🏴󠁭󠁣󠁭󠁡󠁿 Flag for Malbousquet (MC-MA) 🏴󠁭󠁡󠀱󠀲󠁿 Flag for Tadla-Azilal (MA-12) 🏴󠁭󠁣󠁣󠁯󠁿 Flag for La Condamine (MC-CO) 🏴󠁭󠁣󠁭󠁯󠁿 Flag for Monaco-Ville (MC-MO) 🏴󠁭󠁡󠀰󠀹󠁿 Flag for Chaouia-Ouardigha (MA-09) 🏴󠁭󠁡󠀰󠀱󠁿 Flag for Tangier-Tétouan (MA-01) 🏴󠁭󠁣󠁭󠁧󠁿 Flag for Moneghetti (MC-MG) 🏴󠁬󠁹󠁭󠁱󠁿 Flag for Murzuq (LY-MQ) 🏴󠁭󠁡󠀰󠀶󠁿 Flag for Meknès-Tafilalet (MA-06) 🏴󠁭󠁣󠁦󠁯󠁿 Flag for Fontvieille (MC-FO) 🏴󠁬󠁹󠁷󠁤󠁿 Flag for Wadi al Hayaa (LY-WD) 🏴󠁭󠁣󠁣󠁬󠁿 Flag for La Colle (MC-CL) 🏴󠁬󠁹󠁳󠁲󠁿 Flag for Sirte (LY-SR) 🏴󠁬󠁹󠁭󠁩󠁿 Flag for Misrata (LY-MI) 🏴󠁭󠁡󠀰󠀵󠁿 Flag for Fès-Boulemane (MA-05) 🏴󠁬󠁹󠁴󠁢󠁿 Flag for Tripoli (LY-TB) 🏴󠁭󠁣󠁧󠁡󠁿 Flag for La Gare (MC-GA) 👩🏾‍👩🏾‍👦🏾 Family - Woman: Medium-Dark Skin Tone, Woman: Medium-Dark Skin Tone, Boy: Medium-Dark Skin Tone 🏴󠁭󠁤󠁥󠁤󠁿 Flag for Edineț (MD-ED) 🏴󠁭󠁤󠁨󠁩󠁿 Flag for Hîncești (MD-HI) 🏴󠁭󠁤󠁦󠁡󠁿 Flag for Fălești (MD-FA) 🏴󠁭󠁤󠁣󠁲󠁿 Flag for Criuleni (MD-CR) 🏴󠁭󠁤󠁳󠁩󠁿 Flag for Sîngerei (MD-SI) 🏴󠁭󠁤󠁳󠁯󠁿 Flag for Soroca (MD-SO) 🏴󠁭󠁤󠁣󠁴󠁿 Flag for Cantemir (MD-CT) 🏴󠁭󠁤󠁲󠁥󠁿 Flag for Rezina (MD-RE) 🏴󠁭󠁤󠁳󠁤󠁿 Flag for Șoldănești (MD-SD) 🏴󠁭󠁤󠁢󠁲󠁿 Flag for Briceni (MD-BR) 🏴󠁭󠁣󠁶󠁲󠁿 Flag for Vallon de la Rousse (MC-VR) 🏴󠁭󠁤󠁢󠁡󠁿 Flag for Bălţi (MD-BA) 🏴󠁭󠁤󠁤󠁵󠁿 Flag for Dubăsari (MD-DU) 🏴󠁭󠁤󠁣󠁬󠁿 Flag for Călărași (MD-CL) 🏴󠁭󠁣󠁳󠁰󠁿 Flag for Spélugues (MC-SP) 🏴󠁭󠁤󠁣󠁡󠁿 Flag for Cahul (MD-CA) 🏴󠁭󠁤󠁩󠁡󠁿 Flag for Ialoveni (MD-IA) 🏴󠁭󠁤󠁯󠁲󠁿 Flag for Orhei (MD-OR) 🏴󠁭󠁤󠁤󠁲󠁿 Flag for Drochia (MD-DR) 🏴󠁭󠁤󠁧󠁡󠁿 Flag for Gagauzia (MD-GA) 🏴󠁭󠁤󠁣󠁭󠁿 Flag for Cimișlia (MD-CM) 🏴󠁭󠁤󠁯󠁣󠁿 Flag for Ocniţa (MD-OC) 🏴󠁭󠁤󠁢󠁳󠁿 Flag for Basarabeasca (MD-BS) 🏴󠁭󠁤󠁳󠁴󠁿 Flag for Strășeni (MD-ST) 🏴󠁭󠁤󠁡󠁮󠁿 Flag for Anenii Noi (MD-AN) 🏴󠁭󠁣󠁭󠁵󠁿 Flag for Moulins (MC-MU) 🏴󠁭󠁤󠁢󠁤󠁿 Flag for Bender (MD-BD) 🏴󠁭󠁤󠁧󠁬󠁿 Flag for Glodeni (MD-GL) 🏴󠁭󠁣󠁳󠁯󠁿 Flag for La Source (MC-SO) 🏴󠁭󠁤󠁣󠁵󠁿 Flag for Chișinău (MD-CU) 🏴󠁭󠁤󠁤󠁯󠁿 Flag for Dondușeni (MD-DO) 🏴󠁭󠁤󠁦󠁬󠁿 Flag for Florești (MD-FL) 🏴󠁭󠁣󠁰󠁨󠁿 Flag for Port Hercules (MC-PH) 🏴󠁭󠁤󠁮󠁩󠁿 Flag for Nisporeni (MD-NI) 🏴󠁭󠁤󠁲󠁩󠁿 Flag for Rîșcani (MD-RI) 🏴󠁭󠁤󠁬󠁥󠁿 Flag for Leova (MD-LE) 🏴󠁭󠁤󠁳󠁶󠁿 Flag for Ştefan Vodă (MD-SV) 🏴󠁭󠁤󠁵󠁮󠁿 Flag for Ungheni (MD-UN) 🏴󠁭󠁧󠁡󠁿 Flag for Toamasina (MG-A) 🏴󠁭󠁧󠁴󠁿 Flag for Antananarivo (MG-T) 🏴󠁭󠁥󠀰󠀶󠁿 Flag for Cetinje (ME-06) 🏴󠁭󠁫󠀰󠀵󠁿 Flag for Bogdanci (MK-05) 🏴󠁭󠁥󠀲󠀰󠁿 Flag for Ulcinj (ME-20) 🏴󠁭󠁥󠀰󠀹󠁿 Flag for Kolašin (ME-09) 🏴󠁭󠁫󠀰󠀷󠁿 Flag for Bosilovo (MK-07) 🏴󠁭󠁥󠀱󠀴󠁿 Flag for Pljevlja (ME-14) 🏴󠁭󠁤󠁴󠁥󠁿 Flag for Telenești (MD-TE) 🏴󠁭󠁫󠀰󠀶󠁿 Flag for Bogovinje (MK-06) 🏴󠁭󠁥󠀲󠀱󠁿 Flag for Žabljak (ME-21) 🏴󠁭󠁥󠀰󠀸󠁿 Flag for Herceg Novi (ME-08) 🏴󠁭󠁥󠀲󠀳󠁿 Flag for Petnjica (ME-23) 🏴󠁭󠁥󠀱󠀷󠁿 Flag for Rožaje (ME-17) 🏴󠁭󠁥󠀰󠀵󠁿 Flag for Budva (ME-05) 🏴󠁭󠁥󠀰󠀲󠁿 Flag for Bar (ME-02) 🏴󠁭󠁫󠀰󠀳󠁿 Flag for Berovo (MK-03) 🏴󠁭󠁥󠀱󠀹󠁿 Flag for Tivat (ME-19) 🏴󠁭󠁥󠀱󠀵󠁿 Flag for Plužine (ME-15) 🏴󠁭󠁥󠀱󠀰󠁿 Flag for Kotor (ME-10) 🏴󠁭󠁨󠁬󠁿 Flag for Ralik Chain (MH-L) 🏴󠁭󠁥󠀰󠀷󠁿 Flag for Danilovgrad (ME-07) 🏴󠁭󠁥󠀱󠀳󠁿 Flag for Plav (ME-13) 🏴󠁭󠁫󠀰󠀴󠁿 Flag for Bitola (MK-04) 🏴󠁭󠁥󠀰󠀴󠁿 Flag for Bijelo Polje (ME-04) 🏴󠁭󠁥󠀰󠀱󠁿 Flag for Andrijevica (ME-01) 👩🏿‍👩🏿‍👦🏿 Family - Woman: Dark Skin Tone, Woman: Dark Skin Tone, Boy: Dark Skin Tone 🏴󠁭󠁥󠀱󠀲󠁿 Flag for Nikšić (ME-12) 🏴󠁭󠁤󠁴󠁡󠁿 Flag for Taraclia (MD-TA) 🏴󠁭󠁥󠀱󠀱󠁿 Flag for Mojkovac (ME-11) 🏴󠁭󠁧󠁭󠁿 Flag for Mahajanga (MG-M) 🏴󠁭󠁥󠀲󠀲󠁿 Flag for Gusinje (ME-22) 🏴󠁭󠁧󠁦󠁿 Flag for Fianarantsoa (MG-F) 🏴󠁭󠁥󠀱󠀸󠁿 Flag for Šavnik (ME-18) 🏴󠁭󠁥󠀱󠀶󠁿 Flag for Podgorica (ME-16) 🏴󠁭󠁧󠁵󠁿 Flag for Toliara (MG-U) 🏴󠁭󠁧󠁤󠁿 Flag for Antsiranana (MG-D) 🏴󠁭󠁫󠀴󠀳󠁿 Flag for Kratovo (MK-43) 🏴󠁭󠁫󠀴󠀴󠁿 Flag for Kriva Palanka (MK-44) 🏴󠁭󠁫󠀵󠀲󠁿 Flag for Makedonski Brod (MK-52) 🏴󠁭󠁫󠀳󠀵󠁿 Flag for Jegunovce (MK-35) 🏴󠁭󠁫󠀴󠀹󠁿 Flag for Lozovo (MK-49) 🏴󠁭󠁫󠀴󠀷󠁿 Flag for Kumanovo (MK-47) 🏴󠁭󠁫󠀱󠀲󠁿 Flag for Vevčani (MK-12) 🏴󠁭󠁫󠀲󠀴󠁿 Flag for Demir Kapija (MK-24) 🏴󠁭󠁫󠀱󠀱󠁿 Flag for Vasilevo (MK-11) 🏴󠁭󠁫󠀳󠀰󠁿 Flag for Želino (MK-30) 🏴󠁭󠁫󠀳󠀶󠁿 Flag for Kavadarci (MK-36) 🏴󠁭󠁫󠀳󠀲󠁿 Flag for Zelenikovo (MK-32) 🏴󠁭󠁫󠀴󠀱󠁿 Flag for Konče (MK-41) 🏴󠁭󠁫󠀱󠀴󠁿 Flag for Vinica (MK-14) 🏴󠁭󠁫󠀱󠀰󠁿 Flag for Valandovo (MK-10) 🏴󠁭󠁫󠀵󠀵󠁿 Flag for Novaci (MK-55) 🏴󠁭󠁫󠀵󠀶󠁿 Flag for Novo Selo (MK-56) 🏴󠁭󠁫󠀳󠀴󠁿 Flag for Ilinden (MK-34) 🏴󠁭󠁫󠀵󠀱󠁿 Flag for Makedonska Kamenica (MK-51) 🏴󠁭󠁫󠀱󠀶󠁿 Flag for Vrapčište (MK-16) 🏴󠁭󠁫󠀰󠀸󠁿 Flag for Brvenica (MK-08) 🏴󠁭󠁫󠀲󠀰󠁿 Flag for Gradsko (MK-20) 🏴󠁭󠁫󠀵󠀰󠁿 Flag for Mavrovo and Rostuša (MK-50) 🏴󠁭󠁫󠀲󠀲󠁿 Flag for Debarca (MK-22) 🏴󠁭󠁫󠀱󠀹󠁿 Flag for Gostivar (MK-19) 🏴󠁭󠁫󠀵󠀳󠁿 Flag for Mogila (MK-53) 🏴󠁭󠁫󠀴󠀸󠁿 Flag for Lipkovo (MK-48) 🏴󠁭󠁫󠀳󠀷󠁿 Flag for Karbinci (MK-37) 🏴󠁭󠁫󠀳󠀳󠁿 Flag for Zrnovci (MK-33) 🏴󠁭󠁫󠀵󠀴󠁿 Flag for Negotino (MK-54) 🏴󠁭󠁫󠀴󠀰󠁿 Flag for Kičevo (MK-40) 🏴󠁭󠁫󠀲󠀱󠁿 Flag for Debar (MK-21) 🏴󠁭󠁫󠀱󠀳󠁿 Flag for Veles (MK-13) 🏴󠁭󠁫󠀲󠀶󠁿 Flag for Dojran (MK-26) 🏴󠁭󠁫󠀱󠀸󠁿 Flag for Gevgelija (MK-18) 🏴󠁭󠁫󠀴󠀲󠁿 Flag for Kočani (MK-42) 🏴󠁭󠁫󠀴󠀵󠁿 Flag for Krivogaštani (MK-45) 🏴󠁭󠁫󠀲󠀳󠁿 Flag for Delčevo (MK-23) 🏴󠁭󠁫󠀴󠀶󠁿 Flag for Kruševo (MK-46) 🏴󠁭󠁫󠀸󠀲󠁿 Flag for Čučer-Sandevo (MK-82) 🏴󠁭󠁫󠀶󠀲󠁿 Flag for Prilep (MK-62) 🏴󠁭󠁫󠀷󠀸󠁿 Flag for Centar Župa (MK-78) 🏴󠁭󠁭󠀰󠀴󠁿 Flag for Mandalay (MM-04) 🏴󠁭󠁬󠀴󠁿 Flag for Ségou (ML-4) 🏴󠁭󠁫󠀵󠀹󠁿 Flag for Petrovec (MK-59) 🏴󠁭󠁫󠀸󠀱󠁿 Flag for Češinovo-Obleševo (MK-81) 🏴󠁭󠁬󠀸󠁿 Flag for Kidal (ML-8) 🏴󠁭󠁭󠀰󠀲󠁿 Flag for Bago (MM-02) 🏴󠁭󠁫󠀷󠀲󠁿 Flag for Struga (MK-72) 🏴󠁭󠁫󠀷󠀵󠁿 Flag for Tearce (MK-75) 🏴󠁭󠁫󠀷󠀴󠁿 Flag for Studeničani (MK-74) 🏴󠁭󠁫󠀵󠀸󠁿 Flag for Ohrid (MK-58) 🏴󠁭󠁫󠀶󠀹󠁿 Flag for Sveti Nikole (MK-69) 🏴󠁭󠁫󠀷󠀳󠁿 Flag for Strumica (MK-73) 🏴󠁭󠁬󠀳󠁿 Flag for Sikasso (ML-3) 🏴󠁭󠁭󠀱󠀱󠁿 Flag for Kachin (MM-11) 🏴󠁭󠁫󠀶󠀶󠁿 Flag for Resen (MK-66) 🏴󠁭󠁬󠁢󠁫󠁯󠁿 Flag for Bamako (ML-BKO) 🏴󠁭󠁭󠀰󠀳󠁿 Flag for Magway (MM-03) 🏴󠁭󠁫󠀷󠀰󠁿 Flag for Sopište (MK-70) 🏴󠁭󠁫󠀷󠀱󠁿 Flag for Staro Nagoričane (MK-71) 🏴󠁭󠁭󠀰󠀷󠁿 Flag for Ayeyarwady (MM-07) 🏴󠁭󠁬󠀷󠁿 Flag for Gao (ML-7) 🏴󠁭󠁬󠀵󠁿 Flag for Mopti (ML-5) 🏴󠁭󠁫󠀸󠀳󠁿 Flag for Štip (MK-83) 🏴󠁭󠁭󠀱󠀲󠁿 Flag for Kayah (MM-12) 🏴󠁭󠁭󠀰󠀵󠁿 Flag for Tanintharyi (MM-05) 🏴󠁭󠁬󠀲󠁿 Flag for Koulikoro (ML-2) 🏴󠁭󠁫󠀶󠀳󠁿 Flag for Probištip (MK-63) 🏴󠁭󠁫󠀶󠀰󠁿 Flag for Pehčevo (MK-60) 🏴󠁭󠁭󠀰󠀱󠁿 Flag for Sagaing (MM-01) 🏴󠁭󠁫󠀸󠀰󠁿 Flag for Čaška (MK-80) 🏴󠁭󠁫󠀶󠀵󠁿 Flag for Rankovce (MK-65) 🏴󠁭󠁭󠀰󠀶󠁿 Flag for Yangon (MM-06) 🏴󠁭󠁫󠀷󠀶󠁿 Flag for Tetovo (MK-76) 🏴󠁭󠁫󠀶󠀷󠁿 Flag for Rosoman (MK-67) 🏴󠁭󠁲󠀰󠀳󠁿 Flag for Assaba (MR-03) 🏴󠁭󠁭󠀱󠀷󠁿 Flag for Shan (MM-17) 🏴󠁭󠁭󠀱󠀶󠁿 Flag for Rakhine (MM-16) 🏴󠁭󠁮󠀰󠀴󠀱󠁿 Flag for Khövsgöl (MN-041) 🏴󠁭󠁮󠀰󠀷󠀱󠁿 Flag for Bayan-Ölgii (MN-071) 🏴󠁭󠁮󠀰󠀶󠀹󠁿 Flag for Bayankhongor (MN-069) 🏴󠁭󠁮󠀰󠀶󠀱󠁿 Flag for Dornod (MN-061) 🏴󠁭󠁮󠀰󠀴󠀹󠁿 Flag for Selenge (MN-049) 🏴󠁭󠁮󠀱󠁿 Flag for Ulaanbaatar (MN-1) 🏴󠁭󠁮󠀰󠀳󠀷󠁿 Flag for Darkhan-Uul (MN-037) 🏴󠁭󠁮󠀰󠀴󠀷󠁿 Flag for Töv (MN-047) 🏴󠁭󠁭󠀱󠀵󠁿 Flag for Mon (MM-15) 🏴󠁭󠁲󠀰󠀶󠁿 Flag for Trarza (MR-06) 🏴󠁭󠁮󠀰󠀵󠀱󠁿 Flag for Sükhbaatar (MN-051) 🏴󠁭󠁲󠀰󠀴󠁿 Flag for Gorgol (MR-04) 🏴󠁭󠁮󠀰󠀵󠀵󠁿 Flag for Övörkhangai (MN-055) 🏴󠁭󠁭󠀱󠀴󠁿 Flag for Chin (MM-14) 🏴󠁭󠁮󠀰󠀶󠀷󠁿 Flag for Bulgan (MN-067) 🏴󠁭󠁮󠀰󠀵󠀷󠁿 Flag for Zavkhan (MN-057) 🏴󠁭󠁮󠀰󠀶󠀳󠁿 Flag for Dornogovi (MN-063) 🏴󠁭󠁮󠀰󠀵󠀳󠁿 Flag for Ömnögovi (MN-053) 🏴󠁭󠁭󠀱󠀳󠁿 Flag for Kayin (MM-13) 🏴󠁭󠁮󠀰󠀶󠀵󠁿 Flag for Govi-Altai (MN-065) 🏴󠁭󠁲󠀱󠀱󠁿 Flag for Tiris Zemmour (MR-11) 🏴󠁭󠁮󠀰󠀵󠀹󠁿 Flag for Dundgovi (MN-059) 🏴󠁭󠁮󠀰󠀷󠀳󠁿 Flag for Arkhangai (MN-073) 🏴󠁭󠁲󠀰󠀹󠁿 Flag for Tagant (MR-09) 🏴󠁭󠁮󠀰󠀴󠀳󠁿 Flag for Khovd (MN-043) 🏴󠁭󠁮󠀰󠀴󠀶󠁿 Flag for Uvs (MN-046) 🏴󠁭󠁮󠀰󠀶󠀴󠁿 Flag for Govisümber (MN-064) 🏴󠁭󠁲󠀰󠀵󠁿 Flag for Brakna (MR-05) 🏴󠁭󠁲󠀰󠀸󠁿 Flag for Dakhlet Nouadhibou (MR-08) 🏴󠁭󠁲󠀰󠀱󠁿 Flag for Hodh Ech Chargui (MR-01) 🏴󠁭󠁮󠀰󠀳󠀵󠁿 Flag for Orkhon (MN-035) 🏴󠁭󠁲󠀰󠀲󠁿 Flag for Hodh El Gharbi (MR-02) 🏴󠁭󠁭󠀱󠀸󠁿 Flag for Naypyidaw (MM-18) 🏴󠁭󠁲󠀰󠀷󠁿 Flag for Adrar (MR-07) 🏴󠁭󠁲󠀱󠀲󠁿 Flag for Inchiri (MR-12) 🏴󠁭󠁴󠀱󠀹󠁿 Flag for Iklin (MT-19) 🏴󠁭󠁴󠀱󠀴󠁿 Flag for Għarb (MT-14) 🏴󠁭󠁴󠀳󠀳󠁿 Flag for Mqabba (MT-33) 🏴󠁭󠁴󠀲󠀲󠁿 Flag for Kerċem (MT-22) 🏴󠁭󠁴󠀱󠀶󠁿 Flag for Għasri (MT-16) 🏴󠁭󠁴󠀲󠀴󠁿 Flag for Lija (MT-24) 🏴󠁭󠁴󠀰󠀵󠁿 Flag for Birżebbuġa (MT-05) 🏴󠁭󠁴󠀰󠀴󠁿 Flag for Birkirkara (MT-04) 🏴󠁭󠁴󠀳󠀱󠁿 Flag for Mġarr (MT-31) 🏴󠁭󠁴󠀰󠀲󠁿 Flag for Balzan (MT-02) 🏴󠁭󠁴󠀳󠀶󠁿 Flag for Munxar (MT-36) 🏴󠁭󠁴󠀱󠀳󠁿 Flag for Għajnsielem (MT-13) 🏴󠁭󠁴󠀳󠀸󠁿 Flag for Naxxar (MT-38) 🏴󠁭󠁴󠀰󠀹󠁿 Flag for Floriana (MT-09) 🏴󠁭󠁴󠀲󠀶󠁿 Flag for Marsa (MT-26) 🏴󠁭󠁴󠀰󠀷󠁿 Flag for Dingli (MT-07) 🏴󠁭󠁴󠀱󠀱󠁿 Flag for Gudja (MT-11) 🏴󠁭󠁴󠀲󠀳󠁿 Flag for Kirkop (MT-23) 🏴󠁭󠁴󠀲󠀷󠁿 Flag for Marsaskala (MT-27) 🏴󠁭󠁴󠀳󠀹󠁿 Flag for Paola (MT-39) 🏴󠁭󠁴󠀱󠀰󠁿 Flag for Fontana (MT-10) 🏴󠁭󠁴󠀳󠀴󠁿 Flag for Msida (MT-34) 🏴󠁭󠁴󠀳󠀷󠁿 Flag for Nadur (MT-37) 🏴󠁭󠁴󠀳󠀲󠁿 Flag for Mosta (MT-32) 🏴󠁭󠁴󠀳󠀵󠁿 Flag for Imtarfa (MT-35) 🏴󠁭󠁴󠀰󠀶󠁿 Flag for Cospicua (MT-06) 🏴󠁭󠁴󠀰󠀳󠁿 Flag for Birgu (MT-03) 🏴󠁭󠁲󠀱󠀴󠁿 Flag for Nouakchott Nord (MR-14) 🏴󠁭󠁴󠀱󠀲󠁿 Flag for Gżira (MT-12) 🏴󠁭󠁴󠀳󠀰󠁿 Flag for Mellieħa (MT-30) 🏴󠁭󠁴󠀱󠀷󠁿 Flag for Għaxaq (MT-17) 🏴󠁭󠁴󠀱󠀸󠁿 Flag for Ħamrun (MT-18) 🏴󠁭󠁴󠀰󠀸󠁿 Flag for Fgura (MT-08) 🏴󠁭󠁴󠀰󠀱󠁿 Flag for Attard (MT-01) 🏴󠁭󠁴󠀱󠀵󠁿 Flag for Għargħur (MT-15) 🏴󠁭󠁴󠀲󠀱󠁿 Flag for Kalkara (MT-21) 🏴󠁭󠁲󠀱󠀵󠁿 Flag for Nouakchott Sud (MR-15) 🏴󠁭󠁴󠀲󠀸󠁿 Flag for Marsaxlokk (MT-28) 🏴󠁭󠁴󠀴󠀵󠁿 Flag for Victoria (MT-45) 🏴󠁭󠁴󠀴󠀲󠁿 Flag for Qala (MT-42) 🏴󠁭󠁴󠀶󠀴󠁿 Flag for Żabbar (MT-64) 🏴󠁭󠁵󠁡󠁧󠁿 Flag for Agaléga (MU-AG) 🏴󠁭󠁴󠀵󠀸󠁿 Flag for Ta’ Xbiex (MT-58) 🏴󠁭󠁴󠀴󠀱󠁿 Flag for Pietà (MT-41) 🏴󠁭󠁴󠀵󠀲󠁿 Flag for Sannat (MT-52) 🏴󠁭󠁵󠁰󠁬󠁿 Flag for Port Louis District (MU-PL) 🏴󠁭󠁴󠀶󠀱󠁿 Flag for Xagħra (MT-61) 🏴󠁭󠁵󠁢󠁬󠁿 Flag for Rivière Noire (MU-BL) 🏴󠁭󠁴󠀵󠀶󠁿 Flag for Sliema (MT-56) 🏴󠁭󠁴󠀴󠀷󠁿 Flag for Safi (MT-47) 🏴󠁭󠁵󠁦󠁬󠁿 Flag for Flacq (MU-FL) 🏴󠁭󠁴󠀴󠀰󠁿 Flag for Pembroke (MT-40) 🏴󠁭󠁴󠀵󠀷󠁿 Flag for Swieqi (MT-57) 🏴󠁭󠁵󠁣󠁵󠁿 Flag for Curepipe (MU-CU) 🏴󠁭󠁴󠀶󠀸󠁿 Flag for Żurrieq (MT-68) 🏴󠁭󠁴󠀴󠀹󠁿 Flag for San Ġwann (MT-49) 🏴󠁭󠁵󠁧󠁰󠁿 Flag for Grand Port (MU-GP) 🏴󠁭󠁵󠁣󠁣󠁿 Flag for Cargados Carajos (MU-CC) 🏴󠁭󠁴󠀴󠀴󠁿 Flag for Qrendi (MT-44) 🏴󠁭󠁴󠀶󠀰󠁿 Flag for Valletta (MT-60) 🏴󠁭󠁵󠁰󠁡󠁿 Flag for Pamplemousses (MU-PA) 🏴󠁭󠁴󠀴󠀳󠁿 Flag for Qormi (MT-43) 🏴󠁭󠁵󠁰󠁵󠁿 Flag for Port Louis (MU-PU) 🏴󠁭󠁴󠀵󠀹󠁿 Flag for Tarxien (MT-59) 🏴󠁭󠁴󠀶󠀵󠁿 Flag for Żebbuġ Gozo (MT-65) 🏴󠁭󠁴󠀵󠀰󠁿 Flag for Saint Lawrence (MT-50) 🏴󠁭󠁴󠀶󠀷󠁿 Flag for Żejtun (MT-67) 🏴󠁭󠁴󠀵󠀱󠁿 Flag for St. Paul’s Bay (MT-51) 🏴󠁭󠁴󠀵󠀳󠁿 Flag for Santa Luċija (MT-53) 🏴󠁭󠁴󠀶󠀶󠁿 Flag for Żebbuġ (MT-66) 🏴󠁭󠁴󠀴󠀶󠁿 Flag for Rabat (MT-46) 🏴󠁭󠁴󠀵󠀵󠁿 Flag for Siġġiewi (MT-55) 👩🏽‍👩🏽‍👧🏽 Family - Woman: Medium Skin Tone, Woman: Medium Skin Tone, Girl: Medium Skin Tone 🏴󠁭󠁴󠀵󠀴󠁿 Flag for Santa Venera (MT-54) 🏴󠁭󠁴󠀶󠀳󠁿 Flag for Xgħajra (MT-63) 🏴󠁭󠁵󠁭󠁯󠁿 Flag for Moka (MU-MO) 🏴󠁭󠁸󠁭󠁩󠁣󠁿 Flag for Michoacán (MX-MIC) 🏴󠁭󠁷󠁮󠁿 Flag for Northern (MW-N) 🏴󠁭󠁶󠁵󠁮󠁿 Flag for Upper North Province (MV-UN) 🏴󠁭󠁸󠁣󠁯󠁬󠁿 Flag for Colima (MX-COL) 🏴󠁭󠁵󠁲󠁯󠁿 Flag for Rodrigues (MU-RO) 🏴󠁭󠁸󠁧󠁵󠁡󠁿 Flag for Guanajuato (MX-GUA) 🏴󠁭󠁸󠁣󠁭󠁸󠁿 Flag for Ciudad de Mexico (MX-CMX) 🏴󠁭󠁸󠁰󠁵󠁥󠁿 Flag for Puebla (MX-PUE) 🏴󠁭󠁵󠁱󠁢󠁿 Flag for Quatre Bornes (MU-QB) 🏴󠁭󠁸󠁯󠁡󠁸󠁿 Flag for Oaxaca (MX-OAX) 🏴󠁭󠁷󠁣󠁿 Flag for Central (MW-C) 🏴󠁭󠁵󠁳󠁡󠁿 Flag for Savanne (MU-SA) 🏴󠁭󠁸󠁭󠁯󠁲󠁿 Flag for Morelos (MX-MOR) 🏴󠁭󠁸󠁨󠁩󠁤󠁿 Flag for Hidalgo (MX-HID) 🏴󠁭󠁸󠁡󠁧󠁵󠁿 Flag for Aguascalientes (MX-AGU) 🏴󠁭󠁸󠁣󠁡󠁭󠁿 Flag for Campeche (MX-CAM) 🏴󠁭󠁸󠁮󠁬󠁥󠁿 Flag for Nuevo León (MX-NLE) 🏴󠁭󠁶󠁭󠁬󠁥󠁿 Flag for Malé (MV-MLE) 🏴󠁭󠁸󠁧󠁲󠁯󠁿 Flag for Guerrero (MX-GRO) 🏴󠁭󠁵󠁶󠁰󠁿 Flag for Vacoas-Phoenix (MU-VP) 👨🏻‍👨🏻‍👦🏻‍👧🏻 Family - Man: Light Skin Tone, Man: Light Skin Tone, Boy: Light Skin Tone, Girl: Light Skin Tone 🏴󠁭󠁶󠁮󠁣󠁿 Flag for North Central Province (MV-NC) 🏴󠁭󠁸󠁭󠁥󠁸󠁿 Flag for Mexico State (MX-MEX) 🏴󠁭󠁵󠁰󠁷󠁿 Flag for Plaines Wilhems (MU-PW) 🏴󠁭󠁶󠁣󠁥󠁿 Flag for Central Province (MV-CE) 🏴󠁭󠁸󠁣󠁯󠁡󠁿 Flag for Coahuila (MX-COA) 🏴󠁭󠁶󠁳󠁵󠁿 Flag for South Province (MV-SU) 🏴󠁭󠁸󠁣󠁨󠁰󠁿 Flag for Chiapas (MX-CHP) 🏴󠁭󠁷󠁳󠁿 Flag for Southern (MW-S) 🏴󠁭󠁺󠁳󠁿 Flag for Sofala (MZ-S) 🏴󠁭󠁹󠀰󠀹󠁿 Flag for Perlis (MY-09) 🏴󠁭󠁸󠁶󠁥󠁲󠁿 Flag for Veracruz (MX-VER) 🏴󠁭󠁹󠀱󠀳󠁿 Flag for Sarawak (MY-13) 🏴󠁭󠁹󠀰󠀳󠁿 Flag for Kelantan (MY-03) 🏴󠁮󠁡󠁣󠁡󠁿 Flag for Zambezi (NA-CA) 🏴󠁭󠁺󠁢󠁿 Flag for Manica (MZ-B) 🏴󠁭󠁹󠀱󠀵󠁿 Flag for Labuan (MY-15) 🏴󠁭󠁺󠁰󠁿 Flag for Cabo Delgado (MZ-P) 🏴󠁮󠁡󠁨󠁡󠁿 Flag for Hardap (NA-HA) 🏴󠁭󠁺󠁴󠁿 Flag for Tete (MZ-T) 🏴󠁭󠁹󠀰󠀲󠁿 Flag for Kedah (MY-02) 🏴󠁭󠁹󠀰󠀶󠁿 Flag for Pahang (MY-06) 🏴󠁭󠁹󠀰󠀷󠁿 Flag for Penang (MY-07) 🏴󠁭󠁹󠀰󠀸󠁿 Flag for Perak (MY-08) 🏴󠁭󠁺󠁬󠁿 Flag for Maputo Province (MZ-L) 🏴󠁢󠁲󠁧󠁯󠁿 Flag for Goiás (BR-GO) 🏴󠁭󠁹󠀱󠀱󠁿 Flag for Terengganu (MY-11) 🏴󠁭󠁺󠁩󠁿 Flag for Inhambane (MZ-I) 🏴󠁭󠁹󠀰󠀴󠁿 Flag for Malacca (MY-04) 🏴󠁮󠁡󠁥󠁲󠁿 Flag for Erongo (NA-ER) 🏴󠁭󠁸󠁴󠁬󠁡󠁿 Flag for Tlaxcala (MX-TLA) 🏴󠁭󠁹󠀰󠀵󠁿 Flag for Negeri Sembilan (MY-05) 🏴󠁭󠁸󠁺󠁡󠁣󠁿 Flag for Zacatecas (MX-ZAC) 🏴󠁭󠁸󠁴󠁡󠁭󠁿 Flag for Tamaulipas (MX-TAM) 🏴󠁭󠁺󠁡󠁿 Flag for Niassa (MZ-A) 🏴󠁭󠁺󠁭󠁰󠁭󠁿 Flag for Maputo (MZ-MPM) 🏴󠁭󠁺󠁮󠁿 Flag for Nampula (MZ-N) 🏴󠁭󠁹󠀱󠀶󠁿 Flag for Putrajaya (MY-16) 🏴󠁭󠁸󠁳󠁩󠁮󠁿 Flag for Sinaloa (MX-SIN) 🏴󠁭󠁸󠁹󠁵󠁣󠁿 Flag for Yucatán (MX-YUC) 🏴󠁭󠁹󠀱󠀲󠁿 Flag for Sabah (MY-12) 👩🏼‍👩🏼‍👧🏼‍👧🏼 Family - Woman: Medium-Light Skin Tone, Woman: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone, Girl: Medium-Light Skin Tone 🏴󠁭󠁺󠁱󠁿 Flag for Zambezia (MZ-Q) 🏴󠁭󠁸󠁱󠁵󠁥󠁿 Flag for Querétaro (MX-QUE) 🏴󠁭󠁺󠁧󠁿 Flag for Gaza (MZ-G) 🏴󠁮󠁡󠁯󠁤󠁿 Flag for Otjozondjupa (NA-OD) 🏴󠁮󠁥󠀴󠁿 Flag for Maradi (NE-4) 🏴󠁮󠁡󠁫󠁵󠁿 Flag for Kunene (NA-KU) 🏴󠁮󠁧󠁡󠁫󠁿 Flag for Akwa Ibom (NG-AK) 🏴󠁮󠁥󠀵󠁿 Flag for Tahoua (NE-5) 🏴󠁭󠁵󠁲󠁲󠁿 Flag for Rivière du Rempart (MU-RR) 🏴󠁮󠁧󠁩󠁭󠁿 Flag for Imo (NG-IM) 🏴󠁮󠁧󠁫󠁴󠁿 Flag for Katsina (NG-KT) 🏴󠁮󠁥󠀳󠁿 Flag for Dosso (NE-3) 🏴󠁮󠁥󠀶󠁿 Flag for Tillabéri (NE-6) 🏴󠁮󠁧󠁥󠁫󠁿 Flag for Ekiti (NG-EK) 🏴󠁮󠁡󠁯󠁨󠁿 Flag for Omaheke (NA-OH) 🏴󠁮󠁧󠁢󠁡󠁿 Flag for Bauchi (NG-BA) 🏴󠁮󠁡󠁫󠁡󠁿 Flag for Karas (NA-KA) 🏴󠁮󠁧󠁢󠁹󠁿 Flag for Bayelsa (NG-BY) 🏴󠁮󠁡󠁯󠁷󠁿 Flag for Ohangwena (NA-OW) 🏴󠁮󠁧󠁢󠁥󠁿 Flag for Benue (NG-BE) 🏴󠁮󠁧󠁥󠁮󠁿 Flag for Enugu (NG-EN) 🏴󠁮󠁡󠁯󠁮󠁿 Flag for Oshana (NA-ON) 🏴󠁮󠁧󠁫󠁤󠁿 Flag for Kaduna (NG-KD) 👨🏻‍👶🏻‍👦🏻 Family - Man: Light Skin Tone, Baby: Light Skin Tone, Boy: Light Skin Tone 🏴󠁮󠁧󠁫󠁥󠁿 Flag for Kebbi (NG-KE) 🏴󠁮󠁧󠁪󠁩󠁿 Flag for Jigawa (NG-JI) 🏴󠁮󠁥󠀸󠁿 Flag for Niamey (NE-8) 🏴󠁮󠁧󠁡󠁮󠁿 Flag for Anambra (NG-AN) 🏴󠁮󠁧󠁧󠁯󠁿 Flag for Gombe (NG-GO) 🏴󠁮󠁥󠀱󠁿 Flag for Agadez (NE-1) 🏴󠁮󠁡󠁫󠁨󠁿 Flag for Khomas (NA-KH) 🏴󠁮󠁥󠀲󠁿 Flag for Diffa (NE-2) 🏴󠁭󠁹󠀰󠀱󠁿 Flag for Johor (MY-01) 🏴󠁮󠁧󠁫󠁮󠁿 Flag for Kano (NG-KN) 🏴󠁮󠁡󠁯󠁳󠁿 Flag for Omusati (NA-OS) 🏴󠁮󠁧󠁫󠁯󠁿 Flag for Kogi (NG-KO) 🏴󠁮󠁧󠁥󠁤󠁿 Flag for Edo (NG-ED) 🏴󠁮󠁧󠁡󠁢󠁿 Flag for Abia (NG-AB) 🏴󠁮󠁡󠁯󠁴󠁿 Flag for Oshikoto (NA-OT) 🏴󠁮󠁡󠁫󠁷󠁿 Flag for Kavango West (NA-KW) 🏴󠁮󠁧󠁥󠁢󠁿 Flag for Ebonyi (NG-EB) 🏴󠁮󠁥󠀷󠁿 Flag for Zinder (NE-7) 🏴󠁮󠁩󠁪󠁩󠁿 Flag for Jinotega (NI-JI) 🏴󠁮󠁧󠁮󠁡󠁿 Flag for Nasarawa (NG-NA) 🏴󠁮󠁬󠁦󠁲󠁿 Flag for Friesland (NL-FR) 🏴󠁮󠁧󠁳󠁯󠁿 Flag for Sokoto (NG-SO) 🏴󠁮󠁩󠁲󠁩󠁿 Flag for Rivas (NI-RI) 🏴󠁮󠁩󠁮󠁳󠁿 Flag for Nueva Segovia (NI-NS) 🏴󠁮󠁧󠁰󠁬󠁿 Flag for Plateau (NG-PL) 🏴󠁮󠁧󠁹󠁯󠁿 Flag for Yobe (NG-YO) 🏴󠁮󠁬󠁢󠁱󠀱󠁿 Flag for Bonaire (NL-BQ1) 🏴󠁮󠁩󠁡󠁮󠁿 Flag for Atlántico Norte (NI-AN) 🏴󠁮󠁧󠁺󠁡󠁿 Flag for Zamfara (NG-ZA) 🏴󠁮󠁬󠁧󠁥󠁿 Flag for Gelderland (NL-GE) 🏴󠁮󠁧󠁯󠁹󠁿 Flag for Oyo (NG-OY) 🏴󠁮󠁩󠁭󠁤󠁿 Flag for Madriz (NI-MD) 🏴󠁮󠁩󠁣󠁩󠁿 Flag for Chinandega (NI-CI) 🏴󠁮󠁧󠁯󠁮󠁿 Flag for Ondo (NG-ON) 👨🏽‍👨🏽‍👦🏽‍👧🏽 Family - Man: Medium Skin Tone, Man: Medium Skin Tone, Boy: Medium Skin Tone, Girl: Medium Skin Tone 🏴󠁤󠁥󠁮󠁷󠁿 Flag for North Rhine-Westphalia (DE-NW) 🏴󠁮󠁧󠁬󠁡󠁿 Flag for Lagos (NG-LA) 🏴󠁮󠁩󠁭󠁮󠁿 Flag for Managua (NI-MN) 🏴󠁮󠁩󠁡󠁳󠁿 Flag for Atlántico Sur (NI-AS) 🏴󠁮󠁬󠁣󠁷󠁿 Flag for Curaçao (NL-CW) 🏴󠁮󠁩󠁢󠁯󠁿 Flag for Boaco (NI-BO) 🏴󠁮󠁧󠁲󠁩󠁿 Flag for Rivers (NG-RI) 🏴󠁮󠁩󠁧󠁲󠁿 Flag for Granada (NI-GR) 🏴󠁮󠁩󠁣󠁯󠁿 Flag for Chontales (NI-CO) 🏴󠁮󠁬󠁧󠁲󠁿 Flag for Groningen (NL-GR) 🏴󠁮󠁬󠁢󠁱󠀳󠁿 Flag for Sint Eustatius (NL-BQ3) 🏴󠁮󠁩󠁳󠁪󠁿 Flag for Río San Juan (NI-SJ) 🏴󠁮󠁧󠁯󠁳󠁿 Flag for Osun (NG-OS) 🏴󠁮󠁧󠁴󠁡󠁿 Flag for Taraba (NG-TA) 🏴󠁮󠁬󠁦󠁬󠁿 Flag for Flevoland (NL-FL) 🏴󠁮󠁩󠁭󠁴󠁿 Flag for Matagalpa (NI-MT) 🏴󠁮󠁬󠁤󠁲󠁿 Flag for Drenthe (NL-DR) 🏴󠁮󠁩󠁣󠁡󠁿 Flag for Carazo (NI-CA) 🏴󠁮󠁧󠁫󠁷󠁿 Flag for Kwara (NG-KW) 🏴󠁮󠁧󠁮󠁩󠁿 Flag for Niger (NG-NI) 🏴󠁮󠁩󠁥󠁳󠁿 Flag for Estelí (NI-ES) 🏴󠁮󠁬󠁺󠁨󠁿 Flag for South Holland (NL-ZH) """ for line in emojis.splitlines(): words = line.split() char = words[0] desc = " ".join(words[1:]) print("{}\t:{}".format(desc, char))
[]
HubTou/ngc
src/ngc/main.py
9917adfbaff61e7b20b9f06a4be6b51237e4e768
#!/usr/bin/env python """ ngc - n-grams count License: 3-clause BSD (see https://opensource.org/licenses/BSD-3-Clause) Author: Hubert Tournier """ import getopt import logging import os import re import string import sys import unicode2ascii # Version string used by the what(1) and ident(1) commands: ID = "@(#) $Id: ngc - n-grams count v1.0.2 (September 26, 2021) by Hubert Tournier $" # Default parameters. Can be superseded by command line options parameters = { "Convert": { "Unicode to ASCII": False, "Upper to lower case": False, "Lower to upper case": False, "Spaces to one space": False, }, "Discard": { "Unicode characters": False, "Upper case letters": False, "Lower case letters": False, "Connection symbols": False, # ' - "Digits": False, "Punctuation": False, # . , ; : ! ? "Other printable symbols": False, "Spaces": False, # space tab return formfeed vtab "Control characters": False, }, "Length": 1, "Fixed block": False, # Sliding-window mode by default "Word boundary": False, "Partial": { "Discard": False, "Keep": True, "Justify": False, }, "Show": { "Text": False, "N-grams": True, "Summary": False, }, } occurrences = {} summary = { "Upper case letters": 0, "Lower case letters": 0, "Connection symbols": 0, "Digits": 0, "Punctuation": 0, "Other printable symbols": 0, "Spaces": 0, "Other spaces": 0, "Control characters": 0, "Unicode letters": 0, "Unicode marks": 0, "Unicode numbers": 0, "Unicode punctuations": 0, "Unicode symbols": 0, "Unicode separators": 0, "Unicode others": 0, "All unicode characters": 0, "All characters": 0, "All n-grams": 0 } ################################################################################ def initialize_debugging(program_name): """Debugging set up""" console_log_format = program_name + ": %(levelname)s: %(message)s" logging.basicConfig(format=console_log_format, level=logging.DEBUG) logging.disable(logging.INFO) ################################################################################ def display_help(): """Displays usage and help""" print("usage: ngc [-b|--block] [-c|--convert ARGS] [--debug]", file=sys.stderr) print(" [-d|--discard ARGS] [--help|-?] [-l|--length ARG]", file=sys.stderr) print(" [-p|--partial ARG] [-q|--quiet] [-s|--summary] [-t|--text]", file=sys.stderr) print(" [--version] [-w|--word] [--] [filename ...]", file=sys.stderr) print(" ----------------- ----------------------------------------------------", file=sys.stderr ) print(" -b|--block Use fixed- instead of sliding-windows blocks", file=sys.stderr) print(" -c|--convert ARGS Convert text input. A combination of:", file=sys.stderr) print(" ARG = a - Unicode characters to ASCII (remove accents)", file=sys.stderr) print(" ARG = l - Upper case letters to lower", file=sys.stderr) print(" ARG = u - Lower case letters to upper", file=sys.stderr) print(" ARG = s - Spaces-like characters to 1 space", file=sys.stderr) print(" ARGS l and u can't be used at the same time", file=sys.stderr) print(" -d|--discard ARGS Discard characters. A combination of:", file=sys.stderr) print(" ARG = U - Unicode characters", file=sys.stderr) print(" ARG = u - Upper case letters", file=sys.stderr) print(" ARG = l - Lower case letters", file=sys.stderr) print(" ARG = L - All letters", file=sys.stderr) print(" ARG = c - Connection symbols ('-)", file=sys.stderr) print(" ARG = d - Digits", file=sys.stderr) print(" ARG = p - Punctuation (.,;:!?)", file=sys.stderr) print(" ARG = o - Other printable symbols", file=sys.stderr) print(" ARG = s - Spaces (space, tab, return, formfeed, vtab)", file=sys.stderr) print(" ARG = n - Non printable Control characters", file=sys.stderr) print(" -l|--length ARG Length of the n-gram. Defaults to 1", file=sys.stderr) print(" -p|--partial ARG What to do with partial blocks? One among:", file=sys.stderr) print(" ARG = d - Discard", file=sys.stderr) print(" ARG = k - Keep as-is", file=sys.stderr) print(" ARG = j - Keep but right-justify with spaces", file=sys.stderr) print(" -q|--quiet Don't show occurrences and frequency by n-gram", file=sys.stderr) print(" -s|--summary Show a summary of what was processed", file=sys.stderr) print(" -t|--text Show modified text input", file=sys.stderr) print(" -w|--word Respect Word boundaries (delimited by spaces)", file=sys.stderr) print(" --debug Enable debug mode", file=sys.stderr) print(" --help|-? Print usage and this help message and exit", file=sys.stderr) print(" --version Print version and exit", file=sys.stderr) print(" -- Options processing terminator", file=sys.stderr) print(file=sys.stderr) ################################################################################ def process_environment_variables(): """Process environment variables""" if "NGC_DEBUG" in os.environ.keys(): logging.disable(logging.NOTSET) ################################################################################ def process_command_line(): """Process command line""" # pylint: disable=C0103 global parameters # pylint: enable=C0103 # option letters followed by : expect an argument # same for option strings followed by = character_options = "bc:d:l:p:qstw?" string_options = [ "block", "convert=", "debug", "discard=", "help", "length=", "partial=", "quiet", "summary", "text", "version", "word", ] try: options, remaining_arguments = getopt.getopt( sys.argv[1:], character_options, string_options ) except getopt.GetoptError as error: logging.critical(error) display_help() sys.exit(1) for option, argument in options: if option in ("-b", "--block"): parameters["Fixed block"] = True elif option in ("-c", "--convert"): if 'l' in argument and 'u' in argument: logging.critical("-c|--convert parameter can't contain [lu] at the same time") sys.exit(1) if 'a' in argument: parameters["Convert"]["Unicode to ASCII"] = True if 'l' in argument: parameters["Convert"]["Upper to lower case"] = True if 'u' in argument: parameters["Convert"]["Lower to upper case"] = True if 's' in argument: parameters["Convert"]["Spaces to one space"] = True elif option in ("-d", "--discard"): if 'U' in argument: parameters["Discard"]["Unicode characters"] = True if 'u' in argument: parameters["Discard"]["Upper case letters"] = True if 'l' in argument: parameters["Discard"]["Lower case letters"] = True if 'L' in argument: parameters["Discard"]["Upper case letters"] = True parameters["Discard"]["Lower case letters"] = True if 'c' in argument: parameters["Discard"]["Connection symbols"] = True if 'd' in argument: parameters["Discard"]["Digits"] = True if 'p' in argument: parameters["Discard"]["Punctuation"] = True if 'o' in argument: parameters["Discard"]["Other printable symbols"] = True if 's' in argument: parameters["Discard"]["Spaces"] = True if 'n' in argument: parameters["Discard"]["Control characters"] = True elif option in ("-l", "--length"): if argument.isdigit() and int(argument) >= 0: parameters["Length"] = int(argument) else: logging.critical("-l|--length parameter must be a strictly positive integer") sys.exit(1) elif option in ("-p", "--partial"): if len(argument) > 1 or argument not in ('d', 'k', 'j'): logging.critical("-p|--partial parameter must be a single character among [dkj]") sys.exit(1) if argument == 'd': parameters["Partial"]["Discard"] = True parameters["Partial"]["Keep"] = False elif argument == 'j': parameters["Partial"]["Justify"] = True parameters["Partial"]["Keep"] = False elif option in ("-q", "--quiet"): parameters["Show"]["N-grams"] = False elif option in ("-s", "--summary"): parameters["Show"]["Summary"] = True elif option in ("-t", "--text"): parameters["Show"]["Text"] = True elif option in ("-w", "--word"): parameters["Word boundary"] = True elif option == "--debug": logging.disable(logging.NOTSET) elif option in ("--help", "-?"): display_help() sys.exit(0) elif option == "--version": print(ID.replace("@(" + "#)" + " $" + "Id" + ": ", "").replace(" $", "")) sys.exit(0) logging.debug("process_command_line(): parameters:") logging.debug(parameters) logging.debug("process_command_line(): remaining_arguments:") logging.debug(remaining_arguments) return remaining_arguments ################################################################################ def handle_partial_n_gram(text): """Analyze n-grams frequency in a string""" # pylint: disable=C0103 global occurrences, summary # pylint: enable=C0103 if not parameters["Partial"]["Discard"]: if parameters["Partial"]["Justify"]: for _ in range(parameters["Length"] - len(text)): text += " " if text in occurrences: occurrences[text] += 1 else: occurrences[text] = 1 summary["All n-grams"] += 1 ################################################################################ def frequency_analysis(text): """Analyze n-grams frequency in a string""" # pylint: disable=C0103 global occurrences, summary # pylint: enable=C0103 if parameters["Show"]["Summary"]: for character in text: if ord(character) < 128: if character in string.ascii_uppercase: summary["Upper case letters"] += 1 elif character in string.ascii_lowercase: summary["Lower case letters"] += 1 elif character in ("'", "-"): summary["Connection symbols"] += 1 elif character in string.digits: summary["Digits"] += 1 elif character in (".", ",", ";", ":", "!", "?"): summary["Punctuation"] += 1 elif character == " ": summary["Spaces"] += 1 elif character in string.whitespace: summary["Other spaces"] += 1 elif (ord(character) < 32 and ord(character) not in (9, 11, 12, 13)) \ or ord(character) == 127: summary["Control characters"] += 1 else: summary["Other printable symbols"] += 1 else: summary["All unicode characters"] += 1 if unicode2ascii.is_unicode_letter(character): summary["Unicode letters"] += 1 elif unicode2ascii.is_unicode_mark(character): summary["Unicode marks"] += 1 elif unicode2ascii.is_unicode_number(character): summary["Unicode numbers"] += 1 elif unicode2ascii.is_unicode_punctuation(character): summary["Unicode punctuations"] += 1 elif unicode2ascii.is_unicode_symbol(character): summary["Unicode symbols"] += 1 elif unicode2ascii.is_unicode_separator(character): summary["Unicode separators"] += 1 else: summary["Unicode others"] += 1 if len(text) <= parameters["Length"]: if text: handle_partial_n_gram(text) else: i = 0 while i < len(text) + 1 - parameters["Length"]: sequence = text[i:i + parameters["Length"]] if sequence in occurrences: occurrences[sequence] += 1 else: occurrences[sequence] = 1 summary["All n-grams"] += 1 if parameters["Fixed block"]: i += parameters["Length"] else: i += 1 if i < len(text): handle_partial_n_gram(text[i:]) ################################################################################ def process_line(line): """Process a text line""" # pylint: disable=C0103 global summary # pylint: enable=C0103 line = line.rstrip(os.linesep) # Conversions: if parameters["Convert"]["Unicode to ASCII"]: line = unicode2ascii.unicode_to_ascii_string(line) if parameters["Convert"]["Upper to lower case"]: line = line.lower() if parameters["Convert"]["Lower to upper case"]: line = line.upper() # Discards: if parameters["Discard"]["Unicode characters"]: line = "".join([c for c in line if ord(c) < 128]) if parameters["Discard"]["Upper case letters"]: line = re.sub(r"[A-Z]+", "", line) if parameters["Discard"]["Lower case letters"]: line = re.sub(r"[a-z]+", "", line) if parameters["Discard"]["Connection symbols"]: line = re.sub(r"[-']+", "", line) if parameters["Discard"]["Digits"]: line = re.sub(r"[0-9]+", "", line) if parameters["Discard"]["Punctuation"]: line = re.sub(r"[\.,;:!\?]+", "", line) if parameters["Discard"]["Other printable symbols"]: line = re.sub(r"[\"#$&@\[\\\]_`{|}~%()\*+/<=>^]+", "", line) if parameters["Discard"]["Spaces"]: line = re.sub(r"[" + string.whitespace + r"]+", "", line) if parameters["Discard"]["Control characters"]: line = "".join( [c for c in line if not (ord(c) < 9 or (ord(c) > 13 and ord(c) < 32) or ord(c) == 127)] ) # Late conversions: if parameters["Convert"]["Spaces to one space"]: line = re.sub(r"[" + string.whitespace + r"]+", " ", line) if parameters["Show"]["Text"]: print(line) if parameters["Word boundary"]: # Splitting words on all kind of whitespaces: for word in line.split(): if word: frequency_analysis(word) summary["All characters"] += len(word) else: frequency_analysis(line) summary["All characters"] += len(line) ################################################################################ def process_file(filename): """Process the file designated by filename, line by line""" with open(filename, "r") as file: for line in file.readlines(): process_line(line) ################################################################################ def compute_kappa_plaintext(): """Return kappa_plaintext for the processed input stream""" # pylint: disable=C0103 global occurrences, summary # pylint: enable=C0103 # See https://en.wikipedia.org/wiki/Index_of_coincidence index = 0.0 for occurrence in occurrences.values(): index += occurrence * (occurrence - 1) return index / (summary["All n-grams"] * (summary["All n-grams"] - 1)) ################################################################################ def compute_coincidence_index(kappa_plaintext): """Return coincidence index for a given kappa_plaintext and alphabet""" # pylint: disable=C0103 global summary # pylint: enable=C0103 if summary["Unicode separators"]: # Unknown alphabet size return 0 alphabet_size = 0 if summary["Upper case letters"]: alphabet_size += len(string.ascii_uppercase) if summary["Lower case letters"]: alphabet_size += len(string.ascii_lowercase) if summary["Digits"]: alphabet_size += len(string.digits) if summary["Connection symbols"]: alphabet_size += len("'-") if summary["Punctuation"]: alphabet_size += len(".,;:?!") if summary["Other printable symbols"]: alphabet_size += len("\"#$&@[\\]_`{|}~%()*+/<=>^") if summary["Spaces"]: alphabet_size += 1 if summary["Other spaces"]: alphabet_size += len(string.whitespace) - 1 if summary["Control characters"]: alphabet_size += 29 return kappa_plaintext * alphabet_size ################################################################################ def main(): """The program's main entry point""" program_name = os.path.basename(sys.argv[0]) initialize_debugging(program_name) process_environment_variables() arguments = process_command_line() exit_status = 0 # Reading from files whose name were given as arguments: if len(arguments): for filename in arguments: if os.path.isfile(filename): process_file(filename) else: logging.error("The argument '%s' is not a filename", filename) exit_status = 1 # Reading from standard input as there are no arguments: else: for line in sys.stdin: process_line(line) # Displaying occurrences and frequency by n-gram: if parameters["Show"]["N-grams"]: if parameters["Show"]["Text"]: print("--") decreasing_occurrences = dict(sorted(occurrences.items(), key=lambda t: t[1], reverse=True)) for key, value in decreasing_occurrences.items(): print("'{}'\t{}\t{:.2f}%".format(key, value, (value/summary["All n-grams"])*100)) # Displaying summary: if parameters["Show"]["Summary"]: print("==") for key, value in summary.items(): print("{:23s}\t{:d}".format(key, value)) print() kappa_plaintext = compute_kappa_plaintext() coincidence_index = compute_coincidence_index(kappa_plaintext) print("{:23s}\t{}".format("Kappa-plaintext", kappa_plaintext)) print("{:23s}\t{}".format("Index of coincidence", coincidence_index)) sys.exit(exit_status) if __name__ == "__main__": main()
[((2104, 2171), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': 'console_log_format', 'level': 'logging.DEBUG'}), '(format=console_log_format, level=logging.DEBUG)\n', (2123, 2171), False, 'import logging\n'), ((2176, 2205), 'logging.disable', 'logging.disable', (['logging.INFO'], {}), '(logging.INFO)\n', (2191, 2205), False, 'import logging\n'), ((9837, 9889), 'logging.debug', 'logging.debug', (['"""process_command_line(): parameters:"""'], {}), "('process_command_line(): parameters:')\n", (9850, 9889), False, 'import logging\n'), ((9894, 9919), 'logging.debug', 'logging.debug', (['parameters'], {}), '(parameters)\n', (9907, 9919), False, 'import logging\n'), ((9924, 9985), 'logging.debug', 'logging.debug', (['"""process_command_line(): remaining_arguments:"""'], {}), "('process_command_line(): remaining_arguments:')\n", (9937, 9985), False, 'import logging\n'), ((9990, 10024), 'logging.debug', 'logging.debug', (['remaining_arguments'], {}), '(remaining_arguments)\n', (10003, 10024), False, 'import logging\n'), ((17611, 17640), 'os.path.basename', 'os.path.basename', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (17627, 17640), False, 'import os\n'), ((19124, 19145), 'sys.exit', 'sys.exit', (['exit_status'], {}), '(exit_status)\n', (19132, 19145), False, 'import sys\n'), ((5593, 5610), 'os.environ.keys', 'os.environ.keys', ([], {}), '()\n', (5608, 5610), False, 'import os\n'), ((5620, 5651), 'logging.disable', 'logging.disable', (['logging.NOTSET'], {}), '(logging.NOTSET)\n', (5635, 5651), False, 'import logging\n'), ((6309, 6371), 'getopt.getopt', 'getopt.getopt', (['sys.argv[1:]', 'character_options', 'string_options'], {}), '(sys.argv[1:], character_options, string_options)\n', (6322, 6371), False, 'import getopt\n'), ((13781, 13824), 'unicode2ascii.unicode_to_ascii_string', 'unicode2ascii.unicode_to_ascii_string', (['line'], {}), '(line)\n', (13818, 13824), False, 'import unicode2ascii\n'), ((14181, 14207), 're.sub', 're.sub', (['"""[A-Z]+"""', '""""""', 'line'], {}), "('[A-Z]+', '', line)\n", (14187, 14207), False, 'import re\n'), ((14276, 14302), 're.sub', 're.sub', (['"""[a-z]+"""', '""""""', 'line'], {}), "('[a-z]+', '', line)\n", (14282, 14302), False, 'import re\n'), ((14371, 14396), 're.sub', 're.sub', (['"""[-\']+"""', '""""""', 'line'], {}), '("[-\']+", \'\', line)\n', (14377, 14396), False, 'import re\n'), ((14453, 14479), 're.sub', 're.sub', (['"""[0-9]+"""', '""""""', 'line'], {}), "('[0-9]+', '', line)\n", (14459, 14479), False, 'import re\n'), ((14541, 14574), 're.sub', 're.sub', (['"""[\\\\.,;:!\\\\?]+"""', '""""""', 'line'], {}), "('[\\\\.,;:!\\\\?]+', '', line)\n", (14547, 14574), False, 'import re\n'), ((14646, 14704), 're.sub', 're.sub', (['"""[\\\\"#$&@\\\\[\\\\\\\\\\\\]_`{|}~%()\\\\*+/<=>^]+"""', '""""""', 'line'], {}), '(\'[\\\\"#$&@\\\\[\\\\\\\\\\\\]_`{|}~%()\\\\*+/<=>^]+\', \'\', line)\n', (14652, 14704), False, 'import re\n'), ((14755, 14803), 're.sub', 're.sub', (["('[' + string.whitespace + ']+')", '""""""', 'line'], {}), "('[' + string.whitespace + ']+', '', line)\n", (14761, 14803), False, 'import re\n'), ((15089, 15138), 're.sub', 're.sub', (["('[' + string.whitespace + ']+')", '""" """', 'line'], {}), "('[' + string.whitespace + ']+', ' ', line)\n", (15095, 15138), False, 'import re\n'), ((6442, 6465), 'logging.critical', 'logging.critical', (['error'], {}), '(error)\n', (6458, 6465), False, 'import logging\n'), ((6497, 6508), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (6505, 6508), False, 'import sys\n'), ((17912, 17936), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (17926, 17936), False, 'import os\n'), ((12069, 12111), 'unicode2ascii.is_unicode_letter', 'unicode2ascii.is_unicode_letter', (['character'], {}), '(character)\n', (12100, 12111), False, 'import unicode2ascii\n'), ((18011, 18073), 'logging.error', 'logging.error', (['"""The argument \'%s\' is not a filename"""', 'filename'], {}), '("The argument \'%s\' is not a filename", filename)\n', (18024, 18073), False, 'import logging\n'), ((6746, 6824), 'logging.critical', 'logging.critical', (['"""-c|--convert parameter can\'t contain [lu] at the same time"""'], {}), '("-c|--convert parameter can\'t contain [lu] at the same time")\n', (6762, 6824), False, 'import logging\n'), ((6841, 6852), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (6849, 6852), False, 'import sys\n'), ((12186, 12226), 'unicode2ascii.is_unicode_mark', 'unicode2ascii.is_unicode_mark', (['character'], {}), '(character)\n', (12215, 12226), False, 'import unicode2ascii\n'), ((12299, 12341), 'unicode2ascii.is_unicode_number', 'unicode2ascii.is_unicode_number', (['character'], {}), '(character)\n', (12330, 12341), False, 'import unicode2ascii\n'), ((8516, 8593), 'logging.critical', 'logging.critical', (['"""-l|--length parameter must be a strictly positive integer"""'], {}), "('-l|--length parameter must be a strictly positive integer')\n", (8532, 8593), False, 'import logging\n'), ((8610, 8621), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (8618, 8621), False, 'import sys\n'), ((12416, 12463), 'unicode2ascii.is_unicode_punctuation', 'unicode2ascii.is_unicode_punctuation', (['character'], {}), '(character)\n', (12452, 12463), False, 'import unicode2ascii\n'), ((8752, 8838), 'logging.critical', 'logging.critical', (['"""-p|--partial parameter must be a single character among [dkj]"""'], {}), "(\n '-p|--partial parameter must be a single character among [dkj]')\n", (8768, 8838), False, 'import logging\n'), ((8850, 8861), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (8858, 8861), False, 'import sys\n'), ((12543, 12585), 'unicode2ascii.is_unicode_symbol', 'unicode2ascii.is_unicode_symbol', (['character'], {}), '(character)\n', (12574, 12585), False, 'import unicode2ascii\n'), ((12660, 12705), 'unicode2ascii.is_unicode_separator', 'unicode2ascii.is_unicode_separator', (['character'], {}), '(character)\n', (12694, 12705), False, 'import unicode2ascii\n'), ((9560, 9591), 'logging.disable', 'logging.disable', (['logging.NOTSET'], {}), '(logging.NOTSET)\n', (9575, 9591), False, 'import logging\n'), ((9673, 9684), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (9681, 9684), False, 'import sys\n'), ((9820, 9831), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (9828, 9831), False, 'import sys\n')]
rainzhop/ConvNetQuake
openquake.hazardlib/openquake/hazardlib/tests/gsim/campbell_2003_test.py
a3e6de3f7992eac72f1b9883fec36b8c7fdefd48
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright (C) 2012-2016 GEM Foundation # # OpenQuake is free software: you can redistribute it and/or modify it # under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenQuake is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with OpenQuake. If not, see <http://www.gnu.org/licenses/>. from openquake.hazardlib.gsim.campbell_2003 import ( Campbell2003, Campbell2003SHARE, Campbell2003MblgAB1987NSHMP2008, Campbell2003MblgJ1996NSHMP2008, Campbell2003MwNSHMP2008 ) from openquake.hazardlib.tests.gsim.utils import BaseGSIMTestCase import numpy # Test data generated from OpenSHA implementation. class Campbell2003TestCase(BaseGSIMTestCase): GSIM_CLASS = Campbell2003 def test_mean(self): self.check('C03/C03_MEAN.csv', max_discrep_percentage=0.1) def test_std_total(self): self.check('C03/C03_STD_TOTAL.csv', max_discrep_percentage=0.1) class Campbell2003SHARETestCase(BaseGSIMTestCase): GSIM_CLASS = Campbell2003SHARE def test_mean(self): self.check('C03/C03SHARE_MEAN.csv', max_discrep_percentage=0.1) def test_std_total(self): self.check('C03/C03SHARE_STD_TOTAL.csv', max_discrep_percentage=0.1) class Campbell2003MblgAB1987NSHMP2008TestCase(BaseGSIMTestCase): GSIM_CLASS = Campbell2003MblgAB1987NSHMP2008 # test data generated from ``subroutine getCampCEUS`` in ``hazgridXnga2.f`` def test_mean(self): self.check('C03/C03MblgAB1987NSHMP2008_MEAN.csv', max_discrep_percentage=0.1) def test_std_total(self): self.check('C03/C03MblgAB1987NSHMP2008_STD_TOTAL.csv', max_discrep_percentage=0.1) class Campbell2003MblgJ1996NSHMP2008TestCase(BaseGSIMTestCase): GSIM_CLASS = Campbell2003MblgJ1996NSHMP2008 # test data generated from ``subroutine getCampCEUS`` in ``hazgridXnga2.f`` def test_mean(self): self.check('C03/C03MblgJ1996NSHMP2008_MEAN.csv', max_discrep_percentage=0.1) def test_std_total(self): self.check('C03/C03MblgJ1996NSHMP2008_STD_TOTAL.csv', max_discrep_percentage=0.1) class Campbell2003MwNSHMP2008TestCase(BaseGSIMTestCase): GSIM_CLASS = Campbell2003MwNSHMP2008 # test data generated from ``subroutine getCampCEUS`` in ``hazgridXnga2.f`` def test_mean(self): self.check('C03/C03MwNSHMP2008_MEAN.csv', max_discrep_percentage=0.1) def test_std_total(self): self.check('C03/C03MwNSHMP2008_STD_TOTAL.csv', max_discrep_percentage=0.1)
[]
khrapovs/sktime
sktime/regression/interval_based/_tsf.py
1589d007ef5dbcdc1f42f2c8278919ebed516358
# -*- coding: utf-8 -*- """Time Series Forest Regressor (TSF).""" __author__ = ["Tony Bagnall", "kkoziara", "luiszugasti", "kanand77", "Markus Löning"] __all__ = ["TimeSeriesForestRegressor"] import numpy as np from joblib import Parallel, delayed from sklearn.ensemble._forest import ForestRegressor from sklearn.tree import DecisionTreeRegressor from sktime.regression.base import BaseRegressor from sktime.series_as_features.base.estimators.interval_based._tsf import ( BaseTimeSeriesForest, _transform, ) class TimeSeriesForestRegressor(BaseTimeSeriesForest, ForestRegressor, BaseRegressor): """Time series forest regressor. A time series forest is an ensemble of decision trees built on random intervals. Overview: For input data with n series of length m, for each tree: - sample sqrt(m) intervals, - find mean, std and slope for each interval, concatenate to form new data set, - build decision tree on new data set. Ensemble the trees with averaged probability estimates. This implementation deviates from the original in minor ways. It samples intervals with replacement and does not use the splitting criteria tiny refinement described in [1]_. This is an intentionally stripped down, non configurable version for use as a HIVE-COTE component. Parameters ---------- n_estimators : int, default=200 Number of estimators. min_interval : int, default=3 Minimum width of an interval. n_jobs : int, default=1 The number of jobs to run in parallel for both `fit` and `predict`. ``-1`` means using all processors. random_state : int, default=None Attributes ---------- n_classes : int Number of classes. n_intervals : int Number of intervals. classes_ : list List of classes for a given problem. See Also -------- TimeSeriesForestClassifier References ---------- .. [1] H.Deng, G.Runger, E.Tuv and M.Vladimir, "A time series forest for classification and feature extraction", Information Sciences, 239, 2013 .. [2] Java implementation https://github.com/uea-machine-learning/tsml .. [3] Arxiv paper: https://arxiv.org/abs/1302.2277 """ _tags = { "capability:multivariate": False, "X_inner_mtype": "numpy3D", } _base_estimator = DecisionTreeRegressor() def fit(self, X, y): """Override sklearn forest fit with BaseRegressor fit.""" return BaseRegressor.fit(self, X, y) def _fit(self, X, y): """Wrap BaseForest._fit. This is a temporary measure prior to the BaseRegressor refactor. """ return BaseTimeSeriesForest._fit(self, X, y) def predict(self, X): """Override sklearn forest predict with BaseRegressor predict.""" return BaseRegressor.predict(self, X) def _predict(self, X): """Predict. Parameters ---------- X : pd.DataFrame or np.ndarray Panel data Returns ------- np.ndarray Predictions. """ X = X.squeeze(1) _, series_length = X.shape if series_length != self.series_length: raise TypeError( "The number of time points in the training data does not match " "that in the test data." ) y_pred = Parallel(n_jobs=self.n_jobs)( delayed(_predict)(X, self.estimators_[i], self.intervals_[i]) for i in range(self.n_estimators) ) return np.mean(y_pred, axis=0) def _predict(X, estimator, intervals): Xt = _transform(X, intervals) return estimator.predict(Xt)
[((2370, 2393), 'sklearn.tree.DecisionTreeRegressor', 'DecisionTreeRegressor', ([], {}), '()\n', (2391, 2393), False, 'from sklearn.tree import DecisionTreeRegressor\n'), ((3655, 3679), 'sktime.series_as_features.base.estimators.interval_based._tsf._transform', '_transform', (['X', 'intervals'], {}), '(X, intervals)\n', (3665, 3679), False, 'from sktime.series_as_features.base.estimators.interval_based._tsf import BaseTimeSeriesForest, _transform\n'), ((2501, 2530), 'sktime.regression.base.BaseRegressor.fit', 'BaseRegressor.fit', (['self', 'X', 'y'], {}), '(self, X, y)\n', (2518, 2530), False, 'from sktime.regression.base import BaseRegressor\n'), ((2692, 2729), 'sktime.series_as_features.base.estimators.interval_based._tsf.BaseTimeSeriesForest._fit', 'BaseTimeSeriesForest._fit', (['self', 'X', 'y'], {}), '(self, X, y)\n', (2717, 2729), False, 'from sktime.series_as_features.base.estimators.interval_based._tsf import BaseTimeSeriesForest, _transform\n'), ((2846, 2876), 'sktime.regression.base.BaseRegressor.predict', 'BaseRegressor.predict', (['self', 'X'], {}), '(self, X)\n', (2867, 2876), False, 'from sktime.regression.base import BaseRegressor\n'), ((3581, 3604), 'numpy.mean', 'np.mean', (['y_pred'], {'axis': '(0)'}), '(y_pred, axis=0)\n', (3588, 3604), True, 'import numpy as np\n'), ((3406, 3434), 'joblib.Parallel', 'Parallel', ([], {'n_jobs': 'self.n_jobs'}), '(n_jobs=self.n_jobs)\n', (3414, 3434), False, 'from joblib import Parallel, delayed\n'), ((3448, 3465), 'joblib.delayed', 'delayed', (['_predict'], {}), '(_predict)\n', (3455, 3465), False, 'from joblib import Parallel, delayed\n')]
sebastiankruk/vectorc2
vectorc2/vectorc2/settings.py
13232cd63ebed32346fb4a669511b102b8ed24c0
""" Django settings for vectorc2 project. Copyright 2019 Sebastian Ryszard Kruk <vectorc2@kruk.me> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '#9iml9@=i%x#i57qi1zm)&)p46hrf(g=pn7jioagsh*))6+z9(' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [ "localhost", "127.0.0.1", "0.0.0.0" ] # Application definition INSTALLED_APPS = [ 'space', 'command', 'bootstrap4', 'octicons', 'nonicons', 'blocks', 'photos', 'morse', 'webview.apps.WebviewConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'channels', # 'compressor', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'vectorc2.urls' STATICFILES_DIRS = [ os.path.join(BASE_DIR, "static") ] MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [ os.path.join(BASE_DIR, 'webview', 'templates') ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.request', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'vectorc2.wsgi.application' # Database # https://docs.djangoproject.com/en/2.1/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Password validation # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/2.1/topics/i18n/ LANGUAGE_CODE = 'en' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.1/howto/static-files/ STATIC_URL = '/static/' # languages from django.utils.translation import gettext_lazy as _ LANGUAGES = [ ('pl', _('Polish')), ('en', _('English')), ] # Default settings BOOTSTRAP4 = { # The complete URL to the Bootstrap CSS file # Note that a URL can be either a string, # e.g. "https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css", # or a dict like the default value below. "css_url": { "href": "/static/style/bootstrap/bootstrap.min.css", # "integrity": "sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB", "crossorigin": "anonymous", }, # The complete URL to the Bootstrap JavaScript file "javascript_url": { "url": "/static/script/bootstrap/bootstrap.min.js", # "integrity": "sha384-smHYKdLADwkXOn1EmN1qk/HfnUcbVRZyYmZ4qpPea6sjB/pTJ0euyQp0Mk8ck+5T", "crossorigin": "anonymous", }, # The complete URL to the Bootstrap CSS file (None means no theme) "theme_url": None, # The URL to the jQuery JavaScript file (full) "jquery_url": { "url": "/static/script/bootstrap/jquery-3.3.1.min.js", # "integrity": "sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT", "crossorigin": "anonymous", }, # The URL to the jQuery JavaScript file (slim) "jquery_slim_url": { "url": "/static/script/bootstrap/jquery-3.3.1.slim.min.js", # "integrity": "sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo", "crossorigin": "anonymous", }, # The URL to the Popper.js JavaScript file (slim) "popper_url": { "url": "/static/script/bootstrap/popper.min.js", # "integrity": "sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49", "crossorigin": "anonymous", }, # Put JavaScript in the HEAD section of the HTML document (only relevant if you use bootstrap4.html) 'javascript_in_head': False, # Include jQuery with Bootstrap JavaScript False|falsy|slim|full (default=False) # False - means tag bootstrap_javascript use default value - `falsy` and does not include jQuery) 'include_jquery': False, # Label class to use in horizontal forms 'horizontal_label_class': 'col-md-3', # Field class to use in horizontal forms 'horizontal_field_class': 'col-md-9', # Set placeholder attributes to label if no placeholder is provided 'set_placeholder': True, # Class to indicate required (better to set this in your Django form) 'required_css_class': '', # Class to indicate error (better to set this in your Django form) 'error_css_class': 'has-error', # Class to indicate success, meaning the field has valid input (better to set this in your Django form) 'success_css_class': 'has-success', # Renderers (only set these if you have studied the source and understand the inner workings) 'formset_renderers':{ 'default': 'bootstrap4.renderers.FormsetRenderer', }, 'form_renderers': { 'default': 'bootstrap4.renderers.FormRenderer', }, 'field_renderers': { 'default': 'bootstrap4.renderers.FieldRenderer', 'inline': 'bootstrap4.renderers.InlineFieldRenderer', }, } ASGI_APPLICATION = "vectorc2.routing.application" CHANNEL_LAYERS = { 'default': { 'BACKEND': 'channels_redis.core.RedisChannelLayer', 'CONFIG': { "hosts": [('127.0.0.1', 6379)], }, }, } VECTOR = { } # #TODO # STATICFILES_FINDERS = [ # 'compressor.finders.CompressorFinder' # ] # COMPRESS_ENABLED = False # COMPRESS_ROOT = os.path.join(BASE_DIR, 'static_collected')
[((2218, 2249), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""media"""'], {}), "(BASE_DIR, 'media')\n", (2230, 2249), False, 'import os\n'), ((2169, 2201), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""static"""'], {}), "(BASE_DIR, 'static')\n", (2181, 2201), False, 'import os\n'), ((772, 797), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (787, 797), False, 'import os\n'), ((3226, 3262), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""db.sqlite3"""'], {}), "(BASE_DIR, 'db.sqlite3')\n", (3238, 3262), False, 'import os\n'), ((4186, 4197), 'django.utils.translation.gettext_lazy', '_', (['"""Polish"""'], {}), "('Polish')\n", (4187, 4197), True, 'from django.utils.translation import gettext_lazy as _\n'), ((4211, 4223), 'django.utils.translation.gettext_lazy', '_', (['"""English"""'], {}), "('English')\n", (4212, 4223), True, 'from django.utils.translation import gettext_lazy as _\n'), ((2393, 2439), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""webview"""', '"""templates"""'], {}), "(BASE_DIR, 'webview', 'templates')\n", (2405, 2439), False, 'import os\n')]
mikewoodson/ssl-transfer
datahandlers/wgisd.py
524e2d57e9ffdbf0497cd4a1404eb1f85dc9fca7
from torchvision.datasets.folder import pil_loader, accimage_loader, default_loader from torch import Tensor from pathlib import Path from enum import Enum from collections import namedtuple from torchvision import transforms as T import os import numpy as np import pdb import functools import torch.utils.data as data import torch class ConversionType(Enum): centerToVert = 1 def convert_bbox_format(boxes: Tensor, conversionType: int) -> Tensor: if conversionType > ConversionType.centerToVert.value: raise ValueError( f"conversionType must be less than" + "{ConversionType.centerToVert.value}, received {conversionType}") if conversionType == ConversionType.centerToVert.value: # convert box annotations from (Cx,Cy,W,H) to (X0,Y0,X1,Y1) box_centers = boxes[:, [0, 1, 0, 1]] box_wh = 0.5 * boxes[:, [2, 3, 2, 3]] box_wh[:, :2] *= -1 convertedBoxes = box_centers + box_wh else: raise ValueError return convertedBoxes class Wgisd(data.Dataset): """`FGVC-Aircraft <http://www.robots.ox.ac.uk/~vgg/data/fgvc-aircraft>`_ Dataset. Args: root (string): Root directory path to dataset. transform (callable, optional): A function/transform that takes in a PIL image and returns a transformed version. E.g. ``transforms.RandomCrop`` loader (callable, optional): A function to load an image given its path. download (bool, optional): If true, downloads the dataset from the internet and puts it in the root directory. If dataset is already downloaded, it is not downloaded again. """ url = 'https://github.com/thsant/wgisd.git' splits = ('train', 'test') def __init__(self, root, split='train', transform=None, loader=default_loader, download=False, val_size=0.2): if split not in self.splits: raise ValueError( 'Split "{}" not found. Valid splits are: {}'.format( split, ', '.join( self.splits), )) if val_size < 0 or val_size > 1: raise ValueError('val_size should be a fraction between 0 and 1') self.root = Path(root) self.split = split # There's no file specifying a validation dataset, so use a subset of the # training dataset dset_file = self.split self.classes_file = self.root / f'{dset_file}.txt' if download: self.download() self.transform = transform self.loader = loader self.id_to_fname = {} self.val_size = val_size self.total_set = None self.samples = None self.create_dataset() self.mode = 'test' if self.split == 'test' else 'train' @property def mode(self): return self._mode @mode.setter def mode(self, mode): if self.split == 'test': self._mode = 'test' self.partition_dset() return supported_modes = ['train', 'val', 'trainval'] if mode not in supported_modes: raise ValueError(f'mode must be one of {supported_modes}') self._mode = mode self.partition_dset() def create_dataset(self): image_names = [] samples = [] with open(self.classes_file, 'r') as f: for line in f: image_names.append(line.rstrip()) data_dir = self.root / 'data' # Read bbox annotations from file for idx, img_name in enumerate(image_names): target = {} gt_boxes = [] annotations = data_dir / f'{img_name}.txt' img_path = data_dir / f'{img_name}.jpg' with annotations.open() as f: for line in f: gt_boxes.append(line.split()[1:]) gt_np = np.array(gt_boxes, dtype=np.float32) gt_tensor = torch.as_tensor(gt_np, dtype=torch.float32) boxes = convert_bbox_format(gt_tensor, conversionType=1) img = self.loader(img_path) width, height = img.size boxes[:, [0, 2]] = boxes[:, [0, 2]] * width boxes[:, [1, 3]] = boxes[:, [1, 3]] * height boxes = boxes.to(dtype=torch.int32) numObjs = boxes.shape[0] labels = torch.ones((numObjs,), dtype=torch.int64) iscrowd = torch.zeros((numObjs,), dtype=torch.int64) image_id = torch.tensor([idx]) self.id_to_fname[image_id.item()] = img_path.parts[-1] area = (boxes[:, 3] - boxes[:, 1]) * (boxes[:, 2] - boxes[:, 0]) target['boxes'] = boxes target['labels'] = labels target['image_id'] = image_id target['area'] = area target['iscrowd'] = iscrowd samples.append((img_path, target)) self.total_set = samples def partition_dset(self): num_images = len(self.total_set) split = int(np.floor(self.val_size * num_images)) if self.mode == 'trainval': self.samples = self.total_set elif self.mode == 'train': self.samples = self.total_set[split:] elif self.mode == 'val': self.samples = self.total_set[:split] else: self.samples = self.total_set @functools.cached_property def mean(self): n_pixels = 0 pix_sum = torch.zeros([3]) for img_path, _ in self.total_set: img = self.loader(img_path) w,h = img.size im_tensor = T.ToTensor()(img) pix_sum += im_tensor.sum([1,2]) n_pixels += (w*h) pix_avg = pix_sum / n_pixels return pix_avg @functools.cached_property def stddev(self): avg = self.mean avg = avg.reshape([3, 1, 1]) var_sum = torch.zeros([3]) n_pixels = 0 for img_path, _ in self.total_set: img = self.loader(img_path) w,h = img.size im_tensor = T.ToTensor()(img) var_sum += ((im_tensor - avg)**2).sum([1,2]) n_pixels += (w*h) var = var_sum / n_pixels return torch.sqrt(var) def get_fname(self, img_id): return self.id_to_fname[img_id.item()] def __getitem__(self, index): """ Args: index (int): Index Returns: tuple: (sample, target) where target is class_index of the target class. """ path, target = self.samples[index] sample = self.loader(path) if self.transform is not None: sample, target = self.transform(sample, target) return sample, target def __len__(self): return len(self.samples) def __repr__(self): fmt_str = 'Dataset ' + self.__class__.__name__ + '\n' fmt_str += ' Number of datapoints: {}\n'.format(self.__len__()) fmt_str += ' Root Location: {}\n'.format(self.root) tmp = ' Transforms (if any): ' fmt_str += '{0}{1}\n'.format(tmp, self.transform.__repr__().replace('\n', '\n' + ' ' * len(tmp))) return fmt_str def _check_exists(self): return self.root.exists() and self.classes_file.exists() def download(self): """Download the wgisd data if it doesn't exist already.""" import requests import tarfile from git import Repo if self._check_exists(): return print('Downloading %s ... (may take a few minutes)' % self.url) self.root.mkdir() Repo.clone_from(self.url, str(self.root)) print('Done!')
[((2248, 2258), 'pathlib.Path', 'Path', (['root'], {}), '(root)\n', (2252, 2258), False, 'from pathlib import Path\n'), ((5479, 5495), 'torch.zeros', 'torch.zeros', (['[3]'], {}), '([3])\n', (5490, 5495), False, 'import torch\n'), ((5915, 5931), 'torch.zeros', 'torch.zeros', (['[3]'], {}), '([3])\n', (5926, 5931), False, 'import torch\n'), ((6240, 6255), 'torch.sqrt', 'torch.sqrt', (['var'], {}), '(var)\n', (6250, 6255), False, 'import torch\n'), ((3906, 3942), 'numpy.array', 'np.array', (['gt_boxes'], {'dtype': 'np.float32'}), '(gt_boxes, dtype=np.float32)\n', (3914, 3942), True, 'import numpy as np\n'), ((3967, 4010), 'torch.as_tensor', 'torch.as_tensor', (['gt_np'], {'dtype': 'torch.float32'}), '(gt_np, dtype=torch.float32)\n', (3982, 4010), False, 'import torch\n'), ((4390, 4431), 'torch.ones', 'torch.ones', (['(numObjs,)'], {'dtype': 'torch.int64'}), '((numObjs,), dtype=torch.int64)\n', (4400, 4431), False, 'import torch\n'), ((4454, 4496), 'torch.zeros', 'torch.zeros', (['(numObjs,)'], {'dtype': 'torch.int64'}), '((numObjs,), dtype=torch.int64)\n', (4465, 4496), False, 'import torch\n'), ((4520, 4539), 'torch.tensor', 'torch.tensor', (['[idx]'], {}), '([idx])\n', (4532, 4539), False, 'import torch\n'), ((5048, 5084), 'numpy.floor', 'np.floor', (['(self.val_size * num_images)'], {}), '(self.val_size * num_images)\n', (5056, 5084), True, 'import numpy as np\n'), ((5630, 5642), 'torchvision.transforms.ToTensor', 'T.ToTensor', ([], {}), '()\n', (5640, 5642), True, 'from torchvision import transforms as T\n'), ((6087, 6099), 'torchvision.transforms.ToTensor', 'T.ToTensor', ([], {}), '()\n', (6097, 6099), True, 'from torchvision import transforms as T\n')]
nikhilgk/SimpleCV
SimpleCV/MachineLearning/query_imgs/get_imgs_geo_gps_search.py
ee64451c16db1f40b4da221115273020a6a7b01a
#!/usr/bin/python # # So this script is in a bit of a hack state right now. # This script reads # # # # Graciously copied and modified from: # http://graphics.cs.cmu.edu/projects/im2gps/flickr_code.html #Image querying script written by Tamara Berg, #and extended heavily James Hays #9/26/2007 added dynamic timeslices to query more efficiently. #8/18/2008 added new fields and set maximum time slice. #8/19/2008 this is a much simpler function which gets ALL geotagged photos of # sufficient accuracy. No queries, no negative constraints. # divides up the query results into multiple files # 1/5/2009 # now uses date_taken instead of date_upload to get more diverse blocks of images # 1/13/2009 - uses the original im2gps keywords, not as negative constraints though import sys, string, math, time, socket from flickrapi2 import FlickrAPI from datetime import datetime import pycurl import os import shutil socket.setdefaulttimeout(30) #30 second time out on sockets before they throw #an exception. I've been having trouble with urllib.urlopen hanging in the #flickr API. This will show up as exceptions.IOError. #the time out needs to be pretty long, it seems, because the flickr servers can be slow #to respond to our big searches. #returns a query and the search times to attempt to get a desired number of photos #this needs serious refactoring -KAS def DoSearch(fapi,query_string,desired_photos): # number of seconds to skip per query #timeskip = 62899200 #two years #timeskip = 604800 #one week timeskip = 172800 #two days #timeskip = 86400 #one day #timeskip = 3600 #one hour #timeskip = 2257 #for resuming previous query #mintime = 1121832000 #from im2gps #mintime = 1167407788 # resume crash england #mintime = 1177828976 #resume crash japan #mintime = 1187753798 #resume crash greece mintime = 1171416400 #resume crash WashingtonDC maxtime = mintime+timeskip endtime = 1192165200 #10/12/2007, at the end of im2gps queries print datetime.fromtimestamp(mintime) print datetime.fromtimestamp(endtime) while (maxtime < endtime): #new approach - adjust maxtime until we get the desired number of images #within a block. We'll need to keep upper bounds and lower #lower bound is well defined (mintime), but upper bound is not. We can't #search all the way from endtime. lower_bound = mintime + 900 #lower bound OF the upper time limit. must be at least 15 minutes or zero results upper_bound = mintime + timeskip * 20 #upper bound of the upper time limit maxtime = .95 * lower_bound + .05 * upper_bound print '\nBinary search on time range upper bound' print 'Lower bound is ' + str(datetime.fromtimestamp(lower_bound)) print 'Upper bound is ' + str(datetime.fromtimestamp(upper_bound)) keep_going = 6 #search stops after a fixed number of iterations while( keep_going > 0 and maxtime < endtime): try: rsp = fapi.photos_search(api_key=flickrAPIKey, ispublic="1", media="photos", per_page="250", page="1", has_geo = "0", #bbox="-180, -90, 180, 90", text=query_string, accuracy="6", #6 is region level. min_upload_date=str(mintime), max_upload_date=str(maxtime)) #we want to catch these failures somehow and keep going. time.sleep(1) fapi.testFailure(rsp) total_images = rsp.photos[0]['total']; null_test = int(total_images); #want to make sure this won't crash later on for some reason null_test = float(total_images); print '\nnumimgs: ' + total_images print 'mintime: ' + str(mintime) + ' maxtime: ' + str(maxtime) + ' timeskip: ' + str(maxtime - mintime) if( int(total_images) > desired_photos ): print 'too many photos in block, reducing maxtime' upper_bound = maxtime maxtime = (lower_bound + maxtime) / 2 #midpoint between current value and lower bound. if( int(total_images) < desired_photos): print 'too few photos in block, increasing maxtime' lower_bound = maxtime maxtime = (upper_bound + maxtime) / 2 print 'Lower bound is ' + str(datetime.fromtimestamp(lower_bound)) print 'Upper bound is ' + str(datetime.fromtimestamp(upper_bound)) if( int(total_images) > 0): #only if we're not in a degenerate case keep_going = keep_going - 1 else: upper_bound = upper_bound + timeskip; except KeyboardInterrupt: print('Keyboard exception while querying for images, exiting\n') raise except: print sys.exc_info()[0] #print type(inst) # the exception instance #print inst.args # arguments stored in .args #print inst # __str__ allows args to printed directly print ('Exception encountered while querying for images\n') #end of while binary search print 'finished binary search' return([mintime,maxtime,total_images,rsp]) ########################################################################### # Modify this section to reflect your data and specific search ########################################################################### # flickr auth information: # change these to your flickr api keys and secret flickrAPIKey = "fa33550d413b36b3fddc473a931a3b3b" # API key flickrSecret = "7fd481bff0916055" # shared "secret" rootpath = "../data/" #where do you want the data desired_photos = 1000 #how many photos do you want to try and get query_file_name = 'query.dat' #The file to get the queries from #query_file_name = 'place_rec_queries_fall08.txt' query_file = open(query_file_name, 'r') #aggregate all of the positive and negative queries together. pos_queries = [] #an empty list neg_queries = '' #a string num_queries = 0 for line in query_file: if line[0] != '#' and len(line) > 1: #line end character is 2 long? print line[0:len(line)-1] if line[0] != '-': pos_queries = pos_queries + [line[0:len(line)-1]] num_queries = num_queries + 1 if line[0] == '-': neg_queries = neg_queries + ' ' + line[0:len(line)-1] query_file.close() print 'positive queries: ' print pos_queries print 'negative queries: ' + neg_queries print 'num_queries = ' + str(num_queries) #this is the desired number of photos in each block # make a new FlickrAPI instance fapi = FlickrAPI(flickrAPIKey, flickrSecret) for current_tag in range(0, num_queries): print('TOP OF LOOP') # change this to the location where you want to put your output file try: stats = os.stat(rootpath) except OSError: os.mkdir(rootpath) outpath = rootpath+pos_queries[current_tag]+'/' try: os.mkdir(outpath) except OSError: shutil.rmtree(outpath,True) os.mkdir(outpath) out_file = open(rootpath + pos_queries[current_tag] + '.txt','w') ########################################################################### #form the query string. query_string = pos_queries[current_tag] + ' ' + neg_queries print '\n\nquery_string is ' + query_string total_images_queried = 0; [mintime,maxtime,total_images,rsp] = DoSearch(fapi,query_string,desired_photos) print('GETTING TOTATL IMAGES:'+str(total_images)) s = '\nmintime: ' + str(mintime) + ' maxtime: ' + str(maxtime) print s out_file.write(s + '\n') i = getattr(rsp,'photos',None) if i: s = 'numimgs: ' + total_images print s out_file.write(s + '\n') current_image_num = 1; num = 4 # CHANGE THIS BACK int(rsp.photos[0]['pages']) s = 'total pages: ' + str(num) print s out_file.write(s + '\n') #only visit 16 pages max, to try and avoid the dreaded duplicate bug #16 pages = 4000 images, should be duplicate safe. Most interesting pictures will be taken. num_visit_pages = min(16,num) s = 'visiting only ' + str(num_visit_pages) + ' pages ( up to ' + str(num_visit_pages * 250) + ' images)' print s out_file.write(s + '\n') total_images_queried = total_images_queried + min((num_visit_pages * 250), int(total_images)) #print 'stopping before page ' + str(int(math.ceil(num/3) + 1)) + '\n' pagenum = 1; counter = -1 while( pagenum <= num_visit_pages ): #for pagenum in range(1, num_visit_pages + 1): #page one is searched twice print ' page number ' + str(pagenum) try: print("PAGE") print(pagenum) # WARNING THIS QUERY HAS TO MATCH THE SEARCH QUERY!!!! rsp = fapi.photos_search(api_key=flickrAPIKey, ispublic="1", media="photos", per_page="250", page=str(pagenum), has_geo = "0", text=query_string, #extras = "tags, original_format, license, geo, date_taken, date_upload, o_dims, views", #accuracy="6", #6 is region level. min_upload_date=str(1121832000),#mintime), max_upload_date=str(1192165200))#maxtime)) #rsp = fapi.photos_search(api_key=flickrAPIKey, # ispublic="1", # media="photos", # per_page="250", # page='0', #str(pagenum), # sort="interestingness-desc", # has_geo = "0", #bbox="-180, -90, 180, 90", # text=query_string, # #accuracy="6", #6 is region level. most things seem 10 or better. # extras = "tags, original_format, license, geo, date_taken, date_upload, o_dims, views", # min_upload_date=str(mintime), # max_upload_date=str(maxtime)) ##min_taken_date=str(datetime.fromtimestamp(mintime)), ##max_taken_date=str(datetime.fromtimestamp(maxtime))) time.sleep(1) fapi.testFailure(rsp) except KeyboardInterrupt: print('Keyboard exception while querying for images, exiting\n') raise except: print sys.exc_info()[0] #print type(inst) # the exception instance #print inst.args # arguments stored in .args #print inst # __str__ allows args to printed directly print ('Exception encountered while querying for images\n') else: print('got a response') # and print them k = getattr(rsp,'photos',None) if k: print('In K') m = getattr(rsp.photos[0],'photo',None) if m: print('In M') for b in rsp.photos[0].photo: print('In b') if b!=None: counter = counter + 1 ##print(http://farm{farm-id}.static.flickr.com/{server-id}/{id}_{secret}.jpg) myurl = 'http://farm'+b['farm']+".static.flickr.com/"+b['server']+"/"+b['id']+"_"+b['secret']+'.jpg' fname = outpath+pos_queries[current_tag]+str(counter)+'.jpg' #b['id']+"_"+b['secret']+'.jpg' print(myurl) print(fname) mycurl = pycurl.Curl() mycurl.setopt(pycurl.URL, str(myurl)) myfile = open(fname,"wb") mycurl.setopt(pycurl.WRITEDATA, myfile) mycurl.setopt(pycurl.FOLLOWLOCATION, 1) mycurl.setopt(pycurl.MAXREDIRS, 5) mycurl.setopt(pycurl.NOSIGNAL, 1) mycurl.perform() mycurl.close() myfile.close() out_file.write('URL: '+myurl+'\n') out_file.write('File: '+ fname+'\n') out_file.write('photo: ' + b['id'] + ' ' + b['secret'] + ' ' + b['server'] + '\n') out_file.write('owner: ' + b['owner'] + '\n') out_file.write('title: ' + b['title'].encode("ascii","replace") + '\n') out_file.write('originalsecret: ' + b['originalsecret'] + '\n') out_file.write('originalformat: ' + b['originalformat'] + '\n') out_file.write('o_height: ' + b['o_height'] + '\n') out_file.write('o_width: ' + b['o_width'] + '\n') out_file.write('datetaken: ' + b['datetaken'].encode("ascii","replace") + '\n') out_file.write('dateupload: ' + b['dateupload'].encode("ascii","replace") + '\n') out_file.write('tags: ' + b['tags'].encode("ascii","replace") + '\n') out_file.write('license: ' + b['license'].encode("ascii","replace") + '\n') out_file.write('latitude: ' + b['latitude'].encode("ascii","replace") + '\n') out_file.write('longitude: ' + b['longitude'].encode("ascii","replace") + '\n') out_file.write('accuracy: ' + b['accuracy'].encode("ascii","replace") + '\n') out_file.write('views: ' + b['views'] + '\n') out_file.write('interestingness: ' + str(current_image_num) + ' out of ' + str(total_images) + '\n'); out_file.write('\n') current_image_num = current_image_num + 1; print('') pagenum = pagenum + 1; #this is in the else exception block. Itwon't increment for a failure. #this block is indented such that it will only run if there are no exceptions #in the original query. That means if there are exceptions, mintime won't be incremented #and it will try again timeskip = maxtime - mintime #used for initializing next binary search mintime = maxtime out_file.write('Total images queried: ' + str(total_images_queried) + '\n') out_file.close
[]
quguiliang/Machine-Learning-with-Spark-Second-Edition
Chapter04/python/2.0.0/com/sparksamples/util.py
0ba131e6c15a3de97609c6cb5d976806ccc14f09
import os import sys from pyspark.sql.types import * PATH = "/home/ubuntu/work/ml-resources/spark-ml/data" SPARK_HOME = "/home/ubuntu/work/spark-2.0.0-bin-hadoop2.7/" os.environ['SPARK_HOME'] = SPARK_HOME sys.path.append(SPARK_HOME + "/python") from pyspark import SparkContext from pyspark import SparkConf from pyspark.sql import SparkSession conf = SparkConf().setAppName("First Spark App").setMaster("local") sc = SparkContext(conf=conf) spark = SparkSession(sc) def get_user_data(): custom_schema = StructType([ StructField("no", StringType(), True), StructField("age", IntegerType(), True), StructField("gender", StringType(), True), StructField("occupation", StringType(), True), StructField("zipCode", StringType(), True) ]) from pyspark.sql import SQLContext from pyspark.sql.types import * sql_context = SQLContext(sc) user_df = sql_context.read \ .format('com.databricks.spark.csv') \ .options(header='false', delimiter='|') \ .load("%s/ml-100k/u.user" % PATH, schema = custom_schema) return user_df def get_movie_data_df(): custom_schema = StructType([ StructField("no", StringType(), True), StructField("moviename", StringType(), True), StructField("date", StringType(), True), StructField("f1", StringType(), True), StructField("url", StringType(), True), StructField("f2", IntegerType(), True), StructField("f3", IntegerType(), True), StructField("f4", IntegerType(), True), StructField("f5", IntegerType(), True), StructField("f6", IntegerType(), True), StructField("f7", IntegerType(), True), StructField("f8", IntegerType(), True), StructField("f9", IntegerType(), True), StructField("f10", IntegerType(), True), StructField("f11", IntegerType(), True), StructField("f12", IntegerType(), True), StructField("f13", IntegerType(), True), StructField("f14", IntegerType(), True), StructField("f15", IntegerType(), True), StructField("f16", IntegerType(), True), StructField("f17", IntegerType(), True), StructField("f18", IntegerType(), True), StructField("f19", IntegerType(), True) ]) from pyspark.sql import SQLContext from pyspark.sql.types import * sql_context = SQLContext(sc) movie_df = sql_context.read \ .format('com.databricks.spark.csv') \ .options(header='false', delimiter='|') \ .load("%s/ml-100k/u.item" % PATH, schema = custom_schema) return movie_df def get_movie_data(): return sc.textFile("%s/ml-100k/u.item" % PATH) def get_rating_data(): return sc.textFile("%s/ml-100k/u.data" % PATH)
[((206, 245), 'sys.path.append', 'sys.path.append', (["(SPARK_HOME + '/python')"], {}), "(SPARK_HOME + '/python')\n", (221, 245), False, 'import sys\n'), ((421, 444), 'pyspark.SparkContext', 'SparkContext', ([], {'conf': 'conf'}), '(conf=conf)\n', (433, 444), False, 'from pyspark import SparkContext\n'), ((453, 469), 'pyspark.sql.SparkSession', 'SparkSession', (['sc'], {}), '(sc)\n', (465, 469), False, 'from pyspark.sql import SparkSession\n'), ((880, 894), 'pyspark.sql.SQLContext', 'SQLContext', (['sc'], {}), '(sc)\n', (890, 894), False, 'from pyspark.sql import SQLContext\n'), ((2309, 2323), 'pyspark.sql.SQLContext', 'SQLContext', (['sc'], {}), '(sc)\n', (2319, 2323), False, 'from pyspark.sql import SQLContext\n'), ((355, 366), 'pyspark.SparkConf', 'SparkConf', ([], {}), '()\n', (364, 366), False, 'from pyspark import SparkConf\n')]
Safemasks/safemasks-app
safemasks/resources/rest/router.py
44c1cf16f81b15b74fa5eb38d36eaa078180e975
""" """ from rest_framework import routers from safemasks.resources.rest.serializers import SupplierViewSet, TrustedSupplierViewSet # Routers provide an easy way of automatically determining the URL conf. ROUTER = routers.DefaultRouter() ROUTER.register(r"suppliers", SupplierViewSet, "suppliers") ROUTER.register(r"suppliers-trusted", TrustedSupplierViewSet, "suppliers-trusted")
[((217, 240), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (238, 240), False, 'from rest_framework import routers\n')]
jamesjer/zope.testrunner
src/zope/testrunner/formatter.py
af8bfec49d90613633b76e914a6f54884463ba94
############################################################################## # # Copyright (c) 2004-2008 Zope Foundation and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS # FOR A PARTICULAR PURPOSE. # ############################################################################## """Output formatting. """ from __future__ import print_function try: from collections.abc import MutableMapping except ImportError: from collections import MutableMapping from contextlib import contextmanager import doctest import os import re import sys import tempfile import traceback from datetime import datetime, timedelta from zope.testrunner.exceptions import DocTestFailureException try: unicode except NameError: unicode = str doctest_template = """ File "%s", line %s, in %s %s Want: %s Got: %s """ class OutputFormatter(object): """Test runner output formatter.""" # Implementation note: be careful about printing stuff to sys.stderr. # It is used for interprocess communication between the parent and the # child test runner, when you run some test layers in a subprocess. # resume_layer() reasigns sys.stderr for this reason, but be careful # and don't store the original one in __init__ or something. max_width = 80 def __init__(self, options): self.options = options self.last_width = 0 self.compute_max_width() progress = property(lambda self: self.options.progress) verbose = property(lambda self: self.options.verbose) in_subprocess = property( lambda self: ( self.options.resume_layer is not None and self.options.processes > 1)) def compute_max_width(self): """Try to determine the terminal width.""" # Note that doing this every time is more test friendly. self.max_width = tigetnum('cols', self.max_width) def getShortDescription(self, test, room): """Return a description of a test that fits in ``room`` characters.""" room -= 1 s = str(test) if len(s) > room: pos = s.find(" (") if pos >= 0: w = room - (pos + 5) if w < 1: # first portion (test method name) is too long s = s[:room-3] + "..." else: pre = s[:pos+2] post = s[-w:] s = "%s...%s" % (pre, post) else: w = room - 4 s = '... ' + s[-w:] return ' ' + s[:room] def info(self, message): """Print an informative message.""" print(message) def info_suboptimal(self, message): """Print an informative message about losing some of the features. For example, when you run some tests in a subprocess, you lose the ability to use the debugger. """ print(message) def error(self, message): """Report an error.""" print(message) def error_with_banner(self, message): """Report an error with a big ASCII banner.""" print() print('*'*70) self.error(message) print('*'*70) print() def profiler_stats(self, stats): """Report profiler stats.""" stats.print_stats(50) def import_errors(self, import_errors): """Report test-module import errors (if any).""" if import_errors: print("Test-module import failures:") for error in import_errors: self.print_traceback("Module: %s\n" % error.module, error.exc_info), print() def tests_with_errors(self, errors): """Report names of tests with errors (if any).""" if errors: print() print("Tests with errors:") for test, exc_info in errors: print(" ", test) def tests_with_failures(self, failures): """Report names of tests with failures (if any).""" if failures: print() print("Tests with failures:") for test, exc_info in failures: print(" ", test) def modules_with_import_problems(self, import_errors): """Report names of modules with import problems (if any).""" if import_errors: print() print("Test-modules with import problems:") for test in import_errors: print(" " + test.module) def format_seconds(self, n_seconds): """Format a time in seconds.""" if n_seconds >= 60: n_minutes, n_seconds = divmod(n_seconds, 60) return "%d minutes %.3f seconds" % (n_minutes, n_seconds) else: return "%.3f seconds" % n_seconds def format_seconds_short(self, n_seconds): """Format a time in seconds (short version).""" return "%.3f s" % n_seconds def summary(self, n_tests, n_failures, n_errors, n_seconds, n_skipped=0): """Summarize the results of a single test layer.""" print(" Ran %s tests with %s failures, %s errors and " "%s skipped in %s." % (n_tests, n_failures, n_errors, n_skipped, self.format_seconds(n_seconds))) def totals(self, n_tests, n_failures, n_errors, n_seconds, n_skipped=0): """Summarize the results of all layers.""" print("Total: %s tests, %s failures, %s errors and %s skipped in %s." % (n_tests, n_failures, n_errors, n_skipped, self.format_seconds(n_seconds))) def list_of_tests(self, tests, layer_name): """Report a list of test names.""" print("Listing %s tests:" % layer_name) for test in tests: print(' ', test) def garbage(self, garbage): """Report garbage generated by tests.""" if garbage: print("Tests generated new (%d) garbage:" % len(garbage)) print(garbage) def test_garbage(self, test, garbage): """Report garbage generated by a test.""" if garbage: print("The following test left garbage:") print(test) print(garbage) def test_threads(self, test, new_threads): """Report threads left behind by a test.""" if new_threads: print("The following test left new threads behind:") print(test) print("New thread(s):", new_threads) def refcounts(self, rc, prev): """Report a change in reference counts.""" print(" sys refcount=%-8d change=%-6d" % (rc, rc - prev)) def detailed_refcounts(self, track, rc, prev): """Report a change in reference counts, with extra detail.""" print((" sum detail refcount=%-8d" " sys refcount=%-8d" " change=%-6d" % (track.n, rc, rc - prev))) track.output() def start_set_up(self, layer_name): """Report that we're setting up a layer. The next output operation should be stop_set_up(). """ print(" Set up %s" % layer_name, end=' ') sys.stdout.flush() def stop_set_up(self, seconds): """Report that we've set up a layer. Should be called right after start_set_up(). """ print("in %s." % self.format_seconds(seconds)) def start_tear_down(self, layer_name): """Report that we're tearing down a layer. The next output operation should be stop_tear_down() or tear_down_not_supported(). """ print(" Tear down %s" % layer_name, end=' ') sys.stdout.flush() def stop_tear_down(self, seconds): """Report that we've tore down a layer. Should be called right after start_tear_down(). """ print("in %s." % self.format_seconds(seconds)) def tear_down_not_supported(self): """Report that we could not tear down a layer. Should be called right after start_tear_down(). """ print("... not supported") def start_test(self, test, tests_run, total_tests): """Report that we're about to run a test. The next output operation should be test_success(), test_error(), or test_failure(). """ self.test_width = 0 if self.progress: if self.last_width: sys.stdout.write('\r' + (' ' * self.last_width) + '\r') s = " %d/%d (%.1f%%)" % (tests_run, total_tests, tests_run * 100.0 / total_tests) sys.stdout.write(s) self.test_width += len(s) if self.verbose == 1: room = self.max_width - self.test_width - 1 s = self.getShortDescription(test, room) sys.stdout.write(s) self.test_width += len(s) elif self.verbose == 1: sys.stdout.write('.' * test.countTestCases()) elif self.in_subprocess: sys.stdout.write('.' * test.countTestCases()) # Give the parent process a new line so it sees the progress # in a timely manner. sys.stdout.write('\n') if self.verbose > 1: s = str(test) sys.stdout.write(' ') sys.stdout.write(s) self.test_width += len(s) + 1 sys.stdout.flush() def test_success(self, test, seconds): """Report that a test was successful. Should be called right after start_test(). The next output operation should be stop_test(). """ if self.verbose > 2: s = " (%s)" % self.format_seconds_short(seconds) sys.stdout.write(s) self.test_width += len(s) + 1 def test_skipped(self, test, reason): """Report that a test was skipped. Should be called right after start_test(). The next output operation should be stop_test(). """ if self.verbose > 2: s = " (skipped: %s)" % reason elif self.verbose > 1: s = " (skipped)" else: return sys.stdout.write(s) self.test_width += len(s) + 1 def test_error(self, test, seconds, exc_info, stdout=None, stderr=None): """Report that an error occurred while running a test. Should be called right after start_test(). The next output operation should be stop_test(). """ if self.verbose > 2: print(" (%s)" % self.format_seconds_short(seconds)) print() self.print_traceback("Error in test %s" % test, exc_info) self.print_std_streams(stdout, stderr) self.test_width = self.last_width = 0 def test_failure(self, test, seconds, exc_info, stdout=None, stderr=None): """Report that a test failed. Should be called right after start_test(). The next output operation should be stop_test(). """ if self.verbose > 2: print(" (%s)" % self.format_seconds_short(seconds)) print() self.print_traceback("Failure in test %s" % test, exc_info) self.print_std_streams(stdout, stderr) self.test_width = self.last_width = 0 def print_traceback(self, msg, exc_info): """Report an error with a traceback.""" print() print(msg) print(self.format_traceback(exc_info)) def print_std_streams(self, stdout, stderr): """Emit contents of buffered standard streams.""" if stdout: sys.stdout.write("Stdout:\n") sys.stdout.write(stdout) if not stdout.endswith("\n"): sys.stdout.write("\n") sys.stdout.write("\n") if stderr: sys.stderr.write("Stderr:\n") sys.stderr.write(stderr) if not stderr.endswith("\n"): sys.stderr.write("\n") sys.stderr.write("\n") def format_traceback(self, exc_info): """Format the traceback.""" v = exc_info[1] if isinstance(v, DocTestFailureException): tb = v.args[0] elif isinstance(v, doctest.DocTestFailure): tb = doctest_template % ( v.test.filename, v.test.lineno + v.example.lineno + 1, v.test.name, v.example.source, v.example.want, v.got, ) else: tb = "".join(traceback.format_exception(*exc_info)) return tb def stop_test(self, test): """Clean up the output state after a test.""" if self.progress: self.last_width = self.test_width elif self.verbose > 1: print() sys.stdout.flush() def stop_tests(self): """Clean up the output state after a collection of tests.""" if self.progress and self.last_width: sys.stdout.write('\r' + (' ' * self.last_width) + '\r') if self.verbose == 1 or self.progress: print() def tigetnum(attr, default=None): """Return a value from the terminfo database. Terminfo is used on Unix-like systems to report various terminal attributes (such as width, height or the number of supported colors). Returns ``default`` when the ``curses`` module is not available, or when sys.stdout is not a terminal. """ try: import curses except ImportError: # avoid reimporting a broken module in python 2.3 sys.modules['curses'] = None else: # If sys.stdout is not a real file object (e.g. in unit tests that # use various wrappers), you get an error, different depending on # Python version: expected_exceptions = (curses.error, TypeError, AttributeError) if sys.version_info >= (3,): import io expected_exceptions += (io.UnsupportedOperation, ) try: curses.setupterm() except expected_exceptions: # You get curses.error when $TERM is set to an unknown name pass else: try: return curses.tigetnum(attr) except expected_exceptions: # You get TypeError on PyPy3 due to a bug: # https://bitbucket.org/pypy/pypy/issue/2016/pypy3-cursestigetnum-raises-ctype pass return default def terminal_has_colors(): """Determine whether the terminal supports colors. Some terminals (e.g. the emacs built-in one) don't. """ return tigetnum('colors', -1) >= 8 class ColorfulOutputFormatter(OutputFormatter): """Output formatter that uses ANSI color codes. Like syntax highlighting in your text editor, colorizing test failures helps the developer. """ # These colors are carefully chosen to have enough contrast # on terminals with both black and white background. colorscheme = {'normal': 'normal', 'default': 'default', 'info': 'normal', 'suboptimal-behaviour': 'magenta', 'error': 'brightred', 'number': 'green', 'slow-test': 'brightmagenta', 'ok-number': 'green', 'error-number': 'brightred', 'filename': 'lightblue', 'lineno': 'lightred', 'testname': 'lightcyan', 'failed-example': 'cyan', 'expected-output': 'green', 'actual-output': 'red', 'character-diffs': 'magenta', 'diff-chunk': 'magenta', 'exception': 'red', 'skipped': 'brightyellow', } # Map prefix character to color in diff output. This handles ndiff and # udiff correctly, but not cdiff. In cdiff we ought to highlight '!' as # expected-output until we see a '-', then highlight '!' as actual-output, # until we see a '*', then switch back to highlighting '!' as # expected-output. Nevertheless, coloried cdiffs are reasonably readable, # so I'm not going to fix this. # -- mgedmin diff_color = {'-': 'expected-output', '+': 'actual-output', '?': 'character-diffs', '@': 'diff-chunk', '*': 'diff-chunk', '!': 'actual-output', } prefixes = [('dark', '0;'), ('light', '1;'), ('bright', '1;'), ('bold', '1;'), ] colorcodes = {'default': 0, 'normal': 0, 'black': 30, 'red': 31, 'green': 32, 'brown': 33, 'yellow': 33, 'blue': 34, 'magenta': 35, 'cyan': 36, 'grey': 37, 'gray': 37, 'white': 37} slow_test_threshold = 10.0 # seconds def color_code(self, color): """Convert a color description (e.g. 'lightred') to a terminal code.""" prefix_code = '' for prefix, code in self.prefixes: if color.startswith(prefix): color = color[len(prefix):] prefix_code = code break color_code = self.colorcodes[color] return '\033[%s%sm' % (prefix_code, color_code) def color(self, what): """Pick a named color from the color scheme""" return self.color_code(self.colorscheme[what]) def colorize(self, what, message, normal='normal'): """Wrap message in color.""" return self.color(what) + message + self.color(normal) def error_count_color(self, n): """Choose a color for the number of errors.""" if n: return self.color('error-number') else: return self.color('ok-number') def skip_count_color(self, n): """Choose a color for the number of skipped tests.""" if n: return self.color('skipped') else: return self.color('ok-number') def test_skipped(self, test, reason): """Report that a test was skipped. Should be called right after start_test(). The next output operation should be stop_test(). """ if self.verbose > 2: s = " (%sskipped: %s%s)" % ( self.color('skipped'), reason, self.color('info')) elif self.verbose > 1: s = " (%sskipped%s)" % ( self.color('skipped'), self.color('info')) else: return sys.stdout.write(s) self.test_width += len(s) + 1 def info(self, message): """Print an informative message.""" print(self.colorize('info', message)) def info_suboptimal(self, message): """Print an informative message about losing some of the features. For example, when you run some tests in a subprocess, you lose the ability to use the debugger. """ print(self.colorize('suboptimal-behaviour', message)) def error(self, message): """Report an error.""" print(self.colorize('error', message)) def error_with_banner(self, message): """Report an error with a big ASCII banner.""" print() print(self.colorize('error', '*'*70)) self.error(message) print(self.colorize('error', '*'*70)) print() def tear_down_not_supported(self): """Report that we could not tear down a layer. Should be called right after start_tear_down(). """ print("...", self.colorize('suboptimal-behaviour', "not supported")) def format_seconds(self, n_seconds, normal='normal'): """Format a time in seconds.""" if n_seconds >= 60: n_minutes, n_seconds = divmod(n_seconds, 60) return "%s minutes %s seconds" % ( self.colorize('number', '%d' % n_minutes, normal), self.colorize('number', '%.3f' % n_seconds, normal)) else: return "%s seconds" % ( self.colorize('number', '%.3f' % n_seconds, normal)) def format_seconds_short(self, n_seconds): """Format a time in seconds (short version).""" if n_seconds >= self.slow_test_threshold: color = 'slow-test' else: color = 'number' return self.colorize(color, "%.3f s" % n_seconds) def summary(self, n_tests, n_failures, n_errors, n_seconds, n_skipped=0): """Summarize the results.""" sys.stdout.writelines([ self.color('info'), ' Ran ', self.color('number'), str(n_tests), self.color('info'), ' tests with ', self.error_count_color(n_failures), str(n_failures), self.color('info'), ' failures, ', self.error_count_color(n_errors), str(n_errors), self.color('info'), ' errors, ', self.skip_count_color(n_skipped), str(n_skipped), self.color('info'), ' skipped in ', self.format_seconds(n_seconds, 'info'), '.', self.color('normal'), '\n', ]) def totals(self, n_tests, n_failures, n_errors, n_seconds, n_skipped=0): """Report totals (number of tests, failures, and errors).""" sys.stdout.writelines([ self.color('info'), 'Total: ', self.color('number'), str(n_tests), self.color('info'), ' tests, ', self.error_count_color(n_failures), str(n_failures), self.color('info'), ' failures, ', self.error_count_color(n_errors), str(n_errors), self.color('info'), ' errors, ', self.skip_count_color(n_skipped), str(n_skipped), self.color('info'), ' skipped in ', self.format_seconds(n_seconds, 'info'), '.', self.color('normal'), '\n']) def print_traceback(self, msg, exc_info): """Report an error with a traceback.""" print() print(self.colorize('error', msg)) v = exc_info[1] if isinstance(v, DocTestFailureException): self.print_doctest_failure(v.args[0]) elif isinstance(v, doctest.DocTestFailure): # I don't think these are ever used... -- mgedmin tb = self.format_traceback(exc_info) print(tb) else: tb = self.format_traceback(exc_info) self.print_colorized_traceback(tb) def print_doctest_failure(self, formatted_failure): """Report a doctest failure. ``formatted_failure`` is a string -- that's what DocTestSuite/DocFileSuite gives us. """ color_of_indented_text = 'normal' colorize_diff = False for line in formatted_failure.splitlines(): if line.startswith('File '): m = re.match(r'File "(.*)", line (\d*), in (.*)$', line) if m: filename, lineno, test = m.groups() sys.stdout.writelines([ self.color('normal'), 'File "', self.color('filename'), filename, self.color('normal'), '", line ', self.color('lineno'), lineno, self.color('normal'), ', in ', self.color('testname'), test, self.color('normal'), '\n']) else: print(line) elif line.startswith(' ') or line.strip() == '': if colorize_diff and len(line) > 4: color = self.diff_color.get( line[4], color_of_indented_text) print(self.colorize(color, line)) else: if line.strip() != '': print(self.colorize(color_of_indented_text, line)) else: print(line) else: colorize_diff = False if line.startswith('Failed example'): color_of_indented_text = 'failed-example' elif line.startswith('Expected:'): color_of_indented_text = 'expected-output' elif line.startswith('Got:'): color_of_indented_text = 'actual-output' elif line.startswith('Exception raised:'): color_of_indented_text = 'exception' elif line.startswith('Differences '): color_of_indented_text = 'normal' colorize_diff = True else: color_of_indented_text = 'normal' print(line) print() def print_colorized_traceback(self, formatted_traceback): """Report a test failure. ``formatted_traceback`` is a string. """ for line in formatted_traceback.splitlines(): if line.startswith(' File'): m = re.match(r' File "(.*)", line (\d*), in (.*)$', line) if m: filename, lineno, test = m.groups() sys.stdout.writelines([ self.color('normal'), ' File "', self.color('filename'), filename, self.color('normal'), '", line ', self.color('lineno'), lineno, self.color('normal'), ', in ', self.color('testname'), test, self.color('normal'), '\n']) else: print(line) elif line.startswith(' '): print(self.colorize('failed-example', line)) elif line.startswith('Traceback (most recent call last)'): print(line) else: print(self.colorize('exception', line)) print() class FakeTest(object): """A fake test object that only has an id.""" failureException = None def __init__(self, test_id): self._id = test_id def id(self): return self._id # Conditional imports: we don't want zope.testrunner to have a hard # dependency on subunit. try: import subunit from subunit.iso8601 import Utc subunit.StreamResultToBytes except (ImportError, AttributeError): subunit = None # testtools is a hard dependency of subunit itself, but we guard it # separately for richer error messages. try: import testtools from testtools.content import ( Content, ContentType, content_from_file, text_content, ) testtools.StreamToExtendedDecorator except (ImportError, AttributeError): testtools = None class _RunnableDecorator(object): """Permit controlling the runnable annotation on tests. This decorates a StreamResult, adding a setRunnable context manager to indicate whether a test is runnable. (A context manager is unidiomatic here, but it's just about the simplest way to stuff the relevant state through the various layers of decorators involved without accidentally affecting later test results.) """ def __init__(self, decorated): self.decorated = decorated self._runnable = True def __getattr__(self, name): return getattr(self.decorated, name) @contextmanager def setRunnable(self, runnable): orig_runnable = self._runnable try: self._runnable = runnable yield finally: self._runnable = orig_runnable def status(self, **kwargs): kwargs = dict(kwargs) kwargs['runnable'] = self._runnable self.decorated.status(**kwargs) class _SortedDict(MutableMapping, object): """A dict that always returns items in sorted order. This differs from collections.OrderedDict in that it returns items in *sorted* order, not in insertion order. We use this as a workaround for the fact that testtools.ExtendedToStreamDecorator doesn't sort the details dict when encoding it, which makes it difficult to write stable doctests for subunit v2 output. """ def __init__(self, items): self._dict = dict(items) def __getitem__(self, key): return self._dict[key] def __setitem__(self, key, value): self._dict[key] = value def __delitem__(self, key): del self._dict[key] def __iter__(self): return iter(sorted(self._dict)) def __len__(self): return len(self._dict) class SubunitOutputFormatter(object): """A subunit output formatter. This output formatter generates subunit-compatible output (see https://launchpad.net/subunit). Subunit output is essentially a stream of results of unit tests. In this formatter, non-test events (such as layer set up) are encoded as specially-tagged tests. In particular, for a layer 'foo', the fake tests related to layer setup and teardown are tagged with 'zope:layer' and are called 'foo:setUp' and 'foo:tearDown'. Any tests within layer 'foo' are tagged with 'zope:layer:foo'. Note that all tags specific to this formatter begin with 'zope:'. """ # subunit output is designed for computers, so displaying a progress bar # isn't helpful. progress = False verbose = property(lambda self: self.options.verbose) TAG_INFO_SUBOPTIMAL = 'zope:info_suboptimal' TAG_ERROR_WITH_BANNER = 'zope:error_with_banner' TAG_LAYER = 'zope:layer' TAG_IMPORT_ERROR = 'zope:import_error' TAG_PROFILER_STATS = 'zope:profiler_stats' TAG_GARBAGE = 'zope:garbage' TAG_THREADS = 'zope:threads' TAG_REFCOUNTS = 'zope:refcounts' def __init__(self, options, stream=None): if subunit is None: raise Exception('Requires subunit 0.0.11 or better') if testtools is None: raise Exception('Requires testtools 0.9.30 or better') self.options = options if stream is None: stream = sys.stdout self._stream = stream self._subunit = self._subunit_factory(self._stream) # Used to track the last layer that was set up or torn down. Either # None or (layer_name, last_touched_time). self._last_layer = None self.UTC = Utc() # Content types used in the output. self.TRACEBACK_CONTENT_TYPE = ContentType( 'text', 'x-traceback', {'language': 'python', 'charset': 'utf8'}) self.PROFILE_CONTENT_TYPE = ContentType( 'application', 'x-binary-profile') self.PLAIN_TEXT = ContentType('text', 'plain', {'charset': 'utf8'}) @classmethod def _subunit_factory(cls, stream): """Return a TestResult attached to the given stream.""" return _RunnableDecorator(subunit.TestProtocolClient(stream)) def _emit_timestamp(self, now=None): """Emit a timestamp to the subunit stream. If 'now' is not specified, use the current time on the system clock. """ if now is None: now = datetime.now(self.UTC) self._subunit.time(now) return now def _emit_fake_test(self, message, tag, details=None): """Emit a successful fake test to the subunit stream. Use this to print tagged informative messages. """ test = FakeTest(message) with self._subunit.setRunnable(False): self._subunit.startTest(test) self._subunit.tags([tag], []) self._subunit.addSuccess(test, details=details) self._subunit.stopTest(test) def _emit_error(self, error_id, tag, exc_info, runnable=False): """Emit an error to the subunit stream. Use this to pass on information about errors that occur outside of tests. """ test = FakeTest(error_id) with self._subunit.setRunnable(runnable): self._subunit.startTest(test) self._subunit.tags([tag], []) self._subunit.addError(test, exc_info) self._subunit.stopTest(test) def _emit_failure(self, failure_id, tag, exc_info): """Emit an failure to the subunit stream. Use this to pass on information about failures that occur outside of tests. """ test = FakeTest(failure_id) self._subunit.addFailure(test, exc_info) def _enter_layer(self, layer_name): """Tell subunit that we are entering a layer.""" self._subunit.tags(['zope:layer:%s' % (layer_name,)], []) def _exit_layer(self, layer_name): """Tell subunit that we are exiting a layer.""" self._subunit.tags([], ['zope:layer:%s' % (layer_name,)]) def info(self, message): """Print an informative message.""" # info() output is not relevant to actual test results. It only # says things like "Running tests" or "Tearing down left over # layers", things that are communicated already by the subunit # stream. Just suppress the info() output. pass def info_suboptimal(self, message): """Print an informative message about losing some of the features. For example, when you run some tests in a subprocess, you lose the ability to use the debugger. """ # Used _only_ to indicate running in a subprocess. self._emit_fake_test(message.strip(), self.TAG_INFO_SUBOPTIMAL) def error(self, message): """Report an error.""" # XXX: Mostly used for user errors, sometimes used for errors in the # test framework, sometimes used to record layer setUp failure (!!!). self._stream.write('%s\n' % (message,)) def error_with_banner(self, message): """Report an error with a big ASCII banner.""" # Either "Could not communicate with subprocess" # Or "Can't post-mortem debug when running a layer as a subprocess!" self._emit_fake_test(message, self.TAG_ERROR_WITH_BANNER) def profiler_stats(self, stats): """Report profiler stats.""" fd, filename = tempfile.mkstemp(prefix='zope.testrunner-') os.close(fd) try: stats.dump_stats(filename) profile_content = content_from_file( filename, content_type=self.PROFILE_CONTENT_TYPE) details = {'profiler-stats': profile_content} # Name the test 'zope:profiler_stats' just like its tag. self._emit_fake_test( self.TAG_PROFILER_STATS, self.TAG_PROFILER_STATS, details) finally: os.unlink(filename) def import_errors(self, import_errors): """Report test-module import errors (if any).""" if import_errors: for error in import_errors: self._emit_error( error.module, self.TAG_IMPORT_ERROR, error.exc_info, runnable=True) def tests_with_errors(self, errors): """Report names of tests with errors (if any). Simply not supported by the subunit formatter. Fancy summary output doesn't make sense. """ pass def tests_with_failures(self, failures): """Report names of tests with failures (if any). Simply not supported by the subunit formatter. Fancy summary output doesn't make sense. """ pass def modules_with_import_problems(self, import_errors): """Report names of modules with import problems (if any).""" # This is simply a summary method, and subunit output doesn't # benefit from summaries. pass def summary(self, n_tests, n_failures, n_errors, n_seconds, n_skipped=0): """Summarize the results of a single test layer. Since subunit is a stream protocol format, it has no need for a summary. When the stream is finished other tools can generate a summary if so desired. """ pass def totals(self, n_tests, n_failures, n_errors, n_seconds, n_skipped=0): """Summarize the results of all layers. Simply not supported by the subunit formatter. Fancy summary output doesn't make sense. """ pass def _emit_exists(self, test): """Emit an indication that a test exists. With the v1 protocol, we just emit a fake success line. """ self._subunit.addSuccess(test) def list_of_tests(self, tests, layer_name): """Report a list of test names.""" self._enter_layer(layer_name) for test in tests: self._subunit.startTest(test) self._emit_exists(test) self._subunit.stopTest(test) self._exit_layer(layer_name) def garbage(self, garbage): """Report garbage generated by tests.""" # XXX: Really, 'garbage', 'profiler_stats' and the 'refcounts' twins # ought to add extra details to a fake test that represents the # summary information for the whole suite. However, there's no event # on output formatters for "everything is really finished, honest". -- # jml, 2010-02-14 details = {'garbage': text_content(unicode(garbage))} self._emit_fake_test(self.TAG_GARBAGE, self.TAG_GARBAGE, details) def test_garbage(self, test, garbage): """Report garbage generated by a test. Encoded in the subunit stream as a test error. Clients can filter out these tests based on the tag if they don't think garbage should fail the test run. """ # XXX: Perhaps 'test_garbage' and 'test_threads' ought to be within # the output for the actual test, appended as details to whatever # result the test gets. Not an option with the present API, as there's # no event for "no more output for this test". -- jml, 2010-02-14 self._subunit.startTest(test) self._subunit.tags([self.TAG_GARBAGE], []) self._subunit.addError( test, details={'garbage': text_content(unicode(garbage))}) self._subunit.stopTest(test) def test_threads(self, test, new_threads): """Report threads left behind by a test. Encoded in the subunit stream as a test error. Clients can filter out these tests based on the tag if they don't think left-over threads should fail the test run. """ self._subunit.startTest(test) self._subunit.tags([self.TAG_THREADS], []) self._subunit.addError( test, details={'threads': text_content(unicode(new_threads))}) self._subunit.stopTest(test) def refcounts(self, rc, prev): """Report a change in reference counts.""" details = _SortedDict({ 'sys-refcounts': text_content(str(rc)), 'changes': text_content(str(rc - prev)), }) # XXX: Emit the details dict as JSON? self._emit_fake_test(self.TAG_REFCOUNTS, self.TAG_REFCOUNTS, details) def detailed_refcounts(self, track, rc, prev): """Report a change in reference counts, with extra detail.""" details = _SortedDict({ 'sys-refcounts': text_content(str(rc)), 'changes': text_content(str(rc - prev)), 'track': text_content(str(track.delta)), }) self._emit_fake_test(self.TAG_REFCOUNTS, self.TAG_REFCOUNTS, details) def start_set_up(self, layer_name): """Report that we're setting up a layer. We do this by emitting a fake test of the form '$LAYER_NAME:setUp' and adding a tag of the form 'zope:layer:$LAYER_NAME' to the current tag context. The next output operation should be stop_set_up(). """ test = FakeTest('%s:setUp' % (layer_name,)) now = self._emit_timestamp() with self._subunit.setRunnable(False): self._subunit.startTest(test) self._subunit.tags([self.TAG_LAYER], []) self._last_layer = (layer_name, now) def stop_set_up(self, seconds): """Report that we've set up a layer. Should be called right after start_set_up(). """ layer_name, start_time = self._last_layer self._last_layer = None test = FakeTest('%s:setUp' % (layer_name,)) self._emit_timestamp(start_time + timedelta(seconds=seconds)) with self._subunit.setRunnable(False): self._subunit.addSuccess(test) self._subunit.stopTest(test) self._enter_layer(layer_name) def layer_failure(self, failure_type, exc_info): layer_name, start_time = self._last_layer self._emit_failure( '%s:%s' % (layer_name, failure_type), self.TAG_LAYER, exc_info) def start_tear_down(self, layer_name): """Report that we're tearing down a layer. We do this by emitting a fake test of the form '$LAYER_NAME:tearDown' and removing a tag of the form 'layer:$LAYER_NAME' from the current tag context. The next output operation should be stop_tear_down() or tear_down_not_supported(). """ test = FakeTest('%s:tearDown' % (layer_name,)) self._exit_layer(layer_name) now = self._emit_timestamp() with self._subunit.setRunnable(False): self._subunit.startTest(test) self._subunit.tags([self.TAG_LAYER], []) self._last_layer = (layer_name, now) def stop_tear_down(self, seconds): """Report that we've torn down a layer. Should be called right after start_tear_down(). """ layer_name, start_time = self._last_layer self._last_layer = None test = FakeTest('%s:tearDown' % (layer_name,)) self._emit_timestamp(start_time + timedelta(seconds=seconds)) with self._subunit.setRunnable(False): self._subunit.addSuccess(test) self._subunit.stopTest(test) def tear_down_not_supported(self): """Report that we could not tear down a layer. Should be called right after start_tear_down(). """ layer_name, start_time = self._last_layer self._last_layer = None test = FakeTest('%s:tearDown' % (layer_name,)) self._emit_timestamp() with self._subunit.setRunnable(False): self._subunit.addSkip(test, 'tearDown not supported') self._subunit.stopTest(test) def start_test(self, test, tests_run, total_tests): """Report that we're about to run a test. The next output operation should be test_success(), test_error(), or test_failure(). """ self._emit_timestamp() self._subunit.startTest(test) def test_success(self, test, seconds): """Report that a test was successful. Should be called right after start_test(). The next output operation should be stop_test(). """ self._emit_timestamp() self._subunit.addSuccess(test) def test_skipped(self, test, reason): """Report that a test was skipped. Should be called right after start_test(). The next output operation should be stop_test(). """ self._subunit.addSkip(test, reason) def _exc_info_to_details(self, exc_info): """Translate 'exc_info' into a details dict usable with subunit.""" # In an ideal world, we'd use the pre-bundled 'TracebackContent' # class from testtools. However, 'OutputFormatter' contains special # logic to handle errors from doctests, so we have to use that and # manually create an object equivalent to an instance of # 'TracebackContent'. formatter = OutputFormatter(None) traceback = formatter.format_traceback(exc_info) # We have no idea if the traceback is a unicode object or a # bytestring with non-ASCII characters. We had best be careful when # handling it. if isinstance(traceback, bytes): # Assume the traceback was UTF-8-encoded, but still be careful. unicode_tb = traceback.decode('utf-8', 'replace') else: unicode_tb = traceback return _SortedDict({ 'traceback': Content( self.TRACEBACK_CONTENT_TYPE, lambda: [unicode_tb.encode('utf8')]), }) def _add_std_streams_to_details(self, details, stdout, stderr): """Add buffered standard stream contents to a subunit details dict.""" if stdout: if isinstance(stdout, bytes): stdout = stdout.decode('utf-8', 'replace') details['test-stdout'] = Content( self.PLAIN_TEXT, lambda: [stdout.encode('utf-8')]) if stderr: if isinstance(stderr, bytes): stderr = stderr.decode('utf-8', 'replace') details['test-stderr'] = Content( self.PLAIN_TEXT, lambda: [stderr.encode('utf-8')]) def test_error(self, test, seconds, exc_info, stdout=None, stderr=None): """Report that an error occurred while running a test. Should be called right after start_test(). The next output operation should be stop_test(). """ self._emit_timestamp() details = self._exc_info_to_details(exc_info) self._add_std_streams_to_details(details, stdout, stderr) self._subunit.addError(test, details=details) def test_failure(self, test, seconds, exc_info, stdout=None, stderr=None): """Report that a test failed. Should be called right after start_test(). The next output operation should be stop_test(). """ self._emit_timestamp() details = self._exc_info_to_details(exc_info) self._add_std_streams_to_details(details, stdout, stderr) self._subunit.addFailure(test, details=details) def stop_test(self, test): """Clean up the output state after a test.""" self._subunit.stopTest(test) def stop_tests(self): """Clean up the output state after a collection of tests.""" # subunit handles all of this itself. pass class SubunitV2OutputFormatter(SubunitOutputFormatter): """A subunit v2 output formatter.""" @classmethod def _subunit_factory(cls, stream): """Return a TestResult attached to the given stream.""" stream_result = _RunnableDecorator(subunit.StreamResultToBytes(stream)) result = testtools.ExtendedToStreamDecorator(stream_result) # Lift our decorating method up so that we can get at it easily. result.setRunnable = stream_result.setRunnable result.startTestRun() return result def error(self, message): """Report an error.""" # XXX: Mostly used for user errors, sometimes used for errors in the # test framework, sometimes used to record layer setUp failure (!!!). self._subunit.status( file_name='error', file_bytes=unicode(message).encode('utf-8'), eof=True, mime_type=repr(self.PLAIN_TEXT)) def _emit_exists(self, test): """Emit an indication that a test exists.""" now = datetime.now(self.UTC) self._subunit.status( test_id=test.id(), test_status='exists', test_tags=self._subunit.current_tags, timestamp=now)
[((7533, 7551), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (7549, 7551), False, 'import sys\n'), ((8024, 8042), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (8040, 8042), False, 'import sys\n'), ((9768, 9786), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (9784, 9786), False, 'import sys\n'), ((10543, 10562), 'sys.stdout.write', 'sys.stdout.write', (['s'], {}), '(s)\n', (10559, 10562), False, 'import sys\n'), ((13162, 13180), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (13178, 13180), False, 'import sys\n'), ((19053, 19072), 'sys.stdout.write', 'sys.stdout.write', (['s'], {}), '(s)\n', (19069, 19072), False, 'import sys\n'), ((30866, 30871), 'subunit.iso8601.Utc', 'Utc', ([], {}), '()\n', (30869, 30871), False, 'from subunit.iso8601 import Utc\n'), ((30954, 31031), 'testtools.content.ContentType', 'ContentType', (['"""text"""', '"""x-traceback"""', "{'language': 'python', 'charset': 'utf8'}"], {}), "('text', 'x-traceback', {'language': 'python', 'charset': 'utf8'})\n", (30965, 31031), False, 'from testtools.content import Content, ContentType, content_from_file, text_content\n'), ((31081, 31127), 'testtools.content.ContentType', 'ContentType', (['"""application"""', '"""x-binary-profile"""'], {}), "('application', 'x-binary-profile')\n", (31092, 31127), False, 'from testtools.content import Content, ContentType, content_from_file, text_content\n'), ((31167, 31216), 'testtools.content.ContentType', 'ContentType', (['"""text"""', '"""plain"""', "{'charset': 'utf8'}"], {}), "('text', 'plain', {'charset': 'utf8'})\n", (31178, 31216), False, 'from testtools.content import Content, ContentType, content_from_file, text_content\n'), ((34651, 34694), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {'prefix': '"""zope.testrunner-"""'}), "(prefix='zope.testrunner-')\n", (34667, 34694), False, 'import tempfile\n'), ((34703, 34715), 'os.close', 'os.close', (['fd'], {}), '(fd)\n', (34711, 34715), False, 'import os\n'), ((47043, 47093), 'testtools.ExtendedToStreamDecorator', 'testtools.ExtendedToStreamDecorator', (['stream_result'], {}), '(stream_result)\n', (47078, 47093), False, 'import testtools\n'), ((47754, 47776), 'datetime.datetime.now', 'datetime.now', (['self.UTC'], {}), '(self.UTC)\n', (47766, 47776), False, 'from datetime import datetime, timedelta\n'), ((8983, 9002), 'sys.stdout.write', 'sys.stdout.write', (['s'], {}), '(s)\n', (8999, 9002), False, 'import sys\n'), ((9663, 9684), 'sys.stdout.write', 'sys.stdout.write', (['""" """'], {}), "(' ')\n", (9679, 9684), False, 'import sys\n'), ((9697, 9716), 'sys.stdout.write', 'sys.stdout.write', (['s'], {}), '(s)\n', (9713, 9716), False, 'import sys\n'), ((10101, 10120), 'sys.stdout.write', 'sys.stdout.write', (['s'], {}), '(s)\n', (10117, 10120), False, 'import sys\n'), ((11958, 11987), 'sys.stdout.write', 'sys.stdout.write', (['"""Stdout:\n"""'], {}), "('Stdout:\\n')\n", (11974, 11987), False, 'import sys\n'), ((12000, 12024), 'sys.stdout.write', 'sys.stdout.write', (['stdout'], {}), '(stdout)\n', (12016, 12024), False, 'import sys\n'), ((12118, 12140), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (12134, 12140), False, 'import sys\n'), ((12172, 12201), 'sys.stderr.write', 'sys.stderr.write', (['"""Stderr:\n"""'], {}), "('Stderr:\\n')\n", (12188, 12201), False, 'import sys\n'), ((12214, 12238), 'sys.stderr.write', 'sys.stderr.write', (['stderr'], {}), '(stderr)\n', (12230, 12238), False, 'import sys\n'), ((12332, 12354), 'sys.stderr.write', 'sys.stderr.write', (['"""\n"""'], {}), "('\\n')\n", (12348, 12354), False, 'import sys\n'), ((13335, 13388), 'sys.stdout.write', 'sys.stdout.write', (["('\\r' + ' ' * self.last_width + '\\r')"], {}), "('\\r' + ' ' * self.last_width + '\\r')\n", (13351, 13388), False, 'import sys\n'), ((14362, 14380), 'curses.setupterm', 'curses.setupterm', ([], {}), '()\n', (14378, 14380), False, 'import curses\n'), ((31372, 31406), 'subunit.TestProtocolClient', 'subunit.TestProtocolClient', (['stream'], {}), '(stream)\n', (31398, 31406), False, 'import subunit\n'), ((31633, 31655), 'datetime.datetime.now', 'datetime.now', (['self.UTC'], {}), '(self.UTC)\n', (31645, 31655), False, 'from datetime import datetime, timedelta\n'), ((34798, 34865), 'testtools.content.content_from_file', 'content_from_file', (['filename'], {'content_type': 'self.PROFILE_CONTENT_TYPE'}), '(filename, content_type=self.PROFILE_CONTENT_TYPE)\n', (34815, 34865), False, 'from testtools.content import Content, ContentType, content_from_file, text_content\n'), ((35148, 35167), 'os.unlink', 'os.unlink', (['filename'], {}), '(filename)\n', (35157, 35167), False, 'import os\n'), ((44659, 44695), 'traceback.decode', 'traceback.decode', (['"""utf-8"""', '"""replace"""'], {}), "('utf-8', 'replace')\n", (44675, 44695), False, 'import traceback\n'), ((46989, 47024), 'subunit.StreamResultToBytes', 'subunit.StreamResultToBytes', (['stream'], {}), '(stream)\n', (47016, 47024), False, 'import subunit\n'), ((8777, 8830), 'sys.stdout.write', 'sys.stdout.write', (["('\\r' + ' ' * self.last_width + '\\r')"], {}), "('\\r' + ' ' * self.last_width + '\\r')\n", (8793, 8830), False, 'import sys\n'), ((9208, 9227), 'sys.stdout.write', 'sys.stdout.write', (['s'], {}), '(s)\n', (9224, 9227), False, 'import sys\n'), ((12083, 12105), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (12099, 12105), False, 'import sys\n'), ((12297, 12319), 'sys.stderr.write', 'sys.stderr.write', (['"""\n"""'], {}), "('\\n')\n", (12313, 12319), False, 'import sys\n'), ((14560, 14581), 'curses.tigetnum', 'curses.tigetnum', (['attr'], {}), '(attr)\n', (14575, 14581), False, 'import curses\n'), ((23395, 23447), 're.match', 're.match', (['"""File "(.*)", line (\\\\d*), in (.*)$"""', 'line'], {}), '(\'File "(.*)", line (\\\\d*), in (.*)$\', line)\n', (23403, 23447), False, 'import re\n'), ((25539, 25593), 're.match', 're.match', (['""" File "(.*)", line (\\\\d*), in (.*)$"""', 'line'], {}), '(\' File "(.*)", line (\\\\d*), in (.*)$\', line)\n', (25547, 25593), False, 'import re\n'), ((40897, 40923), 'datetime.timedelta', 'timedelta', ([], {'seconds': 'seconds'}), '(seconds=seconds)\n', (40906, 40923), False, 'from datetime import datetime, timedelta\n'), ((42337, 42363), 'datetime.timedelta', 'timedelta', ([], {'seconds': 'seconds'}), '(seconds=seconds)\n', (42346, 42363), False, 'from datetime import datetime, timedelta\n'), ((9572, 9594), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (9588, 9594), False, 'import sys\n'), ((12888, 12925), 'traceback.format_exception', 'traceback.format_exception', (['*exc_info'], {}), '(*exc_info)\n', (12914, 12925), False, 'import traceback\n')]
csisarep/groundwater_dashboard
waterApp/migrations/0011_auto_20210911_1043.py
4f93d7b7c9fd6b48ace54e7b62cae717decc98d2
# Generated by Django 2.2 on 2021-09-11 04:58 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('waterApp', '0010_auto_20210911_1041'), ] operations = [ migrations.AlterField( model_name='gwmonitoring', name='id', field=models.BigAutoField(primary_key=True, serialize=False), ), ]
[((337, 391), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (356, 391), False, 'from django.db import migrations, models\n')]
shubhamtalbar96/geomstats
geomstats/geometry/stratified/__init__.py
9c17ccede7e3f0fddf31487c59227c677216a2b9
"""The Stratified Space Geometry Package."""
[]
xmdy/h9eNi8F5Ut
src/exporter/management/commands/test_export.py
4128d7cbc6105ec0fe69157bd88ef8e30415d6ca
from django.core.management import BaseCommand import logging # These two lines enable debugging at httplib level (requests->urllib3->http.client) # You will see the REQUEST, including HEADERS and DATA, and RESPONSE with HEADERS but without DATA. # The only thing missing will be the response.body which is not logged. try: import http.client as http_client except ImportError: # Python 2 import httplib as http_client http_client.HTTPConnection.debuglevel = 1 # You must initialize logging, otherwise you'll not see debug output. logging.basicConfig() logging.getLogger().setLevel(logging.DEBUG) requests_log = logging.getLogger("requests.packages.urllib3") requests_log.setLevel(logging.DEBUG) requests_log.propagate = True class Command(BaseCommand): def handle(self, *args, **options): from exporter.tasks import GenerateModelExportTask gmet = GenerateModelExportTask() gmet.run(1)
[((545, 566), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (564, 566), False, 'import logging\n'), ((626, 672), 'logging.getLogger', 'logging.getLogger', (['"""requests.packages.urllib3"""'], {}), "('requests.packages.urllib3')\n", (643, 672), False, 'import logging\n'), ((567, 586), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (584, 586), False, 'import logging\n'), ((883, 908), 'exporter.tasks.GenerateModelExportTask', 'GenerateModelExportTask', ([], {}), '()\n', (906, 908), False, 'from exporter.tasks import GenerateModelExportTask\n')]
ianthomas23/dask
dask/tests/test_highgraph.py
7968e85e2edab95565ebbab1f936c9c549e29126
from functools import partial import os import pytest import dask import dask.array as da from dask.utils_test import inc from dask.highlevelgraph import HighLevelGraph, BasicLayer, Layer from dask.blockwise import Blockwise from dask.array.utils import assert_eq def test_visualize(tmpdir): pytest.importorskip("graphviz") fn = str(tmpdir) a = da.ones(10, chunks=(5,)) b = a + 1 c = a + 2 d = b + c d.dask.visualize(fn) assert os.path.exists(fn) def test_basic(): a = {"x": 1} b = {"y": (inc, "x")} layers = {"a": a, "b": b} dependencies = {"a": set(), "b": {"a"}} hg = HighLevelGraph(layers, dependencies) assert dict(hg) == {"x": 1, "y": (inc, "x")} assert all(isinstance(layer, Layer) for layer in hg.layers.values()) def test_keys_values_items_methods(): a = da.ones(10, chunks=(5,)) b = a + 1 c = a + 2 d = b + c hg = d.dask keys, values, items = hg.keys(), hg.values(), hg.items() assert all(isinstance(i, list) for i in [keys, values, items]) assert keys == [i for i in hg] assert values == [hg[i] for i in hg] assert items == [(k, v) for k, v in zip(keys, values)] def test_cull(): a = {"x": 1, "y": (inc, "x")} layers = { "a": BasicLayer( a, dependencies={"x": set(), "y": {"x"}}, global_dependencies=set() ) } dependencies = {"a": set()} hg = HighLevelGraph(layers, dependencies) culled_by_x = hg.cull({"x"}) assert dict(culled_by_x) == {"x": 1} culled_by_y = hg.cull({"y"}) assert dict(culled_by_y) == a @pytest.mark.parametrize("inject_dict", [True, False]) def test_map_basic_layers(inject_dict): """Check map_basic_layers() by injecting an inc() call""" y = da.ones(3, chunks=(3,), dtype="int") + 40 def inject_inc(dsk): assert isinstance(dsk, BasicLayer) dsk = dict(dsk) k = next(iter(dsk)) dsk[k] = (inc, dsk[k]) if inject_dict: return dsk # map_basic_layers() should automatically convert it to a `BasicLayer` else: return BasicLayer(dsk) dsk = y.__dask_graph__() y.dask = dsk.map_basic_layers(inject_inc) layers = list(y.dask.layers.values()) assert isinstance(layers[0], BasicLayer) assert isinstance(layers[1], Blockwise) assert_eq(y, [42] * 3) @pytest.mark.parametrize("use_layer_map_task", [True, False]) def test_map_tasks(use_layer_map_task): """Check map_tasks() by injecting an +1 to the `40` literal""" y = da.ones(3, chunks=(3,), dtype="int") + 40 def plus_one(tasks): ret = [] for t in tasks: if t == 40: t += 1 ret.append(t) return tuple(ret) dsk = y.__dask_graph__() if use_layer_map_task: # In order to test the default map_tasks() implementation on a Blockwise Layer, # we overwrite Blockwise.map_tasks with Layer.map_tasks blockwise_layer = list(dsk.layers.values())[1] blockwise_layer.map_tasks = partial(Layer.map_tasks, blockwise_layer) y.dask = dsk.map_tasks(plus_one) assert_eq(y, [42] * 3) def annot_map_fn(key): return key[1:] @pytest.mark.parametrize( "annotation", [ {"worker": "alice"}, {"block_id": annot_map_fn}, ], ) def test_single_annotation(annotation): with dask.annotate(**annotation): A = da.ones((10, 10), chunks=(5, 5)) alayer = A.__dask_graph__().layers[A.name] assert alayer.annotations == annotation assert dask.config.get("annotations", None) is None def test_multiple_annotations(): with dask.annotate(block_id=annot_map_fn): with dask.annotate(resource="GPU"): A = da.ones((10, 10), chunks=(5, 5)) B = A + 1 C = B + 1 assert dask.config.get("annotations", None) is None alayer = A.__dask_graph__().layers[A.name] blayer = B.__dask_graph__().layers[B.name] clayer = C.__dask_graph__().layers[C.name] assert alayer.annotations == {"resource": "GPU", "block_id": annot_map_fn} assert blayer.annotations == {"block_id": annot_map_fn} assert clayer.annotations is None
[((1597, 1650), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""inject_dict"""', '[True, False]'], {}), "('inject_dict', [True, False])\n", (1620, 1650), False, 'import pytest\n'), ((2361, 2421), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""use_layer_map_task"""', '[True, False]'], {}), "('use_layer_map_task', [True, False])\n", (2384, 2421), False, 'import pytest\n'), ((3200, 3292), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""annotation"""', "[{'worker': 'alice'}, {'block_id': annot_map_fn}]"], {}), "('annotation', [{'worker': 'alice'}, {'block_id':\n annot_map_fn}])\n", (3223, 3292), False, 'import pytest\n'), ((300, 331), 'pytest.importorskip', 'pytest.importorskip', (['"""graphviz"""'], {}), "('graphviz')\n", (319, 331), False, 'import pytest\n'), ((361, 385), 'dask.array.ones', 'da.ones', (['(10)'], {'chunks': '(5,)'}), '(10, chunks=(5,))\n', (368, 385), True, 'import dask.array as da\n'), ((464, 482), 'os.path.exists', 'os.path.exists', (['fn'], {}), '(fn)\n', (478, 482), False, 'import os\n'), ((629, 665), 'dask.highlevelgraph.HighLevelGraph', 'HighLevelGraph', (['layers', 'dependencies'], {}), '(layers, dependencies)\n', (643, 665), False, 'from dask.highlevelgraph import HighLevelGraph, BasicLayer, Layer\n'), ((837, 861), 'dask.array.ones', 'da.ones', (['(10)'], {'chunks': '(5,)'}), '(10, chunks=(5,))\n', (844, 861), True, 'import dask.array as da\n'), ((1414, 1450), 'dask.highlevelgraph.HighLevelGraph', 'HighLevelGraph', (['layers', 'dependencies'], {}), '(layers, dependencies)\n', (1428, 1450), False, 'from dask.highlevelgraph import HighLevelGraph, BasicLayer, Layer\n'), ((2335, 2357), 'dask.array.utils.assert_eq', 'assert_eq', (['y', '([42] * 3)'], {}), '(y, [42] * 3)\n', (2344, 2357), False, 'from dask.array.utils import assert_eq\n'), ((3130, 3152), 'dask.array.utils.assert_eq', 'assert_eq', (['y', '([42] * 3)'], {}), '(y, [42] * 3)\n', (3139, 3152), False, 'from dask.array.utils import assert_eq\n'), ((1762, 1798), 'dask.array.ones', 'da.ones', (['(3)'], {'chunks': '(3,)', 'dtype': '"""int"""'}), "(3, chunks=(3,), dtype='int')\n", (1769, 1798), True, 'import dask.array as da\n'), ((2537, 2573), 'dask.array.ones', 'da.ones', (['(3)'], {'chunks': '(3,)', 'dtype': '"""int"""'}), "(3, chunks=(3,), dtype='int')\n", (2544, 2573), True, 'import dask.array as da\n'), ((3046, 3087), 'functools.partial', 'partial', (['Layer.map_tasks', 'blockwise_layer'], {}), '(Layer.map_tasks, blockwise_layer)\n', (3053, 3087), False, 'from functools import partial\n'), ((3372, 3399), 'dask.annotate', 'dask.annotate', ([], {}), '(**annotation)\n', (3385, 3399), False, 'import dask\n'), ((3413, 3445), 'dask.array.ones', 'da.ones', (['(10, 10)'], {'chunks': '(5, 5)'}), '((10, 10), chunks=(5, 5))\n', (3420, 3445), True, 'import dask.array as da\n'), ((3549, 3585), 'dask.config.get', 'dask.config.get', (['"""annotations"""', 'None'], {}), "('annotations', None)\n", (3564, 3585), False, 'import dask\n'), ((3638, 3674), 'dask.annotate', 'dask.annotate', ([], {'block_id': 'annot_map_fn'}), '(block_id=annot_map_fn)\n', (3651, 3674), False, 'import dask\n'), ((3815, 3851), 'dask.config.get', 'dask.config.get', (['"""annotations"""', 'None'], {}), "('annotations', None)\n", (3830, 3851), False, 'import dask\n'), ((2108, 2123), 'dask.highlevelgraph.BasicLayer', 'BasicLayer', (['dsk'], {}), '(dsk)\n', (2118, 2123), False, 'from dask.highlevelgraph import HighLevelGraph, BasicLayer, Layer\n'), ((3689, 3718), 'dask.annotate', 'dask.annotate', ([], {'resource': '"""GPU"""'}), "(resource='GPU')\n", (3702, 3718), False, 'import dask\n'), ((3736, 3768), 'dask.array.ones', 'da.ones', (['(10, 10)'], {'chunks': '(5, 5)'}), '((10, 10), chunks=(5, 5))\n', (3743, 3768), True, 'import dask.array as da\n')]
webpwnized/cryptography
transference.py
52660c14aa71afe087cf380bb1e9d067fa639bc6
# Requires pip install bitarray from bitarray import bitarray import argparse, math def derive_transfer_function(pTransferFunctionString: str) -> list: lTransferFunction = list(map(int, pTransferFunctionString.split(','))) lTransferFunctionValid = True lLengthTransferFunction = len(lTransferFunction) for i in range(0, lLengthTransferFunction): if i not in lTransferFunction: lTransferFunctionValid = False break # end if # end for if not lTransferFunctionValid: raise Exception('Transfer function must contain all integers from 0 to N where (N - 1) is length of the substitution array.') lExponent = math.log(lLengthTransferFunction, 2) if lExponent != math.floor(lExponent): raise Exception('Transfer function length must be even power of 2.') return lTransferFunction def print_transfer_function_table(pTransferFunction: list) -> None: lLengthTransferFunction = len(pTransferFunction) lNumberBits = int(math.log(lLengthTransferFunction, 2)) lFormat = '0' + str(lNumberBits) + 'b' # print column headers print() for i in range(0, lNumberBits): print("x=" + str(i) + "\t", end="") for i in range(0, lNumberBits): print("y=" + str(i) + "\t", end="") print() # print values for transfer function for lIndex, lSubstitutionValue in enumerate(pTransferFunction): lBinaryIndex = bitarray(format(lIndex, lFormat)) lBinarySV = bitarray(format(lSubstitutionValue, lFormat)) for i in range(0, lNumberBits): print(int(lBinaryIndex[i]), end="") print("\t", end="") for i in range(0, lNumberBits): print(int(lBinarySV[i]), end="") print("\t", end="") print() print() def print_linear_approximation_table(pTransferFunction: list) -> None: lLengthTransferFunction = len(pTransferFunction) lNumberBits = int(math.log(lLengthTransferFunction, 2)) lFormat = '0' + str(lNumberBits) + 'b' # print column headers print("\t", end="") for i in range(0, lLengthTransferFunction): print("b=" + str(i) + "\t", end="") print() for lA in range(0, lLengthTransferFunction): # print row header print("a=" + str(lA) + "\t", end="") for lB in range(0, lLengthTransferFunction): a = bitarray(format(lA, lFormat)) b = bitarray(format(lB, lFormat)) lCount = 0 for lX, lY in enumerate(pTransferFunction): x = bitarray(format(lX, lFormat)) y = bitarray(format(lY, lFormat)) lVectorXorOfAX = 0 for i in range(0, lNumberBits): lVectorXorOfAX ^= int(a[i]) * int(x[i]) lVectorXorOfBY = 0 for i in range(0, lNumberBits): lVectorXorOfBY ^= int(b[i]) * int(y[i]) lAXxorBY = lVectorXorOfAX ^ lVectorXorOfBY if lAXxorBY == 0: lCount += 1 # end looping through transfer function print(str(lCount) + "\t", end="") # end for b print() # end for a if __name__ == '__main__': lArgParser = argparse.ArgumentParser(description='Transference: A tool to help visualize s-boxes (substitution boxes or transfer functions)') lArgParser.add_argument('-tft', '--transfer-function-table', help='Print the transfer function table for the s-box', action='store_true') lArgParser.add_argument('-lat', '--linear-approximation-table', help='Calculate the linear transformation table for the s-box', action='store_true') lArgParser.add_argument('-all', '--all', help='Calculate the linear transformation table for the s-box', action='store_true') lArgParser.add_argument('-v', '--verbose', help='Enables verbose output', action='store_true') lArgParser.add_argument('INPUT', action='store', type=str, help='The substitution table (s-box) represented as a comma delimted list of integers. The length of the list is the number of bits in the substitution. Required. Example: 3,2,0,1 means substitute 3 for 0, 2 for 1, 0 for 2 and 1 for 3. ') lArgs = lArgParser.parse_args() lTransferFunction = derive_transfer_function(lArgs.INPUT) if lArgs.all: lArgs.transfer_function_table = lArgs.linear_approximation_table = True if lArgs.transfer_function_table: print_transfer_function_table(lTransferFunction) if lArgs.linear_approximation_table: print_linear_approximation_table(lTransferFunction)
[((683, 719), 'math.log', 'math.log', (['lLengthTransferFunction', '(2)'], {}), '(lLengthTransferFunction, 2)\n', (691, 719), False, 'import argparse, math\n'), ((3259, 3397), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Transference: A tool to help visualize s-boxes (substitution boxes or transfer functions)"""'}), "(description=\n 'Transference: A tool to help visualize s-boxes (substitution boxes or transfer functions)'\n )\n", (3282, 3397), False, 'import argparse, math\n'), ((740, 761), 'math.floor', 'math.floor', (['lExponent'], {}), '(lExponent)\n', (750, 761), False, 'import argparse, math\n'), ((1016, 1052), 'math.log', 'math.log', (['lLengthTransferFunction', '(2)'], {}), '(lLengthTransferFunction, 2)\n', (1024, 1052), False, 'import argparse, math\n'), ((1958, 1994), 'math.log', 'math.log', (['lLengthTransferFunction', '(2)'], {}), '(lLengthTransferFunction, 2)\n', (1966, 1994), False, 'import argparse, math\n')]
mjcaley/spamc
tests/test_client.py
67c4f2b13d569238ea24794eb5253a1416226a2a
import pytest from aiospamc.client import Client from aiospamc.exceptions import ( BadResponse, UsageException, DataErrorException, NoInputException, NoUserException, NoHostException, UnavailableException, InternalSoftwareException, OSErrorException, OSFileException, CantCreateException, IOErrorException, TemporaryFailureException, ProtocolException, NoPermissionException, ConfigException, ServerTimeoutException, ResponseException, ) from aiospamc.responses import Response async def test_request_sent_to_connection(mock_client_dependency, mocker, hostname): mock_req = mocker.MagicMock() await mock_client_dependency.request(mock_req, host=hostname) assert ( bytes(mock_req) == mock_client_dependency.connection_factory().request.await_args[0][0] ) async def test_request_response_sent_to_parser( mock_client_dependency, mocker, hostname ): mock_req = mocker.MagicMock() connection = mock_client_dependency.connection_factory() parser = mock_client_dependency.parser_factory() mocker.spy(parser, "parse") await mock_client_dependency.request(mock_req, host=hostname) response = connection.request.return_value assert response == parser.parse.call_args[0][0] async def test_request_returns_response(mock_client_dependency, mocker, hostname): mock_req = mocker.MagicMock() connection = mock_client_dependency.connection_factory() parser = mock_client_dependency.parser_factory() parse_spy = mocker.spy(parser, "parse") result = await mock_client_dependency.request(mock_req, host=hostname) expected = Response(**parse_spy.spy_return) assert expected == result async def test_request_raises_usage(mock_client_response, mocker, ex_usage, hostname): mock_client = mock_client_response(ex_usage) with pytest.raises(UsageException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_data_err( mock_client_response, mocker, ex_data_err, hostname ): mock_client = mock_client_response(ex_data_err) with pytest.raises(DataErrorException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_no_input( mock_client_response, mocker, ex_no_input, hostname ): mock_client = mock_client_response(ex_no_input) with pytest.raises(NoInputException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_no_user( mock_client_response, mocker, ex_no_user, hostname ): mock_client = mock_client_response(ex_no_user) with pytest.raises(NoUserException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_no_host( mock_client_response, mocker, ex_no_host, hostname ): mock_client = mock_client_response(ex_no_host) with pytest.raises(NoHostException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_unavailable( mock_client_response, mocker, ex_unavailable, hostname ): mock_client = mock_client_response(ex_unavailable) with pytest.raises(UnavailableException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_software( mock_client_response, mocker, ex_software, hostname ): mock_client = mock_client_response(ex_software) with pytest.raises(InternalSoftwareException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_os_error( mock_client_response, mocker, ex_os_err, hostname ): mock_client = mock_client_response(ex_os_err) with pytest.raises(OSErrorException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_os_file( mock_client_response, mocker, ex_os_file, hostname ): mock_client = mock_client_response(ex_os_file) with pytest.raises(OSFileException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_cant_create( mock_client_response, mocker, ex_cant_create, hostname ): mock_client = mock_client_response(ex_cant_create) with pytest.raises(CantCreateException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_io_error( mock_client_response, mocker, ex_io_err, hostname ): mock_client = mock_client_response(ex_io_err) with pytest.raises(IOErrorException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_temporary_failure( mock_client_response, mocker, ex_temp_fail, hostname ): mock_client = mock_client_response(ex_temp_fail) with pytest.raises(TemporaryFailureException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_protocol( mock_client_response, mocker, ex_protocol, hostname ): mock_client = mock_client_response(ex_protocol) with pytest.raises(ProtocolException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_no_permission( mock_client_response, mocker, ex_no_perm, hostname ): mock_client = mock_client_response(ex_no_perm) with pytest.raises(NoPermissionException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_config(mock_client_response, mocker, ex_config, hostname): mock_client = mock_client_response(ex_config) with pytest.raises(ConfigException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_timeout( mock_client_response, mocker, ex_timeout, hostname ): mock_client = mock_client_response(ex_timeout) with pytest.raises(ServerTimeoutException): await mock_client.request(mocker.MagicMock(), host=hostname) async def test_request_raises_undefined( mock_client_response, mocker, ex_undefined, hostname ): mock_client = mock_client_response(ex_undefined) with pytest.raises(ResponseException): await mock_client.request(mocker.MagicMock(), host=hostname)
[((1673, 1705), 'aiospamc.responses.Response', 'Response', ([], {}), '(**parse_spy.spy_return)\n', (1681, 1705), False, 'from aiospamc.responses import Response\n'), ((1885, 1914), 'pytest.raises', 'pytest.raises', (['UsageException'], {}), '(UsageException)\n', (1898, 1914), False, 'import pytest\n'), ((2148, 2181), 'pytest.raises', 'pytest.raises', (['DataErrorException'], {}), '(DataErrorException)\n', (2161, 2181), False, 'import pytest\n'), ((2415, 2446), 'pytest.raises', 'pytest.raises', (['NoInputException'], {}), '(NoInputException)\n', (2428, 2446), False, 'import pytest\n'), ((2677, 2707), 'pytest.raises', 'pytest.raises', (['NoUserException'], {}), '(NoUserException)\n', (2690, 2707), False, 'import pytest\n'), ((2938, 2968), 'pytest.raises', 'pytest.raises', (['NoHostException'], {}), '(NoHostException)\n', (2951, 2968), False, 'import pytest\n'), ((3211, 3246), 'pytest.raises', 'pytest.raises', (['UnavailableException'], {}), '(UnavailableException)\n', (3224, 3246), False, 'import pytest\n'), ((3480, 3520), 'pytest.raises', 'pytest.raises', (['InternalSoftwareException'], {}), '(InternalSoftwareException)\n', (3493, 3520), False, 'import pytest\n'), ((3750, 3781), 'pytest.raises', 'pytest.raises', (['OSErrorException'], {}), '(OSErrorException)\n', (3763, 3781), False, 'import pytest\n'), ((4012, 4042), 'pytest.raises', 'pytest.raises', (['OSFileException'], {}), '(OSFileException)\n', (4025, 4042), False, 'import pytest\n'), ((4285, 4319), 'pytest.raises', 'pytest.raises', (['CantCreateException'], {}), '(CantCreateException)\n', (4298, 4319), False, 'import pytest\n'), ((4549, 4580), 'pytest.raises', 'pytest.raises', (['IOErrorException'], {}), '(IOErrorException)\n', (4562, 4580), False, 'import pytest\n'), ((4825, 4865), 'pytest.raises', 'pytest.raises', (['TemporaryFailureException'], {}), '(TemporaryFailureException)\n', (4838, 4865), False, 'import pytest\n'), ((5099, 5131), 'pytest.raises', 'pytest.raises', (['ProtocolException'], {}), '(ProtocolException)\n', (5112, 5131), False, 'import pytest\n'), ((5368, 5404), 'pytest.raises', 'pytest.raises', (['NoPermissionException'], {}), '(NoPermissionException)\n', (5381, 5404), False, 'import pytest\n'), ((5626, 5656), 'pytest.raises', 'pytest.raises', (['ConfigException'], {}), '(ConfigException)\n', (5639, 5656), False, 'import pytest\n'), ((5887, 5924), 'pytest.raises', 'pytest.raises', (['ServerTimeoutException'], {}), '(ServerTimeoutException)\n', (5900, 5924), False, 'import pytest\n'), ((6161, 6193), 'pytest.raises', 'pytest.raises', (['ResponseException'], {}), '(ResponseException)\n', (6174, 6193), False, 'import pytest\n')]
tacaswell/sunpy
sunpy/conftest.py
1e06d75408d1a621749a5d4e743ae44a31886100
import os import tempfile import importlib import pytest import astropy import astropy.config.paths # Force MPL to use non-gui backends for testing. try: import matplotlib except ImportError: pass else: matplotlib.use('Agg') # Don't actually import pytest_remotedata because that can do things to the # entrypoints code in pytest. remotedata_spec = importlib.util.find_spec("pytest_remotedata") HAVE_REMOTEDATA = remotedata_spec is not None # Do not collect the sample data file because this would download the sample data. collect_ignore = ["data/sample.py"] @pytest.fixture(scope='session', autouse=True) def tmp_config_dir(request): """ Globally set the default config for all tests. """ tmpdir = tempfile.TemporaryDirectory() os.environ["SUNPY_CONFIGDIR"] = str(tmpdir.name) astropy.config.paths.set_temp_config._temp_path = str(tmpdir.name) astropy.config.paths.set_temp_cache._temp_path = str(tmpdir.name) yield del os.environ["SUNPY_CONFIGDIR"] tmpdir.cleanup() astropy.config.paths.set_temp_config._temp_path = None astropy.config.paths.set_temp_cache._temp_path = None @pytest.fixture() def sunpy_cache(mocker, tmp_path): """ Provide a way to add local files to the cache. This can be useful when mocking remote requests. """ from types import MethodType from sunpy.data.data_manager.cache import Cache from sunpy.data.data_manager.downloader import ParfiveDownloader from sunpy.data.data_manager.storage import InMemStorage cache = Cache( ParfiveDownloader(), InMemStorage(), tmp_path, None ) def add(self, url, path): self._storage.store({ 'url': url, 'file_path': path, 'file_hash': 'none', # hash doesn't matter }) cache.add = MethodType(add, cache) def func(mocked): mocker.patch(mocked, cache) return cache yield func @pytest.fixture() def undo_config_dir_patch(): """ Provide a way for certain tests to not have the config dir. """ oridir = os.environ["SUNPY_CONFIGDIR"] del os.environ["SUNPY_CONFIGDIR"] yield os.environ["SUNPY_CONFIGDIR"] = oridir @pytest.fixture(scope='session', autouse=True) def hide_parfive_progress(request): """ Globally set the HIDE_PARFIVE_PROGESS to hide the parfive progress bar in tests. Used by the parfive helper class only. """ os.environ["HIDE_PARFIVE_PROGESS"] = "True" yield del os.environ["HIDE_PARFIVE_PROGESS"] @pytest.fixture(scope='session', autouse=True) def tmp_dl_dir(request): """ Globally set the default download directory for the test run to a tmp dir. """ with tempfile.TemporaryDirectory() as tmpdir: os.environ["SUNPY_DOWNLOADDIR"] = tmpdir yield tmpdir del os.environ["SUNPY_DOWNLOADDIR"] @pytest.fixture() def undo_download_dir_patch(): """ Provide a way for certain tests to not have tmp download dir. """ oridir = os.environ["SUNPY_DOWNLOADDIR"] del os.environ["SUNPY_DOWNLOADDIR"] yield os.environ["SUNPY_DOWNLOADDIR"] = oridir def pytest_runtest_setup(item): """ pytest hook to skip all tests that have the mark 'remotedata' if the pytest_remotedata plugin is not installed. """ if isinstance(item, pytest.Function): if 'remote_data' in item.keywords and not HAVE_REMOTEDATA: pytest.skip("skipping remotedata tests as pytest-remotedata is not installed")
[((365, 410), 'importlib.util.find_spec', 'importlib.util.find_spec', (['"""pytest_remotedata"""'], {}), "('pytest_remotedata')\n", (389, 410), False, 'import importlib\n'), ((580, 625), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (594, 625), False, 'import pytest\n'), ((1151, 1167), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1165, 1167), False, 'import pytest\n'), ((1968, 1984), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1982, 1984), False, 'import pytest\n'), ((2231, 2276), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (2245, 2276), False, 'import pytest\n'), ((2561, 2606), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (2575, 2606), False, 'import pytest\n'), ((2894, 2910), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (2908, 2910), False, 'import pytest\n'), ((218, 239), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (232, 239), False, 'import matplotlib\n'), ((735, 764), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (762, 764), False, 'import tempfile\n'), ((1847, 1869), 'types.MethodType', 'MethodType', (['add', 'cache'], {}), '(add, cache)\n', (1857, 1869), False, 'from types import MethodType\n'), ((1566, 1585), 'sunpy.data.data_manager.downloader.ParfiveDownloader', 'ParfiveDownloader', ([], {}), '()\n', (1583, 1585), False, 'from sunpy.data.data_manager.downloader import ParfiveDownloader\n'), ((1595, 1609), 'sunpy.data.data_manager.storage.InMemStorage', 'InMemStorage', ([], {}), '()\n', (1607, 1609), False, 'from sunpy.data.data_manager.storage import InMemStorage\n'), ((2736, 2765), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '()\n', (2763, 2765), False, 'import tempfile\n'), ((3455, 3533), 'pytest.skip', 'pytest.skip', (['"""skipping remotedata tests as pytest-remotedata is not installed"""'], {}), "('skipping remotedata tests as pytest-remotedata is not installed')\n", (3466, 3533), False, 'import pytest\n')]
asmateus/PyQtCalendar
qtcalendar/models.py
b8e5e468082f08159744f692e8edaf2ad52fccbb
''' Models for QtWidgets ''' from collections import deque from math import ceil import datetime as dt import calendar class EventInCalendar__Model: class Text: @staticmethod def getDefault(): return EventInCalendar__Model.Text() def __init__(self, event=None, overflow=False): if event is None: self.init_date = dt.datetime(1, 1, 1) self.end_date = dt.datetime(9999, 12, 31) self.place = Event__Model.Place() else: if overflow: self.init_date = dt.datetime.combine( event.getInitDate().date(), dt.time(0, 0, 0)) else: self.init_date = event.getInitDate() self.end_date = event.getEndDate() self.place = event.getPlace() def __str__(self): init_time, end_time = self.init_date.time(), self.end_date.time() return ' '.join([str(i) for i in [init_time, end_time, self.place]]) @staticmethod def colorOf(val): range_list = [ (0.0, 0.2, 'rgb(178, 0, 0)'), (0.2, 0.5, 'rgb(255, 40, 40)'), (0.5, 0.7, 'rgb(191, 165, 0)'), (0.7, 1.0, 'rgb(252, 224, 45)'), (1.0, 1.1, 'rgb(46, 234, 81)'), ] for lw, hi, c in range_list: if lw <= val and hi > val: return c def __init__(self, master, overflow): self._fulfillment = 0.0 self._overflow = overflow self._master = master self._event = None def getFulFillmentStatus(self, numeric=False): if not numeric: return EventInCalendar__Model.colorOf(self._fulfillment) return self._fulfillment def setEvent(self, event): self._event = event.getModel() self._fulfillment = self._event.getFulFillmentStatus() def __str__(self): if self._event is None: return EventInCalendar__Model.Text().__str__() return EventInCalendar__Model.Text(self._event, self._overflow).__str__() class Event__Model: class Place: def __init__(self, name='NA', people=0): self.name = name self.people = people def __str__(self): return self.name def __init__(self, init_date, end_date, place, fulfillment=0.0): self._init_date = init_date self._end_date = end_date self._place = place self._fulfillment = fulfillment def getFulFillmentStatus(self): return self._fulfillment def getInitDate(self): return self._init_date def getEndDate(self): return self._end_date def getPlace(self): return self._place class Date__Model: TYPE_WEEKDAY = 0 TYPE_WEEKEND = 1 TYPE_HOLYDAY = 2 TYPE_FREEDAY = 3 TYPE_GRAYDAY = 4 @staticmethod def colorOf(val): color_list = [ (Date__Model.TYPE_WEEKDAY, (219, 219, 219)), (Date__Model.TYPE_WEEKEND, (183, 183, 183)), (Date__Model.TYPE_HOLYDAY, (183, 183, 183)), (Date__Model.TYPE_FREEDAY, (0, 216, 255)), (Date__Model.TYPE_GRAYDAY, (255, 255, 255)), ] for d, c in color_list: if d == val: return c return color_list[0][1] def __init__(self, master, date): self._master = master self._events = list() self._date = date self._date_type = Date__Model.TYPE_WEEKDAY def setDate(self, date, datetype=TYPE_WEEKDAY): self._date = date self._date_type = datetype def getDate(self): return self._date def getDateType(self, numeric=False): if numeric is False: return Date__Model.colorOf(self._date_type) return self._date_type def addEvent(self, event): self._events.append(event) def getEvents(self): return self._events class Calendar__Model: TYPE_MONDAY_LEADING = 0 TYPE_TUESDAY_LEADING = 1 TYPE_WEDNESDAY_LEADING = 2 TYPE_THURSDAY_LEADING = 3 TYPE_FRIDAY_LEADING = 4 TYPE_SATURDAY_LEADING = 5 TYPE_SUNDAY_LEADING = 6 MAX_DIM_X = 7 MAX_DIM_Y = 6 WEEKENDS = [5, 6] @staticmethod def dayOf(date, init, datatree): ''' Returns the day of the week of a given date and the position of that day in the calendar grid. The returned text value of the day is recovered from the stringer module. ''' days = datatree['str']['days'] # Get the day of the week of the selected date datetuple = tuple([int(s) for s in str(date).split(' ')[0].split('-')]) day = days[list(zip(*days))[0].index(calendar.weekday(*datetuple))][1] # Horizontal position in the grid is deduced from the selected leading day days_dq = deque(days) days_dq.rotate(7 - init) pos_x = list(zip(*days_dq))[0].index(calendar.weekday(*datetuple)) # Vertical position is deduced from the selected leading day and the # day of the first date of that month firstmonthday = (datetuple[0], datetuple[1], 1) fday = list(zip(*days_dq))[0].index(calendar.weekday(*firstmonthday)) pos_y = ceil((fday + date.day) / 7) - 1 # Return the place in the calendar grid depending on the offset return day, pos_x, pos_y def __init__(self, master, ctype=TYPE_SUNDAY_LEADING, holidays=list()): ''' Calendar constructor, a calendar is an array of dates that should always be full, thus, initialy an array of empty dates (6x7), is array is called holders; a second empty array of dates is created and will replace eventually the dates of the respective holder date. Both arrays are validated through a snapshot array, the snapshot refers to the dates that fill the Calendar grid for a current month, be those dates from the actual month or the adjacent months ''' self._master = master self._type = ctype self._holidays = holidays # Assume month as current month self._month = tuple([dt.date.today().year, dt.date.today().month]) # Generate the snapshot for the current month self._snapshot = self.generateSnapshot() # Create empty dates from the snapshot self._dates = self.generateDefaultDates() def generateSnapshot(self): rt = list() if self._month is None: return rt # First day of month first_day = dt.date(self._month[0], self._month[1], 1) # Find day of first position in calendar grid offset = Calendar__Model.dayOf(first_day, self._type, self._master.getDataTree())[1] first_day -= dt.timedelta(offset) # Once first position is encountered, fill the holder array for i in range(Calendar__Model.MAX_DIM_X * Calendar__Model.MAX_DIM_Y): rt.append(first_day) first_day += dt.timedelta(1) return rt def generateDefaultDates(self): rt = list() for date in self._snapshot: created_date = self._master.createDate(date) self.setDateType(created_date) rt.append(created_date) return rt def addDate(self, date): if self._month is not None: if date.getModel().getDate() in self._snapshot: index = self._snapshot.index(date.getModel().getDate()) self.setDateType(date) self._dates[index] = date def addEventInCalendar(self, date, eic): if self._month is not None: if date in self._snapshot: index = self._snapshot.index(date) self._dates[index].addCalendarEvent(eic) def setDateType(self, date): current_type = date.getModel().getDateType(numeric=True) deduced_type = Date__Model.TYPE_WEEKDAY dt_date = date.getModel().getDate() dt_tuple = (dt_date.year, dt_date.month, dt_date.day) if calendar.weekday(*dt_tuple) in Calendar__Model.WEEKENDS: deduced_type = Date__Model.TYPE_WEEKEND if dt_date in self._holidays: deduced_type = Date__Model.TYPE_HOLYDAY if (dt_date.year, dt_date.month) != self._month: deduced_type = Date__Model.TYPE_GRAYDAY if current_type < deduced_type: current_type = deduced_type date.changeDateType(current_type) def _update(self): self._snapshot = self.generateSnapshot() self._dates = self.generateDefaultDates() # Add the required events events = self._master.getEvents() events_to_add = list() for event in events: if event.getModel().getInitDate().date() in self._snapshot: events_to_add.append(event) self._master.createEvents(events_to_add) def setMonth(self, month): self._month = month self._update() def getMonth(self): return self._month def monthSubtract(self): month = self._month if month[1] == 1: if month[0] == 1: return month else: return (month[0] - 1, 12) else: return (month[0], month[1] - 1) def monthAdd(self): month = self._month if month[1] == 12: if month[0] == 9999: return month else: return (month[0] + 1, 1) else: return (month[0], month[1] + 1) def setDataTree(self, datatree): self._datatree = datatree self._update() def getDataTree(self): return self._datatree def posInSnapshot(self, date): i = self._snapshot.index(date) return ceil((i + 1) / 7) - 1, (i) % 7 def getHolderDimensions(self): return Calendar__Model.MAX_DIM_X, Calendar__Model.MAX_DIM_Y def getDates(self): return self._dates def getType(self): return self._type
[((4929, 4940), 'collections.deque', 'deque', (['days'], {}), '(days)\n', (4934, 4940), False, 'from collections import deque\n'), ((6677, 6719), 'datetime.date', 'dt.date', (['self._month[0]', 'self._month[1]', '(1)'], {}), '(self._month[0], self._month[1], 1)\n', (6684, 6719), True, 'import datetime as dt\n'), ((6889, 6909), 'datetime.timedelta', 'dt.timedelta', (['offset'], {}), '(offset)\n', (6901, 6909), True, 'import datetime as dt\n'), ((5019, 5047), 'calendar.weekday', 'calendar.weekday', (['*datetuple'], {}), '(*datetuple)\n', (5035, 5047), False, 'import calendar\n'), ((5273, 5305), 'calendar.weekday', 'calendar.weekday', (['*firstmonthday'], {}), '(*firstmonthday)\n', (5289, 5305), False, 'import calendar\n'), ((5324, 5351), 'math.ceil', 'ceil', (['((fday + date.day) / 7)'], {}), '((fday + date.day) / 7)\n', (5328, 5351), False, 'from math import ceil\n'), ((7116, 7131), 'datetime.timedelta', 'dt.timedelta', (['(1)'], {}), '(1)\n', (7128, 7131), True, 'import datetime as dt\n'), ((8172, 8199), 'calendar.weekday', 'calendar.weekday', (['*dt_tuple'], {}), '(*dt_tuple)\n', (8188, 8199), False, 'import calendar\n'), ((388, 408), 'datetime.datetime', 'dt.datetime', (['(1)', '(1)', '(1)'], {}), '(1, 1, 1)\n', (399, 408), True, 'import datetime as dt\n'), ((441, 466), 'datetime.datetime', 'dt.datetime', (['(9999)', '(12)', '(31)'], {}), '(9999, 12, 31)\n', (452, 466), True, 'import datetime as dt\n'), ((9928, 9945), 'math.ceil', 'ceil', (['((i + 1) / 7)'], {}), '((i + 1) / 7)\n', (9932, 9945), False, 'from math import ceil\n'), ((6271, 6286), 'datetime.date.today', 'dt.date.today', ([], {}), '()\n', (6284, 6286), True, 'import datetime as dt\n'), ((6293, 6308), 'datetime.date.today', 'dt.date.today', ([], {}), '()\n', (6306, 6308), True, 'import datetime as dt\n'), ((674, 690), 'datetime.time', 'dt.time', (['(0)', '(0)', '(0)'], {}), '(0, 0, 0)\n', (681, 690), True, 'import datetime as dt\n'), ((4793, 4821), 'calendar.weekday', 'calendar.weekday', (['*datetuple'], {}), '(*datetuple)\n', (4809, 4821), False, 'import calendar\n')]
Forest216/BigDL
python/orca/src/bigdl/orca/data/tf/data.py
840da9a2eaf395978dd83730b02aa5e5dfbd7989
# # Copyright 2016 The BigDL Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import tensorflow as tf from bigdl.orca.tfpark.tf_dataset import TensorMeta from bigdl.dllib.utils import nest from bigdl.orca.data import SparkXShards from bigdl.dllib.utils import log4Error class Dataset(object): """ Represents a distributed set of elements backed by an RDD, which is created by applying tensorflow dataset transformations on each partitions. """ def __init__(self, xshards, create_dataset_fn): self.xshards = xshards self.create_dataset_fn = create_dataset_fn def as_graph_rdd(self, batch_per_shard, drop_remainder=True): create_dataset_fn = self.create_dataset_fn def to_dataset(iter): data_list = list(iter) import tensorflow as tf if not data_list: return [] datasets = [create_dataset_fn(data) for data in data_list] from functools import reduce dataset = reduce(lambda x, y: x.concatenate(y), datasets) dataset = dataset.batch(batch_per_shard, drop_remainder) iterator = dataset.make_initializable_iterator() train_next_ops = nest.flatten(iterator.get_next()) output_types = [t for t in nest.flatten(dataset.output_types)] output_types_enum = [t.as_datatype_enum for t in output_types] init_op_name = iterator.initializer.name table_init_op = tf.tables_initializer().name output_names = [op.name for op in train_next_ops] graph = train_next_ops[0].graph flatten_shapes = nest.flatten(dataset.output_shapes) flatten_shapes = [shape[1:] for shape in flatten_shapes] flatten_tensor_structure = [TensorMeta(dtype=output_types[i], shape=list(flatten_shapes[i]), name="zoo_input_{}".format(i)) for i in range(len(flatten_shapes))] structure = dataset.output_types if isinstance(structure, tf.DType): structure = (structure,) tensor_structure = nest.pack_sequence_as(structure, flatten_tensor_structure) meta_info = { "init_op_name": init_op_name, "table_init_op": table_init_op, "output_names": output_names, "output_types": output_types_enum, "tensor_structure": tensor_structure } return [(bytearray(graph.as_graph_def().SerializeToString()), meta_info)] graph_rdd_and_meta = self.xshards.rdd.mapPartitions(to_dataset) return graph_rdd_and_meta def as_tf_dataset_rdd(self): create_dataset_fn = self.create_dataset_fn def to_dataset(iter): data_list = list(iter) if not data_list: return [] from tensorflow.python.distribute.coordinator.values import serialize_dataset_to_graph datasets = [create_dataset_fn(data) for data in data_list] from functools import reduce dataset = reduce(lambda x, y: x.concatenate(y), datasets) ds_def = serialize_dataset_to_graph(dataset).numpy() elem_spec = dataset.element_spec return [{"ds_def": ds_def, "elem_spec": elem_spec}] tf_dataset_rdd = self.xshards.rdd.mapPartitions(to_dataset) return tf_dataset_rdd @staticmethod def from_tensor_slices(xshards): return TensorSliceDataset(xshards) @staticmethod def from_feature_table(tbl): from bigdl.friesian.feature import FeatureTable from bigdl.friesian.feature.utils import featuretable_to_xshards log4Error.invalidInputError(isinstance(tbl, FeatureTable), "Only Friesian FeatureTable is supported") xshards = featuretable_to_xshards(tbl) return TensorSliceDataset(xshards) def map(self, map_func): return MapDataset(self, map_func) class TensorSliceDataset(Dataset): def __init__(self, xshards): assert isinstance(xshards, SparkXShards), \ "only datasets backed by a SparkXShards are supported" self.xshards = xshards def create_dataset_fn(data): return tf.data.Dataset.from_tensor_slices(data) super().__init__(xshards, create_dataset_fn) class MapDataset(Dataset): def __init__(self, input_dataset, map_func): create_pre_dataset_fn = input_dataset.create_dataset_fn def create_dataset_fn(data): dataset = create_pre_dataset_fn(data) return dataset.map(map_func) super().__init__(xshards=input_dataset.xshards, create_dataset_fn=create_dataset_fn)
[((4548, 4576), 'bigdl.friesian.feature.utils.featuretable_to_xshards', 'featuretable_to_xshards', (['tbl'], {}), '(tbl)\n', (4571, 4576), False, 'from bigdl.friesian.feature.utils import featuretable_to_xshards\n'), ((2163, 2198), 'bigdl.dllib.utils.nest.flatten', 'nest.flatten', (['dataset.output_shapes'], {}), '(dataset.output_shapes)\n', (2175, 2198), False, 'from bigdl.dllib.utils import nest\n'), ((2750, 2808), 'bigdl.dllib.utils.nest.pack_sequence_as', 'nest.pack_sequence_as', (['structure', 'flatten_tensor_structure'], {}), '(structure, flatten_tensor_structure)\n', (2771, 2808), False, 'from bigdl.dllib.utils import nest\n'), ((4972, 5012), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices', (['data'], {}), '(data)\n', (5006, 5012), True, 'import tensorflow as tf\n'), ((1997, 2020), 'tensorflow.tables_initializer', 'tf.tables_initializer', ([], {}), '()\n', (2018, 2020), True, 'import tensorflow as tf\n'), ((1804, 1838), 'bigdl.dllib.utils.nest.flatten', 'nest.flatten', (['dataset.output_types'], {}), '(dataset.output_types)\n', (1816, 1838), False, 'from bigdl.dllib.utils import nest\n'), ((3852, 3887), 'tensorflow.python.distribute.coordinator.values.serialize_dataset_to_graph', 'serialize_dataset_to_graph', (['dataset'], {}), '(dataset)\n', (3878, 3887), False, 'from tensorflow.python.distribute.coordinator.values import serialize_dataset_to_graph\n')]
StableCoder/vulkan-mini-libs-2
tools/generate_serialization_header.py
e048f45149816e100d3f4f51306626ebf547b032
#!/usr/bin/env python3 import sys import getopt import xml.etree.ElementTree as ET def processVendors(outFile, vendors): outFile.writelines(["\nconstexpr std::array<std::string_view, ", str( len(vendors)), "> vendors = {{\n"]) for vendor in vendors: outFile.writelines([' \"', vendor.tag, '\",\n']) outFile.write('}};\n') def processEnumValue(outFile, enum, value): if not value.get('value') is None: # Spitting out plain values outFile.write(value.get('value')) elif not value.get('bitpos') is None: # Bitflag outFile.writelines( ['0x', format(1 << int(value.get('bitpos')), '08X')]) elif not value.get('alias') is None: processEnumValue(outFile, enum, enum.find(value.get('alias'))) def processEnums(outFile, enums, vendors, first, last): for enum in enums: # Skip VkResult if enum.tag == 'VkResult': continue # Skip if there's no values, MSVC can't do zero-sized arrays if len(enum.findall('./')) == 0: continue outFile.writelines( ['\nconstexpr EnumValueSet ', enum.tag, 'Sets[] = {\n']) # Determine how much to chop off the front strName = enum.tag typeDigit = '' # Determine if type ends with vendor tag vendorName = '' for vendor in vendors: if strName.endswith(vendor.tag): vendorName = vendor.tag strName = strName[:-len(vendorName)] if strName[-1].isdigit(): typeDigit = strName[-1] strName = strName[:-1] if strName.endswith('FlagBits'): strName = strName[:-8] # Construct most likely enum prefix mainPrefix = '' for char in strName: if mainPrefix == '': mainPrefix += char elif char.isupper(): mainPrefix += '_' mainPrefix += char.upper() else: mainPrefix += char.upper() mainPrefix += '_' if typeDigit != '': mainPrefix += typeDigit mainPrefix += '_' current = first while current <= last: for value in enum.findall('./'): if int(value.get('first')) != current: continue outFile.write(" {\"") valueStr = value.tag if valueStr.startswith(mainPrefix): valueStr = valueStr[len(mainPrefix):] if vendorName != '' and valueStr.endswith(vendorName): valueStr = valueStr[:-len(vendorName)-1] if valueStr.endswith('_BIT'): valueStr = valueStr[:-4] outFile.write(valueStr) outFile.write("\", ") processEnumValue(outFile, enum, value) outFile.write("},\n") current += 1 outFile.write('};\n') def main(argv): inputFile = '' outputFile = '' try: opts, args = getopt.getopt(argv, 'i:o:', []) except getopt.GetoptError: print('Error parsing options') sys.exit(1) for opt, arg in opts: if opt == '-i': inputFile = arg elif opt == '-o': outputFile = arg if(inputFile == ''): print("Error: No Vulkan XML file specified") sys.exit(1) if(outputFile == ''): print("Error: No output file specified") sys.exit(1) try: dataXml = ET.parse(inputFile) dataRoot = dataXml.getroot() except: print("Error: Could not open input file: ", inputFile) sys.exit(1) firstVersion = int(dataRoot.get('first')) lastVersion = int(dataRoot.get('last')) outFile = open(outputFile, "w") # Common Header with open("common_header.txt") as fd: outFile.write(fd.read()) outFile.write('\n') # outFile.write("""#ifndef VK_VALUE_SERIALIZATION_HPP #define VK_VALUE_SERIALIZATION_HPP /* USAGE: To use, include this header where the declarations for the boolean checks are required. On *ONE* compilation unit, include the definition of `#define VK_VALUE_SERIALIZATION_CONFIG_MAIN` so that the definitions are compiled somewhere following the one definition rule. */ #include <vulkan/vulkan.h> #include <string> #include <string_view> """) # Static Asserts outFile.writelines(["\nstatic_assert(VK_HEADER_VERSION >= ", str( firstVersion), ", \"VK_HEADER_VERSION is from before the supported range.\");\n"]) outFile.writelines(["static_assert(VK_HEADER_VERSION <= ", str( lastVersion), ", \"VK_HEADER_VERSION is from after the supported range.\");\n"]) # Function Declarataions outFile.write(""" /** * @brief Macro that automatically stringifies the given Vulkan type for serialization * @param VKTYPE Actual Vulkan type * @param VALUE Value to be serialized * @param STRPTR Pointer to the string to store the serialization in. Only modified if true is * returned. * @return True if serialization was successful. False otherwise. */ #define VK_SERIALIZE(VKTYPE, VALUE, STRPTR) vk_serialize<VKTYPE>(#VKTYPE, VALUE, STRPTR) /** * @brief Macro that automatically stringifies the given Vulkan type for parsing * @param VKTYPE Actual Vulkan type * @param STRING String to be parsed * @param VALPTR Pointer to the value to store the parsed value in. Only modified if true is * returned. * @return True if serialization was successful. False otherwise. */ #define VK_PARSE(VKTYPE, STRING, VALPTR) vk_parse<VKTYPE>(#VKTYPE, STRING, VALPTR) /** * @brief Serializes a Vulkan enumerator/flag type (32-bit) * @param vkType Name of the Vulkan enumerator/flag type * @param vkValue Value being serialized * @param pString Pointer to a string that will be modified with the serialized value. Only modified * if true is returned. * @return True the value was successfully serialized. False otherwise. */ bool vk_serialize(std::string_view vkType, uint32_t vkValue, std::string *pString); /** * @brief Parses a Vulkan enumerator/flag serialized string (32-bit) * @param vkType Name of the Vulkan enumerator/flag type * @param vkString String being parsed * @param pValue Pointer to a value that will be modified with the parsed value. Only modified if * true is returned. * @return True the value was successfully serialized. False otherwise. */ bool vk_parse(std::string_view vkType, std::string vkString, uint32_t *pValue); /** * @brief Serializes a Vulkan enumerator/flag type (64-bit) * @param vkType Name of the Vulkan enumerator/flag type * @param vkValue Value being serialized * @param pString Pointer to a string that will be modified with the serialized value. Only modified * if true is returned. * @return True the value was successfully serialized. False otherwise. */ bool vk_serialize(std::string_view vkType, uint64_t vkValue, std::string *pString); /** * @brief Parses a Vulkan enumerator/flag serialized string (64-bit) * @param vkType Name of the Vulkan enumerator/flag type * @param vkString String being parsed * @param pValue Pointer to a value that will be modified with the parsed value. Only modified if * true is returned. * @return True the value was successfully serialized. False otherwise. */ bool vk_parse(std::string_view vkType, std::string vkString, uint64_t *pValue); /** * @brief Serializes a Vulkan enumerator/flag type * @tparam Vulkan type being serialized * @param vkType Name of the Vulkan enumerator/flag type * @param vkValue Value being serialized * @param pString Pointer to a string that will be modified with the serialized value. Only modified * if true is returned. * @return True the value was successfully serialized. False otherwise. */ template <typename T> bool vk_serialize(std::string_view vkType, T vkValue, std::string *pString) { return vk_serialize(vkType, static_cast<uint32_t>(vkValue), pString); } /** * @brief Parses a Vulkan enumerator/flag serialized string * @tparam Vulkan type being parsed * @param vkType Name of the Vulkan enumerator/flag type * @param vkString String being parsed * @param pValue Pointer to a value that will be modified with the parsed value. Only modified if * true is returned. * @return True the value was successfully serialized. False otherwise. */ template <typename T> bool vk_parse(std::string_view vkType, std::string vkString, T *pValue) { uint32_t retVal = 0; auto found = vk_parse(vkType, vkString, &retVal); if (found) { *pValue = static_cast<T>(retVal); } return found; } """) # Definition Start outFile.write("\n#ifdef VK_VALUE_SERIALIZATION_CONFIG_MAIN\n") outFile.write("\n#include <algorithm>\n") outFile.write("#include <array>\n") outFile.write("#include <cstring>\n") outFile.write("\nnamespace {\n") # Vendors vendors = dataRoot.findall('vendors/') processVendors(outFile, vendors) # EnumSet Declaration outFile.write("\nstruct EnumValueSet {\n") outFile.write(" std::string_view name;\n") outFile.write(" int64_t value;\n") outFile.write("};\n") # Enums enums = dataRoot.findall('enums/') processEnums(outFile, enums, vendors, firstVersion, lastVersion) # Enum Type Declaration outFile.write("\nstruct EnumType {\n") outFile.write(" std::string_view name;\n") outFile.write(" EnumValueSet const* data;\n") outFile.write(" uint32_t count;\n") outFile.write(" bool allowEmpty;\n") outFile.write("};\n") # Enum Pointer Array outFile.writelines(["\nconstexpr std::array<EnumType, ", str( len(enums)-1), "> enumTypes = {{\n"]) # -1 for not doing VkResult for enum in enums: if enum.tag == 'VkResult': continue valueCount = len(enum.findall('./')) if valueCount == 0: outFile.writelines( [" {\"", str(enum.tag), "\", nullptr, 0, true},\n"]) else: allowEmpty = "true" for enumVal in enum.findall('./'): if enumVal.get('first') == enum.get('first'): allowEmpty = "false" outFile.writelines([" {\"", str(enum.tag), "\", ", str( enum.tag), "Sets, ", str(valueCount), ", ", allowEmpty, "},\n"]) outFile.write('}};\n') # Function definitions outFile.write(""" /** * @brief Removes a vendor tag from the end of the given string view * @param view String view to remove the vendor tag from * @return A string_view without the vendor tag, if it was suffixed */ std::string_view stripVendor(std::string_view view) { for (auto const &it : vendors) { // Don't strip if it's all that's left if (view == it) break; if (strncmp(view.data() + view.size() - it.size(), it.data(), it.size()) == 0) { view = view.substr(0, view.size() - it.size()); break; } } return view; } /** * @brief Strips '_BIT' from the end of a string, if there */ std::string_view stripBit(std::string_view view) { if (view.size() > strlen("_BIT")) { if (view.substr(view.size() - strlen("_BIT")) == "_BIT") { return view.substr(0, view.size() - strlen("_BIT")); } } return view; } bool getEnumType(std::string_view vkType, EnumValueSet const **ppStart, EnumValueSet const **ppEnd, bool *pAllowEmpty) { // Check for a conversion from Flags -> FlagBits std::string localString; if (vkType.rfind("Flags") != std::string::npos) { localString = vkType; auto it = localString.rfind("Flags"); localString = localString.replace(it, strlen("Flags"), "FlagBits"); vkType = localString; } // Try the original name for (auto const &it : enumTypes) { if (vkType == std::string_view{it.name}) { *ppStart = it.data; *ppEnd = it.data + it.count; *pAllowEmpty = it.allowEmpty; return true; } } // Try a vendor-stripped name vkType = stripVendor(vkType); for (auto const &it : enumTypes) { if (vkType == std::string_view{it.name}) { *ppStart = it.data; *ppEnd = it.data + it.count; *pAllowEmpty = it.allowEmpty; return true; } } return false; } /** * @brief Converts a Vulkan Flag typename into the prefix that is used for it's enums * @param typeName Name of the type to generate the Vk enum prefix for * @return Generated prefix string * * Any capitalized letters except for the first has an underscore inserted before it, an underscore * is added to the end, and all characters are converted to upper case. * * It also removed the 'Flags' or 'FlagBits' suffixes. */ std::string processEnumPrefix(std::string_view typeName) { // Flag Bits std::size_t flagBitsSize = strlen("FlagBits"); if (typeName.size() > flagBitsSize) { if (strncmp(typeName.data() + typeName.size() - flagBitsSize, "FlagBits", flagBitsSize) == 0) { typeName = typeName.substr(0, typeName.size() - strlen("FlagBits")); } } // Flags std::size_t flagsSize = strlen("Flags"); if (typeName.size() > flagsSize) { if (strncmp(typeName.data() + typeName.size() - flagsSize, "Flags", flagsSize) == 0) { typeName = typeName.substr(0, typeName.size() - strlen("Flags")); } } std::string retStr; for (auto it = typeName.begin(); it != typeName.end(); ++it) { if (it == typeName.begin()) { retStr += ::toupper(*it); } else if (::isupper(*it)) { retStr += '_'; retStr += *it; } else { retStr += toupper(*it); } } retStr += '_'; return retStr; } bool findValue(std::string_view findValue, std::string_view prefix, uint64_t *pValue, EnumValueSet const *start, EnumValueSet const *end) { // Remove the vendor tag suffix if it's on the value findValue = stripVendor(findValue); if (findValue[findValue.size() - 1] == '_') findValue = findValue.substr(0, findValue.size() - 1); // Remove '_BIT' if it's there findValue = stripBit(findValue); // Iterate until we find the value while (start != end) { if (findValue == start->name) { *pValue |= start->value; return true; } std::string prefixedName{prefix}; prefixedName += start->name; if (findValue == prefixedName) { *pValue |= start->value; return true; } ++start; } return false; } /** * @brief Takes a given string and formats it for use with parsing * @param str The string to format * @return Formatted string * * First, any non alphanumeric characters are trimmed from both ends of the string. * After than, any spaces are replaced with underscores, and finally all the characters are * capitalized. This will generate the string closest to the original ones found in the XML spec. */ std::string formatString(std::string str) { // Trim left std::size_t cutOffset = 0; for (auto c : str) { if (::isalnum(c)) break; else ++cutOffset; } str = str.substr(cutOffset); // Trim right cutOffset = 0; for (std::size_t i = 0; i < str.size(); ++i) { if (::isalnum(str[i])) cutOffset = i + 1; } str = str.substr(0, cutOffset); std::replace(str.begin(), str.end(), ' ', '_'); std::for_each(str.begin(), str.end(), [](char &c) { c = ::toupper(c); }); return str; } bool serializeBitmask(EnumValueSet const *end, EnumValueSet const *start, bool allowEmpty, uint64_t vkValue, std::string *pString) { --end; --start; if(start == end) { // If this is a non-existing bitmask, then return an empty string *pString = {}; return true; } std::string retStr; while (start != end) { if(vkValue == 0 && !retStr.empty()) { break; } if ((start->value & vkValue) == start->value) { // Found a compatible bit mask, add it if (!retStr.empty()) { retStr += " | "; } retStr += start->name; vkValue = vkValue ^ start->value; } --start; } if (vkValue != 0 || (retStr.empty() && !allowEmpty)) { // Failed to find a valid bitmask for the value return false; } *pString = retStr; return true; } bool serializeEnum(EnumValueSet const *start, EnumValueSet const *end, uint64_t vkValue, std::string *pString) { while (start != end) { if (start->value == vkValue) { *pString = start->name; return true; } ++start; } return false; } bool parseBitmask(std::string_view vkString, EnumValueSet const *start, EnumValueSet const *end, std::string_view prefix, uint64_t *pValue) { uint64_t retVal = 0; auto startCh = vkString.begin(); auto endCh = startCh; for (; endCh != vkString.end(); ++endCh) { if (*endCh == '|') { std::string token(startCh, endCh); token = formatString(token); bool foundVal = findValue(token, prefix, &retVal, start, end); if (!foundVal) return false; startCh = endCh + 1; } } if (startCh != endCh) { std::string token(startCh, endCh); token = formatString(token); bool foundVal = findValue(token, prefix, &retVal, start, end); if (!foundVal) return false; } *pValue = retVal; return true; } bool parseEnum(std::string_view vkString, EnumValueSet const *start, EnumValueSet const *end, std::string_view prefix, uint64_t *pValue) { uint64_t retVal = 0; std::string token = formatString(std::string{vkString}); bool found = findValue(token, prefix, &retVal, start, end); if (found) { *pValue = retVal; } return found; } } // namespace bool vk_serialize(std::string_view vkType, uint64_t vkValue, std::string *pString) { if (vkType.empty()) { return false; } EnumValueSet const *start, *end; bool allowEmpty; if (!getEnumType(vkType, &start, &end, &allowEmpty)) { return false; } if (vkType.find("Flags") != std::string::npos || vkType.find("FlagBits") != std::string::npos) { return serializeBitmask(start, end, allowEmpty, vkValue, pString); } return serializeEnum(start, end, vkValue, pString); } bool vk_serialize(std::string_view vkType, uint32_t vkValue, std::string *pString) { return vk_serialize(vkType, static_cast<uint64_t>(vkValue), pString); } bool vk_parse(std::string_view vkType, std::string vkString, uint64_t *pValue) { if (vkType.empty()) { return false; } EnumValueSet const *start, *end; bool allowEmpty; if (!getEnumType(vkType, &start, &end, &allowEmpty)) { return false; } if (vkString.empty()) { if (allowEmpty) { *pValue = 0; return true; } else { return false; } } std::string prefix = processEnumPrefix(stripVendor(vkType)); if (vkType.find("Flags") != std::string::npos || vkType.find("FlagBits") != std::string::npos) { return parseBitmask(vkString, start, end, prefix, pValue); } return parseEnum(vkString, start, end, prefix, pValue); } bool vk_parse(std::string_view vkType, std::string vkString, uint32_t *pValue) { uint64_t tempValue; if (vk_parse(vkType, vkString, &tempValue)) { *pValue = static_cast<uint32_t>(tempValue); return true; } return false; } """) # endif outFile.write("\n#endif // VK_VALUE_SERIALIZATION_CONFIG_MAIN\n") outFile.write("#endif // VK_VALUE_SERIALIZATION_HPP\n") outFile.close() if __name__ == "__main__": main(sys.argv[1:])
[((3069, 3100), 'getopt.getopt', 'getopt.getopt', (['argv', '"""i:o:"""', '[]'], {}), "(argv, 'i:o:', [])\n", (3082, 3100), False, 'import getopt\n'), ((3411, 3422), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (3419, 3422), False, 'import sys\n'), ((3506, 3517), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (3514, 3517), False, 'import sys\n'), ((3546, 3565), 'xml.etree.ElementTree.parse', 'ET.parse', (['inputFile'], {}), '(inputFile)\n', (3554, 3565), True, 'import xml.etree.ElementTree as ET\n'), ((3179, 3190), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (3187, 3190), False, 'import sys\n'), ((3686, 3697), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (3694, 3697), False, 'import sys\n')]
AmpelProject/Ampel-core
ampel/cli/AbsStockCommand.py
dcbfbe38ba400b7f8e44e641b90217ca1bed4f8f
#!/usr/bin/env python # -*- coding: utf-8 -*- # File : Ampel-core/ampel/cli/AbsStockCommand.py # License : BSD-3-Clause # Author : vb <vbrinnel@physik.hu-berlin.de> # Date : 25.03.2021 # Last Modified Date: 25.03.2021 # Last Modified By : vb <vbrinnel@physik.hu-berlin.de> from typing import Dict, Any, Optional, Union, Literal from ampel.cli.ArgParserBuilder import ArgParserBuilder from ampel.cli.MaybeIntAction import MaybeIntAction from ampel.cli.LoadJSONAction import LoadJSONAction from ampel.cli.AbsCoreCommand import AbsCoreCommand from ampel.mongo.utils import maybe_match_array from ampel.model.UnitModel import UnitModel from ampel.model.time.UnixTimeModel import UnixTimeModel from ampel.model.time.TimeStringModel import TimeStringModel from ampel.model.time.TimeLastRunModel import TimeLastRunModel from ampel.model.time.TimeDeltaModel import TimeDeltaModel from ampel.model.time.TimeConstraintModel import TimeConstraintModel class AbsStockCommand(AbsCoreCommand, abstract=True): """ Base class for commands selecting/matching stock(s) """ @staticmethod def get_select_args_help() -> Dict[str, str]: return { # Required 'config': 'Path to an ampel config file (yaml/json)', # Optional 'secrets': 'Path to a YAML secrets store in sops format', 'log-profile': 'One of: default, compact, headerless, verbose, debug', 'id-mapper': 'Convert stock ids using the provided id mapper (ex: ZTFIdMapper)', # Selection 'stock': 'Stock id(s) (OR matched if multi-valued)', 'channel': 'Channel(s)', 'created-after-ts': 'Created after unix timestamp', 'created-after-str': 'Created after date-time iso string', 'created-after-delta': 'Created after time delta', 'created-after-process': 'Created after last run of process with name', 'created-before-ts': 'Created before unix timestamp', 'created-before-str': 'Created before date-time iso string', 'created-before-delta': 'Created before time delta', 'created-before-process': 'Created before last run of process with name', 'updated-after-ts': 'Updated after unix timestamp', 'updated-after-str': 'Updated after date-time iso string', 'updated-after-delta': 'Updated after time delta', 'updated-after-process': 'Updated after last run of process with name', 'updated-before-ts': 'Updated before unix timestamp', 'updated-before-str': 'Updated before date-time iso string', 'updated-before-delta': 'Updated before time delta', 'updated-before-process': 'Updated before last run of process with name', 'custom-match': 'Custom mongodb match as JSON string (ex: {"body.aKey": {"$gt": 1}})', } def add_selection_args(self, builder: ArgParserBuilder) -> None: # Selection args builder.add_group('match', 'Stock selection arguments') builder.add_arg('match', "stock", action=MaybeIntAction, nargs="+") builder.add_x_args('match', {'name': 'created-before-str'}, {'name': 'created-before-ts', 'type': int}, {'name': 'created-before-delta', 'action': LoadJSONAction}, {'name': 'created-before-process'} ) builder.add_x_args('match', {'name': 'created-after-str'}, {'name': 'created-after-ts', 'type': int}, {'name': 'created-after-delta', 'action': LoadJSONAction}, {'name': 'created-after-process'} ) builder.add_x_args('match', {'name': 'updated-before-str'}, {'name': 'updated-before-ts', 'type': int}, {'name': 'updated-before-delta', 'action': LoadJSONAction}, {'name': 'updated-before-process'} ) builder.add_x_args('match', {'name': 'updated-after-str'}, {'name': 'updated-after-ts', 'type': int}, {'name': 'updated-after-delta', 'action': LoadJSONAction}, {'name': 'updated-after-process'} ) builder.create_logic_args('match', "channel", "Channel") builder.create_logic_args('match', "with-tag", "Tag") builder.create_logic_args('match', "without-tag", "Tag", excl=True) builder.add_arg('match', "custom-match", metavar="#", action=LoadJSONAction) def get_tag(self, args: Dict[str, Any]) -> Optional[Dict[Union[Literal['with'], Literal['without']], Dict]]: tag: Optional[Dict[Union[Literal['with'], Literal['without']], Dict]] = None if args.get('with_tag'): tag = {'with': args['with_tag']} if args.get('without_tag'): if tag is None: tag = {} tag['without'] = args['without_tag'] return tag def build_select_model(self, args: Dict[str, Any]) -> UnitModel: conf = { "created": self.get_time_model("created", args), "updated": self.get_time_model("updated", args), 'channel': args['channel'], 'custom': args['custom_match'] } if args.get('tag'): conf['tag'] = self.get_tag(args) if (stock := args.get('stock')): conf['custom'] = { '_id': stock if isinstance(stock, (int, bytes, str)) else maybe_match_array(stock) } return UnitModel(unit="T3StockSelector", config=conf) def get_time_model(self, prefix: str, args: Dict[str, Any]) -> TimeConstraintModel: d: Dict[str, Any] = {'after': None, 'before': None} for when in ('after', 'before'): if args.get(x := f"{prefix}_{when}_ts"): d[when] = UnixTimeModel(match_type='unix_time', value=args[x]) elif args.get(x := f"{prefix}_{when}_str"): d[when] = TimeStringModel(match_type='time_string', dateTimeStr=args[x], dateTimeFormat="%Y%m%dT%H%M%S") elif args.get(x := f"{prefix}_{when}_delta"): d[when] = TimeDeltaModel(match_type='time_delta', **args[x]) elif args.get(x := f"{prefix}_{when}_process"): d[when] = TimeLastRunModel(match_type='time_last_run', process_name=args[x]) return TimeConstraintModel(**d)
[((4856, 4902), 'ampel.model.UnitModel.UnitModel', 'UnitModel', ([], {'unit': '"""T3StockSelector"""', 'config': 'conf'}), "(unit='T3StockSelector', config=conf)\n", (4865, 4902), False, 'from ampel.model.UnitModel import UnitModel\n'), ((5604, 5628), 'ampel.model.time.TimeConstraintModel.TimeConstraintModel', 'TimeConstraintModel', ([], {}), '(**d)\n', (5623, 5628), False, 'from ampel.model.time.TimeConstraintModel import TimeConstraintModel\n'), ((5139, 5191), 'ampel.model.time.UnixTimeModel.UnixTimeModel', 'UnixTimeModel', ([], {'match_type': '"""unix_time"""', 'value': 'args[x]'}), "(match_type='unix_time', value=args[x])\n", (5152, 5191), False, 'from ampel.model.time.UnixTimeModel import UnixTimeModel\n'), ((4816, 4840), 'ampel.mongo.utils.maybe_match_array', 'maybe_match_array', (['stock'], {}), '(stock)\n', (4833, 4840), False, 'from ampel.mongo.utils import maybe_match_array\n'), ((5253, 5351), 'ampel.model.time.TimeStringModel.TimeStringModel', 'TimeStringModel', ([], {'match_type': '"""time_string"""', 'dateTimeStr': 'args[x]', 'dateTimeFormat': '"""%Y%m%dT%H%M%S"""'}), "(match_type='time_string', dateTimeStr=args[x],\n dateTimeFormat='%Y%m%dT%H%M%S')\n", (5268, 5351), False, 'from ampel.model.time.TimeStringModel import TimeStringModel\n'), ((5411, 5461), 'ampel.model.time.TimeDeltaModel.TimeDeltaModel', 'TimeDeltaModel', ([], {'match_type': '"""time_delta"""'}), "(match_type='time_delta', **args[x])\n", (5425, 5461), False, 'from ampel.model.time.TimeDeltaModel import TimeDeltaModel\n'), ((5527, 5593), 'ampel.model.time.TimeLastRunModel.TimeLastRunModel', 'TimeLastRunModel', ([], {'match_type': '"""time_last_run"""', 'process_name': 'args[x]'}), "(match_type='time_last_run', process_name=args[x])\n", (5543, 5593), False, 'from ampel.model.time.TimeLastRunModel import TimeLastRunModel\n')]
KLumy/Basic-Algorithm
programmers/lv2/42888.py
e52e4200c1955a9062569814ff3418dd06666845
from typing import List def solution(records: List[str]): logger = [] id_name = dict() message = {"Enter": "님이 들어왔습니다.", "Leave": "님이 나갔습니다."} for record in records: op, id, *name = record.split() if name: id_name[id] = name[0] if op in message: logger.append((id, op)) answer = [] for log in logger: id, msg = log answer.append(id_name[id] + message[msg]) return answer if __name__ == "__main__": i = [ "Enter uid1234 Muzi", "Enter uid4567 Prodo", "Leave uid1234", "Enter uid1234 Prodo", "Change uid4567 Ryan", ] print(solution(i))
[]
bobosoft/intrepyd
app/nets.py
13f0912b31f86f9bcc50f52ef4ad870e33f0cf65
""" Implementation of REST API for nets creation """ from flask import Blueprint, request from .utils import typename_to_type from .contexts import contexts nr = Blueprint('nets', __name__) def _create_bool_constant(func): context = request.get_json()['context'] if context is None: return {'result': 'error'}, 400 ctx = contexts[context]['context'] net = func(ctx) return {'result': ctx.net2name[net]}, 201 def _create_unary_gate(func): context = request.get_json()['context'] x = request.get_json()['x'] if context is None or x is None: return {'result': 'error'}, 400 ctx = contexts[context]['context'] x = ctx.nets[x] assert x is not None net = func(ctx, x) return {'result': ctx.net2name[net]}, 201 def _create_binary_gate(func): context = request.get_json()['context'] x = request.get_json()['x'] y = request.get_json()['y'] if context is None or x is None or y is None: return {'result': 'error'}, 400 ctx = contexts[context]['context'] x = ctx.nets[x] y = ctx.nets[y] assert x is not None assert y is not None net = func(ctx, x, y) return {'result': ctx.net2name[net]}, 201 @nr.route('', methods=['GET']) def list_nets(): """ Gets the list of the available nets """ context = request.args.get('context') ctx = contexts[context]['context'] return {'nets': [key for key, _ in ctx.nets.items()]}, 200 @nr.route('/true', methods=['POST']) def create_true(): """ Creates the net true """ return _create_bool_constant(lambda ctx : ctx.mk_true()) @nr.route('/false', methods=['POST']) def create_false(): """ Creates the net false """ return _create_bool_constant(lambda ctx : ctx.mk_false()) @nr.route('/numbers/create', methods=['POST']) def create_number(): """ Creates a number """ context = request.get_json()['context'] value = request.get_json()['value'] typ = request.get_json()['type'] if context is None or value is None or typ is None: return {'result': 'error'}, 400 ctx = contexts[context]['context'] assert value is not None assert typ is not None net = ctx.mk_number(value, typename_to_type(ctx, typ)) return {'result': ctx.net2name[net]}, 201 @nr.route('/nots/create', methods=['POST']) def create_not(): """ Creates a logical not """ return _create_unary_gate(lambda ctx, x : ctx.mk_not(x)) @nr.route('/minuses/create', methods=['POST']) def create_minus(): """ Creates an arithmetic minus """ return _create_unary_gate(lambda ctx, x : ctx.mk_minus(x)) @nr.route('/ands/create', methods=['POST']) def create_and(): """ Creates a logical and """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_and(x, y)) @nr.route('/ors/create', methods=['POST']) def create_or(): """ Creates a logical or """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_or(x, y)) @nr.route('/implieses/create', methods=['POST']) def create_implies(): """ Creates a logical implies """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_implies(x, y)) @nr.route('/xors/create', methods=['POST']) def create_xor(): """ Creates a logical xor """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_xor(x, y)) @nr.route('/iffs/create', methods=['POST']) def create_iff(): """ Creates a logical iff """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_iff(x, y)) @nr.route('/adds/create', methods=['POST']) def create_add(): """ Creates an addition """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_add(x, y)) @nr.route('/muls/create', methods=['POST']) def create_mul(): """ Creates a multiplication """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_mul(x, y)) @nr.route('/divs/create', methods=['POST']) def create_div(): """ Creates a division """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_div(x, y)) @nr.route('/mods/create', methods=['POST']) def create_mod(): """ Creates a modulus """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_mod(x, y)) @nr.route('/subs/create', methods=['POST']) def create_sub(): """ Creates a subtraction """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_sub(x, y)) @nr.route('/eqs/create', methods=['POST']) def create_eq(): """ Creates an equality """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_eq(x, y)) @nr.route('/leqs/create', methods=['POST']) def create_leq(): """ Creates an less or equal """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_leq(x, y)) @nr.route('/geqs/create', methods=['POST']) def create_geq(): """ Creates a greater or equal """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_geq(x, y)) @nr.route('/lts/create', methods=['POST']) def create_lt(): """ Creates a less than """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_lt(x, y)) @nr.route('/gts/create', methods=['POST']) def create_gt(): """ Creates a greater than """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_gt(x, y)) @nr.route('/neqs/create', methods=['POST']) def create_neq(): """ Creates a not equal """ return _create_binary_gate(lambda ctx, x, y : ctx.mk_neq(x, y)) @nr.route('/ites/create', methods=['POST']) def create_ite(): """ Creates an if then else """ context = request.get_json()['context'] x = request.get_json()['x'] y = request.get_json()['y'] z = request.get_json()['z'] if context is None or x is None or y is None or z is None: return {'result': 'error'}, 400 ctx = contexts[context]['context'] i = ctx.nets[x] t = ctx.nets[y] e = ctx.nets[z] assert i is not None assert t is not None assert e is not None net = ctx.mk_ite(i, t, e) return {'result': ctx.net2name[net]}, 201 @nr.route('/casts/create', methods=['POST']) def create_cast(): """ Creates a type cast """ context = request.get_json()['context'] x = request.get_json()['x'] t = request.get_json()['type'] if context is None or x is None or t is None: return {'result': 'error'}, 400 ctx = contexts[context]['context'] x = ctx.nets[x] assert ctx is not None assert x is not None net = None if t == 'int8': net = ctx.mk_cast_to_int8(x) elif t == 'int16': net = ctx.mk_cast_to_int16(x) elif t == 'int32': net = ctx.mk_cast_to_int32(x) elif t == 'int64': net = ctx.mk_cast_to_int64(x) elif t == 'uint8': net = ctx.mk_cast_to_uint8(x) elif t == 'uint16': net = ctx.mk_cast_to_uint16(x) elif t == 'uint32': net = ctx.mk_cast_to_uint32(x) elif t == 'uint64': net = ctx.mk_cast_to_uint64(x) else: return {'result': 'unhandled type {}'.format(t)}, 400 assert net is not None return {'result': ctx.net2name[net]}, 201
[((163, 190), 'flask.Blueprint', 'Blueprint', (['"""nets"""', '__name__'], {}), "('nets', __name__)\n", (172, 190), False, 'from flask import Blueprint, request\n'), ((1325, 1352), 'flask.request.args.get', 'request.args.get', (['"""context"""'], {}), "('context')\n", (1341, 1352), False, 'from flask import Blueprint, request\n'), ((239, 257), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (255, 257), False, 'from flask import Blueprint, request\n'), ((483, 501), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (499, 501), False, 'from flask import Blueprint, request\n'), ((521, 539), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (537, 539), False, 'from flask import Blueprint, request\n'), ((821, 839), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (837, 839), False, 'from flask import Blueprint, request\n'), ((859, 877), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (875, 877), False, 'from flask import Blueprint, request\n'), ((891, 909), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (907, 909), False, 'from flask import Blueprint, request\n'), ((1897, 1915), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (1913, 1915), False, 'from flask import Blueprint, request\n'), ((1939, 1957), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (1955, 1957), False, 'from flask import Blueprint, request\n'), ((1977, 1995), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (1993, 1995), False, 'from flask import Blueprint, request\n'), ((5535, 5553), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (5551, 5553), False, 'from flask import Blueprint, request\n'), ((5573, 5591), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (5589, 5591), False, 'from flask import Blueprint, request\n'), ((5605, 5623), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (5621, 5623), False, 'from flask import Blueprint, request\n'), ((5637, 5655), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (5653, 5655), False, 'from flask import Blueprint, request\n'), ((6133, 6151), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (6149, 6151), False, 'from flask import Blueprint, request\n'), ((6171, 6189), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (6187, 6189), False, 'from flask import Blueprint, request\n'), ((6203, 6221), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (6219, 6221), False, 'from flask import Blueprint, request\n')]
Soroosh129/addons
tensorflow_addons/image/utils.py
d92ae02d04e9052f6ca5ea272873efd15eaa35ce
# Copyright 2019 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Image util ops.""" import tensorflow as tf def get_ndims(image): return image.get_shape().ndims or tf.rank(image) def to_4D_image(image): """Convert 2/3/4D image to 4D image. Args: image: 2/3/4D tensor. Returns: 4D tensor with the same type. """ with tf.control_dependencies( [ tf.debugging.assert_rank_in( image, [2, 3, 4], message="`image` must be 2/3/4D tensor" ) ] ): ndims = image.get_shape().ndims if ndims is None: return _dynamic_to_4D_image(image) elif ndims == 2: return image[None, :, :, None] elif ndims == 3: return image[None, :, :, :] else: return image def _dynamic_to_4D_image(image): shape = tf.shape(image) original_rank = tf.rank(image) # 4D image => [N, H, W, C] or [N, C, H, W] # 3D image => [1, H, W, C] or [1, C, H, W] # 2D image => [1, H, W, 1] left_pad = tf.cast(tf.less_equal(original_rank, 3), dtype=tf.int32) right_pad = tf.cast(tf.equal(original_rank, 2), dtype=tf.int32) new_shape = tf.concat( [ tf.ones(shape=left_pad, dtype=tf.int32), shape, tf.ones(shape=right_pad, dtype=tf.int32), ], axis=0, ) return tf.reshape(image, new_shape) def from_4D_image(image, ndims): """Convert back to an image with `ndims` rank. Args: image: 4D tensor. ndims: The original rank of the image. Returns: `ndims`-D tensor with the same type. """ with tf.control_dependencies( [tf.debugging.assert_rank(image, 4, message="`image` must be 4D tensor")] ): if isinstance(ndims, tf.Tensor): return _dynamic_from_4D_image(image, ndims) elif ndims == 2: return tf.squeeze(image, [0, 3]) elif ndims == 3: return tf.squeeze(image, [0]) else: return image def _dynamic_from_4D_image(image, original_rank): shape = tf.shape(image) # 4D image <= [N, H, W, C] or [N, C, H, W] # 3D image <= [1, H, W, C] or [1, C, H, W] # 2D image <= [1, H, W, 1] begin = tf.cast(tf.less_equal(original_rank, 3), dtype=tf.int32) end = 4 - tf.cast(tf.equal(original_rank, 2), dtype=tf.int32) new_shape = shape[begin:end] return tf.reshape(image, new_shape)
[((1499, 1514), 'tensorflow.shape', 'tf.shape', (['image'], {}), '(image)\n', (1507, 1514), True, 'import tensorflow as tf\n'), ((1535, 1549), 'tensorflow.rank', 'tf.rank', (['image'], {}), '(image)\n', (1542, 1549), True, 'import tensorflow as tf\n'), ((2022, 2050), 'tensorflow.reshape', 'tf.reshape', (['image', 'new_shape'], {}), '(image, new_shape)\n', (2032, 2050), True, 'import tensorflow as tf\n'), ((2742, 2757), 'tensorflow.shape', 'tf.shape', (['image'], {}), '(image)\n', (2750, 2757), True, 'import tensorflow as tf\n'), ((3062, 3090), 'tensorflow.reshape', 'tf.reshape', (['image', 'new_shape'], {}), '(image, new_shape)\n', (3072, 3090), True, 'import tensorflow as tf\n'), ((798, 812), 'tensorflow.rank', 'tf.rank', (['image'], {}), '(image)\n', (805, 812), True, 'import tensorflow as tf\n'), ((1698, 1729), 'tensorflow.less_equal', 'tf.less_equal', (['original_rank', '(3)'], {}), '(original_rank, 3)\n', (1711, 1729), True, 'import tensorflow as tf\n'), ((1771, 1797), 'tensorflow.equal', 'tf.equal', (['original_rank', '(2)'], {}), '(original_rank, 2)\n', (1779, 1797), True, 'import tensorflow as tf\n'), ((2903, 2934), 'tensorflow.less_equal', 'tf.less_equal', (['original_rank', '(3)'], {}), '(original_rank, 3)\n', (2916, 2934), True, 'import tensorflow as tf\n'), ((1864, 1903), 'tensorflow.ones', 'tf.ones', ([], {'shape': 'left_pad', 'dtype': 'tf.int32'}), '(shape=left_pad, dtype=tf.int32)\n', (1871, 1903), True, 'import tensorflow as tf\n'), ((1936, 1976), 'tensorflow.ones', 'tf.ones', ([], {'shape': 'right_pad', 'dtype': 'tf.int32'}), '(shape=right_pad, dtype=tf.int32)\n', (1943, 1976), True, 'import tensorflow as tf\n'), ((2974, 3000), 'tensorflow.equal', 'tf.equal', (['original_rank', '(2)'], {}), '(original_rank, 2)\n', (2982, 3000), True, 'import tensorflow as tf\n'), ((1033, 1124), 'tensorflow.debugging.assert_rank_in', 'tf.debugging.assert_rank_in', (['image', '[2, 3, 4]'], {'message': '"""`image` must be 2/3/4D tensor"""'}), "(image, [2, 3, 4], message=\n '`image` must be 2/3/4D tensor')\n", (1060, 1124), True, 'import tensorflow as tf\n'), ((2325, 2396), 'tensorflow.debugging.assert_rank', 'tf.debugging.assert_rank', (['image', '(4)'], {'message': '"""`image` must be 4D tensor"""'}), "(image, 4, message='`image` must be 4D tensor')\n", (2349, 2396), True, 'import tensorflow as tf\n'), ((2546, 2571), 'tensorflow.squeeze', 'tf.squeeze', (['image', '[0, 3]'], {}), '(image, [0, 3])\n', (2556, 2571), True, 'import tensorflow as tf\n'), ((2616, 2638), 'tensorflow.squeeze', 'tf.squeeze', (['image', '[0]'], {}), '(image, [0])\n', (2626, 2638), True, 'import tensorflow as tf\n')]
fossabot/MolVS
tests/test_charge.py
dc5afca7fcea93ebb0a342b766d70e88d2c0b841
#!/usr/bin/env python # -*- coding: utf-8 -*- """Tests for charge.py""" from __future__ import print_function from __future__ import unicode_literals from __future__ import division import logging from rdkit import Chem from molvs.standardize import Standardizer, standardize_smiles from molvs.charge import Reionizer logging.basicConfig(level=logging.DEBUG) def charge_parent_smiles(smiles, prefer_organic=False): """Utility function that returns the charge parent SMILES for given a SMILES string.""" mol = Chem.MolFromSmiles(smiles.encode('utf8'), sanitize=False) mol = Standardizer(prefer_organic=prefer_organic).charge_parent(mol) if mol: return Chem.MolToSmiles(mol, isomericSmiles=True) def test_charge_parent(): """Test neutralization of ionized acids and bases.""" assert charge_parent_smiles('C(C(=O)[O-])(Cc1n[n-]nn1)(C[NH3+])(C[N+](=O)[O-])') == 'NCC(Cc1nn[nH]n1)(C[N+](=O)[O-])C(=O)O' def test_charge_parent2(): """Test preservation of zwitterion.""" assert charge_parent_smiles('n(C)1cc[n+]2cccc([O-])c12') == 'Cn1cc[n+]2cccc([O-])c12' def test_charge_parent3(): """Choline should be left with a positive charge.""" assert charge_parent_smiles('C[N+](C)(C)CCO') == 'C[N+](C)(C)CCO' def test_charge_parent4(): """This should have the hydrogen removed to give deanol as a charge parent.""" assert charge_parent_smiles('C[NH+](C)CCO') == 'CN(C)CCO' def test_charge_parent5(): """Sodium benzoate to benzoic acid.""" assert charge_parent_smiles('[Na+].O=C([O-])c1ccccc1') == 'O=C(O)c1ccccc1' def test_charge_parent6(): """Benzoate ion to benzoic acid.""" assert charge_parent_smiles('O=C([O-])c1ccccc1') == 'O=C(O)c1ccccc1' def test_charge_parent7(): """Charges in histidine should be neutralized.""" assert charge_parent_smiles('[NH3+]C(Cc1cnc[nH]1)C(=O)[O-]') == 'NC(Cc1cnc[nH]1)C(=O)O' def test_charge_parent8(): """""" assert charge_parent_smiles('C[NH+](C)(C).[Cl-]') == 'CN(C)C' def test_charge_parent9(): """No organic fragments.""" assert charge_parent_smiles('[N+](=O)([O-])[O-]') == 'O=[N+]([O-])[O-]' def test_charge_parent10(): """No organic fragments.""" assert charge_parent_smiles('[N+](=O)([O-])[O-]', prefer_organic=True) == 'O=[N+]([O-])[O-]' def test_charge_parent11(): """Larger inorganic fragment should be chosen.""" assert charge_parent_smiles('[N+](=O)([O-])[O-].[CH2]') == 'O=[N+]([O-])[O-]' def test_charge_parent12(): """Smaller organic fragment should be chosen over larger inorganic fragment.""" assert charge_parent_smiles('[N+](=O)([O-])[O-].[CH2]', prefer_organic=True) == '[CH2]' def test_standardize(): """Test table salt.""" assert standardize_smiles('[Na].[Cl]') == '[Cl-].[Na+]' def test_reionize(): """Test reionizer moves proton to weaker acid.""" mol = Chem.MolFromSmiles('C1=C(C=CC(=C1)[S]([O-])=O)[S](O)(=O)=O') r = Reionizer() mol = r.reionize(mol) assert Chem.MolToSmiles(mol) == 'O=S(O)c1ccc(S(=O)(=O)[O-])cc1' def test_reionize2(): """Test charged carbon doesn't get recognised as alpha-carbon-hydrogen-keto.""" mol = Chem.MolFromSmiles('CCOC(=O)C(=O)[CH-]C#N') r = Reionizer() mol = r.reionize(mol) assert Chem.MolToSmiles(mol) == 'CCOC(=O)C(=O)[CH-]C#N' def test_reionize3(): """""" mol = Chem.MolFromSmiles('C[N+]1=C[CH-]N(C(=N)N)/C1=C/[N+](=O)[O-]') r = Reionizer() mol = r.reionize(mol) assert Chem.MolToSmiles(mol) == 'C[N+]1=CCN(C(=N)N)C1=[C-][N+](=O)[O-]' def test_should_complete(): """Reionization should not infinitely loop forever on these molecules.""" # GitHub Issue #14 assert standardize_smiles('CCCCCCCCCCCCCCCCCC(=O)CC(=C)C(=O)O[Ti](=O)(OC(C)C)C(C)C') == 'C=C(CC(=O)[CH-]CCCCCCCCCCCCCCCC)C(=O)[O-].CC(C)[O-].CCC.[O-2].[Ti+5]' assert standardize_smiles('OP(=O)(O)[O-].OP(=O)([O-])[O-].[O-]S(=O)(=O)[O-].[Na+].[Na+].[Na+].[Mg+2].[Cl-].[Cl-].[K+].[K+]') == 'O=P([O-])(O)O.O=P([O-])([O-])O.O=S(=O)([O-])[O-].[Cl-].[Cl-].[K+].[K+].[Mg+2].[Na+].[Na+].[Na+]' def test_forced_charge1(): """Test forced charge correction maintaining overall neutral charge.""" assert standardize_smiles('[Na].O=C(O)c1ccccc1') == 'O=C([O-])c1ccccc1.[Na+]' def test_forced_charge2(): """Test forced charge correction with no corresponding proton for neutralization.""" # GitHub Issue #15 assert standardize_smiles('[Na].[Na]') == '[Na+].[Na+]' # TODO: Arguably should become selenite ion... O=[Se]([O-])[O-]. Need an AcidBasePair? assert standardize_smiles('[Na].[Na].O[Se](O)=O') == 'O=[Se](O)O.[Na+].[Na+]' # def test_reionize3(): # """Test canonical ionization position when multiple equivalent possibilities.""" # mol = Chem.MolFromSmiles('CC1=CC(=CC=C1S(O)=O)S([O-])=O') # mol2 = Chem.MolFromSmiles('CC1=CC(=CC=C1S([O-])=O)S(O)=O') # r = Reionizer() # mol = r.reionize(mol) # mol2 = r.reionize(mol2) # assert Chem.MolToSmiles(mol) == 'Cc1cc(S(=O)[O-])ccc1S(=O)O' # assert Chem.MolToSmiles(mol2) == 'Cc1cc(S(=O)[O-])ccc1S(=O)O' # assert Chem.MolToSmiles(mol) == Chem.MolToSmiles(mol2) # # # def test_reionize4(): # """Test canonical ionization position when multiple equivalent possibilities.""" # mol = Chem.MolFromSmiles('CCOC(=O)C(=O)[CH-]C#N') # mol2 = Chem.MolFromSmiles('[CH2-]COC(=O)C(=O)CC#N') # r = Reionizer() # mol = r.reionize(mol) # mol2 = r.reionize(mol2) # assert Chem.MolToSmiles(mol) == '[CH2-]COC(=O)C(=O)CC#N' # assert Chem.MolToSmiles(mol2) == '' # assert Chem.MolToSmiles(mol) == Chem.MolToSmiles(mol2)
[((323, 363), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (342, 363), False, 'import logging\n'), ((2873, 2933), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['"""C1=C(C=CC(=C1)[S]([O-])=O)[S](O)(=O)=O"""'], {}), "('C1=C(C=CC(=C1)[S]([O-])=O)[S](O)(=O)=O')\n", (2891, 2933), False, 'from rdkit import Chem\n'), ((2942, 2953), 'molvs.charge.Reionizer', 'Reionizer', ([], {}), '()\n', (2951, 2953), False, 'from molvs.charge import Reionizer\n'), ((3166, 3209), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['"""CCOC(=O)C(=O)[CH-]C#N"""'], {}), "('CCOC(=O)C(=O)[CH-]C#N')\n", (3184, 3209), False, 'from rdkit import Chem\n'), ((3218, 3229), 'molvs.charge.Reionizer', 'Reionizer', ([], {}), '()\n', (3227, 3229), False, 'from molvs.charge import Reionizer\n'), ((3361, 3423), 'rdkit.Chem.MolFromSmiles', 'Chem.MolFromSmiles', (['"""C[N+]1=C[CH-]N(C(=N)N)/C1=C/[N+](=O)[O-]"""'], {}), "('C[N+]1=C[CH-]N(C(=N)N)/C1=C/[N+](=O)[O-]')\n", (3379, 3423), False, 'from rdkit import Chem\n'), ((3432, 3443), 'molvs.charge.Reionizer', 'Reionizer', ([], {}), '()\n', (3441, 3443), False, 'from molvs.charge import Reionizer\n'), ((682, 724), 'rdkit.Chem.MolToSmiles', 'Chem.MolToSmiles', (['mol'], {'isomericSmiles': '(True)'}), '(mol, isomericSmiles=True)\n', (698, 724), False, 'from rdkit import Chem\n'), ((2737, 2768), 'molvs.standardize.standardize_smiles', 'standardize_smiles', (['"""[Na].[Cl]"""'], {}), "('[Na].[Cl]')\n", (2755, 2768), False, 'from molvs.standardize import Standardizer, standardize_smiles\n'), ((2991, 3012), 'rdkit.Chem.MolToSmiles', 'Chem.MolToSmiles', (['mol'], {}), '(mol)\n', (3007, 3012), False, 'from rdkit import Chem\n'), ((3267, 3288), 'rdkit.Chem.MolToSmiles', 'Chem.MolToSmiles', (['mol'], {}), '(mol)\n', (3283, 3288), False, 'from rdkit import Chem\n'), ((3481, 3502), 'rdkit.Chem.MolToSmiles', 'Chem.MolToSmiles', (['mol'], {}), '(mol)\n', (3497, 3502), False, 'from rdkit import Chem\n'), ((3688, 3765), 'molvs.standardize.standardize_smiles', 'standardize_smiles', (['"""CCCCCCCCCCCCCCCCCC(=O)CC(=C)C(=O)O[Ti](=O)(OC(C)C)C(C)C"""'], {}), "('CCCCCCCCCCCCCCCCCC(=O)CC(=C)C(=O)O[Ti](=O)(OC(C)C)C(C)C')\n", (3706, 3765), False, 'from molvs.standardize import Standardizer, standardize_smiles\n'), ((3851, 3978), 'molvs.standardize.standardize_smiles', 'standardize_smiles', (['"""OP(=O)(O)[O-].OP(=O)([O-])[O-].[O-]S(=O)(=O)[O-].[Na+].[Na+].[Na+].[Mg+2].[Cl-].[Cl-].[K+].[K+]"""'], {}), "(\n 'OP(=O)(O)[O-].OP(=O)([O-])[O-].[O-]S(=O)(=O)[O-].[Na+].[Na+].[Na+].[Mg+2].[Cl-].[Cl-].[K+].[K+]'\n )\n", (3869, 3978), False, 'from molvs.standardize import Standardizer, standardize_smiles\n'), ((4186, 4227), 'molvs.standardize.standardize_smiles', 'standardize_smiles', (['"""[Na].O=C(O)c1ccccc1"""'], {}), "('[Na].O=C(O)c1ccccc1')\n", (4204, 4227), False, 'from molvs.standardize import Standardizer, standardize_smiles\n'), ((4409, 4440), 'molvs.standardize.standardize_smiles', 'standardize_smiles', (['"""[Na].[Na]"""'], {}), "('[Na].[Na]')\n", (4427, 4440), False, 'from molvs.standardize import Standardizer, standardize_smiles\n'), ((4560, 4602), 'molvs.standardize.standardize_smiles', 'standardize_smiles', (['"""[Na].[Na].O[Se](O)=O"""'], {}), "('[Na].[Na].O[Se](O)=O')\n", (4578, 4602), False, 'from molvs.standardize import Standardizer, standardize_smiles\n'), ((592, 635), 'molvs.standardize.Standardizer', 'Standardizer', ([], {'prefer_organic': 'prefer_organic'}), '(prefer_organic=prefer_organic)\n', (604, 635), False, 'from molvs.standardize import Standardizer, standardize_smiles\n')]
jochanmin/Blog
backend/users/views.py
465dcb951ebe2e2fabcd81d0c4e0221decc66ccc
from django.shortcuts import render from django.core import serializers from .models import User from django.forms.models import model_to_dict from rest_framework import status from rest_framework.response import Response from rest_framework.decorators import api_view, permission_classes from rest_framework.permissions import IsAuthenticated #회원가입 /users/auth/ #아이디를 등록하는곳 /users/register @api_view(['POST']) def register(request): data=request.data if all(i in data for i in ('email','nickname','password')): email_check=User.objects.filter(email=data['email']) nick_check=User.objects.filter(nickname=data['nickname']) if email_check.exists(): return Response({"message": "email already exists"}, status=status.HTTP_409_CONFLICT) elif nick_check.exists(): return Response({"message": "nickname already exists"}, status=status.HTTP_409_CONFLICT) else: user = User.objects.create_user( data['email'], data['nickname'], data['password'], ) user.save() return Response(model_to_dict(user), status=status.HTTP_201_CREATED) else: return Response({"message": "key error"}, status=status.HTTP_400_BAD_REQUEST) # 토큰을 주면 해당 유저의 정보를 얻는 곳 /users/users @api_view(['GET']) @permission_classes((IsAuthenticated,)) def info(request): user = request.user data = request.data try: searchU=User.objects.filter(email=user.email) if searchU.count==0: return Response({"message": "Can't find info"}, status=status.HTTP_404_NOT_FOUND) data = { 'email': user.email, 'nickname':user.nickname } return Response((data), status=status.HTTP_200_OK) except User.DoesNotExist: return Response({"message": "info does not exists"}, status=status.HTTP_404_NOT_FOUND)
[((394, 412), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (402, 412), False, 'from rest_framework.decorators import api_view, permission_classes\n'), ((1328, 1345), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (1336, 1345), False, 'from rest_framework.decorators import api_view, permission_classes\n'), ((1347, 1385), 'rest_framework.decorators.permission_classes', 'permission_classes', (['(IsAuthenticated,)'], {}), '((IsAuthenticated,))\n', (1365, 1385), False, 'from rest_framework.decorators import api_view, permission_classes\n'), ((1217, 1287), 'rest_framework.response.Response', 'Response', (["{'message': 'key error'}"], {'status': 'status.HTTP_400_BAD_REQUEST'}), "({'message': 'key error'}, status=status.HTTP_400_BAD_REQUEST)\n", (1225, 1287), False, 'from rest_framework.response import Response\n'), ((1751, 1792), 'rest_framework.response.Response', 'Response', (['data'], {'status': 'status.HTTP_200_OK'}), '(data, status=status.HTTP_200_OK)\n', (1759, 1792), False, 'from rest_framework.response import Response\n'), ((701, 779), 'rest_framework.response.Response', 'Response', (["{'message': 'email already exists'}"], {'status': 'status.HTTP_409_CONFLICT'}), "({'message': 'email already exists'}, status=status.HTTP_409_CONFLICT)\n", (709, 779), False, 'from rest_framework.response import Response\n'), ((1564, 1638), 'rest_framework.response.Response', 'Response', (['{\'message\': "Can\'t find info"}'], {'status': 'status.HTTP_404_NOT_FOUND'}), '({\'message\': "Can\'t find info"}, status=status.HTTP_404_NOT_FOUND)\n', (1572, 1638), False, 'from rest_framework.response import Response\n'), ((1840, 1919), 'rest_framework.response.Response', 'Response', (["{'message': 'info does not exists'}"], {'status': 'status.HTTP_404_NOT_FOUND'}), "({'message': 'info does not exists'}, status=status.HTTP_404_NOT_FOUND)\n", (1848, 1919), False, 'from rest_framework.response import Response\n'), ((833, 919), 'rest_framework.response.Response', 'Response', (["{'message': 'nickname already exists'}"], {'status': 'status.HTTP_409_CONFLICT'}), "({'message': 'nickname already exists'}, status=status.\n HTTP_409_CONFLICT)\n", (841, 919), False, 'from rest_framework.response import Response\n'), ((1139, 1158), 'django.forms.models.model_to_dict', 'model_to_dict', (['user'], {}), '(user)\n', (1152, 1158), False, 'from django.forms.models import model_to_dict\n')]
MrRollyPanda/astral
src/test/test_Location.py
5a1b013c945fa902b475ff0fa6769f0d43fe2999
# -*- coding: utf-8 -*- from pytest import raises from astral import Astral, AstralError, Location import datetime import pytz def datetime_almost_equal(datetime1, datetime2, seconds=60): dd = datetime1 - datetime2 sd = (dd.days * 24 * 60 * 60) + dd.seconds return abs(sd) <= seconds def test_Location_Name(): c = Location() assert c.name == 'Greenwich' c.name = 'London' assert c.name == 'London' c.name = 'Köln' assert c.name == 'Köln' def test_Location_Country(): c = Location() assert c.region == 'England' c.region = 'Australia' assert c.region == 'Australia' def test_Location_Elevation(): dd = Astral() c = dd['London'] assert c.elevation == 24 def test_Location_TimezoneName(): c = Location() assert c.timezone == 'Europe/London' c.name = 'Asia/Riyadh' assert c.name == 'Asia/Riyadh' def test_Location_TimezoneNameNoLocation(): c = Location() c._timezone_group = 'Europe' c._timezone_location = '' assert c.timezone == 'Europe' def test_Location_TimezoneNameBad(): c = Location() with raises(ValueError): c.timezone = 'bad/timezone' def test_Location_TimezoneLookup(): c = Location() assert c.tz == pytz.timezone('Europe/London') c.timezone='Europe/Stockholm' assert c.tz == pytz.timezone('Europe/Stockholm') def test_Location_TimezoneLookupBad(): c = Location() c._timezone_group = 'bad' c._timezone_location = 'timezone' with raises(AstralError): c.tz def test_Location_Sun(): c = Location() c.sun() def test_Location_Dawn(): c = Location() c.dawn() def test_Location_DawnUTC(): c = Location() c.dawn(local=False) def test_Location_Sunrise(): c = Location() c.sunrise() def test_Location_SunriseUTC(): c = Location() c.sunrise(local=False) def test_Location_SolarNoon(): c = Location() c.solar_noon() def test_Location_SolarNoonUTC(): c = Location() c.solar_noon(local=False) def test_Location_Dusk(): c = Location() c.dusk() def test_Location_DuskUTC(): c = Location() c.dusk(local=False) def test_Location_Sunset(): c = Location() c.sunset() def test_Location_SunsetUTC(): c = Location() c.sunset(local=False) def test_Location_SolarElevation(): dd = Astral() location = dd['Riyadh'] dt = datetime.datetime(2015, 12, 14, 8, 0, 0) dt = location.tz.localize(dt) elevation = location.solar_elevation(dt) assert abs(elevation - 17) < 0.5 def test_Location_SolarAzimuth(): dd = Astral() location = dd['Riyadh'] dt = datetime.datetime(2015, 12, 14, 8, 0, 0) dt = location.tz.localize(dt) azimuth = location.solar_azimuth(dt) assert abs(azimuth - 126) < 0.5 def test_Location_TimeAtElevation(): dd = Astral() location = dd['New Delhi'] test_data = { datetime.date(2016, 1, 5): datetime.datetime(2016, 1, 5, 10, 0), } for day, cdt in test_data.items(): cdt = location.tz.localize(cdt) dt = location.time_at_elevation(28, date=day) assert datetime_almost_equal(dt, cdt, seconds=600) def test_Location_SolarDepression(): c = Location(("Heidelberg", "Germany", 49.412, -8.71, "Europe/Berlin")) c.solar_depression = 'nautical' assert c.solar_depression == 12 c.solar_depression = 18 assert c.solar_depression == 18 def test_Location_Moon(): d = datetime.date(2017, 12, 1) c=Location() assert c.moon_phase(date=d) == 11 def test_Location_TzError(): with raises(AttributeError): c = Location() c.tz = 1 def test_Location_equality(): c1 = Location() c2 = Location() t = (c1, c2) assert c1 == c2 assert len(set(t)) == 1 c1 = Location(["Oslo", "Norway", 59.9, 10.7, "Europe/Oslo", 0]) c2 = Location(["Oslo", "Norway", 59.9, 10.7, "Europe/Oslo", 0]) c3 = Location(["Stockholm", "Sweden", 59.3, 18, "Europe/Stockholm", 0]) t1 = (c1, c2) t2 = (c1, c3) assert c1 == c2 assert len(set(t1)) == 1 assert c1 != c3 assert len(set(t2)) == 2
[((335, 345), 'astral.Location', 'Location', ([], {}), '()\n', (343, 345), False, 'from astral import Astral, AstralError, Location\n'), ((518, 528), 'astral.Location', 'Location', ([], {}), '()\n', (526, 528), False, 'from astral import Astral, AstralError, Location\n'), ((666, 674), 'astral.Astral', 'Astral', ([], {}), '()\n', (672, 674), False, 'from astral import Astral, AstralError, Location\n'), ((770, 780), 'astral.Location', 'Location', ([], {}), '()\n', (778, 780), False, 'from astral import Astral, AstralError, Location\n'), ((938, 948), 'astral.Location', 'Location', ([], {}), '()\n', (946, 948), False, 'from astral import Astral, AstralError, Location\n'), ((1093, 1103), 'astral.Location', 'Location', ([], {}), '()\n', (1101, 1103), False, 'from astral import Astral, AstralError, Location\n'), ((1215, 1225), 'astral.Location', 'Location', ([], {}), '()\n', (1223, 1225), False, 'from astral import Astral, AstralError, Location\n'), ((1412, 1422), 'astral.Location', 'Location', ([], {}), '()\n', (1420, 1422), False, 'from astral import Astral, AstralError, Location\n'), ((1569, 1579), 'astral.Location', 'Location', ([], {}), '()\n', (1577, 1579), False, 'from astral import Astral, AstralError, Location\n'), ((1628, 1638), 'astral.Location', 'Location', ([], {}), '()\n', (1636, 1638), False, 'from astral import Astral, AstralError, Location\n'), ((1691, 1701), 'astral.Location', 'Location', ([], {}), '()\n', (1699, 1701), False, 'from astral import Astral, AstralError, Location\n'), ((1765, 1775), 'astral.Location', 'Location', ([], {}), '()\n', (1773, 1775), False, 'from astral import Astral, AstralError, Location\n'), ((1834, 1844), 'astral.Location', 'Location', ([], {}), '()\n', (1842, 1844), False, 'from astral import Astral, AstralError, Location\n'), ((1913, 1923), 'astral.Location', 'Location', ([], {}), '()\n', (1921, 1923), False, 'from astral import Astral, AstralError, Location\n'), ((1987, 1997), 'astral.Location', 'Location', ([], {}), '()\n', (1995, 1997), False, 'from astral import Astral, AstralError, Location\n'), ((2064, 2074), 'astral.Location', 'Location', ([], {}), '()\n', (2072, 2074), False, 'from astral import Astral, AstralError, Location\n'), ((2127, 2137), 'astral.Location', 'Location', ([], {}), '()\n', (2135, 2137), False, 'from astral import Astral, AstralError, Location\n'), ((2200, 2210), 'astral.Location', 'Location', ([], {}), '()\n', (2208, 2210), False, 'from astral import Astral, AstralError, Location\n'), ((2267, 2277), 'astral.Location', 'Location', ([], {}), '()\n', (2275, 2277), False, 'from astral import Astral, AstralError, Location\n'), ((2351, 2359), 'astral.Astral', 'Astral', ([], {}), '()\n', (2357, 2359), False, 'from astral import Astral, AstralError, Location\n'), ((2397, 2437), 'datetime.datetime', 'datetime.datetime', (['(2015)', '(12)', '(14)', '(8)', '(0)', '(0)'], {}), '(2015, 12, 14, 8, 0, 0)\n', (2414, 2437), False, 'import datetime\n'), ((2599, 2607), 'astral.Astral', 'Astral', ([], {}), '()\n', (2605, 2607), False, 'from astral import Astral, AstralError, Location\n'), ((2645, 2685), 'datetime.datetime', 'datetime.datetime', (['(2015)', '(12)', '(14)', '(8)', '(0)', '(0)'], {}), '(2015, 12, 14, 8, 0, 0)\n', (2662, 2685), False, 'import datetime\n'), ((2845, 2853), 'astral.Astral', 'Astral', ([], {}), '()\n', (2851, 2853), False, 'from astral import Astral, AstralError, Location\n'), ((3223, 3290), 'astral.Location', 'Location', (["('Heidelberg', 'Germany', 49.412, -8.71, 'Europe/Berlin')"], {}), "(('Heidelberg', 'Germany', 49.412, -8.71, 'Europe/Berlin'))\n", (3231, 3290), False, 'from astral import Astral, AstralError, Location\n'), ((3464, 3490), 'datetime.date', 'datetime.date', (['(2017)', '(12)', '(1)'], {}), '(2017, 12, 1)\n', (3477, 3490), False, 'import datetime\n'), ((3497, 3507), 'astral.Location', 'Location', ([], {}), '()\n', (3505, 3507), False, 'from astral import Astral, AstralError, Location\n'), ((3691, 3701), 'astral.Location', 'Location', ([], {}), '()\n', (3699, 3701), False, 'from astral import Astral, AstralError, Location\n'), ((3711, 3721), 'astral.Location', 'Location', ([], {}), '()\n', (3719, 3721), False, 'from astral import Astral, AstralError, Location\n'), ((3797, 3855), 'astral.Location', 'Location', (["['Oslo', 'Norway', 59.9, 10.7, 'Europe/Oslo', 0]"], {}), "(['Oslo', 'Norway', 59.9, 10.7, 'Europe/Oslo', 0])\n", (3805, 3855), False, 'from astral import Astral, AstralError, Location\n'), ((3865, 3923), 'astral.Location', 'Location', (["['Oslo', 'Norway', 59.9, 10.7, 'Europe/Oslo', 0]"], {}), "(['Oslo', 'Norway', 59.9, 10.7, 'Europe/Oslo', 0])\n", (3873, 3923), False, 'from astral import Astral, AstralError, Location\n'), ((3933, 3999), 'astral.Location', 'Location', (["['Stockholm', 'Sweden', 59.3, 18, 'Europe/Stockholm', 0]"], {}), "(['Stockholm', 'Sweden', 59.3, 18, 'Europe/Stockholm', 0])\n", (3941, 3999), False, 'from astral import Astral, AstralError, Location\n'), ((1113, 1131), 'pytest.raises', 'raises', (['ValueError'], {}), '(ValueError)\n', (1119, 1131), False, 'from pytest import raises\n'), ((1245, 1275), 'pytz.timezone', 'pytz.timezone', (['"""Europe/London"""'], {}), "('Europe/London')\n", (1258, 1275), False, 'import pytz\n'), ((1329, 1362), 'pytz.timezone', 'pytz.timezone', (['"""Europe/Stockholm"""'], {}), "('Europe/Stockholm')\n", (1342, 1362), False, 'import pytz\n'), ((1500, 1519), 'pytest.raises', 'raises', (['AstralError'], {}), '(AstralError)\n', (1506, 1519), False, 'from pytest import raises\n'), ((2912, 2937), 'datetime.date', 'datetime.date', (['(2016)', '(1)', '(5)'], {}), '(2016, 1, 5)\n', (2925, 2937), False, 'import datetime\n'), ((2939, 2975), 'datetime.datetime', 'datetime.datetime', (['(2016)', '(1)', '(5)', '(10)', '(0)'], {}), '(2016, 1, 5, 10, 0)\n', (2956, 2975), False, 'import datetime\n'), ((3586, 3608), 'pytest.raises', 'raises', (['AttributeError'], {}), '(AttributeError)\n', (3592, 3608), False, 'from pytest import raises\n'), ((3622, 3632), 'astral.Location', 'Location', ([], {}), '()\n', (3630, 3632), False, 'from astral import Astral, AstralError, Location\n')]
minjunli/jsonc
__init__.py
a61b72e92729f9177d8d8685deae744244d6be16
from .jsonc import load, loads, dump, dumps
[]
prahal/apitrace
specs/d3d9caps.py
e9426dd61586757d23d7dddc85b3076f477e7f07
########################################################################## # # Copyright 2008-2009 VMware, Inc. # All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. # ##########################################################################/ """d3d9caps.h""" from winapi import * from d3d9types import * D3DVS20CAPS = Flags(DWORD, [ "D3DVS20CAPS_PREDICATION", ]) D3DVSHADERCAPS2_0 = Struct("D3DVSHADERCAPS2_0", [ (D3DVS20CAPS, "Caps"), (INT, "DynamicFlowControlDepth"), (INT, "NumTemps"), (INT, "StaticFlowControlDepth"), ]) D3DPS20CAPS = Flags(DWORD, [ "D3DPS20CAPS_ARBITRARYSWIZZLE", "D3DPS20CAPS_GRADIENTINSTRUCTIONS", "D3DPS20CAPS_PREDICATION", "D3DPS20CAPS_NODEPENDENTREADLIMIT", "D3DPS20CAPS_NOTEXINSTRUCTIONLIMIT", ]) D3DPSHADERCAPS2_0 = Struct("D3DPSHADERCAPS2_0", [ (D3DPS20CAPS, "Caps"), (INT, "DynamicFlowControlDepth"), (INT, "NumTemps"), (INT, "StaticFlowControlDepth"), (INT, "NumInstructionSlots"), ]) D3DCAPS = Flags(DWORD, [ "D3DCAPS_READ_SCANLINE", ]) D3DCAPS2 = Flags(DWORD, [ "D3DCAPS2_FULLSCREENGAMMA", "D3DCAPS2_CANCALIBRATEGAMMA", "D3DCAPS2_RESERVED", "D3DCAPS2_CANMANAGERESOURCE", "D3DCAPS2_DYNAMICTEXTURES", "D3DCAPS2_CANAUTOGENMIPMAP", "D3DCAPS2_CANSHARERESOURCE", ]) D3DCAPS3 = Flags(DWORD, [ "D3DCAPS3_RESERVED", "D3DCAPS3_ALPHA_FULLSCREEN_FLIP_OR_DISCARD", "D3DCAPS3_LINEAR_TO_SRGB_PRESENTATION", "D3DCAPS3_COPY_TO_VIDMEM", "D3DCAPS3_COPY_TO_SYSTEMMEM", ]) D3DPRESENT_INTERVAL = Flags(DWORD, [ #"D3DPRESENT_INTERVAL_DEFAULT", # 0 "D3DPRESENT_INTERVAL_ONE", "D3DPRESENT_INTERVAL_TWO", "D3DPRESENT_INTERVAL_THREE", "D3DPRESENT_INTERVAL_FOUR", "D3DPRESENT_INTERVAL_IMMEDIATE", ]) D3DCURSORCAPS = Flags(DWORD, [ "D3DCURSORCAPS_COLOR", "D3DCURSORCAPS_LOWRES", ]) D3DDEVCAPS = Flags(DWORD, [ "D3DDEVCAPS_EXECUTESYSTEMMEMORY", "D3DDEVCAPS_EXECUTEVIDEOMEMORY", "D3DDEVCAPS_TLVERTEXSYSTEMMEMORY", "D3DDEVCAPS_TLVERTEXVIDEOMEMORY", "D3DDEVCAPS_TEXTURESYSTEMMEMORY", "D3DDEVCAPS_TEXTUREVIDEOMEMORY", "D3DDEVCAPS_DRAWPRIMTLVERTEX", "D3DDEVCAPS_CANRENDERAFTERFLIP", "D3DDEVCAPS_TEXTURENONLOCALVIDMEM", "D3DDEVCAPS_DRAWPRIMITIVES2", "D3DDEVCAPS_SEPARATETEXTUREMEMORIES", "D3DDEVCAPS_DRAWPRIMITIVES2EX", "D3DDEVCAPS_HWTRANSFORMANDLIGHT", "D3DDEVCAPS_CANBLTSYSTONONLOCAL", "D3DDEVCAPS_HWRASTERIZATION", "D3DDEVCAPS_PUREDEVICE", "D3DDEVCAPS_QUINTICRTPATCHES", "D3DDEVCAPS_RTPATCHES", "D3DDEVCAPS_RTPATCHHANDLEZERO", "D3DDEVCAPS_NPATCHES", ]) D3DPMISCCAPS = Flags(DWORD, [ "D3DPMISCCAPS_MASKZ", "D3DPMISCCAPS_CULLNONE", "D3DPMISCCAPS_CULLCW", "D3DPMISCCAPS_CULLCCW", "D3DPMISCCAPS_COLORWRITEENABLE", "D3DPMISCCAPS_CLIPPLANESCALEDPOINTS", "D3DPMISCCAPS_CLIPTLVERTS", "D3DPMISCCAPS_TSSARGTEMP", "D3DPMISCCAPS_BLENDOP", "D3DPMISCCAPS_NULLREFERENCE", "D3DPMISCCAPS_INDEPENDENTWRITEMASKS", "D3DPMISCCAPS_PERSTAGECONSTANT", "D3DPMISCCAPS_FOGANDSPECULARALPHA", "D3DPMISCCAPS_SEPARATEALPHABLEND", "D3DPMISCCAPS_MRTINDEPENDENTBITDEPTHS", "D3DPMISCCAPS_MRTPOSTPIXELSHADERBLENDING", "D3DPMISCCAPS_FOGVERTEXCLAMPED", "D3DPMISCCAPS_POSTBLENDSRGBCONVERT", ]) D3DLINECAPS = Flags(DWORD, [ "D3DLINECAPS_TEXTURE", "D3DLINECAPS_ZTEST", "D3DLINECAPS_BLEND", "D3DLINECAPS_ALPHACMP", "D3DLINECAPS_FOG", "D3DLINECAPS_ANTIALIAS", ]) D3DPRASTERCAPS = Flags(DWORD, [ "D3DPRASTERCAPS_DITHER", "D3DPRASTERCAPS_ZTEST", "D3DPRASTERCAPS_FOGVERTEX", "D3DPRASTERCAPS_FOGTABLE", "D3DPRASTERCAPS_MIPMAPLODBIAS", "D3DPRASTERCAPS_ZBUFFERLESSHSR", "D3DPRASTERCAPS_FOGRANGE", "D3DPRASTERCAPS_ANISOTROPY", "D3DPRASTERCAPS_WBUFFER", "D3DPRASTERCAPS_WFOG", "D3DPRASTERCAPS_ZFOG", "D3DPRASTERCAPS_COLORPERSPECTIVE", "D3DPRASTERCAPS_SCISSORTEST", "D3DPRASTERCAPS_SLOPESCALEDEPTHBIAS", "D3DPRASTERCAPS_DEPTHBIAS", "D3DPRASTERCAPS_MULTISAMPLE_TOGGLE", ]) D3DPCMPCAPS = Flags(DWORD, [ "D3DPCMPCAPS_NEVER", "D3DPCMPCAPS_LESS", "D3DPCMPCAPS_EQUAL", "D3DPCMPCAPS_LESSEQUAL", "D3DPCMPCAPS_GREATER", "D3DPCMPCAPS_NOTEQUAL", "D3DPCMPCAPS_GREATEREQUAL", "D3DPCMPCAPS_ALWAYS", ]) D3DPBLENDCAPS = Flags(DWORD, [ "D3DPBLENDCAPS_ZERO", "D3DPBLENDCAPS_ONE", "D3DPBLENDCAPS_SRCCOLOR", "D3DPBLENDCAPS_INVSRCCOLOR", "D3DPBLENDCAPS_SRCALPHA", "D3DPBLENDCAPS_INVSRCALPHA", "D3DPBLENDCAPS_DESTALPHA", "D3DPBLENDCAPS_INVDESTALPHA", "D3DPBLENDCAPS_DESTCOLOR", "D3DPBLENDCAPS_INVDESTCOLOR", "D3DPBLENDCAPS_SRCALPHASAT", "D3DPBLENDCAPS_BOTHSRCALPHA", "D3DPBLENDCAPS_BOTHINVSRCALPHA", "D3DPBLENDCAPS_BLENDFACTOR", "D3DPBLENDCAPS_SRCCOLOR2", "D3DPBLENDCAPS_INVSRCCOLOR2", ]) D3DPSHADECAPS = Flags(DWORD, [ "D3DPSHADECAPS_COLORGOURAUDRGB", "D3DPSHADECAPS_SPECULARGOURAUDRGB", "D3DPSHADECAPS_ALPHAGOURAUDBLEND", "D3DPSHADECAPS_FOGGOURAUD", ]) D3DPTEXTURECAPS = Flags(DWORD, [ "D3DPTEXTURECAPS_PERSPECTIVE", "D3DPTEXTURECAPS_POW2", "D3DPTEXTURECAPS_ALPHA", "D3DPTEXTURECAPS_SQUAREONLY", "D3DPTEXTURECAPS_TEXREPEATNOTSCALEDBYSIZE", "D3DPTEXTURECAPS_ALPHAPALETTE", "D3DPTEXTURECAPS_NONPOW2CONDITIONAL", "D3DPTEXTURECAPS_PROJECTED", "D3DPTEXTURECAPS_CUBEMAP", "D3DPTEXTURECAPS_VOLUMEMAP", "D3DPTEXTURECAPS_MIPMAP", "D3DPTEXTURECAPS_MIPVOLUMEMAP", "D3DPTEXTURECAPS_MIPCUBEMAP", "D3DPTEXTURECAPS_CUBEMAP_POW2", "D3DPTEXTURECAPS_VOLUMEMAP_POW2", "D3DPTEXTURECAPS_NOPROJECTEDBUMPENV", ]) D3DPTFILTERCAPS = Flags(DWORD, [ "D3DPTFILTERCAPS_MINFPOINT", "D3DPTFILTERCAPS_MINFLINEAR", "D3DPTFILTERCAPS_MINFANISOTROPIC", "D3DPTFILTERCAPS_MINFPYRAMIDALQUAD", "D3DPTFILTERCAPS_MINFGAUSSIANQUAD", "D3DPTFILTERCAPS_MIPFPOINT", "D3DPTFILTERCAPS_MIPFLINEAR", "D3DPTFILTERCAPS_CONVOLUTIONMONO", "D3DPTFILTERCAPS_MAGFPOINT", "D3DPTFILTERCAPS_MAGFLINEAR", "D3DPTFILTERCAPS_MAGFANISOTROPIC", "D3DPTFILTERCAPS_MAGFPYRAMIDALQUAD", "D3DPTFILTERCAPS_MAGFGAUSSIANQUAD", ]) D3DPTADDRESSCAPS = Flags(DWORD, [ "D3DPTADDRESSCAPS_WRAP", "D3DPTADDRESSCAPS_MIRROR", "D3DPTADDRESSCAPS_CLAMP", "D3DPTADDRESSCAPS_BORDER", "D3DPTADDRESSCAPS_INDEPENDENTUV", "D3DPTADDRESSCAPS_MIRRORONCE", ]) D3DSTENCILCAPS = Flags(DWORD, [ "D3DSTENCILCAPS_KEEP", "D3DSTENCILCAPS_ZERO", "D3DSTENCILCAPS_REPLACE", "D3DSTENCILCAPS_INCRSAT", "D3DSTENCILCAPS_DECRSAT", "D3DSTENCILCAPS_INVERT", "D3DSTENCILCAPS_INCR", "D3DSTENCILCAPS_DECR", "D3DSTENCILCAPS_TWOSIDED", ]) D3DTEXOPCAPS = Flags(DWORD, [ "D3DTEXOPCAPS_DISABLE", "D3DTEXOPCAPS_SELECTARG1", "D3DTEXOPCAPS_SELECTARG2", "D3DTEXOPCAPS_MODULATE", "D3DTEXOPCAPS_MODULATE2X", "D3DTEXOPCAPS_MODULATE4X", "D3DTEXOPCAPS_ADD", "D3DTEXOPCAPS_ADDSIGNED", "D3DTEXOPCAPS_ADDSIGNED2X", "D3DTEXOPCAPS_SUBTRACT", "D3DTEXOPCAPS_ADDSMOOTH", "D3DTEXOPCAPS_BLENDDIFFUSEALPHA", "D3DTEXOPCAPS_BLENDTEXTUREALPHA", "D3DTEXOPCAPS_BLENDFACTORALPHA", "D3DTEXOPCAPS_BLENDTEXTUREALPHAPM", "D3DTEXOPCAPS_BLENDCURRENTALPHA", "D3DTEXOPCAPS_PREMODULATE", "D3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR", "D3DTEXOPCAPS_MODULATECOLOR_ADDALPHA", "D3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR", "D3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA", "D3DTEXOPCAPS_BUMPENVMAP", "D3DTEXOPCAPS_BUMPENVMAPLUMINANCE", "D3DTEXOPCAPS_DOTPRODUCT3", "D3DTEXOPCAPS_MULTIPLYADD", "D3DTEXOPCAPS_LERP", ]) D3DFVFCAPS = Flags(DWORD, [ "D3DFVFCAPS_TEXCOORDCOUNTMASK", "D3DFVFCAPS_DONOTSTRIPELEMENTS", "D3DFVFCAPS_PSIZE", ]) D3DVTXPCAPS = Flags(DWORD, [ "D3DVTXPCAPS_TEXGEN", "D3DVTXPCAPS_MATERIALSOURCE7", "D3DVTXPCAPS_DIRECTIONALLIGHTS", "D3DVTXPCAPS_POSITIONALLIGHTS", "D3DVTXPCAPS_LOCALVIEWER", "D3DVTXPCAPS_TWEENING", "D3DVTXPCAPS_TEXGEN_SPHEREMAP", "D3DVTXPCAPS_NO_TEXGEN_NONLOCALVIEWER", ]) D3DDEVCAPS2 = Flags(DWORD, [ "D3DDEVCAPS2_STREAMOFFSET", "D3DDEVCAPS2_DMAPNPATCH", "D3DDEVCAPS2_ADAPTIVETESSRTPATCH", "D3DDEVCAPS2_ADAPTIVETESSNPATCH", "D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES", "D3DDEVCAPS2_PRESAMPLEDDMAPNPATCH", "D3DDEVCAPS2_VERTEXELEMENTSCANSHARESTREAMOFFSET", ]) D3DDTCAPS = Flags(DWORD, [ "D3DDTCAPS_UBYTE4", "D3DDTCAPS_UBYTE4N", "D3DDTCAPS_SHORT2N", "D3DDTCAPS_SHORT4N", "D3DDTCAPS_USHORT2N", "D3DDTCAPS_USHORT4N", "D3DDTCAPS_UDEC3", "D3DDTCAPS_DEC3N", "D3DDTCAPS_FLOAT16_2", "D3DDTCAPS_FLOAT16_4", ]) #D3DPS_VERSION = Enum("DWORD", [ # "D3DPS_VERSION(0,0)", # "D3DPS_VERSION(1,0)", # "D3DPS_VERSION(1,1)", # "D3DPS_VERSION(1,2)", # "D3DPS_VERSION(1,3)", # "D3DPS_VERSION(1,4)", # "D3DPS_VERSION(2,0)", # "D3DPS_VERSION(3,0)", #]) D3DPS_VERSION = DWORD #D3DVS_VERSION = Enum("DWORD", [ # "D3DVS_VERSION(0,0)", # "D3DVS_VERSION(1,0)", # "D3DVS_VERSION(1,1)", # "D3DVS_VERSION(2,0)", # "D3DVS_VERSION(3,0)", #]) D3DVS_VERSION = DWORD D3DCAPS9 = Struct("D3DCAPS9", [ (D3DDEVTYPE, "DeviceType"), (UINT, "AdapterOrdinal"), (D3DCAPS, "Caps"), (D3DCAPS2, "Caps2"), (D3DCAPS3, "Caps3"), (D3DPRESENT_INTERVAL, "PresentationIntervals"), (D3DCURSORCAPS, "CursorCaps"), (D3DDEVCAPS, "DevCaps"), (D3DPMISCCAPS, "PrimitiveMiscCaps"), (D3DPRASTERCAPS, "RasterCaps"), (D3DPCMPCAPS, "ZCmpCaps"), (D3DPBLENDCAPS, "SrcBlendCaps"), (D3DPBLENDCAPS, "DestBlendCaps"), (D3DPCMPCAPS, "AlphaCmpCaps"), (D3DPSHADECAPS, "ShadeCaps"), (D3DPTEXTURECAPS, "TextureCaps"), (D3DPTFILTERCAPS, "TextureFilterCaps"), (D3DPTFILTERCAPS, "CubeTextureFilterCaps"), (D3DPTFILTERCAPS, "VolumeTextureFilterCaps"), (D3DPTADDRESSCAPS, "TextureAddressCaps"), (D3DPTADDRESSCAPS, "VolumeTextureAddressCaps"), (D3DLINECAPS, "LineCaps"), (DWORD, "MaxTextureWidth"), (DWORD, "MaxTextureHeight"), (DWORD, "MaxVolumeExtent"), (DWORD, "MaxTextureRepeat"), (DWORD, "MaxTextureAspectRatio"), (DWORD, "MaxAnisotropy"), (Float, "MaxVertexW"), (Float, "GuardBandLeft"), (Float, "GuardBandTop"), (Float, "GuardBandRight"), (Float, "GuardBandBottom"), (Float, "ExtentsAdjust"), (D3DSTENCILCAPS, "StencilCaps"), (D3DFVFCAPS, "FVFCaps"), (D3DTEXOPCAPS, "TextureOpCaps"), (DWORD, "MaxTextureBlendStages"), (DWORD, "MaxSimultaneousTextures"), (D3DVTXPCAPS, "VertexProcessingCaps"), (DWORD, "MaxActiveLights"), (DWORD, "MaxUserClipPlanes"), (DWORD, "MaxVertexBlendMatrices"), (DWORD, "MaxVertexBlendMatrixIndex"), (Float, "MaxPointSize"), (DWORD, "MaxPrimitiveCount"), (DWORD, "MaxVertexIndex"), (DWORD, "MaxStreams"), (DWORD, "MaxStreamStride"), (D3DVS_VERSION, "VertexShaderVersion"), (DWORD, "MaxVertexShaderConst"), (D3DPS_VERSION, "PixelShaderVersion"), (Float, "PixelShader1xMaxValue"), (D3DDEVCAPS2, "DevCaps2"), (Float, "MaxNpatchTessellationLevel"), (DWORD, "Reserved5"), (UINT, "MasterAdapterOrdinal"), (UINT, "AdapterOrdinalInGroup"), (UINT, "NumberOfAdaptersInGroup"), (D3DDTCAPS, "DeclTypes"), (DWORD, "NumSimultaneousRTs"), (D3DPTFILTERCAPS, "StretchRectFilterCaps"), (D3DVSHADERCAPS2_0, "VS20Caps"), (D3DPSHADERCAPS2_0, "PS20Caps"), (D3DPTFILTERCAPS, "VertexTextureFilterCaps"), (DWORD, "MaxVShaderInstructionsExecuted"), (DWORD, "MaxPShaderInstructionsExecuted"), (DWORD, "MaxVertexShader30InstructionSlots"), (DWORD, "MaxPixelShader30InstructionSlots"), ])
[]
NimBuzz01/Project-Miika_SDGP
miika_nlu/venv/Lib/site-packages/tqdm/_dist_ver.py
08ad1aafafbe9f47c59bd1568b8ac367fefe5503
__version__ = '4.64.0'
[]
katetolstaya/gym-flock
gym_flock/envs/old/mapping.py
3236d1dafcb1b9be0cf78b471672e8becb2d37af
import gym from gym import spaces, error, utils from gym.utils import seeding import numpy as np import configparser from os import path import matplotlib.pyplot as plt from matplotlib.pyplot import gca font = {'family': 'sans-serif', 'weight': 'bold', 'size': 14} class MappingEnv(gym.Env): def __init__(self): # config_file = path.join(path.dirname(__file__), "params_flock.cfg") # config = configparser.ConfigParser() # config.read(config_file) # config = config['flock'] self.nearest_agents = 7 self.nearest_targets = 7 self.mean_pooling = True # normalize the adjacency matrix by the number of neighbors or not self.centralized = True # number states per agent self.nx_system = 4 # number of actions per agent self.nu = 2 # default problem parameters self.n_agents = 100 # int(config['network_size']) # self.comm_radius = 0.9 # float(config['comm_radius']) self.dt = 0.1 # #float(config['system_dt']) self.v_max = 5.0 # float(config['max_vel_init']) self.v_bias = self.v_max # intitialize state matrices self.x = None self.u = None self.mean_vel = None self.init_vel = None self.greedy_action = None self.diff = None self.r2 = None self.adj_mat = None self.adj_mat_mean = None self.diff_targets = None self.r2_targets = None self.target_observed = None self.state_network = None self.state_values = None self.reward = None self.max_accel = 1 # self.action_space = spaces.Box(low=-self.max_accel, high=self.max_accel, shape=(2 * self.n_agents,), # dtype=np.float32) # # self.observation_space = spaces.Box(low=-np.Inf, high=np.Inf, shape=(self.n_agents, ), # dtype=np.float32) # target initialization self.px_max = 100 self.py_max = 100 x = np.linspace(-1.0 * self.px_max, self.px_max, self.n_agents) y = np.linspace(-1.0 * self.py_max, self.py_max, self.n_agents) tx, ty = np.meshgrid(x, y) tx = tx.reshape((-1, 1)) ty = ty.reshape((-1, 1)) self.obs_rad = 2.0 self.obs_rad2 = self.obs_rad * self.obs_rad self.target_x = np.stack((tx, ty), axis=1).reshape((-1, 2)) self.target_unobserved = np.ones((self.n_agents * self.n_agents, 2), dtype=np.bool) # rendering initialization self.fig = None self.ax = None self.line1 = None self.line2 = None self.action_scalar = 10.0 self.seed() def reset(self): x = np.zeros((self.n_agents, self.nx_system)) self.target_unobserved = np.ones((self.n_agents * self.n_agents, 2), dtype=np.bool) x[:, 0] = np.random.uniform(low=-self.px_max, high=self.px_max, size=(self.n_agents,)) x[:, 1] = np.random.uniform(low=-self.py_max, high=self.py_max, size=(self.n_agents,)) #bias = np.random.uniform(low=-self.v_bias, high=self.v_bias, size=(2,)) x[:, 2] = np.random.uniform(low=-self.v_max, high=self.v_max, size=(self.n_agents,)) #+ bias[0] x[:, 3] = np.random.uniform(low=-self.v_max, high=self.v_max, size=(self.n_agents,)) #+ bias[1] # keep good initialization self.mean_vel = np.mean(x[:, 2:4], axis=0) self.init_vel = x[:, 2:4] self.x = x # self.a_net = self.get_connectivity(self.x) self.compute_helpers() return self.state_values, self.state_network def params_from_cfg(self, args): # TODO pass # # self.comm_radius = args.getfloat('comm_radius') # # self.comm_radius2 = self.comm_radius * self.comm_radius # # self.vr = 1 / self.comm_radius2 + np.log(self.comm_radius2) # # # # self.n_agents = args.getint('n_agents') # # self.r_max = self.r_max * np.sqrt(self.n_agents) # # # self.action_space = spaces.Box(low=-self.max_accel, high=self.max_accel, shape=(2 * self.n_agents,), # # dtype=np.float32) # # # # self.observation_space = spaces.Box(low=-np.Inf, high=np.Inf, shape=(self.n_agents, self.n_features), # # dtype=np.float32) # # self.v_max = args.getfloat('v_max') # self.v_bias = self.v_max # self.dt = args.getfloat('dt') def seed(self, seed=None): self.np_random, seed = seeding.np_random(seed) return [seed] def step(self, u): # u = np.reshape(u, (-1, 2)) assert u.shape == (self.n_agents, self.nu) u = np.clip(u, a_min=-self.max_accel, a_max=self.max_accel) self.u = u * self.action_scalar old_x = np.copy(self.x) # x position self.x[:, 0] = self.x[:, 0] + self.x[:, 2] * self.dt + self.u[:, 0] * self.dt * self.dt * 0.5 # y position self.x[:, 1] = self.x[:, 1] + self.x[:, 3] * self.dt + self.u[:, 1] * self.dt * self.dt * 0.5 # x velocity self.x[:, 2] = self.x[:, 2] + self.u[:, 0] * self.dt # y velocity self.x[:, 3] = self.x[:, 3] + self.u[:, 1] * self.dt # clip velocities self.x[:, 2:4] = np.clip(self.x[:, 2:4], -1.0*self.v_max, self.v_max) dist_traveled = np.sum(np.linalg.norm(self.x[:, 0:2] - old_x[:, 0:2], axis=1)) self.compute_helpers() done = (0 == np.sum(self.target_unobserved)) return (self.state_values, self.state_network), 10.0 * self.reward - dist_traveled, done, {} def compute_helpers(self): # TODO - check this, and initialize stuff in the init(), and try to make more efficient # Neighbors computations self.diff = self.x.reshape((self.n_agents, 1, self.nx_system)) - self.x.reshape( (1, self.n_agents, self.nx_system)) self.r2 = np.multiply(self.diff[:, :, 0], self.diff[:, :, 0]) + np.multiply(self.diff[:, :, 1], self.diff[:, :, 1]) np.fill_diagonal(self.r2, np.Inf) nearest = np.argsort(self.r2, axis=1) obs_neigh = np.zeros((self.n_agents, self.nearest_agents * 4)) self.adj_mat = np.zeros((self.n_agents, self.n_agents)) for i in range(self.nearest_agents): ind2, ind3 = np.meshgrid(nearest[:, i], range(4), indexing='ij') ind1, _ = np.meshgrid(range(self.n_agents), range(4), indexing='ij') obs_neigh[:, i * self.nx_system:(i + 1) * self.nx_system] = np.reshape( self.diff[ind1.flatten(), ind2.flatten(), ind3.flatten()], (-1, 4)) self.adj_mat[:, nearest[:, i]] = 1.0 # Normalize the adjacency matrix by the number of neighbors - results in mean pooling, instead of sum pooling n_neighbors = np.reshape(np.sum(self.adj_mat, axis=1), (self.n_agents, 1)) # correct - checked this n_neighbors[n_neighbors == 0] = 1 self.adj_mat_mean = self.adj_mat / n_neighbors # Targets computations self.diff_targets = self.x[:, 0:2].reshape((self.n_agents, 1, 2)) - self.target_x[ self.target_unobserved].reshape( (1, -1, 2)) self.r2_targets = np.multiply(self.diff_targets[:, :, 0], self.diff_targets[:, :, 0]) + np.multiply( self.diff_targets[:, :, 1], self.diff_targets[:, :, 1]) nearest_targets = np.argsort(self.r2_targets, axis=1) obs_target = np.zeros((self.n_agents, self.nearest_targets * 2)) for i in range(min(self.nearest_targets, np.shape(nearest_targets)[1])): ind2, ind3 = np.meshgrid(nearest_targets[:, i], range(2), indexing='ij') ind1, _ = np.meshgrid(range(self.n_agents), range(2), indexing='ij') obs_target[:, i * 2:(i + 1) * 2] = np.reshape( self.diff_targets[ind1.flatten(), ind2.flatten(), ind3.flatten()], (-1, 2)) self.target_observed = np.any(self.r2_targets < self.obs_rad2, axis=0).reshape((-1, 1)) self.target_unobserved[self.target_unobserved] = np.tile(np.logical_not(self.target_observed), (1, 2)).flatten() self.reward = np.sum(self.target_observed.astype(np.int)) self.state_values = np.hstack((obs_neigh, obs_target)) self.greedy_action = -1.0 * obs_target[:, 0:2] if self.mean_pooling: self.state_network = self.adj_mat_mean else: self.state_network = self.adj_mat def controller(self): """ The controller for flocking from Turner 2003. Returns: the optimal action """ # TODO # return np.zeros((self.n_agents, 2)) return self.greedy_action / 10.0 def render(self, mode='human'): """ Render the environment with agents as points in 2D space """ if self.fig is None: plt.ion() fig = plt.figure() self.ax = fig.add_subplot(111) line1, = self.ax.plot(self.x[:, 0], self.x[:, 1], 'bo') locs = self.target_x[self.target_unobserved].reshape((-1, 2)) line2, = self.ax.plot(locs[:, 0], locs[:, 1], 'rx') plt.ylim(-1.0 * self.py_max, 1.0 * self.py_max) plt.xlim(-1.0 * self.px_max, 1.0 * self.px_max) a = gca() a.set_xticklabels(a.get_xticks(), font) a.set_yticklabels(a.get_yticks(), font) plt.title('GNN Controller') self.fig = fig self.line1 = line1 self.line2 = line2 # TODO render unobserved targets else: self.line1.set_xdata(self.x[:, 0]) self.line1.set_ydata(self.x[:, 1]) locs = self.target_x[self.target_unobserved].reshape((-1,2)) self.line2.set_xdata(locs[:, 0]) self.line2.set_ydata(locs[:, 1]) self.fig.canvas.draw() self.fig.canvas.flush_events() def close(self): pass
[((2106, 2165), 'numpy.linspace', 'np.linspace', (['(-1.0 * self.px_max)', 'self.px_max', 'self.n_agents'], {}), '(-1.0 * self.px_max, self.px_max, self.n_agents)\n', (2117, 2165), True, 'import numpy as np\n'), ((2178, 2237), 'numpy.linspace', 'np.linspace', (['(-1.0 * self.py_max)', 'self.py_max', 'self.n_agents'], {}), '(-1.0 * self.py_max, self.py_max, self.n_agents)\n', (2189, 2237), True, 'import numpy as np\n'), ((2256, 2273), 'numpy.meshgrid', 'np.meshgrid', (['x', 'y'], {}), '(x, y)\n', (2267, 2273), True, 'import numpy as np\n'), ((2522, 2580), 'numpy.ones', 'np.ones', (['(self.n_agents * self.n_agents, 2)'], {'dtype': 'np.bool'}), '((self.n_agents * self.n_agents, 2), dtype=np.bool)\n', (2529, 2580), True, 'import numpy as np\n'), ((2805, 2846), 'numpy.zeros', 'np.zeros', (['(self.n_agents, self.nx_system)'], {}), '((self.n_agents, self.nx_system))\n', (2813, 2846), True, 'import numpy as np\n'), ((2880, 2938), 'numpy.ones', 'np.ones', (['(self.n_agents * self.n_agents, 2)'], {'dtype': 'np.bool'}), '((self.n_agents * self.n_agents, 2), dtype=np.bool)\n', (2887, 2938), True, 'import numpy as np\n'), ((2958, 3034), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-self.px_max)', 'high': 'self.px_max', 'size': '(self.n_agents,)'}), '(low=-self.px_max, high=self.px_max, size=(self.n_agents,))\n', (2975, 3034), True, 'import numpy as np\n'), ((3053, 3129), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-self.py_max)', 'high': 'self.py_max', 'size': '(self.n_agents,)'}), '(low=-self.py_max, high=self.py_max, size=(self.n_agents,))\n', (3070, 3129), True, 'import numpy as np\n'), ((3230, 3304), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-self.v_max)', 'high': 'self.v_max', 'size': '(self.n_agents,)'}), '(low=-self.v_max, high=self.v_max, size=(self.n_agents,))\n', (3247, 3304), True, 'import numpy as np\n'), ((3334, 3408), 'numpy.random.uniform', 'np.random.uniform', ([], {'low': '(-self.v_max)', 'high': 'self.v_max', 'size': '(self.n_agents,)'}), '(low=-self.v_max, high=self.v_max, size=(self.n_agents,))\n', (3351, 3408), True, 'import numpy as np\n'), ((3480, 3506), 'numpy.mean', 'np.mean', (['x[:, 2:4]'], {'axis': '(0)'}), '(x[:, 2:4], axis=0)\n', (3487, 3506), True, 'import numpy as np\n'), ((4658, 4681), 'gym.utils.seeding.np_random', 'seeding.np_random', (['seed'], {}), '(seed)\n', (4675, 4681), False, 'from gym.utils import seeding\n'), ((4829, 4884), 'numpy.clip', 'np.clip', (['u'], {'a_min': '(-self.max_accel)', 'a_max': 'self.max_accel'}), '(u, a_min=-self.max_accel, a_max=self.max_accel)\n', (4836, 4884), True, 'import numpy as np\n'), ((4942, 4957), 'numpy.copy', 'np.copy', (['self.x'], {}), '(self.x)\n', (4949, 4957), True, 'import numpy as np\n'), ((5421, 5475), 'numpy.clip', 'np.clip', (['self.x[:, 2:4]', '(-1.0 * self.v_max)', 'self.v_max'], {}), '(self.x[:, 2:4], -1.0 * self.v_max, self.v_max)\n', (5428, 5475), True, 'import numpy as np\n'), ((6265, 6298), 'numpy.fill_diagonal', 'np.fill_diagonal', (['self.r2', 'np.Inf'], {}), '(self.r2, np.Inf)\n', (6281, 6298), True, 'import numpy as np\n'), ((6318, 6345), 'numpy.argsort', 'np.argsort', (['self.r2'], {'axis': '(1)'}), '(self.r2, axis=1)\n', (6328, 6345), True, 'import numpy as np\n'), ((6366, 6416), 'numpy.zeros', 'np.zeros', (['(self.n_agents, self.nearest_agents * 4)'], {}), '((self.n_agents, self.nearest_agents * 4))\n', (6374, 6416), True, 'import numpy as np\n'), ((6440, 6480), 'numpy.zeros', 'np.zeros', (['(self.n_agents, self.n_agents)'], {}), '((self.n_agents, self.n_agents))\n', (6448, 6480), True, 'import numpy as np\n'), ((7634, 7669), 'numpy.argsort', 'np.argsort', (['self.r2_targets'], {'axis': '(1)'}), '(self.r2_targets, axis=1)\n', (7644, 7669), True, 'import numpy as np\n'), ((7691, 7742), 'numpy.zeros', 'np.zeros', (['(self.n_agents, self.nearest_targets * 2)'], {}), '((self.n_agents, self.nearest_targets * 2))\n', (7699, 7742), True, 'import numpy as np\n'), ((8456, 8490), 'numpy.hstack', 'np.hstack', (['(obs_neigh, obs_target)'], {}), '((obs_neigh, obs_target))\n', (8465, 8490), True, 'import numpy as np\n'), ((5506, 5560), 'numpy.linalg.norm', 'np.linalg.norm', (['(self.x[:, 0:2] - old_x[:, 0:2])'], {'axis': '(1)'}), '(self.x[:, 0:2] - old_x[:, 0:2], axis=1)\n', (5520, 5560), True, 'import numpy as np\n'), ((5615, 5645), 'numpy.sum', 'np.sum', (['self.target_unobserved'], {}), '(self.target_unobserved)\n', (5621, 5645), True, 'import numpy as np\n'), ((6067, 6122), 'numpy.multiply', 'np.multiply', (['self.diff[:, :, (0)]', 'self.diff[:, :, (0)]'], {}), '(self.diff[:, :, (0)], self.diff[:, :, (0)])\n', (6078, 6122), True, 'import numpy as np\n'), ((6121, 6176), 'numpy.multiply', 'np.multiply', (['self.diff[:, :, (1)]', 'self.diff[:, :, (1)]'], {}), '(self.diff[:, :, (1)], self.diff[:, :, (1)])\n', (6132, 6176), True, 'import numpy as np\n'), ((7053, 7081), 'numpy.sum', 'np.sum', (['self.adj_mat'], {'axis': '(1)'}), '(self.adj_mat, axis=1)\n', (7059, 7081), True, 'import numpy as np\n'), ((7444, 7515), 'numpy.multiply', 'np.multiply', (['self.diff_targets[:, :, (0)]', 'self.diff_targets[:, :, (0)]'], {}), '(self.diff_targets[:, :, (0)], self.diff_targets[:, :, (0)])\n', (7455, 7515), True, 'import numpy as np\n'), ((7514, 7585), 'numpy.multiply', 'np.multiply', (['self.diff_targets[:, :, (1)]', 'self.diff_targets[:, :, (1)]'], {}), '(self.diff_targets[:, :, (1)], self.diff_targets[:, :, (1)])\n', (7525, 7585), True, 'import numpy as np\n'), ((9100, 9109), 'matplotlib.pyplot.ion', 'plt.ion', ([], {}), '()\n', (9107, 9109), True, 'import matplotlib.pyplot as plt\n'), ((9128, 9140), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (9138, 9140), True, 'import matplotlib.pyplot as plt\n'), ((9402, 9449), 'matplotlib.pyplot.ylim', 'plt.ylim', (['(-1.0 * self.py_max)', '(1.0 * self.py_max)'], {}), '(-1.0 * self.py_max, 1.0 * self.py_max)\n', (9410, 9449), True, 'import matplotlib.pyplot as plt\n'), ((9462, 9509), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(-1.0 * self.px_max)', '(1.0 * self.px_max)'], {}), '(-1.0 * self.px_max, 1.0 * self.px_max)\n', (9470, 9509), True, 'import matplotlib.pyplot as plt\n'), ((9526, 9531), 'matplotlib.pyplot.gca', 'gca', ([], {}), '()\n', (9529, 9531), False, 'from matplotlib.pyplot import gca\n'), ((9648, 9675), 'matplotlib.pyplot.title', 'plt.title', (['"""GNN Controller"""'], {}), "('GNN Controller')\n", (9657, 9675), True, 'import matplotlib.pyplot as plt\n'), ((2444, 2470), 'numpy.stack', 'np.stack', (['(tx, ty)'], {'axis': '(1)'}), '((tx, ty), axis=1)\n', (2452, 2470), True, 'import numpy as np\n'), ((8175, 8222), 'numpy.any', 'np.any', (['(self.r2_targets < self.obs_rad2)'], {'axis': '(0)'}), '(self.r2_targets < self.obs_rad2, axis=0)\n', (8181, 8222), True, 'import numpy as np\n'), ((7793, 7818), 'numpy.shape', 'np.shape', (['nearest_targets'], {}), '(nearest_targets)\n', (7801, 7818), True, 'import numpy as np\n'), ((8305, 8341), 'numpy.logical_not', 'np.logical_not', (['self.target_observed'], {}), '(self.target_observed)\n', (8319, 8341), True, 'import numpy as np\n')]
PaulWang1905/tensorflow
tensorflow/python/kernel_tests/lu_op_test.py
ebf12d22b4801fb8dab5034cc94562bf7cc33fa0
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for tensorflow.ops.tf.Lu.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np from tensorflow.python.client import session from tensorflow.python.framework import dtypes from tensorflow.python.framework import errors from tensorflow.python.framework import ops from tensorflow.python.framework import test_util from tensorflow.python.ops import array_ops from tensorflow.python.ops import control_flow_ops from tensorflow.python.ops import linalg_ops from tensorflow.python.ops import map_fn from tensorflow.python.ops import math_ops from tensorflow.python.ops import random_ops from tensorflow.python.ops import variables from tensorflow.python.platform import benchmark from tensorflow.python.platform import test class LuOpTest(test.TestCase): @property def float_types(self): return set((np.float64, np.float32, np.complex64, np.complex128)) def _verifyLuBase(self, x, lower, upper, perm, verification, output_idx_type): lower_np, upper_np, perm_np, verification_np = self.evaluate( [lower, upper, perm, verification]) self.assertAllClose(x, verification_np) self.assertShapeEqual(x, lower) self.assertShapeEqual(x, upper) self.assertAllEqual(x.shape[:-1], perm.shape.as_list()) # Check dtypes are as expected. self.assertEqual(x.dtype, lower_np.dtype) self.assertEqual(x.dtype, upper_np.dtype) self.assertEqual(output_idx_type.as_numpy_dtype, perm_np.dtype) # Check that the permutation is valid. if perm_np.shape[-1] > 0: perm_reshaped = np.reshape(perm_np, (-1, perm_np.shape[-1])) for perm_vector in perm_reshaped: self.assertAllClose(np.arange(len(perm_vector)), np.sort(perm_vector)) def _verifyLu(self, x, output_idx_type=dtypes.int64): # Verify that Px = LU. lu, perm = linalg_ops.lu(x, output_idx_type=output_idx_type) # Prepare the lower factor of shape num_rows x num_rows lu_shape = np.array(lu.shape.as_list()) batch_shape = lu_shape[:-2] num_rows = lu_shape[-2] num_cols = lu_shape[-1] lower = array_ops.matrix_band_part(lu, -1, 0) if num_rows > num_cols: eye = linalg_ops.eye( num_rows, batch_shape=batch_shape, dtype=lower.dtype) lower = array_ops.concat([lower, eye[..., num_cols:]], axis=-1) elif num_rows < num_cols: lower = lower[..., :num_rows] # Fill the diagonal with ones. ones_diag = array_ops.ones( np.append(batch_shape, num_rows), dtype=lower.dtype) lower = array_ops.matrix_set_diag(lower, ones_diag) # Prepare the upper factor. upper = array_ops.matrix_band_part(lu, 0, -1) verification = math_ops.matmul(lower, upper) # Permute the rows of product of the Cholesky factors. if num_rows > 0: # Reshape the product of the triangular factors and permutation indices # to a single batch dimension. This makes it easy to apply # invert_permutation and gather_nd ops. perm_reshaped = array_ops.reshape(perm, [-1, num_rows]) verification_reshaped = array_ops.reshape(verification, [-1, num_rows, num_cols]) # Invert the permutation in each batch. inv_perm_reshaped = map_fn.map_fn(array_ops.invert_permutation, perm_reshaped) batch_size = perm_reshaped.shape.as_list()[0] # Prepare the batch indices with the same shape as the permutation. # The corresponding batch index is paired with each of the `num_rows` # permutation indices. batch_indices = math_ops.cast( array_ops.broadcast_to( math_ops.range(batch_size)[:, None], perm_reshaped.shape), dtype=output_idx_type) permuted_verification_reshaped = array_ops.gather_nd( verification_reshaped, array_ops.stack([batch_indices, inv_perm_reshaped], axis=-1)) # Reshape the verification matrix back to the original shape. verification = array_ops.reshape(permuted_verification_reshaped, lu_shape) self._verifyLuBase(x, lower, upper, perm, verification, output_idx_type) def testBasic(self): data = np.array([[4., -1., 2.], [-1., 6., 0], [10., 0., 5.]]) for dtype in (np.float32, np.float64): for output_idx_type in (dtypes.int32, dtypes.int64): self._verifyLu(data.astype(dtype), output_idx_type=output_idx_type) for dtype in (np.complex64, np.complex128): for output_idx_type in (dtypes.int32, dtypes.int64): complex_data = np.tril(1j * data, -1).astype(dtype) complex_data += np.triu(-1j * data, 1).astype(dtype) complex_data += data self._verifyLu(complex_data, output_idx_type=output_idx_type) def testPivoting(self): # This matrix triggers partial pivoting because the first diagonal entry # is small. data = np.array([[1e-9, 1., 0.], [1., 0., 0], [0., 1., 5]]) self._verifyLu(data.astype(np.float32)) for dtype in (np.float32, np.float64): self._verifyLu(data.astype(dtype)) _, p = linalg_ops.lu(data) p_val = self.evaluate([p]) # Make sure p_val is not the identity permutation. self.assertNotAllClose(np.arange(3), p_val) for dtype in (np.complex64, np.complex128): complex_data = np.tril(1j * data, -1).astype(dtype) complex_data += np.triu(-1j * data, 1).astype(dtype) complex_data += data self._verifyLu(complex_data) _, p = linalg_ops.lu(data) p_val = self.evaluate([p]) # Make sure p_val is not the identity permutation. self.assertNotAllClose(np.arange(3), p_val) def testInvalidMatrix(self): # LU factorization gives an error when the input is singular. # Note: A singular matrix may return without error but it won't be a valid # factorization. for dtype in self.float_types: with self.assertRaises(errors.InvalidArgumentError): self.evaluate( linalg_ops.lu( np.array([[1., 2., 3.], [2., 4., 6.], [2., 3., 4.]], dtype=dtype))) with self.assertRaises(errors.InvalidArgumentError): self.evaluate( linalg_ops.lu( np.array([[[1., 2., 3.], [2., 4., 6.], [1., 2., 3.]], [[1., 2., 3.], [3., 4., 5.], [5., 6., 7.]]], dtype=dtype))) def testBatch(self): simple_array = np.array([[[1., -1.], [2., 5.]]]) # shape (1, 2, 2) self._verifyLu(simple_array) self._verifyLu(np.vstack((simple_array, simple_array))) odd_sized_array = np.array([[[4., -1., 2.], [-1., 6., 0], [2., 0., 5.]]]) self._verifyLu(np.vstack((odd_sized_array, odd_sized_array))) batch_size = 200 # Generate random matrices. np.random.seed(42) matrices = np.random.rand(batch_size, 5, 5) self._verifyLu(matrices) # Generate random complex valued matrices. np.random.seed(52) matrices = np.random.rand(batch_size, 5, 5) + 1j * np.random.rand(batch_size, 5, 5) self._verifyLu(matrices) def testLargeMatrix(self): # Generate random matrices. n = 500 np.random.seed(64) data = np.random.rand(n, n) self._verifyLu(data) # Generate random complex valued matrices. np.random.seed(129) data = np.random.rand(n, n) + 1j * np.random.rand(n, n) self._verifyLu(data) @test_util.run_v1_only("b/120545219") def testEmpty(self): self._verifyLu(np.empty([0, 2, 2])) self._verifyLu(np.empty([2, 0, 0])) @test_util.run_deprecated_v1 def testConcurrentExecutesWithoutError(self): matrix1 = random_ops.random_normal([5, 5], seed=42) matrix2 = random_ops.random_normal([5, 5], seed=42) lu1, p1 = linalg_ops.lu(matrix1) lu2, p2 = linalg_ops.lu(matrix2) lu1_val, p1_val, lu2_val, p2_val = self.evaluate([lu1, p1, lu2, p2]) self.assertAllEqual(lu1_val, lu2_val) self.assertAllEqual(p1_val, p2_val) class LuBenchmark(test.Benchmark): shapes = [ (4, 4), (10, 10), (16, 16), (101, 101), (256, 256), (1000, 1000), (1024, 1024), (2048, 2048), (4096, 4096), (513, 2, 2), (513, 8, 8), (513, 256, 256), (4, 513, 2, 2), ] def _GenerateMatrix(self, shape): batch_shape = shape[:-2] shape = shape[-2:] assert shape[0] == shape[1] n = shape[0] matrix = np.ones(shape).astype(np.float32) / (2.0 * n) + np.diag( np.ones(n).astype(np.float32)) return np.tile(matrix, batch_shape + (1, 1)) def benchmarkLuOp(self): for shape in self.shapes: with ops.Graph().as_default(), \ session.Session(config=benchmark.benchmark_config()) as sess, \ ops.device("/cpu:0"): matrix = variables.Variable(self._GenerateMatrix(shape)) lu, p = linalg_ops.lu(matrix) variables.global_variables_initializer().run() self.run_op_benchmark( sess, control_flow_ops.group(lu, p), min_iters=25, name="lu_cpu_{shape}".format(shape=shape)) if test.is_gpu_available(True): with ops.Graph().as_default(), \ session.Session(config=benchmark.benchmark_config()) as sess, \ ops.device("/device:GPU:0"): matrix = variables.Variable(self._GenerateMatrix(shape)) lu, p = linalg_ops.lu(matrix) variables.global_variables_initializer().run() self.run_op_benchmark( sess, control_flow_ops.group(lu, p), min_iters=25, name="lu_gpu_{shape}".format(shape=shape)) if __name__ == "__main__": test.main()
[((8201, 8237), 'tensorflow.python.framework.test_util.run_v1_only', 'test_util.run_v1_only', (['"""b/120545219"""'], {}), "('b/120545219')\n", (8222, 8237), False, 'from tensorflow.python.framework import test_util\n'), ((10466, 10477), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (10475, 10477), False, 'from tensorflow.python.platform import test\n'), ((2584, 2633), 'tensorflow.python.ops.linalg_ops.lu', 'linalg_ops.lu', (['x'], {'output_idx_type': 'output_idx_type'}), '(x, output_idx_type=output_idx_type)\n', (2597, 2633), False, 'from tensorflow.python.ops import linalg_ops\n'), ((2840, 2877), 'tensorflow.python.ops.array_ops.matrix_band_part', 'array_ops.matrix_band_part', (['lu', '(-1)', '(0)'], {}), '(lu, -1, 0)\n', (2866, 2877), False, 'from tensorflow.python.ops import array_ops\n'), ((3276, 3319), 'tensorflow.python.ops.array_ops.matrix_set_diag', 'array_ops.matrix_set_diag', (['lower', 'ones_diag'], {}), '(lower, ones_diag)\n', (3301, 3319), False, 'from tensorflow.python.ops import array_ops\n'), ((3365, 3402), 'tensorflow.python.ops.array_ops.matrix_band_part', 'array_ops.matrix_band_part', (['lu', '(0)', '(-1)'], {}), '(lu, 0, -1)\n', (3391, 3402), False, 'from tensorflow.python.ops import array_ops\n'), ((3423, 3452), 'tensorflow.python.ops.math_ops.matmul', 'math_ops.matmul', (['lower', 'upper'], {}), '(lower, upper)\n', (3438, 3452), False, 'from tensorflow.python.ops import math_ops\n'), ((4990, 5052), 'numpy.array', 'np.array', (['[[4.0, -1.0, 2.0], [-1.0, 6.0, 0], [10.0, 0.0, 5.0]]'], {}), '([[4.0, -1.0, 2.0], [-1.0, 6.0, 0], [10.0, 0.0, 5.0]])\n', (4998, 5052), True, 'import numpy as np\n'), ((5683, 5742), 'numpy.array', 'np.array', (['[[1e-09, 1.0, 0.0], [1.0, 0.0, 0], [0.0, 1.0, 5]]'], {}), '([[1e-09, 1.0, 0.0], [1.0, 0.0, 0], [0.0, 1.0, 5]])\n', (5691, 5742), True, 'import numpy as np\n'), ((7223, 7260), 'numpy.array', 'np.array', (['[[[1.0, -1.0], [2.0, 5.0]]]'], {}), '([[[1.0, -1.0], [2.0, 5.0]]])\n', (7231, 7260), True, 'import numpy as np\n'), ((7391, 7454), 'numpy.array', 'np.array', (['[[[4.0, -1.0, 2.0], [-1.0, 6.0, 0], [2.0, 0.0, 5.0]]]'], {}), '([[[4.0, -1.0, 2.0], [-1.0, 6.0, 0], [2.0, 0.0, 5.0]]])\n', (7399, 7454), True, 'import numpy as np\n'), ((7572, 7590), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (7586, 7590), True, 'import numpy as np\n'), ((7606, 7638), 'numpy.random.rand', 'np.random.rand', (['batch_size', '(5)', '(5)'], {}), '(batch_size, 5, 5)\n', (7620, 7638), True, 'import numpy as np\n'), ((7720, 7738), 'numpy.random.seed', 'np.random.seed', (['(52)'], {}), '(52)\n', (7734, 7738), True, 'import numpy as np\n'), ((7964, 7982), 'numpy.random.seed', 'np.random.seed', (['(64)'], {}), '(64)\n', (7978, 7982), True, 'import numpy as np\n'), ((7994, 8014), 'numpy.random.rand', 'np.random.rand', (['n', 'n'], {}), '(n, n)\n', (8008, 8014), True, 'import numpy as np\n'), ((8092, 8111), 'numpy.random.seed', 'np.random.seed', (['(129)'], {}), '(129)\n', (8106, 8111), True, 'import numpy as np\n'), ((8435, 8476), 'tensorflow.python.ops.random_ops.random_normal', 'random_ops.random_normal', (['[5, 5]'], {'seed': '(42)'}), '([5, 5], seed=42)\n', (8459, 8476), False, 'from tensorflow.python.ops import random_ops\n'), ((8491, 8532), 'tensorflow.python.ops.random_ops.random_normal', 'random_ops.random_normal', (['[5, 5]'], {'seed': '(42)'}), '([5, 5], seed=42)\n', (8515, 8532), False, 'from tensorflow.python.ops import random_ops\n'), ((8547, 8569), 'tensorflow.python.ops.linalg_ops.lu', 'linalg_ops.lu', (['matrix1'], {}), '(matrix1)\n', (8560, 8569), False, 'from tensorflow.python.ops import linalg_ops\n'), ((8584, 8606), 'tensorflow.python.ops.linalg_ops.lu', 'linalg_ops.lu', (['matrix2'], {}), '(matrix2)\n', (8597, 8606), False, 'from tensorflow.python.ops import linalg_ops\n'), ((9319, 9356), 'numpy.tile', 'np.tile', (['matrix', '(batch_shape + (1, 1))'], {}), '(matrix, batch_shape + (1, 1))\n', (9326, 9356), True, 'import numpy as np\n'), ((2321, 2365), 'numpy.reshape', 'np.reshape', (['perm_np', '(-1, perm_np.shape[-1])'], {}), '(perm_np, (-1, perm_np.shape[-1]))\n', (2331, 2365), True, 'import numpy as np\n'), ((2919, 2987), 'tensorflow.python.ops.linalg_ops.eye', 'linalg_ops.eye', (['num_rows'], {'batch_shape': 'batch_shape', 'dtype': 'lower.dtype'}), '(num_rows, batch_shape=batch_shape, dtype=lower.dtype)\n', (2933, 2987), False, 'from tensorflow.python.ops import linalg_ops\n'), ((3013, 3070), 'tensorflow.python.ops.array_ops.concat', 'array_ops.concat', (['[lower, eye[(...), num_cols:]]'], {'axis': '(-1)'}), '([lower, eye[(...), num_cols:]], axis=-1)\n', (3029, 3070), False, 'from tensorflow.python.ops import array_ops\n'), ((3211, 3243), 'numpy.append', 'np.append', (['batch_shape', 'num_rows'], {}), '(batch_shape, num_rows)\n', (3220, 3243), True, 'import numpy as np\n'), ((3745, 3784), 'tensorflow.python.ops.array_ops.reshape', 'array_ops.reshape', (['perm', '[-1, num_rows]'], {}), '(perm, [-1, num_rows])\n', (3762, 3784), False, 'from tensorflow.python.ops import array_ops\n'), ((3815, 3872), 'tensorflow.python.ops.array_ops.reshape', 'array_ops.reshape', (['verification', '[-1, num_rows, num_cols]'], {}), '(verification, [-1, num_rows, num_cols])\n', (3832, 3872), False, 'from tensorflow.python.ops import array_ops\n'), ((3993, 4051), 'tensorflow.python.ops.map_fn.map_fn', 'map_fn.map_fn', (['array_ops.invert_permutation', 'perm_reshaped'], {}), '(array_ops.invert_permutation, perm_reshaped)\n', (4006, 4051), False, 'from tensorflow.python.ops import map_fn\n'), ((4755, 4814), 'tensorflow.python.ops.array_ops.reshape', 'array_ops.reshape', (['permuted_verification_reshaped', 'lu_shape'], {}), '(permuted_verification_reshaped, lu_shape)\n', (4772, 4814), False, 'from tensorflow.python.ops import array_ops\n'), ((5878, 5897), 'tensorflow.python.ops.linalg_ops.lu', 'linalg_ops.lu', (['data'], {}), '(data)\n', (5891, 5897), False, 'from tensorflow.python.ops import linalg_ops\n'), ((6279, 6298), 'tensorflow.python.ops.linalg_ops.lu', 'linalg_ops.lu', (['data'], {}), '(data)\n', (6292, 6298), False, 'from tensorflow.python.ops import linalg_ops\n'), ((7328, 7367), 'numpy.vstack', 'np.vstack', (['(simple_array, simple_array)'], {}), '((simple_array, simple_array))\n', (7337, 7367), True, 'import numpy as np\n'), ((7466, 7511), 'numpy.vstack', 'np.vstack', (['(odd_sized_array, odd_sized_array)'], {}), '((odd_sized_array, odd_sized_array))\n', (7475, 7511), True, 'import numpy as np\n'), ((7754, 7786), 'numpy.random.rand', 'np.random.rand', (['batch_size', '(5)', '(5)'], {}), '(batch_size, 5, 5)\n', (7768, 7786), True, 'import numpy as np\n'), ((8123, 8143), 'numpy.random.rand', 'np.random.rand', (['n', 'n'], {}), '(n, n)\n', (8137, 8143), True, 'import numpy as np\n'), ((8280, 8299), 'numpy.empty', 'np.empty', (['[0, 2, 2]'], {}), '([0, 2, 2])\n', (8288, 8299), True, 'import numpy as np\n'), ((8320, 8339), 'numpy.empty', 'np.empty', (['[2, 0, 0]'], {}), '([2, 0, 0])\n', (8328, 8339), True, 'import numpy as np\n'), ((9901, 9928), 'tensorflow.python.platform.test.is_gpu_available', 'test.is_gpu_available', (['(True)'], {}), '(True)\n', (9922, 9928), False, 'from tensorflow.python.platform import test\n'), ((4603, 4663), 'tensorflow.python.ops.array_ops.stack', 'array_ops.stack', (['[batch_indices, inv_perm_reshaped]'], {'axis': '(-1)'}), '([batch_indices, inv_perm_reshaped], axis=-1)\n', (4618, 4663), False, 'from tensorflow.python.ops import array_ops\n'), ((6017, 6029), 'numpy.arange', 'np.arange', (['(3)'], {}), '(3)\n', (6026, 6029), True, 'import numpy as np\n'), ((6418, 6430), 'numpy.arange', 'np.arange', (['(3)'], {}), '(3)\n', (6427, 6430), True, 'import numpy as np\n'), ((7824, 7856), 'numpy.random.rand', 'np.random.rand', (['batch_size', '(5)', '(5)'], {}), '(batch_size, 5, 5)\n', (7838, 7856), True, 'import numpy as np\n'), ((8151, 8171), 'numpy.random.rand', 'np.random.rand', (['n', 'n'], {}), '(n, n)\n', (8165, 8171), True, 'import numpy as np\n'), ((9538, 9558), 'tensorflow.python.framework.ops.device', 'ops.device', (['"""/cpu:0"""'], {}), "('/cpu:0')\n", (9548, 9558), False, 'from tensorflow.python.framework import ops\n'), ((9641, 9662), 'tensorflow.python.ops.linalg_ops.lu', 'linalg_ops.lu', (['matrix'], {}), '(matrix)\n', (9654, 9662), False, 'from tensorflow.python.ops import linalg_ops\n'), ((2463, 2483), 'numpy.sort', 'np.sort', (['perm_vector'], {}), '(perm_vector)\n', (2470, 2483), True, 'import numpy as np\n'), ((6108, 6132), 'numpy.tril', 'np.tril', (['(1.0j * data)', '(-1)'], {}), '(1.0j * data, -1)\n', (6115, 6132), True, 'import numpy as np\n'), ((6167, 6191), 'numpy.triu', 'np.triu', (['(-1.0j * data)', '(1)'], {}), '(-1.0j * data, 1)\n', (6174, 6191), True, 'import numpy as np\n'), ((9779, 9808), 'tensorflow.python.ops.control_flow_ops.group', 'control_flow_ops.group', (['lu', 'p'], {}), '(lu, p)\n', (9801, 9808), False, 'from tensorflow.python.ops import control_flow_ops\n'), ((10059, 10086), 'tensorflow.python.framework.ops.device', 'ops.device', (['"""/device:GPU:0"""'], {}), "('/device:GPU:0')\n", (10069, 10086), False, 'from tensorflow.python.framework import ops\n'), ((10173, 10194), 'tensorflow.python.ops.linalg_ops.lu', 'linalg_ops.lu', (['matrix'], {}), '(matrix)\n', (10186, 10194), False, 'from tensorflow.python.ops import linalg_ops\n'), ((4408, 4434), 'tensorflow.python.ops.math_ops.range', 'math_ops.range', (['batch_size'], {}), '(batch_size)\n', (4422, 4434), False, 'from tensorflow.python.ops import math_ops\n'), ((5355, 5379), 'numpy.tril', 'np.tril', (['(1.0j * data)', '(-1)'], {}), '(1.0j * data, -1)\n', (5362, 5379), True, 'import numpy as np\n'), ((5416, 5440), 'numpy.triu', 'np.triu', (['(-1.0j * data)', '(1)'], {}), '(-1.0j * data, 1)\n', (5423, 5440), True, 'import numpy as np\n'), ((6797, 6871), 'numpy.array', 'np.array', (['[[1.0, 2.0, 3.0], [2.0, 4.0, 6.0], [2.0, 3.0, 4.0]]'], {'dtype': 'dtype'}), '([[1.0, 2.0, 3.0], [2.0, 4.0, 6.0], [2.0, 3.0, 4.0]], dtype=dtype)\n', (6805, 6871), True, 'import numpy as np\n'), ((7015, 7149), 'numpy.array', 'np.array', (['[[[1.0, 2.0, 3.0], [2.0, 4.0, 6.0], [1.0, 2.0, 3.0]], [[1.0, 2.0, 3.0], [\n 3.0, 4.0, 5.0], [5.0, 6.0, 7.0]]]'], {'dtype': 'dtype'}), '([[[1.0, 2.0, 3.0], [2.0, 4.0, 6.0], [1.0, 2.0, 3.0]], [[1.0, 2.0, \n 3.0], [3.0, 4.0, 5.0], [5.0, 6.0, 7.0]]], dtype=dtype)\n', (7023, 7149), True, 'import numpy as np\n'), ((9212, 9226), 'numpy.ones', 'np.ones', (['shape'], {}), '(shape)\n', (9219, 9226), True, 'import numpy as np\n'), ((9277, 9287), 'numpy.ones', 'np.ones', (['n'], {}), '(n)\n', (9284, 9287), True, 'import numpy as np\n'), ((9426, 9437), 'tensorflow.python.framework.ops.Graph', 'ops.Graph', ([], {}), '()\n', (9435, 9437), False, 'from tensorflow.python.framework import ops\n'), ((9487, 9515), 'tensorflow.python.platform.benchmark.benchmark_config', 'benchmark.benchmark_config', ([], {}), '()\n', (9513, 9515), False, 'from tensorflow.python.platform import benchmark\n'), ((9671, 9711), 'tensorflow.python.ops.variables.global_variables_initializer', 'variables.global_variables_initializer', ([], {}), '()\n', (9709, 9711), False, 'from tensorflow.python.ops import variables\n'), ((10319, 10348), 'tensorflow.python.ops.control_flow_ops.group', 'control_flow_ops.group', (['lu', 'p'], {}), '(lu, p)\n', (10341, 10348), False, 'from tensorflow.python.ops import control_flow_ops\n'), ((9943, 9954), 'tensorflow.python.framework.ops.Graph', 'ops.Graph', ([], {}), '()\n', (9952, 9954), False, 'from tensorflow.python.framework import ops\n'), ((10006, 10034), 'tensorflow.python.platform.benchmark.benchmark_config', 'benchmark.benchmark_config', ([], {}), '()\n', (10032, 10034), False, 'from tensorflow.python.platform import benchmark\n'), ((10205, 10245), 'tensorflow.python.ops.variables.global_variables_initializer', 'variables.global_variables_initializer', ([], {}), '()\n', (10243, 10245), False, 'from tensorflow.python.ops import variables\n')]
zhouyangnk/Montreal-Forced-Aligner
aligner/features/processing.py
4f8733409e79a50744616921a04fccf115e8af6f
import multiprocessing as mp import subprocess import shutil import os from ..helper import make_path_safe, thirdparty_binary, filter_scp from ..exceptions import CorpusError def mfcc_func(directory, job_name, mfcc_config_path): # pragma: no cover log_directory = os.path.join(directory, 'log') raw_mfcc_path = os.path.join(directory, 'raw_mfcc.{}.ark'.format(job_name)) raw_scp_path = os.path.join(directory, 'feats.{}.scp'.format(job_name)) log_path = os.path.join(log_directory, 'make_mfcc.{}.log'.format(job_name)) segment_path = os.path.join(directory, 'segments.{}'.format(job_name)) scp_path = os.path.join(directory, 'wav.{}.scp'.format(job_name)) with open(log_path, 'w') as f: if os.path.exists(segment_path): seg_proc = subprocess.Popen([thirdparty_binary('extract-segments'), 'scp,p:' + scp_path, segment_path, 'ark:-'], stdout=subprocess.PIPE, stderr=f) comp_proc = subprocess.Popen([thirdparty_binary('compute-mfcc-feats'), '--verbose=2', '--config=' + mfcc_config_path, 'ark:-', 'ark:-'], stdout=subprocess.PIPE, stderr=f, stdin=seg_proc.stdout) else: comp_proc = subprocess.Popen([thirdparty_binary('compute-mfcc-feats'), '--verbose=2', '--config=' + mfcc_config_path, 'scp,p:' + scp_path, 'ark:-'], stdout=subprocess.PIPE, stderr=f) copy_proc = subprocess.Popen([thirdparty_binary('copy-feats'), '--compress=true', 'ark:-', 'ark,scp:{},{}'.format(raw_mfcc_path, raw_scp_path)], stdin=comp_proc.stdout, stderr=f) copy_proc.wait() def init(env): os.environ = env def mfcc(mfcc_directory, num_jobs, feature_config, frequency_configs): """ Multiprocessing function that converts wav files into MFCCs See http://kaldi-asr.org/doc/feat.html and http://kaldi-asr.org/doc/compute-mfcc-feats_8cc.html for more details on how MFCCs are computed. Also see https://github.com/kaldi-asr/kaldi/blob/master/egs/wsj/s5/steps/make_mfcc.sh for the bash script this function was based on. Parameters ---------- mfcc_directory : str Directory to save MFCC feature matrices log_directory : str Directory to store log files num_jobs : int The number of processes to use in calculation mfcc_configs : list of :class:`~aligner.config.MfccConfig` Configuration object for generating MFCCs Raises ------ CorpusError If the files per speaker exceeds the number of files that are allowed to be open on the computer (for Unix-based systems) """ child_env = os.environ.copy() os.makedirs(os.path.join(mfcc_directory, 'log'), exist_ok=True) paths = [] for j, p in frequency_configs: paths.append(feature_config.write(mfcc_directory, j, p)) jobs = [(mfcc_directory, x, paths[x]) for x in range(num_jobs)] with mp.Pool(processes=num_jobs, initializer=init, initargs=(child_env,)) as pool: r = False try: results = [pool.apply_async(mfcc_func, args=i) for i in jobs] output = [p.get() for p in results] except OSError as e: print(dir(e)) if e.errno == 24: r = True else: raise if r: raise (CorpusError( 'There were too many files per speaker to process based on your OS settings. Please try to split your data into more speakers.')) def apply_cmvn_func(directory, job_name, config): normed_scp_path = os.path.join(directory, config.raw_feature_id + '.{}.scp'.format(job_name)) normed_ark_path = os.path.join(directory, config.raw_feature_id + '.{}.ark'.format(job_name)) with open(os.path.join(directory, 'log', 'norm.{}.log'.format(job_name)), 'w') as logf: utt2spkpath = os.path.join(directory, 'utt2spk.{}'.format(job_name)) cmvnpath = os.path.join(directory, 'cmvn.{}.scp'.format(job_name)) featspath = os.path.join(directory, 'feats.{}.scp'.format(job_name)) if not os.path.exists(normed_scp_path): cmvn_proc = subprocess.Popen([thirdparty_binary('apply-cmvn'), '--utt2spk=ark:' + utt2spkpath, 'scp:' + cmvnpath, 'scp:' + featspath, 'ark,scp:{},{}'.format(normed_ark_path, normed_scp_path)], stderr=logf ) cmvn_proc.communicate() def apply_cmvn(directory, num_jobs, config): child_env = os.environ.copy() jobs = [(directory, x, config) for x in range(num_jobs)] with mp.Pool(processes=num_jobs, initializer=init, initargs=(child_env,)) as pool: results = [pool.apply_async(apply_cmvn_func, args=i) for i in jobs] output = [p.get() for p in results] def add_deltas_func(directory, job_name, config): normed_scp_path = os.path.join(directory, config.raw_feature_id + '.{}.scp'.format(job_name)) ark_path = os.path.join(directory, config.feature_id + '.{}.ark'.format(job_name)) scp_path = os.path.join(directory, config.feature_id + '.{}.scp'.format(job_name)) with open(os.path.join(directory, 'log', 'add_deltas.{}.log'.format(job_name)), 'w') as logf: if config.fmllr_path is not None and os.path.exists(config.fmllr_path): deltas_proc = subprocess.Popen([thirdparty_binary('add-deltas'), 'scp:' + normed_scp_path, 'ark:-'], stderr=logf, stdout=subprocess.PIPE) trans_proc = subprocess.Popen([thirdparty_binary('transform-feats'), 'ark:' + config.fmllr_path, 'ark:-', 'ark,scp:{},{}'.format(ark_path, scp_path)], stdin=deltas_proc.stdout, stderr=logf) trans_proc.communicate() else: deltas_proc = subprocess.Popen([thirdparty_binary('add-deltas'), 'scp:' + normed_scp_path, 'ark,scp:{},{}'.format(ark_path, scp_path)], stderr=logf) deltas_proc.communicate() def add_deltas(directory, num_jobs, config): child_env = os.environ.copy() jobs = [(directory, x, config) for x in range(num_jobs)] with mp.Pool(processes=num_jobs, initializer=init, initargs=(child_env,)) as pool: results = [pool.apply_async(add_deltas_func, args=i) for i in jobs] output = [p.get() for p in results] def apply_lda_func(directory, job_name, config): normed_scp_path = os.path.join(directory, config.raw_feature_id + '.{}.scp'.format(job_name)) ark_path = os.path.join(directory, config.feature_id + '.{}.ark'.format(job_name)) scp_path = os.path.join(directory, config.feature_id + '.{}.scp'.format(job_name)) ivector_scp_path = os.path.join(directory, 'ivector.{}.scp'.format(job_name)) with open(os.path.join(directory, 'log', 'lda.{}.log'.format(job_name)), 'a') as logf: if os.path.exists(config.lda_path): splice_feats_proc = subprocess.Popen([thirdparty_binary('splice-feats'), '--left-context={}'.format(config.splice_left_context), '--right-context={}'.format(config.splice_right_context), 'scp:' + normed_scp_path, 'ark:-'], stdout=subprocess.PIPE, stderr=logf) if config.ivectors and os.path.exists(ivector_scp_path): transform_feats_proc = subprocess.Popen([thirdparty_binary("transform-feats"), config.lda_path, 'ark:-', 'ark:-'], stdin=splice_feats_proc.stdout, stdout=subprocess.PIPE, stderr=logf) paste_proc = subprocess.Popen([thirdparty_binary('paste-feats'), 'ark:-', 'scp:' + ivector_scp_path, 'ark,scp:{},{}'.format(ark_path, scp_path)], stdin=transform_feats_proc.stdout, stderr=logf) paste_proc.communicate() else: transform_feats_proc = subprocess.Popen([thirdparty_binary("transform-feats"), config.lda_path, 'ark:-', 'ark,scp:{},{}'.format(ark_path, scp_path)], stdin=splice_feats_proc.stdout, stderr=logf) transform_feats_proc.communicate() else: logf.write('could not find "{}"\n'.format(config.lda_path)) splice_feats_proc = subprocess.Popen([thirdparty_binary('splice-feats'), '--left-context={}'.format(config.splice_left_context), '--right-context={}'.format(config.splice_right_context), 'scp:' + normed_scp_path, 'ark,scp:{},{}'.format(ark_path, scp_path)], stderr=logf) splice_feats_proc.communicate() def apply_lda(directory, num_jobs, config): jobs = [(directory, x, config) for x in range(num_jobs)] with mp.Pool(processes=num_jobs, initializer=init, initargs=(os.environ.copy(),)) as pool: results = [pool.apply_async(apply_lda_func, args=i) for i in jobs] output = [p.get() for p in results]
[((272, 302), 'os.path.join', 'os.path.join', (['directory', '"""log"""'], {}), "(directory, 'log')\n", (284, 302), False, 'import os\n'), ((3022, 3039), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (3037, 3039), False, 'import os\n'), ((5060, 5077), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (5075, 5077), False, 'import os\n'), ((6912, 6929), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (6927, 6929), False, 'import os\n'), ((731, 759), 'os.path.exists', 'os.path.exists', (['segment_path'], {}), '(segment_path)\n', (745, 759), False, 'import os\n'), ((3057, 3092), 'os.path.join', 'os.path.join', (['mfcc_directory', '"""log"""'], {}), "(mfcc_directory, 'log')\n", (3069, 3092), False, 'import os\n'), ((3313, 3381), 'multiprocessing.Pool', 'mp.Pool', ([], {'processes': 'num_jobs', 'initializer': 'init', 'initargs': '(child_env,)'}), '(processes=num_jobs, initializer=init, initargs=(child_env,))\n', (3320, 3381), True, 'import multiprocessing as mp\n'), ((5160, 5228), 'multiprocessing.Pool', 'mp.Pool', ([], {'processes': 'num_jobs', 'initializer': 'init', 'initargs': '(child_env,)'}), '(processes=num_jobs, initializer=init, initargs=(child_env,))\n', (5167, 5228), True, 'import multiprocessing as mp\n'), ((7012, 7080), 'multiprocessing.Pool', 'mp.Pool', ([], {'processes': 'num_jobs', 'initializer': 'init', 'initargs': '(child_env,)'}), '(processes=num_jobs, initializer=init, initargs=(child_env,))\n', (7019, 7080), True, 'import multiprocessing as mp\n'), ((7717, 7748), 'os.path.exists', 'os.path.exists', (['config.lda_path'], {}), '(config.lda_path)\n', (7731, 7748), False, 'import os\n'), ((4459, 4490), 'os.path.exists', 'os.path.exists', (['normed_scp_path'], {}), '(normed_scp_path)\n', (4473, 4490), False, 'import os\n'), ((5825, 5858), 'os.path.exists', 'os.path.exists', (['config.fmllr_path'], {}), '(config.fmllr_path)\n', (5839, 5858), False, 'import os\n'), ((8355, 8387), 'os.path.exists', 'os.path.exists', (['ivector_scp_path'], {}), '(ivector_scp_path)\n', (8369, 8387), False, 'import os\n'), ((10821, 10838), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (10836, 10838), False, 'import os\n')]
tysen2k/ffai
ffai/util/bothelper.py
2fa1fd45a8877986fdb21e3fea5e01cbf819d3ec
""" A number of static methods for interpretting the state of the fantasy football pitch that aren't required directly by the client """ from ffai.core import Game, Action, ActionType from ffai.core.procedure import * from ffai.util.pathfinding import * from typing import Optional, List, Dict class ActionSequence: def __init__(self, action_steps: List[Action], score: float = 0, description: str = ''): """ Creates a new ActionSequence - an ordered list of sequential Actions to attempt to undertake. :param action_steps: Sequence of action steps that form this action. :param score: A score representing the attractiveness of the move (default: 0) :param description: A debug string (default: '') """ # Note the intention of this object is that when the object is acting, as steps are completed, # they are removed from the move_sequence so the next move is always the top of the move_sequence # lis self.action_steps = action_steps self.score = score self.description = description def is_valid(self, game: Game) -> bool: pass def popleft(self): return self.action_steps.pop(0) #val = self.action_steps[0] #del self.action_steps[0] #return val def is_empty(self): return not self.action_steps class FfHeatMap: """ A heat map of a Blood Bowl field. A class for analysing zones of control for both teams """ def __init__(self, game: Game, team: Team): self.game=game self.team = team # Note that the edges are not on the field, but represent crowd squares self.units_friendly: List[List[float]] = [[0.0 for y in range(game.state.pitch.height)] for x in range(game.state.pitch.width)] self.units_opponent: List[List[float]] = [[0.0 for y in range(game.state.pitch.height)] for x in range(game.state.pitch.width)] def add_unit_paths(self, player:Player, paths: List[Path]): is_friendly: bool = player.team == self.team for path in paths: if is_friendly: self.units_friendly[path.steps[-1].x][path.steps[-1].y] += (1.0 - path.cost)*(1.0 - path.cost) else: self.units_opponent[path.steps[-1].x][path.steps[-1].y] += (1.0 - path.cost)*(1.0 - path.cost) def add_unit_by_paths(self, game: Game, paths: Dict[Player, List[Path]]): for player in paths.keys(): self.add_unit_paths(player, paths[player]) def add_players_moved(self, game: Game, players: List[Player]): for player in players: adjacents: List[Square] = game.get_adjacent_squares(player.position, occupied=True) self.units_friendly[player.position.x][player.position.y] += 1.0 for adjacent in adjacents: self.units_friendly[player.position.x][player.position.y] += 0.5 def get_ball_move_square_safety_score(self, square: Square) -> float: # Basic idea - identify safe regions to move the ball towards friendly_heat: float = self.units_friendly[square.x][square.y] opponent_heat: float = self.units_opponent[square.x][square.y] score: float = 30.0 * max(0.0, (1.0 - opponent_heat/2)) return score #score: float=0.0 #if opponent_heat < 0.25: score += 15.0 #if opponent_heat < 0.05: score += 15.0 #if opponent_heat < 1.5: score += 5 #if friendly_heat > 3.5: score += 10.0 #score += max(30.0, 5.0*(friendly_heat-opponent_heat)) return score def get_cage_necessity_score(self, square: Square) -> float: opponent_friendly: float = self.units_friendly[square.x][square.y] opponent_heat: float = self.units_opponent[square.x][square.y] score: float = 0.0 if opponent_heat < 0.4: score -= 80.0 # if opponent_friendly > opponent_heat: score -= max(30.0, 10.0*(opponent_friendly-opponent_heat)) # if opponent_heat <1.5: score -=5 # if opponent_heat > opponent_friendly: score += 10.0*(opponent_friendly-opponent_heat) return score def blitz_used(game: Game) -> bool: for action in game.state.available_actions: if action.action_type == ActionType.START_BLITZ: return False return True def handoff_used(game: Game) -> bool: for action in game.state.available_actions: if action.action_type == ActionType.START_HANDOFF: return False return True def foul_used(game: Game) -> bool: for action in game.state.available_actions: if action.action_type == ActionType.START_FOUL: return False return True def pass_used(game: Game) -> bool: for action in game.state.available_actions: if action.action_type == ActionType.START_PASS: return False return True def get_players(game: Game, team: Team, include_own: bool = True, include_opp: bool = True, include_stunned: bool = True, include_used: bool = True, include_off_pitch: bool = False, only_blockable: bool = False, only_used: bool = False) -> List[Player]: players: List[Player] = [] selected_players: List[Player] = [] for iteam in game.state.teams: if iteam == team and include_own: players.extend(iteam.players) if iteam != team and include_opp: players.extend(iteam.players) for player in players: if only_blockable and not player.state.up: continue if only_used and not player.state.used: continue if include_stunned or not player.state.stunned: if include_used or not player.state.used: if include_off_pitch or (player.position is not None and not game.is_out_of_bounds(player.position)): selected_players.append(player) return selected_players def caging_squares_north_east(game: Game, protect_square: Square) -> List[Square]: # * At it's simplest, a cage requires 4 platers in the North-East, South-East, South-West and North-West # * positions, relative to the ball carrier, such that there is no more than 3 squares between the players in # * each of those adjacent compass directions. # * # * 1 3 # * xx-xx # * xx-xx # * --o-- # * xx-xx # * xx-xx # * 3 4 # * # * pitch is 26 long # * # * # * Basically we need one player in each of the corners: 1-4, but spaced such that there is no gap of 3 squares. # * If the caging player is in 1-4, but next to ball carrier, he ensures this will automatically be me # * # * The only exception to this is when the ball carrier is on, or near, the sideline. Then return the squares # * that can otherwise form the cage. # * caging_squares: List[Square] = [] x = protect_square.x y = protect_square.y if x <= game.state.pitch.width - 3: if y == game.state.pitch.height-2: caging_squares.append(game.get_square(x + 1, y + 1)) caging_squares.append(game.get_square(x + 2, y + 1)) caging_squares.append(game.get_square(x + 1, y)) caging_squares.append(game.get_square(x + 2, y)) elif y == game.state.pitch.height-1: caging_squares.append(game.get_square(x + 1, y)) caging_squares.append(game.get_square(x + 2, y)) else: caging_squares.append(game.get_square(x + 1, y + 1)) caging_squares.append(game.get_square(x + 1, y + 2)) caging_squares.append(game.get_square(x + 2, y + 1)) # caging_squares.append(game.state.pitch.get_square(x + 3, y + 3)) return caging_squares def caging_squares_north_west(game: Game, protect_square: Square) -> List[Square]: caging_squares: List[Square] = [] x = protect_square.x y = protect_square.y if x >= 3: if y == game.state.pitch.height-2: caging_squares.append(game.get_square(x - 1, y + 1)) caging_squares.append(game.get_square(x - 2, y + 1)) caging_squares.append(game.get_square(x - 1, y)) caging_squares.append(game.get_square(x - 2, y)) elif y == game.state.pitch.height-1: caging_squares.append(game.get_square(x - 1, y)) caging_squares.append(game.get_square(x - 2, y)) else: caging_squares.append(game.get_square(x - 1, y + 1)) caging_squares.append(game.get_square(x - 1, y + 2)) caging_squares.append(game.get_square(x - 2, y + 1)) # caging_squares.append(game.state.pitch.get_square(x - 3, y + 3)) return caging_squares def caging_squares_south_west(game: Game, protect_square: Square) -> List[Square]: caging_squares: List[Square] = [] x = protect_square.x y = protect_square.y if x >= 3: if y == 2: caging_squares.append(game.get_square(x - 1, y - 1)) caging_squares.append(game.get_square(x - 2, y - 1)) caging_squares.append(game.get_square(x - 1, y)) caging_squares.append(game.get_square(x - 2, y)) elif y == 1: caging_squares.append(game.get_square(x - 1, y)) caging_squares.append(game.get_square(x - 2, y)) else: caging_squares.append(game.get_square(x - 1, y - 1)) caging_squares.append(game.get_square(x - 1, y - 2)) caging_squares.append(game.get_square(x - 2, y - 1)) # caging_squares.append(game.state.pitch.get_square(x - 3, y - 3)) return caging_squares def caging_squares_south_east(game: Game, protect_square: Square) -> List[Square]: caging_squares: List[Square] = [] x = protect_square.x y = protect_square.y if x <= game.state.pitch.width-3: if y == 2: caging_squares.append(game.get_square(x + 1, y - 1)) caging_squares.append(game.get_square(x + 2, y - 1)) caging_squares.append(game.get_square(x + 1, y)) caging_squares.append(game.get_square(x + 2, y)) elif y == 1: caging_squares.append(game.get_square(x + 1, y)) caging_squares.append(game.get_square(x + 2, y)) else: caging_squares.append(game.get_square(x + 1, y - 1)) caging_squares.append(game.get_square(x + 1, y - 2)) caging_squares.append(game.get_square(x + 2, y - 1)) # caging_squares.append(game.get_square(x + 3, y - 3)) return caging_squares def is_caging_position(game: Game, player: Player, protect_player: Player) -> bool: return player.position.distance(protect_player.position) <= 2 and not is_castle_position_of(game, player, protect_player) def has_player_within_n_squares(game: Game, units: List[Player], square: Square, num_squares: int) -> bool: for cur in units: if cur.position.distance(square) <= num_squares: return True return False def has_adjacent_player(game: Game, square: Square) -> bool: return not game.get_adjacent_players(square) def is_castle_position_of(game: Game, player1: Player, player2: Player) -> bool: return player1.position.x == player2.position.x or player1.position.y == player2.position.y def is_bishop_position_of(game: Game, player1: Player, player2: Player) -> bool: return abs(player1.position.x - player2.position.x) == abs(player1.position.y - player2.position.y) def attacker_would_surf(game: Game, attacker: Player, defender: Player) -> bool: if (defender.has_skill(Skill.SIDE_STEP) and not attacker.has_skill(Skill.GRAB)) or defender.has_skill(Skill.STAND_FIRM): return False if not attacker.position.is_adjacent(defender.position): return False return direct_surf_squares(game, attacker.position, defender.position) def direct_surf_squares(game: Game, attack_square: Square, defend_square: Square) -> bool: defender_on_sideline: bool = on_sideline(game, defend_square) defender_in_endzone: bool = on_endzone(game, defend_square) if defender_on_sideline and defend_square.x == attack_square.x: return True if defender_in_endzone and defend_square.y == attack_square.y: return True if defender_in_endzone and defender_on_sideline: return True return False def reverse_x_for_right(game: Game, team: Team, x: int) -> int: if not game.is_team_side(Square(13, 3), team): res = game.state.pitch.width - 1 - x else: res = x return res def reverse_x_for_left(game: Game, team: Team, x: int) -> int: if game.is_team_side(Square(13, 3), team): res = game.state.pitch.width - 1 - x else: res = x return res def on_sideline(game: Game, square: Square) -> bool: return square.y == 1 or square.y == game.state.pitch.height - 1 def on_endzone(game: Game, square: Square) -> bool: return square.x == 1 or square.x == game.state.pitch.width - 1 def on_los(game: Game, team: Team, square: Square) -> bool: return (reverse_x_for_right(game, team, square.x) == 13) and 4 < square.y < 21 def los_squares(game: Game, team: Team) -> List[Square]: squares: List[Square] = [ game.get_square(reverse_x_for_right(game, team, 13), 5), game.get_square(reverse_x_for_right(game, team, 13), 6), game.get_square(reverse_x_for_right(game, team, 13), 7), game.get_square(reverse_x_for_right(game, team, 13), 8), game.get_square(reverse_x_for_right(game, team, 13), 9), game.get_square(reverse_x_for_right(game, team, 13), 10), game.get_square(reverse_x_for_right(game, team, 13), 11) ] return squares def distance_to_sideline(game: Game, square: Square) -> int: return min(square.y - 1, game.state.pitch.height - square.y - 2) def is_endzone(game, square: Square) -> bool: return square.x == 1 or square.x == game.state.pitch.width - 1 def last_block_proc(game) -> Optional[Block]: for i in range(len(game.state.stack.items) - 1, -1, -1): if isinstance(game.state.stack.items[i], Block): block_proc = game.state.stack.items[i] return block_proc return None def is_adjacent_ball(game: Game, square: Square) -> bool: ball_square = game.get_ball_position() return ball_square is not None and ball_square.is_adjacent(square) def squares_within(game: Game, square: Square, distance: int) -> List[Square]: squares: List[Square] = [] for i in range(-distance, distance+1): for j in range(-distance, distance+1): cur_square = game.get_square(square.x+i, square.y+j) if cur_square != square and not game.is_out_of_bounds(cur_square): squares.append(cur_square) return squares def distance_to_defending_endzone(game: Game, team: Team, position: Square) -> int: res = reverse_x_for_right(game, team, position.x) - 1 return res def distance_to_scoring_endzone(game: Game, team: Team, position: Square) -> int: res = reverse_x_for_left(game, team, position.x) - 1 return res #return game.state.pitch.width - 1 - reverse_x_for_right(game, team, position.x) def players_in_scoring_endzone(game: Game, team: Team, include_own: bool = True, include_opp: bool = False) -> List[Player]: players: List[Player] = get_players(game, team, include_own=include_own, include_opp=include_opp) selected_players: List[Player] = [] for player in players: if in_scoring_endzone(game, team, player.position): selected_players.append(player) return selected_players def in_scoring_endzone(game: Game, team: Team, square: Square) -> bool: return reverse_x_for_left(game, team, square.x) == 1 def players_in_scoring_distance(game: Game, team: Team, include_own: bool = True, include_opp: bool = True, include_stunned: bool = False) -> List[Player]: players: List[Player] = get_players(game, team, include_own=include_own, include_opp=include_opp, include_stunned=include_stunned) selected_players: List[Player] = [] for player in players: if distance_to_scoring_endzone(game, team, player.position) <= player.num_moves_left(): selected_players.append(player) return selected_players def distance_to_nearest_player(game: Game, team: Team, square: Square, include_own: bool = True, include_opp: bool = True, only_used: bool = False, include_used: bool = True, include_stunned: bool = True, only_blockable: bool = False) -> int: opps: List[Player] = get_players(game, team, include_own=include_own, include_opp=include_opp, only_used=only_used, include_used=include_used, include_stunned=include_stunned, only_blockable=only_blockable) cur_max = 100 for opp in opps: dist = opp.position.distance(square) cur_max = min(cur_max, dist) return cur_max def screening_distance(game: Game, from_square: Square, to_square: Square) -> float: # Return the "screening distance" between 3 squares. (To complete) # float dist =math.sqrt(math.pow(square.x - cur.position.x, 3) + math.pow(square.y - cur.position.y, 3)) return 0.0 def num_opponents_can_reach(game: Game, team: Team, square: Square) -> int: opps: List[Player] = get_players(game, team, include_own=False, include_opp=True) num_opps_reach: int = 0 for cur in opps: dist = max(square.x - cur.position.x, square.y - cur.position.y) if cur.state.stunned: continue move_allowed = cur.get_ma() + 2 if not cur.state.up: move_allowed -= 3 if dist < move_allowed: num_opps_reach += 1 return num_opps_reach def num_opponents_on_field(game: Game, team: Team) -> int: opps: List[Player] = get_players(game, team, include_own=False, include_opp=True) num_opponents = 0 for cur in opps: if cur.position is not None: num_opponents += 1 return num_opponents def number_opponents_closer_than_to_endzone(game: Game, team: Team, square: Square) -> int: opponents: List[Player] = get_players(game, team, include_own=False, include_opp=True) num_opps = 0 distance_square_endzone = distance_to_defending_endzone(game, team, square) for opponent in opponents: distance_opponent_endzone = distance_to_defending_endzone(game, team, opponent.position) if distance_opponent_endzone < distance_square_endzone: num_opps += 1 return num_opps def in_scoring_range(game: Game, player: Player) -> bool: return player.num_moves_left() >= distance_to_scoring_endzone(game, player.team, player.position) def players_in_scoring_range(game: Game, team: Team, include_own=True, include_opp=True, include_used=True, include_stunned=True) -> List[Player]: players: List[Player] = get_players(game, team, include_own=include_own, include_opp=include_opp, include_stunned=include_stunned, include_used=include_used) res: List[Player] = [] for player in players: if in_scoring_range(game, player): res.append(player) return res def players_in(game: Game, team: Team, squares: List[Square], include_own=True, include_opp=True, include_used=True, include_stunned=True, only_blockable=False) -> List[Player]: allowed_players: List[Player] = get_players(game, team, include_own=include_own, include_opp=include_opp, include_used=include_used, include_stunned=include_stunned, only_blockable=only_blockable) res: List[Player] = [] for square in squares: player: Optional[Player] = game.get_player_at(square) if player is None: continue if player in allowed_players: res.append(player) return res
[]
DmitriyGrigoriev/sb-fastapi
sb_backend/cli/cli.py
1aef3db6ce26ea054e048e5927552d48c2eccbfb
# -*- coding: utf-8 -*- """sb-fastapi CLI root.""" import logging import click from sb_backend.cli.commands.serve import serve @click.group() @click.option( "-v", "--verbose", help="Enable verbose logging.", is_flag=True, default=False, ) def cli(**options): """sb-fastapi CLI root.""" if options["verbose"]: level = logging.DEBUG else: level = logging.INFO logging.basicConfig( level=level, format="[%(asctime)s] [%(process)s] [%(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S %z", ) cli.add_command(serve)
[((131, 144), 'click.group', 'click.group', ([], {}), '()\n', (142, 144), False, 'import click\n'), ((146, 243), 'click.option', 'click.option', (['"""-v"""', '"""--verbose"""'], {'help': '"""Enable verbose logging."""', 'is_flag': '(True)', 'default': '(False)'}), "('-v', '--verbose', help='Enable verbose logging.', is_flag=\n True, default=False)\n", (158, 243), False, 'import click\n'), ((414, 554), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'level', 'format': '"""[%(asctime)s] [%(process)s] [%(levelname)s] %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S %z"""'}), "(level=level, format=\n '[%(asctime)s] [%(process)s] [%(levelname)s] %(message)s', datefmt=\n '%Y-%m-%d %H:%M:%S %z')\n", (433, 554), False, 'import logging\n')]
DSandovalFlavio/Dashboards-Plotly-Dash
1-Chapter/htmlcomponents.py
58867c2e813bc9273838dec12e7bd15be25504fa
import dash from dash import html app = dash.Dash(__name__) app.layout = html.Div(children=[html.H1('Data Science', style = {'textAlign': 'center', 'color': '#0FD08D', 'font-size': '50px'}), html.H2('La carrera mas sexy del siglo XXI', style = {'textAlign': 'center', 'color' : '#009A64'}), html.P('Factores clave:'), html.Ul(children = [html.Li('Factor 1'), html.Li('Factor 2'), html.Li('Factor 3'), html.Li(['Source: ', html.A('https://www.excelsior.com.mx/nacional/ciencia-de-datos-la-carrera-mas-sexy-del-xxi-en-la-unam/1323946', href = 'https://www.excelsior.com.mx/nacional/ciencia-de-datos-la-carrera-mas-sexy-del-xxi-en-la-unam/1323946') ]) ]) ]) if __name__ == '__main__': app.run_server(debug=True)
[((41, 60), 'dash.Dash', 'dash.Dash', (['__name__'], {}), '(__name__)\n', (50, 60), False, 'import dash\n'), ((94, 193), 'dash.html.H1', 'html.H1', (['"""Data Science"""'], {'style': "{'textAlign': 'center', 'color': '#0FD08D', 'font-size': '50px'}"}), "('Data Science', style={'textAlign': 'center', 'color': '#0FD08D',\n 'font-size': '50px'})\n", (101, 193), False, 'from dash import html\n'), ((361, 460), 'dash.html.H2', 'html.H2', (['"""La carrera mas sexy del siglo XXI"""'], {'style': "{'textAlign': 'center', 'color': '#009A64'}"}), "('La carrera mas sexy del siglo XXI', style={'textAlign': 'center',\n 'color': '#009A64'})\n", (368, 460), False, 'from dash import html\n'), ((581, 606), 'dash.html.P', 'html.P', (['"""Factores clave:"""'], {}), "('Factores clave:')\n", (587, 606), False, 'from dash import html\n'), ((660, 679), 'dash.html.Li', 'html.Li', (['"""Factor 1"""'], {}), "('Factor 1')\n", (667, 679), False, 'from dash import html\n'), ((729, 748), 'dash.html.Li', 'html.Li', (['"""Factor 2"""'], {}), "('Factor 2')\n", (736, 748), False, 'from dash import html\n'), ((798, 817), 'dash.html.Li', 'html.Li', (['"""Factor 3"""'], {}), "('Factor 3')\n", (805, 817), False, 'from dash import html\n'), ((944, 1185), 'dash.html.A', 'html.A', (['"""https://www.excelsior.com.mx/nacional/ciencia-de-datos-la-carrera-mas-sexy-del-xxi-en-la-unam/1323946"""'], {'href': '"""https://www.excelsior.com.mx/nacional/ciencia-de-datos-la-carrera-mas-sexy-del-xxi-en-la-unam/1323946"""'}), "(\n 'https://www.excelsior.com.mx/nacional/ciencia-de-datos-la-carrera-mas-sexy-del-xxi-en-la-unam/1323946'\n , href=\n 'https://www.excelsior.com.mx/nacional/ciencia-de-datos-la-carrera-mas-sexy-del-xxi-en-la-unam/1323946'\n )\n", (950, 1185), False, 'from dash import html\n')]
iitd-plos/baadal2.0
baadalinstallation/baadal/modules/vm_helper.py
0496a8ddb5c0620f3448f018ba48b080b96cbe61
# -*- coding: utf-8 -*- ################################################################################### from gluon import current from helper import get_constant, execute_remote_cmd, config, get_datetime, \ log_exception, is_pingable, get_context_path from libvirt import * # @UnusedWildImport from log_handler import logger from nat_mapper import create_mapping, remove_mapping import math, shutil, libvirt, os, time, random import xml.etree.ElementTree as etree def _choose_datastore(): """ Chooses datastore from a list of available datastores """ # datastore_capacity = current.db(current.db.datastore.id >= 0).select(orderby = current.db.datastore.used datastores = current.db(current.db.datastore.id >= 0).select() datastore_length = len(datastores) logger.debug("datastore_lengtn" + str(datastore_length)) if(datastore_length == 0): raise Exception("No datastore found.") else: count = datastore_length available_datastores = {} while count != 0: available = datastores[datastore_length-count].capacity - datastores[datastore_length-count].used available_datastores[datastores[datastore_length-count]] = available count = count-1 z = [(i,available_datastores[i]) for i in available_datastores] z.sort(key=lambda x: x[1]) available_datastores = z logger.debug("available d" + str(available_datastores[-1])) first_elts = available_datastores[-1] first_elts = first_elts[0] logger.debug("selected database" + str(first_elts)) return first_elts def host_resources_used(host_id): """ Returns resources utilization of a host in MB, Count """ RAM = 0.0 CPU = 0.0 vms = current.db((current.db.vm_data.host_id == host_id) & (current.db.vm_data.status != current.VM_STATUS_UNKNOWN) & (current.db.vm_data.status != current.VM_STATUS_IN_QUEUE)).select() logger.debug("vms selected are: " + str(vms)) for vm_data in vms: RAM += vm_data.RAM CPU += vm_data.vCPU return (math.ceil(RAM),math.ceil(CPU)) def getVirshDomainConn(vm_details, host_ip=None, domain_name=None): """ Generic method to establish libvirt connection """ if vm_details != None: host_ip = vm_details.host_id.host_ip.private_ip domain_name = vm_details.vm_identity connection_object = libvirt.open("qemu+ssh://root@" + host_ip + "/system") domain = connection_object.lookupByName(domain_name) return (connection_object, domain) def getVirshDomain(vm_details): """ Generic method to establish libvirt connection """ (connection_object, domain) = getVirshDomainConn(vm_details) connection_object.close() return domain def _set_portgroup_in_vm(domain_name, portgroup, host_ip, vlan_tag): """ Set the vlan tag in network configuration of VM This is required to ensure that VM fetches IP of its vlan from DHCP """ (connection_object, domain) = getVirshDomainConn(None, host_ip, domain_name) xml = etree.fromstring(domain.XMLDesc(0)) source_network_element = xml.find('.//interface/source') source_network_string=etree.tostring(source_network_element) logger.debug("Source network is " + source_network_string) if source_network_string.find(" bridge=") != -1: logger.debug("Source is set to bridge adding <vlan><tag_id> to the interface tag ") root_new = xml.find('.//interface') root_new_vlan= etree.SubElement(root_new, 'vlan') root_new_tag= etree.SubElement(root_new_vlan, 'tag') root_new_tag.set('id',vlan_tag) logger.debug("After append root_new_vlan is " + etree.tostring(root_new_vlan)) elif source_network_string.find(" network=") != -1: logger.debug("Source is set to network adding portgroup to the source tag ") source_network_element.set('portgroup', portgroup) logger.debug("Changed source network is " + etree.tostring(source_network_element)) else: logger.debug("Neither VM nor vlan tagId is added in the xml" ) domain = connection_object.defineXML(etree.tostring(xml)) domain.destroy() domain.create() domain.isActive() connection_object.close() def _get_private_ip_mac(security_domain_id): """ Chooses a random Private IP from the pool, such that: - It is not assigned to any VM or host - It belongs to VLAN of given security domain """ vlans = current.db(current.db.security_domain.id == security_domain_id)._select(current.db.security_domain.vlan) private_ip_pool = current.db((~current.db.private_ip_pool.id.belongs(current.db(current.db.vm_data.private_ip != None)._select(current.db.vm_data.private_ip))) & (~current.db.private_ip_pool.id.belongs(current.db(current.db.host.host_ip != None)._select(current.db.host.host_ip))) & (current.db.private_ip_pool.vlan.belongs(vlans))).select(current.db.private_ip_pool.ALL, orderby='<random>').first() if private_ip_pool: return private_ip_pool else: sd = current.db.security_domain[security_domain_id] raise Exception(("Available MACs are exhausted for security domain '%s'." % sd.name)) def _choose_random_public_ip(): """ Chooses a random Public IP from the pool, such that: - It is not assigned to any VM - It is not assigned to any host - IP is marked active. """ public_ip_pool = current.db((~current.db.public_ip_pool.id.belongs(current.db(current.db.vm_data.public_ip != None)._select(current.db.vm_data.public_ip))) & (~current.db.public_ip_pool.id.belongs(current.db(current.db.host.public_ip != None)._select(current.db.host.public_ip))) & (current.db.public_ip_pool.is_active == True)) \ .select(current.db.public_ip_pool.ALL, orderby='<random>').first() return public_ip_pool def _choose_mac_ip(vm_properties): """ Chooses mac address and ip address for a vm to be installed. It also chooses a random public IP if requested """ if not 'private_ip' in vm_properties: private_ip_info = _get_private_ip_mac(vm_properties['security_domain']) vm_properties['private_ip'] = private_ip_info.private_ip vm_properties['mac_addr'] = private_ip_info.mac_addr vm_properties['vlan_name'] = private_ip_info.vlan.name vm_properties['vlan_tag'] = private_ip_info.vlan.vlan_tag if vm_properties['public_ip_req']: if 'public_ip' not in vm_properties: public_ip_pool = _choose_random_public_ip() if public_ip_pool: vm_properties['public_ip'] = public_ip_pool.public_ip else: raise Exception("Available Public IPs are exhausted.") else: vm_properties['public_ip'] = None def _choose_mac_ip_vncport(vm_properties): """ Chooses mac address, ip address and vncport for a vm to be installed """ _choose_mac_ip(vm_properties) start_range = int(get_constant('vncport_start_range')) end_range = int(get_constant('vncport_end_range')) vnc_ports_taken = current.db().select(current.db.vm_data.vnc_port) while True: random_vnc_port = random.randrange(start_range, end_range, 1) if not random_vnc_port in vnc_ports_taken: break; vm_properties['vnc_port'] = str(random_vnc_port) def find_new_host(RAM, vCPU): """ Select a random host from list of 3 hosts with available RAM and CPU Availability is checked with 200 percent over-commitment. """ hosts = current.db(current.db.host.status == 1).select() hosts = hosts.as_list(True,False) count = 3 selected_hosts = [] while count != 0 and hosts: host = random.choice(hosts) logger.debug("Checking host =" + host['host_name']) (used_ram, used_cpu) = host_resources_used(host['id']) logger.debug("used ram: " + str(used_ram) + " used cpu: " + str(used_cpu) + " host ram: " + str(host['RAM']) + " host cpu "+ str(host['CPUs'])) host_ram_after_200_percent_overcommitment = math.floor((host['RAM'] * 1024) * 2) host_cpu_after_200_percent_overcommitment = math.floor(host['CPUs'] * 2) logger.debug("ram available: %s cpu available: %s cpu < max cpu: %s" % ((( host_ram_after_200_percent_overcommitment - used_ram) >= RAM), ((host_cpu_after_200_percent_overcommitment - used_cpu) >= vCPU), (vCPU <= host['CPUs']) )) if((( host_ram_after_200_percent_overcommitment - used_ram) >= RAM) and ((host_cpu_after_200_percent_overcommitment - used_cpu) >= vCPU) and (vCPU <= host['CPUs'])): selected_hosts.append(host) count = count -1 hosts.remove(host) if selected_hosts: #Sort selected host list by Ram first then Cpu selected_host = sorted(selected_hosts,key=lambda k: k['RAM'])[0] return selected_host['id'] #If no suitable host found raise Exception("No active host is available for a new vm.") def allocate_vm_properties(vm_details): """ Allocates vm properties ( datastore, host, ip address, mac address, vnc port, ram, vcpus) """ logger.debug("Inside allocate_vm_properties()...") vm_properties = {} vm_properties['datastore'] = _choose_datastore() logger.debug("Datastore selected is: " + str(vm_properties['datastore'])) vm_properties['host'] = find_new_host(vm_details.RAM, vm_details.vCPU) logger.debug("Host selected is: " + str(vm_properties['host'])) vm_properties['public_ip_req'] = False if (vm_details.public_ip == None) else True vm_properties['security_domain'] = vm_details.security_domain _choose_mac_ip_vncport(vm_properties) logger.debug("MAC is : " + str(vm_properties['mac_addr']) + " IP is : " + str(vm_properties['private_ip']) + " VNCPORT is : " \ + str(vm_properties['vnc_port']) + " Vlan tag is " + str(vm_properties['vlan_tag']) ) vm_properties['ram'] = vm_details.RAM vm_properties['vcpus'] = vm_details.vCPU return vm_properties def create_vm_image(vm_details, datastore): """ Create a VM image - Creates a directory for the new VM using vm_identity - Find the location of template image requested for - Copy the template image from its location to new vm directory """ # Creates a directory for the new vm vm_directory_path = datastore.system_mount_point + '/' + get_constant('vms') + '/' + vm_details.vm_identity logger.debug("Creating vm directory...") if not os.path.exists (vm_directory_path): os.makedirs(vm_directory_path) else: raise Exception("Directory with same name as vmname already exists.") # Finds the location of template image that the user has requested for its vm. template = current.db.template[vm_details.template_id] vm_image_name = vm_directory_path + '/' + vm_details.vm_identity + '.qcow2' # Copies the template image from its location to new vm directory storage_type = config.get("GENERAL_CONF","storage_type") copy_command = 'ndmpcopy ' if storage_type == current.STORAGE_NETAPP_NFS else 'cp ' #template_dir = get_constant('vm_templates_datastore') if copy_command == 'cp ': template_location = datastore.system_mount_point + '/' + get_constant('templates_dir') + '/' + template.hdfile logger.debug("cp %s %s" % (template_location, vm_image_name)) rc = os.system("cp %s %s" % (template_location, vm_image_name)) if rc != 0: logger.error("Copy not successful") raise Exception("Copy not successful") else: logger.debug("Copied successfully") elif copy_command == 'ndmpcopy ': template_dir = template.datastore_id.path logger.debug(template_dir) logger.debug("Copy in progress when storage type is " + str(storage_type)) command_to_execute = copy_command + template_dir + '/' + get_constant("templates_dir") + '/' + \ template.hdfile + ' ' + datastore.path + '/' + get_constant('vms') + '/' + \ vm_details.vm_identity logger.debug("ndmpcopy command: " + str(command_to_execute)) command_output = execute_remote_cmd(datastore.ds_ip, datastore.username, command_to_execute, datastore.password) logger.debug(command_output) logger.debug("Copied successfully.") try: vm_template_name = datastore.system_mount_point + '/' + get_constant('vms') + '/' + vm_details.vm_identity + '/' + template.hdfile os.rename(vm_template_name, vm_image_name) logger.debug("Template renamed successfully") except: logger.debug("Template rename not successful") raise Exception("Template rename not successful") return (template, vm_image_name) def _get_install_command(vm_details, vm_image_location, vm_properties): """ Generates install command for vm """ template = vm_properties['template'] bus = ',bus=virtio' optional = ' --import --os-type=' + template.os model = ',model=virtio' if (template.arch != 'amd64' and template.os == 'Linux'): optional = optional + ' --arch=' + template.arch + ' ' format_command = '' if (template.type == 'QCOW2'): format_command = ',format=qcow2' if (template.os == 'Windows'): bus = '' model = '' install_command = 'virt-install \ --name=' + vm_details.vm_identity + ' \ --ram=' + str(vm_properties['ram']) + ' \ --vcpus=' + str(vm_properties['vcpus']) + optional + ' \ --disk path=' + vm_image_location + format_command + bus + ',cache=none' + ' \ --network network='+current.LIBVIRT_NETWORK + model + ',mac=' + vm_properties['mac_addr'] + ' \ --graphics vnc,port=' + vm_properties['vnc_port'] + ',listen=0.0.0.0,password=duolc \ --noautoconsole \ --autostart \ --force' return install_command def _generate_disk_xml(diskpath,target_disk): """ Generates xml for defining new disk """ root_element = etree.Element('disk',attrib = {'type':'block','device':'disk'}) etree.SubElement(root_element, 'driver',attrib = {'name':'qemu','cache':'none', 'type':'qcow2'}) etree.SubElement(root_element, 'source', attrib = {'dev':diskpath}) etree.SubElement(root_element, 'target', attrib = {'dev': target_disk}) return (etree.tostring(root_element)) def create_extra_disk_image(vm_details, disk_name, size, datastore): """ Create extra disk image """ vm_extra_disks_directory_path = datastore.system_mount_point + '/' + get_constant('extra_disks_dir') + '/' + \ datastore.ds_name + '/' + vm_details.vm_identity if not os.path.exists (vm_extra_disks_directory_path): logger.debug("Making Directory") os.makedirs(vm_extra_disks_directory_path) diskpath = vm_extra_disks_directory_path + '/' + disk_name command= "qemu-img create -f qcow2 "+ diskpath + " " + str(size) + "G" output = os.system(command) return False if output != 0 else True def attach_disk(vm_details, disk_name, hostip, already_attached_disks, new_vm): """ Attach given disk to the VM """ try: (connection_object, domain) = getVirshDomainConn(None, hostip, vm_details.vm_identity) #already_attached_disks = len(current.db(current.db.attached_disks.vm_id == vm.id).select()) logger.debug("Value of alreadyattached is : " + str(already_attached_disks)) (diskpath, device_present, disk_size) = get_extra_disk_location(vm_details.datastore_id, vm_details.vm_identity, disk_name, True) if not device_present: raise Exception("Device to be attached %s missing" %(diskpath)) # Attaching disk to vm using libvirt API target_disk = "vd" + chr(97 + already_attached_disks + 1) logger.debug(target_disk) logger.debug("...................") xmlDescription = _generate_disk_xml(diskpath, target_disk) logger.debug(xmlDescription) logger.debug("new vm is %s " % new_vm) if new_vm: logger.debug("Starting to attach disk on new vm request.") domain.destroy() logger.debug("VM destroyed") domain.attachDeviceFlags(xmlDescription, VIR_DOMAIN_AFFECT_CONFIG) logger.debug("Disk attached") logger.debug("Turn on vm") domain.create() logger.debug("VM started") domain.isActive() elif vm_details.status == current.VM_STATUS_SHUTDOWN: logger.debug("Starting to attach disk while vm is shutdown.") domain.attachDeviceFlags(xmlDescription, VIR_DOMAIN_AFFECT_CONFIG) logger.debug("Disk attached") else: raise Exception("VM is not in shutdown state. Check its status on host") xmlfile = domain.XMLDesc(0) domain = connection_object.defineXML(xmlfile) logger.debug("VM XML redefined") connection_object.close() return disk_size except: logger.exception('Exception: ') return 0 def serve_extra_disk_request(vm_details, disk_size, host_ip, new_vm = False): """ Serves extra disk request and updates db """ logger.debug("Starting to serve extra disk request...") logger.debug("new vm is %s " % new_vm) datastore = _choose_datastore() already_attached_disks = len(current.db(current.db.attached_disks.vm_id == vm_details.id).select()) disk_name = vm_details.vm_identity + "_disk" + str(already_attached_disks + 1) + ".qcow2" disk_created = create_extra_disk_image(vm_details, disk_name, disk_size, datastore) vm_details.datastore_id = datastore.id if disk_created: if (attach_disk(vm_details, disk_name, host_ip, already_attached_disks, new_vm)): current.db.attached_disks.insert(vm_id = vm_details.id, datastore_id = datastore.id , attached_disk_name = disk_name, capacity = disk_size) current.db(current.db.datastore.id == datastore.id).update(used = int(datastore.used) + int(disk_size)) return True return False def launch_vm_on_host(vm_details, vm_image_location, vm_properties): """ Launches a vm image on host """ attach_disk_status_message = '' install_command = _get_install_command(vm_details, vm_image_location, vm_properties) # Starts installing a vm host_ip = current.db.host[vm_properties['host']].host_ip.private_ip logger.debug("Installation started...") logger.debug("Host is "+ host_ip) logger.debug("Installation command : " + install_command) command_output = execute_remote_cmd(host_ip, 'root', install_command) logger.debug(command_output) logger.debug("Starting to set portgroup in vm...") _set_portgroup_in_vm(vm_details['vm_identity'], vm_properties['vlan_name'], host_ip, vm_properties['vlan_tag']) logger.debug("Portgroup set in vm") # Serving HDD request if (int(vm_details.extra_HDD) != 0): if (serve_extra_disk_request(vm_details, vm_details.extra_HDD, host_ip, new_vm = True)): message = "Attached extra disk successfully." attach_disk_status_message += message logger.debug(message) else: attach_disk_status_message += "Attached extra disk failed." return attach_disk_status_message def check_if_vm_defined(hostip, vmname): """ Checks if a newly created vm is successfully defined """ vm_defined = False try: connection_object = libvirt.openReadOnly('qemu+ssh://root@'+ hostip +'/system') domain = connection_object.lookupByName(vmname) if domain.ID() in connection_object.listDomainsID(): vm_defined = True connection_object.close() return vm_defined except: return False def _free_vm_properties(vm_details, vm_properties): """ Frees vm properties in-case installation has failed mid-way """ logger.debug("VM installation fails..Starting to free vm properties") if vm_properties: host_ip_of_vm = current.db.host[vm_properties['host']].host_ip.private_ip logger.debug("Host IP of vm is " + str(host_ip_of_vm)) if check_if_vm_defined(host_ip_of_vm, vm_details.vm_identity): connection_object = libvirt.open('qemu+ssh://root@'+ host_ip_of_vm +'/system') domain = connection_object.lookupByName(vm_details.vm_identity) logger.debug("Starting to delete vm from host..") domain.destroy() domain.undefine() connection_object.close() logger.debug("VM deleted.") current.db(current.db.attached_disks.vm_id == vm_details.id).delete() if 'datastore' in vm_properties: vm_directory_path = vm_properties['datastore'].system_mount_point + '/' + get_constant('vms') + '/' + vm_details.vm_identity vm_extra_disk_dir_path = vm_properties['datastore'].system_mount_point + '/' + get_constant('extra_disks_dir') + '/' + vm_properties['datastore'].ds_name + '/' + vm_details.vm_identity if os.path.exists (vm_directory_path): logger.debug("Starting to delete vm directory.") shutil.rmtree(vm_directory_path) if os.path.exists (vm_extra_disk_dir_path): logger.debug("Starting to delete vm extra disk directory.") shutil.rmtree(vm_extra_disk_dir_path) return def update_db_after_vm_installation(vm_details, vm_properties, parent_id = None): """ Updates db after a vm is installed successfully """ logger.debug("Starting to update db after vm installation..") hostid = vm_properties['host'] datastore = vm_properties['datastore'] template_hdd = vm_properties['template'].hdd logger.debug("Inside update db after installation") logger.debug(vm_properties) # Updating the used entry of datastore current.db(current.db.datastore.id == datastore.id).update(used = int(datastore.used) + int(vm_details.extra_HDD) + int(template_hdd)) private_ip_id = current.db.private_ip_pool(private_ip=vm_properties['private_ip']).id public_ip_id = None if vm_properties['public_ip'] != None: public_ip_id = current.db.public_ip_pool(public_ip=vm_properties['public_ip']).id if parent_id: vm_status = current.VM_STATUS_SHUTDOWN else: vm_status = current.VM_STATUS_RUNNING # Update vm_data table current.db(current.db.vm_data.id == vm_details.id).update( host_id = hostid, extra_HDD = vm_details.extra_HDD, datastore_id = datastore.id, vnc_port = vm_properties['vnc_port'], private_ip = private_ip_id, public_ip = public_ip_id, start_time = get_datetime(), parent_id = parent_id, status = vm_status) logger.debug("Updated db") return def create_object_store(parameters,object_data): try: logger.debug("In create_object_store() function...") object_name=object_data['object_store_name'] size_limit=object_data['object_store_size'] sh_path = os.path.join(get_context_path(), 'private/object_storage.sh') command = 'sh %s %s %s' %(sh_path, object_name, str(size_limit)) logger.debug("command :%s" %command) file_name= object_data['object_store_name'] + "_key.txt" file_path = os.path.join(get_context_path(), 'private/Object_keys/' + file_name) cp = os.open(file_path,os.O_RDWR|os.O_CREAT) co = os.fdopen(cp,"rw+") fd = os.open('/home/key.txt',os.O_RDWR|os.O_CREAT) fo = os.fdopen(fd,"r+") key_s3_secret= fo.readline(); co.write(key_s3_secret); key_s3_access= fo.readline(); co.write(key_s3_access); key_swift_secret= fo.readline(); co.write(key_swift_secret); swift_user= 'Swift_user: ' + object_name + ':swift' co.write(swift_user) co.close() a,b,key_swift_secret= key_swift_secret.partition(' ') # @UnusedVariable a,b,key_s3_secret= key_s3_secret.partition(' ') # @UnusedVariable a,b,key_s3_access= key_s3_access.partition(' ') # @UnusedVariable #print key_s3_secret, key_s3_access , key_swift_secret object_data.update_record(swift_access_key= key_swift_secret.strip() , s3_secret_key= key_s3_secret.strip(), s3_access_key= key_s3_access.strip(), status=3) fo.close() message = "Object Store is created successfully." return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) # Installs a vm def install(parameters): """ Installs a vm """ vmid = parameters['vm_id'] logger.debug("In install() function...") vm_details = current.db.vm_data[vmid] vm_properties = None try: # Fetches vm details from vm_data table logger.debug("VM details are: " + str(vm_details)) # Calling allocate_vm_properties function vm_properties = allocate_vm_properties(vm_details) # Calling create_vm_image function (vm_properties['template'], vm_image_location) = create_vm_image(vm_details, vm_properties['datastore']) # Calling launch_vm_on_host attach_disk_status_message = launch_vm_on_host(vm_details, vm_image_location, vm_properties) # Checking if vm has been installed successfully assert(check_if_vm_defined(current.db.host[vm_properties['host']].host_ip.private_ip, vm_details.vm_identity)), "VM is not installed. Check logs." if vm_properties['public_ip_req']: create_mapping(vm_properties['public_ip'], vm_properties['private_ip']) # Update database after vm installation update_db_after_vm_installation(vm_details, vm_properties) message = "VM is installed successfully." + attach_disk_status_message logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: if vm_properties != None: _free_vm_properties(vm_details, vm_properties) logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def start(parameters): """ Starts a vm """ logger.debug("Inside start() function") vm_id = parameters['vm_id'] vm_details = current.db.vm_data[vm_id] try: domain = getVirshDomain(vm_details) if domain.info()[0] == VIR_DOMAIN_RUNNING: raise Exception("VM is already running. Check vm status on host.") domain.create() current.db(current.db.vm_data.id == vm_id).update(status = current.VM_STATUS_RUNNING) message = vm_details.vm_identity + " is started successfully." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def suspend(parameters): """ Suspends a vm """ logger.debug("Inside suspend() function") vm_id = parameters['vm_id'] vm_details = current.db.vm_data[vm_id] try: domain = getVirshDomain(vm_details) if domain.info()[0] == VIR_DOMAIN_PAUSED: raise Exception("VM is already paused. Check vm status on host.") domain.suspend() current.db(current.db.vm_data.id == vm_id).update(status = current.VM_STATUS_SUSPENDED) message = vm_details.vm_identity + " is suspended successfully." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def resume(parameters): """ Resumes a vm """ logger.debug("Inside resume() function") vm_id = parameters['vm_id'] vm_details = current.db.vm_data[vm_id] try: domain = getVirshDomain(vm_details) if domain.info()[0] == VIR_DOMAIN_RUNNING: raise Exception("VM is already running. Check vm status on host.") domain.resume() current.db(current.db.vm_data.id == vm_id).update(status = current.VM_STATUS_RUNNING) message = vm_details.vm_identity + " is resumed successfully." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def destroy(parameters): """ Destroys a vm forcefully """ logger.debug("Inside destroy() function") vm_id = parameters['vm_id'] vm_details = current.db.vm_data[vm_id] logger.debug(str(vm_details)) try: domain = getVirshDomain(vm_details) if domain.info()[0] == VIR_DOMAIN_SHUTOFF: raise Exception("VM is already shutoff. Check vm status on host.") domain.destroy() current.db(current.db.vm_data.id == vm_id).update(status = current.VM_STATUS_SHUTDOWN) message = vm_details.vm_identity + " is destroyed successfully." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def shutdown(parameters): """ Destroys a vm gracefully """ logger.debug("Inside shutdown() function") vm_id = parameters['vm_id'] vm_details = current.db.vm_data[vm_id] logger.debug(str(vm_details)) try: domain = getVirshDomain(vm_details) if domain.info()[0] == VIR_DOMAIN_SHUTOFF: raise Exception("VM is already shutoff. Check vm status on host.") domain.managedSave() current.db(current.db.vm_data.id == vm_id).update(status = current.VM_STATUS_SHUTDOWN) message = vm_details.vm_identity + " is shutdown successfully." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def _clean_up_database_after_vm_deletion(vm_details): """ Cleans up database after vm deletion """ logger.debug("Inside clean up database after vm deletion () function...") # moving vm image folder to archives folder archive_directory_path = vm_details.datastore_id.system_mount_point + '/' + get_constant('archives_dir') if not os.path.exists(archive_directory_path): os.makedirs(archive_directory_path) source_file = vm_details.datastore_id.system_mount_point + '/' + get_constant('vms') + '/' + vm_details.vm_identity archive_filename = vm_details.vm_identity + str(get_datetime()) logger.debug(archive_filename) destination_file = archive_directory_path + '/' + archive_filename shutil.move(source_file, destination_file) # removing hdd vm_extra_disks_directory_path = vm_details.datastore_id.system_mount_point + '/' + get_constant('extra_disks_dir') + '/' + \ vm_details.datastore_id.ds_name + "/" + vm_details.vm_identity if os.path.exists(vm_extra_disks_directory_path): shutil.rmtree(vm_extra_disks_directory_path) # updating the used entry of database current.db(current.db.datastore.id == vm_details.datastore_id).update(used = int(vm_details.datastore_id.used) - \ (int(vm_details.extra_HDD) + int(vm_details.template_id.hdd))) # updating task_queue_event entry to remove reference of VM current.db(current.db.task_queue_event.vm_id == vm_details.id).update(vm_id = None) # deleting entry of extra disk of vm current.db(current.db.attached_disks.vm_id == vm_details.id).delete() logger.debug("Database cleaned") def vm_has_snapshots(vm_id): """ Checks if a vm has snapshot(s) """ if (current.db(current.db.snapshot.vm_id == vm_id).select()): return True else: return False def delete(parameters): """ Deletes a vm """ logger.debug("Inside delete() function") vm_id = parameters['vm_id'] vm_details = current.db.vm_data[vm_id] try: domain = getVirshDomain(vm_details) logger.debug(str(vm_details.status)) if (vm_details.status == current.VM_STATUS_RUNNING or vm_details.status == current.VM_STATUS_SUSPENDED): logger.debug("Vm is not shutoff. Shutting it off first.") domain.destroy() logger.debug("Starting to delete it...") domain.undefineFlags(VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA ) if vm_details.public_ip: remove_mapping(vm_details.public_ip.public_ip, vm_details.private_ip.private_ip) message = vm_details.vm_identity + " is deleted successfully." logger.debug(message) _clean_up_database_after_vm_deletion(vm_details) current.db(current.db.vm_data.id == vm_id).delete() current.db.commit() logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def migrate_domain_with_snapshots(vm_details, destination_host_ip, domain, domain_snapshots_list, current_snapshot_name, flags, vm_backup_during_migration): """ Migrate domain with snapshots """ # XML dump of snapshot(s) of the vm logger.debug("Starting to take xml dump of the snapshot(s) of the vm... ") if not os.path.exists(vm_backup_during_migration): os.makedirs(vm_backup_during_migration) for domain_snapshot in domain_snapshots_list: logger.debug("snapshot name is " + str(domain_snapshot)) dump_xml_path = vm_backup_during_migration + '/' + 'dump_' + domain_snapshot snapshot_dumpxml_command = 'virsh snapshot-dumpxml %s %s > %s' % ( vm_details.vm_identity, domain_snapshot, dump_xml_path) logger.debug("Taking xml dump of" + str(domain_snapshot)) command_output = execute_remote_cmd(vm_details.host_id.host_ip.private_ip, 'root', snapshot_dumpxml_command) logger.debug(command_output) logger.debug("XML dump of " + str(domain_snapshot) + "succeeded.") # Delete snapshot(s) of the vm and migrate it to destination host logger.debug("Starting to delete snapshots of the vm....") for domain_snapshot in domain_snapshots_list: snapshot = domain.snapshotLookupByName(domain_snapshot, 0) snapshot.delete(0) logger.debug("Migrating the vm to destination host...") domain.migrateToURI("qemu+ssh://root@" + destination_host_ip + "/system", flags , None, 0) # Redefine all the snapshot(s) of the vm on the destination host and set current snapshot logger.debug("Starting to redefine all the snapshot(s) of the domain...") for domain_snapshot in domain_snapshots_list: redefine_xml_path = vm_backup_during_migration + '/' + 'dump_' + domain_snapshot snapshot_redefine_command = 'virsh snapshot-create --redefine %s %s ' % (vm_details.vm_identity, redefine_xml_path) command_output = execute_remote_cmd(destination_host_ip, 'root', snapshot_redefine_command) logger.debug(command_output) snapshot_current_command = 'virsh snapshot-current %s %s' % (vm_details.vm_identity, current_snapshot_name) command_output = execute_remote_cmd(destination_host_ip, 'root', snapshot_current_command) logger.debug(command_output) return def _clean_migration_directory(vm_backup_during_migration): """ Delete directory created for storing dumpxml of vm snapshots """ if os.path.exists(vm_backup_during_migration): shutil.rmtree(vm_backup_during_migration) return def undo_migration(vm_details, domain_snapshots_list, current_snapshot_name, vm_backup_during_migration): """ Undo the migration """ if domain_snapshots_list: # Redefine the snapshots of the vm on the source host logger.debug("Starting to redefine all the snapshot(s) of the vm on the source host...") for domain_snapshot in domain_snapshots_list: redefine_xml_path = vm_backup_during_migration + '/' + 'dump_' + domain_snapshot snapshot_redefine_command = 'virsh snapshot-create --redefine %s %s ' % (vm_details.vm_identity, redefine_xml_path) command_output = execute_remote_cmd(vm_details.host_id.host_ip.private_ip, 'root', snapshot_redefine_command, None, True) logger.debug(command_output) snapshot_current_command = 'virsh snapshot-current %s %s' % (vm_details.vm_identity, current_snapshot_name) command_output = execute_remote_cmd(vm_details.host_id.host_ip.private_ip, 'root', snapshot_current_command, None, True) logger.debug(command_output) # Delete directory created for storing dumpxml of vm snapshots _clean_migration_directory(vm_backup_during_migration) return def migrate_domain(vm_id, destination_host_id=None, live_migration=False): """ Migrate domain """ vm_details = current.db.vm_data[vm_id] domain_snapshots_list = [] current_snapshot_name = '' vm_migration_directory = get_constant('vm_migration_data') vm_backup_during_migration = vm_details.datastore_id.system_mount_point + '/' + vm_migration_directory + '/' + \ vm_details.vm_identity if destination_host_id == None: destination_host_id = find_new_host(vm_details.RAM, vm_details.vCPU) destination_host_ip = current.db.host[destination_host_id].host_ip.private_ip flags = VIR_MIGRATE_PEER2PEER|VIR_MIGRATE_PERSIST_DEST|VIR_MIGRATE_UNDEFINE_SOURCE|VIR_MIGRATE_UNSAFE if live_migration: flags |= VIR_MIGRATE_TUNNELLED|VIR_MIGRATE_LIVE if vm_details.status == current.VM_STATUS_SUSPENDED: logger.debug("Vm is suspended") flags |= VIR_MIGRATE_TUNNELLED|VIR_MIGRATE_PAUSED elif vm_details.status == current.VM_STATUS_SHUTDOWN: logger.debug("Vm is shut off") flags |= VIR_MIGRATE_OFFLINE logger.debug("Flags: " + str(flags)) try: domain = getVirshDomain(vm_details) dom_snapshot_names = domain.snapshotListNames(0) for snapshot in current.db(current.db.snapshot.vm_id == vm_id).select(): logger.debug("snapshot:" + str(snapshot.snapshot_name)) domain_snapshots_list.append(snapshot.snapshot_name) dom_snapshot_names.remove(snapshot.snapshot_name) logger.debug("domain snapshot list is " + str(domain_snapshots_list)) for dom_snapshot in dom_snapshot_names: logger.debug("Deleting orphan snapshot %s" %(dom_snapshot)) snapshot = domain.snapshotLookupByName(dom_snapshot, 0) snapshot.delete(0) if domain_snapshots_list: current_snapshot = domain.snapshotCurrent(0) current_snapshot_name = current_snapshot.getName() migrate_domain_with_snapshots(vm_details, destination_host_ip, domain, domain_snapshots_list, current_snapshot_name, flags, vm_backup_during_migration) else: domain.migrateToURI("qemu+ssh://root@" + destination_host_ip + "/system", flags , None, 0) vm_details.update_record(host_id = destination_host_id) current.db.commit() # Delete directory created for storing dumpxml of vm snapshot _clean_migration_directory(vm_backup_during_migration) message = vm_details.vm_identity + " is migrated successfully." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: undo_migration(vm_details, domain_snapshots_list, current_snapshot_name, vm_backup_during_migration) logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def migrate_domain_datastore(vmid, destination_datastore_id, live_migration=False): """ Migrate VM domain from one datastore to another. - Copy VM Image to new datastore - Update VM XML definition - Update database """ logger.debug(sys.path) vm_details = current.db.vm_data[vmid] # datastore_id = vm_details["datastore_id"] logger.debug("Inside live disk migration block") try: (connection_object, domain) = getVirshDomainConn(vm_details) datastore = current.db.datastore[destination_datastore_id] vm_directory_path = datastore.system_mount_point + get_constant('vms') + '/' + vm_details.vm_identity logger.debug("Creating vm directory on other datastore...") if not os.path.exists (vm_directory_path): os.makedirs(vm_directory_path) diskpath = vm_directory_path + '/' + vm_details.vm_identity + '.qcow2' current_disk_path = vm_details.datastore_id.system_mount_point + get_constant('vms') + '/' + vm_details.vm_identity current_disk_file = current_disk_path + '/' + vm_details.vm_identity + '.qcow2' logger.debug(current_disk_file) xmlfile = domain.XMLDesc(0) if(live_migration==False): rc = os.system("cp %s %s" % (current_disk_file, diskpath)) if rc != 0: logger.error("Copy not successful") raise Exception("Copy not successful") else: logger.debug("Copied successfully") else: if domain.isActive: domain.undefine() root = etree.fromstring(xmlfile) target_elem = root.find("devices/disk/target") target_disk = target_elem.get('dev') # # destxml = generate_blockcopy_xml(diskpath,target_disk) flag = VIR_DOMAIN_BLOCK_REBASE_SHALLOW | VIR_DOMAIN_BLOCK_REBASE_COPY domain.blockRebase(target_disk, diskpath, 0, flag) block_info_list = domain.blockJobInfo(current_disk_file,0) while(block_info_list['end'] != block_info_list['cur']): logger.debug("time to sleep") time.sleep(60) block_info_list = domain.blockJobInfo(current_disk_file,0) domain.blockJobAbort(current_disk_file, VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT) source_elem = root.find("devices/disk/source") source_elem.set('file',diskpath) newxml_file = etree.tostring(root) domain = connection_object.defineXML(newxml_file) vm_details.update_record(datastore_id=destination_datastore_id) if os.path.exists (diskpath): os.remove(current_disk_file) restore_symboltable_path = current_disk_path+"/restore_symboltable" if os.path.exists (restore_symboltable_path): logger.debug(restore_symboltable_path) os.remove(restore_symboltable_path) os.rmdir(current_disk_path) connection_object.close() message = vm_details.vm_identity + " is migrated successfully to new datastore." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: #undo_datastore_migration(vm_details, domain, diskpath, current_disk_file, vm_directory_path, datastore_id) connection_object.close() logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def undo_datastore_migration(vm_details, domain, diskpath, current_disk_file, vm_directory_path, datastore_id): """ Undo migration in case of any issue """ # undo databse changes vm_details.update_record(datastore_id=datastore_id) if domain.isActive: logger.debug("domain is active") block_info_list = domain.blockJobInfo(current_disk_file,0) if(bool(block_info_list) == True): while(block_info_list['end'] != block_info_list['cur']): logger.debug("time to sleep") time.sleep(60) block_info_list = domain.blockJobInfo(current_disk_file,0) if(block_info_list['end'] == block_info_list['cur']): domain.blockJobAbort(current_disk_file) block_info_list = domain.blockJobInfo(current_disk_file,0) if os.path.exists (diskpath): os.remove(diskpath) os.rmdir(vm_directory_path) def migrate(parameters): """ Migrates VM to new host """ vmid = parameters['vm_id'] logger.debug("Inside migrate() function for vm_id: "+str(vmid)) destination_host_id = parameters['destination_host'] if parameters['live_migration'] == 'on': live_migration = True else: live_migration = False return migrate_domain(vmid, destination_host_id, live_migration) def migrate_datastore(parameters): """ Migrates VM to new datastore """ logger.debug("Inside migrate_datastore() function") vmid = parameters['vm_id'] destination_ds_id = parameters['destination_ds'] if parameters['live_migration'] == 'on': live_migration = True else: live_migration = False return migrate_domain_datastore(vmid, destination_ds_id, live_migration) def snapshot(parameters): """ Snapshots a vm """ logger.debug("Inside snapshot() function") vm_id = parameters['vm_id'] snapshot_type = parameters['snapshot_type'] try: vm_details = current.db.vm_data[vm_id] if is_pingable(str(vm_details.private_ip.private_ip)): logger.debug("VM is pingable. Starting to start with snapshotting...") if snapshot_type != current.SNAPSHOT_USER: snapshots = current.db((current.db.snapshot.vm_id == vm_id) & (current.db.snapshot.type == snapshot_type)).select() #Delete the existing Daily/Monthly/Yearly snapshot for snapshot_cron in snapshots: logger.debug(snapshot_cron) delete_snapshot({'vm_id':vm_id, 'snapshot_id':snapshot_cron.id}) snapshot_name = get_datetime().strftime("%I:%M%p_%B%d,%Y") domain = getVirshDomain(vm_details) xmlDesc = "<domainsnapshot><name>%s</name></domainsnapshot>" % (snapshot_name) domain.snapshotCreateXML(xmlDesc, 0) message = "Snapshotted successfully." current.db.snapshot.insert(vm_id = vm_id, datastore_id = vm_details.datastore_id, snapshot_name = snapshot_name, type = snapshot_type) logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) else: message = "Unable to ping VM before snapshoting: %s" % (vm_details.private_ip.private_ip) raise Exception("Unable to ping VM before snapshoting: %s" % (vm_details.private_ip.private_ip)) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def revert(parameters): """ Reverts to snapshot """ logger.debug("Inside revert snapshot() function") vm_id = parameters['vm_id'] snapshotid = parameters['snapshot_id'] vm_details = current.db.vm_data[vm_id] try: domain = getVirshDomain(vm_details) snapshot_name = current.db(current.db.snapshot.id == snapshotid).select().first()['snapshot_name'] snapshot = domain.snapshotLookupByName(snapshot_name, 0) domain.revertToSnapshot(snapshot, 0) message = "Reverted to snapshot successfully." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def delete_snapshot(parameters): """ Deletes a snapshot """ logger.debug("Inside delete snapshot() function") vm_id = parameters['vm_id'] snapshotid = parameters['snapshot_id'] vm_details = current.db.vm_data[vm_id] logger.debug(str(vm_details)) try: domain = getVirshDomain(vm_details) snapshot_name = current.db(current.db.snapshot.id == snapshotid).select().first()['snapshot_name'] snapshot = None try: snapshot = domain.snapshotLookupByName(snapshot_name, 0) except libvirtError: logger.debug("Snapshot %s not found" %(snapshot_name)) if snapshot != None: snapshot.delete(0) message = "Deleted snapshot successfully." logger.debug(message) current.db(current.db.snapshot.id == snapshotid).delete() logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def update_security_domain(vm_details, security_domain_id, xmlDesc=None): """ Get new IP for given security domain. Update the VM XML with new mac_address and update the information in DB """ # fetch new private IP from db from given security domain private_ip_info = _get_private_ip_mac(security_domain_id) # update vm config to add new mac address. root = etree.fromstring(xmlDesc) mac_elem = root.find("devices/interface[@type='bridge']/mac") mac_elem.set('address', private_ip_info.mac_addr) vlan_tag_elem = root.find("devices/interface[@type='bridge']/vlan/tag") vlan_tag_elem.set('id', private_ip_info.vlan.vlan_tag) # update NAT IP mapping, if public IP present if vm_details.public_ip: remove_mapping(vm_details.public_ip.public_ip, vm_details.private_ip.private_ip) create_mapping(vm_details.public_ip.public_ip, private_ip_info.private_ip) # update vm_data current.db(current.db.vm_data.id == vm_details.id).update(security_domain = security_domain_id, private_ip = private_ip_info.id) return etree.tostring(root) def edit_vm_config(parameters): """ Edits vm configuration """ logger.debug("Inside edit vm config() function") vm_id = parameters['vm_id'] vm_details = current.db.vm_data[vm_id] message = "" try: connection_object, domain = getVirshDomainConn(vm_details) if 'vcpus' in parameters: new_vcpus = int(parameters['vcpus']) domain.setVcpusFlags(new_vcpus, VIR_DOMAIN_VCPU_MAXIMUM) domain.setVcpusFlags(new_vcpus, VIR_DOMAIN_AFFECT_CONFIG) message += "Edited vCPU successfully." current.db(current.db.vm_data.id == vm_id).update(vCPU = new_vcpus) if 'ram' in parameters: new_ram = int(parameters['ram']) * 1024 logger.debug(str(new_ram)) domain.setMemoryFlags(new_ram, VIR_DOMAIN_MEM_MAXIMUM) domain.setMemoryFlags(new_ram, VIR_DOMAIN_AFFECT_CONFIG) message += " And edited RAM successfully." current.db(current.db.vm_data.id == vm_id).update(RAM = int(parameters['ram'])) if 'public_ip' in parameters: enable_public_ip = parameters['public_ip'] if enable_public_ip: public_ip_pool = _choose_random_public_ip() if public_ip_pool: create_mapping(public_ip_pool.public_ip, vm_details.private_ip.private_ip) current.db.vm_data[vm_id] = dict(public_ip=public_ip_pool.id) message += "Edited Public IP successfully." else: raise Exception("Available Public IPs are exhausted.") else: remove_mapping(vm_details.public_ip.public_ip, vm_details.private_ip.private_ip) current.db.vm_data[vm_id] = dict(public_ip = None) if 'security_domain' in parameters: logger.debug('Updating security domain') xmlfile = update_security_domain(vm_details, parameters['security_domain'], domain.XMLDesc(0)) domain = connection_object.defineXML(xmlfile) if domain.isActive(): domain.reboot(0) message += "Edited security domain successfully" connection_object.close() logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def _get_clone_properties(vm_details, cloned_vm_details, vm_properties): """ Get properties for Cloned VM. """ datastore = _choose_datastore() vm_properties['datastore'] = datastore logger.debug("Datastore selected is: " + str(datastore)) vm_properties['security_domain'] = vm_details.security_domain vm_properties['public_ip_req'] = False # Finds mac address, ip address and vnc port for the cloned vm _choose_mac_ip_vncport(vm_properties) logger.debug("MAC is : " + str(vm_properties['mac_addr']) + " IP is : " + str(vm_properties['private_ip']) + \ " VNCPORT is : " + str(vm_properties['vnc_port'])) # Template and host of parent vm vm_properties['template'] = current.db(current.db.template.id == vm_details.template_id).select()[0] vm_properties['vm_host_details'] = current.db.host[vm_details.host_id] vm_properties['host'] = vm_properties['vm_host_details'].id # Creates a directory for the cloned vm logger.debug("Creating directory for cloned vm...") cloned_vm_directory_path = datastore.system_mount_point + '/' + get_constant('vms') + '/' + cloned_vm_details.vm_identity if not os.path.exists (cloned_vm_directory_path): os.makedirs(cloned_vm_directory_path) clone_file_parameters = ' --file ' + cloned_vm_directory_path + '/' + cloned_vm_details.vm_identity + '.qcow2' else: raise Exception("Directory with same name as vmname already exists.") # Creates a folder for additional disks of the cloned vm vm = current.db(current.db.vm_data.vm_identity == vm_details.vm_identity).select().first() disk_details_of_cloning_vm = current.db(current.db.attached_disks.vm_id == vm.id).select(orderby=current.db.attached_disks.attached_disk_name) logger.debug(disk_details_of_cloning_vm) already_attached_disks = len(disk_details_of_cloning_vm) cloned_vm_extra_disks_directory = datastore.system_mount_point + '/' + get_constant('extra_disks_dir') + '/' + \ datastore.ds_name + '/' + cloned_vm_details.vm_identity if already_attached_disks > 0: if not os.path.exists (cloned_vm_extra_disks_directory): logger.debug("Making Directory") os.makedirs(cloned_vm_extra_disks_directory) count = already_attached_disks while already_attached_disks > 0: disk_name = cloned_vm_details.vm_identity + '_disk' + str(count - already_attached_disks + 1) + '.qcow2' clone_file_parameters += ' --file ' + cloned_vm_extra_disks_directory + '/' + disk_name current.db.attached_disks.insert(vm_id = cloned_vm_details.id, datastore_id = datastore.id , attached_disk_name = disk_name, capacity = disk_details_of_cloning_vm[count - already_attached_disks].capacity) already_attached_disks -= 1 return (clone_file_parameters) def migrate_clone_to_new_host(vm_details, cloned_vm_details, new_host_id_for_cloned_vm,vm_properties): """ Migrates cloned vm to new host """ try: new_host_ip_for_cloned_vm = current.db.host[new_host_id_for_cloned_vm].host_ip.private_ip logger.debug("New host ip for cloned vm is: " + str(new_host_ip_for_cloned_vm)) flags = VIR_MIGRATE_PEER2PEER|VIR_MIGRATE_PERSIST_DEST|VIR_MIGRATE_UNDEFINE_SOURCE|VIR_MIGRATE_OFFLINE|VIR_MIGRATE_UNSAFE logger.debug("Clone currently on: " + str(vm_details.host_id.host_ip)) (current_host_connection_object, domain) = getVirshDomainConn(None, vm_details.host_id.host_ip, cloned_vm_details.vm_identity) logger.debug("Starting to migrate cloned vm to host " + str(new_host_ip_for_cloned_vm)) domain.migrateToURI("qemu+ssh://root@" + new_host_ip_for_cloned_vm + "/system", flags , None, 0) current_host_connection_object.close() logger.debug("Successfully migrated cloned vm to host " + str(new_host_ip_for_cloned_vm)) cloned_vm_details.update_record(host_id = new_host_id_for_cloned_vm) vm_properties['host'] = new_host_id_for_cloned_vm return True except libvirt.libvirtError,e: message = e.get_error_message() logger.debug("Error: " + message) return False def clone(vmid): """ Clones vm """ vm_properties = {} logger.debug("Inside clone() function") cloned_vm_details = current.db.vm_data[vmid] vm_details = current.db(current.db.vm_data.id == cloned_vm_details.parent_id).select().first() try: domain = getVirshDomain(vm_details) if domain.info()[0] != VIR_DOMAIN_SHUTOFF: raise Exception("VM is not shutoff. Check vm status.") clone_file_parameters = _get_clone_properties(vm_details, cloned_vm_details, vm_properties) logger.debug("cloned vm properties after clone_file_parameters" + str(vm_properties)) host = vm_properties['vm_host_details'] logger.debug("host is: " + str(host)) logger.debug("host details are: " + str(host)) (used_ram, used_cpu) = host_resources_used(host.id) logger.debug("uram: " + str(used_ram) + " used_cpu: " + str(used_cpu) + " host ram: " + str(host.RAM) +" host cpu: " + str(host.CPUs)) host_ram_after_200_percent_overcommitment = math.floor((host.RAM * 1024) * 2) host_cpu_after_200_percent_overcommitment = math.floor(host.CPUs * 2) logger.debug("host_ram_after_200_percent_overcommitment in MB " + str(host_ram_after_200_percent_overcommitment)) logger.debug("host_cpu_after_200_percent_overcommitment " + str(host_cpu_after_200_percent_overcommitment)) logger.debug("Available RAM on host: %s, Requested RAM: %s" % ((host_ram_after_200_percent_overcommitment - used_ram), vm_details.RAM)) logger.debug("Available CPUs on host: %s, Requested CPU: %s " % ((host_cpu_after_200_percent_overcommitment - used_cpu), vm_details.vCPU)) if((( host_ram_after_200_percent_overcommitment - used_ram) >= vm_details.RAM) and ((host_cpu_after_200_percent_overcommitment - used_cpu) >= vm_details.vCPU) and (vm_details.vCPU <= host.CPUs)): clone_command = "virt-clone --original " + vm_details.vm_identity + " --name " + cloned_vm_details.vm_identity + \ clone_file_parameters + " --mac " + vm_properties['mac_addr'] command_output = execute_remote_cmd(vm_details.host_id.host_ip.private_ip, 'root', clone_command, None, True) logger.debug(command_output) logger.debug("Updating db after cloning") update_db_after_vm_installation(cloned_vm_details, vm_properties, parent_id = vm_details.id) message = "Cloned successfully. " try: new_host_id_for_cloned_vm = find_new_host(cloned_vm_details.RAM, cloned_vm_details.vCPU) if new_host_id_for_cloned_vm != host.id: if migrate_clone_to_new_host(vm_details, cloned_vm_details, new_host_id_for_cloned_vm,vm_properties): message += "Found new host and migrated successfully." else: message += "Found new host but not migrated successfully." else: message += "New host selected to migrate cloned vm is same as the host on which it currently resides." except: message += "Could not find host to migrate cloned vm." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) else: raise Exception("Host resources exhausted. Migrate the host vms and then try.") except: _free_vm_properties(cloned_vm_details, vm_properties) logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def attach_extra_disk(parameters): """ Attaches extra disk to VM """ logger.debug("Inside attach extra disk() function") vmid = parameters['vm_id'] disk_size = parameters['disk_size'] vm_details = current.db.vm_data[vmid] logger.debug(str(vm_details)) try: if (serve_extra_disk_request(vm_details, disk_size, vm_details.host_id.host_ip.private_ip)): current.db(current.db.vm_data.id == vmid).update(extra_HDD = vm_details.extra_HDD + disk_size) message = "Attached extra disk successfully" logger.debug(message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) else: message = " Your request for additional HDD could not be completed at this moment. Check logs." logger.debug("Task Status: SUCCESS Message: %s " % message) return (current.TASK_QUEUE_STATUS_FAILED, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def get_vm_image_location(datastore_id, vm_identity): """ Get the file path for qcow2 image of a VM """ datastore = current.db.datastore[datastore_id] vm_directory_path = datastore.system_mount_point + '/' + get_constant('vms') + '/' + vm_identity vm_image_name = vm_directory_path + '/' + vm_identity + '.qcow2' image_present = True if os.path.exists(vm_image_name) else False return (vm_image_name, image_present) def get_extra_disk_location(datastore_id, vm_identity, disk_name, get_disk_size=False): """ Get the file path for qcow2 image of teh extra disk """ datastore = current.db.datastore[datastore_id] if datastore: vm_extra_disks_directory_path = datastore.system_mount_point + '/' + get_constant('extra_disks_dir') + '/' + \ datastore.ds_name + '/' + vm_identity ext = '' if disk_name.endswith('.qcow2') else '.qcow2' disk_image_path = vm_extra_disks_directory_path + '/' + disk_name + ext image_present = True if os.path.exists(disk_image_path) else False disk_size = 0 if image_present & get_disk_size: command = "qemu-img info " + disk_image_path + " | grep 'virtual size'" ret = os.popen(command).read() # Returns e.g. virtual size: 40G (42949672960 bytes) disk_size = int(ret[ret.index(':')+1:ret.index('G ')].strip()) return (disk_image_path, image_present, disk_size) else: return (None, False, 0) def launch_existing_vm_image(vm_details): """ Launch existing VM image - Choose new private_ip & mac_addr if not provided - Get location for VM image - Launch VM on given host - Attach extra disk to VM if defined - Create mapping between public IP and private IP if required """ logger.debug('Launch existing VM image') vm_properties = {} vm_properties['ram'] = vm_details.RAM vm_properties['vcpus'] = vm_details.vCPU vm_properties['security_domain'] = vm_details.security_domain #If Private IP was already chosen previously and DHCP entry is done if vm_details.private_ip != None: private_ip_info = current.db.private_ip_pool[vm_details.private_ip] if private_ip_info: vm_properties['private_ip'] = private_ip_info.private_ip vm_properties['mac_addr'] = private_ip_info.mac_addr vm_properties['vlan_name'] = private_ip_info.vlan.name vm_properties['vlan_tag'] = private_ip_info.vlan.vlan_tag if vm_details.public_ip == None: vm_properties['public_ip_req'] = False else: vm_properties['public_ip_req'] = True if vm_details.public_ip.is_active: vm_properties['public_ip'] = vm_details.public_ip.public_ip _choose_mac_ip_vncport(vm_properties) vm_properties['template'] = current.db.template[vm_details.template_id] vm_properties['datastore'] = current.db.datastore[vm_details.datastore_id] vm_properties['host'] = find_new_host(vm_details.RAM, vm_details.vCPU) (vm_image_name, image_present) = get_vm_image_location(vm_details.datastore_id, vm_details.vm_identity) if image_present: launch_vm_on_host(vm_details, vm_image_name, vm_properties) #Check if extra disk needs to be attached attached_disks = current.db((current.db.attached_disks.vm_id == vm_details.id)).select() if attached_disks: #Extra disk to be attached to the VM host_ip = current.db.host[vm_properties['host']].host_ip.private_ip disk_counter = 1 for attached_disk in attached_disks: disk_size = attach_disk(vm_details, attached_disk.attached_disk_name, host_ip, disk_counter, True) current.db(current.db.attached_disks.vm_id == attached_disk.vm_id and current.db.attached_disks.attached_disk_name==attached_disk.attached_disk_name ).update(capacity = disk_size) vm_details.extra_HDD += disk_size disk_counter += 1 #Create mapping of Private_IP and Public_IP if vm_properties['public_ip_req']: create_mapping(vm_properties['public_ip'], vm_properties['private_ip']) update_db_after_vm_installation(vm_details, vm_properties) def save_vm_as_template(parameters): """ Save VM as template If template for given VM already exists, replace with new template. """ logger.debug("Inside save_as_template() function") vm_id = parameters['vm_id'] vm_data = current.db.vm_data[vm_id] user_list = [] vm_details = current.db.vm_data[vm_id] logger.debug(str(vm_details)) try: (is_templated_created, new_template, old_template) = create_new_template(vm_details) if (is_templated_created): #remove old template if os.path.exists (old_template): os.remove(old_template) else: for user in current.db(current.db.user_vm_map.vm_id == vm_id).select(current.db.user_vm_map.user_id): user_list.append(user.user_id) new_template_id = current.db.template.insert(name = vm_data.vm_name + "_template" , os = vm_data.template_id.os , os_name = vm_data.template_id.os_name , os_version = vm_data.template_id.os_version , os_type = vm_data.template_id.os_type , arch = vm_data.template_id.arch , hdd = vm_data.template_id.hdd , hdfile = new_template , type = vm_data.template_id.type , tag = vm_data.vm_name + "_template" , datastore_id = vm_data.template_id.datastore_id, owner = user_list) current.db.vm_data[vm_id] = dict(saved_template = new_template_id) message = "User Template saved successfully" logger.debug(message) return (current.TASK_QUEUE_STATUS_SUCCESS, message) else: message = " Vm Template not saved " logger.debug("Task Status: %s " % message) return (current.TASK_QUEUE_STATUS_FAILED, message) except: logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (current.TASK_QUEUE_STATUS_FAILED, log_exception()) def delete_template(parameters): """ Delete template """ logger.debug("Inside delete_template() function") template_id = parameters['template_id'] template_details = current.db.template[template_id] template_path = template_details["hdfile"] if os.path.exists(template_path): os.remove(template_path) # set value in db also parent_vm = current.db.vm_data(saved_template = template_id) if parent_vm: parent_vm.update_record(saved_template = None) del current.db.template[template_id] return (current.TASK_QUEUE_STATUS_SUCCESS, "") def create_new_template(vm_details): """ Create a new template from the VM image - Create template directory - Copy VM Image to directory(Live copy if VM is running) - Update database to define new template """ try: (connection_object, domain) = getVirshDomainConn(vm_details) xmlfile = domain.XMLDesc(0) logger.debug("connection object created") datastore = _choose_datastore() logger.debug(datastore) new_template_dir = datastore.system_mount_point + '/' +get_constant('templates_dir') + '/' + vm_details.requester_id.first_name logger.debug("Creating user template directory...") if not os.path.exists (new_template_dir): os.makedirs(new_template_dir) template = new_template_dir + '/' + vm_details.vm_identity + '_template.qcow2' template_location = '/' + vm_details.requester_id.first_name + '/' + vm_details.vm_identity + '_template.qcow2' old_template = new_template_dir + '/' + vm_details.vm_identity + '_template_old.qcow2' if os.path.exists (template): # move template to some other path logger.debug("move template to some other file") shutil.move(template, old_template) logger.debug("template " + template) current_disk_path = vm_details.datastore_id.system_mount_point + get_constant('vms') + '/' + vm_details.vm_identity current_disk_file = current_disk_path + '/' + vm_details.vm_identity + '.qcow2' if (vm_details.status == current.VM_STATUS_RUNNING or vm_details.status == current.VM_STATUS_SUSPENDED): logger.debug("vm is active in db") if domain.isActive(): domain.undefine() root = etree.fromstring(xmlfile) target_elem = root.find("devices/disk/target") target_disk = target_elem.get('dev') flag = VIR_DOMAIN_BLOCK_REBASE_SHALLOW | VIR_DOMAIN_BLOCK_REBASE_COPY domain.blockRebase(target_disk, template, 0, flag) block_info_list = domain.blockJobInfo(current_disk_file,0) while(block_info_list['end'] != block_info_list['cur']): logger.debug("time to sleep") time.sleep(60) block_info_list = domain.blockJobInfo(current_disk_file,0) domain.blockJobAbort(current_disk_file) domain = connection_object.defineXML(xmlfile) connection_object.close() return (True, template_location, old_template) else: logger.debug("domain is not running on host") return (False, template_location, old_template) elif(vm_details.status == current.VM_STATUS_SHUTDOWN): if domain.isActive(): logger.debug("Domain is still active...Please try again after some time!!!") return (False, template_location, old_template) else: logger.debug("copying") copy_command = "cp "+current_disk_file+" "+template logger.debug("copy_command"+copy_command) #rc = os.system("cp %s %s" % (current_disk_file, template)) logger.debug("copy command running on " + vm_details.host_id.host_ip.private_ip + " host") command_output = execute_remote_cmd(vm_details.host_id.host_ip.private_ip, 'root', copy_command) logger.debug(command_output) return (True, template_location, old_template) except: if not domain.isPersistent(): domain = connection_object.defineXML(xmlfile) connection_object.close() logger.debug("Task Status: FAILED Error: %s " % log_exception()) return (False, template_location, old_template)
[]
bopopescu/webrtc-streaming-node
third_party/webrtc/src/chromium/src/build/android/devil/android/sdk/aapt.py
727a441204344ff596401b0253caac372b714d91
# Copyright 2015 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """This module wraps the Android Asset Packaging Tool.""" import os from devil.utils import cmd_helper from pylib import constants _AAPT_PATH = os.path.join(constants.ANDROID_SDK_TOOLS, 'aapt') def _RunAaptCmd(args): """Runs an aapt command. Args: args: A list of arguments for aapt. Returns: The output of the command. """ cmd = [_AAPT_PATH] + args status, output = cmd_helper.GetCmdStatusAndOutput(cmd) if status != 0: raise Exception('Failed running aapt command: "%s" with output "%s".' % (' '.join(cmd), output)) return output def Dump(what, apk, assets=None): """Returns the output of the aapt dump command. Args: what: What you want to dump. apk: Path to apk you want to dump information for. assets: List of assets in apk you want to dump information for. """ assets = assets or [] if isinstance(assets, basestring): assets = [assets] return _RunAaptCmd(['dump', what, apk] + assets).splitlines()
[((310, 359), 'os.path.join', 'os.path.join', (['constants.ANDROID_SDK_TOOLS', '"""aapt"""'], {}), "(constants.ANDROID_SDK_TOOLS, 'aapt')\n", (322, 359), False, 'import os\n'), ((556, 593), 'devil.utils.cmd_helper.GetCmdStatusAndOutput', 'cmd_helper.GetCmdStatusAndOutput', (['cmd'], {}), '(cmd)\n', (588, 593), False, 'from devil.utils import cmd_helper\n')]
esayui/mworks
examples/Tests/Misc/Resources/PythonFile/basic.py
0522e5afc1e30fdbf1e67cedd196ee50f7924499
setvar('nsamples', getvar('a') + getvar('b'))
[]
arosen93/HT-ASE
quacc/recipes/psi4/core.py
a76542e7a2bc5bf6e7382d8f1387374eb2abc713
"""Core recipes for Psi4""" from __future__ import annotations from dataclasses import dataclass from typing import Any, Dict from ase.atoms import Atoms from ase.calculators.psi4 import Psi4 from jobflow import Maker, job from monty.dev import requires try: import psi4 except: psi4 = None from quacc.schemas.calc import summarize_run from quacc.util.basics import merge_dicts from quacc.util.calc import run_calc @dataclass class StaticMaker(Maker): """ Class to carry out a single-point calculation. Parameters ---------- name Name of the job. method The level of theory to use. basis Basis set swaps Dictionary of custom kwargs for the calculator. """ name: str = "Psi4-Static" method: str = "wb97x-v" basis: str = "def2-tzvp" swaps: Dict[str, Any] = None @job @requires(psi4, "Psi4 be installed. Try conda install -c psi4 psi4") def make( self, atoms: Atoms, charge: int = None, mult: int = None ) -> Dict[str, Any]: """ Make the run. Parameters ---------- atoms .Atoms object` charge Charge of the system. If None, this is determined from the sum of atoms.get_initial_charges(). mult Multiplicity of the system. If None, this is determined from 1+ the sum of atoms.get_initial_magnetic_moments(). Returns ------- Dict Summary of the run. """ swaps = self.swaps or {} defaults = { "mem": "16GB", "num_threads": "max", "method": self.method, "basis": self.basis, "charge": charge if charge else round(sum(atoms.get_initial_charges())), "multiplicity": mult if mult else round(1 + sum(atoms.get_initial_magnetic_moments())), } flags = merge_dicts(defaults, swaps, remove_none=True) atoms.calc = Psi4(**flags) new_atoms = run_calc(atoms) summary = summarize_run( new_atoms, input_atoms=atoms, additional_fields={"name": self.name} ) return summary
[((874, 941), 'monty.dev.requires', 'requires', (['psi4', '"""Psi4 be installed. Try conda install -c psi4 psi4"""'], {}), "(psi4, 'Psi4 be installed. Try conda install -c psi4 psi4')\n", (882, 941), False, 'from monty.dev import requires\n'), ((1952, 1998), 'quacc.util.basics.merge_dicts', 'merge_dicts', (['defaults', 'swaps'], {'remove_none': '(True)'}), '(defaults, swaps, remove_none=True)\n', (1963, 1998), False, 'from quacc.util.basics import merge_dicts\n'), ((2021, 2034), 'ase.calculators.psi4.Psi4', 'Psi4', ([], {}), '(**flags)\n', (2025, 2034), False, 'from ase.calculators.psi4 import Psi4\n'), ((2055, 2070), 'quacc.util.calc.run_calc', 'run_calc', (['atoms'], {}), '(atoms)\n', (2063, 2070), False, 'from quacc.util.calc import run_calc\n'), ((2089, 2176), 'quacc.schemas.calc.summarize_run', 'summarize_run', (['new_atoms'], {'input_atoms': 'atoms', 'additional_fields': "{'name': self.name}"}), "(new_atoms, input_atoms=atoms, additional_fields={'name': self\n .name})\n", (2102, 2176), False, 'from quacc.schemas.calc import summarize_run\n')]
Archedar/UAS
UAS/UAS 11 & 12/main.py
3237d9304026340acc93c8f36b358578dc0ae66f
#Main Program from Class import Barang import Menu histori = list() listBarang = [ Barang('Rinso', 5000, 20), Barang('Sabun', 3000, 20), Barang('Pulpen', 2500, 20), Barang('Tisu', 10000, 20), Barang('Penggaris', 1000, 20) ] while True: print(''' Menu 1. Tampilkan Barang 2. Tambahkan Barang 3. Tambah Stock Barang 4. Hapus Barang 5. Cari Barang Berdasarkan Keyword 6. Hitung Barang Belanjaan 7. Histori Keluar Masuk Barang 0. Keluar Program ''') choice = input('Masukan No Menu: ') if choice == '1': Menu.menu1(listBarang) elif choice == '2': Menu.menu2(listBarang, histori) elif choice == '3': Menu.menu3(listBarang, histori) elif choice == '4': Menu.menu4(listBarang, histori) elif choice == '5': Menu.menu5(listBarang) elif choice == '6': Menu.menu6(listBarang, histori) elif choice == '7': Menu.menu7(histori) elif choice == '0': print('Keluar Program') break else: print('Invalid Input!')
[((90, 115), 'Class.Barang', 'Barang', (['"""Rinso"""', '(5000)', '(20)'], {}), "('Rinso', 5000, 20)\n", (96, 115), False, 'from Class import Barang\n'), ((118, 143), 'Class.Barang', 'Barang', (['"""Sabun"""', '(3000)', '(20)'], {}), "('Sabun', 3000, 20)\n", (124, 143), False, 'from Class import Barang\n'), ((146, 172), 'Class.Barang', 'Barang', (['"""Pulpen"""', '(2500)', '(20)'], {}), "('Pulpen', 2500, 20)\n", (152, 172), False, 'from Class import Barang\n'), ((175, 200), 'Class.Barang', 'Barang', (['"""Tisu"""', '(10000)', '(20)'], {}), "('Tisu', 10000, 20)\n", (181, 200), False, 'from Class import Barang\n'), ((203, 232), 'Class.Barang', 'Barang', (['"""Penggaris"""', '(1000)', '(20)'], {}), "('Penggaris', 1000, 20)\n", (209, 232), False, 'from Class import Barang\n'), ((548, 570), 'Menu.menu1', 'Menu.menu1', (['listBarang'], {}), '(listBarang)\n', (558, 570), False, 'import Menu\n'), ((596, 627), 'Menu.menu2', 'Menu.menu2', (['listBarang', 'histori'], {}), '(listBarang, histori)\n', (606, 627), False, 'import Menu\n'), ((653, 684), 'Menu.menu3', 'Menu.menu3', (['listBarang', 'histori'], {}), '(listBarang, histori)\n', (663, 684), False, 'import Menu\n'), ((710, 741), 'Menu.menu4', 'Menu.menu4', (['listBarang', 'histori'], {}), '(listBarang, histori)\n', (720, 741), False, 'import Menu\n'), ((767, 789), 'Menu.menu5', 'Menu.menu5', (['listBarang'], {}), '(listBarang)\n', (777, 789), False, 'import Menu\n'), ((815, 846), 'Menu.menu6', 'Menu.menu6', (['listBarang', 'histori'], {}), '(listBarang, histori)\n', (825, 846), False, 'import Menu\n'), ((872, 891), 'Menu.menu7', 'Menu.menu7', (['histori'], {}), '(histori)\n', (882, 891), False, 'import Menu\n')]
thunlp/JointNRE
original/baselines/train/JointE+ONE.py
29e2070910d0940bf4d32a8b8c97800bceff98fb
#coding:utf-8 import numpy as np import tensorflow as tf import os import time import datetime import ctypes import threading import json ll1 = ctypes.cdll.LoadLibrary lib_cnn = ll1("./init_cnn.so") ll2 = ctypes.cdll.LoadLibrary lib_kg = ll2("./init_know.so") class Config(object): def __init__(self): self.instanceTot = lib_cnn.getInstanceTot() self.sequence_size = lib_cnn.getLenLimit() self.num_classes = lib_cnn.getRelationTotal() self.num_words = lib_cnn.getWordTotal() self.num_positions = 2 * lib_cnn.getPositionLimit() + 1 self.word_size = lib_cnn.getWordDimension() self.position_size = 5 self.embedding_size = self.word_size + self.position_size * 2 self.filter_size = 3 self.num_filters = 230 self.relation_size = self.word_size#230 self.dropout_keep_prob = 0.5 self.l2_lambda = 0.0001 self.NA = 51 lib_cnn.setNA(self.NA) lib_cnn.setRate(3) self.margin = 1.0 self.nbatches = 100 self.trainTimes = 15 self.entityTotal = 0 self.relationTotal = 0 class Model(object): def __init__(self, config): sequence_size = config.sequence_size num_classes = config.num_classes num_words = config.num_words num_positions = config.num_positions embedding_size = config.embedding_size word_size = config.word_size position_size = config.position_size relation_size = config.relation_size filter_size = config.filter_size num_filters = config.num_filters dropout_keep_prob = config.dropout_keep_prob margin = config.margin l2_lambda = config.l2_lambda self.input_x = tf.placeholder(tf.int32, [None, sequence_size], name = "input_x") self.input_p_h = tf.placeholder(tf.int32, [None, sequence_size], name = "input_p_h") self.input_p_t = tf.placeholder(tf.int32, [None, sequence_size], name = "input_p_t") self.input_r = tf.placeholder(tf.float32, [1, 1], name = "input_r") self.input_r_n = tf.placeholder(tf.float32, [1, 1], name = "input_r_n") self.input_h = tf.placeholder(tf.int32, [1, 1], name = "input_h") self.input_t = tf.placeholder(tf.int32, [1, 1], name = "input_t") self.input_y = tf.placeholder(tf.float32, [1, num_classes], name = "input_y") self.pos_h = tf.placeholder(tf.int32, [None]) self.pos_t = tf.placeholder(tf.int32, [None]) self.pos_r = tf.placeholder(tf.int32, [None]) self.neg_h = tf.placeholder(tf.int32, [None]) self.neg_t = tf.placeholder(tf.int32, [None]) self.neg_r = tf.placeholder(tf.int32, [None]) l2_loss = tf.constant(0.0) with tf.name_scope("embedding-lookup"): self.word_embeddings = tf.Variable(word_embeddings, name="word_embeddings") self.relation_embeddings = tf.get_variable("relation_embeddings", [config.relationTotal, word_size]) self.position_embeddings = tf.get_variable("position_embeddings", [num_positions, position_size]) self.relation_attention = tf.get_variable("relation_attention", [num_classes, relation_size]) self.NAattention = tf.get_variable("NAattention", [relation_size, 1]) self.attention = tf.get_variable("attention", [num_filters, relation_size]) #know pos_h_e = tf.nn.embedding_lookup(self.word_embeddings, self.pos_h) pos_t_e = tf.nn.embedding_lookup(self.word_embeddings, self.pos_t) pos_r_e = tf.nn.embedding_lookup(self.relation_embeddings, self.pos_r) neg_h_e = tf.nn.embedding_lookup(self.word_embeddings, self.neg_h) neg_t_e = tf.nn.embedding_lookup(self.word_embeddings, self.neg_t) neg_r_e = tf.nn.embedding_lookup(self.relation_embeddings, self.neg_r) #cnn self.x_initial = tf.nn.embedding_lookup(self.word_embeddings, self.input_x) self.x_p_h = tf.nn.embedding_lookup(self.position_embeddings, self.input_p_h) self.x_p_t = tf.nn.embedding_lookup(self.position_embeddings, self.input_p_t) self.x = tf.expand_dims(tf.concat(2, [self.x_initial, self.x_p_h, self.x_p_t]), -1) self.head = tf.nn.embedding_lookup(self.word_embeddings, self.input_h) self.tail = tf.nn.embedding_lookup(self.word_embeddings, self.input_t) l2_loss += tf.nn.l2_loss(self.attention) with tf.name_scope("conv-maxpool"): self.W = tf.get_variable("W", [filter_size, embedding_size, 1, num_filters]) self.b = tf.get_variable("b", [num_filters]) conv = tf.nn.conv2d(self.x, self.W, strides=[1, 1, 1, 1], padding="VALID", name="conv") h = tf.nn.tanh(tf.nn.bias_add(conv, self.b), name="tanh") self.y = tf.nn.max_pool(h, ksize=[1, sequence_size - filter_size + 1, 1, 1], strides=[1, 1, 1, 1], padding='VALID', name="pool") l2_loss += tf.nn.l2_loss(self.W) l2_loss += tf.nn.l2_loss(self.b) self.y = tf.reshape(self.y, [-1, num_filters]) with tf.name_scope('attention'): self.y_attention = tf.reduce_max(self.y, 0 , keep_dims = True) with tf.name_scope("dropout"): self.y_attention = tf.nn.l2_normalize(self.y_attention, 1) self.h_drop = tf.nn.dropout(self.y_attention, dropout_keep_prob) self.transfer_w = tf.get_variable("transfer_w", [num_filters, num_classes]) self.scores = tf.matmul(self.h_drop, self.transfer_w) l2_loss += tf.nn.l2_loss(self.transfer_w) with tf.name_scope("loss"): cross_entropy = tf.nn.softmax_cross_entropy_with_logits(self.scores, self.input_y) self.loss_cnn = tf.reduce_mean(cross_entropy) + l2_lambda * l2_loss pos = tf.reduce_sum(abs(pos_h_e + pos_r_e - pos_t_e), 1, keep_dims = True) neg = tf.reduce_sum(abs(neg_h_e + neg_r_e - neg_t_e), 1, keep_dims = True) self.loss_kg = tf.reduce_sum(tf.maximum(pos - neg + margin, 0)) with tf.name_scope("accuracy"): self.predictions = tf.argmax(self.scores, 1, name="predictions") correct_predictions = tf.equal(self.predictions, tf.argmax(self.input_y, 1)) self.accuracy = tf.reduce_mean(tf.cast(correct_predictions, "float"), name="accuracy") bags_sum = 0.0 bags_hit_NA = 0.0 sum_NA = 0.0 sum_fNA = 0.0 bags_hit = 0.0 loss_sum = 0.0 if __name__ == "__main__": lib_cnn.readWordVec() lib_cnn.readFromFile() lib_kg.init() np.random.seed(0) tf.set_random_seed(0) config = Config() word_embeddings = np.zeros(config.num_words * config.word_size, dtype = np.float32) lib_cnn.getWordVec.argtypes = [ctypes.c_void_p] lib_cnn.getWordVec(word_embeddings.__array_interface__['data'][0]) word_embeddings.resize((config.num_words,config.word_size)) config.batch_size = lib_kg.getTripleTotal() / config.nbatches config.entityTotal = lib_kg.getEntityTotal() config.relationTotal = lib_kg.getRelationTotal() with tf.Graph().as_default(): conf = tf.ConfigProto() sess = tf.Session(config=conf) with sess.as_default(): initializer = tf.contrib.layers.xavier_initializer() with tf.variable_scope("model", reuse=None, initializer = initializer): m = Model(config = config) global_step_cnn = tf.Variable(0, name="global_step_cnn", trainable=False) optimizer_cnn = tf.train.GradientDescentOptimizer(0.01) grads_and_vars_cnn = optimizer_cnn.compute_gradients(m.loss_cnn) train_op_cnn = optimizer_cnn.apply_gradients(grads_and_vars_cnn, global_step = global_step_cnn) global_step_kg = tf.Variable(0, name="global_step_kg", trainable=False) optimizer_kg = tf.train.GradientDescentOptimizer(0.001) grads_and_vars_kg = optimizer_kg.compute_gradients(m.loss_kg) train_op_kg = optimizer_kg.apply_gradients(grads_and_vars_kg, global_step=global_step_kg) sess.run(tf.initialize_all_variables()) def outEmbedding(str1): word_embeddings, relation_embeddings, position_embeddings, relation_attention, attention, W, B, transfer_w, transfer_b, softmax_w, softmax_b = sess.run([m.word_embeddings, m.relation_embeddings, m.position_embeddings, m.relation_attention, m.attention, m.W, m.b, m.transfer_w, m.transfer_b, m.softmax_w, m.softmax_b]) log = open("log"+str1+".txt", "w") log.write(json.dumps(word_embeddings.tolist())+"\n") log.write(json.dumps(relation_embeddings.tolist())+"\n") log.write(json.dumps(position_embeddings.tolist())+"\n") log.write(json.dumps(relation_attention.tolist())+"\n") log.write(json.dumps(attention.tolist())+"\n") log.write(json.dumps(W.tolist())+"\n") log.write(json.dumps(B.tolist())+"\n") log.write(json.dumps(transfer_w.tolist())+"\n") NAattention = sess.run(m.NAattention) log.write(json.dumps(NAattention.tolist()) + "\n") log.close() x_batch = np.zeros((config.instanceTot,config.sequence_size), dtype = np.int32) p_t_batch = np.zeros((config.instanceTot,config.sequence_size), dtype = np.int32) p_h_batch = np.zeros((config.instanceTot,config.sequence_size), dtype = np.int32) r_batch = np.zeros((1, 1), dtype = np.int32) y_batch = np.zeros((1, config.num_classes), dtype = np.int32) r_n_batch = np.zeros((1, 1), dtype = np.float32) h_batch = np.zeros((1, 1), dtype = np.int32) t_batch = np.zeros((1, 1), dtype = np.int32) x_batch_addr = x_batch.__array_interface__['data'][0] p_t_batch_addr = p_t_batch.__array_interface__['data'][0] p_h_batch_addr = p_h_batch.__array_interface__['data'][0] y_batch_addr = y_batch.__array_interface__['data'][0] r_batch_addr = r_batch.__array_interface__['data'][0] r_n_batch_addr = r_n_batch.__array_interface__['data'][0] h_batch_addr = h_batch.__array_interface__['data'][0] t_batch_addr = t_batch.__array_interface__['data'][0] lib_cnn.batch_iter.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] tipTotal = lib_cnn.getTipTotal() loop = 0 def train_cnn(coord): def train_step_cnn(x_batch, p_h_batch, p_t_batch, y_batch, r_batch, r_n_batch, h_batch, t_batch): global bags_sum, bags_hit, loss_sum, bags_hit_NA, bags_hit, sum_fNA, sum_NA feed_dict = { m.input_x: x_batch, m.input_p_h: p_h_batch, m.input_p_t: p_t_batch, m.input_r: r_batch, m.input_r_n: r_n_batch, m.input_y: y_batch, m.input_h: h_batch, m.input_t: t_batch } _, step, loss, accuracy = sess.run( [train_op_cnn, global_step_cnn, m.loss_cnn, m.accuracy], feed_dict) time_str = datetime.datetime.now().isoformat() loss_sum += loss bags_sum += 1 if (r_batch[0]!=config.NA): sum_fNA += 1 if accuracy > 0.5: bags_hit += 1.0 else: sum_NA += 1 if accuracy > 0.5: bags_hit_NA += 1.0 if bags_sum % 1000 == 0: if (sum_NA == 0): sum_NA+=1 if (sum_fNA == 0): sum_fNA+=1 print("{}: step {}, loss {:g}, acc {:g} acc {:g} {} {}".format(time_str, step, loss_sum/bags_sum, bags_hit_NA/sum_NA, bags_hit/sum_fNA, sum_NA, sum_fNA)) global loop while not coord.should_stop(): print 'Looping ', loop outEmbedding(str(loop)) for i in range(tipTotal): length = lib_cnn.batch_iter(x_batch_addr, p_h_batch_addr, p_t_batch_addr, y_batch_addr, r_batch_addr, r_n_batch_addr, h_batch_addr, t_batch_addr) train_step_cnn(x_batch[0:length,], p_h_batch[0:length,], p_t_batch[0:length,], y_batch, r_batch, r_n_batch, h_batch, t_batch) global bags_sum, bags_hit, loss_sum, bags_hit_NA, bags_hit, sum_fNA, sum_NA bags_sum = 0 bags_hit = 0 bags_hit_NA = 0 loss_sum = 0 sum_fNA = 0 sum_NA = 0 loop += 1 if loop == config.trainTimes: coord.request_stop() ph = np.zeros(config.batch_size * 2, dtype = np.int32) pt = np.zeros(config.batch_size * 2, dtype = np.int32) pr = np.zeros(config.batch_size * 2, dtype = np.int32) nh = np.zeros(config.batch_size * 2, dtype = np.int32) nt = np.zeros(config.batch_size * 2, dtype = np.int32) nr = np.zeros(config.batch_size * 2, dtype = np.int32) ph_addr = ph.__array_interface__['data'][0] pt_addr = pt.__array_interface__['data'][0] pr_addr = pr.__array_interface__['data'][0] nh_addr = nh.__array_interface__['data'][0] nt_addr = nt.__array_interface__['data'][0] nr_addr = nr.__array_interface__['data'][0] lib_kg.getBatch.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int] times_kg = 0 def train_kg(coord): def train_step_kg(pos_h_batch, pos_t_batch, pos_r_batch, neg_h_batch, neg_t_batch, neg_r_batch): feed_dict = { m.pos_h: pos_h_batch, m.pos_t: pos_t_batch, m.pos_r: pos_r_batch, m.neg_h: neg_h_batch, m.neg_t: neg_t_batch, m.neg_r: neg_r_batch } _, step, loss = sess.run( [train_op_kg, global_step_kg, m.loss_kg], feed_dict) return loss global times_kg while not coord.should_stop(): times_kg += 1 res = 0.0 for batch in range(config.nbatches): lib_kg.getBatch(ph_addr, pt_addr, pr_addr, nh_addr, nt_addr, nr_addr, config.batch_size) res += train_step_kg(ph, pt, pr, nh, nt, nr) coord = tf.train.Coordinator() threads = [] threads.append(threading.Thread(target=train_kg, args=(coord,))) threads.append(threading.Thread(target=train_cnn, args=(coord,))) for t in threads: t.start() coord.join(threads)
[]
rachmadaniHaryono/i2vec_cli
i2vec_cli/__main__.py
9e03ca1c930e5eab8e42ac882c66e18f7c7435ba
#!/usr/bin/env python3 """get tag from http://demo.illustration2vec.net/.""" # note: # - error 'ERROR: Request Entity Too Large' for file 1.1 mb # <span style="color:red;">ERROR: Request Entity Too Large</span> from collections import OrderedDict from pathlib import Path from pprint import pformat import imghdr import logging import os import shutil import time import urllib import hashlib import click import requests import structlog import peewee from PIL import Image from i2vec_cli import models from i2vec_cli.requests_session import Session, convert_raw_to_hydrus from i2vec_cli.sha256 import sha256_checksum from i2vec_cli.utils import user_data_dir, thumb_folder def is_url(path): """Return True if path is url, False otherwise.""" scheme = urllib.parse.urlparse(path).scheme if scheme in ('http', 'https'): return True return False def is_ext_equal(file_ext, imghdr_ext): """compare file extension with result from imghdr_ext.""" if not imghdr_ext: return False if file_ext.lower() == '.{}'.format(imghdr_ext): return True if file_ext.lower() in ('.jpg', '.jpeg') and imghdr_ext == 'jpeg': return True return False def download(url, no_clobber): """download url. Args: url: URL to be downloaded. no_clobber: Skip download if file already exist. Returns: Downloaded filename or existing file if `no_clobber` is `True` """ log = structlog.getLogger() basename = os.path.basename(url) if os.path.isfile(basename) and no_clobber: return basename response = requests.get(url, stream=True) with open(basename, 'wb') as out_file: shutil.copyfileobj(response.raw, out_file) name, ext = os.path.splitext(basename) imghdr_ext = imghdr.what(basename) ext_equal = is_ext_equal(file_ext=ext, imghdr_ext=imghdr_ext) if not imghdr_ext: log.debug("imghdr can't recognize file", file=basename) return basename else: new_basename = '{}.{}'.format(name, imghdr_ext) new_basename_exist = os.path.isfile(new_basename) if ext_equal: log.debug('Extension is equal', file_ext=ext, imghdr_ext=imghdr_ext) return basename elif not ext_equal: if new_basename_exist and not no_clobber: log.debug('Replace existing file', old=basename, new=new_basename) shutil.move(basename, new_basename) elif not new_basename_exist: log.debug('Rename file ext', file=basename, new_ext=imghdr_ext) shutil.move(basename, new_basename) else: log.debug('Not replace/rename file', no_clobber=no_clobber, new_basename=new_basename) return new_basename else: log.debug( 'Unknown condition', file=basename, ext_equal=ext_equal, new_basename_exist=new_basename_exist, imghdr_ext=imghdr_ext ) # just return base name if any error happen return basename def validate_close_delay(ctx, param, value): """validate close delay.""" try: value = int(value) except Exception as e: raise click.BadParameter( 'Error when validate close delay: value={}, error={}'.format(value, e)) if value >= -1: return value else: raise click.BadParameter('Close delay have to be bigger or equal than -1') def delay_close(close_delay): """delay when closing the program.""" log = structlog.getLogger() if close_delay == -1: click.pause() elif close_delay == 0: log.debug('No close delay') elif close_delay > 0: time.sleep(close_delay) else: log.error('Invalid close delay', v=close_delay) def md5_checksum(fname): hash_md5 = hashlib.md5() with open(fname, "rb") as f: for chunk in iter(lambda: f.read(4096), b""): hash_md5.update(chunk) return hash_md5.hexdigest() def create_thumbnail(path, thumb_path): """create thumbnail.""" size = 320, 320 try: im = Image.open(path) im.thumbnail(size) im.save(thumb_path, "JPEG") except IOError: raise IOError("cannot create thumbnail for", path) def get_print_result(path, db_path, format, session): """get print result.""" # compatibility p = path sha256 = sha256_checksum(p) md5 = md5_checksum(p) thumb_path = os.path.join(user_data_dir, 'thumb', '{}.jpg'.format(sha256)) try: load_res = models.load_result(db=db_path, sha256=sha256, md5=md5) except models.Image.DoesNotExist: load_res = None if load_res: tags = {'prediction': load_res} else: tags = session.get_tags(path=p) try: models.save_result( db=db_path, sha256=sha256, md5=md5, prediction=tags['prediction']) except peewee.IntegrityError as e: log.debug(str(e)) except keyError as e: log.debug(str(tags)) if not os.path.isfile(thumb_path): create_thumbnail(p, thumb_path) if format == 'dict': return tags if format == 'hydrus': return convert_raw_to_hydrus(tags) else: return pformat(tags['prediction']) @click.command() @click.option('--format', type=click.Choice(['raw', 'hydrus']), default='raw') @click.option('-d', '--debug', is_flag=True, help="Enable debug.") @click.option('-nc', '--no-clobber', is_flag=True, help="Skip download url when file exist.") @click.option( '--close-delay', default=0, help="Close delay of the program.", callback=validate_close_delay) @click.option( '--driver', default=None, help="Driver for browser (deprecated).", type=click.Choice(['firefox', 'phantomjs', 'chrome', 'zope.testbrowser', 'django'])) @click.option('--dump-html', is_flag=True, help="Dump html table for debugging (deprecated).") @click.argument('path', nargs=-1) def main(format, path, debug, no_clobber, close_delay, driver=None, dump_html=False): """get tag from illustration2vec.""" if debug: logging.basicConfig(level=logging.DEBUG) else: logging.basicConfig(level=logging.INFO) structlog.configure_once(logger_factory=structlog.stdlib.LoggerFactory()) log = structlog.getLogger() if not path: raise ValueError('PATH required.') # init folder os.makedirs(user_data_dir, exist_ok=True) os.makedirs(thumb_folder, exist_ok=True) # database db_path = os.path.join(user_data_dir, 'main.db') if not os.path.isfile(db_path): Path(db_path).touch() models.database.init(db_path) try: models.init_all_tables() except peewee.OperationalError: log.debug('Table already created') session = Session(driver=driver) try: for p in path: if os.path.isfile(p): print('path:{}'.format(os.path.basename(p))) elif is_url(p): print('url:{}'.format(p)) p = download(p, no_clobber=no_clobber) else: log.error('Unknown path format or path is not exist', path=p) continue result = get_print_result( path=p, db_path=db_path, format=format, session=session) print(result) finally: delay_close(close_delay) if hasattr(session, 'browser'): session.browser.quit() if __name__ == '__main__': main()
[((5265, 5280), 'click.command', 'click.command', ([], {}), '()\n', (5278, 5280), False, 'import click\n'), ((5361, 5426), 'click.option', 'click.option', (['"""-d"""', '"""--debug"""'], {'is_flag': '(True)', 'help': '"""Enable debug."""'}), "('-d', '--debug', is_flag=True, help='Enable debug.')\n", (5373, 5426), False, 'import click\n'), ((5428, 5525), 'click.option', 'click.option', (['"""-nc"""', '"""--no-clobber"""'], {'is_flag': '(True)', 'help': '"""Skip download url when file exist."""'}), "('-nc', '--no-clobber', is_flag=True, help=\n 'Skip download url when file exist.')\n", (5440, 5525), False, 'import click\n'), ((5522, 5633), 'click.option', 'click.option', (['"""--close-delay"""'], {'default': '(0)', 'help': '"""Close delay of the program."""', 'callback': 'validate_close_delay'}), "('--close-delay', default=0, help='Close delay of the program.',\n callback=validate_close_delay)\n", (5534, 5633), False, 'import click\n'), ((5811, 5909), 'click.option', 'click.option', (['"""--dump-html"""'], {'is_flag': '(True)', 'help': '"""Dump html table for debugging (deprecated)."""'}), "('--dump-html', is_flag=True, help=\n 'Dump html table for debugging (deprecated).')\n", (5823, 5909), False, 'import click\n'), ((5906, 5938), 'click.argument', 'click.argument', (['"""path"""'], {'nargs': '(-1)'}), "('path', nargs=-1)\n", (5920, 5938), False, 'import click\n'), ((1462, 1483), 'structlog.getLogger', 'structlog.getLogger', ([], {}), '()\n', (1481, 1483), False, 'import structlog\n'), ((1500, 1521), 'os.path.basename', 'os.path.basename', (['url'], {}), '(url)\n', (1516, 1521), False, 'import os\n'), ((1610, 1640), 'requests.get', 'requests.get', (['url'], {'stream': '(True)'}), '(url, stream=True)\n', (1622, 1640), False, 'import requests\n'), ((1751, 1777), 'os.path.splitext', 'os.path.splitext', (['basename'], {}), '(basename)\n', (1767, 1777), False, 'import os\n'), ((1795, 1816), 'imghdr.what', 'imghdr.what', (['basename'], {}), '(basename)\n', (1806, 1816), False, 'import imghdr\n'), ((3505, 3526), 'structlog.getLogger', 'structlog.getLogger', ([], {}), '()\n', (3524, 3526), False, 'import structlog\n'), ((3804, 3817), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (3815, 3817), False, 'import hashlib\n'), ((4374, 4392), 'i2vec_cli.sha256.sha256_checksum', 'sha256_checksum', (['p'], {}), '(p)\n', (4389, 4392), False, 'from i2vec_cli.sha256 import sha256_checksum\n'), ((6275, 6296), 'structlog.getLogger', 'structlog.getLogger', ([], {}), '()\n', (6294, 6296), False, 'import structlog\n'), ((6381, 6422), 'os.makedirs', 'os.makedirs', (['user_data_dir'], {'exist_ok': '(True)'}), '(user_data_dir, exist_ok=True)\n', (6392, 6422), False, 'import os\n'), ((6427, 6467), 'os.makedirs', 'os.makedirs', (['thumb_folder'], {'exist_ok': '(True)'}), '(thumb_folder, exist_ok=True)\n', (6438, 6467), False, 'import os\n'), ((6498, 6536), 'os.path.join', 'os.path.join', (['user_data_dir', '"""main.db"""'], {}), "(user_data_dir, 'main.db')\n", (6510, 6536), False, 'import os\n'), ((6607, 6636), 'i2vec_cli.models.database.init', 'models.database.init', (['db_path'], {}), '(db_path)\n', (6627, 6636), False, 'from i2vec_cli import models\n'), ((6773, 6795), 'i2vec_cli.requests_session.Session', 'Session', ([], {'driver': 'driver'}), '(driver=driver)\n', (6780, 6795), False, 'from i2vec_cli.requests_session import Session, convert_raw_to_hydrus\n'), ((765, 792), 'urllib.parse.urlparse', 'urllib.parse.urlparse', (['path'], {}), '(path)\n', (786, 792), False, 'import urllib\n'), ((1529, 1553), 'os.path.isfile', 'os.path.isfile', (['basename'], {}), '(basename)\n', (1543, 1553), False, 'import os\n'), ((1692, 1734), 'shutil.copyfileobj', 'shutil.copyfileobj', (['response.raw', 'out_file'], {}), '(response.raw, out_file)\n', (1710, 1734), False, 'import shutil\n'), ((2090, 2118), 'os.path.isfile', 'os.path.isfile', (['new_basename'], {}), '(new_basename)\n', (2104, 2118), False, 'import os\n'), ((3352, 3420), 'click.BadParameter', 'click.BadParameter', (['"""Close delay have to be bigger or equal than -1"""'], {}), "('Close delay have to be bigger or equal than -1')\n", (3370, 3420), False, 'import click\n'), ((3561, 3574), 'click.pause', 'click.pause', ([], {}), '()\n', (3572, 3574), False, 'import click\n'), ((4084, 4100), 'PIL.Image.open', 'Image.open', (['path'], {}), '(path)\n', (4094, 4100), False, 'from PIL import Image\n'), ((4526, 4580), 'i2vec_cli.models.load_result', 'models.load_result', ([], {'db': 'db_path', 'sha256': 'sha256', 'md5': 'md5'}), '(db=db_path, sha256=sha256, md5=md5)\n', (4544, 4580), False, 'from i2vec_cli import models\n'), ((5025, 5051), 'os.path.isfile', 'os.path.isfile', (['thumb_path'], {}), '(thumb_path)\n', (5039, 5051), False, 'import os\n'), ((5181, 5208), 'i2vec_cli.requests_session.convert_raw_to_hydrus', 'convert_raw_to_hydrus', (['tags'], {}), '(tags)\n', (5202, 5208), False, 'from i2vec_cli.requests_session import Session, convert_raw_to_hydrus\n'), ((5234, 5261), 'pprint.pformat', 'pformat', (["tags['prediction']"], {}), "(tags['prediction'])\n", (5241, 5261), False, 'from pprint import pformat\n'), ((6088, 6128), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (6107, 6128), False, 'import logging\n'), ((6147, 6186), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (6166, 6186), False, 'import logging\n'), ((6548, 6571), 'os.path.isfile', 'os.path.isfile', (['db_path'], {}), '(db_path)\n', (6562, 6571), False, 'import os\n'), ((6654, 6678), 'i2vec_cli.models.init_all_tables', 'models.init_all_tables', ([], {}), '()\n', (6676, 6678), False, 'from i2vec_cli import models\n'), ((5312, 5343), 'click.Choice', 'click.Choice', (["['raw', 'hydrus']"], {}), "(['raw', 'hydrus'])\n", (5324, 5343), False, 'import click\n'), ((5730, 5808), 'click.Choice', 'click.Choice', (["['firefox', 'phantomjs', 'chrome', 'zope.testbrowser', 'django']"], {}), "(['firefox', 'phantomjs', 'chrome', 'zope.testbrowser', 'django'])\n", (5742, 5808), False, 'import click\n'), ((4775, 4865), 'i2vec_cli.models.save_result', 'models.save_result', ([], {'db': 'db_path', 'sha256': 'sha256', 'md5': 'md5', 'prediction': "tags['prediction']"}), "(db=db_path, sha256=sha256, md5=md5, prediction=tags[\n 'prediction'])\n", (4793, 4865), False, 'from i2vec_cli import models\n'), ((6231, 6263), 'structlog.stdlib.LoggerFactory', 'structlog.stdlib.LoggerFactory', ([], {}), '()\n', (6261, 6263), False, 'import structlog\n'), ((6843, 6860), 'os.path.isfile', 'os.path.isfile', (['p'], {}), '(p)\n', (6857, 6860), False, 'import os\n'), ((2404, 2439), 'shutil.move', 'shutil.move', (['basename', 'new_basename'], {}), '(basename, new_basename)\n', (2415, 2439), False, 'import shutil\n'), ((3672, 3695), 'time.sleep', 'time.sleep', (['close_delay'], {}), '(close_delay)\n', (3682, 3695), False, 'import time\n'), ((6581, 6594), 'pathlib.Path', 'Path', (['db_path'], {}), '(db_path)\n', (6585, 6594), False, 'from pathlib import Path\n'), ((2565, 2600), 'shutil.move', 'shutil.move', (['basename', 'new_basename'], {}), '(basename, new_basename)\n', (2576, 2600), False, 'import shutil\n'), ((6901, 6920), 'os.path.basename', 'os.path.basename', (['p'], {}), '(p)\n', (6917, 6920), False, 'import os\n')]
debrando/cherrypy
cherrypy/lib/cptools.py
a92c5cc5d888b0aad327bce34e94da4a1f961e43
"""Functions for builtin CherryPy tools.""" import logging import re from hashlib import md5 import six from six.moves import urllib import cherrypy from cherrypy._cpcompat import text_or_bytes from cherrypy.lib import httputil as _httputil from cherrypy.lib import is_iterator # Conditional HTTP request support # def validate_etags(autotags=False, debug=False): """Validate the current ETag against If-Match, If-None-Match headers. If autotags is True, an ETag response-header value will be provided from an MD5 hash of the response body (unless some other code has already provided an ETag header). If False (the default), the ETag will not be automatic. WARNING: the autotags feature is not designed for URL's which allow methods other than GET. For example, if a POST to the same URL returns no content, the automatic ETag will be incorrect, breaking a fundamental use for entity tags in a possibly destructive fashion. Likewise, if you raise 304 Not Modified, the response body will be empty, the ETag hash will be incorrect, and your application will break. See :rfc:`2616` Section 14.24. """ response = cherrypy.serving.response # Guard against being run twice. if hasattr(response, 'ETag'): return status, reason, msg = _httputil.valid_status(response.status) etag = response.headers.get('ETag') # Automatic ETag generation. See warning in docstring. if etag: if debug: cherrypy.log('ETag already set: %s' % etag, 'TOOLS.ETAGS') elif not autotags: if debug: cherrypy.log('Autotags off', 'TOOLS.ETAGS') elif status != 200: if debug: cherrypy.log('Status not 200', 'TOOLS.ETAGS') else: etag = response.collapse_body() etag = '"%s"' % md5(etag).hexdigest() if debug: cherrypy.log('Setting ETag: %s' % etag, 'TOOLS.ETAGS') response.headers['ETag'] = etag response.ETag = etag # "If the request would, without the If-Match header field, result in # anything other than a 2xx or 412 status, then the If-Match header # MUST be ignored." if debug: cherrypy.log('Status: %s' % status, 'TOOLS.ETAGS') if status >= 200 and status <= 299: request = cherrypy.serving.request conditions = request.headers.elements('If-Match') or [] conditions = [str(x) for x in conditions] if debug: cherrypy.log('If-Match conditions: %s' % repr(conditions), 'TOOLS.ETAGS') if conditions and not (conditions == ['*'] or etag in conditions): raise cherrypy.HTTPError(412, 'If-Match failed: ETag %r did ' 'not match %r' % (etag, conditions)) conditions = request.headers.elements('If-None-Match') or [] conditions = [str(x) for x in conditions] if debug: cherrypy.log('If-None-Match conditions: %s' % repr(conditions), 'TOOLS.ETAGS') if conditions == ['*'] or etag in conditions: if debug: cherrypy.log('request.method: %s' % request.method, 'TOOLS.ETAGS') if request.method in ('GET', 'HEAD'): raise cherrypy.HTTPRedirect([], 304) else: raise cherrypy.HTTPError(412, 'If-None-Match failed: ETag %r ' 'matched %r' % (etag, conditions)) def validate_since(): """Validate the current Last-Modified against If-Modified-Since headers. If no code has set the Last-Modified response header, then no validation will be performed. """ response = cherrypy.serving.response lastmod = response.headers.get('Last-Modified') if lastmod: status, reason, msg = _httputil.valid_status(response.status) request = cherrypy.serving.request since = request.headers.get('If-Unmodified-Since') if since and since != lastmod: if (status >= 200 and status <= 299) or status == 412: raise cherrypy.HTTPError(412) since = request.headers.get('If-Modified-Since') if since and since == lastmod: if (status >= 200 and status <= 299) or status == 304: if request.method in ('GET', 'HEAD'): raise cherrypy.HTTPRedirect([], 304) else: raise cherrypy.HTTPError(412) # Tool code # def allow(methods=None, debug=False): """Raise 405 if request.method not in methods (default ['GET', 'HEAD']). The given methods are case-insensitive, and may be in any order. If only one method is allowed, you may supply a single string; if more than one, supply a list of strings. Regardless of whether the current method is allowed or not, this also emits an 'Allow' response header, containing the given methods. """ if not isinstance(methods, (tuple, list)): methods = [methods] methods = [m.upper() for m in methods if m] if not methods: methods = ['GET', 'HEAD'] elif 'GET' in methods and 'HEAD' not in methods: methods.append('HEAD') cherrypy.response.headers['Allow'] = ', '.join(methods) if cherrypy.request.method not in methods: if debug: cherrypy.log('request.method %r not in methods %r' % (cherrypy.request.method, methods), 'TOOLS.ALLOW') raise cherrypy.HTTPError(405) else: if debug: cherrypy.log('request.method %r in methods %r' % (cherrypy.request.method, methods), 'TOOLS.ALLOW') def proxy(base=None, local='X-Forwarded-Host', remote='X-Forwarded-For', scheme='X-Forwarded-Proto', debug=False): """Change the base URL (scheme://host[:port][/path]). For running a CP server behind Apache, lighttpd, or other HTTP server. For Apache and lighttpd, you should leave the 'local' argument at the default value of 'X-Forwarded-Host'. For Squid, you probably want to set tools.proxy.local = 'Origin'. If you want the new request.base to include path info (not just the host), you must explicitly set base to the full base path, and ALSO set 'local' to '', so that the X-Forwarded-Host request header (which never includes path info) does not override it. Regardless, the value for 'base' MUST NOT end in a slash. cherrypy.request.remote.ip (the IP address of the client) will be rewritten if the header specified by the 'remote' arg is valid. By default, 'remote' is set to 'X-Forwarded-For'. If you do not want to rewrite remote.ip, set the 'remote' arg to an empty string. """ request = cherrypy.serving.request if scheme: s = request.headers.get(scheme, None) if debug: cherrypy.log('Testing scheme %r:%r' % (scheme, s), 'TOOLS.PROXY') if s == 'on' and 'ssl' in scheme.lower(): # This handles e.g. webfaction's 'X-Forwarded-Ssl: on' header scheme = 'https' else: # This is for lighttpd/pound/Mongrel's 'X-Forwarded-Proto: https' scheme = s if not scheme: scheme = request.base[:request.base.find('://')] if local: lbase = request.headers.get(local, None) if debug: cherrypy.log('Testing local %r:%r' % (local, lbase), 'TOOLS.PROXY') if lbase is not None: base = lbase.split(',')[0] if not base: default = urllib.parse.urlparse(request.base).netloc base = request.headers.get('Host', default) if base.find('://') == -1: # add http:// or https:// if needed base = scheme + '://' + base request.base = base if remote: xff = request.headers.get(remote) if debug: cherrypy.log('Testing remote %r:%r' % (remote, xff), 'TOOLS.PROXY') if xff: if remote == 'X-Forwarded-For': # Grab the first IP in a comma-separated list. Ref #1268. xff = next(ip.strip() for ip in xff.split(',')) request.remote.ip = xff def ignore_headers(headers=('Range',), debug=False): """Delete request headers whose field names are included in 'headers'. This is a useful tool for working behind certain HTTP servers; for example, Apache duplicates the work that CP does for 'Range' headers, and will doubly-truncate the response. """ request = cherrypy.serving.request for name in headers: if name in request.headers: if debug: cherrypy.log('Ignoring request header %r' % name, 'TOOLS.IGNORE_HEADERS') del request.headers[name] def response_headers(headers=None, debug=False): """Set headers on the response.""" if debug: cherrypy.log('Setting response headers: %s' % repr(headers), 'TOOLS.RESPONSE_HEADERS') for name, value in (headers or []): cherrypy.serving.response.headers[name] = value response_headers.failsafe = True def referer(pattern, accept=True, accept_missing=False, error=403, message='Forbidden Referer header.', debug=False): """Raise HTTPError if Referer header does/does not match the given pattern. pattern A regular expression pattern to test against the Referer. accept If True, the Referer must match the pattern; if False, the Referer must NOT match the pattern. accept_missing If True, permit requests with no Referer header. error The HTTP error code to return to the client on failure. message A string to include in the response body on failure. """ try: ref = cherrypy.serving.request.headers['Referer'] match = bool(re.match(pattern, ref)) if debug: cherrypy.log('Referer %r matches %r' % (ref, pattern), 'TOOLS.REFERER') if accept == match: return except KeyError: if debug: cherrypy.log('No Referer header', 'TOOLS.REFERER') if accept_missing: return raise cherrypy.HTTPError(error, message) class SessionAuth(object): """Assert that the user is logged in.""" session_key = 'username' debug = False def check_username_and_password(self, username, password): pass def anonymous(self): """Provide a temporary user name for anonymous users.""" pass def on_login(self, username): pass def on_logout(self, username): pass def on_check(self, username): pass def login_screen(self, from_page='..', username='', error_msg='', **kwargs): return (six.text_type("""<html><body> Message: %(error_msg)s <form method="post" action="do_login"> Login: <input type="text" name="username" value="%(username)s" size="10" /> <br /> Password: <input type="password" name="password" size="10" /> <br /> <input type="hidden" name="from_page" value="%(from_page)s" /> <br /> <input type="submit" /> </form> </body></html>""") % vars()).encode('utf-8') def do_login(self, username, password, from_page='..', **kwargs): """Login. May raise redirect, or return True if request handled.""" response = cherrypy.serving.response error_msg = self.check_username_and_password(username, password) if error_msg: body = self.login_screen(from_page, username, error_msg) response.body = body if 'Content-Length' in response.headers: # Delete Content-Length header so finalize() recalcs it. del response.headers['Content-Length'] return True else: cherrypy.serving.request.login = username cherrypy.session[self.session_key] = username self.on_login(username) raise cherrypy.HTTPRedirect(from_page or '/') def do_logout(self, from_page='..', **kwargs): """Logout. May raise redirect, or return True if request handled.""" sess = cherrypy.session username = sess.get(self.session_key) sess[self.session_key] = None if username: cherrypy.serving.request.login = None self.on_logout(username) raise cherrypy.HTTPRedirect(from_page) def do_check(self): """Assert username. Raise redirect, or return True if request handled. """ sess = cherrypy.session request = cherrypy.serving.request response = cherrypy.serving.response username = sess.get(self.session_key) if not username: sess[self.session_key] = username = self.anonymous() self._debug_message('No session[username], trying anonymous') if not username: url = cherrypy.url(qs=request.query_string) self._debug_message( 'No username, routing to login_screen with from_page %(url)r', locals(), ) response.body = self.login_screen(url) if 'Content-Length' in response.headers: # Delete Content-Length header so finalize() recalcs it. del response.headers['Content-Length'] return True self._debug_message('Setting request.login to %(username)r', locals()) request.login = username self.on_check(username) def _debug_message(self, template, context={}): if not self.debug: return cherrypy.log(template % context, 'TOOLS.SESSAUTH') def run(self): request = cherrypy.serving.request response = cherrypy.serving.response path = request.path_info if path.endswith('login_screen'): self._debug_message('routing %(path)r to login_screen', locals()) response.body = self.login_screen() return True elif path.endswith('do_login'): if request.method != 'POST': response.headers['Allow'] = 'POST' self._debug_message('do_login requires POST') raise cherrypy.HTTPError(405) self._debug_message('routing %(path)r to do_login', locals()) return self.do_login(**request.params) elif path.endswith('do_logout'): if request.method != 'POST': response.headers['Allow'] = 'POST' raise cherrypy.HTTPError(405) self._debug_message('routing %(path)r to do_logout', locals()) return self.do_logout(**request.params) else: self._debug_message('No special path, running do_check') return self.do_check() def session_auth(**kwargs): sa = SessionAuth() for k, v in kwargs.items(): setattr(sa, k, v) return sa.run() session_auth.__doc__ = ( """Session authentication hook. Any attribute of the SessionAuth class may be overridden via a keyword arg to this function: """ + '\n'.join(['%s: %s' % (k, type(getattr(SessionAuth, k)).__name__) for k in dir(SessionAuth) if not k.startswith('__')]) ) def log_traceback(severity=logging.ERROR, debug=False): """Write the last error's traceback to the cherrypy error log.""" cherrypy.log('', 'HTTP', severity=severity, traceback=True) def log_request_headers(debug=False): """Write request headers to the cherrypy error log.""" h = [' %s: %s' % (k, v) for k, v in cherrypy.serving.request.header_list] cherrypy.log('\nRequest Headers:\n' + '\n'.join(h), 'HTTP') def log_hooks(debug=False): """Write request.hooks to the cherrypy error log.""" request = cherrypy.serving.request msg = [] # Sort by the standard points if possible. from cherrypy import _cprequest points = _cprequest.hookpoints for k in request.hooks.keys(): if k not in points: points.append(k) for k in points: msg.append(' %s:' % k) v = request.hooks.get(k, []) v.sort() for h in v: msg.append(' %r' % h) cherrypy.log('\nRequest Hooks for ' + cherrypy.url() + ':\n' + '\n'.join(msg), 'HTTP') def redirect(url='', internal=True, debug=False): """Raise InternalRedirect or HTTPRedirect to the given url.""" if debug: cherrypy.log('Redirecting %sto: %s' % ({True: 'internal ', False: ''}[internal], url), 'TOOLS.REDIRECT') if internal: raise cherrypy.InternalRedirect(url) else: raise cherrypy.HTTPRedirect(url) def trailing_slash(missing=True, extra=False, status=None, debug=False): """Redirect if path_info has (missing|extra) trailing slash.""" request = cherrypy.serving.request pi = request.path_info if debug: cherrypy.log('is_index: %r, missing: %r, extra: %r, path_info: %r' % (request.is_index, missing, extra, pi), 'TOOLS.TRAILING_SLASH') if request.is_index is True: if missing: if not pi.endswith('/'): new_url = cherrypy.url(pi + '/', request.query_string) raise cherrypy.HTTPRedirect(new_url, status=status or 301) elif request.is_index is False: if extra: # If pi == '/', don't redirect to ''! if pi.endswith('/') and pi != '/': new_url = cherrypy.url(pi[:-1], request.query_string) raise cherrypy.HTTPRedirect(new_url, status=status or 301) def flatten(debug=False): """Wrap response.body in a generator that recursively iterates over body. This allows cherrypy.response.body to consist of 'nested generators'; that is, a set of generators that yield generators. """ def flattener(input): numchunks = 0 for x in input: if not is_iterator(x): numchunks += 1 yield x else: for y in flattener(x): numchunks += 1 yield y if debug: cherrypy.log('Flattened %d chunks' % numchunks, 'TOOLS.FLATTEN') response = cherrypy.serving.response response.body = flattener(response.body) def accept(media=None, debug=False): """Return the client's preferred media-type (from the given Content-Types). If 'media' is None (the default), no test will be performed. If 'media' is provided, it should be the Content-Type value (as a string) or values (as a list or tuple of strings) which the current resource can emit. The client's acceptable media ranges (as declared in the Accept request header) will be matched in order to these Content-Type values; the first such string is returned. That is, the return value will always be one of the strings provided in the 'media' arg (or None if 'media' is None). If no match is found, then HTTPError 406 (Not Acceptable) is raised. Note that most web browsers send */* as a (low-quality) acceptable media range, which should match any Content-Type. In addition, "...if no Accept header field is present, then it is assumed that the client accepts all media types." Matching types are checked in order of client preference first, and then in the order of the given 'media' values. Note that this function does not honor accept-params (other than "q"). """ if not media: return if isinstance(media, text_or_bytes): media = [media] request = cherrypy.serving.request # Parse the Accept request header, and try to match one # of the requested media-ranges (in order of preference). ranges = request.headers.elements('Accept') if not ranges: # Any media type is acceptable. if debug: cherrypy.log('No Accept header elements', 'TOOLS.ACCEPT') return media[0] else: # Note that 'ranges' is sorted in order of preference for element in ranges: if element.qvalue > 0: if element.value == '*/*': # Matches any type or subtype if debug: cherrypy.log('Match due to */*', 'TOOLS.ACCEPT') return media[0] elif element.value.endswith('/*'): # Matches any subtype mtype = element.value[:-1] # Keep the slash for m in media: if m.startswith(mtype): if debug: cherrypy.log('Match due to %s' % element.value, 'TOOLS.ACCEPT') return m else: # Matches exact value if element.value in media: if debug: cherrypy.log('Match due to %s' % element.value, 'TOOLS.ACCEPT') return element.value # No suitable media-range found. ah = request.headers.get('Accept') if ah is None: msg = 'Your client did not send an Accept header.' else: msg = 'Your client sent this Accept header: %s.' % ah msg += (' But this resource only emits these media types: %s.' % ', '.join(media)) raise cherrypy.HTTPError(406, msg) class MonitoredHeaderMap(_httputil.HeaderMap): def transform_key(self, key): self.accessed_headers.add(key) return super(MonitoredHeaderMap, self).transform_key(key) def __init__(self): self.accessed_headers = set() super(MonitoredHeaderMap, self).__init__() def autovary(ignore=None, debug=False): """Auto-populate the Vary response header based on request.header access. """ request = cherrypy.serving.request req_h = request.headers request.headers = MonitoredHeaderMap() request.headers.update(req_h) if ignore is None: ignore = set(['Content-Disposition', 'Content-Length', 'Content-Type']) def set_response_header(): resp_h = cherrypy.serving.response.headers v = set([e.value for e in resp_h.elements('Vary')]) if debug: cherrypy.log( 'Accessed headers: %s' % request.headers.accessed_headers, 'TOOLS.AUTOVARY') v = v.union(request.headers.accessed_headers) v = v.difference(ignore) v = list(v) v.sort() resp_h['Vary'] = ', '.join(v) request.hooks.attach('before_finalize', set_response_header, 95) def convert_params(exception=ValueError, error=400): """Convert request params based on function annotations, with error handling. exception Exception class to catch. status The HTTP error code to return to the client on failure. """ request = cherrypy.serving.request types = request.handler.callable.__annotations__ with cherrypy.HTTPError.handle(exception, error): for key in set(types).intersection(request.params): request.params[key] = types[key](request.params[key])
[((1355, 1394), 'cherrypy.lib.httputil.valid_status', '_httputil.valid_status', (['response.status'], {}), '(response.status)\n', (1377, 1394), True, 'from cherrypy.lib import httputil as _httputil\n'), ((10356, 10390), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['error', 'message'], {}), '(error, message)\n', (10374, 10390), False, 'import cherrypy\n'), ((15535, 15594), 'cherrypy.log', 'cherrypy.log', (['""""""', '"""HTTP"""'], {'severity': 'severity', 'traceback': '(True)'}), "('', 'HTTP', severity=severity, traceback=True)\n", (15547, 15594), False, 'import cherrypy\n'), ((21666, 21694), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['(406)', 'msg'], {}), '(406, msg)\n', (21684, 21694), False, 'import cherrypy\n'), ((2235, 2285), 'cherrypy.log', 'cherrypy.log', (["('Status: %s' % status)", '"""TOOLS.ETAGS"""'], {}), "('Status: %s' % status, 'TOOLS.ETAGS')\n", (2247, 2285), False, 'import cherrypy\n'), ((3903, 3942), 'cherrypy.lib.httputil.valid_status', '_httputil.valid_status', (['response.status'], {}), '(response.status)\n', (3925, 3942), True, 'from cherrypy.lib import httputil as _httputil\n'), ((5618, 5641), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['(405)'], {}), '(405)\n', (5636, 5641), False, 'import cherrypy\n'), ((12559, 12591), 'cherrypy.HTTPRedirect', 'cherrypy.HTTPRedirect', (['from_page'], {}), '(from_page)\n', (12580, 12591), False, 'import cherrypy\n'), ((13779, 13829), 'cherrypy.log', 'cherrypy.log', (['(template % context)', '"""TOOLS.SESSAUTH"""'], {}), "(template % context, 'TOOLS.SESSAUTH')\n", (13791, 13829), False, 'import cherrypy\n'), ((16607, 16720), 'cherrypy.log', 'cherrypy.log', (["('Redirecting %sto: %s' % ({(True): 'internal ', (False): ''}[internal], url))", '"""TOOLS.REDIRECT"""'], {}), "('Redirecting %sto: %s' % ({(True): 'internal ', (False): ''}[\n internal], url), 'TOOLS.REDIRECT')\n", (16619, 16720), False, 'import cherrypy\n'), ((16785, 16815), 'cherrypy.InternalRedirect', 'cherrypy.InternalRedirect', (['url'], {}), '(url)\n', (16810, 16815), False, 'import cherrypy\n'), ((16840, 16866), 'cherrypy.HTTPRedirect', 'cherrypy.HTTPRedirect', (['url'], {}), '(url)\n', (16861, 16866), False, 'import cherrypy\n'), ((17099, 17236), 'cherrypy.log', 'cherrypy.log', (["('is_index: %r, missing: %r, extra: %r, path_info: %r' % (request.is_index,\n missing, extra, pi))", '"""TOOLS.TRAILING_SLASH"""'], {}), "('is_index: %r, missing: %r, extra: %r, path_info: %r' % (\n request.is_index, missing, extra, pi), 'TOOLS.TRAILING_SLASH')\n", (17111, 17236), False, 'import cherrypy\n'), ((23272, 23315), 'cherrypy.HTTPError.handle', 'cherrypy.HTTPError.handle', (['exception', 'error'], {}), '(exception, error)\n', (23297, 23315), False, 'import cherrypy\n'), ((1539, 1597), 'cherrypy.log', 'cherrypy.log', (["('ETag already set: %s' % etag)", '"""TOOLS.ETAGS"""'], {}), "('ETag already set: %s' % etag, 'TOOLS.ETAGS')\n", (1551, 1597), False, 'import cherrypy\n'), ((2706, 2799), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['(412)', "('If-Match failed: ETag %r did not match %r' % (etag, conditions))"], {}), "(412, 'If-Match failed: ETag %r did not match %r' % (etag,\n conditions))\n", (2724, 2799), False, 'import cherrypy\n'), ((5475, 5583), 'cherrypy.log', 'cherrypy.log', (["('request.method %r not in methods %r' % (cherrypy.request.method, methods))", '"""TOOLS.ALLOW"""'], {}), "('request.method %r not in methods %r' % (cherrypy.request.\n method, methods), 'TOOLS.ALLOW')\n", (5487, 5583), False, 'import cherrypy\n'), ((5682, 5785), 'cherrypy.log', 'cherrypy.log', (["('request.method %r in methods %r' % (cherrypy.request.method, methods))", '"""TOOLS.ALLOW"""'], {}), "('request.method %r in methods %r' % (cherrypy.request.method,\n methods), 'TOOLS.ALLOW')\n", (5694, 5785), False, 'import cherrypy\n'), ((7006, 7071), 'cherrypy.log', 'cherrypy.log', (["('Testing scheme %r:%r' % (scheme, s))", '"""TOOLS.PROXY"""'], {}), "('Testing scheme %r:%r' % (scheme, s), 'TOOLS.PROXY')\n", (7018, 7071), False, 'import cherrypy\n'), ((7510, 7577), 'cherrypy.log', 'cherrypy.log', (["('Testing local %r:%r' % (local, lbase))", '"""TOOLS.PROXY"""'], {}), "('Testing local %r:%r' % (local, lbase), 'TOOLS.PROXY')\n", (7522, 7577), False, 'import cherrypy\n'), ((7682, 7717), 'six.moves.urllib.parse.urlparse', 'urllib.parse.urlparse', (['request.base'], {}), '(request.base)\n', (7703, 7717), False, 'from six.moves import urllib\n'), ((8003, 8070), 'cherrypy.log', 'cherrypy.log', (["('Testing remote %r:%r' % (remote, xff))", '"""TOOLS.PROXY"""'], {}), "('Testing remote %r:%r' % (remote, xff), 'TOOLS.PROXY')\n", (8015, 8070), False, 'import cherrypy\n'), ((9999, 10021), 're.match', 're.match', (['pattern', 'ref'], {}), '(pattern, ref)\n', (10007, 10021), False, 'import re\n'), ((10053, 10124), 'cherrypy.log', 'cherrypy.log', (["('Referer %r matches %r' % (ref, pattern))", '"""TOOLS.REFERER"""'], {}), "('Referer %r matches %r' % (ref, pattern), 'TOOLS.REFERER')\n", (10065, 10124), False, 'import cherrypy\n'), ((12152, 12191), 'cherrypy.HTTPRedirect', 'cherrypy.HTTPRedirect', (["(from_page or '/')"], {}), "(from_page or '/')\n", (12173, 12191), False, 'import cherrypy\n'), ((13082, 13119), 'cherrypy.url', 'cherrypy.url', ([], {'qs': 'request.query_string'}), '(qs=request.query_string)\n', (13094, 13119), False, 'import cherrypy\n'), ((18363, 18427), 'cherrypy.log', 'cherrypy.log', (["('Flattened %d chunks' % numchunks)", '"""TOOLS.FLATTEN"""'], {}), "('Flattened %d chunks' % numchunks, 'TOOLS.FLATTEN')\n", (18375, 18427), False, 'import cherrypy\n'), ((20097, 20154), 'cherrypy.log', 'cherrypy.log', (['"""No Accept header elements"""', '"""TOOLS.ACCEPT"""'], {}), "('No Accept header elements', 'TOOLS.ACCEPT')\n", (20109, 20154), False, 'import cherrypy\n'), ((22547, 22640), 'cherrypy.log', 'cherrypy.log', (["('Accessed headers: %s' % request.headers.accessed_headers)", '"""TOOLS.AUTOVARY"""'], {}), "('Accessed headers: %s' % request.headers.accessed_headers,\n 'TOOLS.AUTOVARY')\n", (22559, 22640), False, 'import cherrypy\n'), ((1651, 1694), 'cherrypy.log', 'cherrypy.log', (['"""Autotags off"""', '"""TOOLS.ETAGS"""'], {}), "('Autotags off', 'TOOLS.ETAGS')\n", (1663, 1694), False, 'import cherrypy\n'), ((3182, 3248), 'cherrypy.log', 'cherrypy.log', (["('request.method: %s' % request.method)", '"""TOOLS.ETAGS"""'], {}), "('request.method: %s' % request.method, 'TOOLS.ETAGS')\n", (3194, 3248), False, 'import cherrypy\n'), ((3350, 3380), 'cherrypy.HTTPRedirect', 'cherrypy.HTTPRedirect', (['[]', '(304)'], {}), '([], 304)\n', (3371, 3380), False, 'import cherrypy\n'), ((3421, 3513), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['(412)', "('If-None-Match failed: ETag %r matched %r' % (etag, conditions))"], {}), "(412, 'If-None-Match failed: ETag %r matched %r' % (etag,\n conditions))\n", (3439, 3513), False, 'import cherrypy\n'), ((4175, 4198), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['(412)'], {}), '(412)\n', (4193, 4198), False, 'import cherrypy\n'), ((8770, 8843), 'cherrypy.log', 'cherrypy.log', (["('Ignoring request header %r' % name)", '"""TOOLS.IGNORE_HEADERS"""'], {}), "('Ignoring request header %r' % name, 'TOOLS.IGNORE_HEADERS')\n", (8782, 8843), False, 'import cherrypy\n'), ((10248, 10298), 'cherrypy.log', 'cherrypy.log', (['"""No Referer header"""', '"""TOOLS.REFERER"""'], {}), "('No Referer header', 'TOOLS.REFERER')\n", (10260, 10298), False, 'import cherrypy\n'), ((17390, 17434), 'cherrypy.url', 'cherrypy.url', (["(pi + '/')", 'request.query_string'], {}), "(pi + '/', request.query_string)\n", (17402, 17434), False, 'import cherrypy\n'), ((17457, 17509), 'cherrypy.HTTPRedirect', 'cherrypy.HTTPRedirect', (['new_url'], {'status': '(status or 301)'}), '(new_url, status=status or 301)\n', (17478, 17509), False, 'import cherrypy\n'), ((18142, 18156), 'cherrypy.lib.is_iterator', 'is_iterator', (['x'], {}), '(x)\n', (18153, 18156), False, 'from cherrypy.lib import is_iterator\n'), ((1749, 1794), 'cherrypy.log', 'cherrypy.log', (['"""Status not 200"""', '"""TOOLS.ETAGS"""'], {}), "('Status not 200', 'TOOLS.ETAGS')\n", (1761, 1794), False, 'import cherrypy\n'), ((1921, 1975), 'cherrypy.log', 'cherrypy.log', (["('Setting ETag: %s' % etag)", '"""TOOLS.ETAGS"""'], {}), "('Setting ETag: %s' % etag, 'TOOLS.ETAGS')\n", (1933, 1975), False, 'import cherrypy\n'), ((4443, 4473), 'cherrypy.HTTPRedirect', 'cherrypy.HTTPRedirect', (['[]', '(304)'], {}), '([], 304)\n', (4464, 4473), False, 'import cherrypy\n'), ((4522, 4545), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['(412)'], {}), '(412)\n', (4540, 4545), False, 'import cherrypy\n'), ((10959, 11361), 'six.text_type', 'six.text_type', (['"""<html><body>\nMessage: %(error_msg)s\n<form method="post" action="do_login">\n Login: <input type="text" name="username" value="%(username)s" size="10" />\n <br />\n Password: <input type="password" name="password" size="10" />\n <br />\n <input type="hidden" name="from_page" value="%(from_page)s" />\n <br />\n <input type="submit" />\n</form>\n</body></html>"""'], {}), '(\n """<html><body>\nMessage: %(error_msg)s\n<form method="post" action="do_login">\n Login: <input type="text" name="username" value="%(username)s" size="10" />\n <br />\n Password: <input type="password" name="password" size="10" />\n <br />\n <input type="hidden" name="from_page" value="%(from_page)s" />\n <br />\n <input type="submit" />\n</form>\n</body></html>"""\n )\n', (10972, 11361), False, 'import six\n'), ((14380, 14403), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['(405)'], {}), '(405)\n', (14398, 14403), False, 'import cherrypy\n'), ((16400, 16414), 'cherrypy.url', 'cherrypy.url', ([], {}), '()\n', (16412, 16414), False, 'import cherrypy\n'), ((17687, 17730), 'cherrypy.url', 'cherrypy.url', (['pi[:-1]', 'request.query_string'], {}), '(pi[:-1], request.query_string)\n', (17699, 17730), False, 'import cherrypy\n'), ((17753, 17805), 'cherrypy.HTTPRedirect', 'cherrypy.HTTPRedirect', (['new_url'], {'status': '(status or 301)'}), '(new_url, status=status or 301)\n', (17774, 17805), False, 'import cherrypy\n'), ((14684, 14707), 'cherrypy.HTTPError', 'cherrypy.HTTPError', (['(405)'], {}), '(405)\n', (14702, 14707), False, 'import cherrypy\n'), ((20464, 20512), 'cherrypy.log', 'cherrypy.log', (['"""Match due to */*"""', '"""TOOLS.ACCEPT"""'], {}), "('Match due to */*', 'TOOLS.ACCEPT')\n", (20476, 20512), False, 'import cherrypy\n'), ((1869, 1878), 'hashlib.md5', 'md5', (['etag'], {}), '(etag)\n', (1872, 1878), False, 'from hashlib import md5\n'), ((21180, 21243), 'cherrypy.log', 'cherrypy.log', (["('Match due to %s' % element.value)", '"""TOOLS.ACCEPT"""'], {}), "('Match due to %s' % element.value, 'TOOLS.ACCEPT')\n", (21192, 21243), False, 'import cherrypy\n'), ((20861, 20924), 'cherrypy.log', 'cherrypy.log', (["('Match due to %s' % element.value)", '"""TOOLS.ACCEPT"""'], {}), "('Match due to %s' % element.value, 'TOOLS.ACCEPT')\n", (20873, 20924), False, 'import cherrypy\n')]
benstear/pyiomica
pyiomica/utilityFunctions.py
bc26032b610fc911cc03b54115d6abdf53a56fce
'''Utility functions''' import multiprocessing from .globalVariables import * def readMathIOmicaData(fileName): '''Read text files exported by MathIOmica and convert to Python data Parameters: fileName: str Path of directories and name of the file containing data Returns: data Python data Usage: data = readMathIOmicaData("../../MathIOmica/MathIOmica/MathIOmicaData/ExampleData/rnaExample") ''' if os.path.isfile(fileName): with open(fileName, 'r') as tempFile: data = tempFile.read() data = data.replace('\n','').replace('{','(').replace('}',')').replace('->',':').replace('|>','}') data = data.replace('<|','{').replace('^','*').replace('`','*').replace('Missing[]','"Missing[]"') data = data.replace("\\",'') else: print('File not found (%s)'%(fileName)) returning = None try: returning = eval(data) except: print('Error occured while converting data (%s)'%(fileName)) return returning def runCPUs(NumberOfAvailableCPUs, func, list_of_tuples_of_func_params): """Parallelize function call with multiprocessing.Pool. Parameters: NumberOfAvailableCPUs: int Number of processes to create func: function Function to apply, must take at most one argument list_of_tuples_of_func_params: list Function parameters Returns: 2d numpy.array Results of func in a numpy array Usage: results = runCPUs(4, pAutocorrelation, [(times[i], data[i], allTimes) for i in range(10)]) """ instPool = multiprocessing.Pool(processes = NumberOfAvailableCPUs) return_values = instPool.map(func, list_of_tuples_of_func_params) instPool.close() instPool.join() return np.vstack(return_values) def createReverseDictionary(inputDictionary): """Efficient way to create a reverse dictionary from a dictionary. Utilizes Pandas.Dataframe.groupby and Numpy arrays indexing. Parameters: inputDictionary: dictionary Dictionary to reverse Returns: dictionary Reversed dictionary Usage: revDict = createReverseDictionary(Dict) """ keys, values = np.array(list(inputDictionary.keys())), np.array(list(inputDictionary.values())) df = pd.DataFrame(np.array([[keys[i], value] for i in range(len(keys)) for value in values[i]])) dfGrouped = df.groupby(df.columns[1]) keys, values = list(dfGrouped.indices.keys()), list(dfGrouped.indices.values()) GOs = df.values.T[0] return dict(zip(keys, [GOs[value].tolist() for value in values])) def createDirectories(path): """Create a path of directories, unless the path already exists. Parameters: path: str Path directory Returns: None Usage: createDirectories("/pathToFolder1/pathToSubFolder2") """ if path=='': return None if not os.path.exists(path): os.makedirs(path) return None
[((1738, 1791), 'multiprocessing.Pool', 'multiprocessing.Pool', ([], {'processes': 'NumberOfAvailableCPUs'}), '(processes=NumberOfAvailableCPUs)\n', (1758, 1791), False, 'import multiprocessing\n')]
deapplegate/wtgpipeline
CRNitschke/get_sextract_thresholds.py
9693e8562022cc97bf5a96427e22965e1a5e8497
#! /usr/bin/env python #adam-does# runs SeeingClearly to get the seeing and rms of the image, then uses those to get sextractor thresholds for CR detection #adam-use# use with CRNitschke pipeline #adam-call_example# call it like ./get_sextract_thresholds.py /path/flname.fits output_file.txt #IO stuff: import sys ; sys.path.append('/u/ki/awright/InstallingSoftware/pythons') ###saveout = sys.stdout saveout = sys.stdout ###logout = open('SeeingClearly_stdout.log','w') ###sys.stdout = logout saveerr = sys.stderr ###logerr = open('SeeingClearly_stderr.log','w') ###sys.stderr = logerr sys.stdout = sys.stderr #the basics import hashlib import os import SeeingClearly from copy import deepcopy def seeing_to_ft_dt(x): y1_dt,m_dt,x1_dt= 5900, -16551.7, 0.48 min_dt= 3500 max_dt= 6000 yy_dts=y1_dt+m_dt*(x-x1_dt) if yy_dts<min_dt:yy_dts=min_dt if yy_dts>max_dt:yy_dts=max_dt y1_ft,m_ft,x1_ft,min_ft= 850, -7000.0, 0.48, 450 min_ft= 450 max_ft= 1000 yy_fts=y1_ft+m_ft*(x-x1_ft) if yy_fts<min_ft:yy_fts=min_ft if yy_fts>max_ft:yy_fts=max_ft return yy_fts,yy_dts import imagetools import glob import astropy from astropy.io import ascii from numpy import asarray if __name__ == "__main__": args=deepcopy(sys.argv[1:]) for false_arg in ['-i', '--']: if false_arg in args: args.remove(false_arg) if len(args)<1: sys.exit() if not os.path.isfile(args[0]): print "sys.argv[1]=",args[0] raise Exception(args[0]+" is not a file!") else: fl=args[0] fl2save=args[1] #start tmp print "Using SeeingClearly to get seeing for: "+fl print "saving output to: " +fl2save try: FILTER=astropy.io.fits.open(fl)[0].header['FILTER'] except: FILTER="UnknownFilt" BASE,ending=os.path.basename(fl).split('OCF') ending="OCF"+ending ending=ending.replace('.fits','') fls_dir=os.path.dirname(fl) basename=os.path.basename(fl) CCDnum=imagetools.GetCCD(fl) globthis='_'+str(CCDnum) glob_basename=basename.replace(globthis,'_*') fls=sorted(glob.glob(fls_dir+"/"+glob_basename)) if not len(fls)==10: raise Exception('cannot find 10 files like this from different CCDs') #adam-old# seeing,back_rms=SeeingClearly.seeing_clearly_withplot(fls,checkplots=1,saveas='pltSeeingClearly_%s_%s' % (FILTER,BASE[:-1]+"ALL")) import adam_stars_from_cat import numpy seeing,back_rms=adam_stars_from_cat.get_seeing_backrms(fls) back_rms=numpy.array(back_rms) ft,dt=seeing_to_ft_dt(seeing) detect_thresh=dt/back_rms #convert to S2N ratio filter_thresh=ft/back_rms #convert to S2N ratio if FILTER=='W-J-B': detect_thresh=asarray([min(170.0,detect_thresh[i]) for i in range(len(detect_thresh))]) filter_thresh=asarray([min(20.0,filter_thresh[i]) for i in range(len(filter_thresh))]) elif (detect_thresh>170.0).any() or (filter_thresh>20.0).any(): print 'checkit: filter=%s and %.2f %% of the detection thresholds are above 170.0 and %.2f %% of the filter thresholds are above 20.0' % (FILTER,(detect_thresh>170.0).mean()*100, (filter_thresh>20.0).mean()*100) dict_out={} dict_out['seeing']=[seeing]*10 dict_out['rms']=back_rms dict_out['dt']=detect_thresh dict_out['ft']=filter_thresh dict_out['#files']=fls t=astropy.table.Table(data=dict_out,names=['#files','rms','seeing','dt','ft'],dtype=[str,float,float,float,float]) t.write(fl2save,format="ascii.basic") #adam-2014#detect_thresh_cap=min(detect_thresh,150.0) #cap is now set in the function seeing_to_ft_dt #PIXSCALE=float(os.environ['PIXSCALE']) #if seeing>PIXSCALE*2.5: #I have no check for being undersampled, should I? #if seeing>.4: # sys.stdout=saveout #back to printing to terminal # ###sys.stdout.write(str(seeing)) # print "'0 "+str(back_rms)+" "+str(seeing)+" "+str(detect_thresh)+" "+str(filter_thresh)+"'" # #else: # #print "exit 1;" # #raise Exception('Seeing less than 2.5xPIXSCALE. The image is undersampled') # #sys.stderr=saveerr #back to printing to terminal # #sys.stderr.write('1') # sys.stdout=saveout #back to printing to terminal # print "0 "+str(back_rms)+" "+str(seeing)+" "+str(detect_thresh)+" "+str(filter_thresh)
[]
flatironinstitute/labbox
python/labbox/api/_session.py
d8b331d55a5cca543567c3b2e92bcdc02b46e799
import time import multiprocessing class Session: def __init__(self, *, labbox_config, default_feed_name: str): self._labbox_config = labbox_config pipe_to_parent, pipe_to_child = multiprocessing.Pipe() self._worker_process = multiprocessing.Process(target=_run_worker_session, args=(pipe_to_parent, labbox_config, default_feed_name)) self._worker_process.start() self._pipe_to_worker_process = pipe_to_child self._incoming_keepalive_timestamp = time.time() def elapsed_sec_since_incoming_keepalive(self): return time.time() - self._incoming_keepalive_timestamp def cleanup(self): self._pipe_to_worker_process.send('exit') pass def check_for_outgoing_messages(self): ret = [] while self._pipe_to_worker_process.poll(): msg = self._pipe_to_worker_process.recv() if isinstance(msg, dict): if msg['type'] == 'outgoing_messages': ret.extend(msg['messages']) else: print(msg) raise Exception('Unexpected message from worker session') else: print(msg) raise Exception('Unexpected message from worker session') return ret def handle_message(self, msg): if msg['type'] == 'keepAlive': self._handle_keepalive() else: self._pipe_to_worker_process.send(dict( type='incoming_message', message=msg )) def _handle_keepalive(self): self._incoming_keepalive_timestamp = time.time() def _run_worker_session(pipe_to_parent, labbox_config, default_feed_name: str): from ._workersession import WorkerSession WS = WorkerSession(labbox_config=labbox_config, default_feed_name=default_feed_name) def handle_messages(msgs): pipe_to_parent.send(dict( type='outgoing_messages', messages=msgs )) WS.on_messages(handle_messages) WS.initialize() while True: while pipe_to_parent.poll(): x = pipe_to_parent.recv() if isinstance(x, str): if x == 'exit': WS.cleanup() return else: print(x) raise Exception('Unexpected message in _run_worker_session') elif isinstance(x, dict): if x['type'] == 'incoming_message': WS.handle_message(x['message']) else: print(x) raise Exception('Unexpected message in _run_worker_session') else: print(x) raise Exception('Unexpected message in _run_worker_session') WS.iterate() time.sleep(0.05)
[((202, 224), 'multiprocessing.Pipe', 'multiprocessing.Pipe', ([], {}), '()\n', (222, 224), False, 'import multiprocessing\n'), ((257, 369), 'multiprocessing.Process', 'multiprocessing.Process', ([], {'target': '_run_worker_session', 'args': '(pipe_to_parent, labbox_config, default_feed_name)'}), '(target=_run_worker_session, args=(pipe_to_parent,\n labbox_config, default_feed_name))\n', (280, 369), False, 'import multiprocessing\n'), ((501, 512), 'time.time', 'time.time', ([], {}), '()\n', (510, 512), False, 'import time\n'), ((1629, 1640), 'time.time', 'time.time', ([], {}), '()\n', (1638, 1640), False, 'import time\n'), ((2826, 2842), 'time.sleep', 'time.sleep', (['(0.05)'], {}), '(0.05)\n', (2836, 2842), False, 'import time\n'), ((580, 591), 'time.time', 'time.time', ([], {}), '()\n', (589, 591), False, 'import time\n')]
GabrielDumbrava/aldryn-newsblog
aldryn_newsblog/tests/test_reversion.py
f3be5ff78e88fde532ce4c45e5eeb88d98fa6d93
# -*- coding: utf-8 -*- from __future__ import unicode_literals from unittest import skipIf try: from django.core.urlresolvers import reverse except ModuleNotFoundError: from django.urls import reverse from django.db import transaction from aldryn_reversion.core import create_revision as aldryn_create_revision from parler.utils.context import switch_language import six from . import NewsBlogTestCase from aldryn_newsblog.cms_appconfig import NewsBlogConfig from ..settings import ENABLE_REVERSION if ENABLE_REVERSION: try: from reversion import create_revision from reversion import default_revision_manager except ImportError: from reversion.revisions import create_revision from reversion.revisions import default_revision_manager @skipIf(not ENABLE_REVERSION, 'django-reversion not enabled') class TestVersioning(NewsBlogTestCase): def create_revision(self, article, content=None, language=None, **kwargs): with transaction.atomic(): with create_revision(): for k, v in six.iteritems(kwargs): setattr(article, k, v) if content: plugins = article.content.get_plugins() plugin = plugins[0].get_plugin_instance()[0] plugin.body = content plugin.save() # TODO: Cover both cases (plugin modification/recreation) # if content: # article.content.get_plugins().delete() # api.add_plugin(article.content, 'TextPlugin', # self.language, body=content) article.save() def revert_to(self, article, revision): (default_revision_manager.get_for_object(article)[revision] .revision.revert()) def test_revert_revision(self): title1 = self.rand_str(prefix='title1_') title2 = self.rand_str(prefix='title2_') content0 = self.rand_str(prefix='content0_') content1 = self.rand_str(prefix='content1_') content2 = self.rand_str(prefix='content2_') article = self.create_article(content=content0) # Revision 1 self.create_revision(article, title=title1, content=content1) response = self.client.get(article.get_absolute_url()) self.assertContains(response, title1) self.assertContains(response, content1) self.assertNotContains(response, content0) # Revision 2 self.create_revision(article, title=title2, content=content2) response = self.client.get(article.get_absolute_url()) self.assertContains(response, title2) self.assertContains(response, content2) self.assertNotContains(response, content1) # Revert to revision 1 self.revert_to(article, 1) response = self.client.get(article.get_absolute_url()) self.assertContains(response, title1) self.assertContains(response, content1) self.assertNotContains(response, content0) self.assertNotContains(response, content2) def test_revert_translated_revision(self): title1_en = self.rand_str(prefix='title1_en_') title1_de = self.rand_str(prefix='title1_de_') title2_en = self.rand_str(prefix='title2_en_') title2_de = self.rand_str(prefix='title2_de_') article = self.create_article() # Revision 1 article.set_current_language('en') self.create_revision(article, title=title1_en) article.set_current_language('de') self.create_revision(article, title=title1_de) with switch_language(article, 'en'): response = self.client.get(article.get_absolute_url()) self.assertContains(response, title1_en) with switch_language(article, 'de'): response = self.client.get(article.get_absolute_url()) self.assertContains(response, title1_de) # Revision 2a (modify just EN) article.set_current_language('en') self.create_revision(article, title=title2_en) response = self.client.get(article.get_absolute_url()) self.assertContains(response, title2_en) with switch_language(article, 'de'): response = self.client.get(article.get_absolute_url()) self.assertContains(response, title1_de) # Revision 2b (modify just DE) article.set_current_language('de') self.create_revision(article, title=title2_de) with switch_language(article, 'en'): response = self.client.get(article.get_absolute_url()) self.assertContains(response, title2_en) with switch_language(article, 'de'): response = self.client.get(article.get_absolute_url()) self.assertContains(response, title2_de) # Revert to revision 2a (EN=2, DE=1) self.revert_to(article, 1) with switch_language(article, 'en'): response = self.client.get(article.get_absolute_url()) self.assertContains(response, title2_en) with switch_language(article, 'de'): response = self.client.get(article.get_absolute_url()) self.assertContains(response, title1_de) # Revert to revision 1 (EN=1, DE=1) self.revert_to(article, 2) with switch_language(article, 'en'): response = self.client.get(article.get_absolute_url()) self.assertContains(response, title1_en) with switch_language(article, 'de'): response = self.client.get(article.get_absolute_url()) self.assertContains(response, title1_de) def test_edit_plugin_directly(self): content0 = self.rand_str(prefix='content0_') content1 = self.rand_str(prefix='content1_') content2 = self.rand_str(prefix='content2_') article = self.create_article(content=content0) # Revision 1 self.create_revision(article, content=content1) self.assertEqual( len(default_revision_manager.get_for_object(article)), 1) # Revision 2 with transaction.atomic(): plugins = article.content.get_plugins() plugin = plugins[0].get_plugin_instance()[0] plugin.body = content2 plugin.save() aldryn_create_revision(article) self.assertEqual( len(default_revision_manager.get_for_object(article)), 2) response = self.client.get(article.get_absolute_url()) self.assertContains(response, content2) self.assertNotContains(response, content1) # Revert to revision 1 self.revert_to(article, 1) response = self.client.get(article.get_absolute_url()) self.assertContains(response, content1) self.assertNotContains(response, content2) def test_blog_config_recovery_accessible(self): with transaction.atomic(): with create_revision(): new_conf = NewsBlogConfig( namespace='test_revocery_admin_url', paginate_by=15) new_conf.save() new_config_version = (default_revision_manager .get_for_object(new_conf)[0]) new_config_pk = new_conf.pk self.assertEqual(NewsBlogConfig.objects.filter( pk=new_config_pk).count(), 1) new_conf.delete() self.assertEqual(NewsBlogConfig.objects.filter( pk=new_config_pk).count(), 0) # check that there is a a way to access recovery view obj = new_config_version.object_version.object opts = obj._meta url = reverse( 'admin:{0}_{1}_{2}'.format( opts.app_label, obj._meta.model_name, 'recover'), args=[new_config_version.pk]) # ust in case check the length, but at this step either a # NoReverseMatch should occur or other error, # if no exception is raised, it is a good sign self.assertGreater(len(url), 4)
[((791, 851), 'unittest.skipIf', 'skipIf', (['(not ENABLE_REVERSION)', '"""django-reversion not enabled"""'], {}), "(not ENABLE_REVERSION, 'django-reversion not enabled')\n", (797, 851), False, 'from unittest import skipIf\n'), ((984, 1004), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (1002, 1004), False, 'from django.db import transaction\n'), ((3684, 3714), 'parler.utils.context.switch_language', 'switch_language', (['article', '"""en"""'], {}), "(article, 'en')\n", (3699, 3714), False, 'from parler.utils.context import switch_language\n'), ((3850, 3880), 'parler.utils.context.switch_language', 'switch_language', (['article', '"""de"""'], {}), "(article, 'de')\n", (3865, 3880), False, 'from parler.utils.context import switch_language\n'), ((4267, 4297), 'parler.utils.context.switch_language', 'switch_language', (['article', '"""de"""'], {}), "(article, 'de')\n", (4282, 4297), False, 'from parler.utils.context import switch_language\n'), ((4571, 4601), 'parler.utils.context.switch_language', 'switch_language', (['article', '"""en"""'], {}), "(article, 'en')\n", (4586, 4601), False, 'from parler.utils.context import switch_language\n'), ((4737, 4767), 'parler.utils.context.switch_language', 'switch_language', (['article', '"""de"""'], {}), "(article, 'de')\n", (4752, 4767), False, 'from parler.utils.context import switch_language\n'), ((4984, 5014), 'parler.utils.context.switch_language', 'switch_language', (['article', '"""en"""'], {}), "(article, 'en')\n", (4999, 5014), False, 'from parler.utils.context import switch_language\n'), ((5150, 5180), 'parler.utils.context.switch_language', 'switch_language', (['article', '"""de"""'], {}), "(article, 'de')\n", (5165, 5180), False, 'from parler.utils.context import switch_language\n'), ((5396, 5426), 'parler.utils.context.switch_language', 'switch_language', (['article', '"""en"""'], {}), "(article, 'en')\n", (5411, 5426), False, 'from parler.utils.context import switch_language\n'), ((5562, 5592), 'parler.utils.context.switch_language', 'switch_language', (['article', '"""de"""'], {}), "(article, 'de')\n", (5577, 5592), False, 'from parler.utils.context import switch_language\n'), ((6182, 6202), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (6200, 6202), False, 'from django.db import transaction\n'), ((6386, 6417), 'aldryn_reversion.core.create_revision', 'aldryn_create_revision', (['article'], {}), '(article)\n', (6408, 6417), True, 'from aldryn_reversion.core import create_revision as aldryn_create_revision\n'), ((6974, 6994), 'django.db.transaction.atomic', 'transaction.atomic', ([], {}), '()\n', (6992, 6994), False, 'from django.db import transaction\n'), ((7210, 7259), 'reversion.revisions.default_revision_manager.get_for_object', 'default_revision_manager.get_for_object', (['new_conf'], {}), '(new_conf)\n', (7249, 7259), False, 'from reversion.revisions import default_revision_manager\n'), ((1023, 1040), 'reversion.revisions.create_revision', 'create_revision', ([], {}), '()\n', (1038, 1040), False, 'from reversion.revisions import create_revision\n'), ((1070, 1091), 'six.iteritems', 'six.iteritems', (['kwargs'], {}), '(kwargs)\n', (1083, 1091), False, 'import six\n'), ((6093, 6141), 'reversion.revisions.default_revision_manager.get_for_object', 'default_revision_manager.get_for_object', (['article'], {}), '(article)\n', (6132, 6141), False, 'from reversion.revisions import default_revision_manager\n'), ((6461, 6509), 'reversion.revisions.default_revision_manager.get_for_object', 'default_revision_manager.get_for_object', (['article'], {}), '(article)\n', (6500, 6509), False, 'from reversion.revisions import default_revision_manager\n'), ((7013, 7030), 'reversion.revisions.create_revision', 'create_revision', ([], {}), '()\n', (7028, 7030), False, 'from reversion.revisions import create_revision\n'), ((7059, 7126), 'aldryn_newsblog.cms_appconfig.NewsBlogConfig', 'NewsBlogConfig', ([], {'namespace': '"""test_revocery_admin_url"""', 'paginate_by': '(15)'}), "(namespace='test_revocery_admin_url', paginate_by=15)\n", (7073, 7126), False, 'from aldryn_newsblog.cms_appconfig import NewsBlogConfig\n'), ((7356, 7403), 'aldryn_newsblog.cms_appconfig.NewsBlogConfig.objects.filter', 'NewsBlogConfig.objects.filter', ([], {'pk': 'new_config_pk'}), '(pk=new_config_pk)\n', (7385, 7403), False, 'from aldryn_newsblog.cms_appconfig import NewsBlogConfig\n'), ((7480, 7527), 'aldryn_newsblog.cms_appconfig.NewsBlogConfig.objects.filter', 'NewsBlogConfig.objects.filter', ([], {'pk': 'new_config_pk'}), '(pk=new_config_pk)\n', (7509, 7527), False, 'from aldryn_newsblog.cms_appconfig import NewsBlogConfig\n'), ((1749, 1797), 'reversion.revisions.default_revision_manager.get_for_object', 'default_revision_manager.get_for_object', (['article'], {}), '(article)\n', (1788, 1797), False, 'from reversion.revisions import default_revision_manager\n')]
VirtualEmbryo/lumen_network
network/network.py
35b1dadccd087c9ef234f12c2735098b82890b34
# Library for the dynamics of a lumen network # The lumen are 2 dimensional and symmetric and connected with 1 dimensional tubes # # Created by A. Mielke, 2018 # Modified by M. Le Verge--Serandour on 8/04/2019 """ network.py conf.init Defines the class network and associated functions Imports ------- Libraries : numpy, os, math Created by A. Mielke Modified by H. Turlier on 8/06/2018 Modified by M. Le Verge--Serandour on 8/04/2019 """ import numpy as np import math import os class network: def __init__(self, network_folder, out_path, t_step, tube_radius = 0.01, friction = 1, swelling = False, swelling_rate=0., save_area_dat=False): """ Initialization of the object network All properties needed for the simulation are read and initialized Input ----- network_folder : str out_path : str, path-like t_step : float Time step of the simulation. Note that if the simulation is adaptative, this time step will change. tube_radius : float, optional, default = 0.01 Radius of the tube connecting lumens. Define the condition for empty lumens. friction : float, optional, default = 1 Friction constant for the fluid circulating through pipes. swelling : bool, optional, default = False Swelling option for the simulation. True if swelling is included, False otherwise. swelling_rate : float, optional, default = 0. Swelling rate value in case the swelling is considered. Make sure the rate is not to big to avoid non-converging simulations. save_area_dat : bool, optional, default = False Save area option. True if areas are saved in area.dat, False otherwise. """ self.network_folder = network_folder # Reading properties of the lumen self.gamma_lumen, self.gamma_contact, self.area = np.loadtxt(os.path.join(network_folder, 'lumen.dat'), dtype = float, usecols = [0,2,3], unpack = True) # Reading links between two lumen self.lumen_lumen = self.read_lumen_lumen(os.path.join(network_folder, 'lumen_lumen.dat')) # Reading links between bridge and lumen self.bridge_lumen, self.num_bridges = self.read_bridge_lumen(os.path.join(network_folder, 'bridge_lumen.dat')) # Reading links between two bridges self.bridge_bridge, self.num_bridges = self.read_bridge_bridge(os.path.join(network_folder, 'bridge_bridge.dat'), self.num_bridges) # Surface tension ratio self.alpha = self.gamma_contact/(2*self.gamma_lumen) self.delta = np.full(len(self.alpha), 1) # Possibility of asymmetric lumen is not included # Resistances self.tube_radius = tube_radius # Radius of the tube connecting the lumen and the bridges self.friction = friction # Friction coefficient; friction * length = resistance # Opening angle of the lumen (angle between curvature and tube) self.theta = self.set_theta() # Area factor for expressing the pressure in terms of the area instead of the radius self.area_factor = self.set_area_factor() # Ending time: time at which only one lumen is remaining self.end_time = 0 # Time step for the output of the area evolution self.time_step = t_step # Creating output file for the area evolution, events, error messages self.save_area(start = True, out_path = out_path) self.save_event('', start = True, out_path = out_path) self.save_error('', start = True, out_path = out_path) # Area distribution after only one lumen is remaining self.final_area = [] # Current time step of the simulation self.current_time = 0 # List of empty lumen (area < tube_radius **2) self.empty_list = np.zeros(len(self.alpha)) # Swelling self.swelling_bool = swelling self.swelling_rate = swelling_rate # Save area self.save_area_dat = save_area_dat ############################################################################################################################ ########################################################## Dynamics ######################################################## ############################################################################################################################ def flux(self, t, state): """ Determines the flux/ area change for each lumen of the network, main function of network.py Input ----- self : network object Needs to be called by a class object t : float Actual time step (not needed for the calculation of the flux, but required for the used integration method in network_simulation.py state : float array The current area of the lumens Returns ------- flux : float array Contains the area change for each lumen in dt """ # Initialization of the array containing the area change (index == lumen ID) flux = [] self.current_time = t for i in range(len(self.alpha)): flux.append(0) # If only one lumen remains -> End of simulation, flux is zero (needed as for the integration method used, no dynamic stop is possible) if(np.sum(self.empty_list) >= len(self.alpha) - 1): if(self.end_time == 0): # Setting the end time for the output file area.log self.end_time = t # more than one lumen remaining: calculation of the flux else: # Adapting network to new state: Empty lumen are removed and graph is reconnected self.area = state self.remove_empty_lumen() # Area change between directly connected lumen flux = self.flux_lumen(flux) # Calculating artificial pressure at each bridge; linear system of equations, with flux(bridge) = 0, the bridge does not gain or loose area pressure_bridges = self.pressure_bridges() # Area change between lumen-bridges flux = self.flux_bridges(flux, pressure_bridges) # Area change due to swelling if self.swelling_bool : flux = self.flux_swelling(flux) # Saving area for the time step given in the configuration file if self.save_area_dat : self.save_area() self.t_old = t if(np.abs(np.sum(flux)) > self.tube_radius ** 2): error = 'total flux is non-zero: total flux = %f' % (np.sum(flux)) self.save_error(error) return flux def flux_lumen(self,flux): """ Determines the flux/ area change for each lumen due to the connection between lumen and lumen Input ----- self network object needs to be called by a class object flux float array vector containing the area change for each lumen; index = lumen ID Returns ------- flux float array area changes due to lumen-lumen connection added to the vector passed """ # for each connection between two lumen for line in range(len(self.lumen_lumen)): lumen_1 = int (self.lumen_lumen[line][0]) # first lumen lumen_2 = int (self.lumen_lumen[line][1]) # second lumen # flux from lumen 2 to lumen 1 fl = (self.pressure(lumen_2) - self.pressure(lumen_1))*self.friction/self.lumen_lumen[line][2] flux[lumen_1] += fl flux[lumen_2] -= fl return flux def pressure_bridges(self): """ Determines the pressure at each bridge for each bridge the total flux is 0, meaning that the bridge does not gain or loose area this gives a linear equation system, which can be solved The connections are taken from the files bridge_lumen.dat and bridge_bridge.dat For Information about the equations see the documentation to the code Input ----- self : network object Needs to be called by a class object Returns ------- pressure_bridges : float array Pressure at each bridge """ R_sum = np.zeros(self.num_bridges, dtype = float) # sum of the resistences around one bridge P_over_R_sum = np.zeros(self.num_bridges, dtype = float) # sum of pressure over resistance between one bridge and all directly connected lumen matrix_bridges = np.zeros([self.num_bridges, self.num_bridges], dtype= float) # matrix to calculate the pressure at each bridge # For each connection between bridge and lumen for line in self.bridge_lumen: bridge = int(line[0]) lumen = int(line[1]) R_sum[bridge] += 1./line[2]*self.friction P_over_R_sum[bridge] += self.pressure(lumen)/line[2]*self.friction # For each connection between bridge and bridge for line in self.bridge_bridge: bridge1 = int(line[0]) bridge2 = int(line[1]) matrix_bridges[bridge1][bridge2] = 1./line[2]*self.friction matrix_bridges[bridge2][bridge1] = 1./line[2]*self.friction R_sum[bridge1] += 1./line[2]*self.friction R_sum[bridge2] += 1./line[2]*self.friction for line in range(self.num_bridges): matrix_bridges[line][line] = -R_sum[line] # Solving linear problem with the pressure at each bridge as solution pressure_bridges = np.linalg.solve(matrix_bridges, -P_over_R_sum) return pressure_bridges; def flux_bridges(self, flux, pressure_bridges): """ Determines the flux/ area change for each lumen due to the connection between lumen and bridge Input ----- self : network object Needs to be called by a class object Returns ------- flux : float array Area changes due to bridge-lumen connection added to the vector passed """ # Area change in one bridge; should be 0; calculated as control value flux_bridge = np.zeros(self.num_bridges, dtype = float) # For each connection between bridge and bridge for line in self.bridge_bridge: bridge1 = int(line[0]) bridge2 = int(line[1]) fb = (pressure_bridges[bridge2] - pressure_bridges[bridge1])*self.friction/line[2] flux_bridge[bridge1] += fb flux_bridge[bridge2] -= fb # For each connection between bridge and lumen for line in self.bridge_lumen: bridge = int(line[0]) lumen = int(line[1]) fl = (pressure_bridges[bridge] - self.pressure(lumen))*self.friction/line[2] flux[lumen] += fl flux_bridge[bridge] -= fl for i in range(len(flux_bridge)): if (np.abs(flux_bridge[i]) > self.tube_radius ** 2): error = 'total flux of bridge %d is non-zero: total flux = %f' % (i,flux_bridge[i]) self.save_error(error) return flux def flux_swelling(self, flux) : """ Determines the flux/ area change for each lumen due to sewlling Input ----- self : network object Needs to be called by a class object Returns ------- flux : float array Area changes due to bridge-lumen connection added to the vector passed """ # for each lumen (lumen is the index of the lumen's area) for lumen in range(len(self.area)) : # if not empty if not self.area[lumen] < 2*self.tube_radius ** 2 : # then add the swelling contribution flux[lumen] += self.swelling(lumen) return flux ############################################################################################################################ ###################################################### Removing Functions ##################################################### ############################################################################################################################ def remove_empty_lumen(self): """ Determines and removes empty lumen Calls a function to obtain a list of empty lumen and passes the list to a function to remove them and reconnect the network Input ----- self : network object Needs to be called by a class object Returns ------- no return """ empty_lumen_list = [] # Creating a list of empty lumen empty_lumen_list = self.get_empty_lumen() # Removing empty lumen and reconnecting the network if (len(empty_lumen_list) > 0 ): event = 'empty lumen: ' + ' '.join(map(str, empty_lumen_list)) #print event self.save_event(event) self.remove_lumen(empty_lumen_list) return; def remove_lumen(self, lumen_to_remove): """ Removes the lumen that are passed and connects the neighbors of these lumen Input ----- self : network object Needs to be called by a class object lumen_to_remove : int list List of lumen to be removed Returns ------- no return """ # For each lumen that has to be removed for lumen in lumen_to_remove: neighbours = self.get_neighbours(lumen) # List of connected lumen bridges = self.get_bridges(lumen) # List of connected bridges self.save_event('lumen ' + str(lumen) + ' neighbours ' + str(neighbours)) self.save_event('lumen ' + str(lumen) + ' bridges ' + str(bridges)) # Lumen had two connections, this means that it disappears and the two connected parts get directly connected, the resistance for the new link is the sum of the resistance of the two previous connections test=True if(len(neighbours) + len(bridges) == 2): # Lumen was connected to two lumen -> new connection between lumen and lumen if(len(neighbours) == 2): self.create_link([neighbours[0][0], neighbours[1][0], neighbours[0][1] + neighbours[1][1]]) #print 'lumen_lumen connexion (' + str(neighbours[0][0]) + ', ' + str(neighbours[1][0]) + ')' # Lumen was connected to a lumen and a bridge -> new connection between lumen and bridge if(len(neighbours) == 1 and len(bridges)==1): self.create_bridge_lumen([bridges[0][0], neighbours[0][0], bridges[0][1] + neighbours[0][1]]) #print 'lumen_bridge connexion (' + str(bridges[0][0]) + ', ' + str(neighbours[0][0]) + ')' # Lumen was connected to two bridges -> new connection between bridge and bridge if(len(bridges)==2): self.create_bridge_bridge([bridges[0][0], bridges[1][0], bridges[0][1] + bridges[1][1]]) #print 'bridge_bridge connexion (' + str(bridges[0][0]) + ', ' + str(bridges[1][0]) + ')' self.create_bridge(neighbours, bridges, lumid=lumen) # Lumen had more than two connections -> becomes a bridge, the resistances remain the same but the connections are changed to connections to a bridge if(len(neighbours) + len(bridges) > 2): self.create_bridge(neighbours, bridges, lumid=lumen) return; def remove_link(self, lumen_1, lumen_2): """ Removes a connection between two lumen Input ----- self : network object Needs to be called by a class object lumen_1 : int First lumen of the connection lumen_2 : Second lumen of the connection Returns ------- no return """ # Due to data structure first lumen must be smaller than second lumen if(lumen_1 > lumen_2): n = lumen_1 lumen_1 = lumen_2 lumen_2 = n # Find connection in lumen_lumen file and remove it line = 0 # For each line in lumen_lumen until connection is found while (line < len(self.lumen_lumen)): # If connection is found removing it if(self.lumen_lumen[line][0] == lumen_1 and self.lumen_lumen[line][1] == lumen_2): event = 'link lumen %d to lumen %d removed' % (lumen_1, lumen_2) #print event self.save_event(event) link = [lumen_1, lumen_2, self.lumen_lumen[line][2]] self.lumen_lumen.remove(link) break; # Look at next line else: line += 1 ############################################################################################################################ ###################################################### Get Functions ##################################################### ############################################################################################################################ def get_empty_lumen(self): """ Gets the IDs of the empty lumen Empty means that the area is smaller than the tube_radius^2 Input ----- self : network object Needs to be called by a class object Returns ------- empty_lumen_list : int list Contains the IDs of the empty lumens """ empty_lumen_list = [] # For each lumen ID for i in range(len(self.area)): # If area is smaller than the treshhold if(self.area[i] < self.tube_radius ** 2 and self.empty_list[i] == 0): self.empty_list[i] = 1 self.area[i] = 0 empty_lumen_list.append(i) return empty_lumen_list def get_neighbours(self, lumen): """ Gets the lumen that are directly connected to the lumen passed on and deletes the connections Input ----- self : network object Needs to be called by a class object lumen : int ID of a lumen Returns ------- neighbour_list : int list ID of all lumen that are directly connected to the lumen passed on """ neighbour_list = [] line = 0 # Going through links in lumen_lumen.dat while line < len(self.lumen_lumen) and self.lumen_lumen[line][0] < lumen : if self.lumen_lumen[line][1] == lumen : neighbour_list.append([self.lumen_lumen[line][0], self.lumen_lumen[line][2]]) event = 'link lumen %d to lumen %d removed' % (self.lumen_lumen[line][0], lumen) self.save_event(event) link = [self.lumen_lumen[line][0], self.lumen_lumen[line][1], self.lumen_lumen[line][2]] self.lumen_lumen.remove(link) else : line += 1 while line < len(self.lumen_lumen) and self.lumen_lumen[line][0] < lumen : line += 1 while(line < len(self.lumen_lumen) and self.lumen_lumen[line][0] == lumen): neighbour_list.append([self.lumen_lumen[line][1], self.lumen_lumen[line][2]]) event = 'link lumen %d to lumen %d removed' % (lumen, self.lumen_lumen[line][1]) self.save_event(event) link = [self.lumen_lumen[line][0], self.lumen_lumen[line][1], self.lumen_lumen[line][2]] self.lumen_lumen.remove(link) return neighbour_list def get_bridges(self, lumen): """ Gets the bridges that are directly connected to the lumen passed on Input ----- self : network object Needs to be called by a class object lumen : int ID of a lumen Returns ------- neighbour_list : int list ID of all lumen that are directly connected to the lumen passed on """ bridge_list = [] line = 0 # Going through the links in bridge_lumen.dat while(line < len(self.bridge_lumen)): if (self.bridge_lumen[line][1] == lumen): bridge_list.append([self.bridge_lumen[line][0], self.bridge_lumen[line][2]]) event = 'link bridge %d to lumen %d removed' % (self.bridge_lumen[line][0], lumen) self.save_event(event) self.bridge_lumen.remove(self.bridge_lumen[line]) else: line += 1 return bridge_list ############################################################################################################################ #################################################### Creating Functions ################################################### ############################################################################################################################ def create_link(self, link): """ Creates a link between two lumen in lumen_lumen.dat Input ----- self : network object Needs to be called by a class object link : float array [ID lumen1, ID lumen2, length] Returns ------- no return """ # no self-loops allowed if(len(link) == 4 and link[0] != link[1]): # Ensuring: lumen_1 < lumen_2 if(link[0] < link[2]): lumen_1 = link[0] lumen_2 = link[1] else: lumen_1 = link[1] lumen_2 = link[0] length = link[2] line = 0 # Finding line in lumen_lumen.dat, to keep the sorting while(line < len(self.lumen_lumen) and lumen_1 > self.lumen_lumen[line][0]): line += 1 if(line < len(self.lumen_lumen) - 1): while(line < len(self.lumen_lumen) and lumen_2 > self.lumen_lumen[line][1] and lumen_1 == self.lumen_lumen[line][0]): line += 1 # Creating the link in lumen_lumen.dat self.lumen_lumen.append([lumen_1,lumen_2, length]) self.lumen_lumen.sort() event = 'link lumen %d to lumen %d created' % (lumen_1,lumen_2) self.save_event(event) return; def create_bridge_lumen(self, link): """ Creates a link between a lumen and a bridge in bridge_lumen.dat Input ----- self : network object Needs to be called by a class object link : float array [ID bridge, ID lumen, length] Returns ------- no return """ bridge = link[0] lumen = link[1] length = link[2] line = 0 # Creating the link in bridge_lumen.dat self.bridge_lumen.append(link) self.bridge_lumen.sort() event = 'link bridge %d to lumen %d created' % (bridge,lumen) self.save_event(event) return; def create_bridge_bridge(self, link): """ Creates a link between two bridges in bridge_bridge.dat Input ----- self : network object Needs to be called by a class object link : float array [ID bridge1, ID bridge2, length] Returns ------- no return """ if(link[0] == link[1]): return; if(link[0] < link[1]): bridge_1 = link[0] bridge_2 = link[1] else: bridge_1 = link[1] bridge_2 = link[0] length = link[2] line = 0 # Creating the link in bridge_bridge.dat self.bridge_bridge.append([bridge_1,bridge_2, length]) self.bridge_bridge.sort() event = 'link bridge %d to bridge %d created' % (bridge_1,bridge_2) self.save_event(event) return; def create_bridge(self, lumen, bridge, lumid): """ Creates a new bridge connected with the lumen and bridges passed on Input ----- self : network object Needs to be called by a class object lumen : int list [[lumen ID, length], [lumen ID, length],.....] lumen IDs to which the new bridge should be connected to bridge : int list [[bridge ID, length], [bridge ID, length],.....] bridge IDs to which the new bridge should be connected to Returns ------- no return """ ##### bridge_conversionfile = os.path.join(self.network_folder,'bridgesconversion.txt') # ID of the new bridge bridge_number = self.num_bridges # Bridge ID counter, contains the ID of the next new bridge self.num_bridges += 1 event = 'new bridge %d' % (bridge_number) + ' (' + str(lumid) + ')' self.save_event(event) line = 0 lumen.sort() bridge.sort() # For each lumen that should be connected to the new bridge for i in range(len(lumen)): new_link = [bridge_number, lumen[i][0], lumen[i][1]] # Create link in bridge_lumen.dat self.create_bridge_lumen(new_link) # For each lumen that should be connected to the new bridge for i in range(len(bridge)): new_link = [bridge[i][0], bridge_number, bridge[i][1]] # Create link in bridge_bridge.dat self.create_bridge_bridge(new_link) open(bridge_conversionfile, 'a').write(str(bridge_number) + ' ' + str(lumid)+ '\n') return; ############################################################################################################################ ################################ Geometric Functions for area and Pressure ############################################### ############################################################################################################################ def set_theta(self): """ Sets the angle theta Calculates the angle theta, angle between the lumen and the tube Input ----- self : network object Needs to be called by a class object Returns ------- theta : float list Theta value for each lumen """ theta = [] for i in range(len(self.alpha)): #cos = (2*self.alpha[i]-(4*self.alpha[i]**2-self.delta[i]**2+1)/(4*self.alpha[i]))/self.delta[i] ## Old version, for assymmetric lumen #theta.append(math.acos(cos)) theta.append(np.arccos(self.alpha[i])) return theta; def set_area_factor(self): """ Sets the area factor, needed to express the pressure in terms of the area instead of the curvature radius Input ----- self : network object Needs to be called by a class object Returns ------- area_factor : float list Area factor for each lumen """ area_factor = [] for i in range(len(self.alpha)): area_factor.append(np.sqrt((2*self.theta[i]-np.sin(2*self.theta[i])))) return area_factor; def opening_radius(self, lumen): """ Calculates the length/2 parallel to the 'tube' where the membrane is not attached for a given lumen Input ----- lumen : int ID of the lumen Returns ------- radius : float Length/2 of the opening radius """ return np.sqrt(2*self.area[lumen]/(2*self.theta[lumen]-np.sin(2*self.theta[lumen])))*np.sin(self.theta[lumen]) def get_area(self, lumen): """ Calculates the area in one half of the lumen (for symmetric lumen) Input ----- lumen : int ID of the lumen Returns ------- area : float Area/2 of the lumen """ area = self.area[lumen] return area def pressure(self,lumen): """ Calculates the pressure inside the lumen (for symmetric lumen) Input ----- lumen : int ID of the lumen Returns ------- pressure : float Pressure of the lumen """ area = self.get_area(lumen) # Avoid dividing by zero if(area < 0.1 * self.tube_radius**2 ): error = 'division by zero in pressure: lumen ID: %d' % (lumen) self.save_error(error) pressure = self.gamma_lumen[lumen]*self.area_factor[lumen]/np.sqrt(area) return pressure ############################################################################################################################ ################################################# Reading Functions ######################################################## ############################################################################################################################ def read_lumen_lumen(self, lumen_lumen_file): """ Reading the file with links between two lumens Input ----- lumen_lumen_file : str File path to file with the links between two lumens Returns ------- lumen_lumen : float list [lumen1, lumen2, length] Information about the links between two lumens """ if (os.path.getsize(lumen_lumen_file)>0): # If the file is not empty lumen_1, lumen_2 = np.loadtxt(lumen_lumen_file, dtype = int, usecols = [0,1], unpack = True) length = np.loadtxt(lumen_lumen_file, dtype = float, usecols = [2]) lumen_lumen = np.column_stack([lumen_1, lumen_2, length]).tolist() else: lumen_lumen = [] return lumen_lumen def read_bridge_lumen(self, bridge_lumen_file): """ Reading the file with links between bridge and lumen Input ----- bridge_lumen_file : str File path to file with the links between bridge and lumen Returns ------- bridge_lumen : float list [bridge, lumen, length] Information about the links between bridge and lumen num_bridges : int Number of bridge_lumen links """ with open(bridge_lumen_file, 'r') as f: lines = f.read().splitlines() last_line = lines[-1] if ('#' in last_line): # If the file is empty bridge_lumen = [] num_bridges = 0 # number of existing bridges else: bridge, lumen = np.loadtxt(bridge_lumen_file, dtype = int, usecols = [0,1], unpack = True) length = np.loadtxt(bridge_lumen_file, dtype = float, usecols = [2]) bridge_lumen = np.column_stack([bridge, lumen, length]).tolist() num_bridges = max(bridge)+1 # number of existing bridges return bridge_lumen, num_bridges def read_bridge_bridge(self, bridge_bridge_file, num_bridges): """ Reading the file with links between two bridge Input ----- bridge_bridge_file : str File path to file with the links between two bridge Returns ------- bridge_bridge : float list [bridge1, bridge2, length] Information about the links between two bridge num : int Number of bridge_bridge links """ with open(bridge_bridge_file, 'r') as f: lines = f.read().splitlines() last_line = lines[-1] if ('#' in last_line>0): # If the file is empty bridge_bridge = [] num = num_bridges else: bridge1, bridge2 = np.loadtxt(bridge_bridge_file, dtype = int, usecols = [0,1], unpack = True) length = np.loadtxt(bridge_bridge_file, dtype = float, usecols = [2]) bridge_bridge = np.column_stack([bridge1, bridge2, length]).tolist() if (max(bridge2)+1 > num_bridges): num = max(bridge2)+1 return bridge_bridge, num ############################################################################################################################ ################################################# Output functions ######################################################### ############################################################################################################################ def save_event(self, event, start = False, out_path = ''): """ Saves each event in the output folder in the file event.dat Events like a lumen disappearing, reconnections in the graph Input ----- event : str Message of the event start : boolean True: File is created False: the message is stored in the file Returns ------ no return """ if(start): header_event = '# Saves each event during the simulation; event is a disappearing lumen, graph reconnection \n' self.file_event = os.path.join(out_path, 'event.dat') fevent = open(self.file_event, 'w') fevent.write(header_event) fevent.close() else: fevent = open(self.file_event, 'a') fevent.write('%.5f' % self.current_time) fevent.write(' ') fevent.write(event) fevent.write('\n') fevent.close() return; def save_error(self, error, start = False, out_path = ''): """ Saves errors in the output folder in the file error.dat Errors like volume loss Input ----- error : string Message of the event start : boolean True: File is created False: the message is stored in the file Returns ------ no return """ if(start): header_error = '# Saves each warning like volume loss \n' self.file_error = os.path.join(out_path, 'error.dat') ferror = open(self.file_error, 'w') ferror.write(header_error) ferror.close() else: ferror = open(self.file_error, 'a') ferror.write('%.5f' % self.current_time) ferror.write(' ') ferror.write(error) ferror.write('\n') ferror.close() return; def save_area(self, start = False, out_path = ''): """ Saves the volume evolution in the output folder in the file area.dat Input ----- start : boolean True: File is created False: the message is stored in the file Returns ------ no return """ if(start): header_volume = '# Saves the volume evolution of each lumen for the time step %f \n' %(self.time_step) self.file_area = os.path.join(out_path, 'area.dat') farea = open(self.file_area, 'w') farea.write(header_volume) farea.close() self.t_old = 0 else: farea = open(self.file_area, 'a') farea.write('%.5f' % self.current_time) farea.write(' ') farea.write(' '.join(map(str, self.area))) farea.write('\n') farea.close() return; ############################################################################################################################ ################################################# Swelling functions ####################################################### ############################################################################################################################ def swelling(self, lumen) : """ self.swelling(lumen) Calculates the input flux for the area fo a given lumen, due to swelling. Input ----- lumen : int Index of the lumen """ area = self.get_area(lumen) theta = self.theta[lumen] flux_swelling = self.swelling_rate * 4 * theta * np.sqrt(area)/ self.area_factor[lumen] #print flux_swelling return flux_swelling
[((8964, 9003), 'numpy.zeros', 'np.zeros', (['self.num_bridges'], {'dtype': 'float'}), '(self.num_bridges, dtype=float)\n', (8972, 9003), True, 'import numpy as np\n'), ((9072, 9111), 'numpy.zeros', 'np.zeros', (['self.num_bridges'], {'dtype': 'float'}), '(self.num_bridges, dtype=float)\n', (9080, 9111), True, 'import numpy as np\n'), ((9225, 9284), 'numpy.zeros', 'np.zeros', (['[self.num_bridges, self.num_bridges]'], {'dtype': 'float'}), '([self.num_bridges, self.num_bridges], dtype=float)\n', (9233, 9284), True, 'import numpy as np\n'), ((10281, 10327), 'numpy.linalg.solve', 'np.linalg.solve', (['matrix_bridges', '(-P_over_R_sum)'], {}), '(matrix_bridges, -P_over_R_sum)\n', (10296, 10327), True, 'import numpy as np\n'), ((10970, 11009), 'numpy.zeros', 'np.zeros', (['self.num_bridges'], {'dtype': 'float'}), '(self.num_bridges, dtype=float)\n', (10978, 11009), True, 'import numpy as np\n'), ((26430, 26488), 'os.path.join', 'os.path.join', (['self.network_folder', '"""bridgesconversion.txt"""'], {}), "(self.network_folder, 'bridgesconversion.txt')\n", (26442, 26488), False, 'import os\n'), ((2077, 2118), 'os.path.join', 'os.path.join', (['network_folder', '"""lumen.dat"""'], {}), "(network_folder, 'lumen.dat')\n", (2089, 2118), False, 'import os\n'), ((2270, 2317), 'os.path.join', 'os.path.join', (['network_folder', '"""lumen_lumen.dat"""'], {}), "(network_folder, 'lumen_lumen.dat')\n", (2282, 2317), False, 'import os\n'), ((2446, 2494), 'os.path.join', 'os.path.join', (['network_folder', '"""bridge_lumen.dat"""'], {}), "(network_folder, 'bridge_lumen.dat')\n", (2458, 2494), False, 'import os\n'), ((2612, 2661), 'os.path.join', 'os.path.join', (['network_folder', '"""bridge_bridge.dat"""'], {}), "(network_folder, 'bridge_bridge.dat')\n", (2624, 2661), False, 'import os\n'), ((5711, 5734), 'numpy.sum', 'np.sum', (['self.empty_list'], {}), '(self.empty_list)\n', (5717, 5734), True, 'import numpy as np\n'), ((29787, 29812), 'numpy.sin', 'np.sin', (['self.theta[lumen]'], {}), '(self.theta[lumen])\n', (29793, 29812), True, 'import numpy as np\n'), ((30876, 30889), 'numpy.sqrt', 'np.sqrt', (['area'], {}), '(area)\n', (30883, 30889), True, 'import numpy as np\n'), ((31777, 31810), 'os.path.getsize', 'os.path.getsize', (['lumen_lumen_file'], {}), '(lumen_lumen_file)\n', (31792, 31810), False, 'import os\n'), ((31873, 31941), 'numpy.loadtxt', 'np.loadtxt', (['lumen_lumen_file'], {'dtype': 'int', 'usecols': '[0, 1]', 'unpack': '(True)'}), '(lumen_lumen_file, dtype=int, usecols=[0, 1], unpack=True)\n', (31883, 31941), True, 'import numpy as np\n'), ((31968, 32022), 'numpy.loadtxt', 'np.loadtxt', (['lumen_lumen_file'], {'dtype': 'float', 'usecols': '[2]'}), '(lumen_lumen_file, dtype=float, usecols=[2])\n', (31978, 32022), True, 'import numpy as np\n'), ((33062, 33131), 'numpy.loadtxt', 'np.loadtxt', (['bridge_lumen_file'], {'dtype': 'int', 'usecols': '[0, 1]', 'unpack': '(True)'}), '(bridge_lumen_file, dtype=int, usecols=[0, 1], unpack=True)\n', (33072, 33131), True, 'import numpy as np\n'), ((33158, 33213), 'numpy.loadtxt', 'np.loadtxt', (['bridge_lumen_file'], {'dtype': 'float', 'usecols': '[2]'}), '(bridge_lumen_file, dtype=float, usecols=[2])\n', (33168, 33213), True, 'import numpy as np\n'), ((34248, 34318), 'numpy.loadtxt', 'np.loadtxt', (['bridge_bridge_file'], {'dtype': 'int', 'usecols': '[0, 1]', 'unpack': '(True)'}), '(bridge_bridge_file, dtype=int, usecols=[0, 1], unpack=True)\n', (34258, 34318), True, 'import numpy as np\n'), ((34345, 34401), 'numpy.loadtxt', 'np.loadtxt', (['bridge_bridge_file'], {'dtype': 'float', 'usecols': '[2]'}), '(bridge_bridge_file, dtype=float, usecols=[2])\n', (34355, 34401), True, 'import numpy as np\n'), ((35661, 35696), 'os.path.join', 'os.path.join', (['out_path', '"""event.dat"""'], {}), "(out_path, 'event.dat')\n", (35673, 35696), False, 'import os\n'), ((36666, 36701), 'os.path.join', 'os.path.join', (['out_path', '"""error.dat"""'], {}), "(out_path, 'error.dat')\n", (36678, 36701), False, 'import os\n'), ((37625, 37659), 'os.path.join', 'os.path.join', (['out_path', '"""area.dat"""'], {}), "(out_path, 'area.dat')\n", (37637, 37659), False, 'import os\n'), ((6969, 6981), 'numpy.sum', 'np.sum', (['flux'], {}), '(flux)\n', (6975, 6981), True, 'import numpy as np\n'), ((7074, 7086), 'numpy.sum', 'np.sum', (['flux'], {}), '(flux)\n', (7080, 7086), True, 'import numpy as np\n'), ((11750, 11772), 'numpy.abs', 'np.abs', (['flux_bridge[i]'], {}), '(flux_bridge[i])\n', (11756, 11772), True, 'import numpy as np\n'), ((28599, 28623), 'numpy.arccos', 'np.arccos', (['self.alpha[i]'], {}), '(self.alpha[i])\n', (28608, 28623), True, 'import numpy as np\n'), ((38874, 38887), 'numpy.sqrt', 'np.sqrt', (['area'], {}), '(area)\n', (38881, 38887), True, 'import numpy as np\n'), ((32053, 32096), 'numpy.column_stack', 'np.column_stack', (['[lumen_1, lumen_2, length]'], {}), '([lumen_1, lumen_2, length])\n', (32068, 32096), True, 'import numpy as np\n'), ((33245, 33285), 'numpy.column_stack', 'np.column_stack', (['[bridge, lumen, length]'], {}), '([bridge, lumen, length])\n', (33260, 33285), True, 'import numpy as np\n'), ((34434, 34477), 'numpy.column_stack', 'np.column_stack', (['[bridge1, bridge2, length]'], {}), '([bridge1, bridge2, length])\n', (34449, 34477), True, 'import numpy as np\n'), ((29229, 29254), 'numpy.sin', 'np.sin', (['(2 * self.theta[i])'], {}), '(2 * self.theta[i])\n', (29235, 29254), True, 'import numpy as np\n'), ((29757, 29786), 'numpy.sin', 'np.sin', (['(2 * self.theta[lumen])'], {}), '(2 * self.theta[lumen])\n', (29763, 29786), True, 'import numpy as np\n')]
always-newbie161/pyprobml
scripts/upsampling_demo.py
eb70c84f9618d68235ef9ba7da147c009b2e4a80
# Illustrate upsampling in 2d # Code from Jason Brownlee # https://machinelearningmastery.com/generative_adversarial_networks/ import tensorflow as tf from tensorflow import keras from numpy import asarray #from keras.models import Sequential from tensorflow.keras.models import Sequential #from keras.layers import UpSampling2D from tensorflow.keras.layers import UpSampling2D X = asarray([[1, 2], [3, 4]]) X = asarray([[1, 2, 3], [4, 5, 6], [7,8,9]]) print(X) nr = X.shape[0] nc = X.shape[1] # reshape input data into one sample a sample with a channel X = X.reshape((1, nr, nc, 1)) model = Sequential() model.add(UpSampling2D(input_shape=(nr, nc, 1))) # nearest neighbor yhat = model.predict(X) yhat = yhat.reshape((2*nr, 2*nc)) print(yhat) model = Sequential() model.add(UpSampling2D(input_shape=(nc, nc, 1), interpolation='bilinear')) yhat = model.predict(X) yhat = yhat.reshape((2*nr, 2*nc)) print(yhat)
[((388, 413), 'numpy.asarray', 'asarray', (['[[1, 2], [3, 4]]'], {}), '([[1, 2], [3, 4]])\n', (395, 413), False, 'from numpy import asarray\n'), ((423, 465), 'numpy.asarray', 'asarray', (['[[1, 2, 3], [4, 5, 6], [7, 8, 9]]'], {}), '([[1, 2, 3], [4, 5, 6], [7, 8, 9]])\n', (430, 465), False, 'from numpy import asarray\n'), ((624, 636), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (634, 636), False, 'from tensorflow.keras.models import Sequential\n'), ((785, 797), 'tensorflow.keras.models.Sequential', 'Sequential', ([], {}), '()\n', (795, 797), False, 'from tensorflow.keras.models import Sequential\n'), ((647, 684), 'tensorflow.keras.layers.UpSampling2D', 'UpSampling2D', ([], {'input_shape': '(nr, nc, 1)'}), '(input_shape=(nr, nc, 1))\n', (659, 684), False, 'from tensorflow.keras.layers import UpSampling2D\n'), ((808, 871), 'tensorflow.keras.layers.UpSampling2D', 'UpSampling2D', ([], {'input_shape': '(nc, nc, 1)', 'interpolation': '"""bilinear"""'}), "(input_shape=(nc, nc, 1), interpolation='bilinear')\n", (820, 871), False, 'from tensorflow.keras.layers import UpSampling2D\n')]
njchj/V2RayCloudSpider
V2RaycSpider1225/src/BusinessCentralLayer/scaffold.py
16154cf48c74fa2c8cf2f6792d2db3632501f5d6
__all__ = ['scaffold', 'command_set'] from gevent import monkey monkey.patch_all() import csv import os import sys import time import shutil from typing import List import gevent from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, \ REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, \ REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING command_set = { # --------------------------------------------- # 部署接口 # --------------------------------------------- 'deploy': "部署项目(定时任务/Flask 开启与否取决于yaml配置文件)", # --------------------------------------------- # 调试接口 # --------------------------------------------- "clear": "清理系统运行缓存", "decouple": "立即唤醒一次subs_ddt链接解耦任务", "overdue": "立即执行一次过时链接清洗任务", "run": "[请使用spawn命令替代]立即执行一次采集任务(强制使用协程加速)", "force_run": "[请使用spawn命令替代]强制执行采集任务", "remain": "读取剩余订阅数量", "ping": "测试数据库连接", "entropy": "打印采集队列", "exile": "执行队列运维脚本(高饱和强阻塞任务)", "spawn": "并发执行所有在列的采集任务", "mining": "启动一次针对STAFF host的SEO全站挖掘任务", # --------------------------------------------- # 随参调试接口 # --------------------------------------------- # usage: 解析某条订阅链接 python main.py --parse https://domain/link/token?sub=3 # usage: 解析多条订阅链接 python main.py --parse https://domain/link/token?sub=3 https://domain/link/token2?sub=3 # "--parse": """解析链接。若是订阅链接,则检测节点数量并测试ping延时""", # --------------------------------------------- # Windows 功能接口 # --------------------------------------------- "panel": "[for Windows] 打开桌面前端面板", "ash": "[for Windows] 一键清洗订阅池,并将所有类型订阅转换为Clash yaml配置文件," "借由URL Scheme自动打开Clash并下载配置文件", # --------------------------------------------- # 调用示例 # --------------------------------------------- "example": "python main.py ping" } class _ConfigQuarantine: def __init__(self): self.root = [ SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CACHE_BGPIC ] self.flag = False def set_up_file_tree(self, root): """ --/qinse/V2RaycSpider{verNum} --BCL --BLL --BVL --Database --client_depot --vcs.csv --logs --*error.log --*runtime.log --temp_cache --*AnyTempCacheFile... --*CrawlFetchHistory.txt --fake_useragent_0.1.11.json --*tests """ # 检查默认下载地址是否残缺 深度优先初始化系统文件 for child_ in root: if not os.path.exists(child_): self.flag = True try: # 初始化文件夹 if os.path.isdir(child_) or not os.path.splitext(child_)[-1]: os.mkdir(child_) logger.success(f"系统文件链接成功->{child_}") # 初始化文件 else: if child_ == SERVER_PATH_DEPOT_VCS: try: with open(child_, 'w', encoding='utf-8', newline='') as fpx: csv.writer(fpx).writerow(['version', 'title']) logger.success(f"系统文件链接成功->{child_}") except Exception as ep: logger.exception(f"Exception{child_}{ep}") except Exception as ep: logger.exception(ep) @staticmethod def check_config(call_driver: bool = False): chromedriver_not_found_error = "<ScaffoldGuider> ForceRun || ChromedriverNotFound ||" \ "未查找到chromedriver驱动,请根据技术文档正确配置\n" \ ">>> https://github.com/QIN2DIM/V2RayCloudSpider" # if not all(SMTP_ACCOUNT.values()): # logger.warning('您未正确配置<通信邮箱>信息(SMTP_ACCOUNT)') # if not SERVERCHAN_SCKEY: # logger.warning("您未正确配置<Server酱>的SCKEY") if not all([REDIS_SLAVER_DDT.get("host"), REDIS_SLAVER_DDT.get("password")]): logger.warning('您未正确配置<Redis-Slave> 本项目资源拷贝功能无法使用,但不影响系统正常运行。') if not all([REDIS_MASTER.get("host"), REDIS_MASTER.get("password")]): logger.error("您未正确配置<Redis-Master> 此配置为“云彩姬”的核心组件,请配置后重启项目!") sys.exit() # 当需要调用的接口涉及到driver操作时抛出 if call_driver and not os.path.exists(CHROMEDRIVER_PATH): logger.error(chromedriver_not_found_error) sys.exit() def run(self): try: if [cq for cq in reversed(self.root) if not os.path.exists(cq)]: logger.warning('系统文件残缺!') logger.debug("启动<工程重构>模块...") self.set_up_file_tree(self.root) self.check_config() finally: if self.flag: logger.success(">>> 运行环境链接完成,请重启项目") logger.warning(">>> 提醒您正确配置Chrome及对应版本的ChromeDriver") sys.exit() _ConfigQuarantine().run() class _ScaffoldGuider: # __slots__ = list(command_set.keys()) def __init__(self): # 脚手架公开接口 self.scaffold_ruler = [i for i in self.__dir__() if i.startswith('_scaffold_')] self.command2solution = { 'deploy': self._scaffold_deploy, 'decouple': self._scaffold_decouple, 'overdue': self._scaffold_overdue, 'spawn': self._scaffold_spawn, # 'run': self._scaffold_run, # 'force_run': self._scaffold_force_run, 'remain': self._scaffold_remain, 'ping': self._scaffold_ping, 'panel': self._scaffold_panel, 'entropy': self._scaffold_entropy, 'ash': self._scaffold_ash, 'mining': self._scaffold_mining, } def startup(self, driver_command_set: List[str]): """ 仅支持单进程使用 @param driver_command_set: 在空指令时列表仅有1个元素,表示启动路径 @return: """ # logger.info(f">>> {' '.join(driver_command_set)}") # ------------------------------- # TODO 优先级0:预处理指令集 # ------------------------------- # CommandId or List[CommandId] driver_command: List[str] = [] # 未输入任何指令 列出脚手架简介 if len(driver_command_set) == 1: print("\n".join([f">>> {menu[0].ljust(20, '-')}|| {menu[-1]}" for menu in command_set.items()])) return True # 输入立即指令 转译指令 if len(driver_command_set) == 2: driver_command = [driver_command_set[-1].lower(), ] # 输入指令集 转译指令集 elif len(driver_command_set) > 2: driver_command = list({command.lower() for command in driver_command_set[1:]}) # 捕获意料之外的情况 if not isinstance(driver_command, list): return True # ------------------------------- # TODO 优先级1:解析运行参数 # ------------------------------- # TODO --help 帮助菜单(继续完善相关功能) # 使用该参数时系统不解析运行指令 if '--help' in driver_command: logger.info(">>>GuiderHelp || 帮助菜单") driver_command.remove("--help") for command_ in driver_command: introduction = command_set.get(command_) if introduction: print(f"> {command_.ljust(20, '-')}|| {introduction}") else: print(f"> {command_}指令不存在") return True # 智能采集 解析目标 if '--parse' in driver_command: driver_command.remove('--parse') task_list = [] for url_ in reversed(driver_command): if url_.startswith("http") or url_.startswith("ssr") or url_.startswith("vmess"): task_list.append(gevent.spawn(self._scaffold_parse, url=url_)) gevent.joinall(task_list) return True # 清除系统缓存 if 'clear' in driver_command: driver_command.remove('clear') self._scaffold_clear() return True # ------------------------------- # TODO 优先级2:运行单线程指令 # ------------------------------- # 协程任务队列 task_list = [] # 测试数据库连接 while driver_command.__len__() > 0: _pending_command = driver_command.pop() try: task_list.append(gevent.spawn(self.command2solution[_pending_command])) except KeyError as e: logger.warning(f'脚手架暂未授权指令<{_pending_command}> {e}') # 并发执行以上指令 gevent.joinall(task_list) # ------------------------------- # TODO 优先级3:自定义参数部署(阻塞线程) # ------------------------------- if 'deploy' in driver_command: self._scaffold_deploy() @staticmethod def _scaffold_deploy(): # logger.info("<ScaffoldGuider> Deploy || MainProcess") from src.BusinessCentralLayer.middleware.interface_io import SystemInterface SystemInterface.run(deploy_=True) @staticmethod def _scaffold_clear(): _permission = { "logs": input(terminal_echo("是否清除所有运行日志[y]?", 2)), "cache": input(terminal_echo("是否清除所有运行缓存[y]?", 2)) } # 清除日志 ~/database/logs if os.path.exists(SERVER_DIR_DATABASE_LOG) and _permission['logs'].startswith("y"): history_logs = os.listdir(SERVER_DIR_DATABASE_LOG) for _log_file in history_logs: if len(_log_file.split('.')) > 2: _log_path = os.path.join(SERVER_DIR_DATABASE_LOG, _log_file) os.remove(_log_path) terminal_echo(f"清除运行日志-->{_log_path}", 3) # 清除运行缓存 ~/database/ if _permission['cache'].startswith("y"): cache_blocks = { # ~/database/temp_cache/ SERVER_DIR_DATABASE_CACHE, # ~/database/staff_hosts/ SERVER_DIR_SSPANEL_MINING, } for block in cache_blocks: # 扫描文件 if os.path.exists(block): _files = [os.path.join(block, i) for i in os.listdir(block)] # 清除文件 for _file in _files: if os.path.isfile(_file): os.remove(_file) else: shutil.rmtree(_file) os.mkdir(_file) terminal_echo(f"清除运行缓存-->{_file}", 3) terminal_echo("系统缓存文件清理完毕", 1) @staticmethod def _scaffold_decouple(): logger.info("<ScaffoldGuider> Decouple || General startup") from src.BusinessLogicLayer.plugins.accelerator import SubscribesCleaner SubscribesCleaner(debug=True).interface(power=DEFAULT_POWER) @staticmethod def _scaffold_overdue(): logger.info("<ScaffoldGuider> Overdue || Redis DDT") from src.BusinessCentralLayer.middleware.interface_io import SystemInterface SystemInterface.ddt() @staticmethod def _scaffold_spawn(): _ConfigQuarantine.check_config(call_driver=True) logger.info("<ScaffoldGuider> Spawn || MainCollector") from src.BusinessLogicLayer.cluster.slavers import __entropy__ from src.BusinessLogicLayer.plugins.accelerator import booster booster(docker=__entropy__, silence=True, power=DEFAULT_POWER, assault=True) @staticmethod def _scaffold_run(): _ConfigQuarantine.check_config(call_driver=True) logger.info("<ScaffoldGuider> Run || MainCollector") from src.BusinessCentralLayer.middleware.interface_io import SystemInterface SystemInterface.run(deploy_=False) @staticmethod def _scaffold_force_run(): _ConfigQuarantine.check_config(call_driver=True) logger.info("<ScaffoldGuider> ForceRun || MainCollector") from src.BusinessLogicLayer.plugins.accelerator import ForceRunRelease ForceRunRelease(task_docker=CRAWLER_SEQUENCE).interface() @staticmethod def _scaffold_remain(): from src.BusinessCentralLayer.middleware.subscribe_io import select_subs_to_admin tracer = [f"{tag[0]}\n采集类型:{info_[0]}\n存活数量:{tag[-1]}" for info_ in select_subs_to_admin(select_netloc=None, _debug=False)['info'].items() for tag in info_[-1].items()] for i, tag in enumerate(tracer): print(f">>> [{i + 1}/{tracer.__len__()}]{tag}") @staticmethod def _scaffold_ping(): from src.BusinessCentralLayer.middleware.redis_io import RedisClient logger.info(f"<ScaffoldGuider> Ping || {RedisClient().test()}") @staticmethod def _scaffold_parse(url, _unused_mode: str = "subscribe"): logger.info(f">>> PARSE --> {url}") from src.BusinessLogicLayer.plugins.accelerator import cleaner # 检查路径完整性 if not os.path.exists(SERVER_DIR_DATABASE_CACHE): os.mkdir(SERVER_DIR_DATABASE_CACHE) # 调取API解析链接 result = cleaner.subs2node(url) if result and isinstance(result, dict): _, info, nodes = result.values() # 节点数量 减去无效的注释项 _unused_node_num = nodes.__len__() - 2 if nodes.__len__() - 2 >= 0 else 0 token_ = '' if info.get('token') is None else info.get('token') # 缓存数据 cache_sub2node = os.path.join(SERVER_DIR_DATABASE_CACHE, f'sub2node_{token_}.txt') with open(cache_sub2node, 'w', encoding="utf8") as f: for node in nodes: f.write(f"{node}\n") # 自动打开缓存文件,仅在parse一个链接时启用 # os.startfile(cache_sub2node) cleaner.node2detail(nodes[0]) else: return False @staticmethod def _scaffold_panel(): from src.BusinessCentralLayer.middleware.interface_io import SystemInterface SystemInterface.system_panel() @staticmethod def _scaffold_entropy(_debug=False): from src.BusinessLogicLayer.cluster.slavers import __entropy__ for i, host_ in enumerate(__entropy__): print(f">>> [{i + 1}/{__entropy__.__len__()}]{host_['name']}") print(f"注册链接: {host_['register_url']}") print(f"存活周期: {host_['life_cycle']}天") print(f"采集类型: {'&'.join([f'{j[0].lower()}' for j in host_['hyper_params'].items() if j[-1]])}\n") @staticmethod def _scaffold_exile(task_sequential=4): logger.debug(f"<ScaffoldGuider> Exile[0/{task_sequential}] || Running scaffold exile...") time.sleep(0.3) # task1: 检查队列任务 logger.debug(f"<ScaffoldGuider> Exile[1/{task_sequential}] || Checking the task queue...") time.sleep(0.3) _ScaffoldGuider._scaffold_entropy(_debug=True) # logger.success(f">>> [Mission Completed] || entropy") # task2: decouple logger.debug(f"<ScaffoldGuider> Exile[2/{task_sequential}] || Cleaning the subscribe pool...") time.sleep(0.3) _ScaffoldGuider._scaffold_decouple() # logger.success(f">>> [Mission Completed] || decouple") # task3: overdue logger.debug(f"<ScaffoldGuider> Exile[3/{task_sequential}] || Cleaning timed out subscribes...") time.sleep(0.3) _ScaffoldGuider._scaffold_overdue() # logger.success(">>> [Mission Completed] || overdue") # finally: print task-queue, remaining subscribes logger.debug(f"<ScaffoldGuider> Exile[{task_sequential}/{task_sequential}] || Outputting debug data...") _ScaffoldGuider._scaffold_entropy() _ScaffoldGuider._scaffold_remain() logger.success("<ScaffoldGuider> Exile[Mission Completed] || exile") @staticmethod @logger.catch() def _scaffold_ash(): """ 无尽套娃 """ from src.BusinessLogicLayer.apis import scaffold_api logger.info("<ScaffoldGuider> ash | Clash订阅堆一键生成脚本") # -------------------------------------------------- # 参数清洗 # -------------------------------------------------- if 'win' not in sys.platform: return # -------------------------------------------------- # 运行脚本 # -------------------------------------------------- return scaffold_api.ash(debug=True, decouple=True) @staticmethod def _scaffold_mining(): """ “国外”服务器:直接运行 大陆主机:开启代理后运行 :return: """ from src.BusinessLogicLayer.apis.staff_mining import staff_api use_collector = staff_api.is_first_run() classify_dir, staff_info = staff_api.go( debug=False, silence=True, power=os.cpu_count() * 2, identity_recaptcha=False, use_collector=use_collector, use_checker=True, use_generator=False, ) staff_api.refresh_cache(mode='de-dup') print(f"\n\nSTAFF INFO\n{'_' * 32}") for element in staff_info.items(): for i, tag in enumerate(element[-1]): print(f">>> [{i + 1}/{len(element[-1])}]{element[0]}: {tag}") print(f">>> 文件导出目录: {classify_dir}") scaffold = _ScaffoldGuider()
[((66, 84), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (82, 84), False, 'from gevent import monkey\n'), ((15864, 15878), 'src.BusinessCentralLayer.setting.logger.catch', 'logger.catch', ([], {}), '()\n', (15876, 15878), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((8684, 8709), 'gevent.joinall', 'gevent.joinall', (['task_list'], {}), '(task_list)\n', (8698, 8709), False, 'import gevent\n'), ((9108, 9141), 'src.BusinessCentralLayer.middleware.interface_io.SystemInterface.run', 'SystemInterface.run', ([], {'deploy_': '(True)'}), '(deploy_=True)\n', (9127, 9141), False, 'from src.BusinessCentralLayer.middleware.interface_io import SystemInterface\n'), ((10737, 10796), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['"""<ScaffoldGuider> Decouple || General startup"""'], {}), "('<ScaffoldGuider> Decouple || General startup')\n", (10748, 10796), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((11003, 11055), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['"""<ScaffoldGuider> Overdue || Redis DDT"""'], {}), "('<ScaffoldGuider> Overdue || Redis DDT')\n", (11014, 11055), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((11149, 11170), 'src.BusinessCentralLayer.middleware.interface_io.SystemInterface.ddt', 'SystemInterface.ddt', ([], {}), '()\n', (11168, 11170), False, 'from src.BusinessCentralLayer.middleware.interface_io import SystemInterface\n'), ((11282, 11336), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['"""<ScaffoldGuider> Spawn || MainCollector"""'], {}), "('<ScaffoldGuider> Spawn || MainCollector')\n", (11293, 11336), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((11487, 11563), 'src.BusinessLogicLayer.plugins.accelerator.booster', 'booster', ([], {'docker': '__entropy__', 'silence': '(True)', 'power': 'DEFAULT_POWER', 'assault': '(True)'}), '(docker=__entropy__, silence=True, power=DEFAULT_POWER, assault=True)\n', (11494, 11563), False, 'from src.BusinessLogicLayer.plugins.accelerator import booster\n'), ((11673, 11725), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['"""<ScaffoldGuider> Run || MainCollector"""'], {}), "('<ScaffoldGuider> Run || MainCollector')\n", (11684, 11725), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((11819, 11853), 'src.BusinessCentralLayer.middleware.interface_io.SystemInterface.run', 'SystemInterface.run', ([], {'deploy_': '(False)'}), '(deploy_=False)\n', (11838, 11853), False, 'from src.BusinessCentralLayer.middleware.interface_io import SystemInterface\n'), ((11969, 12026), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['"""<ScaffoldGuider> ForceRun || MainCollector"""'], {}), "('<ScaffoldGuider> ForceRun || MainCollector')\n", (11980, 12026), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((12889, 12924), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['f""">>> PARSE --> {url}"""'], {}), "(f'>>> PARSE --> {url}')\n", (12900, 12924), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((13159, 13181), 'src.BusinessLogicLayer.plugins.accelerator.cleaner.subs2node', 'cleaner.subs2node', (['url'], {}), '(url)\n', (13176, 13181), False, 'from src.BusinessLogicLayer.plugins.accelerator import cleaner\n'), ((14027, 14057), 'src.BusinessCentralLayer.middleware.interface_io.SystemInterface.system_panel', 'SystemInterface.system_panel', ([], {}), '()\n', (14055, 14057), False, 'from src.BusinessCentralLayer.middleware.interface_io import SystemInterface\n'), ((14597, 14696), 'src.BusinessCentralLayer.setting.logger.debug', 'logger.debug', (['f"""<ScaffoldGuider> Exile[0/{task_sequential}] || Running scaffold exile..."""'], {}), "(\n f'<ScaffoldGuider> Exile[0/{task_sequential}] || Running scaffold exile...'\n )\n", (14609, 14696), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((14695, 14710), 'time.sleep', 'time.sleep', (['(0.3)'], {}), '(0.3)\n', (14705, 14710), False, 'import time\n'), ((14744, 14844), 'src.BusinessCentralLayer.setting.logger.debug', 'logger.debug', (['f"""<ScaffoldGuider> Exile[1/{task_sequential}] || Checking the task queue..."""'], {}), "(\n f'<ScaffoldGuider> Exile[1/{task_sequential}] || Checking the task queue...'\n )\n", (14756, 14844), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((14843, 14858), 'time.sleep', 'time.sleep', (['(0.3)'], {}), '(0.3)\n', (14853, 14858), False, 'import time\n'), ((15013, 15117), 'src.BusinessCentralLayer.setting.logger.debug', 'logger.debug', (['f"""<ScaffoldGuider> Exile[2/{task_sequential}] || Cleaning the subscribe pool..."""'], {}), "(\n f'<ScaffoldGuider> Exile[2/{task_sequential}] || Cleaning the subscribe pool...'\n )\n", (15025, 15117), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((15116, 15131), 'time.sleep', 'time.sleep', (['(0.3)'], {}), '(0.3)\n', (15126, 15131), False, 'import time\n'), ((15276, 15382), 'src.BusinessCentralLayer.setting.logger.debug', 'logger.debug', (['f"""<ScaffoldGuider> Exile[3/{task_sequential}] || Cleaning timed out subscribes..."""'], {}), "(\n f'<ScaffoldGuider> Exile[3/{task_sequential}] || Cleaning timed out subscribes...'\n )\n", (15288, 15382), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((15381, 15396), 'time.sleep', 'time.sleep', (['(0.3)'], {}), '(0.3)\n', (15391, 15396), False, 'import time\n'), ((15571, 15685), 'src.BusinessCentralLayer.setting.logger.debug', 'logger.debug', (['f"""<ScaffoldGuider> Exile[{task_sequential}/{task_sequential}] || Outputting debug data..."""'], {}), "(\n f'<ScaffoldGuider> Exile[{task_sequential}/{task_sequential}] || Outputting debug data...'\n )\n", (15583, 15685), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((15771, 15839), 'src.BusinessCentralLayer.setting.logger.success', 'logger.success', (['"""<ScaffoldGuider> Exile[Mission Completed] || exile"""'], {}), "('<ScaffoldGuider> Exile[Mission Completed] || exile')\n", (15785, 15839), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((16010, 16062), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['"""<ScaffoldGuider> ash | Clash订阅堆一键生成脚本"""'], {}), "('<ScaffoldGuider> ash | Clash订阅堆一键生成脚本')\n", (16021, 16062), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((16411, 16454), 'src.BusinessLogicLayer.apis.scaffold_api.ash', 'scaffold_api.ash', ([], {'debug': '(True)', 'decouple': '(True)'}), '(debug=True, decouple=True)\n', (16427, 16454), False, 'from src.BusinessLogicLayer.apis import scaffold_api\n'), ((16680, 16704), 'src.BusinessLogicLayer.apis.staff_mining.staff_api.is_first_run', 'staff_api.is_first_run', ([], {}), '()\n', (16702, 16704), False, 'from src.BusinessLogicLayer.apis.staff_mining import staff_api\n'), ((17003, 17041), 'src.BusinessLogicLayer.apis.staff_mining.staff_api.refresh_cache', 'staff_api.refresh_cache', ([], {'mode': '"""de-dup"""'}), "(mode='de-dup')\n", (17026, 17041), False, 'from src.BusinessLogicLayer.apis.staff_mining import staff_api\n'), ((4290, 4353), 'src.BusinessCentralLayer.setting.logger.warning', 'logger.warning', (['"""您未正确配置<Redis-Slave> 本项目资源拷贝功能无法使用,但不影响系统正常运行。"""'], {}), "('您未正确配置<Redis-Slave> 本项目资源拷贝功能无法使用,但不影响系统正常运行。')\n", (4304, 4353), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((4444, 4505), 'src.BusinessCentralLayer.setting.logger.error', 'logger.error', (['"""您未正确配置<Redis-Master> 此配置为“云彩姬”的核心组件,请配置后重启项目!"""'], {}), "('您未正确配置<Redis-Master> 此配置为“云彩姬”的核心组件,请配置后重启项目!')\n", (4456, 4505), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((4518, 4528), 'sys.exit', 'sys.exit', ([], {}), '()\n', (4526, 4528), False, 'import sys\n'), ((4641, 4683), 'src.BusinessCentralLayer.setting.logger.error', 'logger.error', (['chromedriver_not_found_error'], {}), '(chromedriver_not_found_error)\n', (4653, 4683), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((4696, 4706), 'sys.exit', 'sys.exit', ([], {}), '()\n', (4704, 4706), False, 'import sys\n'), ((7212, 7248), 'src.BusinessCentralLayer.setting.logger.info', 'logger.info', (['""">>>GuiderHelp || 帮助菜单"""'], {}), "('>>>GuiderHelp || 帮助菜单')\n", (7223, 7248), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((7972, 7997), 'gevent.joinall', 'gevent.joinall', (['task_list'], {}), '(task_list)\n', (7986, 7997), False, 'import gevent\n'), ((9391, 9430), 'os.path.exists', 'os.path.exists', (['SERVER_DIR_DATABASE_LOG'], {}), '(SERVER_DIR_DATABASE_LOG)\n', (9405, 9430), False, 'import os\n'), ((9499, 9534), 'os.listdir', 'os.listdir', (['SERVER_DIR_DATABASE_LOG'], {}), '(SERVER_DIR_DATABASE_LOG)\n', (9509, 9534), False, 'import os\n'), ((10649, 10679), 'src.BusinessCentralLayer.setting.terminal_echo', 'terminal_echo', (['"""系统缓存文件清理完毕"""', '(1)'], {}), "('系统缓存文件清理完毕', 1)\n", (10662, 10679), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((13030, 13071), 'os.path.exists', 'os.path.exists', (['SERVER_DIR_DATABASE_CACHE'], {}), '(SERVER_DIR_DATABASE_CACHE)\n', (13044, 13071), False, 'import os\n'), ((13085, 13120), 'os.mkdir', 'os.mkdir', (['SERVER_DIR_DATABASE_CACHE'], {}), '(SERVER_DIR_DATABASE_CACHE)\n', (13093, 13120), False, 'import os\n'), ((13515, 13580), 'os.path.join', 'os.path.join', (['SERVER_DIR_DATABASE_CACHE', 'f"""sub2node_{token_}.txt"""'], {}), "(SERVER_DIR_DATABASE_CACHE, f'sub2node_{token_}.txt')\n", (13527, 13580), False, 'import os\n'), ((13818, 13847), 'src.BusinessLogicLayer.plugins.accelerator.cleaner.node2detail', 'cleaner.node2detail', (['nodes[0]'], {}), '(nodes[0])\n', (13837, 13847), False, 'from src.BusinessLogicLayer.plugins.accelerator import cleaner\n'), ((2774, 2796), 'os.path.exists', 'os.path.exists', (['child_'], {}), '(child_)\n', (2788, 2796), False, 'import os\n'), ((4594, 4627), 'os.path.exists', 'os.path.exists', (['CHROMEDRIVER_PATH'], {}), '(CHROMEDRIVER_PATH)\n', (4608, 4627), False, 'import os\n'), ((4833, 4858), 'src.BusinessCentralLayer.setting.logger.warning', 'logger.warning', (['"""系统文件残缺!"""'], {}), "('系统文件残缺!')\n", (4847, 4858), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((4875, 4904), 'src.BusinessCentralLayer.setting.logger.debug', 'logger.debug', (['"""启动<工程重构>模块..."""'], {}), "('启动<工程重构>模块...')\n", (4887, 4904), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((5046, 5082), 'src.BusinessCentralLayer.setting.logger.success', 'logger.success', (['""">>> 运行环境链接完成,请重启项目"""'], {}), "('>>> 运行环境链接完成,请重启项目')\n", (5060, 5082), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((5099, 5152), 'src.BusinessCentralLayer.setting.logger.warning', 'logger.warning', (['""">>> 提醒您正确配置Chrome及对应版本的ChromeDriver"""'], {}), "('>>> 提醒您正确配置Chrome及对应版本的ChromeDriver')\n", (5113, 5152), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((5169, 5179), 'sys.exit', 'sys.exit', ([], {}), '()\n', (5177, 5179), False, 'import sys\n'), ((9238, 9272), 'src.BusinessCentralLayer.setting.terminal_echo', 'terminal_echo', (['"""是否清除所有运行日志[y]?"""', '(2)'], {}), "('是否清除所有运行日志[y]?', 2)\n", (9251, 9272), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((9302, 9336), 'src.BusinessCentralLayer.setting.terminal_echo', 'terminal_echo', (['"""是否清除所有运行缓存[y]?"""', '(2)'], {}), "('是否清除所有运行缓存[y]?', 2)\n", (9315, 9336), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((10185, 10206), 'os.path.exists', 'os.path.exists', (['block'], {}), '(block)\n', (10199, 10206), False, 'import os\n'), ((10886, 10915), 'src.BusinessLogicLayer.plugins.accelerator.SubscribesCleaner', 'SubscribesCleaner', ([], {'debug': '(True)'}), '(debug=True)\n', (10903, 10915), False, 'from src.BusinessLogicLayer.plugins.accelerator import SubscribesCleaner\n'), ((12114, 12159), 'src.BusinessLogicLayer.plugins.accelerator.ForceRunRelease', 'ForceRunRelease', ([], {'task_docker': 'CRAWLER_SEQUENCE'}), '(task_docker=CRAWLER_SEQUENCE)\n', (12129, 12159), False, 'from src.BusinessLogicLayer.plugins.accelerator import ForceRunRelease\n'), ((4212, 4240), 'src.BusinessCentralLayer.setting.REDIS_SLAVER_DDT.get', 'REDIS_SLAVER_DDT.get', (['"""host"""'], {}), "('host')\n", (4232, 4240), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((4242, 4274), 'src.BusinessCentralLayer.setting.REDIS_SLAVER_DDT.get', 'REDIS_SLAVER_DDT.get', (['"""password"""'], {}), "('password')\n", (4262, 4274), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((4374, 4398), 'src.BusinessCentralLayer.setting.REDIS_MASTER.get', 'REDIS_MASTER.get', (['"""host"""'], {}), "('host')\n", (4390, 4398), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((4400, 4428), 'src.BusinessCentralLayer.setting.REDIS_MASTER.get', 'REDIS_MASTER.get', (['"""password"""'], {}), "('password')\n", (4416, 4428), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((8498, 8551), 'gevent.spawn', 'gevent.spawn', (['self.command2solution[_pending_command]'], {}), '(self.command2solution[_pending_command])\n', (8510, 8551), False, 'import gevent\n'), ((8603, 8655), 'src.BusinessCentralLayer.setting.logger.warning', 'logger.warning', (['f"""脚手架暂未授权指令<{_pending_command}> {e}"""'], {}), "(f'脚手架暂未授权指令<{_pending_command}> {e}')\n", (8617, 8655), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((9660, 9708), 'os.path.join', 'os.path.join', (['SERVER_DIR_DATABASE_LOG', '_log_file'], {}), '(SERVER_DIR_DATABASE_LOG, _log_file)\n', (9672, 9708), False, 'import os\n'), ((9729, 9749), 'os.remove', 'os.remove', (['_log_path'], {}), '(_log_path)\n', (9738, 9749), False, 'import os\n'), ((9770, 9811), 'src.BusinessCentralLayer.setting.terminal_echo', 'terminal_echo', (['f"""清除运行日志-->{_log_path}"""', '(3)'], {}), "(f'清除运行日志-->{_log_path}', 3)\n", (9783, 9811), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((16823, 16837), 'os.cpu_count', 'os.cpu_count', ([], {}), '()\n', (16835, 16837), False, 'import os\n'), ((2904, 2925), 'os.path.isdir', 'os.path.isdir', (['child_'], {}), '(child_)\n', (2917, 2925), False, 'import os\n'), ((2987, 3003), 'os.mkdir', 'os.mkdir', (['child_'], {}), '(child_)\n', (2995, 3003), False, 'import os\n'), ((3028, 3065), 'src.BusinessCentralLayer.setting.logger.success', 'logger.success', (['f"""系统文件链接成功->{child_}"""'], {}), "(f'系统文件链接成功->{child_}')\n", (3042, 3065), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((3646, 3666), 'src.BusinessCentralLayer.setting.logger.exception', 'logger.exception', (['ep'], {}), '(ep)\n', (3662, 3666), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((4796, 4814), 'os.path.exists', 'os.path.exists', (['cq'], {}), '(cq)\n', (4810, 4814), False, 'import os\n'), ((7914, 7958), 'gevent.spawn', 'gevent.spawn', (['self._scaffold_parse'], {'url': 'url_'}), '(self._scaffold_parse, url=url_)\n', (7926, 7958), False, 'import gevent\n'), ((10238, 10260), 'os.path.join', 'os.path.join', (['block', 'i'], {}), '(block, i)\n', (10250, 10260), False, 'import os\n'), ((10384, 10405), 'os.path.isfile', 'os.path.isfile', (['_file'], {}), '(_file)\n', (10398, 10405), False, 'import os\n'), ((10599, 10636), 'src.BusinessCentralLayer.setting.terminal_echo', 'terminal_echo', (['f"""清除运行缓存-->{_file}"""', '(3)'], {}), "(f'清除运行缓存-->{_file}', 3)\n", (10612, 10636), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((14271, 14292), 'src.BusinessLogicLayer.cluster.slavers.__entropy__.__len__', '__entropy__.__len__', ([], {}), '()\n', (14290, 14292), False, 'from src.BusinessLogicLayer.cluster.slavers import __entropy__\n'), ((10270, 10287), 'os.listdir', 'os.listdir', (['block'], {}), '(block)\n', (10280, 10287), False, 'import os\n'), ((10435, 10451), 'os.remove', 'os.remove', (['_file'], {}), '(_file)\n', (10444, 10451), False, 'import os\n'), ((10510, 10530), 'shutil.rmtree', 'shutil.rmtree', (['_file'], {}), '(_file)\n', (10523, 10530), False, 'import shutil\n'), ((10559, 10574), 'os.mkdir', 'os.mkdir', (['_file'], {}), '(_file)\n', (10567, 10574), False, 'import os\n'), ((12403, 12457), 'src.BusinessCentralLayer.middleware.subscribe_io.select_subs_to_admin', 'select_subs_to_admin', ([], {'select_netloc': 'None', '_debug': '(False)'}), '(select_netloc=None, _debug=False)\n', (12423, 12457), False, 'from src.BusinessCentralLayer.middleware.subscribe_io import select_subs_to_admin\n'), ((12775, 12788), 'src.BusinessCentralLayer.middleware.redis_io.RedisClient', 'RedisClient', ([], {}), '()\n', (12786, 12788), False, 'from src.BusinessCentralLayer.middleware.redis_io import RedisClient\n'), ((2933, 2957), 'os.path.splitext', 'os.path.splitext', (['child_'], {}), '(child_)\n', (2949, 2957), False, 'import os\n'), ((3421, 3458), 'src.BusinessCentralLayer.setting.logger.success', 'logger.success', (['f"""系统文件链接成功->{child_}"""'], {}), "(f'系统文件链接成功->{child_}')\n", (3435, 3458), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((3543, 3585), 'src.BusinessCentralLayer.setting.logger.exception', 'logger.exception', (['f"""Exception{child_}{ep}"""'], {}), "(f'Exception{child_}{ep}')\n", (3559, 3585), False, 'from src.BusinessCentralLayer.setting import logger, DEFAULT_POWER, CHROMEDRIVER_PATH, REDIS_MASTER, SERVER_DIR_DATABASE_CACHE, SERVER_DIR_CLIENT_DEPORT, SERVER_PATH_DEPOT_VCS, SERVER_DIR_CACHE_BGPIC, REDIS_SLAVER_DDT, CRAWLER_SEQUENCE, terminal_echo, SERVER_DIR_DATABASE_LOG, SERVER_DIR_SSPANEL_MINING\n'), ((3342, 3357), 'csv.writer', 'csv.writer', (['fpx'], {}), '(fpx)\n', (3352, 3357), False, 'import csv\n')]
daniestevez/gr-csp
python/swap_header.py
0a10e4d2e5cf4a51256e5dc72aa42f8d3d54c232
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright 2016 Daniel Estevez <daniel@destevez.net>. # # This is free and unencumbered software released into the public domain. # # Anyone is free to copy, modify, publish, use, compile, sell, or # distribute this software, either in source code form or as a compiled # binary, for any purpose, commercial or non-commercial, and by any # means. # # In jurisdictions that recognize copyright laws, the author or authors # of this software dedicate any and all copyright interest in the # software to the public domain. We make this dedication for the benefit # of the public at large and to the detriment of our heirs and # successors. We intend this dedication to be an overt act of # relinquishment in perpetuity of all present and future rights to this # software under copyright law. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR # OTHER DEALINGS IN THE SOFTWARE. # # For more information, please refer to <http://unlicense.org> # import numpy from gnuradio import gr import pmt import array class swap_header(gr.basic_block): """ docstring for block swap_header """ def __init__(self): gr.basic_block.__init__(self, name="swap_crc", in_sig=[], out_sig=[]) self.message_port_register_in(pmt.intern('in')) self.set_msg_handler(pmt.intern('in'), self.handle_msg) self.message_port_register_out(pmt.intern('out')) def handle_msg(self, msg_pmt): msg = pmt.cdr(msg_pmt) if not pmt.is_u8vector(msg): print "[ERROR] Received invalid message type. Expected u8vector" return packet = array.array("B", pmt.u8vector_elements(msg)) header = packet[:4] header.reverse() packet = header + packet[4:] msg_pmt = pmt.cons(pmt.PMT_NIL, pmt.init_u8vector(len(packet), bytearray(packet))) self.message_port_pub(pmt.intern('out'), msg_pmt)
[]
gleenn/dfplayer
start.py
dd390a6f54b3bd8b2a3397fddd6caacfba01b29d
#!/usr/bin/python # # Start dfplayer. import argparse import os import shutil import subprocess import sys import time _PROJ_DIR = os.path.dirname(__file__) def main(): os.chdir(_PROJ_DIR) os.environ['LD_LIBRARY_PATH'] = '/lib:/usr/lib:/usr/local/lib' arg_parser = argparse.ArgumentParser(description='Start player') arg_parser.add_argument('--gdb', action='store_true') arg_parser.add_argument('--no-reset', action='store_true') arg_parser.add_argument('--disable-net', action='store_true') arg_parser.add_argument('--mpd', action='store_true') arg_parser.add_argument('--disable-fin', action='store_true') arg_parser.add_argument('--max', action='store_true') arg_parser.add_argument('--no-sound', action='store_true') arg_parser.add_argument('--no-sound-config', action='store_true') arg_parser.add_argument('--prod', action='store_true') arg_parser.add_argument('--enable-kinect', action='store_true') args = arg_parser.parse_args() if args.prod: print 'dfplayer is sleeping for 30 seconds before startup' time.sleep(30) if not args.no_sound_config and not args.no_sound: shutil.copyfile( 'dfplayer/asoundrc.sample', '/home/' + os.getlogin() + '/.asoundrc') params = ['env/bin/dfplayer', '--listen=0.0.0.0:8081'] if args.no_reset: params.append('--no-reset') if args.no_sound: params.append('--no-sound') if args.disable_net: params.append('--disable-net') if args.disable_fin: params.append('--disable-fin') if args.enable_kinect or args.prod: params.append('--enable-kinect') if args.mpd: params.append('--mpd') if args.max or args.prod: params.append('--max') try: if args.gdb: subprocess.check_call( ['gdb', '-ex', 'run', '--args', 'env/bin/python'] + params) #['gdb', '--args', 'env/bin/python'] + params) else: subprocess.check_call(params) except KeyboardInterrupt: print 'Player is exiting via KeyboardInterrupt' except Exception, err: print sys.exc_info()[0] if args.prod: print 'dfplayer has exited and start.py script is now sleeping' time.sleep(3600) main()
[]
Finnder/Console-Based-Story-Game
Game_Mechanics.py
fe5341faf82783880872560d43d286e917f5e3d7
def attack(): pass def defend(): pass def pass_turn(): pass def use_ability_One(kit): pass def use_ability_Two(kit): pass def end_Of_Battle(): pass
[]
Pougnator/Prometheus
AIY/voice/cloudspeech_demo.py
d7c59f3a97b4f60958f130741ccc16b81d65f505
#!/usr/bin/env python3 # Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """A demo of the Google CloudSpeech recognizer.""" import aiy.audio import aiy.cloudspeech import aiy.voicehat import aiy.i18n import aiy.audio CONFIRM_SOUND_PATH = '/home/pi/Music/R2D2/R2_Understood.wav' CONFUSED_SOUND_PATH = '/home/pi/Music/R2D2/R2_Confused.wav' UNRECOGNISED_SOUND_PATH = '/home/pi/Music/R2D2/R2_FastBip.wav' def main(): status_ui = aiy.voicehat.get_status_ui() status_ui.status('starting') aiy.i18n.set_language_code("fr-FR") recognizer = aiy.cloudspeech.get_recognizer() recognizer.expect_phrase('allumer le feu') recognizer.expect_phrase('éteindre') recognizer.expect_phrase('clignotter') recognizer.expect_phrase('cuir') recognizer.expect_phrase('R2') button = aiy.voicehat.get_button() led = aiy.voicehat.get_led() aiy.audio.get_recorder().start() while True: status_ui.status('ready') print('Press the button and speak') button.wait_for_press() aiy.voicehat.get_status_ui().set_trigger_sound_wave('/home/pi/Music/R2D2/hotword.wav') status_ui.status('listening') WaitingForHotword = True while WaitingForHotword == True: print('Say the hotword to start') hotword = recognizer.recognize() if not hotword: print('I recognised nothing ... looping') else: if ('R2') in hotword: WaitingForHotword = False print('Playing a test sound...') aiy.audio.play_wave(CONFIRM_SOUND_PATH) print('Listening...') text = recognizer.recognize() if not text: print('Sorry, I did not hear you.') aiy.audio.play_wave(CONFUSED_SOUND_PATH) else: WaitingForHotword = True print('You said "', text, '"') if 'allumer le feu' in text: led.set_state(aiy.voicehat.LED.ON) elif 'éteindre' in text: led.set_state(aiy.voicehat.LED.OFF) elif 'clignotter' in text: led.set_state(aiy.voicehat.LED.BLINK) elif 'cuir' in text: # led.set_state(aiy.voicehat.LED.BLINK) aiy.audio.say('cuir cuir cuir moustache') elif 'goodbye' in text: break else: aiy.audio.play_wave(UNRECOGNISED_SOUND_PATH) else: print('Hotword not detected .... looping') if __name__ == '__main__': main()
[]
lime-j/YTMT-Strategy-1
options/base_option.py
aacc38c4e61b91e187cac81aa95500e0422d4d0f
import argparse import models model_names = sorted(name for name in models.__dict__ if name.islower() and not name.startswith("__") and callable(models.__dict__[name])) class BaseOptions(): def __init__(self): self.parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) self.initialized = False def initialize(self): # experiment specifics self.parser.add_argument('--name', type=str, default=None, help='name of the experiment. It decides where to store samples and models') self.parser.add_argument('--gpu_ids', type=str, default='0', help='gpu ids: e.g. 0 0,1,2, 0,2. use -1 for CPU') self.parser.add_argument('--model', type=str, default='errnet_model', help='chooses which model to use.') self.parser.add_argument('--checkpoints_dir', type=str, default='./checkpoints', help='models are saved here') self.parser.add_argument('--resume', '-r', action='store_true', help='resume from checkpoint') self.parser.add_argument('--resume_epoch', '-re', type=int, default=None, help='checkpoint to use. (default: latest') self.parser.add_argument('--seed', type=int, default=2018, help='random seed to use. Default=2018') self.parser.add_argument('--supp_eval', action='store_true', help='supplementary evaluation') self.parser.add_argument('--start_now', action='store_true', help='supplementary evaluation') self.parser.add_argument('--testr', action='store_true', help='test for reflections') self.parser.add_argument('--select', type=str, default=None) # for setting input self.parser.add_argument('--serial_batches', action='store_true', help='if true, takes images in order to make batches, otherwise takes them randomly') self.parser.add_argument('--nThreads', default=8, type=int, help='# threads for loading data') self.parser.add_argument('--max_dataset_size', type=int, default=None, help='Maximum number of samples allowed per dataset. If the dataset directory contains more than max_dataset_size, only a subset is loaded.') # for display self.parser.add_argument('--no-log', action='store_true', help='disable tf logger?') self.parser.add_argument('--no-verbose', action='store_true', help='disable verbose info?') self.parser.add_argument('--display_winsize', type=int, default=256, help='display window size') self.parser.add_argument('--display_port', type=int, default=8097, help='visdom port of the web display') self.parser.add_argument('--display_id', type=int, default=0, help='window id of the web display (use 0 to disable visdom)') self.parser.add_argument('--display_single_pane_ncols', type=int, default=0, help='if positive, display all images in a single visdom web panel with certain number of images per row.') self.initialized = True
[((281, 360), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), '(formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n', (304, 360), False, 'import argparse\n')]
JanhaviSoni/Book-Recommendation-Analysis
bookstore/__init__.py
d2697e1f2eb9b9b4e0bafc0dd43d486ceb3d1707
from flask import Flask, Response from flask_basicauth import BasicAuth from flask_cors import CORS, cross_origin import os #from flask_admin import Admin,AdminIndexView #from flask_admin.contrib.sqla import ModelView from flask_sqlalchemy import SQLAlchemy as _BaseSQLAlchemy from flask_migrate import Migrate, MigrateCommand from flask_script import Manager from werkzeug.exceptions import HTTPException from flask_login import LoginManager from itsdangerous import URLSafeSerializer # import psycopg2 # import pymysql # import logging # import warnings # warnings.filterwarnings("ignore") # Initializing Flask App app = Flask(__name__) app.secret_key="Vampire" # This video demonstrates why we use CORS in our Flask App - https://www.youtube.com/watch?v=vWl5XcvQBx0 CORS(app) app.config.from_object("config.DevelopmentConfig") class SQLAlchemy(_BaseSQLAlchemy): """ This class is defined so that we can set "pool_pre_ping" to True. pool_pre_ping is a boolean flag, which when set to True, will enable the connection pool 'pre-ping' feature that tests connections for liveness upon each checkout. This prevents from dropping of database connection with our app. This class inherits the original SQLAlchemy class, and nothing else is changed except pool_pre_ping flag https://docs.sqlalchemy.org/en/13/core/pooling.html#dealing-with-disconnects https://github.com/pallets/flask-sqlalchemy/issues/589 """ def apply_pool_defaults(self, app, options): super(SQLAlchemy, self).apply_pool_defaults(app, options) options["pool_pre_ping"] = True # Creating and Initializing db object of SQLAlchemy class db = SQLAlchemy(app) db.init_app(app) migrate = Migrate(app, db, render_as_batch=True) with app.app_context(): if db.engine.url.drivername == 'sqlite': migrate.init_app(app, db, render_as_batch=True) else: migrate.init_app(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) # Creating serializer object of URLSafeSerializer class for serializing session_token serializer = URLSafeSerializer(app.secret_key) # Here we set session_token as our user_loader. from bookstore.client.views import client from bookstore.admin.views import admin app.register_blueprint(client) app.register_blueprint(admin)
[((631, 646), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (636, 646), False, 'from flask import Flask, Response\n'), ((781, 790), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (785, 790), False, 'from flask_cors import CORS, cross_origin\n'), ((1685, 1723), 'flask_migrate.Migrate', 'Migrate', (['app', 'db'], {'render_as_batch': '(True)'}), '(app, db, render_as_batch=True)\n', (1692, 1723), False, 'from flask_migrate import Migrate, MigrateCommand\n'), ((1887, 1899), 'flask_script.Manager', 'Manager', (['app'], {}), '(app)\n', (1894, 1899), False, 'from flask_script import Manager\n'), ((2046, 2079), 'itsdangerous.URLSafeSerializer', 'URLSafeSerializer', (['app.secret_key'], {}), '(app.secret_key)\n', (2063, 2079), False, 'from itsdangerous import URLSafeSerializer\n')]
Bibiko/CoBL-public
cobl/lexicon/management/commands/stats236.py
5092a0d01b7a13565c7da6bf2f6c52d648a2debe
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.management import BaseCommand from cobl.lexicon.models import LanguageList, \ MeaningList, \ Meaning, \ Lexeme, \ CognateClass, \ CognateJudgement, \ LanguageClade, \ Clade class Command(BaseCommand): help = "Computes statistics for https://github.com/lingdb/CoBL/issues/236"\ "\nPossible parameters are: {1, 2, 3} for task number." def add_arguments(self, parser): parser.add_argument('task', type=int) missing_args_message = "Please provide a task number of {1,2,3}." def handle(self, *args, **options): # Data to work with: current = LanguageList.objects.get(name='Current') jena200 = MeaningList.objects.get(name='Jena200') languageIds = set(current.languages.values_list('id', flat=True)) meaningIds = jena200.meanings.values_list('id', flat=True) lexemeIds = Lexeme.objects.filter( language_id__in=languageIds, meaning_id__in=meaningIds).values_list('id', flat=True) cognateClassIds = CognateJudgement.objects.filter( lexeme_id__in=lexemeIds).values_list( 'cognate_class_id', flat=True) cognateClasses = CognateClass.objects.filter( id__in=cognateClassIds, root_form='').all() # Only without root_form is wanted. if options['task'] == 1: self.stdout.write('Task 1') self.report(self.compute(2, cognateClasses, meaningIds, languageIds), meaningIds) elif options['task'] == 2: self.stdout.write('Task 2') task1 = self.compute(2, cognateClasses, meaningIds, languageIds) task1CCIds = set([c.id for c in task1 if c is not None]) self.report([c for c in self.compute( 1, cognateClasses, meaningIds, languageIds) if c is not None and c.id not in task1CCIds], meaningIds) elif options['task'] == 3: self.stdout.write('Task 3') unwantedCognateClassIds = set( [c.id for c in self.compute(1, cognateClasses, meaningIds, languageIds) if c is not None]) cIdcladeMap = {c.id: c for c in Clade.objects.exclude( cladeLevel0=0).all()} # Computing ._cognateClasses for each clade: for _, clade in cIdcladeMap.items(): inCladeLanguageIds = set(LanguageClade.objects.filter( clade=clade).values_list('language_id', flat=True)) lexemes = Lexeme.objects.filter( language_id__in=languageIds & inCladeLanguageIds, meaning_id__in=meaningIds, not_swadesh_term=False).all() cognateClassIds = set(CognateJudgement.objects.filter( lexeme__in=lexemes).values_list( 'cognate_class_id', flat=True)) clade._cognateClassIds = set(CognateClass.objects.filter( id__in=cognateClassIds - unwantedCognateClassIds, root_form='').order_by('id').values_list('id', flat=True)) # Removing cognate class IDs we don't want: for _, clade in cIdcladeMap.items(): cogIdCounts = {cId: 0 for cId in clade._cognateClassIds} childIds = clade.queryChildren().values_list('id', flat=True) for childId in childIds: child = cIdcladeMap[childId] for cId in child._cognateClassIds: if cId in cogIdCounts: cogIdCounts[cId] += 1 # Setting ._cognateClassIds for current clade: clade._cognateClassIds = set([cId for cId, count in cogIdCounts.items() if count != 1]) # Updating children: for childId in childIds: child = cIdcladeMap[childId] child._cognateClassIds = child._cognateClassIds & \ set([cId for cId, count in cogIdCounts.items() if count == 1]) # Creating .txt files: for _, clade in cIdcladeMap.items(): # Grouping by meaning: meaningMarkdowns = {} for c in clade._cognateClassIds: s = '- [ ] cog. class '\ '[%s](http://cobl.info/cognate/%s/)' % (c, c) meanings = Meaning.objects.filter( lexeme__cognate_class=c, lexeme__language_id__in=languageIds, lexeme__not_swadesh_term=False, id__in=meaningIds).distinct().all() s += ''.join([ ' = meaning [%s](http://cobl.info/meaning/%s/)' % (m.gloss, m.gloss) for m in meanings]) for m in meanings: if m.gloss not in meaningMarkdowns: meaningMarkdowns[m.gloss] = [] meaningMarkdowns[m.gloss].append(s) # Composing markdown: markdown = [] for k in sorted(meaningMarkdowns.keys()): markdown += meaningMarkdowns[k] # Writing if content: if len(markdown) > 0: fname = '/tmp/%s.txt' % clade.taxonsetName self.stdout.write("Writing file '%s'." % fname) with open(fname, 'w') as f: f.write("\n".join(markdown)+"\n") def compute(self, lowerBranchBound, cognateClasses, meaningIds, languageIds): # The computation we want to perform twice for cognateClass in cognateClasses: lexemeIds = CognateJudgement.objects.filter( cognate_class_id=cognateClass.id).values_list( 'lexeme_id', flat=True) # Need to investigate lexemes: cladeNamesSet = set() for lexeme in Lexeme.objects.filter( id__in=lexemeIds, language_id__in=languageIds, meaning_id__in=meaningIds).all(): # Need to investigate clades: clades = Clade.objects.filter( id__in=LanguageClade.objects.filter( language_id=lexeme.language_id, language_id__in=languageIds).values_list( 'clade_id', flat=True), cladeLevel1=0).exclude( cladeLevel0=0 # Ignore PIE ).all() if len(clades) > 0: cladeNamesSet.add(', '.join([ c.cladeName for c in clades])) # Yield interesting clades: if len(cladeNamesSet) > lowerBranchBound: cognateClass.bNames = ', '.join('"%s"' % n for n in cladeNamesSet) yield(cognateClass) yield(None) # EOG def report(self, cognateClasses, meaningIds): # Print given cognateClasses: for cognateClass in cognateClasses: if cognateClass is None: continue lexemeIds = CognateJudgement.objects.filter( cognate_class_id=cognateClass.id).values_list( 'lexeme_id', flat=True) meaningNames = Meaning.objects.filter( lexeme__id__in=lexemeIds, id__in=meaningIds).distinct().values_list('gloss', flat=True) meaningNames = ', '.join(['"%s"' % m for m in meaningNames]) self.stdout.write("Cognate set id: %s " "meanings: %s branches: %s" % (cognateClass.id, meaningNames, cognateClass.bNames))
[((908, 948), 'cobl.lexicon.models.LanguageList.objects.get', 'LanguageList.objects.get', ([], {'name': '"""Current"""'}), "(name='Current')\n", (932, 948), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((967, 1006), 'cobl.lexicon.models.MeaningList.objects.get', 'MeaningList.objects.get', ([], {'name': '"""Jena200"""'}), "(name='Jena200')\n", (990, 1006), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((1168, 1245), 'cobl.lexicon.models.Lexeme.objects.filter', 'Lexeme.objects.filter', ([], {'language_id__in': 'languageIds', 'meaning_id__in': 'meaningIds'}), '(language_id__in=languageIds, meaning_id__in=meaningIds)\n', (1189, 1245), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((1326, 1382), 'cobl.lexicon.models.CognateJudgement.objects.filter', 'CognateJudgement.objects.filter', ([], {'lexeme_id__in': 'lexemeIds'}), '(lexeme_id__in=lexemeIds)\n', (1357, 1382), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((1477, 1542), 'cobl.lexicon.models.CognateClass.objects.filter', 'CognateClass.objects.filter', ([], {'id__in': 'cognateClassIds', 'root_form': '""""""'}), "(id__in=cognateClassIds, root_form='')\n", (1504, 1542), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((6309, 6374), 'cobl.lexicon.models.CognateJudgement.objects.filter', 'CognateJudgement.objects.filter', ([], {'cognate_class_id': 'cognateClass.id'}), '(cognate_class_id=cognateClass.id)\n', (6340, 6374), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((6548, 6647), 'cobl.lexicon.models.Lexeme.objects.filter', 'Lexeme.objects.filter', ([], {'id__in': 'lexemeIds', 'language_id__in': 'languageIds', 'meaning_id__in': 'meaningIds'}), '(id__in=lexemeIds, language_id__in=languageIds,\n meaning_id__in=meaningIds)\n', (6569, 6647), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((7800, 7865), 'cobl.lexicon.models.CognateJudgement.objects.filter', 'CognateJudgement.objects.filter', ([], {'cognate_class_id': 'cognateClass.id'}), '(cognate_class_id=cognateClass.id)\n', (7831, 7865), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((7963, 8030), 'cobl.lexicon.models.Meaning.objects.filter', 'Meaning.objects.filter', ([], {'lexeme__id__in': 'lexemeIds', 'id__in': 'meaningIds'}), '(lexeme__id__in=lexemeIds, id__in=meaningIds)\n', (7985, 8030), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((2914, 3040), 'cobl.lexicon.models.Lexeme.objects.filter', 'Lexeme.objects.filter', ([], {'language_id__in': '(languageIds & inCladeLanguageIds)', 'meaning_id__in': 'meaningIds', 'not_swadesh_term': '(False)'}), '(language_id__in=languageIds & inCladeLanguageIds,\n meaning_id__in=meaningIds, not_swadesh_term=False)\n', (2935, 3040), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((2578, 2614), 'cobl.lexicon.models.Clade.objects.exclude', 'Clade.objects.exclude', ([], {'cladeLevel0': '(0)'}), '(cladeLevel0=0)\n', (2599, 2614), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((2786, 2827), 'cobl.lexicon.models.LanguageClade.objects.filter', 'LanguageClade.objects.filter', ([], {'clade': 'clade'}), '(clade=clade)\n', (2814, 2827), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((3142, 3193), 'cobl.lexicon.models.CognateJudgement.objects.filter', 'CognateJudgement.objects.filter', ([], {'lexeme__in': 'lexemes'}), '(lexeme__in=lexemes)\n', (3173, 3193), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((3325, 3420), 'cobl.lexicon.models.CognateClass.objects.filter', 'CognateClass.objects.filter', ([], {'id__in': '(cognateClassIds - unwantedCognateClassIds)', 'root_form': '""""""'}), "(id__in=cognateClassIds -\n unwantedCognateClassIds, root_form='')\n", (3352, 3420), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((4960, 5100), 'cobl.lexicon.models.Meaning.objects.filter', 'Meaning.objects.filter', ([], {'lexeme__cognate_class': 'c', 'lexeme__language_id__in': 'languageIds', 'lexeme__not_swadesh_term': '(False)', 'id__in': 'meaningIds'}), '(lexeme__cognate_class=c, lexeme__language_id__in=\n languageIds, lexeme__not_swadesh_term=False, id__in=meaningIds)\n', (4982, 5100), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n'), ((6832, 6925), 'cobl.lexicon.models.LanguageClade.objects.filter', 'LanguageClade.objects.filter', ([], {'language_id': 'lexeme.language_id', 'language_id__in': 'languageIds'}), '(language_id=lexeme.language_id,\n language_id__in=languageIds)\n', (6860, 6925), False, 'from cobl.lexicon.models import LanguageList, MeaningList, Meaning, Lexeme, CognateClass, CognateJudgement, LanguageClade, Clade\n')]
enabling-languages/dinka
collation/test2.py
981ffd07e7468f692c4d17472083a3c5485987f8
import pandas as pd from icu import Collator, Locale, RuleBasedCollator ddf = pd.read_csv("../word_frequency/unilex/din.txt", sep='\t', skiprows = range(2,5)) collator = Collator.createInstance(Locale('en_AU.UTF-8')) # https://stackoverflow.com/questions/13838405/custom-sorting-in-pandas-dataframe/27009771#27009771 # https://gist.github.com/seanpue/e1cb846f676194ae77eb def sort_pd(key=None,reverse=False): def sorter(series): series_list = list(series) return [series_list.index(i) for i in sorted(series_list,key=key,reverse=reverse)] return sorter sort_by_custom_dict = sort_pd(key=collator.getSortKey) #ddf.iloc[sort_by_custom_dict(ddf.index)] # ddf.iloc[sort_by_custom_dict(ddf['Form'])] ddf.iloc[sort_by_custom_dict(ddf['Form'])] #https://python3.wannaphong.com/2015/03/sort-python.html # https://pyerror.com/detail/1316/ lexemes = ddf.Form #lexemes2 = ddf['Form'] temp = lexemes.sort_values() collation_rules = "&A<<aa<<<aA<<<Aa<<<AA<<ä<<<Ä<<ää<<<äÄ<<<Ää<<<ÄÄ\n&D<dh<<<dH<<<Dh<<<DH\n&E<<ee<<<eE<<<Ee<<<EE<<ë<<<Ë<<ëë<<<ëË<<<Ëë<<<ËË<ɛ<<<Ɛ<<ɛɛ<<<ɛƐ<<<Ɛɛ<<<ƐƐ<<ɛ̈<<<Ɛ̈<<ɛ̈ɛ̈<<<ɛ̈Ɛ̈<<<Ɛ̈ɛ̈<<<Ɛ̈Ɛ̈\n&G<ɣ<<<Ɣ\n&I<<ii<<<iI<<<Ii<<<II<<ï<<<Ï<<ïï<<<ïÏ<<<Ïï<<<ÏÏ\n&N<nh<<<nH<<<Nh<<<NH<ny<<<nY<<<Ny<<<NH<ŋ<<<Ŋ\n&O<<oo<<<oO<<<Oo<<<OO<<ö<<<Ö<<öö<<<öÖ<<<Öö<<<ÖÖ<ɔ<<<Ɔ<<ɔɔ<<<ɔƆ<<<Ɔɔ<<<ƆƆ<<ɔ̈<<<Ɔ̈<<ɔ̈ɔ̈<<<ɔ̈Ɔ̈<<<Ɔ̈ɔ̈<<<Ɔ̈Ɔ̈\n&T<th<<<tH<<<Th<<<TH\n&U<<uu<<<uU<<<Uu<<<UU" custom_collator = RuleBasedCollator(collation_rules) temp.sort_values(key=lambda x: custom_collator.getSortKey(x) ) def sort_pd(key=None,reverse=False): def sorter(series): series_list = list(series) return [series_list.index(i) for i in sorted(series_list,key=key,reverse=reverse)] return sorter sort_by_custom_dict = sort_pd(key=custom_collator.getSortKey)
[((1429, 1463), 'icu.RuleBasedCollator', 'RuleBasedCollator', (['collation_rules'], {}), '(collation_rules)\n', (1446, 1463), False, 'from icu import Collator, Locale, RuleBasedCollator\n'), ((196, 217), 'icu.Locale', 'Locale', (['"""en_AU.UTF-8"""'], {}), "('en_AU.UTF-8')\n", (202, 217), False, 'from icu import Collator, Locale, RuleBasedCollator\n')]
jbronikowski/genielibs
pkgs/ops-pkg/src/genie/libs/ops/dot1x/ios/tests/test_dot1x.py
200a34e5fe4838a27b5a80d5973651b2e34ccafb
# Python import unittest from copy import deepcopy from unittest.mock import Mock # ATS from pyats.topology import Device # Genie from genie.libs.ops.dot1x.ios.dot1x import Dot1X from genie.libs.ops.dot1x.ios.tests.dot1x_output import Dot1xOutput # Parser from genie.libs.parser.ios.show_dot1x import ShowDot1xAllDetail, \ ShowDot1xAllStatistics, \ ShowDot1xAllSummary, \ ShowDot1xAllCount class test_dot1x(unittest.TestCase): def setUp(self): self.device = Device(name='aDevice') self.device.os = 'ios' self.device.custom['abstraction'] = {'order':['os']} self.device.mapping={} self.device.mapping['cli']='cli' # Give the device as a connection type # This is done in order to call the parser on the output provided self.device.connectionmgr.connections['cli'] = self.device def test_complete_output(self): self.maxDiff = None dot1x = Dot1X(device=self.device) # Get outputs dot1x.maker.outputs[ShowDot1xAllDetail] = \ {'': Dot1xOutput.ShowDot1xAllDetail} dot1x.maker.outputs[ShowDot1xAllStatistics] = \ {'': Dot1xOutput.ShowDot1xAllStatistics} dot1x.maker.outputs[ShowDot1xAllSummary] = \ {'': Dot1xOutput.ShowDot1xAllSummary} dot1x.maker.outputs[ShowDot1xAllCount] = \ {'': Dot1xOutput.ShowDot1xAllCount} # Learn the feature dot1x.learn() # Verify Ops was created successfully self.assertEqual(dot1x.info, Dot1xOutput.Dot1x_info) # Check Selected Attributes self.assertEqual(dot1x.info['version'], 3) # info - mdot1x default self.assertEqual(dot1x.info['interfaces']['GigabitEthernet1/0/9']\ ['max_start'], 3) def test_empty_output(self): self.maxDiff = None dot1x = Dot1X(device=self.device) dot1x.maker.outputs[ShowDot1xAllDetail] = \ {'': {}} dot1x.maker.outputs[ShowDot1xAllStatistics] = \ {'': {}} dot1x.maker.outputs[ShowDot1xAllSummary] = \ {'': {}} dot1x.maker.outputs[ShowDot1xAllCount] = \ {'': {}} # Learn the feature dot1x.learn() # Check no attribute not found with self.assertRaises(AttributeError): dot1x.info['version'] def test_incomplete_output(self): self.maxDiff = None dot1x = Dot1X(device=self.device) # Get outputs dot1x.maker.outputs[ShowDot1xAllDetail] = \ {'': Dot1xOutput.ShowDot1xAllDetail} dot1x.maker.outputs[ShowDot1xAllStatistics] = \ {'': Dot1xOutput.ShowDot1xAllStatistics} dot1x.maker.outputs[ShowDot1xAllSummary] = \ {'': Dot1xOutput.ShowDot1xAllSummary} dot1x.maker.outputs[ShowDot1xAllCount] = \ {'': {}} # Learn the feature dot1x.learn() # Delete missing specific attribute values expect_dict = deepcopy(Dot1xOutput.Dot1x_info) del(expect_dict['sessions']) # Verify Ops was created successfully self.assertEqual(dot1x.info, expect_dict) if __name__ == '__main__': unittest.main()
[((3479, 3494), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3492, 3494), False, 'import unittest\n'), ((611, 633), 'pyats.topology.Device', 'Device', ([], {'name': '"""aDevice"""'}), "(name='aDevice')\n", (617, 633), False, 'from pyats.topology import Device\n'), ((1067, 1092), 'genie.libs.ops.dot1x.ios.dot1x.Dot1X', 'Dot1X', ([], {'device': 'self.device'}), '(device=self.device)\n', (1072, 1092), False, 'from genie.libs.ops.dot1x.ios.dot1x import Dot1X\n'), ((2038, 2063), 'genie.libs.ops.dot1x.ios.dot1x.Dot1X', 'Dot1X', ([], {'device': 'self.device'}), '(device=self.device)\n', (2043, 2063), False, 'from genie.libs.ops.dot1x.ios.dot1x import Dot1X\n'), ((2666, 2691), 'genie.libs.ops.dot1x.ios.dot1x.Dot1X', 'Dot1X', ([], {'device': 'self.device'}), '(device=self.device)\n', (2671, 2691), False, 'from genie.libs.ops.dot1x.ios.dot1x import Dot1X\n'), ((3263, 3295), 'copy.deepcopy', 'deepcopy', (['Dot1xOutput.Dot1x_info'], {}), '(Dot1xOutput.Dot1x_info)\n', (3271, 3295), False, 'from copy import deepcopy\n')]
lanl/nubhlight
script/analysis/check_transformation_matrices.py
6c0f2abc05884538fe8e4e2e70a021b7c48a72c2
# ====================================================================== # copyright 2020. Triad National Security, LLC. All rights # reserved. This program was produced under U.S. Government contract # 89233218CNA000001 for Los Alamos National Laboratory (LANL), which # is operated by Triad National Security, LLC for the U.S. Department # of Energy/National Nuclear Security Administration. All rights in # the program are reserved by Triad National Security, LLC, and the # U.S. Department of Energy/National Nuclear Security # Administration. The Government is granted for itself and others # acting on its behalf a nonexclusive, paid-up, irrevocable worldwide # license in this material to reproduce, prepare derivative works, # distribute copies to the public, perform publicly and display # publicly, and to permit others to do so. # ====================================================================== # Authors: Oleg Korobkin (korobkin@lanl.gov) # Purpose: # Provides a check of whether a coordinate transformation of the metric # from code coordinates to Kerr-Schild coordinates produces correct # metric, consistent with the closed form (as in e.g. Eq.(3) # McKinney & Gammie 2004, https://arxiv.org/abs/astro-ph/0404512) # # Functions: # - print_matrix # - check_transformation_matrices # from math import * import numpy as np def print_matrix(matrix,fmt="%19.11e",tostdout=True) -> str: """Pretty-prints a matrix to a string (optinally, to stdout) Parameters ---------- matrix : numpy.array([N,M]) matrix to print fmt : str C-style format of each element (default: "%19.11e") tostdout : bool output to stdout (default: true) Returns ------- str formatted output string """ N = matrix.shape[0] M = matrix.shape[1] s = "[" for i in range(N): s+= "[" for j in range(M): s+= (fmt % matrix[i,j]) if j < M - 1: s += ", " s+= "]" if i < N - 1: s += ",\n " s+="]" if tostdout: print(s) return s def check_transformation_matrices(geom, a, ir, jth, verbose=True, tol=1e-12) -> bool: """Transforms the metric to spherical KS and compares with analytic formula Test 1: covariant metric, gcov, at A = {ir, jth} 1.1 sample gcov and Lambda_h2bl_cov at A 1.2 transform gcov to gks using transofmration matrices 1.3 compare to expected values at {r,th} at A Parameters ---------- geom : dictionary nubhlight geom object a : Float dimensionless Kerr spin parameter ir : Integer index of sample point in radial direction jth : Integer index of sample point in angular theta-direction verbose : bool output steps to stdout tol : Float tolerance to relative error (wrt det g) Returns ------- bool True if all checks passed Examples -------- import hdf5_to_dict as io hdr = io.load_hdr("dump_00000010.h5") geom = io.load_geom(hdr,recalc=True) check_transformation_matrices(geom, -1, 64) """ # sample gcov and h2bl at point A gcov_A = geom['gcov'][ir,jth] h2bl_A = geom['Lambda_h2bl_cov'][ir,jth] # sample r and theta, compute BL metric-related quantities r = geom['r'][ir,jth,0]; r2 = r*r a2 = a*a th= geom['th'][ir,jth,0] sth2= sin(th)**2 Delta= r2 - 2*r + a2 Sigma= r2 + a2*cos(th)**2 A = (r2 + a2)**2 - a2*Delta*sin(th)**2 if verbose: print ("r = %19.11e" % r) print ("theta = %19.11e" % th) print ("a = %19.11e" % a) print ("Delta = %19.11e" % Delta) print ("Sigma = %19.11e" % Sigma) print ("A = %19.11e" % A) # output metric print ("gcov_A = ") print_matrix (gcov_A) print ("") # output transformation matrix print ("h2bl_A = ") print_matrix (h2bl_A) print ("") # compute BL metric at A gks_A = np.zeros([4,4]) for i in range(4): for j in range(4): for k in range(4): for l in range(4): gks_A[i,j] = gks_A[i,j] + h2bl_A[k,i]*h2bl_A[l,j]*gcov_A[k,l] if verbose: print ("gks_A = ") print_matrix (gks_A) print("") # expected values at {r, th} g_tt = -1. + 2.*r/Sigma g_rr = 1. + 2.*r/Sigma g_ff = sth2*(Sigma + a2*g_rr*sth2) g_thth = Sigma g_tr = 2*r/Sigma g_tf = -2*a*r*sth2/Sigma g_rf = -a*g_rr*sth2 det_g = -Sigma**2*sth2 if verbose: print ("Expected:") print (" g_tt = %19.11e" % g_tt ) print (" g_rr = %19.11e" % g_rr ) print (" g_thth = %19.11e" % g_thth) print (" g_ff = %19.11e" % g_ff ) print (" g_tr = %19.11e" % g_tr ) print (" g_rf = %19.11e" % g_rf ) print (" g_tf = %19.11e" % g_tf ) print ("") # check gks_A gks_expected = np.array( [[ g_tt, g_tr, 0.0, g_tf], [ g_tr, g_rr, 0.0, g_rf], [ 0.0, 0.0, g_thth, 0.0], [ g_tf, g_rf, 0.0, g_ff]] ) passed = True for i in range(4): for j in range(4): if abs(gks_A[i,j] - gks_expected[i,j])/abs(det_g) > tol: passed = False if verbose: print (f"WARNING: Significant mismatch in gks_A[{i},{j}]:") print (" -- expected: %19.11e" % gks_expected[i,j]) print (" -- actual: %19.11e" % gks_A[i,j]) return passed
[((3804, 3820), 'numpy.zeros', 'np.zeros', (['[4, 4]'], {}), '([4, 4])\n', (3812, 3820), True, 'import numpy as np\n'), ((4699, 4813), 'numpy.array', 'np.array', (['[[g_tt, g_tr, 0.0, g_tf], [g_tr, g_rr, 0.0, g_rf], [0.0, 0.0, g_thth, 0.0],\n [g_tf, g_rf, 0.0, g_ff]]'], {}), '([[g_tt, g_tr, 0.0, g_tf], [g_tr, g_rr, 0.0, g_rf], [0.0, 0.0,\n g_thth, 0.0], [g_tf, g_rf, 0.0, g_ff]])\n', (4707, 4813), True, 'import numpy as np\n')]
rexor12/holobot
holobot/discord/sdk/models/channel.py
89b7b416403d13ccfeee117ef942426b08d3651d
from dataclasses import dataclass @dataclass class Channel: id: str
[]
claireguichon/pynet
pynet/models/braingengan.py
92706375e61fb5cb523548303b7d04769c9de134
# -*- coding: utf-8 -*- ########################################################################## # NSAp - Copyright (C) CEA, 2020 # Distributed under the terms of the CeCILL-B license, as published by # the CEA-CNRS-INRIA. Refer to the LICENSE file or to # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html # for details. ########################################################################## """ 3D MRI Brain Generation with Generative Adversarial Networks (BGGAN) with Variational Auto Encoder (VAE). """ # Imports import logging import collections import numpy as np import torch import torch.nn as nn from torch.autograd import Variable import torch.nn.functional as func from pynet.utils import Networks # Global parameters logger = logging.getLogger("pynet") @Networks.register class BGDiscriminator(nn.Module): """ This is the discriminator part of the BGGAN. """ def __init__(self, in_shape, in_channels=1, out_channels=1, start_filts=64, with_logit=True): """ Init class. Parameters ---------- in_shape: uplet the input tensor data shape (X, Y, Z). in_channels: int, default 1 number of channels in the input tensor. out_channels: int, default 1 number of channels in the output tensor. start_filts: int, default 64 number of convolutional filters for the first conv. with_logit: bool, default True apply the logit function to the result. """ super(BGDiscriminator, self).__init__() self.in_channels = in_channels self.out_channels = out_channels self.start_filts = start_filts self.with_logit = with_logit self.in_shape = in_shape self.shapes = _downsample_shape( self.in_shape, nb_iterations=4, scale_factor=2) self.conv1 = nn.Conv3d( self.in_channels, self.start_filts, kernel_size=4, stride=2, padding=1) self.conv2 = nn.Conv3d( self.start_filts, self.start_filts * 2, kernel_size=4, stride=2, padding=1) self.bn2 = nn.BatchNorm3d(self.start_filts * 2) self.conv3 = nn.Conv3d( self.start_filts * 2, self.start_filts * 4, kernel_size=4, stride=2, padding=1) self.bn3 = nn.BatchNorm3d(self.start_filts * 4) self.conv4 = nn.Conv3d( self.start_filts * 4, self.start_filts * 8, kernel_size=4, stride=2, padding=1) self.bn4 = nn.BatchNorm3d(self.start_filts * 8) self.conv5 = nn.Conv3d( self.start_filts * 8, self.out_channels, kernel_size=self.shapes[-1], stride=1, padding=0) def forward(self, x): logger.debug("BGGAN Discriminator...") self.debug("input", x) h1 = func.leaky_relu(self.conv1(x), negative_slope=0.2) self.debug("conv1", h1) h2 = func.leaky_relu(self.bn2(self.conv2(h1)), negative_slope=0.2) self.debug("conv2", h2) h3 = func.leaky_relu(self.bn3(self.conv3(h2)), negative_slope=0.2) self.debug("conv3", h3) h4 = func.leaky_relu(self.bn4(self.conv4(h3)), negative_slope=0.2) self.debug("conv4", h4) h5 = self.conv5(h4) self.debug("conv5", h5) if self.with_logit: output = torch.sigmoid(h5.view(h5.size(0), -1)) self.debug("output", output) else: output = h5 logger.debug("Done.") return output def debug(self, name, tensor): logger.debug(" {3}: {0} - {1} - {2}".format( tensor.shape, tensor.get_device(), tensor.dtype, name)) @Networks.register class BGEncoder(nn.Module): """ This is the encoder part of the BGGAN. """ def __init__(self, in_shape, in_channels=1, start_filts=64, latent_dim=1000): """ Init class. Parameters ---------- in_shape: uplet the input tensor data shape (X, Y, Z). in_channels: int, default 1 number of channels in the input tensor. start_filts: int, default 64 number of convolutional filters for the first conv. latent_dim: int, default 1000 the latent variable sizes. """ super(BGEncoder, self).__init__() self.in_channels = in_channels self.start_filts = start_filts self.latent_dim = latent_dim self.in_shape = in_shape self.shapes = _downsample_shape( self.in_shape, nb_iterations=4, scale_factor=2) self.dense_features = np.prod(self.shapes[-1]) logger.debug("BGGAN Encoder shapes: {0}".format(self.shapes)) self.conv1 = nn.Conv3d( self.in_channels, self.start_filts, kernel_size=4, stride=2, padding=1) self.conv2 = nn.Conv3d( self.start_filts, self.start_filts * 2, kernel_size=4, stride=2, padding=1) self.bn2 = nn.BatchNorm3d(self.start_filts * 2) self.conv3 = nn.Conv3d( self.start_filts * 2, self.start_filts * 4, kernel_size=4, stride=2, padding=1) self.bn3 = nn.BatchNorm3d(self.start_filts * 4) self.conv4 = nn.Conv3d( self.start_filts * 4, self.start_filts * 8, kernel_size=4, stride=2, padding=1) self.bn4 = nn.BatchNorm3d(self.start_filts * 8) self.mean = nn.Sequential( nn.Linear(self.start_filts * 8 * self.dense_features, 2048), nn.BatchNorm1d(2048), nn.ReLU(), nn.Linear(2048, self.latent_dim)) self.logvar = nn.Sequential( nn.Linear(self.start_filts * 8 * self.dense_features, 2048), nn.BatchNorm1d(2048), nn.ReLU(), nn.Linear(2048, self.latent_dim)) def forward(self, x): logger.debug("BGGAN Encoder...") batch_size = x.size(0) logger.debug(" batch_size: {0}".format(batch_size)) self.debug("input", x) h1 = func.leaky_relu(self.conv1(x), negative_slope=0.2) self.debug("conv1", h1) h2 = func.leaky_relu(self.bn2(self.conv2(h1)), negative_slope=0.2) self.debug("conv2", h2) h3 = func.leaky_relu(self.bn3(self.conv3(h2)), negative_slope=0.2) self.debug("conv3", h3) h4 = func.leaky_relu(self.bn4(self.conv4(h3)), negative_slope=0.2) self.debug("conv4", h4) mean = self.mean(h4.view(batch_size, -1)) self.debug("mean", mean) logvar = self.logvar(h4.view(batch_size, -1)) self.debug("logvar", logvar) std = logvar.mul(0.5).exp_() reparametrized_noise = Variable( torch.randn((batch_size, self.latent_dim))).to(x.device) reparametrized_noise = mean + std * reparametrized_noise self.debug("reparametrization", reparametrized_noise) logger.debug("Done.") return mean, logvar, reparametrized_noise def debug(self, name, tensor): logger.debug(" {3}: {0} - {1} - {2}".format( tensor.shape, tensor.get_device(), tensor.dtype, name)) @Networks.register class BGCodeDiscriminator(nn.Module): """ This is the code discriminator part of the BGGAN. """ def __init__(self, out_channels=1, code_size=1000, n_units=4096): """ Init class. Parameters ---------- out_channels: int, default 1 number of channels in the output tensor. code_size: int, default 1000 the code sier. n_units: int, default 4096 the number of hidden units. """ super(BGCodeDiscriminator, self).__init__() self.out_channels = out_channels self.code_size = code_size self.n_units = n_units self.layer1 = nn.Sequential( nn.Linear(self.code_size, self.n_units), nn.BatchNorm1d(self.n_units), nn.LeakyReLU(0.2, inplace=True)) self.layer2 = nn.Sequential( nn.Linear(self.n_units, self.n_units), nn.BatchNorm1d(self.n_units), nn.LeakyReLU(0.2, inplace=True)) self.layer3 = nn.Linear(self.n_units, self.out_channels) def forward(self, x): logger.debug("BGGAN Code Discriminator...") self.debug("input", x) h1 = self.layer1(x) self.debug("layer1", h1) h2 = self.layer2(h1) self.debug("layer2", h2) output = self.layer3(h2) self.debug("layer3", output) logger.debug("Done.") return output def debug(self, name, tensor): logger.debug(" {3}: {0} - {1} - {2}".format( tensor.shape, tensor.get_device(), tensor.dtype, name)) @Networks.register class BGGenerator(nn.Module): """ This is the generator part of the BGGAN. """ def __init__(self, in_shape, out_channels=1, start_filts=64, latent_dim=1000, mode="trilinear", with_code=False): """ Init class. Parameters ---------- in_shape: uplet the input tensor data shape (X, Y, Z). out_channels: int, default 1 number of channels in the output tensor. start_filts: int, default 64 number of convolutional filters for the first conv. latent_dim: int, default 1000 the latent variable sizes. mode: str, default 'trilinear' the interpolation mode. with_code: bool, default False change the architecture if code discriminator is used. """ super(BGGenerator, self).__init__() self.out_channels = out_channels self.start_filts = start_filts self.latent_dim = latent_dim self.in_shape = in_shape self.mode = mode self.with_code = with_code self.shapes = _downsample_shape( self.in_shape, nb_iterations=4, scale_factor=2) self.dense_features = np.prod(self.shapes[-1]) logger.debug("BGGAN Generator shapes: {0}".format(self.shapes)) if self.with_code: self.tp_conv1 = nn.ConvTranspose3d( self.latent_dim, self.start_filts * 8, kernel_size=4, stride=1, padding=0, bias=False) else: self.fc = nn.Linear( self.latent_dim, self.start_filts * 8 * self.dense_features) self.bn1 = nn.BatchNorm3d(self.start_filts * 8) self.tp_conv2 = nn.Conv3d( self.start_filts * 8, self.start_filts * 4, kernel_size=3, stride=1, padding=1, bias=False) self.bn2 = nn.BatchNorm3d(self.start_filts * 4) self.tp_conv3 = nn.Conv3d( self.start_filts * 4, self.start_filts * 2, kernel_size=3, stride=1, padding=1, bias=False) self.bn3 = nn.BatchNorm3d(self.start_filts * 2) self.tp_conv4 = nn.Conv3d( self.start_filts * 2, self.start_filts, kernel_size=3, stride=1, padding=1, bias=False) self.bn4 = nn.BatchNorm3d(self.start_filts) self.tp_conv5 = nn.Conv3d( self.start_filts, self.out_channels, kernel_size=3, stride=1, padding=1, bias=False) def forward(self, noise): logger.debug("BGGAN Generator...") self.debug("input", noise) if self.with_code: noise = noise.view(-1, self.latent_dim, 1, 1, 1) self.debug("view", noise) h = self.tp_conv1(noise) self.debug("tp_conv1", h) else: noise = noise.view(-1, self.latent_dim) self.debug("view", noise) h = self.fc(noise) self.debug("dense", h) h = h.view(-1, self.start_filts * 8, *self.shapes[-1]) self.debug("view", h) h = func.relu(self.bn1(h)) h = nn.functional.interpolate( h, size=self.shapes[-2], mode=self.mode, align_corners=False) h = self.tp_conv2(h) h = func.relu(self.bn2(h)) self.debug("tp_conv2", h) h = nn.functional.interpolate( h, size=self.shapes[-3], mode=self.mode, align_corners=False) h = self.tp_conv3(h) h = func.relu(self.bn3(h)) self.debug("tp_conv3", h) h = nn.functional.interpolate( h, size=self.shapes[-4], mode=self.mode, align_corners=False) h = self.tp_conv4(h) h = func.relu(self.bn4(h)) self.debug("tp_conv4", h) h = nn.functional.interpolate( h, size=self.shapes[-5], mode=self.mode, align_corners=False) h = self.tp_conv5(h) self.debug("tp_conv5", h) h = torch.tanh(h) self.debug("output", h) logger.debug("Done.") return h def debug(self, name, tensor): logger.debug(" {3}: {0} - {1} - {2}".format( tensor.shape, tensor.get_device(), tensor.dtype, name)) def _downsample_shape(shape, nb_iterations=1, scale_factor=2): shape = np.asarray(shape) all_shapes = [shape.astype(int).tolist()] for idx in range(nb_iterations): shape = np.floor(shape / scale_factor) all_shapes.append(shape.astype(int).tolist()) return all_shapes
[((758, 784), 'logging.getLogger', 'logging.getLogger', (['"""pynet"""'], {}), "('pynet')\n", (775, 784), False, 'import logging\n'), ((12950, 12967), 'numpy.asarray', 'np.asarray', (['shape'], {}), '(shape)\n', (12960, 12967), True, 'import numpy as np\n'), ((1895, 1980), 'torch.nn.Conv3d', 'nn.Conv3d', (['self.in_channels', 'self.start_filts'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(self.in_channels, self.start_filts, kernel_size=4, stride=2,\n padding=1)\n', (1904, 1980), True, 'import torch.nn as nn\n'), ((2023, 2112), 'torch.nn.Conv3d', 'nn.Conv3d', (['self.start_filts', '(self.start_filts * 2)'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(self.start_filts, self.start_filts * 2, kernel_size=4, stride=2,\n padding=1)\n', (2032, 2112), True, 'import torch.nn as nn\n'), ((2153, 2189), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['(self.start_filts * 2)'], {}), '(self.start_filts * 2)\n', (2167, 2189), True, 'import torch.nn as nn\n'), ((2211, 2305), 'torch.nn.Conv3d', 'nn.Conv3d', (['(self.start_filts * 2)', '(self.start_filts * 4)'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(self.start_filts * 2, self.start_filts * 4, kernel_size=4, stride\n =2, padding=1)\n', (2220, 2305), True, 'import torch.nn as nn\n'), ((2345, 2381), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['(self.start_filts * 4)'], {}), '(self.start_filts * 4)\n', (2359, 2381), True, 'import torch.nn as nn\n'), ((2403, 2497), 'torch.nn.Conv3d', 'nn.Conv3d', (['(self.start_filts * 4)', '(self.start_filts * 8)'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(self.start_filts * 4, self.start_filts * 8, kernel_size=4, stride\n =2, padding=1)\n', (2412, 2497), True, 'import torch.nn as nn\n'), ((2537, 2573), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['(self.start_filts * 8)'], {}), '(self.start_filts * 8)\n', (2551, 2573), True, 'import torch.nn as nn\n'), ((2595, 2700), 'torch.nn.Conv3d', 'nn.Conv3d', (['(self.start_filts * 8)', 'self.out_channels'], {'kernel_size': 'self.shapes[-1]', 'stride': '(1)', 'padding': '(0)'}), '(self.start_filts * 8, self.out_channels, kernel_size=self.shapes[\n -1], stride=1, padding=0)\n', (2604, 2700), True, 'import torch.nn as nn\n'), ((4620, 4644), 'numpy.prod', 'np.prod', (['self.shapes[-1]'], {}), '(self.shapes[-1])\n', (4627, 4644), True, 'import numpy as np\n'), ((4736, 4821), 'torch.nn.Conv3d', 'nn.Conv3d', (['self.in_channels', 'self.start_filts'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(self.in_channels, self.start_filts, kernel_size=4, stride=2,\n padding=1)\n', (4745, 4821), True, 'import torch.nn as nn\n'), ((4864, 4953), 'torch.nn.Conv3d', 'nn.Conv3d', (['self.start_filts', '(self.start_filts * 2)'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(self.start_filts, self.start_filts * 2, kernel_size=4, stride=2,\n padding=1)\n', (4873, 4953), True, 'import torch.nn as nn\n'), ((4994, 5030), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['(self.start_filts * 2)'], {}), '(self.start_filts * 2)\n', (5008, 5030), True, 'import torch.nn as nn\n'), ((5052, 5146), 'torch.nn.Conv3d', 'nn.Conv3d', (['(self.start_filts * 2)', '(self.start_filts * 4)'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(self.start_filts * 2, self.start_filts * 4, kernel_size=4, stride\n =2, padding=1)\n', (5061, 5146), True, 'import torch.nn as nn\n'), ((5186, 5222), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['(self.start_filts * 4)'], {}), '(self.start_filts * 4)\n', (5200, 5222), True, 'import torch.nn as nn\n'), ((5244, 5338), 'torch.nn.Conv3d', 'nn.Conv3d', (['(self.start_filts * 4)', '(self.start_filts * 8)'], {'kernel_size': '(4)', 'stride': '(2)', 'padding': '(1)'}), '(self.start_filts * 4, self.start_filts * 8, kernel_size=4, stride\n =2, padding=1)\n', (5253, 5338), True, 'import torch.nn as nn\n'), ((5378, 5414), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['(self.start_filts * 8)'], {}), '(self.start_filts * 8)\n', (5392, 5414), True, 'import torch.nn as nn\n'), ((8165, 8207), 'torch.nn.Linear', 'nn.Linear', (['self.n_units', 'self.out_channels'], {}), '(self.n_units, self.out_channels)\n', (8174, 8207), True, 'import torch.nn as nn\n'), ((9948, 9972), 'numpy.prod', 'np.prod', (['self.shapes[-1]'], {}), '(self.shapes[-1])\n', (9955, 9972), True, 'import numpy as np\n'), ((10382, 10418), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['(self.start_filts * 8)'], {}), '(self.start_filts * 8)\n', (10396, 10418), True, 'import torch.nn as nn\n'), ((10444, 10550), 'torch.nn.Conv3d', 'nn.Conv3d', (['(self.start_filts * 8)', '(self.start_filts * 4)'], {'kernel_size': '(3)', 'stride': '(1)', 'padding': '(1)', 'bias': '(False)'}), '(self.start_filts * 8, self.start_filts * 4, kernel_size=3, stride\n =1, padding=1, bias=False)\n', (10453, 10550), True, 'import torch.nn as nn\n'), ((10590, 10626), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['(self.start_filts * 4)'], {}), '(self.start_filts * 4)\n', (10604, 10626), True, 'import torch.nn as nn\n'), ((10652, 10758), 'torch.nn.Conv3d', 'nn.Conv3d', (['(self.start_filts * 4)', '(self.start_filts * 2)'], {'kernel_size': '(3)', 'stride': '(1)', 'padding': '(1)', 'bias': '(False)'}), '(self.start_filts * 4, self.start_filts * 2, kernel_size=3, stride\n =1, padding=1, bias=False)\n', (10661, 10758), True, 'import torch.nn as nn\n'), ((10798, 10834), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['(self.start_filts * 2)'], {}), '(self.start_filts * 2)\n', (10812, 10834), True, 'import torch.nn as nn\n'), ((10860, 10961), 'torch.nn.Conv3d', 'nn.Conv3d', (['(self.start_filts * 2)', 'self.start_filts'], {'kernel_size': '(3)', 'stride': '(1)', 'padding': '(1)', 'bias': '(False)'}), '(self.start_filts * 2, self.start_filts, kernel_size=3, stride=1,\n padding=1, bias=False)\n', (10869, 10961), True, 'import torch.nn as nn\n'), ((11002, 11034), 'torch.nn.BatchNorm3d', 'nn.BatchNorm3d', (['self.start_filts'], {}), '(self.start_filts)\n', (11016, 11034), True, 'import torch.nn as nn\n'), ((11060, 11158), 'torch.nn.Conv3d', 'nn.Conv3d', (['self.start_filts', 'self.out_channels'], {'kernel_size': '(3)', 'stride': '(1)', 'padding': '(1)', 'bias': '(False)'}), '(self.start_filts, self.out_channels, kernel_size=3, stride=1,\n padding=1, bias=False)\n', (11069, 11158), True, 'import torch.nn as nn\n'), ((11809, 11900), 'torch.nn.functional.interpolate', 'nn.functional.interpolate', (['h'], {'size': 'self.shapes[-2]', 'mode': 'self.mode', 'align_corners': '(False)'}), '(h, size=self.shapes[-2], mode=self.mode,\n align_corners=False)\n', (11834, 11900), True, 'import torch.nn as nn\n'), ((12021, 12112), 'torch.nn.functional.interpolate', 'nn.functional.interpolate', (['h'], {'size': 'self.shapes[-3]', 'mode': 'self.mode', 'align_corners': '(False)'}), '(h, size=self.shapes[-3], mode=self.mode,\n align_corners=False)\n', (12046, 12112), True, 'import torch.nn as nn\n'), ((12233, 12324), 'torch.nn.functional.interpolate', 'nn.functional.interpolate', (['h'], {'size': 'self.shapes[-4]', 'mode': 'self.mode', 'align_corners': '(False)'}), '(h, size=self.shapes[-4], mode=self.mode,\n align_corners=False)\n', (12258, 12324), True, 'import torch.nn as nn\n'), ((12445, 12536), 'torch.nn.functional.interpolate', 'nn.functional.interpolate', (['h'], {'size': 'self.shapes[-5]', 'mode': 'self.mode', 'align_corners': '(False)'}), '(h, size=self.shapes[-5], mode=self.mode,\n align_corners=False)\n', (12470, 12536), True, 'import torch.nn as nn\n'), ((12622, 12635), 'torch.tanh', 'torch.tanh', (['h'], {}), '(h)\n', (12632, 12635), False, 'import torch\n'), ((13067, 13097), 'numpy.floor', 'np.floor', (['(shape / scale_factor)'], {}), '(shape / scale_factor)\n', (13075, 13097), True, 'import numpy as np\n'), ((5462, 5521), 'torch.nn.Linear', 'nn.Linear', (['(self.start_filts * 8 * self.dense_features)', '(2048)'], {}), '(self.start_filts * 8 * self.dense_features, 2048)\n', (5471, 5521), True, 'import torch.nn as nn\n'), ((5535, 5555), 'torch.nn.BatchNorm1d', 'nn.BatchNorm1d', (['(2048)'], {}), '(2048)\n', (5549, 5555), True, 'import torch.nn as nn\n'), ((5569, 5578), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (5576, 5578), True, 'import torch.nn as nn\n'), ((5592, 5624), 'torch.nn.Linear', 'nn.Linear', (['(2048)', 'self.latent_dim'], {}), '(2048, self.latent_dim)\n', (5601, 5624), True, 'import torch.nn as nn\n'), ((5675, 5734), 'torch.nn.Linear', 'nn.Linear', (['(self.start_filts * 8 * self.dense_features)', '(2048)'], {}), '(self.start_filts * 8 * self.dense_features, 2048)\n', (5684, 5734), True, 'import torch.nn as nn\n'), ((5748, 5768), 'torch.nn.BatchNorm1d', 'nn.BatchNorm1d', (['(2048)'], {}), '(2048)\n', (5762, 5768), True, 'import torch.nn as nn\n'), ((5782, 5791), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (5789, 5791), True, 'import torch.nn as nn\n'), ((5805, 5837), 'torch.nn.Linear', 'nn.Linear', (['(2048)', 'self.latent_dim'], {}), '(2048, self.latent_dim)\n', (5814, 5837), True, 'import torch.nn as nn\n'), ((7840, 7879), 'torch.nn.Linear', 'nn.Linear', (['self.code_size', 'self.n_units'], {}), '(self.code_size, self.n_units)\n', (7849, 7879), True, 'import torch.nn as nn\n'), ((7893, 7921), 'torch.nn.BatchNorm1d', 'nn.BatchNorm1d', (['self.n_units'], {}), '(self.n_units)\n', (7907, 7921), True, 'import torch.nn as nn\n'), ((7935, 7966), 'torch.nn.LeakyReLU', 'nn.LeakyReLU', (['(0.2)'], {'inplace': '(True)'}), '(0.2, inplace=True)\n', (7947, 7966), True, 'import torch.nn as nn\n'), ((8017, 8054), 'torch.nn.Linear', 'nn.Linear', (['self.n_units', 'self.n_units'], {}), '(self.n_units, self.n_units)\n', (8026, 8054), True, 'import torch.nn as nn\n'), ((8068, 8096), 'torch.nn.BatchNorm1d', 'nn.BatchNorm1d', (['self.n_units'], {}), '(self.n_units)\n', (8082, 8096), True, 'import torch.nn as nn\n'), ((8110, 8141), 'torch.nn.LeakyReLU', 'nn.LeakyReLU', (['(0.2)'], {'inplace': '(True)'}), '(0.2, inplace=True)\n', (8122, 8141), True, 'import torch.nn as nn\n'), ((10100, 10209), 'torch.nn.ConvTranspose3d', 'nn.ConvTranspose3d', (['self.latent_dim', '(self.start_filts * 8)'], {'kernel_size': '(4)', 'stride': '(1)', 'padding': '(0)', 'bias': '(False)'}), '(self.latent_dim, self.start_filts * 8, kernel_size=4,\n stride=1, padding=0, bias=False)\n', (10118, 10209), True, 'import torch.nn as nn\n'), ((10275, 10345), 'torch.nn.Linear', 'nn.Linear', (['self.latent_dim', '(self.start_filts * 8 * self.dense_features)'], {}), '(self.latent_dim, self.start_filts * 8 * self.dense_features)\n', (10284, 10345), True, 'import torch.nn as nn\n'), ((6711, 6753), 'torch.randn', 'torch.randn', (['(batch_size, self.latent_dim)'], {}), '((batch_size, self.latent_dim))\n', (6722, 6753), False, 'import torch\n')]
baranshad/models
research/object_detection/core/freezable_batch_norm_test.py
aaf008855e9764f32d974e86f8e1f9cfddfafd9a
# Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for object_detection.core.freezable_batch_norm.""" import numpy as np import tensorflow as tf from object_detection.core import freezable_batch_norm class FreezableBatchNormTest(tf.test.TestCase): """Tests for FreezableBatchNorm operations.""" def _build_model(self, training=None): model = tf.keras.models.Sequential() norm = freezable_batch_norm.FreezableBatchNorm(training=training, input_shape=(10,), momentum=0.8) model.add(norm) return model, norm def _train_freezable_batch_norm(self, training_mean, training_var): model, _ = self._build_model() model.compile(loss='mse', optimizer='sgd') # centered on training_mean, variance training_var train_data = np.random.normal( loc=training_mean, scale=training_var, size=(1000, 10)) model.fit(train_data, train_data, epochs=4, verbose=0) return model.weights def _test_batchnorm_layer( self, norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var): out_tensor = norm(tf.convert_to_tensor(test_data, dtype=tf.float32), training=training_arg) out = tf.keras.backend.eval(out_tensor) out -= tf.keras.backend.eval(norm.beta) out /= tf.keras.backend.eval(norm.gamma) if not should_be_training: out *= training_var out += (training_mean - testing_mean) out /= testing_var np.testing.assert_allclose(out.mean(), 0.0, atol=1.5e-1) np.testing.assert_allclose(out.std(), 1.0, atol=1.5e-1) def test_batchnorm_freezing_training_none(self): with self.test_session(): training_mean = 5.0 training_var = 10.0 testing_mean = -10.0 testing_var = 5.0 # Initially train the batch norm, and save the weights trained_weights = self._train_freezable_batch_norm(training_mean, training_var) # Load the batch norm weights, freezing training to True. # Apply the batch norm layer to testing data and ensure it is normalized # according to the batch statistics. model, norm = self._build_model(training=True) for trained_weight, blank_weight in zip(trained_weights, model.weights): weight_copy = blank_weight.assign(tf.keras.backend.eval(trained_weight)) tf.keras.backend.eval(weight_copy) # centered on testing_mean, variance testing_var test_data = np.random.normal( loc=testing_mean, scale=testing_var, size=(1000, 10)) # Test with training=True passed to the call method: training_arg = True should_be_training = True self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) # Test with training=False passed to the call method: training_arg = False should_be_training = False self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) # Test the layer in various Keras learning phase scopes: training_arg = None should_be_training = False self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) tf.keras.backend.set_learning_phase(True) should_be_training = True self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) tf.keras.backend.set_learning_phase(False) should_be_training = False self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) def test_batchnorm_freezing_training_false(self): with self.test_session(): training_mean = 5.0 training_var = 10.0 testing_mean = -10.0 testing_var = 5.0 # Initially train the batch norm, and save the weights trained_weights = self._train_freezable_batch_norm(training_mean, training_var) # Load the batch norm back up, freezing training to False. # Apply the batch norm layer to testing data and ensure it is normalized # according to the training data's statistics. model, norm = self._build_model(training=False) for trained_weight, blank_weight in zip(trained_weights, model.weights): weight_copy = blank_weight.assign(tf.keras.backend.eval(trained_weight)) tf.keras.backend.eval(weight_copy) # centered on testing_mean, variance testing_var test_data = np.random.normal( loc=testing_mean, scale=testing_var, size=(1000, 10)) # Make sure that the layer is never training # Test with training=True passed to the call method: training_arg = True should_be_training = False self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) # Test with training=False passed to the call method: training_arg = False should_be_training = False self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) # Test the layer in various Keras learning phase scopes: training_arg = None should_be_training = False self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) tf.keras.backend.set_learning_phase(True) should_be_training = False self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) tf.keras.backend.set_learning_phase(False) should_be_training = False self._test_batchnorm_layer(norm, should_be_training, test_data, testing_mean, testing_var, training_arg, training_mean, training_var) if __name__ == '__main__': tf.test.main()
[((7572, 7586), 'tensorflow.test.main', 'tf.test.main', ([], {}), '()\n', (7584, 7586), True, 'import tensorflow as tf\n'), ((1002, 1030), 'tensorflow.keras.models.Sequential', 'tf.keras.models.Sequential', ([], {}), '()\n', (1028, 1030), True, 'import tensorflow as tf\n'), ((1042, 1138), 'object_detection.core.freezable_batch_norm.FreezableBatchNorm', 'freezable_batch_norm.FreezableBatchNorm', ([], {'training': 'training', 'input_shape': '(10,)', 'momentum': '(0.8)'}), '(training=training, input_shape=(10,\n ), momentum=0.8)\n', (1081, 1138), False, 'from object_detection.core import freezable_batch_norm\n'), ((1505, 1577), 'numpy.random.normal', 'np.random.normal', ([], {'loc': 'training_mean', 'scale': 'training_var', 'size': '(1000, 10)'}), '(loc=training_mean, scale=training_var, size=(1000, 10))\n', (1521, 1577), True, 'import numpy as np\n'), ((1971, 2004), 'tensorflow.keras.backend.eval', 'tf.keras.backend.eval', (['out_tensor'], {}), '(out_tensor)\n', (1992, 2004), True, 'import tensorflow as tf\n'), ((2016, 2048), 'tensorflow.keras.backend.eval', 'tf.keras.backend.eval', (['norm.beta'], {}), '(norm.beta)\n', (2037, 2048), True, 'import tensorflow as tf\n'), ((2060, 2093), 'tensorflow.keras.backend.eval', 'tf.keras.backend.eval', (['norm.gamma'], {}), '(norm.gamma)\n', (2081, 2093), True, 'import tensorflow as tf\n'), ((1865, 1914), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['test_data'], {'dtype': 'tf.float32'}), '(test_data, dtype=tf.float32)\n', (1885, 1914), True, 'import tensorflow as tf\n'), ((3251, 3321), 'numpy.random.normal', 'np.random.normal', ([], {'loc': 'testing_mean', 'scale': 'testing_var', 'size': '(1000, 10)'}), '(loc=testing_mean, scale=testing_var, size=(1000, 10))\n', (3267, 3321), True, 'import numpy as np\n'), ((4340, 4381), 'tensorflow.keras.backend.set_learning_phase', 'tf.keras.backend.set_learning_phase', (['(True)'], {}), '(True)\n', (4375, 4381), True, 'import tensorflow as tf\n'), ((4627, 4669), 'tensorflow.keras.backend.set_learning_phase', 'tf.keras.backend.set_learning_phase', (['(False)'], {}), '(False)\n', (4662, 4669), True, 'import tensorflow as tf\n'), ((5830, 5900), 'numpy.random.normal', 'np.random.normal', ([], {'loc': 'testing_mean', 'scale': 'testing_var', 'size': '(1000, 10)'}), '(loc=testing_mean, scale=testing_var, size=(1000, 10))\n', (5846, 5900), True, 'import numpy as np\n'), ((6971, 7012), 'tensorflow.keras.backend.set_learning_phase', 'tf.keras.backend.set_learning_phase', (['(True)'], {}), '(True)\n', (7006, 7012), True, 'import tensorflow as tf\n'), ((7259, 7301), 'tensorflow.keras.backend.set_learning_phase', 'tf.keras.backend.set_learning_phase', (['(False)'], {}), '(False)\n', (7294, 7301), True, 'import tensorflow as tf\n'), ((3142, 3176), 'tensorflow.keras.backend.eval', 'tf.keras.backend.eval', (['weight_copy'], {}), '(weight_copy)\n', (3163, 3176), True, 'import tensorflow as tf\n'), ((5721, 5755), 'tensorflow.keras.backend.eval', 'tf.keras.backend.eval', (['weight_copy'], {}), '(weight_copy)\n', (5742, 5755), True, 'import tensorflow as tf\n'), ((3095, 3132), 'tensorflow.keras.backend.eval', 'tf.keras.backend.eval', (['trained_weight'], {}), '(trained_weight)\n', (3116, 3132), True, 'import tensorflow as tf\n'), ((5674, 5711), 'tensorflow.keras.backend.eval', 'tf.keras.backend.eval', (['trained_weight'], {}), '(trained_weight)\n', (5695, 5711), True, 'import tensorflow as tf\n')]
translationalneurosurgery/tool-offspect
offspect/gui/VWidgets/message.py
011dafb697e8542fc7c3cf8af8523af3ff704a14
# from PyQt5.QtWidgets import QMessageBox # def raise_error(message: str = "DEFAULT:Error Description:More Information"): # box = QMessageBox() # kind, msg, info = message.split(":") # box.setIcon(QMessageBox.Critical) # box.setWindowTitle(kind + " Error") # box.setText(msg) # box.setInformativeText(info) # box.exec_()
[]
crazywiden/Leetcode_daily_submit
Widen/LC759_Employee_Free_Time.py
15637e260ab547022ac0c828dd196337bd8d50a3
""" 759. Employee Free Time We are given a list schedule of employees, which represents the working time for each employee. Each employee has a list of non-overlapping Intervals, and these intervals are in sorted order. Return the list of finite intervals representing common, positive-length free time for all employees, also in sorted order. (Even though we are representing Intervals in the form [x, y], the objects inside are Intervals, not lists or arrays. For example, schedule[0][0].start = 1, schedule[0][0].end = 2, and schedule[0][0][0] is not defined). Also, we wouldn't include intervals like [5, 5] in our answer, as they have zero length. """ # Line Swap method # if we met a start, cnt += 1 # if we met an end, cnt -= 1 # time complexity -- O(NlogN), need sort all intervals # Runtime: 96 ms, faster than 87.95% of Python3 online submissions for Employee Free Time. # Memory Usage: 14.7 MB, less than 25.00% of Python3 online submissions for Employee Free Time. """ # Definition for an Interval. class Interval: def __init__(self, start: int = None, end: int = None): self.start = start self.end = end """ class Solution: def employeeFreeTime(self, schedule: '[[Interval]]') -> '[Interval]': START, END = 0, 1 all_interval = [] for person in schedule: for interval in person: all_interval.append((interval.start, START)) all_interval.append((interval.end, END)) all_interval = sorted(all_interval, key=lambda x: x[0]) prev = None cnt = 0 res = [] for i in range(len(all_interval)): if cnt == 0 and prev is not None: if prev != all_interval[i][0]: res.append(Interval(prev, all_interval[i][0])) if all_interval[i][1] == START: cnt += 1 else: cnt -= 1 prev = all_interval[i][0] return res # priority queue # if the current end is less than the smallest start # then means there is a free time # use priority queue to maintain the smallest start # also only stort one of jobs of each person in the queue to save memory # time complexity -- O(NlogC), C is the number of employee """ # Definition for an Interval. class Interval: def __init__(self, start: int = None, end: int = None): self.start = start self.end = end """ import heapq class Solution: def employeeFreeTime(self, schedule: '[[Interval]]') -> '[Interval]': res = [] job_start_q = [(emp[0].start, emp_id, 0) for emp_id, emp in enumerate(schedule)] heapq.heapify(job_start_q) largest_end = min(interval.start for emp in schedule for interval in emp) while job_start_q: start, emp_id, job_id = heapq.heappop(job_start_q) if largest_end < start: res.append(Interval(largest_end, start)) largest_end = max(largest_end, schedule[emp_id][job_id].end) if job_id + 1 < len(schedule[emp_id]): heapq.heappush(job_start_q, (schedule[emp_id][job_id+1].start, emp_id, job_id+1)) return res
[((2646, 2672), 'heapq.heapify', 'heapq.heapify', (['job_start_q'], {}), '(job_start_q)\n', (2659, 2672), False, 'import heapq\n'), ((2818, 2844), 'heapq.heappop', 'heapq.heappop', (['job_start_q'], {}), '(job_start_q)\n', (2831, 2844), False, 'import heapq\n'), ((3078, 3168), 'heapq.heappush', 'heapq.heappush', (['job_start_q', '(schedule[emp_id][job_id + 1].start, emp_id, job_id + 1)'], {}), '(job_start_q, (schedule[emp_id][job_id + 1].start, emp_id, \n job_id + 1))\n', (3092, 3168), False, 'import heapq\n')]
thomaserlang/storitch
storitch/config.py
dbcf97af547d9cb1ae5c3994654e8db03e43a253
import os, yaml config = { 'debug': False, 'port': 5000, 'store_path': '/var/storitch', 'pool_size': 5, 'logging': { 'level': 'warning', 'path': None, 'max_size': 100 * 1000 * 1000,# ~ 95 mb 'num_backups': 10, }, 'image_exts': [ '.jpg', '.jpeg', '.png', '.tiff', '.tif', '.gif', '.bmp', '.bmp2', '.bmp3', '.dcm', '.dicom', '.webp', ], } def load(path=None): default_paths = [ '~/storitch.yaml', './storitch.yaml', '../storitch.yaml', '/etc/storitch/storitch.yaml', '/etc/storitch.yaml', ] if not path: path = os.environ.get('STORITCH_CONFIG', None) if not path: for p in default_paths: p = os.path.expanduser(p) if os.path.isfile(p): path = p break if not path: raise Exception('No config file specified.') if not os.path.isfile(path): raise Exception('Config: "{}" could not be found.'.format(path)) with open(path) as f: data = yaml.load(f, Loader=yaml.FullLoader) for key in data: if key in config: if isinstance(config[key], dict): config[key].update(data[key]) else: config[key] = data[key]
[((651, 690), 'os.environ.get', 'os.environ.get', (['"""STORITCH_CONFIG"""', 'None'], {}), "('STORITCH_CONFIG', None)\n", (665, 690), False, 'import os, yaml\n'), ((964, 984), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (978, 984), False, 'import os, yaml\n'), ((1100, 1136), 'yaml.load', 'yaml.load', (['f'], {'Loader': 'yaml.FullLoader'}), '(f, Loader=yaml.FullLoader)\n', (1109, 1136), False, 'import os, yaml\n'), ((768, 789), 'os.path.expanduser', 'os.path.expanduser', (['p'], {}), '(p)\n', (786, 789), False, 'import os, yaml\n'), ((809, 826), 'os.path.isfile', 'os.path.isfile', (['p'], {}), '(p)\n', (823, 826), False, 'import os, yaml\n')]
PipelineAI/models
keras/lstm-securitai/model/pipeline_invoke_python.py
d8df07877aa8b10ce9b84983bb440af75e84dca7
import io import os import numpy as np import pandas import json import logging #<== Optional. Log to console, file, kafka from pipeline_monitor import prometheus_monitor as monitor #<== Optional. Monitor runtime metrics from pipeline_logger import log import tensorflow as tf from tensorflow.contrib import predictor from keras.models import Sequential, load_model from keras.preprocessing import sequence from keras.preprocessing.text import Tokenizer from collections import OrderedDict _logger = logging.getLogger('pipeline-logger') _logger.setLevel(logging.INFO) _logger_stream_handler = logging.StreamHandler() _logger_stream_handler.setLevel(logging.INFO) _logger.addHandler(_logger_stream_handler) __all__ = ['invoke'] #<== Optional. Being a good Python citizen. _labels = { #<== Optional. Used for metrics/labels 'name': 'injection', 'tag': 'v1', 'type': 'tensorflow', 'runtime': 'python', 'chip': 'cpu', } def _initialize_upon_import(): #<== Optional. Called once upon server startup ''' Initialize / Restore Model Object. ''' model = load_model('securitai-lstm-model.h5') model.load_weights('securitai-lstm-weights.h5') model.compile(loss = 'binary_crossentropy', optimizer = 'adam', metrics = ['accuracy']) return model # This is called unconditionally at *module import time*... _model = _initialize_upon_import() #@log(labels=_labels, logger=_logger) #<== Optional. Sample and compare predictions def invoke(request): #<== Required. Called on every prediction '''Where the magic happens...''' with monitor(labels=_labels, name="transform_request"): #<== Optional. Expose fine-grained metrics transformed_request = _transform_request(request) #<== Optional. Transform input (json) into TensorFlow (tensor) with monitor(labels=_labels, name="invoke"): #<== Optional. Calls _model.predict() response = _model.predict(transformed_request) with monitor(labels=_labels, name="transform_response"): #<== Optional. Transform TensorFlow (tensor) into output (json) transformed_response = _transform_response(response) return transformed_response #<== Required. Returns the predicted value(s) def _transform_request(request): request_str = request.decode('utf-8') # tokenize the csv request and create json X = pandas.read_csv(io.StringIO(request_str), engine='python', quotechar='|', header=None).values[:,0] for index, item in enumerate(X): reqJson = json.loads(item, object_pairs_hook=OrderedDict) del reqJson['http']['timestamp'] del reqJson['http']['headers'] del reqJson['http']['source'] del reqJson['http']['route'] del reqJson['http']['responsePayload'] X[index] = json.dumps(reqJson, separators=(',', ':')) tokenizer = Tokenizer(filters='\t\n', char_level=True) tokenizer.fit_on_texts(X) # this used to be [log_entry] seq = tokenizer.texts_to_sequences([request_str]) max_log_length = 1024 log_entry_processed = sequence.pad_sequences(seq, maxlen=max_log_length) return log_entry_processed def _transform_response(response): return response[0] if __name__ == '__main__': with open('./pipeline_test_request.csv', 'rb') as fb: request_bytes = fb.read() response_bytes = invoke(request_bytes) print(response_bytes)
[((556, 592), 'logging.getLogger', 'logging.getLogger', (['"""pipeline-logger"""'], {}), "('pipeline-logger')\n", (573, 592), False, 'import logging\n'), ((649, 672), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (670, 672), False, 'import logging\n'), ((1310, 1347), 'keras.models.load_model', 'load_model', (['"""securitai-lstm-model.h5"""'], {}), "('securitai-lstm-model.h5')\n", (1320, 1347), False, 'from keras.models import Sequential, load_model\n'), ((3172, 3214), 'keras.preprocessing.text.Tokenizer', 'Tokenizer', ([], {'filters': '"""\t\n"""', 'char_level': '(True)'}), "(filters='\\t\\n', char_level=True)\n", (3181, 3214), False, 'from keras.preprocessing.text import Tokenizer\n'), ((3385, 3435), 'keras.preprocessing.sequence.pad_sequences', 'sequence.pad_sequences', (['seq'], {'maxlen': 'max_log_length'}), '(seq, maxlen=max_log_length)\n', (3407, 3435), False, 'from keras.preprocessing import sequence\n'), ((1872, 1921), 'pipeline_monitor.prometheus_monitor', 'monitor', ([], {'labels': '_labels', 'name': '"""transform_request"""'}), "(labels=_labels, name='transform_request')\n", (1879, 1921), True, 'from pipeline_monitor import prometheus_monitor as monitor\n'), ((2107, 2145), 'pipeline_monitor.prometheus_monitor', 'monitor', ([], {'labels': '_labels', 'name': '"""invoke"""'}), "(labels=_labels, name='invoke')\n", (2114, 2145), True, 'from pipeline_monitor import prometheus_monitor as monitor\n'), ((2265, 2315), 'pipeline_monitor.prometheus_monitor', 'monitor', ([], {'labels': '_labels', 'name': '"""transform_response"""'}), "(labels=_labels, name='transform_response')\n", (2272, 2315), True, 'from pipeline_monitor import prometheus_monitor as monitor\n'), ((2843, 2890), 'json.loads', 'json.loads', (['item'], {'object_pairs_hook': 'OrderedDict'}), '(item, object_pairs_hook=OrderedDict)\n', (2853, 2890), False, 'import json\n'), ((3112, 3154), 'json.dumps', 'json.dumps', (['reqJson'], {'separators': "(',', ':')"}), "(reqJson, separators=(',', ':'))\n", (3122, 3154), False, 'import json\n'), ((2705, 2729), 'io.StringIO', 'io.StringIO', (['request_str'], {}), '(request_str)\n', (2716, 2729), False, 'import io\n')]
ATLASControlTower/aCT
src/act/common/aCTReport.py
fb841bddbe086db9f0d620167c4a11ae4634ef4f
import argparse import importlib import os import re import signal import subprocess import sys import time import logging from act.common import aCTLogger from act.common.aCTConfig import aCTConfigAPP from act.arc import aCTDBArc class aCTReport: '''Print summary info on jobs in DB. Use --web to print html that is automatically refreshed. Add filenames to query more than one aCT DB''' def __init__(self, args): self.output = "" self.outfile = args.web self.actconfs = args.conffiles or [''] # empty string for default behaviour self.logger=aCTLogger.aCTLogger("aCTReport") self.actlog=self.logger() self.actlog.logger.setLevel(logging.INFO) self.criticallogger = aCTLogger.aCTLogger('aCTCritical', arclog=False) self.criticallog = self.criticallogger() if self.outfile: self.log('<META HTTP-EQUIV="refresh" CONTENT="60"><pre>') self.log(time.asctime() + '\n') self.db=aCTDBArc.aCTDBArc(self.actlog) def log(self, message=''): self.output += message + '\n' def AppReport(self): appconf = aCTConfigAPP() apps = appconf.getList(["modules", "app"]) for app in apps: try: ap = importlib.import_module(f'{app}.aCTReport').report self.log(ap(self.actconfs)) except ModuleNotFoundError as e: self.actlog.info(f'No report in module {app}') except AttributeError: self.actlog.info(f'aCTReport.report() not found in {app}') except Exception as e: self.actlog.error(f'Exception running {app}.aCTReport.report: {e}') def ProcessReport(self): if self.actconfs != ['']: return # don't print processes for combined report actprocscmd = 'ps ax -ww -o pid,etime,args' try: out = subprocess.run(actprocscmd.split(), check=True, encoding='utf-8', stdout=subprocess.PIPE).stdout except subprocess.CalledProcessError as e: self.log('Error: could not run ps command: %s' % e.stderr) return # Group processes by cluster cluster_procs = {} longprocesses = [] for line in out.split('\n'): reg = re.match(r'\s*(\d*)\s*(.*) .*python.* .*(aCT\w*)\.py\s?(\S*)', line) if reg: pid, runningtime, process, cluster = reg.groups() # ignore Main and this process if process in ['aCTReport', 'aCTMain', 'aCTHeartbeatWatchdog']: continue if cluster == '': cluster = '(no cluster defined)' elif not re.match(r'\d\d:\d\d$', runningtime): # Check for overrunning processes longprocesses.append((process, pid, cluster, runningtime)) if cluster in cluster_procs: cluster_procs[cluster].append(process) else: cluster_procs[cluster] = [process] for proc in longprocesses: self.log('WARNING: %s (pid %s) for %s running for more than one hour (%s), this process will be killed' % proc) # Kill process and log a critical message to send email # Too many emails, disable #self.criticallog.critical('Killing process %s (pid %s) for %s running for more than one hour (%s)' % proc) try: os.kill(int(proc[1]), signal.SIGKILL) except OSError: pass self.log() self.log('Active processes per cluster:') for cluster in sorted(cluster_procs): procs = cluster_procs[cluster] procs.sort() self.log(f'{cluster:>38.38}: {" ".join(procs)}') self.log() def ArcJobReport(self): rep={} rtot={} states = ["Undefined", "Accepted", "Preparing", "Submitting", "Queuing", "Running", "Finishing", "Finished", "Hold", "Killed", "Failed", "Deleted", "Other"] for conf in self.actconfs: if conf: os.environ['ACTCONFIGARC'] = conf db=aCTDBArc.aCTDBArc(self.actlog) c=db.db.conn.cursor() c.execute("select jobid,state from arcjobs") rows=c.fetchall() for r in rows: reg=re.search('.+//([^:]+)',str(r[0])) cl="" try: cl=reg.group(1) except: cl='WaitingSubmission' jid=str(r[1]) if jid == 'None': jid="Other" try: rep[cl][jid]+=1 except: try: rep[cl][jid]=1 except: rep[cl]={} rep[cl][jid]=1 try: rtot[jid]+=1 except: rtot[jid]=1 if sum(rtot.values()) == 0: return self.log(f"All ARC jobs: {sum(rtot.values())}") self.log(f"{'':39} {' '.join([f'{s:>9}' for s in states])}") for k in sorted(rep, key=lambda x: x.split('.')[-1]): log=f"{k:>38.38}:" for s in states: try: log += f'{rep[k][s]:>10}' except KeyError: log += f'{"-":>10}' self.log(log) log = f"{'Totals':>38}:" for s in states: try: log += f'{rtot[s]:>10}' except: log += f'{"-":>10}' self.log(log+'\n\n') def CondorJobReport(self): rep = {} rtot = {} condorjobstatemap = ['Undefined', # used before real state is known 'Idle', 'Running', 'Removed', 'Completed', 'Held', 'Transferring', 'Suspended'] for conf in self.actconfs: if conf: os.environ['ACTCONFIGARC'] = conf db=aCTDBArc.aCTDBArc(self.actlog) c = db.db.conn.cursor() c.execute("select cluster, JobStatus from condorjobs") rows = c.fetchall() for r in rows: cl = str(r[0]) if not cl: cl = 'WaitingSubmission' jid = r[1] try: rep[cl][jid]+=1 except: try: rep[cl][jid]=1 except: rep[cl]={} rep[cl][jid]=1 try: rtot[jid]+=1 except: rtot[jid]=1 if sum(rtot.values()) == 0: return self.log(f"All Condor jobs: {sum(rtot.values())}") self.log(f"{'':39} {' '.join([f'{s:>9}' for s in condorjobstatemap])}") for k in sorted(rep, key=lambda x: x.split('.')[-1]): log=f"{k:>38.38}:" for s in range(8): try: log += f'{rep[k][s]:>10}' except KeyError: log += f'{"-":>10}' self.log(log) log = f"{'Totals':>38}:" for s in range(8): try: log += f'{rtot[s]:>10}' except: log += f'{"-":>10}' self.log(log+'\n\n') def StuckReport(self): # Query for lost jobs older than lostlimit lostlimit = 86400 select = "(arcstate='submitted' or arcstate='running') and " \ + self.db.timeStampLessThan("tarcstate", lostlimit) + \ " order by tarcstate" columns = ['cluster'] jobs = self.db.getArcJobsInfo(select, columns) if jobs: self.log('Found %d jobs not updated in over %d seconds:\n' % (len(jobs), lostlimit)) clustercount = {} for job in jobs: try: host = re.search('.+//([^:]+)', job['cluster']).group(1) except: host = None if host in clustercount: clustercount[host] += 1 else: clustercount[host] = 1 for cluster, count in clustercount.items(): self.log(f'{count} {cluster}') self.log() def end(self): if self.outfile: self.log('</pre>') def main(): parser = argparse.ArgumentParser(description='Report table of aCT jobs.') parser.add_argument('conffiles', nargs='*', help='list of configuration files') parser.add_argument('--web', help='Output suitable for web page') parser.add_argument('--harvester', action='store_true', help='Dummy arg for backwards compatibility') args = parser.parse_args(sys.argv[1:]) acts = aCTReport(args) acts.AppReport() acts.ArcJobReport() acts.CondorJobReport() acts.StuckReport() acts.ProcessReport() acts.end() if acts.outfile is None: sys.stdout.write(acts.output) else: f=open(acts.outfile,"w") f.write(acts.output) f.close() if __name__ == '__main__': main()
[((8738, 8802), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Report table of aCT jobs."""'}), "(description='Report table of aCT jobs.')\n", (8761, 8802), False, 'import argparse\n'), ((592, 624), 'act.common.aCTLogger.aCTLogger', 'aCTLogger.aCTLogger', (['"""aCTReport"""'], {}), "('aCTReport')\n", (611, 624), False, 'from act.common import aCTLogger\n'), ((739, 787), 'act.common.aCTLogger.aCTLogger', 'aCTLogger.aCTLogger', (['"""aCTCritical"""'], {'arclog': '(False)'}), "('aCTCritical', arclog=False)\n", (758, 787), False, 'from act.common import aCTLogger\n'), ((994, 1024), 'act.arc.aCTDBArc.aCTDBArc', 'aCTDBArc.aCTDBArc', (['self.actlog'], {}), '(self.actlog)\n', (1011, 1024), False, 'from act.arc import aCTDBArc\n'), ((1140, 1154), 'act.common.aCTConfig.aCTConfigAPP', 'aCTConfigAPP', ([], {}), '()\n', (1152, 1154), False, 'from act.common.aCTConfig import aCTConfigAPP\n'), ((9306, 9335), 'sys.stdout.write', 'sys.stdout.write', (['acts.output'], {}), '(acts.output)\n', (9322, 9335), False, 'import sys\n'), ((2297, 2371), 're.match', 're.match', (['"""\\\\s*(\\\\d*)\\\\s*(.*) .*python.* .*(aCT\\\\w*)\\\\.py\\\\s?(\\\\S*)"""', 'line'], {}), "('\\\\s*(\\\\d*)\\\\s*(.*) .*python.* .*(aCT\\\\w*)\\\\.py\\\\s?(\\\\S*)', line)\n", (2305, 2371), False, 'import re\n'), ((4226, 4256), 'act.arc.aCTDBArc.aCTDBArc', 'aCTDBArc.aCTDBArc', (['self.actlog'], {}), '(self.actlog)\n', (4243, 4256), False, 'from act.arc import aCTDBArc\n'), ((6282, 6312), 'act.arc.aCTDBArc.aCTDBArc', 'aCTDBArc.aCTDBArc', (['self.actlog'], {}), '(self.actlog)\n', (6299, 6312), False, 'from act.arc import aCTDBArc\n'), ((954, 968), 'time.asctime', 'time.asctime', ([], {}), '()\n', (966, 968), False, 'import time\n'), ((1269, 1312), 'importlib.import_module', 'importlib.import_module', (['f"""{app}.aCTReport"""'], {}), "(f'{app}.aCTReport')\n", (1292, 1312), False, 'import importlib\n'), ((2720, 2759), 're.match', 're.match', (['"""\\\\d\\\\d:\\\\d\\\\d$"""', 'runningtime'], {}), "('\\\\d\\\\d:\\\\d\\\\d$', runningtime)\n", (2728, 2759), False, 'import re\n'), ((8251, 8291), 're.search', 're.search', (['""".+//([^:]+)"""', "job['cluster']"], {}), "('.+//([^:]+)', job['cluster'])\n", (8260, 8291), False, 'import re\n')]
mtcolman/django-DefectDojo
unittests/test_apiv2_user.py
76175aca446e077884bdb5e1d8e2a671a0840775
from rest_framework.test import APITestCase, APIClient from django.urls import reverse from rest_framework.authtoken.models import Token class UserTest(APITestCase): """ Test the User APIv2 endpoint. """ fixtures = ['dojo_testdata.json'] def setUp(self): token = Token.objects.get(user__username='admin') self.client = APIClient() self.client.credentials(HTTP_AUTHORIZATION='Token ' + token.key) def test_user_list(self): r = self.client.get(reverse('user-list')) self.assertEqual(r.status_code, 200, r.content[:1000]) user_list = r.json()['results'] self.assertTrue(len(user_list) >= 1, r.content[:1000]) for user in user_list: for item in ['username', 'first_name', 'last_name', 'email']: self.assertIn(item, user, r.content[:1000]) for item in ['password']: self.assertNotIn(item, user, r.content[:1000]) def test_user_add(self): # simple user without password r = self.client.post(reverse('user-list'), { "username": "api-user-1" }, format='json') self.assertEqual(r.status_code, 201, r.content[:1000]) # user with good password password = 'testTEST1234!@#$' r = self.client.post(reverse('user-list'), { "username": "api-user-2", "password": password }, format='json') self.assertEqual(r.status_code, 201, r.content[:1000]) # test password by fetching API key r = self.client.post(reverse('api-token-auth'), { "username": "api-user-2", "password": password }, format='json') self.assertEqual(r.status_code, 200, r.content[:1000]) # user with weak password r = self.client.post(reverse('user-list'), { "username": "api-user-3", "password": "weakPassword" }, format='json') self.assertEqual(r.status_code, 400, r.content[:1000]) self.assertIn('The password must contain at least 1 digit, 0-9.', r.content.decode("utf-8")) def test_user_change_password(self): # some user r = self.client.post(reverse('user-list'), { "username": "api-user-4" }, format='json') self.assertEqual(r.status_code, 201, r.content[:1000]) user_id = r.json()['id'] r = self.client.put("{}{}/".format(reverse('user-list'), user_id), { "username": "api-user-4", "first_name": "first" }, format='json',) self.assertEqual(r.status_code, 200, r.content[:1000]) r = self.client.patch("{}{}/".format(reverse('user-list'), user_id), { "last_name": "last" }, format='json') self.assertEqual(r.status_code, 200, r.content[:1000]) r = self.client.put("{}{}/".format(reverse('user-list'), user_id), { "username": "api-user-4", "password": "testTEST1234!@#$" }, format='json') self.assertEqual(r.status_code, 400, r.content[:1000]) self.assertIn("Update of password though API is not allowed", r.content.decode("utf-8")) r = self.client.patch("{}{}/".format(reverse('user-list'), user_id), { "password": "testTEST1234!@#$" }, format='json') self.assertEqual(r.status_code, 400, r.content[:1000]) self.assertIn("Update of password though API is not allowed", r.content.decode("utf-8"))
[((294, 335), 'rest_framework.authtoken.models.Token.objects.get', 'Token.objects.get', ([], {'user__username': '"""admin"""'}), "(user__username='admin')\n", (311, 335), False, 'from rest_framework.authtoken.models import Token\n'), ((358, 369), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (367, 369), False, 'from rest_framework.test import APITestCase, APIClient\n'), ((502, 522), 'django.urls.reverse', 'reverse', (['"""user-list"""'], {}), "('user-list')\n", (509, 522), False, 'from django.urls import reverse\n'), ((1054, 1074), 'django.urls.reverse', 'reverse', (['"""user-list"""'], {}), "('user-list')\n", (1061, 1074), False, 'from django.urls import reverse\n'), ((1306, 1326), 'django.urls.reverse', 'reverse', (['"""user-list"""'], {}), "('user-list')\n", (1313, 1326), False, 'from django.urls import reverse\n'), ((1564, 1589), 'django.urls.reverse', 'reverse', (['"""api-token-auth"""'], {}), "('api-token-auth')\n", (1571, 1589), False, 'from django.urls import reverse\n'), ((1817, 1837), 'django.urls.reverse', 'reverse', (['"""user-list"""'], {}), "('user-list')\n", (1824, 1837), False, 'from django.urls import reverse\n'), ((2199, 2219), 'django.urls.reverse', 'reverse', (['"""user-list"""'], {}), "('user-list')\n", (2206, 2219), False, 'from django.urls import reverse\n'), ((2426, 2446), 'django.urls.reverse', 'reverse', (['"""user-list"""'], {}), "('user-list')\n", (2433, 2446), False, 'from django.urls import reverse\n'), ((2668, 2688), 'django.urls.reverse', 'reverse', (['"""user-list"""'], {}), "('user-list')\n", (2675, 2688), False, 'from django.urls import reverse\n'), ((2867, 2887), 'django.urls.reverse', 'reverse', (['"""user-list"""'], {}), "('user-list')\n", (2874, 2887), False, 'from django.urls import reverse\n'), ((3214, 3234), 'django.urls.reverse', 'reverse', (['"""user-list"""'], {}), "('user-list')\n", (3221, 3234), False, 'from django.urls import reverse\n')]
ankit-kushwaha-51/RESTful_API
src/init.py
4513e8a058cb0200b41d47830b93b8a23ea38d7b
from flask import Flask from src.models import db from . import config def create_app(): flask_app = Flask(__name__) flask_app.config['SQLALCHEMY_DATABASE_URI'] = config.DATABASE_CONNECTION_URI flask_app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False flask_app.app_context().push() db.init_app(flask_app) db.create_all() return flask_app
[((108, 123), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (113, 123), False, 'from flask import Flask\n'), ((307, 329), 'src.models.db.init_app', 'db.init_app', (['flask_app'], {}), '(flask_app)\n', (318, 329), False, 'from src.models import db\n'), ((334, 349), 'src.models.db.create_all', 'db.create_all', ([], {}), '()\n', (347, 349), False, 'from src.models import db\n')]
nicoddemus/dependencies
tests/helpers/examples/order/tasks.py
74180e2c6098d8ad03bc53c5703bdf8dc61c3ed9
from dependencies import Injector from dependencies import this from dependencies.contrib.celery import shared_task from examples.order.commands import ProcessOrder @shared_task class ProcessOrderTask(Injector): name = "process_order" run = ProcessOrder bind = True retry = this.task.retry
[]
SocrammBR/Desafios-Python-CursoEmVideo
001 - 050/ex032.py
bd2454a24134500343ece91b936c169d3a66f89e
ano = int(input('Digite o ano: ')) if (ano%4) == 0: print ('Ele é bissexto') else: print ('Ele não é bissexto')
[]
vikneswaran20/rn
rn/__init__.py
33e0bfaf58bb8a5ec54c6d010035693b35e9909d
__version__ = '0.0.1' __license__ = 'BSD'
[]
FlexMeasures/flexmeasures
flexmeasures/cli/data_edit.py
a4367976d37ac5721b8eb3ce8a2414595e52c678
from datetime import timedelta from typing import Union, List, Optional import click import pandas as pd from flask import current_app as app from flask.cli import with_appcontext from flexmeasures import Sensor from flexmeasures.data import db from flexmeasures.data.schemas.generic_assets import GenericAssetIdField from flexmeasures.data.schemas.sensors import SensorIdField from flexmeasures.data.models.generic_assets import GenericAsset from flexmeasures.data.models.time_series import TimedBelief from flexmeasures.data.utils import save_to_db @click.group("edit") def fm_edit_data(): """FlexMeasures: Edit data.""" @fm_edit_data.command("attribute") @with_appcontext @click.option( "--asset-id", "assets", required=False, multiple=True, type=GenericAssetIdField(), help="Add/edit attribute to this asset. Follow up with the asset's ID.", ) @click.option( "--sensor-id", "sensors", required=False, multiple=True, type=SensorIdField(), help="Add/edit attribute to this sensor. Follow up with the sensor's ID.", ) @click.option( "--attribute", "attribute_key", required=True, help="Add/edit this attribute. Follow up with the name of the attribute.", ) @click.option( "--float", "attribute_float_value", required=False, type=float, help="Set the attribute to this float value.", ) @click.option( "--bool", "attribute_bool_value", required=False, type=bool, help="Set the attribute to this bool value.", ) @click.option( "--str", "attribute_str_value", required=False, type=str, help="Set the attribute to this string value.", ) @click.option( "--int", "attribute_int_value", required=False, type=int, help="Set the attribute to this integer value.", ) @click.option( "--null", "attribute_null_value", required=False, is_flag=True, default=False, help="Set the attribute to a null value.", ) def edit_attribute( attribute_key: str, assets: List[GenericAsset], sensors: List[Sensor], attribute_null_value: bool, attribute_float_value: Optional[float] = None, attribute_bool_value: Optional[bool] = None, attribute_str_value: Optional[str] = None, attribute_int_value: Optional[int] = None, ): """Edit (or add) an asset attribute or sensor attribute.""" if not assets and not sensors: raise ValueError("Missing flag: pass at least one --asset-id or --sensor-id.") # Parse attribute value attribute_value = parse_attribute_value( attribute_float_value=attribute_float_value, attribute_bool_value=attribute_bool_value, attribute_str_value=attribute_str_value, attribute_int_value=attribute_int_value, attribute_null_value=attribute_null_value, ) # Set attribute for asset in assets: asset.attributes[attribute_key] = attribute_value db.session.add(asset) for sensor in sensors: sensor.attributes[attribute_key] = attribute_value db.session.add(sensor) db.session.commit() print("Successfully edited/added attribute.") @fm_edit_data.command("resample-data") @with_appcontext @click.option( "--sensor-id", "sensor_ids", multiple=True, required=True, help="Resample data for this sensor. Follow up with the sensor's ID. This argument can be given multiple times.", ) @click.option( "--event-resolution", "event_resolution_in_minutes", type=int, required=True, help="New event resolution as an integer number of minutes.", ) @click.option( "--from", "start_str", required=False, help="Resample only data from this datetime onwards. Follow up with a timezone-aware datetime in ISO 6801 format.", ) @click.option( "--until", "end_str", required=False, help="Resample only data until this datetime. Follow up with a timezone-aware datetime in ISO 6801 format.", ) @click.option( "--skip-integrity-check", is_flag=True, help="Whether to skip checking the resampled time series data for each sensor." " By default, an excerpt and the mean value of the original" " and resampled data will be shown for manual approval.", ) def resample_sensor_data( sensor_ids: List[int], event_resolution_in_minutes: int, start_str: Optional[str] = None, end_str: Optional[str] = None, skip_integrity_check: bool = False, ): """Assign a new event resolution to an existing sensor and resample its data accordingly.""" event_resolution = timedelta(minutes=event_resolution_in_minutes) event_starts_after = pd.Timestamp(start_str) # note that "" or None becomes NaT event_ends_before = pd.Timestamp(end_str) for sensor_id in sensor_ids: sensor = Sensor.query.get(sensor_id) if sensor.event_resolution == event_resolution: print(f"{sensor} already has the desired event resolution.") continue df_original = sensor.search_beliefs( most_recent_beliefs_only=False, event_starts_after=event_starts_after, event_ends_before=event_ends_before, ).sort_values("event_start") df_resampled = df_original.resample_events(event_resolution).sort_values( "event_start" ) if not skip_integrity_check: message = "" if sensor.event_resolution < event_resolution: message += f"Downsampling {sensor} to {event_resolution} will result in a loss of data. " click.confirm( message + f"Data before:\n{df_original}\nData after:\n{df_resampled}\nMean before: {df_original['event_value'].mean()}\nMean after: {df_resampled['event_value'].mean()}\nContinue?", abort=True, ) # Update sensor sensor.event_resolution = event_resolution db.session.add(sensor) # Update sensor data query = TimedBelief.query.filter(TimedBelief.sensor == sensor) if not pd.isnull(event_starts_after): query = query.filter(TimedBelief.event_start >= event_starts_after) if not pd.isnull(event_ends_before): query = query.filter( TimedBelief.event_start + sensor.event_resolution <= event_ends_before ) query.delete() save_to_db(df_resampled, bulk_save_objects=True) db.session.commit() print("Successfully resampled sensor data.") app.cli.add_command(fm_edit_data) def parse_attribute_value( attribute_null_value: bool, attribute_float_value: Optional[float] = None, attribute_bool_value: Optional[bool] = None, attribute_str_value: Optional[str] = None, attribute_int_value: Optional[int] = None, ) -> Union[float, int, bool, str, None]: """Parse attribute value.""" if not single_true( [attribute_null_value] + [ v is not None for v in [ attribute_float_value, attribute_bool_value, attribute_str_value, attribute_int_value, ] ] ): raise ValueError("Cannot set multiple values simultaneously.") if attribute_null_value: return None elif attribute_float_value is not None: return float(attribute_float_value) elif attribute_bool_value is not None: return bool(attribute_bool_value) elif attribute_int_value is not None: return int(attribute_int_value) return attribute_str_value def single_true(iterable) -> bool: i = iter(iterable) return any(i) and not any(i)
[((556, 575), 'click.group', 'click.group', (['"""edit"""'], {}), "('edit')\n", (567, 575), False, 'import click\n'), ((1078, 1217), 'click.option', 'click.option', (['"""--attribute"""', '"""attribute_key"""'], {'required': '(True)', 'help': '"""Add/edit this attribute. Follow up with the name of the attribute."""'}), "('--attribute', 'attribute_key', required=True, help=\n 'Add/edit this attribute. Follow up with the name of the attribute.')\n", (1090, 1217), False, 'import click\n'), ((1233, 1360), 'click.option', 'click.option', (['"""--float"""', '"""attribute_float_value"""'], {'required': '(False)', 'type': 'float', 'help': '"""Set the attribute to this float value."""'}), "('--float', 'attribute_float_value', required=False, type=float,\n help='Set the attribute to this float value.')\n", (1245, 1360), False, 'import click\n'), ((1381, 1504), 'click.option', 'click.option', (['"""--bool"""', '"""attribute_bool_value"""'], {'required': '(False)', 'type': 'bool', 'help': '"""Set the attribute to this bool value."""'}), "('--bool', 'attribute_bool_value', required=False, type=bool,\n help='Set the attribute to this bool value.')\n", (1393, 1504), False, 'import click\n'), ((1525, 1648), 'click.option', 'click.option', (['"""--str"""', '"""attribute_str_value"""'], {'required': '(False)', 'type': 'str', 'help': '"""Set the attribute to this string value."""'}), "('--str', 'attribute_str_value', required=False, type=str, help\n ='Set the attribute to this string value.')\n", (1537, 1648), False, 'import click\n'), ((1668, 1792), 'click.option', 'click.option', (['"""--int"""', '"""attribute_int_value"""'], {'required': '(False)', 'type': 'int', 'help': '"""Set the attribute to this integer value."""'}), "('--int', 'attribute_int_value', required=False, type=int, help\n ='Set the attribute to this integer value.')\n", (1680, 1792), False, 'import click\n'), ((1812, 1950), 'click.option', 'click.option', (['"""--null"""', '"""attribute_null_value"""'], {'required': '(False)', 'is_flag': '(True)', 'default': '(False)', 'help': '"""Set the attribute to a null value."""'}), "('--null', 'attribute_null_value', required=False, is_flag=True,\n default=False, help='Set the attribute to a null value.')\n", (1824, 1950), False, 'import click\n'), ((3210, 3409), 'click.option', 'click.option', (['"""--sensor-id"""', '"""sensor_ids"""'], {'multiple': '(True)', 'required': '(True)', 'help': '"""Resample data for this sensor. Follow up with the sensor\'s ID. This argument can be given multiple times."""'}), '(\'--sensor-id\', \'sensor_ids\', multiple=True, required=True,\n help=\n "Resample data for this sensor. Follow up with the sensor\'s ID. This argument can be given multiple times."\n )\n', (3222, 3409), False, 'import click\n'), ((3420, 3581), 'click.option', 'click.option', (['"""--event-resolution"""', '"""event_resolution_in_minutes"""'], {'type': 'int', 'required': '(True)', 'help': '"""New event resolution as an integer number of minutes."""'}), "('--event-resolution', 'event_resolution_in_minutes', type=int,\n required=True, help='New event resolution as an integer number of minutes.'\n )\n", (3432, 3581), False, 'import click\n'), ((3597, 3774), 'click.option', 'click.option', (['"""--from"""', '"""start_str"""'], {'required': '(False)', 'help': '"""Resample only data from this datetime onwards. Follow up with a timezone-aware datetime in ISO 6801 format."""'}), "('--from', 'start_str', required=False, help=\n 'Resample only data from this datetime onwards. Follow up with a timezone-aware datetime in ISO 6801 format.'\n )\n", (3609, 3774), False, 'import click\n'), ((3785, 3954), 'click.option', 'click.option', (['"""--until"""', '"""end_str"""'], {'required': '(False)', 'help': '"""Resample only data until this datetime. Follow up with a timezone-aware datetime in ISO 6801 format."""'}), "('--until', 'end_str', required=False, help=\n 'Resample only data until this datetime. Follow up with a timezone-aware datetime in ISO 6801 format.'\n )\n", (3797, 3954), False, 'import click\n'), ((3965, 4220), 'click.option', 'click.option', (['"""--skip-integrity-check"""'], {'is_flag': '(True)', 'help': '"""Whether to skip checking the resampled time series data for each sensor. By default, an excerpt and the mean value of the original and resampled data will be shown for manual approval."""'}), "('--skip-integrity-check', is_flag=True, help=\n 'Whether to skip checking the resampled time series data for each sensor. By default, an excerpt and the mean value of the original and resampled data will be shown for manual approval.'\n )\n", (3977, 4220), False, 'import click\n'), ((6495, 6528), 'flask.current_app.cli.add_command', 'app.cli.add_command', (['fm_edit_data'], {}), '(fm_edit_data)\n', (6514, 6528), True, 'from flask import current_app as app\n'), ((3081, 3100), 'flexmeasures.data.db.session.commit', 'db.session.commit', ([], {}), '()\n', (3098, 3100), False, 'from flexmeasures.data import db\n'), ((4566, 4612), 'datetime.timedelta', 'timedelta', ([], {'minutes': 'event_resolution_in_minutes'}), '(minutes=event_resolution_in_minutes)\n', (4575, 4612), False, 'from datetime import timedelta\n'), ((4638, 4661), 'pandas.Timestamp', 'pd.Timestamp', (['start_str'], {}), '(start_str)\n', (4650, 4661), True, 'import pandas as pd\n'), ((4722, 4743), 'pandas.Timestamp', 'pd.Timestamp', (['end_str'], {}), '(end_str)\n', (4734, 4743), True, 'import pandas as pd\n'), ((6424, 6443), 'flexmeasures.data.db.session.commit', 'db.session.commit', ([], {}), '()\n', (6441, 6443), False, 'from flexmeasures.data import db\n'), ((2938, 2959), 'flexmeasures.data.db.session.add', 'db.session.add', (['asset'], {}), '(asset)\n', (2952, 2959), False, 'from flexmeasures.data import db\n'), ((3054, 3076), 'flexmeasures.data.db.session.add', 'db.session.add', (['sensor'], {}), '(sensor)\n', (3068, 3076), False, 'from flexmeasures.data import db\n'), ((780, 801), 'flexmeasures.data.schemas.generic_assets.GenericAssetIdField', 'GenericAssetIdField', ([], {}), '()\n', (799, 801), False, 'from flexmeasures.data.schemas.generic_assets import GenericAssetIdField\n'), ((979, 994), 'flexmeasures.data.schemas.sensors.SensorIdField', 'SensorIdField', ([], {}), '()\n', (992, 994), False, 'from flexmeasures.data.schemas.sensors import SensorIdField\n'), ((4794, 4821), 'flexmeasures.Sensor.query.get', 'Sensor.query.get', (['sensor_id'], {}), '(sensor_id)\n', (4810, 4821), False, 'from flexmeasures import Sensor\n'), ((5910, 5932), 'flexmeasures.data.db.session.add', 'db.session.add', (['sensor'], {}), '(sensor)\n', (5924, 5932), False, 'from flexmeasures.data import db\n'), ((5979, 6033), 'flexmeasures.data.models.time_series.TimedBelief.query.filter', 'TimedBelief.query.filter', (['(TimedBelief.sensor == sensor)'], {}), '(TimedBelief.sensor == sensor)\n', (6003, 6033), False, 'from flexmeasures.data.models.time_series import TimedBelief\n'), ((6371, 6419), 'flexmeasures.data.utils.save_to_db', 'save_to_db', (['df_resampled'], {'bulk_save_objects': '(True)'}), '(df_resampled, bulk_save_objects=True)\n', (6381, 6419), False, 'from flexmeasures.data.utils import save_to_db\n'), ((6049, 6078), 'pandas.isnull', 'pd.isnull', (['event_starts_after'], {}), '(event_starts_after)\n', (6058, 6078), True, 'import pandas as pd\n'), ((6175, 6203), 'pandas.isnull', 'pd.isnull', (['event_ends_before'], {}), '(event_ends_before)\n', (6184, 6203), True, 'import pandas as pd\n')]
ArseniumGX/bluemer-modulo2
semana2/mail_settings.py
24e5071b734de362dc47ef9d402c191699d15b43
mail_settings = { "MAIL_SERVER": 'smtp.gmail.com', "MAIL_PORT": 465, "MAIL_USE_TLS": False, "MAIL_USE_SSL": True, "MAIL_USERNAME": 'c003.teste.jp@gmail.com', "MAIL_PASSWORD": 'C003.teste' }
[]
dingjingmaster/blog_spider
frame/base/parser.py
7a0885bf886166eac0caca4471ee9f6424be2225
#!/usr/bin/env python3.6 # -*- encoding=utf8 -*- import pyquery """ 需求字段: 標題、發表日期、分類、標籤、內容、圖片 需要的字段信息 1. 网站根URL 2. 解析器名字 3. 解析器类型 1. PARSER_PASSAGE_URL 文章URL 2. PARSER_PASSAGE_TITLE 文章标题 3. PARSER_PASSAGE_DATE 发表日期 4. PARSER_PASSAGE_CATEGORY 文章分類 5. PARSER_PASSAGE_TAG 文章標籤 6. PARSER_PASSAGE_CONTENT 文章内容 7. PARSER_PASSAGE_IMGURL 文章中的图片 URL """ class Parser(object): def __init__ (self): self._webURL = '' self._parserName = 'base_parser' def _parser_passage_url (self, doc: str) -> (bool, str): return def _parser_passage_title (self, doc: str) -> (bool, str): return def _parser_passage_date (self, doc: str) -> (bool, str): return def _parser_passage_category (self, doc: str) -> (bool, str): return def _parser_passage_tag (self, doc: str) -> (bool, str): return def _parser_passage_content (self, doc: str) -> (bool, str): return def _parser_passage_img_url (self, doc: str) -> (bool, str, bytes): return def get_parser_name (self): return self._parserName @staticmethod def _parser (doc: str, rule: str): return pyquery.PyQuery(doc).find(rule) def parse (self, doc: str, rule='', parse_type=-1): if self.PARSER_PASSAGE_URL == parse_type: if doc == '' or doc == None: return (False, '') return self._parser_passage_url(doc) elif self.PARSER_PASSAGE_TITLE == parse_type: if doc == '' or doc == None: return (False, '') return self._parser_passage_title(doc) elif self.PARSER_PASSAGE_DATE == parse_type: if doc == '' or doc == None: return (False, '') return self._parser_passage_date(doc) elif self.PARSER_PASSAGE_CATEGORY == parse_type: if doc == '' or doc == None: return (False, '') return self._parser_passage_category(doc) elif self.PARSER_PASSAGE_TAG == parse_type: if doc == '' or doc == None: return (False, '') return self._parser_passage_tag(doc) elif self.PARSER_PASSAGE_CONTENT == parse_type: if doc == '' or doc == None: return (False, '') return self._parser_passage_content(doc) elif self.PARSER_PASSAGE_IMGURL == parse_type: if doc == '' or doc == None: return (False, '') return self._parser_passage_img_url(doc) else: if doc == '' or doc == None: return (False, '') return Parser._parser(doc, rule) PARSER_PASSAGE_URL = 1 PARSER_PASSAGE_TITLE = 2 PARSER_PASSAGE_DATE = 3 PARSER_PASSAGE_CATEGORY = 4 PARSER_PASSAGE_TAG = 5 PARSER_PASSAGE_CONTENT = 6 PARSER_PASSAGE_IMGURL = 7
[((1374, 1394), 'pyquery.PyQuery', 'pyquery.PyQuery', (['doc'], {}), '(doc)\n', (1389, 1394), False, 'import pyquery\n')]
Commodore-Bench/u5remastered
tools/mkblocks.py
02c7ed86055e368b97d3c3c5ca26622782bd564d
#!/usr/bin/env python3 # ---------------------------------------------------------------------------- # Copyright 2019 Drunella # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ---------------------------------------------------------------------------- import os import sys import glob import subprocess import argparse import hashlib import traceback import pprint def readblockmap_info(filename): directory = dict() with open(filename) as f: result = [line.split() for line in f] for l in result: directory[l[0]] = l[1:] return directory def readdisks_info(filename): disks = [] with open(filename) as f: result = [line.split() for line in f] #pprint.pprint(result) return result def readdisks_getdiskinfo(disks, diskname): for d in disks: if d[0] == diskname: return d return [] def map_initialize(): global bank_data, map_data map_data = bytearray([0xff] * 0x800) def crtmap_appendentry(filename, block, name, address): with open(filename, "at") as f: content = "{0} f {1} addr 0x{2:04x}\n".format(block, name, address) return f.write(content) def load_file(filename): with open(filename, "rb") as f: return f.read() def write_prg(dirname, lowhigh, data): if lowhigh == 0: # low a = bytearray(2) a[0] = 0 a[1] = 0x80 elif lowhigh == 1: # high a = bytearray(2) a[0] = 0 a[1] = 0xA0 else: raise Exception("lowhigh can only be 0 or 1") with open(dirname, "wb") as f: #f.write(a) f.write(data) def blockmap_appendentry(diskid, line, bank, highaddress): global map_data base = diskid * 256 + line * 2 map_data[base] = bank map_data[base+1] = highaddress #print("blockmap_appendentry: " + str(base) + ": " + str(bank) + " " + str(highaddress)) def calculate_address(lowhigh): if lowhigh == 0: # low a = 0x80 elif lowhigh == 1: # high a = 0xA0 else: raise Exception("lowhigh can only be 0 or 1") return a def main(argv): global bank_data, map_data p = argparse.ArgumentParser() p.add_argument("-v", dest="verbose", action="store_true", help="Verbose output.") p.add_argument("-o", dest="disks", action="store", required=True, help="disk configuration file.") p.add_argument("-f", dest="files", action="store", required=True, help="files directory.") p.add_argument("-m", dest="crtfile", action="store", required=True, help="crt.map file") p.add_argument("-d", dest="destination", action="store", required=True, help="destination directory.") p.add_argument("-b", dest="blockmap", action="store", required=True, help="blockmap file.") #p.add_argument("-f", dest="fileoutput", action="store", required=True, help="output data content file.") args = p.parse_args() #temp_path = os.path.join(args.build, "temp") #os.makedirs(temp_path, exist_ok=True) files_path = args.files #os.path.join(args.build, "files") os.makedirs(files_path, exist_ok=True) destination_path = args.destination #os.path.join(args.build, "obj") os.makedirs(destination_path, exist_ok=True) disks = readdisks_info(args.disks) blockmap = readblockmap_info(args.blockmap) map_initialize() if os.path.exists(args.crtfile): os.remove(args.crtfile) # add blocks file for d in ("britannia", "towne", "dwelling", "castle", "keep", "dungeon", "underworld"): diskinfo = readdisks_getdiskinfo(disks, d) starttrack = int(diskinfo[2], 0) height = int(diskinfo[4], 0) - int(diskinfo[2], 0) + 1 diskid = int(diskinfo[1], 0) - 0x41 startbank = int(blockmap[d][0], 0) lowhigh = int(blockmap[d][1], 0) block_data = load_file(os.path.join(files_path, d + ".data")) # build map and blocks map_data[diskid*256+255] = starttrack for b in range(0, height, 2): # double line or single line #factor = 2 #if b+1 >= height: # factor = 1 # make data bank_data = bytearray([0xff] * 0x2000) baseaddress = calculate_address(lowhigh) if b+1 >= height: # one line s = b * 256*16 l = 0x1000 bank_data[0:l] = block_data[s:s+l] blockmap_appendentry(diskid, b, startbank, baseaddress) else: # two lines s = b * 256*16 l = 0x2000 bank_data[0:l] = block_data[s:s+l] blockmap_appendentry(diskid, b, startbank, baseaddress) blockmap_appendentry(diskid, b+1, startbank, baseaddress+0x10) # write data and map filename = "{0}_{1:02d}.aprg".format(d, b) write_prg(os.path.join(destination_path, filename), lowhigh, bank_data) crtmap_appendentry(args.crtfile, startbank, filename, baseaddress * 0x100) # increase values startbank += 1 # write block map blockmap_bank = int(blockmap["blockmap"][0], 0) blockmap_lowhigh = int(blockmap["blockmap"][1], 0) blockmap_address = calculate_address(blockmap_lowhigh) * 256 #blockmap_appendentry(0, b, startbank, baseaddress) blockmapname = os.path.join(destination_path, "blockmap.aprg") write_prg(blockmapname, blockmap_lowhigh, map_data) crtmap_appendentry(args.crtfile, blockmap_bank, "blockmap.aprg", blockmap_address) return 0 if __name__ == '__main__': try: retval = main(sys.argv) sys.exit(retval) except Exception as e: print(e) traceback.print_exc() sys.exit(1)
[((2696, 2721), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2719, 2721), False, 'import argparse\n'), ((3598, 3636), 'os.makedirs', 'os.makedirs', (['files_path'], {'exist_ok': '(True)'}), '(files_path, exist_ok=True)\n', (3609, 3636), False, 'import os\n'), ((3714, 3758), 'os.makedirs', 'os.makedirs', (['destination_path'], {'exist_ok': '(True)'}), '(destination_path, exist_ok=True)\n', (3725, 3758), False, 'import os\n'), ((3876, 3904), 'os.path.exists', 'os.path.exists', (['args.crtfile'], {}), '(args.crtfile)\n', (3890, 3904), False, 'import os\n'), ((5935, 5982), 'os.path.join', 'os.path.join', (['destination_path', '"""blockmap.aprg"""'], {}), "(destination_path, 'blockmap.aprg')\n", (5947, 5982), False, 'import os\n'), ((3914, 3937), 'os.remove', 'os.remove', (['args.crtfile'], {}), '(args.crtfile)\n', (3923, 3937), False, 'import os\n'), ((6230, 6246), 'sys.exit', 'sys.exit', (['retval'], {}), '(retval)\n', (6238, 6246), False, 'import sys\n'), ((4371, 4408), 'os.path.join', 'os.path.join', (['files_path', "(d + '.data')"], {}), "(files_path, d + '.data')\n", (4383, 4408), False, 'import os\n'), ((6299, 6320), 'traceback.print_exc', 'traceback.print_exc', ([], {}), '()\n', (6318, 6320), False, 'import traceback\n'), ((6329, 6340), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (6337, 6340), False, 'import sys\n'), ((5446, 5486), 'os.path.join', 'os.path.join', (['destination_path', 'filename'], {}), '(destination_path, filename)\n', (5458, 5486), False, 'import os\n')]
boxingbeetle/apetest
src/apetest/decode.py
c6dd7aaca014c64eec4bde7e755c4a3dec72404a
# SPDX-License-Identifier: BSD-3-Clause """ Text decode functions. These functions can be used to get Unicode strings from a series of bytes. """ from codecs import ( BOM_UTF8, BOM_UTF16_BE, BOM_UTF16_LE, BOM_UTF32_BE, BOM_UTF32_LE, CodecInfo, lookup as lookup_codec, ) from collections import OrderedDict from typing import Dict, Iterable, Optional, Tuple from apetest.typing import LoggerT def encoding_from_bom(data: bytes) -> Optional[str]: """ Look for a byte-order-marker at the start of the given C{bytes}. If found, return the encoding matching that BOM, otherwise return C{None}. """ if data.startswith(BOM_UTF8): return "utf-8" elif data.startswith(BOM_UTF16_LE) or data.startswith(BOM_UTF16_BE): return "utf-16" elif data.startswith(BOM_UTF32_LE) or data.startswith(BOM_UTF32_BE): return "utf-32" else: return None def standard_codec_name(name: str) -> str: """ Map a codec name to the preferred standardized version. The preferred names were taken from this list published by IANA: U{http://www.iana.org/assignments/character-sets/character-sets.xhtml} @param name: Text encoding name, in lower case. """ if name.startswith("iso8859"): return "iso-8859" + name[7:] return { "ascii": "us-ascii", "euc_jp": "euc-jp", "euc_kr": "euc-kr", "iso2022_jp": "iso-2022-jp", "iso2022_jp_2": "iso-2022-jp-2", "iso2022_kr": "iso-2022-kr", }.get(name, name) def try_decode(data: bytes, encodings: Iterable[str]) -> Tuple[str, str]: """ Attempt to decode text using the given encodings in order. @param data: Encoded version of the text. @param encodings: Names of the encodings to try. Must all be lower case. @return: C{(text, encoding)} The decoded string and the encoding used to decode it. The returned encoding is name the preferred name, which could differ from the name used in the C{encodings} argument. @raise ValueError: If the text could not be decoded. """ # Build sequence of codecs to try. codecs: Dict[str, CodecInfo] = OrderedDict() for encoding in encodings: try: codec = lookup_codec(encoding) except LookupError: pass else: codecs[standard_codec_name(codec.name)] = codec # Apply decoders to the document. for name, codec in codecs.items(): try: text, consumed = codec.decode(data, "strict") except UnicodeDecodeError: continue if consumed == len(data): return text, name raise ValueError("Unable to determine document encoding") def decode_and_report( data: bytes, encoding_options: Iterable[Tuple[Optional[str], str]], logger: LoggerT, ) -> Tuple[str, str]: """ Attempt to decode text using several encoding options in order. @param data: Encoded version of the text. @param encoding_options: C{(encoding | None, source)*} Each option is a pair of encoding name and a description of where this encoding suggestion originated. If the encoding name is C{None}, the option is skipped. @param logger: Non-fatal problems are logged here. Such problems include an unknown or differing encodings among the options. @return: C{(text, encoding)} The decoded string and the encoding used to decode it. @raise ValueError: If the text could not be decoded. """ # Filter and remember encoding options. options = [ (encoding, source) for encoding, source in encoding_options if encoding is not None ] encodings = [encoding for encoding, source in options] # Always try to decode as UTF-8, since that is the most common encoding # these days, plus it's a superset of ASCII so it also works for old or # simple documents. encodings.append("utf-8") text, used_encoding = try_decode(data, encodings) # Report differences between suggested encodings and the one we # settled on. for encoding, source in options: try: codec = lookup_codec(encoding) except LookupError: logger.warning( '%s specifies encoding "%s", which is unknown to Python', source, encoding, ) continue std_name = standard_codec_name(codec.name) if std_name != used_encoding: logger.warning( '%s specifies encoding "%s", ' 'while actual encoding seems to be "%s"', source, encoding, used_encoding, ) elif std_name != encoding: logger.info( '%s specifies encoding "%s", ' 'which is not the standard name "%s"', source, encoding, used_encoding, ) return text, used_encoding
[((2223, 2236), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2234, 2236), False, 'from collections import OrderedDict\n'), ((2301, 2323), 'codecs.lookup', 'lookup_codec', (['encoding'], {}), '(encoding)\n', (2313, 2323), True, 'from codecs import BOM_UTF8, BOM_UTF16_BE, BOM_UTF16_LE, BOM_UTF32_BE, BOM_UTF32_LE, CodecInfo, lookup as lookup_codec\n'), ((4266, 4288), 'codecs.lookup', 'lookup_codec', (['encoding'], {}), '(encoding)\n', (4278, 4288), True, 'from codecs import BOM_UTF8, BOM_UTF16_BE, BOM_UTF16_LE, BOM_UTF32_BE, BOM_UTF32_LE, CodecInfo, lookup as lookup_codec\n')]
jiangycTarheel/Compositional-Auxseq
utils.py
e4645a92c21c893cd320eb186c19d392bc147b43
import os import json import gzip from copy import deepcopy, copy import numpy as np import csv import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader, RandomSampler from transformers.tokenization_utils import trim_batch class LabelSmoothingLoss(nn.Module): def __init__(self, label_smooth, tgt_vocab_size, ignore_index=-100): assert 0. < label_smooth <= 1. self.ignore_index = ignore_index super(LabelSmoothingLoss, self).__init__() smoothing_value = label_smooth / (tgt_vocab_size - 2) one_hot = torch.full((tgt_vocab_size,), smoothing_value) one_hot[self.ignore_index] = 0 self.register_buffer('one_hot', one_hot.unsqueeze(0).unsqueeze(0)) self.confidence = 1.0 - label_smooth self.lossfct = torch.nn.KLDivLoss(reduction='none') def forward(self, pred, target): """ Args: pred: [bsz, seq_len, vocab_size] target: [bsz, seq_len] Returns: """ model_prob = self.one_hot.repeat(target.size(0), target.size(1), 1) # [bsz, seq_len, vocab_size] model_prob.scatter_(2, target.unsqueeze(2), self.confidence) model_prob.masked_fill_((target == self.ignore_index).unsqueeze(2), 0) pred_prob = F.log_softmax(pred, dim=2) #return F.kl_div(pred_prob, model_prob, reduction='mean') loss = self.lossfct(pred_prob, model_prob) loss = torch.sum(loss, dim=2).masked_fill_((target == self.ignore_index), 0) avg_loss = torch.sum(loss) / torch.sum((target != self.ignore_index).to(torch.float)) return avg_loss # Special symbols SOS_token = "<SOS>" # start of sentence EOS_token = "<EOS>" # end of sentence PAD_token = SOS_token # padding symbol INPUT_TOKENS_SCAN = ['jump', 'opposite', 'right', 'twice', 'and', 'turn', 'thrice', 'run', 'after', 'around', 'left', 'walk', 'look'] OUTPUT_TOKENS_SCAN = ['I_TURN_RIGHT', 'I_JUMP', 'I_TURN_LEFT', 'I_RUN', 'I_WALK', 'I_LOOK'] # ACTION_TO_TEXT = {'I_TURN_RIGHT': 'right', 'I_JUMP': 'jump', 'I_TURN_LEFT': 'left', 'I_RUN': 'run', 'I_WALK': 'walk', 'I_LOOK': 'look'} class Lang: # Class for converting strings/words to numerical indices, and vice versa. # Should use separate class for input language (English) and output language (actions) # def __init__(self, symbols, io_type): # symbols : list of all possible symbols n = len(symbols) self.symbols = [_s.strip('\n') for _s in symbols] self.io_type = io_type if SOS_token not in self.symbols: assert EOS_token not in self.symbols self.index2symbol = {n: SOS_token, n+1: EOS_token} self.symbol2index = {SOS_token: n, EOS_token: n + 1} self.sos_id, self.eos_id = n, n + 1 else: self.index2symbol = {} self.symbol2index = {} self.sos_id, self.eos_id = 0, 1 self.pad_token_id = self.sos_id for idx,s in enumerate(self.symbols): self.index2symbol[idx] = s self.symbol2index[s] = idx self.n_symbols = len(self.index2symbol) def variableFromSymbols(self, mylist, add_eos=True): # Convert a list of symbols to a tensor of indices (adding a EOS token at end) # # Input # mylist : list of m symbols # add_eos : true/false, if true add the EOS symbol at end # # Output # output : [m or m+1 LongTensor] indices of each symbol (plus EOS if appropriate) mylist = copy(mylist) if add_eos: mylist.append(EOS_token) indices = [self.symbol2index[s] for s in mylist] output = torch.LongTensor(indices) #if USE_CUDA: output = output.cuda() return output def symbolsFromVector(self, v): # Convert indices to symbols, breaking where we get a EOS token # # Input # v : list of m indices # # Output # mylist : list of m or m-1 symbols (excluding EOS) mylist = [] for x in v: s = self.index2symbol[x] if s == EOS_token: break mylist.append(s) return mylist def encode_scan_file(self, data, max_length): encoded_data = [] for dp in data: input, output = dp[0], dp[1] if self.io_type == 'input': raw = input else: assert self.io_type == 'output' raw = output encoded = self.variableFromSymbols(raw.split(' ')) encoded_data.append(encoded) return encoded_data def encode_scan_file_2_seg(self, data, max_length, cutoffs): encoded_data_1, encoded_data_2 = [], [] for _id, dp in enumerate(data): input, output, cutoff = dp[0], dp[1], cutoffs[_id] assert self.io_type == 'output' raw = output encoded_1 = self.variableFromSymbols(raw.split(' ')[:cutoff]) encoded_2 = self.variableFromSymbols(raw.split(' ')[cutoff:]) encoded_data_1.append(encoded_1) encoded_data_2.append(encoded_2) return encoded_data_1, encoded_data_2 def encode_cfq_file(self, data, max_length): encoded_data = [] for dp in data: input, output = dp['query_ids'], dp['sparql_ids'] if self.io_type == 'input': raw = input else: assert self.io_type == 'output' raw = output + [self.eos_id] encoded = torch.LongTensor(raw).cuda() encoded_data.append(encoded) return encoded_data def encode_cogs_file(self, data, max_length): encoded_data = [] for dp in data: input, output = dp['src'], dp['trg'] if self.io_type == 'input': raw = input else: assert self.io_type == 'output' raw = output encoded = self.variableFromSymbols(raw.split(' ')) encoded_data.append(encoded) return encoded_data def decode(self, ids): out = self.symbolsFromVector(ids.cpu().numpy()) if out == []: return out if out[0] in ['<SOS>', '<SOS_2>']: out = out[1:] return out def calculate_accuracy(preds, gts): assert len(preds) == len(gts) match = 0 for pred, gt in zip(preds, gts): if pred == gt: match += 1 return match / len(preds) def encode_file(tokenizer, data_path, max_length, pad_to_max_length=True, return_tensors="pt", max_examples=None): examples = [] if data_path[-3:] == '.gz': print('Data file is gzipped') f = gzip.open(data_path, "rt") else: print('Data file is plain text') print(data_path) f = open(data_path, "r", encoding='utf-8') for i, text in enumerate(f.readlines()): tokenized = tokenizer.batch_encode_plus( [text + ' </s>'], max_length=max_length, pad_to_max_length=pad_to_max_length, return_tensors=return_tensors ) if max_examples and i >= max_examples: break examples.append(tokenized) f.close() return examples # def encode_file_iterator(tokenizer, data_path, max_length, pad_to_max_length=True, return_tensors="pt", max_examples=None): # ''' # This provides a low-memory usage way of iterating thru all of the source/target lines for processing by JIT loader. # ''' # if data_path[-3:] == '.gz': # print('Data file is gzipped') # f = gzip.open(data_path, "rt") # else: # print('Data file is plain text') # f = open(data_path, "r", encoding='utf-8') # # for i, text in enumerate(f): # # tokenized = tokenizer.batch_encode_plus( [text + ' </s>'], max_length=max_length, # pad_to_max_length=pad_to_max_length, return_tensors=return_tensors ) # # yield tokenized # # if max_examples and i >= max_examples: # break # # f.close() # def convert_scan_actions_to_text(actions): # return ' '.join([ACTION_TO_TEXT[_action] for _action in actions.split(' ')]) # def encode_scan_file(tokenizer, data, io_type, max_length, pad_to_max_length=True, return_tensors="pt", max_examples=None): # examples = [] # # a = tokenizer.batch_encode_plus( ['right jump left run walk look' + ' <s> </s>'], max_length=max_length, # # pad_to_max_length=pad_to_max_length, return_tensors=return_tensors ) # # print(a) # # exit() # for dp in data: # input, output = dp[0], dp[1] # if io_type == 'input': # raw = input # else: # assert io_type == 'output' # raw = convert_scan_actions_to_text(output) # # tokenized = tokenizer.batch_encode_plus( [raw + ' </s>'], max_length=max_length, # pad_to_max_length=pad_to_max_length, return_tensors=return_tensors ) # # if max_examples and i >= max_examples: # break # examples.append(tokenized) # # return examples def load_scan_file(mytype, split): # Load SCAN dataset from file # # Input # mytype : type of SCAN experiment # split : 'train' or 'test' # # Output # commands : list of input/output strings (as tuples) assert mytype in ['simple', 'addprim_jump', 'length', 'addprim_turn_left', 'all', 'template_around_right', 'viz', 'examine', 'template_jump_around_right', 'template_right', 'template_around_right', 'mcd1', 'mcd2', 'mcd3', 'mcd1.1', 'mcd1.2', 'debug', 'attn_vis'] assert split in ['train', 'test', 'val'] if split == 'val' and mytype not in ['mcd1', 'mcd2', 'mcd3', 'mcd1.1', 'mcd1.2']: split = 'test' fn = 'data/scan/tasks_' + split + '_' + mytype + '.txt' fid = open(fn, 'r') lines = fid.readlines() fid.close() lines = [l.strip() for l in lines] lines = [l.lstrip('IN: ') for l in lines] commands = [l.split(' OUT: ') for l in lines] return commands class CompositionDataset(Dataset): def __init__( self, src_lang, trg_lang, data_dir, type_path, sub_task, max_source_length=20, max_target_length=20, tokenized=False, ): super().__init__() self.max_source_length = max_source_length self.max_target_length = max_target_length self.tokenized = tokenized self.src_lang = src_lang self.trg_lang = trg_lang def __len__(self): if self.tokenized: return len(self.dataset) else: return len(self.source) def __getitem__(self, index): if self.tokenized: dp = self.dataset[index] source_ids, src_mask, target_ids = dp[0], dp[1], dp[2] source_ids = source_ids[:self.max_source_length] #src_mask = src_mask[:self.max_source_length] target_ids = target_ids[:self.max_target_length] else: source_ids = self.source[index] target_ids = self.target[index] return {"source_ids": source_ids, "target_ids": target_ids} @staticmethod def trim_seq2seq_batch(batch, src_pad_token_id, trg_pad_token_id, trim_y=True): if trim_y: y = trim_batch(batch["target_ids"], trg_pad_token_id) else: y = batch["target_ids"] source_ids, source_mask = trim_batch(batch["source_ids"], src_pad_token_id, attention_mask=batch["source_mask"]) return source_ids, source_mask, y def pad_to_max_len(self, ids, max_len, pad_token_id): ids_length = ids.size(0) if ids_length == max_len: return ids pad_tokens = torch.tensor([pad_token_id] * (max_len - ids_length)) # if ids.type() == 'torch.cuda.FloatTensor': # print(ids) # exit() padded_ids = torch.cat([ids, pad_tokens.cuda()]) return padded_ids def create_mask(self, ids, max_len): ids_length = ids.size(0) mask = torch.tensor([1] * ids_length + [0] * (max_len - ids_length)).cuda() return mask def collate_fn(self, batch): max_src_len = max(map(len, [x["source_ids"] for x in batch])) max_trg_len = max(map(len, [x["target_ids"] for x in batch])) src_mask = torch.stack([self.create_mask(x["source_ids"], max_src_len) for x in batch]) src_ids = torch.stack([self.pad_to_max_len(x["source_ids"], max_src_len, self.src_lang.pad_token_id) for x in batch]) #masks = torch.stack([x["source_mask"] for x in batch]) trg_ids = torch.stack([self.pad_to_max_len(x["target_ids"], max_trg_len, self.trg_lang.pad_token_id) for x in batch]) y = trim_batch(trg_ids, self.trg_lang.pad_token_id) src_ids, src_mask = trim_batch(src_ids, self.src_lang.pad_token_id, attention_mask=src_mask) return {"source_ids": src_ids, "source_mask": src_mask, "target_ids": y} class ScanDataset(CompositionDataset): def __init__( self, src_lang, trg_lang, data_dir="./data/scan/", type_path="train", sub_task="addprim_jump", max_source_length=20, max_target_length=20, tokenized=False, ): super().__init__(src_lang, trg_lang, data_dir, type_path, sub_task, max_source_length, max_target_length, tokenized) scan_data = load_scan_file(sub_task, type_path) print(len(scan_data)) all_scan_dict = self.convert_to_dict(load_scan_file('all', 'train')) self.action_count_labels, self.action_group_labels, self.action_type_labels = self.construct_count_label(scan_data, all_scan_dict) if not tokenized: self.source = self.src_lang.encode_scan_file(scan_data, max_source_length) self.target = self.trg_lang.encode_scan_file(scan_data, max_target_length) else: self.dataset = torch.load(os.path.join(data_dir, type_path)) def construct_count_label(self, raw_data, all_data_dict): all_count_labels = [] count_label_scheme = "v1" group_label_scheme = "v2" type_label_scheme = "v2" all_action_group_labels, all_action_type_labels = [], [] # Group 1: single prim (jump), Group 2: prim + direction (jump left), Group 3: prim opposite, Group 4: prim around #no_skip_id = np.random.randint(0, len(raw_data), int(len(raw_data)*0.05)) #no_skip_id = np.random.choice(range(len(raw_data)), int(len(raw_data)*0.07), replace=False) # no_skip_id = np.random.choice(range(len(raw_data)), 10, replace=False) skip_cnt, sup_cnt = 0, 0 for _id, dp in enumerate(raw_data): input_text, output_text = dp[0], dp[1] input_tok, output_tok = input_text.split(' '), output_text.split(' ') count_labels, group_labels, type_labels = [], [], [] first_part_output_text, second_part_output_text = '', '' if 'and' in input_tok: first_part_input_tok = input_tok[:input_tok.index('and')] second_part_input_tok = input_tok[input_tok.index('and')+1:] first_part_output_text = all_data_dict[' '.join(first_part_input_tok)] second_part_output_text = all_data_dict[' '.join(second_part_input_tok)] elif 'after' in input_tok: second_part_input_tok = input_tok[:input_tok.index('after')] first_part_input_tok = input_tok[input_tok.index('after') + 1:] first_part_output_text = all_data_dict[' '.join(first_part_input_tok)] second_part_output_text = all_data_dict[' '.join(second_part_input_tok)] else: first_part_input_tok, second_part_input_tok = input_tok, [] first_part_output_text = output_text first_part_output_tok, second_part_output_tok = first_part_output_text.split(' '), second_part_output_text.split(' ') if second_part_output_text == '': second_part_output_tok = [] assert len(first_part_output_tok) + len(second_part_output_tok) == len(output_tok), \ (len(first_part_output_tok), len(second_part_output_tok), len(output_tok), first_part_output_text, second_part_output_text, output_text) ### 1. Build the action count labels ### if count_label_scheme == 'v1': ### For the first part output if 'twice' in first_part_input_tok: if 'after' in input_tok: count_labels += ([4] * int(len(first_part_output_tok) / 2) + [3] * int(len(first_part_output_tok) / 2)) else: count_labels += ([1] * int(len(first_part_output_tok) / 2) + [0] * int(len(first_part_output_tok) / 2)) # count_labels += ([1] + [0] * (int(len(first_part_output_tok) / 2) - 1)) * 2 elif 'thrice' in first_part_input_tok: if 'after' in input_tok: count_labels += ([5] * int(len(first_part_output_tok) / 3) + [4] * int(len(first_part_output_tok) / 3) + \ [3] * int(len(first_part_output_tok) / 3)) else: count_labels += ([2] * int(len(first_part_output_tok) / 3) + [1] * int(len(first_part_output_tok) / 3) + \ [0] * int(len(first_part_output_tok) / 3)) # count_labels += ([1] + [0] * (int(len(first_part_output_tok) / 3) - 1)) * 3 else: if 'after' in input_tok: count_labels += ([3] * len(first_part_output_tok)) else: count_labels += ([0] * len(first_part_output_tok)) # count_labels += ([1] + [0] * (int(len(first_part_output_tok)) - 1)) ### For the second part output if len(second_part_output_tok) > 0: if 'twice' in second_part_input_tok: if 'after' in input_tok: count_labels += ([1] * int(len(second_part_output_tok) / 2) + [0] * int(len(second_part_output_tok) / 2)) else: count_labels += ([4] * int(len(second_part_output_tok) / 2) + [3] * int(len(second_part_output_tok) / 2)) # count_labels += ([1] + [0] * (int(len(second_part_output_tok) / 2) - 1)) * 2 elif 'thrice' in second_part_input_tok: if 'after' in input_tok: count_labels += ([2] * int(len(second_part_output_tok) / 3) + [1] * int(len(second_part_output_tok) / 3) + \ [0] * int(len(second_part_output_tok) / 3)) else: count_labels += ([5] * int(len(second_part_output_tok) / 3) + [4] * int(len(second_part_output_tok) / 3) + \ [3] * int(len(second_part_output_tok) / 3)) # count_labels += ([1] + [0] * (int(len(second_part_output_tok) / 3) - 1)) * 3 else: if 'after' in input_tok: count_labels += ([0] * len(second_part_output_tok)) else: count_labels += ([3] * len(second_part_output_tok)) # count_labels += ([1] + [0] * (int(len(second_part_output_tok)) - 1)) elif count_label_scheme == 'v2': ### For the first part output if 'twice' in first_part_input_tok: count_labels += ([1] * int(len(first_part_output_tok) / 2) + [0] * int( len(first_part_output_tok) / 2)) elif 'thrice' in first_part_input_tok: count_labels += ([2] * int(len(first_part_output_tok) / 3) + [1] * int( len(first_part_output_tok) / 3) + \ [0] * int(len(first_part_output_tok) / 3)) else: count_labels += ([0] * len(first_part_output_tok)) ### For the second part output if len(second_part_output_tok) > 0: if 'twice' in second_part_input_tok: count_labels += ([1] * int(len(second_part_output_tok) / 2) + [0] * int( len(second_part_output_tok) / 2)) elif 'thrice' in second_part_input_tok: count_labels += ([2] * int(len(second_part_output_tok) / 3) + [1] * int( len(second_part_output_tok) / 3) + [0] * int(len(second_part_output_tok) / 3)) else: count_labels += ([0] * len(second_part_output_tok)) elif count_label_scheme == 'v3': ### For the first part output if 'thrice' in first_part_input_tok and 'thrice' in second_part_input_tok: start_count = 5 elif ('thrice' in first_part_input_tok and 'twice' in second_part_input_tok) or \ ('twice' in first_part_input_tok and 'thrice' in second_part_input_tok): start_count = 4 elif ('twice' in first_part_input_tok and 'twice' in second_part_input_tok) or \ ('thrice' in first_part_input_tok) or ('thrice' in second_part_input_tok): start_count = 3 elif 'twice' in first_part_input_tok or 'twice' in second_part_input_tok: start_count = 2 else: start_count = 1 if 'twice' in first_part_input_tok: if 'after' in input_tok: count_labels += ([start_count] * int(len(first_part_output_tok) / 2) + [start_count-1] * int(len(first_part_output_tok) / 2)) else: count_labels += ([1] * int(len(first_part_output_tok) / 2) + [0] * int(len(first_part_output_tok) / 2)) # count_labels += ([1] + [0] * (int(len(first_part_output_tok) / 2) - 1)) * 2 elif 'thrice' in first_part_input_tok: if 'after' in input_tok: count_labels += ([start_count] * int(len(first_part_output_tok) / 3) + [start_count-1] * int(len(first_part_output_tok) / 3) + \ [start_count-2] * int(len(first_part_output_tok) / 3)) else: count_labels += ([2] * int(len(first_part_output_tok) / 3) + [1] * int(len(first_part_output_tok) / 3) + \ [0] * int(len(first_part_output_tok) / 3)) # count_labels += ([1] + [0] * (int(len(first_part_output_tok) / 3) - 1)) * 3 else: if 'after' in input_tok: count_labels += ([start_count] * len(first_part_output_tok)) else: count_labels += ([0] * len(first_part_output_tok)) # count_labels += ([1] + [0] * (int(len(first_part_output_tok)) - 1)) ### For the second part output if len(second_part_output_tok) > 0: if 'twice' in second_part_input_tok: if 'after' in input_tok: count_labels += ([1] * int(len(second_part_output_tok) / 2) + [0] * int(len(second_part_output_tok) / 2)) else: count_labels += ([start_count] * int(len(second_part_output_tok) / 2) + [start_count-1] * int(len(second_part_output_tok) / 2)) # count_labels += ([1] + [0] * (int(len(second_part_output_tok) / 2) - 1)) * 2 elif 'thrice' in second_part_input_tok: if 'after' in input_tok: count_labels += ([2] * int(len(second_part_output_tok) / 3) + [1] * int(len(second_part_output_tok) / 3) + \ [0] * int(len(second_part_output_tok) / 3)) else: count_labels += ([start_count] * int(len(second_part_output_tok) / 3) + [start_count-1] * int(len(second_part_output_tok) / 3) + \ [start_count-2] * int(len(second_part_output_tok) / 3)) # count_labels += ([1] + [0] * (int(len(second_part_output_tok) / 3) - 1)) * 3 else: if 'after' in input_tok: count_labels += ([0] * len(second_part_output_tok)) else: count_labels += ([start_count] * len(second_part_output_tok)) # count_labels += ([1] + [0] * (int(len(second_part_output_tok)) - 1)) elif count_label_scheme == 'v3.1': ### For the first part output if 'thrice' in first_part_input_tok and 'thrice' in second_part_input_tok: start_count = 5 elif ('thrice' in first_part_input_tok and 'twice' in second_part_input_tok) or \ ('twice' in first_part_input_tok and 'thrice' in second_part_input_tok): start_count = 4 elif ('twice' in first_part_input_tok and 'twice' in second_part_input_tok) or \ ('thrice' in first_part_input_tok) or ('thrice' in second_part_input_tok): start_count = 3 elif 'twice' in first_part_input_tok or 'twice' in second_part_input_tok: start_count = 2 else: start_count = 1 if 'twice' in first_part_input_tok: count_labels += ([start_count] * int(len(first_part_output_tok) / 2) + [start_count - 1] * int( len(first_part_output_tok) / 2)) # count_labels += ([1] + [0] * (int(len(first_part_output_tok) / 2) - 1)) * 2 elif 'thrice' in first_part_input_tok: count_labels += ([start_count] * int(len(first_part_output_tok) / 3) + [start_count - 1] * int( len(first_part_output_tok) / 3) + \ [start_count - 2] * int(len(first_part_output_tok) / 3)) else: count_labels += ([start_count] * len(first_part_output_tok)) ### For the second part output if len(second_part_output_tok) > 0: if 'twice' in second_part_input_tok: count_labels += ([1] * int(len(second_part_output_tok) / 2) + [0] * int( len(second_part_output_tok) / 2)) # count_labels += ([1] + [0] * (int(len(second_part_output_tok) / 2) - 1)) * 2 elif 'thrice' in second_part_input_tok: count_labels += ([2] * int(len(second_part_output_tok) / 3) + [1] * int( len(second_part_output_tok) / 3) + \ [0] * int(len(second_part_output_tok) / 3)) else: count_labels += ([0] * len(second_part_output_tok)) else: ### For the first part output if 'twice' in first_part_input_tok: if 'after' in input_tok: new_count_labels = list(range(int(len(first_part_output_tok) / 2)))[::-1] * 2 else: new_count_labels = list(range(int(len(first_part_output_tok) / 2)))[::-1] * 2 elif 'thrice' in first_part_input_tok: if 'after' in input_tok: new_count_labels = list(range(int(len(first_part_output_tok) / 3)))[::-1] * 3 else: new_count_labels = list(range(int(len(first_part_output_tok) / 3)))[::-1] * 3 else: if 'after' in input_tok: new_count_labels = list(range(len(first_part_output_tok)))[::-1] else: new_count_labels = list(range(len(first_part_output_tok)))[::-1] count_labels += new_count_labels ### For the second part output if len(second_part_output_tok) > 0: if 'twice' in second_part_input_tok: if 'after' in input_tok: new_count_labels = list(range(int(len(second_part_output_tok) / 2)))[::-1] * 2 new_count_labels = [_c + 8 for _c in new_count_labels] else: new_count_labels = list(range(int(len(second_part_output_tok) / 2)))[::-1] * 2 new_count_labels = [_c + 8 for _c in new_count_labels] elif 'thrice' in second_part_input_tok: if 'after' in input_tok: new_count_labels = list(range(int(len(second_part_output_tok) / 3)))[::-1] * 3 new_count_labels = [_c + 8 for _c in new_count_labels] else: new_count_labels = list(range(int(len(second_part_output_tok) / 3)))[::-1] * 3 new_count_labels = [_c + 8 for _c in new_count_labels] else: if 'after' in input_tok: new_count_labels = list(range(len(second_part_output_tok)))[::-1] new_count_labels = [_c + 8 for _c in new_count_labels] else: new_count_labels = list(range(len(second_part_output_tok)))[::-1] new_count_labels = [_c + 8 for _c in new_count_labels] count_labels += new_count_labels # count_labels = [] # count_labels += list(range(len(first_part_output_tok)))[::-1] # count_labels += list(range(len(second_part_output_tok)))[::-1] assert len(count_labels) == len(output_tok), (len(count_labels), len(output_tok), input_text, first_part_input_tok, count_labels, output_tok, first_part_output_text, first_part_output_tok, second_part_output_text, second_part_output_tok) count_labels.append(-1) # For the EOS token # count_labels.append(7) # For the EOS token ### 2. Build the action group labels ### if group_label_scheme == 'v1': ## As used in exp 9.0-9.4 if 'around' in first_part_input_tok: if 'after' in input_tok: group_labels += ([4] * len(first_part_output_tok)) else: group_labels += ([0] * len(first_part_output_tok)) elif 'opposite' in first_part_input_tok: if 'after' in input_tok: group_labels += ([5] * len(first_part_output_tok)) else: group_labels += ([1] * len(first_part_output_tok)) elif 'left' in first_part_input_tok or 'right' in first_part_input_tok: if 'after' in input_tok: group_labels += ([6] * len(first_part_output_tok)) else: group_labels += ([2] * len(first_part_output_tok)) else: if 'after' in input_tok: group_labels += ([7] * len(first_part_output_tok)) else: group_labels += ([3] * len(first_part_output_tok)) if 'around' in second_part_input_tok: if 'after' in input_tok: group_labels += ([0] * len(second_part_output_tok)) else: group_labels += ([4] * len(second_part_output_tok)) elif 'opposite' in second_part_input_tok: if 'after' in input_tok: group_labels += ([1] * len(second_part_output_tok)) else: group_labels += ([5] * len(second_part_output_tok)) elif 'left' in second_part_input_tok or 'right' in second_part_input_tok: if 'after' in input_tok: group_labels += ([2] * len(second_part_output_tok)) else: group_labels += ([6] * len(second_part_output_tok)) else: if 'after' in input_tok: group_labels += ([3] * len(second_part_output_tok)) else: group_labels += ([7] * len(second_part_output_tok)) else: ### For the first part output if 'twice' in first_part_input_tok: if 'after' in input_tok: new_group_labels = list(range(int(len(first_part_output_tok) / 2)))[::-1] * 2 new_group_labels = [_c + 8 for _c in new_group_labels] else: new_group_labels = list(range(int(len(first_part_output_tok) / 2)))[::-1] * 2 elif 'thrice' in first_part_input_tok: if 'after' in input_tok: new_group_labels = list(range(int(len(first_part_output_tok) / 3)))[::-1] * 3 new_group_labels = [_c + 8 for _c in new_group_labels] else: new_group_labels = list(range(int(len(first_part_output_tok) / 3)))[::-1] * 3 else: if 'after' in input_tok: new_group_labels = list(range(len(first_part_output_tok)))[::-1] new_group_labels = [_c + 8 for _c in new_group_labels] else: new_group_labels = list(range(len(first_part_output_tok)))[::-1] group_labels += new_group_labels ### For the second part output if len(second_part_output_tok) > 0: if 'twice' in second_part_input_tok: if 'after' in input_tok: new_group_labels = list(range(int(len(second_part_output_tok) / 2)))[::-1] * 2 else: new_group_labels = list(range(int(len(second_part_output_tok) / 2)))[::-1] * 2 new_group_labels = [_c + 8 for _c in new_group_labels] elif 'thrice' in second_part_input_tok: if 'after' in input_tok: new_group_labels = list(range(int(len(second_part_output_tok) / 3)))[::-1] * 3 else: new_group_labels = list(range(int(len(second_part_output_tok) / 3)))[::-1] * 3 new_group_labels = [_c + 8 for _c in new_group_labels] else: if 'after' in input_tok: new_group_labels = list(range(len(second_part_output_tok)))[::-1] else: new_group_labels = list(range(len(second_part_output_tok)))[::-1] new_group_labels = [_c + 8 for _c in new_group_labels] group_labels += new_group_labels assert len(group_labels) == len(output_tok) group_labels.append(-1) # For the EOS token # group_labels.append(17) # For the EOS token ### 3. Build the action type labels ### ### For the first part output if type_label_scheme == 'v1': if 'around' in first_part_input_tok: new_type_labels = [3] * len(first_part_output_tok) elif 'opposite' in first_part_input_tok: new_type_labels = [2] * len(first_part_output_tok) elif 'left' in first_part_input_tok or 'right' in first_part_input_tok: new_type_labels = [1] * len(first_part_output_tok) else: new_type_labels = [0] * len(first_part_output_tok) # if 'after' in input_tok: # new_type_labels = [_c + 4 for _c in new_type_labels] type_labels += new_type_labels ### For the second part output if len(second_part_output_tok) > 0: if 'around' in second_part_input_tok: new_type_labels = [3] * len(second_part_output_tok) elif 'opposite' in second_part_input_tok: new_type_labels = [2] * len(second_part_output_tok) elif 'left' in second_part_input_tok or 'right' in second_part_input_tok: new_type_labels = [1] * len(second_part_output_tok) else: new_type_labels = [0] * len(second_part_output_tok) # if 'after' not in input_tok: # new_type_labels = [_c + 4 for _c in new_type_labels] type_labels += new_type_labels elif type_label_scheme == 'v2': if 'twice' in first_part_input_tok: type_labels += ([1] * int(len(first_part_output_tok) / 2) + [0] * int( len(first_part_output_tok) / 2)) elif 'thrice' in first_part_input_tok: type_labels += ([2] * int(len(first_part_output_tok) / 3) + [1] * int( len(first_part_output_tok) / 3) + \ [0] * int(len(first_part_output_tok) / 3)) else: type_labels += ([0] * len(first_part_output_tok)) ### For the second part output if len(second_part_output_tok) > 0: if 'twice' in second_part_input_tok: type_labels += ([1] * int(len(second_part_output_tok) / 2) + [0] * int( len(second_part_output_tok) / 2)) elif 'thrice' in second_part_input_tok: type_labels += ([2] * int(len(second_part_output_tok) / 3) + [1] * int( len(second_part_output_tok) / 3) + [0] * int(len(second_part_output_tok) / 3)) else: type_labels += ([0] * len(second_part_output_tok)) assert len(type_labels) == len(output_tok) type_labels.append(-1) # For the EOS token # group_labels.append(17) # For the EOS token # if _id not in no_skip_id: # count_labels = [-1] * len(count_labels) # group_labels = [-1] * len(group_labels) # skip_cnt += 1 # else: # sup_cnt += 1 all_action_type_labels.append(torch.tensor(type_labels).cuda()) all_count_labels.append(torch.tensor(count_labels).cuda()) all_action_group_labels.append(torch.tensor(group_labels).cuda()) print(skip_cnt, sup_cnt) return all_count_labels, all_action_group_labels, all_action_type_labels def convert_to_dict(self, raw_data): dict_data = {} for dp in raw_data: input, output = dp[0], dp[1] assert input not in dict_data dict_data[input] = output return dict_data def __getitem__(self, index): if self.tokenized: dp = self.dataset[index] source_ids, src_mask, target_ids = dp[0], dp[1], dp[2] source_ids = source_ids[:self.max_source_length] #src_mask = src_mask[:self.max_source_length] target_ids = target_ids[:self.max_target_length] else: source_ids = self.source[index] target_ids = self.target[index] count_labels = self.action_count_labels[index] group_labels = self.action_group_labels[index] type_labels = self.action_type_labels[index] return {"source_ids": source_ids, "target_ids": target_ids, "action_count_labels": count_labels, "action_group_labels": group_labels, "action_type_labels": type_labels} @staticmethod def trim_seq2seq_batch(batch, src_pad_token_id, trg_pad_token_id, trim_y=True): if trim_y: y = trim_batch(batch["target_ids"], trg_pad_token_id) else: y = batch["target_ids"] source_ids, source_mask = trim_batch(batch["source_ids"], src_pad_token_id, attention_mask=batch["source_mask"]) return source_ids, source_mask, y def collate_fn(self, batch): max_src_len = max(map(len, [x["source_ids"] for x in batch])) max_trg_len = max(map(len, [x["target_ids"] for x in batch])) src_mask = torch.stack([self.create_mask(x["source_ids"], max_src_len) for x in batch]) trg_mask = torch.stack([self.create_mask(x["target_ids"], max_trg_len) for x in batch]) src_ids = torch.stack([self.pad_to_max_len(x["source_ids"], max_src_len, self.src_lang.pad_token_id) for x in batch]) #masks = torch.stack([x["source_mask"] for x in batch]) trg_ids = torch.stack([self.pad_to_max_len(x["target_ids"], max_trg_len, self.trg_lang.pad_token_id) for x in batch]) action_count_labels = torch.stack([self.pad_to_max_len(x["action_count_labels"], max_trg_len, -1) for x in batch]) action_group_labels = torch.stack([self.pad_to_max_len(x["action_group_labels"], max_trg_len, -1) for x in batch]) action_type_labels = torch.stack( [self.pad_to_max_len(x["action_type_labels"], max_trg_len, -1) for x in batch]) y = trim_batch(trg_ids, self.trg_lang.pad_token_id) #action_count_labels = trim_batch(action_count_labels, -1) # _src_ids, src_mask = trim_batch(src_ids, self.src_lang.pad_token_id, attention_mask=src_mask) # print(_src_ids.size(), src_ids.size()) return {"source_ids": src_ids, "source_mask": src_mask, "target_ids": y, "target_mask": trg_mask, "action_count_labels": action_count_labels, "action_group_labels": action_group_labels, "action_type_labels": action_type_labels}
[((607, 653), 'torch.full', 'torch.full', (['(tgt_vocab_size,)', 'smoothing_value'], {}), '((tgt_vocab_size,), smoothing_value)\n', (617, 653), False, 'import torch\n'), ((837, 873), 'torch.nn.KLDivLoss', 'torch.nn.KLDivLoss', ([], {'reduction': '"""none"""'}), "(reduction='none')\n", (855, 873), False, 'import torch\n'), ((1322, 1348), 'torch.nn.functional.log_softmax', 'F.log_softmax', (['pred'], {'dim': '(2)'}), '(pred, dim=2)\n', (1335, 1348), True, 'import torch.nn.functional as F\n'), ((3589, 3601), 'copy.copy', 'copy', (['mylist'], {}), '(mylist)\n', (3593, 3601), False, 'from copy import deepcopy, copy\n'), ((3733, 3758), 'torch.LongTensor', 'torch.LongTensor', (['indices'], {}), '(indices)\n', (3749, 3758), False, 'import torch\n'), ((6816, 6842), 'gzip.open', 'gzip.open', (['data_path', '"""rt"""'], {}), "(data_path, 'rt')\n", (6825, 6842), False, 'import gzip\n'), ((11591, 11682), 'transformers.tokenization_utils.trim_batch', 'trim_batch', (["batch['source_ids']", 'src_pad_token_id'], {'attention_mask': "batch['source_mask']"}), "(batch['source_ids'], src_pad_token_id, attention_mask=batch[\n 'source_mask'])\n", (11601, 11682), False, 'from transformers.tokenization_utils import trim_batch\n'), ((11890, 11943), 'torch.tensor', 'torch.tensor', (['([pad_token_id] * (max_len - ids_length))'], {}), '([pad_token_id] * (max_len - ids_length))\n', (11902, 11943), False, 'import torch\n'), ((12905, 12952), 'transformers.tokenization_utils.trim_batch', 'trim_batch', (['trg_ids', 'self.trg_lang.pad_token_id'], {}), '(trg_ids, self.trg_lang.pad_token_id)\n', (12915, 12952), False, 'from transformers.tokenization_utils import trim_batch\n'), ((12981, 13053), 'transformers.tokenization_utils.trim_batch', 'trim_batch', (['src_ids', 'self.src_lang.pad_token_id'], {'attention_mask': 'src_mask'}), '(src_ids, self.src_lang.pad_token_id, attention_mask=src_mask)\n', (12991, 13053), False, 'from transformers.tokenization_utils import trim_batch\n'), ((41258, 41349), 'transformers.tokenization_utils.trim_batch', 'trim_batch', (["batch['source_ids']", 'src_pad_token_id'], {'attention_mask': "batch['source_mask']"}), "(batch['source_ids'], src_pad_token_id, attention_mask=batch[\n 'source_mask'])\n", (41268, 41349), False, 'from transformers.tokenization_utils import trim_batch\n'), ((42463, 42510), 'transformers.tokenization_utils.trim_batch', 'trim_batch', (['trg_ids', 'self.trg_lang.pad_token_id'], {}), '(trg_ids, self.trg_lang.pad_token_id)\n', (42473, 42510), False, 'from transformers.tokenization_utils import trim_batch\n'), ((1571, 1586), 'torch.sum', 'torch.sum', (['loss'], {}), '(loss)\n', (1580, 1586), False, 'import torch\n'), ((11457, 11506), 'transformers.tokenization_utils.trim_batch', 'trim_batch', (["batch['target_ids']", 'trg_pad_token_id'], {}), "(batch['target_ids'], trg_pad_token_id)\n", (11467, 11506), False, 'from transformers.tokenization_utils import trim_batch\n'), ((41124, 41173), 'transformers.tokenization_utils.trim_batch', 'trim_batch', (["batch['target_ids']", 'trg_pad_token_id'], {}), "(batch['target_ids'], trg_pad_token_id)\n", (41134, 41173), False, 'from transformers.tokenization_utils import trim_batch\n'), ((1482, 1504), 'torch.sum', 'torch.sum', (['loss'], {'dim': '(2)'}), '(loss, dim=2)\n', (1491, 1504), False, 'import torch\n'), ((12216, 12277), 'torch.tensor', 'torch.tensor', (['([1] * ids_length + [0] * (max_len - ids_length))'], {}), '([1] * ids_length + [0] * (max_len - ids_length))\n', (12228, 12277), False, 'import torch\n'), ((14135, 14168), 'os.path.join', 'os.path.join', (['data_dir', 'type_path'], {}), '(data_dir, type_path)\n', (14147, 14168), False, 'import os\n'), ((5641, 5662), 'torch.LongTensor', 'torch.LongTensor', (['raw'], {}), '(raw)\n', (5657, 5662), False, 'import torch\n'), ((39632, 39657), 'torch.tensor', 'torch.tensor', (['type_labels'], {}), '(type_labels)\n', (39644, 39657), False, 'import torch\n'), ((39702, 39728), 'torch.tensor', 'torch.tensor', (['count_labels'], {}), '(count_labels)\n', (39714, 39728), False, 'import torch\n'), ((39780, 39806), 'torch.tensor', 'torch.tensor', (['group_labels'], {}), '(group_labels)\n', (39792, 39806), False, 'import torch\n')]
intellineers/django-bridger
bridger/serializers/fields/related.py
ed097984a99df7da40a4d01bd00c56e3c6083056
from typing import Dict from rest_framework import serializers from rest_framework.fields import empty from rest_framework.relations import ManyRelatedField from rest_framework.request import Request from .mixins import BridgerSerializerFieldMixin from .types import BridgerType, ReturnContentType class BridgerManyRelatedField(ManyRelatedField): def __init__(self, *args, **kwargs): required = kwargs.get("required", True) if not required: kwargs["allow_null"] = True super().__init__(*args, **kwargs) def run_validation(self, data=empty): # If the data is send through form data, we need to convert the data into a proper list of ids if data not in [None, empty] and len(data) == 1 and isinstance(data[0], str) and "," in data[0]: data = data[0].split(",") # If the data is a list of an empty string we need to convert it (FORM DATA) if data not in [None, empty] and len(data) == 1 and isinstance(data[0], str) and data[0] == "": data = [] # If the data is a list and contains the string null, then we need to convert it (FORM DATA) if data == ["null"]: data = [] # If the data is None and null is an allowed value, data needs to be set to an empty list if data is None and self.allow_null: data = [] return super().run_validation(data) def get_representation(self, request: Request, field_name: str) -> Dict: representation = self.child_relation.get_representation(request, field_name) representation["multiple"] = True return representation class PrimaryKeyRelatedField(BridgerSerializerFieldMixin, serializers.PrimaryKeyRelatedField): MANY_RELATION_KWARGS = ( "read_only", "write_only", "required", "default", "initial", "source", "label", "help_text", "style", "error_messages", "allow_empty", "html_cutoff", "html_cutoff_text", "allow_null", ) def __init__(self, *args, **kwargs): self.field_type = kwargs.pop("field_type", BridgerType.SELECT.value) super().__init__(*args, **kwargs) def __new__(cls, *args, **kwargs): kwargs["style"] = {"base_template": "input.html"} return super().__new__(cls, *args, **kwargs) @classmethod def many_init(cls, *args, **kwargs): list_kwargs = {"child_relation": cls(*args, **kwargs)} for key in kwargs: if key in cls.MANY_RELATION_KWARGS: list_kwargs[key] = kwargs[key] return BridgerManyRelatedField(**list_kwargs) def run_validation(self, data=empty): if isinstance(data, str) and data == "null": data = None if data is empty: parent_model_id = self.parent.context["view"].kwargs.get(f"{self.field_name}_id") if parent_model_id: data = parent_model_id return super().run_validation(data) class ListSerializer(serializers.ListSerializer): """ A Wrapper around the normal DRF ListSerializer which also return the child representation """ def get_representation(self, request: Request, field_name: str) -> Dict: representation = self.child.get_representation(request, field_name) representation["multiple"] = True representation["related_key"] = self.source return representation
[]
wenyuanyu/GraphScope
python/graphscope/experimental/nx/tests/algorithms/forward/operators/test_product.py
a40ccaf70557e608d8b091eb25ab04477f99ce21
import networkx.algorithms.operators.tests.test_product import pytest from graphscope.experimental.nx.utils.compat import import_as_graphscope_nx import_as_graphscope_nx(networkx.algorithms.operators.tests.test_product, decorators=pytest.mark.usefixtures("graphscope_session")) def test_tensor_product_combinations(): # basic smoke test, more realistic tests would be useful P5 = nx.path_graph(5) K3 = nx.complete_graph(3) G = nx.tensor_product(P5, K3) assert nx.number_of_nodes(G) == 5 * 3 G = nx.tensor_product(nx.DiGraph(P5), nx.DiGraph(K3)) assert nx.number_of_nodes(G) == 5 * 3 @pytest.mark.skip(reason="not support multigraph") def test_cartesian_product_multigraph(): pass def test_lexicographic_product_combinations(): P5 = nx.path_graph(5) K3 = nx.complete_graph(3) G = nx.lexicographic_product(P5, K3) assert nx.number_of_nodes(G) == 5 * 3 def test_strong_product_combinations(): P5 = nx.path_graph(5) K3 = nx.complete_graph(3) G = nx.strong_product(P5, K3) assert nx.number_of_nodes(G) == 5 * 3 @pytest.mark.skip(reason="not support multigraph") def test_graph_power_raises(): pass
[((643, 692), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""not support multigraph"""'}), "(reason='not support multigraph')\n", (659, 692), False, 'import pytest\n'), ((1108, 1157), 'pytest.mark.skip', 'pytest.mark.skip', ([], {'reason': '"""not support multigraph"""'}), "(reason='not support multigraph')\n", (1124, 1157), False, 'import pytest\n'), ((257, 302), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""graphscope_session"""'], {}), "('graphscope_session')\n", (280, 302), False, 'import pytest\n')]
schleising/banter-bot
Footy/UnsupportedBantzStrings.py
3e51453ae993d2c26dc51464a3cef3875a6be3c9
# {team} -> Name of team # {name} -> Name of person who supports team teamMatchStarted: list[str] = [ "{team} are shit", "{team} cunts", "Dirty {team}", "Dirty {team}, dirty {name}", ] drawing: list[str] = [ "{team} level, this is a shit match", "Boring old {team}", "Happy with how it's going, {name}?", "Yawn...", "{team} wankers", "How can you support this rubbish, {name}?", "You get the feeling that {team} don't really want this", "No passion from {team}, {name}", "If a game of football is like making love to a beautiful woman, this {team} game is a £10 hand job from a swivel-eyed misfit", "This {team} match is like a game of chess. But with more players and only one piece", ] teamLeadByOne: list[str] = [ "{team} cheats, the ref's a cunt", "That was never a goal for {team}", "{team} don't deserve that", "Bollocks", "That should go to VAR", "Bit fortunuate for {team}", "Can't imagine {team} will keep this lead", "Lucky goal for {team}", "{team} got lucky there", "{team} aren't good enough to stay ahead", "Offside!", ] teamExtendingLead: list[str] = [ "There's no way {team} deserve this lead", "Have {team} paid the ref?", "This is bullshit", "The ref's a cunt, {name}'s a cunt", "The ref's a cunt, {team} are cunts, {name}'s a cunt", "Something has gone seriously wrong with this country", "When I voted for Brexit, I didn't vote for this", "At least Boris remains in charge, we've still got that", "Richard Wanger would be turning in his grave", "Liberal elite bullshit", "That was so offside", "VAR!", "Is the linesman OK?", "If only {name}'s wife was as dirty as this game", ] teamLosingLead: list[str] = [ "Lazy old {team}, lazy old {name}", "{team} are throwing it away", "{team} are rubbish", "{team} fucking it up again", "We really are being treated to some world class flouncing from {team} today", "Brace yourself, {name}. This is going to hurt", "This is brown trouser time for {team}", "I hope {name} brought a spare pair of underpants", "I see {team} are playing their B Team. B for Bullshit", ] teamDeficitOfOne: list[str] = [ "This is more like it from {team}", "Oh dear...", "{team} wankers", "How are you feeling, {name}?", "Bit disappointing, {name}?", "Not looking good for {team}, {name}", "You must be furious, {name}", "{team} have just got no heart", "This is what happens when you try to buy success", "All that money spent, {name}, and for what?", ] teamExtendingDeficit: list[str] = [ "Starting to feel a bit sorry for {team}", "Never mind, {name}, there's always the next game", "Poor {team}", "Whoops...", "Oh dear, everything OK, {name}?", "Hey {name}, where'd you get your keeper?\nPOUNDSHOP !! POUNDSHOP !!", "{team} can't raise themselves for this game, typical", "A team like {team} have such a proud history, but what we see today is just embarrassing", "{team} clearly not up for it today", "{team} are letting you down, {name}", "Watching {team} is like watching a bunch of cavemen: Neanderthal", ] teamLosingDeficit: list[str] = [ "Too little too late for {team}", "{team} won't come back from here", "The ref's a cunt", "This is awful", "What a mess", "Well this is an unmitigated shit show", ] teamWon: list[str] = [ "That was a shit game", "There's no way {team} deserved that", "Fuck you, {name} !!", "This will go down in history...\nAs the most tedious game I have ever had the misfortune to witness", ] teamLost: list[str] = [ "Justice done, {team} lost", "Job done for {team}?", "Job done, {name}?", "{name} !!?", "Probably the best {team} could hope for", "Everything OK, {name}?", "{team} continue to disappoint", "Well if the football thing doesn't work out for {team}, they can always consider a career on the stage", "{team} set the bar low", "{team} fail to meet their already low expectations", ] teamDrew: list [str] = [ "Another uninspiring result for {team}", "Thanks for nothing, {team}", "Well that's 90 minutes we won't get back, thanks {team}", "Another draw for {team}", "Boring old {team}", "You should be happy with that result, {name}", "If I could pick one highlight from this {team} game it would be when it finally ended.", "I think {name} will be happy with {team}'s performance today.", ]
[]
codr7/alisp
bench/fibrec.py
05ac47ab2c28683373af4ec80e5a94937390fa6c
from bench import bench print(bench(100, ''' def fib(n): return n if n < 2 else fib(n-1) + fib(n-2) ''', ''' fib(20) '''))
[((31, 128), 'bench.bench', 'bench', (['(100)', '"""\ndef fib(n):\n return n if n < 2 else fib(n-1) + fib(n-2)\n"""', '"""\n fib(20)\n"""'], {}), '(100, """\ndef fib(n):\n return n if n < 2 else fib(n-1) + fib(n-2)\n""",\n \'\\n fib(20)\\n\')\n', (36, 128), False, 'from bench import bench\n')]
NLPIR-team/nlpir-python
nlpir/native/classifier.py
029f81e69ee561725fa017dce09cfd55acb34d20
# coding=utf-8 from nlpir.native.nlpir_base import NLPIRBase from ctypes import c_bool, c_char_p, c_int, POINTER, Structure, c_float class StDoc(Structure): __fields__ = [ ("sTitle", c_char_p), ("sContent", c_char_p), ("sAuthor", c_char_p), ("sBoard", c_char_p), ("sDatatype", c_char_p) ] class Classifier(NLPIRBase): @property def dll_name(self): return "LJClassifier" @NLPIRBase.byte_str_transform def init_lib(self, data_path: str, encode: int, license_code: str) -> int: """ Call **classifier_init** :param data_path: :param encode: :param license_code: :return: 1 success 0 fail """ return self.get_func("classifier_init", [c_char_p, c_char_p, c_int, c_char_p], c_bool)( "rulelist.xml", data_path, encode, license_code) @NLPIRBase.byte_str_transform def exit_lib(self) -> bool: """ Call **classifier_exit** :return: exit success or not """ return self.get_func("classifier_exit", None, None)() @NLPIRBase.byte_str_transform def get_last_error_msg(self) -> str: return self.get_func("classifier_GetLastErrorMsg", None, c_char_p)() @NLPIRBase.byte_str_transform def exec_1(self, data: StDoc, out_type: int = 0): """ Call **classifier_exec1** 对输入的文章结构进行分类 :param data: 文章结构 :param out_type: 输出是否包括置信度, 0 没有置信度 1 有置信度 :return: 主题类别串 各类之间用\t隔开,类名按照置信度从高到低排序 举例:“要闻 敏感 诉讼”, “要闻 1.00 敏感 0.95 诉讼 0.82” """ return self.get_func("classifier_exec1", [POINTER(StDoc), c_int], c_char_p)(data, out_type) @NLPIRBase.byte_str_transform def exec(self, title: str, content: str, out_type: int): """ Call **classifier_exec** 对输入的文章进行分类 :param title: 文章标题 :param content: 文章内容 :param out_type: 输出知否包括置信度,同 :func:`exec_1` :return: 同 :func:`exec_1` """ return self.get_func("classifier_exec", [c_char_p, c_char_p, c_int], c_char_p)(title, content, out_type) @NLPIRBase.byte_str_transform def exec_file(self, filename: str, out_type: int) -> str: """ Call **classifier_execFile** :param filename: 文件名 :param out_type: 输出是否包括置信度, 0 没有置信度 1 有置信度 :return: 主题类别串 各类之间用\t隔开,类名按照置信度从高到低排序 举例:“要闻 敏感 诉讼”, “要闻 1.00 敏感 0.95 诉讼 0.82” """ return self.get_func("classifier_execFile", [c_char_p, c_int], c_char_p)(filename, out_type) @NLPIRBase.byte_str_transform def detail(self, class_name: str): """ Call **classifier_detail** 对于当前文档,输入类名,取得结果明细 :param class_name: 结果类名 :return: 结果明细 例如: :: RULE3: SUBRULE1: 内幕 1 SUBRULE2: 股市 1 基金 3 股票 8 SUBRULE3: 书摘 2 """ return self.get_func("classifier_detail", [c_char_p], c_char_p)(class_name) @NLPIRBase.byte_str_transform def set_sim_thresh(self, sim: float): """ Call **classifier_setsimthresh** 设置阈值 :param sim: 阈值 :return: """ return self.get_func("classifier_setsimthresh", [c_float])(sim)
[((1655, 1669), 'ctypes.POINTER', 'POINTER', (['StDoc'], {}), '(StDoc)\n', (1662, 1669), False, 'from ctypes import c_bool, c_char_p, c_int, POINTER, Structure, c_float\n')]
nickgaya/bravado-core
tests/param/get_param_type_spec_test.py
16e752963bfceb4adfa43724085bc4127eefcd59
# -*- coding: utf-8 -*- import pytest from mock import Mock from bravado_core.exception import SwaggerMappingError from bravado_core.operation import Operation from bravado_core.param import get_param_type_spec from bravado_core.param import Param from bravado_core.spec import Spec @pytest.fixture def body_param_spec(): return { 'name': 'body', 'in': 'body', 'description': 'pet id', 'required': True, 'schema': { 'type': 'string', }, } def test_location_is_body(empty_swagger_spec, body_param_spec): param = Param(empty_swagger_spec, Mock(spec=Operation), body_param_spec) assert body_param_spec['schema'] == get_param_type_spec(param) def test_location_is_not_body(empty_swagger_spec): for location in ('path', 'query', 'header', 'formData',): param_spec = { 'name': 'petId', 'in': location, 'description': 'ID of pet that needs to be updated', 'required': True, 'type': 'string', } param = Param(empty_swagger_spec, Mock(spec=Operation), param_spec) assert param_spec == get_param_type_spec(param) def test_location_invalid(empty_swagger_spec, body_param_spec): body_param_spec['in'] = 'foo' param = Param(empty_swagger_spec, Mock(spec=Operation), body_param_spec) with pytest.raises(SwaggerMappingError) as excinfo: get_param_type_spec(param) assert 'location foo' in str(excinfo.value) def test_ref(minimal_swagger_dict, body_param_spec): minimal_swagger_dict['parameters'] = { 'PetIdParam': body_param_spec, } param_ref_spec = {'$ref': '#/parameters/PetIdParam'} swagger_spec = Spec(minimal_swagger_dict) param = Param(swagger_spec, Mock(spec=Operation), param_ref_spec) assert {'type': 'string'} == get_param_type_spec(param)
[((1718, 1744), 'bravado_core.spec.Spec', 'Spec', (['minimal_swagger_dict'], {}), '(minimal_swagger_dict)\n', (1722, 1744), False, 'from bravado_core.spec import Spec\n'), ((614, 634), 'mock.Mock', 'Mock', ([], {'spec': 'Operation'}), '(spec=Operation)\n', (618, 634), False, 'from mock import Mock\n'), ((693, 719), 'bravado_core.param.get_param_type_spec', 'get_param_type_spec', (['param'], {}), '(param)\n', (712, 719), False, 'from bravado_core.param import get_param_type_spec\n'), ((1320, 1340), 'mock.Mock', 'Mock', ([], {'spec': 'Operation'}), '(spec=Operation)\n', (1324, 1340), False, 'from mock import Mock\n'), ((1369, 1403), 'pytest.raises', 'pytest.raises', (['SwaggerMappingError'], {}), '(SwaggerMappingError)\n', (1382, 1403), False, 'import pytest\n'), ((1424, 1450), 'bravado_core.param.get_param_type_spec', 'get_param_type_spec', (['param'], {}), '(param)\n', (1443, 1450), False, 'from bravado_core.param import get_param_type_spec\n'), ((1777, 1797), 'mock.Mock', 'Mock', ([], {'spec': 'Operation'}), '(spec=Operation)\n', (1781, 1797), False, 'from mock import Mock\n'), ((1848, 1874), 'bravado_core.param.get_param_type_spec', 'get_param_type_spec', (['param'], {}), '(param)\n', (1867, 1874), False, 'from bravado_core.param import get_param_type_spec\n'), ((1092, 1112), 'mock.Mock', 'Mock', ([], {'spec': 'Operation'}), '(spec=Operation)\n', (1096, 1112), False, 'from mock import Mock\n'), ((1155, 1181), 'bravado_core.param.get_param_type_spec', 'get_param_type_spec', (['param'], {}), '(param)\n', (1174, 1181), False, 'from bravado_core.param import get_param_type_spec\n')]
truls/faas-profiler
functions/markdown-to-html/markdown2html.py
d54ca0d9926f38c693f616ba4d08414aea823f51
# Copyright (c) 2019 Princeton University # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from markdown import markdown import base64 import json import base64 def main(params): try: md = json.loads(base64.decodebytes(params["__ow_body"].encode("utf-8")))["markdown"].encode("utf-8") md_text = base64.decodebytes(md).decode("utf-8") except KeyError: return {'Error' : 'Possibly lacking markdown parameter in request.'} test_id = params["__ow_query"].split("&")[0] html = markdown(md_text) return {"result": "ok", "html_response": html, "testid": test_id}
[((593, 610), 'markdown.markdown', 'markdown', (['md_text'], {}), '(md_text)\n', (601, 610), False, 'from markdown import markdown\n'), ((394, 416), 'base64.decodebytes', 'base64.decodebytes', (['md'], {}), '(md)\n', (412, 416), False, 'import base64\n')]