Code text processing method, device, equipment and storage medium

文档序号:104915 发布日期:2021-10-15 浏览:64次 中文

阅读说明:本技术 代码文本的处理方法、装置、设备及存储介质 (Code text processing method, device, equipment and storage medium ) 是由 张涛 刘锦超 吴海浩 于 2021-07-09 设计创作,主要内容包括:本申请涉及开发辅助技术领域,揭露了代码文本的处理方法、装置、设备及存储介质,包括通过软件开发工具读取用户输入的Python代码;基于D I R函数,对所述Python代码中的变量内容进行提取,并存储至预设的变量中转插件中,所述变量中转插件预部署在所述软件开发工具中;所述变量中转插件基于所述变量内容中的变量,从所述Python代码中提取所述变量对应的处理逻辑,所述变量中转插件根据所述处理逻辑对所述变量进行逻辑运算,得到解析内容,所述变量中转插件利用所述解析内容对所述Python代码中对应的所述处理逻辑进行替换。本申请还涉及区块链技术,所述处理逻辑数据存储于区块链中。本申请能使代码中的逻辑运算过程都在变量中转插件中进行,使整篇代码的耦合度降低。(The application relates to the technical field of development assistance, and discloses a method, a device, equipment and a storage medium for processing a code text, wherein the method comprises the steps of reading a Python code input by a user through a software development tool; extracting variable contents in the Python code based on a DIR function, and storing the variable contents in a preset variable transfer plug-in, wherein the variable transfer plug-in is pre-deployed in the software development tool; the variable transfer plug-in extracts processing logic corresponding to the variable from the Python code based on the variable in the variable content, performs logic operation on the variable according to the processing logic to obtain analysis content, and replaces the processing logic corresponding to the Python code with the analysis content. The application also relates to blockchain techniques, the processing logic data being stored in blockchains. The method and the device can enable the logic operation process in the code to be carried out in the variable transfer plug-in unit, and reduce the coupling degree of the whole code.)

1. A method for processing code text, the method comprising:

reading Python codes input by a user through a software development tool;

extracting variable contents in the Python codes based on a DIR function, and storing the variable contents in a preset variable transfer plug-in, wherein the variable transfer plug-in is pre-deployed in the software development tool;

the variable transfer plug-in extracts processing logic corresponding to the variable from the Python code based on the variable in the variable content, and the variable transfer plug-in performs logic operation on the variable according to the processing logic to obtain analysis content;

and the variable transit plug-in replaces the corresponding processing logic in the Python code by using the analysis content.

2. The method for processing code text according to claim 1, after the pre-deployment of the variable transit plug-in the software development tool, further comprising:

registering and monitoring a communication event between the variable transit plug-in and the software development tool;

and setting a response mode corresponding to the message type of the communication event.

3. The method for processing code text according to claim 1, after the pre-deployment of the variable transit plug-in the software development tool, further comprising:

detecting whether the variable transfer plug-in is successfully deployed on the software development tool;

if the variable transfer plug-in is not deployed, acquiring the variable transfer plug-in from a server side;

if the variable transfer plug-in is detected to be deployed, detecting whether the variable transfer plug-in is the latest version, if not, acquiring the variable transfer plug-in of the latest version from the server side, and deploying the variable transfer plug-in of the latest version to the software development tool.

4. The method according to any one of claims 1 to 3, wherein the obtaining, by the variable relay plug-in, the processing logic corresponding to the variable from the Python code based on the variable in the variable content, and performing a logic operation on the variable according to the processing logic by the variable relay plug-in to obtain the analysis content includes:

acquiring data source information and type information corresponding to the variables;

acquiring the processing logic corresponding to the variable from the Python code according to the data source information and the type information;

and correspondingly calculating the variables according to the processing logic and the data source information to obtain the corresponding analysis content.

5. The method for processing code text according to claim 4, before the obtaining the data source information and the type information corresponding to the variable, further comprising:

acquiring the position of the variable in the variable content in the Python code;

identifying the content of the position of the variable in the Python code based on a pre-trained identification model;

and obtaining a plurality of source channels corresponding to the variables according to the identification result.

6. The method according to claim 4, wherein the obtaining the processing logic corresponding to the variable from the Python code according to the data source information and the type information comprises:

calling an algorithm formula corresponding to the variable in the Python code through regular matching based on the data source information and the type information corresponding to the variable;

and taking the algorithm formula as the processing logic corresponding to the variable.

7. The method according to claim 4, after the obtaining the processing logic corresponding to the variable from the Python code according to the data source information and the type information, further comprising:

after a plurality of variables are obtained through identification and corresponding processing logics are obtained, judging whether the processing logics corresponding to the variables are related or not;

and if the variables are related, performing logic check on the processing logic to ensure the normal application of the variables.

8. An apparatus for processing code text, the apparatus comprising:

the reading module is used for reading a Python code input by a user through a software development tool;

the extraction module is used for extracting variable contents in the Python codes based on a DIR function and storing the variable contents in a preset variable transfer plug-in, wherein the variable transfer plug-in is pre-deployed in the software development tool;

the calculation module is used for extracting processing logic corresponding to the variable from the Python code by the variable transfer plug-in based on the variable in the variable content, and the variable transfer plug-in performs logic operation on the variable according to the processing logic to obtain analysis content;

and the replacement module is used for replacing the corresponding processing logic in the Python code by the variable transit plug-in by using the analysis content.

9. A computer device, characterized in that the computer device comprises:

at least one processor; and the number of the first and second groups,

a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,

the memory stores computer readable instructions which, when executed by the processor, implement a method of processing code text as claimed in any one of claims 1 to 7.

10. A computer-readable storage medium having computer-readable instructions stored thereon, which when executed by a processor implement a method of processing code text as claimed in any one of claims 1 to 7.

Technical Field

The present application relates to the field of development assistance technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing a code text.

Background

In the process of developing a program, the application of variables is of great importance, and the variables are generally that each piece of data or other contents to be used in the process of developing the program is assigned with a short and easy-to-remember name, and then the result is calculated through a specific operation formula. Variables are very important tools throughout the development of a program. In the prior art, codes and operation formulas corresponding to variables of the codes are often mixed together to realize some functions. When a function is completed, a large number of variables are utilized, and the variables correspond to a large number of processing logics, in this case, the codes are subjected to a high coupling condition, so that the codes are closely related and have poor independence, and the expansibility of the whole application program is very poor. Therefore, how to reduce the high coupling situation of the existing code becomes an urgent problem to be solved.

Disclosure of Invention

The application provides a method, a device, equipment and a storage medium for processing a code text, which aim to solve the problem of high code coupling degree in the prior art.

In order to solve the above problem, the present application provides a method for processing a code text, including:

reading Python codes input by a user through a software development tool;

extracting variable contents in the Python codes based on a DIR function, and storing the variable contents in a preset variable transfer plug-in, wherein the variable transfer plug-in is pre-deployed in the software development tool;

the variable transfer plug-in extracts processing logic corresponding to the variable from the Python code based on the variable in the variable content, and the variable transfer plug-in performs logic operation on the variable according to the processing logic to obtain analysis content;

and the variable transit plug-in replaces the corresponding processing logic in the Python code by using the analysis content.

Further, after the variable transit plug-in is pre-deployed in the software development tool, the method further includes:

registering and monitoring a communication event between the variable transit plug-in and the software development tool;

and setting a response mode corresponding to the message type of the communication event.

Further, after the variable transit plug-in is pre-deployed in the software development tool, the method further includes:

detecting whether the variable transfer plug-in is successfully deployed on the software development tool;

if the variable transfer plug-in is not deployed, acquiring the variable transfer plug-in from a server side;

if the variable transfer plug-in is detected to be deployed, detecting whether the variable transfer plug-in is the latest version, if not, acquiring the variable transfer plug-in of the latest version from the server side, and deploying the variable transfer plug-in of the latest version to the software development tool.

Further, the acquiring, by the variable transfer plug-in, a processing logic corresponding to the variable from the Python code based on the variable in the variable content, and performing, by the variable transfer plug-in, a logic operation on the variable according to the processing logic to obtain an analysis content includes:

acquiring data source information and type information corresponding to the variables;

acquiring the processing logic corresponding to the variable from the Python code according to the data source information and the type information;

and correspondingly calculating the variables according to the processing logic and the data source information to obtain the corresponding analysis content.

Further, before the obtaining of the data source information and the type information corresponding to the variable, the method further includes:

acquiring the position of the variable in the variable content in the Python code;

identifying the content of the position of the variable in the Python code based on a pre-trained identification model;

and obtaining a plurality of source channels corresponding to the variables according to the identification result.

Further, the obtaining the processing logic corresponding to the variable from the Python code according to the data source information and the type information includes:

calling an algorithm formula corresponding to the variable in the Python code through regular matching based on the data source information and the type information corresponding to the variable;

and taking the algorithm formula as the processing logic corresponding to the variable.

Further, after the obtaining the processing logic corresponding to the variable from the Python code according to the data source information and the type information, the method further includes:

after a plurality of variables are obtained through identification and corresponding processing logics are obtained, judging whether the processing logics corresponding to the variables are related or not;

and if the variables are related, performing logic check on the processing logic to ensure the normal application of the variables.

In order to solve the above problem, the present application also provides a device for processing a code text, the device including:

the reading module is used for reading a Python code input by a user through a software development tool;

the extraction module is used for extracting variable contents in the Python codes based on a DIR function and storing the variable contents in a preset variable transfer plug-in, wherein the variable transfer plug-in is pre-deployed in the software development tool;

the calculation module is used for extracting processing logic corresponding to the variable from the Python code by the variable transfer plug-in based on the variable in the variable content, and the variable transfer plug-in performs logic operation on the variable according to the processing logic to obtain analysis content;

and the replacement module is used for replacing the corresponding processing logic in the Python code by the variable transit plug-in by using the analysis content.

In order to solve the above problem, the present application also provides a computer device, including:

at least one processor; and the number of the first and second groups,

a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,

the memory stores instructions executable by the at least one processor to enable the at least one processor to perform a method of processing code text as described above.

In order to solve the above problem, the present application also provides a non-volatile computer readable storage medium, on which computer readable instructions are stored, and the computer readable instructions, when executed by a processor, implement the processing method of the code text as described above.

Compared with the prior art, the code text processing method, the code text processing device, the code text processing equipment and the storage medium provided by the embodiment of the application have at least the following beneficial effects:

the variable transfer plugin is deployed in a software development tool in advance, codes input by a user are received through the software development tool, variables in the codes are extracted through a DIR function and stored in a preset variable transfer plugin, the variable transfer plugin extracts processing logic corresponding to the variables from Python codes based on the variables in the variable content, the variable transfer plugin performs logic operation according to the processing logic corresponding to the variables to obtain corresponding analysis content, the variable transfer plugin replaces the processing logic corresponding to the Python codes according to the analysis content, the logic operation process in the codes is performed in the variable transfer plugin, and the coupling degree of the whole codes is reduced.

Drawings

In order to more clearly illustrate the solution of the present application, a brief description will be given below of the drawings required for describing the embodiments of the present application, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without inventive effort.

Fig. 1 is a schematic flowchart of a method for processing a code text according to an embodiment of the present application;

fig. 2 is a block diagram of a device for processing code text according to an embodiment of the present application;

fig. 3 is a schematic structural diagram of a computer device according to an embodiment of the present application.

Detailed Description

Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.

Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. One skilled in the art will explicitly or implicitly appreciate that the embodiments described herein can be combined with other embodiments.

The application provides a code text processing method. Fig. 1 is a schematic flow chart of a method for processing a code text according to an embodiment of the present application.

In this embodiment, the method for processing the code text includes:

s1, reading Python codes input by a user through a software development tool;

specifically, the code input by the user can be received in real time through the software development tool, the whole section of the code after the user writes can also be received, and the file corresponding to the code can also be directly read.

S2, extracting variable contents in the Python codes based on a DIR function, and storing the variable contents in a preset variable transfer plug-in, wherein the variable transfer plug-in is pre-deployed in the software development tool;

in the present application, all the variables defined in the specific file, i.e. the code that can be received in the present application, can be obtained by using DIR function, and the specific file refers to module name or file name through DIR (moduleName). For example, in a plurality of files or modules receiving user input, the files contain codes, and the files can be directly passed through dir (maomao), that is, variables with file names of maomao are extracted. When dir () is directly used, the variables, functions, classes and the like of the current page can be obtained. And according to the extracted variable, locating the position of the variable in the Python code.

Further, after the variable transit plug-in is pre-deployed in the software development tool, the method further includes:

registering and monitoring a communication event between the variable transit plug-in and the software development tool;

and setting a response mode corresponding to the message type of the communication event.

Specifically, the communication event between the variable transit plug-in and the software development tool is monitored, the data content acquired by the variable transit plug-in is monitored at any time, and a response mode corresponding to the communication event can be set, for example, when the message type of the communication event is a, a response mode corresponding to a is set to perform synchronous response, and for example, when the message type of the communication event is B, a response mode corresponding to B is set to perform asynchronous response, and the like.

The communication event between the variable transfer plug-in and the software development tool is monitored, and the corresponding response mode is set according to the message type of the communication event, so that the variable transfer plug-in and the software development tool can be matched conveniently.

Further, after the variable transit plug-in is pre-deployed in the software development tool, the method further includes:

detecting whether the variable transfer plug-in is successfully deployed on the software development tool;

if the variable transfer plug-in is not deployed, acquiring the variable transfer plug-in from a server side;

if the variable transfer plug-in is detected to be deployed, detecting whether the variable transfer plug-in is the latest version, if not, acquiring the variable transfer plug-in of the latest version from the server side, and deploying the variable transfer plug-in of the latest version to the software development tool.

Specifically, in order to ensure that the started software development tool can provide plug-in services for developers, it is necessary to ensure that the software development tool has integrated a variable transit plug-in before starting the software development tool.

Detecting whether a variable transfer plugin is successfully deployed in a software development tool or not by detecting plugin identification and the like, if no variable transfer plugin is detected, acquiring the variable transfer plugin again from a server side, deploying the variable transfer plugin after acquisition, and if a variable transfer plugin is detected, further detecting whether the variable transfer plugin is the latest version or not;

for example, the latest version number of the variable transit plug-in is obtained, whether the latest version number is consistent with the version number of the currently deployed variable transit plug-in is judged, and if the latest version number is not consistent with the version number of the currently deployed variable transit plug-in, the latest variable transit plug-in is obtained from the server side for deployment; if the variable is consistent with the variable, the variable transit plug-in is the latest. To provide optimal development services to the relevant developers.

By detecting whether the software development tool is deployed with the variable transfer plug-in and whether the variable transfer plug-in is the latest version, the variable transfer tool can be used by a user and is the optimal development service.

S3, extracting processing logic corresponding to the variable from the Python code by the variable transfer plug-in based on the variable in the variable content, and performing logic operation on the variable by the variable transfer plug-in according to the processing logic to obtain analysis content;

specifically, after receiving the variable content, the variable transfer plug-in extracts a processing logic corresponding to the variable from a Python code based on the variable in the variable content, and performs a logic operation on the variable according to the processing logic to obtain a corresponding analysis content. The logical operation is to calculate and process the variables according to the processing logic, such as an algorithm formula, corresponding to the variables.

Further, the acquiring, by the variable transfer plug-in, a processing logic corresponding to the variable from the Python code based on the variable in the variable content, and performing, by the variable transfer plug-in, a logic operation on the variable according to the processing logic to obtain an analysis content includes:

acquiring data source information and type information corresponding to the variables;

acquiring the processing logic corresponding to the variable from the Python code according to the data source information and the type information;

and correspondingly calculating the variables according to the processing logic and the data source information to obtain the corresponding analysis content.

Specifically, data source and type information corresponding to a variable input by a user are received, the variable is visually displayed in a variable transfer plug-in, the user can click the variable to perform attribute configuration, namely, the data source and type information are configured, processing logic corresponding to the variable is obtained from the code according to the data source information and the type information, and finally, the variable is correspondingly calculated according to the processing logic and the data source information to obtain corresponding analysis content.

The type information of the variables can be divided into: numbers (int), strings (str), lists (list), tuples (tuple), dictionaries (dit), functions, classes, objects, etc.;

the data source information can be divided into: components, services, caches, URLs, constants, variables themselves, etc. In the application, when the data source is stored in the cache and the corresponding type information is a function, a processing logic corresponding to the function is called, and the variable is correspondingly calculated according to the processing logic and the data source information to obtain the analysis content. For example, when the type of the variable is a function and the data source is a constant, that is, the variable calculates the constant by using the function to obtain final content, in this case, the position of the variable in the variable content is used to obtain a corresponding function as processing logic.

And performing corresponding calculation on the variables according to the processing logic and the data source information, for example, performing corresponding calculation on the variables, wherein the variables a, b and b are directly assigned, b is 1, the corresponding processing logic is a, 3+ b, and a is 3+ b, which is the variable a, so as to obtain the analysis content a, 4.

After the processing logic corresponding to the variable is obtained through the variable transfer plug-in, the variable transfer plug-in performs corresponding calculation to realize calculation in the variable transfer plug-in, and the processing logic corresponding to the variable is replaced to decouple the codes in the code text.

Further, before the obtaining of the data source information and the type information corresponding to the variable, the method further includes:

acquiring the position of the variable in the variable content in the Python code;

identifying the content of the position of the variable in the Python code based on a pre-trained identification model;

and obtaining a plurality of source channels corresponding to the variables according to the identification result.

Specifically, based on the variable content, the position of the variable in the code is obtained; and identifying the context content of the position of the code through a pre-trained identification model to finally obtain a plurality of identification results, namely corresponding source channels, and generating a to-be-selected list after obtaining the plurality of source channels so that a user can finally confirm the specific source channels of the variables.

The recognition model is trained through a large number of scattered variables, partial code sentences corresponding to the variables and source channels corresponding to the partial code sentences, and a plurality of possible source channels are obtained according to the recognition model by obtaining the sentences corresponding to the variables for selection of a user.

When the variables and the corresponding partial code content are obtained, the variables are identified through the identification model, and a plurality of approximate source channels are obtained for the user to select so as to determine the final source channel.

A plurality of channels possibly corresponding to the variables are obtained through the identification model, and the processing efficiency is improved.

Still further, the obtaining, according to the data source information and the type information, the processing logic corresponding to the variable from the Python code includes:

calling an algorithm formula corresponding to the variable in the Python code through regular matching based on the data source information and the type information corresponding to the variable;

and taking the algorithm formula as the processing logic corresponding to the variable.

Specifically, on the basis of the data source information and the type information corresponding to the variables, an algorithm formula corresponding to the variables in the code is obtained by adopting a regular matching mode, and the obtained algorithm formula is used as processing logic corresponding to the variables.

When the corresponding algorithm formula is matched in a regular matching mode, the variable transfer plug-in can also receive processing logic input by a user, namely, the algorithm formula input by the user.

The algorithm formula corresponding to the variable is extracted in a regular matching mode, so that the processing efficiency is further improved

Further, after the obtaining the processing logic corresponding to the variable from the Python code according to the data source information and the type information, the method further includes:

after a plurality of variables are obtained through identification and corresponding processing logics are obtained, judging whether the processing logics corresponding to the variables are related or not;

and if the variables are related, performing logic check on the processing logic to ensure the normal application of the variables.

In the application, since there is no only one variable in the whole code, when a plurality of variables are identified, it is determined whether there is a relationship between processing logics corresponding to the variables, that is, whether there is an interaction between the processing logics, and if so, the logic check is performed on the associated processing logics. In particular, e.g.

int a,b,c;

a=12;

b=3+a;

c=a+b;

printf ("% d", a + b + c); in the above simple code segment, there is a correlation between the processing logics corresponding to a, b, and c, so it is necessary to perform logic check on the processing logics corresponding to the variables, the logic check is also mainly to determine whether there is a conflict between the processing logics, if there is no conflict, the logic check passes, and the variables can be normally used. And if the logic check is not passed, the variables which are not passed by the logic check are sent to the user through the software development tool to remind the user.

Through carrying out logic check on the processing logic of a plurality of associated variables, the smooth operation of the codes is ensured, meanwhile, developers are assisted to carry out check, and the check efficiency is improved.

And S4, replacing the corresponding processing logic in the Python code by the variable transit plug-in by using the analysis content.

Specifically, the analyzed content replaces the processing logic corresponding to the variable corresponding to the Python code, and as a possible implementation manner, the original processing logic is replaced by direct assignment.

It is emphasized that all data of the processing logic may also be stored in a node of a block chain in order to further ensure privacy and security of the data.

The block chain referred by the application is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product service layer, an application service layer, and the like.

The variable transfer plugin is deployed in a software development tool in advance, codes input by a user are received through the software development tool, variables in the codes are extracted through a DIR function and stored in a preset variable transfer plugin, the variable transfer plugin extracts processing logic corresponding to the variables from Python codes based on the variables in the variable content, the variable transfer plugin performs logic operation according to the processing logic corresponding to the variables to obtain corresponding analysis content, the variable transfer plugin replaces the processing logic corresponding to the Python codes according to the analysis content, the logic operation process in the codes is performed in the variable transfer plugin, and the coupling degree of the whole codes is reduced.

Fig. 2 is a functional block diagram of a device for processing a code document of the present application.

The apparatus 100 for processing code text described herein may be installed in an electronic device. Depending on the implemented functions, the device 100 for processing code text may comprise a reading module 101, an extraction module 102, a calculation module 103 and a replacement module 104. A module, which may also be referred to as a unit in this application, refers to a series of computer program segments that can be executed by a processor of an electronic device and that can perform a fixed function, and that are stored in a memory of the electronic device.

In the present embodiment, the functions regarding the respective modules/units are as follows:

the reading module 101 is used for reading a Python code input by a user through a software development tool;

specifically, the reading module 101 may receive a code input by a user in real time through a software development tool, may also receive a whole section of code written by the user, and may also directly read a file corresponding to the code.

An extraction module 102, configured to extract variable content in the Python code based on a DIR function, and store the variable content in a preset variable transfer plugin, where the variable transfer plugin is pre-deployed in the software development tool;

specifically, the extracting module 102 may obtain all the defined variables in the specific file by using the DIR function, where the specific file refers to the received code in this application, and the DIR (moduleName), the moduleName refer to the module name or the file name.

Further, the processing device 100 of the code text further comprises a registration module and a response setting module;

the registration module is used for registering and monitoring communication events between the variable transit plug-in and the software development tool;

and the response setting module is used for setting a response mode corresponding to the message type of the communication event.

The communication event between the variable transfer plug-in and the software development tool is monitored through the matching of the registration module and the response setting module, and the corresponding response mode is set according to the message type of the communication event, so that the matching between the variable transfer plug-in and the software development tool is facilitated.

Further, the device 100 for processing the code text further includes a detection module, an acquisition module and a version detection module;

the detection module is used for detecting whether the variable transfer plug-in is successfully deployed on the software development tool;

the plug-in obtaining module is used for obtaining the variable transfer plug-in from a server side if the variable transfer plug-in is not deployed;

the version detection module is used for detecting whether the variable transfer plug-in is the latest version if the deployment of the variable transfer plug-in is detected;

the plug-in obtaining module is further configured to obtain the latest version of the variable transit plug-in from the server side and deploy the latest version of the variable transit plug-in to the software development tool when the version detecting module detects that the version of the variable transit plug-in is not the latest version.

Specifically, the detection module detects whether a variable transfer plug-in is successfully deployed in the software development tool by detecting plug-in identification and other modes, and if no variable transfer plug-in is detected, the plug-in acquisition module acquires the variable transfer plug-in again from the server side and deploys the variable transfer plug-in after acquisition; if the detection module detects that the variable transfer plug-in exists, the version detection module is further used for detecting whether the variable transfer plug-in is the latest version.

Through the cooperation of the detection module, the acquisition module and the version detection module, whether a variable transfer plug-in is deployed in a software development tool or not and whether the variable transfer plug-in is the latest version or not is detected, so that a user can use the variable transfer tool and the optimal development service is ensured.

A calculating module 103, configured to extract, by the variable transit plug-in, a processing logic corresponding to the variable from the Python code based on the variable in the variable content, where the variable transit plug-in performs a logic operation on the variable according to the processing logic to obtain an analysis content.

Specifically, after the variable transfer plug-in receives the variable content, the replacement module 103 extracts a processing logic corresponding to the variable from a Python code based on the variable in the variable content, and the variable transfer plug-in performs a logic operation on the variable according to the processing logic to obtain a corresponding analysis content.

Further, the calculation module 103 includes an acquisition sub-module, a processing logic acquisition sub-module, and a calculation sub-module;

the obtaining submodule is used for obtaining data source information and type information corresponding to the variable;

the processing logic obtaining sub-module is configured to obtain the processing logic corresponding to the variable from the Python code according to the data source information and the type information;

and the calculation submodule is used for correspondingly calculating the variables according to the processing logic and the data source information to obtain the corresponding analysis content.

Specifically, the obtaining submodule receives data source and type information corresponding to a variable input by a user, the variable is visually displayed in a variable transfer plug-in, and the user can click the variable to perform attribute configuration, namely, the data source and type information is configured.

Through the matching of the acquisition submodule, the processing logic acquisition submodule and the calculation submodule, the variable transfer plug-in performs corresponding calculation after acquiring the processing logic corresponding to the variable, so that the calculation in the variable transfer plug-in is realized, and the processing logic corresponding to the variable is replaced, so that the codes in the code text are decoupled.

Still further, the calculation module 103 further includes a position obtaining sub-module and an identification sub-module;

the obtaining submodule is configured to obtain a position of the variable in the variable content in the Python code;

the identification submodule is used for identifying the content of the position of the variable in the Python code based on a pre-trained identification model; and obtaining a plurality of source channels corresponding to the variables according to the identification result.

Specifically, the obtaining submodule obtains the position of the variable in the code based on the variable content; the identification submodule identifies the context content of the position of the code through a pre-trained identification model, finally obtains a plurality of identification results, namely corresponding source channels, and generates a list to be selected after obtaining the source channels so that a user can finally confirm the specific source channel of the variable.

Through the matching of the position acquisition submodule and the recognition submodule, a plurality of channels possibly corresponding to variables are obtained by using the recognition model, and the processing efficiency is improved.

Still further, the processing logic obtaining sub-module comprises a regular extraction unit;

the regular extraction unit is configured to, based on the data source information and the type information corresponding to the variable, call an algorithm formula corresponding to the variable in the Python code by regular matching;

and taking the algorithm formula as the processing logic corresponding to the variable.

Specifically, the regular extraction unit obtains the algorithm formula corresponding to the variable in the code by adopting a regular matching mode on the basis of the data source information and the type information corresponding to the variable, and the obtained algorithm formula is used as the processing logic corresponding to the variable.

The regular extraction unit extracts the algorithm formula corresponding to the variable in a regular matching mode, and the processing efficiency is further improved.

Further, the computing module 103 further includes an association judgment sub-module and a logic check sub-module;

the association judgment submodule is used for judging whether the processing logics corresponding to the variables are associated or not after the variables are identified and obtained and the corresponding processing logics are obtained;

and the logic check submodule is used for performing logic check on the processing logic if the processing logic is related to the variable so as to ensure the normal application of the variable.

The logic check is carried out on the processing logic of the plurality of associated variables through the cooperation of the association judgment submodule and the logic check submodule so as to ensure the smooth operation of the codes, and meanwhile, developers are assisted in carrying out the check, and the check efficiency is improved.

A replacing module 104, configured to replace, by the variable transit plug-in, the processing logic corresponding to the Python code with the analysis content.

Specifically, the analyzed content replaces the processing logic corresponding to the variable corresponding to the Python code, and as a possible implementation manner, the original processing logic is replaced by direct assignment.

By adopting the device, the processing device 100 of the code text enables the logic operation process in the code to be carried out in the variable transfer plug-in unit through the matching use of the reading module 101, the extracting module 102, the calculating module 103 and the replacing module 104, so that the coupling degree of the whole code is reduced.

In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 3, fig. 3 is a block diagram of a basic structure of a computer device according to the present embodiment.

The computer device 4 comprises a memory 41, a processor 42, a network interface 43 communicatively connected to each other via a system bus. It is noted that only computer device 4 having components 41-43 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.

The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.

The memory 41 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 may be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 may also be an external storage device of the computer device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Of course, the memory 41 may also include both internal and external storage devices of the computer device 4. In this embodiment, the memory 41 is generally used for storing an operating system installed in the computer device 4 and various types of application software, such as computer readable instructions of a code text processing method. Further, the memory 41 may also be used to temporarily store various types of data that have been output or are to be output.

The processor 42 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 42 is typically used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is configured to execute computer readable instructions stored in the memory 41 or computer readable instructions for processing data, such as executing the code text processing method.

The network interface 43 may comprise a wireless network interface or a wired network interface, and the network interface 43 is generally used for establishing communication connection between the computer device 4 and other electronic devices.

In this embodiment, when a processor executes a computer readable instruction stored in a memory, the steps of implementing the method for processing a code text according to the above embodiment are implemented, where a variable transfer plugin is deployed in a software development tool in advance, a code input by a user is received by the software development tool, a DIR function is used to extract a variable in the code and store the variable in a preset variable transfer plugin, the variable transfer plugin extracts a processing logic corresponding to the variable from a Python code based on the variable in the variable content, the variable transfer plugin performs a logic operation according to the processing logic corresponding to the variable to obtain a corresponding analysis content, and the variable transfer plugin replaces the corresponding processing logic in the Python code according to the analysis content to enable the logic operation process in the code to be performed in the variable transfer plugin, the coupling degree of the whole code is reduced.

The present application further provides another embodiment, which is to provide a computer-readable storage medium, where computer-readable instructions are stored, and the computer-readable instructions are executable by at least one processor, so as to cause the at least one processor to perform the steps of the method for processing the code text as described above, by deploying a variable relay plug-in a software development tool in advance, receiving a code input by a user through the software development tool, extracting a variable in the code by using a DIR function, and storing the variable in the code into a preset variable relay plug-in, extracting processing logic corresponding to the variable from the Python code based on the variable in the variable content, and performing logic operation by the variable relay plug-in according to the processing logic corresponding to the variable to obtain corresponding analysis content, and the variable transfer plug-in replaces the corresponding processing logic in the Python code according to the analysis content, so that the logic operation process in the code is performed in the variable transfer plug-in, and the coupling degree of the whole code is reduced.

Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.

It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种编译日志的分析方法及装置

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!