text stringlengths 2 999k |
|---|
#---------------------------------------------------------------------------
# This python module is used to customize a supported toolchain for your
# project specific settings.
#
# Notes:
# - ONLY edit/add statements in the sections marked by BEGIN/END EDITS
# markers.
# - Maintain indentation level and u... |
# -*- coding: utf-8 -*-
import argparse
import httplib2
import sys
from django.conf import settings
from djusagi.core.utils import get_cred
from googleapiclient.discovery import build
# set up command-line options
desc = "obtain all users who are suspended and have directory sharing enabled."
EMAIL = settings.DOMA... |
# Copyright (C) 2018 Red Hat, Inc.
#
# 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 in writ... |
# Lab 12 RNN
from string import ascii_uppercase
from collections import OrderedDict
from itertools import count
import torch
import torch.nn as nn
from torch.autograd import Variable
import pre_process as pre
'''
THis is a practice for using torch to implement simple, one cell RNN.
It takes sequence of alphabet lett... |
# coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.10.0
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import os
import sys
i... |
#!/usr/bin/env python
import re
import urllib.request
import urllib.error
from pathlib import Path
from typing import Optional
from labml import lab, monit
def get_repos(filename: str):
with open(str(lab.get_data_path() / filename), 'r') as f:
content = f.read()
link_pattern = re.compile(r"""
... |
#!/usr/bin/env python
from __future__ import print_function
import math
import re
import sqlite3 as sqlite
import sys
TABLE_QUERY = \
"""
SELECT name, sql
FROM sqlite_master
WHERE type='table'
ORDER BY name
"""
def msg(e):
print(e, file=sys.stderr)
def regex_match(expr, item):
re... |
QUERIES = {
'create_sim':
"""
CREATE TABLE IF NOT EXISTS {} (
t REAL NOT NULL PRIMARY KEY,
x REAL NOT NULL,
x_ref REAL NOT NULL,
y REAL NOT NULL,
y_ref REAL NOT NULL,
theta REAL NOT NULL,
theta_ref REAL NOT NULL,
v_c RE... |
import tweepy
from hidden import * #import keys from hidden.py
from nltk.sentiment.vader import SentimentIntensityAnalyzer
import argparse
def twitter_Authentication(): #Twitter API authentication
global api
auth = tweepy.OAuthHandler(CO... |
from flask import render_template,redirect,url_for, flash,request
from .import auth
from ..models import User
from .forms import LoginForm,RegistrationForm
from .. import db
from flask_login import login_user,logout_user,login_required
from ..email import mail_message
@auth.route('/login',methods=['GET','POST'])
def lo... |
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... |
from .utilities import unpackTimecode, findEvenSplit, getDuration, containsAny
class LyricLine:
"""An object that holds a lyric line and it's time"""
def __init__(self, timecode, text=""):
self.hours = 0
self.minutes, self.seconds, self.milliseconds = unpackTimecode(timecode)
self.time... |
# from SetPlaceholders import SetPlaceholder
import numpy as np
import math
from collections import namedtuple
from itertools import chain
vectorized_isclose = np.vectorize(math.isclose)
vectorized_round = np.vectorize(round)
Operator = namedtuple("Operator", "name func input_types output_type")
SetPlaceholder = nam... |
# python library to interface with panda
import datetime
import struct
import hashlib
import socket
import usb1
import os
import time
import traceback
import sys
from .dfu import PandaDFU # pylint: disable=import-error
from .flash_release import flash_release # noqa pylint: disable=import-error
from .update import en... |
from __future__ import division
import sys
import pandas as pd
def calc_coverage(csv_file):
"""Return the mutation coverage from the csv output of pitest
Arguments
-------------
- csv_file: the path of the csv file storing the result of the mutation
"""
frame = pd.read_csv(
csv_file,... |
# -*- coding: utf-8 -*-
import json
from autobahn.twisted.websocket import WebSocketServerProtocol
from autobahn.twisted.websocket import WebSocketServerFactory
from uuid import uuid1
from twisted.internet import reactor
from . import logger
from .messages import ON_OPEN
from .messages import ON_CLOSE
from .messages i... |
"""Example file with multiple flows."""
from metaflow import FlowSpec, step
class LinearFlow1(FlowSpec):
@step
def start(self):
self.a = 111
self.next(self.end)
@step
def end(self):
self.b = 222
assert self.a == 111
class LinearFlow2(FlowSpec):
@step
def star... |
from rest_framework import generics, authentication, permissions
from rest_framework.authtoken.views import ObtainAuthToken
from rest_framework.settings import api_settings
from user.serializers import UserSerializer, AuthTokenSerializer
class CreateUserView(generics.CreateAPIView):
"""Create a new user in the sy... |
# Copyright (c) 2014 Pure Storage, Inc.
# 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 re... |
"""This module contains the various methods for dealing with actions."""
import ClientAPI
import MarsTarget
import MarsCursor
class ActionEntry:
def __init__(self):
self.item = None
self.ability = None
#
# ActionAPI Methods
#
def GetActionInfo(slotId):
global _actions
if not _actions.ha... |
from yalul.parsers.ast.nodes.statements.expression import Expression
class Value(Expression):
def __init__(self, value):
super().__init__(value)
|
# Generated by Django 3.2.5 on 2021-07-05 16:42
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
... |
# Copyright (c) OpenMMLab. All rights reserved.
from abc import ABCMeta
import torch
import torch.nn as nn
from ..utils import constant_init, normal_init
from .conv_module import ConvModule
from .registry import PLUGIN_LAYERS
class _NonLocalNd(nn.Module, metaclass=ABCMeta):
"""Basic Non-local module.
This ... |
import datetime
# Limites de la region a estudiar
xL, xU, yL, yU = -2, +2, -2, +2
# resolucion de la imagen
r = 2000
# numero maximo de iteraciones
max_it = 200
# Grillado de la region a estudiar
x = [xL + i * (float(xU) - float(xL)) / (float(r)) for i in range(r + 1)]
y = [yL + i * (float(yU) - float(yL)) / (float... |
#!/usr/bin/python3
import os
import logging
import sqli_platform.utils as utils
import sqli_platform.utils.logger as logger
from flask import Flask, g
from flask_limiter import Limiter
from flask_limiter.util import get_remote_address
_basedir = os.path.abspath(os.path.dirname(__file__))
DOWNLOAD_PATH = f"{_basedir}/.... |
# -*- coding: utf-8 -*-
from unittest import TestCase
import os
import testdroid
import responses
JSON = {'k': 'v'}
PROJECT_ID = 2
TEST_RUN_ID = 3
DEVICE_SESSION_ID = 5
DEVICE_GROUP_ID = 6
USER_ID = 7
PARAM_ID = 8
TAGS = 'tags'
LIMIT = 0
URL_BASE = 'https://cloud.bitbar.com'
URL_API = '{}/api/v2'.format(URL_BASE)
... |
from railrl.envs.multitask.point2d import MultitaskImagePoint2DEnv
from railrl.envs.multitask.pusher2d import FullPusher2DEnv
from railrl.launchers.arglauncher import run_variants
import railrl.misc.hyperparameter as hyp
from railrl.torch.vae.vae_experiment import experiment
if __name__ == "__main__":
# noinspect... |
# This file is part of the pyMOR project (https://www.pymor.org).
# Copyright pyMOR developers and contributors. All rights reserved.
# License: BSD 2-Clause License (https://opensource.org/licenses/BSD-2-Clause)
from pymor.operators.interface import Operator
from pymor.vectorarrays.list import CopyOnWriteVector, List... |
from django.conf.urls import url
from django.contrib.flatpages import views
urlpatterns = [
url(r'^(?P<url>.*)$', views.flatpage, name='django.contrib.flatpages.templates.flatpage'),
]
|
import os
import pytest
from fontbakery.utils import TEST_FILE
from fontbakery.checkrunner import ERROR
def test_check_fontvalidator():
""" MS Font Validator checks """
from fontbakery.profiles.fontval import com_google_fonts_check_fontvalidator as check
font = TEST_FILE("mada/Mada-Regular.ttf")
# we want t... |
import os
PROJECT_ROOT = os.path.dirname(__file__)
DATA_DIR = os.path.join(PROJECT_ROOT, "data")
MODELS_DIR = os.path.join(PROJECT_ROOT, "trained_model")
|
#!/usr/bin/env python
#
# Copyright 2008 Google Inc. 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 requir... |
class Solution:
def totalMoney(self, n: int) -> int:
weeks = n // 7
firstweek = sum([i for i in range(1,8)])
s = sum([i for i in range(1,weeks)]) * 7 + firstweek * (weeks)
remains = n % 7
s += sum([i for i in range(1,remains+1)]) + remains * weeks
ret... |
from django.conf.urls import url, include
from rest_framework import routers
from .views import (
UserViewSet, PostViewSet, MyPostsList,
OtherPostsList, MyCommentsList, OtherCommentsList,
CommentOnPostViewSet, LoginView, LogoutView, RegisterView
)
router = routers.DefaultRouter()
router.register(r'use... |
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 03 13:30:41 2012
@author: jharston
"""
import webapp2 as webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext.webapp import template
import os
class fellerarleyDescriptionPage(webapp.RequestHandler):
def get(self):
text_f... |
# Copyright 2014 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... |
import tests.model_control.test_ozone_custom_models_enabled as testmod
testmod.build_model( ['None'] , ['Lag1Trend'] , ['Seasonal_Second'] , ['SVR'] ); |
################################# LICENSE ##################################
# Copyright (c) 2009, South African Astronomical Observatory (SAAO) #
# All rights reserved. #
# #
# Redistribu... |
from collections import OrderedDict
from rest_framework.exceptions import APIException
from rest_framework.pagination import PageNumberPagination
from rest_framework.response import Response
from rest_framework.utils.urls import replace_query_param, remove_query_param
from supplier.models import ListModel as supplier... |
# -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... |
import os, sys, time
import numpy as np
execfile('reduction_utils.py')
execfile('JvM_correction_brief.py')
execfile('ImportMS.py')
sys.path.append('.')
import diskdictionary as disk
# specify target disk and gap
target = 'GWLup'
gap_ix = 0
subsuf = '0'
# load mock injection parameters file data (as strings)
inj_file ... |
#
# softmax paddle model generator
#
import numpy as np
import sys
from save_model import saveModel
def softmax(name: str, x, axis):
import paddle as pdpd
pdpd.enable_static()
node_x = pdpd.static.data(name='x', shape=x.shape, dtype='float32')
out = pdpd.nn.functional.softmax(x=node_x, axis=axis)
... |
from run import app
from functools import wraps
from flask import render_template,flash,redirect,logging,session,url_for,request
from .models.database import user_register, user_login, get_feed, get_user_info, update_feed, change_password
#kullanıcı giriş decorator'u. bu yapı tüm decoratorlarda aynı.
def lo... |
import fnmatch
import json
import os
import subprocess
import sys
import threading
from time import sleep
if len(sys.argv) is not 4:
print "Usage\n\t python create_treemap_fallbacks.py [base_url] [timeout] [max_retries]"
exit(1)
base_url = sys.argv[1]
timeout = int(sys.argv[2])
max_retries = int(sys.argv[3]... |
# -*- coding: utf-8 -*-
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
from ccxt.base.exchange import Exchange
import math
from ccxt.base.errors import ExchangeError
from ccxt.base.errors import AuthenticationE... |
from random import choice
class RandomWalk:
def __init__(self, num_points=5000):
self.num_points = num_points
self.x_values = [0]
self.y_values = [0]
def fill_walk(self):
while len(self.x_values) < self.num_points:
x_direction = choice([-1, 1])
x_dista... |
#!/usr/bin/env python3
import sys
import json
import argparse
from collections import OrderedDict
def sort_json_object(o):
if isinstance(o, dict):
sorted_o = OrderedDict()
""" Order of keys in JSON object is irrelevant but we need to pick one
to be able to compare JSONS. """
for k... |
import os
import pwd
import re
import subprocess
import sys
if sys.version_info[0] == 3:
import http.client as httpclient
elif sys.version_info[0] == 2:
import httplib as httpclient
WIRESERVER_ENDPOINT_FILE = '/var/lib/waagent/WireServerEndpoint'
VERSIONS_PATH = '/?comp=versions'
AGENT_CONFIG_FILE = '/etc/wa... |
import csv
import requests
df = open("bridgeData3.csv",'r').readlines()
url = https://b2ptc.herokuapp.com/bridges
finalCsv = df[1:]
for i in finalCsv:
x = i.split(',')
requests.put(url+x[0],data={before:x[2],after:x})
print(x)
# pull each id,before image and after from df
# for each data item do a put ... |
from app.ring_command import RingCommand
def test_turn_next(config_json):
ring = RingCommand(config_json)
status = ring.turn_next()
assert status == 2
status = ring.turn_next()
assert status == 3
status = ring.turn_next()
assert status == 1
def test_turn_prev(config_json):
ring = ... |
import copy
import pickle
import numpy as np
from skimage import io
from . import kitti_utils
from ...ops.roiaware_pool3d import roiaware_pool3d_utils
from ...utils import box_utils, calibration_kitti, common_utils, object3d_kitti
from ..dataset import DatasetTemplate
import struct
class KittiDataset(DatasetTemplat... |
#
# Copyright (c) 2022 Airbyte, Inc., all rights reserved.
#
"""
Test case, when custom Export, ExportSchema properties contains names,
that will conflict in further data normalization, like:
`userName` and `username`
"""
from unittest.mock import MagicMock
import pytest
from airbyte_cdk.models import SyncMode
from ... |
# Copyright 2016 Google Inc. 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 applicable law or ag... |
# -*- coding: utf-8 -*-
# Copyright 2013-2021 CERN
#
# 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 a... |
import pytest
from rumydata import table, Layout, field
from rumydata.rules import row as rr, header as hr
def test_row_good(basic):
assert not table.Layout(basic).check_row(['1', '2', '2020-01-01', 'X'])
def test_row_choice(basic):
lay = Layout({'c1': field.Choice(['x'], nullable=True)})
assert not la... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import atexit
import os
from commands import getoutput, getstatusoutput
GRAY = "\033[90m"
RED = "\033[91m"
GREEN = "\033[92m"
YELLOW = "\033[93m"
ENDC = "\033[0m"
def indent(text, width=4):
return " " * width + text.replace("\n", "\n" + " " * width)
d... |
from abc import ABCMeta, abstractmethod
import numpy as np
from typing import Callable, Dict, List
from ..core.position import Position
from .route import Route
class BaseRouter(metaclass=ABCMeta):
@abstractmethod
def map_match(self, position: Position) -> Position:
return NotImplemented
@abstrac... |
"""
WSGI config for EasyCorrAPI project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_S... |
import os
from django.template import Context, Engine, TemplateSyntaxError
from django.test import SimpleTestCase
from .utils import ROOT
RELATIVE = os.path.join(ROOT, 'relative_templates')
class ExtendsRelativeBehaviorTests(SimpleTestCase):
def test_normal_extend(self):
engine = Engine(dirs=[RELATIVE... |
__pyarmor__(__name__, __file__, b'\x50\x59\x41\x52\x4d\x4f\x52\x00\x00\x03\x07\x00\x42\x0d\x0d\x0a\x06\x29\xa0\x01\x00\x00\x00\x00\x01\x00\x00\x00\x40\x00\x00\x00\x02\x14\x00\x00\x00\x00\x00\x10\x4a\xb5\x74\x68\xaa\xe4\x32\xf5\xdd\x25\x95\x6f\xd4\x18\x25\xcd\x00\x00\x00\x00\x00\x00\x00\x00\x3e\xb4\x51\xa6\x25\x03\xac\x... |
#!/usr/bin/python3
import os
import numpy as np
from scipy import integrate
import matplotlib.pyplot as plt
############
# MAIN
############
# File System Setup
mainpath= "./newtesting/"
subfolder = "funny/"
fullpath = mainpath+subfolder
os.makedirs(fullpath, exist_ok=True)
# Basic Parameters
windowLength = 2016... |
# This file is part of Hypothesis, which may be found at
# https://github.com/HypothesisWorks/hypothesis/
#
# Most of this work is copyright (C) 2013-2021 David R. MacIver
# (david@drmaciver.com), but it contains contributions by others. See
# CONTRIBUTING.rst for a full list of people who may hold copyright, and
# con... |
# Copyright (c) 2016 Cloudbase Solutions Srl
#
# 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 ... |
#!/usr/bin/env python
# Copyright 2016 Google Inc. 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... |
######### 1_generating_more_graphs.py #################
############ Script to Create the Box Plots #############
import pdb #for debugging
import numpy as np
import pyomo.environ as pyo
from pyomo.opt import SolverFactory
from pyomo.opt import SolverStatus, TerminationCondition
import pyomo.mpe... |
# -*- coding: utf-8 -*-
# Copyright 2017 Google Inc. 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
#
# Unles... |
import stuett
from stuett.global_config import get_setting, setting_exists
import argparse
from pathlib import Path
from datetime import datetime
import plotly.graph_objects as go
import pandas as pd
import matplotlib.pyplot as plt
def load_data(fname):
# change here to get data from another sensor
rock_temp... |
import click
import logging
import sys
from typing import Tuple
from kubails.commands import helpers
from kubails.services.config_store import ConfigStore
from kubails.services.service import Service
from kubails.resources.templates import SERVICE_TEMPLATES
from kubails.utils.command_helpers import log_command_args_fac... |
import logging
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration
from sentry_sdk.integrations.logging import LoggingIntegration
from .base import * # noqa
from .base import env
# GENERAL
# ------------------------------------------------------------------------------
# https://docs.djan... |
from mrcnn.config import Config
from mrcnn import utils
import os
class CocoConfig(Config):
"""Configuration for training on MS COCO.
Derives from the base Config class and overrides values specific
to the COCO dataset.
"""
# Give the configuration a recognizable name
NAME = "coco"
# We u... |
'''
This file is part of targetcli.
Copyright (c) 2011-2014 by Datera, Inc
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 applica... |
"""Host API required Work Files tool"""
import os
from . import lib
from avalon import api
def _active_document():
if len(lib.app().Documents) < 1:
return None
return lib.app().ActiveDocument
def file_extensions():
return api.HOST_WORKFILE_EXTENSIONS["photoshop"]
def has_unsaved_changes():
... |
'''
Data mining from
'''
# Common imports
import os
import sys
from data import *
from tqdm import *
import numpy as np
import numpy.random as rnd
import tensorflow as tf
import matplotlib
import matplotlib.pyplot as plt
#from sklearn.preprocessing import StandardScaler
from sklearn.model_selection im... |
#!/usr/bin/env python3
#
# Copyright (c) Bo Peng and the University of Texas MD Anderson Cancer Center
# Distributed under the terms of the 3-clause BSD License.
import os
import pytest
import subprocess
import unittest
from sos.parser import ParsingError, SoS_Script
from sos.targets import file_target, sos_targets, ... |
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(
name='placebo',
version='0.10.0',
description='Make boto3 calls that look real but have no effect',
long_description=open('README.md').read(),
author='Mitch Garnaat',
author_email='mitch@garnaat.com',
url='https://gi... |
"""Build out Mheshimiwa api entry points and routes."""
import collections
from flask import url_for, request
from flask_restplus import Resource,reqparse
from .app import api, app
from . import utils
constituency_arguments = reqparse.RequestParser()
constituency_arguments.add_argument('county', type=str, required=Fal... |
# -*- coding: utf-8 -*-
# Copyright (c) 2021, TeamPRO and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
from calendar import monthrange
import frappe
from frappe.model.document import Document
from dateutil.relativedelta import relativedelta
from frappe.utils im... |
import structlog
from app.asset.assetStore import *
from app.asset.asset import *
from flask import abort
from flask import jsonify
from flask_restful_swagger import swagger
from flask_restful import Resource
from flask_restful import reqparse
logger = structlog.get_logger(__name__)
class AssetAPI(Resource):
as... |
from django.urls import path
from .views import (
RideListView,
RideDetailView,
RideCreateView,
RideUpdateView,
RideDeleteView,
OwnerRideListView,
ShareCreateView,
SharePickRideListView,
ShareRideListView,
... |
from typing import Dict
from msrc.appconfig import from_argv
import pytest
from common import AllTypes, all_args, all_values, En
def test_argv():
loaded = from_argv(AllTypes, all_args)
assert loaded == all_values
def test_argv_unknown():
unknown = ["--unknown"]
loaded = from_argv(AllTypes, all_args+... |
"""Data iterators for common data formats."""
from __future__ import absolute_import
from collections import OrderedDict, namedtuple
import sys
import ctypes
import logging
import threading
import numpy as np
from .base import _LIB
from .base import c_array, c_str, mx_uint, py_str
from .base import DataIterHandle, NDA... |
# Copyright (c) 2020, NVIDIA CORPORATION.
from __future__ import annotations
import datetime as dt
from numbers import Number
from typing import Any, Sequence, Tuple, Union, cast
import numpy as np
import pandas as pd
import pyarrow as pa
from nvtx import annotate
import cudf
from cudf import _lib as libcudf
from cu... |
# Generated by Django 2.2.2 on 2019-12-14 12:22
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('course', '0001_initial')... |
import riiideducation
env = riiideducation.make_env()
iter_test = env.iter_test()
import sys
import logging
PATH = '/kaggle/input/riiid-saint-model'
sys.path.append(PATH)
from riiid.utils import configure_console_logging, check_versions
from riiid.saint.model import SaintModel
configure_console_logging()
check_ve... |
import hashlib
# encoding string using md5 hash function
BYTE_STRING = hashlib.md5(b"This is MD5 in byte equivalent")
# printing the equivalent byte value.
print("The byte equivalent of hash is : ", end="")
print(BYTE_STRING.digest())
HEX_STRING = "This is MD5 in Hex equivalent"
# encoding string using encode()
# then ... |
# Copyright (c) 2019 PaddlePaddle Authors. 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 applic... |
"""Tests for simple use cases of the public api."""
import json
import pytest
import sqlfluff
from sqlfluff.core.errors import SQLFluffUserError
my_bad_query = "SeLEct *, 1, blah as fOO from myTable"
lint_result = [
{
"code": "L010",
"line_no": 1,
"line_pos": 1,
"description"... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from base import BaseObject
class SiblingsDictGenerator(BaseObject):
def __init__(self, some_df):
BaseObject.__init__(self, __name__)
self.df = some_df
@staticmethod
def normalize(some_dict):
the_normalized_dict = {}
for key i... |
from matplotlib import pyplot as plt
import random
from math import sqrt, log
def read_csv(file_name):
with open(file_name, 'r') as f:
data = []
attribute_names = {index:name for index,name in enumerate(f.readline().strip().split(','))}
while True:
line = f.readline()
if not line: return data
else:
... |
"""
WSGI config for AnimeView project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SET... |
# Copyright 2017 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... |
import torch.nn as nn
from mighty.monitor.mutual_info.mutual_info import MutualInfo
class MutualInfoStub(MutualInfo): # pragma: no cover
"""
Mutual Info stub that does nothing.
"""
def __init__(self):
pass
def __repr__(self):
return f"{self.__class__.__name__}()"
def regis... |
#retrieve_iamges.py
#Creator: Anthony Toribio and Robert Toribio
#Date: 10/30/2021
from apiclient.discovery import build
_API_KEY = "APIKeyHidden"
_CX = "CXHidden" #search_engine_id
_QUERY = "Justin Turner"
_SERVICE = build("customsearch","v1", developerKey=_API_KEY)
def getImage_url(query:str) -> st... |
import numpy as np
import pandas as pd
import SimpleITK as itk # simpleitk is required
import gc
gc.enable()
# path of dicom
data_path = "./data/dicom/" # folder contains all dicoms
output_path = "./data/tiff/" # output folder for tiff files
data_path = './DICOMs/'
output_path = './OutputTiff/'
import os
backInde... |
#!/usr/bin/env python3
#-*- coding: UTF-8 -*-
# Copyright (c) 2021 Huawei Device 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
#
#... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2014 Jérémie DECOCK (http://www.jdhp.org)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including withou... |
# Generated by Django 4.0 on 2022-02-19 15:06
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('customers', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='user',
name='time',
... |
import pytest
from dae.pedigrees.family_role_builder import FamilyRoleBuilder
from dae.pedigrees.loader import FamiliesLoader
from dae.variants.attributes import Role
# TODO: Organize into 1 test
@pytest.mark.parametrize(
"ped_file",
["pedigrees/pedigree_no_role_A.ped", "pedigrees/pedigree_no_role_B.ped"],
)
... |
"""
$description Live streaming news channel owned by Now/PCCW Group, based in Hong Kong.
$url news.now.com
$type live
"""
import json
import logging
import re
from streamlink.plugin import Plugin, pluginmatcher
from streamlink.stream.hls import HLSStream
log = logging.getLogger(__name__)
@pluginmatcher(re.compile... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.