id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6,000 | colorcal.py | psychopy_psychopy/psychopy/hardware/crs/colorcal.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2024 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
from psychopy.tools.pkgtools import PluginStub
class ColorCAL(
PluginStub,
plu... | 422 | Python | .py | 12 | 32.25 | 79 | 0.74321 | psychopy/psychopy | 1,662 | 900 | 218 | GPL-3.0 | 9/5/2024, 5:09:29 PM (Europe/Amsterdam) |
6,001 | optical.py | psychopy_psychopy/psychopy/hardware/crs/optical.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2009-2012 Valentin Haenel <valentin.haenel@gmx.de>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, includ... | 1,361 | Python | .py | 28 | 46.821429 | 79 | 0.780286 | psychopy/psychopy | 1,662 | 900 | 218 | GPL-3.0 | 9/5/2024, 5:09:29 PM (Europe/Amsterdam) |
6,002 | __init__.py | psychopy_psychopy/psychopy/hardware/crs/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2024 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
"""Interfaces for Cambridge Research Systems hardware.
These are optional components that... | 1,406 | Python | .py | 35 | 35.2 | 80 | 0.711029 | psychopy/psychopy | 1,662 | 900 | 218 | GPL-3.0 | 9/5/2024, 5:09:29 PM (Europe/Amsterdam) |
6,003 | __init__.py | psychopy_psychopy/psychopy/hardware/joystick/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Control joysticks and gamepads from within PsychoPy.
You do need a window (and you need to be flipping it) for the joystick to be
updated.
Known issues:
- currently under pyglet the joystick axes initialise to a value of zero
and stay like this until the fir... | 19,109 | Python | .py | 474 | 29.512658 | 80 | 0.568658 | psychopy/psychopy | 1,662 | 900 | 218 | GPL-3.0 | 9/5/2024, 5:09:29 PM (Europe/Amsterdam) |
6,004 | __init__.py | psychopy_psychopy/psychopy/hardware/camera/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Classes and functions for reading and writing camera streams.
A camera may be used to document participant responses on video or used by the
experimenter to create movie stimuli or instructions.
"""
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Pei... | 96,633 | Python | .py | 2,255 | 32.231929 | 110 | 0.606997 | psychopy/psychopy | 1,662 | 900 | 218 | GPL-3.0 | 9/5/2024, 5:09:29 PM (Europe/Amsterdam) |
6,005 | __init__.py | psychopy_psychopy/psychopy/hardware/photometer/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Classes and functions for using photometers.
This module serves as the entry point for plugin classes implementing
third-party photometer interfaces. All installed interfaces are discoverable
by calling the :func:`getAllPhotometers()` function.
"""
# Part of the Psych... | 5,626 | Python | .py | 129 | 37.596899 | 80 | 0.717112 | psychopy/psychopy | 1,662 | 900 | 218 | GPL-3.0 | 9/5/2024, 5:09:29 PM (Europe/Amsterdam) |
6,006 | __init__.py | psychopy_psychopy/psychopy/hardware/bbtk/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2024 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
"""Interfaces for Black Box Toolkit Ltd. devices.
These are optional components that can ... | 957 | Python | .py | 23 | 37.913043 | 80 | 0.734914 | psychopy/psychopy | 1,662 | 900 | 218 | GPL-3.0 | 9/5/2024, 5:09:29 PM (Europe/Amsterdam) |
6,007 | ffpyplayer_player.py | psychopy_psychopy/psychopy/visual/movies/players/ffpyplayer_player.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Classes for movie player interfaces.
"""
# Part of the PsychoPy library
# Copyright (C) 2002-2018 Jonathan Peirce (C) 2019-2024 Open Science Tools Ltd.
# Distributed under the terms of the GNU General Public License (GPL).
__all__ = [
'FFPyPlayer'
]
import sys
f... | 45,899 | Python | .pyp | 1,123 | 30.816563 | 81 | 0.586287 | psychopy/psychopy | 1,662 | 900 | 218 | GPL-3.0 | 9/5/2024, 5:09:29 PM (Europe/Amsterdam) |
6,008 | test_component_compile_python.py | psychopy_psychopy/psychopy/tests/test_experiment/test_component_compile_python.py | import os
import shutil
from pathlib import Path
from tempfile import mkdtemp
from psychopy.experiment import getAllComponents, Experiment
from psychopy.tests.utils import compareTextFiles, TESTS_DATA_PATH
from psychopy.scripts import psyexpCompile
from psychopy import constants
class _TestBoilerplateMixin:
"""
... | 7,002 | Python | .pyt | 148 | 37.195946 | 121 | 0.631564 | psychopy/psychopy | 1,662 | 900 | 218 | GPL-3.0 | 9/5/2024, 5:09:29 PM (Europe/Amsterdam) |
6,009 | wsgi.py | amonapp_amon/wsgi.py | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "amon.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application() | 162 | Python | .py | 4 | 39.5 | 64 | 0.822785 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,010 | manage.py | amonapp_amon/manage.py | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "amon.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
| 247 | Python | .py | 7 | 32.142857 | 68 | 0.734177 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,011 | settings.py | amonapp_amon/amon/settings.py | import sys
import logging
import socket
import os
import hashlib
import yaml
from amon.utils.parsehost import parsehost
# dirname, dirname - climbs one dir higher
APPS_ROOT = os.path.abspath(os.path.dirname(__file__))
PROJECT_ROOT = os.path.dirname(APPS_ROOT)
TESTING = True if 'test' in sys.argv else False
TRAVIS ... | 7,608 | Python | .py | 245 | 25.220408 | 111 | 0.623099 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,012 | urls.py | amonapp_amon/amon/urls.py | from django.conf.urls import include, url
from django.views.generic import RedirectView
urlpatterns = [
url(r'^$', RedirectView.as_view(pattern_name='login')),
# url(r'^install/', include('amon.apps.install.urls')),
# url(r'^account/', include('amon.apps.account.urls')),
url(r'^api/', include('amon.app... | 1,289 | Python | .py | 24 | 49.083333 | 80 | 0.649444 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,013 | wsgi.py | amonapp_amon/amon/wsgi.py | import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "amon.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
| 163 | Python | .py | 4 | 39.5 | 64 | 0.822785 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,014 | mongoid.py | amonapp_amon/amon/templatetags/mongoid.py | from django import template
register = template.Library()
@register.filter("mongo_id")
def mongo_id(value):
try:
mongo_id = str(value['_id'])
except:
mongo_id = "doesnotexist"
return mongo_id
@register.filter("to_str")
def to_str(value):
return str(value) | 301 | Python | .py | 12 | 20.333333 | 36 | 0.677536 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,015 | plugins.py | amonapp_amon/amon/templatetags/plugins.py | from django import template
from amon.utils.filesize import size
register = template.Library()
@register.filter
def format_plugin_value(value, column):
if column in ['size', 'totalIndexSize', 'indexes', 'total', 'bytes']:
try:
value = size(value)
except Exception as e:
pass... | 638 | Python | .py | 23 | 21.347826 | 73 | 0.658662 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,016 | url.py | amonapp_amon/amon/templatetags/url.py | from django import template
from django.urls import resolve
register = template.Library()
@register.simple_tag(takes_context=True)
def active(context, url_name, return_value=' active', **kwargs):
matches = current_url_equals(context, url_name, **kwargs)
return return_value if matches else ''
def current_u... | 782 | Python | .py | 21 | 30.809524 | 64 | 0.676821 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,017 | setvar.py | amonapp_amon/amon/templatetags/setvar.py | from django import template
register = template.Library()
class SetVarNode(template.Node):
def __init__(self, var_name, var_value):
self.var_name = var_name
self.var_value = var_value
def render(self, context):
try:
value = template.Variable(self.var_value).resolve(conte... | 786 | Python | .py | 22 | 29.045455 | 113 | 0.619868 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,018 | date.py | amonapp_amon/amon/templatetags/date.py | from datetime import datetime
from django import template
from collections import OrderedDict
import re
from amon.utils.dates import (
dateformat_local,
datetimeformat_local,
dateformat,
timeformat,
day_local,
time_local,
dateformatcharts_local
)
register = template.Library()
def date_to_... | 2,624 | Python | .py | 71 | 30.450704 | 73 | 0.640853 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,019 | metrics.py | amonapp_amon/amon/templatetags/metrics.py | from __future__ import division
from django import template
from amon.utils.filesize import size
register = template.Library()
@register.filter
def kb_to_mb(value):
mb = float(value)/1000
mb = "{0:.2f}".format(mb)
return mb
@register.filter
def seconds_to_minutes(value):
minutes = value/60
... | 691 | Python | .py | 28 | 20.321429 | 37 | 0.683801 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,020 | __init__.py | amonapp_amon/amon/templatetags/__init__.py | # from django.template.base import add_to_builtins
# from amon.settings import AUTOLOAD_TAGS
# for tag in AUTOLOAD_TAGS:
# add_to_builtins(tag)
| 155 | Python | .py | 4 | 36 | 50 | 0.770833 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,021 | charts.py | amonapp_amon/amon/templatetags/charts.py | from django import template
register = template.Library()
@register.filter
def yaxis(value):
yaxis_value = ''
if type(value) is str:
value = value.lower()
if value == 'cpu':
yaxis_value = '%'
elif value in ['memory', 'disk']:
yaxis_value = 'MB'
elif value in ['io','n... | 524 | Python | .py | 18 | 22.5 | 43 | 0.581633 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,022 | baseurl.py | amonapp_amon/amon/templatetags/baseurl.py | from django.urls import reverse
from django.conf import settings
from django import template
from django.utils.encoding import smart_str
register = template.Library()
import re
kwarg_re = re.compile(r"(?:(\w+)=)?(.+)")
class URLNode(template.Node):
def __init__(self, view_name, args, kwargs):
self.view... | 1,396 | Python | .py | 38 | 29.078947 | 80 | 0.622642 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,023 | formhelpers.py | amonapp_amon/amon/templatetags/formhelpers.py | from django.template import Library
register = Library()
def silence_without_field(fn):
def wrapped(field, attr):
if not field:
return ""
return fn(field, attr)
return wrapped
def _process_field_attributes(field, attr, process):
# split attribute name and value from 'attr:v... | 2,208 | Python | .py | 59 | 32.118644 | 73 | 0.685002 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,024 | math.py | amonapp_amon/amon/templatetags/math.py | from __future__ import division
from django import template
register = template.Library()
@register.filter
def sum(element, second_element):
result = float(element)+float(second_element)
return result
@register.filter
def substract(element, second_element):
result = float(element)-float(second_element)
... | 1,165 | Python | .py | 34 | 30.882353 | 120 | 0.720036 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,025 | helpers.py | amonapp_amon/amon/templatetags/helpers.py | import re
from django import template
register = template.Library()
from amon.utils.charts import get_disk_unit
@register.filter
def disk_unit(server):
unit = get_disk_unit(server=server)
return unit
@register.filter
def get_distro(distro):
try:
name = distro.get('name', '').lower()
except:... | 3,518 | Python | .py | 109 | 25.357798 | 83 | 0.613106 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,026 | daterange.py | amonapp_amon/amon/utils/daterange.py | # -*- coding: utf-8 -*-
"""
Example Usage
=============
>>> import datetime
>>> start = datetime.date(2009, 6, 21)
>>> g1 = daterange(start)
>>> g1.next()
datetime.date(2009, 6, 21)
>>> g1.next()
datetime.date(2009, 6, 22)
>>> g1.next()
datetime.date(2009, 6, 23)
>>> g1.next()
datetime.date(2009, 6, 24)
>>> g1.next(... | 6,639 | Python | .py | 162 | 34.716049 | 78 | 0.647854 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,027 | dates.py | amonapp_amon/amon/utils/dates.py | from __future__ import division
import calendar
import pytz
from datetime import datetime, time, timedelta
from pytz import timezone
from operator import itemgetter
# Gets the UTC unix timestamp for 1800 before now
def utc_delta_from_now(period=1800):
now = datetime.utcnow()
now_unix = datetime_to_unixtime(no... | 5,926 | Python | .py | 148 | 34.581081 | 102 | 0.699364 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,028 | security.py | amonapp_amon/amon/utils/security.py | import base64
import hashlib
from Crypto.Cipher import AES
from Crypto import Random
from amon.settings import SECRET_KEY
class AESCipher(object):
"""
A classical AES Cipher. Can use any size of data and any size of password thanks to padding.
Also ensure the coherence and the type of the data with a uni... | 1,359 | Python | .py | 34 | 33.411765 | 105 | 0.639058 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,029 | haiku.py | amonapp_amon/amon/utils/haiku.py | import random
def generate_haiku_name():
adjs = [
"autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark",
"summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter",
"patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue",
"billowing"... | 1,790 | Python | .py | 30 | 50.933333 | 85 | 0.531393 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,030 | __init__.py | amonapp_amon/amon/utils/__init__.py | import random
import string
def generate_random_string(size=6, chars=string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for x in range(size))
class AmonStruct(object):
pass | 210 | Python | .py | 6 | 32.166667 | 81 | 0.776119 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,031 | filesize.py | amonapp_amon/amon/utils/filesize.py |
traditional = [
(1024 ** 5, 'P'),
(1024 ** 4, 'T'),
(1024 ** 3, 'G'),
(1024 ** 2, 'M'),
(1024 ** 1, 'K'),
(1024 ** 0, 'B'),
]
alternative = [
(1024 ** 5, ' PB'),
(1024 ** 4, ' TB'),
(1024 ** 3, ' GB'),
(1024 ** 2, ' MB'),
(1024 ** 1, ' KB'),
(1024 ** 0, (' byt... | 2,166 | Python | .py | 96 | 16.979167 | 66 | 0.457926 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,032 | parsehost.py | amonapp_amon/amon/utils/parsehost.py | from urllib.parse import urlparse
class AmonStruct(object):
pass
def parsehost(host=None):
parsed_url = urlparse(host)
result = AmonStruct()
result.hostname = parsed_url.hostname if parsed_url.hostname != None else parsed_url.path
result.scheme = 'http' if parsed_url.scheme == '' else par... | 636 | Python | .py | 16 | 33.5625 | 93 | 0.69218 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,033 | charts.py | amonapp_amon/amon/utils/charts.py | import random
base_colors = [
"#4B97DE",
"#1fb25a",
"#a489d8",
"#F2832A",
'#8dc48b',
'#15b5c1',
"#ffbc14"]
colors = []
for i in range(0, 5):
for color in base_colors:
colors.append(color)
def select_colors(index, type=None, random_color=None):
if random_color:
selected_color = random.choice(... | 1,088 | Python | .py | 42 | 21.071429 | 80 | 0.594461 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,034 | generators.py | amonapp_amon/amon/utils/generators.py | import random
import string
def random_id_generator(size=32, chars=string.ascii_lowercase + string.digits):
return ''.join(random.choice(chars) for _ in range(size)) | 170 | Python | .py | 4 | 40.5 | 79 | 0.771084 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,035 | test_security.py | amonapp_amon/amon/utils/tests/test_security.py | import unittest
from nose.tools import eq_
from amon.utils.security import AESCipher
from faker import Factory
fake = Factory.create()
class EncryptDecryptTest(unittest.TestCase):
def setUp(self):
self.aes_cipher = AESCipher()
def test_encrypt_decrypt(self):
for i in range(0, 100):
... | 1,085 | Python | .py | 25 | 33.6 | 73 | 0.648649 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,036 | test_parsehost.py | amonapp_amon/amon/utils/tests/test_parsehost.py | import unittest
from nose.tools import eq_
from amon.utils.parsehost import parsehost
class ParseHostTest(unittest.TestCase):
def test_parsehost(self):
# Test domain
result = parsehost('http://amon.cx')
assert result.__dict__ == {'scheme': 'http', 'host': 'http://amon.cx', 'hostname': '... | 1,378 | Python | .py | 23 | 51.565217 | 138 | 0.601949 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,037 | models.py | amonapp_amon/amon/apps/_healthchecks/models.py | import hashlib
from amon.apps.core.basemodel import BaseModel
from amon.utils.dates import unix_utc_now
from amon.utils import AmonStruct
from operator import itemgetter
from amon.apps.servers.models import server_model
from datetime import datetime, timedelta
class HealthChecksResultsModel(BaseModel):
def... | 7,683 | Python | .py | 170 | 31.876471 | 109 | 0.549431 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,038 | urls.py | amonapp_amon/amon/apps/_healthchecks/urls.py | from django.conf.urls import url
from amon.apps.healthchecks import views
urlpatterns = (
url(r'^$', views.view, name='healthchecks_view'),
url(r'^delete/(?P<check_id>\w+)/$', views.delete, name='delete_healthcheck'),
)
| 230 | Python | .py | 6 | 35.666667 | 81 | 0.707207 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,039 | views.py | amonapp_amon/amon/apps/_healthchecks/views.py | from amon.apps.core.views import *
from amon.utils.dates import unix_utc_now
from amon.apps.healthchecks.models import health_checks_model
@login_required
def view(request):
now = unix_utc_now()
sort_by = request.GET.get('sort_by')
filter_by = request.GET.get('filter_by')
result = health_checks_mo... | 844 | Python | .py | 22 | 32.863636 | 86 | 0.690506 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,040 | models_test.py | amonapp_amon/amon/apps/_healthchecks/tests/models_test.py | import unittest
import hashlib
from datetime import datetime
from amon.apps.healthchecks.models import (
health_checks_model,
health_checks_results_model,
health_checks_api_model
)
from amon.apps.servers.models import server_model
from amon.utils.dates import unix_utc_now
class HealthChecksResultsMode... | 7,785 | Python | .py | 151 | 41.238411 | 150 | 0.628125 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,041 | models.py | amonapp_amon/amon/apps/dashboards/models.py | from operator import itemgetter
from django.urls import reverse
from amon.apps.core.basemodel import BaseModel
from amon.apps.api.utils import generate_api_key
from amon.utils.dates import unix_utc_now
from amon.templatetags.charts import yaxis
from amon.apps.processes.models import process_model
from amon.apps.serve... | 13,523 | Python | .py | 260 | 39.273077 | 140 | 0.561949 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,042 | urls.py | amonapp_amon/amon/apps/dashboards/urls.py | from django.conf.urls import url
from amon.apps.dashboards import views
from amon.apps.dashboards import api
urlpatterns = (
url(r'^$', views.index, name='dashboards'),
url(r'^create/$', views.create_dashboard, name='create_dashboard'),
url(r'^edit/(?P<dashboard_id>\w+)/$', views.edit_dashboard, name='ed... | 1,600 | Python | .py | 23 | 64.956522 | 115 | 0.677522 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,043 | api.py | amonapp_amon/amon/apps/dashboards/api.py | from amon.apps.servers.models import server_model
from django.contrib.auth.decorators import login_required
from amon.apps.dashboards.models import dashboard_model, dashboard_metrics_model
from rest_framework.decorators import api_view
from rest_framework.response import Response
from amon.apps.system.views import ge... | 5,138 | Python | .py | 125 | 35.736 | 128 | 0.700948 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,044 | tests.py | amonapp_amon/amon/apps/dashboards/tests.py | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
Replace this with more appropriate tests for your application.
"""
from django.test import TestCase
class SimpleTest(TestCase):
def test_basic_addition(self):
"""
Tests that 1 + 1 a... | 383 | Python | .py | 12 | 27.583333 | 79 | 0.705722 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,045 | views.py | amonapp_amon/amon/apps/dashboards/views.py | from django.shortcuts import render
from django.contrib import messages
from django.shortcuts import redirect
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from django.http import Http404
from amon.apps.dashboards.models import dashboard_model, dashboard_metrics_model
from a... | 5,598 | Python | .py | 140 | 33.157143 | 130 | 0.668886 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,046 | models_test.py | amonapp_amon/amon/apps/dashboards/tests/models_test.py | import unittest
from nose.tools import *
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.dashboards.models import dashboard_model, dashboard_metrics_model
from amon.apps.plugins.models import plugin_model
class DashboardModelTest(unittest.TestCase):
def setUp(self):
... | 14,160 | Python | .py | 262 | 41.969466 | 155 | 0.602434 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,047 | api_test.py | amonapp_amon/amon/apps/dashboards/tests/api_test.py | import json
from django.test.client import Client
from django.urls import reverse
from django.test import TestCase
from nose.tools import *
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.dashboards.models import dashboard_model, dashboard_metrics_model
from amon.apps.plugins.mode... | 8,870 | Python | .py | 170 | 40.711765 | 113 | 0.612973 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,048 | views_test.py | amonapp_amon/amon/apps/dashboards/tests/views_test.py | from django.test.client import Client
from django.urls import reverse
from django.test import TestCase
from nose.tools import *
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.dashboards.models import dashboard_model
class TestDashboardUrls(TestCase):
def setUp(self):
... | 2,902 | Python | .py | 63 | 36.349206 | 115 | 0.642175 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,049 | models.py | amonapp_amon/amon/apps/_tags/models.py | from operator import itemgetter
from amon.apps.core.basemodel import BaseModel
class TagsModel(BaseModel):
def __init__(self):
super(TagsModel, self).__init__()
self.collection = self.mongo.get_collection('tags')
def get_for_group(self, group_id):
group_id = self.object_id(group_id)
... | 5,204 | Python | .py | 126 | 28.928571 | 91 | 0.53876 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,050 | urls.py | amonapp_amon/amon/apps/_tags/urls.py | from django.conf.urls import url
from django.views.generic import TemplateView
from amon.apps.tags import api
urlpatterns = [
url(r'^$', TemplateView.as_view(template_name="tags/view.html"), name='tags'),
url(r'^$', TemplateView.as_view(template_name="tags/view.html"), name='view_tags'),
url(r'^groups/$',... | 1,118 | Python | .py | 34 | 26.970588 | 97 | 0.633396 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,051 | api.py | amonapp_amon/amon/apps/_tags/api.py | from operator import itemgetter
from django.contrib.auth.decorators import login_required
from rest_framework.decorators import api_view
from rest_framework.response import Response
from amon.apps.tags.models import tags_model
from amon.apps.servers.models import server_model
def _tag_dict__repr__(tag=None):
r... | 2,686 | Python | .py | 80 | 27.2625 | 75 | 0.620031 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,052 | models_test.py | amonapp_amon/amon/apps/_tags/tests/models_test.py | import unittest
from nose.tools import eq_
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.tags.models import tags_model, tag_groups_model
class TagsModelTest(unittest.TestCase):
def setUp(self):
self.user = User.objects.create_user(password='qwerty', email='foo@t... | 2,483 | Python | .py | 56 | 35.035714 | 85 | 0.63133 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,053 | api_test.py | amonapp_amon/amon/apps/_tags/tests/api_test.py | import json
from django.test.client import Client
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from amon.apps.tags.models import tags_model
from amon.apps.servers.models import server_model
User = get_user_model()
class TestTagsApi(TestCase):
... | 3,298 | Python | .py | 70 | 38.3 | 131 | 0.626068 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,054 | models.py | amonapp_amon/amon/apps/users/models.py | from django.db import models
from django.conf import settings
from django.contrib.auth.models import (
AbstractBaseUser,
BaseUserManager,
PermissionsMixin
)
from django.utils import timezone
from datetime import datetime, timedelta
from amon.utils.generators import random_id_generator
class Amon... | 2,502 | Python | .py | 64 | 31.0625 | 80 | 0.667499 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,055 | emails.py | amonapp_amon/amon/apps/users/emails.py | from django.template.loader import render_to_string
from amon.apps.notifications.mail.sender import _send_email
from django.conf import settings
def send_invitation_email(invite):
if invite:
recipients_list = [invite['email']]
subject = 'You have been invited to join Amon.'
... | 1,058 | Python | .py | 25 | 31.04 | 79 | 0.626543 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,056 | urls.py | amonapp_amon/amon/apps/users/urls.py | from django.conf.urls import url
from amon.apps.users import views
# urlpatterns = [
# url(r'^$', views.view_users, name='view_users'),
# url(r'^revoke_access/(?P<user_id>\w+)/$', views.revoke_access, name='users_revoke_access'),
# url(r'^remove_pending/(?P<invitation_id>\w+)/$', views.remove_pendi... | 468 | Python | .py | 8 | 56.25 | 109 | 0.66302 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,057 | decorators.py | amonapp_amon/amon/apps/users/decorators.py | from functools import wraps
from django.urls import reverse
from django.shortcuts import redirect
def user_is_admin(view):
@wraps(view)
def inner(request, *args, **kwargs):
if request.user.is_authenticated():
pass
# if request.role.type != 'Admin':
# return redi... | 411 | Python | .py | 12 | 27.333333 | 51 | 0.647959 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,058 | forms.py | amonapp_amon/amon/apps/users/forms.py | import hashlib
import uuid
from django import forms
from annoying.functions import get_object_or_None
from django.contrib.auth import get_user_model
from amon.utils.dates import unix_utc_now
from amon.apps.users.models import invite_model
User = get_user_model()
class InviteForm(forms.Form):
... | 2,772 | Python | .py | 57 | 37.859649 | 111 | 0.6433 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,059 | views.py | amonapp_amon/amon/apps/users/views.py | # from django.shortcuts import redirect
# from django.urls import reverse
# from django.shortcuts import render
# from django.contrib.auth.decorators import login_required
# from django.contrib import messages
# from django.http import Http404
# from django.conf import settings
# from django.contrib.auth.decorat... | 2,919 | Python | .py | 65 | 41.276923 | 128 | 0.654308 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,060 | 0002_amonuser_organizations.py | amonapp_amon/amon/apps/users/migrations/0002_amonuser_organizations.py | # Generated by Django 2.0.2 on 2018-02-19 20:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organizations', '__first__'),
('users', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='amonuser',
... | 444 | Python | .py | 14 | 24.357143 | 74 | 0.616471 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,061 | 0001_initial.py | amonapp_amon/amon/apps/users/migrations/0001_initial.py | # -*- coding: utf-8 -*-
# Generated by Django 1.9.12 on 2017-01-05 10:03
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0007_alter_validators_add_error_mes... | 1,939 | Python | .py | 31 | 51.806452 | 266 | 0.641956 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,062 | 0003_resetpasswordcode.py | amonapp_amon/amon/apps/users/migrations/0003_resetpasswordcode.py | # Generated by Django 2.0.2 on 2018-02-21 19:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('users', '0002_amonuser_organizations'),
]
operations ... | 958 | Python | .py | 21 | 36.952381 | 159 | 0.651288 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,063 | forms_test.py | amonapp_amon/amon/apps/users/tests/forms_test.py | from django.test.client import Client
from django.urls import reverse
from django.test import TestCase
from nose.tools import *
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.users.forms import InviteForm
from amon.apps.users.models import invite_model
class Te... | 3,007 | Python | .py | 57 | 42.719298 | 96 | 0.648298 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,064 | views_test.py | amonapp_amon/amon/apps/users/tests/views_test.py | from django.test.client import Client
from django.urls import reverse
from django.test import TestCase
from nose.tools import *
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.users.models import invite_model
from amon.apps.notifications.mail.models import email_model
... | 2,243 | Python | .py | 49 | 34.897959 | 86 | 0.633946 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,065 | views.py | amonapp_amon/amon/apps/_core/views.py | from django.shortcuts import render_to_response
from django.shortcuts import render
from django.template import RequestContext
from django.contrib.auth.decorators import login_required
from django.urls import reverse
from django.shortcuts import redirect
from django.contrib import messages
from django.conf import setti... | 355 | Python | .py | 9 | 38.555556 | 57 | 0.881844 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,066 | cron.py | amonapp_amon/amon/apps/alerts/cron.py | import kronos
import logging
logger = logging.getLogger(__name__)
from amon.apps.alerts.alerter import notsendingdata_alerter
@kronos.register('* * * * *')
def check_not_sending_data_task():
notsendingdata_alerter.check()
logger.debug('Checking for servers that do not send data ...') | 298 | Python | .py | 8 | 34.625 | 66 | 0.743945 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,067 | alerter.py | amonapp_amon/amon/apps/alerts/alerter.py | from amon.apps.alerts.checkers.system import system_alerts
from amon.apps.alerts.checkers.process import process_alerts
from amon.apps.alerts.checkers.plugin import plugin_alerts
from amon.apps.alerts.checkers.healthcheck import healthcheck_alert_checker
from amon.apps.alerts.models import alerts_model
from amon.apps.... | 6,829 | Python | .py | 132 | 39.287879 | 144 | 0.602411 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,068 | urls.py | amonapp_amon/amon/apps/alerts/urls.py | from django.conf.urls import url
from amon.apps.alerts.views import alerts as alert_views
from amon.apps.alerts.views import pause as pause_views
from amon.apps.alerts.views import healthchecks as healthcheck_views
from amon.apps.alerts import api
urlpatterns = [
url(
r'^$',
alert_views.all,
... | 2,493 | Python | .py | 98 | 18.632653 | 68 | 0.56717 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,069 | api.py | amonapp_amon/amon/apps/alerts/api.py | from django.contrib.auth.decorators import login_required
from django.conf import settings
from rest_framework.decorators import api_view
from rest_framework.response import Response
from amon.apps.alerts.models import alerts_api_model
from amon.apps.healthchecks.models import health_checks_api_model
@login_required... | 1,895 | Python | .py | 50 | 31.7 | 85 | 0.673481 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,070 | forms.py | amonapp_amon/amon/apps/alerts/forms.py | from django import forms
from django.conf import settings
from django.urls import reverse
from amon.apps.servers.models import server_model
from amon.apps.tags.models import tags_model
from amon.apps.alerts.models import alert_mute_servers_model
ABOVE_BELOW_CHOICES = (
('above', 'More than'),
('below', 'Les... | 5,278 | Python | .py | 116 | 37.431034 | 123 | 0.598537 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,071 | plugin.py | amonapp_amon/amon/apps/alerts/checkers/plugin.py | class PluginAlerts(object):
def __init__(self):
self.alert = {}
def check_value(self, rule=None, incoming_value=None):
trigger = False
if rule['above_below'] == 'above':
if float(incoming_value) > float(rule['metric_value']):
trigger = True
if rul... | 1,575 | Python | .py | 32 | 37.34375 | 99 | 0.568498 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,072 | process.py | amonapp_amon/amon/apps/alerts/checkers/process.py | class ProcessAlerts(object):
def __init__(self):
self.alert = {}
def check(self, data, rule=None):
value = rule.get("check") if rule.get('check') else rule.get('metric')
value = value.lower()
if value == 'memory':
self.check_memory(rule, data)
if va... | 1,373 | Python | .py | 31 | 32.129032 | 88 | 0.542587 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,073 | system.py | amonapp_amon/amon/apps/alerts/checkers/system.py | class SystemAlerts(object):
def __init__(self):
self.alerts = {}
def check(self, data=None, rules=None, server=None):
if rules:
for rule in rules:
if rule['metric'] == 'CPU':
cpu_data = data.get('cpu', None)
if cpu_data:
... | 8,895 | Python | .py | 219 | 27.424658 | 101 | 0.497088 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,074 | healthcheck.py | amonapp_amon/amon/apps/alerts/checkers/healthcheck.py | class HealthCheckAlertChecker(object):
def check(self, data=None, rule=None):
self.alert = False
exit_codes = {0: "ok", 1: "warning", 2: "critical"}
data_command_full = data.get("command", "")
data_command_list = data_command_full.split(" ")
if len(data_command_list) > 0:
... | 1,667 | Python | .py | 39 | 29.74359 | 82 | 0.539185 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,075 | system_test.py | amonapp_amon/amon/apps/alerts/checkers/tests/system_test.py | from amon.apps.alerts.checkers.system import SystemAlerts
from nose.tools import eq_
import unittest
class SystemAlertsTest(unittest.TestCase):
def check_memory_test(self):
system_alerts = SystemAlerts()
data = {u'free_mb': 1, u'total_mb': 102, u'used_mb': 101}
rule = {'metric_value': 100,... | 10,763 | Python | .py | 182 | 49.752747 | 125 | 0.576963 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,076 | process_test.py | amonapp_amon/amon/apps/alerts/checkers/tests/process_test.py | from amon.apps.alerts.checkers.process import ProcessAlerts
from nose.tools import eq_
import unittest
class ProcessAlertsTest(unittest.TestCase):
def setUp(self):
self.process_alerts = ProcessAlerts()
def check_memory_test(self):
data = {u'm': u'40.0', u'time': 1327169023}
rule = {'... | 1,412 | Python | .py | 24 | 50.958333 | 131 | 0.594457 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,077 | plugin_test.py | amonapp_amon/amon/apps/alerts/checkers/tests/plugin_test.py | from amon.apps.alerts.checkers.plugin import PluginAlerts
from nose.tools import eq_
import unittest
class PluginAlertsTest(unittest.TestCase):
def setUp(self):
self.plugin_alerts = PluginAlerts()
def check_test(self):
data = {u'myplugin.test_above': u'40.0', u'time': 1327169023}
rul... | 835 | Python | .py | 15 | 48.933333 | 130 | 0.63145 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,078 | healthcheck_test.py | amonapp_amon/amon/apps/alerts/checkers/tests/healthcheck_test.py | from amon.apps.alerts.checkers.healthcheck import HealthCheckAlertChecker
from nose.tools import eq_
import unittest
class HealthChecksAlertsTest(unittest.TestCase):
def setUp(self):
self.health_check_alerts = HealthCheckAlertChecker()
def test_check_invalid(self):
# Alert for specific check... | 2,817 | Python | .py | 72 | 24.972222 | 89 | 0.4705 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,079 | mute.py | amonapp_amon/amon/apps/alerts/models/mute.py | from datetime import datetime, timedelta
from amon.apps.core.basemodel import BaseModel
from amon.utils.dates import datetime_to_unixtime
from amon.apps.tags.models import tags_model
from amon.apps.servers.models import server_model
class AlertMuteServersModel(BaseModel):
def __init__(self):
super(AlertM... | 2,138 | Python | .py | 47 | 34.595745 | 79 | 0.594103 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,080 | alertshistory.py | amonapp_amon/amon/apps/alerts/models/alertshistory.py | import math
from datetime import datetime, timedelta
from amon.apps.core.basemodel import BaseModel
from amon.apps.servers.models import server_model
from amon.utils.dates import unix_utc_now
from amon.apps.devices.models import volumes_model
from amon.apps.devices.models import interfaces_model
from amon.apps.healthc... | 9,539 | Python | .py | 186 | 37.231183 | 134 | 0.574053 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,081 | api.py | amonapp_amon/amon/apps/alerts/models/api.py | from amon.apps.core.basemodel import BaseModel
from amon.apps.processes.models import process_model
from amon.apps.plugins.models import plugin_model
from amon.apps.devices.models import volumes_model
from amon.apps.devices.models import interfaces_model
class AlertsAPIModel(BaseModel):
def __init__(self):
... | 5,794 | Python | .py | 111 | 38.036036 | 129 | 0.530387 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,082 | __init__.py | amonapp_amon/amon/apps/alerts/models/__init__.py | from amon.apps.alerts.models.alerts import AlertsModel
from amon.apps.alerts.models.alertshistory import AlertHistoryModel
from amon.apps.alerts.models.mute import AlertMuteServersModel
from amon.apps.alerts.models.api import AlertsAPIModel
alerts_model = AlertsModel()
alerts_history_model = AlertHistoryModel()
alert_... | 400 | Python | .py | 8 | 49 | 67 | 0.857143 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,083 | alerts.py | amonapp_amon/amon/apps/alerts/models/alerts.py | from django.conf import settings
from amon.apps.core.basemodel import BaseModel
from amon.apps.notifications.models import notifications_model
from amon.apps.tags.models import tags_model
from amon.apps.processes.models import process_model
from amon.apps.servers.models import server_model
from amon.apps.plugins.model... | 15,495 | Python | .py | 321 | 36.205607 | 119 | 0.573359 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,084 | mute_model_test.py | amonapp_amon/amon/apps/alerts/models/tests/mute_model_test.py | import unittest
from amon.apps.alerts.models import alert_mute_servers_model
from amon.apps.servers.models import server_model
from amon.apps.tags.models import tags_model
class MuteModelTest(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
alert_mute_servers_model.collection... | 2,240 | Python | .py | 57 | 29.947368 | 81 | 0.611085 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,085 | api_model_test.py | amonapp_amon/amon/apps/alerts/models/tests/api_model_test.py | import unittest
from nose.tools import eq_
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.alerts.models import AlertsAPIModel
from amon.apps.processes.models import process_model
from amon.apps.plugins.models import plugin_model
from amon.apps.devices.models import volumes_model... | 8,475 | Python | .py | 164 | 40.158537 | 153 | 0.600539 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,086 | alerts_history_model_test.py | amonapp_amon/amon/apps/alerts/models/tests/alerts_history_model_test.py | import unittest
from nose.tools import eq_
from amon.apps.alerts.models import AlertHistoryModel
class AlertsHistoryModelTest(unittest.TestCase):
def setUp(self):
self.model = AlertHistoryModel()
self.collection = self.model.mongo.get_collection('alert_history')
self.server_collection = ... | 3,471 | Python | .py | 79 | 33.455696 | 89 | 0.577376 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,087 | alerts_model_test.py | amonapp_amon/amon/apps/alerts/models/tests/alerts_model_test.py | import unittest
from nose.tools import eq_
from django.contrib.auth import get_user_model
from amon.apps.alerts.models import AlertsModel
from amon.apps.processes.models import process_model
from amon.apps.plugins.models import plugin_model
from amon.apps.servers.models import server_model
from amon.apps.devices.mode... | 13,755 | Python | .py | 316 | 31.797468 | 99 | 0.561584 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,088 | pause.py | amonapp_amon/amon/apps/alerts/views/pause.py | from amon.apps.core.views import *
from amon.apps.alerts.models import alerts_model
from amon.apps.alerts.forms import MuteForm
from amon.apps.alerts.models import alert_mute_servers_model
@login_required
def mute(request, alert_id):
alerts_model.mute(alert_id)
return redirect(reverse('alerts'))
@log... | 1,038 | Python | .py | 30 | 29.133333 | 60 | 0.703854 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,089 | healthchecks.py | amonapp_amon/amon/apps/alerts/views/healthchecks.py | from amon.apps.core.views import *
from amon.apps.servers.models import server_model
from amon.apps.alerts.models import alerts_model
from amon.apps.alerts.forms import HealthCheckAlertForm, EditHealthCheckAlertForm
from amon.apps.tags.models import tags_model
from amon.apps.notifications.models import notifications_... | 2,930 | Python | .py | 70 | 32.128571 | 96 | 0.611719 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,090 | alerts.py | amonapp_amon/amon/apps/alerts/views/alerts.py | from amon.apps.core.views import *
from amon.apps.servers.models import server_model
from amon.apps.alerts.models import alerts_model, alerts_history_model, alerts_api_model
from amon.apps.alerts.forms import AlertForm, EditAlertForm, MuteForm
from amon.apps.tags.models import tags_model
from amon.apps.notifications.... | 7,778 | Python | .py | 183 | 34.098361 | 149 | 0.631846 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,091 | alerts_test.py | amonapp_amon/amon/apps/alerts/views/tests/alerts_test.py | from django.test.client import Client
from django.test import TestCase
from django.urls import reverse
from nose.tools import *
from amon.apps.alerts.models import alerts_model
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.notifications.models import notifications_model
class ... | 10,209 | Python | .py | 255 | 28.545098 | 120 | 0.549729 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,092 | healthchecks_test.py | amonapp_amon/amon/apps/alerts/views/tests/healthchecks_test.py | from django.test.client import Client
from django.test import TestCase
from django.urls import reverse
from nose.tools import *
from amon.apps.alerts.models import alerts_model
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.notifications.models import notifications_model
class ... | 4,295 | Python | .py | 103 | 32.854369 | 87 | 0.569685 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,093 | alerter_test.py | amonapp_amon/amon/apps/alerts/tests/alerter_test.py | import unittest
from nose.tools import eq_
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.servers.models import server_model
from amon.apps.processes.models import process_model
from amon.apps.alerts.models import alerts_model, alerts_history_model
from amon.apps.alerts.alerter... | 10,967 | Python | .py | 251 | 33.665339 | 119 | 0.579985 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,094 | forms_test.py | amonapp_amon/amon/apps/alerts/tests/forms_test.py | from django.test.client import Client
from django.urls import reverse
from django.test import TestCase
from nose.tools import *
from django.contrib.auth import get_user_model
User = get_user_model()
from amon.apps.servers.models import server_model
from amon.apps.alerts.models import alert_mute_servers_model
from am... | 1,432 | Python | .py | 37 | 30.540541 | 85 | 0.647626 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,095 | models.py | amonapp_amon/amon/apps/_files/models.py | import gridfs
import tempfile
from amon.apps.core.basemodel import BaseModel
class FilesModel(BaseModel):
def __init__(self):
super(FilesModel, self).__init__()
self.fs = gridfs.GridFS(self.mongo.get_database(), collection='files')
def get_by_id(self, file_id=None):
file_id = self.ob... | 1,183 | Python | .py | 29 | 31.344828 | 78 | 0.640439 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,096 | models.py | amonapp_amon/amon/apps/map/models.py | import collections
from amon.apps.core.basemodel import BaseModel
from amon.apps.servers.models import server_model
from amon.apps.system.models import system_model
from amon.apps.devices.models import volumes_model, interfaces_model
from amon.apps.processes.models import process_model
from amon.apps.tags.models impor... | 6,869 | Python | .py | 148 | 32.432432 | 119 | 0.530225 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,097 | urls.py | amonapp_amon/amon/apps/map/urls.py | from django.conf.urls import url
from amon.apps.map import views
urlpatterns = (
url(r'^$', views.index, name='servers_map'),
)
| 134 | Python | .py | 5 | 24.6 | 48 | 0.724409 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,098 | views.py | amonapp_amon/amon/apps/map/views.py | from amon.apps.core.views import *
from amon.apps.servers.models import server_model
from amon.apps.map.models import map_model
from amon.apps.tags.models import tag_groups_model
@login_required
def index(request):
all_sort_fields = map_model.get_fields()
all_servers = server_model.get_all()
tag_groups ... | 1,330 | Python | .py | 33 | 32.69697 | 86 | 0.634871 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |
6,099 | models_test.py | amonapp_amon/amon/apps/map/tests/models_test.py | import unittest
from time import time
from amon.apps.servers.models import server_model
from amon.apps.map.models import map_model
from amon.apps.devices.models import interfaces_model, volumes_model
from amon.apps.processes.models import process_model
from amon.apps.system.models import system_model
from amon.apps.tag... | 8,580 | Python | .py | 210 | 27.8 | 84 | 0.502978 | amonapp/amon | 1,334 | 108 | 37 | AGPL-3.0 | 9/5/2024, 5:09:37 PM (Europe/Amsterdam) |