text
stringlengths
5
22M
id
stringlengths
12
177
metadata
dict
__index_level_0__
int64
0
1.37k
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from typing import Dict from azure.cognitiveservices.language.luis.runtime import LUISRuntimeClient from azure.cognitiveservices.language.luis.runtime.models import LuisResult from msrest.authentication import CognitiveServicesCredentials from botbuilder.core import ( TurnContext, RecognizerResult, ) from .luis_recognizer_internal import LuisRecognizerInternal from .luis_recognizer_options_v2 import LuisRecognizerOptionsV2 from .luis_application import LuisApplication from .luis_util import LuisUtil from .activity_util import ActivityUtil class LuisRecognizerV2(LuisRecognizerInternal): # The value type for a LUIS trace activity. luis_trace_type: str = "https://www.luis.ai/schemas/trace" # The context label for a LUIS trace activity. luis_trace_label: str = "Luis Trace" def __init__( self, luis_application: LuisApplication, luis_recognizer_options_v2: LuisRecognizerOptionsV2 = None, ): super().__init__(luis_application) credentials = CognitiveServicesCredentials(luis_application.endpoint_key) self._runtime = LUISRuntimeClient(luis_application.endpoint, credentials) self._runtime.config.add_user_agent(LuisUtil.get_user_agent()) self._runtime.config.connection.timeout = ( luis_recognizer_options_v2.timeout // 1000 ) self.luis_recognizer_options_v2 = ( luis_recognizer_options_v2 or LuisRecognizerOptionsV2() ) self._application = luis_application async def recognizer_internal(self, turn_context: TurnContext): utterance: str = ( turn_context.activity.text if turn_context.activity is not None else None ) luis_result: LuisResult = self._runtime.prediction.resolve( self._application.application_id, utterance, timezone_offset=self.luis_recognizer_options_v2.timezone_offset, verbose=self.luis_recognizer_options_v2.include_all_intents, staging=self.luis_recognizer_options_v2.staging, spell_check=self.luis_recognizer_options_v2.spell_check, bing_spell_check_subscription_key=self.luis_recognizer_options_v2.bing_spell_check_subscription_key, log=self.luis_recognizer_options_v2.log if self.luis_recognizer_options_v2.log is not None else True, ) recognizer_result: RecognizerResult = RecognizerResult( text=utterance, altered_text=luis_result.altered_query, intents=LuisUtil.get_intents(luis_result), entities=LuisUtil.extract_entities_and_metadata( luis_result.entities, luis_result.composite_entities, self.luis_recognizer_options_v2.include_instance_data if self.luis_recognizer_options_v2.include_instance_data is not None else True, ), ) LuisUtil.add_properties(luis_result, recognizer_result) if self.luis_recognizer_options_v2.include_api_results: recognizer_result.properties["luisResult"] = luis_result await self._emit_trace_info( turn_context, luis_result, recognizer_result, self.luis_recognizer_options_v2, ) return recognizer_result async def _emit_trace_info( self, turn_context: TurnContext, luis_result: LuisResult, recognizer_result: RecognizerResult, options: LuisRecognizerOptionsV2, ) -> None: trace_info: Dict[str, object] = { "recognizerResult": LuisUtil.recognizer_result_as_dict(recognizer_result), "luisModel": {"ModelID": self._application.application_id}, "luisOptions": {"Staging": options.staging}, "luisResult": LuisUtil.luis_result_as_dict(luis_result), } trace_activity = ActivityUtil.create_trace( turn_context.activity, "LuisRecognizer", trace_info, LuisRecognizerV2.luis_trace_type, LuisRecognizerV2.luis_trace_label, ) await turn_context.send_activity(trace_activity)
botbuilder-python/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v2.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-ai/botbuilder/ai/luis/luis_recognizer_v2.py", "repo_id": "botbuilder-python", "token_count": 1880 }
400
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from msrest.serialization import Model class QnAResponseContext(Model): """ The context associated with QnA. Used to mark if the qna response has related prompts. """ _attribute_map = { "is_context_only": {"key": "isContextOnly", "type": "bool"}, "prompts": {"key": "prompts", "type": "[Prompt]"}, } def __init__(self, **kwargs): """ Parameters: ----------- is_context_only: Whether this prompt is context only. prompts: The prompts collection of related prompts. """ super().__init__(**kwargs) self.is_context_only = kwargs.get("is_context_only", None) self.prompts = kwargs.get("prompts", None)
botbuilder-python/libraries/botbuilder-ai/botbuilder/ai/qna/models/qna_response_context.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-ai/botbuilder/ai/qna/models/qna_response_context.py", "repo_id": "botbuilder-python", "token_count": 319 }
401
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from enum import Enum class QnATelemetryConstants(str, Enum): """ Default QnA event and property names logged using IBotTelemetryClient. """ qna_message_event = "QnaMessage" """Event name""" knowledge_base_id_property = "knowledgeBaseId" answer_property = "answer" article_found_property = "articleFound" channel_id_property = "channelId" conversation_id_property = "conversationId" question_property = "question" matched_question_property = "matchedQuestion" question_id_property = "questionId" score_metric = "score" username_property = "username"
botbuilder-python/libraries/botbuilder-ai/botbuilder/ai/qna/utils/qna_telemetry_constants.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-ai/botbuilder/ai/qna/utils/qna_telemetry_constants.py", "repo_id": "botbuilder-python", "token_count": 232 }
402
{ "text": "Deliver from 12345 VA to 12346 WA", "intents": { "Delivery": { "score": 0.999999642 }, "search": { "score": 5.50502E-06 }, "None": { "score": 1.97937743E-06 }, "EntityTests": { "score": 1.76767367E-06 }, "Travel": { "score": 1.76767367E-06 }, "Weather_GetForecast": { "score": 5.997471E-07 }, "SpecifyName": { "score": 1.75E-09 }, "Greeting": { "score": 5.9375E-10 }, "Cancel": { "score": 5.529412E-10 }, "Help": { "score": 5.529412E-10 } }, "entities": { "$instance": { "Source": [ { "startIndex": 13, "endIndex": 21, "text": "12345 va", "type": "Address", "score": 0.7669167 } ], "Destination": [ { "startIndex": 25, "endIndex": 33, "text": "12346 wa", "type": "Address", "score": 0.9737196 } ] }, "Source": [ { "$instance": { "State": [ { "startIndex": 19, "endIndex": 21, "text": "va", "type": "State", "score": 0.8453893 } ], "number": [ { "startIndex": 13, "endIndex": 18, "text": "12345", "type": "builtin.number", "subtype": "integer" } ] }, "State": [ "va" ], "number": [ 12345 ] } ], "Destination": [ { "$instance": { "State": [ { "startIndex": 31, "endIndex": 33, "text": "wa", "type": "State", "score": 0.9857455 } ], "number": [ { "startIndex": 25, "endIndex": 30, "text": "12346", "type": "builtin.number", "subtype": "integer" } ] }, "State": [ "wa" ], "number": [ 12346 ] } ] }, "sentiment": { "label": "neutral", "score": 0.5 }, "luisResult": { "query": "Deliver from 12345 VA to 12346 WA", "topScoringIntent": { "intent": "Delivery", "score": 0.999999642 }, "intents": [ { "intent": "Delivery", "score": 0.999999642 }, { "intent": "search", "score": 5.50502E-06 }, { "intent": "None", "score": 1.97937743E-06 }, { "intent": "EntityTests", "score": 1.76767367E-06 }, { "intent": "Travel", "score": 1.76767367E-06 }, { "intent": "Weather.GetForecast", "score": 5.997471E-07 }, { "intent": "SpecifyName", "score": 1.75E-09 }, { "intent": "Greeting", "score": 5.9375E-10 }, { "intent": "Cancel", "score": 5.529412E-10 }, { "intent": "Help", "score": 5.529412E-10 } ], "entities": [ { "entity": "va", "type": "State", "startIndex": 19, "endIndex": 20, "score": 0.8453893 }, { "entity": "wa", "type": "State", "startIndex": 31, "endIndex": 32, "score": 0.9857455 }, { "entity": "12345 va", "type": "Address", "startIndex": 13, "endIndex": 20, "score": 0.7669167, "role": "Source" }, { "entity": "12346 wa", "type": "Address", "startIndex": 25, "endIndex": 32, "score": 0.9737196, "role": "Destination" }, { "entity": "12345", "type": "builtin.number", "startIndex": 13, "endIndex": 17, "resolution": { "subtype": "integer", "value": "12345" } }, { "entity": "12346", "type": "builtin.number", "startIndex": 25, "endIndex": 29, "resolution": { "subtype": "integer", "value": "12346" } } ], "compositeEntities": [ { "parentType": "Address", "value": "12345 va", "children": [ { "type": "State", "value": "va" }, { "type": "builtin.number", "value": "12345" } ] }, { "parentType": "Address", "value": "12346 wa", "children": [ { "type": "State", "value": "wa" }, { "type": "builtin.number", "value": "12346" } ] } ], "sentimentAnalysis": { "label": "neutral", "score": 0.5 } } }
botbuilder-python/libraries/botbuilder-ai/tests/luis/test_data/Composite3.json/0
{ "file_path": "botbuilder-python/libraries/botbuilder-ai/tests/luis/test_data/Composite3.json", "repo_id": "botbuilder-python", "token_count": 3117 }
403
{ "entities": { "$instance": {} }, "intents": { "Greeting": { "score": 0.9589885 } }, "text": "Hi", "v3": { "options": { "includeAllIntents": false, "includeAPIResults": true, "includeInstanceData": true, "log": true, "preferExternalEntities": true, "slot": "production" }, "response": { "query": "Hi", "prediction": { "topIntent": "Greeting", "intents": { "Greeting": { "score": 0.9589885 } }, "entities": {} } } } }
botbuilder-python/libraries/botbuilder-ai/tests/luis/test_data/NoEntitiesInstanceTrue_v3.json/0
{ "file_path": "botbuilder-python/libraries/botbuilder-ai/tests/luis/test_data/NoEntitiesInstanceTrue_v3.json", "repo_id": "botbuilder-python", "token_count": 378 }
404
{ "answers": [ { "questions": [ "Esper seeks" ], "answer": "Esper seeks. She's a curious little explorer. Young toddlers seek out new adventures, expanding their knowledge base. It's their job to test limits, to learn about them. It's the adult's job to enforce the limits, while also allowing room for exploration", "score": 79.65, "id": 35, "source": "Editorial", "isDocumentText": false, "metadata": [], "context": { "isContextOnly": false, "prompts": [] } }, { "questions": [ "Esper sups" ], "answer": "Esper sups. She eats just about anything. She loves her broccoli. Anything that she sees her parents eating, she wants to part take in herself.\n\nCaution though. If she spots you eating dessert, you best be prepared to share with her. Best to wait until she goes down for bed and then sneak your favorite snack in, without her prying eyes.", "score": 79.65, "id": 36, "source": "Editorial", "isDocumentText": false, "metadata": [], "context": { "isContextOnly": false, "prompts": [] } }, { "questions": [ "Esper screams" ], "answer": "Esper screams. The currently 1-year old toddler has a brain that's rapidly developing, expanding to new abilities at an alarming rate. With it may come fright or possibly frustration as they understand what could be done, however they need to master how to do a task themselves", "score": 66.89, "id": 34, "source": "Editorial", "isDocumentText": false, "metadata": [], "context": { "isContextOnly": false, "prompts": [] } }, { "questions": [ "Esper sleeps" ], "answer": "Esper sleeps. Esper sleeps on her floor bed. She never had a crib, as her parents placed her directly on the floor bed since birth. With this comes the benefit of not having to have an awkward transition period from crib to bed, when she gets old enough.\n\nThe idea of using the bed is that it offers the child more freedom to move about--more autonomy. Downside is, they will definitely wander off the bed, when they don't want to sleep", "score": 65.71, "id": 33, "source": "Editorial", "isDocumentText": false, "metadata": [], "context": { "isContextOnly": false, "prompts": [] } } ], "activeLearningEnabled": true }
botbuilder-python/libraries/botbuilder-ai/tests/qna/test_data/QnAMakerDialog_ActiveLearning.json/0
{ "file_path": "botbuilder-python/libraries/botbuilder-ai/tests/qna/test_data/QnAMakerDialog_ActiveLearning.json", "repo_id": "botbuilder-python", "token_count": 1318 }
405
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. """Bot Framework Application Insights integration package info.""" import os __title__ = "botbuilder-applicationinsights" __version__ = ( os.environ["packageVersion"] if "packageVersion" in os.environ else "4.16.0" ) __uri__ = "https://www.github.com/Microsoft/botbuilder-python" __author__ = "Microsoft" __description__ = "Microsoft Bot Framework Bot Builder" __summary__ = "Microsoft Bot Framework Bot Builder SDK for Python." __license__ = "MIT"
botbuilder-python/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/about.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-applicationinsights/botbuilder/applicationinsights/about.py", "repo_id": "botbuilder-python", "token_count": 153 }
406
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os from setuptools import setup REQUIRES = [ "applicationinsights==0.11.9", "botbuilder-schema==4.16.0", "botframework-connector==4.16.0", "botbuilder-core==4.16.0", ] TESTS_REQUIRES = [ "aiounittest==1.3.0", "django==3.2.24", # For samples "djangorestframework==3.14.0", # For samples "flask==2.2.5", # For samples ] root = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(root, "botbuilder", "applicationinsights", "about.py")) as f: package_info = {} info = f.read() exec(info, package_info) with open(os.path.join(root, "README.rst"), encoding="utf-8") as f: long_description = f.read() setup( name=package_info["__title__"], version=package_info["__version__"], url=package_info["__uri__"], author=package_info["__author__"], description=package_info["__description__"], keywords=[ "BotBuilderApplicationInsights", "bots", "ai", "botframework", "botbuilder", ], long_description=long_description, long_description_content_type="text/x-rst", license=package_info["__license__"], packages=[ "botbuilder.applicationinsights", "botbuilder.applicationinsights.django", "botbuilder.applicationinsights.flask", "botbuilder.applicationinsights.processor", ], install_requires=REQUIRES + TESTS_REQUIRES, tests_require=TESTS_REQUIRES, include_package_data=True, classifiers=[ "Programming Language :: Python :: 3.7", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Development Status :: 5 - Production/Stable", "Topic :: Scientific/Engineering :: Artificial Intelligence", ], )
botbuilder-python/libraries/botbuilder-applicationinsights/setup.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-applicationinsights/setup.py", "repo_id": "botbuilder-python", "token_count": 764 }
407
from unittest import TestCase from botbuilder.azure import CosmosDbKeyEscape class TestKeyValidation(TestCase): def test_should_not_change_a_valid_key(self): valid_key = "Abc12345" sanitized_key = CosmosDbKeyEscape.sanitize_key(valid_key) assert ( valid_key == sanitized_key ), f"{valid_key} should be equal to {sanitized_key}" def test_should_escape_illegal_characters_case_1(self): # Ascii code of "?" is "3f" sanitized_key = CosmosDbKeyEscape.sanitize_key("?test?") assert sanitized_key == "*63test*63" def test_should_escape_illegal_characters_case_2(self): # Ascii code of "/" is "2f" sanitized_key = CosmosDbKeyEscape.sanitize_key("/test/") assert sanitized_key == "*47test*47" def test_should_escape_illegal_characters_case_3(self): # Ascii code of "\" is "5c" sanitized_key = CosmosDbKeyEscape.sanitize_key("\\test\\") assert sanitized_key == "*92test*92" def test_should_escape_illegal_characters_case_4(self): # Ascii code of "#" is "23" sanitized_key = CosmosDbKeyEscape.sanitize_key("#test#") assert sanitized_key == "*35test*35" def test_should_escape_illegal_characters_case_5(self): # Ascii code of "*" is "2a". sanitized_key = CosmosDbKeyEscape.sanitize_key("*test*") assert sanitized_key == "*42test*42" def test_should_escape_illegal_characters_compound_key(self): # Check a compound key compoundsanitized_key = CosmosDbKeyEscape.sanitize_key("?#/") assert compoundsanitized_key, "*3f*23*2f" def test_should_handle_possible_collisions(self): valid_key1 = "*2atest*2a" valid_key2 = "*test*" escaped1 = CosmosDbKeyEscape.sanitize_key(valid_key1) escaped2 = CosmosDbKeyEscape.sanitize_key(valid_key2) assert escaped1 != escaped2, f"{escaped1} should be different that {escaped2}" def test_should_truncate_longer_keys(self): # create an extra long key # limit is 255 long_key = "x" * 300 fixed = CosmosDbKeyEscape.sanitize_key(long_key) assert len(fixed) <= 255, "long key was not properly truncated" def test_should_not_truncate_short_key(self): # create a short key short_key = "x" * 16 fixed2 = CosmosDbKeyEscape.sanitize_key(short_key) assert len(fixed2) == 16, "short key was truncated improperly" def test_should_create_sufficiently_different_truncated_keys_of_similar_origin( self, ): # create 2 very similar extra long key where the difference will definitely be trimmed off by truncate function long_key = "x" * 300 + "1" long_key2 = "x" * 300 + "2" fixed = CosmosDbKeyEscape.sanitize_key(long_key) fixed2 = CosmosDbKeyEscape.sanitize_key(long_key2) assert len(fixed) != fixed2, "key truncation failed to create unique key" def test_should_properly_truncate_keys_with_special_chars(self): # create a short key long_key = "*" * 300 fixed = CosmosDbKeyEscape.sanitize_key(long_key) assert len(fixed) <= 255, "long key with special char was truncated improperly" # create a short key short_key = "#" * 16 fixed2 = CosmosDbKeyEscape.sanitize_key(short_key) assert ( len(fixed2) <= 255 ), "short key with special char was truncated improperly"
botbuilder-python/libraries/botbuilder-azure/tests/test_key_validation.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-azure/tests/test_key_validation.py", "repo_id": "botbuilder-python", "token_count": 1486 }
408
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import traceback from abc import ABC, abstractmethod from typing import Dict from enum import Enum class Severity(Enum): verbose = 0 information = 1 warning = 2 error = 3 critical = 4 class TelemetryDataPointType(Enum): measurement = 0 aggregation = 1 class BotTelemetryClient(ABC): @abstractmethod def track_pageview( self, name: str, url, duration: int = 0, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, ) -> None: """ Send information about the page viewed in the application (a web page for instance). :param name: the name of the page that was viewed. :param url: the URL of the page that was viewed. :param duration: the duration of the page view in milliseconds. (defaults to: 0) :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None) :param measurements: the set of custom measurements the client wants to attach to this data item. \ (defaults to: None) """ raise NotImplementedError( "BotTelemetryClient.track_request(): is not implemented." ) @abstractmethod def track_exception( self, exception_type: type = None, value: Exception = None, trace: traceback = None, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, ) -> None: """ Send information about a single exception that occurred in the application. :param exception_type: the type of the exception that was thrown. :param value: the exception that the client wants to send. :param trace: the traceback information as returned by :func:`sys.exc_info`. :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None) :param measurements: the set of custom measurements the client wants to attach to this data item. \ (defaults to: None) """ raise NotImplementedError( "BotTelemetryClient.track_request(): is not implemented." ) @abstractmethod def track_event( self, name: str, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, ) -> None: """ Send information about a single event that has occurred in the context of the application. :param name: the data to associate to this event. :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None) :param measurements: the set of custom measurements the client wants to attach to this data item. \ (defaults to: None) """ raise NotImplementedError( "BotTelemetryClient.track_event(): is not implemented." ) @abstractmethod def track_metric( self, name: str, value: float, tel_type: TelemetryDataPointType = None, count: int = None, min_val: float = None, max_val: float = None, std_dev: float = None, properties: Dict[str, object] = None, ) -> NotImplemented: """ Send information about a single metric data point that was captured for the application. :param name: The name of the metric that was captured. :param value: The value of the metric that was captured. :param tel_type: The type of the metric. (defaults to: TelemetryDataPointType.aggregation`) :param count: the number of metrics that were aggregated into this data point. (defaults to: None) :param min_val: the minimum of all metrics collected that were aggregated into this data point. (defaults to: None) :param max_val: the maximum of all metrics collected that were aggregated into this data point. (defaults to: None) :param std_dev: the standard deviation of all metrics collected that were aggregated into this data point. \ :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None) """ raise NotImplementedError( "BotTelemetryClient.track_metric(): is not implemented." ) @abstractmethod def track_trace(self, name, properties=None, severity: Severity = None): """ Sends a single trace statement. :param name: the trace statement.\n :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None) :param severity: the severity level of this trace, one of DEBUG, INFO, WARNING, ERROR, CRITICAL """ raise NotImplementedError( "BotTelemetryClient.track_trace(): is not implemented." ) @abstractmethod def track_request( self, name: str, url: str, success: bool, start_time: str = None, duration: int = None, response_code: str = None, http_method: str = None, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, request_id: str = None, ): """ Sends a single request that was captured for the application. :param name: The name for this request. All requests with the same name will be grouped together. :param url: The actual URL for this request (to show in individual request instances). :param success: True if the request ended in success, False otherwise. :param start_time: the start time of the request. \ The value should look the same as the one returned by :func:`datetime.isoformat`. (defaults to: None) :param duration: the number of milliseconds that this request lasted. (defaults to: None) :param response_code: the response code that this request returned. (defaults to: None) :param http_method: the HTTP method that triggered this request. (defaults to: None) :param properties: the set of custom properties the client wants attached to this data item. (defaults to: None) :param measurements: the set of custom measurements the client wants to attach to this data item. \ (defaults to: None) :param request_id: the id for this request. If None, a new uuid will be generated. (defaults to: None) """ raise NotImplementedError( "BotTelemetryClient.track_request(): is not implemented." ) @abstractmethod def track_dependency( self, name: str, data: str, type_name: str = None, target: str = None, duration: int = None, success: bool = None, result_code: str = None, properties: Dict[str, object] = None, measurements: Dict[str, object] = None, dependency_id: str = None, ): """ Sends a single dependency telemetry that was captured for the application. :param name: the name of the command initiated with this dependency call. Low cardinality value.\ Examples are stored procedure name and URL path template. :param data: the command initiated by this dependency call. \ Examples are SQL statement and HTTP URL with all query parameters. :param type_name: the dependency type name. Low cardinality value for logical grouping of dependencies and \ interpretation of other fields like commandName and resultCode. Examples are SQL, Azure table, and HTTP. \ (default to: None) :param target: the target site of a dependency call. Examples are server name, host address. (default to: None) :param duration: the number of milliseconds that this dependency call lasted. (defaults to: None) :param success: true if the dependency call ended in success, false otherwise. (defaults to: None) :param result_code: the result code of a dependency call. Examples are SQL error code and HTTP status code. \ (defaults to: None) :param properties: the set of custom properties the client wants attached to this data item. \ (defaults to: None) :param measurements: the set of custom measurements the client wants to attach to this data item. \ (defaults to: None) :param dependency_id: the id for this dependency call. If None, a new uuid will be generated. \ (defaults to: None) """ raise NotImplementedError( "BotTelemetryClient.track_dependency(): is not implemented." )
botbuilder-python/libraries/botbuilder-core/botbuilder/core/bot_telemetry_client.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-core/botbuilder/core/bot_telemetry_client.py", "repo_id": "botbuilder-python", "token_count": 3155 }
409
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import json from typing import List, Union, Type from aiohttp.web import RouteTableDef, Request, Response from msrest.serialization import Model from botbuilder.schema import ( Activity, AttachmentData, ConversationParameters, Transcript, ) from botbuilder.core import ChannelServiceHandler async def deserialize_from_body( request: Request, target_model: Type[Model] ) -> Activity: if "application/json" in request.headers["Content-Type"]: body = await request.json() else: return Response(status=415) return target_model().deserialize(body) def get_serialized_response(model_or_list: Union[Model, List[Model]]) -> Response: if isinstance(model_or_list, Model): json_obj = model_or_list.serialize() else: json_obj = [model.serialize() for model in model_or_list] return Response(body=json.dumps(json_obj), content_type="application/json") def aiohttp_channel_service_routes( handler: ChannelServiceHandler, base_url: str = "" ) -> RouteTableDef: # pylint: disable=unused-variable routes = RouteTableDef() @routes.post(base_url + "/v3/conversations/{conversation_id}/activities") async def send_to_conversation(request: Request): activity = await deserialize_from_body(request, Activity) result = await handler.handle_send_to_conversation( request.headers.get("Authorization"), request.match_info["conversation_id"], activity, ) return get_serialized_response(result) @routes.post( base_url + "/v3/conversations/{conversation_id}/activities/{activity_id}" ) async def reply_to_activity(request: Request): activity = await deserialize_from_body(request, Activity) result = await handler.handle_reply_to_activity( request.headers.get("Authorization"), request.match_info["conversation_id"], request.match_info["activity_id"], activity, ) return get_serialized_response(result) @routes.put( base_url + "/v3/conversations/{conversation_id}/activities/{activity_id}" ) async def update_activity(request: Request): activity = await deserialize_from_body(request, Activity) result = await handler.handle_update_activity( request.headers.get("Authorization"), request.match_info["conversation_id"], request.match_info["activity_id"], activity, ) return get_serialized_response(result) @routes.delete( base_url + "/v3/conversations/{conversation_id}/activities/{activity_id}" ) async def delete_activity(request: Request): await handler.handle_delete_activity( request.headers.get("Authorization"), request.match_info["conversation_id"], request.match_info["activity_id"], ) return Response() @routes.get( base_url + "/v3/conversations/{conversation_id}/activities/{activity_id}/members" ) async def get_activity_members(request: Request): result = await handler.handle_get_activity_members( request.headers.get("Authorization"), request.match_info["conversation_id"], request.match_info["activity_id"], ) return get_serialized_response(result) @routes.post(base_url + "/") async def create_conversation(request: Request): conversation_parameters = deserialize_from_body(request, ConversationParameters) result = await handler.handle_create_conversation( request.headers.get("Authorization"), conversation_parameters ) return get_serialized_response(result) @routes.get(base_url + "/") async def get_conversation(request: Request): # TODO: continuation token? result = await handler.handle_get_conversations( request.headers.get("Authorization") ) return get_serialized_response(result) @routes.get(base_url + "/v3/conversations/{conversation_id}/members") async def get_conversation_members(request: Request): result = await handler.handle_get_conversation_members( request.headers.get("Authorization"), request.match_info["conversation_id"], ) return get_serialized_response(result) @routes.get(base_url + "/v3/conversations/{conversation_id}/members/{member_id}") async def get_conversation_member(request: Request): result = await handler.handle_get_conversation_member( request.headers.get("Authorization"), request.match_info["conversation_id", "member_id"], ) return get_serialized_response(result) @routes.get(base_url + "/v3/conversations/{conversation_id}/pagedmembers") async def get_conversation_paged_members(request: Request): # TODO: continuation token? page size? result = await handler.handle_get_conversation_paged_members( request.headers.get("Authorization"), request.match_info["conversation_id"], ) return get_serialized_response(result) @routes.delete(base_url + "/v3/conversations/{conversation_id}/members/{member_id}") async def delete_conversation_member(request: Request): result = await handler.handle_delete_conversation_member( request.headers.get("Authorization"), request.match_info["conversation_id"], request.match_info["member_id"], ) return get_serialized_response(result) @routes.post(base_url + "/v3/conversations/{conversation_id}/activities/history") async def send_conversation_history(request: Request): transcript = deserialize_from_body(request, Transcript) result = await handler.handle_send_conversation_history( request.headers.get("Authorization"), request.match_info["conversation_id"], transcript, ) return get_serialized_response(result) @routes.post(base_url + "/v3/conversations/{conversation_id}/attachments") async def upload_attachment(request: Request): attachment_data = deserialize_from_body(request, AttachmentData) result = await handler.handle_upload_attachment( request.headers.get("Authorization"), request.match_info["conversation_id"], attachment_data, ) return get_serialized_response(result) return routes
botbuilder-python/libraries/botbuilder-core/botbuilder/core/integration/aiohttp_channel_service.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-core/botbuilder/core/integration/aiohttp_channel_service.py", "repo_id": "botbuilder-python", "token_count": 2657 }
410
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. # SPECIAL_CHARS # closing ')', '}' and ']' # '-' (a range in character set) # '&', '~', (extended character set operations) # '#' (comment) and WHITESPACE (ignored) in verbose mode SPECIAL_CHARS_MAP = {i: "\\" + chr(i) for i in b"()[]{}?*+-|^$\\.&~# \t\n\r\v\f"} def escape(pattern): """ Escape special characters in a string. This is a copy of the re.escape function in Python 3.8. This was done because the 3.6.x version didn't escape in the same way and handling bot names with regex characters in it would fail in TurnContext.remove_mention_text without escaping the text. """ if isinstance(pattern, str): return pattern.translate(SPECIAL_CHARS_MAP) pattern = str(pattern, "latin1") return pattern.translate(SPECIAL_CHARS_MAP).encode("latin1")
botbuilder-python/libraries/botbuilder-core/botbuilder/core/re_escape.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-core/botbuilder/core/re_escape.py", "repo_id": "botbuilder-python", "token_count": 319 }
411
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from abc import ABC, abstractmethod from .turn_context import TurnContext class StatePropertyAccessor(ABC): @abstractmethod async def get( self, turn_context: TurnContext, default_value_or_factory=None ) -> object: """ Get the property value from the source :param turn_context: Turn Context. :param default_value_or_factory: Function which defines the property value to be returned if no value has been set. :return: """ raise NotImplementedError() @abstractmethod async def delete(self, turn_context: TurnContext) -> None: """ Saves store items to storage. :param turn_context: Turn Context. :return: """ raise NotImplementedError() @abstractmethod async def set(self, turn_context: TurnContext, value) -> None: """ Set the property value on the source. :param turn_context: Turn Context. :param value: :return: """ raise NotImplementedError()
botbuilder-python/libraries/botbuilder-core/botbuilder/core/state_property_accessor.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-core/botbuilder/core/state_property_accessor.py", "repo_id": "botbuilder-python", "token_count": 444 }
412
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License class TelemetryLoggerConstants: """The Telemetry Logger Event names.""" # The name of the event when a new message is received from the user. BOT_MSG_RECEIVE_EVENT: str = "BotMessageReceived" # The name of the event when logged when a message is sent from the bot to the user. BOT_MSG_SEND_EVENT: str = "BotMessageSend" # The name of the event when a message is updated by the bot. BOT_MSG_UPDATE_EVENT: str = "BotMessageUpdate" # The name of the event when a message is deleted by the bot. BOT_MSG_DELETE_EVENT: str = "BotMessageDelete"
botbuilder-python/libraries/botbuilder-core/botbuilder/core/telemetry_logger_constants.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-core/botbuilder/core/telemetry_logger_constants.py", "repo_id": "botbuilder-python", "token_count": 220 }
413
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import aiounittest from botbuilder.schema import Activity from botbuilder.schema.teams import TeamsChannelData from botbuilder.core.teams import teams_get_team_info class TestTeamsChannelData(aiounittest.AsyncTestCase): def test_teams_aad_group_id_deserialize(self): # Arrange raw_channel_data = {"team": {"aadGroupId": "teamGroup123"}} # Act channel_data = TeamsChannelData().deserialize(raw_channel_data) # Assert assert channel_data.team.aad_group_id == "teamGroup123" def test_teams_get_team_info(self): # Arrange activity = Activity(channel_data={"team": {"aadGroupId": "teamGroup123"}}) # Act team_info = teams_get_team_info(activity) # Assert assert team_info.aad_group_id == "teamGroup123"
botbuilder-python/libraries/botbuilder-core/tests/teams/test_teams_channel_data.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-core/tests/teams/test_teams_channel_data.py", "repo_id": "botbuilder-python", "token_count": 354 }
414
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from typing import List import aiounittest from botbuilder.core import MessageFactory from botbuilder.schema import ( ActionTypes, Activity, Attachment, CardAction, InputHints, AttachmentLayoutTypes, ) def assert_message(activity: Activity): assert isinstance(activity, Activity), "invalid activity returned" assert activity.type == "message", "not a message activity" def assert_actions(actions: List[CardAction], count: int, titles: List[str] = None): assert isinstance(actions, list), "actions not list" assert len(actions) == count, "wrong number of actions returned" for idx, action in enumerate(actions): # Added type checking assert isinstance(action, CardAction), f"actions[{idx}] is not a CardAction" assert action.title is not None, f"title[{idx}] is missing" if titles is not None: assert action.title == titles[idx], f"title[{idx}] is incorrect" assert action.type is not None, f"type[{idx}] missing" assert action.value is not None, f"value[{idx}] missing" def assert_attachments(activity: Activity, count: int, types: List[str] = None): assert isinstance(activity.attachments, list), "no attachments array" assert len(activity.attachments) == count, "wrong number of attachments" if types: for idx, attachment in enumerate(activity.attachments): # Added type checking assert isinstance( attachment, Attachment ), f"attachment[{idx}] is not an Attachment" assert ( attachment.content_type == types[idx] ), f"attachment[{idx}] has invalid content_type" class TestMessageFactory(aiounittest.AsyncTestCase): suggested_actions = [ CardAction(title="a", type=ActionTypes.im_back, value="a"), CardAction(title="b", type=ActionTypes.im_back, value="b"), CardAction(title="c", type=ActionTypes.im_back, value="c"), ] def test_should_return_a_simple_text_activity(self): activity = MessageFactory.text("test") assert_message(activity) assert activity.text == "test", "invalid text field" def test_should_return_a_simple_text_activity_with_text_and_speak(self): activity = MessageFactory.text("test", "test2") assert_message(activity) assert activity.text == "test", "invalid text field" assert activity.speak == "test2", "invalid speak field" def test_should_return_a_simple_text_activity_with_text_speak_and_input_hint(self): activity = MessageFactory.text("test", "test2", InputHints.ignoring_input) assert_message(activity) assert activity.text == "test", "invalid text field" assert activity.speak == "test2", "invalid speak field" assert ( activity.input_hint == InputHints.ignoring_input ), "invalid input_hint field" def test_should_return_suggested_actions(self): activity = MessageFactory.suggested_actions(self.suggested_actions) assert_message(activity) assert ( activity.suggested_actions is not None and activity.suggested_actions.actions is not None ), "actions not returned" assert_actions(activity.suggested_actions.actions, 3, ["a", "b", "c"]) def test_should_return_suggested_actions_with_text(self): activity = MessageFactory.suggested_actions(self.suggested_actions, "test1") assert_message(activity) assert ( activity.suggested_actions is not None and activity.suggested_actions.actions is not None ), "actions not returned" assert_actions(activity.suggested_actions.actions, 3, ["a", "b", "c"]) assert activity.text == "test1", "invalid text field." def test_should_return_suggested_actions_with_text_and_speak(self): activity = MessageFactory.suggested_actions( self.suggested_actions, "test1", "test2" ) assert_message(activity) assert ( activity.suggested_actions is not None and activity.suggested_actions.actions is not None ), "actions not returned" assert_actions(activity.suggested_actions.actions, 3, ["a", "b", "c"]) assert activity.text == "test1", "invalid text field." assert activity.speak == "test2", "invalid speak field." def test_should_return_suggested_actions_with_text_speak_and_input_hint(self): activity = MessageFactory.suggested_actions( self.suggested_actions, "test1", "test2", InputHints.ignoring_input ) assert_message(activity) assert ( activity.suggested_actions is not None and activity.suggested_actions.actions is not None ), "actions not returned" assert_actions(activity.suggested_actions.actions, 3, ["a", "b", "c"]) assert activity.text == "test1", "invalid text field." assert activity.speak == "test2", "invalid speak field." assert ( activity.input_hint == InputHints.ignoring_input ), "invalid input_hint field." def test_should_return_attachment(self): activity = MessageFactory.attachment(Attachment(content_type="none")) assert_message(activity) assert_attachments(activity, 1, ["none"]) def test_should_return_attachment_with_text(self): activity = MessageFactory.attachment(Attachment(content_type="a"), "test1") assert_message(activity) assert_attachments(activity, 1, ["a"]) assert activity.text == "test1", "invalid text field." def test_should_return_attachment_with_text_and_speak(self): activity = MessageFactory.attachment( Attachment(content_type="none"), "test1", "test2" ) assert_message(activity) assert_attachments(activity, 1, ["none"]) assert activity.text == "test1", "invalid text field." assert activity.speak == "test2", "invalid speak field." def test_should_return_attachment_with_text_speak_and_input_hint(self): activity = MessageFactory.attachment( Attachment(content_type="none"), "test1", "test2", InputHints.ignoring_input ) assert_message(activity) assert_attachments(activity, 1, ["none"]) assert activity.text == "test1", "invalid text field." assert activity.speak == "test2", "invalid speak field." assert ( activity.input_hint == InputHints.ignoring_input ), "invalid input_hint field." def test_should_return_a_list(self): activity = MessageFactory.list( [Attachment(content_type="a"), Attachment(content_type="b")] ) assert_message(activity) assert_attachments(activity, 2, ["a", "b"]) assert ( activity.attachment_layout == AttachmentLayoutTypes.list ), "invalid attachment_layout." def test_should_return_list_with_text_speak_and_input_hint(self): activity = MessageFactory.list( [Attachment(content_type="a"), Attachment(content_type="b")], "test1", "test2", InputHints.ignoring_input, ) assert_message(activity) assert_attachments(activity, 2, ["a", "b"]) assert ( activity.attachment_layout == AttachmentLayoutTypes.list ), "invalid attachment_layout." assert activity.text == "test1", "invalid text field." assert activity.speak == "test2", "invalid speak field." assert ( activity.input_hint == InputHints.ignoring_input ), "invalid input_hint field." def test_should_return_a_carousel(self): activity = MessageFactory.carousel( [Attachment(content_type="a"), Attachment(content_type="b")] ) assert_message(activity) assert_attachments(activity, 2, ["a", "b"]) assert ( activity.attachment_layout == AttachmentLayoutTypes.carousel ), "invalid attachment_layout." def test_should_return_a_carousel_with_text_speak_and_input_hint(self): activity = MessageFactory.carousel( [Attachment(content_type="a"), Attachment(content_type="b")], "test1", "test2", InputHints.ignoring_input, ) assert_message(activity) assert_attachments(activity, 2, ["a", "b"]) assert ( activity.attachment_layout == AttachmentLayoutTypes.carousel ), "invalid attachment_layout." assert activity.text == "test1", "invalid text field." assert activity.speak == "test2", "invalid speak field." assert ( activity.input_hint == InputHints.ignoring_input ), "invalid input_hint field." def test_should_return_a_content_url(self): activity = MessageFactory.content_url( "https://example.com/content", "content-type" ) assert_message(activity) assert_attachments(activity, 1, ["content-type"]) assert ( activity.attachments[0].content_url == "https://example.com/content" ), "invalid attachment[0].content_url." def test_should_return_a_content_url_with_a_name(self): activity = MessageFactory.content_url( "https://example.com/content", "content-type", "file name" ) assert_message(activity) assert_attachments(activity, 1, ["content-type"]) assert ( activity.attachments[0].content_url == "https://example.com/content" ), "invalid attachment[0].content_url." assert ( activity.attachments[0].name == "file name" ), "invalid attachment[0].name." def test_should_return_a_content_url_with_a_name_text_speak_and_input_hint(self): activity = MessageFactory.content_url( "https://example.com/content", "content-type", "file name", "test1", "test2", InputHints.ignoring_input, ) assert_message(activity) assert_attachments(activity, 1, ["content-type"]) assert ( activity.attachments[0].content_url == "https://example.com/content" ), "invalid attachment[0].content_url." assert ( activity.attachments[0].name == "file name" ), "invalid attachment[0].name." assert activity.text == "test1", "invalid text field." assert activity.speak == "test2", "invalid speak field." assert ( activity.input_hint == InputHints.ignoring_input ), "invalid input_hint field."
botbuilder-python/libraries/botbuilder-core/tests/test_message_factory.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-core/tests/test_message_factory.py", "repo_id": "botbuilder-python", "token_count": 4400 }
415
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from typing import List from botbuilder.schema import CardAction class Choice: def __init__( self, value: str = None, action: CardAction = None, synonyms: List[str] = None ): self.value: str = value self.action: CardAction = action self.synonyms: List[str] = synonyms
botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/choices/choice.py", "repo_id": "botbuilder-python", "token_count": 140 }
416
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from abc import ABC, abstractmethod from botbuilder.core import NullTelemetryClient, BotTelemetryClient from .dialog import Dialog from .dialog_context import DialogContext from .dialog_event import DialogEvent from .dialog_events import DialogEvents from .dialog_set import DialogSet class DialogContainer(Dialog, ABC): def __init__(self, dialog_id: str = None): super().__init__(dialog_id) self.dialogs = DialogSet() @property def telemetry_client(self) -> BotTelemetryClient: """ Gets the telemetry client for logging events. """ return self._telemetry_client @telemetry_client.setter def telemetry_client(self, value: BotTelemetryClient) -> None: """ Sets the telemetry client for all dialogs in this set. """ if value is None: self._telemetry_client = NullTelemetryClient() else: self._telemetry_client = value # Care! Dialogs.TelemetryClient assignment internally assigns the # TelemetryClient for each dialog which could lead to an eventual stack # overflow in cyclical dialog structures. # Don't set the telemetry client if the candidate instance is the same as # the currently set one. if self.dialogs.telemetry_client != value: self.dialogs.telemetry_client = self._telemetry_client @abstractmethod def create_child_context(self, dialog_context: DialogContext) -> DialogContext: raise NotImplementedError() def find_dialog(self, dialog_id: str) -> Dialog: # TODO: deprecate DialogSet.find return self.dialogs.find_dialog(dialog_id) async def on_dialog_event( self, dialog_context: DialogContext, dialog_event: DialogEvent ) -> bool: """ Called when an event has been raised, using `DialogContext.emitEvent()`, by either the current dialog or a dialog that the current dialog started. :param dialog_context: The dialog context for the current turn of conversation. :param dialog_event: The event being raised. :return: True if the event is handled by the current dialog and bubbling should stop. """ handled = await super().on_dialog_event(dialog_context, dialog_event) # Trace unhandled "versionChanged" events. if not handled and dialog_event.name == DialogEvents.version_changed: trace_message = ( f"Unhandled dialog event: {dialog_event.name}. Active Dialog: " f"{dialog_context.active_dialog.id}" ) await dialog_context.context.send_trace_activity(trace_message) return handled def get_internal_version(self) -> str: """ GetInternalVersion - Returns internal version identifier for this container. DialogContainers detect changes of all sub-components in the container and map that to an DialogChanged event. Because they do this, DialogContainers "hide" the internal changes and just have the .id. This isolates changes to the container level unless a container doesn't handle it. To support this DialogContainers define a protected virtual method GetInternalVersion() which computes if this dialog or child dialogs have changed which is then examined via calls to check_for_version_change_async(). :return: version which represents the change of the internals of this container. """ return self.dialogs.get_version() async def check_for_version_change_async(self, dialog_context: DialogContext): """ :param dialog_context: dialog context. :return: task. Checks to see if a containers child dialogs have changed since the current dialog instance was started. This should be called at the start of `beginDialog()`, `continueDialog()`, and `resumeDialog()`. """ current = dialog_context.active_dialog.version dialog_context.active_dialog.version = self.get_internal_version() # Check for change of previously stored hash if current and current != dialog_context.active_dialog.version: # Give bot an opportunity to handle the change. # - If bot handles it the changeHash will have been updated as to avoid triggering the # change again. await dialog_context.emit_event( DialogEvents.version_changed, self.id, True, False )
botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/dialog_container.py", "repo_id": "botbuilder-python", "token_count": 1645 }
417
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from abc import ABC, abstractmethod from typing import Iterable from .path_resolver_base import PathResolverBase class ComponentPathResolversBase(ABC): @abstractmethod def get_path_resolvers(self) -> Iterable[PathResolverBase]: raise NotImplementedError()
botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/component_path_resolvers_base.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/component_path_resolvers_base.py", "repo_id": "botbuilder-python", "token_count": 111 }
418
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from botbuilder.core import ConversationState from botbuilder.dialogs.memory import scope_path from .bot_state_memory_scope import BotStateMemoryScope class ConversationMemoryScope(BotStateMemoryScope): def __init__(self): super().__init__(ConversationState, scope_path.CONVERSATION)
botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/conversation_memory_scope.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/memory/scopes/conversation_memory_scope.py", "repo_id": "botbuilder-python", "token_count": 110 }
419
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from typing import Dict from recognizers_choice import recognize_boolean from botbuilder.core.turn_context import TurnContext from botbuilder.schema import ActivityTypes, Activity from botbuilder.dialogs.choices import ( Choice, ChoiceFactoryOptions, ChoiceRecognizers, ListStyle, ) from .prompt import Prompt from .prompt_culture_models import PromptCultureModels from .prompt_options import PromptOptions from .prompt_recognizer_result import PromptRecognizerResult class ConfirmPrompt(Prompt): _default_choice_options: Dict[str, object] = { c.locale: ( Choice(c.yes_in_language), Choice(c.no_in_language), ChoiceFactoryOptions(c.separator, c.inline_or, c.inline_or_more, True), ) for c in PromptCultureModels.get_supported_cultures() } # TODO: PromptValidator def __init__( self, dialog_id: str, validator: object = None, default_locale: str = None, choice_defaults: Dict[str, object] = None, ): super().__init__(dialog_id, validator) if dialog_id is None: raise TypeError("ConfirmPrompt(): dialog_id cannot be None.") # TODO: Port ListStyle self.style = ListStyle.auto # TODO: Import defaultLocale self.default_locale = default_locale self.choice_options = None self.confirm_choices = None if choice_defaults is not None: self._default_choice_options = choice_defaults async def on_prompt( self, turn_context: TurnContext, state: Dict[str, object], options: PromptOptions, is_retry: bool, ): if not turn_context: raise TypeError("ConfirmPrompt.on_prompt(): turn_context cannot be None.") if not options: raise TypeError("ConfirmPrompt.on_prompt(): options cannot be None.") # Format prompt to send channel_id = turn_context.activity.channel_id culture = self._determine_culture(turn_context.activity) defaults = self._default_choice_options[culture] choice_opts = ( self.choice_options if self.choice_options is not None else defaults[2] ) confirms = ( self.confirm_choices if self.confirm_choices is not None else (defaults[0], defaults[1]) ) choices = [confirms[0], confirms[1]] if is_retry and options.retry_prompt is not None: prompt = self.append_choices( options.retry_prompt, channel_id, choices, self.style, choice_opts ) else: prompt = self.append_choices( options.prompt, channel_id, choices, self.style, choice_opts ) await turn_context.send_activity(prompt) async def on_recognize( self, turn_context: TurnContext, state: Dict[str, object], options: PromptOptions, ) -> PromptRecognizerResult: if not turn_context: raise TypeError("ConfirmPrompt.on_prompt(): turn_context cannot be None.") result = PromptRecognizerResult() if turn_context.activity.type == ActivityTypes.message: # Recognize utterance utterance = turn_context.activity.text if not utterance: return result culture = self._determine_culture(turn_context.activity) results = recognize_boolean(utterance, culture) if results: first = results[0] if "value" in first.resolution: result.succeeded = True result.value = first.resolution["value"] else: # First check whether the prompt was sent to the user with numbers # if it was we should recognize numbers defaults = self._default_choice_options[culture] opts = ( self.choice_options if self.choice_options is not None else defaults[2] ) # This logic reflects the fact that IncludeNumbers is nullable and True is the default set in # Inline style if opts.include_numbers is None or opts.include_numbers: # The text may be a number in which case we will interpret that as a choice. confirm_choices = ( self.confirm_choices if self.confirm_choices is not None else (defaults[0], defaults[1]) ) choices = {confirm_choices[0], confirm_choices[1]} second_attempt_results = ChoiceRecognizers.recognize_choices( utterance, choices ) if second_attempt_results: result.succeeded = True result.value = second_attempt_results[0].resolution.index == 0 return result def _determine_culture(self, activity: Activity) -> str: culture = ( PromptCultureModels.map_to_nearest_language(activity.locale) or self.default_locale or PromptCultureModels.English.locale ) if not culture or not self._default_choice_options.get(culture): culture = PromptCultureModels.English.locale return culture
botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/confirm_prompt.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/prompts/confirm_prompt.py", "repo_id": "botbuilder-python", "token_count": 2544 }
420
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from botbuilder.core import ConversationState from botbuilder.core.skills import ( BotFrameworkClient, BotFrameworkSkill, ConversationIdFactoryBase, ) class SkillDialogOptions: def __init__( self, bot_id: str = None, skill_client: BotFrameworkClient = None, skill_host_endpoint: str = None, skill: BotFrameworkSkill = None, conversation_id_factory: ConversationIdFactoryBase = None, conversation_state: ConversationState = None, connection_name: str = None, ): self.bot_id = bot_id self.skill_client = skill_client self.skill_host_endpoint = skill_host_endpoint self.skill = skill self.conversation_id_factory = conversation_id_factory self.conversation_state = conversation_state self.connection_name = connection_name
botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/skills/skill_dialog_options.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-dialogs/botbuilder/dialogs/skills/skill_dialog_options.py", "repo_id": "botbuilder-python", "token_count": 359 }
421
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import copy import aiounittest from botbuilder.dialogs.prompts import ( AttachmentPrompt, PromptOptions, PromptValidatorContext, ) from botbuilder.schema import Activity, ActivityTypes, Attachment, InputHints from botbuilder.core import ( TurnContext, ConversationState, MemoryStorage, MessageFactory, ) from botbuilder.core.adapters import TestAdapter from botbuilder.dialogs import DialogSet, DialogTurnStatus class AttachmentPromptTests(aiounittest.AsyncTestCase): def test_attachment_prompt_with_empty_id_should_fail(self): empty_id = "" with self.assertRaises(TypeError): AttachmentPrompt(empty_id) def test_attachment_prompt_with_none_id_should_fail(self): with self.assertRaises(TypeError): AttachmentPrompt(None) async def test_basic_attachment_prompt(self): async def exec_test(turn_context: TurnContext): dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: options = PromptOptions( prompt=Activity( type=ActivityTypes.message, text="please add an attachment." ) ) await dialog_context.prompt("AttachmentPrompt", options) elif results.status == DialogTurnStatus.Complete: attachment = results.result[0] content = MessageFactory.text(attachment.content) await turn_context.send_activity(content) await convo_state.save_changes(turn_context) # Initialize TestAdapter. adapter = TestAdapter(exec_test) # Create ConversationState with MemoryStorage and register the state as middleware. convo_state = ConversationState(MemoryStorage()) # Create a DialogState property, DialogSet and AttachmentPrompt. dialog_state = convo_state.create_property("dialog_state") dialogs = DialogSet(dialog_state) dialogs.add(AttachmentPrompt("AttachmentPrompt")) # Create incoming activity with attachment. attachment = Attachment(content="some content", content_type="text/plain") attachment_activity = Activity( type=ActivityTypes.message, attachments=[attachment] ) step1 = await adapter.send("hello") step2 = await step1.assert_reply("please add an attachment.") step3 = await step2.send(attachment_activity) await step3.assert_reply("some content") async def test_attachment_prompt_with_input_hint(self): prompt_activity = Activity( type=ActivityTypes.message, text="please add an attachment.", input_hint=InputHints.accepting_input, ) async def exec_test(turn_context: TurnContext): dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: options = PromptOptions(prompt=copy.copy(prompt_activity)) await dialog_context.prompt("AttachmentPrompt", options) elif results.status == DialogTurnStatus.Complete: attachment = results.result[0] content = MessageFactory.text(attachment.content) await turn_context.send_activity(content) await convo_state.save_changes(turn_context) # Initialize TestAdapter. adapter = TestAdapter(exec_test) # Create ConversationState with MemoryStorage and register the state as middleware. convo_state = ConversationState(MemoryStorage()) # Create a DialogState property, DialogSet and AttachmentPrompt. dialog_state = convo_state.create_property("dialog_state") dialogs = DialogSet(dialog_state) dialogs.add(AttachmentPrompt("AttachmentPrompt")) step1 = await adapter.send("hello") await step1.assert_reply(prompt_activity) async def test_attachment_prompt_with_validator(self): async def exec_test(turn_context: TurnContext): dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: options = PromptOptions( prompt=Activity( type=ActivityTypes.message, text="please add an attachment." ) ) await dialog_context.prompt("AttachmentPrompt", options) elif results.status == DialogTurnStatus.Complete: attachment = results.result[0] content = MessageFactory.text(attachment.content) await turn_context.send_activity(content) await convo_state.save_changes(turn_context) # Initialize TestAdapter. adapter = TestAdapter(exec_test) # Create ConversationState with MemoryStorage and register the state as middleware. convo_state = ConversationState(MemoryStorage()) # Create a DialogState property, DialogSet and AttachmentPrompt. dialog_state = convo_state.create_property("dialog_state") dialogs = DialogSet(dialog_state) async def aux_validator(prompt_context: PromptValidatorContext): assert prompt_context, "Validator missing prompt_context" return prompt_context.recognized.succeeded dialogs.add(AttachmentPrompt("AttachmentPrompt", aux_validator)) # Create incoming activity with attachment. attachment = Attachment(content="some content", content_type="text/plain") attachment_activity = Activity( type=ActivityTypes.message, attachments=[attachment] ) step1 = await adapter.send("hello") step2 = await step1.assert_reply("please add an attachment.") step3 = await step2.send(attachment_activity) await step3.assert_reply("some content") async def test_retry_attachment_prompt(self): async def exec_test(turn_context: TurnContext): dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: options = PromptOptions( prompt=Activity( type=ActivityTypes.message, text="please add an attachment." ) ) await dialog_context.prompt("AttachmentPrompt", options) elif results.status == DialogTurnStatus.Complete: attachment = results.result[0] content = MessageFactory.text(attachment.content) await turn_context.send_activity(content) await convo_state.save_changes(turn_context) # Initialize TestAdapter. adapter = TestAdapter(exec_test) # Create ConversationState with MemoryStorage and register the state as middleware. convo_state = ConversationState(MemoryStorage()) # Create a DialogState property, DialogSet and AttachmentPrompt. dialog_state = convo_state.create_property("dialog_state") dialogs = DialogSet(dialog_state) dialogs.add(AttachmentPrompt("AttachmentPrompt")) # Create incoming activity with attachment. attachment = Attachment(content="some content", content_type="text/plain") attachment_activity = Activity( type=ActivityTypes.message, attachments=[attachment] ) step1 = await adapter.send("hello") step2 = await step1.assert_reply("please add an attachment.") step3 = await step2.send("hello again") step4 = await step3.assert_reply("please add an attachment.") step5 = await step4.send(attachment_activity) await step5.assert_reply("some content") async def test_attachment_prompt_with_custom_retry(self): async def exec_test(turn_context: TurnContext): dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: options = PromptOptions( prompt=Activity( type=ActivityTypes.message, text="please add an attachment." ), retry_prompt=Activity( type=ActivityTypes.message, text="please try again." ), ) await dialog_context.prompt("AttachmentPrompt", options) elif results.status == DialogTurnStatus.Complete: attachment = results.result[0] content = MessageFactory.text(attachment.content) await turn_context.send_activity(content) await convo_state.save_changes(turn_context) # Initialize TestAdapter. adapter = TestAdapter(exec_test) # Create ConversationState with MemoryStorage and register the state as middleware. convo_state = ConversationState(MemoryStorage()) # Create a DialogState property, DialogSet and AttachmentPrompt. dialog_state = convo_state.create_property("dialog_state") dialogs = DialogSet(dialog_state) async def aux_validator(prompt_context: PromptValidatorContext): assert prompt_context, "Validator missing prompt_context" return prompt_context.recognized.succeeded dialogs.add(AttachmentPrompt("AttachmentPrompt", aux_validator)) # Create incoming activity with attachment. attachment = Attachment(content="some content", content_type="text/plain") attachment_activity = Activity( type=ActivityTypes.message, attachments=[attachment] ) invalid_activty = Activity(type=ActivityTypes.message, text="invalid") step1 = await adapter.send("hello") step2 = await step1.assert_reply("please add an attachment.") step3 = await step2.send(invalid_activty) step4 = await step3.assert_reply("please try again.") step5 = await step4.send(attachment_activity) await step5.assert_reply("some content") async def test_should_send_ignore_retry_rompt_if_validator_replies(self): async def exec_test(turn_context: TurnContext): dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: options = PromptOptions( prompt=Activity( type=ActivityTypes.message, text="please add an attachment." ), retry_prompt=Activity( type=ActivityTypes.message, text="please try again." ), ) await dialog_context.prompt("AttachmentPrompt", options) elif results.status == DialogTurnStatus.Complete: attachment = results.result[0] content = MessageFactory.text(attachment.content) await turn_context.send_activity(content) await convo_state.save_changes(turn_context) # Initialize TestAdapter. adapter = TestAdapter(exec_test) # Create ConversationState with MemoryStorage and register the state as middleware. convo_state = ConversationState(MemoryStorage()) # Create a DialogState property, DialogSet and AttachmentPrompt. dialog_state = convo_state.create_property("dialog_state") dialogs = DialogSet(dialog_state) async def aux_validator(prompt_context: PromptValidatorContext): assert prompt_context, "Validator missing prompt_context" if not prompt_context.recognized.succeeded: await prompt_context.context.send_activity("Bad input.") return prompt_context.recognized.succeeded dialogs.add(AttachmentPrompt("AttachmentPrompt", aux_validator)) # Create incoming activity with attachment. attachment = Attachment(content="some content", content_type="text/plain") attachment_activity = Activity( type=ActivityTypes.message, attachments=[attachment] ) invalid_activty = Activity(type=ActivityTypes.message, text="invalid") step1 = await adapter.send("hello") step2 = await step1.assert_reply("please add an attachment.") step3 = await step2.send(invalid_activty) step4 = await step3.assert_reply("Bad input.") step5 = await step4.send(attachment_activity) await step5.assert_reply("some content") async def test_should_not_send_retry_if_not_specified(self): async def exec_test(turn_context: TurnContext): dialog_context = await dialogs.create_context(turn_context) results = await dialog_context.continue_dialog() if results.status == DialogTurnStatus.Empty: await dialog_context.begin_dialog("AttachmentPrompt", PromptOptions()) elif results.status == DialogTurnStatus.Complete: attachment = results.result[0] content = MessageFactory.text(attachment.content) await turn_context.send_activity(content) await convo_state.save_changes(turn_context) # Initialize TestAdapter. adapter = TestAdapter(exec_test) # Create ConversationState with MemoryStorage and register the state as middleware. convo_state = ConversationState(MemoryStorage()) # Create a DialogState property, DialogSet and AttachmentPrompt. dialog_state = convo_state.create_property("dialog_state") dialogs = DialogSet(dialog_state) dialogs.add(AttachmentPrompt("AttachmentPrompt")) # Create incoming activity with attachment. attachment = Attachment(content="some content", content_type="text/plain") attachment_activity = Activity( type=ActivityTypes.message, attachments=[attachment] ) step1 = await adapter.send("hello") step2 = await step1.send("what?") step3 = await step2.send(attachment_activity) await step3.assert_reply("some content")
botbuilder-python/libraries/botbuilder-dialogs/tests/test_attachment_prompt.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-dialogs/tests/test_attachment_prompt.py", "repo_id": "botbuilder-python", "token_count": 5892 }
422
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from uuid import uuid4 from typing import Awaitable, Callable, Dict, Union from unittest.mock import Mock import aiounittest from botbuilder.core import MessageFactory, InvokeResponse from botbuilder.core.skills import ( BotFrameworkSkill, ConversationIdFactoryBase, SkillConversationIdFactoryOptions, SkillConversationReference, ) from botbuilder.integration.aiohttp.skills import SkillHttpClient from botbuilder.schema import Activity, ConversationAccount, ConversationReference from botframework.connector.auth import ( AuthenticationConstants, ChannelProvider, GovernmentConstants, ) class SimpleConversationIdFactory(ConversationIdFactoryBase): def __init__(self, conversation_id: str): self._conversation_id = conversation_id self._conversation_refs: Dict[str, SkillConversationReference] = {} # Public property to capture and assert the options passed to CreateSkillConversationIdAsync. self.creation_options: SkillConversationIdFactoryOptions = None async def create_skill_conversation_id( self, options_or_conversation_reference: Union[ SkillConversationIdFactoryOptions, ConversationReference ], ) -> str: self.creation_options = options_or_conversation_reference key = self._conversation_id self._conversation_refs[key] = self._conversation_refs.get( key, SkillConversationReference( conversation_reference=options_or_conversation_reference.activity.get_conversation_reference(), oauth_scope=options_or_conversation_reference.from_bot_oauth_scope, ), ) return key async def get_skill_conversation_reference( self, skill_conversation_id: str ) -> SkillConversationReference: return self._conversation_refs[skill_conversation_id] async def delete_conversation_reference(self, skill_conversation_id: str): raise NotImplementedError() class TestSkillHttpClientTests(aiounittest.AsyncTestCase): async def test_post_activity_with_originating_audience(self): conversation_id = str(uuid4()) conversation_id_factory = SimpleConversationIdFactory(conversation_id) test_activity = MessageFactory.text("some message") test_activity.conversation = ConversationAccount() skill = BotFrameworkSkill( id="SomeSkill", app_id="", skill_endpoint="https://someskill.com/api/messages", ) async def _mock_post_content( to_url: str, token: str, # pylint: disable=unused-argument activity: Activity, ) -> (int, object): nonlocal self self.assertEqual(skill.skill_endpoint, to_url) # Assert that the activity being sent has what we expect. self.assertEqual(conversation_id, activity.conversation.id) self.assertEqual("https://parentbot.com/api/messages", activity.service_url) # Create mock response. return 200, None sut = await self._create_http_client_with_mock_handler( _mock_post_content, conversation_id_factory ) result = await sut.post_activity_to_skill( "", skill, "https://parentbot.com/api/messages", test_activity, "someOriginatingAudience", ) # Assert factory options self.assertEqual("", conversation_id_factory.creation_options.from_bot_id) self.assertEqual( "someOriginatingAudience", conversation_id_factory.creation_options.from_bot_oauth_scope, ) self.assertEqual( test_activity, conversation_id_factory.creation_options.activity ) self.assertEqual( skill, conversation_id_factory.creation_options.bot_framework_skill ) # Assert result self.assertIsInstance(result, InvokeResponse) self.assertEqual(200, result.status) async def test_post_activity_using_invoke_response(self): for is_gov in [True, False]: with self.subTest(is_government=is_gov): # pylint: disable=undefined-variable # pylint: disable=cell-var-from-loop conversation_id = str(uuid4()) conversation_id_factory = SimpleConversationIdFactory(conversation_id) test_activity = MessageFactory.text("some message") test_activity.conversation = ConversationAccount() expected_oauth_scope = ( AuthenticationConstants.TO_CHANNEL_FROM_BOT_OAUTH_SCOPE ) mock_channel_provider: ChannelProvider = Mock(spec=ChannelProvider) def is_government_mock(): nonlocal expected_oauth_scope if is_government: expected_oauth_scope = ( GovernmentConstants.TO_CHANNEL_FROM_BOT_OAUTH_SCOPE ) return is_government mock_channel_provider.is_government = Mock( side_effect=is_government_mock ) skill = BotFrameworkSkill( id="SomeSkill", app_id="", skill_endpoint="https://someskill.com/api/messages", ) async def _mock_post_content( to_url: str, token: str, # pylint: disable=unused-argument activity: Activity, ) -> (int, object): nonlocal self self.assertEqual(skill.skill_endpoint, to_url) # Assert that the activity being sent has what we expect. self.assertEqual(conversation_id, activity.conversation.id) self.assertEqual( "https://parentbot.com/api/messages", activity.service_url ) # Create mock response. return 200, None sut = await self._create_http_client_with_mock_handler( _mock_post_content, conversation_id_factory ) result = await sut.post_activity_to_skill( "", skill, "https://parentbot.com/api/messages", test_activity ) # Assert factory options self.assertEqual( "", conversation_id_factory.creation_options.from_bot_id ) self.assertEqual( expected_oauth_scope, conversation_id_factory.creation_options.from_bot_oauth_scope, ) self.assertEqual( test_activity, conversation_id_factory.creation_options.activity ) self.assertEqual( skill, conversation_id_factory.creation_options.bot_framework_skill ) # Assert result self.assertIsInstance(result, InvokeResponse) self.assertEqual(200, result.status) # Helper to create an HttpClient with a mock message handler that executes function argument to validate the request # and mock a response. async def _create_http_client_with_mock_handler( self, value_function: Callable[[object], Awaitable[object]], id_factory: ConversationIdFactoryBase, channel_provider: ChannelProvider = None, ) -> SkillHttpClient: # pylint: disable=protected-access client = SkillHttpClient(Mock(), id_factory, channel_provider) client._post_content = value_function await client._session.close() return client
botbuilder-python/libraries/botbuilder-integration-aiohttp/tests/skills/test_skill_http_client.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-integration-aiohttp/tests/skills/test_skill_http_client.py", "repo_id": "botbuilder-python", "token_count": 3679 }
423
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from enum import Enum class CallerIdConstants(str, Enum): public_azure_channel = "urn:botframework:azure" """ The caller ID for any Bot Framework channel. """ us_gov_channel = "urn:botframework:azureusgov" """ The caller ID for any Bot Framework US Government cloud channel. """ bot_to_bot_prefix = "urn:botframework:aadappid:" """ The caller ID prefix when a bot initiates a request to another bot. This prefix will be followed by the Azure Active Directory App ID of the bot that initiated the call. """
botbuilder-python/libraries/botbuilder-schema/botbuilder/schema/callerid_constants.py/0
{ "file_path": "botbuilder-python/libraries/botbuilder-schema/botbuilder/schema/callerid_constants.py", "repo_id": "botbuilder-python", "token_count": 207 }
424
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from .async_mixin import AsyncServiceClientMixin
botbuilder-python/libraries/botframework-connector/botframework/connector/async_mixin/__init__.py/0
{ "file_path": "botbuilder-python/libraries/botframework-connector/botframework/connector/async_mixin/__init__.py", "repo_id": "botbuilder-python", "token_count": 37 }
425
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from abc import ABC from msal import ConfidentialClientApplication from .app_credentials import AppCredentials class CertificateAppCredentials(AppCredentials, ABC): """ AppCredentials implementation using a certificate. See: https://github.com/AzureAD/microsoft-authentication-library-for-python/wiki/Client-Credentials#client-credentials-with-certificate """ def __init__( self, app_id: str, certificate_thumbprint: str, certificate_private_key: str, channel_auth_tenant: str = None, oauth_scope: str = None, certificate_public: str = None, ): """ AppCredentials implementation using a certificate. :param app_id: :param certificate_thumbprint: :param certificate_private_key: :param channel_auth_tenant: :param oauth_scope: :param certificate_public: public_certificate (optional) is public key certificate which will be sent through ‘x5c’ JWT header only for subject name and issuer authentication to support cert auto rolls. """ # super will set proper scope and endpoint. super().__init__( app_id=app_id, channel_auth_tenant=channel_auth_tenant, oauth_scope=oauth_scope, ) self.scopes = [self.oauth_scope] self.app = None self.certificate_thumbprint = certificate_thumbprint self.certificate_private_key = certificate_private_key self.certificate_public = certificate_public def get_access_token(self, force_refresh: bool = False) -> str: """ Implementation of AppCredentials.get_token. :return: The access token for the given certificate. """ # Firstly, looks up a token from cache # Since we are looking for token for the current app, NOT for an end user, # notice we give account parameter as None. auth_token = self.__get_msal_app().acquire_token_silent( self.scopes, account=None ) if not auth_token: # No suitable token exists in cache. Let's get a new one from AAD. auth_token = self.__get_msal_app().acquire_token_for_client( scopes=self.scopes ) return auth_token["access_token"] def __get_msal_app(self): if not self.app: self.app = ConfidentialClientApplication( client_id=self.microsoft_app_id, authority=self.oauth_endpoint, client_credential={ "thumbprint": self.certificate_thumbprint, "private_key": self.certificate_private_key, "public_certificate": self.certificate_public if self.certificate_public else None, }, ) return self.app
botbuilder-python/libraries/botframework-connector/botframework/connector/auth/certificate_app_credentials.py/0
{ "file_path": "botbuilder-python/libraries/botframework-connector/botframework/connector/auth/certificate_app_credentials.py", "repo_id": "botbuilder-python", "token_count": 1290 }
426
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from abc import ABC, abstractmethod from .app_credentials import AppCredentials class ServiceClientCredentialsFactory(ABC): @abstractmethod async def is_valid_app_id(self, app_id: str) -> bool: """ Validates an app ID. :param app_id: The app ID to validate. :returns: The result is true if `app_id` is valid for the controller; otherwise, false. """ raise NotImplementedError() @abstractmethod async def is_authentication_disabled(self) -> bool: """ Checks whether bot authentication is disabled. :returns: If bot authentication is disabled, the result is true; otherwise, false. """ raise NotImplementedError() @abstractmethod async def create_credentials( self, app_id: str, oauth_scope: str, login_endpoint: str, validate_authority: bool, ) -> AppCredentials: """ A factory method for creating AppCredentials. :param app_id: The appId. :param audience: The audience. :param login_endpoint: The login url. :param validate_authority: The validate authority value to use. :returns: An AppCredentials object. """ raise NotImplementedError()
botbuilder-python/libraries/botframework-connector/botframework/connector/auth/service_client_credentials_factory.py/0
{ "file_path": "botbuilder-python/libraries/botframework-connector/botframework/connector/auth/service_client_credentials_factory.py", "repo_id": "botbuilder-python", "token_count": 534 }
427
# coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- try: from ._models_py3 import AadResourceUrls from ._models_py3 import Error from ._models_py3 import ErrorResponse, ErrorResponseException from ._models_py3 import InnerHttpError from ._models_py3 import SignInUrlResponse from ._models_py3 import TokenExchangeRequest from ._models_py3 import TokenExchangeResource from ._models_py3 import TokenResponse from ._models_py3 import TokenStatus except (SyntaxError, ImportError): from ._models import AadResourceUrls from ._models import Error from ._models import ErrorResponse, ErrorResponseException from ._models import InnerHttpError from ._models import SignInUrlResponse from ._models import TokenExchangeRequest from ._models import TokenExchangeResource from ._models import TokenResponse from ._models import TokenStatus __all__ = [ "AadResourceUrls", "Error", "ErrorResponse", "ErrorResponseException", "InnerHttpError", "SignInUrlResponse", "TokenExchangeRequest", "TokenExchangeResource", "TokenResponse", "TokenStatus", ]
botbuilder-python/libraries/botframework-connector/botframework/connector/token_api/models/__init__.py/0
{ "file_path": "botbuilder-python/libraries/botframework-connector/botframework/connector/token_api/models/__init__.py", "repo_id": "botbuilder-python", "token_count": 395 }
428
interactions: - request: body: '{"type": "message", "channelId": "slack", "from": {"id": "B21UTEF8S:T03CWQ0QB"}, "recipient": {"id": "U19KH8EHJ:T03CWQ0QB"}, "textFormat": "markdown", "attachmentLayout": "list", "text": "Child activity."}' headers: Accept: [application/json] Accept-Encoding: ['gzip, deflate'] Connection: [keep-alive] Content-Length: ['205'] Content-Type: [application/json; charset=utf-8] User-Agent: [python/3.6.2 (Windows-10-10.0.16299-SP0) requests/2.18.1 msrest/0.4.23 azure-botframework-connector/3.0] method: POST uri: https://slack.botframework.com/v3/conversations/INVALID_ID/activities/INVALID_ID response: body: {string: "{\r\n \"error\": {\r\n \"code\": \"ServiceError\",\r\n \ \ \"message\": \"Invalid ConversationId: INVALID_ID\"\r\n }\r\n}"} headers: cache-control: [no-cache] content-length: ['105'] content-type: [application/json; charset=utf-8] date: ['Fri, 29 Dec 2017 18:02:59 GMT'] expires: ['-1'] pragma: [no-cache] request-context: ['appId=cid-v1:6814484e-c0d5-40ea-9dba-74ff29ca4f62'] server: [Microsoft-IIS/10.0] strict-transport-security: [max-age=31536000] x-powered-by: [ASP.NET] status: {code: 400, message: Bad Request} version: 1
botbuilder-python/libraries/botframework-connector/tests/recordings/test_conversations_reply_to_activity_with_invalid_conversation_id_fails.yaml/0
{ "file_path": "botbuilder-python/libraries/botframework-connector/tests/recordings/test_conversations_reply_to_activity_with_invalid_conversation_id_fails.yaml", "repo_id": "botbuilder-python", "token_count": 616 }
429
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import aiounittest from botframework.connector.auth import AuthenticationConstants, MicrosoftAppCredentials class TestMicrosoftAppCredentials(aiounittest.AsyncTestCase): async def test_app_credentials(self): default_scope_case_1 = MicrosoftAppCredentials("some_app", "some_password") assert ( AuthenticationConstants.TO_CHANNEL_FROM_BOT_OAUTH_SCOPE == default_scope_case_1.oauth_scope ) # Use with default scope default_scope_case_2 = MicrosoftAppCredentials( "some_app", "some_password", "some_tenant" ) assert ( AuthenticationConstants.TO_CHANNEL_FROM_BOT_OAUTH_SCOPE == default_scope_case_2.oauth_scope ) custom_scope = "some_scope" custom_scope_case_1 = MicrosoftAppCredentials( "some_app", "some_password", oauth_scope=custom_scope ) assert custom_scope_case_1.oauth_scope == custom_scope # Use with default scope custom_scope_case_2 = MicrosoftAppCredentials( "some_app", "some_password", "some_tenant", custom_scope ) assert custom_scope_case_2.oauth_scope == custom_scope
botbuilder-python/libraries/botframework-connector/tests/test_microsoft_app_credentials.py/0
{ "file_path": "botbuilder-python/libraries/botframework-connector/tests/test_microsoft_app_credentials.py", "repo_id": "botbuilder-python", "token_count": 544 }
430
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import asyncio from uuid import UUID from typing import Awaitable, Callable, List import botframework.streaming as streaming import botframework.streaming.payloads as payloads from botframework.streaming.payloads.models import Header, ResponsePayload from .assembler import Assembler class ReceiveResponseAssembler(Assembler): # pylint: disable=super-init-not-called def __init__( self, header: Header, stream_manager: "payloads.StreamManager", on_completed: Callable[[UUID, "streaming.ReceiveResponse"], Awaitable], ): if not header: raise TypeError( f"'header: {header.__class__.__name__}' argument can't be None" ) if not on_completed: raise TypeError(f"'on_completed' argument can't be None") self._stream_manager = stream_manager self._on_completed = on_completed self.identifier = header.id self._length = header.payload_length if header.end else None self._stream: List[int] = None def create_stream_from_payload(self) -> List[int]: return [None] * (self._length or 0) def get_payload_as_stream(self) -> List[int]: if self._stream is None: self._stream = self.create_stream_from_payload() return self._stream def on_receive(self, header: Header, stream: List[int], content_length: int): if header.end: self.end = header.end # Execute the response on a separate Task # Execute the request on a separate Thread in the background # Execute the request on a separate in the background asyncio.ensure_future(self.process_response(stream)) def close(self): self._stream_manager.close_stream(self.identifier) async def process_response(self, stream: List[int]): response_payload = ResponsePayload().from_json(bytes(stream).decode("utf8")) response = streaming.ReceiveResponse( status_code=response_payload.status_code, streams=[] ) if response_payload.streams: for stream_description in response_payload.streams: try: identifier = UUID(int=int(stream_description.id)) except Exception: raise ValueError( f"Stream description id '{stream_description.id}' is not a Guid" ) stream_assembler = self._stream_manager.get_payload_assembler( identifier ) stream_assembler.content_type = stream_description.content_type stream_assembler.content_length = stream_description.length content_stream = payloads.ContentStream( identifier=identifier, assembler=stream_assembler ) content_stream.length = stream_description.length content_stream.content_type = stream_description.content_type response.streams.append(content_stream) await self._on_completed(self.identifier, response)
botbuilder-python/libraries/botframework-streaming/botframework/streaming/payloads/assemblers/receive_response_assembler.py/0
{ "file_path": "botbuilder-python/libraries/botframework-streaming/botframework/streaming/payloads/assemblers/receive_response_assembler.py", "repo_id": "botbuilder-python", "token_count": 1358 }
431
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from uuid import UUID from typing import Awaitable, Callable, Dict, List, Union from botframework.streaming.payloads.assemblers import ( Assembler, ReceiveRequestAssembler, ReceiveResponseAssembler, ) from botframework.streaming.payloads.models import Header, PayloadTypes from .stream_manager import StreamManager class PayloadAssemblerManager: def __init__( self, stream_manager: StreamManager, on_receive_request: Callable[[UUID, "streaming.ReceiveRequest"], Awaitable], on_receive_response: Callable[[UUID, "streaming.ReceiveResponse"], Awaitable], ): self._on_receive_request = on_receive_request self._on_receive_response = on_receive_response self._stream_manager = stream_manager self._active_assemblers: Dict[UUID, Assembler] = {} def get_payload_stream( self, header: Header ) -> Union[List[int], "streaming.PayloadStream"]: # TODO: The return value SHOULDN'T be a union, we should interface List[int] into a BFStream class if self._is_stream_payload(header): return self._stream_manager.get_payload_stream(header) if not self._active_assemblers.get(header.id): # a new requestId has come in, start a new task to process it as it is received assembler = self._create_payload_assembler(header) if assembler: self._active_assemblers[header.id] = assembler return assembler.get_payload_as_stream() return None def on_receive( self, header: Header, content_stream: List[int], content_length: int ): if self._is_stream_payload(header): self._stream_manager.on_receive(header, content_stream, content_length) else: assembler = self._active_assemblers.get(header.id) if assembler: assembler.on_receive(header, content_stream, content_length) # remove them when we are done if header.end: del self._active_assemblers[header.id] # ignore unknown header ids def _create_payload_assembler(self, header: Header) -> Assembler: if header.type == PayloadTypes.REQUEST: return ReceiveRequestAssembler( header, self._stream_manager, self._on_receive_request ) if header.type == PayloadTypes.RESPONSE: return ReceiveResponseAssembler( header, self._stream_manager, self._on_receive_response ) return None def _is_stream_payload(self, header: Header) -> bool: return PayloadTypes.is_stream(header)
botbuilder-python/libraries/botframework-streaming/botframework/streaming/payloads/payload_assembler_manager.py/0
{ "file_path": "botbuilder-python/libraries/botframework-streaming/botframework/streaming/payloads/payload_assembler_manager.py", "repo_id": "botbuilder-python", "token_count": 1148 }
432
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from abc import ABC from .transport_base import TransportBase class TransportReceiverBase(ABC, TransportBase): async def receive(self, buffer: object, offset: int, count: int) -> int: raise NotImplementedError()
botbuilder-python/libraries/botframework-streaming/botframework/streaming/transport/transport_receiver_base.py/0
{ "file_path": "botbuilder-python/libraries/botframework-streaming/botframework/streaming/transport/transport_receiver_base.py", "repo_id": "botbuilder-python", "token_count": 92 }
433
from asyncio import Semaphore from typing import List from uuid import UUID, uuid4 import aiounittest from botframework.streaming.payload_transport import PayloadSender from botframework.streaming.payloads import HeaderSerializer from botframework.streaming.payloads.models import Header from botframework.streaming.transport import TransportSenderBase class MockTransportSender(TransportSenderBase): def __init__(self): super().__init__() self.send_called = Semaphore(0) async def send(self, buffer: List[int], offset: int, count: int) -> int: # Assert if count == 48: # Header print("Validating Header...") header = HeaderSerializer.deserialize(buffer, offset, count) assert header.type == "A" assert header.payload_length == 3 assert header.end else: # Payload print("Validating Payload...") assert count == 3 self.send_called.release() return count def close(self): pass class TestPayloadSender(aiounittest.AsyncTestCase): async def test_send(self): # Arrange sut = PayloadSender() sender = MockTransportSender() sut.connect(sender) header_id: UUID = uuid4() header = Header(type="A", id=header_id, end=True) header.payload_length = 3 payload = [1, 2, 3] async def mock_sent_callback(callback_header: Header): print( f"{callback_header.type}.{callback_header.payload_length}.{callback_header.id}.{callback_header.end}" ) # Act sut.send_payload( header, payload, is_length_known=True, sent_callback=mock_sent_callback ) # Assert await sender.send_called.acquire() await sut.disconnect()
botbuilder-python/libraries/botframework-streaming/tests/test_payload_sender.py/0
{ "file_path": "botbuilder-python/libraries/botframework-streaming/tests/test_payload_sender.py", "repo_id": "botbuilder-python", "token_count": 787 }
434
#!/usr/bin/env python3 # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. import os from typing import Dict from botbuilder.core.skills import BotFrameworkSkill """ Bot Configuration """ class DefaultConfig: """ Bot Configuration """ PORT = 3978 APP_ID = os.environ.get("MicrosoftAppId", "") APP_PASSWORD = os.environ.get("MicrosoftAppPassword", "") CONNECTION_NAME = "" SKILL_MICROSOFT_APP_ID = ""
botbuilder-python/tests/experimental/sso/parent/config.py/0
{ "file_path": "botbuilder-python/tests/experimental/sso/parent/config.py", "repo_id": "botbuilder-python", "token_count": 157 }
435
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from os import environ class DefaultConfig: """Bot Configuration""" PORT: int = 3978 APP_ID: str = environ.get("MicrosoftAppId", "") APP_PASSWORD: str = environ.get("MicrosoftAppPassword", "")
botbuilder-python/tests/functional-tests/functionaltestbot/flask_bot_app/default_config.py/0
{ "file_path": "botbuilder-python/tests/functional-tests/functionaltestbot/flask_bot_app/default_config.py", "repo_id": "botbuilder-python", "token_count": 97 }
436
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from typing import Tuple import requests from requests import Response class DirectLineClient: """A direct line client that sends and receives messages.""" def __init__(self, direct_line_secret: str): self._direct_line_secret: str = direct_line_secret self._base_url: str = "https://directline.botframework.com/v3/directline" self._set_headers() self._start_conversation() self._watermark: str = "" def send_message(self, text: str, retry_count: int = 3) -> Response: """Send raw text to bot framework using direct line api""" url = "/".join( [self._base_url, "conversations", self._conversation_id, "activities"] ) json_payload = { "conversationId": self._conversation_id, "type": "message", "from": {"id": "user1"}, "text": text, } success = False current_retry = 0 bot_response = None while not success and current_retry < retry_count: bot_response = requests.post(url, headers=self._headers, json=json_payload) current_retry += 1 if bot_response.status_code == 200: success = True return bot_response def get_message(self, retry_count: int = 3) -> Tuple[Response, str]: """Get a response message back from the bot framework using direct line api""" url = "/".join( [self._base_url, "conversations", self._conversation_id, "activities"] ) url = url + "?watermark=" + self._watermark success = False current_retry = 0 bot_response = None while not success and current_retry < retry_count: bot_response = requests.get( url, headers=self._headers, json={"conversationId": self._conversation_id}, ) current_retry += 1 if bot_response.status_code == 200: success = True json_response = bot_response.json() if "watermark" in json_response: self._watermark = json_response["watermark"] if "activities" in json_response: activities_count = len(json_response["activities"]) if activities_count > 0: return ( bot_response, json_response["activities"][activities_count - 1]["text"], ) return bot_response, "No new messages" return bot_response, "error contacting bot for response" def _set_headers(self) -> None: headers = {"Content-Type": "application/json"} value = " ".join(["Bearer", self._direct_line_secret]) headers.update({"Authorization": value}) self._headers = headers def _start_conversation(self) -> None: # Start conversation and get us a conversationId to use url = "/".join([self._base_url, "conversations"]) bot_response = requests.post(url, headers=self._headers) # Extract the conversationID for sending messages to bot json_response = bot_response.json() self._conversation_id = json_response["conversationId"]
botbuilder-python/tests/functional-tests/tests/direct_line_client.py/0
{ "file_path": "botbuilder-python/tests/functional-tests/tests/direct_line_client.py", "repo_id": "botbuilder-python", "token_count": 1506 }
437
# Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. from typing import List from botbuilder.core import MessageFactory, TurnContext from botbuilder.schema import ActivityTypes, ChannelAccount from helpers.dialog_helper import DialogHelper from bots import DialogBot class AuthBot(DialogBot): async def on_turn(self, turn_context: TurnContext): if turn_context.activity.type == ActivityTypes.invoke: await DialogHelper.run_dialog( self.dialog, turn_context, self.conversation_state.create_property("DialogState") ) else: await super().on_turn(turn_context) async def on_members_added_activity( self, members_added: List[ChannelAccount], turn_context: TurnContext ): for member in members_added: if member.id != turn_context.activity.recipient.id: await turn_context.send_activity( MessageFactory.text("Hello and welcome!") ) async def on_token_response_event( self, turn_context: TurnContext ): print("on token: Running dialog with Message Activity.") return await DialogHelper.run_dialog( self.dialog, turn_context, self.conversation_state.create_property("DialogState") )
botbuilder-python/tests/skills/skills-prototypes/dialog-to-dialog/authentication-bot/bots/auth_bot.py/0
{ "file_path": "botbuilder-python/tests/skills/skills-prototypes/dialog-to-dialog/authentication-bot/bots/auth_bot.py", "repo_id": "botbuilder-python", "token_count": 565 }
438
from .root_bot import RootBot __all__ = ["RootBot"]
botbuilder-python/tests/skills/skills-prototypes/simple-bot-to-bot/simple-root-bot/bots/__init__.py/0
{ "file_path": "botbuilder-python/tests/skills/skills-prototypes/simple-bot-to-bot/simple-root-bot/bots/__init__.py", "repo_id": "botbuilder-python", "token_count": 19 }
439
<?xml version='1.0' encoding='UTF-8'?> <glyph name="Ecircumflexhookabove" format="2"> <advance width="1200"/> <unicode hex="1EC2"/> <outline> <component base="E"/> <component base="circumflexcomb.case" xOffset="30"/> <component base="hookabovecomb.case" xOffset="414" yOffset="248"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>top_viet</string> <key>index</key> <integer>2</integer> <key>name</key> <string>hookabovecomb.case</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/E_circumflexhookabove.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/E_circumflexhookabove.glif", "repo_id": "cascadia-code", "token_count": 325 }
440
<?xml version='1.0' encoding='UTF-8'?> <glyph name="Iacute" format="2"> <advance width="1200"/> <unicode hex="00CD"/> <outline> <component base="I"/> <component base="acutecomb.case" xOffset="79"/> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/I_acute.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/I_acute.glif", "repo_id": "cascadia-code", "token_count": 96 }
441
<?xml version='1.0' encoding='UTF-8'?> <glyph name="Ocircumflexhookabove" format="2"> <advance width="1200"/> <unicode hex="1ED4"/> <outline> <component base="O"/> <component base="circumflexcomb.case"/> <component base="hookabovecomb.case" xOffset="384" yOffset="248"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>top_viet</string> <key>index</key> <integer>2</integer> <key>name</key> <string>hookabovecomb.case</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/O_circumflexhookabove.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/O_circumflexhookabove.glif", "repo_id": "cascadia-code", "token_count": 320 }
442
<?xml version='1.0' encoding='UTF-8'?> <glyph name="Omacrongrave" format="2"> <advance width="1200"/> <unicode hex="1E50"/> <outline> <component base="O"/> <component base="macroncomb.case"/> <component base="gravecomb.case" xOffset="-80" yOffset="341"/> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/O_macrongrave.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/O_macrongrave.glif", "repo_id": "cascadia-code", "token_count": 117 }
443
<?xml version='1.0' encoding='UTF-8'?> <glyph name="Tcommaaccent" format="2"> <advance width="1200"/> <unicode hex="021A"/> <outline> <component base="T"/> <component base="commaaccentcomb" xOffset="-5"/> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/T_commaaccent.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/T_commaaccent.glif", "repo_id": "cascadia-code", "token_count": 98 }
444
<?xml version='1.0' encoding='UTF-8'?> <glyph name="Zacute.loclPLK" format="2"> <advance width="1200"/> <outline> <component base="Z"/> <component base="acutecomb.case.loclPLK"/> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/Z_acute.loclP_L_K_.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/Z_acute.loclP_L_K_.glif", "repo_id": "cascadia-code", "token_count": 91 }
445
<?xml version='1.0' encoding='UTF-8'?> <glyph name="_vinvertedbelow-ar" format="2"> <advance width="1200"/> <anchor x="602" y="-117" name="_bottom"/> <anchor x="602" y="-2" name="_bottom.dot"/> <anchor x="603" y="-426" name="bottom"/> <outline> <component base="_vabove" xScale="-1" yScale="-1" xOffset="1200" yOffset="523"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>_vabove</string> </dict> </array> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/_vinvertedbelow-ar.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/_vinvertedbelow-ar.glif", "repo_id": "cascadia-code", "token_count": 389 }
446
<?xml version='1.0' encoding='UTF-8'?> <glyph name="acircumflexgrave" format="2"> <advance width="1200"/> <unicode hex="1EA7"/> <outline> <component base="a"/> <component base="circumflexcomb" xOffset="-20"/> <component base="gravecomb" xOffset="293" yOffset="340"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>top_viet</string> <key>index</key> <integer>2</integer> <key>name</key> <string>gravecomb</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/acircumflexgrave.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/acircumflexgrave.glif", "repo_id": "cascadia-code", "token_count": 317 }
447
<?xml version='1.0' encoding='UTF-8'?> <glyph name="ainTwodotshorizontalabove-ar.fina" format="2"> <advance width="1200"/> <outline> <component base="ain-ar.fina"/> <component base="twodotshorizontalabove-ar" xOffset="10" yOffset="283"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/ainT_wodotshorizontalabove-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/ainT_wodotshorizontalabove-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 174 }
448
<?xml version='1.0' encoding='UTF-8'?> <glyph name="alefTwoabove-ar" format="2"> <advance width="1200"/> <unicode hex="0773"/> <anchor x="610" y="-141" name="bottom"/> <anchor x="361" y="1570" name="top"/> <outline> <component base="two-persian.small01" xOffset="-269" yOffset="-83"/> <component base="alef-ar.short"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>two-persian.small01</string> </dict> </array> <key>com.schriftgestaltung.Glyphs.glyph.rightMetricsKey</key> <string>=alef-ar</string> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/alefT_woabove-ar.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/alefT_woabove-ar.glif", "repo_id": "cascadia-code", "token_count": 439 }
449
<?xml version='1.0' encoding='UTF-8'?> <glyph name="alefdagesh-hb" format="2"> <advance width="1200"/> <unicode hex="FB30"/> <outline> <component base="alef-hb"/> <component base="dagesh-hb" xOffset="-151" yOffset="-170"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.97,1,0,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/alefdagesh-hb.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/alefdagesh-hb.glif", "repo_id": "cascadia-code", "token_count": 173 }
450
<?xml version='1.0' encoding='UTF-8'?> <glyph name="asterisk_slash.liga" format="2"> <advance width="1200"/> <outline> <component base="asterisk" xOffset="62"/> <component base="slash" xOffset="1142"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>asterisk</string> </dict> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>1</integer> <key>name</key> <string>slash</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/asterisk_slash.liga.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/asterisk_slash.liga.glif", "repo_id": "cascadia-code", "token_count": 416 }
451
<?xml version='1.0' encoding='UTF-8'?> <glyph name="beh-ar.medi" format="2"> <advance width="1200"/> <outline> <component base="behDotless-ar.medi"/> <component base="dotbelow-ar" xOffset="-10" yOffset="-24"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/beh-ar.medi.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/beh-ar.medi.glif", "repo_id": "cascadia-code", "token_count": 165 }
452
<?xml version='1.0' encoding='UTF-8'?> <glyph name="behThreedotshorizontalbelow-ar.fina.alt" format="2"> <advance width="1200"/> <outline> <component base="behDotless-ar.fina.alt"/> <component base="_dots.horz.below" xOffset="-708" yOffset="-18"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>bottom.dot</string> <key>index</key> <integer>1</integer> <key>name</key> <string>_dots.horz.below</string> </dict> </array> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/behT_hreedotshorizontalbelow-ar.fina.alt.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/behT_hreedotshorizontalbelow-ar.fina.alt.glif", "repo_id": "cascadia-code", "token_count": 361 }
453
<?xml version='1.0' encoding='UTF-8'?> <glyph name="behThreedotsupbelow-ar" format="2"> <advance width="1200"/> <unicode hex="0752"/> <outline> <component base="behDotless-ar"/> <component base="threedotsupbelow-ar" xOffset="-20" yOffset="-24"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/behT_hreedotsupbelow-ar.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/behT_hreedotsupbelow-ar.glif", "repo_id": "cascadia-code", "token_count": 179 }
454
<?xml version='1.0' encoding='UTF-8'?> <glyph name="behVabove-ar.init" format="2"> <advance width="1200"/> <outline> <component base="behDotless-ar.init"/> <component base="vabove-ar" xOffset="235" yOffset="335"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>top.dot</string> <key>index</key> <integer>1</integer> <key>name</key> <string>vabove-ar</string> </dict> </array> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/behV_above-ar.init.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/behV_above-ar.init.glif", "repo_id": "cascadia-code", "token_count": 340 }
455
<?xml version='1.0' encoding='UTF-8'?> <glyph name="beheh-ar.alt" format="2"> <advance width="1200"/> <outline> <component base="behDotless-ar.alt"/> <component base="fourdotsbelow-ar" xOffset="-620" yOffset="-24"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>bottom.dot</string> <key>index</key> <integer>1</integer> <key>name</key> <string>fourdotsbelow-ar</string> </dict> </array> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/beheh-ar.alt.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/beheh-ar.alt.glif", "repo_id": "cascadia-code", "token_count": 346 }
456
<?xml version='1.0' encoding='UTF-8'?> <glyph name="checkerBoardFill" format="2"> <advance width="1200"/> <unicode hex="1FB95"/> <outline> <contour> <point x="0" y="2226" type="line"/> <point x="300" y="2226" type="line"/> <point x="300" y="1549" type="line"/> <point x="0" y="1549" type="line"/> </contour> <contour> <point x="600" y="2226" type="line"/> <point x="900" y="2226" type="line"/> <point x="900" y="1549" type="line"/> <point x="600" y="1549" type="line"/> </contour> <contour> <point x="300" y="1549" type="line"/> <point x="600" y="1549" type="line"/> <point x="600" y="873" type="line"/> <point x="300" y="873" type="line"/> </contour> <contour> <point x="900" y="1549" type="line"/> <point x="1200" y="1549" type="line"/> <point x="1200" y="873" type="line"/> <point x="900" y="873" type="line"/> </contour> <contour> <point x="0" y="873" type="line"/> <point x="300" y="873" type="line"/> <point x="300" y="196" type="line"/> <point x="0" y="196" type="line"/> </contour> <contour> <point x="600" y="873" type="line"/> <point x="900" y="873" type="line"/> <point x="900" y="196" type="line"/> <point x="600" y="196" type="line"/> </contour> <contour> <point x="300" y="196" type="line"/> <point x="600" y="196" type="line"/> <point x="600" y="-480" type="line"/> <point x="300" y="-480" type="line"/> </contour> <contour> <point x="900" y="196" type="line"/> <point x="1200" y="196" type="line"/> <point x="1200" y="-480" type="line"/> <point x="900" y="-480" type="line"/> </contour> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/checkerB_oardF_ill.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/checkerB_oardF_ill.glif", "repo_id": "cascadia-code", "token_count": 860 }
457
<?xml version='1.0' encoding='UTF-8'?> <glyph name="colon_equal.liga" format="2"> <advance width="1200"/> <outline> <contour> <point x="1083" y="835" type="line"/> <point x="2120" y="835" type="line"/> <point x="2120" y="1085" type="line"/> <point x="1083" y="1085" type="line"/> </contour> <contour> <point x="1083" y="333" type="line"/> <point x="2120" y="333" type="line"/> <point x="2120" y="583" type="line"/> <point x="1083" y="583" type="line"/> </contour> <component base="colon" xOffset="-60" yOffset="180"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>colon</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/colon_equal.liga.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/colon_equal.liga.glif", "repo_id": "cascadia-code", "token_count": 481 }
458
<?xml version='1.0' encoding='UTF-8'?> <glyph name="dalThreedotsdown-ar" format="2"> <advance width="1200"/> <unicode hex="068F"/> <outline> <component base="dal-ar"/> <component base="threedotsdownabove-ar" xOffset="16" yOffset="512"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/dalT_hreedotsdown-ar.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/dalT_hreedotsdown-ar.glif", "repo_id": "cascadia-code", "token_count": 174 }
459
<?xml version='1.0' encoding='UTF-8'?> <glyph name="dcaron" format="2"> <advance width="1200"/> <unicode hex="010F"/> <outline> <contour> <point x="1105" y="1188" type="line"/> <point x="1311" y="1188" type="line"/> <point x="1401" y="1568" type="line"/> <point x="1155" y="1568" type="line"/> </contour> <component base="d"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>d</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/dcaron.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/dcaron.glif", "repo_id": "cascadia-code", "token_count": 375 }
460
<?xml version='1.0' encoding='UTF-8'?> <glyph name="deviceControlTwoControl" format="2"> <advance width="1200"/> <unicode hex="2412"/> <outline> <component base="D.half" xOffset="-10" yOffset="781"/> <component base="two.half" xOffset="370"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>D.half</string> </dict> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>1</integer> <key>name</key> <string>two.half</string> </dict> </array> <key>com.schriftgestaltung.Glyphs.glyph.widthMetricsKey</key> <string>space</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/deviceC_ontrolT_woC_ontrol.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/deviceC_ontrolT_woC_ontrol.glif", "repo_id": "cascadia-code", "token_count": 477 }
461
<?xml version='1.0' encoding='UTF-8'?> <glyph name="dotaccent" format="2"> <advance width="1200"/> <unicode hex="02D9"/> <outline> <component base="dotaccentcomb"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>dotaccentcomb</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/dotaccent.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/dotaccent.glif", "repo_id": "cascadia-code", "token_count": 278 }
462
<?xml version='1.0' encoding='UTF-8'?> <glyph name="dul-ar.fina" format="2"> <advance width="1200"/> <guideline x="127" y="632" angle="0"/> <outline> <component base="dal-ar.fina"/> <component base="threedotsupabove-ar" xOffset="36" yOffset="482"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/dul-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/dul-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 185 }
463
<?xml version='1.0' encoding='UTF-8'?> <glyph name="eacute" format="2"> <advance width="1200"/> <unicode hex="00E9"/> <outline> <component base="e"/> <component base="acutecomb" xOffset="61"/> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/eacute.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/eacute.glif", "repo_id": "cascadia-code", "token_count": 95 }
464
<?xml version='1.0' encoding='UTF-8'?> <glyph name="eight-ar" format="2"> <advance width="1200"/> <unicode hex="0668"/> <outline> <component base="seven-ar" xScale="-1" yScale="-1" xOffset="1204" yOffset="1430"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/eight-ar.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/eight-ar.glif", "repo_id": "cascadia-code", "token_count": 167 }
465
<?xml version='1.0' encoding='UTF-8'?> <glyph name="escapeControl" format="2"> <advance width="1200"/> <unicode hex="241B"/> <outline> <component base="E.half" xOffset="-10" yOffset="781"/> <component base="C.half" xOffset="370"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>E.half</string> </dict> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>1</integer> <key>name</key> <string>C.half</string> </dict> </array> <key>com.schriftgestaltung.Glyphs.glyph.widthMetricsKey</key> <string>space</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/escapeC_ontrol.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/escapeC_ontrol.glif", "repo_id": "cascadia-code", "token_count": 475 }
466
<?xml version='1.0' encoding='UTF-8'?> <glyph name="exclam_exclam.liga" format="2"> <advance width="1200"/> <outline> <component base="exclam" xOffset="140"/> <component base="exclam" xOffset="1060"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>exclam</string> </dict> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>1</integer> <key>name</key> <string>exclam</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/exclam_exclam.liga.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/exclam_exclam.liga.glif", "repo_id": "cascadia-code", "token_count": 422 }
467
<?xml version='1.0' encoding='UTF-8'?> <glyph name="fehDotbelowThreedotsabove-ar.init" format="2"> <advance width="1200"/> <outline> <component base="fehDotless-ar.init"/> <component base="dotbelow-ar" xOffset="113" yOffset="-24"/> <component base="threedotsupabove-ar" xOffset="65" yOffset="460"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>bottom.dot</string> <key>index</key> <integer>1</integer> <key>name</key> <string>dotbelow-ar</string> </dict> <dict> <key>anchor</key> <string>top.dot</string> <key>index</key> <integer>2</integer> <key>name</key> <string>threedotsupabove-ar</string> </dict> </array> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/fehD_otbelowT_hreedotsabove-ar.init.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/fehD_otbelowT_hreedotsabove-ar.init.glif", "repo_id": "cascadia-code", "token_count": 507 }
468
<?xml version='1.0' encoding='UTF-8'?> <glyph name="fehThreedotsupbelow-ar.fina.alt" format="2"> <advance width="1200"/> <outline> <component base="fehDotless-ar.fina.alt"/> <component base="threedotsupbelow-ar" xOffset="-35" yOffset="-18"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>bottom.dot</string> <key>index</key> <integer>1</integer> <key>name</key> <string>threedotsupbelow-ar</string> </dict> </array> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/fehT_hreedotsupbelow-ar.fina.alt.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/fehT_hreedotsupbelow-ar.fina.alt.glif", "repo_id": "cascadia-code", "token_count": 359 }
469
<?xml version='1.0' encoding='UTF-8'?> <glyph name="fiveeighths.BRACKET.500" format="2"> <advance width="1200"/> <outline> <contour> <point x="710" y="692" type="line"/> <point x="1121" y="969" type="line"/> <point x="989" y="1143" type="line"/> <point x="617" y="814" type="line"/> </contour> <contour> <point x="211" y="269" type="line"/> <point x="577" y="593" type="line"/> <point x="484" y="715" type="line"/> <point x="79" y="449" type="line"/> </contour> <component base="fivesuperior" xOffset="-260"/> <component base="eightinferior" xOffset="270"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>fivesuperior</string> </dict> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>1</integer> <key>name</key> <string>eightinferior</string> </dict> </array> <key>com.schriftgestaltung.Glyphs._originalLayerName</key> <string>[500]</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/fiveeighths.B_R_A_C_K_E_T_.500.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/fiveeighths.B_R_A_C_K_E_T_.500.glif", "repo_id": "cascadia-code", "token_count": 665 }
470
<?xml version='1.0' encoding='UTF-8'?> <glyph name="four-persian.urdusuperior" format="2"> <advance width="1200"/> <outline> <component base="four-persian.urduinferior" yOffset="797"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.category</key> <string>Number</string> <key>com.schriftgestaltung.Glyphs.script</key> <string>arabic</string> <key>com.schriftgestaltung.Glyphs.subCategory</key> <string>Small</string> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/four-persian.urdusuperior.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/four-persian.urdusuperior.glif", "repo_id": "cascadia-code", "token_count": 271 }
471
<?xml version='1.0' encoding='UTF-8'?> <glyph name="franc" format="2"> <advance width="1200"/> <unicode hex="20A3"/> <outline> <contour> <point x="13" y="199" type="line"/> <point x="695" y="199" type="line"/> <point x="695" y="386" type="line"/> <point x="13" y="386" type="line"/> </contour> <component base="F"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>F</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/franc.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/franc.glif", "repo_id": "cascadia-code", "token_count": 367 }
472
<?xml version='1.0' encoding='UTF-8'?> <glyph name="gafRing-ar.medi" format="2"> <advance width="1200"/> <anchor x="649" y="-141" name="bottom"/> <outline> <component base="gaf-ar.medi"/> <component base="ringArabic" xOffset="234" yOffset="978"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>1</integer> <key>name</key> <string>ringArabic</string> </dict> </array> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/gafR_ing-ar.medi.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/gafR_ing-ar.medi.glif", "repo_id": "cascadia-code", "token_count": 353 }
473
<?xml version='1.0' encoding='UTF-8'?> <glyph name="guarani" format="2"> <advance width="1200"/> <unicode hex="20B2"/> <outline> <contour> <point x="518" y="-320" type="line"/> <point x="771" y="-320" type="line"/> <point x="771" y="54" type="line"/> <point x="721" y="121" type="line"/> <point x="721" y="578" type="line"/> <point x="771" y="648" type="line"/> <point x="771" y="1740" type="line"/> <point x="518" y="1740" type="line"/> </contour> <component base="G"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>G</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/guarani.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/guarani.glif", "repo_id": "cascadia-code", "token_count": 454 }
474
<?xml version='1.0' encoding='UTF-8'?> <glyph name="hahFourbelow-ar.fina" format="2"> <advance width="1200"/> <outline> <component base="hah-ar.fina"/> <component base="four-persiancenter-ar" xOffset="-4" yOffset="-340"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.glyph.leftMetricsKey</key> <string>hah-ar.fina</string> <key>com.schriftgestaltung.Glyphs.glyph.rightMetricsKey</key> <string>hah-ar.fina</string> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hahF_ourbelow-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hahF_ourbelow-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 273 }
475
<?xml version='1.0' encoding='UTF-8'?> <glyph name="hahTahbelow-ar.fina" format="2"> <advance width="1200"/> <outline> <component base="hah-ar.fina"/> <component base="tahcenter-ar" xOffset="23" yOffset="-382"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.glyph.leftMetricsKey</key> <string>hah-ar.fina</string> <key>com.schriftgestaltung.Glyphs.glyph.rightMetricsKey</key> <string>hah-ar.fina</string> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hahT_ahbelow-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hahT_ahbelow-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 271 }
476
<?xml version='1.0' encoding='UTF-8'?> <glyph name="hahTwodotsverticalabove-ar.fina" format="2"> <advance width="1200"/> <outline> <component base="hah-ar.fina"/> <component base="twodotsverticalabove-ar" xOffset="-34" yOffset="362"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hahT_wodotsverticalabove-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hahT_wodotsverticalabove-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 175 }
477
<?xml version='1.0' encoding='UTF-8'?> <glyph name="hehHamzaabove-ar.fina" format="2"> <advance width="1200"/> <outline> <component base="heh-ar.fina"/> <component base="hamzaabove-ar" xOffset="109" yOffset="-84"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hehH_amzaabove-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hehH_amzaabove-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 169 }
478
<?xml version='1.0' encoding='UTF-8'?> <glyph name="hookabovecomb" format="2"> <unicode hex="0309"/> <anchor x="580" y="1060" name="_top"/> <anchor x="580" y="1060" name="_top_viet"/> <anchor x="590" y="1618" name="top"/> <outline> <contour> <point x="477" y="1248" type="line"/> <point x="682" y="1248" type="line"/> <point x="682" y="1257" type="line" smooth="yes"/> <point x="682" y="1369"/> <point x="825" y="1380"/> <point x="825" y="1516" type="curve" smooth="yes"/> <point x="825" y="1622"/> <point x="730" y="1692"/> <point x="585" y="1692" type="curve"/> <point x="514" y="1508" type="line"/> <point x="546" y="1508"/> <point x="567" y="1492"/> <point x="567" y="1468" type="curve" smooth="yes"/> <point x="567" y="1407"/> <point x="477" y="1381"/> <point x="477" y="1284" type="curve" smooth="yes"/> </contour> <contour> <point x="415" y="1473" type="line"/> <point x="440" y="1494"/> <point x="479" y="1508"/> <point x="514" y="1508" type="curve"/> <point x="585" y="1692" type="line"/> <point x="484" y="1692"/> <point x="387" y="1662"/> <point x="339" y="1617" type="curve"/> </contour> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.originalWidth</key> <integer>1200</integer> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hookabovecomb.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/hookabovecomb.glif", "repo_id": "cascadia-code", "token_count": 693 }
479
<?xml version='1.0' encoding='UTF-8'?> <glyph name="ii-cy.loclBGR" format="2"> <advance width="1200"/> <outline> <component base="u"/> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/ii-cy.loclB_G_R_.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/ii-cy.loclB_G_R_.glif", "repo_id": "cascadia-code", "token_count": 71 }
480
<?xml version='1.0' encoding='UTF-8'?> <glyph name="kafTwodotshorizontalabove-ar.fina" format="2"> <advance width="1200"/> <anchor x="545.9" y="1381.8" name="top"/> <outline> <component base="kaf-ar.fina"/> <component base="twodotshorizontalabove-ar" xScale="0.7" yScale="0.7" xOffset="116" yOffset="683"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>top.dot</string> <key>index</key> <integer>1</integer> <key>name</key> <string>twodotshorizontalabove-ar</string> </dict> </array> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/kafT_wodotshorizontalabove-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/kafT_wodotshorizontalabove-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 392 }
481
<?xml version='1.0' encoding='UTF-8'?> <glyph name="kasra-ar" format="2"> <unicode hex="0650"/> <anchor x="598" y="0" name="_bottom"/> <anchor x="602" y="-237" name="bottom"/> <outline> <component base="_fatha-ar" xOffset="3" yOffset="-1568"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>_fatha-ar</string> </dict> </array> <key>com.schriftgestaltung.Glyphs.originalWidth</key> <integer>1200</integer> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/kasra-ar.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/kasra-ar.glif", "repo_id": "cascadia-code", "token_count": 400 }
482
<?xml version='1.0' encoding='UTF-8'?> <glyph name="kehehThreedotsbelow-ar.fina" format="2"> <advance width="1200"/> <outline> <component base="keheh-ar.fina"/> <component base="threedotsdownbelow-ar" xOffset="-47" yOffset="-4"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/kehehT_hreedotsbelow-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/kehehT_hreedotsbelow-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 175 }
483
<?xml version='1.0' encoding='UTF-8'?> <glyph name="khah-ar.medi" format="2"> <advance width="1200"/> <outline> <component base="hah-ar.medi"/> <component base="dotabove-ar" xOffset="-34" yOffset="372"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>anchor</key> <string>top.dot</string> <key>index</key> <integer>1</integer> <key>name</key> <string>dotabove-ar</string> </dict> </array> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/khah-ar.medi.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/khah-ar.medi.glif", "repo_id": "cascadia-code", "token_count": 338 }
484
<?xml version='1.0' encoding='UTF-8'?> <glyph name="lamBar-ar.fina" format="2"> <advance width="1200"/> <outline> <component base="lam-ar.fina"/> <component base="_bar" xScale="0.9" xOffset="381" yOffset="633"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.glyph.leftMetricsKey</key> <string>lam-ar.fina</string> <key>com.schriftgestaltung.Glyphs.glyph.rightMetricsKey</key> <string>lam-ar.fina</string> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/lamB_ar-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/lamB_ar-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 269 }
485
<?xml version='1.0' encoding='UTF-8'?> <glyph name="lamDoublebar-ar.medi" format="2"> <advance width="1200"/> <outline> <component base="lam-ar.medi"/> <component base="_doublebar" xScale="0.9" xOffset="171" yOffset="633"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.glyph.leftMetricsKey</key> <string>lam-ar.medi</string> <key>com.schriftgestaltung.Glyphs.glyph.rightMetricsKey</key> <string>lam-ar.medi</string> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/lamD_oublebar-ar.medi.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/lamD_oublebar-ar.medi.glif", "repo_id": "cascadia-code", "token_count": 267 }
486
<?xml version='1.0' encoding='UTF-8'?> <glyph name="lamVabove-ar.init" format="2"> <advance width="1200"/> <outline> <component base="lam-ar.init"/> <component base="vabove-ar" xOffset="234" yOffset="935"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/lamV_above-ar.init.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/lamV_above-ar.init.glif", "repo_id": "cascadia-code", "token_count": 163 }
487
<?xml version='1.0' encoding='UTF-8'?> <glyph name="leftOneThirdBlock" format="2"> <advance width="1200"/> <unicode hex="1FBCF"/> <outline> <contour> <point x="0" y="-480" type="line"/> <point x="400" y="-480" type="line"/> <point x="400" y="2226" type="line"/> <point x="0" y="2226" type="line"/> </contour> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/leftO_neT_hirdB_lock.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/leftO_neT_hirdB_lock.glif", "repo_id": "cascadia-code", "token_count": 169 }
488
<?xml version='1.0' encoding='UTF-8'?> <glyph name="less" format="2"> <advance width="1200"/> <unicode hex="003C"/> <outline> <contour> <point x="1087" y="197" type="line"/> <point x="1087" y="467" type="line"/> <point x="331" y="700" type="line"/> <point x="331" y="718" type="line"/> <point x="1087" y="951" type="line"/> <point x="1087" y="1221" type="line"/> <point x="63" y="843" type="line"/> <point x="63" y="575" type="line"/> </contour> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/less.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/less.glif", "repo_id": "cascadia-code", "token_count": 246 }
489
<?xml version='1.0' encoding='UTF-8'?> <glyph name="less_equal_middle.seq" format="2"> <advance width="1200"/> <outline> <component base="equal_middle.seq" xScale="-1" xOffset="1200"/> <component base="less.alt"/> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/less_equal_middle.seq.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/less_equal_middle.seq.glif", "repo_id": "cascadia-code", "token_count": 97 }
490
<?xml version='1.0' encoding='UTF-8'?> <glyph name="less_plus.liga" format="2"> <advance width="1200"/> <outline> <component base="less" xOffset="81"/> <component base="plus" xOffset="1152"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>less</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/less_plus.liga.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/less_plus.liga.glif", "repo_id": "cascadia-code", "token_count": 284 }
491
<?xml version='1.0' encoding='UTF-8'?> <glyph name="lowerThreeQuartersBlock.stypo" format="2"> <advance width="1200"/> <outline> <contour> <point x="0" y="-480" type="line"/> <point x="1200" y="-480" type="line"/> <point x="1200" y="1305" type="line"/> <point x="0" y="1305" type="line"/> </contour> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/lowerT_hreeQ_uartersB_lock.stypo.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/lowerT_hreeQ_uartersB_lock.stypo.glif", "repo_id": "cascadia-code", "token_count": 162 }
492
<?xml version='1.0' encoding='UTF-8'?> <glyph name="mediumWhiteSmallSquare" format="2"> <advance width="1200"/> <unicode hex="25FD"/> <note> uni25FD </note> <outline> <contour> <point x="225" y="335" type="line"/> <point x="975" y="335" type="line"/> <point x="975" y="1085" type="line"/> <point x="225" y="1085" type="line"/> </contour> <contour> <point x="375" y="485" type="line"/> <point x="375" y="935" type="line"/> <point x="825" y="935" type="line"/> <point x="825" y="485" type="line"/> </contour> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/mediumW_hiteS_mallS_quare.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/mediumW_hiteS_mallS_quare.glif", "repo_id": "cascadia-code", "token_count": 276 }
493
<?xml version='1.0' encoding='UTF-8'?> <glyph name="naira" format="2"> <advance width="1200"/> <unicode hex="20A6"/> <outline> <contour> <point x="0" y="599" type="line"/> <point x="1200" y="599" type="line"/> <point x="1200" y="821" type="line"/> <point x="0" y="821" type="line"/> </contour> <component base="N"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>N</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/naira.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/naira.glif", "repo_id": "cascadia-code", "token_count": 370 }
494
<?xml version='1.0' encoding='UTF-8'?> <glyph name="noon-ar.fina" format="2"> <advance width="1200"/> <outline> <component base="noonghunna-ar.fina"/> <component base="dotabove-ar" xOffset="-38" yOffset="7"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/noon-ar.fina.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/noon-ar.fina.glif", "repo_id": "cascadia-code", "token_count": 166 }
495
<?xml version='1.0' encoding='UTF-8'?> <glyph name="noonRing-ar" format="2"> <advance width="1200"/> <unicode hex="06BC"/> <outline> <component base="noon-ar"/> <component base="ringArabic" xOffset="-8" yOffset="-432"/> </outline> <lib> <dict> <key>public.markColor</key> <string>0.98,0.36,0.67,1</string> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/noonR_ing-ar.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/noonR_ing-ar.glif", "repo_id": "cascadia-code", "token_count": 168 }
496
<?xml version='1.0' encoding='UTF-8'?> <glyph name="numbersign_parenleft.liga" format="2"> <advance width="1200"/> <outline> <contour> <point x="842" y="0" type="line"/> <point x="1084" y="0" type="line"/> <point x="1204" y="1420" type="line"/> <point x="962" y="1420" type="line"/> </contour> <contour> <point x="406" y="0" type="line"/> <point x="648" y="0" type="line"/> <point x="768" y="1420" type="line"/> <point x="526" y="1420" type="line"/> </contour> <contour> <point x="263" y="310" type="line"/> <point x="1620" y="310" type="line"/> <point x="1620" y="558" type="line"/> <point x="263" y="558" type="line"/> </contour> <contour> <point x="263" y="862" type="line"/> <point x="1620" y="862" type="line"/> <point x="1620" y="1110" type="line"/> <point x="263" y="1110" type="line"/> </contour> <component base="parenleft" xOffset="1180"/> </outline> <lib> <dict> <key>com.schriftgestaltung.Glyphs.ComponentInfo</key> <array> <dict> <key>alignment</key> <integer>-1</integer> <key>index</key> <integer>0</integer> <key>name</key> <string>parenleft</string> </dict> </array> </dict> </lib> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/numbersign_parenleft.liga.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/numbersign_parenleft.liga.glif", "repo_id": "cascadia-code", "token_count": 674 }
497
<?xml version='1.0' encoding='UTF-8'?> <glyph name="oacute.loclPLK" format="2"> <advance width="1200"/> <outline> <component base="o"/> <component base="acutecomb.loclPLK" xOffset="30"/> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/oacute.loclP_L_K_.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/oacute.loclP_L_K_.glif", "repo_id": "cascadia-code", "token_count": 94 }
498
<?xml version='1.0' encoding='UTF-8'?> <glyph name="ograve" format="2"> <advance width="1200"/> <unicode hex="00F2"/> <outline> <component base="o"/> <component base="gravecomb" xOffset="-45"/> </outline> </glyph>
cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/ograve.glif/0
{ "file_path": "cascadia-code/sources/CascadiaCode-Bold.ufo/glyphs/ograve.glif", "repo_id": "cascadia-code", "token_count": 93 }
499