repo_name stringlengths 7 65 | path stringlengths 5 185 | copies stringlengths 1 4 | size stringlengths 4 6 | content stringlengths 977 990k | license stringclasses 14
values | hash stringlengths 32 32 | line_mean float64 7.18 99.4 | line_max int64 31 999 | alpha_frac float64 0.25 0.95 | ratio float64 1.5 7.84 | autogenerated bool 1
class | config_or_test bool 2
classes | has_no_keywords bool 2
classes | has_few_assignments bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
bd-j/prospector | prospect/likelihood/kernels.py | 1 | 4381 | import numpy as np
__all__ = ["Kernel", "Uncorrelated", "ExpSquared", "Matern", "PhotoCal",
"PhotSamples_MVN"]
class Kernel(object):
def __init__(self, parnames=[], name=''):
"""
:param parnames:
A list of names of the kernel params, used to alias the intrinsic
... | mit | 9da1df6a2a428bc9007dedfdf4023f6e | 31.213235 | 99 | 0.577037 | 3.870141 | false | false | false | false |
pingo-io/pingo-py | pingo/rpi/grove.py | 6 | 1903 | import pingo
grovepi = None
class GrovePi(pingo.Board, pingo.AnalogInputCapable, pingo.PwmOutputCapable):
def __init__(self):
global grovepi
try:
import grovepi as grovepi # noqa
except ImportError:
raise ImportError('pingo.rpi.GrovePi requires grovepi installed'... | mit | 26ee1024d735d52a13e05dcdbca8ec1f | 27.833333 | 82 | 0.576984 | 3.209106 | false | false | false | false |
pingo-io/pingo-py | pingo/iot/server.py | 1 | 1545 | from bottle import Bottle
import json
import pingo
import sys
app = Bottle(__name__)
board = pingo.detect.get_board()
@app.route('/')
def main():
pins = {key: repr(value) for key, value in board.pins}
return {
'board': repr(board),
'pins': json.dumps(pins)
}
@app.route('/mode/<mode>/<p... | mit | 5cfb07a6e71c42fad28d010f367271e7 | 19.328947 | 58 | 0.599353 | 3.153061 | false | false | false | false |
kivy/kivy-ios | kivy_ios/recipes/libffi/__init__.py | 1 | 1629 | from kivy_ios.toolchain import Recipe, shprint
import sh
from os.path import exists
class LibffiRecipe(Recipe):
version = "3.4.2"
url = "https://github.com/libffi/libffi/releases/download/v{version}/libffi-{version}.tar.gz"
library = "build/Release-{arch.sdk}/libffi.a"
include_per_arch = True
incl... | mit | fcdf18b195382eb282c8d1b44c1aa210 | 36.022727 | 97 | 0.576427 | 3.525974 | false | false | false | false |
algolia/algoliasearch-client-python | algoliasearch/http/requester.py | 1 | 1604 | from typing import Union
import requests
from requests import Timeout, RequestException, Session
from requests.adapters import HTTPAdapter
from urllib3.util import Retry
from algoliasearch.http.transporter import Response, Request
class Requester(object):
def __init__(self):
# type: () -> None
... | mit | 9e187c2ffdff2dc6c91c7b8f9f58d649 | 27.642857 | 86 | 0.595387 | 4.300268 | false | false | false | false |
algolia/algoliasearch-client-python | algoliasearch/search_client.py | 1 | 17008 | import base64
import hashlib
import hmac
import re
import time
import warnings
from typing import Optional, Union, List, Iterator
from algoliasearch.exceptions import ValidUntilNotFoundException
from algoliasearch.helpers import endpoint, is_async_available, build_raw_response_batch
from algoliasearch.http.request_op... | mit | a20db1ddfd78dca5efdeef9fe2b15326 | 34.881857 | 118 | 0.628645 | 3.990615 | false | false | false | false |
algolia/algoliasearch-client-python | algoliasearch/search_index.py | 1 | 20577 | import copy
import math
import random
import string
import time
from typing import Any, Optional, Dict, List, Union, Iterator, Callable
from algoliasearch.configs import SearchConfig
from algoliasearch.exceptions import (
MissingObjectIdException,
ObjectNotFoundException,
RequestException,
)
from algolias... | mit | 6658d4b5dc74e3a35e8357708ecca72c | 34.054514 | 134 | 0.602712 | 4.111289 | false | false | false | false |
algolia/algoliasearch-client-python | algoliasearch/recommendation_client.py | 1 | 4194 | import warnings
from typing import Optional, Union
from algoliasearch.configs import RecommendationConfig
from algoliasearch.helpers import is_async_available
from algoliasearch.http.request_options import RequestOptions
from algoliasearch.http.requester import Requester
from algoliasearch.http.transporter import Tran... | mit | eb4143dd205d243e5511c2994004d99b | 29.613139 | 99 | 0.556986 | 4.598684 | false | true | false | false |
gae-init/gae-init-debug | main/control/test.py | 11 | 2752 | # coding: utf-8
import flask
import flask_wtf
import wtforms
import auth
import util
from main import app
TESTS = [
'alert',
'badge',
'button',
'filter',
'font',
'form',
'grid',
'heading',
'label',
'pageres',
'pagination',
'paragraph',
'responsive',
'social',
'table',
]
class TestFor... | mit | e5129adebbdddc3529e77a98f091a29d | 26.79798 | 79 | 0.667151 | 3.487959 | false | true | false | false |
spyder-ide/qtpy | qtpy/compat.py | 1 | 5700 | #
# Copyright © 2009- The Spyder Development Team
# Licensed under the terms of the MIT License
"""
Compatibility functions
"""
import sys
from . import (
PYQT5,
PYQT6,
PYSIDE2,
PYSIDE6,
)
from .QtWidgets import QFileDialog
TEXT_TYPES = (str,)
def is_text_string(obj):
"""Return True if `obj` ... | mit | 373bfab841b69eeb796206e8790d14ec | 37.248322 | 79 | 0.59256 | 4.523016 | false | false | false | false |
spyder-ide/qtpy | qtpy/Qt3DLogic.py | 1 | 1343 | # -----------------------------------------------------------------------------
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provides Qt3DLogic classes a... | mit | 3cd048374f2601e3fd058c9b7f64876d | 28.822222 | 79 | 0.584203 | 3.845272 | false | false | false | false |
spyder-ide/qtpy | qtpy/QtWidgets.py | 1 | 2874 | # -----------------------------------------------------------------------------
# Copyright © 2014-2015 Colin Duquesnoy
# Copyright © 2009- The Spyder Development Team
#
# Licensed under the terms of the MIT License
# (see LICENSE.txt for details)
# ----------------------------------------------------------------------... | mit | dcd92ff62d76c0f465983259217db0ba | 52.185185 | 154 | 0.685237 | 3.691517 | false | false | false | false |
spyder-ide/qtpy | qtpy/cli.py | 1 | 2866 | # -----------------------------------------------------------------------------
# Copyright © 2009- The QtPy Contributors
#
# Released under the terms of the MIT License
# (see LICENSE.txt for details)
# -----------------------------------------------------------------------------
"""Provide a CLI to allow configuring... | mit | cfe9ea2cd0b6796f902cf474178993d6 | 31.556818 | 102 | 0.614311 | 4.152174 | false | false | false | false |
koduj-z-klasa/python101 | docs/pyqt/todopw/tabmodel_z3.py | 2 | 1068 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from PyQt5.QtCore import QAbstractTableModel, QModelIndex, Qt, QVariant
class TabModel(QAbstractTableModel):
""" Tabelaryczny model danych """
def __init__(self, pola=[], dane=[], parent=None):
super(TabModel, self).__init__()
se... | mit | 2ee6f6fdda79e8871136afcd39864696 | 26.894737 | 71 | 0.570755 | 3.231707 | false | false | false | false |
rochacbruno/dynaconf | example/issues/449_django_lazy_path/polls/views.py | 3 | 1623 | from __future__ import annotations
from django.conf import settings
from django.http import HttpResponse
def index(request):
tests = []
tests.append("<b>.env</b>")
tests.append(
"""<pre>DYNACONF_SERVER='prod_server_fromenv.com'
DEV_SERVER='dev_server_fromenv.com'
# switch envs or omit to default ... | mit | f53b73aa0e63d33ffcdc1642c560fc25 | 29.055556 | 77 | 0.645102 | 3.278788 | false | true | false | false |
koduj-z-klasa/python101 | docs/bazy/sql/sqlraw.py | 1 | 2275 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import sqlite3
# utworzenie połączenia z bazą przechowywaną na dysku
# lub w pamięci (':memory:')
con = sqlite3.connect('test.db')
# dostęp do kolumn przez indeksy i przez nazwy
con.row_factory = sqlite3.Row
# utworzenie obiektu kursora
cur = con.cursor()
# tworzenie... | mit | d3e03c7be281afe562c874674f106eac | 25.940476 | 77 | 0.65665 | 2.514444 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/vendor/toml/encoder.py | 1 | 4748 | _G=']\n'
_F=' = '
_E='\n'
_D=False
_C='['
_B='.'
_A=None
import datetime,re,sys
from decimal import Decimal
from .decoder import InlineTableDict
if sys.version_info>=(3,):unicode=str
def dump(o,f,encoder=_A):
if not f.write:raise TypeError('You can only dump an object to a file descriptor')
A=dumps(o,encoder=encoder)... | mit | 0173076b9e11b921b22c241e903f65b4 | 34.440299 | 348 | 0.617944 | 2.2805 | false | false | false | false |
koduj-z-klasa/python101 | bazy/sqlorm/sqlraw05.py | 1 | 2212 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sqlite3
# utworzenie połączenia z bazą przechowywaną w pamięci RAM
con = sqlite3.connect(':memory:')
# dostęp do kolumn przez indeksy i przez nazwy
con.row_factory = sqlite3.Row
# utworzenie obiektu kursora
cur = con.cursor()
# tworzenie tabel
cur.executescript... | mit | 7bc375b353bda68e25646c1e3e53c020 | 27.960526 | 77 | 0.651976 | 2.595519 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/vendor_src/ruamel/yaml/resolver.py | 1 | 15286 | # coding: utf-8
from __future__ import absolute_import
import re
if False: # MYPY
from typing import Any, Dict, List, Union, Text, Optional # NOQA
from .compat import VersionType # NOQA
from .compat import string_types, _DEFAULT_YAML_VERSION # NOQA
from .error import * # NOQA
from .nodes import Mapping... | mit | 41933438c13ef91891e354c19a8cc8a7 | 37.310777 | 94 | 0.534345 | 3.670108 | false | false | false | false |
koduj-z-klasa/python101 | docs/pyqt/widzety/widzety_z6.py | 1 | 4045 | #!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from PyQt5.QtWidgets import QApplication, QWidget
from gui_z6 import Ui_Widget
from PyQt5.QtGui import QColor
class Widgety(QWidget, Ui_Widget):
""" Główna klasa aplikacji """
kanaly = {'R'} # zbiór kanałów
kolorW = QColo... | mit | bc172e2d800422f5577342a6e2715ddb | 31.780488 | 79 | 0.593254 | 2.923858 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/vendor/ruamel/yaml/events.py | 1 | 2311 | _H='explicit'
_G='style'
_F='flow_style'
_E='value'
_D='anchor'
_C='implicit'
_B='tag'
_A=None
if False:from typing import Any,Dict,Optional,List
def CommentCheck():0
class Event:
__slots__='start_mark','end_mark','comment'
def __init__(A,start_mark=_A,end_mark=_A,comment=CommentCheck):
B=comment;A.start_mark=start... | mit | ca925a38ec19646835a9a6803fbfba0e | 50.377778 | 230 | 0.698399 | 2.699766 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/vendor/box/converters.py | 1 | 3165 | _G='r'
_F='w'
_E=False
_D=True
_C='strict'
_B='utf-8'
_A=None
import csv,json,sys,warnings
from pathlib import Path
import dynaconf.vendor.ruamel.yaml as yaml
from dynaconf.vendor.box.exceptions import BoxError,BoxWarning
from dynaconf.vendor import toml
BOX_PARAMETERS='default_box','default_box_attr','conversion_box',... | mit | e95a57f9d03bfa986ee54c361be3e3da | 39.589744 | 237 | 0.708689 | 2.56483 | false | false | false | false |
koduj-z-klasa/python101 | docs/mcpi/algorytmy/mcpi-lpi01.py | 1 | 1957 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import random
from time import sleep
import mcpi.minecraft as minecraft # import modułu minecraft
import mcpi.block as block # import modułu block
import local.minecraftstuff as mcstuff
os.environ["USERNAME"] = "Steve" # nazwa użytkownika
os.environ["COMPUTERNAME... | mit | df6c02bf1195ac4b4633f1a7e1d2890c | 26.956522 | 72 | 0.634526 | 2.301909 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/loaders/base.py | 1 | 6645 | from __future__ import annotations
import io
import warnings
from dynaconf.utils import build_env_list
from dynaconf.utils import ensure_a_list
from dynaconf.utils import upperfy
class BaseLoader:
"""Base loader for dynaconf source files.
:param obj: {[LazySettings]} -- [Dynaconf settings]
:param env: ... | mit | 899e423f6ffa11462b933aa4185d570e | 34.15873 | 79 | 0.52295 | 4.303756 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/vendor_src/ruamel/yaml/emitter.py | 1 | 64039 | # coding: utf-8
from __future__ import absolute_import
from __future__ import print_function
# Emitter expects events obeying the following grammar:
# stream ::= STREAM-START document* STREAM-END
# document ::= DOCUMENT-START node DOCUMENT-END
# node ::= SCALAR | sequence | mapping
# sequence ::= SEQUENCE-START node*... | mit | 3ffbd7951dc10cfa39a97331d748f37d | 36.937796 | 157 | 0.504177 | 4.2469 | false | false | false | false |
koduj-z-klasa/python101 | docs/pygame/life/code2.py | 1 | 5501 | # coding=utf-8
import pygame
import pygame.locals
class Board(object):
"""
Plansza do gry. Odpowiada za rysowanie okna gry.
"""
def __init__(self, width, height):
"""
Konstruktor planszy do gry. Przygotowuje okienko gry.
:param width: szerokość w pikselach
... | mit | e696a753fb70aac63ab28042af854324 | 30.77439 | 91 | 0.586419 | 2.834916 | false | false | false | false |
koduj-z-klasa/python101 | docs/mcpi/glife/mcpi-glife05.py | 1 | 7044 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# import sys
import os
from random import randint
from time import sleep
import mcpi.minecraft as minecraft # import modułu minecraft
import mcpi.block as block # import modułu block
os.environ["USERNAME"] = "Steve" # nazwa użytkownika
os.environ["COMPUTERNA... | mit | 09c488caff63d64e00dab05fbe63c4cd | 31.790244 | 79 | 0.511766 | 2.750993 | false | false | false | false |
koduj-z-klasa/python101 | docs/podstawy/przyklady/06_slownik_csv.py | 1 | 2677 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import os # moduł udostępniający funkcję isfile()
import csv # moduł do obsługi formatu csv
slownik = {} # pusty słownik
sFile = "slownik.csv" # nazwa pliku zawierającego wyrazy i ich tłumaczenia
def otworz(plik):
if os.path.isfile(sFile): # czy istnieje plik... | mit | 9497913348a04aaf3dbdb7c9bbb560a3 | 31.395062 | 77 | 0.587652 | 2.418433 | false | false | false | false |
koduj-z-klasa/python101 | docs/pygame/tictactoe_str/tictactoe_str2.py | 1 | 1654 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
import pygame
import sys
import random
from pygame.locals import * # udostępnienie nazw metod z locals
# inicjacja modułu pygame
pygame.init()
# przygotowanie powierzchni do rysowania, czyli inicjacja okna gry
OKNOGRY = pygame.display.set_mode((150, 150), 0, 32)
# tyt... | mit | 5158d6eb3c8412b5fefac906f0a789ae | 29.679245 | 72 | 0.559656 | 2.373723 | false | false | false | false |
koduj-z-klasa/python101 | docs/podstawy/przyklady/ocenyfun.py | 1 | 1478 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Moduł ocenyfun zawiera funkcje wykorzystywane w pliku 05_oceny_03.py
"""
import math # zaimportuj moduł matematyczny
def drukuj(co, kom="Sekwencja zawiera: "):
print(kom)
for i in co:
print(i, end=" ")
def srednia(oceny):
suma = sum(ocen... | mit | b640d518f7548f82db21a671ff221165 | 24.875 | 72 | 0.618357 | 2.202128 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/constants.py | 1 | 1259 | # pragma: no cover
from __future__ import annotations
INI_EXTENSIONS = (".ini", ".conf", ".properties")
TOML_EXTENSIONS = (".toml", ".tml")
YAML_EXTENSIONS = (".yaml", ".yml")
JSON_EXTENSIONS = (".json",)
ALL_EXTENSIONS = (
INI_EXTENSIONS + TOML_EXTENSIONS + YAML_EXTENSIONS + JSON_EXTENSIONS
) # noqa
EXTERNAL_L... | mit | 3c4f1fe35170de87eed90ba6380df44c | 23.211538 | 78 | 0.651311 | 2.941589 | false | false | false | false |
koduj-z-klasa/python101 | docs/mcpi/algorytmy/mcpi-lpi02.py | 1 | 2565 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import random
from time import sleep
import mcpi.minecraft as minecraft # import modułu minecraft
import mcpi.block as block # import modułu block
import local.minecraftstuff as mcstuff
os.environ["USERNAME"] = "Steve" # nazwa użytkownika
os.environ["COMPUTERNAME... | mit | 8d7ce47ae4d36184d7370631647fb2a9 | 28.034483 | 76 | 0.614014 | 2.319559 | false | false | false | false |
koduj-z-klasa/python101 | docs/mcpi/funkcje/mcpi-funkcje05.py | 1 | 5725 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np # import biblioteki do obliczeń naukowych
import matplotlib.pyplot as plt # import biblioteki do tworzenia wykresów
import mcpi.minecraft as minecraft # import modułu minecraft
import mcpi.block as block # import modułu block
os.environ["U... | mit | 776f3144e66d953a4d516e8c738982e5 | 28.541667 | 76 | 0.566467 | 2.228684 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/vendor_src/click/decorators.py | 1 | 11109 | import inspect
import sys
from functools import update_wrapper
from .core import Argument
from .core import Command
from .core import Group
from .core import Option
from .globals import get_current_context
from .utils import echo
def pass_context(f):
"""Marks a callback as wanting to receive the current context
... | mit | 89d307ed9b4cbfd351a10f2e5bad573c | 32.561934 | 83 | 0.603565 | 4.361602 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/vendor_src/click/_bashcomplete.py | 1 | 12216 | import copy
import os
import re
from collections import abc
from .core import Argument
from .core import MultiCommand
from .core import Option
from .parser import split_arg_string
from .types import Choice
from .utils import echo
WORDBREAK = "="
# Note, only BASH version 4.4 and later have the nosort option.
COMPLET... | mit | 10647f3d7f29d465e6abf4010b39273f | 31.927224 | 86 | 0.600606 | 3.973975 | false | false | false | false |
koduj-z-klasa/python101 | docs/podstawy/przyklady/05_oceny.py | 1 | 2058 | #! /usr/bin/env python3
# -*- coding: utf-8 -*-
# importujemy funkcje z modułu ocenyfun zapisanego w pliku ocenyfun.py
from ocenyfun import drukuj, srednia, mediana, odchylenie
def main(args):
przedmioty = set(['polski', 'angielski']) # definicja zbioru
drukuj(przedmioty, "Lista przedmiotów zawiera: ")
... | mit | f3d4a007fab2d96bf1cf512126ebb1f9 | 35.232143 | 75 | 0.593396 | 2.495695 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/utils/boxing.py | 1 | 2970 | from __future__ import annotations
import inspect
from functools import wraps
from dynaconf.utils import recursively_evaluate_lazy_format
from dynaconf.utils import upperfy
from dynaconf.utils.functional import empty
from dynaconf.vendor.box import Box
def evaluate_lazy_format(f):
"""Marks a method on Dynabox i... | mit | a5922b5b4c1363c36a87484597ed3104 | 31.282609 | 70 | 0.578451 | 3.882353 | false | false | false | false |
koduj-z-klasa/python101 | docs/mcpi/algorytmy/mcpi-rbrowna03.py | 1 | 5453 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import numpy as np # import biblioteki do obliczeń naukowych
import matplotlib.pyplot as plt # import biblioteki do tworzenia wykresow
from random import randint
from time import sleep
import mcpi.minecraft as minecraft # import modułu minecraft
import mcpi.bl... | mit | 84728bae0f52837093252b05c595c366 | 30.561404 | 77 | 0.577358 | 2.354712 | false | false | false | false |
rochacbruno/dynaconf | example/toml_with_secrets/program.py | 1 | 1331 | from __future__ import annotations
from dynaconf import LazySettings
settings = LazySettings(
environments=True,
ENV_FOR_DYNACONF="example",
ENVVAR_PREFIX_FOR_DYNACONF="PROGRAM",
load_dotenv=True,
settings_files="settings.toml;.secrets.toml",
)
print(settings.USERNAME)
print(settings.SERVER)
prin... | mit | d7a9fd6433388b3bb9215654fc05fce8 | 27.934783 | 77 | 0.666416 | 3.238443 | false | false | false | false |
rochacbruno/dynaconf | dynaconf/vendor_src/ruamel/yaml/events.py | 5 | 3902 | # coding: utf-8
# Abstract classes.
if False: # MYPY
from typing import Any, Dict, Optional, List # NOQA
def CommentCheck():
# type: () -> None
pass
class Event(object):
__slots__ = 'start_mark', 'end_mark', 'comment'
def __init__(self, start_mark=None, end_mark=None, comment=CommentCheck):... | mit | 091309e0638043578fdd78debbd241a8 | 23.853503 | 90 | 0.558688 | 3.660413 | false | false | false | false |
jblance/mpp-solar | mppsolar/helpers.py | 1 | 3001 | #!/usr/bin/env python3
import logging
import importlib
log = logging.getLogger("helpers")
def get_kwargs(kwargs, key, default=None):
if key not in kwargs or not kwargs[key]:
return default
return kwargs[key]
def key_wanted(key, filter=None, excl_filter=None):
# remove any specifically excluded ... | mit | 6c54b804da5ac7b6f96bc075e979028e | 31.619565 | 109 | 0.614795 | 3.793932 | false | false | false | false |
jonathf/chaospy | chaospy/distributions/baseclass/distribution.py | 1 | 33546 | """Abstract baseclass for all distributions."""
import logging
import numpy
import chaospy
from .utils import check_dependencies
class Distribution(object):
"""Baseclass for all probability distributions."""
__array_priority__ = 9000
"""Numpy override variable."""
interpret_as_integer = False
... | mit | a3b201561af7e362951084dc8daa6d90 | 36.149502 | 88 | 0.535354 | 4.206922 | false | false | false | false |
jonathf/chaospy | chaospy/distributions/operators/truncation.py | 1 | 8221 | """
Truncation.
Example usage
-------------
Simple distribution to start with::
>>> distribution = chaospy.Normal(0, 1)
>>> distribution.inv([0.9, 0.99, 0.999]).round(4)
array([1.2816, 2.3263, 3.0902])
Same distribution, but with a upper truncation::
>>> right_trunc = chaospy.Trunc(chaospy.Normal(0... | mit | 936a74829597bd11db8e2ebe925a6bf6 | 36.538813 | 88 | 0.541297 | 3.607284 | false | false | false | false |
pyamg/pyamg | pyamg/relaxation/smoothing.py | 1 | 24568 | """Method to create pre and post-smoothers on the levels of a MultilevelSolver.
The setup_smoother_name functions are helper functions for
parsing user input and assigning each level the appropriate smoother for
the functions in 'change_smoothers'.
The standard interface is
Parameters
----------
lvl : multilevel lev... | mit | 58ec31404b60a1909e978ba9cbed9de6 | 33.074896 | 83 | 0.577336 | 3.676193 | false | false | false | false |
pyamg/pyamg | pyamg/krylov/_gmres_mgs.py | 1 | 11065 | """GMRES Gram-Schmidt-based implementation."""
import warnings
from warnings import warn
import numpy as np
import scipy as sp
from scipy.linalg import get_blas_funcs, get_lapack_funcs
from ..util.linalg import norm
from ..util import make_system
def apply_givens(Q, v, k):
"""Apply the first k Givens rotations ... | mit | ab3756fd790ec8fc5367a692eb04874e | 32.734756 | 85 | 0.551649 | 3.666335 | false | false | false | false |
pyamg/pyamg | pyamg/krylov/_minimal_residual.py | 1 | 4817 | """Minimum Residual projection method."""
import warnings
from warnings import warn
import numpy as np
from ..util.linalg import norm
from ..util import make_system
def minimal_residual(A, b, x0=None, tol=1e-5,
maxiter=None, M=None,
callback=None, residuals=None):
"""Min... | mit | 1161e1f9cac0ee1d43f02504832d0821 | 29.295597 | 81 | 0.540793 | 3.826052 | false | false | false | false |
pyamg/pyamg | pyamg/gallery/tests/test_diffusion.py | 1 | 2626 | """Test diffusion example."""
import numpy as np
from pyamg.gallery.diffusion import diffusion_stencil_2d
from numpy.testing import TestCase, assert_equal, assert_almost_equal
class TestDiffusionStencil2D(TestCase):
def test_simple_finite_difference(self):
# isotropic
stencil = [[0.0, -1.0, 0.0],... | mit | 3912b8024529a72c647fb45a040b6147 | 40.68254 | 78 | 0.47639 | 3.237978 | false | true | false | false |
bbangert/routes | routes/middleware.py | 1 | 6548 | """Routes WSGI Middleware"""
import re
import logging
from webob import Request
from routes.base import request_config
from routes.util import URLGenerator
log = logging.getLogger('routes.middleware')
class RoutesMiddleware(object):
"""Routing middleware that handles resolving the PATH_INFO in
addition to ... | mit | c7aea3683696194f6c19f3a63986a3fb | 37.745562 | 79 | 0.529322 | 4.687187 | false | false | false | false |
joke2k/faker | faker/providers/person/no_NO/__init__.py | 1 | 7074 | from .. import Provider as PersonProvider
class Provider(PersonProvider):
formats = (
"{{first_name}} {{last_name}}",
"{{first_name}} {{last_name}}",
"{{first_name}} {{last_name}}",
"{{first_name}} {{last_name}}",
"{{first_name}} {{last_name}}",
"{{first_name}} {{la... | mit | 4b6772cc2f350c3dca7fae001151bbca | 19.03125 | 68 | 0.370869 | 3.11165 | false | false | false | false |
joke2k/faker | faker/providers/automotive/nl_NL/__init__.py | 1 | 2533 | import re
import string
from .. import Provider as AutomotiveProvider
class Provider(AutomotiveProvider):
"""Implement automotive provider for `nl_NL` locale.
Sources:
- https://en.wikipedia.org/wiki/Vehicle_registration_plates_of_the_Netherlands
- https://www.cbs.nl/en-gb/figures/detail/82044eng
... | mit | c42b5696d81eecbaca0dde4c32d02f0f | 31.896104 | 108 | 0.613502 | 3.503458 | false | false | false | false |
joke2k/faker | faker/providers/date_time/ru_RU/__init__.py | 1 | 53527 | from faker.typing import Country
from .. import Provider as DateTimeProvider
class Provider(DateTimeProvider):
DAY_NAMES = {
"0": "Воскресенье",
"1": "Понедельник",
"2": "Вторник",
"3": "Среда",
"4": "Четверг",
"5": "Пятница",
"6": "Суббота",
}
MO... | mit | f330a9e8013c2eb8e0666451d9851808 | 27.749543 | 115 | 0.416041 | 2.872329 | false | false | false | false |
joke2k/faker | faker/providers/phone_number/en_PH/__init__.py | 1 | 8227 | from typing import Sequence, Tuple
from ... import BaseProvider
class Provider(BaseProvider):
"""
Provider for Philippine mobile and landline telephone numbers
This provider has methods that generate phone numbers specific to service providers whenever applicable, because the
kinds of services, the ... | mit | fe8eea6fb4c2377045d9ff2d2b90124a | 31.646825 | 120 | 0.572019 | 3.496388 | false | false | false | false |
joke2k/faker | faker/providers/address/nl_NL/__init__.py | 1 | 57923 | from .. import Provider as AddressProvider
class Provider(AddressProvider):
building_number_formats = ("#", "##", "###", "#", "##", "###")
street_suffixes = (
"baan",
"boulevard",
"dreef",
"hof",
"laan",
"pad",
"ring",
"singel",
"steeg",... | mit | c964eee4b26695ad72966b352374b72f | 20.137742 | 77 | 0.424206 | 2.891977 | false | false | false | false |
joke2k/faker | tests/providers/test_file.py | 1 | 1697 | import re
import unittest
from faker import Faker
class TestFile(unittest.TestCase):
"""Tests file"""
def setUp(self):
self.fake = Faker()
Faker.seed(0)
def test_file_path(self):
for _ in range(100):
file_path = self.fake.file_path()
assert re.search(r"\/... | mit | ec99496343e115a6b1791aee722b5da9 | 33.632653 | 83 | 0.53683 | 3.421371 | false | true | false | false |
joke2k/faker | faker/providers/ssn/no_NO/__init__.py | 1 | 3339 | import datetime
import operator
from typing import List, Optional, Sequence
from ....typing import SexLiteral
from .. import Provider as SsnProvider
def checksum(digits: Sequence[int], scale: List[int]) -> int:
"""
Calculate checksum of Norwegian personal identity code.
Checksum is calculated with "Mod... | mit | 940599955c57c1d627708b4edd440dc3 | 39.204819 | 94 | 0.596344 | 3.627174 | false | false | false | false |
joke2k/faker | faker/providers/automotive/ro_RO/__init__.py | 1 | 1181 | import string
from .. import Provider as AutomotiveProvider
class Provider(AutomotiveProvider):
"""Implement automotive provider for ``ro_RO`` locale."""
license_plate_prefix = (
"AB",
"AG",
"AR",
"B",
"BC",
"BH",
"BN",
"BR",
"BT",
... | mit | 48fa9e190f18338257a82b98950876b8 | 16.893939 | 68 | 0.365792 | 3.679128 | false | false | false | false |
joke2k/faker | faker/providers/address/az_AZ/__init__.py | 1 | 15731 | from .. import Provider as AddressProvider
class Provider(AddressProvider):
city_formats = ("{{first_name}}",)
city_suffixes = ("şəhəri", "ş.")
street_suffixes = ("küçəsi", "küç.", "prospekti", "pr.")
village_suffixes = ("kəndi", "k.")
district_suffixes = ("rayonu", "ray.")
settlement_suffixes... | mit | 5e0e5d4a65442e317d136c948ba20b76 | 20.842258 | 117 | 0.43338 | 2.436713 | false | false | false | false |
joke2k/faker | faker/documentor.py | 1 | 4220 | import inspect
import warnings
from enum import Enum, auto
from typing import Any, Dict, List, Optional, Tuple, Type, Union
from .generator import Generator
from .providers import BaseProvider
from .proxy import Faker
class FakerEnum(Enum):
"""Required for faker.providers.enum"""
A = auto
B = auto
cl... | mit | 221db1a4d2908a6acf02f008f8c70c2d | 31.713178 | 82 | 0.500474 | 4.861751 | false | false | false | false |
joke2k/faker | faker/providers/person/fr_FR/__init__.py | 1 | 12993 | from .. import Provider as PersonProvider
class Provider(PersonProvider):
formats_female = (
"{{first_name_female}} {{last_name}}",
"{{first_name_female}} {{last_name}}",
"{{first_name_female}} {{last_name}}",
"{{first_name_female}} {{last_name}}",
"{{first_name_female}} {{... | mit | 5ebca554b2dde5ac05881db793fbbf1d | 18.46003 | 71 | 0.36971 | 3.082915 | false | false | false | false |
joke2k/faker | faker/providers/ssn/fi_FI/__init__.py | 1 | 2485 | import datetime
from .. import Provider as SsnProvider
class Provider(SsnProvider):
def ssn(self, min_age: int = 0, max_age: int = 105, artificial: bool = False) -> str:
"""
Returns 11 character Finnish personal identity code (Henkilötunnus,
HETU, Swedish: Personbeteckning). This function... | mit | 26013738c78adcdca13bb098e76cd6f7 | 38.333333 | 114 | 0.61138 | 3.644118 | false | false | false | false |
joke2k/faker | faker/providers/person/it_IT/__init__.py | 1 | 32695 | from .. import Provider as PersonProvider
class Provider(PersonProvider):
formats_male = (
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}",
"{{first_name_male}} {{last_name}}... | mit | 817a1d7eafb13b779eefd50d62554e00 | 18.593525 | 95 | 0.385503 | 3.032288 | false | false | false | false |
joke2k/faker | faker/providers/address/sk_SK/__init__.py | 1 | 122027 | from .. import Provider as AddressProvider
class Provider(AddressProvider):
city_formats = ("{{city_name}}",)
street_name_formats = ("{{street_name}}",)
street_address_formats = ("{{street_name}} {{building_number}}",)
address_formats = ("{{street_address}}\n{{postcode}} {{city}}",)
building_num... | mit | 43cac81a07acb2df43813b312d237649 | 21.062096 | 71 | 0.440183 | 2.484209 | false | false | false | false |
joke2k/faker | faker/providers/address/es_CL/__init__.py | 1 | 19951 | from collections import OrderedDict
from typing import Dict, Tuple
from ... import ElementsType
from ..es import Provider as AddressProvider
class Provider(AddressProvider):
# Source for regions, provinces and communes
# https://www.subdere.gov.cl/documentacion/c%C3%B3digos-%C3%BAnicos-
# territoriales-a... | mit | 99ed30814bed79fb15bd3b3ade833d82 | 29.54784 | 94 | 0.483607 | 2.820202 | false | false | false | false |
joke2k/faker | faker/providers/company/ru_RU/__init__.py | 1 | 45104 | from datetime import datetime
from .. import Provider as CompanyProvider
def calculate_checksum(value: str) -> str:
factors = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8][-len(value) :]
check_sum = 0
for number, factor in zip(value, factors):
check_sum += int(number) * factor
return str((check_sum % 1... | mit | ed01985107a939e7737711b01e4ad032 | 26.823077 | 111 | 0.491445 | 1.794938 | false | false | false | false |
joke2k/faker | faker/providers/person/ar_AA/__init__.py | 1 | 24447 | from typing import Tuple
from .. import Provider as PersonProvider
class Provider(PersonProvider):
formats_female: Tuple[str, ...] = (
"{{first_name_female}} {{last_name}}",
"{{prefix_female}} {{first_name_female}} {{last_name}}",
)
formats_male: Tuple[str, ...] = (
"{{first_name... | mit | 6e255abc053c3e1441896fa1b2cdabeb | 16.475184 | 79 | 0.302162 | 2.086818 | false | false | false | false |
joke2k/faker | faker/providers/address/fa_IR/__init__.py | 1 | 8017 | from .. import Provider as AddressProvider
class Provider(AddressProvider):
city_prefixes = (
"شمال",
"غرب",
"شرق",
"جنوب",
"بندر",
"شهر",
"روستای",
"دهستان",
"شهرستان",
"باغات",
"استان",
)
building_number_formats = ("... | mit | 3cb7cad930c7af333b296f9d1a25edc8 | 19.773649 | 81 | 0.401529 | 2.030713 | false | false | false | false |
joke2k/faker | faker/providers/profile/__init__.py | 1 | 2082 | import itertools
from datetime import date
from decimal import Decimal
from typing import Dict, List, Optional, Tuple, Union
from ...typing import SexLiteral
from .. import BaseProvider
class Provider(BaseProvider):
"""
This provider is a collection of functions to generate personal profiles and identities.... | mit | 4e9c355298bf552a47e3945d91980ca8 | 33.7 | 116 | 0.563401 | 3.928302 | false | false | false | false |
joke2k/faker | faker/providers/internet/en_PH/__init__.py | 1 | 2097 | from collections import OrderedDict
from faker.utils.decorators import lowercase, slugify
from .. import Provider as InternetProvider
class Provider(InternetProvider):
"""
Provider for internet stuff for en_PH locale
Free email domains are based on anecdotal evidence and experience. Available TLDs are ... | mit | 47adbc05873e3dff9296e945d0ba21a6 | 31.261538 | 118 | 0.562709 | 3.956604 | false | false | false | false |
joke2k/faker | faker/providers/credit_card/ru_RU/__init__.py | 1 | 3179 | from collections import OrderedDict
from typing import Optional
from faker.providers.person.ru_RU import translit
from .. import CardType, CreditCard
from .. import Provider as CreditCardProvider
class Provider(CreditCardProvider):
"""Implement credit card provider for ``ru_RU`` locale.
For all methods tha... | mit | 9c4bd1dd3ab934666e11f33f90fca2ee | 26.617391 | 108 | 0.460013 | 3.91133 | false | false | false | false |
jazzband/django-axes | axes/migrations/0004_auto_20181024_1538.py | 3 | 2197 | from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("axes", "0003_auto_20160322_0929")]
operations = [
migrations.AlterModelOptions(
name="accessattempt",
options={
"verbose_name": "access attempt",
... | mit | 16104e6e684b784ea4e3510f45603593 | 31.308824 | 87 | 0.515703 | 4.694444 | false | false | false | false |
atmtools/typhon | typhon/retrieval/mcmc/mcmc.py | 1 | 11539 | """
The mcmc submodule.
===================
Contains the MCMC which implements the Marcov Chain Monte Carlo method to
sample from a posterior distribution of a retrieval problem.
References
==========
[1] Andrew Gelman et al., Bayesian Data Analysis, 3rd Edition
"""
import logging
import numpy as np
logger = log... | mit | 79accffb663b746d2505f694cae73871 | 34.072948 | 81 | 0.544328 | 3.637768 | false | false | false | false |
atmtools/typhon | typhon/files/handlers/ocean_rain.py | 1 | 3663 | from .common import NetCDF4, expects_file_info
__all__ = [
'OceanRAIN',
]
class OceanRAIN(NetCDF4):
"""File handler that can read data from OceanRAIN NetCDF4 files.
This object handles OceanRAIN V1.0 NetCDF4 files such as they are
compatible with :mod:`typhon.collocations`, i.e.:
* rename *lati... | mit | 2b8fd8210bd99871aa34a710f78b496b | 32 | 83 | 0.56047 | 4.092737 | false | false | false | false |
atmtools/typhon | typhon/plots/maps.py | 1 | 5317 | """Functions related to plotting maps. """
from collections import namedtuple
from matplotlib import pyplot as plt
_CartopyError = ImportError(
"You have to install `cartopy` to use functions located in `typhon.plots.maps`."
)
def worldmap(
lat,
lon,
var=None,
fig=None,
ax=None,
project... | mit | cb558795887e9962fc38456d6918df56 | 24.752427 | 84 | 0.572102 | 3.833092 | false | false | false | false |
atmtools/typhon | typhon/files/handlers/tropomi.py | 1 | 2077 | from satpy import Scene
import xarray as xr
import pandas as pd
from .common import expects_file_info, FileHandler
__all__ = [
'TROPOMI',
]
class TROPOMI(FileHandler):
"""File handler for TROPOMI data using Satpy reader
"""
# This file handler always wants to return at least time, lat and lon
# ... | mit | 26ca3d66f64adf90e433ce0d01292958 | 27.847222 | 79 | 0.604718 | 4.088583 | false | false | false | false |
jaraco/keyring | keyring/backends/libsecret.py | 1 | 5973 | import logging
from .. import backend
from .._compat import properties
from ..backend import KeyringBackend
from ..credentials import SimpleCredential
from ..errors import (
PasswordDeleteError,
PasswordSetError,
KeyringLocked,
)
available = False
try:
import gi
from gi.repository import Gio
f... | mit | 2afef7e919ebbd62ea0e1734025078d1 | 37.288462 | 87 | 0.603047 | 4.514739 | false | false | false | false |
jaraco/keyring | keyring/cli.py | 2 | 3924 | #!/usr/bin/env python
"""Simple command line interface to get/set password from a keyring"""
import getpass
import argparse
import sys
from . import core
from . import backend
from . import set_keyring, get_password, set_password, delete_password
class CommandLineTool:
def __init__(self):
self.parser = ... | mit | 6bb41ee2062599cac1ddb35cbeb750a3 | 27.852941 | 84 | 0.556575 | 4.152381 | false | false | false | false |
ceph/ceph-deploy | ceph_deploy/hosts/common.py | 1 | 7735 | from ceph_deploy.util import paths
from ceph_deploy import conf
from ceph_deploy.lib import remoto
from ceph_deploy.util import constants
from ceph_deploy.util import system
def ceph_version(conn):
"""
Log the remote ceph-version by calling `ceph --version`
"""
return remoto.process.run(conn, ['ceph',... | mit | 228b4516a760ca3940d2396bd37fb947 | 30.189516 | 83 | 0.559793 | 3.966667 | false | false | false | false |
ceph/ceph-deploy | ceph_deploy/util/ssh.py | 1 | 1247 | import logging
from ceph_deploy.lib import remoto
from ceph_deploy.connection import get_local_connection
def can_connect_passwordless(hostname):
"""
Ensure that current host can SSH remotely to the remote
host using the ``BatchMode`` option to prevent a password prompt.
That attempt will error with ... | mit | 2bc68f0df387e0f1e1ea4fe77cac6260 | 37.96875 | 83 | 0.667201 | 4.212838 | false | false | false | false |
ceph/ceph-deploy | ceph_deploy/hosts/arch/install.py | 1 | 1139 | from ceph_deploy.hosts.centos.install import repo_install, mirror_install # noqa
from ceph_deploy.hosts.common import map_components
from ceph_deploy.util.system import enable_service, start_service
NON_SPLIT_PACKAGES = [
'ceph-osd',
'ceph-radosgw',
'ceph-mds',
'ceph-mon',
'ceph-mgr',
'ceph-c... | mit | 77126f3eb6ed20b819718b5b16097082 | 22.244898 | 81 | 0.632133 | 3.217514 | false | false | false | false |
liiight/notifiers | notifiers/providers/simplepush.py | 1 | 1091 | from ..core import Provider
from ..core import Response
from ..utils import requests
class SimplePush(Provider):
"""Send SimplePush notifications"""
base_url = "https://api.simplepush.io/send"
site_url = "https://simplepush.io/"
name = "simplepush"
_required = {"required": ["key", "message"]}
... | mit | e4e3e86f5c7b492ef292383b86123f24 | 31.088235 | 67 | 0.562786 | 3.841549 | false | false | false | false |
abusesa/abusehelper | abusehelper/core/events.py | 1 | 22236 | import re
import hashlib
import inspect
import collections
from base64 import b64decode
import idiokit
from idiokit.xmlcore import Element, Elements
def _replace_non_xml_chars(unicode_obj, replacement=u"\ufffd"):
return _NON_XML.sub(replacement, unicode_obj)
_NON_XML = re.compile(u"[\x00-\x08\x0b\x0c\x0e-\x1f... | mit | cbfd28e3f370d8707d4625aabd0503d1 | 29.048649 | 85 | 0.519473 | 3.999281 | false | false | false | false |
abusesa/abusehelper | abusehelper/core/rules/classifier.py | 1 | 1033 | class Classifier(object):
def __init__(self):
self._rules = dict()
def inc(self, rule, class_id):
classes = self._rules.get(rule, None)
if classes is None:
classes = dict()
self._rules[rule] = classes
classes[class_id] = classes.get(class_id, 0) + 1
... | mit | 679536d3571d5e898a2423dad1a7107f | 25.487179 | 56 | 0.516941 | 4.066929 | false | false | false | false |
erdc/proteus | proteus/tests/periodic/la_periodicGauss_p.py | 1 | 5749 | import numpy
from proteus import *
from proteus.default_p import *
from math import *
from proteus.mprans import VOF, NCLS, VOS3P
"""
Linear advection of a guassian with periodic bcs
"""
nd = 2#number of space dimensions
#constant velocity
velocity = numpy.array([1.0,1.0])
if nd == 3:
velocity = numpy.array([1.0,... | mit | 39a0c895ce3a4dd5a4a07059f08f53b2 | 34.054878 | 106 | 0.539398 | 2.697794 | false | false | false | false |
erdc/proteus | proteus/tests/AddedMass/addedmass3D.py | 1 | 4673 | from __future__ import print_function
from __future__ import division
from past.utils import old_div
import numpy as np
from proteus import Domain
from proteus.mprans import SpatialTools as st
from proteus.mbd import CouplingFSI as fsi
import pychrono as chrono
from proteus.TwoPhaseFlow import TwoPhaseFlowProblem as tp... | mit | 4bd118b79da26841e90c094b77493dc2 | 29.542484 | 94 | 0.625294 | 2.604794 | false | false | false | false |
erdc/proteus | proteus/tests/levelset/rotation/ls_rotation_2d_p.py | 1 | 6625 | from __future__ import absolute_import
from builtins import object
from proteus import *
from proteus.default_p import *
from math import *
try:
from .rotation2D import *
except:
from rotation2D import *
from proteus.mprans import NCLS
#import Profiling
LevelModelType = NCLS.LevelModel
logEvent = Profiling.log... | mit | c75d9c112ea8a6bcaea7a7a6cbb3a2a8 | 36.011173 | 130 | 0.569962 | 2.978867 | false | false | false | false |
erdc/proteus | proteus/tests/post_processing/import_modules/bdm_tests_3Dtemplate.py | 1 | 3679 | from builtins import range
from builtins import object
from proteus import iproteus as ip
from proteus import default_p as p
from proteus import default_n as n
from proteus import default_s,default_so
from proteus import Context
import numpy, os, inspect
import proteus as pr
from importlib import reload
reload(p)
reloa... | mit | 589c0b5f17150ddf591d46d1a8b65bd9 | 26.871212 | 109 | 0.665126 | 2.67175 | false | false | false | false |
erdc/proteus | proteus/NonlinearSolvers.py | 1 | 179593 | """
A hierarchy of classes for nonlinear algebraic system solvers.
.. inheritance-diagram:: proteus.NonlinearSolvers
:parts: 1
"""
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from builtins import str
from builtins import zip
from builtins import rang... | mit | b364070158a8a7e0f44b7eda304a69c2 | 48.474656 | 173 | 0.480832 | 3.976376 | false | false | false | false |
erdc/proteus | scripts/UTEPblock.py | 1 | 1592 | #!/usr/bin/env python
from __future__ import division
from builtins import range
from past.utils import old_div
import numpy
Lx=1.0; Ly=1.0;
nx=128; ny=128;
#nx=16; ny=16;
dx=old_div(Lx,nx); dy = old_div(Ly,ny)
vertices = []
for j in range(ny+1):
for i in range(nx+1):
vertices.append((0.0+dx*i,0.0+dy*j))
... | mit | 2e4b7dfc9515bfac0ff446079786fc8a | 26.929825 | 105 | 0.593593 | 2.441718 | false | false | false | false |
erdc/proteus | proteus/tests/POD/POD.py | 1 | 4974 | #!/usr/bin/env python
"""
Proper orthogonal decomposition for the heat equation solver
"""
from __future__ import print_function
from __future__ import division
from builtins import range
from past.utils import old_div
from heat_init import *
from read_hdf5 import *
#we construct this NS object again ONLY to have acce... | mit | e630611ffbd97c8e8c78ab9ef0618577 | 26.94382 | 108 | 0.6924 | 2.738987 | false | false | false | false |
erdc/proteus | proteus/tests/periodic/test_periodic.py | 1 | 5314 | #!/usr/bin/env python
"""
Test module for periodic boundary conditions and null space class.
"""
import proteus.test_utils.TestTools as TestTools
from proteus.iproteus import *
Profiling.logLevel = 7
Profiling.verbose = True
import os
import sys
import inspect
import numpy as np
import tables
import pickle
import pe... | mit | c4e5802e5fc9457761cb3d6f1ad41b42 | 38.954887 | 152 | 0.633233 | 3.331661 | false | true | false | false |
erdc/proteus | proteus/SWFlow/models/GN_sw_n.py | 1 | 3195 | from __future__ import absolute_import
from proteus import *
from proteus.default_n import *
from GN_sw_p import *
from proteus.Transport import Comm
# *********************************************** #
# ********** Read from mySWFlowProblem ********** #
# *********************************************** #
# READ FROM C... | mit | 23e6e59d5249b36759d9bb24f850afd7 | 32.989362 | 84 | 0.521127 | 3.643101 | false | false | false | false |
erdc/proteus | proteus/mprans/VOF.py | 1 | 72857 | # A type of -*- python -*- file
"""
An optimized volume-of-fluid transport module
"""
from __future__ import absolute_import
from __future__ import division
from builtins import range
from past.utils import old_div
import numpy as np
from math import fabs
import proteus
from proteus import cfemIntegrals, Quadrature, N... | mit | d76fe172900896013b78953c6e4dd6a5 | 51.077913 | 182 | 0.578476 | 3.820904 | false | false | false | false |
erdc/proteus | proteus/tests/MeshAdaptPUMI/Sizefields/cylinder2D_ibm/test_cylinder2D_ibm_rans2p.py | 1 | 3900 | """Tests for 2d flow around an immersed boundary cylinder with rans2p"""
from proteus.iproteus import *
from proteus import Comm
from proteus import Context
from proteus import MeshTools
from proteus import Domain
from proteus.MeshAdaptPUMI import MeshAdapt
import tables
import importlib
import subprocess
import pytest... | mit | d489367aafb5116d9fa6dd535d6f6adf | 36.142857 | 134 | 0.562564 | 3.939394 | false | true | false | false |
erdc/proteus | proteus/tests/POD/heat.py | 1 | 2171 | #!/usr/bin/env python
"""
Fine-scale heat equation solver
The equation is du/du - Laplace u + u + f(x,y,z,t) = 0
"""
from __future__ import print_function
from heat_init import *
physics.name = "heat_3d"
so.name = physics.name
ns = NumericalSolution.NS_base(so,[physics],[numerics],so.sList,opts)
import time
start = t... | mit | 19f62eeadd10b464b36e140a0f08fed2 | 31.402985 | 119 | 0.725933 | 2.690211 | false | false | false | false |
erdc/proteus | proteus/elastoplastic/ElastoPlastic.py | 1 | 68998 | from __future__ import print_function
from __future__ import division
from builtins import str
from builtins import range
from past.utils import old_div
import proteus
from proteus import FemTools, Archiver
from .cElastoPlastic import *
from math import atan, tan
import numpy as np
from proteus.Transport import OneLeve... | mit | 58604b8d9b96b62ec9630107cf52ede9 | 63.544434 | 199 | 0.587321 | 3.680875 | false | false | false | false |
erdc/proteus | proteus/tests/levelset/rotation/rotation2D.py | 1 | 3647 | from __future__ import absolute_import
from __future__ import division
from past.utils import old_div
from proteus import Domain
import os
#if True uses PETSc solvers
parallel = False
linearSmoother = None
#compute mass balance statistics or not
checkMass=False#True
#number of space dimensions
nd=2
#time integration, ... | mit | b528b31e5f26d4e4f3c9e54702434d01 | 27.944444 | 146 | 0.733205 | 2.721642 | false | false | false | false |
erdc/proteus | proteus/tests/levelset/vortex2D/ls_consrv_vortex_2d_p.py | 1 | 1478 | from __future__ import absolute_import
from builtins import object
from proteus import *
from proteus.default_p import *
try:
from .vortex2D import *
except:
from vortex2D import *
name=soname+"_phicor"
from proteus.mprans import MCorr
LevelModelType = MCorr.LevelModel
coefficients = MCorr.Coefficients(applyC... | mit | 469f726cfa9cdce84711dbccc69f8c84 | 26.37037 | 68 | 0.550744 | 3.713568 | false | false | false | false |
erdc/proteus | proteus/tests/levelset/vortex2D/tank2dDomain.py | 2 | 1565 | import math
from proteus import Domain
def tank2d(L=[1.0,1.0,1.0],fileprefix=None):
boundaries=['left','right','bottom','top','front','back','obstacle']
boundaryTags=dict([(key,i+1) for (i,key) in enumerate(boundaries)])
vertices=[[0.0,0.0],#0
[L[0],0.0],#1
[L[0],L[1]],#2
... | mit | 1fe742716738057d5330dd77ccf3d395 | 36.261905 | 76 | 0.461342 | 4.264305 | false | false | false | false |
erdc/proteus | proteus/tests/ci/poisson_3d_tetgen_p.py | 1 | 13327 | from __future__ import division
from builtins import range
from builtins import object
from past.utils import old_div
from proteus import *
from proteus.default_p import *
"""
Heterogeneous Poisson's equation, -div(a(x)u) = f(x), on unit domain [0,1]x[0,1]x[0,1]
"""
##\page Tests Test Problems
# \ref poisson_3d_p.py "... | mit | f263689770cc958df8abd57df124d055 | 39.880368 | 124 | 0.536955 | 2.857419 | false | false | false | false |
erdc/proteus | proteus/TwoPhaseFlow/utils/Parameters.py | 1 | 85685 | from __future__ import division
from past.utils import old_div
from builtins import object
import numpy as np
from petsc4py import PETSc
from proteus.Profiling import logEvent
from proteus.MeshTools import MeshOptions
from proteus.defaults import (Physics_base,
Numerics_base,
... | mit | b163bc450f9a717ad48bff5d40371fb9 | 43.122039 | 170 | 0.609768 | 3.624424 | false | false | false | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.