<commit_before>#!/usr/bin/env python
# -*- coding:utf-8 -*-
import json
import argparse

import roslib; roslib.load_manifest("jsk_2014_picking_challenge")
import rospy
from std_msgs.msg import String
from jsk_2014_picking_challenge.msg import order_list
from jsk_2014_picking_challenge.msg import one_order
from jsk_2014_picking_challenge.msg import bin_content
from jsk_2014_picking_challenge.msg import bins_content

def main():
    """Baxter read jsonfile."""
    arg_fmt = argparse.RawTextHelpFormatter
    parser = argparse.ArgumentParser(formatter_class=arg_fmt,
                                     description=main.__doc__)
    required = parser.add_argument_group('required arguments')
    required.add_argument(
        '-f', '--file', required=True,
        help='select json file.'
    )
    args = parser.parse_args(rospy.myargv()[1:])

    f = open(args.file, 'r')
    jsonData = json.load(f)

    bins_data = bins_content()
    bin_contents = jsonData['bin_contents']
    for bin in bin_contents:
        data = bin_content()
        data.bin = bin
        data.items = bin_contents[bin]
        bins_data.bins.append(data)
        # s = ""
        # for content in bin_contents[bin]:
        #     s += content + ":"
        # s = s[:len(s)-1]
        # print("{0}:{1}".format(bin, s))

    order_data = order_list()
    work_orders = jsonData['work_order']
    for order in work_orders:
        data = one_order()
        data.bin = order['bin']
        data.item = order['item']
        order_data.order_list.append(data)

    rospy.loginfo(order_data)
    rospy.init_node('read_json_data')
    pub_order = rospy.Publisher('semi/order_list', order_list)
    pub_bincontents = rospy.Publisher('semi/bin_contents', bins_content)

    while not rospy.is_shutdown():
        rospy.loginfo(order_data)
        pub_order.publish(order_data)
        pub_bincontents.publish(bins_data)
        rospy.sleep(1.0)


if __name__ == "__main__":
    main()
<commit_msg>resolve not assigned queue_size warning<commit_after>#!/usr/bin/env python
# -*- coding:utf-8 -*-
import json
import argparse

import roslib; roslib.load_manifest("jsk_2014_picking_challenge")
import rospy
from std_msgs.msg import String
from jsk_2014_picking_challenge.msg import order_list
from jsk_2014_picking_challenge.msg import one_order
from jsk_2014_picking_challenge.msg import bin_content
from jsk_2014_picking_challenge.msg import bins_content

def main():
    """Baxter read jsonfile."""
    arg_fmt = argparse.RawTextHelpFormatter
    parser = argparse.ArgumentParser(formatter_class=arg_fmt,
                                     description=main.__doc__)
    required = parser.add_argument_group('required arguments')
    required.add_argument(
        '-f', '--file', required=True,
        help='select json file.'
    )
    args = parser.parse_args(rospy.myargv()[1:])

    f = open(args.file, 'r')
    jsonData = json.load(f)

    bins_data = bins_content()
    bin_contents = jsonData['bin_contents']
    for bin in bin_contents:
        data = bin_content()
        data.bin = bin
        data.items = bin_contents[bin]
        bins_data.bins.append(data)
        # s = ""
        # for content in bin_contents[bin]:
        #     s += content + ":"
        # s = s[:len(s)-1]
        # print("{0}:{1}".format(bin, s))

    order_data = order_list()
    work_orders = jsonData['work_order']
    for order in work_orders:
        data = one_order()
        data.bin = order['bin']
        data.item = order['item']
        order_data.order_list.append(data)

    rospy.loginfo(order_data)
    rospy.init_node('read_json_data')
    pub_order = rospy.Publisher('semi/order_list', order_list, queue_size=1)
    pub_bincontents = rospy.Publisher('semi/bin_contents', bins_content, queue_size=1)

    while not rospy.is_shutdown():
        rospy.loginfo(order_data)
        pub_order.publish(order_data)
        pub_bincontents.publish(bins_data)
        rospy.sleep(1.0)


if __name__ == "__main__":
    main()

{'fraction_non_alphanumeric': 0.115, 'fraction_numerical': 0.014, 'mean_word_length': 3.0619289340101523, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5004820', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1310, 'n_words': 244}