repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
david-gpu/deep-makeover | dm_main.py | import os
# Disable Tensorflow's INFO and WARNING messages
# See http://stackoverflow.com/questions/35911252
if 'TF_CPP_MIN_LOG_LEVEL' not in os.environ:
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
import numpy as np
import numpy.random
import os.path
import random
import tensorflow as tf
import dm_celeba
import dm... |
david-gpu/deep-makeover | dm_utils.py | import math
import numpy as np
import scipy.misc
import tensorflow as tf
class Container(object):
"""Dumb container object"""
def __init__(self, dictionary):
self.__dict__.update(dictionary)
def _edge_filter():
"""Returns a 3x3 edge-detection functionally filter similar to Sobel"""
# See http... |
RoRyou/lost_ | model_.py | # coding: utf-8
import datetime
from collections import Counter
import warnings
from sklearn.preprocessing import OneHotEncoder
warnings.filterwarnings('ignore')
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn import tree
import matplotlib.pyplot as plt
plt.rcParams... |
RoRyou/lost_ | model_2.py | # coding: utf-8
import datetime
from collections import Counter
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn import tree
import matplotlib.pyplot as plt
import pymysql
import psycopg2
plt.rcParams['font.sans-serif'... |
RoRyou/lost_ | server_wash.py | import datetime
from collections import Counter
import warnings
warnings.filterwarnings('ignore')
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn import tree
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei'] # 显示中文标签
plt.rcParams['axes.unico... |
RoRyou/lost_ | liushidian.py | #coding: utf-8
import pandas as pd
from sklearn.preprocessing import OneHotEncoder, LabelEncoder
import plotly.graph_objs as go
from sklearn.model_selection import train_test_split
from sklearn import tree
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei'] # 显... |
RoRyou/lost_ | valiadataion_region.py | # -*- coding: utf-8 -*-
import pandas as pd
import psycopg2
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei']
plt.rcParams['axes.unicode_minus'] = False
import datetime
#参数设置
time_start = '2020-09-15'
time_end = '2020-10-14'
server_id = 'glb00011'
#固定参数
... |
RoRyou/lost_ | party_search.py | import numpy as np
import pandas as pd
import psycopg2
import datetime
time_start = '2020-10-07'
time_end = '2020-11-04'
server_id = 'glb00017'
psn_lv_30 = pd.read_csv('D:/data/A10_30_offline.csv')
BH_ = pd.read_csv('D:/data/A10BH_1.csv')
dead_time = datetime.datetime.strptime(str(time_end), '%Y-%m-%d'... |
RoRyou/lost_ | valiadataion_party.py | import pandas as pd
df5 = pd.read_csv('D:/data/final_data_5.csv')
df6 = pd.read_csv('D:/data/final_data_6.csv')
df7 = pd.read_csv('D:/data/final_data_7.csv')
df8 = pd.read_csv('D:/data/final_data_8.csv')
df9 = pd.read_csv('D:/data/final_data_9.csv')
df10 = pd.read_csv('D:/data/final_data_10.csv')
print(df5... |
RoRyou/lost_ | validation.py | import pandas as pd
df5 = pd.read_csv('D:/data/final_data_5.csv')
df6 = pd.read_csv('D:/data/final_data_6.csv')
df7 = pd.read_csv('D:/data/final_data_7.csv')
df8 = pd.read_csv('D:/data/final_data_8.csv')
df9 = pd.read_csv('D:/data/final_data_9.csv')
df10 = pd.read_csv('D:/data/final_data_10.csv')
dict = ... |
venkatesh-phenompeople/elasticsearch-formula | tests/test_kibana.py | <gh_stars>0
import pytest
@pytest.mark.kibana
def test_kibana_repository_configured(SystemInfo, File):
distro = SystemInfo.distribution
if distro in ['ubuntu', 'debian']:
assert File('/etc/apt/sources.list').contains(
'packages.elastic.co/kibana')
if distro in ['redhat', 'centos', 'fed... |
venkatesh-phenompeople/elasticsearch-formula | tests/test_nginx_extra_config.py | <gh_stars>0
import pytest
@pytest.mark.nginx
def test_nginx_extra_config_lines(File):
assert File('/etc/nginx/sites-enabled/kibana').contains('auth_basic on;')
@pytest.mark.nginx
def test_nginx_extra_file(File):
assert File('/etc/nginx/kibana_users').exists
assert File('/etc/nginx/kibana_users').contain... |
venkatesh-phenompeople/elasticsearch-formula | tests/test_elasticsearch.py | <reponame>venkatesh-phenompeople/elasticsearch-formula
"""Use testinfra and py.test to verify formula works properly"""
import pytest
import time
def test_elasticsearch_repository_configured(SystemInfo, File):
distro = SystemInfo.distribution
if distro in ['ubuntu', 'debian']:
assert File('/etc/apt/so... |
venkatesh-phenompeople/elasticsearch-formula | tests/test_elasticsearch_plugins.py | <reponame>venkatesh-phenompeople/elasticsearch-formula<filename>tests/test_elasticsearch_plugins.py
import pytest
@pytest.mark.plugins
def test_plugin_installed(Command):
assert 'cloud-aws' in Command.check_output(
'sudo /usr/share/elasticsearch/bin/plugin list')
@pytest.mark.plugins
def test_plugin_con... |
m5lk3n/how-tos | pi/sense-hat/main.py | from sense_hat import SenseHat
sense = SenseHat()
sense.show_message("Makes sense ;-)") |
SamWheating/KaggleTaxi | NeighbourhoodSegmentation/SegmentAndLabelData.py | import pandas as pd
import numpy as np
import math
import time
import csv
"""
Divide New York into a grid based on longitude and latitude.
Calculate average speed for every combination of pickup / dropoff points.
Re-label test and training Data with to / from neighbourhoods.
"""
start = time.time()
NUM_SEGMENTS =... |
SamWheating/KaggleTaxi | DistanceFit.py | <filename>DistanceFit.py
import pandas as pd
import numpy as np
import math
import time
import csv
MODE = "test"
AVG_KPS = 0.00400644693588925
"""
First ever submission to a Kaggle contest.
Compute the average rate of travel based on hypersine (as-the-crow-flies) distance
Calculate predictions based on (distance / a... |
SamWheating/KaggleTaxi | NeighbourhoodSegmentation/RunNeighbourhoodTest.py | import pandas as pd
import numpy as np
import math
import time
import csv
import datetime
"""
Lookup averaged kps for neighbourhood of trip, apply to trip distance.
Run Algorithm on test set, including fixed multiplier based on workday traffic or not.
"""
RUSH_HOUR_CONSTANT = 1.08
WEEKEND_CONSTANT = 0.99
def isT... |
SamWheating/KaggleTaxi | TitanicChallenge/TitanicModels.py | <reponame>SamWheating/KaggleTaxi
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import RandomForestClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.gaussian_process import GaussianProcessClassifier... |
SamWheating/KaggleTaxi | TitanicChallenge/DataExploration.py | <reponame>SamWheating/KaggleTaxi<filename>TitanicChallenge/DataExploration.py<gh_stars>0
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.ensemble import ExtraTreesClassifier
"""
Used as a sandbox for testing data cleaning and feature ranking.
"""
# Importing data
trainData = pd... |
SamWheating/KaggleTaxi | NeighbourhoodSegmentation/NeighbourhoodFit.py | import pandas as pd
import numpy as np
import math
import time
import csv
MODE = "test"
AVG_KPS = 0.00400644693588925 # Average speed of all routes.
"""
Iterate through training data and compute average speed for all taxi trips from / to each neighbourhood.
"""
start = time.time()
# TRAINING:
# Load Labelled se... |
SamWheating/KaggleTaxi | NeighbourhoodSegmentation/OptimizeTraffic.py | <reponame>SamWheating/KaggleTaxi
import pandas as pd
import numpy as np
import math
import time
import csv
import datetime
"""
Machine Learning / Optimization;
Test a Variety of Values for Traffic / no traffic time multiplier.
Return Best Values.
"""
data = pd.read_csv('trainlabelled.csv')
key = pd.read_csv('key.... |
andersbogsnes/ml_utils | src/ml_tooling/plots/target_feature_distribution.py | from matplotlib import pyplot as plt
from matplotlib.axes import Axes
import numpy as np
from ml_tooling.utils import DataType
from ml_tooling.plots.utils import _plot_barh
def plot_target_feature_distribution(
target: DataType,
feature: DataType,
title: str = "Target feature distribution",
method: s... |
andersbogsnes/ml_utils | src/ml_tooling/baseclass.py | <filename>src/ml_tooling/baseclass.py
import datetime
import pathlib
from contextlib import contextmanager
from importlib.resources import path as import_path
from typing import Tuple, Optional, Sequence, Union, List, Any
import joblib
import pandas as pd
from sklearn.base import is_classifier, is_regressor
from sklea... |
andersbogsnes/ml_utils | tests/test_visualizations/test_feature_importance_plot.py | from typing import List, Union
import pytest
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression, LinearRegression
from sklearn.neighbors import KNeighborsClassifier
from sklearn.pipeline import Pi... |
andersbogsnes/ml_utils | tests/test_visualizations/test_permutation_importance.py | <reponame>andersbogsnes/ml_utils
from typing import List, Union
import pytest
import sklearn
from matplotlib import pyplot as plt
from matplotlib.axes import Axes
from sklearn.ensemble import RandomForestClassifier
from sklearn.linear_model import LogisticRegression, LinearRegression
from sklearn.pipeline import Pipel... |
andersbogsnes/ml_utils | src/ml_tooling/transformers/date_encoder.py | import pandas as pd
from sklearn.base import BaseEstimator, TransformerMixin
class DateEncoder(BaseEstimator, TransformerMixin):
"""
Converts a date column into multiple day-month-year columns
"""
def __init__(
self, day: bool = True, month: bool = True, week: bool = True, year: bool = True
... |
andersbogsnes/ml_utils | src/ml_tooling/plots/viz/classification_viz.py | from typing import Optional, List
from matplotlib import pyplot as plt
from ml_tooling.plots import (
plot_confusion_matrix,
plot_roc_auc,
plot_lift_curve,
plot_pr_curve,
)
from ml_tooling.utils import VizError, _classify
from ml_tooling.plots.viz.baseviz import BaseVisualize
from ml_tooling.config im... |
andersbogsnes/ml_utils | src/ml_tooling/result/result.py | from typing import Any, List
import attr
from sklearn.base import is_classifier
from ml_tooling.data import Dataset
from ml_tooling.logging.log_estimator import Log
from ml_tooling.metrics import Metrics
from ml_tooling.plots.viz import ClassificationVisualize, RegressionVisualize
from ml_tooling.utils import Estimat... |
andersbogsnes/ml_utils | tests/test_results/test_result.py | import pathlib
import numpy as np
import pytest
import yaml
from sklearn.linear_model import LinearRegression
from ml_tooling import Model
from ml_tooling.data import load_demo_dataset
from ml_tooling.logging import Log
from ml_tooling.result import Result
class TestResult:
@pytest.fixture(scope="class")
de... |
andersbogsnes/ml_utils | tests/test_visualizations/test_target_feature_distribution.py | from unittest.mock import MagicMock
import pytest
from matplotlib import pyplot as plt
import pandas as pd
from sklearn.pipeline import Pipeline
from sklearn.datasets import fetch_openml
from ml_tooling.data import Dataset
class TestTargetFeatureDistribution:
@pytest.fixture()
def australian_dataset(self):
... |
rearc-data/fivethirtyeight-congress-generic-ballot | pre-processing/pre-processing-code/s3_md5_compare.py | # Compare the md5 of a file to the s3 etag md5
# Source: <NAME> on StackOverflow
# https://stackoverflow.com/questions/1775816/how-to-get-the-md5sum-of-a-file-on-amazons-s3
import hashlib
import botocore.exceptions
def md5_checksum(filename):
m = hashlib.md5()
with open(filename, 'rb') as f:
for data... |
kompasim/uyghur-maqal-temsillir | maqal/__init__.py | # encoding=utf-8
from maqal.maqal import Maqal
|
aurangzaib/dotfiles | battery_profile.py | import pandas as pd
import matplotlib.pyplot as plt
def get_battery_csv(csv_path=".dotfiles/battery_profile.csv"):
battery_profile = pd.read_csv(csv_path)
battery_profile.head()
return battery_profile
def get_date_time(battery_profile):
battery_date = battery_profile["Date"].values
battery_time = battery_... |
aurangzaib/dotfiles | scripts_python.py | import xlsxwriter
import glob
import os
def get_excel_writer(file_path):
try:
workbook = xlsxwriter.Workbook(file_path)
xls_writer = workbook.add_worksheet("Purchase History")
bold_format = workbook.add_format({"bold": True})
xls_writer.set_column("A:A", 20)
xls_writer.set_... |
pranavarora1895/fascinating_number | main.py | class Fascinating:
def __init__(self, start, end):
self.start = start
self.end = end
def mul_concat(self):
a = self * 1
b = self * 2
c = self * 3
return str(a) + str(b) + str(c)
def calc_fascinating(self):
res_num = Fascinating.mul_concat(self)
... |
Glignos/invenio-rdm-records | invenio_rdm_records/version.py | <gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file ... |
Glignos/invenio-rdm-records | invenio_rdm_records/marshmallow/json.py | <reponame>Glignos/invenio-rdm-records<filename>invenio_rdm_records/marshmallow/json.py
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute ... |
Glignos/invenio-rdm-records | invenio_rdm_records/ext.py | <reponame>Glignos/invenio-rdm-records
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT ... |
Glignos/invenio-rdm-records | invenio_rdm_records/marshmallow/utils.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more det... |
Glignos/invenio-rdm-records | tests/unit/test_schemas_json_load.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more det... |
Glignos/invenio-rdm-records | invenio_rdm_records/cli.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more det... |
Glignos/invenio-rdm-records | invenio_rdm_records/config.py | <filename>invenio_rdm_records/config.py<gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the term... |
Glignos/invenio-rdm-records | tests/conftest.py | <filename>tests/conftest.py
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modifya
# it under the terms of the MIT License; ... |
Glignos/invenio-rdm-records | tests/api/test_demo_cli.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the terms of the MIT License; see LICENSE file for more det... |
Glignos/invenio-rdm-records | invenio_rdm_records/models.py | <filename>invenio_rdm_records/models.py<gh_stars>0
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 CERN.
# Copyright (C) 2019 Northwestern University,
# Galter Health Sciences Library & Learning Center.
#
# Invenio-RDM-Records is free software; you can redistribute it and/or modify
# it under the term... |
astokely/bubblebuster | bubblebuster/__init__.py | <reponame>astokely/bubblebuster
__version__="1.7"
from .bubblebuster import *
|
astokely/bubblebuster | tests/test_bubblebuster.py | <filename>tests/test_bubblebuster.py
import os
import numpy as np
import pytest
import bubblebuster
@pytest.mark.tryp_ben
def test_tryp_ben_num_atoms(
tryp_ben,
tryp_ben_num_atoms
):
assert tryp_ben.number_of_atoms == \
tryp_ben_num_atoms
@pytest.mark.tryp_ben
def test_tryp_cubic_par... |
astokely/bubblebuster | tests/conftest.py | <reponame>astokely/bubblebuster<filename>tests/conftest.py
import pytest
import shutil
import os
import bubblebuster
import numpy as np
@pytest.fixture(scope="session")
def tmp_test_files_dir(
tmpdir_factory
):
test_files_tmpdir_factory = \
tmpdir_factory.mktemp('test_files')
yield test... |
astokely/bubblebuster | setup.py | """
bubblebuster
A Python Library for detecting water box bubbles in structural
files used in molecular simulations.
"""
import sys
import os
from setuptools import setup, find_packages, Extension
from Cython.Build import cythonize
long_description = str("Bubblebuster is a Python Library for detecting water box bub... |
nomuryo7159/treasure-boxes | integration-box/cuenote-import/get_logs.py | import cuenote
import pandas
import io
import os
import sys
os.system(f"{sys.executable} -m pip install -U pytd==1.0.0 td-client")
import pytd
TD_API_KEY = os.environ.get("td_apikey")
TD_API_SERVER = os.environ.get("td_endpoint")
TD_DATABASE = os.environ.get("td_database")
def main():
# Create a TD client insta... |
Future-Aperture/Rodrigues_Online | calculo_Theo/main.py | <gh_stars>1-10
from functions import menu, titulo, lin
titulo('CÁLCULO')
menu()
while True:
try:
op = int(input('Sua opção:\n> '))
except:
print('Digite um valor inválido.')
if op == 1:
print()
titulo('opção 1!')
p = float(input('Preço do item R$: '))
... |
Future-Aperture/Rodrigues_Online | calculo-frete/functions.py | from decimal import Decimal, getcontext
import os
getcontext().prec = 10
def line():
print()
print("-=" * 30)
print()
def header(msg):
line()
print(f"{msg:^60}")
line()
def showMenu():
header("MENU PRINCIPAL")
print("""[1] Calcular Frete
[2] Calcular Preço de Venda [Com Frete Gráti... |
Future-Aperture/Rodrigues_Online | calculo_Theo/functions.py | <filename>calculo_Theo/functions.py
class Obj:
lucro = 20/100
imposto = 15/100
embalagem = 3
def titulo(msg):
print('-='*30)
print(f'{msg:^60}')
print('-='*60)
def lin():
print('-'*30)
def menu():
print('''
[ 1 ] Calcular um produto (produto+frete+lucro+embalagem)
[ 2 ] Calcular p... |
Future-Aperture/Rodrigues_Online | calculo-frete/main.py | <reponame>Future-Aperture/Rodrigues_Online
from functions import showMenu, line, Produto, header, number, Options
import os
options = Options()
produto = Produto(options)
opcao = None
os.system('cls')
header("AFTON")
showMenu()
line()
while True:
if opcao in [0, 1, 2, 3, 9]:
os.system('cls')
head... |
kmsravindra/bayesian_changepoint_detection | bayesian_changepoint_detection/online_changepoint_detection.py | from __future__ import division
import numpy as np
from scipy import stats
import math
def online_changepoint_detection(data, hazard_func, observation_likelihood):
maxes = np.zeros(len(data) + 1)
R = np.zeros((len(data) + 1, len(data) + 1))
R[0, 0] = 1
for t, x in enumerate(data):
# E... |
bentcooke/arm_pelion_psoc64_tools | psoc64_prov_tools/prov_helper_tool.py | import os
from cysecuretools import CySecureTools
from cysecuretools.execute import provision_device as prov_device
# from cysecuretools.execute.sys_call import get_prov_details
from cysecuretools.execute.programmer.programmer import ProgrammingTool
from cysecuretools.execute.provisioning_lib.cyprov_pem import PemKey
f... |
Jaesirky/pydesign | caculator.py | """This is a mini text caculator interpreter
Here is the grammar:
expression ::= func | value | `(` expression `)`
func ::= sin(expression)|cos(expression)|tan(expression)|cos(expression)|
value ::= 1.0 | nan
Author: Jaesirky
Email: <EMAIL>
License: MIT
Version: 0.0.1
"""
import re
import math
from typin... |
patrick91/strawberry-wagtail | example/home/migrations/0005_alter_homepage_body_blogpage.py | # Generated by Django 4.0.3 on 2022-03-23 04:23
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("wagtailimages", "0023_add_choose_permiss... |
patrick91/strawberry-wagtail | strawberry_wagtail/views.py | from functools import cached_property
from wagtail.core.models import Page
from django.apps import apps
from strawberry import Schema
from strawberry.django.views import GraphQLView as BaseGraphQLView
from .schema import get_schema_from_models
def get_schema() -> Schema:
all_models = apps.get_models()
pa... |
patrick91/strawberry-wagtail | tests/django_settings.py | SECRET_KEY = "12345"
DATABASES = {"default": {"ENGINE": "django.db.backends.sqlite3", "NAME": ":memory:"}}
INSTALLED_APPS = [
"django.contrib.auth",
"django.contrib.contenttypes",
"wagtail.users",
"wagtail.admin",
"wagtail.images",
"wagtail.core",
"tests.my_app",
]
AUTH_PASSWORD_VALIDATOR... |
patrick91/strawberry-wagtail | tests/my_app/models.py | from wagtail.core import blocks
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page
class BlogPage(Page):
body = RichTextField()
class CMSPage(Page):
body = StreamField(
[
("heading", blocks.CharBlock(form_classname="full title")),
... |
patrick91/strawberry-wagtail | strawberry_wagtail/apps.py | <filename>strawberry_wagtail/apps.py
from django.apps import AppConfig
class StrawberryWagtailAppConfig(AppConfig):
name = "strawberry_wagtail"
|
patrick91/strawberry-wagtail | tests/test_view.py | import json
import pytest
from wagtail.core.models import Locale
from tests.my_app.models import BlogPage
pytestmark = pytest.mark.django_db
@pytest.fixture(autouse=True)
def _locale():
Locale.objects.create(language_code="en")
def test_view_with_no_data(client):
response = client.post(
"/graph... |
patrick91/strawberry-wagtail | example/home/migrations/0003_homepage_body.py | # Generated by Django 4.0.3 on 2022-03-16 02:48
import wagtail.core.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0002_create_homepage"),
]
operations = [
migrations.AddField(
model_name="homepage",
nam... |
patrick91/strawberry-wagtail | example/home/migrations/0004_alter_homepage_body.py | # Generated by Django 4.0.3 on 2022-03-18 04:25
import wagtail.core.blocks
import wagtail.core.fields
import wagtail.images.blocks
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("home", "0003_homepage_body"),
]
operations = [
migrations.AlterF... |
patrick91/strawberry-wagtail | strawberry_wagtail/scalars.py | <filename>strawberry_wagtail/scalars.py
from typing import NewType
import strawberry
HTML = strawberry.scalar(NewType("HTML", str), serialize=str)
|
patrick91/strawberry-wagtail | example/home/models.py | <filename>example/home/models.py
from wagtail.admin.edit_handlers import FieldPanel, StreamFieldPanel
from wagtail.api import APIField
from wagtail.core import blocks
from wagtail.core.fields import RichTextField, StreamField
from wagtail.core.models import Page
from wagtail.images.blocks import ImageChooserBlock
from ... |
patrick91/strawberry-wagtail | strawberry_wagtail/schema.py | <filename>strawberry_wagtail/schema.py<gh_stars>10-100
import re
import types
from typing import Iterable, List, Optional, Type
from wagtail.core.fields import StreamField
from wagtail.core.models import Page
from django.db.models.fields import Field
import strawberry
import strawberry.django
from strawberry.django ... |
patrick91/strawberry-wagtail | strawberry_wagtail/stream_field.py | <reponame>patrick91/strawberry-wagtail
import dataclasses
from typing import Any, Callable, List, Optional, Type
from wagtail.core.blocks.field_block import CharBlock, FieldBlock, RichTextBlock
from wagtail.core.blocks.stream_block import StreamBlock
from wagtail.core.fields import StreamField
from wagtail.images.bloc... |
patrick91/strawberry-wagtail | tests/urls.py | <reponame>patrick91/strawberry-wagtail
from strawberry_wagtail.views import GraphQLView
from django.urls import path
urlpatterns = [
path("graphql", GraphQLView.as_view()),
]
|
patrick91/strawberry-wagtail | tests/test_type_generation.py | import textwrap
from strawberry_wagtail.schema import get_schema_from_models
from tests.my_app.models import BlogPage, CMSPage
def test_convert_type():
schema = get_schema_from_models([BlogPage])
assert (
str(schema)
== textwrap.dedent(
"""
type BlogPage {
id: ... |
rgbkrk/flying-elephants | silly.py | <gh_stars>1-10
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Silly example of using psycopg2's async.
This is a completely useless async example that is forced to run synchronous.
You'll need a database named test (or change it to a database you have).
.. code-block:: bash
$ createdb test
'''
import sel... |
joser1945/cmr-metadata-review | lib/CSVDIF.py | <reponame>joser1945/cmr-metadata-review
'''This file is for get CSV output for Collection DIF data'''
class DIFOutputCSV():
def __init__(self,checkerRules,wrap):
self.checkerRules = checkerRules
self.wrap = wrap
def checkAll(self, metadata):
result = ",,,"
try:
resu... |
joser1945/cmr-metadata-review | lib/CSVCollection.py | <gh_stars>10-100
'''This file is for get CSV output for Collection DIF data'''
class CollectionOutputCSVBackup():
def __init__(self,checkerRules,fetchAllPlatforms,fetchAllInstrs,fetchAllSciKeyWords):
self.checkerRules = checkerRules
self.fetchAllPlatforms = fetchAllPlatforms
self.fetchAllIn... |
joser1945/cmr-metadata-review | lib/xmlParser.py | <reponame>joser1945/cmr-metadata-review
'''
Copyright 2016, United States Government, as represented by the Administrator of
the National Aeronautics and Space Administration. All rights reserved.
The "pyCMR" platform is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except ... |
joser1945/cmr-metadata-review | lib/CollectionChecker.py | '''
Copyright 2016, United States Government, as represented by the Administrator of
the National Aeronautics and Space Administration. All rights reserved.
The "pyCMR" platform is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may ... |
joser1945/cmr-metadata-review | lib/JsonDIF.py | '''This file is for get JSON output for Collection DIF data'''
class DIFOutputJSON():
def __init__(self,checkerRules,wrap):
self.checkerRules = checkerRules
self.wrap = wrap
def checkAll(self, metadata):
result = {}
#=======================================
str = 'Entry_... |
joser1945/cmr-metadata-review | lib/parse/parseLocations.py | <reponame>joser1945/cmr-metadata-review<gh_stars>10-100
import csv
import urllib2
class parseLocations():
def __init__(self):
ResourcesTypeURL = "https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/locations?format=csv"
response = urllib2.urlopen(ResourcesTypeURL)
data = csv.reader... |
joser1945/cmr-metadata-review | lib/CheckerGranule.py | <filename>lib/CheckerGranule.py<gh_stars>10-100
import csv
import urllib2
import socket
from datetime import *
LINK_CHECK_TIMEOUT = 5
PlatformURL = "https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/platforms?format=csv"
InstrumentURL = "https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/instrument... |
joser1945/cmr-metadata-review | lib/parse/parseRange.py | import csv
import urllib2
class parseRange():
def __init__(self):
ResourcesTypeURL = "https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/temporalresolutionrange?format=csv"
response = urllib2.urlopen(ResourcesTypeURL)
data = csv.reader(response)
self.Temporal_Resolution_R... |
joser1945/cmr-metadata-review | lib/CSVGranule.py | <gh_stars>10-100
'''This file is for get CSV output for Collection DIF data'''
class GranuleOutputCSV():
def __init__(self,checkerRules,fetchAllInstrs):
self.checkerRules = checkerRules
self.fetchAllInstrs = fetchAllInstrs
def checkAll(self, metadata):
result = ", "
# result +=... |
joser1945/cmr-metadata-review | lib/CollectionCheckerDIF.py | <gh_stars>10-100
'''
Copyright 2016, United States Government, as represented by the Administrator of
the National Aeronautics and Space Administration. All rights reserved.
The "pyCMR" platform is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the ... |
joser1945/cmr-metadata-review | lib/CheckerCollection.py | import csv
import urllib2
import socket
from datetime import *
import re
LINK_CHECK_TIMEOUT = 5
class checkerRules():
def __init__(self,urls):
self.urls = urls
def checkShortName(self, val):
#print 'Input of checkShortName() is ' + val
if val == None:
return 'Provide a sh... |
joser1945/cmr-metadata-review | lib/parse/parseProvider.py | <reponame>joser1945/cmr-metadata-review<filename>lib/parse/parseProvider.py
import csv
import urllib2
class parseProvider():
def __init__(self):
ResourcesTypeURL = "https://gcmd.earthdata.nasa.gov/kms/concepts/concept_scheme/providers?format=csv"
response = urllib2.urlopen(ResourcesTypeURL)
... |
joser1945/cmr-metadata-review | lib/CheckerDIF.py | import datetime
import re
import urllib2
import requests
from parse.parseInstrument import parseInstrument
from parse.parsePlatform import parsePlatform
from parse.parseProjects import parseProjects
from parse.parseRuncontenttype import parseRuncontenttype
from parse.parseScienceKeyWord import parseScienceKeyWord
from... |
joser1945/cmr-metadata-review | lib/GranuleChecker.py | '''
Copyright 2016, United States Government, as represented by the Administrator of
the National Aeronautics and Space Administration. All rights reserved.
The "pyCMR" platform is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may ... |
joser1945/cmr-metadata-review | lib/cmr.py | '''
Copyright 2016, United States Government, as represented by the Administrator of
the National Aeronautics and Space Administration. All rights reserved.
The "pyCMR" platform is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may ... |
daemon/bungeeweb-gpt2 | bwgpt2/workspace.py | <gh_stars>0
UUID_RESOLVE_FILENAME = 'uuid-resolv.json'
CHAT_LOG_FILENAME = 'chat-log.tsv' |
daemon/bungeeweb-gpt2 | bwgpt2/run/tsv2dataset.py | <reponame>daemon/bungeeweb-gpt2
import argparse
import json
import os
import sys
from transformers import GPT2Tokenizer
from tqdm import tqdm
from bwgpt2.workspace import UUID_RESOLVE_FILENAME, CHAT_LOG_FILENAME
from bwgpt2.database import ChatRecord, ChatLog
def main():
parser = argparse.ArgumentParser()
p... |
daemon/bungeeweb-gpt2 | bwgpt2/run/convert_mm.py | <filename>bwgpt2/run/convert_mm.py
from pathlib import Path
import argparse
import re
from tqdm import tqdm
from bwgpt2.database import ChatLog, ChatRecord
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--input-path', '-i', type=str, required=True)
parser.add_argument('--output-path... |
daemon/bungeeweb-gpt2 | bwgpt2/database.py | from collections import defaultdict
from dataclasses import dataclass
from typing import List
import os
import random
from tqdm import tqdm
import pandas as pd
@dataclass
class ChatRecord(object):
time: int
uuid: str
username: str
content: str
@dataclass
class ChatLog(object):
records: List[Cha... |
daemon/bungeeweb-gpt2 | bwgpt2/run/finetune_gpt2.py | from collections import Counter
import argparse
import functools
import math
import random
import time
from transformers import GPT2Tokenizer, GPT2LMHeadModel, AdamW, get_linear_schedule_with_warmup
from torch.distributions.categorical import Categorical
import torch
import torch.nn as nn
import torch.utils.data as tu... |
daemon/bungeeweb-gpt2 | bwgpt2/data.py | <gh_stars>0
from collections import Counter
from dataclasses import dataclass
from typing import List
import glob
import os
import random
from tqdm import tqdm
import pandas as pd
import torch.nn as nn
import torch.utils.data as tud
@dataclass
class FlatFileDataset(tud.Dataset):
sentences: List[str]
def __g... |
daemon/bungeeweb-gpt2 | bwgpt2/run/db2tsv.py | <filename>bwgpt2/run/db2tsv.py<gh_stars>0
from collections import defaultdict, deque
from typing import List
import argparse
import getpass
import json
import os
import re
import sys
from tqdm import tqdm
import mysql.connector
import pandas as pd
from bwgpt2.workspace import UUID_RESOLVE_FILENAME, CHAT_LOG_FILENAME
... |
savardge/GeophoneOrientation | setup.py | <filename>setup.py
from setuptools import setup
setup(
name='GeophoneOrientation',
version='0.1',
packages=['fbpicker', 'hodogram'],
url='',
license='MIT',
author='savardge',
author_email='<EMAIL>',
description='Collection of scripts to find the orientation of 3C borehole geophones from... |
savardge/GeophoneOrientation | hodogram/hodogram.py | <gh_stars>0
""" Functions for hodogram analysis"""
import numpy as np
import math
import matplotlib.pyplot as plt
from scipy.spatial.transform import Rotation as R
def hodogram(comp1, comp2, compz, title="", ndt=0.001, azimuth=None, incidence=None):
"""
Plot an hodogram from 3C data
:param comp1: (numpy... |
savardge/GeophoneOrientation | fbpicker/pickers.py | <reponame>savardge/GeophoneOrientation
""" Simple first break pickers"""
from obspy.realtime.signal import kurtosis
import numpy as np
def get_arrival_from_kurtosis(st, win=0.1):
""" Use max of derivative of kurtosis """
tarr = []
for tr in st.traces:
k = kurtosis(st[0], win=win)
dk = np.... |
wedeling/CAF_reduced_SGS | reduced_sgs_more_efficient.py | """
========================================================================
PYTHON SCRIPT ACCOMPANYING:
W.EDELING, <NAME>,
"Reducing data-driven dynamical subgrid scale models
by physical constraints"
COMPUTERS & FLUIDS, 2019.
========================================================================
"""
#############... |
wedeling/CAF_reduced_SGS | generate_input.py | <reponame>wedeling/CAF_reduced_SGS
"""
GENERATES INPUT JSON FILES FOR REDUCED_SGS.PY
"""
import numpy as np
import json
import os
HOME = os.path.abspath(os.path.dirname(__file__))
#name of the generated input file
input_file = 'EZ_track'
description = "Input file tracking 2 QoI"
#target to track ('e', 'z', 'w1', '... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.