这是我的数据框df:
describe('MyComponent', () => {
let component: MyComponent;
let fixture: ComponentFixture<MyComponent>;
const dialogRefStub = {
afterClosed() {
return of(true);
}
};
const dialogStub = { open: () => dialogRefStub };
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [],
declarations: [ MyComponent ],
providers: [
{ provide: MatDialog, useValue: dialogStub }
]
})
.compileComponents();
}));
//...
});
我需要提取每行第一个String类之后开始的nameOfClasses鞭子。
这是我的代码:
Pull Up Attribute protected steps : int from class blokusgame.mi.android.hazi.blokus.GameLogic.PlayerAlgorithm to class blokusgame.mi.android.hazi.blokus.GameLogic.Player
Extract Method private getBestMove(moves ArrayList<Move>) : Move extracted from public nextStep() : void in class blokusgame.mi.android.hazi.blokus.GameLogic.PlayerAlgorithm
Extract Method private getNLongMoves(n int) : ArrayList<Move> extracted from private getAllPossibleMoves() : ArrayList<Move> in class blokusgame.mi.android.hazi.blokus.GameLogic.PlayerAlgorithm"
Extract Method public getPoints() : ArrayList<Point> extracted from public equals(b Object) : boolean in class blokusgame.mi.android.hazi.blokus.GameLogic.Block
Extract Method public getMin() : Point extracted from public getDimensions() : Point in class blokusgame.mi.android.hazi.blokus.GameLogic.Block
Extract Method public getMax() : Point extracted from public getDimensions() : Point in class blokusgame.mi.android.hazi.blokus.GameLogic.Block
Extract Method public normalize() : Block extracted from public equals(b Object) : boolean in class blokusgame.mi.android.hazi.blokus.GameLogic.Block"
Extract Method package setPlayer(player Player) : void extracted from protected onCreate(savedInstanceState Bundle) : void in class blokusgame.mi.android.hazi.blokus.MainActivity
Extract Method public isPlaceable(block Block, pt Point) : boolean extracted from public isPlaceable(block Block, corners ArrayList<Point>, pt Point) : boolean in class blokusgame.mi.android.hazi.blokus.GameLogic.Map
Extract And Move Method public placeBlock(blockIndex int, coord Point) : boolean extracted from public placeBlock(blockIndex int, coord Point) : boolean in class blokusgame.mi.android.hazi.blokus.GameLogic.PlayerHuman & moved to class blokusgame.mi.android.hazi.blokus.GameLogic.Player
Rename Class blokusgame.mi.android.hazi.blokus.GameLogic.PlayerColors renamed to blokusgame.mi.android.hazi.blokus.GameLogic.PlayerConstants
Move Class blokusgame.mi.android.hazi.blokus.View.BoardView moved to View.BoardView
Move Class GameLogic.Block moved to blokusgame.mi.android.hazi.blokus.GameLogic.Block
Move Class GameLogic.BlockFactory moved to blokusgame.mi.android.hazi.blokus.GameLogic.BlockFactory
Move Class GameLogic.Map moved to blokusgame.mi.android.hazi.blokus.GameLogic.Map
Move Class GameLogic.Player moved to blokusgame.mi.android.hazi.blokus.GameLogic.Player
Move Class GameLogic.PlayerHuman moved to blokusgame.mi.android.hazi.blokus.GameLogic.PlayerHuman
Move Class GameLogic.Point moved to blokusgame.mi.android.hazi.blokus.GameLogic.Point
Move Class View.BoardView moved to blokusgame.mi.android.hazi.blokus.View.BoardView"
Rename Method package Point(idx int) renamed to public getPoint(idx int) : Point in class GameLogic.Block
当我尝试打印结果时出现问题,我发现它没有返回所有类,有包含NaN的行。
这是结果:
import pandas as pd
df = pd.read_csv('result_refactorings.csv', sep=';')
refactoring_details = df['RefactoringDetail']
print(refactoring_details)
a=refactoring_details.to_frame(name=refactoring_details)
a.RefactoringDetail.str.extract(r'class ([^ ]*)')
请帮忙!
答案 0 :(得分:0)
您的正则表达式r'class ([^ ]*)'
应该为r'[C|c]lass\s*([^ ]*)'
。