text
string
size
int64
token_count
int64
# 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 concurrent.futures import numpy as np import os from PIL import Image import torchvision from datasets import base from platforms.platf...
2,658
877
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ @File : sm4.py @Description : sm4加密算法的实现 @Date : 2021/10/28 15:59:51 @Author : ZelKnow @Github : https://github.com/ZelKnow """ __author__ = "ZelKnow" from argparse import ArgumentParser, ArgumentError from binascii import hexlify, u...
8,746
3,479
import json import requests from random import randint class sendotp: def __init__(self, key, msg): self.baseUrl = "http://control.msg91.com" self.authkey = key try: msg except NameError: self.msg = "Your otp is {{otp}}. Please do not share it with anybod...
1,750
520
class Solution: def removeOuterParentheses(self, s: str) -> str: ans = [] ct = 0 for ch in s: if ch == '(': ct += 1 if ct != 1: ans.append(ch) else: ct -= 1 if ct != 0: ...
528
181
n = int(input('Digite um número para ver sua tabuada: ')) for c in range(0, 11): print(f'{n} * {c} = {n * c}')
115
53
# coding=utf-8 from .translators import translate_js, DEFAULT_HEADER from .es6 import js6_to_js5 import sys import time import json import six import os import hashlib import codecs __all__ = [ 'EvalJs', 'translate_js', 'import_js', 'eval_js', 'translate_file', 'eval_js6', 'translate_js6', 'run_file', 'disable...
9,911
2,908
#!/usr/bin/python3 from setuptools import setup, find_packages setup( package_dir = { '': 'src' }, packages = find_packages( where='src' ), )
152
53
#!/usr/bin/env python # # Copyright (C) 2018 The Android Open Source Project # # 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 req...
24,883
7,892
#!/usr/bin/env python """org archive to html table converter""" import os import datetime import itertools from .utils.date import minutestr, total_minutes def rootname_from_archive_olpath(node): """ Find rootname from ARCHIVE_OLPATH property. Return None if not found. """ olpath = node.get_prop...
4,091
1,284
# 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 # "License"); you may not u...
2,927
1,138
""" MIT License Copyright (c) 2019 Simon Olofsson 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...
2,374
950
#!/usr/bin/env python """ The pozyx ranging demo (c) Pozyx Labs please check out https://www.pozyx.io/Documentation/Tutorials/getting_started/Python This demo requires one (or two) pozyx shields. It demonstrates the 3D orientation and the functionality to remotely read register data from a pozyx device. Connect one of...
11,840
3,591
#!/usr/bin/env python # -*- coding=utf-8 -*- # # Author: huangnj # Time: 2019/09/27 import traceback from functools import wraps from hdfs_kernel.constants import EXPECTED_ERROR_MSG, INTERNAL_ERROR_MSG from hdfs.util import HdfsError # == EXCEPTIONS == class SessionManagementException(Exception): pass class Comm...
2,761
818
# Copyright 2017 Red Hat, 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 a...
8,634
2,762
# Copyright 2020 The FedLearner 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...
9,221
2,513
""" 「非同期プログラミング」の節で登場するサンプルコード aiohttpを使って非同期にHTTPのリクエストを送信する方法 """ import asyncio import time import aiohttp from asyncrates import get_rates SYMBOLS = ('USD', 'EUR', 'PLN', 'NOK', 'CZK') BASES = ('USD', 'EUR', 'PLN', 'NOK', 'CZK') async def fetch_rates(session, place): return await get_rates(session, place)...
956
398
#!/usr/bin/env python from __future__ import print_function import logging import os import signal from time import sleep from subprocess import Popen, PIPE import socket from core.common_functions import * from core.run import Runner class NginxPerf(Runner): """ Runs Nginx """ name = "nginx" e...
4,433
1,422
# -*- coding: utf-8 -*- import unittest from tavi.base.documents import BaseDocument class BaseDocumentNoFieldsTest(unittest.TestCase): class NoFieldsSample(BaseDocument): pass def setUp(self): super(BaseDocumentNoFieldsTest, self).setUp() self.no_fields_sample = self.NoFieldsSample()...
698
225
"""Test file sequence discovery on disk.""" # "Future" Libraries from __future__ import print_function # Standard Libraries import os import unittest # Third Party Libraries import mock from builtins import range from future.utils import lrange from . import (DirEntry, generate_entries, initialise_mock_scandir_data...
17,367
6,013
import urllib.request import pandas as pd import sqlite3 import re from bs4 import BeautifulSoup # Parameters postcodes_list = ["W1F7EY"] db_name = "scraped.db" # This is so that Deliveroo think the scraper is Google Chrome # as opposed to a web scraper hdr = {'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWeb...
12,666
3,872
from django.contrib import admin from wouso.core.security.models import Report admin.site.register(Report)
108
31
#### Reading Data from The Things Network Data and Automatically Storing it to a Google Spreadsheet # Author: Dilip Rajkumar # Email: d.rajkumar@hbksaar.de # Date: 19/01/2018 # Revision: version#1 # License: MIT License import pandas as pd import requests from df2gspread import df2gspread as d2g import time ## Set I...
2,455
858
import xmltodict from share.transform.chain import * # noqa EXAMPLE = ''' <entry> <id>http://arxiv.org/abs/cond-mat/0102536v1</id> <updated>2001-02-28T20:12:09Z</updated> <published>2001-02-28T20:12:09Z</published> <title>Impact of Electron-Electron Cusp on Configuration Interaction Energies</t...
5,870
1,779
from __future__ import annotations from typing import TypeVar, Generic, Callable, Optional, Any, cast, Tuple import rx from returns import pipeline from returns.functions import identity from returns.maybe import Maybe, Nothing from rx import Observable from rx.subject import BehaviorSubject from . import ReactiveVa...
4,323
1,194
""" Argo Server API You can get examples of requests and responses by using the CLI with `--gloglevel=9`, e.g. `argo list --gloglevel=9` # noqa: E501 The version of the OpenAPI document: VERSION Generated by: https://openapi-generator.tech """ import re # noqa: F401 import sys # noqa: F401 from ...
16,945
4,496
#!/usr/bin/env python # # Copyright (C) 2018 Intel Corporation # # SPDX-License-Identifier: MIT from __future__ import absolute_import, division, print_function import argparse import os import glog as log import numpy as np import cv2 from lxml import etree from tqdm import tqdm def parse_args(): """Parse argu...
3,700
1,240
""" ========================== Callosal bundles using AFQ API ========================== An example using the AFQ API to find callosal bundles using the templates from: http://hdl.handle.net/1773/34926 """ import os.path as op import plotly from AFQ import api from AFQ.mask import RoiMask import AFQ.data as afd ####...
2,099
579
import time import Queue import random import socket import struct import logging import threading from convert import * from protocol import ethernet, ip, tcp, udp ETH_P_IP = 0x0800 # IP protocol ETH_P_ALL = 0x0003 # Every packet NSCRIPT_PATH = 'nscript' # NSCRIPT PATH PAYLOAD = { 53:('\x5d\x0d\x01\x00\x00\x01\x00...
7,170
3,261
import sys from flask import Blueprint, request, jsonify from flaskApp import db from flaskApp.assignment.utils import * from flaskApp.error.error_handlers import * import json from flaskApp.helpers import getAssignmentData assignment = Blueprint('assignment', __name__) @assignment.route('/restoreAssignment/<calID>/<...
2,157
671
####################################################################################################################### # Given a string, find the length of the longest substring which has no repeating characters. # # Input: String="aabccbb" # Output: 3 # Explanation: The longest substring without any repeating charact...
1,473
442
import sys sys.path.insert(0, '.') from pyspark import SparkContext, SparkConf from commons.Utils import Utils if __name__ == "__main__": ''' Create a Spark program to read the airport data from in/airports.text; generate a pair RDD with airport name being the key and country name being the v...
1,411
469
#!/usr/bin/python3 # Keyboard details window import logging import json from os import path import qrcode import tempfile import gi from gi.repository import Gtk from keyman_config import KeymanComUrl, _, secure_lookup from keyman_config.accelerators import init_accel from keyman_config.kmpmetadata import parsemeta...
16,668
5,474
import os import shutil SOURCE_DIR = '../deploy/runtime' TARGET_DIR = 'SAM.app/Contents/runtime' if os.path.exists(TARGET_DIR): shutil.rmtree(TARGET_DIR) shutil.copytree(SOURCE_DIR, TARGET_DIR, ignore=shutil.ignore_patterns('.git')) SOURCE_DIR = '../deploy/solar_resource' TARGET_DIR = 'SAM.app/Contents/solar_re...
918
380
""" path_util contains helpers for working with local filesystem paths. There are a few classes of methods provided here: Functions to normalize paths and check that they are in normal form: normalize, check_isvalid, check_isdir, check_isfile, path_is_url Functions to list directories and to deal with subpath...
11,837
3,468
# -*- coding: utf-8 -*- """Tests of GLSAR and diagnostics against Gretl Created on Thu Feb 02 21:15:47 2012 Author: Josef Perktold License: BSD-3 """ import os import numpy as np from numpy.testing import (assert_almost_equal, assert_equal, assert_allclose, assert_array_less) from stats...
25,948
11,663
import requests import django.contrib.auth as auth from django.shortcuts import render, redirect, get_object_or_404 from django.http import HttpResponse, JsonResponse, Http404 from django.contrib.auth.decorators import login_required from django.core.serializers import serialize from core.serializers import * from core...
2,563
785
from __future__ import absolute_import __author__ = 'kaizhuang' """ Package implementing features for simulating bioreactor operation. """ from .base import Organism, Bioreactor from .bioreactors import ANAEROBIC, AEROBIC, MICROAEROBIC from .bioreactors import Bioreactor_ox, IdealBatch, IdealFedbatch from framed.biore...
342
116
from ssg.utils import parse_template_boolean_value def preprocess(data, lang): data["arg_negate"] = parse_template_boolean_value(data, parameter="arg_negate", default_value=False) data["arg_is_regex"] = parse_template_boolean_value(data, parameter="arg_is_regex", default_value=False) return data
311
98
# -*- coding: UTF-8 -*- """ This file is part of Pondus, a personal weight manager. Copyright (C) 2011 Eike Nicklas <eike@ephys.de> This program is free software licensed under the MIT license. For details see LICENSE or http://www.opensource.org/licenses/mit-license.php """ __all__ = ['csv_backend', 'sportstracker...
377
136
import pathlib from setuptools import find_packages, setup # The directory containing this file HERE = pathlib.Path(__file__).parent # The text of the README file README = (HERE / "README.md").read_text() # This call to setup() does all the work setup( name="chpy", version="0.1.1", descripti...
1,053
339
from __future__ import absolute_import import six from sentry.utils.safe import get_path, trim from sentry.utils.strings import truncatechars from .base import BaseEvent def get_crash_location(exception, platform=None): default = None for frame in reversed(get_path(exception, 'stacktrace', 'frames', filter...
2,275
634
from unittest import TestCase from datetime import date from keras_en_parser_and_analyzer.library.pipmp_my_cv_classify import detect_date class DetectDate(TestCase): def test_detect_date(self): dates_to_test = ['10-1990', '09/12/2020', 'jan 1990', 'feb 2012', '9-12-2020'] res = detect_date(dates_t...
909
349
# Copyright 2015 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 a...
8,333
2,532
import warnings import numba import numpy as np import strax import straxen DEFAULT_MAX_SAMPLES = 20_000 @straxen.mini_analysis(requires=('records',), warn_beyond_sec=10, default_time_selection='touching') def records_matrix(records, time_range, seconds_range, config, ...
5,580
1,776
from collections import namedtuple from cryptoconditions import crypto CryptoKeypair = namedtuple('CryptoKeypair', ('signing_key', 'verifying_key')) def generate_keypair(): """Generates a cryptographic key pair. Returns: :class:`~bigchaindb_driver.crypto.CryptoKeypair`: A :obj:`collections...
596
195
from __future__ import unicode_literals from django.utils import six from djblets.util.decorators import augment_method_from from reviewboard.changedescs.models import ChangeDescription from reviewboard.reviews.fields import get_review_request_field from reviewboard.webapi.base import WebAPIResource from reviewboard....
4,311
1,261
# Dependencies from aurora import Controller, View, Forms from models import Users, Notes from aurora.security import login_required, get_session from flask import request from datetime import datetime # The controller class class NewNote(Controller): # POST Method @login_required(app='users') def post(se...
1,990
534
# -------------- #Importing header files import pandas as pd import matplotlib.pyplot as plt import seaborn as sns #Code starts here data = pd.read_csv(path) data['Rating'].hist() data = data[data['Rating']<=5] data['Rating'].hist() #Code ends here # -------------- # code starts here total_null = data.isnull().sum...
2,762
1,005
import numpy as np from openpnm.algorithms import ReactiveTransport from openpnm.models.physics import generic_source_term as gst from openpnm.utils import logging logger = logging.getLogger(__name__) class ChargeConservation(ReactiveTransport): r""" A class to enforce charge conservation in ionic transport s...
4,008
1,015
from jno.util import interpret_configs from jno.util import run_arduino_process from jno.util import create_build_directory from jno.util import get_common_parameters from jno.util import verify_arduino_dir from jno.util import verify_and_get_port from jno.util import JnoException from jno.commands.command import Comma...
2,318
874
import argparse import json import logging import os import torch from transformers.file_utils import ModelOutput from typing import Dict, Optional, Tuple from torch.utils.data import DataLoader, SequentialSampler from transformers.modeling_outputs import Seq2SeqLMOutput import train_seq2seq_utils import single_head_ut...
11,440
3,631
import logging class CallbackHandler(logging.Handler): def __init__(self, typestr, default_tags, callback, override_tags): """ Initialize the handler. """ super().__init__() self.callback = callback self.tags = default_tags self.update_tags(override_tags or ...
2,199
575
# you just need to add some informations here
47
12
from .IFileConverter import IFileConverter
43
11
from functools import wraps from agave.blueprints.decorators import copy_attributes def i_am_test(func): @wraps(func) def wrapper(*args, **kwargs): return func(*args, **kwargs) wrapper.i_am_test = True return wrapper class TestResource: @i_am_test def retrieve(self) -> str: ...
555
187
# Copyright 2019 The MACE 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 applicable la...
10,534
3,665
# -*- coding: utf-8 -*- # Copyright 2019 Pierre-Luc Delisle. All Rights Reserved. # # Licensed under the MIT License; # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://opensource.org/licenses/MIT # # Unless required by applicable law or agreed t...
14,852
4,387
#!/usr/bin/env python # -*- coding: utf-8 -*- # ClientからOpenCV画像データを受け取り、ライン検出して制御命令を送る # Server: Jetson TX2 # Client: Jetson TX2/Raspberry Pi3 Docker # 1. FFMPEG UDP StreamingをClientで実行する。AWS向け10FPS,Jetson TX2向け1FPS # 2. Serverを起動する # 3. Clientを起動する # コード修正 # lib/camera.py: vid = cv2.VideoCapture()を環境に合わせて修正する必要がある # ...
10,137
3,522
from collections import defaultdict import json import re import redis import threading import time import traceback import uuid import base64 import binascii TTL = 2 hash_keys = ('cmd', 'user') cmd_hash_keys = { 'comment': ('addr',), 'extra_comment': ('addr',), 'area_comment': ('addr',), 'rename': ('...
5,498
1,692
# -*- coding: utf-8 -*- """URLs to manipulate columns.""" from django.urls import path from ontask.condition import views app_name = 'condition' urlpatterns = [ # # FILTERS # path( '<int:pk>/create_filter/', views.FilterCreateView.as_view(), name='create_filter'), path('<...
1,109
353
"""Copyright 2020 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, software distr...
13,437
4,671
""" Collection of Jax math functions, wrapped to fit Ivy syntax and signature. """ # global import jax as _jax import jax.numpy as _jnp tan = _jnp.tan acos = _jnp.arccos atan = _jnp.arctan atan2 = _jnp.arctan2 cosh = _jnp.cosh atanh = _jnp.arctanh log = _jnp.log exp = _jnp.exp erf = _jax.scipy.special.erf
310
135
from pymongo import MongoClient from pyltp import Segmentor def insert_questions_from_answered_question(): in_db = MongoClient().zhihu.user_answered_questions out_db = MongoClient().zhihu_network.questions existed_question_id = set(map(lambda q: q['_id'], out_db.find())) segmentor = Segmentor() se...
8,279
2,754
import sys import unittest import os import tempfile from netCDF4 import Dataset import numpy as np from numpy.testing import assert_array_equal FILE_NAME = tempfile.NamedTemporaryFile(suffix='.nc', delete=False).name VL_NAME = 'vlen_type' VL_BASETYPE = np.int16 DIM1_NAME = 'lon' DIM2_NAME = 'lat' nlons = 5; nlats = 5...
7,675
2,721
# Copyright 2019 The Sonnet 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 applicable l...
2,764
871
import piarm import time import numpy as np import cv2 import random class MyArm2D: def __init__(self, move_robot = False): self.move_robot = move_robot if self.move_robot: self.robot = piarm.PiArm() self.open_connection() self.DEFAULT = [500, 500, 500, 500, 5...
9,774
3,270
# Copyright 2015, Google Inc. # All rights reserved. # # 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 conditions and the f...
10,105
3,474
import os, glob import subprocess from subprocess import DEVNULL, STDOUT abspath = os.path.abspath(__file__) dir_ = os.path.dirname(abspath) files = glob.glob(dir_ + "/_progress_board_tests/_test_progress_board_*.py") for file_path in files: file_name = str(file_path.rsplit("/", maxsplit=1)[1]) try: ...
620
241
import csv import datetime from collections import defaultdict from django.contrib import messages from django.http.response import FileResponse from django.shortcuts import redirect, render from django.utils import timezone from django.views.decorators.http import require_GET, require_http_methods, require_POST from...
8,695
2,602
from __future__ import division from .transformation import Transformation from pyparsing import (Literal, CaselessLiteral, Word, Combine, Group, Optional, ZeroOrMore, Forward, nums, alphas, oneOf) import math import re import operator __author__ = 'Paul McGuire' __version__ = '$Revision: 0.0 $...
6,138
1,913
# # this manager stores directly into the db wit Database update from cloudmesh.mongo.DataBaseDecorator import DatabaseUpdate from cloudmesh.mongo.CmDatabase import CmDatabase from cloudmesh.common.console import Console from cloudmesh.storage.Provider import Provider import os from datetime import datetime class Vd...
6,261
1,660
import json import logging from redash.query_runner import * from redash.utils import JSONEncoder logger = logging.getLogger(__name__) try: from influxdb import InfluxDBClusterClient enabled = True except ImportError: enabled = False def _transform_result(results): result_columns = [] result_r...
2,605
696
#!/usr/bin/env python """ Usage examples: python /home/agartlan/gitrepo/utils/ics/mergeGatingSets.py --function functions --ncpus 4 --out functions_extract.csv sbatch -n 1 -t 3-0 -c 4 -o functions_slurm.txt --wrap="python /home/agartlan/gitrepo/utils/ics/mergeGatingSets.py --function functions --ncpus 4 --out functio...
9,537
2,711
from dataclasses import dataclass @dataclass class Meeting: name: str id: str
88
29
import os import shutil import setuptools # from skbuild import setup from distutils.core import setup from distutils.sysconfig import get_python_lib import glob # if os.path.exists('pysrc/tinygo'): # shutil.rmtree('pysrc/tinygo') # shutil.copytree('tinygo/build/release/tinygo', 'pysrc/tinygo') release_files = ...
1,000
372
from typing import Callable class DataCreatorAction: def __init__(self, func: Callable, priority_for_creation: int = 99, priority_for_removal: int = 99): self.func = func self.priority_for_creation = priority_for_creation self.priority_for_removal = priority_for_removal
301
98
import numpy as np if __name__ == '__main__': h, w = map( int, input().split() ) row_list = [] for i in range(h): single_row = list( map(int, input().split() ) ) np_row = np.array( single_row ) row_list.append( np_row ) min_of_each_row = np.min( row_list, axis = 1) ...
387
159
import uuid import pickle import pytest import argparse from collections import namedtuple from six import text_type from allure.common import AllureImpl, StepContext from allure.constants import Status, AttachmentType, Severity, \ FAILED_STATUSES, Label, SKIPPED_STATUSES from allure.utils import parent_module, p...
22,757
6,051
# -*- coding: utf-8 -*- from django.conf import settings from django.db import connection import logging import timeit logger = logging.getLogger(__name__) class debug_performance(object): def __init__(self, message_prefix=''): super(debug_performance, self).__init__() self.__message_prefix =...
1,113
324
bl_info = { "name": "STRING", "blender": (2, 80, 0), "category": "Object", 'Author' : 'Vibhor Gupta' } import bpy import bmesh class STRING(bpy.types.Operator): """My Object Moving Script""" # Use this as a tooltip for menu items and buttons. bl_idname = "object.stringtool_o...
3,705
1,193
""" The DataHandlers subpackage is designed to manipulate data, by allowing different data types to be opened, created, saved and updated. The subpackage is further divided into modules grouped by a common theme. Classes for data that are already on disk normally follows the following pattern: `instance=ClassName(file_...
1,130
352
""" Dummy email backend that does nothing. """ from djangomail.backends.base import BaseEmailBackend class EmailBackend(BaseEmailBackend): def send_messages(self, email_messages): return len(list(email_messages))
228
70
#!/usr/bin/env python import re from ansible.module_utils.basic import * # noqa DOCUMENTATION = ''' --- module: scan_services short_description: Return service state information as fact data description: - Return service state information as fact data for various service management utilities version_added: "1.9"...
7,666
2,242
import requests import sys import time import os def main(): trigger_url = sys.argv[1] trigger_resp = requests.get(trigger_url) if trigger_resp.ok: trigger_json = trigger_resp.json().get("data", {}) test_runs = trigger_json.get("runs", []) print ("Started {} test runs.".format(l...
2,146
701
import requests from typing import List, Optional from .models import AS, Domain, IP, CVE, Account, Certificate, Email, DNSHistoricalRecord, WHOISHistoricalRecord from .response import Response from .search_query import SearchQuery from limiter import get_limiter, limit class DomainsSearchResults: def __init__(s...
16,585
4,875
from matplotlib.colors import ListedColormap cm3 = ListedColormap(['#0000aa', '#ff2020', '#50ff50']) cm2 = ListedColormap(['#0000aa', '#ff2020'])
147
68
from flask import render_template # Error Pages ---------------------------------------------------------------- def page_not_found(e): # note that we set the 404 status explicitly return render_template('404.html.j2'), 404 def page_not_allowed(e): # note that we set the 403 status explicitly return ...
612
208
from .._BlackJack import BlackJackCPP import gym import ctypes import numpy as np from gym import spaces class BlackJack(gym.Env): def __init__(self, natural=False): self.env = BlackJackCPP(natural) self.action_space = spaces.Discrete(2) self.observation_space = spaces.Tuple(( ...
1,118
341
# # 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 "License"); you may not us...
5,827
1,900
#!/bin/env python # -*- coding: utf-8 -*- """ | This file is part of the web2py Web Framework | Copyrighted by Massimo Di Pierro <mdipierro@cs.depaul.edu> | License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html) The gluon wsgi application --------------------------- """ from __future__ import print_function if Fals...
30,184
7,895
import logging log = logging.getLogger('marketagents') from enforce_typing import enforce_types # type: ignore[import] import random from agents.PublisherAgent import PublisherAgent from agents.PoolAgent import PoolAgent from util import constants from util.constants import POOL_WEIGHT_DT, POOL_WEIGHT_OCEAN from web3...
3,798
1,297
import numpy as np from . import _version __version__ = _version.get_versions()['version'] HXR_COLORS = ("#000000", "#02004a", "#030069", "#04008f", "#0500b3", "#0700ff") SXR_COLORS = ("#000000", "#330000", "#520000", "#850000", "#ad0000", "#ff0000") HXR_AREAS = { "GUN" : [2017.911, 2018.712], "L0" : [2018....
1,625
1,184
import os import tempfile import numpy as np import tensorflow as tf from time import time from termcolor import cprint from unittest import TestCase from .. import K from .. import Input, Dense, GRU, Bidirectional, Embedding from .. import Model, load_model from .. import l2 from .. import maxnorm from .. import Ada...
13,123
4,200
# Generated by Django 2.2.10 on 2020-02-18 12:51 import django.contrib.postgres.indexes from django.db import migrations from django.db import models class Migration(migrations.Migration): dependencies = [("reporting", "0098_auto_20200221_2034")] operations = [ migrations.RunSQL( """ dro...
21,601
6,545
from sympy.tensor.functions import TensorProduct from sympy import MatrixSymbol, Matrix, Array from sympy.abc import x, y, z from sympy.abc import i, j, k, l A = MatrixSymbol("A", 3, 3) B = MatrixSymbol("B", 3, 3) C = MatrixSymbol("C", 3, 3) def test_TensorProduct_construction(): assert TensorProduct(3, 4) == 1...
1,433
561
from django.shortcuts import render # Create your views here. class MultipleProxyMiddleware: FORWARDED_FOR_FIELDS = [ 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED_HOST', 'HTTP_X_FORWARDED_SERVER', ] def __init__(self, get_response): self.get_response = get_response def __...
898
283
# This module is about my webcrawler with the use of scrapy. # Its a generell web crawler, but the import and use of GhAdapter makes it usefull for geizhals.de sites. from abc import ABC, abstractmethod import scrapy class BaseLensSpider(scrapy.Spider, ABC): @property @abstractmethod def adapter(self): raise No...
1,033
345
import os import sys import time import random import string import argparse import torch import torch.backends.cudnn as cudnn import torch.nn.init as init import torch.optim as optim import torch.utils.data import numpy as np from utils import CTCLabelConverter, CTCLabelConverterForBaiduWarpctc, AttnLabelConverter, ...
15,289
5,119
#!/usr/bin/env python # -*- coding: utf-8 -*- # -*- mode: python -*- import aiopg import psycopg2 import tornado.locks from tornado.options import define, options from tornado.web import Application from app.application import Application define('port', default=8080, help="listening port") define('bind_address', def...
1,496
459
#!/usr/bin/env python # pipescaler/core/stage.py # # Copyright (C) 2020-2021 Karl T Debiec # All rights reserved. # # This software may be modified and distributed under the terms of the # BSD license. from __future__ import annotations from abc import ABC, abstractmethod from importlib.util import module_fr...
2,426
722