This is a temporary function that helps move from v1 API to v2 without
        breaking already running script and keep backwards compatibility.
        Translates option name from API v1 to renamed one of v2 API.
172157
def v2_translator(self, option):
        
        new_option = option
        new_value = getattr(self, option)

        renaming_pairs = {
            "dontfrag": "dont_fragment",
            "maxhops": "max_hops",
            "firsthop": "first_hop",
            "use_NSID": "set_nsid_bit",
            "cd": "set_cd_bit",
            "do": "set_do_bit",
            "qbuf": "include_qbuf",
            "recursion_desired": "set_rd_bit",
            "noabuf": "include_abuf"
        }
        if option in renaming_pairs.keys():
            warninglog = (
                "DeprecationWarning: {0} option has been deprecated and "
                "renamed to {1}."
            ).format(option, renaming_pairs[option])
            print(warninglog)
            new_option = renaming_pairs[option]

        # noabuf was changed to include_abuf so we need a double-negative
        if option == "noabuf":
            new_value = not new_value

        return new_option, new_value
472134
def _translate_key(key):
    

    d = _get_deprecated_option(key)
    if d:
        return d.rkey or key
    else:
        return key
952044
def rename(path, new_name, options={})
      raise ArgumentError, "Names cannot have slashes in them" if new_name.include?('/')
      path = path.sub(/\/$/, '')
      destination = path.split('/')
      destination[destination.size - 1] = new_name
      destination = destination.join('/')
      move path, destination, options
    end
197301
def _convert_rename(self, fc):
        
        old = fc.old_path
        new = fc.new_path
        keep_old = self._path_to_be_kept(old)
        keep_new = self._path_to_be_kept(new)
        if keep_old and keep_new:
            fc.old_path = self._adjust_for_new_root(old)
            fc.new_path = self._adjust_for_new_root(new)
            return fc
        elif keep_old:
            # The file has been renamed to a non-interesting location.
            # Delete it!
            old = self._adjust_for_new_root(old)
            return commands.FileDeleteCommand(old)
        elif keep_new:
            # The file has been renamed into an interesting location
            # We really ought to add it but we don't currently buffer
            # the contents of all previous files and probably never want
            # to. Maybe fast-import-info needs to be extended to
            # remember all renames and a config file can be passed
            # into here ala fast-import?
            self.warning("cannot turn rename of %s into an add of %s yet" %
                (old, new))
        return None
643002
function translate(key, options, hasOwnOptions) {

			var lng = options.lng || 'auto';

			if (!translations[lng]) {
				translations[lng] = {};
			}

			if (!t) {
				translations[lng][key] = key;
			} else if (!translations[lng][key] || hasOwnOptions) {
				translations[lng][key] = t(key, options);
			}

		}
1230878
def workflow_rename(object_id, input_params={}, always_retry=True, **kwargs):
    
    return DXHTTPRequest('/%s/rename' % object_id, input_params, always_retry=always_retry, **kwargs)
836512
def deprecated_alias(name, replacement)
      # Create a wrapped version
      define_method(name) do |*args, &block|
        warn "##{name} deprecated (please use ##{replacement})"
        send replacement, *args, &block
      end
    end
1309180
function Translator(api, options) {
  var origLength = JSON.stringify(api, null, 2).length;
  var debugInfo = {flattened: {}, pruned: {}};
  var shapeName = 'S0';
  var shapeNameMap = {};
  var visitedShapes = {};

  function logResults() {
    console.log('** Generated', api.metadata.endpointPrefix + '-' +
      api.metadata.apiVersion +'.min.json' +
      (process.env.DEBUG ? ':' : ''));

    if (process.env.DEBUG) {
      var pruned = Object.keys(debugInfo.pruned);
      var flattened = Object.keys(debugInfo.flattened);
      var newLength = JSON.stringify(api, null, 2).length;
      console.log('- Pruned Shapes:', pruned.length);
      console.log('- Flattened Shapes:', flattened.length);
      console.log('- Remaining Shapes:', Object.keys(api.shapes).length);
      console.log('- Original Size:', origLength / 1024.0, 'kb');
      console.log('- Minified Size:', newLength / 1024.0, 'kb');
      console.log('- Size Saving:', (origLength - newLength) / 1024.0, 'kb');
      console.log('');
    }
  }

  function deleteTraits(obj) {
    if (!options.documentation) {
      delete obj.documentation;
      delete obj.documentationUrl;
      delete obj.errors;
      delete obj.min;
      delete obj.max;
      delete obj.pattern;
      delete obj['enum'];
      delete obj.box;
    }
  }

  function trackShapeDeclaration(ref) {
    if (ref.shape && !shapeNameMap[ref.shape]) {
      // found a shape declaration we have not yet visited.
      // assign a new generated name in the shapeNameMap & visit it
      var oldShapeName = ref.shape;
      ref.shape = shapeName = nextString(shapeName);

      visitedShapes[shapeName] = api.shapes[oldShapeName];
      shapeNameMap[oldShapeName] = {name: shapeName, refs: [ref]};

      traverseShapeRef(api.shapes[oldShapeName]);
    } else if (ref.shape && shapeNameMap[ref.shape]) {
      // we visited this shape before. keep track of this ref and rename
      // the referenced declaration to the generated name
      var map = shapeNameMap[ref.shape];
      map.refs.push(ref);
      ref.shape = map.name;        
    }
  }

  function pruneShapes() {
    // prune shapes visited only once or only have type specifiers
    each(shapeNameMap, function(name, map) {
      if (Object.keys(visitedShapes[map.name]).join() === 'type' &&
          ['structure','map','list'].indexOf(visitedShapes[map.name].type) < 0) {
        // flatten out the shape (only a scalar type property is on the shape)
        for (var i = 0; i < map.refs.length; i++) {
          var ref = map.refs[i];
          debugInfo.flattened[name] = true;
          delete ref.shape;
          ref.type = visitedShapes[map.name].type;

          // string type is default, don't need to specify this
          if (ref.type === 'string') delete ref.type;
        }

        // we flattened all refs, we can prune the shape too
        delete visitedShapes[map.name];
        debugInfo.pruned[name] = true;
      } else if (map.refs.length === 1) { // only visited once
        // merge shape data onto ref
        var shape = visitedShapes[map.name];

        for (var i = 0; i < map.refs.length; i++) {
          delete map.refs[i].shape;
          for (var prop in shape) {
            if (shape.hasOwnProperty(prop)) {
              //Translator prefers timestampFormat trait in members rather than in shape
              if (map.refs[i].hasOwnProperty(prop) && ['timestampFormat'].indexOf(prop) >= 0) {
                continue;
              }
              map.refs[i][prop] = shape[prop];
            }
            
          }
        }

        // delete the visited shape
        delete visitedShapes[map.name];
        debugInfo.pruned[name] = true;
      }
    });
  }

  function traverseShapeRef(ref) {
    if (!ref) return;

    deleteTraits(ref);

    traverseShapeRef(ref.key); // for maps
    traverseShapeRef(ref.value); // for maps
    traverseShapeRef(ref.member); // for lists

    // for structures
    each(ref.members || {}, function(key, value) { traverseShapeRef(value); });

    // resolve shape declarations
    trackShapeDeclaration(ref);
  }

  function traverseOperation(op) {
    deleteTraits(op);

    delete op.name;
    if (op.http) {
      if (op.http.method === 'POST') delete op.http.method;
      if (op.http.requestUri === '/') delete op.http.requestUri;
      if (Object.keys(op.http).length === 0) delete op.http;
    }

    traverseShapeRef(op.input);
    traverseShapeRef(op.output);    
  }

  function traverseApi() {
    deleteTraits(api);
    each(api.operations, function(name, op) { traverseOperation(op); });
    api.shapes = visitedShapes;
  }

  traverseApi();
  pruneShapes();
  logResults();
  return api;
}
787225
def action_rename(self):
        

        # get old and new name from args
        old = self.args['<old>']
        new = self.args['<new>']

        # select the old shortcut
        self.db_query('''
            SELECT id FROM shortcuts WHERE name=?
            ''', (old,))
        r = self.db_fetch_one()

        # error if old doesn't exist
        if r == None:
            print_err('Shortcut "%s" does not exist!' % old)
            return

        # error if new exists
        if self.shortcut_exists(new):
            print_err('Shortcut "%s" already exists!' % new)
            return

        id = r[0]

        # rename in DB
        self.db_exec('''
            UPDATE shortcuts SET name=? WHERE id=?
            ''', (new, id))

        # show OK message
        print_msg('Shortcut "%s" renamed to "%s".' % (old, new))
83068
function replaceModuleExports(path, name) {
  const { scope } = path;
  const oldName = path.node.name;

  // Skip if not global scope
  if (scope.hasBinding(oldName, true)) return;

  // TODO: correctly replace foo.exports with object.property?
  if (!isPropertyOrKey(path)) {
    path.node.name = oldName == 'module' ? name : `${name}.exports`;
  }
}
778781
function transformPropertyName(attributeName) {
  if (propertiesToTransform[attributeName]) {
    return propertiesToTransform[attributeName];
  }
  if (nonTransformedProperties[attributeName] !== true) {
    return false;
  }
  return attributeName;
}
1263396
def _convert(cls, name, module, filter, source=None):
    
    # convert all constants from source (or module) that pass filter() to
    # a new Enum called name, and export the enum and its members back to
    # module;
    # also, replace the __reduce_ex__ method so unpickling works in
    # previous Python versions
    module_globals = vars(_sys.modules[module])
    if source:
        source = vars(source)
    else:
        source = module_globals
    members = dict((name, value) for name, value in source.items() if filter(name))
    cls = cls(name, members, module=module)
    cls.__reduce_ex__ = _reduce_ex_by_name
    module_globals.update(cls.__members__)
    module_globals[name] = cls
    return cls
487933
function (version1, version2) {
    try {
      if (lodash.isNumber(version1) && lodash.isNumber(version2)) {
        if (version1 > version2) { return 1 }
        if (version1 === version2) { return 0 }
        if (version1 < version2) { return -1 }
      } else if (lodash.isNumber(version1) || lodash.isNumber(version2)) {
        version1 += '';
        version2 += '';
      }

      var version1Array = version1.split('.');
      var version2Array = version2.split('.');

      var ver1IntList = [];
      var ver2IntList = [];

      version1Array.forEach(function (value, index, array) {
        ver1IntList.push(parseInt(value));
      });

      version2Array.forEach(function (value, index, array) {
        ver2IntList.push(parseInt(value));
      });

      // format
      if (ver1IntList.length < ver2IntList.length) {
        var i = 0;
        for (; i < (ver2IntList.length - ver1IntList.length); ++i) {
          ver1IntList.push(0);
        }
      }

      if (ver1IntList.length > ver2IntList.length) {
        var i$1 = 0;
        for (; i$1 < (ver1IntList.length - ver2IntList.length); ++i$1) {
          ver2IntList.push(0);
        }
      }

      var i$2 = 0;
      for (; i$2 < ver1IntList.length; ++i$2) {
        var cVer1 = ver1IntList[i$2];
        var cVer2 = ver2IntList[i$2];

        if (cVer1 > cVer2) { return 1 }
        if (cVer1 < cVer2) { return -1 }
      }

      return 0
    } catch (e) {
      return -1
    }
  }
1356301
def change_object_name(self, old_name, new_name):
        
        h = self._get_object_handle(old_name)
        if old_name in self._object_handles:
            self._object_handles.pop(old_name)
        lua_code = "simSetObjectName({}, '{}')".format(h, new_name)
        self._inject_lua_code(lua_code)
1168279
def RenameFunction(function, name):
    
    return FunctionType(function.__code__,
                        function.__globals__,
                        name,
                        function.__defaults__)
691265
@SuppressWarnings("JavadocReference")
    protected Map<String, Object> getNewOptionsByName(ResourceOptions options, Map<String, Object> optionsByName) {
        Map<String,Object> clonedOptionsByName = new HashMap<>(optionsByName);
        clonedOptionsByName.put(NEXT_PROTOCOL.name(), options.getOption(NEXT_PROTOCOL));
        clonedOptionsByName.put(QUALIFIER.name(), options.getOption(QUALIFIER));
        clonedOptionsByName.put(TRANSPORT_URI.name(), options.getOption(TRANSPORT_URI));
        clonedOptionsByName.put(BIND_ALTERNATE.name(), options.getOption(BIND_ALTERNATE));
        clonedOptionsByName.put(RESOLVER.name(), options.getOption(RESOLVER));

        return clonedOptionsByName;
    }
704897
def _translate(self, options):
        
        translation = dict()
        for key, val in iteritems_(options):
            self._validate(key, val, feed_arg_types(self._source))
            try:
                if isinstance(val, STRTYPE):
                    translation[key] = val
                elif not isinstance(val, NONETYPE):
                    arg_converter = TYPE_CONVERTERS.get(type(val), json.dumps)
                    translation[key] = arg_converter(val)
            except Exception as ex:
                raise CloudantArgumentError(115, key, ex)
        return translation