code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'pesquisa_produtos.ui'
#
# Created by: PyQt5 View code generator 5.14.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Frame(object):
def setupUi(self, Frame):
Fram... | [
"PyQt5.QtWidgets.QTableWidget",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtGui.QIcon",
"PyQt5.QtGui.QFont",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QFrame",
"PyQt5.QtGui.QCursor",
"PyQt5.QtCore.QRect",
"PyQt5.QtGui.QPixmap",
"PyQt5.QtWidgets.QLabel... | [((503, 526), 'PyQt5.QtWidgets.QFrame', 'QtWidgets.QFrame', (['Frame'], {}), '(Frame)\n', (519, 526), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((754, 795), 'PyQt5.QtWidgets.QLabel', 'QtWidgets.QLabel', (['self.fr_titulo_servicos'], {}), '(self.fr_titulo_servicos)\n', (770, 795), False, 'from PyQt5 import... |
from data import all_emoji
from aiogram.types import InlineKeyboardMarkup, InlineKeyboardButton
from aiogram.utils.callback_data import CallbackData
from data import all_emoji
from utils.googlesheets import send_to_google
from utils.set_minus_and_plus_currences import set_minus_and_plus
from utils.get_minuses_sum_F... | [
"utils.get_values_FGH_MNO.get_plus_FGH",
"aiogram.utils.callback_data.CallbackData",
"utils.get_minuses_sum_FGH.get_minus_FGH",
"aiogram.types.InlineKeyboardMarkup"
] | [((411, 444), 'aiogram.utils.callback_data.CallbackData', 'CallbackData', (['"""cb_ws"""', '"""type_btn"""'], {}), "('cb_ws', 'type_btn')\n", (423, 444), False, 'from aiogram.utils.callback_data import CallbackData\n'), ((1355, 1397), 'aiogram.utils.callback_data.CallbackData', 'CallbackData', (['"""anprix"""', '"""cur... |
import rospy
MOVE_CYCLE_PERIOD = 0.01
def move_towards(target, current, step=1):
if abs(target-current) < step:
return target, True
else:
if target > current:
return current + step, False
else:
return current - step, False
def move_leg(leg, coxa=None, femur=N... | [
"rospy.sleep"
] | [((2232, 2249), 'rospy.sleep', 'rospy.sleep', (['(0.05)'], {}), '(0.05)\n', (2243, 2249), False, 'import rospy\n'), ((4831, 4847), 'rospy.sleep', 'rospy.sleep', (['(0.2)'], {}), '(0.2)\n', (4842, 4847), False, 'import rospy\n'), ((6262, 6278), 'rospy.sleep', 'rospy.sleep', (['(0.2)'], {}), '(0.2)\n', (6273, 6278), Fals... |
from pathlib import Path
import os
from PIL import Image, ImageFont, ImageDraw
import numpy as np
import pandas as pd
from math import *
p = Path("resources/graphics/Pokemon/Icons")
df = pd.read_csv(Path("resources/PBS/compressed/pokemon.csv"), index_col=0)
width = 64
height = ceil(len(df) / 64)
canvas = Image.new(... | [
"PIL.Image.new",
"PIL.ImageDraw.Draw",
"PIL.Image.open",
"pathlib.Path"
] | [((142, 182), 'pathlib.Path', 'Path', (['"""resources/graphics/Pokemon/Icons"""'], {}), "('resources/graphics/Pokemon/Icons')\n", (146, 182), False, 'from pathlib import Path\n'), ((310, 357), 'PIL.Image.new', 'Image.new', (['"""RGBA"""', '(width, height)', '"""#00000000"""'], {}), "('RGBA', (width, height), '#00000000... |
from django.contrib import admin
from django.http import HttpResponse
from django.urls import path
from django.shortcuts import render, HttpResponse, redirect
from django import forms
import os
import csv
from io import TextIOWrapper, StringIO
from .models import Player, Team, Usage, XgLookup
class CsvImportForm(for... | [
"django.shortcuts.render",
"django.shortcuts.HttpResponse",
"csv.writer",
"os.path.splitext",
"django.contrib.admin.register",
"io.TextIOWrapper",
"django.shortcuts.redirect",
"django.forms.FileField",
"django.urls.path",
"csv.reader"
] | [((3493, 3515), 'django.contrib.admin.register', 'admin.register', (['Player'], {}), '(Player)\n', (3507, 3515), False, 'from django.contrib import admin\n'), ((3654, 3674), 'django.contrib.admin.register', 'admin.register', (['Team'], {}), '(Team)\n', (3668, 3674), False, 'from django.contrib import admin\n'), ((3811,... |
# -*- coding: utf-8 -*-
# =====================================================================================================================
# Copyright (©) 2015-2021 LCS - Laboratoire Catalyse et Spectrochimie, Caen, France. =
# CeCILL-B FREE SOFTWARE LICENSE AGREEMENT - See ful... | [
"os.path.join",
"pytest.raises",
"pathlib.Path",
"spectrochempy.utils.get_filename"
] | [((1359, 1453), 'spectrochempy.utils.get_filename', 'get_filename', ([], {'filetypes': "['OMNIC files (*.spg *.spa *.srs)', 'SpectroChemPy files (*.scp)']"}), "(filetypes=['OMNIC files (*.spg *.spa *.srs)',\n 'SpectroChemPy files (*.scp)'])\n", (1371, 1453), False, 'from spectrochempy.utils import get_filename\n'), ... |
from toontown.safezone.DistributedETreasureAI import DistributedETreasureAI
from toontown.safezone.RegenTreasurePlannerAI import RegenTreasurePlannerAI
class ETreasurePlannerAI(RegenTreasurePlannerAI):
def __init__(self, zoneId):
self.healAmount = 2
self.spawnPoints = []
RegenTreasurePlan... | [
"toontown.safezone.RegenTreasurePlannerAI.RegenTreasurePlannerAI.__init__"
] | [((303, 403), 'toontown.safezone.RegenTreasurePlannerAI.RegenTreasurePlannerAI.__init__', 'RegenTreasurePlannerAI.__init__', (['self', 'zoneId', 'DistributedETreasureAI', '"""ETreasurePlanner"""', '(15)', '(3)'], {}), "(self, zoneId, DistributedETreasureAI,\n 'ETreasurePlanner', 15, 3)\n", (334, 403), False, 'from t... |
from sdk.color_print import c_print
from user_roles import role_translate_id
from tqdm import tqdm
def add_roles(session, old_session, roles, logger):
added = 0
tenant_name = session.tenant
if roles:
logger.info(f'Adding User Roles to tenant: \'{tenant_name}\'')
#Translate Acc Grp IDs
... | [
"user_roles.role_translate_id.translate_rsc_list_ids",
"user_roles.role_translate_id.translate_acc_grp_ids",
"tqdm.tqdm"
] | [((924, 974), 'tqdm.tqdm', 'tqdm', (['roles'], {'desc': '"""Adding User Roles"""', 'leave': '(False)'}), "(roles, desc='Adding User Roles', leave=False)\n", (928, 974), False, 'from tqdm import tqdm\n'), ((1237, 1313), 'user_roles.role_translate_id.translate_acc_grp_ids', 'role_translate_id.translate_acc_grp_ids', (['o... |
# File: ds_base_service.py
#
# Licensed under Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)
#
import json
import time
import base64
from functools import wraps
from ..config import ds_api_host, ds_api_base
from .ds_abstract_service import DSAbstractService
class DSBaseService(DSAbstractService):
... | [
"base64.b64encode",
"time.sleep",
"json.loads",
"functools.wraps"
] | [((670, 698), 'base64.b64encode', 'base64.b64encode', (['data_bytes'], {}), '(data_bytes)\n', (686, 698), False, 'import base64\n'), ((1908, 1927), 'json.loads', 'json.loads', (['content'], {}), '(content)\n', (1918, 1927), False, 'import json\n'), ((5597, 5617), 'functools.wraps', 'wraps', (['view_function'], {}), '(v... |
# Imports para o Carla
import glob
import os
import sys
try:
sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % (
sys.version_info.major,
sys.version_info.minor,
'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0])
except IndexError:
pass
import carla
try:
sys.path... | [
"carla.command.DestroyActor",
"carla.Location",
"agents.navigation.unb_agent.Agent",
"carla.Client",
"os.path.abspath",
"carla.Rotation",
"glob.glob"
] | [((1002, 1033), 'carla.Client', 'carla.Client', (['"""localhost"""', '(2000)'], {}), "('localhost', 2000)\n", (1014, 1033), False, 'import carla\n'), ((3007, 3049), 'agents.navigation.unb_agent.Agent', 'Agent', (['vehicle'], {'ignore_traffic_light': '(False)'}), '(vehicle, ignore_traffic_light=False)\n', (3012, 3049), ... |
import json
import requests
post_url = "http://127.0.0.1:5000/api/"
# ---------- general web interfacing ----------------------
def post(endpoint, payload, uri="http://127.0.0.1:5000/api/"):
"""
Posts to the flask web server.
Args:
endpoint: The endpoint of the API
payload: Payload accor... | [
"random.choice",
"requests.post",
"requests.get"
] | [((463, 506), 'requests.post', 'requests.post', (['(uri + endpoint)'], {'json': 'payload'}), '(uri + endpoint, json=payload)\n', (476, 506), False, 'import requests\n'), ((762, 790), 'requests.get', 'requests.get', (['(uri + endpoint)'], {}), '(uri + endpoint)\n', (774, 790), False, 'import requests\n'), ((4542, 4565),... |
"""Loads the config.json file and store key value pairs into variables"""
import json
with open('config.json', 'r', encoding='utf-8') as f:
config = json.load(f)
config_location_type = config['location_type']
config_location = config['location']
country = config['country']
config_covid_terms = config['... | [
"json.load"
] | [((158, 170), 'json.load', 'json.load', (['f'], {}), '(f)\n', (167, 170), False, 'import json\n')] |
import glob, os
import numpy as np
import tensorflow as tf
import tensorflow.contrib.graph_editor as ge
class Flownet2:
def __init__(self, bilinear_warping_module):
self.weights = dict()
for key, shape in self.all_variables():
self.weights[key] = tf.get_variable(key, shape=shape)
... | [
"tensorflow.nn.conv2d",
"tensorflow.contrib.graph_editor.reroute.add_control_inputs",
"tensorflow.image.resize_nearest_neighbor",
"tensorflow.shape",
"tensorflow.pad",
"tensorflow.reshape",
"tensorflow.get_variable",
"tensorflow.to_float",
"tensorflow.reduce_sum",
"tensorflow.ones",
"tensorflow.... | [((469, 489), 'tensorflow.maximum', 'tf.maximum', (['x', '(s * x)'], {}), '(x, s * x)\n', (479, 489), True, 'import tensorflow as tf\n'), ((1098, 1126), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['(flow * target)'], {}), '(flow * target)\n', (1111, 1126), True, 'import tensorflow as tf\n'), ((1173, 1267), 'tensorflow.... |
"""
"""
import sys
import uuid
import base64
import fileinput
import datetime
from django.utils import timezone
from django.conf import settings
from django.shortcuts import get_object_or_404
from urlparse import urlparse, parse_qs
from APNSWrapper import *
from mdm.models import MDMDevice, DeviceCommand
def replac... | [
"base64.b64decode",
"fileinput.input",
"sys.stdout.write"
] | [((371, 403), 'fileinput.input', 'fileinput.input', (['file'], {'inplace': '(1)'}), '(file, inplace=1)\n', (386, 403), False, 'import fileinput\n'), ((569, 606), 'base64.b64decode', 'base64.b64decode', (['device.device_token'], {}), '(device.device_token)\n', (585, 606), False, 'import base64\n'), ((498, 520), 'sys.std... |
import math
import itertools
from operator import itemgetter
import json
import os
import random
from .geom import hflip_pattern, vflip_pattern, rot_pattern
from .patterns import (
get_pattern_size,
get_pattern_livecount,
get_grid_empty,
get_grid_pattern,
segment_pattern,
methuselah_quadrants_pa... | [
"random.choice",
"random.shuffle",
"itertools.product",
"random.seed",
"random.getrandbits",
"operator.itemgetter",
"random.random",
"random.randint",
"random.gauss"
] | [((1805, 1837), 'random.shuffle', 'random.shuffle', (['team_assignments'], {}), '(team_assignments)\n', (1819, 1837), False, 'import random\n'), ((13654, 13685), 'random.shuffle', 'random.shuffle', (['all_methuselahs'], {}), '(all_methuselahs)\n', (13668, 13685), False, 'import random\n'), ((16746, 16763), 'random.choi... |
'''
Created on Jun 21, 2020
@author: ballance
'''
import vsc
from vsc_test_case import VscTestCase
from vsc.visitors.model_pretty_printer import ModelPrettyPrinter
class TestListScalar(VscTestCase):
@vsc.randobj
class my_item_c(object):
def __init__(self):
self.fixed = vsc.ra... | [
"vsc.bit_t",
"vsc.rng",
"vsc.rand_uint8_t",
"vsc.rangelist",
"vsc.uint8_t",
"vsc.if_then",
"vsc.foreach"
] | [((330, 342), 'vsc.bit_t', 'vsc.bit_t', (['(8)'], {}), '(8)\n', (339, 342), False, 'import vsc\n'), ((395, 407), 'vsc.bit_t', 'vsc.bit_t', (['(8)'], {}), '(8)\n', (404, 407), False, 'import vsc\n'), ((452, 464), 'vsc.bit_t', 'vsc.bit_t', (['(8)'], {}), '(8)\n', (461, 464), False, 'import vsc\n'), ((2126, 2144), 'vsc.ra... |
import json
from configserver import ConfigServer, get_postgres_db
from configserver.errors import InvalidRouteUUIDError
from flask.testing import FlaskClient
import pytest
from peewee import SqliteDatabase
import logging
from uuid import uuid4
import functools
from typing import Iterable
@pytest.fixture(autouse=True... | [
"logging.getLogger",
"json.loads",
"json.dumps",
"configserver.get_postgres_db",
"json.load",
"uuid.uuid4",
"pytest.mark.usefixtures",
"pytest.fixture",
"functools.partialmethod"
] | [((293, 321), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (307, 321), False, 'import pytest\n'), ((389, 405), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (403, 405), False, 'import pytest\n'), ((680, 696), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (694, 696... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 7 14:40:40 2021
@author: victorsellemi
"""
import numpy as np
def filter_MA(Y,q = 2):
"""
DESCRIPTION:
Decompose a time series into a trend and stationary component
using the moving average (MA) filter (i.e., low pass fi... | [
"numpy.eye",
"numpy.zeros",
"numpy.concatenate"
] | [((877, 897), 'numpy.zeros', 'np.zeros', (['(T - Q, T)'], {}), '((T - Q, T))\n', (885, 897), True, 'import numpy as np\n'), ((970, 1006), 'numpy.concatenate', 'np.concatenate', (['(p1, p2, p3)'], {'axis': '(0)'}), '((p1, p2, p3), axis=0)\n', (984, 1006), True, 'import numpy as np\n'), ((1060, 1073), 'numpy.eye', 'np.ey... |
import sys
import pytest
import aiohttp_mako
from aiohttp import web
@pytest.fixture
def app():
app = web.Application()
lookup = aiohttp_mako.setup(app, input_encoding='utf-8',
output_encoding='utf-8',
default_filters=['decode.utf8'])
tplt... | [
"aiohttp.web.Application",
"aiohttp_mako.setup"
] | [((110, 127), 'aiohttp.web.Application', 'web.Application', ([], {}), '()\n', (125, 127), False, 'from aiohttp import web\n'), ((141, 250), 'aiohttp_mako.setup', 'aiohttp_mako.setup', (['app'], {'input_encoding': '"""utf-8"""', 'output_encoding': '"""utf-8"""', 'default_filters': "['decode.utf8']"}), "(app, input_encod... |
from fastapi import Depends
from fastapi.exceptions import HTTPException
from fastapi.security import OAuth2PasswordBearer
from app.models.users import User, UserRepository
get_token = OAuth2PasswordBearer(tokenUrl="/login")
async def get_user(
token: str = Depends(get_token), users: UserRepository = Depends()
... | [
"fastapi.Depends",
"fastapi.security.OAuth2PasswordBearer",
"fastapi.exceptions.HTTPException"
] | [((187, 226), 'fastapi.security.OAuth2PasswordBearer', 'OAuth2PasswordBearer', ([], {'tokenUrl': '"""/login"""'}), "(tokenUrl='/login')\n", (207, 226), False, 'from fastapi.security import OAuth2PasswordBearer\n'), ((266, 284), 'fastapi.Depends', 'Depends', (['get_token'], {}), '(get_token)\n', (273, 284), False, 'from... |
#!/usr/bin/env python
#
# Author: <NAME>.
# Email:
#
from __future__ import print_function
from collections import defaultdict
import sys
import DNS
import re
RE_PARSE = re.compile(r'(ip4|ip6|include|redirect)[:=](.*)', re.IGNORECASE)
MAX_RECURSION = 5
def dns_txt(domain):
try:
resp = DNS.dnslookup(domain, 'TX... | [
"collections.defaultdict",
"DNS.dnslookup",
"re.compile"
] | [((172, 235), 're.compile', 're.compile', (['"""(ip4|ip6|include|redirect)[:=](.*)"""', 're.IGNORECASE'], {}), "('(ip4|ip6|include|redirect)[:=](.*)', re.IGNORECASE)\n", (182, 235), False, 'import re\n'), ((525, 541), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (536, 541), False, 'from collectio... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue May 19 18:08:01 2020
@author: <NAME>
Implementação do ajuste do modelo SEIIHURD com separação de grupos. Necessita
de mais verificações e funções para simplificar o input. Baseado nas classes
disponíveis no modelos.py
"""
import numpy as np
from funct... | [
"numpy.ones_like",
"scipy.optimize.least_squares",
"numpy.sqrt",
"numpy.random.rand",
"scipy.integrate.odeint",
"numpy.flatnonzero",
"pyswarms.single.LocalBestPSO",
"joblib.Parallel",
"numpy.array",
"numpy.split",
"numpy.zeros",
"numpy.empty",
"numpy.isnan",
"copy.deepcopy",
"joblib.dela... | [((987, 4278), 'numpy.array', 'np.array', (['[[0.47868515, 0.50507561, 0.29848922, 0.15763748, 0.26276959, 0.40185462, \n 0.46855027, 0.42581354, 0.2150961, 0.0856771, 0.08705463, 0.07551931, \n 0.05129175, 0.02344832, 0.00793644, 0.01072846], [0.35580205, \n 0.77874482, 0.51392686, 0.21151069, 0.08597966, 0.2... |
# -*- coding: utf-8 -*-
import os
import sys
from gluon import current
from gluon.storage import Storage
__all__ = ("PluginLoader",
)
# Name of the plugin directory in modules
PLUGINS = "plugins"
# Module names to ignore when scanning for plugins
IGNORE = ("skeleton", "__init__")
# Name of the setup fu... | [
"os.listdir",
"os.path.join",
"os.path.splitext",
"gluon.current.log.error",
"os.path.isdir",
"sys.modules.get"
] | [((7235, 7275), 'os.path.join', 'os.path.join', (['folder', '"""modules"""', 'PLUGINS'], {}), "(folder, 'modules', PLUGINS)\n", (7247, 7275), False, 'import os\n'), ((7293, 7309), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (7303, 7309), False, 'import os\n'), ((8183, 8211), 'sys.modules.get', 'sys.modules.... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'ccm.ui'
#
# Created by: PyQt5 UI code generator 5.13.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_CCMTask(object):
def setupUi(self, CCMTask):
CCMTask.setObjec... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTextEdit",
"PyQt5.QtGui.QFont",
"PyQt5.QtWidgets.QSpacerItem",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QSplitter",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QStatusBar",
... | [((391, 479), 'PyQt5.QtWidgets.QSizePolicy', 'QtWidgets.QSizePolicy', (['QtWidgets.QSizePolicy.Ignored', 'QtWidgets.QSizePolicy.Ignored'], {}), '(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.\n Ignored)\n', (412, 479), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((754, 780), 'PyQt5.QtWidgets.QWid... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
"subprocess.check_output",
"os.path.exists",
"socket.getfqdn",
"re.compile",
"os.path.join",
"os.environ.get",
"multiprocessing.cpu_count",
"os.path.dirname",
"os.path.isdir",
"sys.exit",
"warnings.simplefilter"
] | [((901, 932), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {}), "('ignore')\n", (922, 932), False, 'import warnings\n'), ((2572, 2612), 'os.path.dirname', 'os.path.dirname', (["context['PROJECT_PATH']"], {}), "(context['PROJECT_PATH'])\n", (2587, 2612), False, 'import os\n'), ((2810, 2858), 'os.... |
import random
import numpy as np
import tensorflow as tf
from collections import deque
class PrioritizedReplayBuffer():
""" Class implements Prioritized Experience Replay (PER)
"""
def __init__(self, maxlen):
""" PER constructor
Args:
maxlen (int): buffer length
"""
... | [
"numpy.array",
"collections.deque"
] | [((400, 425), 'collections.deque', 'deque', ([], {'maxlen': 'self.maxlen'}), '(maxlen=self.maxlen)\n', (405, 425), False, 'from collections import deque\n'), ((452, 477), 'collections.deque', 'deque', ([], {'maxlen': 'self.maxlen'}), '(maxlen=self.maxlen)\n', (457, 477), False, 'from collections import deque\n'), ((124... |
#!/usr/bin/python3
# coding=utf-8
# 环境准备:pip install opencv_contrib_python
# 输入话题:tianbot_mini/image_raw/compressed
# 输出话题:roi
import sys
import os
import rospy
import sensor_msgs.msg
from cv_bridge import CvBridge
import cv2
import numpy as np
from sensor_msgs.msg import RegionOfInterest as ROI
from sensor_msgs.msg ... | [
"cv2.rectangle",
"cv2.TrackerGOTURN_create",
"rospy.init_node",
"cv2.TrackerKCF_create",
"cv2.imshow",
"cv2.TrackerMedianFlow_create",
"cv2.__version__.split",
"cv2.TrackerMIL_create",
"cv2.Tracker_create",
"cv_bridge.CvBridge",
"rospy.Subscriber",
"cv2.waitKey",
"sensor_msgs.msg.RegionOfInt... | [((350, 360), 'cv_bridge.CvBridge', 'CvBridge', ([], {}), '()\n', (358, 360), False, 'from cv_bridge import CvBridge\n'), ((4002, 4035), 'numpy.zeros', 'np.zeros', (['(640, 640, 3)', 'np.uint8'], {}), '((640, 640, 3), np.uint8)\n', (4010, 4035), True, 'import numpy as np\n'), ((4124, 4163), 'rospy.init_node', 'rospy.in... |
# -*- coding:utf-8 -*-
# @Author: ZhaoWen <<EMAIL>>
# @Date: 2021/1/2
# @GiteePath: https://gitee.com/openeuler2020/team-1186152014
from method_analysis_utils.scanner import get_scanner,token_type
import os
import logging.config
from method_analysis_utils.complier import get_complier
# 配置日志
logging.config.fileConfi... | [
"method_analysis_utils.scanner.get_scanner",
"method_analysis_utils.scanner.token_type",
"method_analysis_utils.complier.get_complier"
] | [((455, 469), 'method_analysis_utils.complier.get_complier', 'get_complier', ([], {}), '()\n', (467, 469), False, 'from method_analysis_utils.complier import get_complier\n'), ((601, 614), 'method_analysis_utils.scanner.get_scanner', 'get_scanner', ([], {}), '()\n', (612, 614), False, 'from method_analysis_utils.scanne... |
from configparser import RawConfigParser
config = RawConfigParser()
config.read("configuration/config.ini")
class ReadConfig():
@staticmethod
def getApplicationURL():
url = (config.get('common info', 'baseURL'))
return url
@staticmethod
def getUserName():
username = (config.get('common info', 'username'))... | [
"configparser.RawConfigParser"
] | [((51, 68), 'configparser.RawConfigParser', 'RawConfigParser', ([], {}), '()\n', (66, 68), False, 'from configparser import RawConfigParser\n')] |
from __future__ import print_function
import warnings
import numpy as np
C4 = 261.6 # Hz
piano_max = 4186.01 # Hz
piano_min = 27.5000 # Hz - not audible
__all__ = ['cent_per_value','get_f_min','get_f_max','FrequencyScale']
def cent_per_value(f_min, f_max, v_min, v_max):
"""
This function takes in a freque... | [
"warnings.warn",
"numpy.log2",
"numpy.round"
] | [((841, 863), 'numpy.log2', 'np.log2', (['(f_max / f_min)'], {}), '(f_max / f_min)\n', (848, 863), True, 'import numpy as np\n'), ((5680, 5737), 'warnings.warn', 'warnings.warn', (['"""Min y value is greater than max y value."""'], {}), "('Min y value is greater than max y value.')\n", (5693, 5737), False, 'import warn... |
from apscheduler.schedulers.background import BackgroundScheduler
from des.ccd import start_pipeline
def download_queue():
start_pipeline()
scheduler = BackgroundScheduler()
scheduler.add_job(
download_queue,
'interval',
# minutes=1
seconds=20,
max_instances=1,
id='des_download_ccd'
)
... | [
"des.ccd.start_pipeline",
"apscheduler.schedulers.background.BackgroundScheduler"
] | [((161, 182), 'apscheduler.schedulers.background.BackgroundScheduler', 'BackgroundScheduler', ([], {}), '()\n', (180, 182), False, 'from apscheduler.schedulers.background import BackgroundScheduler\n'), ((130, 146), 'des.ccd.start_pipeline', 'start_pipeline', ([], {}), '()\n', (144, 146), False, 'from des.ccd import st... |
#!/usr/bin/env python
import os
import sys
import re
import math
import random
import matplotlib.pyplot as plt
import numpy as np
from google.protobuf import text_format
sys.path.append(os.path.dirname(os.path.realpath(__file__))+"/../../build")
import gsbn_pb2
if len(sys.argv) < 1:
print("Arguments wrong! Please r... | [
"gsbn_pb2.StimRawData",
"os.path.realpath"
] | [((502, 524), 'gsbn_pb2.StimRawData', 'gsbn_pb2.StimRawData', ([], {}), '()\n', (522, 524), False, 'import gsbn_pb2\n'), ((204, 230), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (220, 230), False, 'import os\n'), ((359, 385), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(... |
#!/usr/bin/env python3
from geopy.geocoders import Nominatim
locator = Nominatim(user_agent="getcity")
loc = locator.geocode("Munich")
print(loc.latitude, loc.longitude)
| [
"geopy.geocoders.Nominatim"
] | [((74, 105), 'geopy.geocoders.Nominatim', 'Nominatim', ([], {'user_agent': '"""getcity"""'}), "(user_agent='getcity')\n", (83, 105), False, 'from geopy.geocoders import Nominatim\n')] |
from django.contrib.auth.models import User
from django.db import models
from markdownx.models import MarkdownxField
class Category(models.Model):
"""
Represents a COCO category
"""
coco_id = models.IntegerField(unique=True, db_index=True)
name = models.CharField(max_length=50)
supercategory =... | [
"django.db.models.FloatField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"markdownx.models.MarkdownxField",
"django.db.models.ImageField",
"dja... | [((210, 257), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'unique': '(True)', 'db_index': '(True)'}), '(unique=True, db_index=True)\n', (229, 257), False, 'from django.db import models\n'), ((269, 300), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n'... |
import json
from newsservice.models import News
from flask import (Blueprint, request)
bp = Blueprint('request', __name__)
@bp.route('/requestnews', methods=['GET', 'POST'])
def requestdb():
"""
This Method receives filter values as a JSON and uses these to make queries at the database.
It creates a Lis... | [
"json.dumps",
"flask.Blueprint",
"newsservice.models.News.query.all"
] | [((94, 124), 'flask.Blueprint', 'Blueprint', (['"""request"""', '__name__'], {}), "('request', __name__)\n", (103, 124), False, 'from flask import Blueprint, request\n'), ((559, 575), 'newsservice.models.News.query.all', 'News.query.all', ([], {}), '()\n', (573, 575), False, 'from newsservice.models import News\n'), ((... |
import re
import unittest
from rexlex import Lexer
from rexlex.lexer.itemclass import get_itemclass
class TestableLexer(Lexer):
"""Test tuple state transitions including #pop."""
LOGLEVEL = None
re_skip = re.compile('\s+')
tokendefs = {
'root': [
('Root', 'a', 'bar'),
... | [
"rexlex.lexer.itemclass.get_itemclass",
"re.compile"
] | [((222, 240), 're.compile', 're.compile', (['"""\\\\s+"""'], {}), "('\\\\s+')\n", (232, 240), False, 'import re\n'), ((575, 594), 'rexlex.lexer.itemclass.get_itemclass', 'get_itemclass', (['text'], {}), '(text)\n', (588, 594), False, 'from rexlex.lexer.itemclass import get_itemclass\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue May 30 16:43:10 2017
☜☜☜☜☜☜★☆★☆★☆★☆ provided code ★☆★☆★☆★☆☞☞☞☞☞☞
@author: Minsooyeo
"""
import os
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
from PIL import Image as im
import numpy as np
import utills as ut
import tensorflow as tf
sess = tf.InteractiveS... | [
"tensorflow.InteractiveSession",
"numpy.reshape",
"utills._FlatModel",
"utills._DropOut",
"utills._SoftMax",
"os.getcwd",
"tensorflow.global_variables_initializer",
"utills._CNNModel",
"numpy.zeros",
"numpy.concatenate",
"utills.Nextbatch",
"utills._SetAccuracy",
"numpy.random.permutation"
] | [((305, 328), 'tensorflow.InteractiveSession', 'tf.InteractiveSession', ([], {}), '()\n', (326, 328), True, 'import tensorflow as tf\n'), ((809, 820), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (818, 820), False, 'import os\n'), ((2117, 2155), 'numpy.random.permutation', 'np.random.permutation', (['total_data_poin'], ... |
import numpy as np
from common import projection_back
EPS = 1e-9
def ilrma(mix, n_iter, n_basis=2, proj_back=True):
"""Implementation of ILRMA (Independent Low-Rank Matrix Analysis).
This algorithm is called ILRMA1 in http://d-kitamura.net/pdf/misc/AlgorithmsForIndependentLowRankMatrixAnalysis.pdf
It on... | [
"numpy.clip",
"numpy.abs",
"numpy.eye",
"numpy.linalg.solve",
"numpy.sqrt",
"numpy.ones",
"numpy.conj",
"numpy.sum",
"numpy.matmul",
"common.projection_back",
"numpy.random.randn"
] | [((1098, 1137), 'numpy.random.randn', 'np.random.randn', (['n_src', 'n_freq', 'n_basis'], {}), '(n_src, n_freq, n_basis)\n', (1113, 1137), True, 'import numpy as np\n'), ((1156, 1196), 'numpy.random.randn', 'np.random.randn', (['n_src', 'n_basis', 'n_frame'], {}), '(n_src, n_basis, n_frame)\n', (1171, 1196), True, 'imp... |
import random
import math
from functools import reduce
import torch
import torch.nn as nn
def random_z_v(z_dim, z_num):
# ret = np.random.normal(0.01, 1.0, z_dim * z_num)
return torch.distributions.normal.Normal(torch.zeros([z_num, z_dim]), 0.1).sample()
class HyperNN(nn.Module):
def __init__(self, obs_... | [
"torch.nn.ReLU",
"math.ceil",
"functools.reduce",
"torch.Tensor",
"torch.nn.init.kaiming_normal_",
"torch.nn.Linear",
"random.random",
"torch.zeros",
"torch.cat"
] | [((1585, 1600), 'random.random', 'random.random', ([], {}), '()\n', (1598, 1600), False, 'import random\n'), ((3713, 3728), 'torch.Tensor', 'torch.Tensor', (['w'], {}), '(w)\n', (3725, 3728), False, 'import torch\n'), ((813, 843), 'torch.nn.Linear', 'nn.Linear', (['self.z_dim', 'in_size'], {}), '(self.z_dim, in_size)\n... |
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# [0,0] = TN
# [1,1] = TP
# [0,1] = FP
# [1,0] = FN
# cm is a confusion matrix
# Accuracy: (TP + TN) / Total
def accuracy(cm: pd.DataFrame) -> float:
return (cm[0,0] + cm[1,1]) / cm.sum()
# Precision: TP / (TP + FP)
de... | [
"numpy.mean",
"numpy.delete",
"seaborn.heatmap",
"numpy.squeeze",
"numpy.array_split",
"numpy.array",
"numpy.random.randint",
"numpy.zeros",
"matplotlib.pyplot.figure",
"numpy.random.seed",
"numpy.empty",
"numpy.concatenate",
"pandas.DataFrame",
"numpy.arange",
"numpy.random.shuffle"
] | [((1018, 1034), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (1026, 1034), True, 'import numpy as np\n'), ((1142, 1196), 'pandas.DataFrame', 'pd.DataFrame', (['cm'], {'columns': "['0', '1']", 'index': "['0', '1']"}), "(cm, columns=['0', '1'], index=['0', '1'])\n", (1154, 1196), True, 'import pandas as pd\... |
from __future__ import print_function
import numba.unittest_support as unittest
from numba.utils import PYVERSION
from .support import TestCase, enable_pyobj_flags
def build_set_usecase(*args):
ns = {}
src = """if 1:
def build_set():
return {%s}
""" % ', '.join(repr(arg) for arg in args)
... | [
"numba.unittest_support.main",
"numba.unittest_support.skipIf"
] | [((423, 508), 'numba.unittest_support.skipIf', 'unittest.skipIf', (['(PYVERSION < (2, 7))', '"""set literals unavailable before Python 2.7"""'], {}), "(PYVERSION < (2, 7),\n 'set literals unavailable before Python 2.7')\n", (438, 508), True, 'import numba.unittest_support as unittest\n'), ((1261, 1276), 'numba.unitt... |
from pep272_encryption import PEP272Cipher, MODE_ECB
block_size = 1
key_size = 0
def new(*args, **kwargs):
return RC4Cipher(*args, **kwargs)
class RC4Cipher(PEP272Cipher):
block_size = 1
key_size = 0
def __init__(self, key, mode=MODE_ECB, **kwargs):
if mode != MODE_ECB:
raise V... | [
"pep272_encryption.PEP272Cipher.__init__"
] | [((600, 648), 'pep272_encryption.PEP272Cipher.__init__', 'PEP272Cipher.__init__', (['self', 'key', 'mode'], {}), '(self, key, mode, **kwargs)\n', (621, 648), False, 'from pep272_encryption import PEP272Cipher, MODE_ECB\n')] |
"""
color_scheme_matcher.
Licensed under MIT.
Copyright (C) 2012 <NAME> <<EMAIL>>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to... | [
"collections.namedtuple",
"sublime.score_selector",
"re.match",
"os.path.normpath",
"os.path.basename",
"sublime.platform"
] | [((1530, 1679), 'collections.namedtuple', 'namedtuple', (['"""SchemeColors"""', "['fg', 'fg_simulated', 'bg', 'bg_simulated', 'style', 'fg_selector',\n 'bg_selector', 'style_selectors']"], {'verbose': '(False)'}), "('SchemeColors', ['fg', 'fg_simulated', 'bg', 'bg_simulated',\n 'style', 'fg_selector', 'bg_selecto... |
import re
class Node:
def __init__(self, id, ip, hostname, type):
self.id = id
self.ip = ip
self.hostname = hostname
self.type = type
self.validate()
def validate(self):
self.illegal = False
if re.match("^(\d{1,3}\.){3}\d{1,3}$", self.ip):
... | [
"re.match"
] | [((262, 309), 're.match', 're.match', (['"""^(\\\\d{1,3}\\\\.){3}\\\\d{1,3}$"""', 'self.ip'], {}), "('^(\\\\d{1,3}\\\\.){3}\\\\d{1,3}$', self.ip)\n", (270, 309), False, 'import re\n')] |
import math
def radix_sort(arr):
if arr != []:
bucket_size = 10
maxLength = False
temp = -1
placement = 1
while not maxLength:
maxLength = True
buckets = [list() for i in range( bucket_size )]
#empty the arr
for i in arr:
... | [
"math.floor"
] | [((339, 364), 'math.floor', 'math.floor', (['(i / placement)'], {}), '(i / placement)\n', (349, 364), False, 'import math\n')] |
from django.conf.urls import url
from django.contrib.auth import views as auth_views
from django.contrib.auth import views
from . import views
urlpatterns = [
#Custom login view
# url(r'^login/$', views.user_login, name='login'),
#Builtin login view
url(r'^login/$', auth_views.login, name='login'),
... | [
"django.conf.urls.url"
] | [((268, 315), 'django.conf.urls.url', 'url', (['"""^login/$"""', 'auth_views.login'], {'name': '"""login"""'}), "('^login/$', auth_views.login, name='login')\n", (271, 315), False, 'from django.conf.urls import url\n'), ((322, 361), 'django.conf.urls.url', 'url', (['"""^edit/$"""', 'views.edit'], {'name': '"""edit"""'}... |
# -*- coding: utf-8 -*-
from pyfr.mpiutil import get_comm_rank_root
from pyfr.plugins.base import BasePlugin, init_csv
class DtStatsPlugin(BasePlugin):
name = 'dtstats'
systems = ['*']
formulations = ['std']
def __init__(self, intg, cfgsect, prefix):
super().__init__(intg, cfgsect, prefix)
... | [
"pyfr.plugins.base.init_csv",
"pyfr.mpiutil.get_comm_rank_root"
] | [((522, 542), 'pyfr.mpiutil.get_comm_rank_root', 'get_comm_rank_root', ([], {}), '()\n', (540, 542), False, 'from pyfr.mpiutil import get_comm_rank_root\n'), ((647, 697), 'pyfr.plugins.base.init_csv', 'init_csv', (['self.cfg', 'cfgsect', '"""n,t,dt,action,error"""'], {}), "(self.cfg, cfgsect, 'n,t,dt,action,error')\n",... |
import math
import random
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from fmt.pythonfmt.doubleintegrator import filter_reachable, gen_trajectory, show_trajectory
from fmt.pythonfmt.world import World
def dist2(p, q):
return math.sqrt((p[1] - q[1]) ** 2 + (p[2] - q[2]) ** 2)
# FM... | [
"numpy.ones",
"numpy.random.default_rng",
"fmt.pythonfmt.doubleintegrator.gen_trajectory",
"fmt.pythonfmt.doubleintegrator.show_trajectory",
"math.sqrt",
"numpy.array",
"numpy.zeros",
"numpy.empty",
"numpy.concatenate",
"numpy.nonzero",
"numpy.argmin",
"random.random",
"matplotlib.pyplot.pau... | [((263, 313), 'math.sqrt', 'math.sqrt', (['((p[1] - q[1]) ** 2 + (p[2] - q[2]) ** 2)'], {}), '((p[1] - q[1]) ** 2 + (p[2] - q[2]) ** 2)\n', (272, 313), False, 'import math\n'), ((1135, 1151), 'numpy.zeros', 'np.zeros', (['(N, 4)'], {}), '((N, 4))\n', (1143, 1151), True, 'import numpy as np\n'), ((1178, 1194), 'numpy.ar... |
# import unittest
import logging
from timeit import timeit
logging.basicConfig(level=logging.INFO)
def memoize(function):
cache = {}
def memo(*args):
if args not in cache:
cache[args] = function(*args)
return cache[args]
return memo
@memoize
def edit_distance_recursive(sou... | [
"logging.basicConfig",
"timeit.timeit"
] | [((60, 99), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (79, 99), False, 'import logging\n'), ((2032, 2162), 'timeit.timeit', 'timeit', (['"""edit_distance_recursive("intention", "execution")"""'], {'setup': '"""from __main__ import edit_distance_recursive"""... |
import sys
import os
import json
import hashlib
import logging
import base64
import shutil
from concurrent.futures import ProcessPoolExecutor
from subprocess import Popen, PIPE, STDOUT
from jvd.disassembler import DisassemblerAbstract
import logging as log
import traceback
from jvd.utils import read_gz_js, write_gz_js,... | [
"idaapi.get_func",
"os.path.exists",
"jvd.resources.require",
"idaapi.execute_sync",
"jvd.utils.write_gz_js",
"jvd.ghidra.decompiler.process",
"threading.Timer",
"jvd.ida.ida_utils.get_all",
"os.path.join",
"os.environ.copy",
"os.path.realpath",
"jvd.utils.read_gz_js",
"platform.system",
"... | [((490, 524), 'os.path.join', 'os.path.join', (['SRC', '"""ida_script.py"""'], {}), "(SRC, 'ida_script.py')\n", (502, 524), False, 'import os\n'), ((446, 472), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (462, 472), False, 'import os\n'), ((658, 675), 'platform.system', 'platform.system'... |
# Imports
import socket
import subprocess
import os
import requests
# from prettytable import PrettyTable
import getpass
import CONFIG
def send_message(text):
try:
requests.post('https://slack.com/api/chat.postMessage', {
'token': CONFIG.SLACK_TOKEN,
'channel': CONFIG.SLACK_CHANNEL_INFO,
... | [
"subprocess.check_output",
"requests.post",
"socket.socket",
"os.popen",
"getpass.getuser",
"socket.gethostname"
] | [((480, 497), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (495, 497), False, 'import getpass\n'), ((530, 550), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (548, 550), False, 'import socket\n'), ((594, 642), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(... |
import typing as t
import warnings
from .error_handler import MissingExtensionError, MissingExtensionWarning
class ExtensionMixin:
"""
A base class for mixing in custom classes (extensions) into another classes.
"""
AUTHOR = "unknown"
NAME = "unknown"
ID = f"{AUTHOR}-{NAME}"
SOFT_... | [
"warnings.warn"
] | [((2853, 2994), 'warnings.warn', 'warnings.warn', (['f"""`{extension}` softly depends on `{soft_dependency}`. Some features might be unavailable."""', 'MissingExtensionWarning'], {}), "(\n f'`{extension}` softly depends on `{soft_dependency}`. Some features might be unavailable.'\n , MissingExtensionWarning)\n", ... |
import numpy as np
import h5py
import pyglib.basic.units as units
import pyglib.basic.splot as splot
'''
Equation of state.
'''
def Murnaghan(parameters, vol):
'''
Given a vector of parameters and volumes, return a vector of energies.
equation From PRB 28,5480 (1983)
'''
E0 = parameters[0]
B0... | [
"pyglib.basic.splot.xy_plot",
"pylab.polyfit",
"pyglib.basic.splot.xy2_plot",
"h5py.File",
"scipy.optimize.leastsq",
"scipy.interpolate.UnivariateSpline"
] | [((1148, 1164), 'pylab.polyfit', 'polyfit', (['v', 'e', '(2)'], {}), '(v, e, 2)\n', (1155, 1164), False, 'from pylab import polyfit\n'), ((1844, 1881), 'scipy.optimize.leastsq', 'leastsq', (['eos_fit_fun', 'x0'], {'args': '(e, v)'}), '(eos_fit_fun, x0, args=(e, v))\n', (1851, 1881), False, 'from scipy.optimize import l... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 27 23:58:37 2020
@author: manal
"""
import numpy as np
import GPy
from GPy.kern.src.stationary import Stationary
class Cosine_prod(Stationary):
"""
Cosine kernel:
Product of 1D Cosine kernels
.. math::
&k(x,x')_i = ... | [
"numpy.sin",
"numpy.prod",
"numpy.zeros",
"numpy.cos"
] | [((1126, 1145), 'numpy.zeros', 'np.zeros', (['(m, m, n)'], {}), '((m, m, n))\n', (1134, 1145), True, 'import numpy as np\n'), ((1749, 1768), 'numpy.zeros', 'np.zeros', (['(m, m, n)'], {}), '((m, m, n))\n', (1757, 1768), True, 'import numpy as np\n'), ((1864, 1888), 'numpy.sin', 'np.sin', (['dist[:, :, dimX]'], {}), '(d... |
import logging
logging.basicConfig(level=logging.INFO, format="%(asctime)s %(levelname)s (%(threadName)s-%(process)d) %(message)s")
__version__ = "2.2.0"
| [
"logging.basicConfig"
] | [((16, 137), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s %(levelname)s (%(threadName)s-%(process)d) %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s %(levelname)s (%(threadName)s-%(process)d) %(message)s')\n", (35, 137), False, 'import logging... |
import logging
import time
from pathlib import Path
from subprocess import call
import cli
def parse_args(args):
parser = cli.argparser()
subparsers = parser.add_subparsers(
help="Arguments for specific action.", dest="dtype"
)
subparsers.required = True
slurm = subparsers.add_parser("s... | [
"pathlib.Path",
"pathlib.Path.home",
"subprocess.call",
"cli.argparser",
"logging.error"
] | [((129, 144), 'cli.argparser', 'cli.argparser', ([], {}), '()\n', (142, 144), False, 'import cli\n'), ((2845, 2879), 'pathlib.Path', 'Path', (['f"""{args.outdir}/{args.name}"""'], {}), "(f'{args.outdir}/{args.name}')\n", (2849, 2879), False, 'from pathlib import Path\n'), ((3250, 3274), 'subprocess.call', 'call', (['[s... |
from dataclasses import dataclass, field
from typing import Any, Dict, List
from aiographql.client.error import GraphQLError
from aiographql.client.request import GraphQLRequestContainer
@dataclass(frozen=True)
class GraphQLBaseResponse(GraphQLRequestContainer):
json: Dict[str, Any] = field(default_factory=dict)... | [
"dataclasses.dataclass",
"dataclasses.field",
"aiographql.client.error.GraphQLError.load"
] | [((191, 213), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (200, 213), False, 'from dataclasses import dataclass, field\n'), ((324, 346), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (333, 346), False, 'from dataclasses import dataclass, fi... |
# Fichier main de gestion des ressources du robot
from micropython import const
from machine import *
from DRV8833 import *
from BME280 import *
import pycom
import time
import os
# Variables globales pour moteurs et pont en H
DRV8833_Sleep_pin = "P20" # Pin SLEEP
DRV8833_AIN1 = "P22" # Entrée PWM moteu... | [
"time.sleep"
] | [((3406, 3419), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (3416, 3419), False, 'import time\n'), ((3468, 3481), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (3478, 3481), False, 'import time\n'), ((3544, 3557), 'time.sleep', 'time.sleep', (['(2)'], {}), '(2)\n', (3554, 3557), False, 'import time\n'), (... |
from json import dumps
from typing import Callable
from flask.json import jsonify
from flask.wrappers import Response
from flask_verify.verify_json import verify_json_response
from pytest import raises
@verify_json_response
def _view_function_response() -> Response:
"""
To test if an endpoint that already ret... | [
"json.dumps",
"pytest.raises",
"flask.wrappers.Response"
] | [((779, 857), 'flask.wrappers.Response', 'Response', (['"""This is obviously not JSON."""'], {'content_type': '"""plain/text"""', 'status': '(200)'}), "('This is obviously not JSON.', content_type='plain/text', status=200)\n", (787, 857), False, 'from flask.wrappers import Response\n'), ((421, 458), 'json.dumps', 'dump... |
import numpy as np
import sys
import cv2
sys.path.append("../")
from utils.config import config
class TestLoader:
def __init__(self, imdb, batch_size=1, shuffle=False):
self.imdb = imdb
self.batch_size = batch_size
self.shuffle = shuffle
self.size = len(imdb)#num of data
... | [
"numpy.random.shuffle",
"sys.path.append",
"cv2.imread"
] | [((41, 63), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (56, 63), False, 'import sys\n'), ((1226, 1242), 'cv2.imread', 'cv2.imread', (['imdb'], {}), '(imdb)\n', (1236, 1242), False, 'import cv2\n'), ((516, 544), 'numpy.random.shuffle', 'np.random.shuffle', (['self.imdb'], {}), '(self.imdb)\n... |
import time
from unittest import mock
import pytest
from django.contrib.auth.models import AnonymousUser
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from django.http import Http404
from django.test import RequestFactory, TestCase
from django.urls import reverse
from wagtail.... | [
"core.models.Country.objects.create",
"tests.unit.core.factories.CuratedListPageFactory",
"tests.helpers.make_test_video",
"time.sleep",
"tests.unit.core.factories.TopicPageFactory",
"wagtail.core.models.Collection.objects.get_or_create",
"wagtail.images.tests.utils.get_test_image_file",
"wagtail_fact... | [((4414, 6025), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""querystring_to_add,expected_backlink_value"""', "(('', None), ('?return-link=%2Fexport-plan%2F1%2Fabout-your-business%2F',\n '/export-plan/1/about-your-business/'), (\n '?return-link=%2Fexport-plan%2F1%2Fabout-your-business%2F%3Ffoo%3Dbar... |
# Copyright (C) 2013 <NAME>
"""
This file provides a mpirun work-around for clusters that do not have the ibrun
command.
"""
import os, stat
class random_manningsn(object):
"""
This class is an implementation of
:class:`polyadcirc.run_framework.random_manningsn` that provides a
``mpirun`` based work-a... | [
"os.path.join"
] | [((3939, 3984), 'os.path.join', 'os.path.join', (['self.base_dir', 'self.script_name'], {}), '(self.base_dir, self.script_name)\n', (3951, 3984), False, 'import os, stat\n'), ((4003, 4048), 'os.path.join', 'os.path.join', (['self.base_dir', 'self.script_name'], {}), '(self.base_dir, self.script_name)\n', (4015, 4048), ... |
import unittest
import logging
from flask import Flask
@unittest.skip("needs refactoring")
class driftTestCase(unittest.TestCase):
def setUp(self):
self.app = Flask(__name__)
logging.basicConfig(level="ERROR")
self.app.testing = True
self.test_client = self.app.test_client()
... | [
"unittest.main",
"unittest.skip",
"logging.basicConfig",
"flask.Flask"
] | [((59, 93), 'unittest.skip', 'unittest.skip', (['"""needs refactoring"""'], {}), "('needs refactoring')\n", (72, 93), False, 'import unittest\n'), ((604, 619), 'unittest.main', 'unittest.main', ([], {}), '()\n', (617, 619), False, 'import unittest\n'), ((175, 190), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__... |
import os
import yaml
import xlrd
from openpyxl import load_workbook
from util_func import securely_check_dir
class ExcelHandler:
def __init__(self, config):
self.config = config
securely_check_dir('forms')
securely_check_dir('att')
securely_check_dir('config')
self.sub... | [
"os.path.exists",
"os.path.join",
"os.path.splitext",
"util_func.securely_check_dir",
"os.walk"
] | [((204, 231), 'util_func.securely_check_dir', 'securely_check_dir', (['"""forms"""'], {}), "('forms')\n", (222, 231), False, 'from util_func import securely_check_dir\n'), ((240, 265), 'util_func.securely_check_dir', 'securely_check_dir', (['"""att"""'], {}), "('att')\n", (258, 265), False, 'from util_func import secur... |
from ipware.ip import get_ip
from ipware.utils import is_private_ip
def is_private_ip_from_request(request) -> bool:
return is_private_ip(get_ip(request))
| [
"ipware.ip.get_ip"
] | [((144, 159), 'ipware.ip.get_ip', 'get_ip', (['request'], {}), '(request)\n', (150, 159), False, 'from ipware.ip import get_ip\n')] |
import urllib.request
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt
from PIL import Image
import os
def image_poster(title_address):
url = f'{title_address}'
req = urllib.request.Request(url)
res = urllib.request.urlopen(url).read()
soup = BeautifulSoup(res, 'html.parser')
soup = ... | [
"bs4.BeautifulSoup",
"matplotlib.pyplot.show"
] | [((275, 308), 'bs4.BeautifulSoup', 'BeautifulSoup', (['res', '"""html.parser"""'], {}), "(res, 'html.parser')\n", (288, 308), False, 'from bs4 import BeautifulSoup\n'), ((543, 553), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (551, 553), True, 'import matplotlib.pyplot as plt\n')] |
# -*- coding: utf-8 -*-
"""Nowruz at SemEval 2022: Tackling Cloze Tests with Transformers and Ordinal Regression
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/1RXkjBpzNJtc0WhhrKMjU-50rd5uSviX3
"""
import torch
import torch.nn as nn
from torch.functio... | [
"transformers.AutoModel.from_pretrained",
"torch.nn.Dropout",
"torch.nn.GELU",
"transformers.TrainingArguments",
"pandas.read_csv",
"torch.nn.CrossEntropyLoss",
"datasets.Dataset.from_dict",
"torch.sigmoid",
"data_loader.retrieve_labels_from_dataset_for_classification",
"numpy.array",
"data_load... | [((1360, 1402), 'pandas.read_csv', 'pd.read_csv', (['dataPath'], {'sep': '"""\t"""', 'quoting': '(3)'}), "(dataPath, sep='\\t', quoting=3)\n", (1371, 1402), True, 'import pandas as pd\n'), ((1436, 1476), 'data_loader.retrieve_instances_from_dataset', 'retrieve_instances_from_dataset', (['dataset'], {}), '(dataset)\n', ... |
'''
This provides the view functions for the /api/libraries endpoints
'''
import flask
from flask import current_app
class ApiEndpoint(object):
def __init__(self, blueprint):
blueprint.add_url_rule("/libraries/", view_func = self.get_libraries)
blueprint.add_url_rule("/libraries/<int:collection_i... | [
"flask.abort",
"flask.request.args.get",
"flask.jsonify"
] | [((569, 603), 'flask.jsonify', 'flask.jsonify', ([], {'libraries': 'libraries'}), '(libraries=libraries)\n', (582, 603), False, 'import flask\n'), ((927, 963), 'flask.jsonify', 'flask.jsonify', ([], {'collection': 'collection'}), '(collection=collection)\n', (940, 963), False, 'import flask\n'), ((895, 911), 'flask.abo... |
''' A module for defining and producing the linekey object, which is used
to determine and store information about data format in a CRREL
ice mass balance buoy.'''
class linekey:
def __init__(self,date_index = 0):
self.date_index = date_index
self.value_index = []
self.phenomena_names = [... | [
"dictionaries.title_dic",
"functions.is_number",
"csv.reader"
] | [((930, 947), 'csv.reader', 'csv.reader', (['fileh'], {}), '(fileh)\n', (940, 947), False, 'import csv\n'), ((2444, 2461), 'csv.reader', 'csv.reader', (['fileh'], {}), '(fileh)\n', (2454, 2461), False, 'import csv\n'), ((2521, 2545), 'dictionaries.title_dic', 'dictionaries.title_dic', ([], {}), '()\n', (2543, 2545), Fa... |
from flask import Flask, render_template, session, redirect, url_for
app = Flask(__name__)
app.config['SECRET_KEY'] = '<PASSWORD>'
@app.route('/')
def index():
return render_template('index.html')
@app.route('/set-background/<mode>')
def set_background(mode):
session['mode'] = mode
return red... | [
"flask.render_template",
"flask.session.pop",
"flask.url_for",
"flask.Flask"
] | [((78, 93), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (83, 93), False, 'from flask import Flask, render_template, session, redirect, url_for\n'), ((180, 209), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (195, 209), False, 'from flask import Flask, render... |
import random
from collections import deque
import networkx as nx
from lib import puzzle
def draw_grid(grid):
min_y, max_y = 0, 0
min_x, max_x = 0, 0
for y, x in grid:
if y < min_y:
min_y = y
if y > max_y:
max_y = y
if x < min_x:
min_x = x
... | [
"networkx.shortest_path",
"collections.deque",
"networkx.Graph"
] | [((715, 725), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (723, 725), True, 'import networkx as nx\n'), ((735, 752), 'collections.deque', 'deque', (['[position]'], {}), '([position])\n', (740, 752), False, 'from collections import deque\n'), ((1580, 1590), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1588, 1590... |
# --------------
# Import packages
import numpy as np
import pandas as pd
from scipy.stats import mode
# code starts here
bank=pd.read_csv(path)
categorical_var=bank.select_dtypes(include='object')
print(categorical_var)
numerical_var=bank.select_dtypes(include='number')
print(numerical_var)
# code ends here... | [
"pandas.pivot_table",
"pandas.read_csv"
] | [((133, 150), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (144, 150), True, 'import pandas as pd\n'), ((611, 722), 'pandas.pivot_table', 'pd.pivot_table', (['banks'], {'index': "['Gender', 'Married', 'Self_Employed']", 'values': "['LoanAmount']", 'aggfunc': '"""mean"""'}), "(banks, index=['Gender', 'M... |
# -*- coding: utf-8 -*-
""" Example definition of a borehole. A top-view plot of the borehole is
created and the borehole resistance is computed.
"""
from __future__ import absolute_import, division, print_function
import pygfunction as gt
from numpy import pi
def main():
# Borehole dimensions
H = 400. ... | [
"pygfunction.pipes.convective_heat_transfer_coefficient_circular_pipe",
"pygfunction.pipes.SingleUTube",
"pygfunction.pipes.borehole_thermal_resistance",
"pygfunction.boreholes.Borehole",
"pygfunction.pipes.conduction_thermal_resistance_circular_pipe"
] | [((792, 838), 'pygfunction.boreholes.Borehole', 'gt.boreholes.Borehole', (['H', 'D', 'r_b'], {'x': '(0.0)', 'y': '(0.0)'}), '(H, D, r_b, x=0.0, y=0.0)\n', (813, 838), True, 'import pygfunction as gt\n'), ((1357, 1429), 'pygfunction.pipes.conduction_thermal_resistance_circular_pipe', 'gt.pipes.conduction_thermal_resista... |
# -*- coding: UTF-8 -*-
from random import randint
import math
from project import matplt,database
from geopy.geocoders import Nominatim
from geopy import exc
import os, shutil
categ_coef = 17960
geolocator = Nominatim()
def clean_temp_folder(folder):
for the_file in os.listdir(folder):
file_path = os.p... | [
"os.listdir",
"project.matplt.plot_hist",
"geopy.geocoders.Nominatim",
"os.path.join",
"os.path.isfile",
"os.unlink",
"project.matplt.plot_scatter"
] | [((211, 222), 'geopy.geocoders.Nominatim', 'Nominatim', ([], {}), '()\n', (220, 222), False, 'from geopy.geocoders import Nominatim\n'), ((276, 294), 'os.listdir', 'os.listdir', (['folder'], {}), '(folder)\n', (286, 294), False, 'import os, shutil\n'), ((1213, 1250), 'project.matplt.plot_hist', 'matplt.plot_hist', (['t... |
#!/usr/bin/env python
import os
import re
import argparse
re_junk = re.compile(r'[._-]')
re_spaces = re.compile(r'\s\s+')
def print_rename(old_filename, new_filename):
print('{} -> {}'.format(old_filename, new_filename))
def print_and_rename(old_path, new_path):
print_rename(old_path, new_p... | [
"os.path.exists",
"argparse.ArgumentParser",
"re.compile",
"os.rename",
"os.path.splitext",
"os.path.split"
] | [((76, 95), 're.compile', 're.compile', (['"""[._-]"""'], {}), "('[._-]')\n", (86, 95), False, 'import re\n'), ((110, 131), 're.compile', 're.compile', (['"""\\\\s\\\\s+"""'], {}), "('\\\\s\\\\s+')\n", (120, 131), False, 'import re\n'), ((330, 359), 'os.rename', 'os.rename', (['old_path', 'new_path'], {}), '(old_path, ... |
# Copyright 2018-2020 Streamlit Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wr... | [
"threading.Lock",
"blinker.Signal"
] | [((2137, 2153), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (2151, 2153), False, 'import threading\n'), ((2186, 2436), 'blinker.Signal', 'Signal', ([], {'doc': '"""Emitted when a file list is added to the manager or updated.\n\n Parameters\n ----------\n session_id : str\n ... |
# encoding: utf-8
"""
build transform
"""
#import torchvision.transforms as T
#from PIL import Image
#from .transforms import RandomErasing,RandomErasingCorner
from .data_preprocessing import TrainAugmentation_albu,TestAugmentation_albu,TrainAugmentation_bone,TestAugmentation_bone
import torchvision.transforms as ... | [
"torchvision.transforms.CenterCrop",
"torchvision.transforms.RandomHorizontalFlip",
"torchvision.transforms.RandomCrop",
"torchvision.transforms.ColorJitter",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor"
] | [((804, 833), 'torchvision.transforms.RandomCrop', 'transforms.RandomCrop', (['resize'], {}), '(resize)\n', (825, 833), True, 'import torchvision.transforms as transforms\n'), ((847, 883), 'torchvision.transforms.RandomHorizontalFlip', 'transforms.RandomHorizontalFlip', (['(0.5)'], {}), '(0.5)\n', (878, 883), True, 'im... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is au... | [
"ansible.module_utils.basic.AnsibleModule",
"ansible_collections.cisco.nxos.plugins.module_utils.network.nxos.config.l3_interfaces.l3_interfaces.L3_interfaces"
] | [((9832, 9992), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'L3_interfacesArgs.argument_spec', 'required_if': 'required_if', 'mutually_exclusive': 'mutually_exclusive', 'supports_check_mode': '(True)'}), '(argument_spec=L3_interfacesArgs.argument_spec, required_if=\n required_... |
# MIT License
#
# Copyright (c) 2018 <NAME>, <EMAIL>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, mer... | [
"pytest.mark.parametrize",
"json.loads",
"tests.helpers.read_file",
"bscetl.jobs.exporters.traces_item_exporter.traces_item_exporter"
] | [((1557, 1725), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""resource_group"""', "['block_without_transactions', 'block_with_create', 'block_with_suicide',\n 'block_with_subtraces', 'block_with_error']"], {}), "('resource_group', ['block_without_transactions',\n 'block_with_create', 'block_with_sui... |
"""Module to add Employee fields to the User admin interface."""
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
from .models import Employee
class EmployeeInline(admin.StackedInline):
model = Employee
can_delete =... | [
"django.contrib.admin.site.unregister",
"django.contrib.admin.site.register"
] | [((520, 547), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['User'], {}), '(User)\n', (541, 547), False, 'from django.contrib import admin\n'), ((548, 584), 'django.contrib.admin.site.register', 'admin.site.register', (['User', 'UserAdmin'], {}), '(User, UserAdmin)\n', (567, 584), False, 'from djan... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
from dataclasses import dataclass
from pants.backend.codegen.thrift.apache.subsystem import ApacheThriftSubsystem
from pants.backend.code... | [
"logging.getLogger",
"pants.core.util_rules.source_files.SourceFilesRequest",
"pants.engine.fs.MergeDigests",
"dataclasses.dataclass",
"pants.engine.fs.RemovePrefix",
"pants.source.source_root.SourceRootsRequest.for_files",
"pants.engine.target.TransitiveTargetsRequest",
"pants.engine.process.BinaryPa... | [((1146, 1173), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1163, 1173), False, 'import logging\n'), ((1177, 1199), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (1186, 1199), False, 'from dataclasses import dataclass\n'), ((1352, 1374), 'datacla... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='DeliriumUser',
fields=[
('id', models.AutoField... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((304, 397), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)', 'verbose_name': '"""ID"""', 'auto_created': '(True)', 'serialize': '(False)'}), "(primary_key=True, verbose_name='ID', auto_created=True,\n serialize=False)\n", (320, 397), False, 'from django.db import models, migrations\... |
import os
import salt.utils.platform
from tests.support.mock import patch
from tests.support.unit import TestCase, skipIf
try:
import salt.utils.win_system as win_system
except Exception as exc: # pylint: disable=broad-except
win_system = exc
class WinSystemImportTestCase(TestCase):
"""
Simply impo... | [
"salt.utils.win_system.get_pending_computer_name",
"salt.utils.win_system.get_pending_domain_join",
"tests.support.mock.patch",
"salt.utils.win_system.get_computer_name",
"salt.utils.win_system.set_reboot_required_witnessed",
"os.environ.get",
"salt.utils.win_system.get_reboot_required_witnessed",
"sa... | [((865, 925), 'tests.support.mock.patch', 'patch', (['"""win32api.GetComputerNameEx"""'], {'return_value': '"""FAKENAME"""'}), "('win32api.GetComputerNameEx', return_value='FAKENAME')\n", (870, 925), False, 'from tests.support.mock import patch\n'), ((1119, 1173), 'tests.support.mock.patch', 'patch', (['"""win32api.Get... |
"""Tests for the bradley_terry module"""
# Copyright 2019 <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 app... | [
"numpy.array",
"numpy.seterr",
"numpy.full"
] | [((903, 925), 'numpy.seterr', 'np.seterr', ([], {'all': '"""raise"""'}), "(all='raise')\n", (912, 925), True, 'import numpy as np\n'), ((1101, 1121), 'numpy.array', 'np.array', (['[1.0, 2.0]'], {}), '([1.0, 2.0])\n', (1109, 1121), True, 'import numpy as np\n'), ((1148, 1168), 'numpy.array', 'np.array', (['[1.0, 2.0]'],... |
#!/usr/bin/env python3
"""Log Analysis Project for Full Stack Nanodegree by Udacity"""
import psycopg2
DBNAME = "news"
def three_most_popular_articles():
"""Queries and displays the top three most viewed articles."""
conn = psycopg2.connect(database=DBNAME)
cur = conn.cursor()
query = 'VIEW_top_thr... | [
"psycopg2.connect"
] | [((235, 268), 'psycopg2.connect', 'psycopg2.connect', ([], {'database': 'DBNAME'}), '(database=DBNAME)\n', (251, 268), False, 'import psycopg2\n'), ((799, 832), 'psycopg2.connect', 'psycopg2.connect', ([], {'database': 'DBNAME'}), '(database=DBNAME)\n', (815, 832), False, 'import psycopg2\n'), ((1358, 1391), 'psycopg2.... |
import torch
import torch.nn as nn
import pytorch_lightning as pl
from torchvision.models import (
alexnet,
vgg16_bn,
resnet18,
resnet34,
resnet50,
densenet121,
densenet161,
)
from torch.nn import functional as F
from pytorch_lightning.metrics.functional import accuracy, precision_recall
c... | [
"torch.optim.Adam",
"torch.optim.SGD",
"torchvision.models.densenet161",
"torch.stack",
"torchvision.models.resnet18",
"torchvision.models.alexnet",
"torchvision.models.resnet34",
"torchvision.models.vgg16_bn",
"torch.nn.Linear",
"torch.nn.functional.cross_entropy",
"torchvision.models.densenet1... | [((3826, 3851), 'torch.nn.functional.cross_entropy', 'F.cross_entropy', (['y_hat', 'y'], {}), '(y_hat, y)\n', (3841, 3851), True, 'from torch.nn import functional as F\n'), ((3992, 4017), 'torch.nn.functional.cross_entropy', 'F.cross_entropy', (['y_hat', 'y'], {}), '(y_hat, y)\n', (4007, 4017), True, 'from torch.nn imp... |
import gi
import time
import os
import json
gi.require_version('Notify', '0.7')
gi.require_version('Gtk', '3.0')
from gi.repository import Notify, Gtk
from gi.repository import Gio, GLib, GObject, Peas
from gi.repository import RB
from pypresence import Presence
from status_prefs import discord_status_prefs
class dis... | [
"gi.repository.Gtk.Dialog",
"pypresence.Presence",
"gi.repository.Gtk.HBox",
"gi.repository.Notify.uninit",
"gi.require_version",
"gi.repository.GObject.Object.__init__",
"os.path.realpath",
"gi.repository.Gtk.Label",
"gi.repository.Notify.init",
"os.getpid",
"gi.repository.Notify.Notification.n... | [((44, 79), 'gi.require_version', 'gi.require_version', (['"""Notify"""', '"""0.7"""'], {}), "('Notify', '0.7')\n", (62, 79), False, 'import gi\n'), ((80, 112), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (98, 112), False, 'import gi\n'), ((744, 774), 'pypresence.Pr... |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict"
] | [((7845, 7870), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (7864, 7870), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n')] |
from project.settings import INSTALLED_APPS, ALLOWED_HOSTS, BASE_DIR
import os
INSTALLED_APPS.append( 'webpack_loader',)
INSTALLED_APPS.append( 'app',)
ALLOWED_HOSTS.append('*',)
# STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATICFILES_DIRS = [
# os.path.join(BASE_DIR, 'static',)
os.path.join(BASE_DIR, ... | [
"project.settings.INSTALLED_APPS.append",
"project.settings.ALLOWED_HOSTS.append",
"os.path.join"
] | [((80, 119), 'project.settings.INSTALLED_APPS.append', 'INSTALLED_APPS.append', (['"""webpack_loader"""'], {}), "('webpack_loader')\n", (101, 119), False, 'from project.settings import INSTALLED_APPS, ALLOWED_HOSTS, BASE_DIR\n'), ((122, 150), 'project.settings.INSTALLED_APPS.append', 'INSTALLED_APPS.append', (['"""app"... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import numpy as np
from PyQt5 import QtWidgets as QtWid
import pyqtgraph as pg
from dvg_pyqtgraph_threadsafe import PlotCurve
USE_OPENGL = True
if USE_OPENGL:
print("OpenGL acceleration: Enabled")
pg.setConfigOptions(useOpenGL=True)
pg.setConfigO... | [
"PyQt5.QtWidgets.QHBoxLayout",
"pyqtgraph.setConfigOptions",
"numpy.array",
"PyQt5.QtWidgets.QApplication",
"pyqtgraph.GraphicsLayoutWidget",
"pyqtgraph.mkPen"
] | [((267, 302), 'pyqtgraph.setConfigOptions', 'pg.setConfigOptions', ([], {'useOpenGL': '(True)'}), '(useOpenGL=True)\n', (286, 302), True, 'import pyqtgraph as pg\n'), ((307, 342), 'pyqtgraph.setConfigOptions', 'pg.setConfigOptions', ([], {'antialias': '(True)'}), '(antialias=True)\n', (326, 342), True, 'import pyqtgrap... |
from turtle import forward, left, right, width, color, clearscreen
clearscreen()
color("lightblue")
width(3)
for i in range(6):
forward(50)
left(60)
forward(25)
left(180)
forward(25)
left(60)
forward(25)
left(180)
forward(25)
right(120)
forward(25)
left(180)
forwar... | [
"turtle.width",
"turtle.color",
"turtle.forward",
"turtle.right",
"turtle.left",
"turtle.clearscreen"
] | [((69, 82), 'turtle.clearscreen', 'clearscreen', ([], {}), '()\n', (80, 82), False, 'from turtle import forward, left, right, width, color, clearscreen\n'), ((83, 101), 'turtle.color', 'color', (['"""lightblue"""'], {}), "('lightblue')\n", (88, 101), False, 'from turtle import forward, left, right, width, color, clears... |
import numpy as np
import itertools
from .contrib import compress_filter, smooth, residual_model
from .contrib import reduce_interferences
def expectation_maximization(y, x, iterations=2, verbose=0, eps=None):
r"""Expectation maximization algorithm, for refining source separation
estimates.
This algorith... | [
"numpy.abs",
"numpy.eye",
"numpy.sqrt",
"numpy.linalg.pinv",
"numpy.conj",
"numpy.angle",
"numpy.sum",
"numpy.zeros",
"numpy.real",
"numpy.empty_like",
"numpy.zeros_like"
] | [((4979, 5045), 'numpy.zeros', 'np.zeros', (['(nb_bins, nb_channels, nb_channels, nb_sources)', 'x.dtype'], {}), '((nb_bins, nb_channels, nb_channels, nb_sources), x.dtype)\n', (4987, 5045), True, 'import numpy as np\n'), ((5054, 5096), 'numpy.zeros', 'np.zeros', (['(nb_frames, nb_bins, nb_sources)'], {}), '((nb_frames... |
# coding=utf-8
import logging
from subliminal.providers.legendastv import LegendasTVSubtitle as _LegendasTVSubtitle, \
LegendasTVProvider as _LegendasTVProvider, Episode, Movie, guess_matches, guessit, sanitize
logger = logging.getLogger(__name__)
class LegendasTVSubtitle(_LegendasTVSubtitle):
def __init__(... | [
"logging.getLogger",
"subliminal.providers.legendastv.guessit",
"subliminal.providers.legendastv.sanitize"
] | [((226, 253), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (243, 253), False, 'import logging\n'), ((1821, 1882), 'subliminal.providers.legendastv.guessit', 'guessit', (['self.name', "{'type': self.type, 'single_value': True}"], {}), "(self.name, {'type': self.type, 'single_value': True... |
from django.shortcuts import render, redirect, get_object_or_404
import json
from django.http import HttpResponse, Http404
from django.urls import reverse
from django.contrib.auth.decorators import login_required
from django.utils import timezone
# Create your views here.
from socialnetwork.forms import *
from soci... | [
"django.shortcuts.render",
"json.loads",
"datetime.datetime.strptime",
"socialnetwork.models.Profile.objects.get_or_create",
"django.http.HttpResponse",
"django.shortcuts.get_object_or_404",
"json.dumps",
"django.urls.reverse",
"requests.get",
"django.utils.timezone.now",
"socialnetwork.forms.Pr... | [((864, 912), 'socialnetwork.models.Profile.objects.get_or_create', 'Profile.objects.get_or_create', ([], {'user': 'request.user'}), '(user=request.user)\n', (893, 912), False, 'from socialnetwork.models import Profile\n'), ((952, 965), 'socialnetwork.forms.ProfileForm', 'ProfileForm', ([], {}), '()\n', (963, 965), Fal... |
"""
Run capture as a separate process
"""
import time
from barcap.barcode import BarcodeCapture
def main():
# Default camera index
camera_index = 0
# Camera selection routine
try:
from .device_list import select_camera, camera_list
# Get camera list
dev_list = camera_list()... | [
"barcap.barcode.BarcodeCapture",
"time.localtime",
"time.sleep"
] | [((549, 584), 'barcap.barcode.BarcodeCapture', 'BarcodeCapture', ([], {'camera': 'camera_index'}), '(camera=camera_index)\n', (563, 584), False, 'from barcap.barcode import BarcodeCapture\n'), ((1040, 1055), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (1050, 1055), False, 'import time\n'), ((839, 873), 'tim... |
import os
import requests
from typing import Optional, List
from pydantic import Field, validator
from dbt_cloud.command.command import DbtCloudAccountCommand
from dbt_cloud.field import JOB_ID_FIELD
class DbtCloudJobRunCommand(DbtCloudAccountCommand):
"""Triggers a dbt Cloud job run and returns a status JSON res... | [
"pydantic.Field",
"pydantic.validator"
] | [((379, 487), 'pydantic.Field', 'Field', ([], {'default': '"""Triggered via API"""', 'description': '"""A text description of the reason for running this job"""'}), "(default='Triggered via API', description=\n 'A text description of the reason for running this job')\n", (384, 487), False, 'from pydantic import Fiel... |
# Generated by Django 3.0.3 on 2020-10-14 12:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('modelzoo', '0023_model_con_mod_dims'),
]
operations = [
migrations.RemoveField(
model_name='model',
name='author_ema... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((236, 299), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""model"""', 'name': '"""author_email"""'}), "(model_name='model', name='author_email')\n", (258, 299), False, 'from django.db import migrations, models\n'), ((344, 406), 'django.db.migrations.RemoveField', 'migrations.Rem... |
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
import os
from time import time, localtime, strftime
import numpy as np
from scipy.io import savemat
from dotmap import DotMap
from src.modeling.trainers import BNN_trainer
from src.misc.DotmapUtils import ge... | [
"os.listdir",
"src.modeling.trainers.BNN_trainer",
"os.path.join",
"src.modeling.trainers.registry.get_config",
"src.controllers.MPC.MPC",
"os.rmdir",
"src.misc.Agent.Agent"
] | [((2186, 2212), 'src.misc.Agent.Agent', 'Agent', (['self.args', 'self.env'], {}), '(self.args, self.env)\n', (2191, 2212), False, 'from src.misc.Agent import Agent\n'), ((2296, 2330), 'src.modeling.trainers.BNN_trainer', 'BNN_trainer', (['self.args', 'self.model'], {}), '(self.args, self.model)\n', (2307, 2330), False,... |
from eblib import libcollect
# Create a LibCollect object
lc = libcollect.LibCollect()
# Prepare arguments for do_collect
#
# Path to the script (can be absolute or relative)
scriptname = 'plotting_data_monitor.pyw'
# Ask the resulting distribution to be placed in
# directory distrib
targetdir = 'distr... | [
"eblib.libcollect.LibCollect"
] | [((67, 90), 'eblib.libcollect.LibCollect', 'libcollect.LibCollect', ([], {}), '()\n', (88, 90), False, 'from eblib import libcollect\n')] |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance
# with the License. A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file accom... | [
"pytest.fixture",
"boto3.client",
"botocore.stub.Stubber"
] | [((618, 634), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (632, 634), False, 'import pytest\n'), ((1100, 1116), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1114, 1116), False, 'import pytest\n'), ((2214, 2235), 'boto3.client', 'boto3.client', (['service'], {}), '(service)\n', (2226, 2235), False, '... |