content stringlengths 5 1.05M |
|---|
# Copyright 2018 Tensorforce Team. 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 la... |
from django.contrib.admin.templatetags.admin_list import pagination
from django.template import Library
register = Library()
@register.inclusion_tag('admin/pagination_top.html')
def pagination_top(cl):
return pagination(cl) |
__author__ = 'Vinayak Marali'
__author__ = 'Pavan Prabhakar Bhat'
"""
CSCI-603: Lab 2 (week 2)
Section 03
Author: Pavan Prbahakar Bhat (pxb8715@rit.edu)
Vinayak Marali (vkm7895@rit.edu)
This is a program that draws a forest with trees and a house.
"""
# Imports required by the program
import turtle
import ra... |
"""
This displays the user-based filtering page
"""
from ast import literal_eval
from collections import defaultdict
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
from dash.exceptions import PreventUpdate
import ... |
import streamlit as st
from src.database import Database
from src.utils import setup_logger, excel_download_link
logger = setup_logger()
def home_page():
logger.info({"message": "Loading home page."})
st.title("Excel SQL Runner")
st.write("Here you can run SQLs on your excel files.")
st.write("You c... |
#!/usr/bin/env python
#-*- coding=utf-8 -*-
#
# Copyright 2012 Jike Inc. All Rights Reserved.
# Author: liwei@jike.com
try:
s = 'abc'
s[0] = 'b'
except TypeError:
print 'str is not mutable'
try:
t = (1, 2, 3)
t[0] = 2
except TypeError:
print 'tuple is not mutable'
class A(object):
def __in... |
""" Kinesis Stream and Firehose Construct """
import os
from aws_cdk import (
core,
aws_iam,
aws_kinesis,
aws_kinesisfirehose,
aws_logs
)
from accounts.accounts import fetch_account_central
ACCOUNT_NUMBER = os.environ.get('CDK_DEPLOY_ACCOUNT')
CENTRAL_ACCOUNT_NUMBER = fetch_account_central(ACCOUNT_N... |
import os
import csv
import random
from sys import breakpointhook
words = []
position = 0
word_size = 9
#word_list="words_alpha.txt"
word_list="norvig_100000.txt"
def load_words():
words.clear()
if os.access(word_list,os.F_OK):
f = open(word_list)
for row in csv.reader(f, delimiter='\t'):
... |
'''Testing library for the applequest web app'''
|
import olympe
import os
from olympe.messages.ardrone3.PilotingSettingsState import MaxTiltChanged
DRONE_IP = os.environ.get("DRONE_IP", "10.202.0.1")
def test_maxtiltget():
drone = olympe.Drone(DRONE_IP)
drone.connect()
print("Drone MaxTilt = ", drone.get_state(MaxTiltChanged)["current"])
drone.disco... |
class Solution:
def numSteps(self, s: str) -> int:
|
#eg1
x = 4
y = 4
print(x==y)
#eg2
x = 5
y = '5'
print(x==y)
#eg3
x = 'Python'
y = 'python'
print(x==y)
#eg4
x = 'Python'
y = 'python'
print(x.lower())
print(x.lower()==y)
#eg5
print({5,6,7} == {7,6,5})
|
#!/usr/bin/env python
from operator import *
class MyObj(object):
def __init__(self,val):
super(MyObj,self).__init__()
self.val = val
def __str__(self):
return"MyObj(%s)"%self.val
def __lt__(self,other):
print'Testing %s < %s'%(self,other)
return self.val < other.val
def __add__(self,other):
print'A... |
import click
import csv
from enum import Enum
import re
EXTRACTABLE_TYPES = {
"theorem": ["thm", "theorem"],
"definition": ["def", "definition"],
"corollary": ["cor", "corollary"],
"lemma": ["lem", "lemm", "lemma"],
}
class RegexParts(Enum):
ExtraCharactersBeforeBeginTag = 0,
MainBeginTag = ... |
# Copyright (c) 2015 Mirantis, 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... |
import torch
from torch import nn
import torch.nn.functional as F
def relu():
return nn.ReLU(inplace=True)
def conv(in_channels, out_channels, kernel_size=(3,3,3), stride=(1,1,1), padding = 1, nonlinearity = relu):
conv_layer = nn.Conv3d(in_channels = in_channels, out_channels= out_channels, kernel_size = ke... |
from django.conf.urls import patterns, include, url
from django.contrib import admin
urlpatterns = patterns(
'',
url(r'^$|^sync', 'cal.views.home', name='home'),
url(r'^admin/', include(admin.site.urls)),
url(r'^admin/', include('loginas.urls')),
url(r'^admin/generate-categories', 'cal.views.gener... |
"""
Defines components.
- PipelineComponent: receive message from a queue, publishes to a topic
- SourceComponent: generates data somehow (e.g. external fetch), publishes to a topic
- SinkComponent: receive messages, do not publish anything
- NullComponent: does not receive or publish anything
"""
import typing
impor... |
import requests
import json
import os
import time
from requests import post
os.system("clear")
os.system("figlet Zendot-H")
time.sleep(1)
banner="""
\t Spam SMS
--------------------------------------
[+]Author: Zendot-H
[+]Github: https://github.com/Zaeni123
----------------------------------------
... |
def test_example():
"""Stub test."""
|
from markyp_html.inline import a
from markyp_bootstrap4.buttons import ButtonContext
from markyp_bootstrap4.dropdowns import *
def test_DropdownButtonFactory():
contexts = (
ButtonContext.PRIMARY, ButtonContext.SECONDARY, ButtonContext.SUCCESS,
ButtonContext.DANGER, ButtonContext.WARNING, ButtonCon... |
from django.db import models
from django.contrib.auth.models import AbstractUser
from utils.BaseModel import BaseModel
class User(AbstractUser, BaseModel):
"""
用户模型类
"""
image = models.ImageField(upload_to="user_image", verbose_name="用户头像")
class Meta:
db_table = "shop_user"
verbo... |
import dns.resolver
import json
def test_lookup(request):
svc = request.args.get('svc')
if svc:
return lookup(svc)
return 'svc arg not provided'
def lookup(name):
answers = dns.resolver.query(f'_run._tcp.{name}.svc.local.', 'SRV')
if answers:
print(f'found answers {answers} for n... |
from setuptools import setup
setup(
name='upstream_wpt_webhook',
version='0.1.0',
author='The Servo Project Developers',
url='https://github.com/servo-automation/upstream-wpt-sync-webhook/',
description='A service that upstreams local changes to web-platform-tests',
packages=['upstream_wpt_web... |
# -*- coding: utf-8 -*-
"""
create on 2021-01-30 15:41
author @66492
"""
import numpy as np
def accuracy(y_true: np.ndarray, y_hat: np.ndarray):
y_true = y_true.reshape(-1, )
y_hat = y_hat.reshape(-1, )
return (y_true == y_hat).sum() / y_true.shape[0]
|
from contextlib import suppress
from pathlib import Path
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QListWidgetItem, QTableWidget, QListWidget, QStackedWidget
from gemmi import cif
from cif.text import retranslate_delimiter, utf8_to_str
from equip_property.tools import read_document_from_cif_file
from gu... |
import unittest
from logging import INFO
from common import exceptions
import logger
from series import FileParser
class KnownValues(unittest.TestCase):
File_SxxExx = {}
File_SxxExx['FileName'] = ""
File_SxxExx['SeriesName'] = 'Covert Affairs'
File_SxxExx['SeasonNum'] = 1
File_SxxExx['EpisodeNum... |
import click
from cached_property import cached_property
from sgqlc.endpoint.http import HTTPEndpoint
from github_team_organizer.classes.github import GitHubWrapper
class GitHubGraphQL:
__instance = None
url = 'https://api.github.com/graphql'
def __new__(cls, *args, **kwargs):
if GitHubGraphQL... |
"""
implementations of AES ECB block cipher commands to execute on a YubiHSM
"""
# Copyright (c) 2011 Yubico AB
# See the file COPYING for licence statement.
import struct
__all__ = [
# constants
# functions
# classes
#'YHSM_Cmd_AES_ECB',
'YHSM_Cmd_AES_ECB_Encrypt',
'YHSM_Cmd_AES_ECB_Decrypt'... |
"""Handler for executions endpoint."""
from datetime import datetime
from datetime import timedelta
import tornado.gen
import tornado.web
from ndscheduler import settings
from ndscheduler.corescheduler import constants
from ndscheduler.corescheduler import utils
from ndscheduler.server.handlers import base
class H... |
# A provider for performing the necessary SPARQL queries.
# This was taken from the interim wikidata fuzzysearch backend, and is not fully working at all, which is
# why this file is commented out
# class SPARQLProvider:
# def query_variable(self, dataset, variable):
# query = f'''
# select ?dataset_i... |
import logging
import gym
import matplotlib.pyplot as plt
import numpy as np
from gym import logger
from peepo.pp.generative_model import GenerativeModel
from peepo.pp.genetic_algorithm import GeneticAlgorithm
from peepo.pp.peepo import Peepo
from peepo.pp.peepo_network import write_to_file
VISION = 'vision'
MOTOR =... |
from django.db import models
class Book(models.Model):
title = models.CharField(max_length=250)
is_published = models.BooleanField(default=False)
class BlogPost(models.Model):
title = models.CharField(max_length=250)
is_published = models.BooleanField(default=False)
|
# -*- test-case-name: mimic.test.test_session -*-
"""
Implementation of simple in-memory session storage and generation for Mimic.
"""
from __future__ import absolute_import, division, unicode_literals
from six import text_type
from uuid import uuid4
from datetime import datetime, timedelta
import attr
@attr.s
cl... |
import numpy as np
import mxnet as mx
from mxnet.gluon.data import DataLoader
from mxnet.gluon.data.vision import transforms
from pathlib import Path
from .dataset import PrepareDataset
from .transforms import ResizeLong, NonNormalizedTensor
from ..mytypes import Detector, Detections
from typing import Sequen... |
"""
Author: Ioannis Paraskevakos
License: MIT
Copyright: 2018-2019
"""
from .discovery import Discovery # noqa:F401
from .image_disc import image_discovery # noqa:F401
|
'''
Created on Jun 18, 2018
@author: rameshpr
'''
from PyQt4 import QtCore, QtGui
import os
import cv2
import numpy as np
from libs import FeatureExtractor
from libs.common import image_path, Sizes, MODEL_TYPE
class MainWindow(QtGui.QMainWindow):
def __init__(self):
QtGui.QMainWindow.__init__(self)
... |
from ..utils import action, results_formatter
from functools import partial
import arep
import pytest
import os
results_formatter = partial(results_formatter, name=os.path.basename(__file__))
results_in_comprehension = results_formatter({
(3, 5)
})
results_regular = results_formatter({
(8, 8)
})
results_yie... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Project : AppZoo.
# @File : demo
# @Time : 2020/11/5 8:19 下午
# @Author : yuanjie
# @Email : yuanjie@xiaomi.com
# @Software : PyCharm
# @Description :
from appzoo import App
app = App()
if __name__ == '__main__':
app.add_rou... |
"""
models/scintrex.py
==================
PyQt model for Scintrex relative gravimeter data.
--------------------------------------------------------------------------------
NB: PyQt models follow the PyQt CamelCase naming convention. All other
methods/functions in GSadjust use PEP-8 lowercase_underscore conve... |
# input = [5764801, 17807724]
input = [14222596, 4057428]
def transform(n, subject_number):
# set the value to itself multiplied by the subject number
n = n * subject_number
# set the value to the remainder after dividing the value by 20201227
_, remainder = divmod(n, 20201227)
return remainder
... |
from app import db
import json
import base64
from werkzeug.security import generate_password_hash, check_password_hash
from flask_login import UserMixin
#from enum import Enum
#class StatusEnum(Enum):
# off = "off"
# on = "on"
class User(UserMixin, db.Model):
id = db.Column(db.Integer, primary_key = True)
ema... |
import warnings
from weylchamber import closest_LI, c1c2c3
import qutip
def test_closest_LI_trivial_powell():
"""Test that a gate exactly at (c1, c2, c3) is in fact closest to itself"""
warnings.filterwarnings(
'ignore', message='the matrix subclass is not the recommended way')
CNOT = qutip.gates... |
import requests
from st2common.runners.base_action import Action
from urlparse import urlparse
class Device42BaseException(Exception):
pass
class BaseAction(Action):
def __init__(self, config):
super(BaseAction, self).__init__(config)
self.d42_server = self.config.get('d42_server', None)
... |
import unittest
from requests import Session
from adapter import p
from spoofbot.adapter.har import HarCache
class HarProxyTest(unittest.TestCase):
session: Session = None
adapter: HarCache = None
@classmethod
def setUpClass(cls) -> None:
cls.adapter = HarCache(
p / 'test_data/w... |
import gym
import pandas as pd
import datetime
from recogym.agents import OrganicUserEventCounterAgent, organic_user_count_args
from recogym import build_agent_init
from recogym.agents import Agent
from recogym import Configuration
from recogym import (
gather_agent_stats,
AgentStats
)
from recogym import env_1... |
# @Author : FederalLab
# @Date : 2021-09-25 16:52:03
# @Last Modified by : Chen Dengsheng
# @Last Modified time: 2021-09-25 16:52:03
# Copyright (c) FederalLab. All rights reserved.
from typing import List
import numpy as np
from openfed.utils import tablist
def samples_distribution(federat... |
from dataclasses import dataclass
from pathlib import Path
import os
import tempfile
from django.apps import apps
from django.conf import settings
from django.core.files.images import ImageFile
from django.utils.translation import gettext_lazy as _
import PIL as pillow
###############################################... |
import numpy as np
import matplotlib as plt
import torch
import torchvision
from torchvision import datasets, models, transforms
from torch.utils.data import DataLoader
import torch.nn.functional as Function
from torch import nn, optim
from torch.autograd import Variable
from PIL import Image
import json
from workspac... |
import glob
import json
import os
import shutil
import sqlite3
from scripts.artifact_report import ArtifactHtmlReport
from scripts.ilapfuncs import logfunc, is_platform_windows
def get_cmh(files_found, report_folder, seeker):
file_found = str(files_found[0])
db = sqlite3.connect(file_found)
cursor = db.c... |
import argparse
import json
import os
import django
import logging
FSW_ACCOUNT = 18
CANVAS_URL = "https://canvas.vu.nl"
os.environ['DJANGO_SETTINGS_MODULE'] = 'dejavu.settings'
django.setup()
logging.basicConfig(level=logging.INFO, format='[%(asctime)s %(name)-12s %(levelname)-5s] %(message)s')
import canvasapi
fr... |
# Generated by Django 3.1.3 on 2021-10-17 06:14
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
ope... |
# -*- coding:utf-8 -*-
from ihome.libs.yuntongxun.CCPRestSDK import REST
# 说明:主账号,登陆云通讯网站后,可在"控制台-应用"中看到开发者主账号ACCOUNT SID
_accountSid = '8aaf070858862df301588a202b520154'
# 说明:主账号Token,登陆云通讯网站后,可在控制台-应用中看到开发者主账号AUTH TOKEN
_accountToken = 'd42ff3839c2f4defa0361e5e11234b11'
# 请使用管理控制台首页的APPID或自己创建应用的APPID
_appId = '8... |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@File : 78.py
@Contact : huanghoward@foxmail.com
@Modify Time : 2022/5/28 18:54
------------
"""
from typing import List
class Solution:
def subsets(self, nums: List[int]) -> List[List[int]]:
res = []
def back(index, path):... |
import turtle
import pyperclip as pc
class TreeNode:
def __init__(self, val, left=None, right=None):
self.val = val
self.left = left
self.right = right
def __repr__(self):
return "TreeNode({})".format(self.val)
class TreeBuild:
""" Display how our tree looks like. """
... |
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... |
from otree.api import (
models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer,
Currency as c, currency_range,
)
import random
author = 'Victor_Farah'
doc = """
The Surrogation Game
"""
class Constants(BaseConstants):
name_in_url = 'surrogation'
players_per_group = None
num_round... |
from .context import assert_equal, get_simple_examples
import pytest
from sympy import Abs
examples = get_simple_examples(Abs)
delimiter_pairs = {
'|': '|',
'\\vert': '\\vert',
'\\lvert': '\\rvert'
}
@pytest.mark.parametrize('input, output, symbolically', examples)
def test_abs(input, output, symbolical... |
import gdspy
import math
def waveguide(w,l,layer):
""" waveguide rectangle """
wg=gdspy.Rectangle((-l/2,-w/2),(l/2,w/2),**layer)
return wg
def photonic_crystal(normal_holes,taper_holes,radius,taper_depth,spacing,
cell_name,input_taper_holes,input_taper_percent,layer):
""" define a parabolically tapered photoni... |
# Generated by Django 3.0.2 on 2020-07-12 20:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('loans', '0003_auto_20200617_0103'),
]
operations = [
migrations.AddField(
model_name='collateralfiles',
name='file_u... |
import proper_forms.fields as f
def test_render_attrs():
field = f.Text()
attrs = {
"id": "text1",
"classes": "myclass",
"data_id": 1,
"checked": True,
"ignore": False,
}
assert (
str(field.render_attrs(**attrs))
== 'class="myclass" data-id="1" i... |
# Generated by Django 3.1.14 on 2022-02-02 07:12
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('topology', '0013_add_user_defined_properties_field'),
]
operations = [
migrations.RemoveField(
model_name='snapshot',
name=... |
"""
==========
pcolormesh
==========
Shows how to combine Normalization and Colormap instances to draw
"levels" in pcolor, pcolormesh and imshow type plots in a similar
way to the levels keyword argument to contour/contourf.
"""
import matplotlib.pyplot as plt
from matplotlib.colors import BoundaryNorm
from matplotl... |
#!/usr/bin/env python
"""
The data set that is in the specified hdf5 file has labels in two different locations.
The label input files have the .label suffix.
The foci input files have the .out suffix.
Vacuum up the labels from the two given directories, merge the relevant portions (image number,object number) and
... |
from libs.operations import operator
print("mylib.py:", __name__)
# -- can do relative imports from file with parent package --
from .operations import operator
|
class ZiggeoWebhooks:
def __init__(self, application):
self.__application = application
def create(self, data = None):
return self.__application.connect.post('/v1/api/hook', data)
def confirm(self, data = None):
return self.__application.connect.post('/v1/api/confirmhook', data)
... |
#!/usr/bin/python3
"""
Export your Windows Bluetooth LE keys into Linux!
Thanks to: http://console.systems/2014/09/how-to-pair-low-energy-le-bluetooth.html
Usage:
$ ./export-ble-infos.py <args>
$ sudo bash -c 'cp -r ./bluetooth /var/lib && service bluetooth force-reload'
$ rm -r bluetooth
"""
import os
import shuti... |
#!/usr/bin/python3
"""sends a request to the URL
displays the value of the variable X-Request-Id in the response header"""
from sys import argv
from requests import get
if __name__ == "__main__":
url = argv[1]
r = get(url)
print(r.headers.get("X-Request-Id"))
|
import psycopg2 as pgres
import pandas as pd
# ___ Connect to ElephantSQL db _________
def conx_elephant(conx_str):
# instantiate and return connection obj
cnx = pgres.connect(conx_str)
return cnx
# _____ DROP table ____________
def drop_table(tbl_name, cur, conn):
qry = "DROP TABLE " + tbl_name
... |
from heapq import heappush, heappop, heapify
# heappop - pop and return the smallest element from heap,
# maintaining the heap invariant.
# heappush - push the value item onto the heap,
# maintaining heap invarient.
# heapify - transform list into heap, in place,
# in linear time
class MinHeap:
def __init__(... |
import pytest
import jira_context
from jira_context import INPUT, JIRA
@pytest.fixture(autouse=True)
def reset_jira():
jira_context._prompt = lambda f, p: 'user' if f == INPUT else 'pass'
JIRA.ABORTED_BY_USER = False
JIRA.COOKIE_CACHE_FILE_PATH = None
JIRA.FORCE_USER = None
JIRA.MESSAGE_AUTH_ERR... |
from datetime import datetime
from unittest import TestCase
from mock import Mock
from app.jinja_filters import format_date, format_currency, format_multilined_string, format_percentage
from app.jinja_filters import format_household_member_name
from app.jinja_filters import format_str_as_date
from app.jinja_filters i... |
import pygame
import tydev
from tydev.gui.template import Template
class List(Template):
def __init__(self, location, size):
Template.__init__(self, location=location, size=size)
self.background_color = (255, 255, 255)
self.highlight_color = (130, 145, 255)
self.objects = []
... |
# A module to tests the methods of the SuperSystem
import unittest
import os
import shutil
import re
from copy import copy
from qsome import cluster_subsystem, cluster_supersystem, helpers
from pyscf import gto, lib, scf, dft
import numpy as np
import scipy as sp
import tempfile
class TestClusterSuperSystemMethod... |
from bili_global import API_LIVE
import utils
from json_rsp_ctrl import Ctrl, In, JsonRspType
class TvRaffleHandlerReq:
@staticmethod
async def check(user, real_roomid):
url = f"{API_LIVE}/gift/v3/smalltv/check?roomid={real_roomid}"
response = await user.bililive_session.request_json('GET', ur... |
# Generated by Django 3.0.7 on 2020-07-06 14:21
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('projects', '0001_initial'),
('library', '0002_item_project'),
]
operations = [
migrations.AddField(... |
from .date_viewsets import DayTemplateRuleViewSet, RuleSetElementViewSet, \
RuleSetViewSet, BaseRuleViewSet, DateRuleViewSet
from .delta_viewsets import DeltaViewSet
from .schedule_viewsets import ScheduleViewSet, TaskViewSet
|
from django.conf.urls import url
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [
url(r'^forms/$', views.forms, name="view"),
url(r'^board/$', views.board, name="board"),
url(r'^config/$', views.config, name="config"),
url(r'^$', views.ma... |
# Copyright (C) 2013 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
import os
import re
import time
from functools import partial
import sublime
from . import pycodestyle as pep8
from ..worker import Worker
from ..callback import Callback
from ..persistent_... |
import pty
from io import BytesIO
import pytest
from scrapli.exceptions import (
ScrapliConnectionError,
ScrapliConnectionNotOpened,
ScrapliUnsupportedPlatform,
)
from scrapli.transport.plugins.system.ptyprocess import PtyProcess
from scrapli.transport.plugins.system.transport import SystemTransport
def... |
from onecodex.models import OneCodexBase, ResourceList
from onecodex.models.helpers import ResourceDownloadMixin
from onecodex.models.analysis import Analyses
class AnnotationSets(OneCodexBase, ResourceDownloadMixin):
_resource_path = "/api/v1_experimental/annotation_sets"
def download(self, path=None, file_... |
import datetime
import os
import webbrowser
import pyttsx3
import pywhatkit
import speech_recognition as sr
import wikipedia
import pyjokes
engine = pyttsx3.init('sapi5')
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[1].id)
def speak(audio):
engine.say(audio)
en... |
# 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 ... |
## TO TELL ME THE AGE ##
def tell_my_age(age):
print('My age is {}'.format(age))
|
# -*- coding: utf-8 -*-
from setuptools import setup
from setuptools import Extension
import os
packages = \
['app', 'app.cython_ext', 'app.data']
package_data = \
{'': ['*']}
extras_require = \
{'Nuitka': ['Nuitka>=0.6.19.4,<0.7.0.0'],
'cython': ['cython>=0.29.15,<0.30.0'],
'pyinstaller': ['pyinstaller>=4.8,<5.0'... |
import sys
def dfs(v):
global ans
stack = [v]
tr.append(v)
w = graph[v]
visit[v] = True
if visit[w]:
a = 0
try:
a = tr.index(w)
except:
a = -1
if a != -1:
ans += tr[a:]
else:
dfs(w)
sys.setrecursionlimit(10**6)
t= i... |
#import subprocess
import yaml
import pandas as p
import json as js
import os, sys
#cmd = "ls pageyml"
#res = os.system(cmd)
#res = subprocess.check_output(cmd.split(' ')).strip()
#print (res)
#sys.exit()
def mkspc(x, maxsp, sep=' '):
return(''.join([sep]*(maxsp-len(x))))
def openfile(fname):
fp = open(fname, 'r'... |
from struct import pack, unpack
from can import Message
def cell_V_set_1_4(box_id: int, cell_1_4_v: list[float]) -> Message:
"""
Sets the Voltage Setpoints for Cells 1-4, range 0 to 5 V
"""
try:
arb_id = 160 + box_id
v_data = pack("<4e", *cell_1_4_v)
frame = Message(arbitration_... |
import pandas as pd
import numpy as np
from optbinning import BinningProcess
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.metrics import classification_report
from sklearn.metrics import auc, roc_auc_score, roc_curve
from sklearn.model_select... |
from django.db import models
# Create your models here.
from django.utils.timezone import now
from Blog import settings
from account.models import BlogUser
class OauthUser(models.Model):
user_alternative_type = (
("1","github"),
("2","google"),
)
user = models.ForeignKey(settings.AUTH_US... |
#
# (c) 2017 Shalom Carmel shalom@globaldots.com
#
# purge-akamai version 1
# https://api.ccu.akamai.com/ccu/v2/docs/
# Changelog
# version 1: Initial version
from __future__ import print_function
import os
import json
import logging
from highwindsclient import Highwinds
import config_highwinds as config
# Lamb... |
import os
import shutil
from unittest import TestCase
from cookiejar.channel import Channel
from cookiejar.settings import SettingsReader
class ChannelTests(TestCase):
def setUp(self):
self.current_dir = os.path.dirname(os.path.abspath(__file__))
self.templates_dir = os.path.join(self.current_di... |
from django.shortcuts import redirect
from django.contrib.auth.forms import UserCreationForm
from django.views.generic.edit import FormView
from django.http import JsonResponse
from django.contrib.auth import get_user_model, authenticate, login, logout
from django.contrib.auth.mixins import LoginRequiredMixin
from djan... |
# -*- encoding: utf-8 -*-
from django.conf.urls import patterns
from django.contrib import admin
from django.core.exceptions import PermissionDenied
from django.shortcuts import redirect, get_object_or_404
from django.utils.translation import ugettext_lazy as _
from django_pages.settings import ADMIN_MEDIA_PREFIX
fro... |
"""Compute depth maps for images in the input folder.
"""
import os
import glob
import torch
import utils
import cv2
import argparse
from torchvision.transforms import Compose
from midas.midas_net import MidasNet
from midas.midas_net_custom import MidasNet_small
from midas.transforms import Resize, NormalizeImage, Pre... |
from django.conf.urls import url
from .views import *
urlpatterns = [
url(r'^home$',home,name='home'),
url(r'^cart$',cart,name='cart'),
url(r'^market$',market,name='market'),
url(r'^market_with_params/(\d+)/(\d+)/(\d+)',market_with_params,name='market_with_params'),
url(r'^mine$',mine,name='mine'),... |
from numerous.engine.system.binding import Binding
from numerous.utils.dict_wrapper import _DictWrapper
from numerous.engine.system.namespace import _ShadowVariableNamespace
from numerous.engine.system.node import Node
class Connector(Node):
"""
Base class for representing connectors. Object that inherited ... |
from utilities.logger import *
def read_last_line():
file = open(Path(Logger.log_path, LogError.error_log_file), "r")
lastline = file.readlines()[-1]
lastline = lastline.strip()
file.close()
return lastline
def test_submission_error_flask():
"""" Ensures that that correct format """
flask... |
import os
import sys
os.system("echo " + ">xxx.txt")
for i in range(1,101):
#os.system("java -jar tools/PlayGame.jar maps/map"+str(i)+".txt 1000 1000 log.txt \"python harsha.py\" \"python alex.py\" 2> a.txt")
#~ os.system("java -jar tools/PlayGame.jar maps/map"+str(i)+".txt 1000 1000 log.txt \"python WatchYourStep.p... |
#!/usr/bin/env python3
from sense_hat import SenseHat
import datetime
import time
from logData import Logger
from checkRange import InRange
from makeRemindercsv import Reminder
import sqlite3
class Info:
SAMPLE_FREQUENCY_SECONDS = 3
def getInfo(self):
sense = SenseHat.getSenseHat()
timestamp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.