repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
noelli/bacpypes
setup.py
<filename>setup.py<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import re try: from setuptools import setup except ImportError: from distutils.core import setup # different source folders version_info = sys.version_info[:2] source_folder = { (2, 5): 'py25', (2, 6): 'p...
noelli/bacpypes
pcap_tools/ReadPropertySummaryFilter.py
<gh_stars>1-10 #!/usr/bin/python """ Read Property Summary Filter - Summarize Read Property Requests/Responses """ import sys from bacpypes.debugging import Logging, function_debugging, ModuleLogger from bacpypes.consolelogging import ConsoleLogHandler from bacpypes.pdu import Address from bacpypes.analysis import ...
noelli/bacpypes
pcap_tools/IAmRouterToNetworkSummaryFilter.py
<filename>pcap_tools/IAmRouterToNetworkSummaryFilter.py #!/usr/bin/python """ Summarize I-Am-Router-To-Network Notifications """ import sys from collections import defaultdict from bacpypes.debugging import Logging, function_debugging, ModuleLogger from bacpypes.consolelogging import ConsoleLogHandler from bacpypes...
noelli/bacpypes
samples/ReadRangeServer.py
#!/usr/bin/env python """ Server with a Trend Log Object """ from bacpypes.debugging import bacpypes_debugging, ModuleLogger from bacpypes.consolelogging import ConfigArgumentParser from bacpypes.core import run from bacpypes.errors import ExecutionError from bacpypes.primitivedata import Date, Time from bacpypes.co...
noelli/bacpypes
samples/VendorReadWriteProperty.py
<gh_stars>0 #!/usr/bin/env python """ This application presents a 'console' prompt to the user asking for commands. For 'read' commands it will create ReadPropertyRequest PDUs, then lines up the coorresponding ReadPropertyACK and prints the value. For 'write' commands it will create WritePropertyRequst PDUs and prin...
noelli/bacpypes
samples/LocalScheduleObject.py
#!/usr/bin/env python """ This application creates a series of Local Schedule Objects and then prompts to test dates and times. """ from time import localtime as _localtime from bacpypes.debugging import bacpypes_debugging, ModuleLogger, xtob from bacpypes.consolelogging import ConfigArgumentParser from bacpypes.con...
noelli/bacpypes
py25/bacpypes/app.py
<filename>py25/bacpypes/app.py #!/usr/bin/python """ Application Module """ import warnings from .debugging import bacpypes_debugging, DebugContents, ModuleLogger from .comm import ApplicationServiceElement, bind from .iocb import IOController, SieveQueue from .pdu import Address from .primitivedata import ObjectI...
noelli/bacpypes
tests/test_utilities/test_time_machine.py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Test Utilities Time Machine ---------------------------- """ import time import unittest from bacpypes.debugging import bacpypes_debugging, ModuleLogger from bacpypes.task import OneShotTask, FunctionTask, RecurringTask from ..time_machine import TimeMachine, reset_...
noelli/bacpypes
pcap_tools/WhoIsIAmSummaryFilter.py
<filename>pcap_tools/WhoIsIAmSummaryFilter.py<gh_stars>1-10 #!/usr/bin/python """ Who-Is and I-Am Summary Filter """ import sys from collections import defaultdict from bacpypes.debugging import Logging, function_debugging, ModuleLogger from bacpypes.consolelogging import ConsoleLogHandler from bacpypes.pdu import ...
noelli/bacpypes
samples/UDPConsole.py
<gh_stars>1-10 #!/usr/bin/env python """ UDPConsole ========== This is a sample application that is similar to the UDPMultiplexer. It opens a socket for unicast messages and (optionally) another for broadcast messages. Run this application with a BACpypes IP address parameter. $ python UDPConsole.py <addr> [ -...
noelli/bacpypes
samples/WhoIsIAmVLAN.py
#!/usr/bin/env python """ Who-Is, I-Am VLAN This sample application is very similar to WhoIsIAm.py but rather than the device on an IPv4 network, it is sitting on a VLAN with a router to the network. The INI file is used for the device object properties with the exception of the address, which is given to the router...
noelli/bacpypes
samples/ReadPropertyAny.py
<reponame>noelli/bacpypes<gh_stars>0 #!/usr/bin/env python """ This application presents a 'console' prompt to the user asking for read commands which create ReadPropertyRequest PDUs, waits for the response, then decodes the value if it is application encoded. This is useful for reading the values of propietary prope...
noelli/bacpypes
pcap_tools/WhoIsIAmDeviceFilter.py
#!/usr/bin/python """ Who-Is and I-Am Device Filter """ import sys from bacpypes.debugging import Logging, function_debugging, ModuleLogger from bacpypes.consolelogging import ConsoleLogHandler from bacpypes.pdu import Address from bacpypes.analysis import trace, strftimestamp, Tracer from bacpypes.apdu import WhoI...
noelli/bacpypes
pcap_tools/ReadPropertyTimeoutFilter.py
<reponame>noelli/bacpypes<gh_stars>1-10 #!/usr/bin/python """ Read Property Timeout Filter - Look for Read Property Requests with no response """ import sys from bacpypes.debugging import Logging, function_debugging, ModuleLogger from bacpypes.consolelogging import ConsoleLogHandler from bacpypes.pdu import Address...
noelli/bacpypes
pcap_tools/PDUsPerMinuteFilter.py
#!/usr/bin/python """ PDUs per Minute Filter - present a table of number of PDUs per minute """ import sys from collections import defaultdict from bacpypes.debugging import Logging, function_debugging, ModuleLogger from bacpypes.consolelogging import ConsoleLogHandler from bacpypes.analysis import trace, strftimes...
noelli/bacpypes
samples/COVClient.py
<reponame>noelli/bacpypes #!/usr/bin/env python """ This application presents a 'console' prompt to the user asking for subscribe commands which create SubscribeCOVRequests. The other commands are for changing the type of reply to the confirmed COV notification that gets sent. """ from bacpypes.debugging import bacp...
amado-developer/Lab3-Redes
main.py
import getpass from networkx.algorithms.shortest_paths.generic import shortest_path import yaml from aioconsole import ainput import networkx as nx import asyncio import logging from datetime import datetime import slixmpp import networkx as nx import random from getpass import getpass import sys if sys.plat...
bspaulding/elm-ios
elm-ios.py
#!/usr/bin/env python2.7 """Compiles and builds elm-ios apps.""" import os import os.path import shutil import stat import subprocess import sys __author__ = '<NAME>' __email__ = '<EMAIL>' __version__ = '0.1.0' # Constants TEMPLATE_NAME = 'AppTemplate' COMPILED_ELM_FNAME = 'compiledElm.js' ASSETS_FNAME = 'assets' O...
raimamathew/Brain-Tumor-Segmentation
train_script.py
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D import numpy as np import os from skimage import measure import re import nibabel as nib import tensorflow as tf import time from scipy.ndimage import zoom import tensorflow as tf from tensorflow.keras.models import Model, load_model from tensorflo...
lgazpio/PhrasIS-baselines
00.launchPreprocess.py
import pandas as pd import nltk import seaborn as sns import matplotlib.pyplot as plt import numpy as np import os nltk.download('stopwords') nltk.download('punkt') nltk.download('wordnet_ic') nltk.download('genesis') nltk.download('averaged_perceptron_tagger') nltk.download('wordnet') from src.Preprocess import Uti...
lgazpio/PhrasIS-baselines
src/ML/MachineLearning.py
<reponame>lgazpio/PhrasIS-baselines<filename>src/ML/MachineLearning.py import copy as cp import matplotlib.pyplot as plt import numpy as np from sklearn.model_selection import KFold import math import seaborn as sns from typing import Tuple from sklearn.metrics import confusion_matrix ser=dict() def cross_val_predi...
lgazpio/PhrasIS-baselines
02.launchML.py
<filename>02.launchML.py import pandas as pd pd.options.mode.chained_assignment = None import numpy as np import os import sys from sklearn.feature_extraction.text import CountVectorizer from src.Preprocess import Utils from src.Constants.Constants import ALL_FEATURES from src.Constants.Constants import LEXICAL_COLS ...
lgazpio/PhrasIS-baselines
src/Preprocess/Lexical_Features.py
import pandas as pd """ PYTHON MODULE TO COMPUTE LEXICAL FEATURES """ # JACCARD OVERLAP STRIP TOKENIZED def addColumnsJaccardStripTokenized(df: pd.DataFrame): df ['jaccard_strip_tokenized'] = df.apply(lambda it : jaccard_similarity (it['left_strip_tokenized'], it['right_strip_tokenized']), axis ...
lgazpio/PhrasIS-baselines
01.launchCorrelations.py
import pandas as pd import numpy as np import os import sys from src.Preprocess import Utils from src.Correlations import Correlations # Set seed for all libraries np.random.seed(123) # To print the whole df pd.options.display.width= None pd.options.display.max_columns= None pd.set_option('display.max_rows', 100) pd...
lgazpio/PhrasIS-baselines
src/Constants/Constants.py
''' Constants for column groups ''' LEXICAL_COLS = ['jaccard_strip_tokenized', 'jaccard_strip_tokenized_noPunct_lemmat_noStopWords', 'jaccard_strip_tokenized_noPunct_lemmat'] WORDNET_PATH_COLS = ['path_similarity', 'path_similarity_root'] WORDNET_LCH_COLS = ['lch_similarity_nouns', 'lch_similarity_verbs', 'lc...
lgazpio/PhrasIS-baselines
03.launch_embedding_baselines.py
import sys import src.Embeddings_baselines.sts_utils as utils import src.Preprocess.Utils as preprocess_utils import os import argparse import numpy as np import pandas as pd import math # Evaluate non trainable baselines on a given test set # Download fasttext embeddings from https://fasttext.cc/docs/en/crawl-vectors...
lgazpio/PhrasIS-baselines
src/Preprocess/WordNet_Features.py
import nltk from nltk.corpus import wordnet as wn from nltk.corpus import wordnet_ic from nltk.corpus import genesis import pandas as pd import numpy as np brown_ic = wordnet_ic.ic('ic-brown.dat') genesis_ic = wn.ic(genesis, False, 0.0) """ PYTHON MODULE TO COMPUTE WORDNET FEATURES """ # ####ONTHOLOGY # MAX PATH_SI...
lgazpio/PhrasIS-baselines
src/Embeddings_baselines/sts_utils.py
<reponame>lgazpio/PhrasIS-baselines # (c) <NAME> import nltk import nltk.corpus import nltk.stem import nltk.translate.gleu_score import nltk.translate.chrf_score import numpy as np import string # Load stopwords stopwords = set(nltk.corpus.stopwords.words('english')) # Load stemmer stemmer = nltk.stem.SnowballStemm...
lgazpio/PhrasIS-baselines
02.launchML_others.py
# (c) <NAME> import src.Embeddings_baselines.sts_utils as utils import os import sys import argparse import numpy as np import sklearn.ensemble import sklearn.kernel_ridge import sklearn.linear_model import sklearn.svm import pandas as pd import src.Preprocess.Utils as preprocess_utils def embedding_features(src, t...
lgazpio/PhrasIS-baselines
src/Normalization/Normalization.py
import pandas as pd from src.Constants.Constants import ALL_FEATURES from sklearn import preprocessing def standardNormalization (df: pd.DataFrame, columnsNormalize = ALL_FEATURES): ''' Normalize given columns of the dataframe using a standard scaler ''' X = preprocessing.StandardScaler().fit_transform( df[co...
lgazpio/PhrasIS-baselines
src/Correlations/Correlations.py
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt def CorrelationMatrix (df: pd.DataFrame, columns : list, name : str, fillNA=False, savePath=None): ''' Color map correlation matrix ''' corr = df[columns].corr() if fillNA: corr = corr.fillna(0) sns.heatmap( c...
lgazpio/PhrasIS-baselines
src/Preprocess/Utils.py
<filename>src/Preprocess/Utils.py #coding: utf-8 import pandas as pd import nltk from nltk.corpus import stopwords from nltk.stem import WordNetLemmatizer from .WordNet_Features import getWnPos from sklearn import preprocessing scaler = preprocessing.StandardScaler() """ PREPROCESSING UTILITIES """ lemmatizer = Wor...
DoubleE1/Keras-GAN
InceptionScore/Keras_cifar10_IS.py
# calculate inception score for cifar-10 in Keras import numpy as np import matplotlib.pyplot as plt from math import floor from numpy import ones, expand_dims, log, mean, std, exp from numpy.random import shuffle from keras.applications.inception_v3 import InceptionV3, preprocess_input from keras.datasets import cifar...
DoubleE1/Keras-GAN
dcgan/mnist/InceptionScore.py
# calculate inception score for cifar-10 in Keras import numpy as np import matplotlib.pyplot as plt from math import floor from numpy import ones, expand_dims, log, mean, std, exp from numpy.random import shuffle from keras.applications.inception_v3 import InceptionV3, preprocess_input from keras.datasets import cifar...
skaymen/waterdataui
wdfn-server/waterdata/tests/commands/lookup_generation/test_wqp_lookups.py
from unittest import TestCase, mock import requests from waterdata.commands.lookup_generation.wqp_lookups import ( get_lookup_by_json, is_us_county, get_nwis_state_lookup, get_nwis_county_lookup) @mock.patch('waterdata.commands.lookup_generation.wqp_lookups.execute_get_request') class GetLookupByJsonTestCase(T...
skaymen/waterdataui
wdfn-server/waterdata/commands/lookup_generation/nwis_lookups.py
<gh_stars>0 """ Utilities to retrieve NWIS RDB codes """ from itertools import groupby def _get_lookup_value(code_lookup, name_key, group_key, desc_key): """ Returns dict with 'name' and optional 'desc' properties derived from code_lookup :param code_lookup: :param name_key: :param: desc_key: Can...
skaymen/waterdataui
wdfn-server/waterdata/filters.py
""" Jinja2 filters. Must be imported (via waterdata.__init__) for them to register via the `app.template_filter` decorator. """ import datetime from itertools import chain from urllib.parse import urljoin, urlparse, ParseResult from . import app @app.template_filter('asset_url') def asset_url_filter(asset_src): ...
skaymen/waterdataui
wdfn-server/waterdata/tests/test_location_utils.py
""" Unit tests for waterdata.waterservices classes and functions. """ from unittest import TestCase from pendulum import datetime from .. import app from ..location_utils import ( build_linked_data, get_disambiguated_values, get_state_abbreviation, rollup_dataseries ) class GetDisambiguatedValuesTestCase(TestC...
skaymen/waterdataui
wdfn-server/config.py
""" Application configuration settings. """ # pylint: disable=line-too-long import logging import os # controls environment specific behavior # acceptable values: 'local', 'development', 'staging', 'prod' DEPLOYMENT_ENVIRONMENT = 'development' # FEATURE FLAGS TIMESERIES_AUDIO_ENABLED = True HYDROLOGIC_PAGES_ENABLE...
skaymen/waterdataui
wdfn-server/waterdata/tests/commands/lookup_generation/test_nwis_lookups.py
from unittest import TestCase from waterdata.commands.lookup_generation.nwis_lookups import ( translate_to_lookup, translate_codes_by_group) class TranslateToLookupTestCase(TestCase): def setUp(self): self.test_dict_iter = [ {'this_cd': 'value1', 'this_name': 'Name1', 'this_desc': 'Desc...
skaymen/waterdataui
wdfn-server/manage.py
#!/usr/bin/env python3.6 """ Entrypoint for Flask development server. """ import click from flask.cli import FlaskGroup from waterdata import app cli = FlaskGroup(create_app=lambda script_info: app) @cli.command() @click.option('--datadir', type=click.Path(dir_okay=True, file_okay=False), default=a...
skaymen/waterdataui
wdfn-server/waterdata/tests/test_filters.py
<reponame>skaymen/waterdataui """ Unit tests for Jinja2 filters. """ import datetime from unittest import TestCase import pendulum from .. import filters def test_asset_url_filter_manifest(app, mocker): mocker.patch.dict(app.config, { 'STATIC_ROOT': 'root/path/', 'ASSET_MANIFEST': { ...
skaymen/waterdataui
wdfn-server/waterdata/tests/commands/lookup_generation/test_commands.py
<filename>wdfn-server/waterdata/tests/commands/lookup_generation/test_commands.py """ Tests to confirm that manage.py entrypoints of the lookup generation tools run without failure. The correctness of generation JSON is handled by other unit tests. """ # pylint: disable=C0103,W0613 import os from click.testing import...
skaymen/waterdataui
wdfn-server/waterdata/commands/lookup_generation/__init__.py
#!/usr/bin/env python3.6 """ Generates two files, each containing a json object that will contain keys for the various codes used in NWIS site info expanded service """ import json import logging import os from waterdata.utils import execute_get_request, parse_rdb from .nwis_lookups import translate_to_lookup, trans...
skaymen/waterdataui
wdfn-server/waterdata/commands/lookup_generation/huc_lookups.py
<reponame>skaymen/waterdataui<filename>wdfn-server/waterdata/commands/lookup_generation/huc_lookups.py """ Creates a JSON file that maps HUC codes to sub-HUC codes, and includes metadata of each region. The following service is used as a data source: https://help.waterdata.usgs.gov/code/hucs_query?fmt=rdb """ from co...
skaymen/waterdataui
wdfn-server/waterdata/constants.py
<reponame>skaymen/waterdataui """ Constants """ STATION_FIELDS_D = { 'agency_cd': { 'name': 'Agency', 'description': 'The agency that is reporting the data.' }, 'site_no': { 'name': 'Site identification number', 'description': 'Each site in the USGS data base has a unique 8-...
skaymen/waterdataui
wdfn-server/waterdata/tests/test_views.py
<filename>wdfn-server/waterdata/tests/test_views.py """ Unit tests for the main WDFN views. """ import json import re from unittest import TestCase, mock import pytest import requests_mock from .. import app from ..views import __version__ class TestHomeView(TestCase): def setUp(self): self.app_client ...
skaymen/waterdataui
wdfn-server/run.py
<gh_stars>10-100 #!/usr/bin/env python3.6 """ Entrypoint for Flask development server. """ import argparse from waterdata import app def run_server(port=5050): """Run a development server on the given port.""" parser = argparse.ArgumentParser() parser.add_argument('--host', '-ht', type=str) args = ...
skaymen/waterdataui
wdfn-server/waterdata/commands/lookup_generation/wqp_lookups.py
""" Utilities to retrieve lookup information from WQP state and county lookups """ from itertools import groupby import logging from waterdata.utils import execute_get_request def get_lookup_by_json(hostname, path=None, params=None): """ Make an HttpRequest to endpoint and return dict :param str hostnam...
skaymen/waterdataui
wdfn-server/waterdata/tests/services/test_sifta.py
""" Tests for the cooperator service calls. """ import json import pytest import requests_mock from waterdata.services import sifta MOCK_RESPONSE = """ {"Site": "06864000", "Date": "6/19/2018", "Customers":[{"Name":"Kansas Water Office","URL":"http://www.kwo.org/","IconURL":"http://water.usgs.gov/customer/icons/67...
skaymen/waterdataui
wdfn-server/waterdata/tests/test_utils.py
""" Unit tests for the main WDFN views. """ from unittest import TestCase, mock import requests as r from ..utils import construct_url, defined_when, execute_get_request, parse_rdb class TestConstructUrl(TestCase): def setUp(self): self.test_netloc = 'https://fakeurl.gov' self.test_path = '/bl...
skaymen/waterdataui
wdfn-server/waterdata/tests/commands/lookup_generation/test_huc_lookups.py
""" Unit test for HUC-code retrieval module. """ # pylint: disable=C0302,W0613,W0621 from waterdata.commands.lookup_generation import huc_lookups def test_huc_lookup(huc_mock): huc_data = huc_lookups.get_huc_data() hucs = huc_data['hucs'] classes = huc_data['classes'] assert len(hucs) == 35, 'Unexpe...
NoXPhasma/protonfixes
protonfixes/gamefixes/684450.py
""" Game fix for Surviving the Aftermath """ #pylint: disable=C0103 from protonfixes import util def main(): """ Launcher currently broken """ util.replace_command("launcher/Paradox Launcher.exe", "Aftermath64.exe")
NoXPhasma/protonfixes
protonfixes/gamefixes/495420.py
<reponame>NoXPhasma/protonfixes<filename>protonfixes/gamefixes/495420.py """ Game fix for State of Decay 2 """ #pylint: disable=C0103 from protonfixes import util def main(): """ Fix game crashes with d3dcompiler_47 and multiplayer crashes with win7 """ util.protontricks('d3dcompiler_47') util.proton...
sveetch/sveedocuments
sveedocuments/settings.py
<filename>sveedocuments/settings.py<gh_stars>1-10 # -*- coding: utf-8 -*- """ sveedocuments default settings """ gettext = lambda s: s # Forbidden words for slug values in documents DOCUMENTS_PAGE_RESERVED_SLUGS = ('add','board','help','inserts','preview','sitemap') # Default template to generate tree menu DOCUMENTS_...
sveetch/sveedocuments
sveedocuments/management/commands/documents_export.py
<filename>sveedocuments/management/commands/documents_export.py # -*- coding: utf-8 -*- """ Command line tool to export DEPRECATED """ import re, StringIO from optparse import OptionValueError, make_option from django.conf import settings from django.core.cache import cache from django.core.management.base import Co...
sveetch/sveedocuments
sveedocuments/forms/crispies.py
""" Crispy forms layouts """ from django import forms from django.utils.translation import ugettext as _ from crispy_forms.helper import FormHelper from crispy_forms_foundation.layout import Layout, Fieldset, SplitDateTimeField, RowFluid, Column, ButtonHolder, Submit def page_helper(form_tag=True, parent=None, edit_m...
sveetch/sveedocuments
sveedocuments/views/page.py
<reponame>sveetch/sveedocuments<filename>sveedocuments/views/page.py # -*- coding: utf-8 -*- """ Page document views """ import json, os from django.conf import settings from django.core.urlresolvers import reverse from django.http import HttpResponse, Http404 from django.views import generic from mptt.templatetags.m...
sveetch/sveedocuments
sveedocuments/views/board/attachment.py
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Page's attachments management views """ from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404 from django.views import generic from django.contrib import messages from django.utils.translation import ugettext as _ from braces.views import...
sveetch/sveedocuments
sveedocuments/parser.py
# -*- coding: utf-8 -*- """ ReStructuredText parser facilities """ import copy try: from xml.etree.cElementTree import fromstring, tostring, ElementTree except ImportError: from xml.etree.ElementTree import fromstring, tostring, ElementTree from django.utils.encoding import smart_str import docutils import d...
sveetch/sveedocuments
sveedocuments/assets.py
""" Asset bundles to use with django-assets """ try: from django_assets import Bundle, register except ImportError: DJANGO_ASSETS_INSTALLED = False else: DJANGO_ASSETS_INSTALLED = True AVALAIBLE_BUNDLES = { 'sveedocuments_css': Bundle( "css/sveedocuments_app.css", filter...
sveetch/sveedocuments
sveedocuments/templatetags/__init__.py
<filename>sveedocuments/templatetags/__init__.py<gh_stars>1-10 # -*- coding: utf-8 -*- from django.core.cache import cache from rstview.parser import SourceParser from sveedocuments.parser import extract_toc def get_render_with_cache(instance, setting_key="default", force_update_cache=False, initial_header_level=Non...
sveetch/sveedocuments
sveedocuments/templatetags/documents_markup.py
<reponame>sveetch/sveedocuments # -*- coding: utf-8 -*- """ Parser template tags """ from django import template from django.conf import settings from django.utils.encoding import force_unicode from django.utils.safestring import mark_safe from rstview.parser import SourceParser from sveedocuments.templatetags impor...
sveetch/sveedocuments
sveedocuments/templatetags/documents_admin.py
# -*- coding: utf-8 -*- """ Template tags used in admin or board """ from django import template register = template.Library() @register.filter(name='calcul_indent') def calcul_indent(value, coef=20): return (value+1)*coef
sveetch/sveedocuments
sveedocuments/management/commands/extractor.py
# -*- coding: utf-8 -*- """ Export/Import Command line tool TODO: * Better command name; * Option to select only some items from entries; * Item fields to edit some other object field; Use this tool with a JSON config that contain mapping between Pages object and files. Export ------ This will fetch ite...
sveetch/sveedocuments
sveedocuments/crumbs.py
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Application Crumbs """ from autobreadcrumbs import site from django.utils.translation import ugettext_lazy site.update({ 'sveedocuments:index': ugettext_lazy('Document sitemap'), 'sveedocuments:board': ugettext_lazy('Document management'), 'sveedocuments:insert-in...
sveetch/sveedocuments
sveedocuments/models.py
<filename>sveedocuments/models.py # -*- coding: utf-8 -*- """ Data models """ import warnings from datetime import datetime import django.dispatch from django.conf import settings from django.core.files.storage import FileSystemStorage from django.db import models from django.contrib.auth.models import User from djang...
sveetch/sveedocuments
sveedocuments/utils/braces_addons.py
<filename>sveedocuments/utils/braces_addons.py import datetime, json from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.serializers.json import DjangoJSONEncoder from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.views.generic.base imp...
sveetch/sveedocuments
sveedocuments/management/commands/documents.py
# -*- coding: utf-8 -*- """ General Command line tool """ import StringIO from optparse import OptionValueError, make_option from django.conf import settings from django.core.cache import cache from django.core.management.base import CommandError, BaseCommand from sveedocuments.models import Page, Insert class Comm...
sveetch/sveedocuments
sveedocuments/urls_board.py
# -*- coding: utf-8 -*- """ Url's map for documents board """ from django.conf.urls import * from sveedocuments.views.board import ( BoardIndexView, PreviewView, BoardEditorSettingsView, BoardPagesIndexView, BoardInsertsIndexView ) from sveedocuments.views.board.page import ( PageCreateView, PageEditVi...
sveetch/sveedocuments
sveedocuments/utils/rest_roles.py
<filename>sveedocuments/utils/rest_roles.py # -*- coding: utf-8 -*- """ ReSTructured additional roles """ import os, re from docutils import nodes, utils from docutils.parsers.rst import roles from django.conf import settings from django.core.urlresolvers import reverse from django.core.cache import cache from django...
sveetch/sveedocuments
sveedocuments/templatetags/documents_utils.py
# -*- coding: utf-8 -*- """ Templates tags divers pour les documents """ from django import template from django.utils.safestring import mark_safe from sveedocuments.models import Insert, Page from sveedocuments.templatetags import get_render_with_cache, get_toc_with_cache from sveedocuments.utils.templatetags import ...
sveetch/sveedocuments
sveedocuments/utils/__init__.py
# -*- coding: utf-8 -*- """ Utilities """ import copy, itertools def _get_cache_keyset(keytpl, **kwargs): """ Return a list of possible cache keys of a document (*Pages* or *Insert*) Because a document can have various active cache key for his various possible render (from the parser settings) an...
sveetch/sveedocuments
sveedocuments/urls.py
# -*- coding: utf-8 -*- """ Root url's map for application """ from django.conf.urls import * from sveedocuments.models import ATTACHMENTS_WITH_SENDFILE from sveedocuments.views.page import ( HelpPageView, PageIndexView, PageDetailsView, PageSourceView ) urlpatterns = patterns('', url(r'^$', PageIndexVie...
sveetch/sveedocuments
sveedocuments/admin.py
<filename>sveedocuments/admin.py<gh_stars>1-10 # -*- coding: utf-8 -*- """ Model admin """ from django.contrib import admin from models import * class InsertAdmin(admin.ModelAdmin): list_display = ('slug', 'title', 'modified', 'author', 'visible' ) list_filter = ('created', 'modified', 'visible') ordering ...
sveetch/sveedocuments
sveedocuments/views/board/__init__.py
# -*- coding: utf-8 -*- """ Board views """ import json from django.views import generic from django.core.urlresolvers import reverse from mptt.templatetags.mptt_tags import cache_tree_children from djangocodemirror.views import SamplePreviewView, EditorSettingsView from sveedocuments.models import Page, Insert fro...
sveetch/sveedocuments
sveedocuments/forms/page.py
# -*- coding: utf-8 -*- """ Page forms """ from django.conf import settings from django import forms from django.utils.translation import ugettext as _ from mptt.forms import TreeNodeChoiceField from djangocodemirror.fields import CodeMirrorWidget from djangocodemirror.forms import DjangoCodeMirrorSettingsForm as Dja...
sveetch/sveedocuments
sveedocuments/utils/templatetags.py
# -*- coding: utf-8 -*- from django.template import Variable, TemplateSyntaxError, VariableDoesNotExist def resolve_string_or_variable(value, context, safe=False, default=None, capture_none_value=True): """ Resolve a template variable within the given context If the variable is a string (detected with...
sveetch/sveedocuments
sveedocuments/views/board/page.py
# -*- coding: utf-8 -*- """ Pages management views """ from datetime import datetime from django.conf import settings from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404 from django.template.loader import render_to_string from django.views import generic from django.views.generi...
sveetch/sveedocuments
sveedocuments/views/attachment.py
<reponame>sveetch/sveedocuments # -*- coding: utf-8 -*- """ Page's attachment views """ import os from django.conf import settings from django.http import Http404 from django.shortcuts import get_object_or_404 from django.views import generic from sendfile import sendfile from braces.views import LoginRequiredMixin ...
sveetch/sveedocuments
docs/dummy_settings.py
# Dummy Django settings SECRET_KEY = 'dummy-key'
sveetch/sveedocuments
sveedocuments/forms/insert.py
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Insert forms """ from django.conf import settings from django import forms from django.utils.translation import ugettext as _ from djangocodemirror.fields import CodeMirrorWidget from rstview.parser import SourceReporter, map_parsing_errors from sveedocuments.models import ...
sveetch/sveedocuments
sveedocuments/templatetags/documents_menus.py
<filename>sveedocuments/templatetags/documents_menus.py # -*- coding: utf-8 -*- """ Templates tags divers pour les documents """ from django.conf import settings from django import template from django.utils.safestring import mark_safe from sveedocuments.models import Insert, Page from sveedocuments.utils.templatetags...
sveetch/sveedocuments
sveedocuments/views/board/insert.py
<gh_stars>1-10 # -*- coding: utf-8 -*- """ Insert documents management views """ from django.core.urlresolvers import reverse from django.http import HttpResponse from django.views import generic from django.contrib import messages from django.utils.translation import ugettext as _ from braces.views import PermissionR...
sveetch/sveedocuments
sveedocuments/utils/objects.py
<gh_stars>1-10 # -*- coding: utf-8 -*- def get_instance_children(obj, depth=0, sig=0): """ Récupèration récursive des relations enfants d'un objet @depth: integer limitant le niveau de recherche des enfants, 0=illimité """ children = [] # Pour toute les relations enfants de l'objet for ...
sveetch/sveedocuments
sveedocuments/forms/attachment.py
# -*- coding: utf-8 -*- """ Forms """ from django import forms from django.utils.translation import ugettext as _ from sveedocuments.models import Attachment from sveedocuments.forms import CrispyFormMixin class AttachmentForm(CrispyFormMixin, forms.ModelForm): """ Attachment form """ crispy_form_help...
BuildForSDG/Team-115-Product
src/api/v1/solutions/routes.py
<filename>src/api/v1/solutions/routes.py<gh_stars>0 from flask import request, jsonify from .. import application from .. import db from ..models import Solutions @application.route('/api/v1/solutions/search', methods=['POST']) def search(): sub_industry = request.json.get('sub_industry') available_sols = So...
BuildForSDG/Team-115-Product
src/api/v1/__init__.py
import os from flask import Flask from flask_sqlalchemy import SQLAlchemy from flask_migrate import Migrate from dotenv import load_dotenv application = Flask(__name__) basedir = os.path.abspath(os.path.dirname(__file__)) # set db base directory project_dir = os.path.expanduser('~/team-115-product') load_dotenv(os....
BuildForSDG/Team-115-Product
src/api/v1/models.py
<reponame>BuildForSDG/Team-115-Product<gh_stars>0 from passlib.apps import custom_app_context as pwd_context from itsdangerous import (TimedJSONWebSignatureSerializer as Serializer, BadSignature, SignatureExpired) from . import db from . import application class Users(db.Model): # user ...
BuildForSDG/Team-115-Product
src/app.py
<gh_stars>0 from .api.v1 import application def run(): application.run(debug=True)
BuildForSDG/Team-115-Product
src/api/v1/users/routes.py
<reponame>BuildForSDG/Team-115-Product<filename>src/api/v1/users/routes.py import flask from flask import request, jsonify, g from flask_httpauth import HTTPBasicAuth from .. import application from .. import db from ..models import Users auth = HTTPBasicAuth() @application.route('/<path:text>', methods=['GET', 'PO...
BuildForSDG/Team-115-Product
src/api/v1/solutions/__init__.py
<filename>src/api/v1/solutions/__init__.py """Register solutions blueprint.""" from flask import Blueprint solutions = Blueprint('solutions', __name__)
chmike/pyHelloExtension
setup.py
from setuptools import setup, Extension # See https://realpython.com/build-python-c-extension-module/ setup( name="hello_ext", version="0.0.0-rc0", description="Python extension example", author="<NAME>", author_email="<EMAIL>", ext_modules=[Extension('hello_ext', ['src/hello.c', 's...
chmike/pyHelloExtension
tests/test_hello.py
<gh_stars>0 """ testing hello_ext """ #from hello import * import hello_ext def test_hello(): """ test hello """ assert hello_ext.hello("Gérard") == 'hello Gérard!'
ethoms-usgs/gems-tools-pro
Scripts/GeMS_InclinationNumbers_AGP2.py
<gh_stars>0 # GeMS_InclinationNumbers_AGP2.py # Creates a point feature class called OrientationPointLabels with dip and plunge # number labels for appropriate features within OrientationPoints. The location # of the label is offset based on characteristics of the rotated symbol and the map scale. # ...
ethoms-usgs/gems-tools-pro
Scripts/GeMS_MakePolys3_AGP2.py
##New, improved make polys import arcpy, sys, os from pathlib import Path from GeMS_utilityFunctions import * from GeMS_Definition import tableDict # 5 January 2018: Modified error message for topology that contains polys # # 29 May 2019: <NAME> # Replaced concatenated path strings and os.path operations # with...
ethoms-usgs/gems-tools-pro
Scripts/GeMS_DMUtoDocx_AGP2.py
<reponame>ethoms-usgs/gems-tools-pro """ Translates DMU table in NCGMP09-style geodatabase into a fully formatted Microsoft Word .docx file. Assumes formatting and style names in USGS Pubs template MapManuscript_v1-0_04-11.dotx Arguments Input geodatabase Output workspace Output filename (if it doesn't en...
ethoms-usgs/gems-tools-pro
Scripts/GeMS_AttributeByKeyValues_AGP2.py
# Script to step through an identified subset of feature classes in GeologicMap feature dataset # and, for specified values of independent fields, calculate values of dependent fields. # Useful for translating Alacarte-derived data into NCGMP09 format, and for using NCGMP09 # to digitize data in Alacarte mode. # # Edit...
ethoms-usgs/gems-tools-pro
Scripts/GeMS_CompactAndBackup_AGP2.py
# compacts a database and makes a copy # copy is .gdb or .mdb, to match input, and # has _yyyy-mm-dd appended to filename root. # # if a db with this name already exists # in the output directory, an a, or b, or ... # is appended until a unique name is obtained. # # 4 March 2018 added optional message to log file # 16...
ethoms-usgs/gems-tools-pro
Scripts/GeMS_CreateDatabase_AGP2.py
# GeMS_CreateDatabase_Arc10.1.py # Python script to create an empty NCGMP09-style # ArcGIS 10 geodatabase for geologic map data # # <NAME>, USGS # # RUN AS TOOLBOX SCRIPT FROM ArcCatalog OR ArcMap # 9 Sept 2016: Made all fields NULLABLE # 19 Dec 2016: Added GeoMaterials table, domains # 8 March 2017: Added Exis...