repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
gkucsko/NeMo | nemo/collections/nlp/data/dialogue/dataset/dialogue_zero_shot_intent_dataset.py | <reponame>gkucsko/NeMo
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2019 The Google Research Authors.
#
# 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 ... |
gkucsko/NeMo | nemo/collections/asr/parts/submodules/ssl_quantizers.py | # Copyright (c) 2020, NVIDIA CORPORATION. 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/LICENSE-2.0
#
# Unless required by appli... |
gkucsko/NeMo | nemo/collections/nlp/modules/common/prompt_encoder.py | <reponame>gkucsko/NeMo
# Copyright (c) 2022, NVIDIA CORPORATION. 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/LICENSE-2.0
#
# U... |
gkucsko/NeMo | nemo_text_processing/text_normalization/en/verbalizers/electronic.py | <gh_stars>0
# Copyright (c) 2021, NVIDIA CORPORATION. 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/LICENSE-2.0
#
# Unless requi... |
gkucsko/NeMo | nemo/collections/nlp/metrics/dialogue_metrics.py | # Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# Copyright 2019 The Google Research Authors.
#
# 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.a... |
gkucsko/NeMo | scripts/dataset_processing/nlp/financial_phrase_bank/prompt_learning_financial_phrase_bank_preprocessing.py | <filename>scripts/dataset_processing/nlp/financial_phrase_bank/prompt_learning_financial_phrase_bank_preprocessing.py
# Copyright (c) 2022, NVIDIA CORPORATION. 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.
# Y... |
gkucsko/NeMo | scripts/nemo_legacy_import/nlp_checkpoint_port.py | # Copyright (c) 2021, NVIDIA CORPORATION. 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/LICENSE-2.0
#
# Unless required by appli... |
gkucsko/NeMo | nemo/collections/asr/parts/utils/speaker_utils.py | <gh_stars>0
# Copyright (c) 2020, NVIDIA CORPORATION. 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/LICENSE-2.0
#
# Unless requi... |
gkucsko/NeMo | nemo/collections/nlp/models/language_modeling/megatron_finetune_model.py | # Copyright (c) 2022, NVIDIA CORPORATION. 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/LICENSE-2.0
#
# Unless required by appli... |
spyysalo/prodigy-wiki-linking | builddb.py | #!/usr/bin/env python3
import sys
from os.path import join
from collections import defaultdict
from argparse import ArgumentParser
from tqdm import tqdm
from sqlitedict import SqliteDict
def load_wd_aliases(fn):
"""
Load mapping from Wikidata QIDs to Wikidata aliases.
"""
total = 0
aliases_by_q... |
spyysalo/prodigy-wiki-linking | el_kb.py | <reponame>spyysalo/prodigy-wiki-linking
import sys
import os
import re
from collections import defaultdict
from logging import warning
from sqlitedict import SqliteDict
from standoff import ann_stream
def load_lemma_data(fn):
lemma_data = defaultdict(list)
with open(fn) as f:
for ln, l in enumerate... |
spyysalo/prodigy-wiki-linking | el_recipe.py | <gh_stars>0
import datetime
import hashlib
import prodigy
from pathlib import Path
from logging import warning
from prodigy.components.filters import filter_duplicates
from standoff import ann_stream
from el_kb import SqliteKnowledgeBase
def iso8601_now():
"""Return current time in ISO 8601 format w/o microse... |
spyysalo/prodigy-wiki-linking | standoff.py | import os
from glob import glob
from collections import namedtuple
from logging import warning
# Entity types to exlude by default from candidates
EXCLUDE_BY_DEFAULT = set([
'DATE',
'TIME',
'CARDINAL',
'ORDINAL',
'QUANTITY',
'PERCENT',
])
Textbound = namedtuple('Textbound', 'id type start e... |
spyysalo/prodigy-wiki-linking | filter_kb.py | <filename>filter_kb.py
#!/usr/bin/env python3
import sys
import os
from collections import defaultdict
from argparse import ArgumentParser
from el_kb import load_wd_aliases, load_descriptions, load_title_qid_map
from el_kb import load_counts
def save_aliases(fn, aliases_by_qid):
with open(fn, 'w') as f:
... |
jhult/compose_format | setup.py | <filename>setup.py<gh_stars>10-100
from setuptools import setup
def readme():
with open('README.rst') as file:
return file.read()
setup(
name='compose_format',
version='1.1.0',
description='format docker-compose files',
long_description=readme(),
url='http://github.com/funkwerk/compo... |
jhult/compose_format | compose_format/__init__.py | <filename>compose_format/__init__.py
from ruamel.yaml import RoundTripDumper, RoundTripLoader, dump, load
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from ruamel.yaml.scalarstring import SingleQuotedScalarString
class ComposeFormat:
TOPLEVEL_ORDER = ['version', 'services', 'volumes', 'networks', '... |
JinJackson/Simcse-unsup | train_unsup.py | # -*- coding: utf-8 -*-
# @Time : 2021/6/10
# @Author : kaka
import argparse
import logging
import os
from pathlib import Path
from datasets import load_dataset
import torch
import torch.nn.functional as F
from torch.utils.data import DataLoader
from tqdm import tqdm
from transformers import BertTokenizer
from S... |
JinJackson/Simcse-unsup | SimCSERetrieval.py | # -*- coding: utf-8 -*-
# @Time : 2021/6/10
# @Author : kaka
import faiss
import numpy as np
import torch
from tqdm import tqdm
from transformers import BertTokenizer
from SimCSE import SimCSE
class SimCSERetrieval(object):
def __init__(self,
fname,
pretrained_path,
... |
JinJackson/Simcse-unsup | test_unsup.py | # -*- coding: utf-8 -*-
# @Time : 2021/6/10
# @Author : kaka
import logging
from SimCSERetrieval import SimCSERetrieval
def main():
fname = "./data/news_title.txt"
pretrained = "hfl/chinese-bert-wwm-ext" # huggingface modelhub 下载的预训练模型
simcse_model = "./model/batch-1400"
batch_size = 64
max_... |
JinJackson/Simcse-unsup | CSECollator.py | # -*- coding: utf-8 -*-
# @Time : 2021/6/10
# @Author : kaka
class CSECollator(object):
def __init__(self,
tokenizer,
features=("input_ids", "attention_mask", "token_type_ids"),
max_len=100):
self.tokenizer = tokenizer
self.features = features... |
JinJackson/Simcse-unsup | SimCSE.py | <filename>SimCSE.py
# -*- coding: utf-8 -*-
# @Time : 2021/6/10
# @Author : kaka
import torch.nn as nn
from transformers import BertConfig, BertModel
class SimCSE(nn.Module):
def __init__(self, pretrained="hfl/chinese-bert-wwm-ext", pool_type="cls", dropout_prob=0.3):
super().__init__()
conf ... |
JinJackson/Simcse-unsup | eval_unsup.py | <filename>eval_unsup.py
# -*- coding: utf-8 -*-
# @Time : 2021/6/18
# @Author : kaka
import logging
import torch
import torch.nn.functional as F
import numpy as np
import scipy.stats
from transformers import BertTokenizer
from SimCSE import SimCSE
def load_test_data(fname, tokenizer, max_length):
lines = ope... |
Mamdasn/Perceptron-a-Showcase | Perceptron-a-Showcase.py | import pygame
import sys
window = pygame.display.set_mode((620,450))
pygame.display.set_caption("Time Series Analysis")
WHITE = [255, 255, 255]
RED = [200,0,0]
GREEN = [0,200,0]
BLACK = [20,20,20]
GRAY = [128,128,128]
window.fill(WHITE)
pygame.display.flip()
pygame.font.init() # you have to call this at the start, ... |
cohenjer/mscode | mscode/xp/fista_reglevel.py | <reponame>cohenjer/mscode
# Recov vs best lamb/lamb_max (generate randomly, find best, report scores, show histogram of realizations in background with second origin)
# Show av. Recovery vs deviations from best (0 dev means average from previous curve)
# Do for all Fistamix and Fista
# Check redundancy rate
import num... |
cohenjer/mscode | mscode/xp/general_comparison.py | <reponame>cohenjer/mscode<gh_stars>0
# recovery (and error) vs noise for all algorithms
# recovery (and error) vs condB for all algorithms
# recovery vs (k,d) for all algorithms (heatmap)
# todo: also condD?
# Questions:
# - test two distributions for X: Gaussian, and decreasing
# - to choose lambda(s), we fix accor... |
cohenjer/mscode | mscode/xp/homp_bahvior.py | <gh_stars>0
# Check convergence for k>1
# Same for iht ?
import numpy as np
from matplotlib import pyplot as plt
#from itertools import combinations, product
#import shelve
from mscode.utils.utils import count_support
from mscode.methods.algorithms import iht_mix, homp
from mscode.utils.generator import gen_mix, initia... |
cohenjer/mscode | mscode/xp/noise_comparison_nn.py | <reponame>cohenjer/mscode
# recovery (and error) vs noise for block-FISTA and its nonnegative version
# Questions:
# - test two distributions for X: Gaussian, and decreasing
# - to choose lambda(s), we fix according to average best one from a set of experiments using the same settings on the fly. The grid is very coa... |
cohenjer/mscode | mscode/xp/basic_tests.py | import numpy as np
from matplotlib import pyplot as plt
from itertools import combinations, product
import shelve
from mscode.utils.utils import count_support, redundance_count
from mscode.methods.algorithms import iht_mix, homp, omp, ls_kn_supp, pseudo_trick, brute_trick, ista_mix, ista, admm_mix, ista_nn
from mscode.... |
cohenjer/mscode | mscode/xp/runtimes.py | # Average 5 runs (problems) for various n,m dimensions. k,d fixed
# Same wrt k,d and n,m fixed large
# For all algorithms
# Check av. number of iterations and time per iteration as well when applicable
import numpy as np
from matplotlib import pyplot as plt
from itertools import combinations, product
import shelve
from... |
cohenjer/mscode | mscode/utils/utils.py | <filename>mscode/utils/utils.py
import numpy as np
from mscode.methods.algorithms import ista_mix, ista, ista_nn
from mscode.utils.generator import gen_mix, initialize
def count_support(Strue, Sest):
'''
Counts the number of corrected estimated atoms
Parameters
----------
Strue : list of list (or ... |
cohenjer/mscode | mscode/methods/prox_ind_l1_norm.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
This script illustrates how to use the call the compiled C code in Python
using ctypes.
@author: <NAME>
"""
# ============================================================================
# import modules
# ==============================================================... |
cohenjer/mscode | setup.py | #!/usr/bin/env python
import setuptools
setuptools.setup(
name='mscode',
version='0.0',
description='Code for Mixed Sparse Coding',
author='<NAME>',
author_email='<EMAIL>',
packages=setuptools.find_packages(),
license='MIT'
)
|
cohenjer/mscode | mscode/methods/algorithms.py | <filename>mscode/methods/algorithms.py
import numpy as np
from itertools import combinations
from mscode.methods.proxs import prox_ml1,prox_ml1_fast
from mscode.methods.proxs import SoftT
from mscode.methods.proxs import ml1
from mscode.methods.proxs import HardT
from mscode.methods.proxs import ls_kn_supp, ls_cg
from ... |
cohenjer/mscode | mscode/methods/proxs.py | import numpy as np
from scipy.optimize import nnls
from numpy.matlib import repmat as repmat
from mscode.methods.prox_ind_l1_norm import prox_l1inf
def ml1(X):
'''
Computes the induced matrix l1 norm of X
'''
return np.max(np.sum(np.abs(X), axis=0))
def SoftT(x, lamb):
'''
Computes the Soft-Th... |
cohenjer/mscode | mscode/utils/generator.py | <reponame>cohenjer/mscode<filename>mscode/utils/generator.py
import numpy as np
import tensorly as tl
def gen_mix(dims, k, snr=20, distr='Gaussian', cond=1, cond_rand=False, decrease_coeff = 0.7):
'''
Generates simulated dataset for experiments according to the mixed sparse coding model.
Parameters
-... |
cohenjer/mscode | mscode/xp/initialization_sensitivity.py | # For all functions, boxplot with normal and uniform inits, only error. Keep problem constant, Fista should not change results.
import numpy as np
from matplotlib import pyplot as plt
#from itertools import combinations, product
#import shelve
from mscode.utils.utils import count_support
from mscode.methods.algorithms ... |
4n6ir/remedy-lambda-public-ip-visibility | bundle/get-public-ip/extension.py | #!/usr/bin/env python3
import json
import os
import requests
import signal
import sys
from pathlib import Path
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
LAMBDA_EXTENSION_NAME = Path(__file__).parent.name
def execute_custom_processing(event):
retry_strategy = ... |
4n6ir/remedy-lambda-public-ip-visibility | remedy_lambda_public_ip_visibility/remedy_lambda_public_ip_visibility_stack.py | from aws_cdk import (
RemovalPolicy,
Stack,
aws_lambda as _lambda,
)
from constructs import Construct
class RemedyLambdaPublicIpVisibilityStack(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)
layer = _... |
tanukihee/Pearson3CurveFitting | HessianProbabilityGrid.py | # Pearson-III curve plotting and fitting,
# used for hydrological analysis and hydraulic calculations.
# v6.1
# Copyright (c) 2020 -- 2021 ListLee
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import probscale
import scipy.stats as stats
from scipy.optimize import curve_fit
from scipy.stats impo... |
Litou-lyh/pytorch_resnet_cifar10 | scheduler.py | import torch
import torch.optim.lr_scheduler as lr_scheduler
class MultiStageScheduler():
def __init__(self,optimizer,args=None) -> None:
self.optimizer = optimizer
self.policy = args.policy if args else None
self.schedulers = []
self.steps = 0
self.stage = 0
... |
Litou-lyh/pytorch_resnet_cifar10 | trainer.py | <filename>trainer.py
import argparse
import os
from scheduler import MultiStageScheduler
import shutil
import time
from typing_extensions import get_args
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.util... |
taldatech/tf-bgd | bgd_model.py | <filename>bgd_model.py
'''
Bayesian Gradient Descent
Implementation of the BGD algorithm:
The basic assumption is that in each step, the previous posterior distribution is used as the new prior distribution and that the parametric distribution is approximately a Diagonal Gaussian,
that is, all the parameters of th... |
taldatech/tf-bgd | bgd_regression_example.py | # imports
import tensorflow as tf
import numpy as np
from sklearn.model_selection import train_test_split
from bgd_model import BgdModel
from matplotlib import pyplot as plt
from datetime import datetime
import time
import os
import json
import shutil
from collections import OrderedDict
from random import shuffle
impor... |
rzhao271/css-none-scraper | scraper.py | <reponame>rzhao271/css-none-scraper
import ast
import re
import requests
from lxml import etree
valid_property_re = re.compile('^[^(@:]+$')
# scrape_properties: void -> [(link, property-name)]
def scrape_properties():
main_page_url = 'https://developer.mozilla.org/en-US/docs/Web/CSS/Reference'
content = requ... |
jD91mZM2/MCWASM | src/instructions.py | <reponame>jD91mZM2/MCWASM
from cmds import CmdGenerator
from value_types import Type, Types, Value
import wasm
CONDITION_COUNTER = 0
def InstructionHandler(func):
def first_invocation(*args):
def second_invocation(cmd, ins):
return func(*args, cmd, ins)
return second_invocation
re... |
jD91mZM2/MCWASM | src/transpiler.py | from collections import defaultdict, namedtuple
from enum import Enum
import wasm
from cmds import CmdGenerator
from instructions import InstructionTable
from value_types import Type
class ExportKind(Enum):
FUNCTION = 0x0
TABLE = 0x1
MEMORY = 0x2
GLOBAL = 0x3
Function = namedtuple("Function", ["nam... |
jD91mZM2/MCWASM | src/cmds.py | from value_types import Type, Value
class WithGuard:
def __init__(self, restore):
self.restore = restore
def __enter__(self):
pass
def __exit__(self, type, value, traceback):
self.restore()
class CmdGenerator:
def __init__(self, execute_params, types=None):
self.out... |
jD91mZM2/MCWASM | src/value_types.py | <reponame>jD91mZM2/MCWASM<gh_stars>1-10
from collections import defaultdict, namedtuple
import wasm
class Type(namedtuple(
"Type",
["name", "python_type", "format_spec", "mc_name"]
)):
def __str__(self):
return self.name
def __repr__(self):
return self.__str__()
def from_... |
jD91mZM2/MCWASM | src/main.py | <reponame>jD91mZM2/MCWASM<gh_stars>1-10
from argparse import ArgumentParser
from pathlib import Path
from string import Template
import json
import shutil
import sys
import transpiler
parser = ArgumentParser(description="Convert WASM to .mcfunction")
parser.add_argument("input", help="The .wasm file to input")
parser... |
whtsky/font-rename | font_rename.py | <reponame>whtsky/font-rename<filename>font_rename.py
#!/usr/bin/env python3
import argparse
from pathlib import Path
from typing import List
import cchardet as chardet
from fontTools.ttLib import TTCollection
from fontTools.ttLib import TTFont
from fontTools.ttLib.tables._n_a_m_e import NameRecord
from fontTools.ttLib... |
Marcelo-Augusto-Silva/Programa-que-encontrar-emails-e-telefones-em-textos | principal.py | import re
def email(txt):
email = re.compile('([a-zA-Z0-9._%+-]+)' # Nome do usuario
'(@[a-zA-Z0-9]+)' # dominio
'(\.[a-zA-Z]{2,4})') # depois do .com
procurar = email.findall(txt)
return procurar
def numero(num):
numero_celular = re.compile('(\(\... |
rberrelleza/cuelake | api/workflows/serializers.py | import json
from rest_framework import serializers
# from django_celery_beat.models import CrontabSchedule
from workflows.models import Workflow, WorkflowRun, NotebookJob
class WorkflowSerializer(serializers.ModelSerializer):
"""
Serializer for the model NotebookJob
"""
triggerWorkflow = serializers.Se... |
rberrelleza/cuelake | api/workflows/views.py | from django.http import HttpRequest
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.decorators import api_view
from workflows.services import WorkflowServices, WorkflowActions
class Workflows(APIView):
"""
Class to get and post workflows
"""
de... |
rberrelleza/cuelake | api/genie/admin.py | <reponame>rberrelleza/cuelake<filename>api/genie/admin.py
from django.contrib import admin
from genie.models import NotebookJob, RunStatus, Connection, ConnectionType, ConnectionParam, ConnectionParamValue, NotebookTemplate
class RunStatusAdmin(admin.ModelAdmin):
# Adding starttimestamp in a new modelAdmin class ... |
rberrelleza/cuelake | api/genie/migrations/0005_auto_20210414_1316.py | <gh_stars>0
# Generated by Django 3.1.7 on 2021-04-14 13:16
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('genie', '0004_auto_20210414_1012'),
]
operations = [
migrations.AlterField(
model_name='connectionparam',
... |
rberrelleza/cuelake | api/workflows/migrations/0003_auto_20210426_1919.py | <gh_stars>0
# Generated by Django 3.1.8 on 2021-04-26 19:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('workflows', '0002_auto_20210421_0926'),
]
operations = [
migrations.RenameField(
model_name='workflow',
old_name... |
rberrelleza/cuelake | api/system/migrations/0003_auto_20210418_0738.py | # Generated by Django 3.1.7 on 2021-04-18 07:38
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('system', '0002_auto_20210418_0735'),
]
operations = [
migrations.AlterField(
model_name='accountsetting',
name='valu... |
rberrelleza/cuelake | api/genie/migrations/0002_auto_20210318_1404.py | <reponame>rberrelleza/cuelake<filename>api/genie/migrations/0002_auto_20210318_1404.py
# Generated by Django 3.1.7 on 2021-03-18 14:04
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('genie', '0001_initial'),
]
o... |
rberrelleza/cuelake | api/genie/migrations/0009_merge_0008_runstatus_worflowrun_0008_schedule.py | <reponame>rberrelleza/cuelake
# Generated by Django 3.2 on 2021-05-04 02:19
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('genie', '0008_runstatus_worflowrun'),
('genie', '0008_schedule'),
]
operations = [
]
|
rberrelleza/cuelake | api/genie/tasks.py | <gh_stars>0
import json
import datetime as dt
import dateutil.parser as dp
import requests
import polling
from celery import shared_task
from django.conf import settings
from genie.models import NotebookJob, RunStatus, NOTEBOOK_STATUS_SUCCESS, NOTEBOOK_STATUS_ERROR, NOTEBOOK_STATUS_RUNNING, NOTEBOOK_STATUS_FINISHED, N... |
rberrelleza/cuelake | api/genie/serializers.py | <reponame>rberrelleza/cuelake
import json
from rest_framework import serializers
from django_celery_beat.models import CrontabSchedule
from genie.models import NotebookJob, RunStatus, Connection, ConnectionType, NotebookTemplate, Schedule
class NotebookJobSerializer(serializers.ModelSerializer):
"""
Serializer... |
rberrelleza/cuelake | api/workflows/services.py | <gh_stars>0
from typing import List
import asyncio
import json
import pytz
import time
from django.db import transaction
import polling
from workflows.models import (
Workflow,
WorkflowRun,
NotebookJob,
STATUS_SUCCESS,
STATUS_FAILURE,
STATUS_ALWAYS,
STATUS_RUNNING,
STATUS_RECEIVED,
S... |
rberrelleza/cuelake | api/genie/migrations/0003_auto_20210412_0719.py | <gh_stars>0
# Generated by Django 3.1.7 on 2021-04-12 07:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('genie', '0002_auto_20210318_1404'),
]
operations = [
migrations.RenameField(
model_name='runstatus',
old... |
rberrelleza/cuelake | api/utils/zeppelinAPI.py | <filename>api/utils/zeppelinAPI.py
import asyncio
import aiohttp
import requests
from django.conf import settings
from rest_framework import response
NOTEBOOKS_ENDPOINT = "api/notebook"
NOTEBOOK_STATUS_ENDPOINT = "api/notebook/job"
class ZeppelinAPI:
"""
Functionalities around zeppelin APIs
"""
def ge... |
rberrelleza/cuelake | api/system/migrations/0002_auto_20210418_0735.py | <filename>api/system/migrations/0002_auto_20210418_0735.py<gh_stars>0
# Generated by Django 3.1.7 on 2021-04-18 07:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('system', '0001_initial'),
]
operations = [
migrations.AddField(
... |
rberrelleza/cuelake | api/workflows/admin.py | from django.contrib import admin
from workflows.models import Workflow, WorkflowRun, NotebookJob
class WorkflowRunAdmin(admin.ModelAdmin):
# Adding starttimestamp in a new modelAdmin class as its a readonly field
# to make it visible in the admin panel
readonly_fields = ('startTimestamp',)
admin.site.reg... |
rberrelleza/cuelake | api/workflows/tasks.py | import json
import datetime as dt
import dateutil.parser as dp
import requests
import polling
from celery import shared_task
from django.conf import settings
from system.services import NotificationServices
from workflows.services import WorkflowServices
from workflows.models import WorkflowRun, STATUS_RECEIVED, STATU... |
rberrelleza/cuelake | api/utils/druidSpecGenerator.py | <reponame>rberrelleza/cuelake
# Class to generate Druid ingestion spec
import json
import os
import logging
from typing import List
from urllib.parse import urlparse
import boto3
import pyarrow.parquet as pq
import s3fs
PARQUET_STRING = ["STRING", "ENUM", "UUID"]
PARQUET_COMPLEX_TYPE = ["LIST", "STRUCT"]
PARQUET_INT... |
rberrelleza/cuelake | api/genie/services.py | import asyncio
import json
import pytz
import time
from typing import List
from django.template import Template, Context
# from django_celery_beat.models import CrontabSchedule
from genie.models import NotebookJob, RunStatus, Connection, ConnectionType, ConnectionParam, ConnectionParamValue, NotebookTemplate, Schedule
... |
rberrelleza/cuelake | api/genie/migrations/0004_auto_20210414_1012.py | <reponame>rberrelleza/cuelake
# Generated by Django 3.1.7 on 2021-04-14 10:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('genie', '0003_auto_20210412_0719'),
]
operations = [
migrations.CreateModel(
... |
rberrelleza/cuelake | api/workflows/migrations/0001_initial.py | <filename>api/workflows/migrations/0001_initial.py
# Generated by Django 3.1.8 on 2021-04-19 13:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('django_celery_beat', '0015_edit_solarschedule_events_... |
rberrelleza/cuelake | api/genie/urls.py | from django.urls import path
from . import views
urlpatterns = [
path("notebooks/<int:offset>", views.NotebookView.as_view(), name="notebookView"),
path("notebooksLight", views.NotebooksLight.as_view(), name="notebookView"),
path("notebook/<str:notebookId>", views.NotebookOperationsView.as_view(), name="n... |
rberrelleza/cuelake | api/workflows/models.py | <reponame>rberrelleza/cuelake<gh_stars>0
from django.db import models
from django_celery_beat.models import PeriodicTask
STATUS_SUCCESS = "success"
STATUS_FAILURE = "failure"
STATUS_ALWAYS = "always"
STATUS_RUNNING = "running"
STATUS_RECEIVED = "received" # just before triggering job
STATUS_ABORTED = "aborted"
cla... |
rberrelleza/cuelake | api/genie/migrations/0001_initial.py | # Generated by Django 3.1.7 on 2021-03-12 14:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('django_celery_beat', '0015_edit_solarschedule_events_choices'),
]
operations = [
migrat... |
rberrelleza/cuelake | api/genie/migrations/0008_runstatus_worflowrun.py | <gh_stars>0
# Generated by Django 3.1.8 on 2021-04-19 13:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('workflows', '0001_initial'),
('genie', '0007_auto_20210417_1807'),
]
operations = [
mig... |
rberrelleza/cuelake | api/genie/views.py | from django.http import HttpRequest
from rest_framework.views import APIView
from rest_framework.response import Response
from genie.services import NotebookJobServices, Connections, NotebookTemplateService
from rest_framework.decorators import api_view
class NotebookOperationsView(APIView):
"""
Class to get n... |
Sen/ledger | test/dummy/db/migrate/20191028102323_create_ookkee_entries.rb | class CreateOokkeeEntries < ActiveRecord::Migration[6.0]
def change
create_table :ookkee_entries do |t|
t.integer :sheet_id
t.string :sheet_name # assets, liability, etc
t.integer :account_id # cash, bank payable
t.string :entry_type # credit/debit
t.decimal :amount, scale: 10, pr... |
Sen/ledger | lib/ookkee/repos/entry_repo.rb | require 'bigdecimal'
module Ookkee
class EntryRepo
def build_from_factory(sheet, factory)
entry = sheet.entries.build
entry.account = factory.attributes[:account]
entry.trackable = factory.attributes[:trackable]
entry.sheet_name = factory.attributes[:sheet_name]
... |
Sen/ledger | lib/ookkee/liability.rb | <filename>lib/ookkee/liability.rb
module Ookkee
class Liability < Sheet
end
end |
Sen/ledger | lib/ookkee/revenue.rb | module Ookkee
class Revenue < Sheet
end
end |
Sen/ledger | lib/tasks/ookkee_tasks.rake | # desc "Explaining what the task does"
namespace :ookkee do
task :install do
end
end
|
Sen/ledger | lib/ookkee/model/sheet.rb | <gh_stars>0
module Ookkee
class Sheet < ActiveRecord::Base
self.table_name = "ookkee_sheets"
has_many :entries, class_name: 'Ookkee::Entry', foreign_key: :sheet_id
belongs_to :user, polymorphic: true
validates :title, presence: true
validate :credit_and_debit_must_be_exists
validate :ledger_... |
Sen/ledger | lib/ookkee.rb | <gh_stars>0
require "ookkee/railtie"
require 'ookkee/model/entry'
require 'ookkee/model/sheet'
require 'ookkee/model/account'
require 'ookkee/builder'
require 'ookkee/builder_proxy'
require 'ookkee/factory'
# require 'ookkee/stack'
require 'ookkee/repos/entry_repo'
require 'ookkee/usecase'
module Ookkee
# Your code... |
Sen/ledger | lib/ookkee/usecase.rb | module Ookkee
class Usecase
class << self
def account_balance_with_user(account, user)
repo.calculate_account_balance(account, user)
end
def account_entries(account, user)
repo.account_entries_with_user(account, user)
end
def user_sheets(user)
repo.sheets_wi... |
Sen/ledger | test/dummy/db/migrate/20191028101521_create_ookkee_sheets.rb | class CreateOokkeeSheets < ActiveRecord::Migration[6.0]
def change
create_table :ookkee_sheets do |t|
t.string :title
t.string :transaction_number
t.string :user_type
t.integer :user_id
t.timestamps
end
add_index :ookkee_sheets, :transaction_number
add_index :ookkee_s... |
Sen/ledger | lib/ookkee/builder_proxy.rb | module Ookkee
class BuilderProxy
def initialize(options)
@builder = options[:builder]
end
def credit(account)
factory = Factory.new
yield factory
factory.entry_type 'credit'
factory.account account
factory.sheet_name account.sheet_name
@builder.registry << facto... |
Sen/ledger | lib/ookkee/equity.rb | module Ookkee
class Equity
end
end
|
Sen/ledger | lib/ookkee/model/entry.rb | module Ookkee
class Entry < ActiveRecord::Base
self.table_name = "ookkee_entries"
ENTRY_TYPES = %w[credit debit]
SHEET_NAMES = %w[assets liabilities equity revenue expenses]
belongs_to :sheet, class_name: 'Ookkee::Sheet', foreign_key: :sheet_id
belongs_to :account, class_name: 'Ookkee::Account',... |
Sen/ledger | test/ookkee/builder_test.rb | <gh_stars>0
require 'test_helper'
class Ookkee::BuilderTest < ActiveSupport::TestCase
setup do
@account = Ookkee::Account.new
@account.name = 'cash'
@account.sheet_name = 'assets'
@account.save!
@user = User.create!(name: 'tester')
@order = Order.create!(title: 'test order')
end
test "k... |
Sen/ledger | lib/ookkee/model/account.rb | <filename>lib/ookkee/model/account.rb
module Ookkee
class Account < ActiveRecord::Base
self.table_name = "ookkee_accounts"
validates :name, presence: true
validates :sheet_name, presence: true, \
inclusion: {
in: Entry::SHEET_NAMES,
message: "%{value} is not a valid account name"
... |
Sen/ledger | test/ookkee/sheet_test.rb | <gh_stars>0
require 'test_helper'
class Ookkee::SheetTest < ActiveSupport::TestCase
test "truth" do
assert_equal Ookkee::Sheet.new.class.name, 'Ookkee::Sheet'
end
end
|
Sen/ledger | lib/ookkee/expense.rb | module Ookkee
class Expense < Sheet
end
end |
Sen/ledger | test/ookkee/account_test.rb | <filename>test/ookkee/account_test.rb
require 'test_helper'
class Ookkee::AccountTest < ActiveSupport::TestCase
test "truth" do
assert_equal Ookkee::Account.new.class.name, 'Ookkee::Account'
end
test "create" do
count = Ookkee::Account.count
sheet = Ookkee::Account.new
sheet.name = 'cash'
sh... |
Sen/ledger | lib/ookkee/builder.rb | module Ookkee
class Builder
attr_accessor :registry
def initialize
@registry = []
@attributes = {}
end
def self.build
instance = self.new
yield instance
instance.build_activerecord_objects
end
def title(value)
@attributes[:title] = value
end
def... |
Sen/ledger | test/dummy/db/migrate/20191031040323_create_ookkee_accounts.rb | class CreateOokkeeAccounts < ActiveRecord::Migration[6.0]
def change
create_table :ookkee_accounts do |t|
t.string :name
t.string :sheet_name # assets, liability, etc
t.timestamps
end
add_index :ookkee_accounts, :sheet_name
add_index :ookkee_accounts, [:name, :sheet_name], unique: ... |
Sen/ledger | test/dummy/db/schema.rb | <reponame>Sen/ledger
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# This file is the source Rails uses to define your schema ... |
Sen/ledger | lib/ookkee/asset.rb | <filename>lib/ookkee/asset.rb
module Ookkee
class Asset
end
end |
appcues/data-uploader | lib/appcues_data_uploader.rb | #!/usr/bin/env ruby
#
# Appcues Data Uploader
#
# Uploads CSV-formatted user profile data to the Appcues API.
# Run `appcues-data-uploader -h` for more information.
#
# Homepage: https://github.com/appcues/data-uploader
#
# Copyright 2018, Appcues, Inc.
#
# Released under the MIT License, whose text is available at:
# ... |
appcues/data-uploader | appcues_data_uploader.gemspec | require "./lib/appcues_data_uploader/version"
Gem::Specification.new do |s|
s.name = 'appcues_data_uploader'
s.version = AppcuesDataUploader::VERSION
s.date = AppcuesDataUploader::VERSION_DATE
s.summary = 'Upload CSVs of user profile data to the Appcues API'
s.homepage = 'https://github.com/appcues... |
appcues/data-uploader | lib/appcues_data_uploader/version.rb | class AppcuesDataUploader
VERSION = "0.2.0"
VERSION_DATE = "2018-11-08"
end
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.