repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
makinacorpus/ionyweb
ionyweb/administration/views/users.py
<gh_stars>1-10 # -*- coding: utf-8 -*- from ionyweb.administration.views import IsAdminView from djangorestframework.response import Response, ErrorResponse from djangorestframework import status from ionyweb.administration.utils import MESSAGES from ionyweb.authentication.forms import EditCurrentUser from django.temp...
makinacorpus/ionyweb
ionyweb/website/rendering/__init__.py
# -*- coding: utf-8 -*- import os from django.conf import settings from django.contrib.contenttypes.models import ContentType from django.template import RequestContext from django.template.loader import render_to_string from ionyweb.utils import ContentTypeAccessor as CTA from ionyweb.website.utils import main_menu...
makinacorpus/ionyweb
ionyweb/widgets.py
<filename>ionyweb/widgets.py # -*- coding: utf-8 -*- import floppyforms as forms import datetime from django.conf import settings from tinymce.widgets import TinyMCE class DatePicker(forms.TextInput): template_name = 'floppyforms/date.html' format="%d/%m/%Y" def render(self, name, value, attrs=None): ...
makinacorpus/ionyweb
demos/demoproject/settings.py
<gh_stars>1-10 # -*- coding: utf-8 -*- # Django settings for the demoproject project. from ionyweb import get_ionyweb_path from ionyweb.settings import * import os ABSOLUTE_PATH = os.getcwd() DEBUG = True TEMPLATE_DEBUG = DEBUG ADMINS = ( ('<NAME>', '<EMAIL>'), ('<NAME>', '<EMAIL>'), ('<NAME>', '<EMAI...
makinacorpus/ionyweb
ionyweb/administration/permissions.py
<filename>ionyweb/administration/permissions.py # -*- coding: utf-8 -*- from djangorestframework.permissions import BasePermission from djangorestframework import status from djangorestframework.response import ErrorResponse _400_BAD_REQUEST = ErrorResponse( status.HTTP_400_BAD_REQUEST, {'detail': 'Bad reques...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_image/forms.py
# -*- coding: utf-8 -*- import floppyforms as forms from ionyweb.forms import ModuloModelForm from models import Plugin_Image from ionyweb.file_manager.widgets import FileManagerWidget class Plugin_ImageForm(ModuloModelForm): class Meta: model = Plugin_Image widgets = { 'image': FileM...
makinacorpus/ionyweb
ionyweb/administration/views/page.py
# -*- coding: utf-8 -*- from ionyweb.administration.views import IsAdminView from djangorestframework.response import Response from djangorestframework import status # from django.contrib.contenttypes.models import ContentType from django.shortcuts import get_object_or_404 from django.template.loader import render_to...
makinacorpus/ionyweb
ionyweb/page_app/page_redirect/models.py
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from ionyweb.page.models import AbstractPageApp class PageApp_Redirect(AbstractPageApp): url = models.URLField() def __unicode__(self): return u'Redirect #%d' % (self.pk) class Meta:...
makinacorpus/ionyweb
ionyweb/page_app/page_blog/migrations/0001_initial.py
# encoding: utf-8 import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'PageApp_Blog' db.create_table('page_blog_pageapp_blog', ( ('id', self.gf('djan...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_slideshow/views.py
# -*- coding: utf-8 -*- from django.conf import settings from ionyweb.website.rendering.medias import * from ionyweb.website.rendering.utils import render_view RENDER_MEDIAS = ( JSMedia('ionyweb.timer.js'), JSMedia('ionyweb_slideshow.js'), CSSMedia('plugin_slideshow.css'), JSAdminMedia('plugin_slidesho...
makinacorpus/ionyweb
ionyweb/page_app/page_sitemap/views.py
# -*- coding: utf-8 -*- from ionyweb.website.rendering.utils import render_view def index_view(request, page_app): return render_view('page_sitemap/index.html')
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_map/forms.py
# -*- coding: utf-8 -*- import floppyforms as forms from ionyweb.widgets import Slider from ionyweb.forms import ModuloModelForm from models import Plugin_Map from django.conf import settings from django.template.loader import render_to_string class DoNotDisplay(forms.TextInput): template_name = 'floppyforms/don...
makinacorpus/ionyweb
ionyweb/administration/views/test.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- from djangorestframework.views import View from djangorestframework.response import Response, ErrorResponse from djangorestframework import status class TestView(View): """ Test of status code """ def get(self, *args, **kwargs): """ ...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_video/viewers/facebook.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- from django.utils.safestring import mark_safe from ionyweb.plugin_app.plugin_video.viewers.base import BaseViewer import re class FacebookViewer(BaseViewer): @staticmethod def is_competent_for_url(url): """ Return true for : -...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_fb_likebox/forms.py
# -*- coding: utf-8 -*- import floppyforms as forms from ionyweb.forms import ModuloModelForm from models import Plugin_FbLikebox class Plugin_FbLikeboxForm(ModuloModelForm): class Meta: model = Plugin_FbLikebox
makinacorpus/ionyweb
ionyweb/administration/views/plugin.py
# -*- coding: utf-8 -*- from django.conf import settings from django.template import RequestContext from django.template.loader import render_to_string from django.contrib.contenttypes.models import ContentType from django.http import Http404 from djangorestframework.response import Response, ErrorResponse from django...
makinacorpus/ionyweb
ionyweb/page_app/page_dev_css/models.py
# -*- coding: utf-8 -*- from django.db import models from django.utils.translation import ugettext_lazy as _ from ionyweb.page.models import AbstractPageApp class PageApp_DevCss(AbstractPageApp): def __unicode__(self): return u'DevCss #%d' % (self.pk) class Meta: verbose_name = _(u"Dev C...
makinacorpus/ionyweb
ionyweb/website/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from ionyweb.website.models import * admin.site.register(WebSite) admin.site.register(WebSiteOwner)
makinacorpus/ionyweb
ionyweb/page_app/page_agenda/forms.py
# -*- coding: utf-8 -*- import floppyforms as forms from ionyweb.forms import ModuloModelForm from models import PageApp_Agenda, Event from ionyweb.file_manager.widgets import FileManagerWidget from ionyweb.widgets import TinyMCESimple, DateTimePicker class PageApp_AgendaForm(ModuloModelForm): class Meta: ...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_website_title/forms.py
<reponame>makinacorpus/ionyweb<gh_stars>1-10 # -*- coding: utf-8 -*- import floppyforms as forms from ionyweb.forms import ModuloModelForm from models import Plugin_WebsiteTitle class Plugin_WebsiteTitleForm(ModuloModelForm): class Meta: model = Plugin_WebsiteTitle
makinacorpus/ionyweb
ionyweb/website/management/commands/createwebsite.py
# -*- coding: utf-8 -*- from django.core.management.base import BaseCommand, CommandError from ionyweb.website import create_new_website class Command(BaseCommand): args = '' help = 'Create an empty but fonctionnal website' def handle(self, *args, **options): create_new_website()
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_breadcrumb/forms.py
# -*- coding: utf-8 -*- import floppyforms as forms from ionyweb.forms import ModuloModelForm from models import Plugin_Breadcrumb class Plugin_BreadcrumbForm(ModuloModelForm): class Meta: model = Plugin_Breadcrumb
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_contact/__init__.py
<gh_stars>1-10 # -*- coding: utf-8 -*- from django.utils.translation import ugettext as _ PLUGIN_INFO = { 'NAME': _(u"Contact"), 'VERSION': "1.0", 'SHORT_DESCRIPTION': _(u"Contact form with anwser by mail"), 'DESCRIPTION': _(u"Sometime, it's better to do not show your email adresse of your website. You...
makinacorpus/ionyweb
ionyweb/website/models.py
<reponame>makinacorpus/ionyweb # -*- coding: utf-8 -*- " WebSite models " import os import shutil from django.conf import settings from django.contrib.auth.models import User from django.contrib.sites.models import Site from django.db import connection from django.db import models from django.db.utils import Integrity...
makinacorpus/ionyweb
ionyweb/page_app/page_gallery_images/actions/views.py
<reponame>makinacorpus/ionyweb<gh_stars>1-10 # -*- coding: utf-8 -*- from djangorestframework.response import Response from djangorestframework import status from ionyweb.administration.actions.views import ActionAdminListView, ActionAdminDetailView from ionyweb.administration.utils import MESSAGES from ionyweb.page_...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_video/viewers/vimeo.py
# -*- coding: utf-8 -*- from django.utils.safestring import mark_safe from ionyweb.plugin_app.plugin_video.viewers.base import BaseViewer import re class VimeoViewer(BaseViewer): @staticmethod def is_competent_for_url(url): """ Return true for : - http://vimeo.com/17065523 ...
makinacorpus/ionyweb
ionyweb/authentication/models.py
# -*- coding: utf-8 -*- from django.contrib.auth.models import User from django.db import models from django.db.utils import IntegrityError from django.utils.translation import ugettext as _ from django.conf import settings # Visites # FIXME : Faire un model Traking qui sauvegarde les visites faites par # un utilisat...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_contact/admin.py
<gh_stars>1-10 # -*- coding: utf-8 -*- from django.contrib import admin from models import * admin.site.register(Plugin_Contact)
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_video/admin.py
<filename>ionyweb/plugin_app/plugin_video/admin.py # -*- coding: utf-8 -*- from django.contrib import admin from ionyweb.plugin_app.plugin_video.models import Plugin_Video admin.site.register(Plugin_Video)
makinacorpus/ionyweb
ionyweb/page/utils.py
<reponame>makinacorpus/ionyweb<filename>ionyweb/page/utils.py # -*- coding: utf-8 -*- import floppyforms as forms from django import forms as django_forms from django.conf import settings def errors_append(form, field_name, message): u''' Add an ValidationError to a field (instead of __all__) during Form.cle...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_blog_entries_list/views.py
# -*- coding: utf-8 -*- from django.conf import settings from ionyweb.website.rendering.utils import render_view from ionyweb.website.rendering.medias import JSAdminMedia RENDER_MEDIAS = ( JSAdminMedia('plugin_blog_entries_list.js'), ) def index_view(request, plugin): return render_view( plug...
makinacorpus/ionyweb
ionyweb/page_app/page_blog/managers.py
<filename>ionyweb/page_app/page_blog/managers.py # -*- coding: utf-8 -*- """ Managers of ``blog`` application. """ from django.db import models class CategoryOnlineManager(models.Manager): """ Manager that manages online ``Category`` objects. """ def get_query_set(self): from models import Ent...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_breadcrumb/__init__.py
<filename>ionyweb/plugin_app/plugin_breadcrumb/__init__.py # -*- coding: utf-8 -*- from django.utils.translation import ugettext as _ PLUGIN_INFO = { 'NAME': _(u"Breadcrumb"), 'VERSION': "1.0", 'SHORT_DESCRIPTION': _(u"An intelligent breadcrumb to help navigation."), 'DESCRIPTION': _(u"This will optimi...
makinacorpus/ionyweb
ionyweb/page_app/page_blog/wa_actions_urls.py
# -*- coding: utf-8 -*- from ionyweb.administration.actions.utils import get_actions_urls from models import Entry, Category from forms import EntryForm, CategoryForm from wa_actions_views import EntryActionAdminDetailView urlpatterns = get_actions_urls(Entry, form_class=EntryForm, ...
makinacorpus/ionyweb
ionyweb/file_manager/migrations/0001_initial.py
<gh_stars>1-10 # -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Directory' db.create_table('file_manager_directory', ( ('id', sel...
makinacorpus/ionyweb
ionyweb/bin/quickstart.py
#!/usr/bin/python # -*- coding: utf-8 -*- import sys try: import django assert django.VERSION[0:2] == (1, 4) except: print >> sys.stderr, "Don't forget to install Django-1.4\n pip install Django" sys.exit(4) try: import jinja2 except: print >> sys.stderr, "Don't forget to install python-ji...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_blog_entries_list/wa_actions_urls.py
<filename>ionyweb/plugin_app/plugin_blog_entries_list/wa_actions_urls.py # -*- coding: utf-8 -*- from django.conf.urls import patterns, url from ionyweb.administration.actions.utils import get_actions_urls from models import EntryLink from forms import EntryLink_Form # Generic Action View urlpatterns = get_actions_u...
makinacorpus/ionyweb
ionyweb/page_app/page_text/forms.py
# -*- coding: utf-8 -*- import floppyforms as forms from ionyweb.forms import ModuloModelForm from models import PageApp_Text from ionyweb.widgets import TinyMCELargeTable class PageApp_TextForm(ModuloModelForm): class Meta: model = PageApp_Text widgets = { 'text': TinyM...
makinacorpus/ionyweb
ionyweb/loaders/layouts_finders.py
<reponame>makinacorpus/ionyweb<gh_stars>1-10 import os from django.conf import settings from django.contrib.staticfiles.finders import BaseFinder from django.utils.datastructures import SortedDict from django.utils.importlib import import_module from django.utils._os import safe_join from django.contrib.staticfiles imp...
makinacorpus/ionyweb
ionyweb/page_app/page_dev_css/forms.py
# -*- coding: utf-8 -*- import floppyforms as forms from ionyweb.forms import ModuloModelForm from models import PageApp_DevCss class PageApp_DevCssForm(ModuloModelForm): class Meta: model = PageApp_DevCss
makinacorpus/ionyweb
ionyweb/website/middleware.py
# -*- coding: utf-8 -*- from django.conf import settings from django.contrib.sites.models import RequestSite, Site from django.db import DatabaseError from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect, Http404 from django.shortcuts import render_to_response from django.template import Request...
makinacorpus/ionyweb
ionyweb/page_app/page_blog/models.py
# -*- coding: utf-8 -*- """ Models of ``blog`` application. """ from datetime import datetime from django.conf import settings from django.core.urlresolvers import reverse from django.db import models from django.utils.translation import ugettext_lazy as _ from django.http import Http404 from mptt.models import MPTTMod...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_video/viewers/base.py
# -*- coding: utf-8 -*- class BaseViewer(object): @staticmethod def is_competent_for_url(url): raise NotImplementedError('Please extends the is_competent_for_url method') @staticmethod def get_video_viewer(video_id): raise NotImplementedError('Please extends the get_video_viewer metho...
makinacorpus/ionyweb
ionyweb/website/rendering/utils.py
<reponame>makinacorpus/ionyweb<gh_stars>1-10 # -*- coding: utf-8 -*- from django.template.loader import render_to_string from ionyweb.website.rendering import HTMLRendering def render_view(template_name, params={}, medias=(), context_instance=None, is_admin_view=False, title=None): """ Returns an HTMLRenderin...
makinacorpus/ionyweb
ionyweb/plugin_app/plugin_links_list/admin.py
# -*- coding: utf-8 -*- from django.contrib import admin from models import * class LinksListAdmin(admin.ModelAdmin): list_display = ('__unicode__', 'nb_links') class LinkAdmin(admin.ModelAdmin): list_display = ('text', 'target', 'plugin', 'order') list_filter = ('plugin',) ordering = ('text',) ...
makinacorpus/ionyweb
ionyweb/administration/views/apps.py
<gh_stars>1-10 # -*- coding: utf-8 -*- from django.template.loader import render_to_string from django.template import RequestContext from djangorestframework import status from djangorestframework.response import ErrorResponse, Response from ionyweb.administration.views import IsAdminView from ionyweb.administration...
lucaslopes/alpha_zero_othello
lib/replaybuffer.py
<gh_stars>100-1000 from collections import deque import random try: import _pickle as pickle except: import pickle class ReplayBuffer(object): def __init__(self, buffer_size): self.buffer_size = buffer_size self.buffer = deque() def add(self, experience): self.buffer.append(expe...
lucaslopes/alpha_zero_othello
worker/self_play.py
<reponame>lucaslopes/alpha_zero_othello from config import SelfPlayConfig from lib import tf_util, util from player.aiplayer import AIPlayer from othello import Othello from time import time import glob import os def start(): config = SelfPlayConfig() tf_util.update_memory(config.gpu_mem_fraction) util.set...
lucaslopes/alpha_zero_othello
player/player.py
<reponame>lucaslopes/alpha_zero_othello<filename>player/player.py from abc import ABC, abstractmethod from othello import Othello import random class Player(ABC): def __init__(self): super().__init__() @abstractmethod def pick_move(self, game): pass class RandomPlayer(Player): ...
lucaslopes/alpha_zero_othello
lib/tf_util.py
import tensorflow as tf import keras.backend as K def update_memory(fraction): tfconfig = tf.ConfigProto( gpu_options=tf.GPUOptions( per_process_gpu_memory_fraction=fraction, allow_growth=True, ) ) sess = tf.Session(config=tfconfig) K.set_session(sess)
lucaslopes/alpha_zero_othello
worker/optimizer.py
from config import OptimizerConfig from lib import tf_util, util from player.aiplayer import AIPlayer from time import time, sleep try: import _pickle as pickle except: import pickle import glob def start(): config = OptimizerConfig() tf_util.update_memory(config.gpu_mem_fraction) util.set_high_proce...
lucaslopes/alpha_zero_othello
run.py
<reponame>lucaslopes/alpha_zero_othello<gh_stars>100-1000 import os import argparse if __name__ == '__main__': os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' parser = argparse.ArgumentParser() parser.add_argument("mode", help="which mode to run in: \"opt\" to train the network," + ...
lucaslopes/alpha_zero_othello
lib/util.py
import sys from time import time, sleep import pandas as pd import psutil import shutil import glob import os try: import _pickle as pickle except: import pickle def print_progress_bar(count, total, start=0): bar_len = 60 filled_len = int(round(bar_len * count / float(total))) percents = round(100.0...
lucaslopes/alpha_zero_othello
player/aiplayer.py
<filename>player/aiplayer.py from player.player import Player from othello import Othello from lib.replaybuffer import ReplayBuffer from collections import deque, defaultdict import keras.backend as K from keras import optimizers from keras.engine.training import Model from keras.layers import Dense, Activation, Flatte...
lucaslopes/alpha_zero_othello
worker/compile_rank.py
<gh_stars>100-1000 from config import RankingConfig from lib import util import numpy as np import choix import time import os def start(): config = RankingConfig() print("Merging Staged Files") df = util.mergeStagedWTL(config) if df is None: print("Issue loading file, will keep trying") ...
lucaslopes/alpha_zero_othello
config.py
import os def project_dir(): return os.path.dirname(os.path.abspath(__file__)) def data_dir(): return os.path.join(project_dir(), "data") class DataConfig: game_location = data_dir()+'/games/' model_location = data_dir()+'/models/' history_location = data_dir()+'/history/' performance_locatio...
lucaslopes/alpha_zero_othello
worker/ranking.py
from config import RankingConfig from lib import tf_util, util from player.aiplayer import AIPlayer from othello import Othello from time import time import numpy as np import itertools import random import choix import glob def start(): config = RankingConfig() tf_util.update_memory(config.gpu_mem_fraction) ...
lucaslopes/alpha_zero_othello
worker/evaluate.py
<reponame>lucaslopes/alpha_zero_othello from config import EvaluateConfig from lib import tf_util, util from player.player import RandomPlayer from player.aiplayer import AIPlayer from othello import Othello from time import time, sleep import glob def start(): config = EvaluateConfig() tf_util.update_memory(c...
lucaslopes/alpha_zero_othello
worker/history.py
from config import DataConfig import matplotlib.pyplot as plt try: import _pickle as pickle except: import pickle import glob def start(): config = DataConfig() histories = sorted(glob.glob(config.history_location+"*.pickle")) data = {} for hist in histories: file = open(hist, 'rb') ...
lucaslopes/alpha_zero_othello
worker/play_game.py
from config import EvaluateConfig from lib import tf_util from player.player import RandomPlayer from player.aiplayer import AIPlayer from othello import Othello from random import random from tkinter import Tk, Canvas import threading import time import glob def start(): root = Tk() AppLogic(root) root.ma...
UoA-eResearch/haka_tweets
scraper/scraper.py
<reponame>UoA-eResearch/haka_tweets from selenium import webdriver from selenium.common.exceptions import NoSuchElementException from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.expected_co...
UoA-eResearch/haka_tweets
parse_jsonl.py
#!/usr/bin/env python3 import pandas as pd df = pd.read_json("lsu_quote_replies.jsonl", lines=True) df["screen_name"] = df.user.apply(lambda x: x.get("screen_name")) df["location"] = df.place.apply(lambda x: x["full_name"] + ", " + x["country"] if x is not None else None) df["bounding_box"] = df.place.apply(lambda x:...
rn10/radiorec
radiorec.py
#!/usr/bin/python3 # -*- coding: utf-8 -*- import subprocess import shutil sleep = shutil.which('sleep') wget = shutil.which('wget') echo = shutil.which('echo') base64 = shutil.which('base64') dd = shutil.which('dd') ffmpeg = shutil.which('ffmpeg') def rec_nhk(ch,length,path): delay = 35 #遅延が大きいので調整 if ch =...
paulpc/moloch-wise
package_merge.py
#!/usr/local/bin/python3 import json mol = json.load(open('./moloch/package.json')) wisemol = json.load(open('./moloch/wiseService/package.json')) for dep in mol['dependencies']: if not dep in wisemol['dependencies']: wisemol['dependencies'][dep]=mol['dependencies'][dep] json.dump(wisemol, open('package.j...
paulpc/moloch-wise
wise_tests.py
import requests import logging logging.basicConfig(level=logging.INFO) wresp = requests.post('http://localhost:8081/get?ver=2&ips=192.168.127.12') if wresp.status_code == 200: logging.info('[+] successfully connected to wise') else: logging.critical('[-] unable to connect to wise') exit(1) # generating in...
NEC-FIWARE/fiware-covid-19
converter/converter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # MIT License # # Copyright (c) 2021 NEC Corporation # # 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 ...
NEC-FIWARE/fiware-covid-19
aggregator/libs/builder/patients_summary_builder.py
<gh_stars>0 # # MIT License # # Copyright (c) 2021 NEC Corporation # # 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 # to use, cop...
NEC-FIWARE/fiware-covid-19
aggregator/libs/settings.py
# # MIT License # # Copyright (c) 2021 NEC Corporation # # 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 # to use, copy, modify, m...
NEC-FIWARE/fiware-covid-19
aggregator/libs/broker.py
# # MIT License # # Copyright (c) 2021 NEC Corporation # # 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 # to use, copy, modify, m...
NEC-FIWARE/fiware-covid-19
aggregator/libs/builder/entity_builder.py
# # MIT License # # Copyright (c) 2021 NEC Corporation # # 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 # to use, copy, modify, m...
NEC-FIWARE/fiware-covid-19
aggregator/aggregator.py
#!/usr/bin/env python # # MIT License # # Copyright (c) 2021 NEC Corporation # # 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 # t...
NEC-FIWARE/fiware-covid-19
converter/test_converter.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import unittest import yaml import sys import json import argparse from io import StringIO from urllib.error import HTTPError, URLError from unittest.mock import patch, MagicMock import converter class TestConv(unittest.TestCase): def test_create_ngsi_entities_dryru...
NEC-FIWARE/fiware-covid-19
aggregator/libs/builder/patients_list_aggregated_builder.py
<filename>aggregator/libs/builder/patients_list_aggregated_builder.py # # MIT License # # Copyright (c) 2021 NEC Corporation # # 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 restrict...
NEC-FIWARE/fiware-covid-19
aggregator/libs/builder/test_count_daily_aggregated_builder.py
# # MIT License # # Copyright (c) 2021 NEC Corporation # # 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 # to use, copy, modify, m...
NEC-FIWARE/fiware-covid-19
extras/meteoroid/function/aggregator.py
#!/usr/bin/env python # # MIT License # # Copyright (c) 2021 NEC Corporation # # 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 # t...
NEC-FIWARE/fiware-covid-19
aggregator/libs/builder/patients_daily_aggregated_builder.py
<reponame>NEC-FIWARE/fiware-covid-19 # # MIT License # # Copyright (c) 2021 NEC Corporation # # 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...
mfarragher/saas-business-simulation
tests/test_user_growth.py
<gh_stars>1-10 import pytest import numpy as np import pandas.api.types as ptypes from pandas.testing import assert_series_equal from src._user_growth import get_active_user_counts_by_date, get_user_counts_by_date def test_active_user_count_values_integer(): dau_count = get_active_user_counts_by_date('2019-01-01...
mfarragher/saas-business-simulation
src/_user_growth.py
<gh_stars>1-10 import pandas as pd import numpy as np def _get_active_user_p_by_date(start_date, end_date, *, seed=None): """Generate a trajectory for % daily active users (DAU). The series is a random walk with drift. DAU % starts between approx. 20-30% range and then follows random walk with drift ...
mfarragher/saas-business-simulation
src/data.py
<reponame>mfarragher/saas-business-simulation import uuid import pandas as pd import numpy as np from scipy.stats import skewnorm from src._user_growth import get_user_counts_by_date, get_active_user_counts_by_date def get_user_dataset(start_date, end_date, *, approx_yoy_growth_rate=3, start_use...
kevinxin90/biothings_web
src/demo.py
from biothings import Graph graph = Graph() ''' Assume well-tolerated drugs: Fludarabine, Carmustine Assume poorly-tolerated drugs: Etoposide, Tacrolimus ''' drug_set1 = ['Fludarabine', 'Carmustine'] drug_set2 = ['Etoposide', 'Tacrolimus'] ''' Get DrugBank ID using drug and compound API (mydrug python package) ''' imp...
kevinxin90/biothings_web
src/jsonld_processor.py
import json import requests from pyld import jsonld from collections import OrderedDict from config import AVAILABLE_API_SOURCES, AVAILABLE_IDS def find_id_from_uri(uri): for _id in AVAILABLE_IDS.keys(): if AVAILABLE_IDS[_id]["uri"] == uri: return _id def fetch_doc_from_api(url): ''' ...
kevinxin90/biothings_web
src/utils.py
from biothings_helper import find_annotate_api_ids, find_query_api_ids, find_xref, find_query_id_list, find_query_id_list_for_filter from config import AVAILABLE_IDS, AVAILABLE_API_SOURCES from jsonld_processor import load_context, find_id_from_uri node = 0 edge = 0 id_list = [] ''' initialize a cytoscape graph reset...
kevinxin90/biothings_web
src/biothings_helper.py
<reponame>kevinxin90/biothings_web from config import * from jsonld_processor import load_context, fetch_doc_from_api, get_nquads_from_url, get_nquads_from_json, fetch_value_by_uri_relation, get_uri_value_relation from biothings_client import ClientRedirect def get_biothings(api, id, fields=None, fields_uri=None): ...
kevinxin90/biothings_web
src/mydrug.py
<reponame>kevinxin90/biothings_web<filename>src/mydrug.py ''' Python Client for MyDrug.info services ''' from __future__ import print_function import sys import os import time from itertools import islice from collections import Iterable import requests try: from pandas import DataFrame from pandas.io.json imp...
kevinxin90/biothings_web
src/biothings.py
<filename>src/biothings.py from biothings_helper import find_annotate_api_ids, find_query_api_ids, find_value_from_output_type, query_ids_from_output_type import networkx as nx class Graph(): def __init__(self): self.graph = nx.Graph() def get_nodes_edges(self, output_dict): nodes = [] edges = [] for k, v i...
kevinxin90/biothings_web
src/config.py
AVAILABLE_IDS= {"ensembl_gene_id": { "uri": "http://identifiers.org/ensembl.gene/", "example": "ENSG00000139618" }, "ensembl_protein_id": { "uri": "http://identifiers.org/ensembl.protein/", "example": "ENSP0000012345" }, "ensembl_transcript_id": { "uri": "http://identifiers.org/ensembl.transcript/", "examp...
SamehElalfi/APG
main.py
import tkinter.filedialog import tkinter as tk from tkinter import * import tkinter.ttk as ttk from tkinter import messagebox import re import random class Application: def __init__(self, master=None): self.master = master self.master.title('Advanced Password Generator') window.geometry("80...
RaspberryProgramming/IncrementalWordlist
python3/iw.py
<reponame>RaspberryProgramming/IncrementalWordlist import time def_chars = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A",...
kperrynrel/pvanalytics
docs/examples/data-completeness.py
<reponame>kperrynrel/pvanalytics<filename>docs/examples/data-completeness.py<gh_stars>0 """ Missing Data Periods ==================== Identifying days with missing data using a "completeness" score metric. """ # %% # Identifying days with missing data and filtering these days out reduces noise # when performing data ...
kperrynrel/pvanalytics
docs/examples/day-night-masking.py
""" Day-Night Masking ================= Masking day-night periods using the PVAnalytics daytime module. """ # %% # Identifying and masking day-night periods in an AC power time series or # irradiance time series can aid in future data analysis, such as detecting # if a time series has daylight savings time or time sh...
kperrynrel/pvanalytics
docs/examples/clearsky-detection.py
""" Clear-Sky Detection =================== Identifying periods of clear-sky conditions using measured irradiance. """ # %% # Identifying and filtering for clear-sky conditions is a useful way to # reduce noise when analyzing measured data. This example shows how to # use :py:func:`pvanalytics.features.clearsky.reno...
kperrynrel/pvanalytics
docs/examples/qcrad-consistency-irradiance.py
""" QCrad Consistency for Irradiance Data ===================================== Check consistency of GHI, DHI and DNI using QCRad criteria. """ # %% # Identifying and filtering out invalid irradiance data is a # useful way to reduce noise during analysis. In this example, # we use # :py:func:`pvanalytics.quality.irra...
kperrynrel/pvanalytics
docs/examples/daily-insolation-limits-irradiance.py
""" Clearsky Limits for Daily Insolation ==================================== Checking the clearsky limits for daily insolation data. """ # %% # Identifying and filtering out invalid irradiance data is a # useful way to reduce noise during analysis. In this example, # we use :py:func:`pvanalytics.quality.irradiance.d...
kperrynrel/pvanalytics
docs/examples/qcrad-limits-irradiance.py
<reponame>kperrynrel/pvanalytics<filename>docs/examples/qcrad-limits-irradiance.py """ QCrad Limits for Irradiance Data ================================ Test for physical limits on GHI, DHI or DNI using the QCRad criteria. """ # %% # Identifying and filtering out invalid irradiance data is a # useful way to reduce no...
kperrynrel/pvanalytics
pvanalytics/tests/quality/test_data_shifts.py
<gh_stars>0 """Tests for data shift quality control functions.""" import pandas as pd import pytest from pvanalytics.quality import data_shifts as dt from ..conftest import DATA_DIR import ruptures test_file_1 = DATA_DIR / "pvlib_data_shift.csv" @pytest.fixture def generate_time_series(): # Pull down the saved PV...
kperrynrel/pvanalytics
pvanalytics/tests/features/test_shading.py
<filename>pvanalytics/tests/features/test_shading.py import pandas as pd from pandas.testing import assert_series_equal import pytest from pvanalytics.features import shading @pytest.fixture(scope='module') def times(): return pd.date_range( start='1/1/2020', end='12/31/2020', closed='left...
kperrynrel/pvanalytics
pvanalytics/quality/irradiance.py
<gh_stars>0 """Quality control functions for irradiance data.""" import numpy as np import pandas as pd from scipy import integrate from pvlib.tools import cosd import pvlib from pvanalytics import quality from pvanalytics import util QCRAD_LIMITS = {'ghi_ub': {'mult': 1.5, 'exp': 1.2, 'min': 100}, ...
kperrynrel/pvanalytics
pvanalytics/features/__init__.py
from pvanalytics.features import clearsky # noqa: F401 from pvanalytics.features import clipping # noqa: F401 from pvanalytics.features import shading # noqa: F401
kperrynrel/pvanalytics
pvanalytics/tests/features/test_orientation.py
<reponame>kperrynrel/pvanalytics import pytest from pandas.util.testing import assert_series_equal import pandas as pd from pvlib import tracking, pvsystem, modelchain, irradiance from pvanalytics.features import orientation from ..conftest import requires_pvlib def test_clearsky_ghi_fixed(clearsky, solarposition): ...
kperrynrel/pvanalytics
pvanalytics/tests/test_system.py
"""Tests for system parameter identification functions.""" import pytest import pandas as pd import numpy as np import pvlib from pvlib import location, pvsystem, tracking, modelchain, irradiance from pvanalytics import system from .conftest import requires_pvlib @pytest.fixture(scope='module') def summer_times(): ...