code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from django.contrib.auth.models import User
from rest_framework import viewsets
from rest_framework import permissions
from rest_framework.response import Response
from blog.models import Post
from blog.serializers import PostSerializer
from blog.serializers import UserSerializer
from blog.permissions import IsAuthor... | [
"django.contrib.auth.models.User.objects.all",
"blog.models.Post.objects.all"
] | [((473, 491), 'django.contrib.auth.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (489, 491), False, 'from django.contrib.auth.models import User\n'), ((706, 724), 'blog.models.Post.objects.all', 'Post.objects.all', ([], {}), '()\n', (722, 724), False, 'from blog.models import Post\n')] |
# -*- coding: utf-8 -*-
#
# Copyright 2017 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compli... | [
"git.Repo.init",
"responses.RequestsMock",
"click.testing.CliRunner",
"os.getcwd",
"shutil.rmtree",
"os.chdir",
"renku.api.LocalClient",
"git.Actor",
"tempfile.mkdtemp",
"contextlib.ExitStack",
"git.Repo",
"pytest.fixture"
] | [((942, 972), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (956, 972), False, 'import pytest\n'), ((1129, 1145), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1143, 1145), False, 'import pytest\n'), ((1346, 1362), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n... |
# -*- coding: utf-8 -*-
""" --- Description ---
Module:
Logger.py
Abstract:
A module for logging
Modified:
threemeninaboat3247 2018/04/30
--- End ---
"""
# Standard library imports
import logging
logger = logging.getLogger('Kuchinawa Log')
# ログレベルの設定
logger.setLevel(1... | [
"logging.getLogger",
"logging.Formatter",
"logging.StreamHandler",
"logging.FileHandler"
] | [((255, 289), 'logging.getLogger', 'logging.getLogger', (['"""Kuchinawa Log"""'], {}), "('Kuchinawa Log')\n", (272, 289), False, 'import logging\n'), ((346, 382), 'logging.FileHandler', 'logging.FileHandler', (['"""kuchinawa.log"""'], {}), "('kuchinawa.log')\n", (365, 382), False, 'import logging\n'), ((428, 451), 'log... |
""" Copyright 2012, 2013 UW Information Technology, University of Washington
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 r... | [
"django.core.cache.get_cache",
"django.test.client.Client",
"spotseeker_server.models.Spot.objects.create",
"mock.patch.object",
"django.test.utils.override_settings",
"simplejson.loads"
] | [((980, 1053), 'django.test.utils.override_settings', 'override_settings', ([], {'SPOTSEEKER_AUTH_MODULE': '"""spotseeker_server.auth.all_ok"""'}), "(SPOTSEEKER_AUTH_MODULE='spotseeker_server.auth.all_ok')\n", (997, 1053), False, 'from django.test.utils import override_settings\n'), ((1145, 1207), 'django.core.cache.ge... |
import pandas as pd
import numpy as np
from model.helper_functions import build_playlist_features
print('Reading data into memory')
pid_list = np.genfromtxt('../data/train_pids.csv', skip_header=1, dtype=int)
playlistfile = '../data/playlists.csv'
playlist_df = pd.read_csv(playlistfile)
trackfile = '../data/songs_1000... | [
"pandas.read_csv",
"model.helper_functions.build_playlist_features",
"pandas.concat",
"numpy.savetxt",
"pandas.get_dummies",
"numpy.genfromtxt"
] | [((144, 209), 'numpy.genfromtxt', 'np.genfromtxt', (['"""../data/train_pids.csv"""'], {'skip_header': '(1)', 'dtype': 'int'}), "('../data/train_pids.csv', skip_header=1, dtype=int)\n", (157, 209), True, 'import numpy as np\n'), ((263, 288), 'pandas.read_csv', 'pd.read_csv', (['playlistfile'], {}), '(playlistfile)\n', (... |
"""Defines an Table Status Message."""
# System imports
from enum import IntEnum
# Local source tree imports
from pyof.foundation.base import GenericMessage, GenericStruct
from pyof.foundation.basic_types import BinaryData, FixedTypeList, UBInt16, UBInt8, UBInt32, UBInt64, Pad
from pyof.v0x05.common.header import He... | [
"pyof.foundation.basic_types.Pad",
"pyof.v0x05.controller2switch.multipart_reply.TableDesc",
"pyof.foundation.basic_types.UBInt8",
"pyof.v0x05.common.header.Header"
] | [((911, 954), 'pyof.v0x05.common.header.Header', 'Header', ([], {'message_type': 'Type.OFPT_TABLE_STATUS'}), '(message_type=Type.OFPT_TABLE_STATUS)\n', (917, 954), False, 'from pyof.v0x05.common.header import Header, Type\n'), ((991, 1019), 'pyof.foundation.basic_types.UBInt8', 'UBInt8', ([], {'enum_ref': 'TableReason'... |
import torch
from torch.autograd import Function
class Identity(Function):
@staticmethod
def forward(ctx, x, name):
ctx.name = name
return x.clone()
def backward(ctx, grad):
import pydevd
pydevd.settrace(suspend=False, trace_only_current_thread=True)
grad_temp = gr... | [
"pydevd.settrace"
] | [((235, 297), 'pydevd.settrace', 'pydevd.settrace', ([], {'suspend': '(False)', 'trace_only_current_thread': '(True)'}), '(suspend=False, trace_only_current_thread=True)\n', (250, 297), False, 'import pydevd\n')] |
# Copyright 2022 Quantapix Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable l... | [
"collections.OrderedDict",
"os.path.join",
"os.path.isfile",
"unicodedata.category",
"os.path.isdir",
"unicodedata.normalize"
] | [((3002, 3027), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (3025, 3027), False, 'import collections\n'), ((9109, 9127), 'os.path.isdir', 'os.path.isdir', (['dir'], {}), '(dir)\n', (9122, 9127), False, 'import os\n'), ((11284, 11318), 'unicodedata.normalize', 'unicodedata.normalize', (['"""N... |
import datetime, os, base64
from flask import Flask, jsonify, request, Blueprint
from dbstore import dbconf
import json
from bson import json_util
# process kill
# lsof -i tcp:3000
file_upload = Blueprint('uploadAPI', __name__)
app = Flask(__name__)
def song_upload(val):
try:
# content = request.get_j... | [
"flask.Flask",
"dbstore.dbconf.file_store.update_one",
"bson.json_util.dumps",
"dbstore.dbconf.file_store.insert",
"datetime.datetime.now",
"flask.request.get_json",
"dbstore.dbconf.file_store.find",
"flask.Blueprint",
"flask.jsonify"
] | [((199, 231), 'flask.Blueprint', 'Blueprint', (['"""uploadAPI"""', '__name__'], {}), "('uploadAPI', __name__)\n", (208, 231), False, 'from flask import Flask, jsonify, request, Blueprint\n'), ((239, 254), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (244, 254), False, 'from flask import Flask, jsonify, r... |
# Generated by Django 3.2.2 on 2021-07-10 03:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('blweb', '0011_vehiclecolor'),
]
operations = [
migrations.AddField(
model_name='vehicleconfig',... | [
"django.db.models.ForeignKey"
] | [((365, 567), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'default': 'None', 'help_text': '"""The chosen color for this config"""', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""color"""', 'to': '"""blweb.vehiclecolor"""'}), "(blank=True, defaul... |
import numpy as np
import sys
import scipy.interpolate as interpolate
import asdf
from .function import *
from .basic_func import Basic
class Func:
'''
The list of (possible) `Func` attributes is given below:
Attributes
----------
'''
def __init__(self, MB, dust_model=0):
'''
... | [
"numpy.abs",
"numpy.log10",
"matplotlib.pyplot.plot",
"scipy.interpolate.interp1d",
"matplotlib.pyplot.close",
"numpy.lexsort",
"asdf.open",
"matplotlib.pyplot.show"
] | [((2825, 2882), 'asdf.open', 'asdf.open', (["(self.DIR_TMP + 'spec_all_' + self.ID + '.asdf')"], {}), "(self.DIR_TMP + 'spec_all_' + self.ID + '.asdf')\n", (2834, 2882), False, 'import asdf\n'), ((2905, 2946), 'asdf.open', 'asdf.open', (["(self.DIR_TMP + 'spec_all.asdf')"], {}), "(self.DIR_TMP + 'spec_all.asdf')\n", (2... |
import os
import sys
import json
from manager import dbmanager
def loadJson(filename):
print("loadJson: " + filename)
memoList = []
try:
if os.path.isfile(filename):
file = open(filename, 'r', encoding="UTF-8")
lines = file.readlines()
file.close()
... | [
"os.path.isfile",
"json.loads",
"manager.dbmanager.DBManager"
] | [((800, 828), 'manager.dbmanager.DBManager', 'dbmanager.DBManager', (['db_name'], {}), '(db_name)\n', (819, 828), False, 'from manager import dbmanager\n'), ((162, 186), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (176, 186), False, 'import os\n'), ((386, 402), 'json.loads', 'json.loads', ([... |
import FWCore.ParameterSet.Config as cms
# This modifier sets replaces the default pattern recognition with mkFit for tobTecStep
trackingMkFitTobTecStep = cms.Modifier()
| [
"FWCore.ParameterSet.Config.Modifier"
] | [((156, 170), 'FWCore.ParameterSet.Config.Modifier', 'cms.Modifier', ([], {}), '()\n', (168, 170), True, 'import FWCore.ParameterSet.Config as cms\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import,unicode_literals
from pythainlp.tools import get_path_db,get_path_data
from tinydb import TinyDB,Query
from future.moves.urllib.request import urlopen
from tqdm import tqdm
import requests
import os
import math
import requests
from nltk.corpus import names
... | [
"os.path.exists",
"os.path.getsize",
"tinydb.TinyDB",
"tinydb.Query",
"requests.get",
"pythainlp.tools.get_path_data",
"future.moves.urllib.request.urlopen",
"pythainlp.tools.get_path_db"
] | [((402, 415), 'pythainlp.tools.get_path_db', 'get_path_db', ([], {}), '()\n', (413, 415), False, 'from pythainlp.tools import get_path_db, get_path_data\n'), ((443, 459), 'tinydb.TinyDB', 'TinyDB', (['path_db_'], {}), '(path_db_)\n', (449, 459), False, 'from tinydb import TinyDB, Query\n'), ((471, 478), 'tinydb.Query',... |
__all__ = [
'Terminated',
'Unavailable',
'client',
'server',
]
import logging
import time
import curio
import nanomsg as nn
from garage import asyncs
from garage.assertions import ASSERT
from garage.asyncs import futures
from garage.asyncs import queues
LOG = logging.getLogger(__name__)
class Te... | [
"logging.getLogger",
"garage.asyncs.futures.Future",
"time.perf_counter",
"nanomsg.Message",
"garage.asyncs.TaskSet",
"curio.timeout_after",
"garage.asyncs.TaskStack",
"garage.assertions.ASSERT.equal"
] | [((282, 309), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (299, 309), False, 'import logging\n'), ((3978, 4030), 'garage.assertions.ASSERT.equal', 'ASSERT.equal', (['socket.options.nn_domain', 'nn.AF_SP_RAW'], {}), '(socket.options.nn_domain, nn.AF_SP_RAW)\n', (3990, 4030), False, 'fro... |
#! /usr/bin/env python3.5
# vim:ts=4:sw=4:ai:et:si:sts=4
import argparse
import json
import re
import os
import uuid
import shutil
import sys
import requests
filterRe = re.compile(r'(?P<block>^%=(?P<mode>.)?\s+(?P<label>.*?)\s+(?P<value>[^\s\n$]+)(?:\s*.*?)?^(?P<section>.*?)^=%.*?$)', re.M | re.S)
subItemRe = re.com... | [
"os.path.exists",
"argparse.ArgumentParser",
"re.compile",
"os.path.join",
"requests.get",
"uuid.uuid4",
"shutil.copyfile",
"json.load",
"sys.stdin.read",
"os.path.expanduser"
] | [((172, 315), 're.compile', 're.compile', (['"""(?P<block>^%=(?P<mode>.)?\\\\s+(?P<label>.*?)\\\\s+(?P<value>[^\\\\s\\\\n$]+)(?:\\\\s*.*?)?^(?P<section>.*?)^=%.*?$)"""', '(re.M | re.S)'], {}), "(\n '(?P<block>^%=(?P<mode>.)?\\\\s+(?P<label>.*?)\\\\s+(?P<value>[^\\\\s\\\\n$]+)(?:\\\\s*.*?)?^(?P<section>.*?)^=%.*?$)'\... |
import numpy as np
import torch
from torch import optim
from torch.nn import functional
import torch.nn as nn
import torch.utils.data
from torch.nn import BatchNorm1d, Dropout, LeakyReLU, Linear, Module, ReLU, Sequential,Sigmoid
from torch.nn import functional as F
from opendp.smartnoise.synthesizers.base import SDGYMB... | [
"ctgan.models.Generator",
"torch.nn.Dropout",
"torch.nn.Sequential",
"ctgan.sampler.Sampler",
"torch.from_numpy",
"ctgan.conditional.ConditionalGenerator",
"torch.cuda.is_available",
"torch.normal",
"numpy.arange",
"torch.nn.Sigmoid",
"torch.mean",
"numpy.concatenate",
"torch.nn.LeakyReLU",
... | [((1613, 1638), 'torch.cuda.manual_seed', 'torch.cuda.manual_seed', (['(0)'], {}), '(0)\n', (1635, 1638), False, 'import torch\n'), ((1647, 1667), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (1664, 1667), False, 'import torch\n'), ((2061, 2077), 'torch.nn.Sequential', 'Sequential', (['*seq'], {}),... |
import socket
import threading
import time
# Create constants
HEADER = 64
PORT = 5050
FORMAT = 'utf-8'
DC_MSG = "!DISCONNECT"
SERVER = "localhost"
ADDR = (SERVER, PORT)
# Set up client var and connect to the server
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect(ADDR)
erase = ... | [
"threading.Thread",
"time.sleep",
"socket.socket"
] | [((239, 288), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (252, 288), False, 'import socket\n'), ((1401, 1436), 'threading.Thread', 'threading.Thread', ([], {'target': 'recvThread'}), '(target=recvThread)\n', (1417, 1436), False, 'import th... |
from __future__ import annotations
import disnake
from disnake.ext import commands
from typing import TYPE_CHECKING
from src.utils.utils import EmbedFactory, ExitButton, SaveButton, add_lines, get_info
if TYPE_CHECKING:
from src.utils import File
def clear_codeblock(content: str):
content.strip("\n")
... | [
"src.utils.utils.get_info",
"src.utils.utils.EmbedFactory.ide_embed",
"src.utils.utils.ExitButton",
"src.utils.File",
"src.utils.utils.SaveButton",
"disnake.ui.button",
"src.utils.utils.add_lines"
] | [((2156, 2220), 'disnake.ui.button', 'disnake.ui.button', ([], {'label': '"""Write"""', 'style': 'disnake.ButtonStyle.gray'}), "(label='Write', style=disnake.ButtonStyle.gray)\n", (2173, 2220), False, 'import disnake\n'), ((2355, 2421), 'disnake.ui.button', 'disnake.ui.button', ([], {'label': '"""Replace"""', 'style': ... |
import discord, sqlite3, asyncio, utils, re
from discord.ext import commands
from datetime import datetime
TIME_REGEX = re.compile("(?:(\d{1,5})\s?(h|hours|hrs|hour|hr|s|seconds|secs|sec|second|m|mins|minutes|minute|min|d|days|day))+?")
TIME_DICT = {"h": 3600, "s": 1, "m": 60, "d": 86400}
class TimeConverter... | [
"utils.Config",
"sqlite3.connect",
"utils.get_member_role",
"re.compile",
"asyncio.sleep",
"datetime.datetime.utcnow",
"utils.get_ping_role",
"discord.ext.commands.bot_has_permissions",
"utils.guild_only",
"discord.ext.commands.cooldown",
"re.findall",
"discord.Embed",
"discord.ext.commands.... | [((127, 255), 're.compile', 're.compile', (['"""(?:(\\\\d{1,5})\\\\s?(h|hours|hrs|hour|hr|s|seconds|secs|sec|second|m|mins|minutes|minute|min|d|days|day))+?"""'], {}), "(\n '(?:(\\\\d{1,5})\\\\s?(h|hours|hrs|hour|hr|s|seconds|secs|sec|second|m|mins|minutes|minute|min|d|days|day))+?'\n )\n", (137, 255), False, 'im... |
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
## Created by: <NAME>
## Email: <EMAIL>
## Copyright (c) 2020
##
## LICENSE file in the root directory of this source tree
##+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
"""ResNet variants"""
import os
import math
i... | [
"models.attention_map.SEModule",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.Tanh",
"torch.nn.Sequential",
"rfconv.RFConv2d",
"math.sqrt",
"models.utils.gen_adj",
"torch.from_numpy",
"torch.nn.AvgPool2d",
"torch.nn.functional.softmax",
"os.path.exists",
"torch.nn.init.xavier_uniform_",
... | [((22501, 22533), 'torch.matmul', 'torch.matmul', (['feature', 'reshape_x'], {}), '(feature, reshape_x)\n', (22513, 22533), False, 'import torch\n'), ((22837, 22866), 'torch.randn', 'torch.randn', (['[2, 3, 224, 224]'], {}), '([2, 3, 224, 224])\n', (22848, 22866), False, 'import torch\n'), ((1961, 2020), 'torch.nn.Conv... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 02_inference.ipynb (unless otherwise specified).
__all__ = ['device', 'pad_output', 'get_activ_offsets_mns']
# Cell
#from fastai.vision.all import *
from fastai import *
from typing import *
from torch import tensor, Tensor
import torch
import torchvision # Needed to i... | [
"torch.stack",
"torch.max",
"torchvision.ops.nms",
"torch.softmax",
"torch.cuda.is_available",
"torch.zeros",
"torch.cat"
] | [((3994, 4022), 'torch.softmax', 'torch.softmax', (['p_classes', '(-1)'], {}), '(p_classes, -1)\n', (4007, 4022), False, 'import torch\n'), ((444, 469), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (467, 469), False, 'import torch\n'), ((2238, 2292), 'torch.zeros', 'torch.zeros', (['(mx_len -... |
# The MIT License (MIT)
#
# Copyright (c) 2014 <NAME>
#
# 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, me... | [
"redis.ConnectionPool",
"flagon.errors.UnknownFeatureError",
"redis.Redis"
] | [((1452, 1501), 'redis.ConnectionPool', 'redis.ConnectionPool', ([], {'host': 'host', 'port': 'port', 'db': 'db'}), '(host=host, port=port, db=db)\n', (1472, 1501), False, 'import redis\n'), ((1525, 1620), 'redis.Redis', 'redis.Redis', ([], {'connection_pool': 'pool', 'charset': '"""utf-8"""', 'errors': '"""strict"""',... |
from math import sin, cos, pi
f = lambda x: 9*pi*cos(x) + 7*sin(x) + 4*x - 5*x*cos(x) # Analytical Solution
df = lambda x: -9*pi*sin(x) + 7*cos(x) + 4 - 5*(cos(x)-x*sin(x))
dy = lambda x,y,u: u # 1st Derivative, y' = u
du = lambda x,y,u: 4*x + 10*sin(x) - y # 2nd Derivative, u' = 4x+10sin(x)-y
x = ... | [
"math.cos",
"math.sin"
] | [((79, 85), 'math.cos', 'cos', (['x'], {}), '(x)\n', (82, 85), False, 'from math import sin, cos, pi\n'), ((156, 162), 'math.cos', 'cos', (['x'], {}), '(x)\n', (159, 162), False, 'from math import sin, cos, pi\n'), ((267, 273), 'math.sin', 'sin', (['x'], {}), '(x)\n', (270, 273), False, 'from math import sin, cos, pi\n... |
from records_mover.utils import quiet_remove
from records_mover.records.delimited import cant_handle_hint, ValidatedRecordsHints
from typing import Set, Tuple, Optional
from .types import DateOrderStyle, DateOutputStyle
def determine_date_output_style(unhandled_hints: Set[str],
hints: ... | [
"records_mover.records.delimited.cant_handle_hint",
"records_mover.utils.quiet_remove"
] | [((1346, 1389), 'records_mover.utils.quiet_remove', 'quiet_remove', (['unhandled_hints', '"""dateformat"""'], {}), "(unhandled_hints, 'dateformat')\n", (1358, 1389), False, 'from records_mover.utils import quiet_remove\n'), ((1394, 1441), 'records_mover.utils.quiet_remove', 'quiet_remove', (['unhandled_hints', '"""time... |
from typing import Any, Dict, List, Type, TypeVar, Union, cast
import attr
from ..types import UNSET, Unset
T = TypeVar("T", bound="Cluster")
@attr.s(auto_attribs=True)
class Cluster:
""" """
addr: Union[Unset, str] = UNSET
auth_timeout: Union[Unset, int] = UNSET
cluster_port: Union[Unset, int] = U... | [
"attr.s",
"attr.ib",
"typing.TypeVar"
] | [((115, 144), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""Cluster"""'}), "('T', bound='Cluster')\n", (122, 144), False, 'from typing import Any, Dict, List, Type, TypeVar, Union, cast\n'), ((148, 173), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)'}), '(auto_attribs=True)\n', (154, 173), False, 'import... |
# import tkinter module
from tkinter import *
# import other necessery modules
import random
# Vigenère cipher for encryption and decryption
import base64
# creating root object
root = Tk()
# defining size of window
root.geometry("1200x4000")
# setting up the title of window
root.title("Message Enc... | [
"base64.urlsafe_b64decode"
] | [((2850, 2879), 'base64.urlsafe_b64decode', 'base64.urlsafe_b64decode', (['enc'], {}), '(enc)\n', (2874, 2879), False, 'import base64\n')] |
from selenium import webdriver
from fixture.session import SessionHelper
from fixture.group import GroupHelper
from fixture.contact import ContactHelper
class Application:
def __init__(self, browser, base_url):
if browser == "firefox":
self.wd = webdriver.Firefox()
elif browser == "Ch... | [
"fixture.group.GroupHelper",
"selenium.webdriver.Chrome",
"selenium.webdriver.Firefox",
"fixture.session.SessionHelper",
"fixture.contact.ContactHelper",
"selenium.webdriver.Ie"
] | [((572, 591), 'fixture.session.SessionHelper', 'SessionHelper', (['self'], {}), '(self)\n', (585, 591), False, 'from fixture.session import SessionHelper\n'), ((613, 630), 'fixture.group.GroupHelper', 'GroupHelper', (['self'], {}), '(self)\n', (624, 630), False, 'from fixture.group import GroupHelper\n'), ((654, 673), ... |
# https://stackoverflow.com/questions/47295473/how-to-plot-using-matplotlib-python-colahs-deformed-grid
"""
这个形状仍然不对。靠近坐标轴的地方变化太大。不管是横轴还是纵轴。应该是以原点为圆心,各个网格均匀分担才对
而不管是否靠近坐标轴
变形的目标,是在某处给定一个球体或者立方体,整个坐标中的网格,靠近这个物体的,受到变形影响,距离越远,影响
越小,直到可以忽略不计
但有个要求是靠近物体的网格,是均匀的受到影响,不能有的多,有的少
或许用极坐标是更好的选择?但是也不行。极坐标如何体现原有的坐标系呢?
极坐标没有平直的地方... | [
"matplotlib.pyplot.gca",
"matplotlib.collections.LineCollection",
"numpy.exp",
"numpy.stack",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((1565, 1579), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1577, 1579), True, 'import matplotlib.pyplot as plt\n'), ((1827, 1837), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (1835, 1837), True, 'import matplotlib.pyplot as plt\n'), ((544, 568), 'numpy.stack', 'np.stack', (['(x, y)'], ... |
# Python script uses flask and SQL alchemy to create API requests for weather data from Hawaii.
# Import dependencies.
import numpy as np
import datetime as dt
import sqlalchemy
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.orm import Session
from sqlalchemy import create_engine, func
from flask impo... | [
"sqlalchemy.func.min",
"flask.Flask",
"datetime.datetime.strptime",
"sqlalchemy.ext.automap.automap_base",
"sqlalchemy.create_engine",
"sqlalchemy.orm.Session",
"sqlalchemy.func.max",
"sqlalchemy.func.strftime",
"sqlalchemy.func.avg",
"datetime.timedelta",
"flask.jsonify"
] | [((1064, 1114), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///Resources/hawaii.sqlite"""'], {}), "('sqlite:///Resources/hawaii.sqlite')\n", (1077, 1114), False, 'from sqlalchemy import create_engine, func\n'), ((1170, 1184), 'sqlalchemy.ext.automap.automap_base', 'automap_base', ([], {}), '()\n', (1182, ... |
import argparse
import logging
import sys
import time
import glob
import os
from . import logger
from . import config
from . visualization import plot
from . optimization import run
from . optimization import utils
class optimalTAD:
def __init__(self):
self.log = logger.initialize_logger()
self.cfg... | [
"os.path.expanduser",
"time.time",
"argparse.ArgumentParser",
"sys.exit"
] | [((376, 667), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""optimalTAD: Topologically Associating Domain optimal set prediction"""', 'usage': '""" optimalTAD <command> [<args>]\n \nThe basic optimalTAD commands are:\n run Run optimization process\n visualize Vis... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Sensirion SHT2x humidity sensor.
Drives SHT20, SHT21 and SHT25 humidity and temperature sensors.
Sensirion `SHT2x Datasheets <https://www.sensirion.com/en/environmental-sensors/humidity-sensors/humidity-temperature-sensor-sht2x-digital-i2c-accurate/>`
"""
from i2cmo... | [
"i2cmod.SHT2X"
] | [((360, 367), 'i2cmod.SHT2X', 'SHT2X', ([], {}), '()\n', (365, 367), False, 'from i2cmod import SHT2X\n')] |
import argparse
from os import listdir, path
import numpy as np
def convert(main_folder, output):
ret = []
for label, class_folder in listdir(main_folder):
class_folder_path = path.join(main_folder, class_folder)
for img_name in listdir(class_folder_path):
image_path = path.join... | [
"os.path.join",
"os.listdir",
"argparse.ArgumentParser",
"numpy.savetxt"
] | [((146, 166), 'os.listdir', 'listdir', (['main_folder'], {}), '(main_folder)\n', (153, 166), False, 'from os import listdir, path\n'), ((399, 450), 'numpy.savetxt', 'np.savetxt', (['output', 'ret'], {'delimiter': '""" """', 'fmt': '"""%s %i"""'}), "(output, ret, delimiter=' ', fmt='%s %i')\n", (409, 450), True, 'import... |
#!/usr/bin/env python
from setuptools import setup, find_packages
import sys, os
setup(
name='anglerfish',
version='0.4.1',
description='Anglerfish, a tool to demultiplex Illumina libraries from ONT data',
author='<NAME>',
author_email='<EMAIL>',
url='https://github.com/remiolsen/anglerfish',
... | [
"setuptools.find_packages"
] | [((353, 368), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (366, 368), False, 'from setuptools import setup, find_packages\n')] |
# Copyright 2018 <NAME> and <NAME>
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.matrix",
"numpy.amin",
"scipy.sparse.issparse",
"numpy.power"
] | [((1145, 1172), 'numpy.matrix', 'np.matrix', (['([1] * center_num)'], {}), '([1] * center_num)\n', (1154, 1172), True, 'import numpy as np\n'), ((1241, 1258), 'scipy.sparse.issparse', 'sp.issparse', (['data'], {}), '(data)\n', (1252, 1258), True, 'import scipy.sparse as sp\n'), ((1101, 1122), 'numpy.matrix', 'np.matrix... |
import os
from sys import platform
def say_beep(n: int):
for i in range(0, n):
if platform == "darwin":
os.system("say beep")
| [
"os.system"
] | [((130, 151), 'os.system', 'os.system', (['"""say beep"""'], {}), "('say beep')\n", (139, 151), False, 'import os\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2022 HalfMarble LLC
# Copyright 2019 <NAME> <<EMAIL>>
from hm_gerber_tool.cam import FileSettings
import hm_gerber_tool.rs274x
from hm_gerber_tool.gerber_statements import *
from hm_gerber_ex.gerber_statements import AMParamStmt, AMParamStmtEx, ADParamStmtEx
f... | [
"hm_gerber_ex.gerber_statements.ADParamStmtEx.from_stmt",
"hm_gerber_ex.utility.rotate",
"hm_gerber_ex.gerber_statements.AMParamStmtEx.from_stmt"
] | [((5745, 5792), 'hm_gerber_ex.utility.rotate', 'rotate', (['statement.x', 'statement.y', 'angle', 'center'], {}), '(statement.x, statement.y, angle, center)\n', (5751, 5792), False, 'from hm_gerber_ex.utility import rotate\n'), ((5512, 5541), 'hm_gerber_ex.utility.rotate', 'rotate', (['cx', 'cy', 'angle', 'center'], {}... |
""" Sample view for group aware projects """
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.decorators import login_required
from django.http import Http404, HttpResponseRedirect
from django.shortcuts import render_to_response, get_object_or_404
from dja... | [
"django.http.HttpResponseRedirect",
"django.shortcuts.get_object_or_404",
"django.template.RequestContext",
"wall.models.Post.objects.all"
] | [((2629, 2663), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Post'], {'slug': 'slug'}), '(Post, slug=slug)\n', (2646, 2663), False, 'from django.shortcuts import render_to_response, get_object_or_404\n'), ((941, 959), 'wall.models.Post.objects.all', 'Post.objects.all', ([], {}), '()\n', (957, 959), Fal... |
# Helpers common to the gui
from contextlib import contextmanager
from PyQt5 import QtWidgets
@contextmanager
def safe_command(command):
"""
Helper to suppress AttributeErrors from commands
Args:
command (callable): The command to run. Any AttributeError raised by
the command will be ... | [
"PyQt5.QtWidgets.QMessageBox.warning"
] | [((777, 856), 'PyQt5.QtWidgets.QMessageBox.warning', 'QtWidgets.QMessageBox.warning', (['parent', 'title', 'message', 'QtWidgets.QMessageBox.Ok'], {}), '(parent, title, message, QtWidgets.QMessageBox.Ok)\n', (806, 856), False, 'from PyQt5 import QtWidgets\n')] |
import simplejson as json
from .telegram_field import TelegramField
class WTelegramHeader(object):
def __init__(self):
# self._startField = TelegramField()
self._lField = TelegramField()
self._cField = TelegramField()
# self._crcField = TelegramField()
# self._stopField = T... | [
"simplejson.dumps"
] | [((1940, 2013), 'simplejson.dumps', 'json.dumps', (['self.interpreted'], {'sort_keys': '(False)', 'indent': '(4)', 'use_decimal': '(True)'}), '(self.interpreted, sort_keys=False, indent=4, use_decimal=True)\n', (1950, 2013), True, 'import simplejson as json\n')] |
# Based on spec_tests.py from
# https://github.com/commonmark/commonmark-spec/blob/master/test/spec_tests.py
# and
# https://github.com/github/cmark-gfm/blob/master/test/spec_tests.py
import sys
import os
import os.path
import re
import md4c
import md4c.domparser
import pytest
from normalize import normalize_html
ex... | [
"re.compile",
"md4c.domparser.DOMParser",
"os.path.join",
"re.match",
"md4c.HTMLRenderer",
"normalize.normalize_html",
"pytest.skip"
] | [((1138, 1155), 're.compile', 're.compile', (['"""#+ """'], {}), "('#+ ')\n", (1148, 1155), False, 'import re\n'), ((1177, 1220), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""spec"""', 'specfile'], {}), "(sys.path[0], 'spec', specfile)\n", (1189, 1220), False, 'import os\n'), ((4686, 4720), 'md4c.HTMLRenderer',... |
"""
Methods for user login
"""
from cgi import escape
from google.appengine.ext import ndb
def login_fields_complete(post_data):
"""
validates that both login fields were filled in
:param post_data:
:return:
"""
try:
user_id = escape(post_data['user_id'], quote=True)
except KeyErr... | [
"cgi.escape",
"google.appengine.ext.ndb.Key"
] | [((746, 770), 'google.appengine.ext.ndb.Key', 'ndb.Key', (['"""User"""', 'user_id'], {}), "('User', user_id)\n", (753, 770), False, 'from google.appengine.ext import ndb\n'), ((262, 302), 'cgi.escape', 'escape', (["post_data['user_id']"], {'quote': '(True)'}), "(post_data['user_id'], quote=True)\n", (268, 302), False, ... |
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 16 13:20:51 2018
lstm encoder decoder for hands
@author: Γιώργος
"""
import torch
import torch.nn as nn
from utils.file_utils import print_and_save
class LSTM_Hands_encdec(nn.Module):
# source: https://github.com/yunjey/pytorch-tutorial/blob/master/tutorials/02-in... | [
"torch.nn.LSTM",
"torch.stack",
"torch.zeros",
"torch.nn.Linear"
] | [((746, 853), 'torch.nn.LSTM', 'nn.LSTM', (['input_size', 'row_hidden', '(1)'], {'bias': '(True)', 'batch_first': '(False)', 'dropout': 'dropout', 'bidirectional': '(False)'}), '(input_size, row_hidden, 1, bias=True, batch_first=False, dropout=\n dropout, bidirectional=False)\n', (753, 853), True, 'import torch.nn a... |
import re
with open("day14.txt", "r") as f:
data = f.read().splitlines()
def apply_mask(mask, value):
binary_value = f"{value:>036b}"
masked_value = "".join(
value if mask_value == "X" else mask_value
for value, mask_value in zip(binary_value, mask)
)
return int(masked_value, 2)
... | [
"re.findall"
] | [((446, 472), 're.findall', 're.findall', (['"""(\\\\d+)"""', 'line'], {}), "('(\\\\d+)', line)\n", (456, 472), False, 'import re\n')] |
# ------------------------------------------------------------------------------
# Test Many Things Utilities
# ------------------------------------------------------------------------------
import sys
import datetime as dt
import pytz
from django.test import TestCase
from django.utils import translation
from ls.joyous... | [
"ls.joyous.utils.manythings.toOrdinal",
"ls.joyous.utils.manythings.hrJoin",
"django.utils.translation.activate",
"ls.joyous.utils.manythings.toDaysOffsetStr",
"ls.joyous.utils.manythings.toTheOrdinal",
"django.utils.translation.deactivate"
] | [((3257, 3283), 'django.utils.translation.activate', 'translation.activate', (['"""fr"""'], {}), "('fr')\n", (3277, 3283), False, 'from django.utils import translation\n'), ((3317, 3341), 'django.utils.translation.deactivate', 'translation.deactivate', ([], {}), '()\n', (3339, 3341), False, 'from django.utils import tr... |
from box.parser import Parser
from box.generator import Generator
import os
class Importer:
def __init__(self, path):
# Path to directory containing function graphs to import
self.path = os.path.abspath(path)
# { "FunctionName": <Generator>, ... }
self.function_declarations = {}
... | [
"os.listdir",
"os.path.join",
"box.parser.Parser",
"os.path.abspath",
"box.generator.Generator"
] | [((209, 230), 'os.path.abspath', 'os.path.abspath', (['path'], {}), '(path)\n', (224, 230), False, 'import os\n'), ((652, 673), 'os.listdir', 'os.listdir', (['self.path'], {}), '(self.path)\n', (662, 673), False, 'import os\n'), ((736, 765), 'os.path.join', 'os.path.join', (['self.path', 'file'], {}), '(self.path, file... |
import os
from docx import Document
from docx.shared import Inches
from docx import Document
from docx.text.paragraph import Paragraph
def Iceriyomu(dosyayol):
document = Document('{}'.format(dosyayol))
headings = []
texts = []
para = []
giris = ""
for paragraph in document.paragraphs... | [
"docx.Document"
] | [((1304, 1315), 'docx.Document', 'Document', (['f'], {}), '(f)\n', (1312, 1315), False, 'from docx import Document\n')] |
"""Assimp-based analyzer."""
from __future__ import absolute_import
import os
import logging
import subprocess
import pyassimp
from damn_at import (
mimetypes,
MetaDataType,
MetaDataValue,
FileId,
FileDescription,
AssetDescription,
AssetId
)
from damn_at.pluginmanager import IAnalyzer
from... | [
"logging.getLogger",
"damn_at.mimetypes.guess_type",
"damn_at.analyzers.mesh.metadata.MetaDataAssimpTexture.extract",
"damn_at.pluginmanager.IAnalyzer.__init__",
"subprocess.Popen",
"pyassimp.release",
"io.open",
"damn_at.FileDescription",
"os.path.abspath",
"six.moves.map",
"damn_at.analyzers.m... | [((369, 396), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (386, 396), False, 'import logging\n'), ((603, 695), 'subprocess.Popen', 'subprocess.Popen', (["['assimp', 'listext']"], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), "(['assimp', 'listext'], stdout=subprocess.PIP... |
# Generated by Django 2.2.1 on 2019-06-30 00:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('students', '0009_auto_20190629_0125'),
]
operations = [
migrations.AddField(
model_name='institutionalemail',
name='... | [
"django.db.models.CharField"
] | [((352, 427), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""Assunto do email"""', 'editable': '(False)', 'max_length': '(20)'}), "(default='Assunto do email', editable=False, max_length=20)\n", (368, 427), False, 'from django.db import migrations, models\n')] |
"""
Author: <NAME>
Email: <EMAIL>
Date: 12/21/2019
Description:
Loads Azure Utility Tool configuration file. The configuration
file is a blend of what the Microsoft Authentication Library
requires and some extra directives that the Auzre Utility
Tool requires. It is a JSON file that is required to be
... | [
"os.path.exists",
"azure_utility_tool.exceptions.ConfigFileNotFound",
"os.path.expanduser"
] | [((528, 559), 'os.path.expanduser', 'os.path.expanduser', (['config_file'], {}), '(config_file)\n', (546, 559), False, 'import os\n'), ((639, 666), 'os.path.exists', 'os.path.exists', (['CONFIG_PATH'], {}), '(CONFIG_PATH)\n', (653, 666), False, 'import os\n'), ((682, 794), 'azure_utility_tool.exceptions.ConfigFileNotFo... |
import json
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter, FileType
from pathlib import Path
def main():
parser = ArgumentParser(description='Collect markdown files, and write JSON.',
formatter_class=ArgumentDefaultsHelpFormatter)
project_path = Path(__file__).... | [
"json.dump",
"argparse.FileType",
"argparse.ArgumentParser",
"pathlib.Path"
] | [((141, 261), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Collect markdown files, and write JSON."""', 'formatter_class': 'ArgumentDefaultsHelpFormatter'}), "(description='Collect markdown files, and write JSON.',\n formatter_class=ArgumentDefaultsHelpFormatter)\n", (155, 261), False, 'from... |
# -*- coding: utf-8 -*-
from __future__ import with_statement
import base64
import time
import simplejson as json
from flask.ext.security.utils import capture_registrations, \
capture_reset_password_requests, capture_passwordless_login_requests
from flask.ext.security.forms import LoginForm, ConfirmRegisterForm,... | [
"flask.ext.security.utils.capture_registrations",
"flask_security.core._security.datastore.delete",
"base64.b64encode",
"flask.ext.security.forms.SubmitField",
"time.sleep",
"flask_security.core._security.datastore.commit",
"flask.ext.security.utils.capture_reset_password_requests",
"flask.ext.securit... | [((2724, 2742), 'simplejson.loads', 'json.loads', (['r.data'], {}), '(r.data)\n', (2734, 2742), True, 'import simplejson as json\n'), ((10141, 10157), 'time.sleep', 'time.sleep', (['(1.25)'], {}), '(1.25)\n', (10151, 10157), False, 'import time\n'), ((13827, 13840), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (... |
from allauth.socialaccount.helpers import complete_social_login
from allauth.socialaccount.models import SocialApp, SocialToken, SocialLogin, SocialAccount
from allauth.socialaccount.providers.facebook.views import fb_complete_login
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from djang... | [
"allauth.socialaccount.providers.google.views.GoogleOAuth2Adapter",
"allauth.socialaccount.helpers.complete_social_login",
"allauth.socialaccount.models.SocialLogin.state_from_request",
"allauth.socialaccount.providers.facebook.views.fb_complete_login",
"allauth.socialaccount.models.SocialToken",
"allauth... | [((818, 863), 'allauth.socialaccount.providers.google.views.GoogleOAuth2Adapter', 'GoogleOAuth2Adapter', ([], {'request': 'original_request'}), '(request=original_request)\n', (837, 863), False, 'from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter\n'), ((883, 928), 'allauth.socialaccount.models... |
"""
training a super-network and periodically evaluating its performance on bench architectures
a work in this direction exists: https://arxiv.org/abs/2001.01431
"""
from uninas.main import Main
# default configurations, for the search process and the network design
# config_files = "{path_conf_bench_tasks}/s1_fairna... | [
"uninas.main.Main.new_task"
] | [((2493, 2542), 'uninas.main.Main.new_task', 'Main.new_task', (['config_files'], {'args_changes': 'changes'}), '(config_files, args_changes=changes)\n', (2506, 2542), False, 'from uninas.main import Main\n')] |
import numpy as np
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql as psql
from sqlalchemy.orm import relationship
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.schema import UniqueConstraint
from astropy import units as u
from .core import Base
from .constants import APER_KEY, A... | [
"sqlalchemy.orm.relationship",
"numpy.ceil",
"numpy.log10",
"astropy.table.vstack",
"sqlalchemy.ForeignKey",
"astropy.coordinates.SkyCoord",
"photutils.aperture_photometry",
"astropy.wcs.WCS",
"numpy.floor",
"photutils.CircularAperture",
"numpy.bitwise_or.reduce",
"sqlalchemy.Index",
"sqlalc... | [((458, 497), 'sqlalchemy.Column', 'sa.Column', (['sa.Integer'], {'primary_key': '(True)'}), '(sa.Integer, primary_key=True)\n', (467, 497), True, 'import sqlalchemy as sa\n'), ((550, 571), 'sqlalchemy.Column', 'sa.Column', (['sa.Integer'], {}), '(sa.Integer)\n', (559, 571), True, 'import sqlalchemy as sa\n'), ((581, 6... |
import subprocess
from collections import UserDict
from functools import lru_cache
def _parse_handle_section(lines):
"""
Parse a section of dmidecode output
* 1st line contains address, type and size
* 2nd line is title
* line started with one tab is one option and its value
* line started with... | [
"subprocess.run_command"
] | [((1720, 1775), 'subprocess.run_command', 'subprocess.run_command', (["['dmidecode', *args]"], {'root': '(True)'}), "(['dmidecode', *args], root=True)\n", (1742, 1775), False, 'import subprocess\n')] |
import os
from datetime import datetime
from flask_sqlalchemy import SQLAlchemy
# heroku postgresql setting
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL', None)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True
db = SQLAlchemy(app)
class usermessage(db.Model):
'''
user message and reply d... | [
"flask_sqlalchemy.SQLAlchemy",
"os.getenv"
] | [((148, 179), 'os.getenv', 'os.getenv', (['"""DATABASE_URL"""', 'None'], {}), "('DATABASE_URL', None)\n", (157, 179), False, 'import os\n'), ((237, 252), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (247, 252), False, 'from flask_sqlalchemy import SQLAlchemy\n')] |
import torch
import torch.nn as nn
class voxel_match_loss(nn.Module):
def __init__(self):
super().__init__()
self.criterion=nn.MSELoss()
def forward(self,output,label):
positive_mask=torch.zeros(label.shape).cuda()
positive_mask=torch.where(label>0.2,torch.ones_like(positive_mas... | [
"torch.nn.MSELoss",
"torch.ones_like",
"torch.zeros"
] | [((145, 157), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (155, 157), True, 'import torch.nn as nn\n'), ((292, 322), 'torch.ones_like', 'torch.ones_like', (['positive_mask'], {}), '(positive_mask)\n', (307, 322), False, 'import torch\n'), ((522, 552), 'torch.ones_like', 'torch.ones_like', (['negative_mask'], {}... |
# Copyright 2019 The Johns Hopkins University Applied Physics Laboratory
#
# 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 ... | [
"conduit.utils.datajoint_hook.DatajointHook",
"parse.parse",
"math.log1p",
"airflow.exceptions.AirflowException",
"airflow.contrib.hooks.aws_hook.AwsHook",
"conduit.utils.datajoint_hook.JobMetadata"
] | [((2820, 2835), 'conduit.utils.datajoint_hook.DatajointHook', 'DatajointHook', ([], {}), '()\n', (2833, 2835), False, 'from conduit.utils.datajoint_hook import DatajointHook, JobMetadata\n'), ((2906, 2919), 'conduit.utils.datajoint_hook.JobMetadata', 'JobMetadata', ([], {}), '()\n', (2917, 2919), False, 'from conduit.u... |
from collections import OrderedDict
from dataclasses import (
fields,
)
from prettyprinter.prettyprinter import pretty_call, register_pretty
def is_instance_of_dataclass(value):
try:
fields(value)
except TypeError:
return False
else:
return True
def pretty_dataclass_instance... | [
"collections.OrderedDict",
"prettyprinter.prettyprinter.register_pretty",
"dataclasses.fields"
] | [((373, 386), 'dataclasses.fields', 'fields', (['value'], {}), '(value)\n', (379, 386), False, 'from dataclasses import fields\n'), ((202, 215), 'dataclasses.fields', 'fields', (['value'], {}), '(value)\n', (208, 215), False, 'from dataclasses import fields\n'), ((810, 861), 'prettyprinter.prettyprinter.register_pretty... |
from __future__ import unicode_literals
import codecs
from django.conf import settings
from rest_framework.compat import six
from rest_framework.parsers import BaseParser, ParseError
from rest_framework import renderers
from rest_framework.settings import api_settings
import ujson
class UJSONParser(BaseParser):
... | [
"rest_framework.compat.six.text_type",
"codecs.getreader",
"ujson.load"
] | [((950, 1007), 'ujson.load', 'ujson.load', (['decoded_stream'], {'parse_constant': 'parse_constant'}), '(decoded_stream, parse_constant=parse_constant)\n', (960, 1007), False, 'import ujson\n'), ((820, 846), 'codecs.getreader', 'codecs.getreader', (['encoding'], {}), '(encoding)\n', (836, 846), False, 'import codecs\n'... |
import datetime
import re
import os
import requests
import json
import uuid
import random
import calendar
import time
import libs.SerializableDict as SerializableDict
import libs.StorageObjects as StorageObjects
import libs.Models as Models
import libs.Loggiz as Loggiz
from pytz import timezone
import pytz
import teleg... | [
"pytz.timezone",
"libs.Models.StaticModels",
"random.randrange",
"libs.SerializableDict.WordStats",
"libs.Loggiz.log.write.info",
"libs.SerializableDict.UserObject",
"datetime.datetime.now",
"uuid.uuid4",
"time.gmtime",
"libs.Loggiz.log.write.warn"
] | [((3177, 3198), 'libs.Models.StaticModels', 'Models.StaticModels', ([], {}), '()\n', (3196, 3198), True, 'import libs.Models as Models\n'), ((4938, 4961), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (4959, 4961), False, 'import datetime\n'), ((4977, 5005), 'pytz.timezone', 'pytz.timezone', (['""... |
"""
Purpose of this file is to give examples of structured arrays
This script is partially dirived from the LinkedIn learning course
https://www.linkedin.com/learning/numpy-data-science-essential-training/create-arrays-from-python-structures
"""
import numpy as np
person_data_def = [('name', 'S6'), ('height', 'f8'),... | [
"numpy.zeros",
"numpy.rec.array"
] | [((398, 432), 'numpy.zeros', 'np.zeros', (['(4)'], {'dtype': 'person_data_def'}), '(4, dtype=person_data_def)\n', (406, 432), True, 'import numpy as np\n'), ((1396, 1451), 'numpy.rec.array', 'np.rec.array', (["[('a', 100, 80, 50), ('b', 190, 189, 20)]"], {}), "([('a', 100, 80, 50), ('b', 190, 189, 20)])\n", (1408, 1451... |
'''
File: ebook_fix.py
Created: 2021-03-06 15:46:09
Modified: 2021-03-06 15:46:14
Author: mcxiaoke (<EMAIL>)
License: Apache License 2.0
'''
import sys
import os
from pprint import pprint
from types import new_class
from mobi import Mobi
from ebooklib import epub
import argparse
from multiprocessing.dummy import Pool
f... | [
"os.path.exists",
"ebooklib.epub.read_epub",
"os.listdir",
"argparse.ArgumentParser",
"os.rename",
"os.walk",
"os.path.splitext",
"os.path.join",
"os.path.dirname",
"os.path.basename",
"mobi.Mobi",
"multiprocessing.dummy.Pool"
] | [((4104, 4127), 'os.path.basename', 'os.path.basename', (['fname'], {}), '(fname)\n', (4120, 4127), False, 'import os\n'), ((4141, 4163), 'os.path.splitext', 'os.path.splitext', (['name'], {}), '(name)\n', (4157, 4163), False, 'import os\n'), ((4668, 4675), 'multiprocessing.dummy.Pool', 'Pool', (['(8)'], {}), '(8)\n', ... |
#!/usr/bin/env python3
#
#<NAME>
#
# <NAME>
# 7/06
#
#
# parsePhoneNrs.py - an example of 'grouping' - extracting parts of a match
#
# Python 3.5.2
# on Linux 4.4.0-36-generic x86_64
#
# Demonstrates: regexp, re, search, groups
#
# Usage: By default, reads telNrs.txt . You may supply a different filename
#
# Notes:
... | [
"re.compile"
] | [((2062, 2095), 're.compile', 're.compile', (['patString', 're.VERBOSE'], {}), '(patString, re.VERBOSE)\n', (2072, 2095), False, 'import re\n')] |
import functools
from flask import Blueprint
from flask import render_template
from flask import g
from flask import redirect
from flask import url_for
from flask import flash
from mflac.vuln_app.db import get_db
bp = Blueprint("admin", __name__, url_prefix="/admin")
def admin_required(view):
@functools.wraps(... | [
"flask.render_template",
"mflac.vuln_app.db.get_db",
"flask.flash",
"functools.wraps",
"flask.url_for",
"flask.Blueprint"
] | [((221, 270), 'flask.Blueprint', 'Blueprint', (['"""admin"""', '__name__'], {'url_prefix': '"""/admin"""'}), "('admin', __name__, url_prefix='/admin')\n", (230, 270), False, 'from flask import Blueprint\n'), ((304, 325), 'functools.wraps', 'functools.wraps', (['view'], {}), '(view)\n', (319, 325), False, 'import functo... |
import numpy as np
import matplotlib.pyplot as plt
plt.close('all')
# From section 3.8.3 of wind energy explained
# Prandlt tip loss calc
B = 3 # number of blades
R = 1 # blade length
phi = np.deg2rad(10) # relative wind angle
r = np.linspace(0,R,100)
F = 2/np.pi * np.arccos(np.exp(-((B/2)*(1-(r/R)))/((r/R)*np.sin(phi... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"numpy.deg2rad",
"numpy.linspace",
"numpy.sin",
"numpy.rad2deg"
] | [((51, 67), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (60, 67), True, 'import matplotlib.pyplot as plt\n'), ((191, 205), 'numpy.deg2rad', 'np.deg2rad', (['(10)'], {}), '(10)\n', (201, 205), True, 'import numpy as np\n'), ((232, 254), 'numpy.linspace', 'np.linspace', (['(0)', 'R', '(100)'... |
"""
VKontakte OpenAPI and OAuth 2.0 support.
This contribution adds support for VKontakte OpenAPI and OAuth 2.0 service in the form
www.vkontakte.ru. Username is retrieved from the identity returned by server.
"""
from django.conf import settings
from django.contrib.auth import authenticate
from django.utils import s... | [
"django.contrib.auth.authenticate",
"urllib2.urlopen",
"hashlib.md5",
"urllib.unquote",
"django.template.RequestContext",
"urllib2.Request",
"urllib.urlencode",
"time.time",
"django.template.loader.get_template"
] | [((8401, 8416), 'urllib.urlencode', 'urlencode', (['data'], {}), '(data)\n', (8410, 8416), False, 'from urllib import urlencode, unquote\n'), ((8435, 8462), 'urllib2.Request', 'Request', (["(url + '?' + params)"], {}), "(url + '?' + params)\n", (8442, 8462), False, 'from urllib2 import Request, urlopen, HTTPError\n'), ... |
#-----------------------------------------------------------------------------
# Copyright (c) 2012 - 2017, Anaconda, Inc. All rights reserved.
#
# Powered by the Bokeh Development Team.
#
# The full license is in the file LICENSE.txt, distributed with this software.
#---------------------------------------------------... | [
"logging.getLogger",
"colorama.init"
] | [((684, 711), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (701, 711), False, 'import logging\n'), ((1787, 1802), 'colorama.init', 'colorama.init', ([], {}), '()\n', (1800, 1802), False, 'import colorama\n')] |
# Project: SwarmAggregation
# Filename: exp.py
# Authors: <NAME> (<EMAIL>) and <NAME>
# (<EMAIL>).
"""
exp: A flexible, unifying framework for defining and running experiments for
swarm aggregation.
"""
import argparse
from aggregation import aggregation, ideal
from itertools import produ... | [
"numpy.random.default_rng",
"matplotlib.pyplot.Polygon",
"matplotlib.collections.LineCollection",
"math.cos",
"aggregation.aggregation",
"aggregation.ideal",
"numpy.arange",
"numpy.mean",
"argparse.ArgumentParser",
"tqdm.tqdm.write",
"itertools.product",
"numpy.max",
"matplotlib.pyplot.close... | [((14036, 14063), 'numpy.arange', 'np.arange', (['(0)', '(0.501)', '(0.0125)'], {}), '(0, 0.501, 0.0125)\n', (14045, 14063), True, 'import numpy as np\n'), ((14529, 14553), 'numpy.arange', 'np.arange', (['(0)', '(40.1)', '(1.25)'], {}), '(0, 40.1, 1.25)\n', (14538, 14553), True, 'import numpy as np\n'), ((15011, 15035)... |
import rpyc
from Crypto.Signature import pkcs1_15
from Crypto.Hash import SHA256
from Crypto.PublicKey import RSA
#############
## KLIJENT ##
#############
def generiraj_kljuceve():
key = RSA.generate(2048)
#stvaranje i spremanje privatnog ključa u datoteku
file_out = open("private_key.pem", "wb")
fil... | [
"Crypto.Hash.SHA256.new",
"rpyc.connect",
"Crypto.PublicKey.RSA.generate",
"Crypto.Signature.pkcs1_15.new"
] | [((194, 212), 'Crypto.PublicKey.RSA.generate', 'RSA.generate', (['(2048)'], {}), '(2048)\n', (206, 212), False, 'from Crypto.PublicKey import RSA\n'), ((1330, 1362), 'rpyc.connect', 'rpyc.connect', (['"""127.0.0.1"""', '(25555)'], {}), "('127.0.0.1', 25555)\n", (1342, 1362), False, 'import rpyc\n'), ((3037, 3056), 'Cry... |
from importlib import import_module
from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext
from django.template import loader
from django.utils.text import slugify
from django.utils import timezone
from revers... | [
"django.db.models.Manager",
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"ecs.core.diff.diff_submission_forms",
"django.template.loader.select_template",
"reversion.revisions.register",
"ecs.meetings.models.Meeting.objects.filter",
"ecs.notifications.m... | [((7001, 7037), 'reversion.revisions.register', 'reversion.register', ([], {'fields': "('text',)"}), "(fields=('text',))\n", (7019, 7037), True, 'from reversion import revisions as reversion\n'), ((715, 759), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(80)', 'unique': '(True)'}), '(max_lengt... |
from abc import ABCMeta, abstractmethod
import numpy as np
class BaseSubspace(metaclass=ABCMeta):
def __init__(self, measurements=None, A=None, k=None, rank=None, pks=[], name=''):
# Check A
if A is None:
self.__A = np.asarray(a=1, dtype=measurements.dtype)
else:
# C... | [
"numpy.linalg.matrix_rank",
"numpy.where",
"numpy.conjugate",
"numpy.asarray",
"numpy.diff",
"numpy.zeros",
"numpy.linalg.eigh"
] | [((2029, 2097), 'numpy.zeros', 'np.zeros', ([], {'shape': '(n, measurements.shape[1])', 'dtype': 'measurements.dtype'}), '(shape=(n, measurements.shape[1]), dtype=measurements.dtype)\n', (2037, 2097), True, 'import numpy as np\n'), ((2735, 2804), 'numpy.linalg.matrix_rank', 'np.linalg.matrix_rank', ([], {'M': 'self.mea... |
from connectors.tableau.tableau import TableauConnector
from posixpath import join
from typing import List, Dict, Tuple
import argparse
import connectors.tableau
import os
import utils
import logging
import sys
import yaml
logging.basicConfig(level=logging.INFO)
MAIN_PATH = '/Users/tomevers/projects/airglow'
CONNEC... | [
"logging.basicConfig",
"utils.store_md",
"argparse.ArgumentParser",
"os.makedirs",
"yaml.dump",
"os.path.join",
"logging.exception",
"os.path.isdir",
"sys.exit",
"connectors.tableau.tableau.TableauConnector",
"logging.info",
"utils.get_file"
] | [((226, 265), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (245, 265), False, 'import logging\n'), ((565, 611), 'os.path.join', 'os.path.join', (['MAIN_PATH', 'CONNECTIONS_CONF_FILE'], {}), '(MAIN_PATH, CONNECTIONS_CONF_FILE)\n', (577, 611), False, 'import os\... |
import logging
from itertools import starmap
from funcy import join
from .context import Context
from .interpolate import resolve
logger = logging.getLogger(__name__)
STAGES = "stages"
class DataResolver:
def __init__(self, d):
self.context = Context()
self.data = d
def _resolve_entry(sel... | [
"logging.getLogger"
] | [((142, 169), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (159, 169), False, 'import logging\n')] |
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
from conversion_imagenet import TestModels
from conversion_imagenet import is_paddle_supported
def get_test_table():
return { 'paddle' : {
'resnet50' : [
TestModels.onnx_emit,
... | [
"conversion_imagenet.TestModels",
"conversion_imagenet.is_paddle_supported"
] | [((1542, 1564), 'conversion_imagenet.TestModels', 'TestModels', (['test_table'], {}), '(test_table)\n', (1552, 1564), False, 'from conversion_imagenet import TestModels\n'), ((1393, 1414), 'conversion_imagenet.is_paddle_supported', 'is_paddle_supported', ([], {}), '()\n', (1412, 1414), False, 'from conversion_imagenet ... |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "This action resets password for Okta user and transitions user status to PASSWORD_EXPIRED, so that the user is required to change their password at their next login"
class Input:
TEMP_PASSWORD = "<PASSWORD>"
... | [
"json.loads"
] | [((478, 1022), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "temp_password": {\n "type": "boolean",\n "title": "Okta User Temporary Password",\n "description": "If set to true, sets the user\'s password to a temporary password and returns ... |
from lexer.token import Token
class Scanner:
# Construtor da classe
def __init__(self, programa):
self.inicio = 0
self.atual = 0
self.linha = 1
self.tokens = []
self.programa = programa
# Busca caracteres, passa para o próximo char (atual é o char a frente do que ... | [
"lexer.token.Token"
] | [((2373, 2438), 'lexer.token.Token', 'Token', (['"""COMMA"""', 'self.programa[self.inicio:self.atual]', 'self.linha'], {}), "('COMMA', self.programa[self.inicio:self.atual], self.linha)\n", (2378, 2438), False, 'from lexer.token import Token\n'), ((2618, 2687), 'lexer.token.Token', 'Token', (['"""SEMICOLON"""', 'self.p... |
import os
import pytest
import numpy as np
from laserembeddings import Laser
SIMILARITY_TEST = os.getenv('SIMILARITY_TEST')
def test_laser():
with open(Laser.DEFAULT_ENCODER_FILE, 'rb') as f_encoder:
laser = Laser(
Laser.DEFAULT_BPE_CODES_FILE,
None,
f_encoder,
... | [
"numpy.mean",
"os.getenv",
"numpy.linalg.norm",
"os.path.realpath",
"numpy.sum",
"numpy.min",
"pytest.skip",
"laserembeddings.Laser"
] | [((98, 126), 'os.getenv', 'os.getenv', (['"""SIMILARITY_TEST"""'], {}), "('SIMILARITY_TEST')\n", (107, 126), False, 'import os\n'), ((912, 919), 'laserembeddings.Laser', 'Laser', ([], {}), '()\n', (917, 919), False, 'from laserembeddings import Laser\n'), ((225, 277), 'laserembeddings.Laser', 'Laser', (['Laser.DEFAULT_... |
# --------------
# Importing header files
import numpy as np
# Path of the file has been stored in variable called 'path'
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Code starts here
data_file='subset_1000.csv'
data=np.genfromtxt(path,delimiter=",",skip_header=1)
print(data)
census=np.conc... | [
"numpy.mean",
"numpy.std",
"numpy.max",
"numpy.concatenate",
"numpy.min",
"numpy.genfromtxt"
] | [((244, 293), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(path, delimiter=',', skip_header=1)\n", (257, 293), True, 'import numpy as np\n'), ((313, 355), 'numpy.concatenate', 'np.concatenate', (['(new_record, data)'], {'axis': '(0)'}), '((new_record, data), axis=0)... |
import numpy as np
from matplotlib import pyplot as plt
"""
https://stackoverflow.com/questions/42750910/convert-rgb-image-to-index-image/62980021#62980021
convert semantic labels from RGB coding to index coding
Steps:
1. define COLORS (see below)
2. hash colors
3. run rgb2index(segmentation_rgb)
see example below
T... | [
"numpy.power",
"numpy.array",
"numpy.sum",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((402, 462), 'numpy.array', 'np.array', (['[[0, 0, 0], [0, 0, 255], [255, 0, 0], [0, 255, 0]]'], {}), '([[0, 0, 0], [0, 0, 255], [255, 0, 0], [0, 255, 0]])\n', (410, 462), True, 'import numpy as np\n'), ((467, 491), 'numpy.power', 'np.power', (['(255)', '[0, 1, 2]'], {}), '(255, [0, 1, 2])\n', (475, 491), True, 'impor... |
import asyncio
import shutil
from functools import cached_property
from pathlib import Path
import aiopath
from datafiles import datafile, field
from furl import furl
from sanic import Request
from sanic.log import logger
from .. import settings, utils
from ..types import Dimensions
from .overlay import Overlay
from ... | [
"datafiles.field",
"furl.furl",
"sanic.log.logger.error",
"pathlib.Path",
"sanic.log.logger.warning",
"aiopath.AsyncPath",
"sanic.log.logger.info",
"sanic.log.logger.debug",
"asyncio.to_thread",
"shutil.rmtree",
"datafiles.datafile"
] | [((341, 404), 'datafiles.datafile', 'datafile', (['"""../../templates/{self.id}/config.yml"""'], {'defaults': '(True)'}), "('../../templates/{self.id}/config.yml', defaults=True)\n", (349, 404), False, 'from datafiles import datafile, field\n'), ((620, 679), 'datafiles.field', 'field', ([], {'default_factory': "(lambda... |
import codecs
import os
# Function to save a string into a file
def save_string_in_file(string_text, file_name):
with codecs.open(file_name, "w", "utf-8") as f:
f.write(string_text)
f.close()
# Function to read all files in a dir with a specific extension
def read_files_in_dir_ext(dir_route, exten... | [
"os.path.exists",
"codecs.open",
"os.listdir",
"os.makedirs"
] | [((340, 361), 'os.listdir', 'os.listdir', (['dir_route'], {}), '(dir_route)\n', (350, 361), False, 'import os\n'), ((123, 159), 'codecs.open', 'codecs.open', (['file_name', '"""w"""', '"""utf-8"""'], {}), "(file_name, 'w', 'utf-8')\n", (134, 159), False, 'import codecs\n'), ((564, 600), 'codecs.open', 'codecs.open', ([... |
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 4.0.2
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info as _swig_python_version_info
if _swig_python_version_info < (2, 7, 0):
raise Runtime... | [
"_beast.new_star_db",
"_beast.new_star_fov",
"_beast.constellation_swigregister",
"_beast.star_DBG_",
"_beast.star_lt_x",
"_beast.star_query_kdsearch_z",
"_beast.star_query_kdsort",
"_beast.match_result_size",
"_beast.star_fov_get_id",
"_beast.star_query_from_kdresults",
"_beast.star_db___and__"... | [((3680, 3710), '_beast.star_swigregister', '_beast.star_swigregister', (['star'], {}), '(star)\n', (3704, 3710), False, 'import _beast\n'), ((5830, 5866), '_beast.star_db_swigregister', '_beast.star_db_swigregister', (['star_db'], {}), '(star_db)\n', (5857, 5866), False, 'import _beast\n'), ((6453, 6491), '_beast.star... |
from onegov.core.orm import Base
from onegov.core.orm.mixins import ContentMixin
from onegov.core.orm.mixins import TimestampMixin
from onegov.core.orm.mixins import UTCPublicationMixin
from onegov.core.orm.types import UUID
from onegov.search import ORMSearchable
from sqlalchemy import Column
from sqlalchemy import Fo... | [
"sqlalchemy.orm.object_session",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column",
"sqlalchemy.orm.backref"
] | [((962, 989), 'sqlalchemy.Column', 'Column', (['Text'], {'nullable': '(True)'}), '(Text, nullable=True)\n', (968, 989), False, 'from sqlalchemy import Column\n'), ((1224, 1269), 'sqlalchemy.Column', 'Column', (['UUID'], {'primary_key': '(True)', 'default': 'uuid4'}), '(UUID, primary_key=True, default=uuid4)\n', (1230, ... |
import os
try:
from google.cloud import bigquery # noqa
except ImportError:
BIGQUERY = False
else:
BIGQUERY = True
GOOGLE_APPLICATION_CREDENTIALS = "GOOGLE_APPLICATION_CREDENTIALS"
BIGQUERY_LOCATION = "BIGQUERY_LOCATION"
BIGQUERY_DATASET = "BIGQUERY_DATASET"
def use_bigquery():
return (
B... | [
"os.environ.get",
"os.environ"
] | [((340, 386), 'os.environ.get', 'os.environ.get', (['GOOGLE_APPLICATION_CREDENTIALS'], {}), '(GOOGLE_APPLICATION_CREDENTIALS)\n', (354, 386), False, 'import os\n'), ((399, 432), 'os.environ.get', 'os.environ.get', (['BIGQUERY_LOCATION'], {}), '(BIGQUERY_LOCATION)\n', (413, 432), False, 'import os\n'), ((445, 473), 'os.... |
import torch
from skimage.filters import gaussian
def blur_cm_plot(Cm_plot, sigma):
"""
Blur the keypoints/center-of-masses for better visualiztion
Arguments
---------
Cm_plot : tensor with the center-of-masses
sigma : how much to blur
Return
------
out : blurred points... | [
"torch.from_numpy",
"torch.cat",
"skimage.filters.gaussian",
"torch.argmin",
"torch.zeros",
"torch.linspace"
] | [((918, 935), 'torch.cat', 'torch.cat', (['out', '(0)'], {}), '(out, 0)\n', (927, 935), False, 'import torch\n'), ((2160, 2177), 'torch.cat', 'torch.cat', (['out', '(0)'], {}), '(out, 0)\n', (2169, 2177), False, 'import torch\n'), ((837, 863), 'torch.cat', 'torch.cat', (['blur_cm_plot', '(0)'], {}), '(blur_cm_plot, 0)\... |
import os, sys
sys.path.insert(0, os.path.join(os.path.dirname(__file__),'../src'))
| [
"os.path.dirname"
] | [((48, 73), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (63, 73), False, 'import os, sys\n')] |
import os
import wandb
import torch
import warnings
import numpy as np
import torchvision.transforms
from fvcore.nn import FlopCountAnalysis
from dpt.models import DPTDepthModel
def get_flops(model, x, unit="G", quiet=True):
_prefix = {'k': 1e3, # kilo
'M': 1e6, # mega
'G': 1e9, ... | [
"torch.cuda.Event",
"numpy.mean",
"os.path.getsize",
"wandb.log",
"fvcore.nn.FlopCountAnalysis",
"wandb.init",
"torch.cuda.synchronize",
"numpy.zeros",
"torch.cuda.is_available",
"torch.cuda.amp.autocast",
"numpy.std",
"warnings.simplefilter",
"torch.no_grad",
"dpt.models.DPTDepthModel",
... | [((424, 451), 'fvcore.nn.FlopCountAnalysis', 'FlopCountAnalysis', (['model', 'x'], {}), '(model, x)\n', (441, 451), False, 'from fvcore.nn import FlopCountAnalysis\n'), ((721, 740), 'os.remove', 'os.remove', (['"""tmp.pt"""'], {}), "('tmp.pt')\n", (730, 740), False, 'import os\n'), ((1369, 1413), 'warnings.simplefilter... |
from django.db import models
import uuid, datetime
from django.utils import timezone
# Create your models here.
class User(models.Model):
user_id = models.CharField(max_length=100,default=uuid.uuid4)
email = models.EmailField(max_length=100)
name = models.CharField(max_length=100)
password = models.Ch... | [
"django.db.models.EmailField",
"django.db.models.IntegerField",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((154, 206), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'default': 'uuid.uuid4'}), '(max_length=100, default=uuid.uuid4)\n', (170, 206), False, 'from django.db import models\n'), ((218, 251), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(100)'}), '(max_le... |
#!/usr/bin/env python3
import os
import sys
import argparse
from zulip_bots.finder import import_module_from_source, resolve_bot_path
from zulip_bots.simple_lib import TerminalBotHandler
current_dir = os.path.dirname(os.path.abspath(__file__))
def parse_args():
description = '''
This tool allows you to t... | [
"sys.path.insert",
"argparse.ArgumentParser",
"zulip_bots.finder.resolve_bot_path",
"os.path.dirname",
"zulip_bots.simple_lib.TerminalBotHandler",
"zulip_bots.finder.import_module_from_source",
"sys.exit",
"os.path.abspath"
] | [((219, 244), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (234, 244), False, 'import os\n'), ((437, 544), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=description, format... |
from flask import redirect
from flask import request as flask_req
from flask import _app_ctx_stack
from ..base_client import RemoteApp
class FlaskRemoteApp(RemoteApp):
"""Flask integrated RemoteApp of :class:`~authlib.client.OAuthClient`.
It has built-in hooks for OAuthClient. The only required configuration
... | [
"flask.redirect"
] | [((2349, 2368), 'flask.redirect', 'redirect', (["rv['url']"], {}), "(rv['url'])\n", (2357, 2368), False, 'from flask import redirect\n')] |
from .model import KerasModel
import keras
from keras.models import Sequential
from keras.layers import Dense, Activation, Flatten
from keras.layers import BatchNormalization, Dropout, Conv2D, MaxPooling2D
import kapre
from kapre.utils import Normalization2D
from kapre.time_frequency import Spectrogram
class CNN_STF... | [
"keras.layers.Conv2D",
"keras.layers.Flatten",
"keras.layers.MaxPooling2D",
"keras.models.Sequential",
"keras.layers.Activation",
"kapre.utils.Normalization2D",
"keras.layers.Dense",
"keras.layers.BatchNormalization",
"keras.layers.Dropout",
"kapre.time_frequency.Spectrogram"
] | [((484, 496), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (494, 496), False, 'from keras.models import Sequential\n'), ((558, 724), 'kapre.time_frequency.Spectrogram', 'Spectrogram', ([], {'n_dft': '(128)', 'n_hop': '(16)', 'input_shape': 'input_shape', 'return_decibel_spectrogram': '(False)', 'power_spe... |
from datetime import datetime
from django.contrib.auth.models import User
from django.core.exceptions import ValidationError
from django.db import models
from scaffold.exceptions.exceptions import AppError
# def patch_methods(model_class):
# def do_patch(cls):
# for k in cls.__dict__:
# obj ... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.core.exceptions.ValidationError",
"django.db.models.BooleanField",
"datetime.datetime.now",
"django.db.models.BigIntegerField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"scaffold.exceptions.exceptions.AppE... | [((540, 658), 'django.db.models.BigIntegerField', 'models.BigIntegerField', ([], {'verbose_name': '"""排序"""', 'default': '(0)', 'help_text': '"""用于系统进行排序的参数,可以给用户设定或者作为计算列存储组合权重"""', 'db_index': '(True)'}), "(verbose_name='排序', default=0, help_text=\n '用于系统进行排序的参数,可以给用户设定或者作为计算列存储组合权重', db_index=True)\n", (562, 658)... |
#
# This file is part of softboxen software.
#
# Copyright (c) 2020, <NAME> <<EMAIL>>
# License: https://github.com/etingof/softboxen/LICENSE.rst
#
import json
import sys
import unittest
from unittest import mock
from softboxen.client.resources.box import box
from softboxen.client.resources.box import credentials
fro... | [
"softboxen.client.resources.box.box.Box",
"unittest.mock.Mock",
"softboxen.client.resources.box.box.BoxCollection",
"unittest.mock.patch.object",
"json.load",
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((3008, 3052), 'unittest.mock.patch.object', 'mock.patch.object', (['box', '"""Box"""'], {'autospec': '(True)'}), "(box, 'Box', autospec=True)\n", (3025, 3052), False, 'from unittest import mock\n'), ((3257, 3301), 'unittest.mock.patch.object', 'mock.patch.object', (['box', '"""Box"""'], {'autospec': '(True)'}), "(box... |
import click
from flask import current_app, g
from flask.cli import with_appcontext
from flask_pymongo import PyMongo
from werkzeug.security import check_password_hash, generate_password_hash
def get_db():
if 'db' not in g:
mongo = PyMongo(current_app)
g.db = mongo.db
g.db_client = mongo.c... | [
"flask_pymongo.PyMongo",
"flask.g.pop"
] | [((367, 384), 'flask.g.pop', 'g.pop', (['"""db"""', 'None'], {}), "('db', None)\n", (372, 384), False, 'from flask import current_app, g\n'), ((401, 425), 'flask.g.pop', 'g.pop', (['"""db_client"""', 'None'], {}), "('db_client', None)\n", (406, 425), False, 'from flask import current_app, g\n'), ((246, 266), 'flask_pym... |
# preferences panel to allow inputting cutom parameters for the structure of a project and its
# naming conventions.
# --------------------------------------------------------------------------------------------------
import hashlib
import nuke
from nukescripts.panels import PythonPanel
import fileinput
import os
impor... | [
"nuke.getFilename",
"nuke.File_Knob",
"nuke.String_Knob",
"nukescripts.panels.PythonPanel.showModal",
"os.path.join",
"os.path.realpath",
"nuke.PyScript_Knob",
"nuke.Int_Knob",
"nuke.Tab_Knob",
"nukescripts.panels.PythonPanel.__init__"
] | [((408, 452), 'nukescripts.panels.PythonPanel.__init__', 'PythonPanel.__init__', (['self', '"""C1 Preferences"""'], {}), "(self, 'C1 Preferences')\n", (428, 452), False, 'from nukescripts.panels import PythonPanel\n'), ((971, 1013), 'nuke.String_Knob', 'nuke.String_Knob', (['"""email"""', '"""C1 Initials: """'], {}), "... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2
import runtime_pb2 as runtime__pb2
class RuntimeStub(object):
"""Missing associ... | [
"grpc.unary_stream_rpc_method_handler",
"grpc.experimental.stream_unary",
"grpc.method_handlers_generic_handler",
"grpc.stream_stream_rpc_method_handler",
"grpc.unary_unary_rpc_method_handler",
"grpc.experimental.stream_stream",
"grpc.experimental.unary_stream",
"grpc.stream_unary_rpc_method_handler",... | [((20592, 20686), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""spec.proto.runtime.v1.Runtime"""', 'rpc_method_handlers'], {}), "('spec.proto.runtime.v1.Runtime',\n rpc_method_handlers)\n", (20628, 20686), False, 'import grpc\n'), ((13916, 14111), 'grpc.unary_unary_rpc_method_... |
import heterocl as hcl
hcl.init()
target = hcl.Platform.xilinx_zc706
initiation_interval = 4
a = hcl.placeholder((10, 20), name="a")
b = hcl.placeholder((10, 20), name="b")
c = hcl.placeholder((10, 20), name="c")
d = hcl.placeholder((10, 20), name="d")
e = hcl.placeholder((10, 20), name="e")
def add_mul(a, b, c, d,... | [
"heterocl.for_",
"heterocl.placeholder",
"heterocl.def_",
"heterocl.create_schedule",
"heterocl.build",
"heterocl.init",
"heterocl.lower"
] | [((24, 34), 'heterocl.init', 'hcl.init', ([], {}), '()\n', (32, 34), True, 'import heterocl as hcl\n'), ((99, 134), 'heterocl.placeholder', 'hcl.placeholder', (['(10, 20)'], {'name': '"""a"""'}), "((10, 20), name='a')\n", (114, 134), True, 'import heterocl as hcl\n'), ((139, 174), 'heterocl.placeholder', 'hcl.placehold... |
import os
from setuptools import setup
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md')) as readme_file:
README = readme_file.read()
setup(
name='k8s-workload-scaler',
version='0.0.2',
packages=['k8s_workload_scaler'],
url='github.com/eminaktas/k8s-workl... | [
"os.path.join",
"os.path.dirname",
"setuptools.setup"
] | [((183, 579), 'setuptools.setup', 'setup', ([], {'name': '"""k8s-workload-scaler"""', 'version': '"""0.0.2"""', 'packages': "['k8s_workload_scaler']", 'url': '"""github.com/eminaktas/k8s-workload-scaler"""', 'license': '"""MIT"""', 'author': '"""emin.aktas"""', 'author_email': '"""<EMAIL>"""', 'description': '"""Kubern... |