英文翻译day1

<span class="portrait"></span><p class="slideShine">xiaofang.bk</p> / 2024-11-13 / 原文

open files inherited by the shell at invocation, as modified by redirections supplied to the exec builtin

翻译顺序:the shell at invocation--> inherited -->open files         as(经过由于)-->supplied to the exec builtin-->redirections -->modified 

at invocation: 在某个程序、函数或脚本最初被启动或调用执行的那一刻,

as:用于表示方式或条件,翻译:“经过…改变”,来表明这些文件是如何被修改的

supplied to :提供给,传递给,这里意思这些重定向操作是被传递给 exec 内置命令的,supplied to” 在这个句子中是被动语态,“redirections” 是动作 “supply” 的承受者,即 “redirections” 被提供给 “the exec builtin”。被动语态的使用强调了 “redirections” 是如何被提供的,而不是谁提供了它们

当shell启动时,它继承了某些已经打开的文件,这些文件可能会因为传递给 exec 内置命令的重定向操作而发生变化

 

“the current working directory as set by cd, pushd, or popd, or inherited by the shell at invocation”

 这里的 “as set by” 和 “or inherited by” 描述了两种不同的方式来确定当前工作目录。“as” 引导的从句解释了设置当前工作目录的方式或条件。
“or” 表示这是另一种可能性,而 “as” 在这里被省略了,但可以理解为它也在引导一个省略了的从句,即 “as inherited by the shell at invocation”。
shell的当前工作目录是通过执行 cd、pushd 或 popd 命令来设置的,或者在shell启动时从其父进程那里继承来的
举例:
user@machine:~$ pwd
/home/user
启动一个新的 shell 实例: 现在,假设你在当前终端中启动了一个新的 shell 实例。这可以通过执行 bash 命令

user@machine:~$ bash

在新启动的 shell 中检查当前工作目录: 在新的 shell 实例中,再次使用 pwd 命令来查看当前的工作目录。

user@machine:~$ pwd
/home/user

新启动的 shell 的当前工作目录同样是 /home/user,因为它从其父进程那里继承了工作目录。

as从句:as 动词 方式翻译经过某方式而动作如:经过某方式而改变

 

 

Command substitution, commands grouped with parentheses, and asynchronous commands are invoked in a subshell environment that is a duplicate of the shell environment, except that traps caught by the shell are reset to the values that the shell inherited from its parent at invocation.

这里的 “that” 指的是前面提到的子 shell 环境,并且它引入了一个说明该环境特点的从句,即在这个环境中,shell 捕获的陷阱被重置为特定的值。它引导一个定语从句,用来修饰先行词 “a subshell environment”。

命令替换、用括号括起来的命令以及异步命令在一个子 shell 环境中被调用,该环境是 shell 环境的一个副本,除了 shell 捕获的陷阱会被重置为 shell 在启动时从其父进程继承的值。

命令替换、用括号括起来的命令以及异步命令:$()  (子shell )   sleep 3& 后台进程

 

Decorator factory to apply update_wrapper() to a wrapper function Returns a decorator that invokes update_wrapper() with the decorated function as the wrapper argument and the arguments to wraps() as the remaining arguments. Default arguments are as for update_wrapper(). This is a convenience function to simplify applying partial() to update_wrapper().

这个wrapper装饰器的翻译:

Decorator factory to apply update_wrapper() to a wrapper function  装饰器工厂,用于将 update_wrapper() 应用于包装函数

  • “to apply” 是谓语的一部分,这里作为不定式使用,表示目的或意图。
  • “update_wrapper()” 是宾语,表示要应用的动作或函数
  • “to a wrapper function” 是宾语补足语,进一步说明了 “apply” 动作的对象。这里to是介词,用于连接 “apply update_wrapper()” 这个动作和其作用的对象
  • 不定式符号 “to” 用于引导动词不定式,表示目的或意图,而介词 “to” 用于表示方向、位置、目的地等,连接名词或代词(宾语)与句子的其他部分。在这个特定的句子中,两个 “to” 的用法和作用是不同的

Returns a decorator that invokes updatewrapper() with the decorated function as the wrapper argument and the arguments to wraps() as the remaining arguments.

返回一个装饰器,该装饰器使用被装饰的函数作为包装器参数调用 updatewrapper(),并且将传递给 wraps() 的参数作为其余参数。with” 用作介词,表示“使用”或“伴随,做状语,that是定语从句,做主语。the decorated function” 中,“decorated” 是过去分词形式,用来描述 “function”“decorated” 在这里表示的是被动语态,即这个函数是被某个装饰器所装饰的。

,“as” 两次作为介词使用,它的作用是将一个名词或名词短语(即介词宾语)与另一个名词或名词短语(即介词的补充说明)连接起来,表示身份、角色或用途的等同。

  1. 第一个 “as”:

    • “with the decorated function as the wrapper argument”
    • 在这里,“as” 将 “the decorated function”(被装饰的函数)与 “the wrapper argument”(包装器参数)连接起来,表示被装饰的函数在 updatewrapper() 函数调用中扮演的角色是包装器参数。
      1. 第二个 “as”:

        • “and the arguments to wraps() as the remaining arguments”
        • 在这里,“as” 将 “the arguments to wraps()”(传递给 wraps() 函数的参数)与 “the remaining arguments”(其余的参数)连接起来,表示这些参数在 updatewrapper() 函数调用中的角色是其余的参数。“as” 在这里不是宾语,也不是状语,而是起到连接作用的连词。
    • 在这个短语 “the arguments to wraps() as the remaining arguments” 中,“to” 也是一个介词,它用来表明 “the arguments”(参数)与 “wraps()”(一个函数)之间的关系。具体来说,“to” 在这里的意思是“对于”或“属于”,表明这些参数是针对或属于 wraps() 函数的。在翻译技术文档时,选择准确的词汇来表达特定的技术概念是非常重要的。在这个例子中,“to” 表示的是参数的传递方向,而不是归属关系,所以不翻译成“属于”在“the arguments to wraps()”这个短语中,“to wraps()”整体作为一个介词短语,它的功能是修饰前面的名词“the arguments”,因此“to wraps()”在这个短语中是做定语。

      定语是用来修饰名词或代词的成分,它提供关于所修饰词的额外信息。在这个例子中,“to wraps()”告诉我们这些参数是传递给wraps()这个函数的。

      状语通常用来修饰动词、形容词、副词或整个句子,提供关于动作或状态发生的时间、地点、原因、条件、程度、方式等信息。在这个短语中,“to wraps()”并不是状语,因为它不直接修饰动词、形容词、副词或整个句子,而是修饰名词“the arguments”。

    • 这个句子 “Default arguments are as for update_wrapper().” 中,“as” 不是定语也不是状语,而是连词。连词是用来连接单词、短语、从句或句子的词,用于表明它们之间的关系。“as” 并不直接修饰名词或动词,而是用来表明两个比较对象(“default arguments” 和 “update_wrapper()”'s default arguments)之间的关系是相同的“as” 这个词可以翻译为“与…一样”或者“如同”。。“Default arguments are as for update_wrapper().” 中,“for” 引导的短语 “for update_wrapper()” 作为一个介词短语,它在句子中充当的是状语的角色,具体来说是目的状语。

      “for” 作为一个介词,其作用是表明目的、目标或者服务的对象。这里 “for” 的具体含义可以解释为:

      • 指明对象:在这个句子中,“for” 指明了默认参数是针对哪个函数的,即 “update_wrapper()” 函数。
      • 表明参照:它表明 “Default arguments” 是参照 “update_wrapper()” 的默认参数来设定的。
        1. 语法结构:在这个句子中,“as” 是一个比较级的连词,它用于比较两个事物的相似性。当 “as” 用于比较时,它通常需要一个补充说明来指明比较的对象,这个补充说明通常由 “for” 引导。因此,“for” 在这里起到了引导比较对象的作用,即 “update_wrapper()” 的默认参数。省略 “for” 会导致句子失去明确性。没有 “for”,读者可能不清楚 “as” 是在比较什么。完整的句子清晰地表达了默认参数与 “update_wrapper()” 的默认参数相同,而省略 “for” 后,

      • “默认参数与 update_wrapper() 的参数相同。”

         “simplify” 是一个动词,其含义是使某事物变得简单、更不复杂或更易于理解或执行这个动名词短语 “applying partial()” 是整个不定式短语 “to simplify applying partial() to update_wrapper()” 的一部分,该不定式短语作为目的状语,说明 “convenience function” 的目的或作用。在这个结构中,“applying partial()” 是被 “simplify” 动词所作用的宾语。“to simplify” 是一个不定式短语,它在句中充当目的状语,用来说明 “convenience function” 的目的或作用。applying partial() to update_wrapper()” 是宾语,它是不定式短语的一部分,说明 “simplify” 这个动作的具体内容。
      • 这是一个便利函数,用于简化将 partial() 应用到 update_wrapper() 的过程。
      • 的。整个句子的结构可以分解如下:

        • 主语: “This” (指代 “a convenience function”)
        • 谓语: “is”
        • 表语: “a convenience function”
        • 状语: “to simplify applying partial() to update_wrapper()” (说明了这个便利函数的目的)

        在这个状语中:

        • 动词: “simplify”
        • 宾语: “applying partial() to update_wrapper()”

 

 

strip()

Return a copy of the string with leading and trailing whitespace remove. If chars is given and not None, remove characters in chars instead.Return a copy of the string with leading and trailing whitespace remove. If chars is given and not None, remove characters in chars instead.

返回一个字符串副本,去除前导和尾随的空白字符。

如果给出了chars参数且不为None,则删除字符串中出现在chars中的字符。

 

 

“Generally speaking, instance variables are for data unique to each instance and class variables are for attributes and methods shared by all instances of the class.” 这句话的翻译顺序可以按照原句的结构来翻译,如下:

按照原句的结构来翻译,一般来说,实例变量用于存储每个实例独有的数据,而类变量则用于存储所有类实例共享的属性和方法。

“are for” 是一个英语短语,其意思是“用于……”,“为了……”,“适用于……”。这个短语用来表明某物或某事的目的、用途或适用对象。

 

 

Return an iterator yielding those items of iterable for which function(item)
is true. If function is None, return the items that are true 成分

返回一个迭代器,产生那些对于函数(item)为真的iterable中的项。如果函数为None,则返回那些本身为真的项、、,“yielding” 是这个定语从句中的现在分词短语,它作为从句的谓语动词,描述了迭代器的行为或动作。

  • “yielding those items of iterable for which function(item) is true” 是一个定语从句,其中 “yielding” 是现在分词,引导这个定语从句,并且作为从句的谓语,描述迭代器产生的项目。

  • “for which function(item) is true” 是另一个定语从句,它嵌入在第一个定语从句中,并且进一步修饰 “those items of iterable”。在这里,“for which” 是关系代词 “which” 的引导词,用来引导定语从句,并且 “which” 代表 “those items of iterable”。

所以,整个短语 “yielding those items of iterable for which function(item) is true” 是一个复合定语从句,用来详细说明 “iterator” 的性质,即它产生哪些项目。这个复合定语从句可以被分解为两个层次:

  1. 外层定语从句:“yielding those items of iterable”,说明迭代器产生的是 “iterable” 中的某些项目。
  2. 内层定语从句:“for which function(item) is true”,进一步限定哪些项目会被产生,即那些使得 “function(item)” 返回真值的项。
  3. “for which” 在定语从句中不仅仅是起到连接作用,它实际上承担了两个重要的语法功能:

    1. 引导作用: “for which” 中的 “which” 是关系代词,用来引导定语从句,并且指代前面的名词 “those items of iterable”。这个关系代词连接了主句和从句,使得从句能够修饰主句中的名词。

    2. 介词宾语: “for” 是介词,它在定语从句中与关系代词 “which” 结合使用,形成了介词短语 “for which”。这个短语在从句中作为介词的宾语,表示 “function(item) is true” 这个条件是针对 “those items of iterable” 的。换句话说,“for which” 表明了对 “those items” 的选择标准或条件。

      • which” 是关系代词,它指代前面的名词 “those items of iterable”,并且引入一个定语从句来进一步描述这些项目。
      • “for” 是介词,它与 “which” 结合使用,表明了一个目的或条件。在这个上下文中,“for” 表示 “根据” 或 “为了” 的意思,即根据某个条件来选择项目。