code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from torch.autograd import Variable
import torch
import torch.nn as nn
import torch.nn.functional as F
class LSTM(nn.Module):
def __init__(self, nin, hidden_size):
super(LSTM, self).__init__()
if torch.cuda.is_available():
self.linear_f = nn.Linear(nin + hidden_size, hidden_size).cuda()
... | [
"torch.nn.functional.tanh",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.zeros",
"torch.cat"
] | [((216, 241), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (239, 241), False, 'import torch\n'), ((1929, 1954), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (1952, 1954), False, 'import torch\n'), ((599, 640), 'torch.nn.Linear', 'nn.Linear', (['(nin + hidden_size)',... |
import torch
from torch import nn
from torch.utils.data import DataLoader
from tqdm.notebook import tqdm
from torch.optim import Adam
import torch.nn.functional as F
from voice_verification.src.models.vggvox import VGGVox
from voice_verification.src.losses.contrastive_loss import ContrastiveLoss
from datasets import ... | [
"voice_verification.src.models.vggvox.VGGVox",
"voice_verification.src.losses.contrastive_loss.ContrastiveLoss",
"datasets.VoiceContrastiveDataset",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.utils.data.DataLoader",
"torch.no_grad",
"tqdm.notebook.tqdm",
"torch.nn.functional.pairwise_dista... | [((398, 435), 'datasets.VoiceContrastiveDataset', 'VoiceContrastiveDataset', ([], {'data_path': '""""""'}), "(data_path='')\n", (421, 435), False, 'from datasets import VoiceContrastiveDataset\n'), ((455, 492), 'datasets.VoiceContrastiveDataset', 'VoiceContrastiveDataset', ([], {'data_path': '""""""'}), "(data_path='')... |
import sqlite3
import json
import sys
import os
class Database(object):
# Contructior opens database
def __init__(self, databasePath = "app/data.db"):
self.databasePath = databasePath
self.select = ""
self.froms = ""
self.joins = ""
self.wheres = ""
self.groupBy = ""
self.orderBy = ""
def open_conn(... | [
"sqlite3.connect",
"json.dumps",
"os.getcwd",
"os.path.realpath",
"sys.exc_info",
"json.load"
] | [((615, 661), 'sqlite3.connect', 'sqlite3.connect', (['self.databaseRelativeLocation'], {}), '(self.databaseRelativeLocation)\n', (630, 661), False, 'import sqlite3\n'), ((1585, 1600), 'json.load', 'json.load', (['data'], {}), '(data)\n', (1594, 1600), False, 'import json\n'), ((7815, 7868), 'json.dumps', 'json.dumps',... |
from keras.models import Model, load_model
from keras.preprocessing.image import ImageDataGenerator
from keras.optimizers import SGD
import numpy as np
import os
def preprocess_input(x):
x /= 127.5
x -= 1.
return x
test_gen = ImageDataGenerator(
preprocessing_function=preprocess_input
)
test_genera... | [
"os.path.join",
"keras.preprocessing.image.ImageDataGenerator"
] | [((242, 301), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {'preprocessing_function': 'preprocess_input'}), '(preprocessing_function=preprocess_input)\n', (260, 301), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((499, 523), 'os.path.join', 'os.path.join', (['model... |
import os
import sys
import cv2
import numpy as np
class Equirectangular:
def __init__(self, img):
self._img = img
#self._img = cv2.imread(img_name, cv2.IMREAD_COLOR)
[self._height, self._width, _] = self._img.shape
print(self._img.shape)
def GetPerspective(self, FOV, THET... | [
"numpy.radians",
"numpy.sqrt",
"numpy.ones",
"numpy.repeat",
"numpy.arcsin",
"numpy.array",
"numpy.dot",
"numpy.linspace",
"numpy.arctan2",
"numpy.stack"
] | [((743, 779), 'numpy.ones', 'np.ones', (['[height, width]', 'np.float32'], {}), '([height, width], np.float32)\n', (750, 779), True, 'import numpy as np\n'), ((936, 981), 'numpy.sqrt', 'np.sqrt', (['(x_map ** 2 + y_map ** 2 + z_map ** 2)'], {}), '(x_map ** 2 + y_map ** 2 + z_map ** 2)\n', (943, 981), True, 'import nump... |
"""
This module contains decorators that can be used in model implementation to relate them to each other.
For example, getting dies from a wafer.
"""
from functools import wraps
from typing import Callable, Type
from .mongomodel import MongoModel
def forward_link_one(model_get: Callable[[], Type[MongoModel]]):
... | [
"functools.wraps"
] | [((665, 676), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (670, 676), False, 'from functools import wraps\n'), ((1495, 1506), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1500, 1506), False, 'from functools import wraps\n')] |
import os
import streamlit as st
import uuid
import streamlit.components.v1 as components
from hydralit_components import IS_RELEASE
if IS_RELEASE:
absolute_path = os.path.dirname(os.path.abspath(__file__))
build_path = os.path.join(absolute_path, "frontend/build")
_component_func = components.declare_com... | [
"os.path.abspath",
"streamlit.components.v1.declare_component",
"os.path.join"
] | [((230, 275), 'os.path.join', 'os.path.join', (['absolute_path', '"""frontend/build"""'], {}), "(absolute_path, 'frontend/build')\n", (242, 275), False, 'import os\n'), ((298, 356), 'streamlit.components.v1.declare_component', 'components.declare_component', (['"""info_card"""'], {'path': 'build_path'}), "('info_card',... |
import os
MAIN_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
| [
"os.path.realpath"
] | [((44, 70), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (60, 70), False, 'import os\n')] |
import unittest
from typing import Any, Mapping, Optional, Type
import torch
from kgm.data import KnowledgeGraphAlignmentDataset, get_erdos_renyi
from kgm.data.knowledge_graph import sub_graph_alignment
from kgm.models import GCNAlign, get_matching_model_by_name
from kgm.models.matching.base import KGMatchingModel
fr... | [
"kgm.data.get_erdos_renyi",
"kgm.models.get_matching_model_by_name",
"torch.stack",
"kgm.utils.common.kwargs_or_empty",
"torch.randint",
"torch.arange",
"torch.cuda.is_available",
"unittest.main",
"torch.cat",
"torch.device"
] | [((448, 493), 'torch.randint', 'torch.randint', (['num_nodes'], {'size': '(2, num_edges)'}), '(num_nodes, size=(2, num_edges))\n', (461, 493), False, 'import torch\n'), ((573, 596), 'torch.arange', 'torch.arange', (['num_nodes'], {}), '(num_nodes)\n', (585, 596), False, 'import torch\n'), ((610, 654), 'torch.cat', 'tor... |
import os
import unittest
import pandas as pd
from ai4good.runner.facade import Facade
from ai4good.models.model_registry import get_models, create_params
class InitialiseParameters(unittest.TestCase):
def setUp(self) -> None:
self.facade = Facade.simple()
self.mdl = get_models()['compartmental-mo... | [
"os.path.dirname",
"ai4good.models.model_registry.get_models",
"ai4good.models.model_registry.create_params",
"ai4good.runner.facade.Facade.simple"
] | [((255, 270), 'ai4good.runner.facade.Facade.simple', 'Facade.simple', ([], {}), '()\n', (268, 270), False, 'from ai4good.runner.facade import Facade\n'), ((1059, 1149), 'ai4good.models.model_registry.create_params', 'create_params', (['self.facade.ps', '"""compartmental-model"""', 'custom_profile_df', '"""Moria"""', 'N... |
import numpy as np
try:
import matplotlib.pyplot as plt
except ImportError: # mpl is optional
pass
def compareplot(comp_df, insample_dev=True, se=True, dse=True, ax=None,
plot_kwargs=None):
"""
Model comparison summary plot in the style of the one used in the book
Statistical Reth... | [
"numpy.linspace",
"matplotlib.pyplot.subplots"
] | [((1348, 1406), 'numpy.linspace', 'np.linspace', (['(0)', '(-1)', '(comp_df.shape[0] * 2 - 1)'], {'retstep': '(True)'}), '(0, -1, comp_df.shape[0] * 2 - 1, retstep=True)\n', (1359, 1406), True, 'import numpy as np\n'), ((1255, 1269), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1267, 1269), True, 'i... |
#!/usr/bin/env python3
import binascii
import itertools
from Crypto.Cipher import AES
HASH_LEN = 32
DATA_LEN = 204
KEY_LEN = 42
FIB_OFFSET = 4919
def fib_seq(n):
out = [0, 1]
for i in range(2, n):
out.append(out[(i - 1)] + out[(i - 2)])
return out
def gen_keys():
keys = []
for a, b i... | [
"Crypto.Cipher.AES.new",
"binascii.unhexlify"
] | [((1020, 1050), 'binascii.unhexlify', 'binascii.unhexlify', (['hash_block'], {}), '(hash_block)\n', (1038, 1050), False, 'import binascii\n'), ((1277, 1312), 'Crypto.Cipher.AES.new', 'AES.new', (['possible_key', 'AES.MODE_ECB'], {}), '(possible_key, AES.MODE_ECB)\n', (1284, 1312), False, 'from Crypto.Cipher import AES\... |
# Generated by Django 2.2.3 on 2019-07-09 17:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('boards', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='board',
... | [
"django.db.models.ForeignKey"
] | [((356, 486), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank': '(True)', 'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'parent_link': '(True)', 'to': '"""boards.Category"""'}), "(blank=True, null=True, on_delete=django.db.models.\n deletion.CASCADE, parent_link=True, to='board... |
import numpy as np
import re
from nltk import Tree
from nltk import induce_pcfg
from nltk import Nonterminal
from nltk.parse.generate import generate
epsilon = 1e-20
class corpus:
# stores all sentence forms in data
def __init__(self):
self.sentence_forms = {}
for i in range(6): # init si... | [
"os.listdir",
"numpy.power",
"nltk.Nonterminal",
"numpy.log",
"nltk.Tree.fromstring",
"nltk.induce_pcfg",
"re.search"
] | [((5787, 5808), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (5797, 5808), False, 'import os\n'), ((7044, 7060), 'nltk.Nonterminal', 'Nonterminal', (['"""S"""'], {}), "('S')\n", (7055, 7060), False, 'from nltk import Nonterminal\n'), ((7075, 7102), 'nltk.induce_pcfg', 'induce_pcfg', (['S', 'product... |
from elasticsearch import helpers, Elasticsearch
import csv
def read_mapping():
try:
with open('books-mapping.json', 'r') as file:
mapping = file.read().replace('\n', '')
return mapping
except Exception as e:
print(e)
es = Elasticsearch()
index_name = 'books'
mapping = re... | [
"elasticsearch.helpers.bulk",
"elasticsearch.Elasticsearch",
"csv.DictReader"
] | [((271, 286), 'elasticsearch.Elasticsearch', 'Elasticsearch', ([], {}), '()\n', (284, 286), False, 'from elasticsearch import helpers, Elasticsearch\n'), ((463, 480), 'csv.DictReader', 'csv.DictReader', (['f'], {}), '(f)\n', (477, 480), False, 'import csv\n'), ((489, 531), 'elasticsearch.helpers.bulk', 'helpers.bulk', ... |
import bpy
import numpy as np
from PIL import Image
class CarModelViewToImage():
# def __init__:
# self.camera_ = None
# self.image_folder_ = None
# self.car_width_ = 0
# self.car_length_ = 0
# self.viewport_width_ = 0
# self.viewport_height_ = 0
# self.stri... | [
"numpy.radians",
"numpy.clip",
"bpy.ops.object.camera_add",
"PIL.Image.fromarray",
"numpy.sqrt",
"bpy.ops.object.constraint_add",
"numpy.array",
"bpy.ops.render.render"
] | [((2180, 2207), 'bpy.ops.object.camera_add', 'bpy.ops.object.camera_add', ([], {}), '()\n', (2205, 2207), False, 'import bpy\n'), ((2367, 2381), 'numpy.radians', 'np.radians', (['(90)'], {}), '(90)\n', (2377, 2381), True, 'import numpy as np\n'), ((2526, 2572), 'bpy.ops.object.constraint_add', 'bpy.ops.object.constrain... |
import os
from os.path import exists
from os.path import join
from os.path import splitext
from subprocess import check_call
from typing import Dict
from typing import List
from typing import Mapping
from typing import Optional
from .compat import is_posix
from .exc import CommandError
def open_in_editor(
filena... | [
"os.path.exists",
"os.path.splitext",
"os.path.join",
"subprocess.check_call"
] | [((952, 982), 'subprocess.check_call', 'check_call', (['[editor, filename]'], {}), '([editor, filename])\n', (962, 982), False, 'from subprocess import check_call\n'), ((2103, 2124), 'os.path.join', 'join', (['path', 'candidate'], {}), '(path, candidate)\n', (2107, 2124), False, 'from os.path import join\n'), ((2136, 2... |
from copy import deepcopy
from uuid import UUID
from django.db import transaction
from django.db.models import F
from django.http import JsonResponse
from django.utils import timezone
from django.utils.timezone import now
from rest_framework import status
from rest_framework.exceptions import PermissionDenied, Validat... | [
"api.applications.models.F680ClearanceApplication.objects.get",
"api.organisations.libraries.get_organisation.get_request_user_organisation",
"api.goods.serializers.GoodCreateSerializer",
"api.cases.enums.CaseTypeEnum.reference_to_id",
"api.applications.libraries.case_status_helpers.submit_application",
"... | [((7945, 7989), 'api.core.decorators.authorised_to_view_application', 'authorised_to_view_application', (['ExporterUser'], {}), '(ExporterUser)\n', (7975, 7989), False, 'from api.core.decorators import application_in_state, authorised_to_view_application, allowed_application_types\n'), ((8727, 8771), 'api.core.decorato... |
from blessings import Terminal
term = Terminal()
class Writer(object):
"""
---------------------------------------------------------------------------
Create an object with a write method that writes to a
specific place on the screen, defined at instantiation.
This is the glue between blessings ... | [
"blessings.Terminal"
] | [((39, 49), 'blessings.Terminal', 'Terminal', ([], {}), '()\n', (47, 49), False, 'from blessings import Terminal\n')] |
"""
Segment Info Merging Wrapper Script
- Takes an id mapping across segments as input
- Merges the segment info dataframes into one for the entire dataset
"""
import synaptor as s
import argparse
parser = argparse.ArgumentParser()
# Inputs & Outputs
parser.add_argument("storagestr")
parser.add_argument("hashval", ... | [
"synaptor.io.parse_storagestr",
"argparse.ArgumentParser"
] | [((209, 234), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (232, 234), False, 'import argparse\n'), ((540, 578), 'synaptor.io.parse_storagestr', 's.io.parse_storagestr', (['args.storagestr'], {}), '(args.storagestr)\n', (561, 578), True, 'import synaptor as s\n'), ((601, 643), 'synaptor.io.pa... |
# Copyright (c) 2021, Intel Corporation
#
# SPDX-License-Identifier: BSD-3-Clause
import subprocess
import os
import time
from . import tools
from syslog import syslog
from util import util
class CommonPlatform:
def __init__(self, configuration):
self.conf = configuration
self.teardown_list = []
... | [
"util.util.run",
"subprocess.Popen",
"subprocess.run",
"time.sleep",
"syslog.syslog",
"util.util.get_configuration_key"
] | [((1588, 1633), 'syslog.syslog', 'syslog', (['f"""NIC under test: {controller_name} """'], {}), "(f'NIC under test: {controller_name} ')\n", (1594, 1633), False, 'from syslog import syslog\n'), ((1720, 1758), 'syslog.syslog', 'syslog', (['f"""Kernel under test: {output}"""'], {}), "(f'Kernel under test: {output}')\n", ... |
import socket
import random
from onionBrowser import *
ab = onionBrowser(proxies = [],\
user_agents=[('User-agents','superSecretBrowser')])
sock=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
bytes = random._urandom(1024)
ip = input('Target IP: ')
port = input('Target Port: ')
port = int(port)
sent = 1
while... | [
"random._urandom",
"socket.socket"
] | [((155, 203), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (168, 203), False, 'import socket\n'), ((211, 232), 'random._urandom', 'random._urandom', (['(1024)'], {}), '(1024)\n', (226, 232), False, 'import random\n')] |
import torch
import arcsim
import gc
import time
import json
import sys
import gc
import os
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
now = datetime.now()
timestamp = datetime.now().strftime('%Y-%m-%d_%H:%M:%S')
#steps = 30
#epochs= 10
steps = 40
epochs= 20
#handles = [25, 60, 30... | [
"torch.optim.SGD",
"matplotlib.pyplot.savefig",
"torch.optim.lr_scheduler.CosineAnnealingWarmRestarts",
"arcsim.get_sim",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"torch.set_num_threads",
"datetime.datetime.now",
"torch.norm",
"os.mkdir",
"numpy.vstack"... | [((180, 194), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (192, 194), False, 'from datetime import datetime\n'), ((659, 677), 'os.mkdir', 'os.mkdir', (['out_path'], {}), '(out_path)\n', (667, 677), False, 'import os\n'), ((909, 934), 'torch.set_num_threads', 'torch.set_num_threads', (['(16)'], {}), '(16)... |
import fire
def main():
"""Command line interface."""
pass
if __name__ == "__main__":
fire.Fire(main)
| [
"fire.Fire"
] | [((102, 117), 'fire.Fire', 'fire.Fire', (['main'], {}), '(main)\n', (111, 117), False, 'import fire\n')] |
from django.contrib import admin
from django.urls import path
import manhole.views
urlpatterns = [
path('<str:client>', manhole.views.script, name='script'),
path('<str:client>/<int:ordering>', manhole.views.output, name='output')
]
| [
"django.urls.path"
] | [((104, 161), 'django.urls.path', 'path', (['"""<str:client>"""', 'manhole.views.script'], {'name': '"""script"""'}), "('<str:client>', manhole.views.script, name='script')\n", (108, 161), False, 'from django.urls import path\n'), ((167, 239), 'django.urls.path', 'path', (['"""<str:client>/<int:ordering>"""', 'manhole.... |
import salome
import SMESH
from salome.geom import geomBuilder
from salome.smesh import smeshBuilder
import sys
import math
import numpy as np
from numpy.linalg import norm
from numpy.random import uniform
from pathlib import Path
from auxiliaryFunctions import clusteringAlgorithm
from auxiliaryFunctions import getTr... | [
"numpy.radians",
"salome.salome_init",
"numpy.allclose",
"numpy.sqrt",
"numpy.cross",
"numpy.tan",
"salome.geom.geomBuilder.New",
"pathlib.Path.cwd",
"numpy.linalg.norm",
"numpy.column_stack",
"numpy.array",
"numpy.savetxt",
"numpy.random.uniform",
"auxiliaryFunctions.clusteringAlgorithm",... | [((392, 412), 'salome.salome_init', 'salome.salome_init', ([], {}), '()\n', (410, 412), False, 'import salome\n'), ((422, 439), 'salome.geom.geomBuilder.New', 'geomBuilder.New', ([], {}), '()\n', (437, 439), False, 'from salome.geom import geomBuilder\n'), ((448, 466), 'salome.smesh.smeshBuilder.New', 'smeshBuilder.New... |
"""
.. module:: Augmentation
:platform: Unix, Windows
:synopsis: A useful module indeed.
.. moduleauthor:: <NAME> <<EMAIL>>
"""
import numpy as np
import random
from nltk.corpus import wordnet
import collections
import math
#import nltk
#nltk.download('wordnet')
class Augmentation:
r"""
This is the clas... | [
"numpy.random.random",
"numpy.random.choice",
"numpy.max",
"numpy.array",
"collections.defaultdict",
"nltk.corpus.wordnet.synsets"
] | [((2556, 2584), 'collections.defaultdict', 'collections.defaultdict', (['int'], {}), '(int)\n', (2579, 2584), False, 'import collections\n'), ((3466, 3501), 'numpy.random.random', 'np.random.random', ([], {'size': '(cache_len,)'}), '(size=(cache_len,))\n', (3482, 3501), True, 'import numpy as np\n'), ((4591, 4619), 'nu... |
"""
THIS CODE IS UNDER THE BSD 2-Clause LICENSE. YOU CAN FIND THE COMPLETE
FILE AT THE SOURCE DIRECTORY.
Copyright (C) 2017 <NAME> - All rights reserved
@author : <EMAIL>
Publication:
A Novel Unsupervised Analysis of El... | [
"cudamat.cublas_init",
"sys.path.insert",
"_pickle.dump",
"scipy.io.loadmat",
"numpy.array",
"cudamat.dot",
"numpy.mod",
"numpy.random.RandomState",
"os.path.exists",
"numpy.savez",
"numpy.mean",
"cudamat.CUDAMatrix",
"numpy.max",
"cudamat.log",
"os.path.isdir",
"numpy.empty",
"numpy... | [((1300, 1343), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../dataPreprocessing/"""'], {}), "(0, '../dataPreprocessing/')\n", (1315, 1343), False, 'import sys\n'), ((1913, 1926), 'dataPreproc.DataPreproc', 'DataPreproc', ([], {}), '()\n', (1924, 1926), False, 'from dataPreproc import DataPreproc\n'), ((5883, 59... |
"""Report generator for the error command.
TODO: move reporting functionality out of the ErrorEstimator class.
"""
from itertools import repeat
from atropos.commands.reports import BaseReportGenerator
from atropos.io import open_output
from atropos.commands.legacy_report import Printer, TitlePrinter
class ReportGener... | [
"atropos.commands.legacy_report.TitlePrinter",
"atropos.io.open_output",
"atropos.commands.legacy_report.Printer",
"itertools.repeat"
] | [((816, 834), 'atropos.commands.legacy_report.Printer', 'Printer', (['outstream'], {}), '(outstream)\n', (823, 834), False, 'from atropos.commands.legacy_report import Printer, TitlePrinter\n'), ((854, 877), 'atropos.commands.legacy_report.TitlePrinter', 'TitlePrinter', (['outstream'], {}), '(outstream)\n', (866, 877),... |
# from flask import Flask, render_template, flash, redirect, url_for, session, request, logging
# from wtforms import Form, StringField, TextAreaField, PasswordField, validators
# from functools import wraps
import requests
import json
import pandas as pd
import platform
import shutil
import datetime
from module import... | [
"json.loads",
"requests.Session",
"pandas.read_csv",
"time.sleep",
"requests.get",
"datetime.datetime.today",
"platform.system",
"pandas.DataFrame"
] | [((831, 848), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (842, 848), True, 'import pandas as pd\n'), ((8500, 8520), 'pandas.DataFrame', 'pd.DataFrame', (['newres'], {}), '(newres)\n', (8512, 8520), True, 'import pandas as pd\n'), ((625, 642), 'platform.system', 'platform.system', ([], {}), '()\n', (6... |
from parsing import get_diet
import discord , asyncio , datetime , sys , os
import parsing
def main():
client = discord.Client()
TOKEN = "<KEY>"
#명령어 목록
Command_list = (
"```css\n"
"[NCC_bot Command List]\n"
"!도움말 - 도움말\n"
... | [
"os.execvp",
"discord.Game",
"datetime.datetime.now",
"datetime.datetime.today",
"discord.Client",
"datetime.timedelta",
"discord.Embed",
"parsing.get_diet"
] | [((118, 134), 'discord.Client', 'discord.Client', ([], {}), '()\n', (132, 134), False, 'import discord, asyncio, datetime, sys, os\n'), ((6401, 6428), 'os.execvp', 'os.execvp', (['executable', 'args'], {}), '(executable, args)\n', (6410, 6428), False, 'import discord, asyncio, datetime, sys, os\n'), ((1209, 1247), 'dis... |
import boto3, json, time, os, logging, botocore, uuid
from crhelper import CfnResource
from botocore.exceptions import ClientError
logger = logging.getLogger()
logger.setLevel(logging.INFO)
logging.getLogger('boto3').setLevel(logging.CRITICAL)
logging.getLogger('botocore').setLevel(logging.CRITICAL)
session = boto3.Se... | [
"logging.getLogger",
"boto3.Session",
"json.dumps",
"time.sleep",
"crhelper.CfnResource"
] | [((141, 160), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (158, 160), False, 'import boto3, json, time, os, logging, botocore, uuid\n'), ((312, 327), 'boto3.Session', 'boto3.Session', ([], {}), '()\n', (325, 327), False, 'import boto3, json, time, os, logging, botocore, uuid\n'), ((338, 434), 'crhelper.... |
'''
Load external modules
'''
import os
import sys
BASE_DIR = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(BASE_DIR, "../python_modules"))
| [
"os.path.realpath",
"os.path.join"
] | [((78, 104), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (94, 104), False, 'import os\n'), ((122, 165), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""../python_modules"""'], {}), "(BASE_DIR, '../python_modules')\n", (134, 165), False, 'import os\n')] |
import json
import os
from datetime import datetime
import boto3
from aws_lambda_powertools.logging import Logger
logger = Logger()
@logger.inject_lambda_context
def main(event, context):
records = event.get("Records", [])
entries = []
stream_label = os.environ["STREAM_LABEL"]
logger.info(
... | [
"json.dumps",
"boto3.client",
"aws_lambda_powertools.logging.Logger"
] | [((125, 133), 'aws_lambda_powertools.logging.Logger', 'Logger', ([], {}), '()\n', (131, 133), False, 'from aws_lambda_powertools.logging import Logger\n'), ((1308, 1330), 'boto3.client', 'boto3.client', (['"""events"""'], {}), "('events')\n", (1320, 1330), False, 'import boto3\n'), ((1113, 1183), 'json.dumps', 'json.du... |
import cv2
import matplotlib.pyplot as plt
import time
from picamera.array import PiRGBArray as pi_rgb
from picamera import PiCamera as picam
confidence_threshold = 0.45 # Threshold to detect object
font = cv2.FONT_HERSHEY_COMPLEX
color = [255, 255, 255]
height = 320
width = 640
focal_length = 500
class P... | [
"cv2.rectangle",
"picamera.PiCamera",
"time.sleep",
"cv2.imshow",
"cv2.dnn_DetectionModel",
"cv2.destroyAllWindows",
"picamera.array.PiRGBArray",
"cv2.waitKey"
] | [((1122, 1169), 'cv2.dnn_DetectionModel', 'cv2.dnn_DetectionModel', (['weightsPath', 'configPath'], {}), '(weightsPath, configPath)\n', (1144, 1169), False, 'import cv2\n'), ((2068, 2091), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (2089, 2091), False, 'import cv2\n'), ((1944, 1974), 'cv2.imsho... |
from os.path import join
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import zscore
from sklearn.decomposition import PCA
import pandas as pd
from itertools import combinations
# Load helper function(s) for interacting with CTF dataset
from ctf_dataset.load import create_wr... | [
"numpy.hstack",
"numpy.nanmean",
"numpy.array",
"numpy.cumsum",
"scipy.stats.pearsonr",
"numpy.save",
"numpy.arange",
"seaborn.set",
"sklearn.decomposition.PCA",
"numpy.stack",
"matplotlib.pyplot.yticks",
"numpy.vstack",
"pandas.DataFrame",
"numpy.amin",
"seaborn.lineplot",
"scipy.stat... | [((403, 425), 'os.path.join', 'join', (['base_dir', '"""data"""'], {}), "(base_dir, 'data')\n", (407, 425), False, 'from os.path import join\n'), ((465, 533), 'ctf_dataset.load.create_wrapped_dataset', 'create_wrapped_dataset', (['data_dir'], {'output_dataset_name': '"""virtual.hdf5"""'}), "(data_dir, output_dataset_na... |
from flask_wtf import FlaskForm
from wtforms import *
from wtforms.validators import InputRequired
class LoginForm(FlaskForm):
username = TextField('username',validators=[InputRequired()])
password = PasswordField('password',validators=[InputRequired()]) | [
"wtforms.validators.InputRequired"
] | [((183, 198), 'wtforms.validators.InputRequired', 'InputRequired', ([], {}), '()\n', (196, 198), False, 'from wtforms.validators import InputRequired\n'), ((250, 265), 'wtforms.validators.InputRequired', 'InputRequired', ([], {}), '()\n', (263, 265), False, 'from wtforms.validators import InputRequired\n')] |
import time
from memory import Memory
from constfile.constkey import *
from constfile.ddpgqueue import fifo, model_queue
from ddpg import DDPG
from utils.configsupport import config
from utils.logsupport import log
class train(object):
def __init__(self):
self.model = DDPG()
self.model.load_weigh... | [
"time.sleep",
"utils.configsupport.config.get",
"ddpg.DDPG",
"memory.Memory",
"time.time"
] | [((284, 290), 'ddpg.DDPG', 'DDPG', ([], {}), '()\n', (288, 290), False, 'from ddpg import DDPG\n'), ((347, 355), 'memory.Memory', 'Memory', ([], {}), '()\n', (353, 355), False, 'from memory import Memory\n'), ((443, 467), 'utils.configsupport.config.get', 'config.get', (['MODEL_WARMUP'], {}), '(MODEL_WARMUP)\n', (453, ... |
import json
import os
import time
from copy import deepcopy
import TransportMaps.Distributions as dist
import TransportMaps.Likelihoods as like
from typing import List, Dict
from matplotlib import pyplot as plt
from factors.Factors import Factor, ExplicitPriorFactor, ImplicitPriorFactor, \
LikelihoodFactor, Bina... | [
"matplotlib.pyplot.ylabel",
"numpy.hstack",
"sampler.sampler_utils.JointFactor",
"numpy.array",
"utils.Functions.sample_dict_to_array",
"copy.deepcopy",
"sampler.SimulationBasedSampler.SimulationBasedSampler",
"slam.Variables.Variable",
"os.path.exists",
"numpy.mean",
"matplotlib.pyplot.xlabel",... | [((32008, 32052), 'os.path.exists', 'os.path.exists', (['f"""{case_dir}/run{run_count}"""'], {}), "(f'{case_dir}/run{run_count}')\n", (32022, 32052), False, 'import os\n'), ((32081, 32119), 'os.mkdir', 'os.mkdir', (['f"""{case_dir}/run{run_count}"""'], {}), "(f'{case_dir}/run{run_count}')\n", (32089, 32119), False, 'im... |
#!/usr/bin/env python
# coding: utf-8
import time
#https://stackoverflow.com/questions/714063/importing-modules-from-parent-folder
import sys
sys.path.insert(0,'../gym')
import numpy as np
from support import *
from model import *
def run_exper(model, steps, get_features, pre_proc_features):
from environment im... | [
"sys.path.insert",
"argparse.ArgumentParser",
"time.perf_counter",
"time.sleep",
"environment.SIMULATOR",
"numpy.array",
"numpy.zeros",
"numpy.expand_dims",
"sys.exit"
] | [((144, 172), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""../gym"""'], {}), "(0, '../gym')\n", (159, 172), False, 'import sys\n'), ((384, 395), 'environment.SIMULATOR', 'SIMULATOR', ([], {}), '()\n', (393, 395), False, 'from environment import SIMULATOR\n'), ((2414, 2439), 'argparse.ArgumentParser', 'argparse.Ar... |
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
h, w = map(int, input().split())
for i in range(h):
c = input().strip()
print(c)
print(c)
| [
"sys.setrecursionlimit"
] | [((38, 68), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(10 ** 7)'], {}), '(10 ** 7)\n', (59, 68), False, 'import sys\n')] |
# generated by 'clang2py'
# flags '-c -d -l ftd2xx64.dll ftd2xx.h -vvv -o _ftd2xx64.py'
# -*- coding: utf-8 -*-
#
# TARGET arch is: []
# WORD_SIZE is: 4
# POINTER_SIZE is: 8
# LONGDOUBLE_SIZE is: 8
#
import ctypes
# if local wordsize is same as target, keep ctypes pointer function.
if ctypes.sizeof(ctypes.c_void_p) =... | [
"ctypes.CFUNCTYPE",
"ctypes.sizeof",
"ctypes.CDLL"
] | [((2139, 2166), 'ctypes.CDLL', 'ctypes.CDLL', (['"""ftd2xx64.dll"""'], {}), "('ftd2xx64.dll')\n", (2150, 2166), False, 'import ctypes\n'), ((288, 318), 'ctypes.sizeof', 'ctypes.sizeof', (['ctypes.c_void_p'], {}), '(ctypes.c_void_p)\n', (301, 318), False, 'import ctypes\n'), ((1965, 1999), 'ctypes.sizeof', 'ctypes.sizeo... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class TripletLoss(nn.Module):
def __init__(self,margin = 0.2, sigma = 0.3):
super(TripletLoss,self).__init__()
self.margin = margin
self.sigma = sigma
def forward(self,f_anchor,f_positive, f_negative): # (-1,c)
... | [
"torch.no_grad",
"torch.norm",
"torch.randn",
"torch.exp"
] | [((1002, 1042), 'torch.norm', 'torch.norm', (['(f_anchor - f_positive)'], {'dim': '(1)'}), '(f_anchor - f_positive, dim=1)\n', (1012, 1042), False, 'import torch\n'), ((1056, 1096), 'torch.norm', 'torch.norm', (['(f_anchor - f_negative)'], {'dim': '(1)'}), '(f_anchor - f_negative, dim=1)\n', (1066, 1096), False, 'impor... |
# -*- coding: utf-8 -*-
# *****************************************************************************
# NICOS, the Networked Instrument Control System of the MLZ
# Copyright (c) 2009-2021 by the NICOS contributors (see AUTHORS)
#
# This program is free software; you can redistribute it and/or modify it under
# the t... | [
"nicos.core.ACCESS_LEVELS.items",
"nicos.core.ACCESS_LEVELS.values"
] | [((1955, 1976), 'nicos.core.ACCESS_LEVELS.items', 'ACCESS_LEVELS.items', ([], {}), '()\n', (1974, 1976), False, 'from nicos.core import ACCESS_LEVELS\n'), ((1223, 1245), 'nicos.core.ACCESS_LEVELS.values', 'ACCESS_LEVELS.values', ([], {}), '()\n', (1243, 1245), False, 'from nicos.core import ACCESS_LEVELS\n')] |
#!/usr/bin/python3
import time
import os
import subprocess
import argparse
# constants
DATE_FORMAT = "%Y-%m-%d %H:%M"
ALERT_STRING = "alerted"
LUNCH_BREAK_DURATION = 1
INFO_WORKING_DURATION = 7
INFO_MESSAGE = "Time to finish open todos"
ALERT_WORKING_DURATION = 8
ALERT_MESSAGE = "Time to go home :-)"
# parse comma... | [
"subprocess.check_output",
"time.strptime",
"argparse.ArgumentParser",
"subprocess.check_call",
"os.symlink",
"os.mkdir",
"time.localtime",
"time.time",
"os.path.expanduser",
"os.remove"
] | [((347, 452), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Tracks working time based on your first login time after 5am."""'}), "(description=\n 'Tracks working time based on your first login time after 5am.')\n", (370, 452), False, 'import argparse\n'), ((664, 675), 'time.time', 't... |
import numpy as np
import tensorflow as tf
from sklearn.metrics import precision_recall_curve, roc_curve
from sklearn.metrics import average_precision_score, auc
from load_data import load_data
from model import build_model, compileModel, build_model_CNN
from numpy import interp
from itertools import cycle
import matpl... | [
"matplotlib.pyplot.ylabel",
"sklearn.metrics.auc",
"sklearn.metrics.roc_curve",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.cla",
"itertools.cycle",
"matplotlib.pyplot.savefig",
"matplotlib.use",
"matplotlib.pyplot.gcf",
"sklearn.metrics.a... | [((327, 348), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (341, 348), False, 'import matplotlib\n'), ((2196, 2243), 'itertools.cycle', 'cycle', (["['aqua', 'darkorange', 'cornflowerblue']"], {}), "(['aqua', 'darkorange', 'cornflowerblue'])\n", (2201, 2243), False, 'from itertools import cycle\... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import scripts.conll18_ud_eval as ud_eval
from scripts.reinsert_compounds import reinsert_compounds
def evaluate(gold_filename, sys_filename, metric):
""""""
reinsert_compounds(gold_filename, sys_filena... | [
"scripts.conll18_ud_eval.load_conllu_file",
"scripts.reinsert_compounds.reinsert_compounds",
"scripts.conll18_ud_eval.evaluate"
] | [((276, 323), 'scripts.reinsert_compounds.reinsert_compounds', 'reinsert_compounds', (['gold_filename', 'sys_filename'], {}), '(gold_filename, sys_filename)\n', (294, 323), False, 'from scripts.reinsert_compounds import reinsert_compounds\n'), ((345, 384), 'scripts.conll18_ud_eval.load_conllu_file', 'ud_eval.load_conll... |
# --------------
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# Code starts here
df=pd.read_csv(path)
df["state"]=df["state"].apply(lambda x: x.lower())
df['total']=df['Jan']+df['Feb']+df['Mar']
sum_var={col: df[col].sum() for col in df}
sum_row=pd.DataFrame(sum_var,ind... | [
"pandas.DataFrame",
"requests.get",
"pandas.read_html",
"pandas.read_csv"
] | [((134, 151), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (145, 151), True, 'import pandas as pd\n'), ((296, 328), 'pandas.DataFrame', 'pd.DataFrame', (['sum_var'], {'index': '[0]'}), '(sum_var, index=[0])\n', (308, 328), True, 'import pandas as pd\n'), ((508, 525), 'requests.get', 'requests.get', (['... |
from injector import inject
from domain.connection.CheckDatabaseConnection.CheckDatabaseConnectionCommand import CheckDatabaseConnectionCommand
from domain.connection.CheckDatabaseConnection.CheckDatabaseConnectionRequest import CheckDatabaseConnectionRequest
from infrastructure.api.ResourceBase import ResourceBase
fr... | [
"domain.connection.CheckDatabaseConnection.CheckDatabaseConnectionCommand.CheckDatabaseConnectionCommand",
"infrastructure.api.decorators.Controller.controller"
] | [((439, 451), 'infrastructure.api.decorators.Controller.controller', 'controller', ([], {}), '()\n', (449, 451), False, 'from infrastructure.api.decorators.Controller import controller\n'), ((829, 872), 'domain.connection.CheckDatabaseConnection.CheckDatabaseConnectionCommand.CheckDatabaseConnectionCommand', 'CheckData... |
#! /usr/bin/env python
#
# Copyright (c) 2013, <NAME>
# Imperial College London
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyr... | [
"random.uniform",
"actionlib.msg.TestGoal",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.Time.now",
"rospy.get_name",
"rospy.Duration",
"actionlib.SimpleActionClient"
] | [((2776, 2807), 'rospy.init_node', 'rospy.init_node', (['Constants.node'], {}), '(Constants.node)\n', (2791, 2807), False, 'import rospy\n'), ((2136, 2193), 'actionlib.SimpleActionClient', 'actionlib.SimpleActionClient', (['Constants.topic', 'TestAction'], {}), '(Constants.topic, TestAction)\n', (2164, 2193), False, 'i... |
from base_expansion import base_expansion as be
def binary_addition(num1, num2):
"""Return binary addition"""
a = _helper(num1)
b = _helper(num2)
c = 0
res = []
length = len(a) if len(a) > len(b) else len(b)
for i in range(length-1):
d = (_get(a, i)+_get(b, i)+c)//2
elem =... | [
"base_expansion.base_expansion"
] | [((544, 554), 'base_expansion.base_expansion', 'be', (['num', '(2)'], {}), '(num, 2)\n', (546, 554), True, 'from base_expansion import base_expansion as be\n')] |
"""Test the logger extension module."""
# pylint: disable=protected-access,redefined-outer-name,unused-variable,invalid-name
import importlib
import json
import sys
import google
import pytest
from marshmallow import fields
from conftest import app
from luckycharms import base
from protobuffers import proto
def set... | [
"json.loads",
"protobuffers.proto.TestCollection",
"conftest.app.test_request_context",
"protobuffers.proto.Test",
"pytest.raises",
"importlib.reload",
"marshmallow.fields.String",
"marshmallow.fields.Integer"
] | [((559, 581), 'importlib.reload', 'importlib.reload', (['base'], {}), '(base)\n', (575, 581), False, 'import importlib\n'), ((900, 922), 'importlib.reload', 'importlib.reload', (['base'], {}), '(base)\n', (916, 922), False, 'import importlib\n'), ((1008, 1024), 'marshmallow.fields.Integer', 'fields.Integer', ([], {}), ... |
#!/usr/bin/python
import sicario
import os
import importlib
class ModuleManager:
modules = []
modules_failed = []
def load_modules (self, directory="modules/"):
directories = os.listdir(directory)
modules = []
modules_failed = []
for module in directories:
if not os.path.isdir('modules/' + module):
... | [
"os.path.isfile",
"os.listdir",
"os.path.isdir",
"importlib.import_module"
] | [((184, 205), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (194, 205), False, 'import os\n'), ((341, 399), 'os.path.isfile', 'os.path.isfile', (["('modules/' + module + '/' + module + '.py')"], {}), "('modules/' + module + '/' + module + '.py')\n", (355, 399), False, 'import os\n'), ((284, 318), 'o... |
# https://leetcode.com/problems/valid-parentheses
from collections import deque
class Solution:
def isValid(self, s: str):
if not s:
return True
N = len(s)
st = deque([s[0]])
for i in range(1, N):
if not st:
st.append(s[i])
else:... | [
"collections.deque"
] | [((204, 217), 'collections.deque', 'deque', (['[s[0]]'], {}), '([s[0]])\n', (209, 217), False, 'from collections import deque\n')] |
import numpy as np
one_d_array = [0, 1, 2, 3, 4, 5]
two_d_array = [
[11, 12, 13, 14, 15],
[16, 17, 18, 19, 20],
[21, 22, 23, 24, 25],
[26, 27, 28 ,29, 30],
[31, 32, 33, 34, 35]
]
t = one_d_array[3]
# x: coord(index)
e = two_d_array[2][1]
# y x y:row x:column
arr = ... | [
"numpy.array"
] | [((320, 341), 'numpy.array', 'np.array', (['two_d_array'], {}), '(two_d_array)\n', (328, 341), True, 'import numpy as np\n')] |
import frappe
from datetime import datetime
from adaequare_gsp.helpers.schema.states import number_state_mapping
from adaequare_gsp.helpers.schema.gstr_2b import (
GST_CATEGORY,
NOTE_TYPE,
YES_NO,
)
def update_period(date):
date = datetime.strptime(date, "%b-%y").strftime("%m%Y")
return date
DAT... | [
"datetime.datetime.strptime",
"frappe._dict"
] | [((934, 1298), 'frappe._dict', 'frappe._dict', (["{'doc_number': 'inum', 'supply_type': 'inv_typ', 'doc_date': 'idt',\n 'document_value': 'val', 'place_of_supply': 'pos',\n 'other_return_period': 'aspd', 'amendment_type': 'atyp',\n 'reverse_charge': 'rchrg', 'diffprcnt': 'diff_percent', 'irn_source':\n 'src... |
import tempfile
import tensorflow as tf
import tensorflow_model_optimization as tfmot
from tensorflow.keras.models import load_model
import os
from tensorflow import keras
import time
def evaluate_model(interpreter):
input_index = interpreter.get_input_details()[0]["index"]
output_index = interpreter.get_output_de... | [
"os.path.getsize",
"tensorflow.keras.layers.Reshape",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow_model_optimization.quantization.keras.quantize_apply",
"tensorflow.keras.layers.BatchNormalization",
"tensorflow.keras.layers.Dense",
"tensorflow.lite.TFLiteConve... | [((2171, 2217), 'tensorflow_model_optimization.quantization.keras.quantize_apply', 'tfmot.quantization.keras.quantize_apply', (['model'], {}), '(model)\n', (2210, 2217), True, 'import tensorflow_model_optimization as tfmot\n'), ((2875, 2931), 'tensorflow.lite.TFLiteConverter.from_keras_model', 'tf.lite.TFLiteConverter.... |
from __future__ import annotations
import copy
from typing import Optional
from mapfmclient import MarkedLocation
from python.coord import Coord, UncalculatedCoord
class Agent:
def __init__(self, location: Coord, color: int, accumulated_cost: Optional[int]):
self.location = location
self.accumu... | [
"python.coord.Coord"
] | [((1117, 1146), 'python.coord.Coord', 'Coord', (['location.x', 'location.y'], {}), '(location.x, location.y)\n', (1122, 1146), False, 'from python.coord import Coord, UncalculatedCoord\n')] |
import sqlalchemy as sq
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
engine = create_engine('sqlite:///tmp/expense.db',
connect_args={"check_same_thread": False},
... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"sqlalchemy.String",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.Column"
] | [((166, 184), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (182, 184), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((194, 302), 'sqlalchemy.create_engine', 'create_engine', (['"""sqlite:///tmp/expense.db"""'], {'connect_args': "{'check_same_thread': False... |
"""web URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based vie... | [
"django.views.generic.RedirectView.as_view",
"django.urls.path",
"django.contrib.staticfiles.urls.static",
"django.urls.include"
] | [((1191, 1252), 'django.contrib.staticfiles.urls.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)\n', (1197, 1252), False, 'from django.contrib.staticfiles.urls import static\n'), ((1073, 1104), 'django.urls.path', 'path', ([... |
from django import forms
from dal import forward
from dal.autocomplete import ModelSelect2, ModelSelect2Multiple
from django.forms import formset_factory, inlineformset_factory, modelformset_factory
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit
from .... | [
"django.forms.DateInput",
"django.forms.BooleanField",
"django.forms.CharField",
"django.forms.ChoiceField",
"django.forms.IntegerField",
"django.forms.Textarea",
"dal.autocomplete.ModelSelect2",
"dal.forward.Const",
"django.forms.RadioSelect",
"django.forms.FileField",
"dal.autocomplete.ModelSe... | [((615, 969), 'django.forms.ChoiceField', 'forms.ChoiceField', ([], {'choices': "(('year', 'Conference year (ascending)'), ('-year',\n 'Conference year (descending)'), ('rank', 'Text search relevance'), (\n 'title', 'Title (A-Z)'), ('-title', 'Title (Z-A)'), ('last_name',\n 'Last name of first author (A-Z)'), ... |
import sys
import requests
from bs4 import BeautifulSoup
from urllib import request
args = sys.argv[1]
url = args
response = request.urlopen(url)
soup = BeautifulSoup(response, features = "html.parser")
response.close()
print(soup.title.text)
print(soup.pre.text)
| [
"bs4.BeautifulSoup",
"urllib.request.urlopen"
] | [((126, 146), 'urllib.request.urlopen', 'request.urlopen', (['url'], {}), '(url)\n', (141, 146), False, 'from urllib import request\n'), ((154, 201), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response'], {'features': '"""html.parser"""'}), "(response, features='html.parser')\n", (167, 201), False, 'from bs4 import Beaut... |
#dada
from dearpygui import core, simple
from generic_window import GenericWindow
from tensor_flow_interface import TensorFlowInterface
from tensor_flow_interface import ModelDataContainer
from import_window import ImportWindow
from output_visualisation_window import OutputVisualisationWindow
from better_visualizer imp... | [
"dearpygui.core.render_dearpygui_frame",
"dearpygui.core.get_value",
"dearpygui.core.add_text",
"dearpygui.core.add_checkbox",
"history_graph_window.HistoryGraphWindow",
"dearpygui.simple.set_window_pos",
"tensor_flow_interface.ModelDataContainer",
"dearpygui.core.add_input_int",
"output_visualisati... | [((1571, 1592), 'tensor_flow_interface.TensorFlowInterface', 'TensorFlowInterface', ([], {}), '()\n', (1590, 1592), False, 'from tensor_flow_interface import TensorFlowInterface\n'), ((1634, 1661), 'output_visualisation_window.OutputVisualisationWindow', 'OutputVisualisationWindow', ([], {}), '()\n', (1659, 1661), Fals... |
from typing import NewType
from typing import Union
from typing import List
from typing import Tuple
from typing import TypedDict
from typing import Optional
Baz = NewType("Baz", bool)
Foo = NewType("Foo", str)
"""array of strings is all...
"""
UnorderedSetOfFooz1UBFn8B = NewType("UnorderedSetOfFooz1UBFn8B", List[Foo... | [
"typing.NewType"
] | [((165, 185), 'typing.NewType', 'NewType', (['"""Baz"""', 'bool'], {}), "('Baz', bool)\n", (172, 185), False, 'from typing import NewType\n'), ((193, 212), 'typing.NewType', 'NewType', (['"""Foo"""', 'str'], {}), "('Foo', str)\n", (200, 212), False, 'from typing import NewType\n'), ((275, 322), 'typing.NewType', 'NewTy... |
# Copyright (c) 2021, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import unittest
from src.lyap.verifier.z3verifier import Z3Verifier
from functools import partial
fr... | [
"src.lyap.verifier.z3verifier.Z3Verifier.solver_fncts",
"src.lyap.learner.net.NN",
"src.lyap.verifier.z3verifier.Z3Verifier",
"functools.partial",
"unittest.main"
] | [((4318, 4333), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4331, 4333), False, 'import unittest\n'), ((780, 811), 'functools.partial', 'partial', (['poly_2'], {'batch_size': '(100)'}), '(poly_2, batch_size=100)\n', (787, 811), False, 'from functools import partial\n'), ((1060, 1095), 'src.lyap.verifier.z3veri... |
# Copyright 2017, <NAME>
# Copyright 2017, Red Hat
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | [
"repoxplorer.controllers.utils.resolv_filters",
"repoxplorer.index.contributors.Contributors",
"repoxplorer.index.projects.Projects",
"repoxplorer.index.Connector",
"pecan.expose"
] | [((887, 901), 'pecan.expose', 'expose', (['"""json"""'], {}), "('json')\n", (893, 901), False, 'from pecan import expose\n'), ((1073, 1083), 'repoxplorer.index.projects.Projects', 'Projects', ([], {}), '()\n', (1081, 1083), False, 'from repoxplorer.index.projects import Projects\n'), ((1101, 1115), 'repoxplorer.index.c... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2012 <NAME> <<EMAIL>>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#... | [
"weechat.prnt",
"weechat.infolist_string",
"weechat.config_read",
"weechat.color",
"weechat.config_string",
"weechat.command",
"weechat.infolist_free",
"weechat.config_integer",
"os.walk",
"weechat.hook_command",
"weechat.hook_completion",
"weechat.infolist_get",
"os.path.isdir",
"os.unlin... | [((4286, 4349), 'weechat.config_new', 'weechat.config_new', (['CONFIG_FILE_NAME', '"""wg_config_reload_cb"""', '""""""'], {}), "(CONFIG_FILE_NAME, 'wg_config_reload_cb', '')\n", (4304, 4349), False, 'import weechat\n'), ((4477, 4578), 'weechat.config_new_section', 'weechat.config_new_section', (['wg_config_file', '"""c... |
#
#
# vizMetrics - an interactive toolset for calculating visualization metrics
#
#
#
import os
from kivy.app import App
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.lang import Builder
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import StringProperty
f... | [
"kivy.config.Config.set",
"saliencyMetric.hi_res",
"saliencyMetric.edgeCongestion",
"os.path.splitext",
"saliencyMetric.low_res",
"os.path.basename",
"saliencyMetric.aalto",
"kivy.properties.StringProperty"
] | [((4136, 4175), 'kivy.config.Config.set', 'Config.set', (['"""graphics"""', '"""width"""', '"""1422"""'], {}), "('graphics', 'width', '1422')\n", (4146, 4175), False, 'from kivy.config import Config\n'), ((4176, 4215), 'kivy.config.Config.set', 'Config.set', (['"""graphics"""', '"""height"""', '"""774"""'], {}), "('gra... |
#coding=utf8
import sys
import json
codes_fmt = '''
auto ns = LuaAdapterEnvironment::getInstance().getNamespace("%s");
ns->begin();
{
ns->registerClass("%s", typeid(%s));
auto cls = ns->getClass("%s");
cls->begin();
%s//extends
%s//constructors
%s//destructor
%s//nonmember variables
%s//member vari... | [
"json.loads"
] | [((2548, 2568), 'json.loads', 'json.loads', (['fContent'], {}), '(fContent)\n', (2558, 2568), False, 'import json\n')] |
'''
Created on 2009-08-11
@author: malem303
'''
import unittest
from imugrabber.algorithms import fong_accelero, utils, statistics
from imugrabber.algorithms import io
import os
import scipy as sp
from numpy import testing
class FongTests(unittest.TestCase):
def setUp(self):
self.misalignments... | [
"imugrabber.algorithms.fong_accelero.fit",
"scipy.array",
"imugrabber.algorithms.utils.build_measures_matrix",
"numpy.testing.assert_almost_equal",
"imugrabber.algorithms.io.float_columns_from_CSV",
"unittest.main"
] | [((1366, 1381), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1379, 1381), False, 'import unittest\n'), ((332, 502), 'scipy.array', 'sp.array', (['[[0.00408269136, -1.96002082e-05, 0.000116692771], [-6.73123099e-06, \n 0.00386658837, -0.000277361987], [-6.43895175e-05, 0.00029126093, \n 0.00393614477]]'], ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Nov 1 18:25:21 2020
@author: vinnie
"""
import tweepy
from collections import defaultdict
import pandas as pd
import argparse
import os
from stats import tweet_analyzer
from wordanalysis import WordsAnalysis
from keys import (
api_key,
api_se... | [
"argparse.ArgumentParser",
"stats.tweet_analyzer",
"pandas.DataFrame.from_dict",
"wordanalysis.WordsAnalysis",
"tweepy.API",
"os.path.isdir",
"collections.defaultdict",
"os.mkdir",
"tweepy.OAuthHandler"
] | [((383, 427), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (['api_key', 'api_secret_key'], {}), '(api_key, api_secret_key)\n', (402, 427), False, 'import tweepy\n'), ((492, 508), 'tweepy.API', 'tweepy.API', (['auth'], {}), '(auth)\n', (502, 508), False, 'import tweepy\n'), ((3969, 4005), 'stats.tweet_analyzer', 'tweet... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 15 09:44:30 2021
@author: erri
"""
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.colors import ListedColormap, BoundaryNorm
#############################################################################################... | [
"numpy.count_nonzero",
"numpy.array",
"numpy.loadtxt",
"numpy.nanmin",
"os.path.exists",
"matplotlib.colors.ListedColormap",
"os.mkdir",
"numpy.nanmax",
"matplotlib.pyplot.savefig",
"numpy.isnan",
"numpy.savetxt",
"numpy.nansum",
"matplotlib.pyplot.show",
"os.path.join",
"numpy.logical_o... | [((959, 989), 'os.path.join', 'os.path.join', (['w_dir', 'DEM1_name'], {}), '(w_dir, DEM1_name)\n', (971, 989), False, 'import os\n'), ((1002, 1032), 'os.path.join', 'os.path.join', (['w_dir', 'DEM2_name'], {}), '(w_dir, DEM2_name)\n', (1014, 1032), False, 'import os\n'), ((1297, 1328), 'os.path.join', 'os.path.join', ... |
"""unit test for bandage.Supply"""
import bandage
supplier = bandage.Supply(
"https://github.com/perpetualCreations/bandage/releases/tag/BANDAGE",
"F://bandage//tests//test_target//VERSION")
print(supplier.realize())
print(supplier.pre_collect_dump())
print(supplier.version_gap)
| [
"bandage.Supply"
] | [((63, 200), 'bandage.Supply', 'bandage.Supply', (['"""https://github.com/perpetualCreations/bandage/releases/tag/BANDAGE"""', '"""F://bandage//tests//test_target//VERSION"""'], {}), "(\n 'https://github.com/perpetualCreations/bandage/releases/tag/BANDAGE',\n 'F://bandage//tests//test_target//VERSION')\n", (77, 2... |
#!/usr/bin/env python3
# Pascals triangle
# 2022 <NAME> -- MIT License
import colorama
from colorama import Fore
from colorama import Style
C = "A "
SEED = 3
ITERATIONS = 49
SCREEN_WIDTH = 160
class TNode:
value = SEED
parent_left = None
parent_right = None
def __init__(self, left = None, right = N... | [
"colorama.init"
] | [((1709, 1724), 'colorama.init', 'colorama.init', ([], {}), '()\n', (1722, 1724), False, 'import colorama\n')] |
"""Test that parsing Percolator input files works correctly"""
import pytest
import mokapot
import pandas as pd
@pytest.fixture
def std_pin(tmp_path):
"""Create a standard pin file"""
out_file = tmp_path / "std_pin"
with open(str(out_file), "w+") as pin:
dat = (
"sPeCid\tLaBel\tpepTide... | [
"mokapot.read_pin",
"pandas.testing.assert_frame_equal"
] | [((639, 676), 'mokapot.read_pin', 'mokapot.read_pin', (['std_pin'], {'to_df': '(True)'}), '(std_pin, to_df=True)\n', (655, 676), False, 'import mokapot\n'), ((825, 850), 'mokapot.read_pin', 'mokapot.read_pin', (['std_pin'], {}), '(std_pin)\n', (841, 850), False, 'import mokapot\n'), ((855, 921), 'pandas.testing.assert_... |
import napari
from nilearn import image
from skimage import segmentation
img = image.image.load_img('assets/BraTS19_2013_10_1_flair.nii').get_data()
viewer = napari.view_image(img)
pix = segmentation.slic(img, n_segments=10000, compactness=0.002, multichannel=False,
)
pix_boundaries = segmenta... | [
"skimage.segmentation.find_boundaries",
"napari.view_image",
"nilearn.image.image.load_img",
"skimage.segmentation.slic"
] | [((159, 181), 'napari.view_image', 'napari.view_image', (['img'], {}), '(img)\n', (176, 181), False, 'import napari\n'), ((189, 268), 'skimage.segmentation.slic', 'segmentation.slic', (['img'], {'n_segments': '(10000)', 'compactness': '(0.002)', 'multichannel': '(False)'}), '(img, n_segments=10000, compactness=0.002, m... |
#!/usr/bin/env python
import argparse
import csv
import datetime
import dateutil.relativedelta as relativedelta
import dateutil.rrule as rrule
def parse_args():
parser = argparse.ArgumentParser(description='Generates an empty class schedule CSV file')
parser.add_argument('-s', '--startdate',
type=dat... | [
"argparse.FileType",
"csv.writer",
"argparse.ArgumentParser",
"dateutil.rrule.rrule"
] | [((176, 262), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generates an empty class schedule CSV file"""'}), "(description=\n 'Generates an empty class schedule CSV file')\n", (199, 262), False, 'import argparse\n'), ((1416, 1472), 'dateutil.rrule.rrule', 'rrule.rrule', (['rrule.WEE... |
# CTK: Cherokee Toolkit
#
# Authors:
# <NAME>
# <NAME>
#
# Copyright (C) 2010-2011 <NAME>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License as published by the Free Software Foundation.
#
# This program is distributed... | [
"Widget.Widget.__init__",
"Server.cfg.get_val",
"Widget.Widget.Render",
"RawHTML.RawHTML",
"Box.Box.__init__"
] | [((1086, 1107), 'Widget.Widget.__init__', 'Widget.__init__', (['self'], {}), '(self)\n', (1101, 1107), False, 'from Widget import Widget\n'), ((1542, 1561), 'Widget.Widget.Render', 'Widget.Render', (['self'], {}), '(self)\n', (1555, 1561), False, 'from Widget import Widget\n'), ((1788, 1806), 'Box.Box.__init__', 'Box._... |
def colorprint(text, color, bgcolor, *options):
import os
bef = "\x1B["
bg = bef + bgcolorcode(bgcolor)
cc = bef + colorcode(color)
styles = optioncode(*options)
end = bef + "0m"
os.system("echo \"" + styles + bg + cc + text + end + "\"")
def optioncode(*options):
option = ""
allop... | [
"os.system"
] | [((208, 265), 'os.system', 'os.system', (['(\'echo "\' + styles + bg + cc + text + end + \'"\')'], {}), '(\'echo "\' + styles + bg + cc + text + end + \'"\')\n', (217, 265), False, 'import os\n')] |
import flask
import threading
app = flask.Flask('main.py')
@app.route('/')
def index():
return flask.render_template("index.html")
t = threading.Thread(target=app.run())
t.start()
| [
"flask.render_template",
"flask.Flask"
] | [((37, 59), 'flask.Flask', 'flask.Flask', (['"""main.py"""'], {}), "('main.py')\n", (48, 59), False, 'import flask\n'), ((102, 137), 'flask.render_template', 'flask.render_template', (['"""index.html"""'], {}), "('index.html')\n", (123, 137), False, 'import flask\n')] |
from django.urls import path, include
from .views import ReportCreate, ReportList, ImpactCreate, ReportEdit, \
ReportDetail, ReportAddImpact, DeleteImpact, ReportSubmit, FinalReport
from .plots import meta_plot
urlpatterns = [
path('impact/', ImpactCreate.as_view(), name='report-impact'),
path('create/',... | [
"django.urls.path"
] | [((968, 1045), 'django.urls.path', 'path', (['"""final/<int:year>/demo/<str:plotname>.png"""', 'meta_plot'], {'name': '"""meta_plot"""'}), "('final/<int:year>/demo/<str:plotname>.png', meta_plot, name='meta_plot')\n", (972, 1045), False, 'from django.urls import path, include\n')] |
import numpy as np
def load_lda(path):
rows = []
with open(path, 'r') as f:
for line in f:
line = line.strip(" []\n")
if line:
rows.append(np.fromstring(line, dtype=np.float32, sep=' '))
matrix = np.array(rows).T
return matrix[:-1], matrix[-1]
| [
"numpy.array",
"numpy.fromstring"
] | [((259, 273), 'numpy.array', 'np.array', (['rows'], {}), '(rows)\n', (267, 273), True, 'import numpy as np\n'), ((197, 243), 'numpy.fromstring', 'np.fromstring', (['line'], {'dtype': 'np.float32', 'sep': '""" """'}), "(line, dtype=np.float32, sep=' ')\n", (210, 243), True, 'import numpy as np\n')] |
# This script looks for errors in the examples creates by `create_run_all_examples.py`
import argparse
import glob
parser = argparse.ArgumentParser()
parser.add_argument(
'working_dir',
type=str,
metavar='PATH',
help='path to examples working directory',
)
args = parser.parse_args()
files_with_error... | [
"glob.glob",
"argparse.ArgumentParser"
] | [((126, 151), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (149, 151), False, 'import argparse\n'), ((343, 404), 'glob.glob', 'glob.glob', (['f"""{args.working_dir}/*/output/log/activitysim.log"""'], {}), "(f'{args.working_dir}/*/output/log/activitysim.log')\n", (352, 404), False, 'import glo... |
#!/usr/bin/python
from __future__ import absolute_import
import torch
import torch.nn as nn
from torchvision import transforms
from torchvision.models import vgg16_bn
from torch.utils.data import Dataset, DataLoader
from PIL import Image
import numpy as np
import matplotlib.pyplot as plt
import os
from statistics impor... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"statistics.stdev",
"torch.nn.CrossEntropyLoss",
"torch.max",
"numpy.array",
"matplotlib.pyplot.imshow",
"numpy.mean",
"os.listdir",
"matplotlib.pyplot.plot",
"numpy.asarray",
"torchvision.models.vgg16_bn",
"matplotlib.pyplot.ylim",
"torchvision.transfo... | [((549, 569), 'PIL.Image.open', 'Image.open', (['img_path'], {}), '(img_path)\n', (559, 569), False, 'from PIL import Image\n'), ((615, 630), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n', (625, 630), True, 'import numpy as np\n'), ((760, 775), 'matplotlib.pyplot.imshow', 'plt.imshow', (['img'], {}), '(img)\n... |
import unittest
from nose.plugins.attrib import attr
from testing.utils import DumpResponse
import cloudsigma.resource as resource
@attr('acceptance_test')
class FirewallPolicyTest(unittest.TestCase):
def setUp(self):
unittest.TestCase.setUp(self)
self.client = resource.FirewallPolicy()
... | [
"nose.plugins.attrib.attr",
"testing.utils.DumpResponse",
"cloudsigma.resource.Server",
"cloudsigma.resource.FirewallPolicy",
"unittest.TestCase.setUp"
] | [((136, 159), 'nose.plugins.attrib.attr', 'attr', (['"""acceptance_test"""'], {}), "('acceptance_test')\n", (140, 159), False, 'from nose.plugins.attrib import attr\n'), ((2457, 2478), 'nose.plugins.attrib.attr', 'attr', (['"""docs_snippets"""'], {}), "('docs_snippets')\n", (2461, 2478), False, 'from nose.plugins.attri... |
"""ЛР 3.3, <NAME>, М8О-303Б-18"""
import numpy as np
import fire # CLI
import matplotlib.pyplot as plt
from sem1.lab1_1.gauss import lu_decomposition, lu_solve
def f(coeffs, x):
"""Вычисление значения полинома с коэффициентами coeffs"""
return sum([x ** i * c for i, c in enumerate(coeffs)])
def sum_squar... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"fire.Fire",
"sem1.lab1_1.gauss.lu_decomposition",
"matplotlib.pyplot.plot",
"sem1.lab1_1.gauss.lu_solve",
"numpy.array",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((735, 748), 'numpy.array', 'np.array', (['mat'], {}), '(mat)\n', (743, 748), True, 'import numpy as np\n'), ((757, 768), 'numpy.array', 'np.array', (['b'], {}), '(b)\n', (765, 768), True, 'import numpy as np\n'), ((783, 804), 'sem1.lab1_1.gauss.lu_decomposition', 'lu_decomposition', (['mat'], {}), '(mat)\n', (799, 80... |
from argparse import ArgumentParser
from itertools import starmap
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from fyne import blackscholes, heston
from matplotlib.patches import Patch
from scipy.stats import gaussian_kde
import settings
from align_settings import STARTTIME, ENDTIME
from ut... | [
"numpy.clip",
"pandas.to_timedelta",
"pandas.read_parquet",
"argparse.ArgumentParser",
"numpy.reshape",
"numpy.log",
"pandas.Series.xs",
"numpy.linspace",
"matplotlib.pyplot.subplots",
"matplotlib.patches.Patch",
"numpy.rot90",
"numpy.broadcast_arrays",
"pandas.to_datetime"
] | [((2058, 2079), 'pandas.to_timedelta', 'pd.to_timedelta', (['"""1s"""'], {}), "('1s')\n", (2073, 2079), True, 'import pandas as pd\n'), ((2921, 2982), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(2)'], {'sharey': '(True)', 'sharex': '(True)', 'figsize': '(8, 10)'}), '(3, 2, sharey=True, sharex=True, figsize... |
import unittest
import tests.helpers.util as util
from tetris.logic.board.Board import Board
from tetris.logic.tetromino.Tetromino import Tetromino
from tetris.util.containers import Dimension
class BoardTest(unittest.TestCase):
def setUp(self):
self.board = Board(Dimension(5, 4))
def test_new_board_... | [
"tests.helpers.util.check_board_state",
"tetris.logic.tetromino.Tetromino.Tetromino",
"tests.helpers.util.control_tetromino",
"tetris.util.containers.Dimension"
] | [((344, 422), 'tests.helpers.util.check_board_state', 'util.check_board_state', (['self', 'self.board', "['.....', '.....', '.....', '.....']"], {}), "(self, self.board, ['.....', '.....', '.....', '.....'])\n", (366, 422), True, 'import tests.helpers.util as util\n'), ((555, 633), 'tests.helpers.util.check_board_state... |
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
from botbuilder.dialogs import (
ComponentDialog,
WaterfallDialog,
WaterfallStepContext,
OAuthPrompt,
OAuthPromptSettings,
)
class SsoSignInDialog(ComponentDialog):
def __init__(self, connection_name... | [
"botbuilder.dialogs.OAuthPromptSettings",
"botbuilder.dialogs.WaterfallDialog"
] | [((815, 901), 'botbuilder.dialogs.WaterfallDialog', 'WaterfallDialog', (['WaterfallDialog.__name__', '[self.signin_step, self.display_token]'], {}), '(WaterfallDialog.__name__, [self.signin_step, self.\n display_token])\n', (830, 901), False, 'from botbuilder.dialogs import ComponentDialog, WaterfallDialog, Waterfal... |
from pathlib import Path
import os
import dj_database_url
BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
DEBUG = False
ALLOWED_HOSTS = ['khafonline.com','www.khafonline.com']
MYSQL=True
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'OPTIONS': {
... | [
"os.path.join",
"pathlib.Path"
] | [((866, 900), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""download"""'], {}), "(BASE_DIR, 'download')\n", (878, 900), False, 'import os\n'), ((70, 84), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (74, 84), False, 'from pathlib import Path\n'), ((367, 404), 'os.path.join', 'os.path.join', (['BASE_D... |
import os
import random
import datetime
import argparse
import numpy as np
from tqdm import tqdm
from model.unetdsbn import Unet2D
from utils.loss import dice_loss1
from datasets.dataset import Dataset, ToTensor, CreateOnehotLabel
import torch
import torchvision.transforms as tfs
from torch import optim
from torch.op... | [
"torch.manual_seed",
"os.path.exists",
"utils.loss.dice_loss1",
"argparse.ArgumentParser",
"torch.optim.lr_scheduler.ExponentialLR",
"os.makedirs",
"datasets.dataset.CreateOnehotLabel",
"tqdm.tqdm",
"os.path.join",
"torch.nn.DataParallel",
"random.seed",
"datasets.dataset.ToTensor",
"datetim... | [((454, 514), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""Dual Normalization U-Net Training"""'], {}), "('Dual Normalization U-Net Training')\n", (477, 514), False, 'import argparse\n'), ((1464, 1498), 'random.seed', 'random.seed', (['(args.seed + worker_id)'], {}), '(args.seed + worker_id)\n', (1475, 1... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | [
"mindspore.dataset.audio.transforms.Flanger",
"numpy.abs",
"mindspore.dataset.NumpySlicesDataset",
"numpy.count_nonzero",
"numpy.array",
"numpy.random.sample",
"pytest.raises"
] | [((1061, 1092), 'numpy.abs', 'np.abs', (['(data_expected - data_me)'], {}), '(data_expected - data_me)\n', (1067, 1092), True, 'import numpy as np\n'), ((1179, 1204), 'numpy.count_nonzero', 'np.count_nonzero', (['greater'], {}), '(greater)\n', (1195, 1204), True, 'import numpy as np\n'), ((1532, 1594), 'numpy.array', '... |
# Generated by Django 2.0.4 on 2018-04-17 07:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('workouts', '0008_auto_20180417_0934'),
]
operations = [
migrations.AlterField(
model_name='exercise',
name='exercise... | [
"django.db.models.SlugField"
] | [((346, 375), 'django.db.models.SlugField', 'models.SlugField', ([], {'unique': '(True)'}), '(unique=True)\n', (362, 375), False, 'from django.db import migrations, models\n')] |
from aorist import (
Attribute,
NaturalNumber,
StringIdentifier,
DateString,
POSIXTimestamp,
PositiveFloat,
default_tabular_schema,
RowStruct,
StaticDataTable,
DataSchema,
StorageSetup,
RemoteStorageSetup,
Storage,
RemoteStorage,
RemoteLocation,
CSVEncodin... | [
"aorist.WebLocation",
"aorist.SingleFileLayout",
"aorist.StringIdentifier",
"aorist.NaturalNumber",
"aorist.DataSchema",
"aorist.CSVHeader",
"aorist.RowStruct",
"aorist.DateString",
"aorist.DatumTemplate"
] | [((3206, 3282), 'aorist.RowStruct', 'RowStruct', ([], {'name': '"""the_racial_covid_data_tracker_datum"""', 'attributes': 'attributes'}), "(name='the_racial_covid_data_tracker_datum', attributes=attributes)\n", (3215, 3282), False, 'from aorist import Attribute, NaturalNumber, StringIdentifier, DateString, POSIXTimesta... |
# ----------------------------------------------------------------------------
# Copyright (c) 2016--, gneiss development team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
# ------------------------------------------------... | [
"skbio.stats.composition.ilr_inv",
"pandas.DataFrame",
"gneiss.balances.balance_basis"
] | [((2433, 2452), 'gneiss.balances.balance_basis', 'balance_basis', (['tree'], {}), '(tree)\n', (2446, 2452), False, 'from gneiss.balances import balance_basis\n'), ((2469, 2502), 'skbio.stats.composition.ilr_inv', 'ilr_inv', (['coef.values'], {'basis': 'basis'}), '(coef.values, basis=basis)\n', (2476, 2502), False, 'fro... |
'''
Solution for day 13 of the 2021 Advent of Code calendar.
Run it with the command `python -m adventofcode run_solution -y 2021 13` from the project root.
'''
import numpy as np
from adventofcode.types import Solution
def part1(data, exit_on_first_fold=False):
rows = [row for row in data.splitlines() if row an... | [
"numpy.flip"
] | [((754, 773), 'numpy.flip', 'np.flip', (['fold[::-1]'], {}), '(fold[::-1])\n', (761, 773), True, 'import numpy as np\n'), ((1173, 1186), 'numpy.flip', 'np.flip', (['fold'], {}), '(fold)\n', (1180, 1186), True, 'import numpy as np\n')] |
"""
Test data scaffolding.
Read: https://docs.djangoproject.com/en/dev/howto/custom-management-commands/
"""
import json
from random import randint
from django.core.management.base import BaseCommand, CommandError
from ensemble.models import (
Classification,
Model,
ModelVersion,
MediaFile,
VideoPre... | [
"json.loads",
"ensemble.models.MediaFile",
"ensemble.models.Classification",
"ensemble.models.Model",
"ensemble.models.ModelVersion",
"random.randint"
] | [((491, 521), 'ensemble.models.Classification', 'Classification', ([], {'name': '"""GUNSHOT"""'}), "(name='GUNSHOT')\n", (505, 521), False, 'from ensemble.models import Classification, Model, ModelVersion, MediaFile, VideoPrediction, AudioPrediction\n'), ((570, 592), 'ensemble.models.Model', 'Model', ([], {'name': '"""... |
import sqlite3 as sql
import pandas as pd
from tabulate import tabulate
connect = sql.connect("rpg_db.sqlite3")
cursor = connect.cursor()
def total_char_count():
""" Total all characters """
print(pd.read_sql_query('''SELECT COUNT(distinct character_id)
FROM charactercreator_character;''', connect))
... | [
"pandas.read_sql_query",
"tabulate.tabulate",
"sqlite3.connect"
] | [((84, 113), 'sqlite3.connect', 'sql.connect', (['"""rpg_db.sqlite3"""'], {}), "('rpg_db.sqlite3')\n", (95, 113), True, 'import sqlite3 as sql\n'), ((208, 328), 'pandas.read_sql_query', 'pd.read_sql_query', (['"""SELECT COUNT(distinct character_id)\n FROM charactercreator_character;"""', 'connect'], {}), '(\n ... |
# encoding=utf-8
from __future__ import print_function
import sys
PYTHON_VERSION = sys.version_info[:2]
if (2, 7) != PYTHON_VERSION < (3, 5):
print("This mycobot version requires Python2.7, 3.5 or later.")
sys.exit(1)
import setuptools
import textwrap
import pymycobot
try:
long_description = (
op... | [
"textwrap.dedent",
"setuptools.find_packages",
"sys.exit"
] | [((215, 226), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (223, 226), False, 'import sys\n'), ((456, 2004), 'textwrap.dedent', 'textwrap.dedent', (['""" # This is Python API for myCobot\n\n This is a python API for serial communication with mycobot and controlling it.\n\n [:
results = {}
for exp_id, proposals in exp_to_proposals.items():
assert len(proposals) >= 1... | [
"pickle.load",
"argparse.ArgumentParser",
"lib.refer.REFER",
"utils.hit_rate_utils.NewHitRateEvaluator"
] | [((1113, 1177), 'lib.refer.REFER', 'REFER', (['"""data/refer"""'], {'dataset': 'args.dataset', 'splitBy': 'args.split_by'}), "('data/refer', dataset=args.dataset, splitBy=args.split_by)\n", (1118, 1177), False, 'from lib.refer import REFER\n'), ((1272, 1333), 'utils.hit_rate_utils.NewHitRateEvaluator', 'NewHitRateEvalu... |