Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
common_helper_mongo
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fact-gitdep
common_helper_mongo
Commits
327d0a04
Commit
327d0a04
authored
Feb 12, 2020
by
Jörg Stucke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removed deprecated function
parent
8252bde4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
29 deletions
+3
-29
.pre-commit-config.yaml
.pre-commit-config.yaml
+0
-4
__init__.py
common_helper_mongo/__init__.py
+3
-2
aggregate.py
common_helper_mongo/aggregate.py
+0
-23
No files found.
common_helper_mongo/
.pre-commit-config.yaml
→
.pre-commit-config.yaml
View file @
327d0a04
default_stages
:
[
commit
,
push
]
default_stages
:
[
commit
,
push
]
exclude
:
^src/bin/
repos
:
repos
:
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
-
repo
:
https://github.com/pre-commit/pre-commit-hooks
rev
:
v2.2.3
rev
:
v2.2.3
...
@@ -19,9 +18,6 @@ repos:
...
@@ -19,9 +18,6 @@ repos:
-
id
:
fix-encoding-pragma
-
id
:
fix-encoding-pragma
args
:
[
--remove
]
args
:
[
--remove
]
-
id
:
file-contents-sorter
files
:
src/unpacker/passwords|.gitignore|_list.txt
-
id
:
flake8
-
id
:
flake8
args
:
[
--ignore="E501
,
W503"
,
--select=W504
]
args
:
[
--ignore="E501
,
W503"
,
--select=W504
]
...
...
common_helper_mongo/__init__.py
View file @
327d0a04
from
.aggregate
import
(
get_field_average
,
get_field_execute_operation
,
get_field_sum
,
get_list_of_all_values
,
get_objects_and_count_of_occurrence
)
from
.gridfs
import
overwrite_file
from
.gridfs
import
overwrite_file
from
.aggregate
import
get_objects_and_count_of_occurrence
,
get_field_average
,
get_field_sum
,
get_field_execute_operation
,
get_list_of_all_values
,
get_list_of_all_values_and_collect_information_of_additional_field
__all__
=
[
__all__
=
[
'overwrite_file'
,
'overwrite_file'
,
...
@@ -8,5 +10,4 @@ __all__ = [
...
@@ -8,5 +10,4 @@ __all__ = [
'get_field_sum'
,
'get_field_sum'
,
'get_field_execute_operation'
,
'get_field_execute_operation'
,
'get_list_of_all_values'
,
'get_list_of_all_values'
,
'get_list_of_all_values_and_collect_information_of_additional_field'
]
]
common_helper_mongo/aggregate.py
View file @
327d0a04
...
@@ -2,7 +2,6 @@ import logging
...
@@ -2,7 +2,6 @@ import logging
from
typing
import
List
,
Optional
from
typing
import
List
,
Optional
from
bson.son
import
SON
from
bson.son
import
SON
from
pymongo.command_cursor
import
CommandCursor
def
get_list_of_all_values
(
collection
,
object_path
,
unwind
=
False
,
match
=
None
):
def
get_list_of_all_values
(
collection
,
object_path
,
unwind
=
False
,
match
=
None
):
...
@@ -27,28 +26,6 @@ def get_list_of_all_values(collection, object_path, unwind=False, match=None):
...
@@ -27,28 +26,6 @@ def get_list_of_all_values(collection, object_path, unwind=False, match=None):
return
result
return
result
def
get_list_of_all_values_and_collect_information_of_additional_field
(
collection
,
object_path
,
additional_information_object_path
,
unwind
=
False
,
match
=
None
):
'''
Get a list of unique values and a collection of additional information on a specific object path in a collection.
An Optional search string (match) can be added.
:param collection: mongo collection to look at
:type collection: pymongo.collection.Collection
:param object_path: mongo object path
:type object_path: str
:param additional_information_object_path: field of the additional information
:type additional_information_object_path: str
:param unwind: if true: handle list entries as single values
:type unwind: bool
:param match: mongo search string
:type match: dict, optional
:return: {<VALUE>:[<ADDITIONAL_INFORMATION_1>, ...], ...}
'''
logging
.
warning
(
'deprecation warning: this method will be removed in a future release'
)
return
get_all_value_combinations_of_fields
(
collection
,
object_path
,
additional_information_object_path
,
unwind
,
match
)
def
get_all_value_combinations_of_fields
(
collection
,
primary_field
,
secondary_field
,
unwind
=
False
,
match
=
None
):
def
get_all_value_combinations_of_fields
(
collection
,
primary_field
,
secondary_field
,
unwind
=
False
,
match
=
None
):
'''
'''
Get a dictionary with all unique values of a field as keys and a list of all unique values that a second field takes
Get a dictionary with all unique values of a field as keys and a list of all unique values that a second field takes
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment