コード例 #1
0
        public static IImportSearchResult FindImports(this PathResolverSnapshot pathResolver, string modulePath, FromImportStatement fromImportStatement)
        {
            var rootNames = fromImportStatement.Root.Names.Select(n => n.Name);
            var dotCount  = fromImportStatement.Root is RelativeModuleName relativeName ? relativeName.DotCount : 0;

            return(pathResolver.FindImports(modulePath, rootNames, dotCount, fromImportStatement.ForceAbsolute));
        }
コード例 #2
0
        public static IImportSearchResult FindImports(this PathResolverSnapshot pathResolver, string modulePath, FromImportStatement fromImportStatement)
        {
            var rootNames = fromImportStatement.Root.Names.Select(n => n.Name);

            return(fromImportStatement.Root is RelativeModuleName relativeName
                ? pathResolver.GetImportsFromRelativePath(modulePath, relativeName.DotCount, rootNames)
                : pathResolver.GetImportsFromAbsoluteName(modulePath, rootNames, fromImportStatement.ForceAbsolute));
        }
コード例 #3
0
 public static IImportSearchResult FindImports(this PathResolverSnapshot pathResolver, string modulePath, IEnumerable <string> rootNames, int dotCount, bool forceAbsolute)
 => dotCount > 0
         ? pathResolver.GetImportsFromRelativePath(modulePath, dotCount, rootNames)
         : pathResolver.GetImportsFromAbsoluteName(modulePath, rootNames, forceAbsolute);
コード例 #4
0
 public PathResolver(PythonLanguageVersion pythonLanguageVersion)
 {
     _currentSnapshot = new PathResolverSnapshot(pythonLanguageVersion);
 }
コード例 #5
0
 public static IImportSearchResult FindImports(this PathResolverSnapshot pathResolver, string modulePath, ModuleName importName, bool forceAbsolute)
 => pathResolver.GetImportsFromAbsoluteName(modulePath, importName.Names.Select(n => n.Name), forceAbsolute);
コード例 #6
0
 public ChildrenSource(PathResolverSnapshot snapshot, ImmutableArray <Edge> edges)
 {
     _snapshot = snapshot;
     _edges    = edges;
 }
コード例 #7
0
 public ChildrenSource(PathResolverSnapshot snapshot, Edge edge)
     : this(snapshot, ImmutableArray <Edge> .Create(edge))
 {
 }