<commit_before>import random
import logging
import time

from protocol import order
from pyelliptic import ECC
from multisig import Multisig
from db_store import Obdb
import gnupg
import hashlib
import string
import json
import datetime

class Orders(object):
    def __init__(self, transport, market_id):

        self._transport = transport
        self._priv = transport._myself
        self._market_id = market_id

        self._gpg = gnupg.GPG()

        # TODO: Make user configurable escrow addresses
        self._escrows = [
            "<KEY>",
            "<KEY>"]
        self._db = Obdb()
        self._orders = self.get_orders()
        self.orders = self._orders

        self._transport.add_callback('order', self.on_order)

        self._log = logging.getLogger('[%s] %s' % (self._market_id, self.__class__.__name__))

    def get_order(self, orderId):

        order = self._db.selectEntries("orders", {"id": orderId})[0]
        order["escrows"] = self._db.selectEntries("escrows", {"id": order["id"]}) 
        order_escrows = ""
        for e in order["escrows"]:
            for key, val in e.iteritems():
                order_escrows = order_escrows + ", " + val
        order["escrows"] = order_escrows
        return order

    def get_orders(self):
        orders = self._db.selectEntries("orders", order_field="created", order="DESC")
        for o in orders:
            o["escrows"] = self._db.selectEntries("escrows", {"id": o["id"]})
        return orders



    # Create a new order
    def create_order(self, seller, text):
        self._log.info('CREATING ORDER')
        id = random.randint(0, 1000000)<commit_msg>Grab only orders for the specific market.<commit_after>import random
import logging
import time

from protocol import order
from pyelliptic import ECC
from multisig import Multisig
from db_store import Obdb
import gnupg
import hashlib
import string
import json
import datetime

class Orders(object):
    def __init__(self, transport, market_id):

        self._transport = transport
        self._priv = transport._myself
        self._market_id = market_id

        self._gpg = gnupg.GPG()

        # TODO: Make user configurable escrow addresses
        self._escrows = [
            "<KEY>",
            "02ca0020c0d9cd9bdd70c8565374ed8986ac58d24f076e9bcc401fc836352da4fc21f8490020b59dec0aff5e93184d022423893568df13ec1b8352e5f1141dbc669456af510c"]
        self._db = Obdb()
        self._orders = self.get_orders()
        self.orders = self._orders

        self._transport.add_callback('order', self.on_order)

        self._log = logging.getLogger('[%s] %s' % (self._market_id, self.__class__.__name__))

    def get_order(self, orderId):

        order = self._db.selectEntries("orders", {"id": orderId})[0]
        order["escrows"] = self._db.selectEntries("escrows", {"id": order["id"]}) 
        order_escrows = ""
        for e in order["escrows"]:
            for key, val in e.iteritems():
                order_escrows = order_escrows + ", " + val
        order["escrows"] = order_escrows
        return order

    def get_orders(self):
        orders = self._db.selectEntries("orders", {'market_id': self._market_id}, order_field="created", order="DESC")
        for o in orders:
            o["escrows"] = self._db.selectEntries("escrows", {"id": o["id"]})
        return orders



    # Create a new order
    def create_order(self, seller, text):
        self._log.info('CREATING ORDER')
        id = random.randint(0, 1000000)
{'fraction_non_alphanumeric': 0.11444921316165951, 'fraction_numerical': 0.03118741058655222, 'mean_word_length': 2.7876489707475622, 'pattern_counts': {'":': 6, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5061508', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1053, 'n_words': 257}