text stringlengths 1 927k |
|---|
from app.filter import clean_query
from app.request import send_tor_signal
from app.utils.session import generate_user_key
from app.utils.bangs import gen_bangs_json
from app.utils.misc import gen_file_hash
from flask import Flask
from flask_session import Session
import json
import logging.config
import os
from stem i... |
import logging
import math
import time
from asyncio import Lock
from random import choice, randrange
from secrets import randbits
from typing import Dict, List, Optional, Set, Tuple
from chinilla.types.peer_info import PeerInfo, TimestampedPeerInfo
from chinilla.util.hash import std_hash
from chinilla.util.ints import... |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='Protein generation project for course 02456 Deep Learning at DTU',
author='Jonas Vestergaard Jensen',
license='MIT',
) |
import commands
import getpass
def main():
paths = dict()
with open('urls.txt') as fp:
for item in fp:
temp = item.split('=')
paths[temp[0]] = temp[1].strip('\n')
user_name = getpass.getuser()
#print user_name
url_check = '/Users/' + user_name + paths['RUN_PATH']
temp1 = paths['RUN_PATH'].replace(... |
from app.schema.item import ItemCreate
from app.schema.seller import SellerCreate
seller_1_raw_get = {
"name": "name_1",
"email": "email_1@gmail.com",
"image_url": "http://image.com/seller_1.jpg",
}
seller_1_raw = {
**seller_1_raw_get,
"password": "password_1",
}
seller_1_typed = SellerCreate(**s... |
# nuScenes dev-kit.
# Code written by Freddy Boulton, 2020.
import colorsys
from typing import Any, Dict, List, Tuple, Callable
import cv2
import numpy as np
from pyquaternion import Quaternion
from nuscenes.prediction import PredictHelper
from nuscenes.prediction.helper import quaternion_yaw
from nuscenes.prediction... |
"""Retrieve Tweets, embeddings, and persist in the database."""
from os import getenv
import tweepy
import basilica
from .models import DB, User, Tweet
TWITTER_USERS = ['calebhicks', 'elonmusk', 'rrherr', 'SteveMartinToGo',
'alyankovic', 'nasa', 'sadserver', 'jkhowland', 'austen',
'co... |
from django.apps import AppConfig
class ProductsConfig(AppConfig):
name = 'aqa.products' |
from evo import Evo
import numpy as np
import matplotlib.pyplot as plt
import networkx as nx
from itertools import islice
def k_shortest_paths(G, source, target, k, weight=None):
return list(
islice(nx.shortest_simple_paths(G, source, target, weight=weight), k)
)
def draw_graph_with_subpaths(best, k_... |
from django.conf import settings
from django.views.generic.detail import DetailView
from django.contrib.contenttypes.models import ContentType
from django_tables2 import RequestConfig
from apis_core.apis_entities.views import GenericListViewNew
from . forms2 import GenericRelationForm
from . tables import get_generic... |
r"""
Modules With Basis
AUTHORS:
- Nicolas M. Thiery (2008-2014): initial revision, axiomatization
- Jason Bandlow and Florent Hivert (2010): Triangular Morphisms
- Christian Stump (2010): :trac:`9648` module_morphism's to a wider class
of codomains
"""
#*************************************************************... |
import asyncio
from typing import Any, Callable, Dict, Iterable, List, Optional
from procrastinate import exceptions, utils
QUEUEING_LOCK_CONSTRAINT = "procrastinate_jobs_queueing_lock_idx"
Pool = Any # The connection pool can be any pool object compatible with the database.
class BaseConnector:
json_dumps: ... |
from ast import literal_eval
from csv import DictReader, QUOTE_NONE
from pyrevit import revit, DB, script, forms
from operator import itemgetter
from rpw.ui.forms import (FlexForm, Label, ComboBox, TextBox, TextBox,
Separator, Button, CheckBox, Alert)
output = script.get_output()
data_types ... |
import time
import pygame
from pygame.locals import *
# The individual event object that is returned
# This serves as a proxy to pygame's event object
# and the key field is one of the strings in the button list listed below
# in the InputManager's constructor
# This comment is actually longer than the class defin... |
def main():
n = int(input())
xyh=[]
for _ in range(n):
x,y,h = map(int,input().split())
xyh.append([x,y,h])
xyh.sort(key=lambda x: x[2], reverse=True)
for xc in range(101):
for yc in range(101):
x = xyh[0][0]
y = xyh[0][1]
h = xyh[0][2]
... |
import re
import torch
from torch_geometric.transforms import BaseTransform
from torch_geometric.utils import remove_isolated_nodes
class RemoveIsolatedNodes(BaseTransform):
r"""Removes isolated nodes from the graph."""
def __call__(self, data):
num_nodes = data.num_nodes
out = remove_isolat... |
# Python program for implementation of MergeSort
def mergeSort(arr):
if len(arr) >1:
mid = len(arr)//2 # Finding the mid of the array
L = arr[:mid] # Dividing the array elements
R = arr[mid:] # into 2 halves
mergeSort(L) # Sorting the first half
mergeSort(R) # Sort... |
# import third party libs
from flask_apispec.annotations import marshal_with, doc, use_kwargs
from flask_apispec.views import MethodResource
# import app libs
from app.api import api
from app.api.errors import error_response
from app.core.vrf_operations import VrfOperations
from app.schemas.response.vrf import VrfResp... |
#!/usr/bin/python
from apscheduler.schedulers.background import BackgroundScheduler
from datetime import datetime, timedelta
import ConfigParser
import ibmiotf.application
import json
import os
import requests
import time
class MonitorApplication:
DEFAULT_TAP_SIZE = 5.0
DEFAULT_ORDER_AMOUNT = 31.0
DEFAU... |
# Copyright 2019 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... |
from django.test import TestCase
from django.contrib.auth import get_user_model, authenticate
class UsersManagersTests(TestCase):
def test_create_user(self):
User = get_user_model()
user = User.objects.create_user(username='normal_user', password='foo')
self.assertEqual(user.username, 'nor... |
class SessionHelper:
def __init__(self, app):
self.app = app
def login(self, username="admin", password="secret"):
wd = self.app.wd
self.app.open_home_page()
wd.find_element_by_name("user").click()
wd.find_element_by_name("user").clear()
wd.find_element_by_name(... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
"""Defines Experimenter message."""
# System imports
# Third-party imports
from pyof.foundation.base import GenericMessage
from pyof.foundation.basic_types import UBInt32
from pyof.v0x04.common.header import Header, Type
__all__ = ('ExperimenterHeader',)
# Classes
class ExperimenterHeader(GenericMessage):
""... |
__author__ = "Børge Jakobsen, Thomas Donegan"
__copyright__ = "Copyright 2019, Brexit boy and SaLmon king"
__credits__ = ["Børge Jakobsen, Thomas Donegan"]
__license__ = "Apache License"
__version__ = "2.0"
__maintainer__ = "Børge Jakobsen, Thomas Donegan"
__status__ = "Development"
from Db import Db
from ModelDbFunct... |
#__author__ = "Edward Wong"
#__copyright__ = "Copyright 2021, The X Project"
#__credits__ = ["Edward Wong"]
#__license__ = "MIT"
#__version__ = "1.0.1"
#__maintainer__ = "Edward Wong"
#__email__ = "edwsin65@gmail.com"
import numpy as np
import cv2 as cv
import matplotlib.pyplot as plt
img1 = cv.imread(
"differen... |
from distutils.core import setup
setup(
name = 'macos-releases',
version = '1.0',
license='MIT',
description = 'Get the name and version of a macOS releases',
author = 'XIMet',
author_email = 'dq.ximet@gmail.com',
url = 'https://github.com/ximet/macos-releases',
download_url = 'https://github.com/ximet/... |
n=int(input())
e=[int(i) for i in input().split()]
ap=0 #Available Police
uc=0 #Unchecked Case
for i in e:
if i>0:
ap+=i
else:
x= ap+i #since i is negative ap+i=ap-|i|
if x>0:
ap=x
else:
ap=0
uc+=(-x)
print(uc) |
from typing import List, Callable
from functools import wraps
import numpy as np
from numpy import ndarray
from numpy.fft import fft2, fftshift, ifft2, ifftshift
def split_channel(func: Callable[[ndarray], ndarray]):
""" Split channels of the input image.
Assume the decorated function only accept gray-scale ... |
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
from vk_api.keyboard import VkKeyboard, VkKeyboardColor
from vk_api.utils import get_random_id
from dotenv import load_dotenv
from unpacker import unpack_questions
import os
import random
import redis
import logging
logger = logging.getLogger(__file__)
... |
import warnings
import cv2
import numpy as np
from mmpose.core.post_processing import transform_preds
def _calc_distances(preds, targets, mask, normalize):
"""Calculate the normalized distances between preds and target.
Note:
batch_size: N
num_keypoints: K
dimension of keypoints: D ... |
# -*- coding: utf-8 -*-
#
# Finite State Machine
#
# Written in 2021 by Moky <albert.moky@gmail.com>
#
# ==============================================================================
# MIT License
#
# Copyright (c) 2021 Albert Moky
#
# Permission is hereby granted, free of charge, to a... |
from pytube import YouTube
import pytube
import os
def main():
video_url = input('Enter YouTube video URL: ')
if os.name == 'nt':
path = os.getcwd() + '\\'
else:
path = os.getcwd() + '/'
name = pytube.extract.video_id(video_url)
YouTube(video_url).streams.filter(only_audio=True).f... |
# Copyright 2018 Google LLC
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... |
import numpy as np
import pywt
def damp_coefficient(coeff, sigma):
"""Filter DWT coefficients by performing an FFT and applying a Gaussian
kernel.
"""
fft_coeff = np.fft.fft(coeff, axis=0)
fft_coeff = np.fft.fftshift(fft_coeff, axes=[0])
ydim, _ = fft_coeff.shape
gauss1d = 1 - np.exp(-np.... |
from django.contrib import admin
from .models import Feature, FeatureOption
admin.site.register(Feature)
admin.site.register(FeatureOption) |
# -*- coding: utf-8 -*-
# Copyright (c) 2013, Mahmoud Hashemi
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of condit... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... |
from botocore.exceptions import ClientError
from django.test import TestCase
from rest_framework.test import APIClient
from backend.models import UserModel, RoleModel, TenantModel, AwsEnvironmentModel, Schedule, ScheduleModel,\
CloudWatchEvent
from datetime import datetime
from unittest import mock
@mock.patch("b... |
from paddle import nn
from paddle.nn import functional as F
from maskrcnn_benchmark.modeling import registry
from maskrcnn_benchmark.modeling.poolers import Pooler
from maskrcnn_benchmark.layers import Conv2d
@registry.ROI_KEYPOINT_FEATURE_EXTRACTORS.register("KeypointRCNNFeatureExtractor")
class KeypointRCNNFeatur... |
vis_embedding_dim = 512
len_vis_input = 49
vis_input = False
pretrain_mode = 'train'
dev_data_gen = False
dev_data_file_load = False
return_the_img_path = False # return_the_img_path = True when pretrain_mode == 'test'
dev_npy_dir = '/data/meihuan2/dataset/SS_MLM/1213-testnpy/'
result_multimodal_file = '/data/meihuan2/... |
import msprime
import tskit
import warnings
import numpy as np
from .slim_tree_sequence import *
from .slim_metadata import *
from .provenance import *
from .util import *
def recapitate(ts,
ancestral_Ne=None,
**kwargs):
'''
Returns a "recapitated" tree sequence, by using msprime... |
# -*- coding: utf-8 -*-
"""Validation machine of a polar SCIM
From publication:
K. Boughrara
Analytical Analysis of Cage Rotor Induction Motors in Healthy, Defective and Broken Bars Conditions
IEEE Trans on Mag, 2014
"""
from numpy import pi
from pyleecan.Classes.CondType12 import CondType12
from pyleecan.Classes.CondT... |
import cv2,os
import numpy as np
from PIL import Image
cam = cv2.VideoCapture(0)
recognizer = cv2.createLBPHFaceRecognizer()
detector=cv2.CascadeClassifier('frontface.xml')
'''
Below function converts data into yml
'''
def getImagesAndLabels(path):
imagePaths=[os.path.join(path,f) for f in os.listdir(path)]
... |
#!/usr/bin/env python
import sys
import time
import sim
_ENABLE_GUI = "--gui" in sys.argv
# If you don't want to see log messages on the console, uncomment the
# following line. You might want to do this if you are using the GUI
# which displays logs itself.
_DISABLE_CONSOLE_LOG = True
from rip_router import RIPRo... |
import numpy as np
#This is crafted especially for normal distribution for MLE.
class GradientDescentOptimizer:
def __init__(self, X, tolerance, learning_rate):
self.learning_rate = learning_rate
self.tolerance = tolerance
self.X = X
if(len(X.shape) == 1):
self.number_of... |
# -*- coding: utf-8 -*-
import six
from bson.objectid import ObjectId, InvalidId
from girder import logger
from girder.api import access
from girder.api.describe import Description, autoDescribeRoute
from girder.api.rest import Resource
from girder.constants import AccessType
from girder.exceptions import GirderExcept... |
# Copyright The PyTorch Lightning team.
#
# 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 i... |
#!/usr/bin/env python
# Obtain api key and secret and name it settings.py
BITFLYER_API_KEY = 'XXXXX'
BITFLYER_API_SECRET = 'XXXXX' |
# -*- coding: utf-8 -*-
class Storage(object):
def set(self, key, value, time=0):# pragma: no cover
raise NotImplementedError()
def get(self, key, default=None):# pragma: no cover
raise NotImplementedError()
def delete(self, key):# pragma: no cover
raise NotImplementedError()
cla... |
"""Functions copypasted from newer versions of numpy.
"""
from __future__ import division, print_function, absolute_import
import warnings
import sys
import numpy as np
from numpy.testing._private.nosetester import import_nose
from scipy._lib._version import NumpyVersion
if NumpyVersion(np.__version__) > '1.7.0.de... |
"""
CaseES
------
Here's an example getting pregnancy cases that are either still open or were
closed after May 1st.
.. code-block:: python
from corehq.apps.es import cases as case_es
q = (case_es.CaseES()
.domain('testproject')
.case_type('pregnancy')
.OR(case_es.is_closed(False)... |
"""Model for an access log."""
import datetime
import numpy as np
from time_period import TimePeriod
from django.conf import settings
from django.db import models
from django.utils import timezone
class AccessLog(models.Model):
"""Base class which logs access of information.
Attributes:
user: The us... |
#!/usr/bin/env python3
import yaml
CONFIG = {
'aws-arm64-quota-slice': {
# Wild guesses. We'll see when we hit quota issues
'us-east-1': 10,
'us-east-2': 8,
'us-west-1': 8,
'us-west-2': 8,
},
'aws-quota-slice': {
# Wild guesses. We'll see when we hit quo... |
# -*- coding: utf-8 -*-
class Solution(object):
''' https://leetcode.com/problems/count-primes/
'''
def countPrimes(self, n):
if n <= 2:
return 0
is_prime = [True] * n
ret = 0
for i in range(2, n):
if not is_prime[i]:
continue
... |
import functools
__all__ = [
"_C_ARY_B",
"_C_ARY_E",
"_C_BFLD",
"_C_BOOL",
"_C_BYCOPY",
"_C_BYREF",
"_C_CHARPTR",
"_C_CHR",
"_C_CLASS",
"_C_CONST",
"_C_DBL",
"_C_FLT",
"_C_ID",
"_C_IN",
"_C_INOUT",
"_C_INT",
"_C_LNG",
"_C_LNG_LNG",
"_C_ONEWAY",
"_C_OUT",
"_C_PTR",
"_C_SEL",
"_C_SHT",
"_C_STRUCT... |
# coding: utf-8
# In[1]:
# Alexander Hebert
# ECE 6390
# Computer Project #2
# Method 2/3
# In[2]:
# Tested using Python v3.4 and IPython v2
##### Import libraries and functions
# In[3]:
import numpy as np
# In[4]:
from PlaneRotationFn import planeRotation1
from PlaneRotationFn import planeRotation2
# In[... |
'''
By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.
What is the 10 001st prime number?
'''
import math
# this needs to be high in order to find enough primes
limit = 1000000
# create a list with limit+1 entries all set to True
list = [True] * (limit+1)
i = 2
limit... |
import chess
import math
from .coordinates import *
# -- Magic values ------------------------------------------------------------------------------------------------------
AZ_MOVE_COUNT = 4672
AZ_INDEX_NONE = -1
AZ_SHAPE = (8, 8, 73)
UNDERPROMOTIONS_SHAPE = (3, 3)
PROMOTION_PIECE_MODIFIER = 2
QUEEN_MOVE_SHAPE = ... |
import TestScripts.Parser
import sys
import os.path
import math
groupCode="""class %s : public Client::Group
{
public:
%s(Testing::testID_t id):Client::Group(id)
%s
{
%s
}
private:
%s;
};
"""
suiteCode="""
#include \"%s.h\"
%s::%s(Testing::testID_t id):Client::Suite(id)
... |
import os
import hashlib
from pathlib import Path
from manimpp.constants import TEX_TEXT_TO_REPLACE
from manimpp.constants import TEX_USE_CTEX
import manimpp.constants as consts
def tex_hash(expression, template_tex_file_body):
id_str = str(expression + template_tex_file_body)
hasher = hashlib.sha256()
... |
#!/usr/bin/env python
# Copyright (c) 2005 David D. Ding <dding@berkeley.edu>
#
# This software is distributed under the MIT Open Source License.
# <http://www.opensource.org/licenses/mit-license.html>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associa... |
# coding: utf-8
"""
LUSID API
The version of the OpenAPI document: 0.11.2275
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
class ResourceListOfQuote(object):
"""NOTE: This class is auto generated by OpenAPI Genera... |
import click
from src.pipeline_manager import PipelineManager
pipeline_manager = PipelineManager()
@click.group()
def main():
pass
@main.command()
@click.option('-p', '--pipeline_name', help='pipeline to be trained', required=True)
@click.option('-d', '--dev_mode', help='if true only a small sample of data wi... |
#!/usr/bin/python
# Copyright 2003 Dave Abrahams
# Copyright 2002, 2003 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# This tests that :
# 1) the 'make' correctly assigns types to produced targets
# 2) if... |
from pathlib import Path
from setuptools import setup, find_packages
# Get base working directory.
base_dir = Path(__file__).resolve().parent
# Readme text for long description
with open(base_dir/"README.md") as f:
readme = f.read()
setup(
name = "errant",
version = "2.2.3",
license = "MIT",
... |
"""
Support for Ness D8X/D16X alarm panel.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/alarm_control_panel.ness_alarm/
"""
import logging
import homeassistant.components.alarm_control_panel as alarm
from homeassistant.const import (
STATE_ALARM_... |
from __future__ import unicode_literals
try:
import unittest2 as unittest
except ImportError:
import unittest
import os
import datetime
import time
import subprocess
import warnings
import tempfile
import pickle
class WarningTestMixin(object):
# Based on https://stackoverflow.com/a/12935176/467366
cl... |
from __future__ import absolute_import, division, print_function
import collections
import os
import iotbx.phil
import numpy as np
from cctbx import uctbx
from dials.array_family import flex
from dials.util import Sorry, tabulate
from dxtbx.model.experiment_list import ExperimentListFactory
from scitbx.math import fi... |
from flask import render_template
from . import main
@main.app_errorhandler(404)
def page_not_found(e):
return render_template('404.html'), 404
@main.app_errorhandler(500)
def internal_server_error(e):
return render_template('500.html'), 500 |
from pipeline import *
def make_index_html(D):# {{{
source_dir = '../../data/interim/htmls/'
for i in tqdm(D.index):
auth = D.loc[i]
papers = get_papers_from_df(auth)
df = gen_spreadsheet(auth, papers)
idx = np.argsort(df.Año.values)
df = df.loc[idx, :]
FP = np... |
'''
@author: Greg Kramida (github id: Algomorph)
@copyright: (2015-2016) Gregory Kramida
@license: Apache V2
[That means (basically): feel free to modify, sell,
whatever, just do not remove the original author's credits/notice
from the files. For details, see LICENSE file.... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import warnings
from unittest import mock
import torch
from botorch import settings
from botorch.acquisition.monte_car... |
from .filterLastnightGapper import LastNightGapper
from .stockFinancial import StockFinancial
from .filterRemoveNoDataStocks import RemoveNoDataStocks
from .filterAtr import FilterAtr
from .filterEma import FilterEma
from .filterKeylevels import FilterKeyLevels
from .filterFibonacciRetracement import FilterFibonacciRet... |
'''
#######################
Implementation of Bellman Ford Algorithm in Python
Input: Weighted Directed Graph
Output: Minimum distance for each vertex from source
#######################
'''
graph = [] #dictionary to store the weighted directed graph
dist = [] # storing the minimum distance from source over eac... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# convert NoahMP outputs to CF-compatible files
import sys
import os
import glob
import datetime
import argparse
import dateutil.parser
import numpy as np
import netCDF4 as nc
np.seterr(invalid='ignore')
TDIM = 'time'
TVAR = 'TIMES'
timeunits = 'hours since 1900-01-01... |
from pype.ast import *
from pype.symtab import *
from pype.lib_import import LibraryImporter
from pype.fgir import FGNodeType, FGNode, Flowgraph, FGIR
from pype.error import *
class SymbolTableVisitor(ASTVisitor):
def __init__(self):
self.symbol_table = SymbolTable()
self.currentComponent = None
def retur... |
# Copyright 2020 The TensorFlow Probability 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.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
from textwrap import dedent
from typing import List, Tuple
import datetime
import requests
import pytest
from lunchbot.scrape_mensa import parse_menu, VEGY_TYPES
from lunchbot.scrape_mensa import read_page
from lunchbot.scrape_mensa import URI
def generate_test_html(
days: List[datetime.date],
items: List[... |
import pytest
from django.urls import resolve, reverse
from ccdj.users.models import User
pytestmark = pytest.mark.django_db
def test_detail(user: User):
assert (
reverse("users:detail", kwargs={"username": user.username})
== f"/users/{user.username}/"
)
assert resolve(f"/users/{user.use... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from sqlalchemy.ext.declarative import declared_attr
from woodbox.access_control.record import RecordACLModel
from woodbox.db import db, DatabaseInitializer
from woodbox.models.user_model import WBRoleModel
from woodbox.p... |
import pandas as pd
import numpy as np
import sklearn
from sklearn import linear_model
from sklearn.utils import shuffle
import matplotlib.pyplot as py
import pickle
from matplotlib import style
data = pd.read_csv("student-mat.csv", sep=";")
#print(data.head())
data = data[["G1", "G2", "G3", "studytime", "failures", "... |
import os
from jedi.inference.gradual.typeshed import TYPESHED_PATH, create_stub_module
def load_proper_stub_module(inference_state, file_io, import_names, module_node):
"""
This function is given a random .pyi file and should return the proper
module.
"""
path = file_io.path
assert path.ends... |
"""
To-Do Lists
https://github.com/basecamp/bc3-api/blob/master/sections/todolists.md
Lists of TodoItems and TodoListGroups under a TodoSet.
The To-Do hierarchy can be confusing.
TodoSet -> TodoLists -> TodoListGroups -> TodoItems
^
You are here.
"""
import abc
import six
from . import recordi... |
from __future__ import annotations
from typing import Any, cast
from django.core import checks
from django.db.backends.base.base import BaseDatabaseWrapper
from django.db.models import CharField, Field, IntegerField, Model, TextField
from django.db.models.expressions import BaseExpression
from django.forms import Fie... |
# 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... |
import frappe
from frappe.modules.import_file import import_file_by_path
from frappe.utils import get_bench_path
import os
from os.path import join
def after_migrate(**args):
callyzer_integration_create_custom_fields(**args)
def callyzer_integration_create_custom_fields(**args):
from frappe.custom.doctype.cus... |
import uuid as uu
from copy import copy
class CardClass:
"""
A class for the card classes
"""
def __init__(self, name, prop=[], *super):
self.name = name
self.super = super # array of superclasses
self.prop = prop
def unwrap_classes(cls: 'tuple') -> 'tuple':
"""
Return... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from ... import _utilities
fro... |
from setuptools import setup, find_packages
def read(filename):
return [req.strip()
for req in open(filename).readlines()
]
setup(
name="Delivery",
version="0.1.0", #major, minor, patch
description="Delivery app",
packages=find_packages(exclude="./venv"), #if a package has a __init__ is considered a p... |
import asyncio
import json
from datetime import timedelta
from starlette.testclient import TestClient
from starlette.websockets import WebSocketDisconnect
from strawberry.subscriptions import GRAPHQL_TRANSPORT_WS_PROTOCOL
from strawberry.subscriptions.protocols.graphql_transport_ws.types import (
CompleteMessage,... |
import win32api
import win32con
##from ctypes import windll
import time
import serial
##def m_move(x,y):
## windll.user32.SetCursorPos(x,y)
def l_click(x,y):
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
time.sleep(0.05)
win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
def... |
#!/usr/bin/env python3
from aws_cdk import core
from audiobook.audiobook_stack import AudiobookStack
app = core.App()
AudiobookStack(app, "audiobook", env={'region': 'eu-west-2'})
app.synth() |
# This file will be edited (the {{{ }}} things), and then ~/.emscripten created
# with the result, if ~/.emscripten doesn't exist.
# Note: If you put paths relative to the home directory, do not forget
# os.path.expanduser
# Note: On Windows, remember to escape backslashes! I.e. PYTHON='c:\Python27\'
# is not valid, ... |
import argparse
import os
import re
from logging import warning
import meio.gsm.tree_gsm as tree_gsm
from meio.experiment.gsm_experiment_utils import plot_gsm
from meio.gsm.dag_gsm import GuaranteedServiceModelDAG
from meio.gsm.utils import read_supply_chain_from_txt
def run_gsm(path, network, figpath, run_gsm_optim... |
# -*- coding: utf-8 -*-
import lemoncheesecake.api as lcc
from lemoncheesecake.matching import is_integer, check_that_in, check_that, is_list, is_, has_length, \
is_dict, has_entry, is_str
from common.base_test import BaseTest
SUITE = {
"description": "Method 'get_global_properties'"
}
@lcc.prop("main", "ty... |
# -*- coding: utf-8 -*-
import json
import requests
from . import BASE_URL, HEADERS
BASE_URL_NETWORK = BASE_URL + 'networks'
class BaseView(object):
"""
Base view class to directly access node/edge view properties.
"""
def __init__(self, network_view=None, obj_id=None, obj_type=None):
if ne... |
#!/usr/bin/python
import sys
import os
import threading
from threading import Thread
import time
import signal
import subprocess
airsimprocess = subprocess.Popen(["/home/nvagent/Blocks/Blocks.sh"])
exit_flag = False
def exit_properly_runtime_test():
global exit_flag
print("CREATING SUCCESS RESULT FILE... |
import requests
# headers = {'content-disposition': 'attachment'}
# headers={'Authorization': 'Bearer 1n3SF3B1cXejCiQymF0fpsvNXitE7b'}
# auth= "BINhnaWONXGmeTBxc1xs4jozzvnuaU"
# url = "https://actions.google.com/sounds/v1/alarms/alarm_clock.ogg"
# url_1 = 'https://freesound.org/apiv2/search/text/?query=piano&token=7W7... |
import os
from contextlib import contextmanager
import boto3
from botocore.errorfactory import ClientError
from dagster import Field, StringSource, check, seven
from dagster.core.storage.compute_log_manager import (
MAX_BYTES_FILE_READ,
ComputeIOType,
ComputeLogFileData,
ComputeLogManager,
)
from dagst... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.