This repository was archived by the owner on Jan 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 55
Add AzureClient project to iqsharp #119
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
c804d4f
Fix case consistency in test namespace
rmshaffer d9afad7
Enforce exact match for %magic command names
rmshaffer c757aa6
Make Extensions.Dedent() publicly accessible
rmshaffer 8b931bb
Move Extensions.Dedent() to core project
rmshaffer 7e5f3f6
Add AzureClient project to iqsharp solution
rmshaffer a0023f2
Add AzureClient project dependencies and update package versions to b…
rmshaffer e424eed
Add AzureClient class and register as magic symbol provider
rmshaffer dfc62ab
Add #nullable enable to new files
rmshaffer 7d7bcc3
Add empty AzureClientTests
rmshaffer 8d2b0eb
Update a few package references
rmshaffer 435018a
Merge branch 'rmshaffer/azure-client' of https://github.com/microsoft…
rmshaffer 0c5681a
Update IAzureClient API docs
65ccb8c
Update new array syntax
9c9cc67
Merge branch 'rmshaffer/azure-client' of https://github.com/microsoft…
rmshaffer ae883cb
Use Microsoft.Quantum.Development.Kit package
rmshaffer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #nullable enable | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using Microsoft.Jupyter.Core; | ||
| using System.Threading.Tasks; | ||
|
|
||
| using Microsoft.Identity.Client; | ||
| using Microsoft.Identity.Client.Extensions.Msal; | ||
| using System.Linq; | ||
| using System.IO; | ||
| using Microsoft.Azure.Quantum; | ||
| using Microsoft.Azure.Quantum.Client; | ||
| using Microsoft.Azure.Quantum.Client.Models; | ||
| using Microsoft.Quantum.Runtime; | ||
|
|
||
| namespace Microsoft.Quantum.IQSharp.AzureClient | ||
| { | ||
| /// <inheritdoc/> | ||
| public class AzureClient : IAzureClient | ||
| { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>netstandard2.1</TargetFramework> | ||
| <PlatformTarget>x64</PlatformTarget> | ||
| <RootNamespace>Microsoft.Quantum.IQSharp.AzureClient</RootNamespace> | ||
| <AssemblyName>Microsoft.Quantum.IQSharp.AzureClient</AssemblyName> | ||
| <GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="..\..\build\DelaySign.cs" Link="Properties\DelaySign.cs" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Microsoft.Azure.Quantum.Client" Version="0.11.2004.1014-beta" /> | ||
| <PackageReference Include="Microsoft.Identity.Client" Version="4.10.0" /> | ||
| <PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="2.8.0-preview" /> | ||
| <PackageReference Include="Microsoft.Jupyter.Core" Version="1.3.9214-CI-20200415-173910" /> | ||
| <PackageReference Include="System.Reactive" Version="4.3.2" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\Core\Core.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #nullable enable | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using Microsoft.Extensions.DependencyInjection; | ||
|
|
||
| namespace Microsoft.Quantum.IQSharp.AzureClient | ||
| { | ||
| /// <summary> | ||
| /// Extension methods to be used with various IQ# and AzureClient objects. | ||
| /// </summary> | ||
| public static class Extensions | ||
| { | ||
| /// <summary> | ||
| /// Adds services required for the AzureClient to a given service collection. | ||
| /// </summary> | ||
| public static void AddAzureClient(this IServiceCollection services) | ||
| { | ||
| services.AddSingleton<IAzureClient, AzureClient>(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #nullable enable | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Text; | ||
| using Microsoft.Jupyter.Core; | ||
| using System.Threading.Tasks; | ||
|
|
||
| namespace Microsoft.Quantum.IQSharp.AzureClient | ||
| { | ||
| /// <summary> | ||
| /// This service is capable of connecting to Azure Quantum workspaces | ||
| /// and submitting jobs. | ||
| /// </summary> | ||
| public interface IAzureClient | ||
| { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.Text.RegularExpressions; | ||
|
|
||
| namespace Microsoft.Quantum.IQSharp | ||
| { | ||
| public static partial class Extensions | ||
| { | ||
| /// <summary> | ||
| /// Removes common indents from each line in a string, | ||
| /// similarly to Python's <c>textwrap.dedent()</c> function. | ||
| /// </summary> | ||
| public static string Dedent(this string text) | ||
| { | ||
| // First, start by finding the length of common indents, | ||
| // disregarding lines that are only whitespace. | ||
| var leadingWhitespaceRegex = new Regex(@"^[ \t]*"); | ||
| var minWhitespace = int.MaxValue; | ||
| foreach (var line in text.Split("\n")) | ||
| { | ||
| if (!string.IsNullOrWhiteSpace(line)) | ||
| { | ||
| var match = leadingWhitespaceRegex.Match(line); | ||
| minWhitespace = match.Success | ||
| ? System.Math.Min(minWhitespace, match.Value.Length) | ||
| : minWhitespace = 0; | ||
| } | ||
| } | ||
|
|
||
| // We can use that to build a new regex that strips | ||
| // out common indenting. | ||
| var leftTrimRegex = new Regex(@$"^[ \t]{{{minWhitespace}}}", RegexOptions.Multiline); | ||
| return leftTrimRegex.Replace(text, ""); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| #nullable enable | ||
|
|
||
| using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
| using Microsoft.Quantum.IQSharp.AzureClient; | ||
| using System.Linq; | ||
| using System.Collections.Generic; | ||
|
|
||
| namespace Tests.IQSharp | ||
| { | ||
| [TestClass] | ||
| public class AzureClientTests | ||
| { | ||
| [TestMethod] | ||
| public void TestNothing() | ||
| { | ||
| Assert.IsTrue(true); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.