code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import unittest
import havok
class TestSectionHeaders(unittest.TestCase):
def test_it_can_decompile_the_classname_section_header(self):
""" @test it can decompile the classname section header
Given the file G-6-2.hksc
When the file is passed to the SectionHeader class
Then the sec... | [
"havok.SectionHeaderTables",
"havok.SectionHeader"
] | [((502, 529), 'havok.SectionHeader', 'havok.SectionHeader', (['infile'], {}), '(infile)\n', (521, 529), False, 'import havok\n'), ((1141, 1168), 'havok.SectionHeader', 'havok.SectionHeader', (['infile'], {}), '(infile)\n', (1160, 1168), False, 'import havok\n'), ((1204, 1231), 'havok.SectionHeader', 'havok.SectionHeade... |
from __future__ import absolute_import
from django.views.decorators.csrf import csrf_exempt
from sentry.api.base import Endpoint
from sentry.integrations.pipeline import ensure_integration
from sentry.tasks.integrations import sync_metadata
from .integration import JiraIntegrationProvider
class JiraInstalledEndpo... | [
"sentry.integrations.pipeline.ensure_integration"
] | [((712, 744), 'sentry.integrations.pipeline.ensure_integration', 'ensure_integration', (['"""jira"""', 'data'], {}), "('jira', data)\n", (730, 744), False, 'from sentry.integrations.pipeline import ensure_integration\n')] |
#Load packages
import numpy as np
import pandas as pd
import torch
from tqdm.auto import tqdm
import pytorch_lightning as pl
from transformers import AutoTokenizer, AutoModel
#Import package for aspect sentiment prediction
import aspect_based_sentiment_analysis as absa
#Load the ABSA sentiment model
nlp = absa.load()... | [
"pandas.DataFrame",
"torch.nn.BCELoss",
"numpy.argmax",
"transformers.AutoModel.from_pretrained",
"transformers.AutoTokenizer.from_pretrained",
"torch.sigmoid",
"numpy.where",
"aspect_based_sentiment_analysis.load",
"numpy.array",
"torch.nn.Linear"
] | [((309, 320), 'aspect_based_sentiment_analysis.load', 'absa.load', ([], {}), '()\n', (318, 320), True, 'import aspect_based_sentiment_analysis as absa\n'), ((482, 554), 'transformers.AutoTokenizer.from_pretrained', 'AutoTokenizer.from_pretrained', (['"""vinai/bertweet-base"""'], {'normalization': '(True)'}), "('vinai/b... |
from functools import wraps
from time import perf_counter
def timer(func):
"""Print the runtime of the decorated function"""
@wraps(func)
def wrapper_timer(*args, **kwargs):
start_time = perf_counter()
value = func(*args, **kwargs)
end_time = perf_counter()
run_time = end_... | [
"time.perf_counter",
"functools.wraps"
] | [((137, 148), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (142, 148), False, 'from functools import wraps\n'), ((210, 224), 'time.perf_counter', 'perf_counter', ([], {}), '()\n', (222, 224), False, 'from time import perf_counter\n'), ((282, 296), 'time.perf_counter', 'perf_counter', ([], {}), '()\n', (294, ... |
from config import config
#########################################################
# flask imports
from flask import Flask, Response, render_template, request, redirect, send_from_directory
#########################################################
#########################################################
# flask soc... | [
"json.dumps",
"os.path.join",
"flask.request.get_json",
"serverutils.utils.SafeLimitedUniqueQueueList",
"traceback.print_exc",
"random.randint",
"json.loads",
"flask_socketio.emit",
"flask.render_template",
"cbuild.book.get_zobrist_key_hex",
"flask.send_from_directory",
"chess.Move.from_uci",
... | [((2051, 2093), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '"""/static"""'}), "(__name__, static_url_path='/static')\n", (2056, 2093), False, 'from flask import Flask, Response, render_template, request, redirect, send_from_directory\n'), ((2356, 2369), 'flask_socketio.SocketIO', 'SocketIO', (['app'], {... |
# 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 builtins import __test_source
from enum import Enum
class CustomEnum(Enum):
TRACKED_FIELD = "A"
UNTRACKED_field = "B"
untra... | [
"builtins.__test_source"
] | [((405, 420), 'builtins.__test_source', '__test_source', ([], {}), '()\n', (418, 420), False, 'from builtins import __test_source\n'), ((534, 549), 'builtins.__test_source', '__test_source', ([], {}), '()\n', (547, 549), False, 'from builtins import __test_source\n'), ((665, 680), 'builtins.__test_source', '__test_sour... |
import sublime, sublime_plugin
import traceback, os, json, io, sys, imp,shlex, tempfile
class evaluate_javascriptCommand(manage_cliCommand):
isNode = True
alsoNonProject = True
def prepare_command(self, **kwargs):
is_line = kwargs.get("is_line") if "is_line" in kwargs else False
view = self.window.ac... | [
"tempfile.NamedTemporaryFile",
"sublime.platform",
"sublime.Region",
"json.dumps",
"shlex.quote"
] | [((1215, 1256), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {'delete': '(False)'}), '(delete=False)\n', (1242, 1256), False, 'import traceback, os, json, io, sys, imp, shlex, tempfile\n'), ((1434, 1452), 'sublime.platform', 'sublime.platform', ([], {}), '()\n', (1450, 1452), False, 'import sublim... |
__all__ = ['memoize3']
from collections.abc import Callable
from typing import TypeVar, Union
from weakref import WeakKeyDictionary
A1 = TypeVar('A1')
A2 = TypeVar('A2')
A3 = TypeVar('A3')
R = TypeVar('R')
class _UndefinedType:
...
_undefined = _UndefinedType()
def memoize3(fn: Callable[[A1, A2, A3], R]) ->... | [
"typing.TypeVar",
"weakref.WeakKeyDictionary"
] | [((139, 152), 'typing.TypeVar', 'TypeVar', (['"""A1"""'], {}), "('A1')\n", (146, 152), False, 'from typing import TypeVar, Union\n'), ((158, 171), 'typing.TypeVar', 'TypeVar', (['"""A2"""'], {}), "('A2')\n", (165, 171), False, 'from typing import TypeVar, Union\n'), ((177, 190), 'typing.TypeVar', 'TypeVar', (['"""A3"""... |
import asyncio
from typing import Union
import discord
from discord.ext import commands
from discord_slash import ComponentContext, SlashContext
from discord_slash.model import ButtonStyle
from discord_slash.utils.manage_components import (
create_actionrow,
create_button,
wait_for_component,
)
class Aut... | [
"discord_slash.utils.manage_components.create_actionrow",
"discord_slash.utils.manage_components.wait_for_component"
] | [((2223, 2258), 'discord_slash.utils.manage_components.create_actionrow', 'create_actionrow', (['*buttons_no_front'], {}), '(*buttons_no_front)\n', (2239, 2258), False, 'from discord_slash.utils.manage_components import create_actionrow, create_button, wait_for_component\n'), ((2338, 2372), 'discord_slash.utils.manage_... |
import tempfile
from django.http import HttpResponse
from django.utils.translation import ugettext as _
from django.views.generic import View
from reportlab.lib.pagesizes import A4
from reportlab.lib.styles import ParagraphStyle, StyleSheet1
from reportlab.lib.units import mm
from reportlab.platypus import (
BaseD... | [
"tempfile.NamedTemporaryFile",
"django.http.HttpResponse",
"reportlab.platypus.Paragraph",
"reportlab.platypus.BaseDocTemplate",
"reportlab.lib.styles.ParagraphStyle",
"reportlab.platypus.Frame",
"django.utils.translation.ugettext",
"reportlab.lib.styles.StyleSheet1"
] | [((1462, 1522), 'reportlab.platypus.Paragraph', 'Paragraph', (['self.submission.title'], {'style': "self.styles['Title']"}), "(self.submission.title, style=self.styles['Title'])\n", (1471, 1522), False, 'from reportlab.platypus import BaseDocTemplate, Flowable, Frame, PageTemplate, Paragraph\n'), ((4619, 4632), 'report... |
# Define here the models for your scraped items
#
# See documentation in:
# https://docs.scrapy.org/en/latest/topics/items.html
import scrapy
from scrapy.loader.processors import Join, MapCompose, TakeFirst
from w3lib.html import remove_tags
def remove_whitspaces(value):
return value.strip()
class ZenaCrawlerIte... | [
"scrapy.loader.processors.MapCompose",
"scrapy.loader.processors.TakeFirst",
"scrapy.Field"
] | [((400, 414), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (412, 414), False, 'import scrapy\n'), ((430, 444), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (442, 444), False, 'import scrapy\n'), ((494, 536), 'scrapy.loader.processors.MapCompose', 'MapCompose', (['remove_tags', 'remove_whitspaces'], {}), '(rem... |
import typing
import sys
import numpy as np
import numba as nb
@nb.njit((nb.i8[:, :], ), cache=True)
def solve(ab: np.ndarray) -> typing.NoReturn:
n = len(ab)
a, b = ab[:, 0], ab[:, 1]
a.sort()
b.sort()
if n & 1:
s = b[n >> 1] - a[n >> 1] + 1
else:
hi = b[n >> 1] + b[(n >> 1) - 1]
lo = a[n ... | [
"numba.njit",
"sys.stdin.read"
] | [((69, 104), 'numba.njit', 'nb.njit', (['(nb.i8[:, :],)'], {'cache': '(True)'}), '((nb.i8[:, :],), cache=True)\n', (76, 104), True, 'import numba as nb\n'), ((448, 464), 'sys.stdin.read', 'sys.stdin.read', ([], {}), '()\n', (462, 464), False, 'import sys\n')] |
import torch
from torch import nn
from torch.nn import functional as F
class BatchNorm2d(nn.Module):
"""
Fixed version of BatchNorm2d, which has only the scale and bias
"""
def __init__(self, out):
super(BatchNorm2d, self).__init__()
self.register_buffer("scale", torch.ones(out))
... | [
"torch.ones",
"torch.nn.functional.conv2d",
"torch.cat",
"torch.exp",
"torch.clamp",
"torch.max",
"torch.zeros",
"torch.min",
"torch.nn.functional.pad"
] | [((2784, 2829), 'torch.clamp', 'torch.clamp', (['(right_bottom - left_top)'], {'min': '(0.0)'}), '(right_bottom - left_top, min=0.0)\n', (2795, 2829), False, 'import torch\n'), ((3197, 3240), 'torch.max', 'torch.max', (['boxes0[..., :2]', 'boxes1[..., :2]'], {}), '(boxes0[..., :2], boxes1[..., :2])\n', (3206, 3240), Fa... |
from textgenrnn import textgenrnn
textgen = textgenrnn('/home/amazonec2/hacker_news.hdf5')
def text_to_stego(ciphertext_to_steg):
stegotext = textgen.generate(interactive=True, temperature=0.2, top_n=2, ciphertext=ciphertext_to_steg)
print(stegotext)
return stegotext
text_to_stego(b'rnaodmdomeodshit')
| [
"textgenrnn.textgenrnn"
] | [((45, 91), 'textgenrnn.textgenrnn', 'textgenrnn', (['"""/home/amazonec2/hacker_news.hdf5"""'], {}), "('/home/amazonec2/hacker_news.hdf5')\n", (55, 91), False, 'from textgenrnn import textgenrnn\n')] |
# encoding: utf-8
import os
import numpy as np
from histolab.slide import Slide
from histolab.tiler import GridTiler, RandomTiler, ScoreTiler
from histolab.scorer import NucleiScorer
from ..fixtures import SVS
from ..util import load_expectation
class DescribeRandomTiler:
def it_locates_tiles_on_the_slide(sel... | [
"histolab.tiler.RandomTiler",
"numpy.asarray",
"histolab.tiler.GridTiler",
"os.path.join",
"histolab.scorer.NucleiScorer"
] | [((482, 569), 'histolab.tiler.RandomTiler', 'RandomTiler', ([], {'tile_size': '(512, 512)', 'n_tiles': '(2)', 'level': '(0)', 'seed': '(42)', 'check_tissue': '(False)'}), '(tile_size=(512, 512), n_tiles=2, level=0, seed=42, check_tissue\n =False)\n', (493, 569), False, 'from histolab.tiler import GridTiler, RandomTi... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: google/devtools/resultstore/v2/upload_metadata.proto
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflec... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.reflection.GeneratedProtocolMessageType",
"google.protobuf.descriptor.FileDescriptor"
] | [((451, 477), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (475, 477), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((495, 1243), 'google.protobuf.descriptor.FileDescriptor', '_descriptor.FileDescriptor', ([], {'name': '"""google/devtools/result... |
from flask import Blueprint, render_template
from flask_jwt_extended import jwt_required
from IFSensor.views.view_controller import view_controller
views = Blueprint('views', __name__)
@views.route('/')
@jwt_required(optional=True, locations=["headers", "cookies"])
def home():
return render_template('home.html', ... | [
"flask_jwt_extended.jwt_required",
"flask.Blueprint",
"flask.render_template"
] | [((157, 185), 'flask.Blueprint', 'Blueprint', (['"""views"""', '__name__'], {}), "('views', __name__)\n", (166, 185), False, 'from flask import Blueprint, render_template\n'), ((206, 267), 'flask_jwt_extended.jwt_required', 'jwt_required', ([], {'optional': '(True)', 'locations': "['headers', 'cookies']"}), "(optional=... |
import numpy
import cupy
from cupy import core
def place(arr, mask, vals):
"""Change elements of an array based on conditional and input values.
This function uses the first N elements of `vals`, where N is the number
of true values in `mask`.
Args:
arr (cupy.ndarray): Array to put data int... | [
"numpy.cumprod",
"cupy.isscalar",
"cupy.asarray",
"cupy.core.ElementwiseKernel",
"numpy.can_cast",
"numpy.diff",
"cupy.arange",
"cupy.diff"
] | [((2253, 2411), 'cupy.core.ElementwiseKernel', 'core.ElementwiseKernel', (['"""Q mask, raw S values, uint64 len_vals"""', '"""T out"""', '"""\n if (mask) out = (T) values[i % len_vals];\n """', '"""putmask_kernel"""'], {}), '(\'Q mask, raw S values, uint64 len_vals\', \'T out\',\n """\n if (mask) out = (T) ... |
from skimage.segmentation import slic
from skimage.util import img_as_float
from skimage import io
import datetime
from PIL import Image
import numpy as np
imgname="taili"
image = img_as_float(io.imread(imgname+".png"))
print(datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')+" Start.")
for numSegments ... | [
"skimage.segmentation.slic",
"datetime.datetime.now",
"numpy.array",
"skimage.io.imread"
] | [((202, 229), 'skimage.io.imread', 'io.imread', (["(imgname + '.png')"], {}), "(imgname + '.png')\n", (211, 229), False, 'from skimage import io\n'), ((461, 523), 'skimage.segmentation.slic', 'slic', (['image'], {'n_segments': 'numSegments', 'sigma': 'sig', 'compactness': 'cp'}), '(image, n_segments=numSegments, sigma=... |
# coding: utf-8
import copy
from functools import reduce
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from flearn.common.strategy import AVG
from flearn.common.trainer import Trainer
class AVGTrainer(Trainer):
def __init__(self, model, optimizer, criterion, device, displ... | [
"numpy.diag",
"numpy.divide",
"torch.nn.MSELoss",
"numpy.sum",
"torch.nn.KLDivLoss",
"numpy.square",
"torch.FloatTensor",
"torch.nn.functional.softmax",
"numpy.linalg.svd",
"numpy.reshape",
"torch.nn.functional.log_softmax",
"functools.reduce",
"model.ModelFedCon",
"torch.tensor"
] | [((6475, 6527), 'model.ModelFedCon', 'ModelFedCon', (['"""simple-cnn"""'], {'out_dim': '(256)', 'n_classes': '(10)'}), "('simple-cnn', out_dim=256, n_classes=10)\n", (6486, 6527), False, 'from model import ModelFedCon\n'), ((6657, 6697), 'numpy.linalg.svd', 'np.linalg.svd', (['fc_m'], {'full_matrices': '(False)'}), '(f... |
import logging as log
from common.config import MILVUS_TABLE, OUT_PATH, OUT_DATA
from indexer.index import milvus_client, search_vectors, get_vector_by_ids
from indexer.tools import connect_mysql, search_by_milvus_id
import numpy as np
import torch
import pickle
import dgl
import json
import random
def get_list_info(... | [
"indexer.index.search_vectors",
"indexer.index.get_vector_by_ids",
"json.loads"
] | [((896, 929), 'json.loads', 'json.loads', (['info[1]'], {'strict': '(False)'}), '(info[1], strict=False)\n', (906, 929), False, 'import json\n'), ((1200, 1254), 'indexer.index.get_vector_by_ids', 'get_vector_by_ids', (['index_client', 'table_name', 'search_id'], {}), '(index_client, table_name, search_id)\n', (1217, 12... |
from .celery import app as celery_app
import pymysql
__all__ = ('celery_app',)
pymysql.install_as_MySQLdb()
| [
"pymysql.install_as_MySQLdb"
] | [((81, 109), 'pymysql.install_as_MySQLdb', 'pymysql.install_as_MySQLdb', ([], {}), '()\n', (107, 109), False, 'import pymysql\n')] |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2020 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at https://trac.edgewall.org/wiki/TracLicense.
#
# This software cons... | [
"trac.util.backup_config_file"
] | [((1222, 1265), 'trac.util.backup_config_file', 'backup_config_file', (['env', '""".tracopt-svn.bak"""'], {}), "(env, '.tracopt-svn.bak')\n", (1240, 1265), False, 'from trac.util import backup_config_file\n')] |
#!/usr/bin/env python3
from aws_cdk import core
from spotzero.spotzero_stack import SpotZeroStack
app = core.App()
SpotZeroStack(app, "SpotZero")
app.synth()
| [
"aws_cdk.core.App",
"spotzero.spotzero_stack.SpotZeroStack"
] | [((108, 118), 'aws_cdk.core.App', 'core.App', ([], {}), '()\n', (116, 118), False, 'from aws_cdk import core\n'), ((119, 149), 'spotzero.spotzero_stack.SpotZeroStack', 'SpotZeroStack', (['app', '"""SpotZero"""'], {}), "(app, 'SpotZero')\n", (132, 149), False, 'from spotzero.spotzero_stack import SpotZeroStack\n')] |
"""BlueprintEntity class"""
from typing import Any
from homeassistant.helpers.entity import Entity, DeviceInfo
from .data_coordinator import DataCoordinator
from .const import ATTRIBUTION, DOMAIN, NAME, VERSION
class PhonieboxEntity(Entity):
coordinator: DataCoordinator
def __init__(self, config_entry, coo... | [
"homeassistant.helpers.entity.DeviceInfo"
] | [((718, 866), 'homeassistant.helpers.entity.DeviceInfo', 'DeviceInfo', ([], {'identifiers': '{(DOMAIN, self.config_entry.entry_id)}', 'name': 'NAME', 'model': 'VERSION', 'manufacturer': 'NAME', 'sw_version': 'self.coordinator.version'}), '(identifiers={(DOMAIN, self.config_entry.entry_id)}, name=NAME,\n model=VERSIO... |
from collections import defaultdict
from django.db.models import Exists, OuterRef
from ...channel.models import Channel
from ...order.models import Order
from ...shipping.models import ShippingZone
from ..checkout.dataloaders import CheckoutByIdLoader, CheckoutLineByIdLoader
from ..core.dataloaders import DataLoader
... | [
"collections.defaultdict",
"django.db.models.OuterRef",
"django.db.models.Exists"
] | [((2971, 2988), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2982, 2988), False, 'from collections import defaultdict\n'), ((2497, 2511), 'django.db.models.OuterRef', 'OuterRef', (['"""pk"""'], {}), "('pk')\n", (2505, 2511), False, 'from django.db.models import Exists, OuterRef\n'), ((2568, 25... |
# -*- coding: utf-8 -*-
#%% NumPyの読み込み
import numpy as np
# SciPyのstatsモジュールの読み込み
import scipy.stats as st
# Pandasの読み込み
import pandas as pd
# PyMCの読み込み
import pymc3 as pm
# MatplotlibのPyplotモジュールの読み込み
import matplotlib.pyplot as plt
# tqdmからプログレスバーの関数を読み込む
from tqdm import trange
# 日本語フォントの設定
from matplotl... | [
"sys.platform.startswith",
"numpy.random.seed",
"scipy.stats.norm.rvs",
"numpy.empty",
"scipy.stats.invgamma.rvs",
"numpy.mean",
"scipy.stats.invgamma.pdf",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"matplotlib.font_manager.FontProperties",
"numpy.std",
"numpy.linspace",
"matplot... | [((372, 402), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (395, 402), False, 'import sys\n'), ((734, 764), 'matplotlib.font_manager.FontProperties', 'FontProperties', ([], {'fname': 'FontPath'}), '(fname=FontPath)\n', (748, 764), False, 'from matplotlib.font_manager import Fo... |
import torch
import torch.nn as nn
import torch.optim
from torch.autograd import Variable
from FrEIA.framework import *
from FrEIA.modules import *
# From FrEIA
from FrEIA.framework import InputNode, OutputNode, Node, ReversibleGraphNet, ConditionNode
from FrEIA.modules import GLOWCouplingBlock, PermuteRandom
import ... | [
"torch.optim.lr_scheduler.StepLR",
"torch.nn.ReLU",
"FrEIA.framework.InputNode",
"FrEIA.framework.ConditionNode",
"FrEIA.framework.OutputNode",
"torch.randn",
"torch.optim.Adam",
"torch.nn.Linear",
"FrEIA.framework.Node",
"FrEIA.framework.ReversibleGraphNet"
] | [((549, 572), 'FrEIA.framework.ConditionNode', 'ConditionNode', (['c.ndim_y'], {}), '(c.ndim_y)\n', (562, 572), False, 'from FrEIA.framework import InputNode, OutputNode, Node, ReversibleGraphNet, ConditionNode\n'), ((1135, 1175), 'FrEIA.framework.ReversibleGraphNet', 'ReversibleGraphNet', (['nodes'], {'verbose': '(Fal... |
"""
@file
@brief Various function about programs such as guessing the language of a code
"""
import re
def guess_language_code(code):
"""
Guess the language of a piece of code.
The result can be: js, xml, html, cpp, py, sql, vba, css
@param code code
@return type of la... | [
"re.compile"
] | [((811, 852), 're.compile', 're.compile', (['"""[^a-z]([a-z]{2,8})[^a-z0-9]"""'], {}), "('[^a-z]([a-z]{2,8})[^a-z0-9]')\n", (821, 852), False, 'import re\n'), ((864, 898), 're.compile', 're.compile', (['"""(</?[a-z]{2,8}( |>))"""'], {}), "('(</?[a-z]{2,8}( |>))')\n", (874, 898), False, 'import re\n'), ((2018, 2037), 'r... |
from __future__ import division, print_function, absolute_import
# noinspection PyUnresolvedReferences
from six.moves import range
from scipy.stats import rv_discrete
import numpy as np
__all__ = ['nonuniform', 'gibbs']
# noinspection PyMethodOverriding,PyPep8Naming
class nonuniform_gen(rv_discrete):
"""A nonun... | [
"numpy.sum",
"six.moves.range",
"numpy.asarray",
"numpy.zeros",
"numpy.finfo",
"numpy.exp",
"numpy.random.rand"
] | [((1104, 1120), 'numpy.random.rand', 'np.random.rand', ([], {}), '()\n', (1118, 1120), True, 'import numpy as np\n'), ((1211, 1247), 'numpy.zeros', 'np.zeros', (['self._size'], {'dtype': 'np.int32'}), '(self._size, dtype=np.int32)\n', (1219, 1247), True, 'import numpy as np\n'), ((2589, 2602), 'numpy.exp', 'np.exp', ([... |
# Copyright (c) 2012-2020 Esri R&D Center Zurich
# 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... | [
"pyprt.initialize_prt",
"pyprt.shutdown_prt",
"unittest.TestLoader",
"unittest.TestSuite"
] | [((1252, 1273), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (1271, 1273), False, 'import unittest\n'), ((1287, 1307), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (1305, 1307), False, 'import unittest\n'), ((935, 957), 'pyprt.initialize_prt', 'pyprt.initialize_prt', ([], {}), '()\n'... |
import warnings
warnings.filterwarnings('ignore')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import networkx as nx
def calc_mean_std(x):
return (np.mean(x), np.std(x, ddof=1) / np.sqrt(len(x)))
def color_func(p):
if p > 0.2:
return 'dodgerblue'
elif p < 0.05:
re... | [
"pandas.read_csv",
"numpy.mean",
"numpy.std",
"warnings.filterwarnings"
] | [((16, 49), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (39, 49), False, 'import warnings\n'), ((553, 574), 'pandas.read_csv', 'pd.read_csv', (['filename'], {}), '(filename)\n', (564, 574), True, 'import pandas as pd\n'), ((1402, 1423), 'pandas.read_csv', 'pd.read_csv',... |
from collections import OrderedDict
import pandas as pd
import numpy as np
from tia.analysis.model.interface import (
TxnColumns as TC,
MarketDataColumns as MC,
PlColumns as PL,
TxnPlColumns as TPL,
)
from tia.analysis.perf import periods_in_year, guess_freq
from tia.util.decorator import lazy_propert... | [
"pandas.DataFrame",
"tia.analysis.perf.guess_freq",
"tia.util.decorator.lazy_property",
"numpy.isscalar",
"pandas.expanding_max",
"pandas.rolling_sum",
"pandas.DatetimeIndex",
"tia.util.fmt.new_dynamic_formatter",
"tia.util.mplot.AxesFormat",
"numpy.array",
"pandas.DataFrame.from_records",
"co... | [((16498, 16567), 'tia.util.decorator.lazy_property', 'lazy_property', (['(lambda self: self.txn_details.weekly)', '"""weekly_details"""'], {}), "(lambda self: self.txn_details.weekly, 'weekly_details')\n", (16511, 16567), False, 'from tia.util.decorator import lazy_property\n'), ((16871, 16942), 'tia.util.decorator.la... |
# -*- encoding: utf-8 -*-
"""
@Author : zYx.Tom
@Contact : <EMAIL>
@site : https://zhuyuanxiang.github.io
---------------------------
@Software : PyCharm
@Project : Dive-into-Deep-Learning
@File : sec0202.py
@Version : v0.1
@Time : 2020-12-27 9:25
@License : (C)... | [
"d2lzh.load_data_fashion_mnist",
"tools.show_figures",
"tools.beep_end",
"mxnet.gluon.nn.Dense",
"mxnet.gluon.nn.MaxPool2D",
"mxnet.gluon.nn.Conv2D",
"tools.show_subtitle",
"mxnet.gluon.nn.Activation",
"mxnet.gluon.nn.GlobalAvgPool2D",
"mxnet.gluon.nn.Sequential",
"mxnet.gluon.nn.BatchNorm",
"... | [((825, 840), 'mxnet.gluon.nn.Sequential', 'nn.Sequential', ([], {}), '()\n', (838, 840), False, 'from mxnet.gluon import data as gdata, loss as gloss, nn\n'), ((1295, 1348), 'mxnet.nd.random.uniform', 'nd.random.uniform', ([], {'shape': '(1, 1, data_size, data_size)'}), '(shape=(1, 1, data_size, data_size))\n', (1312,... |
from seedwork.infrastructure.repository import InMemoryRepository
from seedwork.domain.entities import Entity
class Person(Entity):
first_name: str
last_name: str
def test_InMemoryRepository_persist_one():
# arrange
person = Person(first_name="John", last_name="Doe")
repository = InMemoryReposit... | [
"seedwork.infrastructure.repository.InMemoryRepository"
] | [((305, 325), 'seedwork.infrastructure.repository.InMemoryRepository', 'InMemoryRepository', ([], {}), '()\n', (323, 325), False, 'from seedwork.infrastructure.repository import InMemoryRepository\n'), ((624, 644), 'seedwork.infrastructure.repository.InMemoryRepository', 'InMemoryRepository', ([], {}), '()\n', (642, 64... |
import argparse
import time
import torch
import wandb
from torch import nn
from torch.autograd import profiler
from torch.nn import CrossEntropyLoss
from torch.nn.utils import prune
from torch.optim import SGD
from torch.optim.lr_scheduler import CosineAnnealingLR
from torchvision.models import resnet50
from tqdm impo... | [
"wandb.log",
"torch.cuda.synchronize",
"argparse.ArgumentParser",
"torch.autograd.profiler.record_function",
"torch.randn",
"torch.device",
"simplify.utils.get_bn_folding",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"torch.nn.utils.prune.ln_structured",
"torch.zeros",
"torch.randint",
"torc... | [((1252, 1263), 'simplify.utils.set_seed', 'set_seed', (['(0)'], {}), '(0)\n', (1260, 1263), False, 'from simplify.utils import set_seed\n'), ((1277, 1297), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (1289, 1297), False, 'import torch\n'), ((1590, 1642), 'torch.optim.lr_scheduler.CosineAnnealin... |
#
# Author: <NAME>
# Copyright 2015-present, NASA-JPL/Caltech
#
import os
import logging
import isceobj
from isceobj.Alos2Proc.runSwathMosaic import swathMosaic
from isceobj.Alos2Proc.runSwathMosaic import swathMosaicParameters
from isceobj.Alos2Proc.Alos2ProcPublic import create_xml
logger = logging.getLogger('isce... | [
"os.makedirs",
"isceobj.Alos2Proc.runSwathMosaic.swathMosaic",
"isceobj.Catalog.createCatalog",
"os.path.isfile",
"isceobj.Alos2Proc.Alos2ProcPublic.create_xml",
"isceobj.createImage",
"isceobj.Alos2Proc.runSwathMosaic.swathMosaicParameters",
"os.path.join",
"os.chdir",
"logging.getLogger"
] | [((297, 353), 'logging.getLogger', 'logging.getLogger', (['"""isce.alos2burstinsar.runSwathMosaic"""'], {}), "('isce.alos2burstinsar.runSwathMosaic')\n", (314, 353), False, 'import logging\n'), ((427, 482), 'isceobj.Catalog.createCatalog', 'isceobj.Catalog.createCatalog', (['self._insar.procDoc.name'], {}), '(self._ins... |
import argparse
import json
import sys
def convert(input_json, prefix):
for source_file in input_json.get('source_files', []):
source_file['name'] = prefix + source_file.get('name', '')
parser = argparse.ArgumentParser(
description="Add a prefix path to all CodeClimate coverage files")
parser.add_ar... | [
"json.load",
"argparse.ArgumentParser",
"json.dumps",
"argparse.FileType"
] | [((211, 306), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Add a prefix path to all CodeClimate coverage files"""'}), "(description=\n 'Add a prefix path to all CodeClimate coverage files')\n", (234, 306), False, 'import argparse\n'), ((547, 575), 'json.load', 'json.load', (['args.C... |
import os
import unittest
import tempfile
from django.conf import settings
from django.db import connection, models
from south.db import db
from south.logger import close_logger
class TestLogger(unittest.TestCase):
"""
Tests if the logging is working reasonably. Some tests ignored if you don't
have writ... | [
"south.logger.close_logger",
"os.remove",
"django.db.models.BooleanField",
"tempfile.mkstemp"
] | [((1610, 1624), 'south.logger.close_logger', 'close_logger', ([], {}), '()\n', (1622, 1624), False, 'from south.logger import close_logger\n'), ((430, 467), 'tempfile.mkstemp', 'tempfile.mkstemp', ([], {'suffix': '""".south.log"""'}), "(suffix='.south.log')\n", (446, 467), False, 'import tempfile\n'), ((1650, 1675), 'o... |
# -*- coding: utf-8 -*-
import re
import codecs
import jieba
import pickle
import string
import warnings
import logging
from argparse import ArgumentParser, RawDescriptionHelpFormatter
from gensim import corpora, models
"""
todo lda主题模型
"""
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(l... | [
"pickle.dump",
"logging.debug",
"codecs.open",
"argparse.ArgumentParser",
"logging.basicConfig",
"warnings.filterwarnings",
"jieba.cut",
"gensim.models.TfidfModel",
"gensim.corpora.Dictionary",
"re.escape",
"gensim.models.LdaModel",
"pickle.load",
"logging.getLogger"
] | [((243, 363), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(lineno)d: %(message)s"""'}), "(level=logging.DEBUG, format=\n '%(asctime)s - %(name)s - %(levelname)s - %(lineno)d: %(message)s')\n", (262, 363), False, 'import logging... |
#!/usr/bin/env python3
# Copyright 2019 The Kapitan Authors
# SPDX-FileCopyrightText: 2020 The Kapitan Authors <<EMAIL>>
#
# SPDX-License-Identifier: Apache-2.0
"jinja2 tests"
import base64
import unittest
import tempfile
import time
from kapitan.utils import render_jinja2_file
from kapitan.resources import inventor... | [
"tempfile.NamedTemporaryFile",
"kapitan.inputs.jinja2_filters.base64_encode",
"kapitan.utils.render_jinja2_file",
"kapitan.refs.base.RefController",
"time.strftime",
"tempfile.mkdtemp",
"base64.b64encode",
"collections.namedtuple",
"kapitan.resources.inventory",
"kapitan.refs.base64.Base64Ref",
... | [((622, 651), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (649, 651), False, 'import tempfile\n'), ((995, 1024), 'tempfile.NamedTemporaryFile', 'tempfile.NamedTemporaryFile', ([], {}), '()\n', (1022, 1024), False, 'import tempfile\n'), ((1327, 1356), 'tempfile.NamedTemporaryFile', 't... |
import numpy as np
import os
import warnings
warnings.filterwarnings("ignore", category=FutureWarning)
import sys
stderr = sys.stderr
sys.stderr = open(os.devnull, 'w')
from keras.models import Sequential, load_model
from keras.layers import LSTM, Dropout, TimeDistributed, Dense, Activation, Embedding
sys.stderr = stde... | [
"keras.layers.Activation",
"warnings.filterwarnings",
"keras.layers.LSTM",
"keras.layers.Dropout",
"numpy.zeros",
"keras.layers.Dense",
"numpy.random.randint",
"keras.layers.Embedding",
"keras.models.Sequential"
] | [((45, 102), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ignore', category=FutureWarning)\n", (68, 102), False, 'import warnings\n'), ((464, 476), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (474, 476), False, 'from keras.models import Seque... |
import bs4
import lxml
import discord
from urllib.request import urlopen, Request
import urllib
import json
import requests
import random
class Search:
def get_video_link(self, titleli):
return
def search_image(self, titleli):
title = ''
for i in titleli:
title = tit... | [
"urllib.request.Request",
"discord.Embed",
"urllib.request.urlopen",
"urllib.parse.quote",
"bs4.BeautifulSoup"
] | [((356, 381), 'urllib.parse.quote', 'urllib.parse.quote', (['title'], {}), '(title)\n', (374, 381), False, 'import urllib\n'), ((699, 724), 'urllib.request.Request', 'Request', (['url'], {'headers': 'hdr'}), '(url, headers=hdr)\n', (706, 724), False, 'from urllib.request import urlopen, Request\n'), ((740, 767), 'urlli... |
"""
An implementation of a logging.Handler for sending messages to Discord
"""
import datetime
import logging
from discord import Color, Embed
from discord.ext import commands
from bot.constants import LOGGING_CHANNEL_ID
LEVEL_COLORS = {
logging.CRITICAL: Color.red(),
logging.ERROR: Color.red(),
logging... | [
"discord.Color.blurple",
"datetime.datetime.utcnow",
"discord.Color.red",
"discord.Color.gold"
] | [((264, 275), 'discord.Color.red', 'Color.red', ([], {}), '()\n', (273, 275), False, 'from discord import Color, Embed\n'), ((296, 307), 'discord.Color.red', 'Color.red', ([], {}), '()\n', (305, 307), False, 'from discord import Color, Embed\n'), ((330, 342), 'discord.Color.gold', 'Color.gold', ([], {}), '()\n', (340, ... |
import urx
import logging
import time
if __name__ == "__main__":
logging.basicConfig(level=logging.WARN)
# home_pos = [0.0755, -0.2824, 0.3477, -0.0387, -3.0754, 0.4400] # rest position (good to place/remove gripper)
rob = urx.Robot("192.168.56.1")
#rob = urx.Robot("localhost")
rob.set_tcp((0,0,... | [
"urx.Robot",
"logging.basicConfig",
"time.sleep"
] | [((71, 110), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.WARN'}), '(level=logging.WARN)\n', (90, 110), False, 'import logging\n'), ((239, 264), 'urx.Robot', 'urx.Robot', (['"""192.168.56.1"""'], {}), "('192.168.56.1')\n", (248, 264), False, 'import urx\n'), ((773, 786), 'time.sleep', 'time.sle... |
#!/usr/bin/env python
"""
Module implementing an XYZ file object class.
"""
from __future__ import division
__author__ = "<NAME>"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__date__ = "Apr 17, 2012"
import re
from pymatgen.core.struct... | [
"pymatgen.core.structure.Molecule",
"re.compile"
] | [((1430, 1504), 're.compile', 're.compile', (['"""(\\\\w+)\\\\s+([0-9\\\\-\\\\.]+)\\\\s+([0-9\\\\-\\\\.]+)\\\\s+([0-9\\\\-\\\\.]+)"""'], {}), "('(\\\\w+)\\\\s+([0-9\\\\-\\\\.]+)\\\\s+([0-9\\\\-\\\\.]+)\\\\s+([0-9\\\\-\\\\.]+)')\n", (1440, 1504), False, 'import re\n'), ((1738, 1758), 'pymatgen.core.structure.Molecule', ... |
# Created by <NAME>
# Date: 13/03/2020
from gym.envs.registration import register
register(
id='Dummy-v0',
entry_point='gym_dummy.envs:DummyEnv',
# timestep_limit=1000,
)
register(
id='Walker2D-v0',
entry_point='gym_dummy.envs:Walker2DEnv',
) | [
"gym.envs.registration.register"
] | [((85, 147), 'gym.envs.registration.register', 'register', ([], {'id': '"""Dummy-v0"""', 'entry_point': '"""gym_dummy.envs:DummyEnv"""'}), "(id='Dummy-v0', entry_point='gym_dummy.envs:DummyEnv')\n", (93, 147), False, 'from gym.envs.registration import register\n'), ((187, 255), 'gym.envs.registration.register', 'regist... |
from setuptools import setup
setup(name='gym_qubit',
version='0.0.1',
install_requires=['gym>=0.10.5',
'qutip>=4.3.1',
'scipy>=1.0.1',
'numpy>=1.14.5']
)
| [
"setuptools.setup"
] | [((30, 157), 'setuptools.setup', 'setup', ([], {'name': '"""gym_qubit"""', 'version': '"""0.0.1"""', 'install_requires': "['gym>=0.10.5', 'qutip>=4.3.1', 'scipy>=1.0.1', 'numpy>=1.14.5']"}), "(name='gym_qubit', version='0.0.1', install_requires=['gym>=0.10.5',\n 'qutip>=4.3.1', 'scipy>=1.0.1', 'numpy>=1.14.5'])\n", ... |
import os
from atve.script import AtveTestCase
from runner import TestAtveTestRunner as TSTR
from nose.tools import with_setup, raises, ok_, eq_
class TestAndroidTestRuner(TSTR):
@with_setup(TSTR.setup, TSTR.teardown)
def test_library_execute_android_success_01(self):
self.script_path = os.path.join(s... | [
"atve.script.AtveTestCase.set",
"os.path.join",
"nose.tools.with_setup"
] | [((186, 223), 'nose.tools.with_setup', 'with_setup', (['TSTR.setup', 'TSTR.teardown'], {}), '(TSTR.setup, TSTR.teardown)\n', (196, 223), False, 'from nose.tools import with_setup, raises, ok_, eq_\n'), ((413, 450), 'nose.tools.with_setup', 'with_setup', (['TSTR.setup', 'TSTR.teardown'], {}), '(TSTR.setup, TSTR.teardown... |
import os
import random
import numpy as np
import cv2
from keras.utils import Sequence
# This vvvvv is for example_preprocess function and augs
# from albumentations import (
# HorizontalFlip, VerticalFlip, Flip, Transpose, Rotate, ShiftScaleRotate, RandomScale,
# RandomBrightness, RandomContrast, Rando... | [
"random.shuffle",
"numpy.empty",
"os.path.join",
"os.listdir",
"cv2.resize"
] | [((2673, 2700), 'random.shuffle', 'random.shuffle', (['self._files'], {}), '(self._files)\n', (2687, 2700), False, 'import random\n'), ((3604, 3711), 'numpy.empty', 'np.empty', (['(self._batch_size, self._in_shape[h], self._in_shape[w], self._in_shape[c])'], {'dtype': '"""float32"""'}), "((self._batch_size, self._in_sh... |
import unittest
from src.countingValleys.countingValleys import counting_valleys;
class TestCountingValleys(unittest.TestCase):
def test_large_valley(self):
self.assertEqual(counting_valleys("UDDDUDUU"), 1)
| [
"src.countingValleys.countingValleys.counting_valleys"
] | [((189, 217), 'src.countingValleys.countingValleys.counting_valleys', 'counting_valleys', (['"""UDDDUDUU"""'], {}), "('UDDDUDUU')\n", (205, 217), False, 'from src.countingValleys.countingValleys import counting_valleys\n')] |
# Copyright (c) 2021 Cisco Systems, Inc. and its affiliates
# All rights reserved.
# Use of this source code is governed by a BSD 3-Clause License
# that can be found in the LICENSE file.
from typing import Any, Dict
import contextlib
import json
import logging
import os
from pathlib import Path
import sqlite3
from t... | [
"swagger_server.errors.StreamDoesNotExist",
"json.loads",
"logging.warning",
"swagger_server.models.Status",
"swagger_server.errors.SubjectNotInStream",
"logging.info",
"pathlib.Path",
"sqlite3.connect",
"swagger_server.encoder.JSONEncoder"
] | [((1350, 1374), 'sqlite3.connect', 'sqlite3.connect', (['db_path'], {}), '(db_path)\n', (1365, 1374), False, 'import sqlite3\n'), ((1648, 1681), 'logging.info', 'logging.info', (['"""Creating database"""'], {}), "('Creating database')\n", (1660, 1681), False, 'import logging\n'), ((1520, 1556), 'logging.warning', 'logg... |
import pytest
from manubot.cite.pubmed import (
get_pmcid_and_pmid_for_doi,
get_pmid_for_doi,
get_pubmed_ids_for_doi,
)
@pytest.mark.parametrize(
("doi", "pmid"),
[
("10.1098/rsif.2017.0387", "29618526"), # in PubMed and PMC
("10.1161/CIRCGENETICS.115.001181", "27094199"), # in ... | [
"manubot.cite.pubmed.get_pubmed_ids_for_doi",
"pytest.mark.parametrize",
"manubot.cite.pubmed.get_pmcid_and_pmid_for_doi",
"manubot.cite.pubmed.get_pmid_for_doi"
] | [((136, 332), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["('doi', 'pmid')", "[('10.1098/rsif.2017.0387', '29618526'), ('10.1161/CIRCGENETICS.115.001181',\n '27094199'), ('10.7717/peerj-cs.134', None), ('10.1161/CIRC', None)]"], {}), "(('doi', 'pmid'), [('10.1098/rsif.2017.0387',\n '29618526'), ('10.1... |
from unittest import TestCase, main, skip
from aocfw import TestCaseMixin
from p2 import Solution
class SolutionTests(TestCase, TestCaseMixin):
solution = Solution
source = "sample.txt"
given = 168
def test_triangular_numbers(self):
self.assertEqual(Solution().get_triangular_number(3), 6)
... | [
"unittest.main",
"p2.Solution"
] | [((996, 1002), 'unittest.main', 'main', ([], {}), '()\n', (1000, 1002), False, 'from unittest import TestCase, main, skip\n'), ((736, 746), 'p2.Solution', 'Solution', ([], {}), '()\n', (744, 746), False, 'from p2 import Solution\n'), ((894, 904), 'p2.Solution', 'Solution', ([], {}), '()\n', (902, 904), False, 'from p2 ... |
from mlagents.torch_utils import torch
from unittest import mock
import pytest
from mlagents.trainers.torch.encoders import (
VectorInput,
Normalizer,
SimpleVisualEncoder,
ResNetVisualEncoder,
NatureVisualEncoder,
)
# This test will also reveal issues with states not being saved in the state_dict... | [
"mlagents.trainers.torch.encoders.Normalizer",
"mlagents.trainers.torch.encoders.VectorInput",
"unittest.mock.Mock",
"mlagents.torch_utils.torch.ones",
"unittest.mock.patch",
"mlagents.torch_utils.torch.equal",
"mlagents.torch_utils.torch.tensor",
"pytest.mark.parametrize",
"pytest.approx"
] | [((1407, 1464), 'unittest.mock.patch', 'mock.patch', (['"""mlagents.trainers.torch.encoders.Normalizer"""'], {}), "('mlagents.trainers.torch.encoders.Normalizer')\n", (1417, 1464), False, 'from unittest import mock\n'), ((2273, 2358), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""image_size"""', '[(36, 36... |
import os
import re
from maya import cmds, mel
import pymel.core as pm
import pyblish.api
import pype.api
from pype.hosts.maya import lib
class ValidateRenderSettings(pyblish.api.InstancePlugin):
"""Validates the global render settings
* File Name Prefix must start with: `maya/<Scene>`
all other to... | [
"pype.hosts.maya.lib.RENDER_ATTRS.get",
"maya.cmds.getAttr",
"pype.hosts.maya.lib.get_attr_in_layer",
"maya.cmds.setAttr",
"pype.hosts.maya.lib.renderlayer",
"re.search",
"re.compile"
] | [((2417, 2467), 're.compile', 're.compile', (['"""%a|<aov>|<renderpass>"""', 're.IGNORECASE'], {}), "('%a|<aov>|<renderpass>', re.IGNORECASE)\n", (2427, 2467), False, 'import re\n'), ((2498, 2551), 're.compile', 're.compile', (['"""%l|<layer>|<renderlayer>"""', 're.IGNORECASE'], {}), "('%l|<layer>|<renderlayer>', re.IG... |
"""https://github.com/kujason/scene_vis"""
import os
import numpy as np
import vtk
class VtkImage:
"""Image
"""
def __init__(self):
self.vtk_actor = vtk.vtkImageActor()
# Need to keep reference to the image
self.image = None
self.vtk_image_data = None
def _save_im... | [
"vtk.vtkPNGReader",
"numpy.copy",
"vtk.vtkImageActor",
"os.path.splitext",
"vtk.vtkImageImport",
"numpy.ascontiguousarray"
] | [((175, 194), 'vtk.vtkImageActor', 'vtk.vtkImageActor', ([], {}), '()\n', (192, 194), False, 'import vtk\n'), ((738, 781), 'numpy.ascontiguousarray', 'np.ascontiguousarray', (['image'], {'dtype': 'np.uint8'}), '(image, dtype=np.uint8)\n', (758, 781), True, 'import numpy as np\n'), ((882, 902), 'vtk.vtkImageImport', 'vt... |
from rest_framework import serializers
from .models import *
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = fields = ['first_name', 'last_name', 'username', 'passport']
class AirlineSerializer(serializers.ModelSerializer):
class Meta:
model = A... | [
"rest_framework.serializers.CharField"
] | [((969, 1033), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'source': '"""get_race_display"""', 'read_only': '(True)'}), "(source='get_race_display', read_only=True)\n", (990, 1033), False, 'from rest_framework import serializers\n')] |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import sys
sys.path.append("../../exos/LG/")
import csv
from Array import Array
from ftfy import fix_text
"""
@:param path : The path of the csv file to turn into an array
@:param sep : The separator to use for spliting the csv row data
@:return : Return an a... | [
"sys.path.append",
"csv.DictReader",
"Array.Array",
"csv.reader"
] | [((57, 90), 'sys.path.append', 'sys.path.append', (['"""../../exos/LG/"""'], {}), "('../../exos/LG/')\n", (72, 90), False, 'import sys\n'), ((971, 994), 'csv.DictReader', 'csv.DictReader', (['csvFile'], {}), '(csvFile)\n', (985, 994), False, 'import csv\n'), ((1015, 1053), 'csv.DictReader', 'csv.DictReader', (['csvFile... |
#!/usr/bin/env python
'''
Plot degree values for a given set of nodes in a simple circle plot.
'''
import numpy as np
import matplotlib.pyplot as plt
import mne
from jumeg import get_jumeg_path
from jumeg.connectivity import plot_degree_circle
import bct
orig_labels_fname = get_jumeg_path() + '/data/desikan_label_... | [
"jumeg.get_jumeg_path",
"numpy.load",
"mne.connectivity.degree",
"jumeg.connectivity.plot_degree_circle"
] | [((480, 498), 'numpy.load', 'np.load', (['con_fname'], {}), '(con_fname)\n', (487, 498), True, 'import numpy as np\n'), ((574, 623), 'mne.connectivity.degree', 'mne.connectivity.degree', (['con_'], {'threshold_prop': '(0.2)'}), '(con_, threshold_prop=0.2)\n', (597, 623), False, 'import mne\n'), ((635, 693), 'jumeg.conn... |
import os
import time
run_properties_file = open("run.properties", "r")
exec(run_properties_file.read())
run_properties_file.close()
time_delay_each_frame = time_delay_each_frame
shell_keyword_to_clear = shell_keyword_to_clear
while True:
input_data = input("Enter filename: ")
if(os.path.exists(input_data)):... | [
"os.path.exists",
"os.system",
"time.sleep"
] | [((292, 318), 'os.path.exists', 'os.path.exists', (['input_data'], {}), '(input_data)\n', (306, 318), False, 'import os\n'), ((1170, 1203), 'time.sleep', 'time.sleep', (['time_delay_each_frame'], {}), '(time_delay_each_frame)\n', (1180, 1203), False, 'import time\n'), ((1206, 1239), 'os.system', 'os.system', (['shell_k... |
# coding=utf-8
"""
Ingest data from the command-line.
"""
from __future__ import absolute_import
import logging
import os
import uuid
from pathlib import Path
from xml.etree import ElementTree
import click
import rasterio.features
import shapely.affinity
import shapely.geometry
import shapely.ops
import yaml
from osg... | [
"xml.etree.ElementTree.parse",
"uuid.uuid4",
"logging.basicConfig",
"click.command",
"logging.info",
"pathlib.Path",
"yaml.safe_dump_all",
"click.Path",
"os.path.join",
"os.listdir",
"osgeo.osr.SpatialReference"
] | [((11803, 11983), 'click.command', 'click.command', ([], {'help': '"""Prepare Sentinel 2 L2 sen2cor dataset SR and SC for ingestion into the Data Cube. eg. python sen2cor_prepare.py <input>.SAFE --output <outfile>.yaml"""'}), "(help=\n 'Prepare Sentinel 2 L2 sen2cor dataset SR and SC for ingestion into the Data Cube... |
from mongoengine import connect
class Connect(object):
@staticmethod
def connect(table="test", username="superuser", password="<PASSWORD>#", authentication_source="admin"):
# return MongoClient("mongodb://superuser:Seltzer123#@localhost:27017/admin?authSource=admin")
connect('test', username... | [
"mongoengine.connect"
] | [((296, 392), 'mongoengine.connect', 'connect', (['"""test"""'], {'username': '"""superuser"""', 'password': '"""<PASSWORD>#"""', 'authentication_source': '"""admin"""'}), "('test', username='superuser', password='<PASSWORD>#',\n authentication_source='admin')\n", (303, 392), False, 'from mongoengine import connect\... |
#!/usr/bin/python
import pandas as pd
import covidAnnotator
import sys
import argparse
import os
def main():
all_mutations = pd.read_csv(os.path.dirname(os.path.abspath(__file__))+"/all_mutations.csv")
b117muts = pd.read_csv(os.path.dirname(os.path.abspath(__file__))+"/b117muts.csv")
uniqueIDs ... | [
"pandas.DataFrame",
"os.path.abspath",
"argparse.ArgumentParser",
"pandas.unique",
"pandas.ExcelWriter",
"covidAnnotator.main"
] | [((322, 361), 'pandas.unique', 'pd.unique', (["all_mutations['Sequence ID']"], {}), "(all_mutations['Sequence ID'])\n", (331, 361), True, 'import pandas as pd\n'), ((380, 416), 'pandas.unique', 'pd.unique', (["all_mutations['nuc name']"], {}), "(all_mutations['nuc name'])\n", (389, 416), True, 'import pandas as pd\n'),... |
# Generated by Django 3.1.5 on 2021-03-14 03:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('interflowApp', '0004_auto_20210311_1650'),
]
operations = [
migrations.AlterModelOptions(
name='board',
options={'ve... | [
"django.db.models.FileField",
"django.db.models.TextField",
"django.db.migrations.AlterModelOptions"
] | [((240, 351), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""board"""', 'options': "{'verbose_name': '访客留言', 'verbose_name_plural': '访客留言'}"}), "(name='board', options={'verbose_name': '访客留言',\n 'verbose_name_plural': '访客留言'})\n", (268, 351), False, 'from django.db import... |
from shutil import copyfile
import pandas as pd
import os
from glob import glob
import json
import sys
from tqdm import tqdm
import numpy as np
from absl import app
from absl import flags
FLAGS = flags.FLAGS
flags.DEFINE_string('config', './configs/train_config.json', 'Config file with data paths')
flags.DEFINE_stri... | [
"os.mkdir",
"json.load",
"os.path.basename",
"os.path.isdir",
"absl.flags.DEFINE_string",
"absl.app.run",
"glob.glob",
"shutil.copyfile",
"os.path.join"
] | [((211, 306), 'absl.flags.DEFINE_string', 'flags.DEFINE_string', (['"""config"""', '"""./configs/train_config.json"""', '"""Config file with data paths"""'], {}), "('config', './configs/train_config.json',\n 'Config file with data paths')\n", (230, 306), False, 'from absl import flags\n'), ((303, 411), 'absl.flags.D... |
import sys
import setuptools
from distutils import sysconfig
cfg_vars = sysconfig.get_config_vars()
for key, value in cfg_vars.items():
if type(value) == str:
cfg_vars[key] = cfg_vars[key].replace("-Wstrict-prototypes", "")
cfg_vars[key] = cfg_vars[key].replace("-Wall", "-w")
cfg_vars[key] =... | [
"distutils.sysconfig.get_config_vars",
"distutils.sysconfig.get_python_lib",
"multiprocessing.log_to_stderr",
"numpy.get_include",
"multiprocessing.cpu_count"
] | [((72, 99), 'distutils.sysconfig.get_config_vars', 'sysconfig.get_config_vars', ([], {}), '()\n', (97, 99), False, 'from distutils import sysconfig\n'), ((1399, 1425), 'distutils.sysconfig.get_python_lib', 'sysconfig.get_python_lib', ([], {}), '()\n', (1423, 1425), False, 'from distutils import sysconfig\n'), ((58940, ... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from dataclasses import dataclass
from pathlib import PurePath
from pants.backend.go.target_types import (
GoBinaryMainPackage,
GoBinaryMainPackageField,
GoBinaryMainPackageRe... | [
"pants.engine.unions.UnionRule",
"pants.backend.go.util_rules.import_analysis.ImportConfigRequest",
"pants.backend.go.util_rules.build_pkg.BuildGoPackageTargetRequest",
"pants.engine.fs.MergeDigests",
"pants.backend.go.target_types.GoBinaryMainPackageRequest",
"pants.core.goals.package.BuiltPackage",
"p... | [((971, 993), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (980, 993), False, 'from dataclasses import dataclass\n'), ((2387, 2435), 'pants.core.goals.package.BuiltPackage', 'BuiltPackage', (['renamed_output_digest', '(artifact,)'], {}), '(renamed_output_digest, (artifact,))\n', ... |
# -*- coding: utf-8 -*-
import time
import unittest
from convertdate import julianday
from convertdate.armenian import (_valid_date, from_gregorian, from_jd, from_julian, leap, month_length, to_gregorian,
to_jd, to_julian, tostring)
class TestArmenian(unittest.TestCase):
def set... | [
"unittest.main",
"convertdate.armenian._valid_date",
"convertdate.armenian.from_julian",
"convertdate.armenian.tostring",
"convertdate.armenian.to_julian",
"convertdate.armenian.leap",
"convertdate.armenian.from_gregorian",
"convertdate.armenian.to_gregorian",
"convertdate.armenian.from_jd",
"conv... | [((4171, 4186), 'unittest.main', 'unittest.main', ([], {}), '()\n', (4184, 4186), False, 'import unittest\n'), ((349, 365), 'time.localtime', 'time.localtime', ([], {}), '()\n', (363, 365), False, 'import time\n'), ((387, 450), 'convertdate.julianday.from_gregorian', 'julianday.from_gregorian', (['self.now[0]', 'self.n... |
from euler.big_int import BigInt
def compute() -> int:
result = 0
for i in range(1, 10):
j, n = 1, BigInt(i)
while len(n) == j:
result += 1
j += 1
n *= i
return result
| [
"euler.big_int.BigInt"
] | [((117, 126), 'euler.big_int.BigInt', 'BigInt', (['i'], {}), '(i)\n', (123, 126), False, 'from euler.big_int import BigInt\n')] |
"""
All logic regarding extensions management
"""
import time
import importlib
import threading
import logging
import collections
from collections import defaultdict
import scapy.layers.dot11 as dot11
import scapy.arch.linux as linux
import wifiphisher.common.constants as constants
import wifiphisher.extensions.deauth... | [
"threading.Thread",
"scapy.layers.dot11.sniff",
"importlib.import_module",
"scapy.arch.linux.L2Socket",
"time.sleep",
"collections.defaultdict",
"wifiphisher.extensions.deauth.is_deauth_frame",
"logging.getLogger"
] | [((351, 378), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (368, 378), False, 'import logging\n'), ((2393, 2410), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (2404, 2410), False, 'from collections import defaultdict\n'), ((2512, 2549), 'threading.Thread', 'thre... |
""" Line analysis tools
These are intended to be methods generic to emission and absorption
(e.g. Equivalent width)
"""
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
import os
from astropy.modeling import models, fitting
def box_ew(spec):
""" Boxcar EW c... | [
"numpy.sum",
"numpy.roll",
"astropy.modeling.models.Gaussian1D",
"astropy.modeling.models.GaussianAbsorption1D",
"numpy.isfinite",
"astropy.modeling.fitting.LevMarLSQFitter",
"numpy.min",
"numpy.mean",
"numpy.max",
"numpy.sqrt"
] | [((697, 721), 'numpy.sum', 'np.sum', (['(dwv * (1.0 - fx))'], {}), '(dwv * (1.0 - fx))\n', (703, 721), True, 'import numpy as np\n'), ((736, 763), 'numpy.sum', 'np.sum', (['(dwv ** 2 * sig ** 2)'], {}), '(dwv ** 2 * sig ** 2)\n', (742, 763), True, 'import numpy as np\n'), ((774, 788), 'numpy.sqrt', 'np.sqrt', (['varEW'... |
# -*- coding: utf-8 -*-
"""Validation of an ISA investigation
Eventually, all format independent content- and specification-related validations which
don't interrupt model creation definitely (e.g. when parsing from ISA-tab) should go
here. Then, validations can be performed on whole models (e.g. after parsing or befo... | [
"warnings.warn",
"re.compile"
] | [((948, 1011), 're.compile', 're.compile', (['"""^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\\\.[a-zA-Z0-9-.]+$"""'], {}), "('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\\\.[a-zA-Z0-9-.]+$')\n", (958, 1011), False, 'import re\n'), ((1028, 1059), 're.compile', 're.compile', (['"""^\\\\+?[\\\\d /()-]+$"""'], {}), "('^\\\\+?[\\\\d /()-]+$')\n"... |
from math import pi
from unittest.mock import Mock, call
from pygfx import WorldObject
from pygfx.linalg import Euler, Vector3, Quaternion
def test_traverse():
root = WorldObject()
layer1_child1 = WorldObject()
root.add(layer1_child1)
layer1_child2 = WorldObject()
root.add(layer1_child2)
la... | [
"pygfx.linalg.Vector3",
"unittest.mock.Mock",
"pygfx.linalg.Quaternion",
"pygfx.WorldObject",
"unittest.mock.call",
"pygfx.linalg.Euler"
] | [((174, 187), 'pygfx.WorldObject', 'WorldObject', ([], {}), '()\n', (185, 187), False, 'from pygfx import WorldObject\n'), ((209, 222), 'pygfx.WorldObject', 'WorldObject', ([], {}), '()\n', (220, 222), False, 'from pygfx import WorldObject\n'), ((271, 284), 'pygfx.WorldObject', 'WorldObject', ([], {}), '()\n', (282, 28... |
import math; # importiert das ganze Mathe Modul
a = float(input("Bitte geben Sie eine Zahl ein:"));
wurzel = math.sqrt(a);
print("Die Wurzel von " + str(a) + " ist " + str(wurzel));
hochFünf = math.pow(a,5);
print(str(a) + " hoch 5 ergibt " + str(hochFünf)); | [
"math.pow",
"math.sqrt"
] | [((110, 122), 'math.sqrt', 'math.sqrt', (['a'], {}), '(a)\n', (119, 122), False, 'import math\n'), ((196, 210), 'math.pow', 'math.pow', (['a', '(5)'], {}), '(a, 5)\n', (204, 210), False, 'import math\n')] |
"""
This class fetches the earthquakes that occured within the United States
within the past 24 hours. Creates a report of the quakes that have
happened. Report is retrievable through 'get_report'. Also, returns
the amount of quakes that have happened through 'get_count'.
"""
import requests
from datetime import datet... | [
"datetime.datetime.today",
"csv.writer",
"math.radians",
"datetime.timedelta",
"requests.get"
] | [((799, 826), 'csv.writer', 'csv.writer', (['self._data_file'], {}), '(self._data_file)\n', (809, 826), False, 'import csv\n'), ((1032, 1238), 'requests.get', 'requests.get', (['f"""https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime={self._today}&minlatitude=21&minlongitude=-165&maxlatitude=70&ma... |
import pytest
from autofit import database as db
from autofit.mock import mock as m
@pytest.fixture(
name="gaussian_1"
)
def make_gaussian_1():
return db.Fit(
id="gaussian_1",
instance=m.Gaussian(
centre=1
),
info={"info": 1},
is_complete=True,
uniq... | [
"autofit.mock.mock.Gaussian",
"pytest.fixture"
] | [((88, 121), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""gaussian_1"""'}), "(name='gaussian_1')\n", (102, 121), False, 'import pytest\n'), ((342, 375), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""gaussian_2"""'}), "(name='gaussian_2')\n", (356, 375), False, 'import pytest\n'), ((597, 625), 'pytest.f... |
# coding: utf-8
"""
DocuSign REST API
The DocuSign REST API provides you with a powerful, convenient, and simple Web services API for interacting with DocuSign.
OpenAPI spec version: v2.1
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pf... | [
"six.iteritems"
] | [((15948, 15977), 'six.iteritems', 'iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (15957, 15977), False, 'from six import iteritems\n')] |
from __future__ import unicode_literals
from model_utils.models import TimeStampedModel
from django.db import models
from hackupc.users.models import User
# Create your models here.
class Proposal(TimeStampedModel):
title = models.TextField(blank=False, max_length=100)
description = models.TextField(blank=Fa... | [
"django.db.models.ImageField",
"django.db.models.TextField",
"django.db.models.ForeignKey"
] | [((231, 276), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(False)', 'max_length': '(100)'}), '(blank=False, max_length=100)\n', (247, 276), False, 'from django.db import models\n'), ((295, 341), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(False)', 'max_length': '(2000)'}), '... |
# SPDX-License-Identifier: MIT
import pytest
from attr._compat import metadata_proxy
@pytest.fixture(name="mp")
def _mp():
return metadata_proxy({"x": 42, "y": "foo"})
class TestMetadataProxy:
"""
Ensure properties of metadata_proxy independently of hypothesis strategies.
"""
def test_repr(se... | [
"pytest.raises",
"pytest.fixture",
"attr._compat.metadata_proxy"
] | [((90, 115), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""mp"""'}), "(name='mp')\n", (104, 115), False, 'import pytest\n'), ((138, 175), 'attr._compat.metadata_proxy', 'metadata_proxy', (["{'x': 42, 'y': 'foo'}"], {}), "({'x': 42, 'y': 'foo'})\n", (152, 175), False, 'from attr._compat import metadata_proxy\n')... |
#!/usr/bin/python
import re
import sys
def remove_rtti(text):
return re.sub(r'dynamic_cast<(.* \*)>', r'(\1)', text)
def make_dalvik_compat(text):
init_text = """/* Utility class for managing the JNI environment */
class JNIEnvWrapper {
const Director *director_;
JNIEnv *jenv_;
public:
JN... | [
"re.sub"
] | [((72, 119), 're.sub', 're.sub', (['"""dynamic_cast<(.* \\\\*)>"""', '"""(\\\\1)"""', 'text'], {}), "('dynamic_cast<(.* \\\\*)>', '(\\\\1)', text)\n", (78, 119), False, 'import re\n')] |
from abc import ABC
from unittest.mock import MagicMock, call
from uuid import uuid4, UUID
import pytest
from erica.domain.repositories.base_repository_interface import BaseRepositoryInterface
from erica.infrastructure.sqlalchemy.repositories.base_repository import BaseRepository, EntityNotFoundError
from tests.infra... | [
"uuid.uuid4",
"unittest.mock.MagicMock",
"tests.infrastructure.sqlalechemy.repositories.mock_repositories.MockDomainModel",
"pytest.raises",
"uuid.UUID"
] | [((2215, 2261), 'tests.infrastructure.sqlalechemy.repositories.mock_repositories.MockDomainModel', 'MockDomainModel', ([], {'payload': "{'endboss': 'Melkor'}"}), "(payload={'endboss': 'Melkor'})\n", (2230, 2261), False, 'from tests.infrastructure.sqlalechemy.repositories.mock_repositories import MockDomainModel, MockSc... |
# Generated by Django 2.0.7 on 2018-09-01 11:47
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('images', '0006_image_tags'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('notifications', '0003_auto... | [
"django.db.migrations.swappable_dependency",
"django.db.migrations.RenameField",
"django.db.migrations.RenameModel"
] | [((225, 282), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (256, 282), False, 'from django.db import migrations\n'), ((372, 444), 'django.db.migrations.RenameModel', 'migrations.RenameModel', ([], {'old_name': '"""Not... |
from vint.ast.plugin.abstract_ast_plugin import AbstractASTPlugin
from vint.ast.plugin.scope_plugin.reference_reachability_tester import (
ReferenceReachabilityTester,
is_reference_identifier as _is_reference_identifier,
is_declarative_identifier as _is_declarative_identifier,
is_reachable_reference_ide... | [
"vint.ast.plugin.scope_plugin.identifier_attribute.is_autoload_identifier",
"vint.ast.plugin.scope_plugin.identifier_attribute.is_function_identifier",
"vint.ast.plugin.scope_plugin.reference_reachability_tester.ReferenceReachabilityTester",
"vint.ast.plugin.scope_plugin.reference_reachability_tester.is_reach... | [((1253, 1282), 'vint.ast.plugin.scope_plugin.reference_reachability_tester.ReferenceReachabilityTester', 'ReferenceReachabilityTester', ([], {}), '()\n', (1280, 1282), False, 'from vint.ast.plugin.scope_plugin.reference_reachability_tester import ReferenceReachabilityTester, is_reference_identifier as _is_reference_id... |
# gridftp.py
"""Module provides an interface to GridFTP command-line interface."""
from collections import namedtuple
from datetime import datetime
import hashlib
import logging
import os
import shutil
import subprocess
import tempfile
from typing import Any, List, Optional, Tuple, Union
File = namedtuple('File', ['d... | [
"subprocess.run",
"subprocess.Popen",
"os.path.basename",
"os.getcwd",
"os.path.exists",
"datetime.datetime.now",
"datetime.datetime",
"collections.namedtuple",
"shutil.rmtree",
"os.path.join",
"logging.getLogger"
] | [((298, 398), 'collections.namedtuple', 'namedtuple', (['"""File"""', "['directory', 'perms', 'subfiles', 'owner', 'group', 'size', 'date', 'name']"], {}), "('File', ['directory', 'perms', 'subfiles', 'owner', 'group',\n 'size', 'date', 'name'])\n", (308, 398), False, 'from collections import namedtuple\n'), ((404, ... |
import collections
import inspect
import typing
import numpy as np
import pandas as pd
import torch
from river import base
__all__ = ["PyTorch2RiverBase", "PyTorch2RiverRegressor", "PyTorch2RiverClassifier"]
class PyTorch2RiverBase(base.Estimator):
"""An estimator that integrates neural Networks from PyTorch."... | [
"pandas.DataFrame",
"torch.mean",
"numpy.random.seed",
"torch.nn.Sequential",
"torch.manual_seed",
"torch.Tensor",
"inspect.signature",
"torch.nn.Linear",
"collections.Counter",
"torch.no_grad",
"torch.nn.Sigmoid"
] | [((832, 855), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (849, 855), False, 'import torch\n'), ((864, 884), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (878, 884), True, 'import numpy as np\n'), ((2531, 2550), 'torch.Tensor', 'torch.Tensor', (['[[y]]'], {}), '([[y]])\n'... |
import ipaddress
import os
import shutil
from natlas import logging
utillogger = logging.get_logger("Utilities")
def validate_target(target, config):
try:
iptarget = ipaddress.ip_address(target)
if iptarget.is_private and not config.scan_local:
utillogger.error("We're not configured to scan local addresses... | [
"os.mkdir",
"os.makedirs",
"os.path.isdir",
"ipaddress.ip_address",
"natlas.logging.get_logger",
"shutil.move",
"shutil.rmtree"
] | [((84, 115), 'natlas.logging.get_logger', 'logging.get_logger', (['"""Utilities"""'], {}), "('Utilities')\n", (102, 115), False, 'from natlas import logging\n'), ((538, 577), 'os.makedirs', 'os.makedirs', (['data_folder'], {'exist_ok': '(True)'}), '(data_folder, exist_ok=True)\n', (549, 577), False, 'import os\n'), ((7... |
#!/usr/bin/env python
from setuptools import setup
setup(
name='gmreader',
version='0.1.6',
description='Let python read your google emails to you. Listen to your gmails instead of reading them',
author='<NAME>',
license='MIT',
keywords = "email gmail google mail read text to speec... | [
"setuptools.setup"
] | [((53, 503), 'setuptools.setup', 'setup', ([], {'name': '"""gmreader"""', 'version': '"""0.1.6"""', 'description': '"""Let python read your google emails to you. Listen to your gmails instead of reading them"""', 'author': '"""<NAME>"""', 'license': '"""MIT"""', 'keywords': '"""email gmail google mail read text to spee... |
# -*- coding: utf-8 -*- #
# Copyright 2017 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requir... | [
"googlecloudsdk.core.properties.VALUES.core.project.Get",
"googlecloudsdk.calliope.base.ASYNC_FLAG.AddToParser",
"googlecloudsdk.api_lib.services.serviceusage.BatchEnableApiCall",
"googlecloudsdk.command_lib.services.common_flags.available_service_flag",
"googlecloudsdk.api_lib.services.services_util.PrintO... | [((2560, 2595), 'googlecloudsdk.calliope.base.ASYNC_FLAG.AddToParser', 'base.ASYNC_FLAG.AddToParser', (['parser'], {}), '(parser)\n', (2587, 2595), False, 'from googlecloudsdk.calliope import base\n'), ((2804, 2853), 'googlecloudsdk.core.properties.VALUES.core.project.Get', 'properties.VALUES.core.project.Get', ([], {'... |
import numpy as np
import math
import matplotlib.pyplot as plt
import pickle
from time import time
from numpy.linalg import matrix_rank
from numpy.linalg import pinv,inv
from numpy.linalg import eig as eig
from numpy.linalg import eigh,lstsq
from numpy.linalg import matrix_power
from scipy.linalg import expm,pinvh,solv... | [
"numpy.load",
"numpy.random.seed",
"sklearn.model_selection.train_test_split",
"tqdm.notebook.trange",
"numpy.mean",
"numpy.arange",
"torch.no_grad",
"numpy.unique",
"numpy.max",
"sklearn.neighbors.NearestNeighbors",
"numpy.random.choice",
"torch.nn.Linear",
"sklearn.neighbors.NearestCentroi... | [((2683, 2707), 'types.SimpleNamespace', 'SimpleNamespace', ([], {}), '(**tasks)\n', (2698, 2707), False, 'from types import SimpleNamespace\n'), ((2958, 2995), 'numpy.load', 'np.load', (['f"""saved_models/CNTK-200.npy"""'], {}), "(f'saved_models/CNTK-200.npy')\n", (2965, 2995), True, 'import numpy as np\n'), ((6803, 6... |
from sampling import Sampler
import algos
import numpy as np
from simulation_utils import create_env, get_feedback, run_algo
import sys
def batch(task, method, N, M, b):
if N % b != 0:
print('N must be divisible to b')
exit(0)
B = 20*b
simulation_object = create_env(task)
d = simulatio... | [
"simulation_utils.get_feedback",
"numpy.mean",
"numpy.linalg.norm",
"simulation_utils.create_env",
"simulation_utils.run_algo",
"numpy.array",
"numpy.random.rand",
"sampling.Sampler"
] | [((286, 302), 'simulation_utils.create_env', 'create_env', (['task'], {}), '(task)\n', (296, 302), False, 'from simulation_utils import create_env, get_feedback, run_algo\n'), ((671, 681), 'sampling.Sampler', 'Sampler', (['d'], {}), '(d)\n', (678, 681), False, 'from sampling import Sampler\n'), ((1612, 1638), 'numpy.me... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.utils import cint, get_link_to_form
from frappe.model.document import Document
class Ass... | [
"frappe.utils.get_link_to_form",
"frappe.whitelist",
"frappe.db.get_value",
"frappe.bold",
"frappe.scrub",
"frappe.unscrub",
"frappe._"
] | [((3509, 3527), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (3525, 3527), False, 'import frappe\n'), ((4115, 4246), 'frappe.db.get_value', 'frappe.db.get_value', (['"""Asset Category Account"""'], {'filters': "{'parent': asset_category, 'company_name': company}", 'fieldname': 'fieldname'}), "('Asset Categ... |
# -*- coding: utf-8 -*-
import json
import io, sys
import nltk
import xml.etree.cElementTree as ET
from xml.etree.ElementTree import Element, SubElement, dump, ElementTree
file_ko = 'test_ko.txt'
file_en = 'test_en.txt'
ko = open(file_ko).readlines()
en = open(file_en).readlines()
data_ko = []
for t in ko:
if t.... | [
"xml.etree.ElementTree.dump",
"xml.etree.ElementTree.Element",
"xml.etree.ElementTree.SubElement"
] | [((624, 637), 'xml.etree.ElementTree.Element', 'Element', (['"""tu"""'], {}), "('tu')\n", (631, 637), False, 'from xml.etree.ElementTree import Element, SubElement, dump, ElementTree\n'), ((652, 673), 'xml.etree.ElementTree.SubElement', 'SubElement', (['tu', '"""tuv"""'], {}), "(tu, 'tuv')\n", (662, 673), False, 'from ... |
# Generated by Django 2.1 on 2018-08-16 20:20
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('leagues', '0015_league_season'),
]
operations = [
migrations.AlterUniqueTogether(
name='season',
unique_together={('start_date... | [
"django.db.migrations.AlterUniqueTogether"
] | [((220, 316), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""season"""', 'unique_together': "{('start_date', 'end_date')}"}), "(name='season', unique_together={(\n 'start_date', 'end_date')})\n", (250, 316), False, 'from django.db import migrations\n')] |
#!/usr/bin/env python
"""
Tests for the Mininet Walkthrough
TODO: missing xterm test
"""
import unittest
import pexpect
import os
import re
from mininet.util import quietRun
from distutils.version import StrictVersion
def tsharkVersion():
"Return tshark version"
versionStr = quietRun( 'tshark -v' )
vers... | [
"unittest.main",
"pexpect.spawn",
"distutils.version.StrictVersion",
"os.path.realpath",
"os.path.exists",
"re.findall",
"os.path.normpath",
"mininet.util.quietRun",
"os.path.join"
] | [((288, 309), 'mininet.util.quietRun', 'quietRun', (['"""tshark -v"""'], {}), "('tshark -v')\n", (296, 309), False, 'from mininet.util import quietRun\n'), ((331, 386), 're.findall', 're.findall', (['"""TShark[^\\\\d]*(\\\\d+.\\\\d+.\\\\d+)"""', 'versionStr'], {}), "('TShark[^\\\\d]*(\\\\d+.\\\\d+.\\\\d+)', versionStr)... |
"""
Advances in Financial Machine Learning, <NAME>
Chapter 2: Financial Data Structures
This module contains the functions to help users create structured financial data from raw unstructured data,
in the form of time, tick, volume, and dollar bars.
These bars are used throughout the text book (Advances in Financial ... | [
"numpy.float",
"mlfinlab.data_structures.base_bars.BaseBars.__init__"
] | [((1508, 1568), 'mlfinlab.data_structures.base_bars.BaseBars.__init__', 'BaseBars.__init__', (['self', 'file_path_or_df', 'metric', 'batch_size'], {}), '(self, file_path_or_df, metric, batch_size)\n', (1525, 1568), False, 'from mlfinlab.data_structures.base_bars import BaseBars\n'), ((2513, 2529), 'numpy.float', 'np.fl... |
# Ignoring some linting rules in tests
# pylint: disable=redefined-outer-name
# pylint: disable=missing-docstring
import pytest
import logging
from bingo.util import log
@pytest.mark.parametrize("verbosity, expected_level",
[("debug", 10),
("detailed", log.DETAILED_... | [
"bingo.util.log.MpiFilter",
"pytest.mark.filterwarnings",
"bingo.util.log.configure_logging",
"bingo.util.log.StatsFilter",
"logging.Logger.setLevel.assert_called_with",
"pytest.mark.parametrize"
] | [((174, 345), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""verbosity, expected_level"""', "[('debug', 10), ('detailed', log.DETAILED_INFO), ('standard', log.INFO), (\n 'quiet', 30), (31, 31), (0.5, 25)]"], {}), "('verbosity, expected_level', [('debug', 10), (\n 'detailed', log.DETAILED_INFO), ('sta... |
# -*- coding:utf-8 -*-
import re
import json
import requests
"""
目标APP:比心陪练APP
目标url:APP短视频分享链接
爬取思路:
1. 通过APP里的分享获取视频url,获取其timelineId
2. 对https://h5.hibixin.com/capi/bixin/timeline/shareTimeline发送post请求,获取json数据
"""
class BiXin(object):
def __init__(self, url):
self.url = url
self.sessi... | [
"requests.Session",
"json.dumps",
"re.compile"
] | [((325, 343), 'requests.Session', 'requests.Session', ([], {}), '()\n', (341, 343), False, 'import requests\n'), ((697, 734), 're.compile', 're.compile', (['"""dynamic_id=(\\\\w+)"""', 're.S'], {}), "('dynamic_id=(\\\\w+)', re.S)\n", (707, 734), False, 'import re\n'), ((1592, 1628), 'json.dumps', 'json.dumps', (['info'... |
from get_adelphi_info import AdelphiInfo
import json
create_json = AdelphiInfo()
filename = "tmp/adelphi_calendar.json"
calendar_info_dict = dict()
with open(filename) as f:
calendar_info_dict = json.load(f)
| [
"json.load",
"get_adelphi_info.AdelphiInfo"
] | [((67, 80), 'get_adelphi_info.AdelphiInfo', 'AdelphiInfo', ([], {}), '()\n', (78, 80), False, 'from get_adelphi_info import AdelphiInfo\n'), ((201, 213), 'json.load', 'json.load', (['f'], {}), '(f)\n', (210, 213), False, 'import json\n')] |
# Generated by Django 2.0.4 on 2018-04-10 16:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('account', '0005_auto_20180410_1458'),
]
operations = [
migrations.AddField(
model_name='account',
name='last_modifie... | [
"django.db.models.DateTimeField",
"django.db.models.SlugField"
] | [((342, 388), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)', 'null': '(True)'}), '(auto_now=True, null=True)\n', (362, 388), False, 'from django.db import migrations, models\n'), ((509, 559), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)',... |