transform teban-fugou-from to jkf
357658
def transform_teban_fugou_from(teban, fugou, from)
      ret = { "color" => teban2color(teban.join), "piece" => fugou["piece"] }
      if fugou["to"]
        ret["to"] = fugou["to"]
      else
        ret["same"] = true
      end
      ret["promote"] = true if fugou["promote"]
      ret["from"] = from if from
      ret
    end
491509
def _cast_to_pod(val):
  """"""
  bools = {"True": True, "False": False}
  if val in bools:
    return bools[val]
  try:
    return int(val)
  except ValueError:
    try:
      return float(val)
    except ValueError:
      return tf.compat.as_text(val)
282760
def ijk_jlk_to_il(A, B):
    
    res = np.zeros((A.shape[0], B.shape[1]))
    [np.add(np.dot(A[:,:,k], B[:,:,k]), res, out=res) for k in range(B.shape[-1])]
    return res
336556
def translate(self, mo):
        """"""
        attrs = {}
        groupdict = mo.groupdict()
        for name, value in compat_iteritems(groupdict):
            if value is None:
                value = None
            elif self._int_re.match(value):
                value = int(value)
            elif self._float_re.match(value):
                value = float(value)
            attrs[name] = (value)
        return Struct(attrs)
1168908
def transpose(attrs, inputs, proto_obj):
    """"""
    new_attrs = translation_utils._fix_attribute_names(attrs,
                                                       {'perm' : 'axes'})
    return 'transpose', new_attrs, inputs
797129
def to_cf(serializer = :json)
      resources = static_resources.merge(enumerable_resources)

      case serializer
      when :json then JSON.pretty_generate(resources)
      when :yaml then YAML.dump(resources)
      end
    end
1062073
function getComputedTranslate(obj) {
        var result = {
            translateX: 0,
            translateY: 0,
            translateZ: 0,
            scaleX: 1,
            scaleY: 1,
            offsetX: 0,
            offsetY: 0
        };
        var offsetX = 0, offsetY = 0;
        if (!global.getComputedStyle || !obj) return result;
        var style = global.getComputedStyle(obj), transform, origin;
        transform = style.webkitTransform || style.mozTransform;
        origin = style.webkitTransformOrigin || style.mozTransformOrigin;
        var par = origin.match(/(.*)px\s+(.*)px/);
        if (par.length > 1) {
            offsetX = par[1] - 0;
            offsetY = par[2] - 0;
        }
        if (transform === 'none') return result;
        var mat3d = transform.match(/^matrix3d\((.+)\)$/);
        var mat2d = transform.match(/^matrix\((.+)\)$/);
        var str;
        if (mat3d) {
            str = mat3d[1].split(', ');
            result = {
                translateX: str[12] - 0,
                translateY: str[13] - 0,
                translateZ: str[14] - 0,
                offsetX: offsetX - 0,
                offsetY: offsetY - 0,
                scaleX: str[0] - 0,
                scaleY: str[5] - 0,
                scaleZ: str[10] - 0
            };
        } else if (mat2d) {
            str = mat2d[1].split(', ');
            result = {
                translateX: str[4] - 0,
                translateY: str[5] - 0,
                offsetX: offsetX - 0,
                offsetY: offsetY - 0,
                scaleX: str[0] - 0,
                scaleY: str[3] - 0
            };
        }
        return result;
    }
1369078
def as_cnpjcpf(numero):
    
    if is_cnpj(numero):
        return as_cnpj(numero)
    elif is_cpf(numero):
        return as_cpf(numero)
    return numero
1177173
def transformFilter(actor, transformation):
    
    tf = vtk.vtkTransformPolyDataFilter()
    tf.SetTransform(transformation)
    prop = None
    if isinstance(actor, vtk.vtkPolyData):
        tf.SetInputData(actor)
    else:
        tf.SetInputData(actor.polydata())
        prop = vtk.vtkProperty()
        prop.DeepCopy(actor.GetProperty())
    tf.Update()

    tfa = Actor(tf.GetOutput())
    if prop:
        tfa.SetProperty(prop)
    return tfa
146506
def transformFromNative(cls, obj):
        """"""
        # print('transforming from native')
        if obj.isNative:
            obj.isNative = False
            tzid = TimezoneComponent.registerTzinfo(obj.value.tzinfo)
            obj.value = dateTimeToString(obj.value, cls.forceUTC)
            if not cls.forceUTC and tzid is not None:
                obj.tzid_param = tzid
            if obj.params.get('X-VOBJ-ORIGINAL-TZID'):
                if not hasattr(obj, 'tzid_param'):
                    obj.tzid_param = obj.x_vobj_original_tzid_param
                del obj.params['X-VOBJ-ORIGINAL-TZID']

        return obj
267918
def _ConvertToCanonicalSqlDict(self, schema, raw_dict, prefix=""):
    """"""
    flattened_dict = {}
    for k, v in iteritems(raw_dict):
      if isinstance(v, dict):
        flattened_dict.update(
            self._ConvertToCanonicalSqlDict(
                schema, v, prefix="%s%s." % (prefix, k)))
      else:
        field_name = prefix + k
        flattened_dict[field_name] = schema[field_name].convert_fn(v)
    return flattened_dict
251519
def transform_values(&b)
            self.class.new self.map { |k, v|
                [ k.to_sym, b.call(v) ]
            }.to_h
        end
1036867
function _fnConvert(filters) {
                var _iF, _lenF, _keysF,
                    _filter,
                    _state;

                // convert filter object to array filter
                if (angular.isObject(filters) && !angular.isArray(filters)) {
                    _keysF  = Object.keys(filters);
                    _lenF   = _keysF.length;
                    _filter = [];

                    if (_lenF > 0) {
                        for (_iF = 0; _iF < _lenF; _iF++) {

                            if (typeof filters[_keysF[_iF]] === 'string' && filters[_keysF[_iF]].length === 0) {
                                continue;
                            } else if (angular.isArray(filters[_keysF[_iF]])) {
                                _state = filters[_keysF[_iF]];
                            } else if (angular.isObject(filters[_keysF[_iF]])) {
                                _state = _fnConvert(filters[_keysF[_iF]]);
                            } else {
                                _state = {
                                    field:    _keysF[_iF],
                                    callback: filters[_keysF[_iF]]
                                };
                            }
                            _filter.push(_state);
                        }
                    }

                    return _filter;
                }
                else {
                    return filters;
                }
            }
635589
@Override
	protected void doTransform(ITransformable.Translate transformable, float comp)
	{
		float fromX = reversed ? this.toX : this.fromX;
		float toX = reversed ? this.fromX : this.toX;
		float fromY = reversed ? this.toY : this.fromY;
		float toY = reversed ? this.fromY : this.toY;
		float fromZ = reversed ? this.toZ : this.fromZ;
		float toZ = reversed ? this.fromZ : this.toZ;

		transformable.translate(fromX + (toX - fromX) * comp, fromY + (toY - fromY) * comp, fromZ + (toZ - fromZ) * comp);
	}
232590
def from_json_format(conf):
    ''''''
    if 'fmode' in conf:
        conf['fmode'] = int(conf['fmode'], 8)
    if 'dmode' in conf:
        conf['dmode'] = int(conf['dmode'], 8)
1103230
def transformFromNative(obj):
        
        obj.isNative = False
        obj.value = serializeFields(obj.value, NAME_ORDER)
        return obj
973820
def transform_frame(frame, transform, columns=None, direction='forward',
                    return_all=True, args=(), **kwargs):
    
    tfun, tname = parse_transform(transform, direction)
    columns = to_list(columns)
    if columns is None:
        columns = frame.columns
    if return_all:
        transformed = frame.copy()
        for c in columns:
            transformed[c] = tfun(frame[c], *args, **kwargs)
    else:
        transformed = frame.filter(columns).apply(tfun, *args, **kwargs)
    return transformed