code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import time
from grove.grove_light_sensor_v1_2 import GroveLightSensor
from grove.grove_led import GroveLed
import paho.mqtt.client as mqtt
import json
light_sensor = GroveLightSensor(0)
led = GroveLed(5)
id = '<ID>'
client_telemetry_topic = 'kekiot/' + id + '/telemetry'
client_name = id + 'nightlight_client'
mqtt_... | [
"grove.grove_led.GroveLed",
"json.dumps",
"time.sleep",
"paho.mqtt.client.Client",
"grove.grove_light_sensor_v1_2.GroveLightSensor"
] | [((168, 187), 'grove.grove_light_sensor_v1_2.GroveLightSensor', 'GroveLightSensor', (['(0)'], {}), '(0)\n', (184, 187), False, 'from grove.grove_light_sensor_v1_2 import GroveLightSensor\n'), ((194, 205), 'grove.grove_led.GroveLed', 'GroveLed', (['(5)'], {}), '(5)\n', (202, 205), False, 'from grove.grove_led import Gro... |
import requests
from bs4 import BeautifulSoup
import re
'''def fate_proxy():
resp=requests.get('https://raw.githubusercontent.com/fate0/proxylist/master/proxy.list')
#print(resp.text)
a=((resp.text).split('\n'))
#print(a)
p_list=[]
for i in a:
try:
p_list.append(json.loads(i)... | [
"bs4.BeautifulSoup",
"requests.get",
"re.compile"
] | [((860, 894), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (872, 894), False, 'import requests\n'), ((906, 937), 'bs4.BeautifulSoup', 'BeautifulSoup', (['res.text', '"""lxml"""'], {}), "(res.text, 'lxml')\n", (919, 937), False, 'from bs4 import BeautifulSoup\n'), ((2178... |
#!/usr/bin/env python
import uuid
class SMAPI_Response(object):
'''
Implentation of a ICUV Request
'''
def __init__(self, output_parameters):
self._uuid = uuid.uuid1()
self._date = None
self._output_parameters = output_parameters
def get_output_parameters(self):
... | [
"uuid.uuid1"
] | [((187, 199), 'uuid.uuid1', 'uuid.uuid1', ([], {}), '()\n', (197, 199), False, 'import uuid\n')] |
# ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import argparse
import json
import logging
from responsibleai import RAIInsights
from constants import RAIToolType
from rai_component_ut... | [
"argparse.ArgumentParser",
"logging.basicConfig",
"rai_component_utilities.copy_dashboard_info_file",
"rai_component_utilities.save_to_output_port",
"logging.getLogger",
"rai_component_utilities.load_rai_insights_from_input_port"
] | [((444, 471), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (461, 471), False, 'import logging\n'), ((472, 511), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (491, 511), False, 'import logging\n'), ((568, 593), 'argparse.Argumen... |
# Brickout Game V 0.1
# 2018 by <NAME>
# color constants
# a website for finding out color names
# https://www.w3schools.com/colors/colors_converter.asp
GREY = [105, 105, 105]
BLACK = [0, 0, 0]
PINK = [168, 76, 96]
BROWN = [133, 107, 17]
OTHERBROWN = [157, 90, 48]
GREEN = [28, 120, 29]
LIGHTGREEN = [56, 141, 47]
DARKG... | [
"pygame.mouse.set_visible",
"pygame.event.get",
"pygame.mixer.init",
"pygame.display.update",
"pygame.sprite.spritecollide",
"pygame.font.Font",
"pygame.mouse.get_pos",
"pygame.display.set_mode",
"pygame.mixer.Sound",
"pygame.quit",
"pygame.Surface",
"pygame.mouse.get_pressed",
"pygame.mixer... | [((428, 470), 'pygame.mixer.pre_init', 'pygame.mixer.pre_init', (['(22050)', '(-16)', '(1)', '(2048)'], {}), '(22050, -16, 1, 2048)\n', (449, 470), False, 'import pygame\n'), ((471, 490), 'pygame.mixer.init', 'pygame.mixer.init', ([], {}), '()\n', (488, 490), False, 'import pygame\n'), ((492, 505), 'pygame.init', 'pyga... |
# ~/Blog/djr/gql/schema.py
import graphene
from items.models import Movie
from graphene_django.types import DjangoObjectType
# api-movie-model
class MovieType(DjangoObjectType):
id = graphene.Int()
name = graphene.String()
year = graphene.Int()
summary = graphene.String()
poster_url = graphene.Stri... | [
"graphene.List",
"graphene.String",
"items.models.Movie.objects.all",
"graphene.Int",
"graphene.Schema",
"items.models.Movie.objects.filter"
] | [((1400, 1428), 'graphene.Schema', 'graphene.Schema', ([], {'query': 'Query'}), '(query=Query)\n', (1415, 1428), False, 'import graphene\n'), ((188, 202), 'graphene.Int', 'graphene.Int', ([], {}), '()\n', (200, 202), False, 'import graphene\n'), ((214, 231), 'graphene.String', 'graphene.String', ([], {}), '()\n', (229,... |
from functools import reduce
from pprint import pprint
from typing import Sequence, Tuple
import requests
from graph import Graph
spring_id = 71
spring_id_legacy = 20178
def modify_string(p: str, repl: Sequence[Tuple[str, str]]) -> str:
return reduce(lambda a, kv: a.replace(*kv), repl, p)
url = 'https://api.... | [
"pprint.pprint",
"requests.get"
] | [((483, 520), 'requests.get', 'requests.get', ([], {'url': 'url', 'params': 'payload'}), '(url=url, params=payload)\n', (495, 520), False, 'import requests\n'), ((1320, 1335), 'pprint.pprint', 'pprint', (['courses'], {}), '(courses)\n', (1326, 1335), False, 'from pprint import pprint\n')] |
#Leia 10 números inteiros e armazene em um vetor v. Crie dois
#novos vetores v1 e v2. Copie os valores ímpares de v para
#v1, e os valores pares de v para v2. Note que cada um dos
#vetores v1 e v2 têm no máximo 10 elementos, mas nem todos
#os elementos são utilizados. No final escreva os elementos
#UTILIZADOS de v1 e ... | [
"random.randint"
] | [((421, 442), 'random.randint', 'random.randint', (['(1)', '(50)'], {}), '(1, 50)\n', (435, 442), False, 'import random\n')] |
import argparse
import subprocess
from dtran.dcat.api import DCatAPI
from funcs.readers.dcat_read_func import DATA_CATALOG_DOWNLOAD_DIR
import os
import csv
import json
import shutil
from datetime import datetime
from datetime import timedelta
from pathlib import Path
from typing import Optional, Dict
import re
impor... | [
"json.load",
"logging.debug",
"zipfile.ZipFile",
"logging.basicConfig",
"re.split",
"xarray.open_dataset",
"os.path.exists",
"dtran.dcat.api.DCatAPI.get_instance",
"xarray.merge",
"logging.info",
"datetime.datetime.strptime",
"pathlib.Path",
"datetime.timedelta",
"xarray.open_mfdataset",
... | [((515, 573), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stderr', 'level': 'logging.INFO'}), '(stream=sys.stderr, level=logging.INFO)\n', (534, 573), False, 'import logging, sys\n'), ((2628, 2677), 'logging.debug', 'logging.debug', (['"""Reading variables from dataset.."""'], {}), "('Reading var... |
from django.core.exceptions import ValidationError
def only_letters_validator(value):
for ch in value:
if not ch.isalpha():
raise ValidationError("Value must contains only letters")
def file_max_size_in_mb_validator(max_size):
def validate(value):
filesize = value.file.size
... | [
"django.core.exceptions.ValidationError"
] | [((156, 207), 'django.core.exceptions.ValidationError', 'ValidationError', (['"""Value must contains only letters"""'], {}), "('Value must contains only letters')\n", (171, 207), False, 'from django.core.exceptions import ValidationError\n')] |
import torch
from rlpyt.utils.tensor import infer_leading_dims, restore_leading_dims
from rlpyt.models.conv2d import Conv2dModel
from rlpyt.models.mlp import MlpModel
from rlpyt.models.dqn.dueling import DuelingHeadModel
class CartpoleDqnModel(torch.nn.Module):
def __init__(
self,
image... | [
"rlpyt.utils.tensor.restore_leading_dims",
"rlpyt.models.dqn.dueling.DuelingHeadModel",
"rlpyt.utils.tensor.infer_leading_dims",
"rlpyt.models.mlp.MlpModel"
] | [((1291, 1317), 'rlpyt.utils.tensor.infer_leading_dims', 'infer_leading_dims', (['img', '(1)'], {}), '(img, 1)\n', (1309, 1317), False, 'from rlpyt.utils.tensor import infer_leading_dims, restore_leading_dims\n'), ((1526, 1565), 'rlpyt.utils.tensor.restore_leading_dims', 'restore_leading_dims', (['q', 'lead_dim', 'T', ... |
from .base_lot import *
import numpy as np
import os
from .units import *
#TODO get rid of get_energy
class QChem(Lot):
def run(self,geom,multiplicity):
tempfilename = 'tempQCinp'
tempfile = open(tempfilename,'w')
if self.lot_inp_file == False:
tempfile.write(' $rem\n')
... | [
"numpy.asarray",
"os.path.isfile",
"os.system"
] | [((1355, 1381), 'os.path.isfile', 'os.path.isfile', (['"""link.txt"""'], {}), "('link.txt')\n", (1369, 1381), False, 'import os\n'), ((2103, 2117), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (2112, 2117), False, 'import os\n'), ((3668, 3693), 'numpy.asarray', 'np.asarray', (['tmp[state][1]'], {}), '(tmp[state]... |
# System imports
import abc
import RPi.GPIO as GPIO
# Local imports
from mtda.usb.switch import UsbSwitch
class RPiGpioUsbSwitch(UsbSwitch):
def __init__(self):
self.dev = None
self.pin = 0
self.enable = GPIO.HIGH
self.disable = GPIO.LOW
GPIO.setwarnings(False)
... | [
"RPi.GPIO.setmode",
"RPi.GPIO.setup",
"RPi.GPIO.input",
"RPi.GPIO.output",
"RPi.GPIO.setwarnings"
] | [((294, 317), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (310, 317), True, 'import RPi.GPIO as GPIO\n'), ((993, 1027), 'RPi.GPIO.output', 'GPIO.output', (['self.pin', 'self.enable'], {}), '(self.pin, self.enable)\n', (1004, 1027), True, 'import RPi.GPIO as GPIO\n'), ((1149, 1184), 'RPi.... |
import sys
import tensorflow as tf
import leveldb
from absl import app
from absl import flags
from absl import logging
from datetime import datetime
import warnings
import glob
import toml
import re
from contextlib import redirect_stdout
import collections
import datetime
import functools
import itertools
import math
... | [
"os.mkdir",
"data.create_input_generator",
"tensorflow.keras.optimizers.SGD",
"os.path.join",
"absl.logging.set_verbosity",
"pandas.DataFrame",
"absl.flags.mark_flags_as_required",
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"tensorflow.python.keras.backend.get_value",
"tensorflow.ker... | [((1561, 1607), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""plan"""', 'None', '"""toml file"""'], {}), "('plan', None, 'toml file')\n", (1580, 1607), False, 'from absl import flags\n'), ((1609, 1671), 'absl.flags.DEFINE_multi_string', 'flags.DEFINE_multi_string', (['"""d"""', 'None', '"""override plan sett... |
import asyncio
import random
from pyckaxe.utils.logging import get_logger
def preview_logging():
log = get_logger("preview_logging")
log.debug("debug")
log.info("info")
log.warning("warning")
log.error("error")
log.critical("critical")
try:
raise ValueError("don't worry this is a ... | [
"asyncio.gather",
"pyckaxe.utils.logging.get_logger",
"random.randint"
] | [((110, 139), 'pyckaxe.utils.logging.get_logger', 'get_logger', (['"""preview_logging"""'], {}), "('preview_logging')\n", (120, 139), False, 'from pyckaxe.utils.logging import get_logger\n'), ((1024, 1059), 'pyckaxe.utils.logging.get_logger', 'get_logger', (['"""preview_async_logging"""'], {}), "('preview_async_logging... |
from enum import Enum
import numpy as np
import tensorflow as tf
from edward1_utils import get_ancestors, get_descendants
class GenerativeMode(Enum):
UNCONDITIONED = 1 # i.e. sampling the learnt prior
CONDITIONED = 2 # i.e. sampling the posterior, with variational samples substituted
RECONSTRUCTION = ... | [
"tensorflow.abs",
"tensorflow.losses.add_loss",
"tensorflow.summary.scalar",
"tensorflow.trainable_variables",
"tensorflow.reshape",
"numpy.zeros",
"tensorflow.variable_scope",
"tensorflow.reduce_mean",
"edward1_utils.get_descendants",
"tensorflow.transpose",
"tensorflow.reduce_max",
"tensorfl... | [((20630, 20671), 'tensorflow.summary.scalar', 'tf.summary.scalar', (['"""inference/loss"""', 'loss'], {}), "('inference/loss', loss)\n", (20647, 20671), True, 'import tensorflow as tf\n'), ((20676, 20721), 'tensorflow.summary.scalar', 'tf.summary.scalar', (['"""inference/log_Px"""', 'log_Px'], {}), "('inference/log_Px... |
# coding=utf-8
# @Time : 2020/10/24 12:13
# @Auto : zzf-jeff
import torch
import torch.nn as nn
import math
from ..builder import BACKBONES
from .base import BaseBackbone
import torch.utils.model_zoo as model_zoo
from torchocr.utils.checkpoints import load_checkpoint
__all__ = [
"DetResNet"
]
... | [
"torch.nn.ReLU",
"math.sqrt",
"torch.nn.Sequential",
"torch.nn.Conv2d",
"torch.nn.BatchNorm2d",
"torchocr.utils.checkpoints.load_checkpoint",
"torchvision.ops.DeformConv2d",
"torch.nn.MaxPool2d"
] | [((836, 925), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': '(3)', 'stride': 'stride', 'padding': '(1)', 'bias': '(False)'}), '(in_planes, out_planes, kernel_size=3, stride=stride, padding=1,\n bias=False)\n', (845, 925), True, 'import torch.nn as nn\n'), ((1240, 1262), 'torch.nn.Batc... |
from poyonga import Groonga
import gevent
from gevent import monkey
monkey.patch_all()
def fetch(cmd, **kwargs):
g = Groonga()
ret = g.call(cmd, **kwargs)
print(ret.status)
print(ret.body)
print("*" * 40)
return ret.body
cmds = [
("status", {}),
("log_level", {"level": "warning"}),
... | [
"gevent.spawn",
"poyonga.Groonga",
"gevent.monkey.patch_all",
"gevent.joinall"
] | [((69, 87), 'gevent.monkey.patch_all', 'monkey.patch_all', ([], {}), '()\n', (85, 87), False, 'from gevent import monkey\n'), ((494, 514), 'gevent.joinall', 'gevent.joinall', (['jobs'], {}), '(jobs)\n', (508, 514), False, 'import gevent\n'), ((124, 133), 'poyonga.Groonga', 'Groonga', ([], {}), '()\n', (131, 133), False... |
"""This module offers GUI tools for manipulating table-like step functions
of "elementary" cellular automatons.
Ideas for further utilities:
* Display conflicting rules for horizontal or vertical symmetry, rotational
symmetry, ...
* An editing mode, that handles simple binary logic, like::
c == 1 then resu... | [
"random.randrange"
] | [((10386, 10435), 'random.randrange', 'random.randrange', (['(0)', '(base ** base ** self.entries)'], {}), '(0, base ** base ** self.entries)\n', (10402, 10435), False, 'import random\n')] |
import tasks
from time import sleep
print("add 3+5")
ret = tasks.add.delay(3,5)
print("Task ID:")
print(ret)
sleep(10)
print(ret.status)
| [
"tasks.add.delay",
"time.sleep"
] | [((60, 81), 'tasks.add.delay', 'tasks.add.delay', (['(3)', '(5)'], {}), '(3, 5)\n', (75, 81), False, 'import tasks\n'), ((110, 119), 'time.sleep', 'sleep', (['(10)'], {}), '(10)\n', (115, 119), False, 'from time import sleep\n')] |
# -*- coding: future_fstrings -*-
from __future__ import print_function
import argparse
import binascii
import struct
import sys
import logging
from libptmalloc.frontend import printutils as pu
from libptmalloc.ptmalloc import ptmalloc as pt
from libptmalloc.frontend import helpers as h
from libptmalloc.frontend.comm... | [
"argparse.ArgumentParser",
"logging.getLogger"
] | [((349, 381), 'logging.getLogger', 'logging.getLogger', (['"""libptmalloc"""'], {}), "('libptmalloc')\n", (366, 381), False, 'import logging\n'), ((818, 1083), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Print malloc parameter(s) information\n\nAnalyze the malloc_par structure\'s fiel... |
import sympy as sp
def get_4th_order_rungekutta(dydx, x0, y0, n:int, h, x = sp.Symbol('x'), y = sp.Symbol('y')):
"""
Method to get the values of x, y and dy/dx using fourth-order Runge-Kutta method in a form of a 2d list
Parameters:
dydx: Equation to get the derivative
x0: initial value of... | [
"sympy.Symbol"
] | [((81, 95), 'sympy.Symbol', 'sp.Symbol', (['"""x"""'], {}), "('x')\n", (90, 95), True, 'import sympy as sp\n'), ((101, 115), 'sympy.Symbol', 'sp.Symbol', (['"""y"""'], {}), "('y')\n", (110, 115), True, 'import sympy as sp\n'), ((1118, 1132), 'sympy.Symbol', 'sp.Symbol', (['"""y"""'], {}), "('y')\n", (1127, 1132), True,... |
import os
import sys
import json
class NoEnvironmentFile(Exception):
pass
class KeyNotFound(Exception):
pass
DEFAULT = object()
class LocalEnv:
_BOOLEANS = {'1': True, 'yes': True, 'true': True, 'on': True,
'0': False, 'no': False, 'false': False, 'off': False, '': False}
def _... | [
"os.path.dirname",
"sys._getframe",
"json.dumps",
"os.path.isfile",
"os.path.join"
] | [((2494, 2509), 'sys._getframe', 'sys._getframe', ([], {}), '()\n', (2507, 2509), False, 'import sys\n'), ((2525, 2587), 'os.path.dirname', 'os.path.dirname', (['frame.f_back.f_back.f_back.f_code.co_filename'], {}), '(frame.f_back.f_back.f_back.f_code.co_filename)\n', (2540, 2587), False, 'import os\n'), ((2603, 2629),... |
# 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... | [
"itertools.tee",
"requests.Response",
"json.dumps"
] | [((1437, 1447), 'requests.Response', 'Response', ([], {}), '()\n', (1445, 1447), False, 'from requests import Response\n'), ((1498, 1509), 'json.dumps', 'dumps', (['body'], {}), '(body)\n', (1503, 1509), False, 'from json import dumps\n'), ((1123, 1136), 'itertools.tee', 'tee', (['iterator'], {}), '(iterator)\n', (1126... |
import subprocess
try:
from flask import Flask, request, send_from_directory
except ImportError:
print('This example needs Flask to run. Try running:\n'
'pip install flask')
app = Flask(__name__)
STATIC_DIR = 'examples/reverse_image_search/static'
# TODO(wcrichto): figure out how to prevent image ... | [
"flask.send_from_directory",
"flask.Flask",
"subprocess.check_call"
] | [((199, 214), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (204, 214), False, 'from flask import Flask, request, send_from_directory\n'), ((396, 431), 'flask.send_from_directory', 'send_from_directory', (['"""static"""', 'path'], {}), "('static', path)\n", (415, 431), False, 'from flask import Flask, req... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from lib.helpers.decode_helper import _transpose_and_gather_feat
from lib.losses.focal_loss import focal_loss_cornernet
from lib.losses.uncertainty_loss import laplacian_aleatoric_uncertainty_loss
from lib.losses.dim_aware_loss import dim_aware_l1_loss... | [
"torch.ones",
"lib.losses.dim_aware_loss.dim_aware_l1_loss",
"lib.losses.focal_loss.focal_loss_cornernet",
"torch.log",
"torch.nn.functional.l1_loss",
"torch.nn.functional.cross_entropy",
"torch.clamp",
"torch.zeros",
"lib.losses.uncertainty_loss.laplacian_aleatoric_uncertainty_loss",
"torch.sum",... | [((1577, 1634), 'lib.losses.focal_loss.focal_loss_cornernet', 'focal_loss_cornernet', (["input['heatmap']", "target['heatmap']"], {}), "(input['heatmap'], target['heatmap'])\n", (1597, 1634), False, 'from lib.losses.focal_loss import focal_loss_cornernet\n'), ((1923, 1979), 'torch.nn.functional.l1_loss', 'F.l1_loss', (... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-07-19 10:17
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hkm', '0021_page_ref'),
]
operations = [
migrations.AddField(
m... | [
"django.db.models.BooleanField"
] | [((399, 470), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(False)', 'verbose_name': '"""Museum purchase only"""'}), "(default=False, verbose_name='Museum purchase only')\n", (418, 470), False, 'from django.db import migrations, models\n')] |
# This code calculates compressibility factor (z-factor) for natural hydrocarbon gases
# with 3 different methods. It is the outcomes of the following paper:
# <br>
# <NAME>.; <NAME>., <NAME>.; <NAME>. & <NAME>, <NAME>.
# Using artificial neural networks to estimate the Z-Factor for natural hydrocarbon gases
... | [
"numpy.abs",
"numpy.zeros",
"numpy.exp"
] | [((4319, 4335), 'numpy.zeros', 'np.zeros', (['(5, 2)'], {}), '((5, 2))\n', (4327, 4335), True, 'import numpy as np\n'), ((4441, 4457), 'numpy.zeros', 'np.zeros', (['(5, 2)'], {}), '((5, 2))\n', (4449, 4457), True, 'import numpy as np\n'), ((4567, 4584), 'numpy.zeros', 'np.zeros', (['(10, 2)'], {}), '((10, 2))\n', (4575... |
# Copyright 2021 The ML Collections Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [
"absl.testing.absltest.main",
"ml_collections.config_dict.config_dict.placeholder",
"ml_collections.ConfigDict",
"ml_collections.config_dict.config_dict.create",
"ml_collections.FieldReference"
] | [((24528, 24543), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (24541, 24543), False, 'from absl.testing import absltest\n'), ((2095, 2139), 'ml_collections.FieldReference', 'ml_collections.FieldReference', (['initial_value'], {}), '(initial_value)\n', (2124, 2139), False, 'import ml_collections\n')... |
# Standard
import gc
from pathlib import Path
import time
# PIP
from ignite.metrics import PSNR, SSIM
from lpips import LPIPS
from ptflops import get_model_complexity_info
import torch
from torch.utils.data import DataLoader
from tqdm import tqdm
# Custom
from custom.softsplat.model import SoftSplat
from custom.vimeo... | [
"torch.cuda.synchronize",
"custom.vimeo.dataset.Vimeo",
"torch.cuda.max_memory_allocated",
"gc.collect",
"pathlib.Path",
"torch.no_grad",
"torch.cuda.amp.autocast",
"torch.utils.data.DataLoader",
"torch.load",
"ptflops.get_model_complexity_info",
"tqdm.tqdm",
"torch.cuda.reset_peak_memory_stat... | [((428, 440), 'gc.collect', 'gc.collect', ([], {}), '()\n', (438, 440), False, 'import gc\n'), ((445, 469), 'torch.cuda.empty_cache', 'torch.cuda.empty_cache', ([], {}), '()\n', (467, 469), False, 'import torch\n'), ((474, 510), 'torch.cuda.reset_peak_memory_stats', 'torch.cuda.reset_peak_memory_stats', ([], {}), '()\n... |
# Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"torch.ones",
"torch.mul",
"torch.clamp",
"torch.nn.functional.conv1d",
"torch.no_grad"
] | [((1230, 1267), 'torch.ones', 'torch.ones', (['(1)', '(1)', 'self.kernel_size[0]'], {}), '(1, 1, self.kernel_size[0])\n', (1240, 1267), False, 'import torch\n'), ((3088, 3123), 'torch.mul', 'torch.mul', (['output', 'self.update_mask'], {}), '(output, self.update_mask)\n', (3097, 3123), False, 'import torch\n'), ((3159,... |
# Generated by Django 2.2.1 on 2019-05-15 09:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('DiseaseClassify', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='uploadimage',
name='predict_i... | [
"django.db.models.FileField"
] | [((345, 389), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': '"""predict_image/"""'}), "(upload_to='predict_image/')\n", (361, 389), False, 'from django.db import migrations, models\n')] |
from rlcore.algo import PPO
from rlcore.storage import RolloutStorage
class Neo(object):
def __init__(self, args, policy, obs_shape, action_space):
super().__init__()
self.obs_shape = obs_shape
self.action_space = action_space
self.actor_critic = policy # it is MPNN instance
self.rollou... | [
"rlcore.storage.RolloutStorage",
"rlcore.algo.PPO"
] | [((325, 446), 'rlcore.storage.RolloutStorage', 'RolloutStorage', (['args.num_steps', 'args.num_processes', 'self.obs_shape', 'self.action_space'], {'recurrent_hidden_state_size': '(1)'}), '(args.num_steps, args.num_processes, self.obs_shape, self.\n action_space, recurrent_hidden_state_size=1)\n', (339, 446), False,... |
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 6 14:52:32 2021
@author: Patrice
Simple utility script to read tiles from drive and compile a large tensor saved as an npy file.
Use only if you have enough ram to contain all your samples at once
"""
import numpy as np
import glob
import skimage.io as io
def tic():
... | [
"numpy.float16",
"numpy.uint8",
"numpy.save",
"time.time",
"glob.glob",
"numpy.int16",
"skimage.io.imread"
] | [((448, 459), 'time.time', 'time.time', ([], {}), '()\n', (457, 459), False, 'import time\n'), ((1210, 1243), 'glob.glob', 'glob.glob', (["(class_folder + '*.tif')"], {}), "(class_folder + '*.tif')\n", (1219, 1243), False, 'import glob\n'), ((1549, 1582), 'glob.glob', 'glob.glob', (["(class_folder + '*.tif')"], {}), "(... |
"""
Feedforward model construct
number of hidden layers:5
neural units of hidden layers: [2000, 1000, 800, 500, 100]
activation function: elu
"""
import torch as tch
class FNN(tch.nn.Module):
def __init__(self, n_inputs):
# call constructors from superclass
super(FNN, self).__init__()... | [
"torch.nn.Dropout",
"torch.nn.ELU",
"torch.nn.Linear"
] | [((384, 413), 'torch.nn.Linear', 'tch.nn.Linear', (['n_inputs', '(1000)'], {}), '(n_inputs, 1000)\n', (397, 413), True, 'import torch as tch\n'), ((437, 461), 'torch.nn.Linear', 'tch.nn.Linear', (['(1000)', '(800)'], {}), '(1000, 800)\n', (450, 461), True, 'import torch as tch\n'), ((485, 508), 'torch.nn.Linear', 'tch.... |
import httpx
from asgi_lifespan import LifespanManager
from fastapi import FastAPI
from pytest import mark
from sqlalchemy import text
def test_startup():
from fastapi_sqla import _Session, startup
startup()
session = _Session()
assert session.execute(text("SELECT 1")).scalar() == 1
@mark.asyncio... | [
"fastapi_sqla._Session",
"asgi_lifespan.LifespanManager",
"httpx.AsyncClient",
"sqlalchemy.text",
"fastapi_sqla.startup",
"fastapi_sqla.setup",
"fastapi.FastAPI"
] | [((209, 218), 'fastapi_sqla.startup', 'startup', ([], {}), '()\n', (216, 218), False, 'from fastapi_sqla import _Session, startup\n'), ((234, 244), 'fastapi_sqla._Session', '_Session', ([], {}), '()\n', (242, 244), False, 'from fastapi_sqla import _Session, setup\n'), ((415, 424), 'fastapi.FastAPI', 'FastAPI', ([], {})... |
from setuptools import setup, find_packages
import pathlib
HERE = pathlib.Path(__file__).parent
README = (HERE / "README.md").read_text()
setup(
name='build-flask-app',
description='Set up a modern flask web server by running one command.',
long_description=README,
long_description_content_type="text/... | [
"pathlib.Path",
"setuptools.find_packages"
] | [((67, 89), 'pathlib.Path', 'pathlib.Path', (['__file__'], {}), '(__file__)\n', (79, 89), False, 'import pathlib\n'), ((344, 359), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (357, 359), False, 'from setuptools import setup, find_packages\n')] |
from linkedlist import LinkedList
class Queue(object):
def __init__(self):
self._store = LinkedList()
def enqueue(self, data):
self._store.add_back(data)
def dequeue(self):
if(self._store.front() != None):
data = self._store.front().data
self._store.delete(... | [
"linkedlist.LinkedList"
] | [((102, 114), 'linkedlist.LinkedList', 'LinkedList', ([], {}), '()\n', (112, 114), False, 'from linkedlist import LinkedList\n')] |
#!/usr/bin/python3
#
# Extract audio metadata from m4a file
#
# Author: <NAME>
# Date: 04 Jan 2021
#
import glob
from mutagen.mp4 import MP4
import numpy as np
filez = glob.glob("2020_12_27_AM.m4a")
mp4file = MP4(filez[0])
for tag in mp4file.tags:
print('{}: {}'.format(tag, mp4file.tags[tag]))
| [
"mutagen.mp4.MP4",
"glob.glob"
] | [((176, 206), 'glob.glob', 'glob.glob', (['"""2020_12_27_AM.m4a"""'], {}), "('2020_12_27_AM.m4a')\n", (185, 206), False, 'import glob\n'), ((217, 230), 'mutagen.mp4.MP4', 'MP4', (['filez[0]'], {}), '(filez[0])\n', (220, 230), False, 'from mutagen.mp4 import MP4\n')] |
#!/usr/bin/python3
import tkinter as tk
from tkinter import messagebox
from PIL import ImageTk
from PIL import Image
from os import path
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
from Crypto import Random
import base64
from sys import exit
global mainBgColr, secBgColr, theme
mainBgColr = "#121212"
... | [
"tkinter.StringVar",
"PIL.Image.new",
"Crypto.Random.new",
"tkinter.Label",
"tkinter.Checkbutton",
"tkinter.Button",
"tkinter.Entry",
"os.path.exists",
"tkinter.Tk",
"tkinter.messagebox.showinfo",
"tkinter.IntVar",
"tkinter.messagebox.showerror",
"sys.exit",
"Crypto.Hash.SHA256.new",
"PI... | [((588, 595), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (593, 595), True, 'import tkinter as tk\n'), ((740, 771), 'PIL.Image.open', 'Image.open', (['"""assets/header.png"""'], {}), "('assets/header.png')\n", (750, 771), False, 'from PIL import Image\n'), ((781, 804), 'PIL.ImageTk.PhotoImage', 'ImageTk.PhotoImage', (['im... |
# Copyright 2020 Makani Technologies 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... | [
"makani.config.mconfig.Config"
] | [((648, 846), 'makani.config.mconfig.Config', 'mconfig.Config', ([], {'deps': "{'control': 'common.control.control_params', 'monitor':\n 'common.monitor.monitor_params', 'sim': 'common.sim.sim_params',\n 'system': mconfig.WING_MODEL + '.system_params'}"}), "(deps={'control': 'common.control.control_params', 'moni... |
"""
Measure: modularity (set)
@auth: <NAME>
@date 2015/10/09
@update 2016/02/13
"""
# 模塊性: Newman's modularity
def modularity(G, community_list):
"""
The estimated time complexity of this version (2016/02/13) is approximating
O(V) + O(E)
"""
import copy as c
NODE_DEGREE = 'node_degree'
... | [
"copy.copy"
] | [((623, 646), 'copy.copy', 'c.copy', (['community_index'], {}), '(community_index)\n', (629, 646), True, 'import copy as c\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_... | [
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QFrame"
] | [((2293, 2316), 'PyQt5.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', ([], {}), '()\n', (2314, 2316), False, 'from PyQt5 import QtWidgets\n'), ((3054, 3072), 'PyQt5.QtWidgets.QFrame', 'QtWidgets.QFrame', ([], {}), '()\n', (3070, 3072), False, 'from PyQt5 import QtWidgets\n'), ((1106, 1149), 'PyQt5.QtWidgets.QLabel', ... |
# 70. 爬楼梯
#
# 20210716
# huao
from math import comb
class Solution:
def climbStairs(self, n: int) -> int:
count = 0
for i in range(n // 2 + 1):
count += comb(n - i, i)
return count
print(Solution().climbStairs(2))
print(Solution().climbStairs(3))
| [
"math.comb"
] | [((189, 203), 'math.comb', 'comb', (['(n - i)', 'i'], {}), '(n - i, i)\n', (193, 203), False, 'from math import comb\n')] |
"""
Modular arithmetic
"""
from collections import defaultdict
import numpy as np
class ModInt:
"""
Integers of Z/pZ
"""
def __init__(self, a, n):
self.v = a % n
self.n = n
def __eq__(a, b):
if isinstance(b, ModInt):
return not bool(a - b)
else:
... | [
"numpy.zeros",
"collections.defaultdict",
"numpy.array"
] | [((10508, 10519), 'numpy.array', 'np.array', (['P'], {}), '(P)\n', (10516, 10519), True, 'import numpy as np\n'), ((10532, 10543), 'numpy.array', 'np.array', (['Q'], {}), '(Q)\n', (10540, 10543), True, 'import numpy as np\n'), ((10556, 10580), 'numpy.zeros', 'np.zeros', (['(p + q, p + q)'], {}), '((p + q, p + q))\n', (... |
import os
import torch
import matplotlib.pyplot as plt
from torchvision import transforms
from torch.utils.data import Dataset
import cv2
from PIL import Image
class CustomDataSet(Dataset):
def __init__(self, main_dir, type='train', resolution=(128,128)):
self.main_dir = main_dir
self.root_dir =... | [
"torchvision.transforms.PILToTensor",
"PIL.Image.open",
"torchvision.transforms.Grayscale",
"os.path.join",
"os.listdir",
"torch.tensor",
"torchvision.transforms.Resize"
] | [((353, 390), 'os.path.join', 'os.path.join', (['self.root_dir', '"""images"""'], {}), "(self.root_dir, 'images')\n", (365, 390), False, 'import os\n'), ((418, 450), 'os.path.join', 'os.path.join', (['self.img_dir', 'type'], {}), '(self.img_dir, type)\n', (430, 450), False, 'import os\n'), ((474, 503), 'os.listdir', 'o... |
# Copyright 2021 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... | [
"official.core.exp_factory.register_config_factory",
"official.vision.beta.configs.common.Augmentation",
"dataclasses.field",
"official.vision.beta.configs.image_classification.Losses",
"os.path.join"
] | [((5718, 5781), 'official.core.exp_factory.register_config_factory', 'exp_factory.register_config_factory', (['"""mobilenet_edgetpu_search"""'], {}), "('mobilenet_edgetpu_search')\n", (5753, 5781), False, 'from official.core import exp_factory\n'), ((5967, 6031), 'official.core.exp_factory.register_config_factory', 'ex... |
import numpy as np
class Average:
@staticmethod
def aggregate(gradients):
assert len(gradients) > 0, "Empty list of gradient to aggregate"
if len(gradients) > 1:
return np.mean(gradients, axis=0)
else:
return gradients[0]
| [
"numpy.mean"
] | [((209, 235), 'numpy.mean', 'np.mean', (['gradients'], {'axis': '(0)'}), '(gradients, axis=0)\n', (216, 235), True, 'import numpy as np\n')] |
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed in the hope that ... | [
"re.split"
] | [((1085, 1127), 're.split', 're.split', (['"""\\\\s?=\\\\s?|: """', 'line'], {'maxsplit': '(1)'}), "('\\\\s?=\\\\s?|: ', line, maxsplit=1)\n", (1093, 1127), False, 'import re\n')] |
#!/usr/bin/env python
import os
import sys
import re
params = {"port": 9000,
"target": "./example"}
if len(sys.argv)>1:
for arg in sys.argv:
tokens = re.split("=",arg.strip())
if len(tokens)>1:
var = tokens[0]
value = tokens[1]
params[var] = value
#TODO: make this a more python... | [
"os.system"
] | [((354, 388), 'os.system', 'os.system', (['"""python userstate.py &"""'], {}), "('python userstate.py &')\n", (363, 388), False, 'import os\n'), ((389, 420), 'os.system', 'os.system', (['"""python action.py &"""'], {}), "('python action.py &')\n", (398, 420), False, 'import os\n')] |
"""Provides a dictionary indexed by object identity with a weak reference."""
import weakref
from typing import Any, Dict, Generic, Iterator, TypeVar
T = TypeVar("T")
class WeakIdDict(Generic[T]):
"""Dictionary using object identity with a weak reference as key."""
data: Dict[int, T]
refs: Dict[int, we... | [
"typing.TypeVar",
"weakref.ref"
] | [((156, 168), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (163, 168), False, 'from typing import Any, Dict, Generic, Iterator, TypeVar\n'), ((735, 772), 'weakref.ref', 'weakref.ref', (['obj_key', 'clean_stale_ref'], {}), '(obj_key, clean_stale_ref)\n', (746, 772), False, 'import weakref\n')] |
import os
from configparser import ConfigParser
infile = os.path.expanduser("~/.abook/addressbook")
class AddressBook(object):
def __init__(self, contacts):
self.contacts = contacts
for i in self.contacts:
i["email"] = list(filter(None, i.get("email", '').split(",")))
def __getite... | [
"configparser.ConfigParser",
"os.path.expanduser"
] | [((58, 100), 'os.path.expanduser', 'os.path.expanduser', (['"""~/.abook/addressbook"""'], {}), "('~/.abook/addressbook')\n", (76, 100), False, 'import os\n'), ((1061, 1075), 'configparser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (1073, 1075), False, 'from configparser import ConfigParser\n')] |
if __name__=='__main__':
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import sys
sys.argv += ['build_ext','--inplace']
ext = Extension("pyclipper",
sources=["pyclipper.pyx", "clipper.cpp"],
... | [
"distutils.extension.Extension",
"distutils.core.setup"
] | [((221, 337), 'distutils.extension.Extension', 'Extension', (['"""pyclipper"""'], {'sources': "['pyclipper.pyx', 'clipper.cpp']", 'language': '"""c++"""', 'include_dirs': "['./../include']"}), "('pyclipper', sources=['pyclipper.pyx', 'clipper.cpp'], language=\n 'c++', include_dirs=['./../include'])\n", (230, 337), F... |
# *******************************************************************************
#
# Copyright (c) 2021 <NAME>. All rights reserved.
#
# *******************************************************************************
import math, numpy
from coppertop.pipe import *
from coppertop.std.linalg import tvarray
@copp... | [
"math.exp",
"numpy.std",
"numpy.mean",
"math.log",
"numpy.cov"
] | [((464, 482), 'numpy.mean', 'numpy.mean', (['ndOrPy'], {}), '(ndOrPy)\n', (474, 482), False, 'import math, numpy\n'), ((627, 649), 'numpy.std', 'numpy.std', (['ndOrPy', 'dof'], {}), '(ndOrPy, dof)\n', (636, 649), False, 'import math, numpy\n'), ((368, 380), 'numpy.cov', 'numpy.cov', (['A'], {}), '(A)\n', (377, 380), Fa... |
import numpy as np
from int_tabulated import *
def GetNDVItoDate(NDVI, Time, Start_End, bpy, DaysPerBand, CurrentBand):
#;
#;jzhu,8/9/2011,This program calculates total ndvi integration (ndvi*day) from start of season to currentband, the currentband is the dayindex of interesting day.
#
FILL=-1.... | [
"numpy.floor",
"numpy.zeros",
"numpy.ceil",
"numpy.unique"
] | [((529, 541), 'numpy.zeros', 'np.zeros', (['ny'], {}), '(ny)\n', (537, 541), True, 'import numpy as np\n'), ((1508, 1542), 'numpy.unique', 'np.unique', (['XSeg'], {'return_index': '(True)'}), '(XSeg, return_index=True)\n', (1517, 1542), True, 'import numpy as np\n'), ((703, 732), 'numpy.ceil', 'np.ceil', (["Start_End['... |
# Copyright © 2019 Province of British Columbia
#
# 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 agr... | [
"registry_schemas.validate",
"copy.deepcopy"
] | [((939, 974), 'registry_schemas.validate', 'validate', (['COMMENT_FILING', '"""comment"""'], {}), "(COMMENT_FILING, 'comment')\n", (947, 974), False, 'from registry_schemas import validate\n'), ((1221, 1252), 'copy.deepcopy', 'copy.deepcopy', (['COMMENT_BUSINESS'], {}), '(COMMENT_BUSINESS)\n', (1234, 1252), False, 'imp... |
import re
import os
import usb
import time
import json
import queue
import struct
import logging
import datetime
from ctypes import *
from typing import TypeVar, Any, Callable
from .SpectrometerSettings import SpectrometerSettings
from .SpectrometerState import SpectrometerState
from .SpectrometerResp... | [
"os.path.expanduser",
"json.dump",
"json.load",
"os.getpid",
"os.path.join",
"os.makedirs",
"os.path.exists",
"struct.calcsize",
"os.path.isfile",
"datetime.datetime.now",
"logging.getLogger"
] | [((636, 663), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (653, 663), False, 'import logging\n'), ((3095, 3106), 'os.getpid', 'os.getpid', ([], {}), '()\n', (3104, 3106), False, 'import os\n'), ((3140, 3163), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (3161, 31... |
"""
Copyright 2019 Samsung SDS
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 ... | [
"brightics.common.utils.get_default_from_parameters_if_required",
"scipy.stats.mannwhitneyu",
"brightics.common.repr.BrtcReprBuilder",
"itertools.combinations",
"numpy.where",
"numpy.array",
"brightics.common.utils.check_required_parameters",
"brightics.common.groupby._function_by_group"
] | [((1165, 1229), 'brightics.common.utils.check_required_parameters', 'check_required_parameters', (['_mann_whitney_test', 'params', "['table']"], {}), "(_mann_whitney_test, params, ['table'])\n", (1190, 1229), False, 'from brightics.common.utils import check_required_parameters\n'), ((1248, 1315), 'brightics.common.util... |
from common.page_object import PageObject, PageNotLoaded
from pages.footer import Footer
from pages.locators import HomePageLocators
from pages.signin_page import SigninPage
from pages.top_bar import TopBarNav
class HomePage(PageObject):
""" Quandl's page object """
def is_loaded(self):
"""A Top Bar ... | [
"pages.footer.Footer",
"pages.top_bar.TopBarNav",
"pages.signin_page.SigninPage"
] | [((882, 908), 'pages.top_bar.TopBarNav', 'TopBarNav', (['self._webdriver'], {}), '(self._webdriver)\n', (891, 908), False, 'from pages.top_bar import TopBarNav\n'), ((1170, 1193), 'pages.footer.Footer', 'Footer', (['self._webdriver'], {}), '(self._webdriver)\n', (1176, 1193), False, 'from pages.footer import Footer\n')... |
"""Unit tests for socket timeout feature."""
import unittest
from test import support
# This requires the 'network' resource as given on the regrtest command line.
skip_expected = not support.is_resource_enabled('network')
import time
import errno
import socket
class CreationTestCase(unittest.TestCase):
"""Tes... | [
"test.support.requires",
"socket.socket",
"test.support.transient_internet",
"time.time",
"test.support.bind_port",
"test.support.run_unittest",
"test.support.is_resource_enabled"
] | [((186, 224), 'test.support.is_resource_enabled', 'support.is_resource_enabled', (['"""network"""'], {}), "('network')\n", (213, 224), False, 'from test import support\n'), ((7361, 7388), 'test.support.requires', 'support.requires', (['"""network"""'], {}), "('network')\n", (7377, 7388), False, 'from test import suppor... |
import logging
from objective_turk import objective_turk
logger = logging.getLogger(__name__)
EXTERNAL_URL_QUESTION = """<?xml version="1.0"?>
<ExternalQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2006-07-14/ExternalQuestion.xsd">
<ExternalURL>{}</ExternalURL>
<FrameHeigh... | [
"objective_turk.objective_turk.Hit._new_from_response",
"objective_turk.objective_turk.client",
"logging.debug",
"logging.getLogger"
] | [((68, 95), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (85, 95), False, 'import logging\n'), ((4303, 4357), 'objective_turk.objective_turk.Hit._new_from_response', 'objective_turk.Hit._new_from_response', (["response['HIT']"], {}), "(response['HIT'])\n", (4340, 4357), False, 'from obj... |
from src.templating import Request, url_path, redirect, form, render_template
lang = {
"ru": {
"title": "Редирект",
"route": {
"panel": "Панель управления",
"redirect": "Редирект",
},
"redirect_index": "Редирект на главную",
},
}
async def response(requ... | [
"src.templating.render_template",
"src.templating.form",
"src.templating.url_path"
] | [((375, 381), 'src.templating.form', 'form', ([], {}), '()\n', (379, 381), False, 'from src.templating import Request, url_path, redirect, form, render_template\n'), ((447, 532), 'src.templating.render_template', 'render_template', (['"""route/panel/redirect.html"""'], {'context': "{'lc': lang[request.lang]}"}), "('rou... |
"""
This is the official list of CEA colors to use in plots
"""
import os
import pandas as pd
import yaml
import warnings
import functools
from typing import List, Callable
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, Architecture and Building Systems - ETH Zurich"
__credits__ = ["<NAME>"]
__license__ =... | [
"re.match"
] | [((1784, 1850), 're.match', 're.match', (['"""rgb\\\\(\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*\\\\)"""', 'color'], {}), "('rgb\\\\(\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*\\\\)', color)\n", (1792, 1850), False, 'import re\n')] |
import math
import statistics
def fuzzyAnd(m):
"""
fuzzy anding
m = list of membership values to be anded
returns smallest value in the list
"""
return min(m)
FuzzyAnd = fuzzyAnd
def fuzzyOr(m):
"""
fuzzy oring
m = list of membership values to be ored
returns largest value... | [
"statistics.median",
"math.pow"
] | [((1999, 2017), 'math.pow', 'math.pow', (['s', '(1 / l)'], {}), '(s, 1 / l)\n', (2007, 2017), False, 'import math\n'), ((4215, 4236), 'statistics.median', 'statistics.median', (['wm'], {}), '(wm)\n', (4232, 4236), False, 'import statistics\n'), ((910, 935), 'math.pow', 'math.pow', (['product1', '(1 - g)'], {}), '(produ... |
import bcrypt
from functools import lru_cache, wraps
import os
import pytest
from pyrsistent import freeze, thaw
import yaml
from app import create_app
from app.config import Config
from app.models import db, BaseModel, User, SiteMetadata
from app.caching import cache
from app.auth import auth_provider
from test.util... | [
"test.utilities.recursively_update",
"app.auth.auth_provider.actually_delete_user",
"pytest.fixture",
"app.caching.cache.clear",
"app.create_app",
"os.environ.get",
"pyrsistent.thaw",
"app.models.db.detach",
"app.config.Config",
"yaml.safe_load",
"functools.wraps",
"app.models.BaseModel.__subc... | [((1142, 1153), 'functools.lru_cache', 'lru_cache', ([], {}), '()\n', (1151, 1153), False, 'from functools import lru_cache, wraps\n'), ((3591, 3619), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (3605, 3619), False, 'import pytest\n'), ((615, 706), 'app.config.Config', 'Config',... |
from google.appengine.ext import ndb
from protorpc import messages
class Session(ndb.Model):
"""Session -- Session object"""
organizerUserId = ndb.StringProperty()
name = ndb.StringProperty(required=True)
highlights = ndb.StringProperty(repeated=True)
speaker = ndb.StringProperty()
duration = ... | [
"protorpc.messages.StringField",
"google.appengine.ext.ndb.IntegerProperty",
"google.appengine.ext.ndb.StringProperty",
"google.appengine.ext.ndb.DateProperty",
"protorpc.messages.MessageField",
"protorpc.messages.EnumField"
] | [((153, 173), 'google.appengine.ext.ndb.StringProperty', 'ndb.StringProperty', ([], {}), '()\n', (171, 173), False, 'from google.appengine.ext import ndb\n'), ((185, 218), 'google.appengine.ext.ndb.StringProperty', 'ndb.StringProperty', ([], {'required': '(True)'}), '(required=True)\n', (203, 218), False, 'from google.... |
from boc_python_demo import my_sum
def test_my_sum():
assert my_sum(1) == 1
assert my_sum(2) == 2
assert my_sum(3) == 3
assert my_sum(4) == 5
assert my_sum(5) == 8
assert my_sum(6) == 13
| [
"boc_python_demo.my_sum"
] | [((67, 76), 'boc_python_demo.my_sum', 'my_sum', (['(1)'], {}), '(1)\n', (73, 76), False, 'from boc_python_demo import my_sum\n'), ((93, 102), 'boc_python_demo.my_sum', 'my_sum', (['(2)'], {}), '(2)\n', (99, 102), False, 'from boc_python_demo import my_sum\n'), ((119, 128), 'boc_python_demo.my_sum', 'my_sum', (['(3)'], ... |
import tensorflow as tf
from capsule.utils import squash
import numpy as np
layers = tf.keras.layers
models = tf.keras.models
class GammaCapsule(tf.keras.Model):
def __init__(self, in_capsules, in_dim, out_capsules, out_dim, stdev=0.2, routing_iterations=2, use_bias=True, name=''):
super(GammaCapsule,... | [
"tensorflow.nn.softmax",
"tensorflow.reduce_sum",
"numpy.log",
"tensorflow.constant_initializer",
"tensorflow.reduce_mean",
"tensorflow.tile",
"tensorflow.zeros",
"tensorflow.random_normal_initializer",
"tensorflow.shape",
"capsule.utils.squash",
"tensorflow.name_scope",
"tensorflow.norm",
"... | [((1410, 1429), 'tensorflow.norm', 'tf.norm', (['u'], {'axis': '(-1)'}), '(u, axis=-1)\n', (1417, 1429), True, 'import tensorflow as tf\n'), ((1545, 1565), 'tensorflow.expand_dims', 'tf.expand_dims', (['u', '(1)'], {}), '(u, 1)\n', (1559, 1565), True, 'import tensorflow as tf\n'), ((1579, 1599), 'tensorflow.expand_dims... |
"""
store the current version info of the server.
"""
from jupyter_packaging import get_version_info
# Version string must appear intact for tbump versioning
__version__ = '1.6.2'
version_info = get_version_info(__version__)
| [
"jupyter_packaging.get_version_info"
] | [((197, 226), 'jupyter_packaging.get_version_info', 'get_version_info', (['__version__'], {}), '(__version__)\n', (213, 226), False, 'from jupyter_packaging import get_version_info\n')] |
import pygame, math, time
from enum import Enum
class WeaponType(Enum):
MELEE = 1
LOADABLE = 2
DOUBLE_SHOT = 3
# bazuka, granat, paluch, strzelba
class Weapon(object):
def __init__(self, team, battle, game):
self.team = team
self.owner = team.get_selected_worm()
self.for... | [
"math.radians",
"pygame.Rect",
"math.sin",
"time.clock",
"math.cos",
"pygame.mixer.Sound"
] | [((3048, 3060), 'time.clock', 'time.clock', ([], {}), '()\n', (3058, 3060), False, 'import pygame, math, time\n'), ((3132, 3162), 'math.radians', 'math.radians', (['self.owner.angle'], {}), '(self.owner.angle)\n', (3144, 3162), False, 'import pygame, math, time\n'), ((3214, 3237), 'math.sin', 'math.sin', (['angle_radia... |
import asyncio
import ssl
import aiohttp
# if sys.version_info >= (3, 5):
# EventLoopType = t.Union[asyncio.BaseEventLoop, asyncio.AbstractEventLoop]
# else:
# EventLoopType = asyncio.AbstractEventLoop
def get_or_create_event_loop() -> asyncio.AbstractEventLoop:
try:
loop = asyncio.get_event_loo... | [
"asyncio.get_event_loop",
"asyncio.set_event_loop",
"ssl.create_default_context",
"aiohttp.TCPConnector",
"asyncio.new_event_loop"
] | [((299, 323), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (321, 323), False, 'import asyncio\n'), ((943, 989), 'ssl.create_default_context', 'ssl.create_default_context', ([], {'cafile': 'self.cafile'}), '(cafile=self.cafile)\n', (969, 989), False, 'import ssl\n'), ((1109, 1202), 'aiohttp.TCPC... |
'''
This is the central location for driving the other modules. It should primarily
contain seasons and SCVL specific location.
'''
import facility
from optimizer import make_schedule, save_schedules
from optimizer import make_round_robin_game, get_default_potential_sch_loc
import datetime
from facility import SCVL_Fac... | [
"datetime.date.today",
"optimizer.make_round_robin_game"
] | [((543, 613), 'optimizer.make_round_robin_game', 'make_round_robin_game', (['team_counts', 'sch_template_path', 'total_schedules'], {}), '(team_counts, sch_template_path, total_schedules)\n', (564, 613), False, 'from optimizer import make_round_robin_game, get_default_potential_sch_loc\n'), ((976, 997), 'datetime.date.... |
# code-checked
# server-checked
import cv2
import numpy as np
import os
import os.path as osp
import random
import torch
from torch.utils import data
import pickle
def generate_scale_label(image, label):
f_scale = 0.5 + random.randint(0, 16)/10.0
image = cv2.resize(image, None, fx=f_scale, fy=f_scale, interp... | [
"random.randint",
"os.path.basename",
"numpy.asarray",
"cv2.copyMakeBorder",
"os.path.exists",
"cv2.imread",
"pickle.load",
"numpy.array",
"numpy.random.choice",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((266, 345), 'cv2.resize', 'cv2.resize', (['image', 'None'], {'fx': 'f_scale', 'fy': 'f_scale', 'interpolation': 'cv2.INTER_LINEAR'}), '(image, None, fx=f_scale, fy=f_scale, interpolation=cv2.INTER_LINEAR)\n', (276, 345), False, 'import cv2\n'), ((358, 443), 'cv2.resize', 'cv2.resize', (['label', 'None'], {'fx': 'f_sc... |
import search
from math import(cos, pi)
stl_map = search.UndirectedGraph(dict(
Kirkwood=dict(Webster=10, Clayton=17, MapleWood=17, Oakland=5, Glendale=7,),
St_Louis=dict(Clayton=12),
Glendale=dict(St_Louis=19),
Oakland=dict(Glendale=4),
MapleWood=dict(St_Louis=11),
Clayton=dict(Webster=14, St_L... | [
"search.GraphProblem"
] | [((655, 707), 'search.GraphProblem', 'search.GraphProblem', (['"""Kirkwood"""', '"""St_Louis"""', 'stl_map'], {}), "('Kirkwood', 'St_Louis', stl_map)\n", (674, 707), False, 'import search\n'), ((722, 772), 'search.GraphProblem', 'search.GraphProblem', (['"""Oakland"""', '"""Webster"""', 'stl_map'], {}), "('Oakland', 'W... |
import argparse
from etoLib.log_logger import log_make_logger
from etoLib.s3_func import s3_hello
from etoLib.util_func import unique
from etoLib.util_func import grepfxn
def get_parser():
parser = argparse.ArgumentParser(description='Run the eto code')
parser.add_argument('tile', metavar='TILE', type=str, ... | [
"etoLib.log_logger.log_make_logger",
"argparse.ArgumentParser",
"etoLib.s3_func.s3_hello"
] | [((206, 261), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run the eto code"""'}), "(description='Run the eto code')\n", (229, 261), False, 'import argparse\n'), ((1315, 1331), 'etoLib.s3_func.s3_hello', 's3_hello', (['"""Greg"""'], {}), "('Greg')\n", (1323, 1331), False, 'from etoLib.... |
"""Utility functions for file manipulation"""
import logging
import os
import shutil
import sys
import urllib.error
import urllib.request
import zipfile
def download_file(source, dest, verbose=False, overwrite=None):
"""Get a file from a url and save it locally"""
if verbose:
print(f"Downloading {sour... | [
"zipfile.ZipFile",
"os.path.basename",
"logging.warning",
"os.path.exists",
"shutil.rmtree",
"os.path.join",
"shutil.copy"
] | [((343, 363), 'os.path.exists', 'os.path.exists', (['dest'], {}), '(dest)\n', (357, 363), False, 'import os\n'), ((2358, 2389), 'os.path.join', 'os.path.join', (['out_path', 'dirname'], {}), '(out_path, dirname)\n', (2370, 2389), False, 'import os\n'), ((2397, 2427), 'os.path.exists', 'os.path.exists', (['extracted_pat... |
#!/usr/bin/env python
import sys
import os
import time
import json
import golfir.model
import golfir.utils
import yaml
def run(root, argv=[]):
#ds9 = None
defaults = {'ds9': None,
'patch_arcmin': 1.0, # Size of patch to fit
'patch_overlap': 0.2, # O... | [
"os.mkdir",
"yaml.dump",
"os.path.exists",
"os.system",
"time.ctime",
"os.path.join",
"os.chdir"
] | [((1846, 1880), 'os.path.join', 'os.path.join', (["kwargs['PATH']", 'root'], {}), "(kwargs['PATH'], root)\n", (1858, 1880), False, 'import os\n'), ((1888, 1911), 'os.path.exists', 'os.path.exists', (['run_dir'], {}), '(run_dir)\n', (1902, 1911), False, 'import os\n'), ((2026, 2049), 'os.path.exists', 'os.path.exists', ... |
import re
from setuptools import setup
with open('wumpus/__init__.py') as f:
contents = f.read()
try:
version = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', contents, re.M
).group(1)
except AttributeError:
raise RuntimeError('Could not identify version') from ... | [
"re.search",
"setuptools.setup"
] | [((701, 1779), 'setuptools.setup', 'setup', ([], {'name': '"""wumpus.py"""', 'author': 'author', 'url': '"""https://github.com/jay3332/wumpus.py"""', 'project_urls': "{'Issue tracker': 'https://github.com/jay3332/wumpus.py/issues', 'Discord':\n 'https://discord.gg/FqtZ6akWpd'}", 'version': '"""0.0.0"""', 'packages':... |
import unittest
import spydrnet as sdn
from spydrnet.ir.first_class_element import FirstClassElement
class TestWire(unittest.TestCase):
def setUp(self):
self.definition_top = sdn.Definition()
self.port_top = self.definition_top.create_port()
self.inner_pin = self.port_top.create_pin()
... | [
"spydrnet.Definition",
"spydrnet.OuterPin",
"spydrnet.Wire",
"spydrnet.OuterPin.from_instance_and_inner_pin",
"spydrnet.InnerPin"
] | [((190, 206), 'spydrnet.Definition', 'sdn.Definition', ([], {}), '()\n', (204, 206), True, 'import spydrnet as sdn\n'), ((449, 465), 'spydrnet.Definition', 'sdn.Definition', ([], {}), '()\n', (463, 465), True, 'import spydrnet as sdn\n'), ((871, 881), 'spydrnet.Wire', 'sdn.Wire', ([], {}), '()\n', (879, 881), True, 'im... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018, ESS LLP and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
import json
from frappe.utils import cint
from erpnext.healthcare.utils import render_docs_as_html
@frappe.whitelist()
def get_feed(name, docum... | [
"json.loads",
"frappe.whitelist",
"frappe.db.get_all",
"frappe.utils.cint",
"frappe.get_single"
] | [((277, 295), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (293, 295), False, 'import frappe\n'), ((1202, 1220), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (1218, 1220), False, 'import frappe\n'), ((1571, 1589), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (1587, 1589), False, '... |
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
import math
import pandas
def parseErrorCode(code):
"""에러코드 메시지
:param code: 에러 코드
:type code: str
:return: 에러코드 메시지를 반환
::
parseErrorCode("00310") # 모의투자 조회가 완료되었습니다
"""
code = str(code)
ht ... | [
"datetime.timedelta",
"datetime.datetime.today"
] | [((4842, 4858), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (4856, 4858), False, 'from datetime import datetime, timedelta\n'), ((4238, 4254), 'datetime.datetime.today', 'datetime.today', ([], {}), '()\n', (4252, 4254), False, 'from datetime import datetime, timedelta\n'), ((4691, 4707), 'datetime.da... |
import json # pylint: disable=import-error
import os # pylint: disable=import-error
import time # pylint: disable=import-error
import requests # pylint: disable=import-error
from flask import Flask, request # pylint: disable=import-error
app = Flask(__name__)
print("app",app)
@app.route("/", methods=["POST"])
d... | [
"requests.session",
"flask.Flask",
"json.dumps",
"time.sleep",
"flask.request.get_json"
] | [((251, 266), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (256, 266), False, 'from flask import Flask, request\n'), ((392, 410), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (408, 410), False, 'from flask import Flask, request\n'), ((797, 810), 'time.sleep', 'time.sleep', (['(1)'], {}... |
import base64
import string
from random import randint, choice
from Crypto.Cipher import AES
from Crypto.Hash import SHA256
from Crypto import Random as CryptoRandom
class Encryption():
def __init__(self, key):
self.key = key # Key in bytes
self.salted_key = None # Placeholder for optional sal... | [
"Crypto.Hash.SHA256.new",
"random.randint",
"random.choice",
"base64.b64decode",
"base64.b64encode",
"Crypto.Random.new"
] | [((2087, 2109), 'base64.b64encode', 'base64.b64encode', (['data'], {}), '(data)\n', (2103, 2109), False, 'import base64\n'), ((2246, 2274), 'base64.b64decode', 'base64.b64decode', (['enc_secret'], {}), '(enc_secret)\n', (2262, 2274), False, 'import base64\n'), ((583, 598), 'Crypto.Hash.SHA256.new', 'SHA256.new', (['key... |
import setuptools
# Reads the content of your README.md into a variable to be used in the setup below
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name='maddress', # should match the package folder
packages=['maddress'],... | [
"setuptools.setup"
] | [((190, 1120), 'setuptools.setup', 'setuptools.setup', ([], {'name': '"""maddress"""', 'packages': "['maddress']", 'version': '"""1.0.0-alpha"""', 'license': '"""MIT"""', 'description': '"""Testing installation of Package"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""... |
from googleapiclient.discovery import build
from os import getenv
from auth import get_credentials
class AppsScript():
def __init__(self, id: str):
self._name = getenv("API_SERVICE_NAME")
self._version = getenv("API_VERSION")
self._id = id
def run(self, function: str):
body =... | [
"auth.get_credentials",
"os.getenv"
] | [((176, 202), 'os.getenv', 'getenv', (['"""API_SERVICE_NAME"""'], {}), "('API_SERVICE_NAME')\n", (182, 202), False, 'from os import getenv\n'), ((227, 248), 'os.getenv', 'getenv', (['"""API_VERSION"""'], {}), "('API_VERSION')\n", (233, 248), False, 'from os import getenv\n'), ((402, 419), 'auth.get_credentials', 'get_c... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""ObjectID test."""
import json
from unittest import TestCase
from bson import ObjectId
from mongoengine.document import Document
from mongoengine.errors import ValidationError
from mongoengine.fields import StringField
from mongoengine_goodjson.fields import ObjectIDF... | [
"mongoengine.fields.StringField",
"bson.ObjectId",
"mongoengine_goodjson.fields.ObjectIDField",
"json.dumps"
] | [((464, 479), 'mongoengine_goodjson.fields.ObjectIDField', 'ObjectIDField', ([], {}), '()\n', (477, 479), False, 'from mongoengine_goodjson.fields import ObjectIDField\n'), ((491, 517), 'mongoengine.fields.StringField', 'StringField', ([], {'required': '(True)'}), '(required=True)\n', (502, 517), False, 'from mongoengi... |
from collections import Counter
def partition_labels(s: str) -> list:
res = []
count = Counter(s)
addr = {}
for i,c in enumerate(s):
if c in addr:
addr[c].append(i)
else:
addr[c] = [i]
lst = []
added = set()
for c in s:
if c in added:
... | [
"collections.Counter"
] | [((98, 108), 'collections.Counter', 'Counter', (['s'], {}), '(s)\n', (105, 108), False, 'from collections import Counter\n')] |
#!/usr/bin/env python3
# Copyright 2018 <NAME>.
#
# 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... | [
"varsome_api.vcf.VCFAnnotator",
"argparse.ArgumentParser"
] | [((729, 794), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""VCF Annotator command line"""'}), "(description='VCF Annotator command line')\n", (752, 794), False, 'import argparse\n'), ((2077, 2194), 'varsome_api.vcf.VCFAnnotator', 'VCFAnnotator', ([], {'api_key': 'api_key', 'ref_genome':... |
#!/usr/bin/env python
from setuptools import setup
import subprocess
import sys
import pkg_resources
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
def get_semantic_version():
gl... | [
"sys.stdout.write",
"subprocess.Popen",
"setuptools.setup",
"os.path.dirname",
"os.path.join"
] | [((1039, 1900), 'setuptools.setup', 'setup', ([], {'name': '"""fourbars"""', 'version': 'VERSION', 'description': '"""Ableton Live CLI - High Precision Loop Production and Asset Management"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'author': '"""<NAME>"""', 'aut... |
from __future__ import absolute_import, division, print_function, unicode_literals
# NB: see head of `datasets.py'
from training_utils import *
from utils_io import os, tempdir
from datasets import image_kinds
print ("Using TensorFlow version:", tf.__version__)
def train_n_save_classifier (model, class_names, input_k... | [
"tensorflow.keras.layers.Reshape",
"tensorflow.keras.models.Sequential",
"utils_io.os.path.join",
"tensorflow.keras.layers.Dense"
] | [((781, 813), 'utils_io.os.path.join', 'os.path.join', (['outdir', 'model.name'], {}), '(outdir, model.name)\n', (793, 813), False, 'from utils_io import os, tempdir\n'), ((5227, 5253), 'tensorflow.keras.models.Sequential', 'Sequential', (['layers'], {}), '(layers, **kwds)\n', (5237, 5253), False, 'from tensorflow.kera... |
# -*- coding: utf-8 -*-
"""
@author: <NAME>
@copyright 2017
@licence: 2-clause BSD licence
This file contains the main code for the phase-state machine
"""
import numpy as _np
import pandas as _pd
import itertools
from numba import jit
import warnings as _warnings
@jit(nopython=True, cache=True)
def _limit(a):
... | [
"numpy.abs",
"numpy.sum",
"numpy.argmax",
"numpy.empty",
"numpy.clip",
"numpy.random.normal",
"numpy.full",
"numpy.tri",
"numpy.minimum",
"numpy.asarray",
"numpy.dot",
"numpy.copyto",
"numpy.outer",
"numpy.isscalar",
"numpy.zeros",
"numpy.any",
"numba.jit",
"numpy.array",
"numpy.... | [((271, 301), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'cache': '(True)'}), '(nopython=True, cache=True)\n', (274, 301), False, 'from numba import jit\n'), ((692, 722), 'numba.jit', 'jit', ([], {'nopython': '(True)', 'cache': '(True)'}), '(nopython=True, cache=True)\n', (695, 722), False, 'from numba import jit\... |
import pygame
import random
pygame.init()
COLOR_BLACK = (0, 0, 0)
COLOR_WHITE = (255, 255, 255)
SCORE_MAX = 10
tn = [1, 2, 3, 4, 5]
size = (1280, 720)
screen = pygame.display.set_mode(size)
pygame.display.set_caption("MyPong - PyGame Edition - 2021.01.30")
# score text
score_font = pygame.font.Font('C:/Users/Pich... | [
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.init",
"pygame.display.flip",
"random.randrange",
"pygame.font.Font",
"pygame.image.load",
"pygame.display.set_caption",
"pygame.time.Clock",
"pygame.mixer.Sound"
] | [((29, 42), 'pygame.init', 'pygame.init', ([], {}), '()\n', (40, 42), False, 'import pygame\n'), ((165, 194), 'pygame.display.set_mode', 'pygame.display.set_mode', (['size'], {}), '(size)\n', (188, 194), False, 'import pygame\n'), ((195, 261), 'pygame.display.set_caption', 'pygame.display.set_caption', (['"""MyPong - P... |
import os
AWS_REGION = os.environ.get('AWS_REGION')
BUCKET = ""
CACHE_MAX_AGE = 3600
DEFAULT_QUALITY_RATE = 80
LOSSY_IMAGE_FMTS = ('jpg', 'jpeg', 'webp')
| [
"os.environ.get"
] | [((24, 52), 'os.environ.get', 'os.environ.get', (['"""AWS_REGION"""'], {}), "('AWS_REGION')\n", (38, 52), False, 'import os\n')] |
# Copyright (c) 2016 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... | [
"topology.Topology",
"tarfile.TarFile",
"paddle.proto.ParameterConfig_pb2.ParameterConfig",
"numpy.zeros",
"tarfile.TarInfo",
"struct.pack",
"collections.OrderedDict",
"cStringIO.StringIO",
"numpy.ndarray"
] | [((1005, 1021), 'topology.Topology', 'Topology', (['layers'], {}), '(layers)\n', (1013, 1021), False, 'from topology import Topology\n'), ((2864, 2877), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (2875, 2877), False, 'from collections import OrderedDict\n'), ((10804, 10840), 'tarfile.TarFile', 'tarfile... |
"""
:: deftwit.forms ::
A source of truthyness for deftwit wtforms.
"""
from flask_wtf import FlaskForm
from wtforms import StringField, SubmitField, SelectField
from wtforms.validators import DataRequired, Length
from deftwit.models import DB, User, Tweet
class GetUserForm(FlaskForm):
"""
A general class ... | [
"wtforms.SelectField",
"wtforms.validators.Length",
"deftwit.models.User.query.all",
"wtforms.SubmitField",
"wtforms.validators.DataRequired"
] | [((699, 722), 'wtforms.SubmitField', 'SubmitField', (['"""Add User"""'], {}), "('Add User')\n", (710, 722), False, 'from wtforms import StringField, SubmitField, SelectField\n'), ((1052, 1068), 'deftwit.models.User.query.all', 'User.query.all', ([], {}), '()\n', (1066, 1068), False, 'from deftwit.models import DB, User... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import logging
import re
import pyforms as app
from pyforms.basewidget import BaseWidget
from pyforms.controls import ControlList
from pyforms.controls import ControlCheckBox
from pybpodgui_plugin.models.setup.task_variable import TaskVariableWindow
from pybpodgui_api.model... | [
"pybpodgui_api.models.setup.board_task.BoardTask.__init__",
"pyforms.controls.ControlList",
"re.compile",
"pyforms.controls.ControlCheckBox",
"pybpodgui_plugin.models.setup.task_variable.TaskVariableWindow",
"logging.getLogger",
"pyforms.start_app"
] | [((366, 393), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (383, 393), False, 'import logging\n'), ((4724, 4754), 'pyforms.start_app', 'app.start_app', (['BoardTaskWindow'], {}), '(BoardTaskWindow)\n', (4737, 4754), True, 'import pyforms as app\n'), ((2322, 2357), 'pyforms.controls.Cont... |
"""create table budget_item
Revision ID: 7b47983c2ea0
Revises: 89794c69ffab
Create Date: 2019-09-07 11:46:49.554912
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = '7b47983c2ea0'
down_revision = '89794c69ffab'
branch_labels = None
depends_on = None
def upgrade... | [
"alembic.op.drop_table",
"sqlalchemy.String",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column"
] | [((1222, 1250), 'alembic.op.drop_table', 'op.drop_table', (['"""budget_item"""'], {}), "('budget_item')\n", (1235, 1250), False, 'from alembic import op\n'), ((641, 690), 'sqlalchemy.Column', 'sa.Column', (['"""quantity"""', 'sa.Integer'], {'nullable': '(False)'}), "('quantity', sa.Integer, nullable=False)\n", (650, 69... |
import numpy as np
import imageio
import os
AVAILABLE_IMAGES = ['barbara']
def _add_noise(img, sigma):
noise = np.random.normal(scale=sigma,
size=img.shape).astype(img.dtype)
return img + noise
def example_image(img_name, noise_std=0):
imgf = os.path.join('sparselandtools'... | [
"imageio.imread",
"os.path.join",
"numpy.random.normal"
] | [((290, 366), 'os.path.join', 'os.path.join', (['"""sparselandtools"""', '"""applications"""', '"""assets"""', "(img_name + '.png')"], {}), "('sparselandtools', 'applications', 'assets', img_name + '.png')\n", (302, 366), False, 'import os\n'), ((118, 163), 'numpy.random.normal', 'np.random.normal', ([], {'scale': 'sig... |
import mnist
import numpy as np
import pickle
import cnn
training_images = mnist.train_images()
training_labels = mnist.train_labels()
## uncomment below to train mnist images as RGB data
# import cv2
# training_images_rgb = []
# for i, image in enumerate(training_images):
# training_images_rgb.append(cv2.cvtCol... | [
"mnist.train_images",
"cnn.CNN",
"mnist.train_labels",
"pickle.dump",
"mnist.test_labels",
"cnn.layers.SoftMax",
"pickle.load",
"cnn.layers.MaxPool",
"mnist.test_images",
"cnn.layers.Conv"
] | [((77, 97), 'mnist.train_images', 'mnist.train_images', ([], {}), '()\n', (95, 97), False, 'import mnist\n'), ((116, 136), 'mnist.train_labels', 'mnist.train_labels', ([], {}), '()\n', (134, 136), False, 'import mnist\n'), ((701, 723), 'pickle.load', 'pickle.load', (['pickle_in'], {}), '(pickle_in)\n', (712, 723), Fals... |
from flask import Flask
from resume_builder.config import Configuration
app = Flask(__name__)
app.config.from_object(Configuration)
from resume_builder import routes,models
| [
"flask.Flask"
] | [((79, 94), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (84, 94), False, 'from flask import Flask\n')] |