repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
Creatide/RenderFarts
src/__init__.py
<filename>src/__init__.py # ##### BEGIN GPL LICENSE BLOCK ##### # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # Th...
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/mpi_estimate.py
<filename>_includes/code/02_parallel_jobs/mpi_estimate.py #!/usr/bin/env python3 import sys import random import math from mpi4py import MPI comm = MPI.COMM_WORLD size = comm.Get_size() rank = comm.Get_rank() def estimate_pi(total_count): count_inside = 0 for count in range(0, total_count): x = rand...
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/mpi_print_hostname.py
from mpi4py import MPI def print_hostname(): comm = MPI.COMM_WORLD rank = comm.Get_rank() size = comm.Get_size() hname = MPI.Get_processor_name() print("this is rank = %2i (total: %2i) running on %s" % (rank,size,hname)) comm.Barrier() if __name__ == '__main__': print_hostname()
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/threads_numpi.py
#!/usr/bin/env python3 import sys import random import numpy as np import math from multiprocessing import cpu_count from multiprocessing.pool import ThreadPool as Pool def estimate_pi(total_count): x = np.float32(np.random.uniform(size=total_count)) y = np.float32(np.random.uniform(size=total_count)) ra...
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/parallel_numpi.py
<filename>_includes/code/02_parallel_jobs/parallel_numpi.py #!/usr/bin/env python3 import sys import numpy as np from multiprocessing import cpu_count, Pool np.random.seed(2017) def inside_circle(total_count): x = np.float32(np.random.uniform(size=total_count)) y = np.float32(np.random.uniform(size=total_c...
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/generate_scrambled_data.py
#!/usr/bin/env python3 import sys import numpy as np np.random.seed(2017) def inside_circle(total_count): x = np.float32(np.random.uniform(size=total_count)) y = np.float32(np.random.uniform(size=total_count)) radii = np.sqrt(x*x + y*y) count = len(radii[np.where(radii<=1.0)]) return count, x,...
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/serial_estimate.py
<filename>_includes/code/02_parallel_jobs/serial_estimate.py #!/usr/bin/env python3 import sys import random import math def estimate_pi(total_count): count_inside = 0 for count in range(0, total_count): x = random.random() y = random.random() d = math.sqrt(x*x + y*y) if d < 1:...
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/distributed.dask_numpi.py
<reponame>bkmgit/hpc-parallel-novice #!/usr/bin/env python3 import sys import math import dask.array as da from dask.distributed import Client import numpy as np np.random.seed(2017) da.random.seed(2017) def inside_circle(total_count, chunk_size = -1): x = da.random.uniform(size=(total_count), ...
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/count_pi_estimates.py
<reponame>bkmgit/hpc-parallel-novice #!/usr/bin/env python3 import sys import os if __name__=='__main__': file_name = "" if len(sys.argv) < 2: print("usage: count_pi_estimates.py <file_name>") else: file_name = sys.argv[1] if os.path.exists(file_name): print("opening", file_na...
bkmgit/hpc-parallel-novice
downloads/count_lines.py
from __future__ import print_function import os import sys def lines_count(afilename): """ counts the number of words in the string given by <text> """ if not os.path.exists(afilename): return 0 return len(open(afilename).readlines()) def main(): if len(sys.argv)<2: print("usage: ...
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/count_pylibs_annotated.py
<reponame>bkmgit/hpc-parallel-novice import os import sys import glob import re def load_text(): """ searches for the path seen by python (aka sys.path) which contains os.py and reads all .py files in this directory into a large string """ path_of_ospy = "" text = [] for d in sys.path: if os....
bkmgit/hpc-parallel-novice
_includes/code/02_parallel_jobs/print_hostname_and_time.py
<gh_stars>10-100 #/usr/bin/env python3 from mpi4py import MPI from datetime import datetime def print_hostname(): comm = MPI.COMM_WORLD rank = comm.Get_rank() size = comm.Get_size() hname = MPI.Get_processor_name() tod = datetime.now().isoformat(' ') print("this is rank = %2i (total: %2i) r...
hezhenke/technical-py
main.py
<filename>main.py import random, itertools, math, os, json, urllib2, sys, copy from datetime import date, datetime import time as timer import numpy as np import multiprocessing as mp def readable_date(unix): return datetime.fromtimestamp(int(unix)).strftime('%Y-%m-%d %H:%M:%S') class Indicator(object): def __init...
swprojects/Buildertron
buildertron/forms/uiaboutdialog.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'aboutdialog.ui' # # Created by: PyQt5 UI code generator 5.11.2 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_AboutDialog(object): def setupUi(self, AboutDialog): Ab...
swprojects/Buildertron
buildertron/spec/android_permissions.py
<reponame>swprojects/Buildertron permissions = [ 'ACCESS_ALL_DOWNLOADS', 'ACCESS_BLUETOOTH_SHARE', 'ACCESS_CACHE_FILESYSTEM', 'ACCESS_CHECKIN_PROPERTIES', 'ACCESS_CONTENT_PROVIDERS_EXTERNALLY', 'ACCESS_DOWNLOAD_MANAGER', 'ACCESS_DOWNLOAD_MANAGER_ADVANCED', 'ACCESS_DRM_CERTIFICATES', ...
swprojects/Buildertron
buildertron/buildertron.py
<filename>buildertron/buildertron.py #!/usr/bin/python3 # -*- coding: utf-8 -* """ Copyright (c) 2018 <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, includin...
swprojects/Buildertron
buildertron/forms/uisettingsdialog.py
<filename>buildertron/forms/uisettingsdialog.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'settingsdialog.ui' # # Created by: PyQt5 UI code generator 5.10 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_SettingsDialog(obj...
swprojects/Buildertron
buildertron/forms/generate_pyui.pyw
<reponame>swprojects/Buildertron # Generate python modules from UI forms import os import os.path try: os.chdir(os.path.split(__file__)[0]) except OSError: pass files = [f for f in os.listdir('.') if os.path.isfile(f)] for f in files: if not f.endswith('.ui'): continue os.system('pyuic5 -o ui{...
swprojects/Buildertron
buildertron/forms/mainwindow.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'mainwindow.ui' # # Created by: PyQt5 UI code generator 5.10 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWin...
swprojects/Buildertron
buildertron/forms/uiandroidpermissionsdialog.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'androidpermissionsdialog.ui' # # Created by: PyQt5 UI code generator 5.10 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_AndroidPermissionsDialog(object): def setupUi(self, ...
swprojects/Buildertron
buildertron/spec/default.py
<filename>buildertron/spec/default.py spec = { # PROJECT SETTINGS 'targetname': 'android', 'build_dir': './.buildozer', 'bin_dir': './bin', # APPLICATION 'title': 'My Application', 'package_name': 'myapp', 'version': '0.1', 'version_regex': '__version__ = [\'"](.*)[\'"]', 'versi...
swprojects/Buildertron
buildertron/dialogs/androidpermissionsdialog.py
#!/usr/bin/python3 # -*- coding: utf-8 -* """ Copyright (c) 2018 <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 to us...
swprojects/Buildertron
buildertron/spec/android_presplash_colors.py
<gh_stars>1-10 colors = [ 'red', 'blue', 'green', 'black', 'white', 'gray', 'cyan', 'magenta', 'yellow', 'lightgray', 'darkgray', 'grey', 'lightgrey', 'darkgrey', 'aqua', 'fuchsia', 'lime', 'maroon', 'navy', 'olive', 'purple', 'silver', 'teal' ] def get_android_presplash_colors(): return colors
swprojects/Buildertron
info.py
<reponame>swprojects/Buildertron<filename>info.py from os import path from buildertron.version import __version__ __projectname__ = 'buildertron' # __version__ = '0.1.1' __homepage__ = 'https://github.com/swprojects/Buildertron' __author__ = '<NAME>' __description__ = 'A buildozer front-end for Linux' __author_email__...
swprojects/Buildertron
buildertron/spec/buildozerdefault.py
<filename>buildertron/spec/buildozerdefault.py default_template = ("""[app] {app} [buildozer] {buildozer} """) def get_default_template(): return default_template
swprojects/Buildertron
buildertron/forms/uisubmitissuedialog.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'submitissuedialog.ui' # # Created by: PyQt5 UI code generator 5.10 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_SubmitIssueDialog(object): def setupUi(self, SubmitIssueDia...
swprojects/Buildertron
buildertron/forms/uimainwindow.py
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'mainwindow.ui' # # Created by: PyQt5 UI code generator 5.10 # # WARNING! All changes made in this file will be lost! from PyQt5 import QtCore, QtGui, QtWidgets class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWin...
swprojects/Buildertron
setup.py
<filename>setup.py # # buildertron # import subprocess from setuptools import setup, find_packages, Command from info import (__projectname__, __version__, __homepage__, __author__, __classifiers__, __readme__, __history__, __description__, __author_email__) class TestCommand(Comm...
swprojects/Buildertron
buildertron/dialogs/settingsdialog.py
#!/usr/bin/python3 # -*- coding: utf-8 -* """ Copyright (c) 2018 <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 to us...
swprojects/Buildertron
buildertron/spec/translate_objects.py
#!/usr/bin/python3 # -*- coding: utf-8 -* """ Copyright (c) 2018 <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 to us...
salRoid/Dynamic-Certificate-Generator
scripts/genCertificate.py
from PIL import Image, ImageDraw, ImageFont import pandas as pd import os import sys import json generationType = sys.argv[1] path = '/Users/salroid/Documents/GitHub/Dynamic-Certificate-Generator/' # Single or Bulk if (generationType == "Single") : certificateId = input("Enter certificate Id: ") pathCer...
salRoid/Dynamic-Certificate-Generator
scripts/getCoordinates.py
import sys import matplotlib.pyplot as plt import matplotlib.image as mpimg def onclick(event): print("button=%d, x=%d, y=%d, xdata=%f, ydata=%f" % ( event.button, event.x, event.y, event.xdata, event.ydata)) certificateName = sys.argv[1] certificateId = certificateName.split('.')[0] path = '/Users/sa...
salRoid/Dynamic-Certificate-Generator
scripts/genConfigFile.py
import sys import json # TODO Validate Plot Certificate.jpg exists if not ask to run # TODO Validate both the arguments certificateId = sys.argv[1] totalTextFields = sys.argv[2] totalTextFields = int(totalTextFields) # Create Dictionary for JSON config file data = {} data['properties'] = [] for i in range(0, total...
YW81/DAML
lib/functions/triplet_loss.py
<gh_stars>1-10 # -*- coding: utf-8 -*- import numpy as np import chainer.functions as F def triplet_loss(a,p,n,alpha=1.0): """Lifted struct loss function. Args: f_a (~chainer.Variable): Feature vectors as anchor examples. All examples must be different classes each other. f_p (...
theShmoo/DSA5RegelWikiParser
regelwikiparser/spiders/sonderfertigkeiten_spider.py
import scrapy class FightAbilities(scrapy.Spider): name = "fight" start_urls = [ 'http://www.ulisses-regelwiki.de/index.php/sf_kampfsonderfertigkeiten.html' ] def parse(self, response): for a in response.css('nav.mod_navigation a'): name = a.css('a::attr(title)').extract_first() lin...
salesforce/smartACL
smartACL/tools.py
# Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import itertools import sys try: import netaddr except: try: import sys s...
salesforce/smartACL
smartACL/link.py
<filename>smartACL/link.py<gh_stars>1-10 #!/usr/bin/env python # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import sys import os import argpar...
salesforce/smartACL
tests/test_smartShadow.py
<filename>tests/test_smartShadow.py # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import unittest import sys import os from smartACL import lin...
salesforce/smartACL
smartACL/link_juniper.py
<gh_stars>1-10 #!/usr/bin/env python # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause from linkdef import * import sys def cidr_to_mask(cidr): ...
salesforce/smartACL
tests/test_Link.py
# Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import unittest import os import sys import glob from smartACL import link class smartTest(unit...
salesforce/smartACL
smartACL/linkdef.py
<reponame>salesforce/smartACL<filename>smartACL/linkdef.py # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause try: import netaddr except: try...
salesforce/smartACL
smartACL/link_cisco.py
<reponame>salesforce/smartACL #!/usr/bin/env python # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import sys from linkdef import * def cidr_to...
salesforce/smartACL
smartACL/dsmo_split.py
<reponame>salesforce/smartACL<gh_stars>1-10 #!/usr/bin/env python # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import argparse import linkdef...
salesforce/smartACL
smartACL/link_pol.py
#!/usr/bin/env python # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import sys import os import copy from linkdef import * def cidr_to_mask(c...
salesforce/smartACL
tests/test_smartCompare.py
# Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import unittest import sys import os from smartACL import linkdef from smartACL import link_cisco...
salesforce/smartACL
smartACL/link_fortigate.py
<reponame>salesforce/smartACL<gh_stars>1-10 #!/usr/bin/env python # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import sys from linkdef import ...
salesforce/smartACL
tests/test_smartLog.py
<filename>tests/test_smartLog.py # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import unittest import sys import os from smartACL import smartA...
salesforce/smartACL
smartACL/smartACL.py
<filename>smartACL/smartACL.py<gh_stars>1-10 #!/usr/bin/env python # Copyright (c) 2018, salesforce.com, inc. # All rights reserved. # Licensed under the BSD 3-Clause license. # For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause import sys import os import gl...
pedronogs/convert-udt-spacy
convert.py
import json import subprocess import spacy import re import argparse # Convert NER tag to IOB format based on token and annotated text def convertIOB(token, annotation_text, annotation_label, previous_annotation): # If token is equal to annotated text or at least first word, return with 'B' tag if token == an...
guineawheek/aiotoa
aiotoa/http.py
<gh_stars>0 from asyncio import sleep from urllib.parse import urlencode import datetime import json import aiohttp from async_timeout import timeout as atimeout from .models import * __all__ = ["AioTOAError", "TOASession"] def endpoint(endp, query_params=None): def wrapper(func): async def new_func(sel...
guineawheek/aiotoa
aiotoa/__init__.py
from . import * from .http import TOASession, AioTOAError
ufo-github/google-sign-in
main.py
<reponame>ufo-github/google-sign-in #!/usr/bin/python # Copyright Google Inc. 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/LICEN...
Griffintaur/News-At-Command-Line
setup.py
from setuptools import setup, find_packages from os import path here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.md')) as f: long_description = f.read() setup( name="News At Command Line", version="0.0.1", description="Read your news on your favourite terminal", autho...
kjagodka/porth
porth.py
<filename>porth.py #!/usr/bin/env python3 import os import sys import subprocess import shlex from os import path from typing import * from enum import IntEnum, Enum, auto from dataclasses import dataclass from copy import copy from time import sleep import traceback PORTH_EXT = '.porth' DEFAULT_EXPANSION_LIMIT=1000 ...
Jael-G/lifepy
examples/lifepygame.py
import pygame from lifepy import lifepy from pygame import event ''' Using Pygame to show a lifepy simulation ''' DISPLAY_H =500 DISPLAY_W = 500 CELL_SPACE = 10 ''' Note: The width and height are the size of the window, and the cell space is the amount of pixels from said window that EACH cell will take. Therefore, ce...
Jael-G/lifepy
src/lifepy/lifepy.py
<gh_stars>0 import curses import numpy import random import sys import time class Simulator: def __init__(self, m_size=50, n_size=50, mode='DEFAULT', live_char='#', dead_char='-'): self.__m_size = m_size self.__n_size = n_size self.mode = mode self.__array = None self.live_...
kirkeaton/sudoku-image-solver
imsudoku.py
<reponame>kirkeaton/sudoku-image-solver import cv2 import homography import numpy as np import os from libsvm.svmutil import * from PIL import Image from pylab import * from scipy import ndimage H = 1 # helper functions for the sudoku solver # Ref(s): # http://stackoverflow.com/questions/201461/shortest-sudoku-so...
qyxqyx/LWML
main.py
import numpy as np import random import tensorflow as tf from lwau import LWAU from tensorflow.python.platform import flags import os from task_generator import TaskGenerator FLAGS = flags.FLAGS flags.DEFINE_integer('metatrain_iterations', 60000, 'number of metatraining iterations.') # Training options flags.DEFINE_...
qyxqyx/LWML
utils.py
import os import random import tensorflow as tf from tensorflow.contrib.layers.python import layers as tf_layers from tensorflow.python.platform import flags FLAGS = flags.FLAGS ## Image helper def get_images(paths, nb_samples=None): support = [] query = [] for i, path in enumerate(paths): images...
qyxqyx/LWML
networks.py
<gh_stars>1-10 import tensorflow as tf from tensorflow.python.platform import flags from utils import mse, xent, conv_block, normalize import numpy as np FLAGS = flags.FLAGS class Conv_4(object): def __init__(self): ''' Conv-4 backbone ''' self.channels = 3 self.dim_hidden ...
qyxqyx/LWML
task_generator.py
""" Code for loading data. """ import numpy as np import os import random import tensorflow as tf from tensorflow.python.platform import flags from utils import get_images import os import pwd import cv2 import math FLAGS = flags.FLAGS def random_crop(img, scale=(0.6, 1.0), ratio=(3. / 4., 4. / 3.)): shape = im...
qyxqyx/LWML
lwau.py
from __future__ import print_function import numpy as np import tensorflow as tf from tensorflow.python.platform import flags from utils import mse, xent, conv_block, normalize from networks import Conv_4, ResNet12 FLAGS = flags.FLAGS class LWAU: def __init__(self, dim_input=1, dim_output=1): self.dim_i...
mfrister/phipsair
setup.py
<reponame>mfrister/phipsair<filename>setup.py from setuptools import find_packages, setup with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name="phipsair", version="0.4.1", description="phipsair allows controlling Philips air purifiers via encrypted CoAP.", ...
Nathaliacr/Nathaliacr-NathaliaCalderon_Ejercicio23
ejecuta.py
import os import numpy as np import matplotlib.pyplot as plt os.system("g++ suma.cpp -o suma.x") os.system("./suma.x > suma.dat") data = np.loadtxt("suma.dat") print(data)
AaqeelorShahid/Task-7
main.py
<reponame>AaqeelorShahid/Task-7 import numpy as np import matplotlib.pyplot as plt import pandas as pd # Import dataset dataset = pd.read_csv('UK.csv') X = dataset.iloc[:, [1, 2]].values # Using Elbow method to find number of Clusters from sklearn.cluster import KMeans wcss = [] for i in range(1, 11): kmeans =...
bioinformed/esa
esa/__init__.py
<filename>esa/__init__.py from esa import *
bioinformed/esa
setup.py
<gh_stars>1-10 import numpy as np from setuptools import setup, find_packages from Cython.Distutils import build_ext from distutils.extension import Extension install_requires = ['Cython>=0.22', 'nose'] setup_requires = [] tests_require = ['coverage'] ext_modules = [Extension('esa.rmq', ['esa/rmq.pyx'], ...
jonashackt/pulumi-example-aws-python
__main__.py
import pulumi import pulumi_aws as aws from pulumi_aws import ec2 # AMI image configuration ec2_image_id = 'ami-07d1bb89ff2dd50fe' ec2_image_owner = '099720109477' ec2_instance_size = 't2.micro' ec2_instance_name = 'aws-ec2-ubuntu' ec2_keypair_name = 'pulumi_key' ec2_ssh_port = 22 # Lets use Pulumi to get the AMI ima...
jonashackt/pulumi-example-aws-python
tests/test_docker.py
import os def test_is_docker_installed(host): package_docker = host.package('docker-ce') assert package_docker.is_installed def test_vagrant_user_is_part_of_group_docker(host): user_vagrant = host.user('vagrant') assert 'docker' in user_vagrant.groups def test_run_hello_world_container_successfu...
ahedengren/dbt-vertica
dbt/adapters/vertica/connections.py
<reponame>ahedengren/dbt-vertica from contextlib import contextmanager from dataclasses import dataclass import ssl import os import requests from typing import Optional from dbt.adapters.base import Credentials from dbt.adapters.sql import SQLConnectionManager from dbt.logger import GLOBAL_LOGGER as logger from dbt....
ahedengren/dbt-vertica
setup.py
#!/usr/bin/env python from setuptools import find_packages from setuptools import setup import pathlib package_name = "dbt-verrtica" package_version = "0.21.0" description = """The vertica adapter plugin for dbt (data build tool)""" HERE = pathlib.Path(__file__).parent README = (HERE / "README.md").read_text() setup...
AminovE99/link_saver
visited_links/tests.py
<gh_stars>0 import ast import json import time import unittest import redis from django.test import TestCase, Client # Create your tests here. from link_saver import settings from visited_links.apps import VisitedLinksConfig from visited_links.views import VisitedLinksRegisterView class TestVisitedLinks(unittest.Te...
AminovE99/link_saver
visited_links/utils.py
import urllib.parse as urlparse def handle_links(links): """ Validate links from usual strings :param links: list of strings with possible links :return: set of strings """ handled_links = [] for link in links: h_link = urlparse.urlparse(link) if not h_link: co...
AminovE99/link_saver
visited_links/redis_services.py
<reponame>AminovE99/link_saver import ast def save_link_visits(redis_instance, links, timestamp): redis_instance.zadd('links', {str(links): timestamp}) def get_links_from(redis_instance, timestamp_from, timestamp_to): links = redis_instance.zrangebyscore('links', timestamp_from, timestamp_to) all_links ...
AminovE99/link_saver
visited_links/views.py
import json import time import redis from django.http import JsonResponse from rest_framework.views import APIView from link_saver import settings from visited_links.redis_services import save_link_visits, get_links_from from visited_links.utils import handle_links class VisitedLinksRegisterView(APIView): def ...
jaketanderson/openff-evaluator
openff/evaluator/tests/test_utils/test_tcp.py
""" Units tests for openff.evaluator.utils.tcp """ from openff.evaluator.utils import tcp def test_message_packing(): """Test that packing / unpacking ints works as expected""" assert tcp.unpack_int(tcp.pack_int(20))[0] == 20 def test_message_type_enum(): """Test the message type enum creation.""" a...
jaketanderson/openff-evaluator
openff/evaluator/tests/test_plugins.py
""" Units tests for the openff.evaluator.plugins module. """ import pkg_resources from openff.evaluator.layers import ( registered_calculation_layers, registered_calculation_schemas, ) from openff.evaluator.plugins import register_default_plugins, register_external_plugins from openff.evaluator.workflow import...
jaketanderson/openff-evaluator
openff/evaluator/tests/test_datasets/test_curation/test_workflow.py
<reponame>jaketanderson/openff-evaluator<filename>openff/evaluator/tests/test_datasets/test_curation/test_workflow.py import numpy import pandas import pytest from openff.units import unit from openff.evaluator.datasets import ( MeasurementSource, PhysicalPropertyDataSet, PropertyPhase, ) from openff.evalu...
jaketanderson/openff-evaluator
openff/evaluator/utils/exceptions.py
""" A collection of commonly raised python exceptions. """ import traceback from typing import Optional from openff.evaluator.utils.serialization import TypedBaseModel class EvaluatorException(TypedBaseModel, BaseException): """A serializable wrapper around an `Exception`.""" @classmethod def from_excep...
jaketanderson/openff-evaluator
openff/evaluator/properties/enthalpy.py
""" A collection of enthalpy physical property definitions. """ from openff.units import unit from openff.evaluator.attributes import UNDEFINED, PlaceholderValue from openff.evaluator.datasets import PhysicalProperty, PropertyPhase from openff.evaluator.datasets.thermoml import thermoml_property from openff.evaluator....
jaketanderson/openff-evaluator
openff/evaluator/tests/test_thermodynamics.py
""" Units tests for openff.evaluator.thermodynamics """ import pint import pytest from openff.units import unit from openff.evaluator.thermodynamics import ThermodynamicState def test_state_equality(): state_a = ThermodynamicState( temperature=1.0 * unit.kelvin, pressure=1.0 * unit.pascals ) st...
jaketanderson/openff-evaluator
openff/evaluator/backends/__init__.py
from .backends import CalculationBackend, ComputeResources, QueueWorkerResources __all__ = [ ComputeResources, CalculationBackend, QueueWorkerResources, ]
jaketanderson/openff-evaluator
openff/evaluator/datasets/provenance.py
"""A collection of classes to help track the provenance of measured / estimated properties. """ from openff.evaluator.utils.serialization import TypedBaseModel class Source(TypedBaseModel): """Container class for information about how a property was measured / calculated. .. todo:: Swap this out with a more ...
jaketanderson/openff-evaluator
openff/evaluator/protocols/miscellaneous.py
<reponame>jaketanderson/openff-evaluator """ A collection of miscellaneous protocols, mostly aimed at performing simple math operations. """ import typing import numpy as np from openff.units import unit from openff.evaluator.attributes import UNDEFINED from openff.evaluator.forcefield import ParameterGradient, Param...
jaketanderson/openff-evaluator
integration-tests/virtual-sites/run-tip4p.py
<gh_stars>10-100 import shutil from openff.toolkit.typing.engines.smirnoff import ForceField, ParameterList from openff.units import unit from openmm import unit as openmm_unit from openff.evaluator.forcefield import ParameterGradientKey, SmirnoffForceFieldSource from openff.evaluator.protocols.coordinates import Bui...
jaketanderson/openff-evaluator
openff/evaluator/datasets/utilities.py
from typing import TYPE_CHECKING, Set, Tuple if TYPE_CHECKING: import pandas def reorder_data_frame(data_frame: "pandas.DataFrame") -> "pandas.DataFrame": """Re-order the substance columns of a data frame so that the individual components are alphabetically sorted. Parameters ---------- dat...
jaketanderson/openff-evaluator
openff/evaluator/forcefield/__init__.py
from .forcefield import ( ForceFieldSource, LigParGenForceFieldSource, SmirnoffForceFieldSource, TLeapForceFieldSource, ) from .gradients import ParameterGradient, ParameterGradientKey __all__ = [ ForceFieldSource, SmirnoffForceFieldSource, LigParGenForceFieldSource, TLeapForceFieldSour...
jaketanderson/openff-evaluator
openff/evaluator/substances/components.py
<filename>openff/evaluator/substances/components.py """ An API for defining and creating substances. """ from enum import Enum from openff.evaluator.attributes import UNDEFINED, Attribute, AttributeClass class Component(AttributeClass): """Defines a single component in a chemical system, as well as it's rol...
jaketanderson/openff-evaluator
openff/evaluator/tests/test_utils/test_timeseries.py
<gh_stars>10-100 """ Units tests for openff.evaluator.utils.statistics """ import numpy as np from pymbar.timeseries import detectEquilibration from openff.evaluator.utils.timeseries import ( analyze_time_series, get_uncorrelated_indices, ) def test_analyze_time_series_std(): """Test the ``analyze_time_...
jaketanderson/openff-evaluator
openff/evaluator/datasets/curation/components/__init__.py
<gh_stars>10-100 from openff.evaluator.datasets.curation.components.components import ( CurationComponent, CurationComponentSchema, ) __all__ = [CurationComponent, CurationComponentSchema]
jaketanderson/openff-evaluator
openff/evaluator/datasets/thermoml/thermoml.py
<filename>openff/evaluator/datasets/thermoml/thermoml.py<gh_stars>10-100 """ An API for importing a ThermoML archive. """ import copy import logging import re import traceback from enum import Enum, unique from urllib.error import HTTPError from xml.etree import ElementTree import numpy as np import requests from open...
jaketanderson/openff-evaluator
openff/evaluator/layers/workflow.py
<filename>openff/evaluator/layers/workflow.py """Provides base classes for calculation layers which will use the built-in workflow framework to estimate the set of physical properties. """ import abc import copy import logging import os from openff.evaluator.attributes import UNDEFINED, Attribute from openff.evaluator...
jaketanderson/openff-evaluator
openff/evaluator/tests/test_forcefields/test_gradients.py
<reponame>jaketanderson/openff-evaluator import numpy as np import pytest from openff.units import unit from openff.evaluator.forcefield import ParameterGradient, ParameterGradientKey def test_gradient_addition(): gradient_a = ParameterGradient( ParameterGradientKey("vdW", "[#1:1]", "epsilon"), 1.0 * un...
jaketanderson/openff-evaluator
integration-tests/paprika/run.py
<gh_stars>10-100 import os from openff.toolkit.typing.engines.smirnoff import ForceField from openff.units import unit from openff import evaluator from openff.evaluator.attributes import UNDEFINED from openff.evaluator.backends import QueueWorkerResources from openff.evaluator.backends.dask import DaskLSFBackend fro...
jaketanderson/openff-evaluator
openff/evaluator/layers/plugins.py
""" An API for registering new calculation layers. Attributes ---------- registered_calculation_layers: dict of str and type of CalculationLayer The calculation layers which have been registered as being available to use in property estimations. registered_calculation_schemas: dict of str and dict of str and t...
jaketanderson/openff-evaluator
openff/evaluator/tests/test_layers/test_layers.py
<reponame>jaketanderson/openff-evaluator import json import tempfile from os import makedirs, path from openff.evaluator.backends.dask import DaskLocalCluster from openff.evaluator.client import RequestOptions from openff.evaluator.layers import ( CalculationLayer, CalculationLayerResult, CalculationLayerS...
jaketanderson/openff-evaluator
openff/evaluator/datasets/__init__.py
<reponame>jaketanderson/openff-evaluator<filename>openff/evaluator/datasets/__init__.py from .provenance import CalculationSource, MeasurementSource, Source # isort:skip from .datasets import PhysicalProperty, PhysicalPropertyDataSet, PropertyPhase __all__ = [ PropertyPhase, PhysicalProperty, PhysicalProp...
jaketanderson/openff-evaluator
openff/evaluator/tests/test_layers/test_workflow_layer.py
<reponame>jaketanderson/openff-evaluator import os import tempfile from openff.units import unit from openff.evaluator.backends.dask import DaskLocalCluster from openff.evaluator.client import RequestOptions from openff.evaluator.forcefield import SmirnoffForceFieldSource from openff.evaluator.layers.simulation impor...
jaketanderson/openff-evaluator
openff/evaluator/datasets/curation/components/thermoml.py
import glob import io import logging import os import tarfile from multiprocessing import Pool from typing import Optional, Union import pandas import requests from pydantic import Field, HttpUrl from typing_extensions import Literal from openff.evaluator.datasets.curation.components import ( CurationComponent, ...
jaketanderson/openff-evaluator
docs/conf.py
<reponame>jaketanderson/openff-evaluator # -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/stable/config # -- Path setup -------------------...