Advertisement
junbjn98

Untitled

Jan 13th, 2020
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.39 KB | None | 0 0
  1. import pandas as pd
  2. import numpy as np
  3. import os
  4.  
  5.  
  6. class Checksheet:
  7.     def __init__(self, filename, sheetname, content_colname, checksheet_colname):
  8.         self.filename = filename
  9.         self.sheetname = sheetname
  10.         self.content_colname = content_colname
  11.         self.checksheet_colname = checksheet_colname
  12.  
  13.  
  14. def main():
  15.     # Init type checksheet
  16.     x304 = Checksheet("codin", "cdcheckshet", "content", "checksheet")
  17.     css = [x304]
  18.  
  19.     # Get file paths after update svn
  20.     paths = get_file_paths()
  21.     for path in paths:
  22.         print(path)
  23.         check_checksheet(css, path)
  24.  
  25.  
  26. def get_file_paths(ankenNumbers):
  27.     folderNames = [f for f in os.listdir() if [a for a in map(lambda x: x + "_", ankenNumbers) if not f.find(a)]]
  28.     with open("filePaths.txt") as f:
  29.         files = [line.rstrip('\n') for line in f]
  30.     return files
  31.  
  32.  
  33. def check_checksheet(css, path):
  34.     # For each type checksheets
  35.     for cs in css:
  36.         if cs.filename in path:
  37.             get_data_excel(path, cs)
  38.         break
  39.  
  40.  
  41. def get_data_excel(path, cs_obj):
  42.     df = pd.read_excel(path, header=None, sheet_name=cs_obj.sheetname)
  43.     # print(df)
  44.     xy = df[df.isin([cs_obj.content_colname])].stack().index.labels
  45.     row = xy[0][0]
  46.     col = xy[1][0]
  47.     print(col)
  48.     print(row)
  49.  
  50.  
  51. print("AAA")
  52. # main()
  53.  
  54. # D:\Projects\zxyApp\650_offshore_smpapli\75_案件別成果物_DeliverablesByAnken\10_UIEh\
  55. rpath = 'D:/Projects/zxyApp/650_offshore_smpapli/75_案件別成果物_DeliverablesByAnken/10_UIEh'
  56. # TODO - Get all folder (just folder name) in rpath
  57. os.chdir('D:/Tool/Check_Checksheet/test_folder')
  58. ankenNumbers = ["123", "321"]
  59. folderNames = [f for f in os.listdir() if [a for a in map(lambda x: x + "_", ankenNumbers) if not f.find(a)]]
  60.  
  61. rpath = list(map(lambda x: os.path.join(rpath, x), folderNames))
  62. csFolders = ["D240_ソースコードチェックシートScreenCodingChecksheet", "X301_基本設計書_DevelopmentSpecDesign", "X401_単体機能テスト_FUT_Spec(Online)"]
  63. csCode = ["D240", "X301", "X401"]
  64. rpath = np.hstack([list(map(lambda x: os.path.join(f, x), csFolders)) for f in rpath])
  65.  
  66. cs_paths = []
  67. for p in rpath:
  68.     # TODO - update SVN coding checksheet folder
  69.     print(p)
  70.     # Get file in path & sub dir
  71.     # os.chdir(p)
  72.     os.chdir('D:/Tool/Check_Checksheet/test_folder/123_asdasdasdasd')
  73.     for d in os.listdir():
  74.         fullPath = os.path.join(os.getcwd(), d)
  75.         if os.path.isfile(d):
  76.             cs_paths.append(fullPath)
  77.         else:
  78.             for sd in os.listdir(fullPath):
  79.                 cs_paths.append(os.path.join(fullPath, sd))
  80.     break
  81.  
  82. for cs in cs_paths:
  83.     print(cs)
  84.  
  85. "permissions": ["http://*/", "https://*/", "notifications", "contextMenus"],
  86.  
  87. chrome.contextMenus.create({
  88.   id: "fillIssueNotes",
  89.   title: "Fill issue notes",
  90.   contexts:["page"]
  91. });
  92.  
  93. chrome.contextMenus.onClicked.addListener(function(info, tab) {
  94.     if (tab) {
  95.         if (info.menuItemId === "fillIssueNotes"){
  96.           /* Create the code to be injected */
  97.           var code = [
  98.               'let fillContent =  ',
  99.               '`Dear XXX-san,',
  100.               '',
  101.               '',
  102.               '',
  103.               'Regards',
  104.               'NamDV16`',
  105.               'document.getElementById("issue_notes").value = fillContent'
  106.           ].join("\n");
  107.  
  108.           chrome.tabs.executeScript(tab.id, { code: code });
  109.         }
  110.     }
  111. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement