content stringlengths 5 1.05M |
|---|
from __future__ import annotations
import copy
from typing import List, Union
from machine_common_sense.config_manager import Vector3d
from .base_objects import (
create_soccer_ball,
create_variable_definition_from_base,
)
from .definitions import (
ChosenMaterial,
DefinitionDataset,
ObjectDefini... |
from django.contrib.auth.base_user import BaseUserManager
from django.db import models
from django.contrib.auth.models import AbstractBaseUser
from django.contrib.auth.models import PermissionsMixin
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from django.contrib.auth.validat... |
def binary_to_string(binary):
return ''.join(chr(int(binary[a:a + 8], 2))
for a in xrange(0, len(binary), 8))
|
import pandas as pd
df = pd.read_csv("values.csv")
col = '_file_'
for index, row in df.iterrows():
l = str(row["dir"])
if len(l) == 1 :
row["dir"]= "00"+l
if len(l) == 2 :
row["dir"] = "0"+l
rep = str("" + str(row["id"]) + "_"+str(row["dir"])+".bmp")
print(rep)
row[col] = r... |
from .Lexicon import Lexicon
from .Stories import Stories
__all__ = ['Lexicon', 'Stories']
|
from core.modules.OTModule import OTModule
from pyforms import BaseWidget
from PyQt4 import QtGui
from PyQt4 import QtCore
import plugins
import sys
import pickle
import os
import traceback
class OTModuleProject(OTModule):
"""
Implements the project management module
"""
_controller = None #: modules con... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Jie Yang, Wei wu, Xiaoy LI
# Last update: 2019.03.12
# First create: 2017.06.15
# Concate:
#
import os
import sys
root_path = "/".join(os.path.realpath(__file__).split("/")[:-3])
if root_path not in sys.path:
sys.path.insert(0, root_path)
impo... |
# Importing necessary modules & libraries
from django.urls import path
from core import views
# Setting the app_name and url paths
app_name = "core"
urlpatterns = [
path('', views.index, name="index"),
path('analytics', views.analytics, name="analytics"),
path('user_login', views.user_login, name="user_lo... |
#!/usr/bin/env python
import string
import random
import uuid
import logging
from flask import Flask
from flask import request, jsonify
from tacker_agent import *
from shutil import rmtree
from database import DatabaseConnection
from copy import deepcopy
from werkzeug.contrib.cache import MemcachedCache
# LOGGING
# ... |
#!/usr/bin/env python
"""Stats server implementation."""
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import collections
import errno
import json
import logging
import socket
import threading
from future.builtins import range
from future.moves.urllib i... |
import unittest
from unittest import mock
import quibble.mediawiki.maintenance
class TestMediawikiMaintenance(unittest.TestCase):
@mock.patch.dict('os.environ', {'BAR': 'foo'}, clear=True)
@mock.patch('subprocess.Popen')
def test_install_php_uses_os_environment(self, mock_popen):
mock_popen.retur... |
from abc import ABC, abstractmethod
import treeclasses
import random
import copy
from sklearn.externals import joblib
from sklearn.neural_network import MLPRegressor
import pandas
import mtrain
class Player(ABC):
def __init__(self, player_num):
self.player_num = player_num
super().__init__()
... |
# -*- coding: UTF-8 -*-
from tkinter import *
class MainWindow:
def __init__(self):
self.frame = Tk()
self.label_search = Label(self.frame, text = "Input a word:")
self.text_search = Text(self.frame, height="1",width=30)
self.label_Result = Label(self.frame, text = "Result from iciba:")
self.text_Result ... |
import sys
import argparse
import web3
import autobahn
from autobahn import xbr
def main (accounts):
print('\nTest accounts - ETH/XBR balances and XBR data markets:\n')
for acct in accounts:
balance_eth = w3.eth.getBalance(acct)
balance_xbr = xbr.xbrtoken.functions.balanceOf(acct).call()
... |
from aiosnow import select
from aiosnow.models.table.declared import IncidentModel as Incident
async def main(client):
async with Incident(client, table_name="incident") as inc:
query = select().order_asc(inc.number)
async for _, record in inc.stream(query, limit=500, page_size=50):
p... |
# Copyright (c) 2016-2018 Koninklijke Philips N.V. All rights reserved. A
# copyright license for redistribution and use in source and binary forms,
# with or without modification, is hereby granted for non-commercial,
# experimental and research purposes, provided that the following conditions
# are met:
# - Redistrib... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Author: Donny You (youansheng@gmail.com)
# Repackage some file operations.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from utils.tools.logger import Logger as Log
class FileHelper(object):
... |
# -*- coding: utf-8 -*-
# Copyright (c) 2016, thumbor-community
# Use of this source code is governed by the MIT license that can be
# found in the LICENSE file.
from pyvows import Vows, expect
from tc_shortener.generators import BaseGenerator
from tc_core.context import Context
from thumbor.config import Config
fr... |
"""photrix.planning.py"""
__author__ = "Eric Dose :: New Mexico Mira Project, Albuquerque"
# Python system imports:
import os
import os.path
from collections import OrderedDict
from datetime import datetime, timezone, timedelta
from math import floor, sqrt, ceil, cos, sin, pi
from random import seed, uniform, shuffle... |
"""
The RepoManager class is the entry point for all actions related to repositories. It manages the list of repos and is
responsible for passing requests from the rest of asset management system to the individual repos.
"""
import os
from squirrel.repo.repo import Repo
from squirrel.repo.cache import Cache
from squi... |
# your Gmail account
import smtplib
import os
def send_mail(mailFrom,mailTo,appPass):
# creates SMTP session
s = smtplib.SMTP('smtp.gmail.com', 587)
# start TLS for security
s.starttls()
# Authentication
s.login(mailFrom, appPass)
catManage = 'cat /opt/projetmaster-master/logs/report'
body = os.popen(catMan... |
import streamlit as st
import streamlit.components.v1 as components
import gca_requests as gl
import datetime
import urllib.parse
import pandas as pd
import gca_main_functions as mf
def gca_page_2():
st.title("GOOGLE CALENDARS ANALYTICS PAGE 2")
st.write(f'## 2 GOOGLE CALENDAR SPECIFIC ANALYSIS (1 CALENDAR)')... |
# Generated by Django 3.0.8 on 2020-09-16 18:21
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('trip_places', '0010_auto_20200916_1810'),
('trip_places', '0010_auto_20200916_1620'),
]
operations = [
]
|
import argparse
import textwrap
with open('args.txt', 'w') as fp:
fp.write('-f\nbar')
parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
parser.add_argument('-f')
print(parser.parse_args(['-f', 'foo', '@args.txt']))
parser.print_help()
|
import datetime
import os
from pygame import mixer
import time
os.system("python3 loading.py")
now = datetime.datetime.now()
fmt = "%Y-%m-%d-%H"
def readr():
os.system("ls notes/*.txt")
File = input("Type your file from the list above ")
text = open( File, "r")
print(text.read())
def readp():
... |
#! /usr/bin/python
"""
Skeleton file for a ROS node implementation
in this project.
"""
from dataclasses import dataclass
from enum import Enum, auto
import sys
import sqlite3
import rclpy
from rclpy.node import Node
from rr_interfaces import msg
from load_config import load_configuration
from . import get_best
fro... |
from helpers import Distributions
from config import Configuration
import numpy as np
class Gene:
inno_tracker = 0
def __init__(self, generation, cause=None, copy=False):
self.inno_num = Gene.inno_tracker
if not copy:
Gene.inno_tracker+=1
self.origin = generation
se... |
#!/usr/bin/env python
# Copyright (c) Matscholar Development Team.
# Distributed under the terms of the MIT License.
from __future__ import print_function, unicode_literals
import click
from matscholar.cli.mscli_config import set_config
from matscholar.collect import ScopusCollector
from tabulate import tabulate
from... |
"""
Example how to query tags and keywords from the database.
"""
from __future__ import print_function, nested_scopes, generators
from simdb.databaseModel import *
import simdb.databaseAPI as api
import collections
import numpy as np
def print_caption(caption, size=80):
print("#" + "=" * (size - 2) + "#")
pri... |
from .html import HtmlParser, ParagraphHtmlSelector, SumulaHtmlSelector, EnciclopediaHtmlSelector
from .iudicium import IudiciumParser
from .pdf import PdfParser
law_parser = HtmlParser(ParagraphHtmlSelector(), 'planalto')
sumula_parser = HtmlParser(SumulaHtmlSelector(), 'stf')
enciclopedia_parser = HtmlParser(Enciclo... |
from setuptools import setup, find_packages
version = '0.4.1'
long_description = """
JSON-RPC Parts is a library of composable components one would need to assemble a JSON-RPC server or client.
The parts provided are JSON-RPC message parser and serializer, a generic request handler collection, a WSGI-specific reques... |
import typing as t
import unittest
from itertools import chain
import gql_alchemy.schema as s
from gql_alchemy.executor import Executor, Resolver, SomeResolver
from gql_alchemy.utils import PrimitiveType
class ListQuery:
def __init__(self, iterable: t.Iterable[t.Any]) -> None:
self.__iterable = iterable
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from subprocess import check_output # call command line
# from subprocess import Popen, PIPE
import os # make directories, change current dir, etc
import platform # macOS or windows
import shutil # move and delete files/folders
from glob impor... |
"""This module contains the general information for BiosPlatformDefaults ManagedObject."""
from ...imcmo import ManagedObject
from ...imccoremeta import ImcVersion, MoPropertyMeta, MoMeta
from ...imcmeta import VersionMeta
class BiosPlatformDefaultsConsts():
pass
class BiosPlatformDefaults(ManagedObject):
... |
from tools.load import loadFile
from speech import assistantResponse
from voiceRecognize import listen
from intents.timedate import timeDate_intent as timeDate
from intents.weather import wheather_intent as weather
from intents.assistant import assistant_intent as assistant
import random, os, sys
from multiprocessing i... |
"""
Copyright © 2022 Armağan Salman
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 without limitation the rights to use, copy, modify, merge, publish, distribute, s... |
from pytorch3d.renderer import RasterizationSettings
from pytorch3d.renderer import MeshRasterizer
class Rasterizer:
def init_rasterizer(self,cameras,image_size=512, blur_radius=0.0, faces_per_pixel=1):
raster_settings = RasterizationSettings(image_size=image_size, blur_radius=blur_radius,
... |
import os
import pandas as pd
from nltk import word_tokenize
import gensim
data = pd.read_json(os.path.join("scraper_siglas-uc", "outputs", "programas_clean.json"), orient="table")
programas = data["programa"].apply(lambda x: word_tokenize(x)).to_list()
diccionario = gensim.corpora.Dictionary(programas)
corpus ... |
import random
import string
from cancel_token import CancelToken
from eth_utils import (
to_bytes,
keccak,
)
from eth_keys import keys
from p2p import discovery
from p2p import kademlia
def random_address():
return kademlia.Address(
'10.0.0.{}'.format(random.randint(0, 255)), random.randint(0,... |
###########################
#
# #446 Retractions B - Project Euler
# https://projecteuler.net/problem=446
#
# Code by Kevin Marciniak
#
###########################
|
# (C) Copyright 2020 ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernmenta... |
from cvxopt import matrix, spmatrix, mul, div # NOQA
from .base import ModelBase
from ..consts import Fx0, Fy0, Gx0, Gy0 # NOQA
class Node(ModelBase):
""" DC node class"""
def __init__(self, system, name):
super().__init__(system, name)
self._group = 'Topology'
self._name = 'Node'
... |
# flake8: noqa
import unittest
from remember.sql_store import _create_command_search_select_query, Command, _rerank_matches, \
SqlCommandStore
REMEMBER_STAR = 'full_command, count_seen, last_used, command_info'
class SqlStoreTests(unittest.TestCase):
def test_create_select_query_whenSingleTermAll3_ShouldRet... |
import asyncio
from telethon.events import ChatAction, NewMessage
from telethon.tl.types import MessageEntityMentionName
from firebot import CMD_HELP
from firebot.function import get_all_admin_chats, is_admin
from firebot.modules.sql_helper import gban_sql
from firebot.modules.sql_helper.mute_sql import is_muted, mut... |
from hashlib import sha1
from Crypto import Random
from flag import FLAG
class PrivateSigningKey:
def __init__(self):
self.gen = 0x44120dc98545c6d3d81bfc7898983e7b7f6ac8e08d3943af0be7f5d52264abb3775a905e003151ed0631376165b65c8ef72d0b6880da7e4b5e7b833377bb50fde65846426a5bfdc182673b6b2504ebfe0d6bca36338b3a... |
import os
import pyttsx3
import webbrowser
import speech_recognition as sr
def get():
r = sr.Recognizer()
with sr.Microphone() as source:
print("How can I help you? ")
audio = r.listen(source)
print("done!")
try:
ch = r.recognize_google(audio).lower()
print("You said... |
import copy
import json
import pathlib
from typing import Union, List, Dict, Tuple
from iiif.iiif_server import IIIFServer
SAMPLES_CANVAS = {
"@type": "sc:Canvas",
"@id": "http://localhost:80/canvas1",
"label": "",
"width": 100,
"height": 100,
"images": [
{
"@type": "oa:Ann... |
from functools import wraps
from flask import Flask, request, jsonify
import uuid
app = Flask(__name__)
def _mock_get_things_from_db(id=None):
things = [{'id': '2ce41c1a-095e-4e1f-8c08-59bfd89fa806', 'name': 'thing1'},
{'id': 'c1a68009-97f0-4ca9-94fd-c300b63314b1', 'name': 'thing2'}]
if id:
... |
#counter for couting number of possibilities
counter = 1 #(1 because of 200p is one way)
#we go through the for loop for each coins
for a in range(3): #100
for b in range(int(1+(200-100*a)/50)): #50
for c in range(int(1+(200-100*a-50*b)/20)): #20
for d in range(int(1+(200-100*a-50*b-20*c)/10)): #10
... |
# Copyright 2022 The TensorFlow 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 applica... |
# coding= utf-8
from __future__ import unicode_literals
import pytest
import forth
class TestTheParser():
def test_empty_string(self):
""" Parser refuses to parse past the end of the string. """
p = forth.Parser('')
with pytest.raises(StopIteration):
p.parse_whitespace()
... |
# Copyright 2017 British Broadcasting Corporation
#
# 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... |
from functools import reduce
from select import select
from threading import Thread
import approxeng.input.sys as sys
from approxeng.input.controllers import *
EV_KEY = 1
EV_REL = 2
EV_ABS = 3
class ControllerResource:
"""
General resource which binds one or more controllers on entry and unbinds the event l... |
from django.core.management.base import BaseCommand, CommandError
from aggregator.models import *
from django.conf import settings
import prestodb
import psycopg2
import requests
import json
from datetime import datetime
class Command(BaseCommand):
help = 'Collects the datasets/tables on Presto and updates all the... |
from django import forms
# from django.contrib.auth.models import User
# from django.contrib.auth.forms import UserCreationForm
from .models import *
from mptt.forms import TreeNodeMultipleChoiceField, TreeNodeChoiceField
from .widget import CheckboxSelectMultiple
class PropertyForm(forms.ModelForm):
parent = Tr... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import pulumi
import pulumi.runtime
class ServiceLinkedRole(pulumi.CustomResource):
"""
Provides an [IAM service-linked role](... |
# Generated by Django 3.1 on 2021-09-03 19:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0011_profile_call'),
]
operations = [
migrations.AddField(
model_name='profile',
name='address',
... |
from bleak import BleakClient
import asyncio
notify_uuid = "beb5483e-36e1-4688-b7f5-ea07361b26a"
def callback(sender, data):
print(sender, data)
def run(addresses):
loop = asyncio.get_event_loop()
tasks = asyncio.gather(
*(connect_to_device(address, loop) for address in addresses)
)
... |
import json
import time
import pyotp
import pprint
import config
import numpy as np
import pandas as pd
import robin_stocks as rs
from decimal import *
from base import BaseClass
class DiscretionaryWeight(BaseClass):
# returns true if not all weights add to 100%
def check_discretionary_weights(self, d... |
import cv2
import numpy as np
import dlib
class Seg2FaceDataMaker(object):
def __init__(self, lm_detector_param, out_size, margin=1.0):
self._out_size = out_size
self._margin = margin
self._f_detector = dlib.get_frontal_face_detector()
self._lm_detector = dlib.shape_predictor(lm_de... |
ref = {"A": 10, "B": 11, "C": 12, "D": 13, "E": 14, "F": 15}
def hex_to_decimal_integer(number):
if "." in number:
number = number.split('.')[0]
result = 0
for index, multiplier in enumerate(range(len(number) - 1, -1, -1)):
value = number[index]
if value in ref.keys():
... |
import os, glob, logging
import cPickle as pickle
from functools import partial
import random
import math
import multiprocessing as mp
import multiprocessing.sharedctypes as mps
from contextlib import closing
import numpy as n
from scipy.special import erf
import scipy.stats.mstats as mstats
import rtpipe.parsems as pm... |
import glob, os
from ez_trans import compress, carrier, config, logger
class engine(object):
"""work engine in charge of compressing and transfer files"""
log = logger.SimpleLogger()
def __init__(self, config, log=None):
self.config = config
if log:
self.log = log
def d... |
from django.urls import path
from . import views
from .views import MyTokenObtainPairView
from rest_framework_simplejwt.views import (
TokenRefreshView,
)
urlpatterns = [
path('', views.getRoutes),
path('register/', views.register, name="register" ),
path('get-budget/', views.getBudget, name='ge... |
#!/usr/bin/env python
__author__ = 'litrin.jiang@intel.com'
import os
import tornado.ioloop
import tornado.web
import tornado.httpclient
from tornado.options import define, options, parse_command_line
define("api_url", default="http://10.239.163.50:888", help="api url")
define("port", default="80", help="service po... |
import math
import os
import cv2
import imageio as io
import moviepy
import moviepy.editor
import numpy as np
import torch
import torch.nn.functional as F
import torchvision
from tqdm import tqdm
from models.disparity_estimation import Disparity, Semantics
from models.disparity_refinement import Refine
from models.di... |
import json
import os
import toml
from modules import login, room
class Bot(object):
"""Drrr bot feito em Python"""
def __init__(self):
self.config = toml.load('config.toml')
self.name = self.config['Botconfig']['name']
self.icon = self.config['Botconfig']['icon']
self.roomId = self.config['Botconfig']['ro... |
from app import app
import unittest
import json
from config import config
from app.model import drop, init, db
class TestUsers(unittest.TestCase):
def setUp(self):
self.app = app
self.app.config.from_object(config['testing'])
self.app_context = self.app.app_context()
self.app_cont... |
#
# PySNMP MIB module RIVERSTONE-RS94X-AGENTCAP-MIB (http://snmplabs.com/pysmi)
# ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/RIVERSTONE-RS94X-AGENTCAP-MIB
# Produced by pysmi-0.3.4 at Mon Apr 29 20:49:22 2019
# On host DAVWANG4-M-1475 platform Darwin version 18.5.0 by user davwang4
# Using Python ve... |
import collections
import enum
import re
from PipelineModulesLib.Util import ScopedNode
import slicer
import vtk
from PipelineCreatorLib.PipelineBases import SinglePiecePipeline # Note: this import may show up as unused in linting, but it is needed for the exec calls to work
from PipelineCreator import CallAfterAllThe... |
#!/usr/bin/python
from Cheetah.Template import Template
from cgi import escape
version = '0.1.1';
namespace = {'matplot_lib': '../matplot-' + version + '.js',
'version': version,
'renderer': ''};
templateDef='''
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="te... |
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 26 23:15:48 2016
@author: oacom
"""
import numpy as np
from terrain import genTerrain, interpTerrain, calcNormals, loadTerrain
from initCameras import generateCameras
from plotting import plotAll
from checkPoints import checkPoints
from sortAngles import sortAngles
from g... |
from string import ascii_lowercase, ascii_uppercase, digits
def main():
s = input()
lowercase = ''.join(sorted([i for i in s if i in ascii_lowercase]))
uppercase = ''.join(sorted([i for i in s if i in ascii_uppercase]))
odd = ''.join(sorted([i for i in s if i in digits and int(i) % 2 == 1]))
even... |
"""Module defining encoders."""
from opennmt.encoders.encoder import SequentialEncoder, ParallelEncoder
from opennmt.encoders.rnn_encoder import UnidirectionalRNNEncoder
from opennmt.encoders.rnn_encoder import BidirectionalRNNEncoder
from opennmt.encoders.rnn_encoder import RNMTPlusEncoder
from opennmt.encoders.rnn_e... |
# Copyright Microsoft Corporation
#
# 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... |
"""Utility that collects interpreted benchmark timings for a commit.
Run "python3 -m reporting.collect_baseline --help" for more information.
"""
from typing import Tuple
from datetime import datetime
import argparse
from reporting.common import get_csv_path
from reporting.gitutil import get_current_commit
from repo... |
# ---------------------------------------------------------------
# __init__.py
# Set-up time: 2020/5/14 下午4:09
# Copyright (c) 2020 ICT
# Licensed under The MIT License [see LICENSE for details]
# Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT
# Contact: wenbin.wang@vipl.ict.ac.cn [OR] nkwangwenbin@gmail.com
... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# The MIT License (MIT)
#
# Copyright (c) 2015 Bartosz Janda
#
# 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 w... |
# Copyright 2018 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://www.apache.org/licenses/LICENSE-2.0
#
# or in the "license... |
OSNAME = "MACOS"
NUMCORES = 4
BUILDCOMMAND = ["make", "-j" + str(NUMCORES)]
CLEANCOMMAND = ["make", "clean"]
FBSDIR = "/Users/mherron/Projects/FEBioStudio/"
FBSBUILDDIR = FBSDIR + "build/"
FBSPATH = FBSBUILDDIR + "bin/FEBioStudio.app/Contents/MacOS/FEBioStudio"
FBSREMOTEDIR = "macOS/stage/FEBioStudio.app/Contents/Ma... |
import types
import json
import schematics
from schematics.models import Model
from schematics.types import IntType, StringType
from schematics.types.compound import ModelType
from pyco.helpers.schema import BytesType, TupleType, LazyDictType
from pyco import errors, helpers
class Code(Model):
argcount = IntType(... |
from dsslite import *
db = Database()
w = Worker(db)
sim = Simulation(w, sim_speed=0)
sim.run()
|
# coding: utf-8
import pprint
import re
import six
class Encryption:
"""
Attributes:
openapi_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json... |
from jsonschema import validate
def validate_status_code(response, expected_status):
"""Please specify the parameters in the following order => (response, expected_status)"""
assert response.status_code == int(expected_status), f"Status code validation failed. Expected {expected_status}, Actual {response.statu... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
# File: /playstream3.py
# Created Date: Monday April 29th 2019
# -----
# Last Modified: Sunday May 12th 2019 7:22:55 pm
'''
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import hashlib
imp... |
# -*- coding: utf-8 -*-
import requests
class BoardSettings:
def __init__(self, board):
retry_attempts = 10
for attempt in range(retry_attempts):
settings_url = "https://8ch.net/settings.php?board={0}".format(board)
try:
r = requests.get(settings_url)
j = r.json()
except requests.exceptions.Time... |
import unittest
from keydra.providers import cloudflare
from keydra.exceptions import DistributionException
from keydra.exceptions import RotationException
from unittest.mock import call
from unittest.mock import MagicMock
from unittest.mock import patch
CF_CREDS = {'manage_tokens.secret': 'pass'}
CF_SECRET_ALL ... |
from functools import partial
from homely._ui import allowinteractive, note, shellquote, warn
from homely._utils import haveexecutable, run
__all__ = ["haveexecutable", "execute"]
def execute(cmd, stdout=None, stderr=None, expectexit=0, **kwargs):
# Executes `cmd` in a subprocess. Raises a SystemError if the ex... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** 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... |
# -*- coding: utf-8 -*-
__author__= "姜维洋"
import re
import time
import scrapy
from scrapy import Request,FormRequest
from WEIBOSEARCH.items import WeibosearchItem
from WEIBOSEARCH.settings import TOPIC, max_page
class WeibosearchSpider(scrapy.Spider):
name = 'WeiboSearch'
search_url = 'https://weibo.cn/search/... |
class PnWKitException(Exception):
...
class GraphQLError(PnWKitException):
...
|
# -*- coding: utf-8 -*-
"""
CNN 'sparrow' from Grill/Schlüter, EUSIPCO 2017.
Provides create(). Can be used as a local predictor in audioclass/__init__.py.
Author: Jan Schlüter
"""
import torch.nn as nn
import torch.nn.functional as F
from . import ReceptiveField
class Sparrow(nn.Module):
"""
CNN from Gri... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import warnings
from ._tsrex import index, indices, tensor, TsrEx
from ._tplex import template
from ._constants import pi
from ._special import zeros, ones, eye
try:
import google.colab # noqa: F401
try:
from IPython import get_ipython
from IPytho... |
# pylint: disable=unused-wildcard-import
import os
import jstyleson
import sys
from .cli.colorized_print import *
def read_json_file(file_path):
with open(file_path, 'r') as file:
file_content = file.read()
return jstyleson.loads(file_content)
def write_json_file(file_path, config):
with open(file_path, '... |
import random
def run (autoTester):
def f():
return 3, 4
autoTester.check ((1, 2, *f()))
def g():
return [3, 4]
autoTester.check ([1, 2, *f()])
# doesn't compile
# d1 = {'a':1, 'b':2}
# d2 = {'c':3, **d1}
# autoTester.check(str(d2))
|
import torch
import glob
import unicodedata
import string
import random
all_letters = string.ascii_letters + " .,;'-"
n_letters = len(all_letters)
def find_files(path): return glob.glob(path)
# Turn a Unicode string to plain ASCII, thanks to http://stackoverflow.com/a/518232/2809427
def unicode2ascii(s):
retur... |
from rules_reader import read_rules, empty_char
from sys import argv, stderr
import json
def parse_rule_label(
inpc: dict,
inpdata: str,
rules,
label: str,
recsel={},
recpath="",
simple_terminal=False,
loglevel=0,
emptyExpansion=True,
recLog=None,
):
"""Tenta expandir recurs... |
from gpconfig_modules.database_segment_guc import DatabaseSegmentGuc
from gpconfig_modules.file_segment_guc import FileSegmentGuc
from gpconfig_modules.segment_guc import SegmentGuc
class MultiValueGuc(SegmentGuc):
"""
encapsulate various GUC locations within a given segment.
A segment can include 2 datab... |
# Copyright 2021 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, ... |
import os
import logging
import argparse
from pathlib import Path
import shutil
import time
import copy
import yaml
import torch
from torch.utils.tensorboard import SummaryWriter
from datasets.datasets import Datasets
from utils.logger import setup_logger
from config.simclr_config import SimCLRConfig
from models.simc... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.