# Path: attributes/community/main.py
# QUERY = '''
#     SELECT c.author_id, COUNT(*)
#     FROM commits c JOIN project_commits pc
#       ON pc.commit_id = c.id
#     WHERE pc.project_id = {0}
#     GROUP BY c.author_id
#     ORDER BY COUNT(*) DESC
# '''
# def run(project_id, repo_path, cursor, **options):
# 
# Path: lib/database.py
# class DatabaseError(Exception):
# class Database(object):
#     def __init__(self, value):
#     def __str__(self):
#     def __init__(self, settings):
#     def connect(self):
#     def disconnect(self):
#     def get(self, query):
#     def post(self, query, data=None):
#     def cursor(self):
#     def _connected(self):
#     def __getstate__(self):
#     def __setstate__(self, state):


import json
import os
import unittest
from attributes.community import main
from lib import database
            self.database.disconnect()

        # Assert
        self.assertTrue(result)
        self.assertLess(0, value)

        # Arrange
        project_id = 66  # libraM/django-request-signer
        options = {'threshold': 2, 'cutoff': 0.8}

        # Act
        try:
            self.database.connect()
            with self.database.cursor() as cursor:
                (result, value) = main.run(project_id, '', cursor, **options)
        finally:
            self.database.disconnect()

        # Assert
        self.assertFalse(result)
        self.assertLess(0, value)

        # Arrange
        project_id = 18228981  # sleeper/oauth2
        options = {'threshold': 2, 'cutoff': 0.8}

        # Act
        try:
            self.database.connect()
            with self.database.cursor() as cursor:

# Path: attributes/community/main.py
# QUERY = '''
#     SELECT c.author_id, COUNT(*)
#     FROM commits c JOIN project_commits pc
#       ON pc.commit_id = c.id
#     WHERE pc.project_id = {0}
#     GROUP BY c.author_id
#     ORDER BY COUNT(*) DESC
# '''
# def run(project_id, repo_path, cursor, **options):
# 
# Path: lib/database.py
# class DatabaseError(Exception):
# class Database(object):
#     def __init__(self, value):
#     def __str__(self):
#     def __init__(self, settings):
#     def connect(self):
#     def disconnect(self):
#     def get(self, query):
#     def post(self, query, data=None):
#     def cursor(self):
#     def _connected(self):
#     def __getstate__(self):
#     def __setstate__(self, state):


# Path: tests/community/test_main.py
import json
import os
import unittest
from attributes.community import main
from lib import database

            self.database.disconnect()

        # Assert
        self.assertTrue(result)
        self.assertLess(0, value)

        # Arrange
        project_id = 66  # libraM/django-request-signer
        options = {'threshold': 2, 'cutoff': 0.8}

        # Act
        try:
            self.database.connect()
            with self.database.cursor() as cursor:
                (result, value) = main.run(project_id, '', cursor, **options)
        finally:
            self.database.disconnect()

        # Assert
        self.assertFalse(result)
        self.assertLess(0, value)

        # Arrange
        project_id = 18228981  # sleeper/oauth2
        options = {'threshold': 2, 'cutoff': 0.8}

        # Act
        try:
            self.database.connect()
            with self.database.cursor() as cursor:

                (result, value) = main.run(project_id, '', cursor, **options)