content stringlengths 5 1.05M |
|---|
from .cmd import getNamespaces
from .permissions import isForbiddenAllNamespace
def list():
'''Return list of tuples of namespaces: [(value,label),(value,label),...]'''
if isForbiddenAllNamespace() == True:
namespaces = []
else:
namespaces = [("all-namespaces","All namespaces")]
allNam... |
__all__ = ['sslaction', 'sslcert', 'sslcertchain', 'sslcertchain_binding', 'sslcertchain_sslcertkey_binding', 'sslcertfile', 'sslcertkey', 'sslcertkey_binding', 'sslcertkey_crldistribution_binding', 'sslcertkey_service_binding', 'sslcertkey_sslocspresponder_binding', 'sslcertkey_sslvserver_binding', 'sslcertlink', 'ssl... |
#!/usr/bin/env python3
from distutils.core import setup, Extension
setup(
name='pybeep',
version='0.1',
ext_modules=[Extension("pybeep", ["_pybeep.c", "pybeep.c"])],
license="MIT",
classifiers=[
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux"
],
... |
"""
This program performs two different logistic regression implementations on two
different datasets of the format [float,float,boolean], one
implementation is in this file and one from the sklearn library. The program
then compares the two implementations for how well the can predict the given outcome
for each input ... |
import os.path as osp
import numpy as np
import pickle
import random
from pathlib import Path
from functools import reduce
from typing import Tuple, List
from tqdm import tqdm
from pyquaternion import Quaternion
from nuscenes import NuScenes
from nuscenes.utils import splits
from nuscenes.utils.data_classes import Li... |
# -*- coding: utf-8 -*-
"""Parser for Windows NT shell items."""
import pyfwsi
from plaso import dependencies
from plaso.events import shell_item_events
from plaso.lib import eventdata
from plaso.winnt import shell_folder_ids
dependencies.CheckModuleVersion(u'pyfwsi')
class ShellItemsParser(object):
"""Parses f... |
"""Helper module
This module provides some helper checkers
that make sure the configuration is complete
before using any of the functionalities
"""
from CAM2RequestsCLI import host, port
from functools import wraps
from click import UsageError
def requires_url(f):
'''Asserts the configuration of the URL'''
@wraps... |
from pyleaves.leavesdb.db_manager import create_db, build_db_from_json
import argparse
import os
from os.path import join, abspath
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--json_path', default=r'pyleaves/leavesdb/resources/full_dataset_frozen.json', type=str,help='Db ... |
# !/usr/bin/env Python3
# -*- coding: utf-8 -*-
# @Author : weiz
# @FILE : testImgTemplate.py
# @Time : 2020/6/19 14:39
# @Description : ocr服务测试程序,三种访问方法,如下所示
import requests
import json
import numpy as np
def test_1():
#url = 'http://192.168.0.99:80/ocr_service'
url = 'http://192.168.1.43... |
import requests
import re
from bs4 import BeautifulSoup
def get_info():
'''获取one的照片和一句话'''
one_url = 'http://www.wufazhuce.com'
r = requests.get(one_url)
html = r.text
soap = BeautifulSoup(html, "html.parser")
# 下载图片
pic_url = soap.find(class_='fp-one-imagen').get('src')
pic = reques... |
import FWCore.ParameterSet.Config as cms
from DQMServices.Components.DQMMessageLogger_cfi import *
from DQMServices.Components.DQMProvInfo_cfi import *
from DQMServices.Components.DQMFastTimerService_cff import *
from DQMOffline.L1Trigger.L1TriggerDqmOffline_cff import *
from DQMOffline.Ecal.ecal_dqm_source_offline_H... |
# Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed
# under the Apache Software License, v. 2 except as noted otherwise in the LICENSE file
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the Licens... |
import numpy as np
import tensorflow as tf
import SimpleITK as sitk
from utils import *
"""
@author: roger
This code runs the test manually and iis just to verify
"""
train_phase=tf.placeholder(tf.bool, name='phase_train')#This is for testing!
def generator(inputMR,batch_size_tf,wd):
######## FCN for the... |
import cv2
import numpy as np
import joblib
file1=open('final.txt','r')
data=[];label=[]
counter=0
while(1):
line=file1.readline()
#line.strip('\n')
if len(line)!=0:
line=line.split(';')
path_str,label_str=line[0],line[1].strip('\n')
img=cv2.imread(path_str,0)
pi... |
# coding: utf-8
"""
most code in this file copy from:https://github.com/swapnil96/Convex-hull
getHull(pl)
just use this api
pl:[c4d.Vector()...]
return:((0,1,2),(3,6,7)...)
"""
import c4d
import math
def set_correct_normal(possible_internal_points, plane): # Make the orientation of Normal correct
for point in p... |
import tensorflow as tf
from tensorflow.python.framework import ops
_binned_select_knn = tf.load_op_library('binned_select_knn.so')
def _BinnedSelectKnn(K : int, coords, bin_idx, dim_bin_idx, bin_boundaries, n_bins, bin_width , tf_compatible=False):
'''
the op wrapper only
'''
return _binned_se... |
def is_leap(year):
leap = False
if year % 4 == 0:
leap=True
if year % 100 == 0 and year % 400 != 0:
leap = False
return leap
if __name__ == '__main__':
year = int(input())
print ( is_leap(year))
|
from django import forms
from api.forms.abstract_form import AbstractForm
class LuxstayRoomForm(AbstractForm):
custom_session_id = forms.CharField(required=False, initial=None)
ip_address = forms.CharField(required=False, initial=None)
room_id = forms.IntegerField(required=False, initial=None)
|
# -*- coding: utf-8 -*-
"""Main module."""
from pandas import DataFrame
import pandas as pd
import sqlparse
from typing import List
Columns = List[str]
class AnalysisException(Exception):
def __init__(self, message):
self.message = message
def __str__(self):
return self.message
class Dat... |
from dataclasses import dataclass
from bindings.ows.resource_type import ResourceType
__NAMESPACE__ = "http://www.w3.org/1999/xlink"
@dataclass
class Resource2(ResourceType):
class Meta:
name = "resource"
namespace = "http://www.w3.org/1999/xlink"
|
from rest_framework import serializers
from rest_framework.validators import UniqueTogetherValidator
from .models import UserLikes
from core.serializers import PinSerializer
class UserLikesDetailSerializer(serializers.ModelSerializer):
#TODO: 这里以后做一个简易的pin的序列化 没必要返回这么多信息
pin = PinSerializer()
class Meta... |
#!/usr/bin/env python
"""
In the name of Allah, the most Gracious, the most Merciful.
▓▓▓▓▓▓▓▓▓▓
░▓ Author ▓ Abdullah <https://abdullah.today>
░▓▓▓▓▓▓▓▓▓▓
░░░░░░░░░░
░█▀█░█▀█░█░░░█░█░█▀▄░█▀█░█▀▄
░█▀▀░█░█░█░░░░█░░█▀▄░█▀█░█▀▄
░▀░░░▀▀▀░▀▀▀░░▀░░▀▀░░▀░▀░▀░▀
"""
# Install dependencies
# pip install --upgrade google-api-... |
"""
owtf.models.email_confirmation
~~~~~~~~~~~~~~~~~~~~~~
"""
from sqlalchemy import Column, Integer, Unicode, ForeignKey, DateTime
from owtf.db.model_base import Model
class EmailConfirmation(Model):
__tablename__ = "email_confirmation"
id = Column(Integer, primary_key=True, autoincrement=True)
key_val... |
from random import sample
from datetime import datetime, timedelta
from numpy import power
from numpy.random import randint, gamma
def date_to_season(date):
# Crude, but close enough
vernal_equinox = datetime(date.year, 3, 21)
summer_solstice = datetime(date.year, 6, 21)
autumnal_equinox = datetime(dat... |
import numpy as np
import pytest
import mbuild as mb
from mbuild.formats.vasp import read_poscar, write_poscar
from mbuild.tests.base_test import BaseTest
class TestVasp(BaseTest):
"""Unit tests for Vasp POSCAR writer"""
@pytest.fixture(autouse=True)
def initdir(self, tmpdir):
tmpdir.chdir()
... |
import discord
from redbot.core import commands
from redbot.core.i18n import Translator, cog_i18n
import contextlib
from . import constants as sub
from .core import Core
_ = Translator("Nsfw", __file__)
@cog_i18n(_)
class Nsfw(Core):
"""
Send random NSFW images from random subreddits
... |
# ===-----------------------------------------------------------*- Python -*-===
#
# Part of the LOMP project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# ===-----------------------------... |
import os
from setuptools import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(here, 'README.rst')).read()
CHANGES = open(os.path.join(here, 'CHANGES.rst')).read()
version = '0.3.5b0'
requires = [
'eduid-am >= 0.6.3b5',
'eduid-userdb >= 0.4.0b12',
]
test... |
import json
import logging
from django.http import JsonResponse
from django.contrib.contenttypes.models import ContentType
from rest_framework.response import Response
from rest_framework import (
viewsets,
status,
)
from rest_framework.generics import (
UpdateAPIView,
ListAPIView,
)
from rest_framewor... |
# ## ML-Agent Learning (SAC)
# Contains an implementation of SAC as described in https://arxiv.org/abs/1801.01290
# and implemented in https://github.com/hill-a/stable-baselines
import logging
from collections import defaultdict
from typing import Dict
import os
import numpy as np
from mlagents_envs.timers import t... |
rules = {
'A': {
1: 'To enter the competition you MUST create an audio track',
2: 'Every person can enter the competition with one entry only. You may submit your',
3: 'Your audio track MUST be downloadable without access control and the audio file',
4: 'The length of your submitted ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: Apache-2.0
"""
Helper functions for Alexa Media Player.
For more details about this platform, please refer to the documentation at
https://community.home-assistant.io/t/echo-devices-alexa-as-media-player-testers-needed/58639
"""
import logging
... |
class SpotNotFound(Exception):
"""
Exception raised when spot cannot be found
"""
pass
class SpotDataOverflow(Exception):
"""
Exception raised when spot data overflows
"""
pass
|
import argparse
from restli.scaffolders import ProjectScaffolder
from restli.generators import PegasusGenerator, ResourceGenerator
def create_parser():
parser = argparse.ArgumentParser(description="A command line tool for restli projects.")
parser.add_argument('-s', '--scaffold', help="THe name of your restli ... |
# Source : https://leetcode.com/problems/longest-uncommon-subsequence-i/#/description
# Author : Han Zichi
# Date : 2017-04-23
class Solution(object):
def findLUSlength(self, a, b):
"""
:type a: str
:type b: str
:rtype: int
"""
if a == b:
return -1
... |
"""Evaluate the accuracy of the retriever module."""
import unicodedata
import regex as re
import spacy
from typing import List
from sacremoses import MosesDetokenizer
from utils.text_process_tool import spacy_tokenize, normalize
md = MosesDetokenizer(lang='en')
def regex_match(text, pattern):
"""Test if a rege... |
from app.common.library import cognito
from app.common.models import User
def reset_password_confirm(username, confirmation_code, new_password):
client = cognito.create_client()
# pylint:disable=unused-variable
resp, msg = cognito.idp_confirm_forgot_password(
client, username, confirmation_code, ... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# 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 applicable law or agreed to... |
list1 = [2, 8, "Aditya", 9, 78 ,55 ,3 ,4 , 1, "Ani"]
for x in list1:
if str(x).isnumeric() and x > 6:
print(x)
|
#!/usr/bin/env python
from os import path
from setuptools import setup, find_packages
BASE_DIR = path.abspath(path.dirname(__file__))
def read(f):
with open(path.join(BASE_DIR, f)) as fh:
return fh.read()
def get_version():
version = read('VERSION').strip()
if not version:
raise Runtim... |
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
import json
import logging
import mimetypes
import os
import re
import time
import zipfile
from collections import OrderedDict
import html5lib
from cheroot import wsgi
from django.conf import settings
... |
"""
Contains protocol/step objects for gate operations.
.. currentmodule:: quanguru.classes.QGates
.. autosummary::
SpinRotation
xGate
.. |c| unicode:: U+2705
.. |x| unicode:: U+274C
.. |w| unicode:: U+2000
======================= ================== ============== ... |
from .collection import create_collection_from_xml, add_collection_items_from_xml
from .guild import create_guild_from_xml, add_guild_members_from_xml
from .hotitems import create_hot_items_from_xml, add_hot_items_from_xml
from .plays import create_plays_from_xml, add_plays_from_xml
from .game import create_game_from_x... |
import numpy as np
from GitMarco.statistics.metrics import standard_error
def test_standard_error():
data = np.random.rand(20)
error = standard_error(data)
assert isinstance(error, float), 'Error in standard error type'
|
import time
from datetime import datetime
import socket
import os
import glob
from tqdm import tqdm
import importlib
import argparse
import numpy as np
import random
import torch
from torch import nn, optim
from torch.utils.data import DataLoader
from torch.autograd import Variable
from tensorboardX i... |
from scipy.stats import bernoulli, randint
import numpy as np
class TreeCut:
def __init__(self, growth_param=5, replanting_cost=30, linear_wood_value=10,
maintenance_cost=3, max_height=40, proba_of_dying=.1,
sappling_height=1, gamma=1. / (1 + 0.05)):
self.growth... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-11-27 19:28
from __future__ import unicode_literals
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import json
import yaml
def convert_probe_source(apps, schema_editor):
ProbeSource... |
from pony.orm import *
import datetime
from model import Group, Contact
from pymysql.converters import decoders, encoders, convert_mysql_timestamp
class ORMFixture:
def __init__(self, host, database, user, password):
conv = encoders
conv.update(decoders)
conv[datetime] = convert_mysql_time... |
import uvicorn
from datetime import datetime
from typing import List, Optional
from fastapi import FastAPI
from fastapi.encoders import jsonable_encoder
from fastapi.responses import JSONResponse
from pydantic import BaseModel, EmailStr
app = FastAPI()
_version_ = '1.0.0'
class baseRequest(BaseModel):
... |
'''
Created on Aug 7, 2018
@author: kjnether
'''
import pytest
import FMEUtil.FMWParser
import os.path
@pytest.fixture()
def attributeRenamerFixture():
'''
returns a fmw file as a FMWParser
object that contains a attribute renamer
transformer:
fish_aquatic_invasive_spcs_sp_sta... |
from nequip.data import AtomicDataDict
RMSE_LOSS_KEY = "rmse"
MAE_KEY = "mae"
LOSS_KEY = "noramlized_loss"
VALUE_KEY = "value"
CONTRIB = "contrib"
VALIDATION = "validation"
TRAIN = "training"
ABBREV = {
AtomicDataDict.TOTAL_ENERGY_KEY: "e",
AtomicDataDict.PER_ATOM_ENERGY_KEY: "Ei",
AtomicDataDict.FORCE_... |
#from scamp import entryExit
import utilities
global itr
itr = 0
def sort_filters(a,b):
import string
list = ['-u','W-J-B','-g','W-J-V','-r','W-C-RC','-i','W-S-I+','W-C-IC','-z','W-S-Z+']
a_num = 0
b_num = ... |
#!/usr/bin/python3
# pylint: disable=I0011,R0913,R0902
"""Define Handler abstact"""
class Handler(object):
"""Handler abstract"""
def __init__(self, *argv):
self.workers = []
for worker in argv:
self.workers.append(worker)
def add_worker(self, worker):
self.workers.app... |
from django.core.management import BaseCommand
from db.models import ProfileType
from db.seed import Seed
class Command(BaseCommand):
help = 'Generates random students'
seed = Seed()
def add_arguments(self, parser):
parser.add_argument('num_students',
type=int,
... |
import os
print(os.environ["ENV001"])
print(os.environ["ENV002"])
|
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu>
#
# License: BSD-3-Clause
import os
import os.path as op
import re
import shutil
import numpy as np
from numpy.testing import assert_allclose, assert_array_almost_equal
import pytest
import warnings
import mne
from mne.datasets import testing
from mne.io impor... |
import pytest
from digests.utils import get_schema_name
@pytest.mark.parametrize('content_type, schema_name', [
('application/vnd.elife.digest+json; version=1', 'digest.v1.json'),
('application/vnd.elife.digest+json; version=2', 'digest.v2.json'),
('application/vnd.elife.digest+json; version=3', 'digest.... |
import json
import os
import pytest
import yaml
from desmod.component import Component
from desmod.simulation import (
SimEnvironment,
SimStopEvent,
simulate,
simulate_factors,
simulate_many,
)
import desmod.progress
pytestmark = pytest.mark.usefixtures('cleandir')
@pytest.fixture
def cleandir(... |
A, B = map(int, input().split())
print(A / B)
|
Map = ["a", "b", "c", "d", 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
def result(Str):
newstr = ""
for i in Str:
if i in Map:
if Map.index(i)+2>25:
newstr += Map[abs(len(Map)-(Map.index(i)+2))]
... |
import bpy
from bpy.props import *
from bpy.types import Node, NodeSocket
from arm.logicnode.arm_nodes import *
class SetParentBoneNode(Node, ArmLogicTreeNode):
'''Set parent bone node'''
bl_idname = 'LNSetParentBoneNode'
bl_label = 'Set Parent Bone'
bl_icon = 'NONE'
def init(self, context):
... |
import os
def clearConsole():
command = 'clear'
os.system(command)
if __name__ == "__main__":
clearConsole() |
""" This module defines the training configuration """
from typing import NamedTuple, Union
class TrainConfig(NamedTuple):
""" TrainConfig is a configuration for training with ray """
experiment_name: str
num_workers: int
resume: Union[bool, str] = "prompt"
|
import torch
import torch.nn as nn
import torch.nn.functional as F
from open3d.ml.torch.layers import SparseConv, SparseConvTranspose
class SparseConvFunc(torch.autograd.Function):
@staticmethod
def symbolic(g, cls, feat, in_pos, out_pos, voxel_size):
kernel = cls.state_dict()["kernel"]
offset ... |
# ===========================================================================
# configuration.py --------------------------------------------------------
# ===========================================================================
# import ------------------------------------------------------------------
# -----... |
from django.db import models
from accounts.models import User
# Create your models here.
class Question(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='comments', null=True, blank=True)
question = models.CharField(max_length=1000, null=True, blank=True)
answer = mode... |
#!/usr/bin/env python3
# coding: utf-8
from enum import Enum, auto
from sys import version_info
from typing import Any, Dict, List
if version_info.minor < 8:
from typing_extensions import TypedDict
else:
from typing import TypedDict # type: ignore
class DefaultWorkflowEngineParameter(TypedDict):
"""
... |
import matplotlib.pyplot as plt
from gem.utils import graph_util, plot_util
from gem.evaluation import visualize_embedding as viz
from gem.evaluation import evaluate_graph_reconstruction as gr
from time import time
from gem.embedding.gf import GraphFactorization
from gem.embedding.hope import HOPE
from gem.... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from Crypto.Cipher import CAST
from . import StandardBlockCipherUnit
class cast(StandardBlockCipherUnit, cipher=CAST):
"""
CAST encryption and decryption.
"""
pass
|
import numpy as np
import pyccl as ccl
def test_szcl():
COSMO = ccl.Cosmology(
Omega_b=0.05,
Omega_c=0.25,
h=0.67,
n_s=0.9645,
A_s=2.02E-9,
Neff=3.046)
bm = np.loadtxt("benchmarks/data/sz_cl_P13_szpowerspectrum.txt",
unpack=True)
l_bm = b... |
from .web_arima import The_Arima_Model as arima1
from .web_arima import Arima2 as arima2
from .web_monteCarlo import The_Monte_Carlo as monteCarlo
from .web_prophet import Web_prophet_kyle as prophet
from .web_regression import Regression_Model as regression
from .web_sarima import The_SARIMA_Model as sarima
from .web_... |
import torch
import torch.nn.functional as F
from torch.nn import Linear, ModuleDict
from torch_geometric.nn import GCNConv, global_mean_pool
from src.data.make_dataset import get_dataloader, get_mutag_data
class GCN(torch.nn.Module):
def __init__(
self,
input_num_features: int,
num_class... |
import importlib
import json
import re
from app.shared.handler import lambda_handler
@lambda_handler
async def handler(event=None, context=None, **kwargs):
unknown_api_response = 404, json.dumps({'message': 'Invalid API'})
path = event.get('path')
try:
_, api, function_name = path.split('/')
... |
# obtain a basic description of all the species seen in the past 30 years that the Solow p-value designated as extinct
# particularly interested in species designated extinct that are know (from Chong et al. (2009)) to be common
import csv
import sys
sys.path.insert(0,'../..') # allows us to import undetected extinct... |
import numpy as np
from rospy import loginfo, get_param
from human import Human
kitchen_feature = get_param('kitchen_feature')
human_feature = get_param('human_feature')
class Kitchen:
"""
This class represents a kitchen and saves Human objects.
"""
def __init__(self, kitchen_id, data):
"""
... |
import pandas as pd
import multiprocessing as mp
from api import Bittrex
import sqlite3 as sl
from time import time
import sys
BITTREX_MARKETS_FILE = './metadata/bittrex_markets.csv'
DB_PATH = './cryptodata.db'
bittrex = Bittrex()
def post_to_db(values,time):
conn = sl.connect(DB_PATH)
cursor = conn.cursor()
... |
# -*- coding: utf-8 -*-
#---------------------------------------------------------------------
# Copyright (C) 2014 Dimosthenis Pediaditakis.
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# a... |
import itertools
from math import log2
from typing import List, Sequence, TypeVar
import numpy as np
from scipy import stats
from sklearn.metrics import dcg_score, ndcg_score
from sklearn.metrics.pairwise import cosine_similarity
X = TypeVar("X")
def reciprocal_rank(relevant_item: X, recommendation: Sequence[X]) ->... |
"""Test suite for AGS result type."""
import json
from uuid import uuid4
from app.analysis_results.analysis_result_models import AnalysisResultMeta, AnalysisResultWrapper
from app.display_modules.ags.tests.factory import AGSFactory
from tests.base import BaseTestCase
class TestAGSModule(BaseTestCase):
"""Tests ... |
from distutils.core import setup
setup(
name = 'pymsteams',
packages = ['pymsteams'],
version = '0.1.3',
description = 'Format messages and post to Microsoft Teams.',
author = 'Ryan Veach',
author_email = 'rveach@gmail.com',
url = 'https://github.com/rveachkc/pymsteams',
download_url = 'https://github.c... |
from translationstring import TranslationStringFactory
from pyramid.config import Configurator
from c2cwsgiutils.health_check import HealthCheck
from pyramid.events import BeforeRender, NewRequest
import c2cgeoform
from pkg_resources import resource_filename
from c2c.template.config import config as configuration
fro... |
from algernon.memory import Memory
import pytest
import numpy as np
from keras.models import Sequential
from keras.layers.core import Dense
from keras.optimizers import sgd
class MockModel:
def __init__(self, output_dims, input_dims):
self.w = np.random.random(size=(output_dims, input_dims))
def pre... |
# Copyright (c) 2018, Stellapps Technologies Private Ltd.
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import has_common
def execute(filters=None):
columns, data = get_columns(), get_data(filters)
return columns ,data ... |
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cint, flt
from erpnext.stock.utils import update_included_uom_in_report
from erpnext.stock.d... |
#######################################################################
# Copyright (C) 2008-2020 by Carnegie Mellon University.
#
# @OPENSOURCE_LICENSE_START@
# See license information in ../../../LICENSE.txt
# @OPENSOURCE_LICENSE_END@
#
#######################################################################
########... |
from pesummary.gw.fetch import fetch_open_strain
import os
# Gravitational wave strain data is typically either 32s or 4096s in duration
# with a sampling rate of either 4KHz or 16KHz. We can download either by simply
# specifying the event name and specifying the duration and sampling rate with
# the `duration` and `... |
# Spectral_Analysis_Amp_and_Phase.py
import os
import numpy as np
import pandas as pd
import scipy.linalg as la
import matplotlib.pyplot as plt
# Import time from the data or define it
t = np.arange(0.015, 0.021, 10**-7)
dt = 10**-7
# Define trainsize and number of modes
trainsize = 20000 # Number of snapshots u... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Poll',
fields=[
('id', models.AutoField(verbose... |
#!/usr/bin/env python
# -*- encoding: utf-8
'''
_____.___._______________ __.____ __________ _________ ___ ___ _____ .___
\__ | |\_ _____/ |/ _| | \ \ \_ ___ \ / | \ / _ \ | |
/ | | | __)_| < | | / | \ / \ \// ~ \/ /_\ \| |
\____ | | ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pysam
import singlecellmultiomics.molecule
import singlecellmultiomics.fragment
import gzip
import collections
import matplotlib.pyplot as plt
import pandas as pd
import argparse
import pysamiterators
import sys
import os
import uuid
import singlecellmultiomics.bamPr... |
#!/usr/bin/env python3
"""Main game logic for Pybrix
2018.08.23 -- GVG"""
import pygame
import sys
import os
import tetromino as tet
import display
from random import randint
from board import Board
from settings import GRID_SIZE, COLORS
def init():
global f
pygame.init()
pygame.font.init()
f = op... |
#!/usr/bin/env python
"""
This script will query the AWS API using boto3 and provide a list (table) of all regions and your current opt in status
Example Usage:
./list-regions.py
"""
from __future__ import print_function
import boto3
import requests
import sys
from botocore.exceptions import ClientError
from ... |
import yfinance as yf
import logging
import pandas as pd
import zipfile
import urllib.request
logging.basicConfig(filename='output.log', filemode='a',
format='%(asctime)s - %(levelname)-4s [%(filename)s:%(lineno)d] %(message)s', level=logging.INFO)
class MktDataReader:
def __init__(self, start_date, end_date, da... |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import textwrap
from sqlalchemy import type_coerce
from sqlalchemy.event import listens_for
from sqlalche... |
def insertin_sort(list):
for i in range(1 ,len(list)):
key = list[i]
last = i-1
while last >= 0 and key < list[last]:
list[last+1] = list[last]
last = last-1
list[last+1] = key
list = [12,45,90,3,10]
insertin_sort(list)
print(list) |
import os
import shutil
import subprocess
from setuptools import setup, Extension, Command
from setuptools.command.sdist import sdist as sdist
from setuptools.command.build_ext import build_ext as build_ext
BASE_DIR = os.path.abspath(os.path.dirname(__file__))
BUILD_DIR = os.path.join(BASE_DIR, 'vendor', 'build')
VE... |
import numpy as np
import pytest
from pandas import DataFrame, MultiIndex, Panel, Series
from pandas.util import testing as tm
@pytest.mark.filterwarnings('ignore:\\nPanel:FutureWarning')
class TestMultiIndexPanel(object):
def test_iloc_getitem_panel_multiindex(self):
# GH 7199
# Panel with mul... |
"""Test
>>> find_longest_substring_with_at_most_k_distict_chars("abcba", 2)
'bcb'
"""
from collections import deque, namedtuple
def find_longest_substring_with_at_most_k_distict_chars(s: str, k: int) -> str:
class Cstats:
def __init__(self):
self.number = 0
self.positions =... |
class Pessoa:
olhos = 2
def __init__(self, *filhos, nome=None, idade=None):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Olá {id(self)}'
@staticmethod
def metodo_estatico():
return 42
@classmethod
... |
#! /usr/bin/python
import os
import sys
import requests
import json
from collections import deque
DATA_DIR = '/Users/danielgoldin/data/meerkat'
profiles_to_parse = deque()
profiles_done = set()
def put(url, data):
r = requests.put(url, data=json.dumps(data), headers={'Content-Type': 'application/json'}, verify=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.