Skip to content

Commit

Permalink
Format fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Dtenwolde committed Dec 9, 2024
1 parent f565867 commit c54ccbd
Show file tree
Hide file tree
Showing 97 changed files with 165 additions and 167 deletions.
2 changes: 1 addition & 1 deletion extension-ci-tools
8 changes: 2 additions & 6 deletions scripts/bootstrap-template.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ def replace_everywhere(to_find, to_replace):

if __name__ == "__main__":
if len(sys.argv) != 2:
raise Exception(
"usage: python3 bootstrap-template.py <name_for_extension_in_snake_case>"
)
raise Exception("usage: python3 bootstrap-template.py <name_for_extension_in_snake_case>")

name_extension = sys.argv[1]

Expand Down Expand Up @@ -79,9 +77,7 @@ def replace_everywhere(to_find, to_replace):

# rename files
os.rename(f"test/sql/{string_to_find}.test", f"test/sql/{string_to_replace}.test")
os.rename(
f"src/{string_to_find}_extension.cpp", f"src/{string_to_replace}_extension.cpp"
)
os.rename(f"src/{string_to_find}_extension.cpp", f"src/{string_to_replace}_extension.cpp")
os.rename(
f"src/include/{string_to_find}_extension.hpp",
f"src/include/{string_to_replace}_extension.hpp",
Expand Down
18 changes: 12 additions & 6 deletions scripts/copy_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,18 @@ def main(argv):
for file in onlyfiles:
f = open(test_path_duckpgq + "/" + file, "r")
content = f.read()
content = content.replace("require duckpgq\n",
dedent("statement ok\n"
"force install '__BUILD_DIRECTORY__/../../../build/"+mode+"/extension/duckpgq/duckpgq.duckdb_extension';\n"
"\n"
"statement ok\n"
"load 'duckpgq';\n"))
content = content.replace(
"require duckpgq\n",
dedent(
"statement ok\n"
"force install '__BUILD_DIRECTORY__/../../../build/"
+ mode
+ "/extension/duckpgq/duckpgq.duckdb_extension';\n"
"\n"
"statement ok\n"
"load 'duckpgq';\n"
),
)

new_file = open(test_path_duckdb + "/" + file, "w")
new_file.write(content)
Expand Down
2 changes: 1 addition & 1 deletion scripts/format.py → scripts/format_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
]
formatted_directories = ['src', 'test', 'scripts']
ignored_files = []
ignored_directories = []
ignored_directories = ['__pycache__', '.pytest_cache']
format_all = False
check_only = True
confirm = True
Expand Down
8 changes: 4 additions & 4 deletions scripts/python_helpers.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
def open_utf8(fpath, flags):
import sys

if sys.version_info[0] < 3:
return open(fpath, flags)
else:
return open(fpath, flags, encoding="utf8")


def normalize_path(path):
import os

def normalize(p):
return os.path.sep.join(p.split('/'))

Expand All @@ -17,7 +19,5 @@ def normalize(p):

if (isinstance, str):
return normalize(path)

raise Exception("Can only be called with a str or list argument")

raise Exception("Can only be called with a str or list argument")
3 changes: 3 additions & 0 deletions scripts/s3_availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
bucket_name = 'duckpgq'
prefix = 'v'


def list_extensions(bucket, prefix):
response = s3_client.list_objects_v2(Bucket=bucket, Prefix=prefix)
extensions = {}
Expand All @@ -29,6 +30,7 @@ def list_extensions(bucket, prefix):

return extensions


def generate_markdown_table(extensions):
table = '## DuckPGQ Extension Availability\n\n'

Expand All @@ -46,6 +48,7 @@ def generate_markdown_table(extensions):

return table


extensions = list_extensions(bucket_name, prefix)
markdown_table = generate_markdown_table(extensions)

Expand Down
6 changes: 4 additions & 2 deletions scripts/set_extension_name.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,21 @@
import sys, os
from pathlib import Path

if (len(sys.argv) != 2):
if len(sys.argv) != 2:
raise Exception('usage: python3 set_extension_name.py <name_for_extension>')

string_to_find = "quack"
string_to_replace = sys.argv[1]


def replace(file_name, to_find, to_replace):
with open(file_name, 'r', encoding="utf8") as file :
with open(file_name, 'r', encoding="utf8") as file:
filedata = file.read()
filedata = filedata.replace(to_find, to_replace)
with open(file_name, 'w', encoding="utf8") as file:
file.write(filedata)


files_to_search = []
files_to_search.extend(Path('./.github').rglob('./**/*.yml'))
files_to_search.extend(Path('./test').rglob('./**/*.py'))
Expand Down
8 changes: 4 additions & 4 deletions scripts/test_header_generation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import os


def generate_headers(base_dir):
# Ensure to include the 'test' directory in the path
test_dir = os.path.join(base_dir, "test") # Adjust this if the base_dir does not already include 'test'
Expand All @@ -18,9 +20,7 @@ def generate_headers(base_dir):
content = f.read()

# Create the header content
header = f"# name: {relative_path}\n" \
f"# description: ""\n" \
f"# group: [{group}]\n\n"
header = f"# name: {relative_path}\n" f"# description: " "\n" f"# group: [{group}]\n\n"

# Search and replace old header if exists
if header.split("\n")[0] in content:
Expand All @@ -35,4 +35,4 @@ def generate_headers(base_dir):

# Usage
base_dir = "/Users/dljtw/git/duckpgq" # Adjust this path to the correct directory which includes the 'test' folder
generate_headers(base_dir)
generate_headers(base_dir)
6 changes: 2 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ add_subdirectory(core)

set(EXTENSION_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_extension.cpp
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_state.cpp
${EXTENSION_SOURCES}
PARENT_SCOPE
)
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_state.cpp ${EXTENSION_SOURCES}
PARENT_SCOPE)
6 changes: 2 additions & 4 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ add_subdirectory(parser)
add_subdirectory(utils)

set(EXTENSION_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/module.cpp
${EXTENSION_SOURCES}
PARENT_SCOPE
)
${CMAKE_CURRENT_SOURCE_DIR}/module.cpp ${EXTENSION_SOURCES}
PARENT_SCOPE)
5 changes: 2 additions & 3 deletions src/core/functions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ add_subdirectory(scalar)
add_subdirectory(table)

set(EXTENSION_SOURCES
${EXTENSION_SOURCES}
PARENT_SCOPE
)
${EXTENSION_SOURCES}
PARENT_SCOPE)
16 changes: 7 additions & 9 deletions src/core/functions/function_data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
set(EXTENSION_SOURCES
${EXTENSION_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/cheapest_path_length_function_data.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iterative_length_function_data.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_clustering_coefficient_function_data.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pagerank_function_data.cpp
${CMAKE_CURRENT_SOURCE_DIR}/weakly_connected_component_function_data.cpp

PARENT_SCOPE
)
${EXTENSION_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/cheapest_path_length_function_data.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iterative_length_function_data.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_clustering_coefficient_function_data.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pagerank_function_data.cpp
${CMAKE_CURRENT_SOURCE_DIR}/weakly_connected_component_function_data.cpp
PARENT_SCOPE)
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ bool CheapestPathLengthFunctionData::Equals(const FunctionData &other_p) const {

} // namespace core

} // namespace duckpgq
} // namespace duckpgq
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ unique_ptr<FunctionData> IterativeLengthFunctionData::IterativeLengthBind(

} // namespace core

} // namespace duckpgq
} // namespace duckpgq
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ bool LocalClusteringCoefficientFunctionData::Equals(

} // namespace core

} // namespace duckpgq
} // namespace duckpgq
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ bool PageRankFunctionData::Equals(const FunctionData &other_p) const {
}
} // namespace core

} // namespace duckpgq
} // namespace duckpgq
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ bool WeaklyConnectedComponentFunctionData::Equals(

} // namespace core

} // namespace duckpgq
} // namespace duckpgq
31 changes: 15 additions & 16 deletions src/core/functions/scalar/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
set(EXTENSION_SOURCES
${EXTENSION_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/cheapest_path_length.cpp
${CMAKE_CURRENT_SOURCE_DIR}/csr_creation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/csr_deletion.cpp
${CMAKE_CURRENT_SOURCE_DIR}/csr_get_w_type.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iterativelength.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iterativelength2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iterativelength_bidirectional.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pagerank.cpp
${CMAKE_CURRENT_SOURCE_DIR}/reachability.cpp
${CMAKE_CURRENT_SOURCE_DIR}/shortest_path.cpp
${CMAKE_CURRENT_SOURCE_DIR}/csr_creation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_clustering_coefficient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/weakly_connected_component.cpp
PARENT_SCOPE
)
${EXTENSION_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/cheapest_path_length.cpp
${CMAKE_CURRENT_SOURCE_DIR}/csr_creation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/csr_deletion.cpp
${CMAKE_CURRENT_SOURCE_DIR}/csr_get_w_type.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iterativelength.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iterativelength2.cpp
${CMAKE_CURRENT_SOURCE_DIR}/iterativelength_bidirectional.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pagerank.cpp
${CMAKE_CURRENT_SOURCE_DIR}/reachability.cpp
${CMAKE_CURRENT_SOURCE_DIR}/shortest_path.cpp
${CMAKE_CURRENT_SOURCE_DIR}/csr_creation.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_clustering_coefficient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/weakly_connected_component.cpp
PARENT_SCOPE)
2 changes: 1 addition & 1 deletion src/core/functions/scalar/weakly_connected_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,4 +186,4 @@ void CoreScalarFunctions::RegisterWeaklyConnectedComponentScalarFunction(
}

} // namespace core
} // namespace duckpgq
} // namespace duckpgq
21 changes: 10 additions & 11 deletions src/core/functions/table/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
set(EXTENSION_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/create_property_graph.cpp
${CMAKE_CURRENT_SOURCE_DIR}/describe_property_graph.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drop_property_graph.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_clustering_coefficient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/match.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pagerank.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pgq_scan.cpp
${CMAKE_CURRENT_SOURCE_DIR}/weakly_connected_component.cpp
${EXTENSION_SOURCES}
PARENT_SCOPE
)
${CMAKE_CURRENT_SOURCE_DIR}/create_property_graph.cpp
${CMAKE_CURRENT_SOURCE_DIR}/describe_property_graph.cpp
${CMAKE_CURRENT_SOURCE_DIR}/drop_property_graph.cpp
${CMAKE_CURRENT_SOURCE_DIR}/local_clustering_coefficient.cpp
${CMAKE_CURRENT_SOURCE_DIR}/match.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pagerank.cpp
${CMAKE_CURRENT_SOURCE_DIR}/pgq_scan.cpp
${CMAKE_CURRENT_SOURCE_DIR}/weakly_connected_component.cpp
${EXTENSION_SOURCES}
PARENT_SCOPE)
2 changes: 1 addition & 1 deletion src/core/functions/table/create_property_graph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,4 +450,4 @@ void CoreTableFunctions::RegisterCreatePropertyGraphTableFunction(
}
} // namespace core

} // namespace duckpgq
} // namespace duckpgq
2 changes: 1 addition & 1 deletion src/core/functions/table/pagerank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ void CoreTableFunctions::RegisterPageRankTableFunction(DatabaseInstance &db) {
}

} // namespace core
} // namespace duckpgq
} // namespace duckpgq
2 changes: 1 addition & 1 deletion src/core/functions/table/weakly_connected_component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ void CoreTableFunctions::RegisterWeaklyConnectedComponentTableFunction(
}

} // namespace core
} // namespace duckpgq
} // namespace duckpgq
2 changes: 1 addition & 1 deletion src/core/module.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ void CoreModule::Register(DatabaseInstance &db) {

} // namespace core

} // namespace duckpgq
} // namespace duckpgq
6 changes: 2 additions & 4 deletions src/core/operator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set(EXTENSION_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_bind.cpp
${EXTENSION_SOURCES}
PARENT_SCOPE
)
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_bind.cpp ${EXTENSION_SOURCES}
PARENT_SCOPE)
2 changes: 1 addition & 1 deletion src/core/operator/duckpgq_bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ void CorePGQOperator::RegisterPGQBindOperator(DatabaseInstance &db) {

} // namespace core

} // namespace duckpgq
} // namespace duckpgq
6 changes: 2 additions & 4 deletions src/core/parser/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
set(EXTENSION_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_parser.cpp
${EXTENSION_SOURCES}
PARENT_SCOPE
)
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_parser.cpp ${EXTENSION_SOURCES}
PARENT_SCOPE)
2 changes: 1 addition & 1 deletion src/core/parser/duckpgq_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,4 +189,4 @@ void CorePGQParser::RegisterPGQParserExtension(DatabaseInstance &db) {

} // namespace core

} // namespace duckpgq
} // namespace duckpgq
10 changes: 4 additions & 6 deletions src/core/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
set(EXTENSION_SOURCES
${EXTENSION_SOURCES}
${CMAKE_CURRENT_SOURCE_DIR}/compressed_sparse_row.cpp
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_bitmap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_utils.cpp
PARENT_SCOPE
)
${EXTENSION_SOURCES} ${CMAKE_CURRENT_SOURCE_DIR}/compressed_sparse_row.cpp
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_bitmap.cpp
${CMAKE_CURRENT_SOURCE_DIR}/duckpgq_utils.cpp
PARENT_SCOPE)
2 changes: 1 addition & 1 deletion src/core/utils/compressed_sparse_row.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,4 +701,4 @@ unique_ptr<SubqueryRef> CreateCountCTESubquery() {

} // namespace core

} // namespace duckpgq
} // namespace duckpgq
2 changes: 1 addition & 1 deletion src/core/utils/duckpgq_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ CreateColumnRefExpression(const string &column_name, const string &table_name,
return column_ref;
}
} // namespace core
} // namespace duckpgq
} // namespace duckpgq
Loading

0 comments on commit c54ccbd

Please sign in to comment.