code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Flask settings file.
For the full list of settings and their values, visit
http://flask.pocoo.org/docs/0.12/config/
"""
import os
DEBUG = True if os.environ.get('FLASK_DEBUG') in ['1', 'True', 'true'] else False
SECRET_KEY = '<KEY>'
| [
"os.environ.get"
] | [((153, 182), 'os.environ.get', 'os.environ.get', (['"""FLASK_DEBUG"""'], {}), "('FLASK_DEBUG')\n", (167, 182), False, 'import os\n')] |
#!/usr/bin/python
from kafka import KafkaProducer
kafkaHosts=["kafka01.paas.longfor.sit:9092"
,"kafka02.paas.longfor.sit:9092"
,"kafka03.paas.longfor.sit:9092"]
producer = KafkaProducer(bootstrap_servers=kafkaHosts);
for _ in range(20):
producer.send("testapplog_plm-prototype",b"Hello...... | [
"kafka.KafkaProducer"
] | [((199, 242), 'kafka.KafkaProducer', 'KafkaProducer', ([], {'bootstrap_servers': 'kafkaHosts'}), '(bootstrap_servers=kafkaHosts)\n', (212, 242), False, 'from kafka import KafkaProducer\n')] |
from setuptools import setup, find_packages
setup(
name='django-jsx',
version='0.4.0',
author='<NAME>',
author_email='<EMAIL>',
packages=find_packages(exclude=['sample_project']),
include_package_data=True,
license='BSD',
description='Integration library for React/JSX and Django',
c... | [
"setuptools.find_packages"
] | [((158, 199), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['sample_project']"}), "(exclude=['sample_project'])\n", (171, 199), False, 'from setuptools import setup, find_packages\n')] |
import copy
class Filledlist(list):
def __init__(self,count,value,*args,**kwargs):
super().__init__()
for _ in range(count):
slef.append(copy.copy(value))
| [
"copy.copy"
] | [((171, 187), 'copy.copy', 'copy.copy', (['value'], {}), '(value)\n', (180, 187), False, 'import copy\n')] |
from torch.utils.data import DataLoader
import torchvision
from torchvision.transforms import ToTensor, Normalize
class DataGetter():
"""Helper class for getting various torchvision transformations and data loaders
Args:
self.dataset (torch.utils.data.Dataset): data set from which to load ... | [
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor"
] | [((895, 905), 'torchvision.transforms.ToTensor', 'ToTensor', ([], {}), '()\n', (903, 905), False, 'from torchvision.transforms import ToTensor, Normalize\n'), ((923, 954), 'torchvision.transforms.Normalize', 'Normalize', (['(0.1307,)', '(0.3081,)'], {}), '((0.1307,), (0.3081,))\n', (932, 954), False, 'from torchvision.... |
import requests, json
import sys
from colorama import init, Fore
init(autoreset=True)
bold = '\033[01m'
print (Fore.RED+"""
_________________________________
| |
| |
โโโโโ โโโ... | [
"colorama.init",
"requests.get",
"sys.exit"
] | [((65, 85), 'colorama.init', 'init', ([], {'autoreset': '(True)'}), '(autoreset=True)\n', (69, 85), False, 'from colorama import init, Fore\n'), ((6097, 6108), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (6105, 6108), False, 'import sys\n'), ((1542, 1564), 'requests.get', 'requests.get', (['(api + ip)'], {}), '(api... |
import unittest
from yauber_algo.errors import *
class TWMATestCase(unittest.TestCase):
def test_twma(self):
import yauber_algo.sanitychecks as sc
from numpy import array, nan, inf
import os
import sys
import pandas as pd
import numpy as np
from yauber_algo... | [
"pandas.Series",
"numpy.random.random",
"numpy.array",
"yauber_algo.sanitychecks.SanityChecker"
] | [((443, 465), 'yauber_algo.sanitychecks.SanityChecker', 'sc.SanityChecker', (['algo'], {}), '(algo)\n', (459, 465), True, 'import yauber_algo.sanitychecks as sc\n'), ((589, 616), 'numpy.array', 'array', (['[nan, nan, 2, 7 / 3]'], {}), '([nan, nan, 2, 7 / 3])\n', (594, 616), False, 'from numpy import array, nan, inf\n')... |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import re
import pytest
from pex.resolve.path_mappings import PathMapping, PathMappings
from pex.typing import TYPE_CHECKING
if TYPE_CHECKING:
from typing import Tuple
def create_... | [
"re.escape",
"pex.resolve.path_mappings.PathMapping"
] | [((423, 456), 'pex.resolve.path_mappings.PathMapping', 'PathMapping', ([], {'path': 'path', 'name': 'name'}), '(path=path, name=name)\n', (434, 456), False, 'from pex.resolve.path_mappings import PathMapping, PathMappings\n'), ((573, 627), 're.escape', 're.escape', (['"""Mapped paths must be absolute. Given: foo"""'], ... |
from django.contrib import admin
from django.forms import TextInput, ModelForm
from suit.admin import SortableModelAdmin
from .models import MarqueeMessage
class MarqueeMessageForm(ModelForm):
class Meta:
widgets = {
'message': TextInput(attrs={'class': 'input-xxlarge'}),
}
class Mar... | [
"django.forms.TextInput",
"django.contrib.admin.site.register"
] | [((505, 561), 'django.contrib.admin.site.register', 'admin.site.register', (['MarqueeMessage', 'MarqueeMessageAdmin'], {}), '(MarqueeMessage, MarqueeMessageAdmin)\n', (524, 561), False, 'from django.contrib import admin\n'), ((254, 297), 'django.forms.TextInput', 'TextInput', ([], {'attrs': "{'class': 'input-xxlarge'}"... |
# coding=utf-8
from pypint.integrators.node_providers.gauss_legendre_nodes import GaussLegendreNodes
import unittest
from nose.tools import *
import numpy as np
test_num_nodes = range(2, 7)
def manual_initialization(n_nodes):
nodes = GaussLegendreNodes()
nodes.init(n_nodes)
assert_equal(nodes.num_nodes,... | [
"pypint.integrators.node_providers.gauss_legendre_nodes.GaussLegendreNodes",
"numpy.sqrt"
] | [((242, 262), 'pypint.integrators.node_providers.gauss_legendre_nodes.GaussLegendreNodes', 'GaussLegendreNodes', ([], {}), '()\n', (260, 262), False, 'from pypint.integrators.node_providers.gauss_legendre_nodes import GaussLegendreNodes\n'), ((803, 823), 'pypint.integrators.node_providers.gauss_legendre_nodes.GaussLege... |
from torch.utils.data import Dataset
from tqdm import tqdm
from pathlib import Path
def read_text(text_file):
with open(text_file, 'r', encoding='utf-8') as out:
return out.readlines()[0].strip()
class MnMAudioDataset(Dataset):
def __init__(self, path, manifest_csv_file, tokenizer, data_transfor... | [
"tqdm.tqdm",
"pathlib.Path",
"pathlib.Path.home"
] | [((411, 422), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (420, 422), False, 'from pathlib import Path\n'), ((461, 470), 'pathlib.Path', 'Path', (['"""."""'], {}), "('.')\n", (465, 470), False, 'from pathlib import Path\n'), ((841, 849), 'tqdm.tqdm', 'tqdm', (['mp'], {}), '(mp)\n', (845, 849), False, 'from tqdm... |
import webapp2
import json
from models.user import User
class setCityHandler(webapp2.RequestHandler):
def get(self):
user = User.checkUser()
if not user:
return
city = self.request.get('city')
city = int(city)
if city:
update = User.setCity(user.email,city)
self.response.write(json.du... | [
"models.user.User.setCity",
"models.user.User.checkUser",
"json.dumps",
"webapp2.WSGIApplication"
] | [((415, 482), 'webapp2.WSGIApplication', 'webapp2.WSGIApplication', (["[('/setCity', setCityHandler)]"], {'debug': '(True)'}), "([('/setCity', setCityHandler)], debug=True)\n", (438, 482), False, 'import webapp2\n'), ((128, 144), 'models.user.User.checkUser', 'User.checkUser', ([], {}), '()\n', (142, 144), False, 'from... |
import re # to search the tags
import html # to analyze the html &...
import imghdr # check for the img type
import atexit
import requests # main module to get the web source
import zipfile # archive all files into a zip file
from threading import Thread
from collections import deque # use thread safe sequence
from rd... | [
"requests.session",
"atexit.register",
"rdstr.randstr",
"html.unescape",
"zipfile.ZipFile",
"imghdr.what",
"collections.deque",
"re.compile"
] | [((374, 392), 'requests.session', 'requests.session', ([], {}), '()\n', (390, 392), False, 'import requests\n'), ((629, 663), 're.compile', 're.compile', (['"""<a class="iusc" .*?>"""'], {}), '(\'<a class="iusc" .*?>\')\n', (639, 663), False, 'import re\n'), ((671, 699), 're.compile', 're.compile', (['""""murl":"(.*?)\... |
#!/usr/bin/env python
from .greengraph import GreenGraph
from .googlemap import GoogleMap
from argparse import ArgumentParser
from IPython.display import Image
from IPython.display import display
if __name__ == "__main__":
parser = ArgumentParser(description = 'Generate pictures between 2 location')
parser.add_argu... | [
"argparse.ArgumentParser"
] | [((235, 301), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Generate pictures between 2 location"""'}), "(description='Generate pictures between 2 location')\n", (249, 301), False, 'from argparse import ArgumentParser\n')] |
import os
import sys
import unittest
import launch_testing.asserts
sys.path.append(os.path.dirname(__file__))
from move_group_launch_test_common import generate_move_group_test_description
def generate_test_description():
return generate_move_group_test_description(gtest_name='move_group_ompl_constraints_test')
... | [
"os.path.dirname",
"move_group_launch_test_common.generate_move_group_test_description"
] | [((84, 109), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (99, 109), False, 'import os\n'), ((235, 323), 'move_group_launch_test_common.generate_move_group_test_description', 'generate_move_group_test_description', ([], {'gtest_name': '"""move_group_ompl_constraints_test"""'}), "(gtest_name... |
# -*- coding: utf-8 -*-
# Created by: ZhaoDongshuang
# Created on: 18-2-7
""" ๅฎไน learning_logs ็ URL ๆจกๅผ """
from django.conf.urls import url
from . import views
app_name = 'learning_logs'
urlpatterns = [
# ไธป้กต
url(r'^$', views.index, name='index'),
# ๆพ็คบๆๆ็ไธป้ข
url(r'^topics/$', views.topics, name='topic... | [
"django.conf.urls.url"
] | [((220, 256), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (223, 256), False, 'from django.conf.urls import url\n'), ((277, 322), 'django.conf.urls.url', 'url', (['"""^topics/$"""', 'views.topics'], {'name': '"""topics"""'}), "('^topics/$'... |
from collections import defaultdict
from io import StringIO
from random import choice
from packaging.version import Version
from pysvc import errors as svc_errors
from pysvc.unified.client import connect
from pysvc.unified.response import CLIFailureError, SVCResponse
from retry import retry
import controller.array_ac... | [
"controller.array_action.errors.MappingError",
"collections.defaultdict",
"controller.array_action.errors.ExpectedSnapshotButFoundVolumeError",
"controller.array_action.errors.StorageManagementIPsNotSupportError",
"controller.array_action.errors.VolumeAlreadyExists",
"controller.array_action.errors.Volume... | [((851, 870), 'controller.common.csi_logger.get_stdout_logger', 'get_stdout_logger', ([], {}), '()\n', (868, 870), False, 'from controller.common.csi_logger import get_stdout_logger\n'), ((20224, 20287), 'retry.retry', 'retry', (['svc_errors.StorageArrayClientException'], {'tries': '(5)', 'delay': '(1)'}), '(svc_errors... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 30 13:23:53 2019
@author: casimp
"""
import numpy as np
import csv
import matplotlib.pyplot as plt
from cpex.transformation import strain_transformation
class Extract():
def __init__(self):
pass
def extract_grains(self, data='elastic', idx=... | [
"numpy.moveaxis",
"numpy.sum",
"numpy.abs",
"numpy.ones",
"numpy.argsort",
"matplotlib.pyplot.contourf",
"numpy.arange",
"numpy.unique",
"numpy.nanmean",
"numpy.meshgrid",
"numpy.zeros_like",
"numpy.transpose",
"matplotlib.pyplot.colorbar",
"numpy.cumsum",
"numpy.max",
"numpy.linspace"... | [((2844, 2872), 'numpy.argsort', 'np.argsort', (['euc_dist'], {'axis': '(0)'}), '(euc_dist, axis=0)\n', (2854, 2872), True, 'import numpy as np\n'), ((6900, 6912), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (6910, 6912), True, 'import matplotlib.pyplot as plt\n'), ((6921, 6934), 'matplotlib.pyplot.ylab... |
# -*- coding: utf-8 -*-
"""
ะะพะดัะปั ั ะพัะฝะพะฒะฝะพะน ะปะพะณะธะบะพะน ะดะปั ะดะตะบะพัะฐัะพัะฐ.
ะะปั ะพะฑัะตะฝะธั ั ะฝะพะดะพะน(Chrome/Node.js) ะธัะฟะพะปัะทัะตััั Chrome DevTools Protocol:
https://chromedevtools.github.io/devtools-protocol/
"""
import inspect
import pathlib
import shutil
import xml.etree.ElementTree as xml
from functools import wraps
from time ... | [
"shutil.make_archive",
"sealant.logger.set_logger",
"xml.etree.ElementTree.ElementTree",
"inspect.isclass",
"xml.etree.ElementTree.Element",
"inspect.isfunction",
"sealant.heapfile_processing.check_leak_with_timeline",
"time.time",
"sealant.cdp.DevToolsProtocolConnection",
"time.sleep",
"pathlib... | [((663, 678), 'sealant.config.SeaLantConfig', 'SeaLantConfig', ([], {}), '()\n', (676, 678), False, 'from sealant.config import SeaLantConfig\n'), ((2447, 2459), 'sealant.logger.set_logger', 'set_logger', ([], {}), '()\n', (2457, 2459), False, 'from sealant.logger import log, set_logger\n'), ((2485, 2540), 'sealant.cdp... |
from sklearn.decomposition import PCA
import pandas as pd
import matplotlib.pyplot as plt
from brightics.common.report import ReportBuilder, strip_margin, pandasDF2MD, plt2MD, dict2MD
from brightics.function.utils import _model_dict
from brightics.common.groupby import _function_by_group
from brightics.common.uti... | [
"pandas.DataFrame",
"matplotlib.pyplot.clf",
"matplotlib.pyplot.scatter",
"brightics.function.utils._model_dict",
"matplotlib.pyplot.figure",
"sklearn.decomposition.PCA",
"brightics.common.report.plt2MD",
"brightics.common.report.ReportBuilder",
"brightics.common.utils.check_required_parameters",
... | [((407, 457), 'brightics.common.utils.check_required_parameters', 'check_required_parameters', (['_pca', 'params', "['table']"], {}), "(_pca, params, ['table'])\n", (432, 457), False, 'from brightics.common.utils import check_required_parameters\n'), ((967, 1045), 'sklearn.decomposition.PCA', 'PCA', (['n_components', '... |
from __future__ import print_function, absolute_import, division
import numpy as np
from poseutils.logger import log
from poseutils.datasets.unprocessed.Dataset import Dataset
class TDPWDataset(Dataset):
"""Dataset class for handling 3DPW dataset
:param path: path to npz file
:type path: str
... | [
"numpy.load",
"poseutils.logger.log"
] | [((885, 907), 'poseutils.logger.log', 'log', (['"""Loaded raw data"""'], {}), "('Loaded raw data')\n", (888, 907), False, 'from poseutils.logger import log\n'), ((483, 534), 'numpy.load', 'np.load', (['path'], {'allow_pickle': '(True)', 'encoding': '"""latin1"""'}), "(path, allow_pickle=True, encoding='latin1')\n", (49... |
# 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",
"numpy.deg2rad"
] | [((711, 806), 'makani.config.mconfig.Config', 'mconfig.Config', ([], {'deps': "{'gs_model': 'base_station.gs_model', 'test_site': 'common.test_site'}"}), "(deps={'gs_model': 'base_station.gs_model', 'test_site':\n 'common.test_site'})\n", (725, 806), False, 'from makani.config import mconfig\n'), ((2688, 2706), 'num... |
import sys
sys.path.append('./')
from unittest import TestCase
from SumpOverflowAlert.Calibration.Calibrator import Calibrator
from SumpOverflowAlert import config
class TestCalibrator(TestCase):
def __init__(self, method_name='runTest'):
super().__init__(method_name)
def setUp(self):
confi... | [
"sys.path.append",
"SumpOverflowAlert.Calibration.Calibrator.Calibrator"
] | [((12, 33), 'sys.path.append', 'sys.path.append', (['"""./"""'], {}), "('./')\n", (27, 33), False, 'import sys\n'), ((429, 441), 'SumpOverflowAlert.Calibration.Calibrator.Calibrator', 'Calibrator', ([], {}), '()\n', (439, 441), False, 'from SumpOverflowAlert.Calibration.Calibrator import Calibrator\n')] |
from lex import *
import sys
def main():
print("Mini Java Compiler - Lexer Test")
if len(sys.argv) != 2:
sys.exit("Error: Compiler needs source file as argument.")
with open(sys.argv[1], 'r') as f:
buffer = f.read()
lexer = Lexer(buffer)
filler = ""
# Token stream test
... | [
"sys.exit"
] | [((124, 182), 'sys.exit', 'sys.exit', (['"""Error: Compiler needs source file as argument."""'], {}), "('Error: Compiler needs source file as argument.')\n", (132, 182), False, 'import sys\n')] |
from ticTacToe import *
from neuralNetwork import *
from math import sqrt
from math import floor
class AITrainer:
def __init__(self, numberOfAIs):
self.AIList = []
self.numberOfAIs = numberOfAIs
self.numberOfSurvivingAIs = floor(sqrt(numberOfAIs))
self.trainingStarted=0
for ... | [
"math.floor",
"math.sqrt"
] | [((258, 275), 'math.sqrt', 'sqrt', (['numberOfAIs'], {}), '(numberOfAIs)\n', (262, 275), False, 'from math import sqrt\n'), ((2144, 2161), 'math.floor', 'floor', (['(answer / 3)'], {}), '(answer / 3)\n', (2149, 2161), False, 'from math import floor\n')] |
import struct
from typing import BinaryIO
from PIL import Image
from PIL.ImageFile import PyDecoder
class TileDecoder(PyDecoder):
def decode(self, b: bytes):
if len(b) % 8 != 0:
raise Exception("tile too smol")
width = self.state.xsize
if width % 8 != 0:
raise Exception("canvas too smol")
raw = byt... | [
"PIL.Image.register_decoder",
"struct.unpack"
] | [((909, 952), 'PIL.Image.register_decoder', 'Image.register_decoder', (['"""tile"""', 'TileDecoder'], {}), "('tile', TileDecoder)\n", (931, 952), False, 'from PIL import Image\n'), ((2328, 2375), 'PIL.Image.register_decoder', 'Image.register_decoder', (['"""sprite"""', 'SpriteDecoder'], {}), "('sprite', SpriteDecoder)\... |
from django.db import models
from django.contrib.auth.models import User
from django.contrib.postgres.search import TrigramSimilarity
from django.core.exceptions import ObjectDoesNotExist
from django.conf import settings
from StreamServerApp.subtitles import get_subtitles
from StreamServerApp.media_processing import co... | [
"django.db.models.FileField",
"subprocess.run",
"django.contrib.postgres.search.TrigramSimilarity",
"django.db.models.ManyToManyField",
"StreamServerApp.media_management.fileinfo.readfileinfo",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.PositiveSmallIntegerField",
... | [((783, 815), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(300)'}), '(max_length=300)\n', (799, 815), False, 'from django.db import models\n'), ((833, 872), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)'}), '(auto_now_add=True)\n', (853, 872), False, ... |
import asyncio
import json
from pymongo import ReadPreference
from werkzeug.datastructures import MultiDict
from analyzers import get_analyzer
from api import APIError, APIHandler
from blueprints.assets.models import Asset
from workers.tasks import AnalyzeTask
from .document import BaseCollectionHandler, BaseDocumen... | [
"asyncio.gather",
"blueprints.assets.models.Asset.with_options",
"workers.tasks.AnalyzeTask",
"analyzers.get_analyzer",
"api.APIError"
] | [((3262, 3331), 'workers.tasks.AnalyzeTask', 'AnalyzeTask', (['self.account._id', 'asset._id', 'analyzers', 'notification_url'], {}), '(self.account._id, asset._id, analyzers, notification_url)\n', (3273, 3331), False, 'from workers.tasks import AnalyzeTask\n'), ((723, 792), 'api.APIError', 'APIError', (['"""invalid_re... |
#--------------------------------------- RE par el lexer---------------------------------------
import re
import ply.lex as lex # Scanner
import ply.yacc as yacc
import math as math
import lexico
AuxList = ['temp', 'tempo']
Cuartetos = []
Temporales = []
Saltos = []
Scope = ['GLOBAL']
parametros = {}
size... | [
"math.ceil",
"asignadorMemoria.AsignadorMemoria",
"stack.Stack",
"ply.yacc.yacc",
"directory.Directory",
"tablaConstantes.TablaConstantes",
"tablaOperaciones.TablaOperaciones"
] | [((842, 849), 'stack.Stack', 'Stack', ([], {}), '()\n', (847, 849), False, 'from stack import Stack\n'), ((859, 866), 'stack.Stack', 'Stack', ([], {}), '()\n', (864, 866), False, 'from stack import Stack\n'), ((875, 882), 'stack.Stack', 'Stack', ([], {}), '()\n', (880, 882), False, 'from stack import Stack\n'), ((891, ... |
import os
import csv
import sys
import time
import json
import h5py
import pickle as pkl
import logging
import argparse
import random
from collections import OrderedDict
import torch
import numpy as np
from tqdm import tqdm, trange
from nglib.common import utils
def get_arguments(argv):
parser = argparse.Argume... | [
"nglib.common.utils.get_root_logger",
"nglib.common.utils.bin_config",
"h5py.File",
"numpy.random.seed",
"argparse.ArgumentParser",
"random.randint",
"torch.manual_seed",
"random.shuffle",
"time.time",
"random.seed",
"collections.OrderedDict",
"os.path.join",
"os.listdir",
"numpy.concatena... | [((305, 370), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""more intrinsic evaluations"""'}), "(description='more intrinsic evaluations')\n", (328, 370), False, 'import argparse\n'), ((1360, 1377), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1371, 1377), False, 'import ra... |
# Copyright 2017 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... | [
"tensorflow.summary.image",
"tensorflow.nn.zero_fraction",
"tensorflow.add_n",
"tensorflow.summary.scalar",
"tensorflow.reduce_mean",
"tensorflow.variable_scope",
"tensorflow.add",
"tensorflow.concat",
"tensorflow.ones_like",
"tensorflow.zeros_like",
"tensorflow.summary.histogram",
"collection... | [((1347, 1395), 're.sub', 're.sub', (["('%s_[0-9]*/' % TOWER_NAME)", '""""""', 'x.op.name'], {}), "('%s_[0-9]*/' % TOWER_NAME, '', x.op.name)\n", (1353, 1395), False, 'import re\n'), ((1398, 1451), 'tensorflow.summary.histogram', 'tf.summary.histogram', (["(tensor_name + '/activations')", 'x'], {}), "(tensor_name + '/a... |
import unicodedata
def filter_accents(text):
"""Return a sequence of accented characters found in
the passed in lowercased text string
"""
# decomposition return base char + added symbol or ''
# you could also use unicodedata.normalize
return {char for char in text.lower() if unicodedata.de... | [
"unicodedata.decomposition"
] | [((306, 337), 'unicodedata.decomposition', 'unicodedata.decomposition', (['char'], {}), '(char)\n', (331, 337), False, 'import unicodedata\n')] |
# RUN: %PYTHON %s
import numpy as np
from shark.shark_importer import SharkImporter
import pytest
model_path = "https://tfhub.dev/tensorflow/lite-model/albert_lite_base/squadv1/1?lite-format=tflite"
# Inputs modified to be useful albert inputs.
def generate_inputs(input_details):
for input in input_details:
... | [
"numpy.random.randint",
"numpy.zeros",
"numpy.ones",
"shark.shark_importer.SharkImporter"
] | [((905, 1038), 'shark.shark_importer.SharkImporter', 'SharkImporter', ([], {'model_path': 'model_path', 'model_type': '"""tflite"""', 'model_source_hub': '"""tfhub"""', 'device': '"""cpu"""', 'dynamic': '(False)', 'jit_trace': '(True)'}), "(model_path=model_path, model_type='tflite', model_source_hub=\n 'tfhub', dev... |
from typing import List, Tuple, Optional
import numpy as np
import os
import torch
from torch import nn
from environments.environment_abstract import Environment, State
from collections import OrderedDict
import re
from random import shuffle
from torch import Tensor
import torch.optim as optim
from torch.optim.optimize... | [
"numpy.random.choice",
"torch.nn.MSELoss",
"numpy.maximum",
"random.shuffle",
"torch.load",
"torch.multiprocessing.get_context",
"numpy.zeros",
"torch.nn.DataParallel",
"time.time",
"os.environ.get",
"torch.cuda.is_available",
"torch.device",
"collections.OrderedDict",
"torch.tensor",
"r... | [((904, 963), 'numpy.random.choice', 'np.random.choice', (['num_examples', 'num_examples'], {'replace': '(False)'}), '(num_examples, num_examples, replace=False)\n', (920, 963), True, 'import numpy as np\n'), ((1661, 1673), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (1671, 1673), False, 'from torch import nn\n... |
from cms.models import CMSPlugin
from django.db import models
from django.utils.translation import ugettext_lazy as _
class CarouselPlugin(CMSPlugin):
interval = models.PositiveIntegerField(_('Interval'), default=5)
title = models.CharField(_('Title'), max_length=255, default='', blank=True)
def __str__(... | [
"django.utils.translation.ugettext_lazy"
] | [((196, 209), 'django.utils.translation.ugettext_lazy', '_', (['"""Interval"""'], {}), "('Interval')\n", (197, 209), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((251, 261), 'django.utils.translation.ugettext_lazy', '_', (['"""Title"""'], {}), "('Title')\n", (252, 261), True, 'from django.utils.... |
"""
because tests are good?
"""
import pytorch_lightning as pl
from pytorch_lightning import Trainer
from pytorch_lightning.callbacks import ModelCheckpoint
from simple_qnet import QNetLightning
import gym
import pandas as pd
env = gym.make("CartPole-v0")
# from env_catch import CatchEnv
# env = CatchEnv({"simplif... | [
"pytorch_lightning.Trainer",
"gym.make",
"simple_qnet.QNetLightning"
] | [((236, 259), 'gym.make', 'gym.make', (['"""CartPole-v0"""'], {}), "('CartPole-v0')\n", (244, 259), False, 'import gym\n'), ((341, 359), 'simple_qnet.QNetLightning', 'QNetLightning', (['env'], {}), '(env)\n', (354, 359), False, 'from simple_qnet import QNetLightning\n'), ((371, 395), 'pytorch_lightning.Trainer', 'Train... |
from report1 import main_report1
from report2 import main_report2
from report3 import main_report3
from report4 import main_report4
def banner(message, border='*'):
line = border * 73
print("\n")
print(line)
print(message)
print(line)
def report1():
print("Iniciando informe 1...... | [
"report1.main_report1",
"report2.main_report2",
"report4.main_report4",
"report3.main_report3"
] | [((328, 342), 'report1.main_report1', 'main_report1', ([], {}), '()\n', (340, 342), False, 'from report1 import main_report1\n'), ((401, 415), 'report2.main_report2', 'main_report2', ([], {}), '()\n', (413, 415), False, 'from report2 import main_report2\n'), ((474, 488), 'report3.main_report3', 'main_report3', ([], {})... |
import lights
from tools import xbmclog
class AmbilightController(lights.Controller):
def __init__(self, *args, **kwargs):
super(AmbilightController, self).__init__(*args, **kwargs)
def on_playback_start(self):
if self.settings.ambilight_start_dim_enable:
self.save_state_as_initia... | [
"tools.xbmclog"
] | [((337, 434), 'tools.xbmclog', 'xbmclog', (['"""Kodi Hue: In AmbilightController.on_playback_start() dimming ambilight group"""'], {}), "(\n 'Kodi Hue: In AmbilightController.on_playback_start() dimming ambilight group'\n )\n", (344, 434), False, 'from tools import xbmclog\n'), ((699, 798), 'tools.xbmclog', 'xbmc... |
import cv2
import numpy as np
from imutils import perspective, rotate_bound
from pymatting import estimate_alpha_knn, estimate_foreground_ml, stack_images
from typing import Tuple
PAPER_SIZE = (1485, 1050)
def find_paper(image_bgr: np.ndarray) -> np.ndarray:
image_hsv = cv2.cvtColor(image_bgr, cv2.COLOR_BGR2HS... | [
"cv2.approxPolyDP",
"numpy.ones",
"numpy.argmin",
"cv2.erode",
"cv2.inRange",
"cv2.contourArea",
"numpy.zeros_like",
"cv2.cvtColor",
"numpy.max",
"imutils.perspective.four_point_transform",
"cv2.drawContours",
"cv2.resize",
"numpy.uint8",
"numpy.min",
"cv2.convexHull",
"numpy.squeeze",... | [((280, 322), 'cv2.cvtColor', 'cv2.cvtColor', (['image_bgr', 'cv2.COLOR_BGR2HSV'], {}), '(image_bgr, cv2.COLOR_BGR2HSV)\n', (292, 322), False, 'import cv2\n'), ((340, 390), 'cv2.inRange', 'cv2.inRange', (['image_hsv', '(0, 0, 90)', '(180, 60, 255)'], {}), '(image_hsv, (0, 0, 90), (180, 60, 255))\n', (351, 390), False, ... |
from collections import namedtuple
from envs.custom_tol_env_dir.tol_2d.state import TolState, BallPositions
"""
Maps State to the ball positions on the pegs.
Possible ball positions are as follows:
- - 33
- 22 32
11 21 31
First number denotes position of the red ball,
second number denotes position if ... | [
"envs.custom_tol_env_dir.tol_2d.state.BallPositions",
"collections.namedtuple",
"envs.custom_tol_env_dir.tol_2d.state.TolState"
] | [((416, 430), 'envs.custom_tol_env_dir.tol_2d.state.TolState', 'TolState', (['(1)', '(1)'], {}), '(1, 1)\n', (424, 430), False, 'from envs.custom_tol_env_dir.tol_2d.state import TolState, BallPositions\n'), ((464, 478), 'envs.custom_tol_env_dir.tol_2d.state.TolState', 'TolState', (['(1)', '(2)'], {}), '(1, 2)\n', (472,... |
from chips.api.api import Input, Output
from pytun import TunTapDevice, IFF_TAP, IFF_NO_PI
import Queue
import threading
class VirtualNetworkCard:
def __init__(self, ip='192.168.1.0', netmask='255.255.255.0'):
tap = TunTapDevice(flags=IFF_TAP|IFF_NO_PI, name="tap0")
tap.mtu = 1500
tap.addr... | [
"threading.Thread",
"chips.api.api.Output.__init__",
"Queue.Queue",
"pytun.TunTapDevice",
"chips.api.api.Input.__init__"
] | [((230, 282), 'pytun.TunTapDevice', 'TunTapDevice', ([], {'flags': '(IFF_TAP | IFF_NO_PI)', 'name': '"""tap0"""'}), "(flags=IFF_TAP | IFF_NO_PI, name='tap0')\n", (242, 282), False, 'from pytun import TunTapDevice, IFF_TAP, IFF_NO_PI\n'), ((477, 510), 'chips.api.api.Output.__init__', 'Output.__init__', (['self', 'chip',... |
# -*- coding: utf-8 -*-
import pytest
from pyramid.path import DottedNameResolver
from shapely.geometry import MultiPolygon, Polygon
from pyramid_oereb.lib.config import Config
from pyramid_oereb.lib.records.extract import ExtractRecord
from pyramid_oereb.lib.records.plr import PlrRecord
from pyramid_oereb.lib.records... | [
"shapely.geometry.Polygon",
"pyramid_oereb.lib.config.Config.get",
"pyramid_oereb.lib.records.view_service.ViewServiceRecord",
"pyramid_oereb.lib.config.Config.get_plr_cadastre_authority",
"shapely.geometry.MultiPolygon",
"tests.mockrequest.MockParameter",
"pyramid_oereb.lib.readers.extract.ExtractReade... | [((627, 662), 'pyramid_oereb.lib.config.Config.get_plr_cadastre_authority', 'Config.get_plr_cadastre_authority', ([], {}), '()\n', (660, 662), False, 'from pyramid_oereb.lib.config import Config\n'), ((692, 710), 'pyramid_oereb.lib.config.Config.get', 'Config.get', (['"""plrs"""'], {}), "('plrs')\n", (702, 710), False,... |
import os
os.path.dirname(os.path.abspath(__file__)+'/../../')
from QNetbots.core_bot_api.matrix_bot_api import MatrixBotAPI
from QNetbots.core_bot_api.mregex_handler import MRegexHandler
from QNetbots.core_bot_api.mcommand_handler import MCommandHandler
class Bot(object):
def __init__(self, USERNAME,PASSWORD,SE... | [
"os.path.abspath",
"QNetbots.core_bot_api.matrix_bot_api.MatrixBotAPI",
"QNetbots.core_bot_api.mcommand_handler.MCommandHandler",
"QNetbots.core_bot_api.mregex_handler.MRegexHandler"
] | [((26, 51), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (41, 51), False, 'import os\n'), ((346, 386), 'QNetbots.core_bot_api.matrix_bot_api.MatrixBotAPI', 'MatrixBotAPI', (['USERNAME', 'PASSWORD', 'SERVER'], {}), '(USERNAME, PASSWORD, SERVER)\n', (358, 386), False, 'from QNetbots.core_bot_... |
#!/usr/bin/env python3
from unittest.mock import call, patch
import pytest
from pytest import raises
from vang.tfs.get_projects import get_projects, main, parse_args
def test_get_projects():
assert [] == get_projects(None)
assert [] == get_projects([])
with patch(
'vang.tfs.get_projects.cal... | [
"unittest.mock.patch",
"pytest.raises",
"vang.tfs.get_projects.main",
"vang.tfs.get_projects.get_projects",
"pytest.mark.parametrize",
"unittest.mock.call"
] | [((1405, 1456), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""args"""', "['', '-n n -p -p']"], {}), "('args', ['', '-n n -p -p'])\n", (1428, 1456), False, 'import pytest\n'), ((1588, 1888), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""args, expected"""', "[['o1 o2', {'names': False, 'organi... |
import pandas as pd
import tensorflow as tf
import os
from tensorflow._api.v2 import data
# TODO is jpeg and write log of how many and what is filtered
def load_meta(path):
meta = pd.read_csv(path)
ids = [id-1 for id in meta.id.values]
wnid_to_id = tf.lookup.StaticHashTable(
initializer=tf.looku... | [
"tensorflow.strings.split",
"pandas.read_csv",
"tensorflow.io.is_jpeg",
"tensorflow.io.decode_jpeg",
"tensorflow.data.Dataset.zip",
"os.sep.join",
"tensorflow.io.read_file",
"tensorflow.image.resize",
"tensorflow.lookup.KeyValueTensorInitializer",
"tensorflow.image.convert_image_dtype"
] | [((188, 205), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (199, 205), True, 'import pandas as pd\n'), ((540, 576), 'tensorflow.strings.split', 'tf.strings.split', (['file_name'], {'sep': '"""_"""'}), "(file_name, sep='_')\n", (556, 576), True, 'import tensorflow as tf\n'), ((707, 747), 'tensorflow.io.... |
import config
from models import BlockModel
import datetime
import uuid
from utilities import AppContext
from anuvaad_auditor.loghandler import log_info, log_exception
import time
class FileContentRepositories:
def __init__(self):
self.blockModel = BlockModel()
def create_block_info(self, block, r... | [
"models.BlockModel",
"uuid.uuid4",
"utilities.AppContext.getContext",
"time.time",
"datetime.datetime.utcnow",
"utilities.AppContext.addRecordID"
] | [((266, 278), 'models.BlockModel', 'BlockModel', ([], {}), '()\n', (276, 278), False, 'from models import BlockModel\n'), ((461, 487), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (485, 487), False, 'import datetime\n'), ((992, 1004), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (1002, 100... |
import os
from pathlib import Path
import pandas as pd
#######################
## folders ##
#######################
def get_result_dir():
folder = Path(Path.home(), 'fao_cropland_results')
folder.mkdir(parents=True, exist_ok=True)
return str(folder)
def get_tmp_dir():
folder = Path(Path.h... | [
"os.path.dirname",
"pathlib.Path.home"
] | [((170, 181), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (179, 181), False, 'from pathlib import Path\n'), ((314, 325), 'pathlib.Path.home', 'Path.home', ([], {}), '()\n', (323, 325), False, 'from pathlib import Path\n'), ((473, 498), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (4... |
import tkinter as tk
from tkinter import filedialog
from tkinter import *
from PIL import ImageTk ,Image
import numpy as np
from keras.models import load_model
#load the model
model = load_model('traffic_classifier.h5')
#defince the class labels in the dictionary
classes = { 1:'Speed limit (20km/h)',
2:'S... | [
"keras.models.load_model",
"PIL.ImageTk.PhotoImage",
"numpy.expand_dims",
"tkinter.filedialog.askopenfilename",
"PIL.Image.open",
"numpy.array",
"tkinter.Tk"
] | [((185, 220), 'keras.models.load_model', 'load_model', (['"""traffic_classifier.h5"""'], {}), "('traffic_classifier.h5')\n", (195, 220), False, 'from keras.models import load_model\n'), ((1873, 1880), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (1878, 1880), True, 'import tkinter as tk\n'), ((2147, 2168), 'PIL.Image.open'... |
"""
Updated version of the MPyC Coroutine code file
A few alterations have been made to ensure that type hinting can be applied properly
"""
import functools
import sys
from asyncio import Future, Task
from typing import (
Any,
Callable,
Coroutine,
Generator,
Generic,
List,
Optional,
Ty... | [
"asyncio.Task",
"mpyc.asyncoro.__reconcile",
"typing.get_type_hints",
"sys._getframe",
"mpyc.asyncoro._nested_list",
"mpyc.asyncoro._reconcile",
"functools.wraps",
"mpyc.asyncoro._ProgramCounterWrapper",
"typing.TypeVar",
"mpyc.asyncoro._ncopy"
] | [((926, 950), 'typing.TypeVar', 'TypeVar', (['"""SecureElement"""'], {}), "('SecureElement')\n", (933, 950), False, 'from typing import Any, Callable, Coroutine, Generator, Generic, List, Optional, Type, TypeVar, Union, get_type_hints\n'), ((5843, 5862), 'typing.TypeVar', 'TypeVar', (['"""SomeType"""'], {}), "('SomeTyp... |
from unittest import mock
import pytest
import mongomock
DB_TEST = mongomock.MongoClient().tests_solanches
@pytest.fixture(scope='session', autouse=True)
def teardown():
mock.patch('solanches.authenticate.jwt_required', lambda x: x).start()
mock.patch('solanches.connect2db.DB', DB_TEST).start()
mock.pat... | [
"solanches.models.DB.produto.delete_many",
"solanches.models.DB.block_list.delete_many",
"solanches.models.DB.cardapio.delete_many",
"pytest.fixture",
"unittest.mock.patch",
"mongomock.MongoClient",
"solanches.models.DB.comercio.delete_many"
] | [((112, 157), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'autouse': '(True)'}), "(scope='session', autouse=True)\n", (126, 157), False, 'import pytest\n'), ((69, 92), 'mongomock.MongoClient', 'mongomock.MongoClient', ([], {}), '()\n', (90, 92), False, 'import mongomock\n'), ((632, 666), 'solanc... |
from flask import request, render_template, flash, session, Markup, redirect, url_for
from signage_server_app import app
import json
import yaml
import os
curdir = os.path.dirname(os.path.realpath(__file__))
# HTML Snippets
snippets = dict()
for file in os.listdir(os.path.join(curdir, "templates", "snippets")):
if... | [
"os.path.realpath",
"flask.session.get",
"json.dumps",
"flask.url_for",
"os.path.splitext",
"flask.render_template",
"signage_server_app.app.route",
"os.path.join"
] | [((602, 616), 'signage_server_app.app.route', 'app.route', (['"""/"""'], {}), "('/')\n", (611, 616), False, 'from signage_server_app import app\n'), ((618, 657), 'signage_server_app.app.route', 'app.route', (['"""/displays"""'], {'methods': "['GET']"}), "('/displays', methods=['GET'])\n", (627, 657), False, 'from signa... |
import sys, heapq
input = sys.stdin.readline
# constant
INF = 1234567
# function
def dijkstra(n, x, road):
visited = [False for _ in range(n + 1)]
time = [INF for _ in range(n + 1)]
time[x] = 0
h = [(INF, i) for i in range(1, n + 1)]
h.append((0, x))
heapq.heapify(h)
while h:
_, cur = heapq.heappop(h)
... | [
"heapq.heappush",
"heapq.heapify",
"heapq.heappop"
] | [((261, 277), 'heapq.heapify', 'heapq.heapify', (['h'], {}), '(h)\n', (274, 277), False, 'import sys, heapq\n'), ((300, 316), 'heapq.heappop', 'heapq.heappop', (['h'], {}), '(h)\n', (313, 316), False, 'import sys, heapq\n'), ((466, 503), 'heapq.heappush', 'heapq.heappush', (['h', '(time[next], next)'], {}), '(h, (time[... |
import os
basedir = os.path.abspath(os.path.dirname(__file__))
WTF_CSRF_ENABLED = True
SECRET_KEY = '33stanlake#'
DEBUG = True
TESTING = True
LIVESERVER_PORT = 5000
APP_TITLE = 'Data Driven Simulation Management Database'
VERSION = '0.1-dev'
MONGODB_SETTINGS = {
'db': 'ddsm-integrate',
'host': 'localhost',... | [
"os.path.dirname"
] | [((36, 61), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (51, 61), False, 'import os\n')] |
#!/usr/bin/env python
'''
Autor: <NAME>
Licencia: MIT (Ver License)
Fecha: 5 de febrero de 2021
'''
import vlc
import time
import os
import re
import random
# Reproduccion de canciones
def playMusic():
for cancion in musica:
instance = vlc.Instance()
media = instance.media_new(cancion)
pla... | [
"random.shuffle",
"os.walk",
"re.search",
"vlc.Instance",
"os.path.join"
] | [((1537, 1558), 'os.walk', 'os.walk', (['"""/media/pi/"""'], {}), "('/media/pi/')\n", (1544, 1558), False, 'import os\n'), ((2330, 2352), 'random.shuffle', 'random.shuffle', (['musica'], {}), '(musica)\n', (2344, 2352), False, 'import random\n'), ((2380, 2402), 'random.shuffle', 'random.shuffle', (['videos'], {}), '(vi... |
from groupon.services import list_alive_groupon_by_product_ids
from logs.services import create_product_log
from order.selectors import list_order_with_order_details_by_product_id
def list_order_with_order_details_by_product_id_interface(shop_id: int, product_id: int):
"""้่ฟ่ดงๅIDๅๅบ่ฎขๅ,ๅธฆ่ฎขๅ่ฏฆๆ
"""
order_list = list... | [
"logs.services.create_product_log",
"order.selectors.list_order_with_order_details_by_product_id",
"groupon.services.list_alive_groupon_by_product_ids"
] | [((316, 380), 'order.selectors.list_order_with_order_details_by_product_id', 'list_order_with_order_details_by_product_id', (['shop_id', 'product_id'], {}), '(shop_id, product_id)\n', (359, 380), False, 'from order.selectors import list_order_with_order_details_by_product_id\n'), ((524, 570), 'groupon.services.list_ali... |
import matplotlib.pyplot as plt
import numpy as np
from typing import Callable
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import datasets, layers, models
import skimage
from skimage.metrics import structural_similarity as ssim
from sklearn.model_selection import train_test_split
from de... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplot",
"tensorflow.keras.layers.BatchNormalization",
"deep_raman.utils.generate_training_set",
"sklearn.model_selection.train_test_split",
"tensorflow.keras.Input",
"tensorflow.keras.layers.Conv1D",
"tensorflow.keras.layers.MaxPooling1D",
"tensorflow.... | [((461, 489), 'numpy.linspace', 'np.linspace', (['(-200)', '(200)', '(1024)'], {}), '(-200, 200, 1024)\n', (472, 489), True, 'import numpy as np\n'), ((502, 554), 'deep_raman.utils.generate_training_set', 'utils.generate_training_set', (['x'], {'num_base_examples': '(64)'}), '(x, num_base_examples=64)\n', (529, 554), F... |
from flask import Response
from thupoll.models import Vote
from tests.factories import Factory
from tests.utils import marshall, get_past_datetime
def test__marshall(vote):
assert marshall(vote) == dict(
id=vote.id,
created=vote.created_date.isoformat(),
updated=vote.change_date.isoformat... | [
"tests.factories.Factory.themepoll",
"tests.factories.Factory.vote",
"tests.utils.get_past_datetime",
"tests.utils.marshall"
] | [((525, 553), 'tests.factories.Factory.themepoll', 'Factory.themepoll', ([], {'poll': 'poll'}), '(poll=poll)\n', (542, 553), False, 'from tests.factories import Factory\n'), ((558, 591), 'tests.factories.Factory.vote', 'Factory.vote', ([], {'themepoll': 'themepoll'}), '(themepoll=themepoll)\n', (570, 591), False, 'from... |
import curses
from curses import textpad
import os
import threading
import traceback
import time
import client
import curses_util
class GUI():
def __init__(self, stdscr):
global client_obj
self.client_obj = client_obj
self.username = 'G'
self.password = 'password'
self.y = 10
self.ms... | [
"threading.Thread",
"traceback.print_exc",
"curses.resize_term",
"curses.noecho",
"curses.wrapper",
"curses.endwin",
"curses.start_color",
"time.sleep",
"os._exit",
"curses.curs_set"
] | [((5978, 5997), 'curses.wrapper', 'curses.wrapper', (['GUI'], {}), '(GUI)\n', (5992, 5997), False, 'import curses\n'), ((466, 481), 'curses.noecho', 'curses.noecho', ([], {}), '()\n', (479, 481), False, 'import curses\n'), ((485, 503), 'curses.curs_set', 'curses.curs_set', (['(0)'], {}), '(0)\n', (500, 503), False, 'im... |
import os
import nlp
import json
import random
import datetime
import tokenizers
import numpy as np
import transformers
import pandas as pd
import tensorflow as tf
import plotly.express as px
import matplotlib.pyplot as plt
from sklearn.utils import shuffle
def getUnbatchedDataset(trainDataSet, modelName, maxLength=6... | [
"transformers.AutoTokenizer.from_pretrained",
"tensorflow.data.Dataset.from_tensor_slices"
] | [((531, 599), 'transformers.AutoTokenizer.from_pretrained', 'transformers.AutoTokenizer.from_pretrained', (['modelName'], {'use_fast': '(True)'}), '(modelName, use_fast=True)\n', (573, 599), False, 'import transformers\n'), ((1578, 1625), 'tensorflow.data.Dataset.from_tensor_slices', 'tf.data.Dataset.from_tensor_slices... |
#!pcsx2py
# This volatile module `monitor.00000000` may be re-loaded and loose all variables on some events:
# - Game startup (on _reloadElfInfo)
# - Resume, where it is suspended by pressing ESC key (on AppCoreThread::Resume)
# Not:
# - Resume, where it is suspended by System menu โ Pause
# - Load game state
... | [
"pcsx2.WriteLn"
] | [((338, 360), 'pcsx2.WriteLn', 'pcsx2.WriteLn', (['"""Hello"""'], {}), "('Hello')\n", (351, 360), False, 'import pcsx2\n')] |
from itertools import count as memoryhog
list(memoryhog(0)) | [
"itertools.count"
] | [((49, 61), 'itertools.count', 'memoryhog', (['(0)'], {}), '(0)\n', (58, 61), True, 'from itertools import count as memoryhog\n')] |
#!/usr/bin/env python3
import time
import zmq
import random
import sys
# Connect to the master port
print("Client socket waiting for connection...")
# Set desired master port number
masterPort = "5000"
#############################################################
# Function to request port number from master serve... | [
"zmq.Context"
] | [((957, 970), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (968, 970), False, 'import zmq\n'), ((446, 459), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (457, 459), False, 'import zmq\n')] |
from django.db import models
# Create your models here.
class User(models.Model):
user = models.AutoField(primary_key=True)
name = models.TextField(max_length=128, default='', null=False)
login = models.TextField(max_length=128, default='', null=False)
password = models.TextField(max_length=128, defa... | [
"django.db.models.TextField",
"django.db.models.TimeField",
"django.db.models.ForeignKey",
"django.db.models.FloatField",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((96, 130), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (112, 130), False, 'from django.db import models\n'), ((142, 198), 'django.db.models.TextField', 'models.TextField', ([], {'max_length': '(128)', 'default': '""""""', 'null': '(False)'}), "(max_length... |
from django.http import HttpResponse
from django.shortcuts import render
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
from chatterbot.trainers import ChatterBotCorpusTrainer
import json
my_bot = ChatBot('WeatherBot',
logic_adapters=['chatterbot.logic.MathematicalEvalu... | [
"json.loads",
"chatterbot.trainers.ChatterBotCorpusTrainer",
"chatterbot.trainers.ListTrainer",
"chatterbot.ChatBot"
] | [((227, 343), 'chatterbot.ChatBot', 'ChatBot', (['"""WeatherBot"""'], {'logic_adapters': "['chatterbot.logic.MathematicalEvaluation', 'chatterbot.logic.BestMatch']"}), "('WeatherBot', logic_adapters=[\n 'chatterbot.logic.MathematicalEvaluation', 'chatterbot.logic.BestMatch'])\n", (234, 343), False, 'from chatterbot ... |
import cv2
def calc_amount_of_area(gray_img, avg):
# ็พๅจใฎใใฌใผใ ใจ็งปๅๅนณๅใจใฎ้ใฎๅทฎใ่จ็ฎใใ
# accumulateWeighted้ขๆฐใฎ็ฌฌไธๅผๆฐใฏใใฉใใใใใฎๆฉใใงไปฅๅใฎ็ปๅใๅฟใใใใใๅฐใใใใฐๅฐใใใปใฉใๆๆฐใฎ็ปๅใใ้่ฆใใใ
# http://opencv.jp/opencv-2svn/cpp/imgproc_motion_analysis_and_object_tracking.html
# ๅฐใใใใชใใจๅใฎใใฌใผใ ใฎๆฎๅใๆฎใ
# ้ใฟใฏ่็ฉใ็ถใใใ
cv2.accumulateWeighted(gr... | [
"cv2.countNonZero",
"cv2.waitKey",
"cv2.accumulateWeighted",
"cv2.threshold",
"cv2.cvtColor",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.convertScaleAbs",
"cv2.destroyAllWindows"
] | [((295, 337), 'cv2.accumulateWeighted', 'cv2.accumulateWeighted', (['gray_img', 'avg', '(0.1)'], {}), '(gray_img, avg, 0.1)\n', (317, 337), False, 'import cv2\n'), ((584, 608), 'cv2.countNonZero', 'cv2.countNonZero', (['thresh'], {}), '(thresh)\n', (600, 608), False, 'import cv2\n'), ((972, 991), 'cv2.VideoCapture', 'c... |
import logging
from typing import List, Tuple
import requests
from dateutil.parser import parse
from django.utils.timezone import now
from lxml.html import document_fromstring
from obj_update import obj_update_or_create
from .models import BandC, Meeting, Document
from . import scrape_logger
# CONSTANTS
MEETING_DA... | [
"dateutil.parser.parse",
"django.utils.timezone.now",
"obj_update.obj_update_or_create",
"lxml.html.document_fromstring",
"requests.get",
"logging.getLogger"
] | [((404, 431), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (421, 431), False, 'import logging\n'), ((522, 599), 'requests.get', 'requests.get', (['"""https://www.austintexas.gov/department/boards-and-commissions"""'], {}), "('https://www.austintexas.gov/department/boards-and-commissions... |
import discord
from discord.ext import commands
import todoist
import datetime
class TodoistCog:
def __init__(self, bot):
self.bot = bot
global debuglv
debuglv = 0
@commands.command(name='todoist',
description="runs some API tests on todoist",
b... | [
"discord.ext.commands.guild_only",
"discord.ext.commands.command",
"todoist.TodoistAPI",
"datetime.datetime.now"
] | [((206, 339), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""todoist"""', 'description': '"""runs some API tests on todoist"""', 'brief': '"""Tests todoist API"""', 'aliases': "['todo']"}), "(name='todoist', description=\n 'runs some API tests on todoist', brief='Tests todoist API', aliases=[\... |
"""
mbed CMSIS-DAP debugger
Copyright (c) 2016 ARM Limited
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 o... | [
"logging.debug"
] | [((1821, 1896), 'logging.debug', 'logging.debug', (['"""TransferError while trying to read 16 bytes at 0x%08x"""', 'ptr'], {}), "('TransferError while trying to read 16 bytes at 0x%08x', ptr)\n", (1834, 1896), False, 'import logging\n')] |
from django.contrib import admin
from .models import student
admin.site.register(student)
# Register your models here.
| [
"django.contrib.admin.site.register"
] | [((65, 93), 'django.contrib.admin.site.register', 'admin.site.register', (['student'], {}), '(student)\n', (84, 93), False, 'from django.contrib import admin\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.urls import reverse
from misago.acl.testutils import override_acl
from misago.categories.models import Category
from misago.users.testutils import AuthenticatedUserTestCase
class StartThreadTests(AuthenticatedUserTestCase):
def setUp(se... | [
"django.urls.reverse",
"misago.categories.models.Category.objects.get",
"misago.acl.testutils.override_acl"
] | [((396, 439), 'misago.categories.models.Category.objects.get', 'Category.objects.get', ([], {'slug': '"""first-category"""'}), "(slug='first-category')\n", (416, 439), False, 'from misago.categories.models import Category\n'), ((464, 497), 'django.urls.reverse', 'reverse', (['"""misago:api:thread-list"""'], {}), "('mis... |
from direct.showbase.ShowBase import ShowBase
from mapmanager import Mapmanager
from hero import Hero
class Game(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.land = Mapmanager()
x,y = self.land.loadLand("land.txt")
self.hero = Hero((x//2,y//2,2),self.land)
bas... | [
"mapmanager.Mapmanager",
"hero.Hero",
"direct.showbase.ShowBase.ShowBase.__init__"
] | [((157, 180), 'direct.showbase.ShowBase.ShowBase.__init__', 'ShowBase.__init__', (['self'], {}), '(self)\n', (174, 180), False, 'from direct.showbase.ShowBase import ShowBase\n'), ((201, 213), 'mapmanager.Mapmanager', 'Mapmanager', ([], {}), '()\n', (211, 213), False, 'from mapmanager import Mapmanager\n'), ((279, 315)... |
import cv2
import numpy as np
import copy
class Drawer(object):
def __init__(self, color = (255,255,0), font=cv2.FONT_HERSHEY_DUPLEX):
self.color = color
self.RED = (0,0,255)
self.LESSRED = (0,20,100)
self.TEAL = (148, 184, 0)
self.font = font
self.fontScale = 1.2
... | [
"copy.deepcopy",
"cv2.putText",
"cv2.rectangle"
] | [((931, 1042), 'cv2.putText', 'cv2.putText', (['frame', 'label', '(border, 20 + border)', 'self.font', 'self.fontScale', 'self.color', 'self.fontThickness'], {}), '(frame, label, (border, 20 + border), self.font, self.fontScale,\n self.color, self.fontThickness)\n', (942, 1042), False, 'import cv2\n'), ((1395, 1503)... |
import pandas as pd
import plotly.express as px
import plotly.graph_objects as go
import numpy as np
from plotly.subplots import make_subplots
from pathlib import Path
repo_dir = Path(__file__).parent.parent
outputdir = repo_dir/'output'
outputdir.mkdir(parents=True, exist_ok=True)
casos = pd.read_csv('https://raw.git... | [
"plotly.graph_objects.Scatter",
"pandas.read_csv",
"plotly.graph_objects.Figure",
"pandas.merge",
"pathlib.Path",
"pandas.to_datetime",
"pandas.Timedelta",
"plotly.subplots.make_subplots",
"pandas.to_numeric"
] | [((292, 424), 'pandas.read_csv', 'pd.read_csv', (['"""https://raw.githubusercontent.com/MinCiencia/Datos-COVID19/master/output/producto3/TotalesPorRegion_std.csv"""'], {}), "(\n 'https://raw.githubusercontent.com/MinCiencia/Datos-COVID19/master/output/producto3/TotalesPorRegion_std.csv'\n )\n", (303, 424), True, ... |
# coding:utf-8
'''
@Copyright:LintCode
@Author: taoleetju
@Problem: http://www.lintcode.com/problem/cosine-similarity
@Language: Python
@Datetime: 15-10-05 15:16
'''
class Solution:
"""
@param A: An integer array.
@param B: An integer array.
@return: Cosine similarity.
"""
def cosineSimilari... | [
"math.sqrt"
] | [((638, 646), 'math.sqrt', 'sqrt', (['LA'], {}), '(LA)\n', (642, 646), False, 'from math import sqrt\n'), ((649, 657), 'math.sqrt', 'sqrt', (['LB'], {}), '(LB)\n', (653, 657), False, 'from math import sqrt\n')] |
# Generated by Django 2.0.4 on 2018-05-15 03:13
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ticketing', '0003_auto_20180515_0148'),
]
operations = [
migrations.AlterField(
model_name='pus... | [
"django.db.models.ForeignKey"
] | [((382, 509), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""notification_tokens"""', 'to': '"""ticketing.Account"""'}), "(on_delete=django.db.models.deletion.CASCADE, related_name\n ='notification_tokens', to='ticketing.Account')\n", (... |
"""
Tests of 'python -m recipy' usage.
This script uses a Python script (run_numpy_no_recipy.py) about
which the following assumptions are made:
* Co-located with this test script, in the same directory.
* Expects two arguments via the command-line: an input file
name and an output file name.
* Reads the input file... | [
"integration_test.helpers.enable_recipy",
"os.remove",
"integration_test.helpers.execute_python",
"os.path.isdir",
"os.path.basename",
"os.rename",
"os.path.dirname",
"integration_test.recipy_environment.get_recipydb",
"tempfile.mkdtemp",
"shutil.rmtree",
"os.path.join",
"shutil.copy"
] | [((1356, 1392), 'tempfile.mkdtemp', 'tempfile.mkdtemp', (['TestMflag.__name__'], {}), '(TestMflag.__name__)\n', (1372, 1392), False, 'import tempfile\n'), ((1594, 1650), 'shutil.copy', 'shutil.copy', (['TestMflag.script', 'TestMflag.original_script'], {}), '(TestMflag.script, TestMflag.original_script)\n', (1605, 1650)... |
from django import template
from ..music_handler.interpret import KEYS
register = template.Library()
@register.filter
def num2chord(value):
try:
return KEYS[int(value) % 12]
except Exception:
return value
| [
"django.template.Library"
] | [((84, 102), 'django.template.Library', 'template.Library', ([], {}), '()\n', (100, 102), False, 'from django import template\n')] |
import pytest
import torch
from perceiver_pytorch.queries import LearnableQuery
from perceiver_pytorch.perceiver_io import PerceiverIO
from perceiver_pytorch.utils import encode_position
import einops
@pytest.mark.parametrize("layer_shape", ["2d", "3d"])
def test_learnable_query(layer_shape):
query_creator = Lear... | [
"perceiver_pytorch.utils.encode_position",
"torch.randn",
"einops.rearrange",
"perceiver_pytorch.queries.LearnableQuery",
"pytest.mark.parametrize",
"torch.no_grad"
] | [((204, 256), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""layer_shape"""', "['2d', '3d']"], {}), "('layer_shape', ['2d', '3d'])\n", (227, 256), False, 'import pytest\n'), ((828, 880), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""layer_shape"""', "['2d', '3d']"], {}), "('layer_shape', ['2d... |
from django.db import models
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin, BaseUserManager, Permission
from django.utils.translation import ugettext, ugettext_lazy as _
from django.utils import six, timezone
from django.core.mail import send_mail
# Create your models here.
class StaffManag... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.utils.timezone.now",
"django.core.mail.send_mail",
"django.utils.translation.ugettext_lazy"
] | [((3221, 3264), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(16)', 'blank': '(True)'}), '(max_length=16, blank=True)\n', (3237, 3264), False, 'from django.db import models\n'), ((3279, 3323), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'blank': '(True)'}), '... |
#!/usr/bin/env python
import os
import json
import pytz
from copy import copy
from glob import glob
from datetime import datetime
import argparse
import xgboost as xgb
import pandas as pd
import sklearn as sk
import numpy as np
import matplotlib.pyplot as plt
from statistics import mean
from statistics import stdev
... | [
"json.dump",
"os.makedirs",
"argparse.ArgumentParser",
"sklearn.metrics.accuracy_score",
"copy.copy",
"sklearn.metrics.recall_score",
"sklearn.metrics.roc_auc_score",
"sklearn.metrics.f1_score",
"pytz.timezone",
"sklearn.metrics.precision_score",
"xgboost.XGBClassifier",
"sklearn.metrics.avera... | [((541, 603), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""python train_xgboost.py"""'}), "(description='python train_xgboost.py')\n", (564, 603), False, 'import argparse\n'), ((1606, 1675), 'os.path.join', 'os.path.join', (['args.root', '"""datasets"""', '"""split_list"""', '"""kfcv""... |
"""
Tests for the datastore logic used to define the behaviour of the API.
Copyright (C) 2020 <NAME>.
"Commons Clause" License Condition v1.0:
The Software is provided to you by the Licensor under the License, as defined
below, subject to the following condition.
Without limiting other conditions in the License, th... | [
"datastore.logic.create_namespace",
"datastore.logic.update_tag_description",
"datastore.logic.create_tag",
"datastore.models.Tag.objects.get",
"datastore.models.User.objects.create_user",
"unittest.mock.MagicMock",
"datastore.models.Namespace.objects.get",
"datastore.logic.get_namespace",
"datastor... | [((2282, 2402), 'datastore.models.User.objects.create_user', 'models.User.objects.create_user', ([], {'username': '"""site_admin_user"""', 'email': '"""<EMAIL>"""', 'password': '"""password"""', 'is_superuser': '(True)'}), "(username='site_admin_user', email='<EMAIL>',\n password='password', is_superuser=True)\n", (... |
from typing import Dict, Tuple, TYPE_CHECKING
import numpy as np
from ..continuous_sensor import ContinuousSensor
if TYPE_CHECKING:
from task import StackingTask
# TODO: This should be a DiscreteSensor
class CurrentPartReleasedSensor(ContinuousSensor["StackingEnv"]):
def __init__(self, part_release_distanc... | [
"numpy.zeros",
"numpy.ones"
] | [((645, 656), 'numpy.zeros', 'np.zeros', (['(1)'], {}), '(1)\n', (653, 656), True, 'import numpy as np\n'), ((658, 668), 'numpy.ones', 'np.ones', (['(1)'], {}), '(1)\n', (665, 668), True, 'import numpy as np\n')] |
#!/usr/bin/env python
from json import dumps
from circuits.web import Controller, Server
def json(f):
def wrapper(self, *args, **kwargs):
return dumps(f(self, *args, **kwargs))
return wrapper
class Root(Controller):
@json
def getrange(self, limit=4):
return list(range(int(limit)))
... | [
"circuits.web.Server"
] | [((328, 353), 'circuits.web.Server', 'Server', (["('0.0.0.0', 8000)"], {}), "(('0.0.0.0', 8000))\n", (334, 353), False, 'from circuits.web import Controller, Server\n')] |
# date: 2019ๅนด11ๆ3ๆฅ
# author: lw
# e-mail: <EMAIL>
# description: ๅฎ็ฐๅ็ซฏ็ๅค็่ฟๅๅฝๆฐ๏ผๅบไบflaskๅ
# -*- coding: utf-8 -*-
from flask import Flask, jsonify, render_template,request
from flask_cors import *
from query_op import *
import json
app = Flask(__name__) # ๅฎไพๅappๅฏน่ฑก
CORS(app,supports_credentials=True) # ่งฃๅณ่ทจๅ่ฏทๆฑๆ ๅๅบ้ฎ้ข
# ... | [
"flask.Flask",
"json.load"
] | [((237, 252), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (242, 252), False, 'from flask import Flask, jsonify, render_template, request\n'), ((522, 536), 'json.load', 'json.load', (['f_s'], {}), '(f_s)\n', (531, 536), False, 'import json\n'), ((724, 738), 'json.load', 'json.load', (['f_t'], {}), '(f_t)... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# 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 applicab... | [
"mock.call",
"mock.mock_open",
"heat.engine.environment.Environment",
"mock.patch",
"heat.engine.resources.global_env",
"heat.engine.resources._load_global_environment"
] | [((907, 929), 'heat.engine.resources.global_env', 'resources.global_env', ([], {}), '()\n', (927, 929), False, 'from heat.engine import resources\n'), ((1128, 1156), 'heat.engine.environment.Environment', 'environment.Environment', (['old'], {}), '(old)\n', (1151, 1156), False, 'from heat.engine import environment\n'),... |
import json
import random
from collections import defaultdict
from dataclasses import dataclass
from typing import Optional, Dict, Union
import pkg_resources
from nextcord import TextChannel, Thread
from nextcord.ext import commands
from shlimpbot.cogs.config import is_config_channel
@dataclass
class ChannelState:
... | [
"nextcord.ext.commands.has_guild_permissions",
"nextcord.ext.commands.group",
"json.load",
"pkg_resources.resource_stream",
"collections.defaultdict",
"nextcord.ext.commands.guild_only",
"shlimpbot.cogs.config.is_config_channel"
] | [((564, 580), 'nextcord.ext.commands.group', 'commands.group', ([], {}), '()\n', (578, 580), False, 'from nextcord.ext import commands\n'), ((685, 720), 'shlimpbot.cogs.config.is_config_channel', 'is_config_channel', (['"""wordle.channel"""'], {}), "('wordle.channel')\n", (702, 720), False, 'from shlimpbot.cogs.config ... |
# Generated by Django 2.1.2 on 2019-01-30 08:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('extrequests', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='profileupdaterequest',
name='domains',
... | [
"django.db.migrations.RemoveField",
"django.db.migrations.DeleteModel"
] | [((220, 293), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""profileupdaterequest"""', 'name': '"""domains"""'}), "(model_name='profileupdaterequest', name='domains')\n", (242, 293), False, 'from django.db import migrations\n'), ((338, 413), 'django.db.migrations.RemoveField', 'mi... |
import paddle
import paddle.fluid as fluid
from .operations import OPS
def AuxiliaryHeadCIFAR(inputs, C, class_num):
print('AuxiliaryHeadCIFAR : inputs-shape : {:}'.format(inputs.shape))
temp = fluid.layers.relu(inputs)
temp = fluid.layers.pool2d(
temp, pool_size=5, pool_stride=3, pool_padding=0, ... | [
"paddle.fluid.layers.concat",
"paddle.fluid.layers.relu",
"paddle.fluid.layers.conv2d",
"paddle.fluid.layers.batch_norm",
"paddle.fluid.layers.fc",
"paddle.fluid.layers.elementwise_add",
"paddle.fluid.layers.pool2d"
] | [((204, 229), 'paddle.fluid.layers.relu', 'fluid.layers.relu', (['inputs'], {}), '(inputs)\n', (221, 229), True, 'import paddle.fluid as fluid\n'), ((241, 331), 'paddle.fluid.layers.pool2d', 'fluid.layers.pool2d', (['temp'], {'pool_size': '(5)', 'pool_stride': '(3)', 'pool_padding': '(0)', 'pool_type': '"""avg"""'}), "... |
from math import sqrt
import copy
import sys
from utils import tools
from utils import config
log_file = open("trace.log","w")
old_stdout = sys.stdout
COUNTER = config.RECURSION_LIMIT
def find_solution(grid, n, i, j, pos, pre, back_depth):
global COUNTER
COUNTER -= 1
if (COUNTER == 0):
COUNTER = ... | [
"math.sqrt"
] | [((3949, 3956), 'math.sqrt', 'sqrt', (['n'], {}), '(n)\n', (3953, 3956), False, 'from math import sqrt\n'), ((3999, 4006), 'math.sqrt', 'sqrt', (['n'], {}), '(n)\n', (4003, 4006), False, 'from math import sqrt\n'), ((4052, 4059), 'math.sqrt', 'sqrt', (['n'], {}), '(n)\n', (4056, 4059), False, 'from math import sqrt\n')... |
from flask import Blueprint, request
blueprint = Blueprint('users', __name__, url_prefix='/users')
@blueprint.route('', methods=['POST', 'GET'])
def create_list():
if request.method == 'POST':
return 'Create user'
return 'List users'
@blueprint.route('/<user_id>', methods=['GET', 'DELETE', 'PUT'])
... | [
"flask.Blueprint"
] | [((50, 99), 'flask.Blueprint', 'Blueprint', (['"""users"""', '__name__'], {'url_prefix': '"""/users"""'}), "('users', __name__, url_prefix='/users')\n", (59, 99), False, 'from flask import Blueprint, request\n')] |
import os
import redis
from rq import Worker, Queue, Connection
listen = ["default"]
redis_url = 'redis://localhost:6379'
conn = redis.from_url(redis_url)
if __name__ == '__main__':
with Connection(conn):
worker = Worker(list(map(Queue, listen)))
worker.work()
| [
"redis.from_url",
"rq.Connection"
] | [((130, 155), 'redis.from_url', 'redis.from_url', (['redis_url'], {}), '(redis_url)\n', (144, 155), False, 'import redis\n'), ((193, 209), 'rq.Connection', 'Connection', (['conn'], {}), '(conn)\n', (203, 209), False, 'from rq import Worker, Queue, Connection\n')] |
#ๅฎไนๆไธพ็ฑป
from enum import Enum
Month = Enum('Month',('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'))
#ไฝฟ็จๆไธพ
for name, member in Month.__members__.items():
print(name, '=>', member, ',', member.value)
from enum import Enum, unique
@unique #@unique่ฃ
้ฅฐๅจๅฏไปฅๅธฎๅฉๆไปฌๆฃๆฅไฟ่ฏๆฒกๆ้ๅคๅผใ
class Weekday(Enum)... | [
"enum.Enum"
] | [((39, 142), 'enum.Enum', 'Enum', (['"""Month"""', "('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct',\n 'Nov', 'Dec')"], {}), "('Month', ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',\n 'Sep', 'Oct', 'Nov', 'Dec'))\n", (43, 142), False, 'from enum import Enum, unique\n')] |
from gym.envs.registration import register
from .environment import MarsLanderEnv
register(
id="MarsLander-v1",
entry_point=MarsLanderEnv,
)
| [
"gym.envs.registration.register"
] | [((84, 139), 'gym.envs.registration.register', 'register', ([], {'id': '"""MarsLander-v1"""', 'entry_point': 'MarsLanderEnv'}), "(id='MarsLander-v1', entry_point=MarsLanderEnv)\n", (92, 139), False, 'from gym.envs.registration import register\n')] |
# Copyright (C) 2013 - <NAME> <<EMAIL>>
# This program is Free Software see LICENSE file for details
"""Package Control progress bar like
"""
import threading
import sublime
class ProgressBar(threading.Thread):
"""A progress bar animation that runs in other thread
"""
class Status(object):
NO... | [
"threading.Thread.__init__",
"sublime.status_message"
] | [((450, 481), 'threading.Thread.__init__', 'threading.Thread.__init__', (['self'], {}), '(self)\n', (475, 481), False, 'import threading\n'), ((1452, 1483), 'sublime.status_message', 'sublime.status_message', (['message'], {}), '(message)\n', (1474, 1483), False, 'import sublime\n')] |
from django.conf.urls import url
from django.http import Http404, HttpResponse
def view(request, *args, **kwargs):
if request.path == '/raise404/':
raise Http404
return HttpResponse('Hello!')
urlpatterns = [
url("^$", view, name="index"),
url("^(?P<slug>[^/]+)/$", view, name="detail"),
]
| [
"django.http.HttpResponse",
"django.conf.urls.url"
] | [((187, 209), 'django.http.HttpResponse', 'HttpResponse', (['"""Hello!"""'], {}), "('Hello!')\n", (199, 209), False, 'from django.http import Http404, HttpResponse\n'), ((232, 261), 'django.conf.urls.url', 'url', (['"""^$"""', 'view'], {'name': '"""index"""'}), "('^$', view, name='index')\n", (235, 261), False, 'from d... |
import asyncio
import re
import traceback
from typing import Union
import discord
from discord.ext.commands import AutoShardedBot, Cog
from discord_slash import ButtonStyle, ComponentContext, SlashContext, cog_ext
from discord_slash.utils import manage_components
from utils import punishments, utils
class ServerUti... | [
"discord.ext.commands.MissingPermissions",
"utils.utils.LOGGER.debug",
"discord_slash.utils.manage_components.create_select_option",
"discord_slash.utils.manage_components.manage_components.wait_for_component",
"discord_slash.utils.manage_components.create_actionrow",
"discord.Colour.from_rgb",
"traceba... | [((12847, 12977), 'discord_slash.cog_ext.cog_subcommand', 'cog_ext.cog_subcommand', ([], {'base': '"""server"""', 'subcommand_group': '"""user"""', 'name': '"""punish"""', 'description': '"""punishes a user"""', 'options': 'pun_opt'}), "(base='server', subcommand_group='user', name=\n 'punish', description='punishes... |
import numpy as np
import tensorflow as tf
from collections import Counter
from utils.process_utils import calculate_iou, non_maximum_suppression
def evaluate(y_pred, y_true, num_classes, score_thresh=0.5, iou_thresh=0.5):
num_images = y_true[0].shape[0]
true_labels_dict = {i:0 for i in range(num_classes)} ... | [
"utils.process_utils.non_maximum_suppression",
"numpy.argmax",
"numpy.array",
"utils.process_utils.calculate_iou",
"collections.Counter"
] | [((1303, 1362), 'utils.process_utils.non_maximum_suppression', 'non_maximum_suppression', (['pred_boxes', 'pred_confs', 'pred_probs'], {}), '(pred_boxes, pred_confs, pred_probs)\n', (1326, 1362), False, 'from utils.process_utils import calculate_iou, non_maximum_suppression\n'), ((1385, 1410), 'numpy.array', 'np.array'... |
"""
Created on 31 Jan 2019
@author: <NAME> (<EMAIL>)
https://www.u-blox.com/en/product/sam-m8q-module
example sentences:
PAM7...
$GPRMC,103228.00,A,5049.37823,N,00007.37872,W,0.104,,301216,,,D*64
$GPVTG,,T,,M,0.104,N,0.193,K,D*28
$GPGGA,103228.00,5049.37823,N,00007.37872,W,2,07,1.85,34.0,M,45.4,M,,0000*75
$GPGSA,A,3... | [
"scs_core.position.nmea.nmea_report.NMEAReport.construct",
"scs_core.position.nmea.gprmc.GPRMC.construct",
"scs_dfe.board.io.IO",
"scs_core.position.nmea.gpgll.GPGLL.construct",
"time.sleep",
"scs_core.position.nmea.gpvtg.GPVTG.construct",
"scs_host.sys.host_serial.HostSerial",
"scs_core.position.nmea... | [((2270, 2274), 'scs_dfe.board.io.IO', 'IO', ([], {}), '()\n', (2272, 2274), False, 'from scs_dfe.board.io import IO\n'), ((2299, 2340), 'scs_host.sys.host_serial.HostSerial', 'HostSerial', (['uart', 'self.__BAUD_RATE', '(False)'], {}), '(uart, self.__BAUD_RATE, False)\n', (2309, 2340), False, 'from scs_host.sys.host_s... |
# The main purpose of this cfi is test that the validation will insert
# missing parameters that are required by the ParameterSetDescription.
# It also tests many other things that cannot be tested in an
# autogenerated cfi file that are related to the ParameterSetDescription
# infrastructure.
import FWCore.Paramete... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.untracked.int32",
"FWCore.ParameterSet.Config.untracked.vstring",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.vstring",
"FWCore.ParameterSet.Config.int32",
"FWCore.ParameterSet.Config.uint32",
"FWCore.Paramet... | [((434, 459), 'FWCore.ParameterSet.Config.untracked.bool', 'cms.untracked.bool', (['(False)'], {}), '(False)\n', (452, 459), True, 'import FWCore.ParameterSet.Config as cms\n'), ((478, 491), 'FWCore.ParameterSet.Config.int32', 'cms.int32', (['(11)'], {}), '(11)\n', (487, 491), True, 'import FWCore.ParameterSet.Config a... |
"""empty message
Revision ID: 0d0c426e7b01
Revises: <KEY>
Create Date: 2017-10-29 20:37:10.615469
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0d0c426e7b01'
down_revision = '<KEY>'
branch_labels = None
depends_on = None
def upgrade():
# ### commands a... | [
"alembic.op.drop_table",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((872, 899), 'alembic.op.drop_table', 'op.drop_table', (['"""access_key"""'], {}), "('access_key')\n", (885, 899), False, 'from alembic import op\n'), ((655, 704), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['user_id']", "['user.id']"], {}), "(['user_id'], ['user.id'])\n", (678, 704), True, 'impo... |