repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
philskillz-coder/discord-py-paginator
examples/with_config.py
from discord import app_commands, Embed, Color, Interaction from discord.ext.paginator import paginator from typing import Dict, Any class GuildPaginator(paginator.Paginator): CONFIG = { "quick_navigation_button_enabled": False # this paginator never uses quick nav by default } async def get_page...
philskillz-coder/discord-py-paginator
discord/ext/paginator/errors.py
class ViewException(Exception): def __init__(self, message: str) -> None: self.message = message class BetterException(ViewException): pass class ButtonException(BetterException): pass class ButtonFailed(ButtonException): pass class NotAuthor(ButtonException): pass class SelectException...
wwwennie/spectra_fit
main_raman.py
<reponame>wwwennie/spectra_fit #!/usr/bin/python # This module is for analyzing Raman spectra # It has the following capabilities # - Gaussian peak fitting # - First derivatives via finite difference # - Differential Raman spectroscopy # This file is the main driver for running things # Dependecies: # nump...
wwwennie/spectra_fit
dat_wo3.py
<reponame>wwwennie/spectra_fit<filename>dat_wo3.py #!/usr/bin/python #==============================# #========= USER INPUTS ========# #==============================# # take difference of two spectra, and interpolate file1 = "./example-data/wo3-side1.txt" file2 = "./example-data/wo3-side2.txt" # take first derivat...
wwwennie/spectra_fit
truncdata.py
#!/usr/bin/python # created by: <NAME> (<EMAIL>) # created on: 20 July 2016 import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d #==============================# #========= USER INPUTS ========# #==============================# def trunc_data(filename,min_index,max_index,outfile...
wwwennie/spectra_fit
finite_diff.py
<filename>finite_diff.py<gh_stars>1-10 #!/usr/bin/python # created by: <NAME> (<EMAIL>) # created on: 31 July 2016 import numpy as np import matplotlib.pyplot as plt def finite_diff(filename,outfile="out-finitediff.dat"): """ This file is for finding the first-order derivative of a set of data (i.e, Raman ...
wwwennie/spectra_fit
dat_sto.py
#!/usr/bin/python #========= USER INPUTS ========# #==============================# filefit = "./example-data/sto-raman-spectra.txt" typefit = 1 # 1 = Gaussian, 2 = Lorentzian, 3 = Voigt type fits shift = 20 # background shift #================ Initial guesses =================# # as nested dictionary # adapt t...
wwwennie/spectra_fit
fitpeaks.py
<gh_stars>1-10 #!/usr/bin/python # created by: <NAME> (<EMAIL>) # created on: 4 July 2016 import numpy as np import matplotlib.pyplot as plt from lmfit.models import GaussianModel,LorentzianModel,VoigtModel, ExponentialModel import time def fitpeaks(filename,initpar,typefit=1,shift=25): """ This file is for fi...
wwwennie/spectra_fit
interpdiff.py
<gh_stars>1-10 #!/usr/bin/python # created by: <NAME> (<EMAIL>) # created on: 7 July 2016 import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import interp1d def interpdiff(file1,file2, outfile="out-interpdiff.dat"): """ Takes difference of two Raman Spectra Requires interpolation sin...
wwwennie/spectra_fit
smooth.py
#!/usr/bin/python # created by: <NAME> (<EMAIL>) # created on: 31 July 2016 import numpy as np import matplotlib.pyplot as plt def smooth_spectra(y, box_pts): box = np.ones(box_pts)/box_pts y_smooth = np.convolve(y, box, mode='same') return y_smooth def smooth(filename,outfile="out-smooth.dat"): """...
tetienne/synologydsm-api
tests/test_synology_dsm.py
"""Synology DSM tests.""" from unittest import TestCase import pytest from . import SynologyDSMMock from . import USER_MAX_TRY from . import VALID_HOST from . import VALID_HTTPS from . import VALID_OTP from . import VALID_PASSWORD from . import VALID_PORT from . import VALID_USER from . import VALID_USER_2SA from . i...
tetienne/synologydsm-api
tests/test_synology_dsm_5.py
"""Synology DSM tests.""" from unittest import TestCase from . import SynologyDSMMock from . import VALID_HOST from . import VALID_HTTPS from . import VALID_OTP from . import VALID_PASSWORD from . import VALID_PORT from . import VALID_USER from . import VALID_USER_2SA from . import VALID_VERIFY_SSL from .const import ...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/semantic_scholar.py
<gh_stars>0 import asyncio import json from abc import ABC, abstractmethod from aiohttp import ClientSession, ClientResponseError from motor.motor_asyncio import AsyncIOMotorClient from aioredis import Redis from datetime import timedelta, date from collections import defaultdict from typing import Optional, List from...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/prev_cited_topic.py
<filename>arxivdigest_recommenders/prev_cited_topic.py import asyncio from elasticsearch import Elasticsearch from elasticsearch.helpers import bulk from arxivdigest.connector import ArxivdigestConnector from collections import defaultdict from typing import DefaultDict, Dict, Sequence from arxivdigest_recommenders.re...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/config.py
<gh_stars>0 import os import json from typing import List file_locations = [ os.curdir + "/config.json", os.path.expanduser("~") + "/arxivdigest-recommenders/config.json", "/etc/arxivdigest-recommenders/config.json", ] def get_config_from_file(file_paths: List[str]): """Checks the given list of file...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/prev_cited_collab.py
<gh_stars>0 import asyncio from collections import defaultdict from typing import DefaultDict, Dict, Any from arxivdigest_recommenders.recommender import ArxivdigestRecommender from arxivdigest_recommenders.semantic_scholar import SemanticScholar from arxivdigest_recommenders import config def explanation(author: di...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/weighted_inf.py
<gh_stars>0 import asyncio from collections import defaultdict from typing import List, Dict, DefaultDict import numpy as np from arxivdigest_recommenders.recommender import ArxivdigestRecommender from arxivdigest_recommenders.semantic_scholar import SemanticScholar from arxivdigest_recommenders.author_representation ...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/frequent_venues.py
import asyncio import numpy as np from typing import List, Dict from arxivdigest_recommenders.recommender import ArxivdigestRecommender from arxivdigest_recommenders.semantic_scholar import SemanticScholar from arxivdigest_recommenders.author_representation import venue_author_representation from arxivdigest_recommend...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/recommender.py
import asyncio from abc import ABC, abstractmethod from typing import List, Dict, Any, Sequence, Optional from arxivdigest.connector import ArxivdigestConnector from arxivdigest_recommenders import config from arxivdigest_recommenders.semantic_scholar import SemanticScholar from arxivdigest_recommenders.util import ex...
olafapl/arxivdigest_recommenders
tests/test_rate_limiter.py
<filename>tests/test_rate_limiter.py import unittest import time from arxivdigest_recommenders.util import AsyncRateLimiter class TestRateLimiter(unittest.IsolatedAsyncioTestCase): async def test_rate_limit(self): stamps = [] limiter = AsyncRateLimiter(1000, 2) while len(stamps) < 10000: ...
olafapl/arxivdigest_recommenders
setup.py
<filename>setup.py<gh_stars>0 from setuptools import setup, find_packages with open("requirements.txt") as file: install_requires = file.read().splitlines() setup( name="arxivdigest-recommenders", author="<NAME>", packages=find_packages(), install_requires=install_requires, )
olafapl/arxivdigest_recommenders
tests/test_author_representation.py
import unittest from arxivdigest_recommenders.author_representation import venue_author_representation author_papers = [ [{"venue": venue} for venue in ("a", "a", "b", "c", "d", "e", "f", "b")], [{"venue": "g"}], ] class TestAuthorRepresentation(unittest.TestCase): def test_venue_author_representation(s...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/venue_copub.py
import asyncio import random import numpy as np from typing import List, Dict from arxivdigest_recommenders.recommender import ArxivdigestRecommender from arxivdigest_recommenders.semantic_scholar import SemanticScholar from arxivdigest_recommenders.author_representation import venue_author_representation from arxivdi...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/author_representation.py
import numpy as np from typing import List, Dict, Any from arxivdigest_recommenders import config def venue_author_representation( venues: List[str], published_papers: List[Dict[str, Any]] ) -> np.ndarray: """Create an author vector representation based on the venues an author has published at. The retu...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/log.py
<filename>arxivdigest_recommenders/log.py import sys import logging from arxivdigest_recommenders import config LOG_LEVELS = { "FATAL": 50, "ERROR": 40, "WARNING": 30, "INFO": 20, "DEBUG": 10, } def get_logger(name: str, prefix: str): formatter = logging.Formatter( fmt="%(asctime)s [...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/prev_cited.py
<filename>arxivdigest_recommenders/prev_cited.py import asyncio from collections import defaultdict from typing import DefaultDict from arxivdigest_recommenders.recommender import ArxivdigestRecommender from arxivdigest_recommenders.semantic_scholar import SemanticScholar from arxivdigest_recommenders import config ...
olafapl/arxivdigest_recommenders
tests/test_venue_copub.py
import unittest from arxivdigest_recommenders.venue_copub import explanation from arxivdigest_recommenders import config authors = [[2, 2, 1, 1, 1, 1], [0, 0, 0, 0, 0, 0, 1]] users = [[4, 2, 0, 0, 3, 1], [1, 1, 0, 0, 0, 0]] venues = ["a", "b", "c", "d", "e", "f", "g"] class TestVenueCoPubRecommender(unittest.TestCa...
olafapl/arxivdigest_recommenders
arxivdigest_recommenders/util.py
import asyncio import time import numpy as np import numpy.typing as npt from urllib.parse import urlparse from typing import Optional, List, Tuple, Any, Sequence, TypeVar, Iterator T = TypeVar("T") def extract_s2_id(user: dict) -> Optional[str]: """Extract S2 ID from a user's Semantic Scholar profile link. ...
chrisguest75/py_coverage_example
binary_search_tree.py
class binary_search_tree(): def __init__(self, initial_value=None): self.left = None self.right = None self.value = initial_value def __len__(self): return self.num_nodes() def num_nodes(self): if self.value is None: return 0 else: ...
chrisguest75/py_coverage_example
test_binary_search_tree.py
<gh_stars>0 import pytest from binary_search_tree import binary_search_tree @pytest.fixture def empty_bst(): return binary_search_tree() def test_create_empty(empty_bst): bst = empty_bst assert(len(bst) == 0) assert(bst.num_nodes() == 0) def test_add_first_value(empty_bst): bst = empty_bst ...
ttan/Mute-o-Matic-V2
code.py
<reponame>ttan/Mute-o-Matic-V2 import board import time import usb_hid from digitalio import DigitalInOut, Direction, Pull from adafruit_hid.keyboard import Keyboard from adafruit_hid.keycode import Keycode switch = DigitalInOut(board.GP4) switch.direction = Direction.INPUT switch.pull = Pull.UP bt1 = DigitalInOut(b...
Drayang/ERPNext-Production-Scheduing
production_scheduling_shrdc/hooks.py
<reponame>Drayang/ERPNext-Production-Scheduing # -*- coding: utf-8 -*- from __future__ import unicode_literals from . import __version__ as app_version app_name = "production_scheduling_shrdc" app_title = "Production Scheduling Shrdc" app_publisher = "DCKY" app_description = "This is a production scheduling app." app_...
Drayang/ERPNext-Production-Scheduing
production_scheduling_shrdc/production_scheduling_shrdc/doctype/frepple_integration/frepple_integration.py
<filename>production_scheduling_shrdc/production_scheduling_shrdc/doctype/frepple_integration/frepple_integration.py # -*- coding: utf-8 -*- # Copyright (c) 2022, DCKY and contributors # For license information, please see license.txt from __future__ import unicode_literals # import frappe from frappe.model.document i...
Drayang/ERPNext-Production-Scheduing
production_scheduling_shrdc/production_scheduling_shrdc/doctype/production_scheduling_backend/production_scheduling_backend.py
# -*- coding: utf-8 -*- # Copyright (c) 2021, DCKY and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe, json from frappe import get_all, msgprint, _ from frappe.utils import add_to_date ,getdate,today,now #utils now and today is string form from frap...
Drayang/ERPNext-Production-Scheduing
production_scheduling_shrdc/overrides/sales_order.py
from erpnext.selling.doctype.sales_order.sales_order import SalesOrder from frappe import msgprint import frappe from frappe import _ class CustomSalesOrder(SalesOrder): def on_submit(self): self.my_custom_code() def validate(self): self.my_custom_code() def my_custom_code(self): ...
Drayang/ERPNext-Production-Scheduing
setup.py
# -*- coding: utf-8 -*- from setuptools import setup, find_packages with open("requirements.txt") as f: install_requires = f.read().strip().split("\n") # get version from __version__ variable in production_scheduling_shrdc/__init__.py from production_scheduling_shrdc import __version__ as version setup( name="prod...
Drayang/ERPNext-Production-Scheduing
production_scheduling_shrdc/production_scheduling_shrdc/doctype/frepple_setting/frepple_setting.py
<reponame>Drayang/ERPNext-Production-Scheduing<filename>production_scheduling_shrdc/production_scheduling_shrdc/doctype/frepple_setting/frepple_setting.py<gh_stars>0 # -*- coding: utf-8 -*- # Copyright (c) 2022, DCKY and contributors # For license information, please see license.txt from __future__ import unicode_lite...
Drayang/ERPNext-Production-Scheduing
production_scheduling_shrdc/event.py
from __future__ import unicode_literals from six import print_ import frappe import json from frappe.utils import cint, getdate, formatdate, today from frappe import throw, _ from frappe.model.document import Document @frappe.whitelist() def get_events(start, end, filters=None): """Returns events for Gantt / Calenda...
Drayang/ERPNext-Production-Scheduing
production_scheduling_shrdc/config/production_scheduling_shrdc.py
<reponame>Drayang/ERPNext-Production-Scheduing<gh_stars>0 from __future__ import unicode_literals from frappe import _ def get_data(): config = [ { "label": _("Production Scheduling"), "items": [ { "type": "doctype", "name": "P...
Drayang/ERPNext-Production-Scheduing
production_scheduling_shrdc/production_scheduling_shrdc/doctype/work_order_backend/work_order_backend.py
# -*- coding: utf-8 -*- # Copyright (c) 2021, DCKY and contributors # For license information, please see license.txt from __future__ import unicode_literals import frappe, json from frappe import msgprint, _ from frappe.utils import add_to_date ,getdate,today,now from frappe.utils import flt, cint, formatdate, comma_...
casassg/sonome
main.py
<reponame>casassg/sonome<gh_stars>0 #!./env/bin/python import cmd import json import os import random import mingus.core.scales as scales import requests import tweepy from mingus.containers import Track, Composition from mingus.midi import fluidsynth from tweepy import OAuthHandler, API BASE_DIR = os.path.dirname(o...
AnnieLan/Web
proyectodjango/Registro/admin.py
<gh_stars>0 from django.contrib import admin # Register your models here. from .models import ModelRegistro admin.site.register(ModelRegistro)
AnnieLan/Web
proyectodjango/Login/urls.py
<gh_stars>0 from django.contrib.auth import views as auth_view from Login.views import LandingClass from Login.views import LoginClass from Login.views import DashboardClass from django.urls import include, path, re_path app_name = 'Login' urlpatterns = [ path('', LandingClass.as_view(), name='Landing'), path...
AnnieLan/Web
proyectodjango/Login/models.py
from django.db import models # Create your models here. class Login (models.Model): nombre = models.CharField(max_length = 254,null=False) ap_pat = models.CharField(max_length = 254,null=False) ap_mat = models.CharField(max_length = 254,null=False) edad = models.IntegerField(null=False)
AnnieLan/Web
proyectodjango/Alumnos/migrations/0002_auto_20200226_2209.py
<gh_stars>0 # Generated by Django 3.0.3 on 2020-02-27 04:09 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('Alumnos', '0001_initial'), ] operations = [ migrations.AlterField( model_name='alumno', name='matricula'...
AnnieLan/Web
proyectodjango/Registro/models.py
<reponame>AnnieLan/Web from django.db import models # Create your models here. class ModelRegistro(models.Model): nombre = models.CharField(max_length = 254,null = False) edad = models.IntegerField(null=False) direccion = models.CharField(max_length = 254,null = False) genero = models.CharField(max_le...
AnnieLan/Web
proyectodjango/Almacen/admin.py
<gh_stars>0 from django.contrib import admin # Register your models here. from .models import Almacen admin.site.register(Almacen)
AnnieLan/Web
proyectodjango/Almacen/models.py
<filename>proyectodjango/Almacen/models.py from django.db import models # Create your models here. class Almacen(models.Model): nombre = models.CharField(max_length = 254,null = False) fechaProducto = models.CharField(max_length = 254,null = False) FechaCaducidad = models.CharField(max_length = 254,null =...
AnnieLan/Web
proyectodjango/Alumnos/migrations/0001_initial.py
<filename>proyectodjango/Alumnos/migrations/0001_initial.py # Generated by Django 3.0.3 on 2020-02-13 20:45 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateMod...
AnnieLan/Web
proyectodjango/Almacen/migrations/0001_initial.py
# Generated by Django 3.0.3 on 2020-02-13 20:26 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Almacen', fields=[ ('id', models.AutoField(...
AnnieLan/Web
proyectodjango/Alumnos/admin.py
<reponame>AnnieLan/Web from django.contrib import admin # Register your models here. from .models import Materia admin.site.register(Materia) from .models import Alumno admin.site.register(Alumno)
AnnieLan/Web
proyectodjango/Login/views.py
<filename>proyectodjango/Login/views.py from django.shortcuts import render, redirect from django.views.generic import View # Importar metodo de auntenticacion from django.contrib.auth import authenticate # Create your views here. def index (request): return render(request,'index.html') def landing (request): ...
AnnieLan/Web
proyectodjango/Alumnos/models.py
<gh_stars>0 from django.db import models # Create your models here. class Materia(models.Model): materia = models.CharField(max_length = 254,null = False) class Alumno (models.Model): materia = models.ForeignKey(Materia, on_delete=models.CASCADE) nombre = models.CharField(max_length = 254,null = False) ...
AnnieLan/Web
proyectodjango/Registro/apps.py
<filename>proyectodjango/Registro/apps.py from django.apps import AppConfig class RegistroConfig(AppConfig): name = 'Registro'
AnnieLan/Web
proyectodjango/Almacen/apps.py
<filename>proyectodjango/Almacen/apps.py from django.apps import AppConfig class AlmacenConfig(AppConfig): name = 'Almacen'
AnnieLan/Web
Scripts/django-admin.py
#!c:\users\danie\onedrive\escritorio\web\.proyecto\scripts\python.exe from django.core import management if __name__ == "__main__": management.execute_from_command_line()
citrix-openstack-build/python-ceilometerclient
ceilometerclient/v1/shell.py
<gh_stars>0 # Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # ...
citrix-openstack-build/python-ceilometerclient
ceilometerclient/v2/samples.py
<gh_stars>0 # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
citrix-openstack-build/python-ceilometerclient
ceilometerclient/tests/v2/test_alarms.py
# -*- encoding: utf-8 -*- # # Copyright © 2013 Red Hat, Inc # # Author: <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/L...
citrix-openstack-build/python-ceilometerclient
ceilometerclient/tests/v2/test_shell.py
<reponame>citrix-openstack-build/python-ceilometerclient # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
citrix-openstack-build/python-ceilometerclient
ceilometerclient/tests/v2/test_statistics.py
<reponame>citrix-openstack-build/python-ceilometerclient # Copyright 2012 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http...
citrix-openstack-build/python-ceilometerclient
ceilometerclient/v2/shell.py
<filename>ceilometerclient/v2/shell.py # -*- encoding: utf-8 -*- # # Copyright © 2013 Red Hat, Inc # # Author: <NAME> <<EMAIL>> # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
citrix-openstack-build/python-ceilometerclient
ceilometerclient/tests/test_utils.py
# Copyright 2013 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
akentner/home-assistant
homeassistant/components/nest/binary_sensor.py
"""Support for Nest Thermostat binary sensors.""" from itertools import chain import logging from homeassistant.components.binary_sensor import ( DEVICE_CLASS_SOUND, BinarySensorEntity, ) from homeassistant.const import CONF_MONITORED_CONDITIONS from . import CONF_BINARY_SENSORS, DATA_NEST, DATA_NEST_CONFIG, ...
ColOfAbRiX/cf-utils
cfutils/debug.py
<reponame>ColOfAbRiX/cf-utils #!/usr/bin/env python # # MIT License # # Copyright (c) 2017 <NAME> <<EMAIL>> # # 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, including wi...
ColOfAbRiX/cf-utils
cfutils/gitutils.py
<filename>cfutils/gitutils.py #!/usr/bin/env python # # MIT License # # Copyright (c) 2017 <NAME> <<EMAIL>> # # 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, including wi...
ColOfAbRiX/cf-utils
cfutils/execute.py
#!/usr/bin/env python # # MIT License # # Copyright (c) 2017 <NAME> <<EMAIL>> # # 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, including without limitation the rights # ...
ColOfAbRiX/cf-utils
cfutils/sysinfo.py
<filename>cfutils/sysinfo.py #!/usr/bin/env python # # MIT License # # Copyright (c) 2017 <NAME> <<EMAIL>> # # 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, including wit...
ColOfAbRiX/cf-utils
cfutils/common.py
#!/usr/bin/env python # # MIT License # # Copyright (c) 2017 <NAME> <<EMAIL>> # # 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, including without limitation the rights # ...
ColOfAbRiX/cf-utils
setup.py
<gh_stars>0 #!/usr/bin/env python # # MIT License # # Copyright (c) 2017 <NAME> <<EMAIL>> # # 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, including without limitation t...
ColOfAbRiX/cf-utils
cfutils/formatting.py
#!/usr/bin/env python # # MIT License # # Copyright (c) 2017 <NAME> <<EMAIL>> # # 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, including without limitation the rights # ...
openedx/edx-repo-health
repo_health/check_django_dependencies_compatibility.py
<gh_stars>1-10 """ contains check that reads/parses dependencies of a repo """ import csv import json import logging import os import re import tempfile from pathlib import Path from packaging.version import parse import pytest import requests from pytest_repo_health import health_metadata from repo_health import ge...
openedx/edx-repo-health
repo_health/check_github_integration.py
<gh_stars>1-10 """ Checks repository is on github actions workflow and tests are enabled. """ import json import logging import os import re import requests from pytest_repo_health import add_key_to_metadata logger = logging.getLogger(__name__) module_dict_key = "github_actions" URL_PATTERN = r"github.com[/:](?P<o...
openedx/edx-repo-health
tests/test_check_renovate.py
<reponame>openedx/edx-repo-health import os from repo_health.check_renovate import ( check_renovate, MODULE_DICT_KEY, ) from unittest import mock, TestCase def get_repo_path(repo_name): tests_directory = os.path.dirname(__file__) return f"{tests_directory}/fake_repos/{repo_name}" async def mocked_re...
openedx/edx-repo-health
repo_health/check_makefile.py
<filename>repo_health/check_makefile.py """ Checks to see if Makefile follows standards """ import re import os import pytest from pytest_repo_health import health_metadata from repo_health import get_file_content module_dict_key = "makefile" output_keys = { "upgrade": "target that upgrades our dependencies to n...
openedx/edx-repo-health
repo_health/check_docs.py
<reponame>openedx/edx-repo-health """ Check some details of Read The Docs integration. """ import json import logging import os.path import re import pytest import requests import yaml from pytest_repo_health import health_metadata from repo_health import fixture_readme, get_file_content # pylint: disable=unused-im...
openedx/edx-repo-health
repo_health/check_ownership.py
""" Checks to fetch repository ownership information from the Google Sheets speadsheet. """ import logging import re import os import gspread import pytest from pytest_repo_health import health_metadata from pytest_repo_health.fixtures.github import URL_PATTERN logger = logging.getLogger(__name__) MODULE_DICT_KEY = ...
openedx/edx-repo-health
repo_health/check_readme.py
""" Check some details in the readme file. """ import re import urllib.parse import requests from pytest_repo_health import health_metadata from repo_health import fixture_readme # pylint:disable=unused-import module_dict_key = "readme" # Good things should be there, and are True if they are present. GOOD_THINGS ...
openedx/edx-repo-health
tests/test_check_github_integration.py
<gh_stars>1-10 import os from repo_health.check_github_integration import check_github_actions_integration, module_dict_key from unittest import mock class MockResponse: def __init__(self, content, status_code): self.content = content self.status_code = status_code def json(self): re...
openedx/edx-repo-health
tests/test_check_makefile.py
import os import pytest from repo_health.check_makefile import ( module_dict_key, check_has_make_target, output_keys, ) def get_repo_path(repo_name): tests_directory = os.path.dirname(__file__) return f"{tests_directory}/{repo_name}" @pytest.mark.parametrize("fake_repo, flag_list", [ ("make...
openedx/edx-repo-health
repo_health/check_existence.py
<filename>repo_health/check_existence.py """ Functions to check the existence of files. """ from pytest_repo_health import health_metadata from .utils import dir_exists, file_exists module_dict_key = "exists" req_files = { "openedx.yaml": "openedx.yaml contains repository metadata as outlined in OEP-2", "M...
openedx/edx-repo-health
tests/test_check_docs.py
<gh_stars>1-10 import os import pytest import responses import json from repo_health.check_docs import check_build_bagde, check_python_version, module_dict_key, ReadTheDocsChecker def get_repo_path(repo_name): tests_directory = os.path.dirname(__file__) return f"{tests_directory}/{repo_name}" @pytest.mark....
openedx/edx-repo-health
repo_health/__init__.py
<gh_stars>0 """ This package contains checks for edx repo standards """ import codecs import os from configparser import ConfigParser import glob import pytest import dockerfile __version__ = "0.2.3" GITHUB_URL_PATTERN = r"github.com[/:](?P<org_name>[^/]+)/(?P<repo_name>[^/]+).*#egg=(?P<package>[^\/]+).*" PYPI_PACKA...
openedx/edx-repo-health
tests/test_check_ownership.py
import csv import os from repo_health.check_ownership import check_ownership, MODULE_DICT_KEY from unittest import mock, TestCase def mocked_responses(*args, **kwargs): current_dir = os.path.dirname(__file__) with open(os.path.join(current_dir, 'data/ownership_data.csv'), 'r') as csv_file: file_dat...
openedx/edx-repo-health
tests/test_check_travis_yml.py
import os import pytest from repo_health.check_travis_yml import ( check_yaml_parsable, check_has_tests_with_py38, check_travis_python_versions, fixture_parsed_data, fixture_python_version, fixture_travis_yaml, module_dict_key ) def get_repo_path(repo_name): tests_directory = os.path....
openedx/edx-repo-health
repo_health_dashboard/utils/utils.py
""" utils used to create dashboard """ import csv import html import os def squash_dict(input_dict, delimiter="."): """ Takes very nested dict(metadata_by_repo inside of metadata_by_repo) and squashes it to only one level For example: for input: {'a':{'b':'1', 'c':{'d':'2'}, 'f':[1,2,3]}, 'e':2} t...
openedx/edx-repo-health
tests/test_check_github.py
#!/usr/bin/env python3 """Testing functions in repo_health/check_github.py""" from unittest.mock import Mock from repo_health.check_github import ( check_settings, MODULE_DICT_KEY, repo_license_exemptions, ) async def test_check_settings_license_exemption_present(): """ Test to make sure having ...
openedx/edx-repo-health
tests/test_check_readme.py
<gh_stars>1-10 import re from unittest.mock import patch import requests import responses from repo_health.check_readme import check_readme_links, module_dict_key @responses.activate def test_one_good_one_bad(): # If you attempt to fetch a url which isn't registered, responses will raise a ConnectionError: ...
openedx/edx-repo-health
tests/test_check_openedx_yaml.py
import os import pytest from repo_health.check_openedx_yaml import ( check_oeps, check_obsolete_fields, check_release_maybe, check_release_ref, check_yaml_parsable, module_dict_key, fixture_openedx_yaml, fixture_oeps, fixture_parsed_data, output_keys, obsolete_fields, ) de...
openedx/edx-repo-health
tests/test_ubuntu_dependencies.py
<filename>tests/test_ubuntu_dependencies.py import os from repo_health.check_ubuntufiles import get_apt_get_txt, get_docker_file_content def get_repo_path(repo_name): tests_directory = os.path.dirname(__file__) return f"{tests_directory}/{repo_name}" def test_loading_docker_file_check(): repo_path = ge...
openedx/edx-repo-health
tests/test_check_dependencies.py
import os from repo_health.check_dependencies import get_dependencies def get_repo_path(repo_name): tests_directory = os.path.dirname(__file__) return f"{tests_directory}/{repo_name}" def test_python_js_repo_dependency_check(): repo_path = get_repo_path('fake_repos/python_js_repo') dependencies = g...
openedx/edx-repo-health
repo_health/check_npm_package.py
""" Checks package published name on npm. """ import json import os import pytest from pytest_repo_health import health_metadata from repo_health import get_file_content module_dict_key = "npm_package" def get_dependencies(repo_path): """ entry point to read parse and read dependencies @param repo_path: ...
openedx/edx-repo-health
tests/test_npm_package_name.py
import os from repo_health.check_npm_package import get_dependencies, check_npm_package, module_dict_key def get_repo_path(repo_name): tests_directory = os.path.dirname(__file__) return f"{tests_directory}/{repo_name}" def test_valid_npm_package_name(): repo_path = get_repo_path('fake_repos/js_repo') ...
openedx/edx-repo-health
repo_health/check_dependencies.py
""" contains check that reads/parses dependencies of a repo """ import copy import json import logging import os import re from abc import ABC, abstractmethod from pathlib import Path from pytest_repo_health import health_metadata from repo_health import get_file_lines, get_file_content logger = logging.getLogger(_...
openedx/edx-repo-health
tests/test_check_ubuntufiles.py
import os import re import pytest from repo_health.check_ubuntufiles import PlaybookAPTPackagesReader, VARIABLE_PATTERN def get_repo_path(repo_name): tests_directory = os.path.dirname(__file__) return f"{tests_directory}/{repo_name}" def test_playbooks_apt_reader(): repo_path = get_repo_path('fake_rep...
openedx/edx-repo-health
tests/test_check_tox_ini.py
import os import pytest from repo_health.check_tox_ini import ( module_dict_key, check_has_sections, check_whitelist_externals, fixture_tox_ini, ) def get_repo_path(repo_name): tests_directory = os.path.dirname(__file__) return f"{tests_directory}/fake_repos/{repo_name}" @pytest.mark.parame...
openedx/edx-repo-health
setup.py
<reponame>openedx/edx-repo-health #!/usr/bin/env python """ Package metadata for repo_health. """ import os import re import sys from setuptools import setup def get_version(file_path): """ Extract the version string from the file at the given relative path fragments. """ filename = os.path.join(os.p...
openedx/edx-repo-health
tests/test_check_existence.py
import os import pytest from repo_health.check_existence import ( check_readme_existence, check_dir_existence, check_file_existence, check_path_existence, req_dirs, req_files, req_paths, module_dict_key, check_transifex_config_existence ) def get_repo_path(repo_name): tests_di...
openedx/edx-repo-health
tests/test_check_requirements.py
import os import pytest import pdb from repo_health.check_requirements import ( fixture_req_lines, module_dict_key, check_requires, ) def get_repo_path(repo_name): tests_directory = os.path.dirname(__file__) return f"{tests_directory}/fake_repos/{repo_name}" @pytest.mark.parametrize("repo_path, ...
openedx/edx-repo-health
tests/test_check_django_deps.py
<gh_stars>1-10 import os import pytest from repo_health.check_django_dependencies_compatibility import ( DjangoDependencyReader, MODULE_DICT_KEY, check_django_dependencies_status, ) TEST_CSV_PATH = os.path.join(os.path.dirname(__file__), 'data/mock_django_dependencies_sheet.csv') def get_repo_path(repo_...