{% liked objects by user as varname %}
351956
def liked(parser, token):
    
    tag, objects, _, user, _, varname = token.split_contents()
    return LikedObjectsNode(objects, user, varname)
734232
private void fillHasLiked(JsonObject summary) {
    if (summary != null && summary.get("has_liked") != null) {
      hasLiked = summary.get("has_liked").asBoolean();
    }

    if (hasLiked == null && openGraphUserLikes != null) {
      hasLiked = openGraphUserLikes;
    }
  }
1293659
def who_likes(obj):
    
    return Like.objects.filter(
        receiver_content_type=ContentType.objects.get_for_model(obj),
        receiver_object_id=obj.pk
    )
1272610
function markVariableAsUsed(context, name) {
  let scope = context.getScope();
  let variables;
  let i;
  let len;
  let found = false;

  // Special Node.js scope means we need to start one level deeper
  if (scope.type === 'global') {
    while (scope.childScopes.length) {
      scope = scope.childScopes[0];
    }
  }

  do {
    variables = scope.variables;
    for (i = 0, len = variables.length; i < len; i++) { // eslint-disable-line no-plusplus
      if (variables[i].name === name) {
        variables[i].eslintUsed = true;
        found = true;
      }
    }
    scope = scope.upper;
  } while (scope);

  return found;
}
73317
public static void removeFavorite(@Nonnull User user, @Nonnull Item item) throws FavoriteException {
        try {
            if (isFavorite(user, item)) {
                FavoriteUserProperty fup = user.getProperty(FavoriteUserProperty.class);
                fup.removeFavorite(item.getFullName());
                FavoriteListener.fireOnRemoveFavourite(item, user);
            } else {
                throw new FavoriteException("Favourite is already unset for User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">");
            }
        } catch (IOException e) {
            throw new FavoriteException("Could not remove Favorite. User: <" + user.getFullName() + "> Item: <" + item.getFullName() + ">", e);
        }
    }
764644
def nil_instance_vars(object, vars)
    vars = Array(vars)
    vars.select { |var| object.instance_variable_get(var).nil? }
  end
1140224
function findByUsername(username, cb) {
  db.getClient(function(err, client, done) {
    client.query(SELECT_USERNAME, [username], function(err, r) {
      var result = r && r.rows[0];
      if(!err && !result) { err = new exceptions.NotFound(); }
      if(err) {
        cb(err);
        done(err);
      } else {
        cb(null, result);
        done();
      }
    });
  });
}
1373775
function (args) {
  if (false === (this instanceof User)) throw new Error('new operator required');
  args = args || {};
  if (!args.attributes) {
    args.attributes = [];
  }
  args.attributes.push(new Attribute({name: 'name', type: 'String(20)'}));
  args.attributes.push(new Attribute({name: 'active', type: 'Boolean'}));
  args.attributes.push(new Attribute({name: 'password', type: 'String(20)'}));
  args.attributes.push(new Attribute({name: 'firstName', type: 'String(35)'}));
  args.attributes.push(new Attribute({name: 'lastName', type: 'String(35)'}));
  args.attributes.push(new Attribute({name: 'email', type: 'String(20)'}));
  Model.call(this, args);
  this.modelType = "User";
  this.set('active', false);
}
941397
function getFollowersIt(T, user_id, followers, cursor, max_followers, finish) {
  if (followers.length >= max_followers) {
    return finish(followers);
  }

  T.get('followers/list', {user_id: user_id, cursor: cursor}, function (err, data) {
    if (err) {
      console.log(err);
      return delay(function () {
        getFollowersIt(T, user_id, followers, cursor, max_followers, finish);
      });
    }

    // user.followers_ids = data.users.map(function (user) { 
    //   return user.id;
    // });
    // finish(data.users);
    followers = followers.concat(data.users);
    getFollowersIt(T, user_id, followers, data.next_cursor, max_followers, finish);
  });
}
601102
function pick(obj, var_keys){
        var keys = typeof arguments[1] !== 'string'? arguments[1] : slice(arguments, 1),
            out = {},
            i = 0, key;
        while (key = keys[i++]) {
            out[key] = obj[key];
        }
        return out;
    }
1171428
def likes?(object)
      verbs_of_interest = %w[like unlike]

      query = Activity.joins(:verb)
                      .with_activity_object_id(id: object.id)
                      .with_actor_id(id: guid)
                      .merge(Verb.with_display_name(name: verbs_of_interest))

      query.count.odd?
    end
917661
def liked_by
      # subquery = Activity.where(activity_object_id: id)
      # people   = Person.joins(activity_object: { actor_activities: :verb })
      #                  .merge(subquery)
      # likers   = people.merge(Verb.by_display_name("like"))
      # unlikers = people.merge(Verb.by_display_name("unlike")).pluck(:id)

      query    = Activity.joins(:verb).with_activity_object_id(id: id)
      likers   = query.merge(Verb.with_display_name(name: "like"))
      unlikers = query.merge(Verb.with_display_name(name: "unlike"))
      people   = likers.map(&:actor)

      unlikers.each do |activity|
        people.delete_at people.index(activity.actor)
      end

      people
    end
1039262
def cli(obj, show_userinfo):
    """"""
    client = obj['client']
    userinfo = client.userinfo()
    if show_userinfo:
        for k, v in userinfo.items():
            if isinstance(v, list):
                v = ', '.join(v)
            click.echo('{:20}: {}'.format(k, v))
    else:
        click.echo(userinfo['preferred_username'])
370483
def awesome_object(o)
      vars = instance_variables_opal(o).map do |var|
        property = var.to_s[1..-1].to_sym # to_s because of some monkey patching done by Puppet.
        accessor = if o.respond_to?(:"#{property}=")
                     o.respond_to?(property) ? :accessor : :writer
                   else
                     o.respond_to?(property) ? :reader : nil
                   end
        if accessor
          [ "attr_#{accessor} :#{property}", var ]
        else
          [ var.to_s, var ]
        end
      end

      data = vars.sort.map do |declaration, var|
        key = left_aligned do
          align(declaration, declaration.size)
        end

        unless @options[:plain]
          if key =~ /(@\w+)/
            key = key.sub($1, colorize($1, :variable))
          else
            key = key.sub(/(attr_\w+)\s(\:\w+)/, "#{colorize('\\1', :keyword)} #{colorize('\\2', :method)}")
          end
        end
        indented do
          key + colorize(" = ", :hash) + @inspector.awesome(o.instance_variable_get(var))
        end
      end
      if @options[:multiline]
        "#<#{awesome_instance(o)}\n#{data.join(%Q/,\n/)}\n#{outdent}>"
      else
        "#<#{awesome_instance(o)} #{data.join(', ')}>"
      end
    end
70755
def get_favoritable_value
      if spree_current_user.present?
        @favorite = spree_current_user.favorites.where(favoritable_params).first
      end

      respond_to do |format|
        format.js
      end
    end
434576
def show(self, username):
        """"""
        filter = ['(objectclass=posixAccount)', "(uid={})".format(username)]
        return self.client.search(filter)
1250501
def get_favorites(self, username):
        

        r = self._query_('/users/%s/favorite_anime' % username, 'GET')

        results = [Favorite(item) for item in r.json()]
        return results