code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# Generated by Django 3.0.4 on 2020-05-01 10:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('web', '0013_auto_20200501_0956'),
]
operations = [
migrations.AlterField(
model_name='pet',
name='gender',
... | [
"django.db.models.IntegerField"
] | [((329, 451), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'choices': "[(None, 'Nepatikslinta'), (1, 'Patinas'), (2, 'Patelė')]", 'null': '(True)', 'verbose_name': '"""Lytis"""'}), "(choices=[(None, 'Nepatikslinta'), (1, 'Patinas'), (2,\n 'Patelė')], null=True, verbose_name='Lytis')\n", (348, 451), ... |
class Timer(object):
'''
Timer decorator to measure function runtime, that provides an API to include custom summary functions
Args:
max_n (int): Maximum number of measurements for that function
additional_summary_functions (list): summary functions that take one argument of type list, tha... | [
"collections.namedtuple",
"functools.wraps",
"time.time"
] | [((722, 773), 'collections.namedtuple', 'namedtuple', (['"""Measurement"""', "['start', 'end', 'time']"], {}), "('Measurement', ['start', 'end', 'time'])\n", (732, 773), False, 'from collections import namedtuple\n'), ((1799, 1810), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (1804, 1810), False, 'from func... |
# Author: <NAME>
# License: BSD
import numpy as np
from seglearn.datasets import load_watch
from seglearn.base import TS_Data
from seglearn import util
def test_util():
df = load_watch()
data = TS_Data(df['X'], df['side'])
Xt, Xc = util.get_ts_data_parts(data)
assert np.array_equal(Xc, df['side'])... | [
"seglearn.base.TS_Data",
"seglearn.util.check_ts_data",
"seglearn.util.ts_stats",
"seglearn.util.get_ts_data_parts",
"seglearn.datasets.load_watch",
"numpy.array_equal"
] | [((182, 194), 'seglearn.datasets.load_watch', 'load_watch', ([], {}), '()\n', (192, 194), False, 'from seglearn.datasets import load_watch\n'), ((207, 235), 'seglearn.base.TS_Data', 'TS_Data', (["df['X']", "df['side']"], {}), "(df['X'], df['side'])\n", (214, 235), False, 'from seglearn.base import TS_Data\n'), ((249, 2... |
import os
from zipfile import ZipFile
def unzip(source_path, destination_dir):
with ZipFile(source_path) as zf:
for member in zf.infolist():
# Path traversal defense copied from
# http://hg.python.org/cpython/file/tip/Lib/http/server.py#l789
words = member.filename.spli... | [
"os.path.splitdrive",
"zipfile.ZipFile",
"os.path.join",
"os.path.split"
] | [((90, 110), 'zipfile.ZipFile', 'ZipFile', (['source_path'], {}), '(source_path)\n', (97, 110), False, 'from zipfile import ZipFile\n'), ((428, 452), 'os.path.splitdrive', 'os.path.splitdrive', (['word'], {}), '(word)\n', (446, 452), False, 'import os\n'), ((482, 501), 'os.path.split', 'os.path.split', (['word'], {}), ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: alameda_api/v1alpha1/datahub/resources/metadata.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import des... | [
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor.EnumValueDescriptor",
"google.protobuf.symbol_database.Default",
"google.protobuf.reflection.GeneratedProtocolMessageType",
"google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper"
] | [((556, 582), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (580, 582), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((2833, 2873), 'google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper', 'enum_type_wrapper.EnumTypeWrapper', (['_KIND'], {})... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
from typing import Any, Dict, Optional
import numpy as np
from synthetic_problems import (
Branin1DEmbedding,
Branin2DBase,
Hartm... | [
"synthetic_problems.Hartmann6DBase",
"numpy.arange",
"numpy.ones",
"synthetic_problems.Branin2DBase"
] | [((1242, 1329), 'synthetic_problems.Branin2DBase', 'Branin2DBase', ([], {'context_name_list': 'context_name_list', 'context_weights': 'context_weights'}), '(context_name_list=context_name_list, context_weights=\n context_weights)\n', (1254, 1329), False, 'from synthetic_problems import Branin1DEmbedding, Branin2DBas... |
import random
import numpy as np
def int_to_bin(number: int, length=8) -> str:
b = bin(number)[2:]
return ('0' * (-len(b) % length)) + b
def bin_to_int(number: str) -> int:
return int(number, base=2)
def random_string(length=8):
return ''.join([chr(random.randint(0, 127)) for _ in range(length)])... | [
"numpy.array",
"random.randint",
"numpy.prod",
"numpy.ravel"
] | [((722, 738), 'numpy.prod', 'np.prod', (['I.shape'], {}), '(I.shape)\n', (729, 738), True, 'import numpy as np\n'), ((2411, 2422), 'numpy.array', 'np.array', (['B'], {}), '(B)\n', (2419, 2422), True, 'import numpy as np\n'), ((2452, 2463), 'numpy.array', 'np.array', (['R'], {}), '(R)\n', (2460, 2463), True, 'import num... |
import os
import jpeg4py as jpeg
import pandas as pd
from sklearn import preprocessing
from torch.utils.data import Dataset
from dataset.transform import image_transform
from config import Config
def img_path_from_id(id):
img_path = os.path.join(Config.DATA_DIR, 'train',
id[0], id[1], ... | [
"pandas.read_csv",
"jpeg4py.JPEG",
"os.path.join",
"sklearn.preprocessing.LabelEncoder"
] | [((239, 311), 'os.path.join', 'os.path.join', (['Config.DATA_DIR', '"""train"""', 'id[0]', 'id[1]', 'id[2]', 'f"""{id}.jpg"""'], {}), "(Config.DATA_DIR, 'train', id[0], id[1], id[2], f'{id}.jpg')\n", (251, 311), False, 'import os\n'), ((435, 463), 'pandas.read_csv', 'pd.read_csv', (['Config.CSV_PATH'], {}), '(Config.CS... |
import os
import sys
import json
from ui_file.changeRoomUI import Ui_Form
from PyQt5.QtWidgets import QWidget, QApplication, QMessageBox
from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal, QCoreApplication
os.environ['Path'] = os.environ['Path'] + ';' + os.path.join(os.getcwd(), 'ffmpeg\\bin') # 加入环境变量
with op... | [
"PyQt5.QtCore.pyqtSignal",
"json.dump",
"json.load",
"os.getcwd",
"showMainWindow.Widget",
"ui_file.changeRoomUI.Ui_Form",
"PyQt5.QtCore.pyqtSlot",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtCore.QCoreApplication.setAttribute",
"PyQt5.QtWidgets.QMessageBox.information"
] | [((359, 371), 'json.load', 'json.load', (['f'], {}), '(f)\n', (368, 371), False, 'import json\n'), ((414, 429), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['str'], {}), '(str)\n', (424, 429), False, 'from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal, QCoreApplication\n'), ((690, 700), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot'... |
#!/usr/bin/env python
"""
Builds a convolutional neural network on the fashion mnist data set.
Designed to show wandb integration with pytorch.
"""
import wandb
import spinup
import gym
import pybullet_envs
hyperparameter_defaults = dict(
coeff = 0.5,
lam1 = 0.93,
lam2 = 0.97,
env_name = 'AntBulle... | [
"spinup.ppo2_tf1",
"wandb.init",
"gym.make"
] | [((367, 477), 'wandb.init', 'wandb.init', ([], {'config': 'hyperparameter_defaults', 'project': '"""generalized-critic"""', 'entity': '"""syrma"""', 'monitor_gym': '(True)'}), "(config=hyperparameter_defaults, project='generalized-critic',\n entity='syrma', monitor_gym=True)\n", (377, 477), False, 'import wandb\n'),... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Nekokatt
# Copyright (c) 2021-present davfsa
#
# 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 t... | [
"tempfile.NamedTemporaryFile",
"mock.patch.object",
"tempfile.TemporaryDirectory",
"hikari.files._FileAsyncReaderContextManagerImpl",
"tests.hikari.hikari_test_helpers.mock_class_namespace",
"pytest.fail",
"pytest.fixture",
"contextlib.ExitStack",
"pytest.mark.asyncio",
"pytest.raises",
"pathlib... | [((1407, 1423), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1421, 1423), False, 'import pytest\n'), ((1999, 2119), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""executor"""', '[concurrent.futures.ThreadPoolExecutor, concurrent.futures.ProcessPoolExecutor]'], {}), "('executor', [concurrent.futur... |
"""Use of Bertran to calculate sparse segments."""
import numpy as np
import chaospy as cp
def sparse_segment(cords):
r"""
Create a segment of a sparse grid.
Convert a ol-index to sparse grid coordinates on ``[0, 1]^N`` hyper-cube.
A sparse grid of order ``D`` coencide with the set of sparse_segments... | [
"numpy.array",
"numpy.prod"
] | [((1165, 1180), 'numpy.array', 'np.array', (['cords'], {}), '(cords)\n', (1173, 1180), True, 'import numpy as np\n'), ((1336, 1359), 'numpy.prod', 'np.prod', (['grid.shape[1:]'], {}), '(grid.shape[1:])\n', (1343, 1359), True, 'import numpy as np\n')] |
import bfs
import fire
# proceed from top-left to bottom right
def run(maze, flammability):
start = (0, 0)
end = (maze.height - 1, maze.width - 1)
# setup the fire
fire.add_fire(maze, flammability)
# calculate the first path
path = []
bfs.bfs(path, maze, start, end)
if len(path) == 0:... | [
"fire.advance_fire_one_step",
"fire.add_fire",
"bfs.bfs"
] | [((182, 215), 'fire.add_fire', 'fire.add_fire', (['maze', 'flammability'], {}), '(maze, flammability)\n', (195, 215), False, 'import fire\n'), ((266, 297), 'bfs.bfs', 'bfs.bfs', (['path', 'maze', 'start', 'end'], {}), '(path, maze, start, end)\n', (273, 297), False, 'import bfs\n'), ((980, 1012), 'fire.advance_fire_one... |
import json
class Settings:
def __init__(self, filename):
"""
:param filename: str, file name for configuration file
"""
with open(filename, 'r') as f:
ret = json.load(f)
f.close()
if ret is None:
raise Exception("Cannot load configuration f... | [
"json.load"
] | [((209, 221), 'json.load', 'json.load', (['f'], {}), '(f)\n', (218, 221), False, 'import json\n')] |
import re
from django import forms
from django.conf import settings
from django.contrib.postgres.forms import SimpleArrayField
from django.core.exceptions import ValidationError
from django.core.validators import RegexValidator, validate_email
from controlpanel.api import validators
from controlpanel.api.cluster impo... | [
"django.core.exceptions.ValidationError",
"controlpanel.api.models.S3Bucket.objects.all",
"django.forms.ChoiceField",
"django.forms.BooleanField",
"django.core.validators.validate_email",
"controlpanel.api.models.User.objects.filter",
"controlpanel.api.models.S3Bucket.objects.none",
"controlpanel.api.... | [((640, 660), 're.compile', 're.compile', (['"""[,; ]+"""'], {}), "('[,; ]+')\n", (650, 660), False, 'import re\n'), ((1001, 1093), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(512)', 'validators': '[validators.validate_github_repository_url]'}), '(max_length=512, validators=[validators.\n vali... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.13 on 2017-06-28 18:27
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('locations', '0003_location_homepage'),
('events', '... | [
"django.db.models.ForeignKey",
"django.db.models.PositiveIntegerField",
"django.db.migrations.AlterModelOptions"
] | [((382, 486), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""eventrsvp"""', 'options': "{'ordering': ('-coming', 'user__username')}"}), "(name='eventrsvp', options={'ordering': (\n '-coming', 'user__username')})\n", (410, 486), False, 'from django.db import migrations, mo... |
#!/bin/env python3
import subprocess
from flask import Flask, request, json, render_template, Response
import time
import hashlib
import psutil
import os
import webbrowser
from decimal import Decimal
#import requests
#import platform
app = Flask(__name__)
SwapFormFile = os.path.join('templates', 'swapform.html')
Sta... | [
"os.path.abspath",
"psutil.Process",
"subprocess.Popen",
"webbrowser.open",
"decimal.Decimal",
"flask.Flask",
"time.sleep",
"flask.render_template",
"flask.json.loads",
"os.path.join"
] | [((241, 256), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (246, 256), False, 'from flask import Flask, request, json, render_template, Response\n'), ((274, 316), 'os.path.join', 'os.path.join', (['"""templates"""', '"""swapform.html"""'], {}), "('templates', 'swapform.html')\n", (286, 316), False, 'impo... |
import random
import sys
size = 3000000
for x in (random.randint(5,5) for x in range(size)):
sys.stdout.write(f"{x} ") | [
"sys.stdout.write",
"random.randint"
] | [((52, 72), 'random.randint', 'random.randint', (['(5)', '(5)'], {}), '(5, 5)\n', (66, 72), False, 'import random\n'), ((99, 124), 'sys.stdout.write', 'sys.stdout.write', (['f"""{x} """'], {}), "(f'{x} ')\n", (115, 124), False, 'import sys\n')] |
#!/usr/bin/python
import argparse, os, time, json
argparser = argparse.ArgumentParser(description='Install a fresh access token, expiring in one hour.')
argparser.add_argument('token')
args = argparser.parse_args()
path = 'config.json'
if not os.path.exists(path):
path = 'config-template.json'
with open(path, ... | [
"json.dump",
"json.load",
"argparse.ArgumentParser",
"os.rename",
"os.path.exists",
"time.time"
] | [((64, 159), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Install a fresh access token, expiring in one hour."""'}), "(description=\n 'Install a fresh access token, expiring in one hour.')\n", (87, 159), False, 'import argparse, os, time, json\n'), ((578, 621), 'os.rename', 'os.rena... |
from traceback import format_exc
from django.core.management.base import BaseCommand
from sitemessage.compat import CommandOption, options_getter
from sitemessage.toolbox import send_scheduled_messages
get_options = options_getter((
CommandOption(
'--priority', action='store', dest='priority', default=N... | [
"traceback.format_exc",
"sitemessage.toolbox.send_scheduled_messages",
"sitemessage.compat.CommandOption"
] | [((241, 413), 'sitemessage.compat.CommandOption', 'CommandOption', (['"""--priority"""'], {'action': '"""store"""', 'dest': '"""priority"""', 'default': 'None', 'help': '"""Allows to filter scheduled messages by a priority number. Defaults to None."""'}), "('--priority', action='store', dest='priority', default=None,\n... |
from django.conf.urls import url
from django.urls import include
from . import views
app_name = 'account'
urlpatterns = [
url(r'^inscription/', views.register, name='register'),
url(r'^connection/', include("django.contrib.auth.urls"), name='login')
]
| [
"django.conf.urls.url",
"django.urls.include"
] | [((129, 182), 'django.conf.urls.url', 'url', (['"""^inscription/"""', 'views.register'], {'name': '"""register"""'}), "('^inscription/', views.register, name='register')\n", (132, 182), False, 'from django.conf.urls import url\n'), ((210, 245), 'django.urls.include', 'include', (['"""django.contrib.auth.urls"""'], {}),... |
import ipinfo
import numpy as np
import re
from rich.console import Console
from rich.table import Column, Table
import sys
import time
IPINFO_TOKEN = "<PASSWORD>_TOKEN"
def parse_line(line: str):
regex = r'[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{3}Z CLOSE host=([a-zA-Z0-9]{0,4}:[a-zA-Z0-9]{... | [
"numpy.median",
"numpy.std",
"numpy.mean",
"rich.console.Console",
"re.search",
"rich.table.Table",
"ipinfo.getHandler"
] | [((515, 552), 're.search', 're.search', (['regex', 'line', 're.IGNORECASE'], {}), '(regex, line, re.IGNORECASE)\n', (524, 552), False, 'import re\n'), ((825, 856), 'ipinfo.getHandler', 'ipinfo.getHandler', (['IPINFO_TOKEN'], {}), '(IPINFO_TOKEN)\n', (842, 856), False, 'import ipinfo\n'), ((2220, 2241), 'numpy.median', ... |
# Generated by Django 3.1.3 on 2020-11-22 13:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0011_catalogue_content'),
]
operations = [
migrations.AlterField(
model_name='catalogue',
name='father',
... | [
"django.db.models.IntegerField"
] | [((335, 376), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'verbose_name': '"""父目录ID"""'}), "(verbose_name='父目录ID')\n", (354, 376), False, 'from django.db import migrations, models\n'), ((500, 538), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'verbose_name': '"""级别"""'}), "(verbose_na... |
import socket
def send_msg(udp_socket):
"""获取键盘数据,并将其发送给对方"""
#1.从键盘输入数据
msg = input("请输入要发送的数据:")
#数度对方的ip地址
dest_ip = input("请输入对方的ip地址:")
#3.输入对方的port
dest_port = int(input("请输入对方的端口号:"))
#4.发送数据
udp_socket.sendto(msg.encode("utf-8"),(dest_ip,dest_port))
def recv_msg(udp_socket)... | [
"socket.socket"
] | [((587, 635), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (600, 635), False, 'import socket\n'), ((1741, 1789), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (1754, 1... |
from more_itertools import powerset
from collections import Counter
def get_latent_powerset(goal):
flat_goal = [y for x, c in zip(range(3), goal[::2]) for y in [x] * c]
flat_partitions = [Counter(x) for x in powerset(flat_goal)]
counts = Counter(flat_goal)
flat_complements = [counts - x for x in flat_... | [
"collections.Counter",
"more_itertools.powerset"
] | [((252, 270), 'collections.Counter', 'Counter', (['flat_goal'], {}), '(flat_goal)\n', (259, 270), False, 'from collections import Counter\n'), ((198, 208), 'collections.Counter', 'Counter', (['x'], {}), '(x)\n', (205, 208), False, 'from collections import Counter\n'), ((218, 237), 'more_itertools.powerset', 'powerset',... |
# coding=utf8
from __future__ import print_function
from django.core.management.base import BaseCommand
from django.contrib.auth.models import User
class Command(BaseCommand):
args = ''
help = 'Clears all emails from user profiles'
def handle(self, *args, **options):
for user in User.objects.al... | [
"django.contrib.auth.models.User.objects.all"
] | [((305, 323), 'django.contrib.auth.models.User.objects.all', 'User.objects.all', ([], {}), '()\n', (321, 323), False, 'from django.contrib.auth.models import User\n')] |
import discord
from discord.ext import commands, tasks
import asyncio
import pandas as pd
from stockcheker2 import Scraper
import numpy as np
import time
def main():
link1 = 'https://www.tokopedia.com/nvidiageforce/etalase/geforce-gtx-16-series'
description = '''
Bot buat ngecek alert stock GPU sekita... | [
"asyncio.sleep",
"pandas.read_csv",
"discord.ext.commands.DefaultHelpCommand",
"time.time",
"stockcheker2.Scraper",
"discord.Game",
"discord.ext.commands.Bot",
"discord.Intents.default"
] | [((556, 612), 'discord.ext.commands.DefaultHelpCommand', 'commands.DefaultHelpCommand', ([], {'no_category': '"""Commands List"""'}), "(no_category='Commands List')\n", (583, 612), False, 'from discord.ext import commands, tasks\n'), ((630, 655), 'discord.Intents.default', 'discord.Intents.default', ([], {}), '()\n', (... |
import pytest
import testinfra
check_output = testinfra.get_host(
'local://'
).check_output
class CommandLineArguments:
def __init__(self, docker_image):
self.docker_image = docker_image
@pytest.fixture()
def host(request):
arguments = _parse_command_line_arguments(request)
image_id = argu... | [
"pytest.fixture",
"testinfra.get_host"
] | [((209, 225), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (223, 225), False, 'import pytest\n'), ((47, 77), 'testinfra.get_host', 'testinfra.get_host', (['"""local://"""'], {}), "('local://')\n", (65, 77), False, 'import testinfra\n'), ((623, 669), 'testinfra.get_host', 'testinfra.get_host', (["('docker://' +... |
# Generated by Django 3.2.5 on 2021-09-15 22:13
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Restaurants', '0001_initial'),
('Menu', '0001_initial'),
]
operations = [
migrations.RemoveField(
... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((295, 352), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""section"""', 'name': '"""menu"""'}), "(model_name='section', name='menu')\n", (317, 352), False, 'from django.db import migrations, models\n'), ((500, 621), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_d... |
from unittest import TestCase
from pythautomata.abstract.finite_automaton import FiniteAutomaton
from pythautomata.automata_definitions.bollig_habermehl_kern_leucker_automata import BolligHabermehlKernLeuckerAutomata
from pythautomata.automata_definitions.omlin_giles_automata import OmlinGilesAutomata
from pythautomat... | [
"pythautomata.automata_definitions.other_automata.OtherAutomata.get_all_automata",
"pythautomata.automata_definitions.bollig_habermehl_kern_leucker_automata.BolligHabermehlKernLeuckerAutomata.get_all_automata",
"pythautomata.automata_definitions.tomitas_grammars_modifications.TomitasGrammarsMods.get_all_automat... | [((829, 882), 'pythautomata.automata_definitions.bollig_habermehl_kern_leucker_automata.BolligHabermehlKernLeuckerAutomata.get_all_automata', 'BolligHabermehlKernLeuckerAutomata.get_all_automata', ([], {}), '()\n', (880, 882), False, 'from pythautomata.automata_definitions.bollig_habermehl_kern_leucker_automata import ... |
import asyncio
from aio_pika import IncomingMessage, Message, ExchangeType, connect_robust
from .util import datasetFromBinary, datasetToBinary
async def async_subscriber(server, queue, methods, dcmhandler, additional_args = []):
loop = asyncio.get_running_loop()
connection = await connect_robust(server, loop=... | [
"aio_pika.connect_robust",
"asyncio.get_child_watcher",
"asyncio.new_event_loop",
"asyncio.get_running_loop"
] | [((242, 268), 'asyncio.get_running_loop', 'asyncio.get_running_loop', ([], {}), '()\n', (266, 268), False, 'import asyncio\n'), ((292, 325), 'aio_pika.connect_robust', 'connect_robust', (['server'], {'loop': 'loop'}), '(server, loop=loop)\n', (306, 325), False, 'from aio_pika import IncomingMessage, Message, ExchangeTy... |
import torch
import torch.nn as nn
import logging
LOG = logging.getLogger(__name__)
class IDMLP(nn.Module):
def __init__(
self,
indim: int,
outdim: int,
hidden_dim: int,
n_hidden: int,
init: str = None,
act: str = None,
rank: int = None,
n_... | [
"torch.nn.ReLU",
"torch.eye",
"logging.basicConfig",
"torch.nn.Sequential",
"torch.nn.Embedding",
"torch.nn.init.xavier_uniform_",
"torch.empty",
"torch.randn",
"pdb.set_trace",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.init.calculate_gain",
"torch.tensor",
"torch.allclose",
"logging.g... | [((58, 85), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (75, 85), False, 'import logging\n'), ((6108, 6232), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s [%(filename)s:%(lineno)d] %(message)s"""', 'level': 'logging.INFO'}), "(format=\n ... |
from os.path import abspath, dirname, join
from setuptools import setup
# Read the README markdown data from README.md
with open(abspath(join(dirname(__file__), 'README.md')), 'rb') as readmeFile:
__readme__ = readmeFile.read().decode('utf-8')
# Read the version number from version.py
with open(abspath(join(dirname(... | [
"os.path.dirname",
"setuptools.setup"
] | [((464, 1497), 'setuptools.setup', 'setup', ([], {'name': '"""dll-diagnostics"""', 'version': '__version__', 'description': '"""Tools for diagnosing DLL dependency loading issues"""', 'long_description': '__readme__', 'long_description_content_type': '"""text/markdown"""', 'classifiers': "['License :: OSI Approved :: M... |
"""
OXASL_OPTPCASL: Widget that displays summary of the scan protocol
Copyright (c) 2019 University of Oxford
"""
import sys
import numpy as np
import wx
import matplotlib
matplotlib.use('WXAgg')
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as FigureCanvas
from matplotlib.figure import Figure
fro... | [
"wx.Bitmap",
"wx.Colour",
"wx.BoxSizer",
"wx.Panel",
"wx.AutoBufferedPaintDC",
"wx.Rect",
"wx.StaticText",
"wx.Button",
"matplotlib.use",
"wx.TextCtrl",
"wx.ClientDC",
"wx.FileDialog",
"wx.TheColourDatabase.Find",
"wx.Font",
"wx.Size",
"wx.MemoryDC"
] | [((175, 198), 'matplotlib.use', 'matplotlib.use', (['"""WXAgg"""'], {}), "('WXAgg')\n", (189, 198), False, 'import matplotlib\n'), ((796, 820), 'wx.BoxSizer', 'wx.BoxSizer', (['wx.VERTICAL'], {}), '(wx.VERTICAL)\n', (807, 820), False, 'import wx\n'), ((984, 998), 'wx.Panel', 'wx.Panel', (['self'], {}), '(self)\n', (992... |
from typing import Union
from lxml import etree
from .v11 import FES11Parser
from .v20 import FES20Parser
def parse(xml: Union[str, etree._Element]):
if isinstance(xml, str):
xml = etree.fromstring(xml)
# decide upon namespace which parser to use
namespace = etree.QName(xml).namespace
if na... | [
"lxml.etree.fromstring",
"lxml.etree.QName"
] | [((197, 218), 'lxml.etree.fromstring', 'etree.fromstring', (['xml'], {}), '(xml)\n', (213, 218), False, 'from lxml import etree\n'), ((284, 300), 'lxml.etree.QName', 'etree.QName', (['xml'], {}), '(xml)\n', (295, 300), False, 'from lxml import etree\n')] |
import numpy as np
from utils.distributions import bernoulli
# ----------------------------------------------------------------------------------------------------------------------
class Recombination(object):
def __init__(self):
pass
def recombination(self, x):
pass
# --------------------... | [
"numpy.random.permutation",
"numpy.arange",
"utils.distributions.bernoulli",
"numpy.clip"
] | [((970, 991), 'numpy.arange', 'np.arange', (['x.shape[0]'], {}), '(x.shape[0])\n', (979, 991), True, 'import numpy as np\n'), ((1107, 1140), 'numpy.random.permutation', 'np.random.permutation', (['x.shape[0]'], {}), '(x.shape[0])\n', (1128, 1140), True, 'import numpy as np\n'), ((1220, 1253), 'numpy.random.permutation'... |
import algorithm_data_formatter as data_formatter
import fileWriteReadParser as file_parser
global timeComplexity
timeComplexity = 0
# create bad match table - how much do i need to shift the search string after a mismatch
# takes in pattern string as input and returns a dictionary of lookup values
def bmtable(patt... | [
"algorithm_data_formatter.get_date_time_now"
] | [((4505, 4539), 'algorithm_data_formatter.get_date_time_now', 'data_formatter.get_date_time_now', ([], {}), '()\n', (4537, 4539), True, 'import algorithm_data_formatter as data_formatter\n')] |
from __future__ import annotations
from typing import Optional
import numpy as np
from .transformation import Transformation
class TransformationWithCovariance(Transformation):
"""Light weight transformation class with added covariance propagation."""
def __init__(self,
*,
tran_w_... | [
"numpy.zeros_like",
"numpy.zeros"
] | [((1403, 1419), 'numpy.zeros', 'np.zeros', (['(6, 6)'], {}), '((6, 6))\n', (1411, 1419), True, 'import numpy as np\n'), ((2260, 2303), 'numpy.zeros_like', 'np.zeros_like', (['*self._C_ba.shape[:-2]', '(6)', '(6)'], {}), '(*self._C_ba.shape[:-2], 6, 6)\n', (2273, 2303), True, 'import numpy as np\n')] |
import click
from chakin.cli import pass_context, json_loads
from chakin.decorators import custom_exception, None_output
@click.command('load_gff')
@click.argument("gff", type=str)
@click.argument("analysis_id", type=int)
@click.argument("organism_id", type=int)
@click.option(
"--landmark_type",
help="Type of... | [
"click.option",
"click.argument",
"click.command"
] | [((124, 149), 'click.command', 'click.command', (['"""load_gff"""'], {}), "('load_gff')\n", (137, 149), False, 'import click\n'), ((151, 182), 'click.argument', 'click.argument', (['"""gff"""'], {'type': 'str'}), "('gff', type=str)\n", (165, 182), False, 'import click\n'), ((184, 223), 'click.argument', 'click.argument... |
# -*- coding:utf-8 -*-
# Copyright (C) 2020. Huawei Technologies Co., Ltd. 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... | [
"vega.report.ReportClient"
] | [((1806, 1820), 'vega.report.ReportClient', 'ReportClient', ([], {}), '()\n', (1818, 1820), False, 'from vega.report import ReportClient\n')] |
from telegram.ext import Updater
import logging
from settings import BOT_TOKEN
from bot.models import database, User
from bot.callbacks import error_callback
from bot.handlers import (
start_handler, admin_handler,
statistics_handler, mailing_conversation_handler,
check_my_username_handler, how_to_use_ha... | [
"bot.models.database.connect",
"logging.basicConfig",
"bot.models.database.create_tables",
"telegram.ext.Updater",
"bot.models.database.close",
"logging.info"
] | [((374, 501), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s – %(levelname)s – %(message)s"""', 'datefmt': '"""%m/%d/%Y %I:%M:%S %p"""', 'level': 'logging.INFO'}), "(format='%(asctime)s – %(levelname)s – %(message)s',\n datefmt='%m/%d/%Y %I:%M:%S %p', level=logging.INFO)\n", (393, 501)... |
"""
Parses the output of OrthoFinder
and creates PAV and CNV matrices.
The gene names are selected as follows:
If an OG contains a reference gene, it
is given as the gene name. If multiple
ref genes exist - take the first. If
no ref genes exist, call it PanGeneX,
where X is a running ID.
PAV and CNV are the same except... | [
"pandas.read_csv",
"pandas.notna"
] | [((710, 775), 'pandas.read_csv', 'pd.read_csv', (['in_orthogroups_tsv'], {'sep': '"""\t"""', 'index_col': '"""Orthogroup"""'}), "(in_orthogroups_tsv, sep='\\t', index_col='Orthogroup')\n", (721, 775), True, 'import pandas as pd\n'), ((574, 597), 'pandas.notna', 'pd.notna', (['row[ref_name]'], {}), '(row[ref_name])\n', ... |
"""
Original code from OSVOS (https://github.com/scaelles/OSVOS-TensorFlow)
<NAME> (<EMAIL>)
Modified code for liver and lesion segmentation:
<NAME> (<EMAIL>)
"""
import os
import sys
import tensorflow as tf
slim = tf.contrib.slim
import numpy as np
import seg_liver as segmentation
from dataset.dataset_seg import Dat... | [
"seg_liver.test",
"os.path.join",
"config.Config",
"dataset.dataset_seg.Dataset"
] | [((622, 671), 'os.path.join', 'os.path.join', (['config.root_folder', '"""LiTS_database"""'], {}), "(config.root_folder, 'LiTS_database')\n", (634, 671), False, 'import os\n'), ((735, 776), 'os.path.join', 'os.path.join', (['logs_path', '"""seg_liver.ckpt"""'], {}), "(logs_path, 'seg_liver.ckpt')\n", (747, 776), False,... |
# <NAME>
# 17CS30033
# The functions are written in the order of the questions and solution to, for example 1a is named as _1a_plot
import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
from copy import copy
import json
# loading training data
try:
train_data = pd.read_csv('train.csv')
excep... | [
"pandas.DataFrame",
"json.dump",
"matplotlib.pyplot.title",
"json.load",
"matplotlib.pyplot.show",
"numpy.sum",
"pandas.read_csv",
"matplotlib.pyplot.scatter",
"numpy.power",
"numpy.zeros",
"numpy.ones",
"copy.copy",
"numpy.array",
"numpy.dot",
"matplotlib.pyplot.ylabel",
"matplotlib.p... | [((290, 314), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (301, 314), True, 'import pandas as pd\n'), ((560, 583), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'], {}), "('test.csv')\n", (571, 583), True, 'import pandas as pd\n'), ((6868, 6882), 'matplotlib.pyplot.subplots', 'p... |
import h5py
from tqdm import tqdm
import librosa
import numpy as np
from keras.utils.np_utils import to_categorical
from sklearn.utils import shuffle
import cv2
import torch
germanBats = {
"Rhinolophus ferrumequinum": 0,
"Rhinolophus hipposideros": 1,
"Myotis daubentonii": 2,
"Myotis brandtii": 3,
... | [
"h5py.File",
"librosa.util.peak_pick",
"numpy.asarray",
"numpy.mean",
"sklearn.utils.shuffle",
"cv2.resize"
] | [((1306, 1334), 'numpy.mean', 'np.mean', (['spectrogram'], {'axis': '(1)'}), '(spectrogram, axis=1)\n', (1313, 1334), True, 'import numpy as np\n'), ((1376, 1473), 'librosa.util.peak_pick', 'librosa.util.peak_pick', (['env'], {'pre_max': '(3)', 'post_max': '(5)', 'pre_avg': '(3)', 'post_avg': '(5)', 'delta': '(0.6)', '... |
from __future__ import absolute_import
from __future__ import unicode_literals
from datetime import timedelta
from django.contrib.auth.models import User
from django.test import TestCase
from corehq.apps.notifications.models import Notification, LastSeenNotification, IllegalModelStateException
from corehq.apps.users.... | [
"corehq.apps.users.models.WebUser",
"corehq.apps.notifications.models.Notification.get_by_user",
"django.contrib.auth.models.User",
"corehq.apps.notifications.models.LastSeenNotification.get_last_seen_notification_date_for_user",
"corehq.apps.notifications.models.Notification.objects.create",
"datetime.ti... | [((420, 507), 'corehq.apps.notifications.models.Notification.objects.create', 'Notification.objects.create', ([], {'content': '"""info1"""', 'url': '"""http://dimagi.com"""', 'type': '"""info"""'}), "(content='info1', url='http://dimagi.com', type=\n 'info')\n", (447, 507), False, 'from corehq.apps.notifications.mod... |
# case12
from spacecapsule.k8s import copy_tar_file_to_namespaced_pod, prepare_api, executor_command_inside_namespaced_pod
from spacecapsule.template import resource_path
def case12():
print('TODO')
def slow_code(namespace, pod, claz, method, inject_code):
print('TODO')
def runtime_err():
print('TODO'... | [
"spacecapsule.k8s.prepare_api",
"spacecapsule.k8s.executor_command_inside_namespaced_pod",
"spacecapsule.template.resource_path"
] | [((469, 493), 'spacecapsule.k8s.prepare_api', 'prepare_api', (['kube_config'], {}), '(kube_config)\n', (480, 493), False, 'from spacecapsule.k8s import copy_tar_file_to_namespaced_pod, prepare_api, executor_command_inside_namespaced_pod\n'), ((715, 755), 'spacecapsule.k8s.executor_command_inside_namespaced_pod', 'execu... |
# 隐马尔可夫模型
# 2020/09/27
import re
import jieba
import numpy as np
def trainParameter(filename):
"""
依据训练文本统计 PI, A, B
:param filename: 训练文本
:return: 模型参数
"""
statusDict = {'B': 0, 'M': 1, 'E': 2, 'S': 3}
# 初始化模型参数
PI = np.zeros(4)
A = np.zeros((4, 4))
B = np.z... | [
"jieba.cut",
"numpy.log",
"numpy.zeros",
"numpy.sum"
] | [((269, 280), 'numpy.zeros', 'np.zeros', (['(4)'], {}), '(4)\n', (277, 280), True, 'import numpy as np\n'), ((290, 306), 'numpy.zeros', 'np.zeros', (['(4, 4)'], {}), '((4, 4))\n', (298, 306), True, 'import numpy as np\n'), ((316, 336), 'numpy.zeros', 'np.zeros', (['(4, 65536)'], {}), '((4, 65536))\n', (324, 336), True,... |
# Keywords for the different sections of the ARFF file
import re
from multiprocessing.pool import Pool
import numpy as np
# Numeric type to use for numeric data
import CNTKDeserializerUtils
import onehot
# The data-type to use for numeric values
DEFAULT_NUMERIC_TYPE = np.float32
# The number of rows to process as ... | [
"CNTKDeserializerUtils.extract_by_index",
"re.match",
"onehot.Encoding",
"multiprocessing.pool.Pool",
"CNTKDeserializerUtils.get_open_func"
] | [((22251, 22281), 're.match', 're.match', (['pattern', 'line', 'flags'], {}), '(pattern, line, flags)\n', (22259, 22281), False, 'import re\n'), ((3584, 3629), 'CNTKDeserializerUtils.get_open_func', 'CNTKDeserializerUtils.get_open_func', (['filename'], {}), '(filename)\n', (3619, 3629), False, 'import CNTKDeserializerU... |
from nagiosplugin.runtime import Runtime, guarded
import logging
import nagiosplugin
import pytest
@pytest.fixture
def fake_check():
class Check(object):
summary_str = 'summary'
verbose_str = 'long output'
name = 'check'
state = nagiosplugin.Ok
exitcode = 0
perfdat... | [
"nagiosplugin.Timeout",
"nagiosplugin.runtime.Runtime"
] | [((524, 533), 'nagiosplugin.runtime.Runtime', 'Runtime', ([], {}), '()\n', (531, 533), False, 'from nagiosplugin.runtime import Runtime, guarded\n'), ((665, 674), 'nagiosplugin.runtime.Runtime', 'Runtime', ([], {}), '()\n', (672, 674), False, 'from nagiosplugin.runtime import Runtime, guarded\n'), ((2211, 2237), 'nagio... |
import shlex
import sys
from os import makedirs
from os.path import dirname, join as pjoin, realpath
from visualqc.freesurfer import cli_run
test_dir = dirname(realpath(__file__))
fs_dir = realpath(pjoin(test_dir, '..', '..', 'example_datasets'))
id_list = pjoin(fs_dir, 'id_list')
# fs_dir = '/data1/strother_lab/p... | [
"visualqc.freesurfer.cli_run",
"os.path.realpath",
"os.path.join",
"os.makedirs"
] | [((261, 285), 'os.path.join', 'pjoin', (['fs_dir', '"""id_list"""'], {}), "(fs_dir, 'id_list')\n", (266, 285), True, 'from os.path import dirname, join as pjoin, realpath\n'), ((477, 502), 'os.path.join', 'pjoin', (['fs_dir', '"""vqc_test"""'], {}), "(fs_dir, 'vqc_test')\n", (482, 502), True, 'from os.path import dirna... |
# tests.color_tests
# Testing the color package in commis.
#
# Author: <NAME> <<EMAIL>>
# Created: Fri Jan 22 16:03:34 2016 -0500
#
# Copyright (C) 2016 B<EMAIL>
# For license information, see LICENSE.txt
#
# ID: color_tests.py [] <EMAIL> $
"""
Testing the color package in commis.
"""
#############################... | [
"colorama.init",
"commis.color.colorize",
"colorama.deinit",
"commis.color.format"
] | [((1910, 1925), 'colorama.init', 'colorama.init', ([], {}), '()\n', (1923, 1925), False, 'import colorama\n'), ((2054, 2071), 'colorama.deinit', 'colorama.deinit', ([], {}), '()\n', (2069, 2071), False, 'import colorama\n'), ((2733, 2768), 'commis.color.colorize', 'color.colorize', (['templ', 'cm'], {}), '(templ, cm, *... |
import bobcat as b
import sys
if __name__ == '__main__':
message = b.BobMessage(sys.argv[1])
if not message.is_valid():
raise Exception("This Message isn't a Valid BobMessage : " + message)
message.send()
| [
"bobcat.BobMessage"
] | [((69, 94), 'bobcat.BobMessage', 'b.BobMessage', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (81, 94), True, 'import bobcat as b\n')] |
import threading
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import models
import cv2
import numpy as np
import matplotlib.pyplot as plt
import math
import random
import tkinter as tk
##### Input trainned model #####
model = keras.models.load_model('mnist_model1.h5')
model2 ... | [
"tkinter.StringVar",
"cv2.GaussianBlur",
"tkinter.Text",
"cv2.erode",
"tkinter.Label",
"cv2.dilate",
"tkinter.Button",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"tkinter.Entry",
"cv2.imwrite",
"numpy.reshape",
"tkinter.Tk",
"cv2.resize",
"cv2.Canny",
"tensorflow.keras.models.load_mod... | [((269, 311), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['"""mnist_model1.h5"""'], {}), "('mnist_model1.h5')\n", (292, 311), False, 'from tensorflow import keras\n'), ((322, 363), 'tensorflow.keras.models.load_model', 'keras.models.load_model', (['"""alpha_model.h5"""'], {}), "('alpha_model.h5')... |
from django import forms
from .models import Hood, Profile, Business, Post, Social_Amenities
from django.contrib.auth.models import User
from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.forms.widgets import TextInput, PasswordInput
class SignUpForm(UserCreationForm):
"""
... | [
"django.forms.widgets.TextInput",
"django.forms.widgets.PasswordInput",
"django.forms.EmailField"
] | [((375, 407), 'django.forms.EmailField', 'forms.EmailField', ([], {'max_length': '(250)'}), '(max_length=250)\n', (391, 407), False, 'from django import forms\n'), ((1079, 1144), 'django.forms.widgets.TextInput', 'TextInput', ([], {'attrs': "{'class': 'validate', 'placeholder': 'Username'}"}), "(attrs={'class': 'valida... |
from django.db import models
from books.models import Book
from django.contrib.auth.models import User
# Playlist
class Playlist(models.Model):
#name = models.CharField(max_length=100)
uri = models.CharField(max_length=150)
user_id = models.ForeignKey(User, on_delete=models.CASCADE)
#description = mod... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.TextField",
"django.db.models.ForeignKey"
] | [((201, 233), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (217, 233), False, 'from django.db import models\n'), ((248, 297), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (... |
from collections import defaultdict
import datetime
import log
from mock import patch
import os
import os.path
import preferences
import process
import psutil
#
# TODO: Fix tests, needs work on Auger's automatic test generator
#
from psutil import Popen
import sys
import unittest
import utils
import versions.v00001.pro... | [
"unittest.main",
"mock.patch.object",
"log.log",
"log.get_log_path"
] | [((525, 554), 'mock.patch.object', 'patch.object', (['os.path', '"""join"""'], {}), "(os.path, 'join')\n", (537, 554), False, 'from mock import patch\n'), ((560, 591), 'mock.patch.object', 'patch.object', (['os.path', '"""exists"""'], {}), "(os.path, 'exists')\n", (572, 591), False, 'from mock import patch\n'), ((1069,... |
import secrets
import time
bit_size = 8192
t0 = time.time()
bits = secrets.randbits(bit_size)
print(bits)
bin_ascii = bin(bits)[2:].zfill(bit_size)
print("Binary String: ", bin_ascii)
print("Binary lenght: ", len(bin_ascii))
num_ones_array = bin_ascii.count('1')
print("Number of 'ones': ", num_ones_array)
print(time... | [
"secrets.randbits",
"secrets.randbelow",
"time.time"
] | [((51, 62), 'time.time', 'time.time', ([], {}), '()\n', (60, 62), False, 'import time\n'), ((70, 96), 'secrets.randbits', 'secrets.randbits', (['bit_size'], {}), '(bit_size)\n', (86, 96), False, 'import secrets\n'), ((372, 383), 'time.time', 'time.time', ([], {}), '()\n', (381, 383), False, 'import time\n'), ((431, 451... |
#!/usr/bin/env python3
"""
Executes a command when postgres is ready, or exits 1 if it's not ready
after the timeout.
Here, "ready" means:
1. We can connect to postgres on $POSTGRES_DSN, and
1. We can run a query (SELECT 1;) for > (success-secs), to accomodate
postgres initialization scripts that restart the DB.
... | [
"logging.error",
"logging.debug",
"logging.basicConfig",
"logging.getLogger",
"time.time",
"time.sleep",
"os.execvp",
"sys.exit",
"psycopg2.connect"
] | [((963, 974), 'time.time', 'time.time', ([], {}), '()\n', (972, 974), False, 'import time\n'), ((1575, 1596), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (1594, 1596), False, 'import logging\n'), ((2289, 2323), 'os.execvp', 'os.execvp', (['args.args[0]', 'args.args'], {}), '(args.args[0], args.args)... |
import os
import re
import argparse
import json
import time
import path_convertor as pc
import pyperclip
import shutil
powershell_path = "/mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe"
explorer_path = "/mnt/c/Windows/explorer.exe"
def search_articles(settings: dict, search_string: str) ->... | [
"json.dump",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.join",
"os.walk",
"os.path.exists",
"os.system",
"time.localtime",
"path_convertor.abs_wsl2win",
"pyperclip.copy",
"path_convertor.abs_win2wsl",
"shutil.copy",
"re.compile"
] | [((498, 542), 'os.walk', 'os.walk', (['(jekyll_home + site_home + post_path)'], {}), '(jekyll_home + site_home + post_path)\n', (505, 542), False, 'import os\n'), ((729, 746), 're.compile', 're.compile', (['regex'], {}), '(regex)\n', (739, 746), False, 'import re\n'), ((1081, 1122), 'argparse.ArgumentParser', 'argparse... |
import collections
from itertools import combinations
def checkIsSum(value, values):
toCheck = combinations(values, 2)
toCheck = [sum(x) for x in toCheck]
return value in toCheck
numbers = []
with open("./9/input.txt") as inputFile:
for line in inputFile:
number = int(line.replace("\n",""))
numbers.append(nu... | [
"itertools.combinations",
"collections.deque"
] | [((343, 385), 'collections.deque', 'collections.deque', (['numbers[:25]'], {'maxlen': '(25)'}), '(numbers[:25], maxlen=25)\n', (360, 385), False, 'import collections\n'), ((97, 120), 'itertools.combinations', 'combinations', (['values', '(2)'], {}), '(values, 2)\n', (109, 120), False, 'from itertools import combination... |
import os
import sys
sys.path.extend((os.path.abspath('..\\packages'), os.getcwd()))
import input_formatter
def main():
input_formatter.main()
if __name__ == '__main__':
main()
| [
"os.getcwd",
"os.path.abspath",
"input_formatter.main"
] | [((127, 149), 'input_formatter.main', 'input_formatter.main', ([], {}), '()\n', (147, 149), False, 'import input_formatter\n'), ((38, 69), 'os.path.abspath', 'os.path.abspath', (['"""..\\\\packages"""'], {}), "('..\\\\packages')\n", (53, 69), False, 'import os\n'), ((71, 82), 'os.getcwd', 'os.getcwd', ([], {}), '()\n',... |
import re
from . import __version__
from bibtexparser import load as load_bib
from bibtexparser.bwriter import BibTexWriter
from bibtexparser.bibdatabase import BibDatabase
import click
_print = print
def print(msg, **kwargs):
if 'file' in kwargs:
_print(msg, **kwargs)
else:
click.secho(s, fg='red')
@click.g... | [
"click.version_option",
"click.option",
"bibtexparser.load",
"click.File",
"click.format_filename",
"bibtexparser.bwriter.BibTexWriter",
"bibtexparser.bibdatabase.BibDatabase",
"click.group",
"click.secho",
"re.compile"
] | [((313, 326), 'click.group', 'click.group', ([], {}), '()\n', (324, 326), False, 'import click\n'), ((328, 369), 'click.version_option', 'click.version_option', ([], {'version': '__version__'}), '(version=__version__)\n', (348, 369), False, 'import click\n'), ((515, 577), 'click.option', 'click.option', (['"""-v/-V"""'... |
import rl
import rl.core
import keras
from keras.layers import *
from keras.models import Model
from keras.models import model_from_json
from keras.utils import CustomObjectScope
import os
import pickle
from .common import *
#---------------------------------------------------
# Rainbow
#--------------------------... | [
"pickle.dump",
"keras.models.Model",
"os.path.isfile",
"pickle.load",
"keras.models.model_from_json"
] | [((4180, 4207), 'keras.models.model_from_json', 'model_from_json', (['model_json'], {}), '(model_json)\n', (4195, 4207), False, 'from keras.models import model_from_json\n'), ((9015, 9031), 'keras.models.Model', 'Model', (['input_', 'c'], {}), '(input_, c)\n', (9020, 9031), False, 'from keras.models import Model\n'), (... |
import torch.nn as nn
import torch.nn.functional as F
configurations = {}
with open("../traffic_management/config/params.cfg", "r+") as config:
for line in config:
key, value = line.split("=")
if key:
configurations[key] = eval(value)
grid_shape = configurations['grid_shape']
num_ancho... | [
"torch.nn.MaxPool2d",
"torch.nn.BatchNorm2d",
"torch.nn.Conv2d",
"torch.nn.Linear"
] | [((738, 784), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', '(64)'], {'kernel_size': '(7, 7)', 'stride': '(2)'}), '(1, 64, kernel_size=(7, 7), stride=2)\n', (747, 784), True, 'import torch.nn as nn\n'), ((820, 838), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['(64)'], {}), '(64)\n', (834, 838), True, 'import torch.nn as nn\... |
from django.contrib import admin
from .models import Product, Brewery
# Register your models here.
class ProductAdmin(admin.ModelAdmin):
list_display = (
'sku',
'name',
'ibu',
'abv',
'brewery',
'price',
'rating',
'image',
)
ordering = ('na... | [
"django.contrib.admin.site.register"
] | [((454, 496), 'django.contrib.admin.site.register', 'admin.site.register', (['Product', 'ProductAdmin'], {}), '(Product, ProductAdmin)\n', (473, 496), False, 'from django.contrib import admin\n'), ((497, 539), 'django.contrib.admin.site.register', 'admin.site.register', (['Brewery', 'BreweryAdmin'], {}), '(Brewery, Bre... |
from unittest import TestCase
from rxtender.rxtender import parse_idl
class ParserStructTestCase(TestCase):
def test_struct(self):
rxt = '''struct Foo {
field1: u32;
field2: i32;
}'''
expected_ast = [{
'stream': None,
'struct': {
... | [
"rxtender.rxtender.parse_idl"
] | [((608, 622), 'rxtender.rxtender.parse_idl', 'parse_idl', (['rxt'], {}), '(rxt)\n', (617, 622), False, 'from rxtender.rxtender import parse_idl\n'), ((1797, 1811), 'rxtender.rxtender.parse_idl', 'parse_idl', (['rxt'], {}), '(rxt)\n', (1806, 1811), False, 'from rxtender.rxtender import parse_idl\n'), ((2003, 2017), 'rxt... |
# Copyright 2021 <NAME>
# SPDX-License-Identifier: Apache-2.0
'colorex numpy'
import numpy as np
from colorex.cex_constants import (
REC_709_LUMA_WEIGHTS,
MAX_COMPONENT_VALUE,
SMALL_COMPONENT_VALUE,
M_RGB_TO_XYZ_T,
M_XYZ_TO_RGB_T,
D50_TO_D65_T,
)
def gamma_correct(values, gamma):
'apply a g... | [
"numpy.stack",
"numpy.power",
"numpy.matmul",
"numpy.clip"
] | [((392, 415), 'numpy.power', 'np.power', (['values', 'gamma'], {}), '(values, gamma)\n', (400, 415), True, 'import numpy as np\n'), ((1184, 1226), 'numpy.power', 'np.power', (['((arr[mask] + 0.055) / 1.055)', '(2.4)'], {}), '((arr[mask] + 0.055) / 1.055, 2.4)\n', (1192, 1226), True, 'import numpy as np\n'), ((1437, 149... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import os
import unittest
import pymel.util.path
from pymel.util.path import path
class TestPath(unittest.TestCase):
def test_misc(self):
thisFile = path(__file__)
self.assert... | [
"pymel.util.path.path"
] | [((285, 299), 'pymel.util.path.path', 'path', (['__file__'], {}), '(__file__)\n', (289, 299), False, 'from pymel.util.path import path\n'), ((1180, 1214), 'pymel.util.path.path', 'path', (['"""slartybartfast_fasdfjlkfjl"""'], {}), "('slartybartfast_fasdfjlkfjl')\n", (1184, 1214), False, 'from pymel.util.path import pat... |
#!/usr/bin/env python
import sys
from cvangysel import argparse_utils, logging_utils, sklearn_utils, trec_utils
from sert import inference, math_utils, models
import argparse
import collections
import io
import logging
import numpy as np
import os
import operator
import pickle
import scipy
import scipy.spatial
impor... | [
"numpy.sum",
"argparse.ArgumentParser",
"collections.defaultdict",
"numpy.argsort",
"pickle.load",
"numpy.linalg.norm",
"logging.error",
"logging.warning",
"cvangysel.trec_utils.write_run",
"cvangysel.sklearn_utils.neighbors_algorithm",
"scipy.spatial.distance.cdist",
"os.path.basename",
"cv... | [((387, 412), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (410, 412), False, 'import argparse\n'), ((1883, 1915), 'cvangysel.trec_utils.parse_topics', 'trec_utils.parse_topics', (['topic_f'], {}), '(topic_f)\n', (1906, 1915), False, 'from cvangysel import argparse_utils, logging_utils, sklea... |
import datetime
from django.core.cache import cache
from common import errors, config
from libs.cache import rds
from social.models import Swiped, Friend
from user.models import User
def recommend_users(user):
"""
筛选符合 user.profile 条件的用户
过滤掉已经被划过的用户
:param user:
:return:
"""
today = date... | [
"django.core.cache.cache.set",
"libs.cache.rds.zrevrange",
"user.models.User.objects.filter",
"common.config.SWIPE_SCORES.get",
"datetime.date.today",
"django.core.cache.cache.get",
"social.models.Swiped.swipe",
"social.models.Friend.objects.make_friends",
"social.models.Swiped.is_liked",
"social.... | [((316, 337), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (335, 337), False, 'import datetime\n'), ((1077, 1120), 'social.models.Swiped.swipe', 'Swiped.swipe', ([], {'uid': 'uid', 'sid': 'sid', 'mark': '"""like"""'}), "(uid=uid, sid=sid, mark='like')\n", (1089, 1120), False, 'from social.models impo... |
import unittest
import roguebot
import pytest
import logging
from roguebot.navigation.path import PathFinder
from abc import ABC, abstractmethod
from roguebot.action import Action, MoveAction, TakeAction
from roguebot.state.state import State
from roguebot.navigation.path_printer import *
from tests.state.dungeon_draw... | [
"assertpy.assert_that",
"roguebot.goals.attack_goal.AttackEntity",
"roguebot.navigation.point.Point",
"roguebot.state.state.State"
] | [((1383, 1390), 'roguebot.state.state.State', 'State', ([], {}), '()\n', (1388, 1390), False, 'from roguebot.state.state import State\n'), ((1756, 1786), 'roguebot.goals.attack_goal.AttackEntity', 'AttackEntity', (['"""fredID"""', '"""fred"""'], {}), "('fredID', 'fred')\n", (1768, 1786), False, 'from roguebot.goals.att... |
import sqlite3
import time
import datetime
con = sqlite3.connect('TP1.db')
c = con.cursor()
numero_subasta = int(raw_input("Numero de subasta: "))
query_hay_subasta = 'SELECT * FROM PUBLICACION p WHERE p.idPublicacion = ' + str(numero_subasta) + " AND p.esSubasta = 1"
if(len(c.execute(query_hay_subasta).fetchall()) ... | [
"sqlite3.connect",
"time.time"
] | [((51, 76), 'sqlite3.connect', 'sqlite3.connect', (['"""TP1.db"""'], {}), "('TP1.db')\n", (66, 76), False, 'import sqlite3\n'), ((1501, 1512), 'time.time', 'time.time', ([], {}), '()\n', (1510, 1512), False, 'import time\n')] |
from random import randint
# Function to create random and unsorted list/array
def createlist(size=5, max=50):
return [randint(0,max) for _ in range(size)]
#Function to a quick sort
def Quicksort(tbsorted):
#return the list as it containly only one value
if len(tbsorted)<=1:
return tbsor... | [
"random.randint"
] | [((128, 143), 'random.randint', 'randint', (['(0)', 'max'], {}), '(0, max)\n', (135, 143), False, 'from random import randint\n')] |
import numpy as np
rslt_binomial_0 = np.array([0, 6.618737, 0.004032037, 0.01433665, 0.01265635,
0.006173346, 0.01067706])
rslt_binomial_1 = np.array([0, 1.029661, 0.02180239, 0.07769613, 0.06756466,
0.03156418, 0.05851878])
rslt_binomial_2 = np.array([0, 0.160... | [
"numpy.array"
] | [((38, 128), 'numpy.array', 'np.array', (['[0, 6.618737, 0.004032037, 0.01433665, 0.01265635, 0.006173346, 0.01067706]'], {}), '([0, 6.618737, 0.004032037, 0.01433665, 0.01265635, 0.006173346, \n 0.01067706])\n', (46, 128), True, 'import numpy as np\n'), ((171, 259), 'numpy.array', 'np.array', (['[0, 1.029661, 0.021... |
from django.urls import path
from rest_framework import routers
from .views import RepositoryAPIView, ApplicationViewSet, BranchAPIView, CommitAPIView
app_name = "applications"
router = routers.DefaultRouter(trailing_slash=False)
router.register(r'apps', ApplicationViewSet, 'apps')
urlpatterns = [
path('apps/<... | [
"rest_framework.routers.DefaultRouter"
] | [((189, 232), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {'trailing_slash': '(False)'}), '(trailing_slash=False)\n', (210, 232), False, 'from rest_framework import routers\n')] |
from django.template import Library
from urlparse import urlparse, urlunparse
from urllib import quote
register = Library()
def add_query_param(url, param):
(key, sep, val) = param.partition('=')
param = '%s=%s' % (key, quote(val))
(scheme, netloc, path, params, query, fragment) = urlparse(url)
if quer... | [
"django.template.Library",
"urlparse.urlparse",
"urlparse.urlunparse",
"urllib.quote"
] | [((114, 123), 'django.template.Library', 'Library', ([], {}), '()\n', (121, 123), False, 'from django.template import Library\n'), ((295, 308), 'urlparse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (303, 308), False, 'from urlparse import urlparse, urlunparse\n'), ((395, 454), 'urlparse.urlunparse', 'urlunparse', ... |
import grpc
import random
from datetime import datetime
from django_grpc_framework.services import Service
from serverapp.models import Penduduk
from serverapp.serializers import PendudukProtoSerializer
class PendudukService(Service):
def Create(self, request, context):
random.seed()
nama = ["Ryan"... | [
"serverapp.serializers.PendudukProtoSerializer",
"random.seed",
"random.randint",
"datetime.datetime.now"
] | [((284, 297), 'random.seed', 'random.seed', ([], {}), '()\n', (295, 297), False, 'import random\n'), ((356, 376), 'random.randint', 'random.randint', (['(0)', '(2)'], {}), '(0, 2)\n', (370, 376), False, 'import random\n'), ((391, 412), 'random.randint', 'random.randint', (['(1)', '(10)'], {}), '(1, 10)\n', (405, 412), ... |
'''Test two-stage segmentation'''
from pathlib import Path
import shutil
import tempfile
import torch
import numpy as np
from PIL import Image
from albumentations.augmentations.functional import center_crop
from torchvision.transforms.functional import to_tensor
from road_roughness_prediction.segmentation.datasets im... | [
"road_roughness_prediction.segmentation.models.load_model",
"road_roughness_prediction.tools.torch.get_device",
"torchvision.transforms.functional.to_tensor",
"torch.cat",
"road_roughness_prediction.segmentation.datasets.surface_types.from_string",
"PIL.Image.open",
"pathlib.Path",
"tempfile.mkdtemp",... | [((718, 758), 'road_roughness_prediction.segmentation.datasets.surface_types.from_string', 'surface_types.from_string', (['category_name'], {}), '(category_name)\n', (743, 758), False, 'from road_roughness_prediction.segmentation.datasets import surface_types\n'), ((769, 813), 'road_roughness_prediction.segmentation.mo... |
import base64
import random
import requests
import secrets
from uploader import AbstractUploader
class Uploader(AbstractUploader):
def upload(self) -> str:
with open(self.path, 'rb') as f:
base64Img = base64.b64encode(f.read()).decode()
r = requests.post(
f'https://new-api.... | [
"random.randint",
"secrets.token_urlsafe"
] | [((346, 370), 'secrets.token_urlsafe', 'secrets.token_urlsafe', (['(6)'], {}), '(6)\n', (367, 370), False, 'import secrets\n'), ((631, 653), 'random.randint', 'random.randint', (['(0)', '(255)'], {}), '(0, 255)\n', (645, 653), False, 'import random\n')] |
import os
import re
import datetime
from pathlib import Path
import pandas as pd
import numpy as np
from seis_utils import progress_message_generator, set_val
from ivms_settings import IVMS_FOLDER, IvmsFileRag, IvmsRag
from ivms_database import IvmsDb
pattern = re.compile(
r'^.*\n.*\n\n.*From\s+'
r'(?P<date1>... | [
"os.stat",
"ivms_settings.IvmsFileRag",
"os.walk",
"pandas.read_excel",
"seis_utils.set_val",
"pathlib.Path",
"ivms_settings.IvmsRag",
"ivms_database.IvmsDb",
"re.compile"
] | [((264, 396), 're.compile', 're.compile', (['"""^.*\\\\n.*\\\\n\\\\n.*From\\\\s+(?P<date1>\\\\d\\\\d/\\\\d\\\\d/\\\\d\\\\d\\\\d\\\\d)\\\\s+To\\\\s+(?P<date2>\\\\d\\\\d/\\\\d\\\\d/\\\\d\\\\d\\\\d\\\\d)"""'], {}), "(\n '^.*\\\\n.*\\\\n\\\\n.*From\\\\s+(?P<date1>\\\\d\\\\d/\\\\d\\\\d/\\\\d\\\\d\\\\d\\\\d)\\\\s+To\\\\s+... |
import logging
from django.conf import settings
from django.contrib import admin
from django.urls import path, include
from dataworkspace.apps.accounts.utils import login_required
from dataworkspace.apps.core.views import (
CreateTableDAGStatusView,
CreateTableDAGTaskStatusView,
RestoreTableDAGTaskStatusV... | [
"dataworkspace.apps.core.views.CreateTableDAGTaskStatusView.as_view",
"django.contrib.admin.autodiscover",
"dataworkspace.apps.core.views.NewsletterSubscriptionView.as_view",
"django.contrib.staticfiles.urls.staticfiles_urlpatterns",
"dataworkspace.apps.core.views.TechnicalSupportView.as_view",
"django.ur... | [((982, 1006), 'logging.getLogger', 'logging.getLogger', (['"""app"""'], {}), "('app')\n", (999, 1006), False, 'import logging\n'), ((1008, 1028), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (1026, 1028), False, 'from django.contrib import admin\n'), ((1090, 1122), 'dataworkspace.apps.a... |
from typing import List
import numpy as np
import pandas as pd
from bohrapi.core import Task
from bohrlabels.core import LabelSet, to_numeric_label
from tqdm import tqdm
from bohrruntime.bohrfs import BohrFileSystem, BohrFsPath
from bohrruntime.core import load_dataset, load_ground_truth_labels
from bohrruntime.data_... | [
"tqdm.tqdm",
"bohrlabels.core.to_numeric_label",
"bohrruntime.labeling.cache.CategoryMappingCache",
"bohrruntime.core.load_ground_truth_labels",
"bohrruntime.core.load_dataset",
"bohrruntime.heuristics.get_heuristic_files",
"pandas.read_pickle",
"bohrruntime.data_analysis.calculate_lf_metrics",
"boh... | [((639, 687), 'bohrruntime.labeling.cache.CategoryMappingCache', 'CategoryMappingCache', (['task.labels'], {'maxsize': '(10000)'}), '(task.labels, maxsize=10000)\n', (659, 687), False, 'from bohrruntime.labeling.cache import CategoryMappingCache, map_numeric_label_value\n'), ((707, 773), 'tqdm.tqdm', 'tqdm', (['task.te... |
import matplotlib.patches as mpatches
from nilearn import plotting, image, datasets
from nilearn.input_data import NiftiSpheresMasker
from nilearn.connectome import ConnectivityMeasure
import numpy as np
import pandas as pd
from common.paths import POWER
POWER_NUM_NODES = 264
POWER_DATASET = datasets.fetch_coords_pow... | [
"nilearn.connectome.ConnectivityMeasure",
"pandas.read_csv",
"nilearn.input_data.NiftiSpheresMasker",
"nilearn.datasets.fetch_coords_power_2011",
"numpy.zeros",
"numpy.triu_indices",
"numpy.array",
"numpy.triu_indices_from",
"matplotlib.patches.Patch",
"numpy.vstack"
] | [((295, 329), 'nilearn.datasets.fetch_coords_power_2011', 'datasets.fetch_coords_power_2011', ([], {}), '()\n', (327, 329), False, 'from nilearn import plotting, image, datasets\n'), ((449, 484), 'pandas.read_csv', 'pd.read_csv', (['POWER'], {'index_col': '"""ROI"""'}), "(POWER, index_col='ROI')\n", (460, 484), True, '... |
import unittest
from utils.channel_access import ChannelAccess
from utils.ioc_launcher import get_default_ioc_dir
from utils.test_modes import TestModes
from utils.testing import get_running_lewis_and_ioc, skip_if_recsim
DEVICE_PREFIX = "KNRK6_01"
DEVICE_NAME = "knrk6"
IOCS = [
{
"name": DEVICE_PREFIX,
... | [
"utils.testing.skip_if_recsim",
"utils.channel_access.ChannelAccess",
"utils.ioc_launcher.get_default_ioc_dir",
"utils.testing.get_running_lewis_and_ioc"
] | [((1331, 1387), 'utils.testing.skip_if_recsim', 'skip_if_recsim', (['"""Unable to use lewis backdoor in RECSIM"""'], {}), "('Unable to use lewis backdoor in RECSIM')\n", (1345, 1387), False, 'from utils.testing import get_running_lewis_and_ioc, skip_if_recsim\n'), ((1623, 1679), 'utils.testing.skip_if_recsim', 'skip_if... |
from __future__ import annotations
from typing import Callable
from prettyqt import constants, core
from prettyqt.qt import QtCore
from prettyqt.utils import InvalidParamError, helpers
QtCore.QTimer.__bases__ = (core.Object,)
class Timer(QtCore.QTimer):
def serialize_fields(self):
return dict(
... | [
"prettyqt.utils.InvalidParamError",
"prettyqt.utils.helpers.parse_time"
] | [((912, 956), 'prettyqt.utils.InvalidParamError', 'InvalidParamError', (['typ', 'constants.TIMER_TYPE'], {}), '(typ, constants.TIMER_TYPE)\n', (929, 956), False, 'from prettyqt.utils import InvalidParamError, helpers\n'), ((1325, 1353), 'prettyqt.utils.helpers.parse_time', 'helpers.parse_time', (['interval'], {}), '(in... |
""" XVM (c) www.modxvm.com 2013-2017 """
#####################################################################
# MOD INFO
XFW_MOD_INFO = {
# mandatory
'VERSION': '0.9.19.0.1',
'URL': 'http://www.modxvm.com/',
'UPDATE_URL': 'http://www.modxvm.com/en/download-xvm/',
'GAME_VERSIONS... | [
"traceback.format_exc",
"xvm_main.python.xvm.l10n"
] | [((1534, 1558), 'xvm_main.python.xvm.l10n', 'l10n', (['"""Hide with honors"""'], {}), "('Hide with honors')\n", (1538, 1558), False, 'from xvm_main.python.xvm import l10n\n'), ((1718, 1733), 'xvm_main.python.xvm.l10n', 'l10n', (['"""Started"""'], {}), "('Started')\n", (1722, 1733), False, 'from xvm_main.python.xvm impo... |
"""
Unit tests for PowerExpansion class
"""
__author__ = '<NAME>'
import unittest
import numpy as np
from scipy.special import sph_harm
import onsager.PowerExpansion as PE
T3D = PE.Taylor3D
T2D = PE.Taylor2D
class PowerExpansionTests(unittest.TestCase):
"""Tests to make sure our power expansions are constructed... | [
"scipy.special.sph_harm",
"numpy.random.uniform",
"numpy.abs",
"numpy.tensordot",
"numpy.allclose",
"numpy.zeros",
"numpy.sin",
"numpy.array",
"numpy.exp",
"numpy.linspace",
"numpy.cos",
"numpy.dot",
"numpy.eye",
"onsager.PowerExpansion.factorial",
"numpy.sqrt"
] | [((20126, 20150), 'numpy.exp', 'np.exp', (['(1.0j * l * theta)'], {}), '(1.0j * l * theta)\n', (20132, 20150), True, 'import numpy as np\n'), ((5139, 5176), 'numpy.array', 'np.array', (['[[-4.2, 2.67], [1.3, 3.21]]'], {}), '([[-4.2, 2.67], [1.3, 3.21]])\n', (5147, 5176), True, 'import numpy as np\n'), ((12788, 12824), ... |
from copy import deepcopy
from dataclasses import dataclass
from typing import List, Iterator, Dict, Any, TypeVar, Union
from dbt.config import RuntimeConfig, Project
from dbt.contracts.graph.model_config import BaseConfig, get_config_for
from dbt.exceptions import InternalException
from dbt.legacy_config_updater impo... | [
"dbt.utils.fqn_search",
"copy.deepcopy",
"dbt.legacy_config_updater.ConfigUpdater",
"typing.TypeVar",
"dbt.contracts.graph.model_config.get_config_for"
] | [((2903, 2933), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': 'BaseConfig'}), "('T', bound=BaseConfig)\n", (2910, 2933), False, 'from typing import List, Iterator, Dict, Any, TypeVar, Union\n'), ((1049, 1095), 'dbt.legacy_config_updater.ConfigUpdater', 'ConfigUpdater', (['active_project.credentials.type'], {}), ... |
#!/usr/bin/python3
import sys
import os
import time
import json
import random
#import subprocess
# For keypress handling:
if os.name == "nt":
import msvcrt
elif os.name == "posix":
import termios
import fcntl
import select
from pprint import pprint
try: # need for development
from irciot import PyLayerIRCIo... | [
"fcntl.fcntl",
"msvcrt.kbhit",
"random.randint",
"PyIRCIoT.udpbrcst.PyLayerUDPb",
"termios.tcgetattr",
"json.loads",
"time.sleep",
"termios.tcsetattr",
"select.select",
"random.seed",
"sys.stdin.fileno",
"sys.stdout.flush",
"sys.exit",
"PyIRCIoT.irciot.PyLayerIRCIoT"
] | [((558, 573), 'PyIRCIoT.irciot.PyLayerIRCIoT', 'PyLayerIRCIoT', ([], {}), '()\n', (571, 573), False, 'from PyIRCIoT.irciot import PyLayerIRCIoT\n'), ((586, 599), 'PyIRCIoT.udpbrcst.PyLayerUDPb', 'PyLayerUDPb', ([], {}), '()\n', (597, 599), False, 'from PyIRCIoT.udpbrcst import PyLayerUDPb\n'), ((689, 702), 'random.seed... |
# -*- coding: utf-8 -*-
"""CLI Output."""
from typing import Callable, Union
from cli_calc.config import Config
from cli_calc.memory import Memory
class Output:
"""
CLI Output.
* Print help
* Print header (type hints like: int, float, hex, ...)
* Print value / result
"""
@staticmethod... | [
"cli_calc.config.Config.get_item"
] | [((1974, 2024), 'cli_calc.config.Config.get_item', 'Config.get_item', (['function', 'Config.Column.Name.name'], {}), '(function, Config.Column.Name.name)\n', (1989, 2024), False, 'from cli_calc.config import Config\n'), ((3744, 3798), 'cli_calc.config.Config.get_item', 'Config.get_item', (['function', 'Config.Column.Fu... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# COPYRIGHT NOTICE STARTS HERE
# Copyright 2019 © Samsung Electronics 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
#
#... | [
"docker.from_env",
"os.remove",
"argparse.ArgumentParser",
"os.makedirs",
"logging.basicConfig",
"os.getcwd",
"timeit.default_timer",
"os.path.isfile",
"sys.exit",
"retrying.retry",
"logging.getLogger"
] | [((935, 962), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (952, 962), False, 'import logging\n'), ((4853, 4902), 'retrying.retry', 'retry', ([], {'stop_max_attempt_number': '(5)', 'wait_fixed': '(5000)'}), '(stop_max_attempt_number=5, wait_fixed=5000)\n', (4858, 4902), False, 'from ret... |
import pytest
from emailclean.requests import request as req
from emailclean.domain import email
@pytest.fixture
def msg_list():
email_2 = email.Email(
uid=2,
sender="Daily Beast: Scouted <<EMAIL>>",
date="Sun, 5 Apr 2020 19:25:56 + 0000(UTC)",
subject="Welcome to Scouted!",
... | [
"emailclean.requests.request.DbRequestObject.build",
"pytest.mark.parametrize",
"emailclean.requests.request.DbGetReqObject.build",
"emailclean.domain.email.Email"
] | [((2344, 2450), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""get_type,expected"""', "[('by_sender', True), ('deleted', True), ('all', True)]"], {}), "('get_type,expected', [('by_sender', True), (\n 'deleted', True), ('all', True)])\n", (2367, 2450), False, 'import pytest\n'), ((144, 351), 'emailclean.... |
#!/usr/bin/env python3
'''
kicad-footprint-generator 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.
kicad-footprint-generator is distribut... | [
"footprint_text_fields.addTextFields",
"os.makedirs",
"argparse.ArgumentParser",
"math.sqrt",
"os.path.isdir",
"yaml.safe_load",
"os.path.join"
] | [((892, 935), 'os.path.join', 'os.path.join', (['sys.path[0]', '""".."""', '""".."""', '""".."""'], {}), "(sys.path[0], '..', '..', '..')\n", (904, 935), False, 'import os\n'), ((1089, 1135), 'os.path.join', 'os.path.join', (['sys.path[0]', '""".."""', '""".."""', '"""tools"""'], {}), "(sys.path[0], '..', '..', 'tools'... |
from app import create_app
# TODO: Implement Caching of the requests for data
application = create_app()
| [
"app.create_app"
] | [((93, 105), 'app.create_app', 'create_app', ([], {}), '()\n', (103, 105), False, 'from app import create_app\n')] |
import pytest
from freezegun import freeze_time
from tests.onegov.election_day.common import login
from tests.onegov.election_day.common import upload_complex_vote
from tests.onegov.election_day.common import upload_vote
from webtest import TestApp as Client
def test_view_vote_redirect(election_day_app):
client =... | [
"tests.onegov.election_day.common.login",
"tests.onegov.election_day.common.upload_vote",
"tests.onegov.election_day.common.upload_complex_vote",
"pytest.mark.parametrize",
"freezegun.freeze_time",
"webtest.TestApp"
] | [((4247, 4519), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""url,"""', "['proposal-by-entities-table', 'counter-proposal-by-entities-table',\n 'proposal-by-districts-table', 'counter-proposal-by-districts-table',\n 'tie-breaker-by-entities-table', 'tie-breaker-by-districts-table',\n 'vote-header... |
import unittest
import duckdb
import pandas as pd
from pandas.testing import assert_frame_equal
from sqlglot.executor import execute
from tests.helpers import load_sql_fixture_pairs, FIXTURES_DIR, TPCH_SCHEMA
class TestExecutor(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.conn = duckdb.... | [
"tests.helpers.load_sql_fixture_pairs",
"pandas.testing.assert_frame_equal",
"sqlglot.executor.execute",
"duckdb.connect"
] | [((313, 329), 'duckdb.connect', 'duckdb.connect', ([], {}), '()\n', (327, 329), False, 'import duckdb\n'), ((646, 697), 'tests.helpers.load_sql_fixture_pairs', 'load_sql_fixture_pairs', (['"""optimizer/tpc-h/tpc-h.sql"""'], {}), "('optimizer/tpc-h/tpc-h.sql')\n", (668, 697), False, 'from tests.helpers import load_sql_f... |
#!/usr/bin/env python
from setuptools import setup, find_packages
VERSION = '1.6.4'
setup(
name='hspy',
version=VERSION,
author='prior',
author_email='<EMAIL>',
packages=find_packages(),
include_package_data=True,
url='https://github.com/HubSpot/hspy',
download_url='https://github.com/... | [
"setuptools.find_packages"
] | [((192, 207), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (205, 207), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding: utf-8 -*-
"""
author: <NAME>
"""
import numpy as np
import imageio
class MNISTImageReader():
"""
brief: read image data from .idx3-ubyte file as numpy array
use cases:
# case 1
with MNISTImageReader('t10k-images.idx3-ubyte') as reader:
# the reader was designed as... | [
"numpy.frombuffer"
] | [((2822, 2867), 'numpy.frombuffer', 'np.frombuffer', (['raw_image_data'], {'dtype': 'np.uint8'}), '(raw_image_data, dtype=np.uint8)\n', (2835, 2867), True, 'import numpy as np\n'), ((6043, 6088), 'numpy.frombuffer', 'np.frombuffer', (['raw_label_data'], {'dtype': 'np.uint8'}), '(raw_label_data, dtype=np.uint8)\n', (605... |
"""forager_backend URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/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')
Cla... | [
"django.urls.path"
] | [((760, 791), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (764, 791), False, 'from django.urls import path\n'), ((797, 865), 'django.urls.path', 'path', (['"""api/start_cluster"""', 'views.start_cluster'], {'name': '"""start_cluster"""'}), "('api/start_cluster... |