code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import pytest
import numpy as np
from examples.protocol import Protocol
from examples.tools import generate_sound, WindowConfiguration
@pytest.fixture
def prepare_sound():
def create_sound(sound_index, duration, sample_rate, data_type):
# generate sound
window_config = WindowConfiguration(left_du... | [
"pytest.mark.parametrize",
"examples.tools.generate_sound",
"examples.tools.WindowConfiguration"
] | [((2347, 2398), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""sound_index"""', '[2, 10, 20]'], {}), "('sound_index', [2, 10, 20])\n", (2370, 2398), False, 'import pytest\n'), ((2400, 2451), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""duration"""', '[4, 8, 12, 25]'], {}), "('duration', [4, ... |
# Copyright (c) 2016-present, <NAME>. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditio... | [
"os.system",
"os.chdir",
"os.path.exists"
] | [((1612, 1632), 'os.chdir', 'os.chdir', (['output_dir'], {}), '(output_dir)\n', (1620, 1632), False, 'import os\n'), ((1634, 1722), 'os.system', 'os.system', (["('java -jar ' + settings.WORKING_DIR + 'lib/apktool.jar d -f ' + input_apk)"], {}), "('java -jar ' + settings.WORKING_DIR + 'lib/apktool.jar d -f ' +\n inpu... |
import time
import rasiberryPiGPIOBaseController.driver.BMP180 as devBMP180
class BMP180:
def __init__(self, address=0x77):
self._address = address
self.device = devBMP180.BMP180(address)
def getTemperature(self):
return self.device.read_temperature()
def getPressure(self):
return self.dev... | [
"rasiberryPiGPIOBaseController.driver.BMP180.BMP180"
] | [((174, 199), 'rasiberryPiGPIOBaseController.driver.BMP180.BMP180', 'devBMP180.BMP180', (['address'], {}), '(address)\n', (190, 199), True, 'import rasiberryPiGPIOBaseController.driver.BMP180 as devBMP180\n')] |
# coding: utf-8
"""
KubeVirt API
This is KubeVirt API an add-on for Kubernetes.
OpenAPI spec version: 1.0.0
Contact: <EMAIL>
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
class V1alpha1VolumeRestore(object):... | [
"six.iteritems"
] | [((4695, 4724), 'six.iteritems', 'iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (4704, 4724), False, 'from six import iteritems\n')] |
import json
import sdk.util as util
from sdk.data import compression
from sdk.data.CANFrame import CANFrame
from sdk.data.Mappable import Mappable, NoneAsMappable, ListAsMappable, StringAsMappable
class Message(Mappable):
""" Request base class"""
__slots__ = ('message', 'type', 'id')
def __init__(self... | [
"json.loads",
"sdk.data.Mappable.ListAsMappable",
"sdk.data.Mappable.NoneAsMappable",
"sdk.data.Mappable.StringAsMappable",
"sdk.data.compression.decompress"
] | [((3864, 3879), 'json.loads', 'json.loads', (['obj'], {}), '(obj)\n', (3874, 3879), False, 'import json\n'), ((3904, 3937), 'sdk.data.Mappable.ListAsMappable', 'ListAsMappable', (['CANFrame.from_obj'], {}), '(CANFrame.from_obj)\n', (3918, 3937), False, 'from sdk.data.Mappable import Mappable, NoneAsMappable, ListAsMapp... |
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^oauth2/callback/$',
'idt_oauth2.views.oauth2_callback', name='oauth2_callback'),
url(r'^oauth2/authorize/(?P<service_name>(\w+))/$',
'idt_oauth2.views.oauth2_authorize', name='oauth2_authorize'),
)
| [
"django.conf.urls.url"
] | [((84, 174), 'django.conf.urls.url', 'url', (['"""^oauth2/callback/$"""', '"""idt_oauth2.views.oauth2_callback"""'], {'name': '"""oauth2_callback"""'}), "('^oauth2/callback/$', 'idt_oauth2.views.oauth2_callback', name=\n 'oauth2_callback')\n", (87, 174), False, 'from django.conf.urls import patterns, include, url\n'... |
import json
with open('strings.json') as json_data:
d = json.load(json_data)
print(d)
pprint(data) | [
"json.load"
] | [((61, 81), 'json.load', 'json.load', (['json_data'], {}), '(json_data)\n', (70, 81), False, 'import json\n')] |
# -*- coding: utf-8 -*-
# This file is part of Shuup Admin Channel
#
# Copyright (c) 2019, <NAME>. All rights reserved.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import json
from django.utils.translation import ugettext
class SendAle... | [
"django.utils.translation.ugettext",
"json.dumps"
] | [((972, 1066), 'json.dumps', 'json.dumps', (["{'command': 'alert', 'message': payload['message'], 'level': payload['level']}"], {}), "({'command': 'alert', 'message': payload['message'], 'level':\n payload['level']})\n", (982, 1066), False, 'import json\n'), ((1332, 1363), 'django.utils.translation.ugettext', 'ugett... |
"""Node Count ETL"""
import logging
import os
from etl import ETL
from files import TXTFile
from .helpers import Neo4jHelper
class NodeCountETL(ETL):
"""Node Count ETL"""
logger = logging.getLogger(__name__)
def __init__(self, config):
super().__init__()
self.data_type_config = config
... | [
"os.path.join",
"files.TXTFile",
"logging.getLogger"
] | [((192, 219), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (209, 219), False, 'import logging\n'), ((665, 704), 'os.path.join', 'os.path.join', (['"""tmp"""', 'exception_filename'], {}), "('tmp', exception_filename)\n", (677, 704), False, 'import os\n'), ((1730, 1747), 'files.TXTFile', ... |
from PyQt5.QtWidgets import *
import sys
from PyQt5.QtWebEngineWidgets import *
from PyQt5.QtCore import *
from PyQt5 import QtGui
import requests
import validators
from settings import settings
from urllib.parse import quote
from xml.etree import ElementTree as ET
class MainWindow(QMainWindow)... | [
"PyQt5.QtGui.QIcon",
"xml.etree.ElementTree.fromstring",
"validators.url",
"PyQt5.QtGui.QMovie",
"urllib.parse.quote",
"requests.get"
] | [((515, 548), 'PyQt5.QtGui.QMovie', 'QtGui.QMovie', (['"""icons/loading.gif"""'], {}), "('icons/loading.gif')\n", (527, 548), False, 'from PyQt5 import QtGui\n'), ((4472, 4492), 'validators.url', 'validators.url', (['text'], {}), '(text)\n', (4486, 4492), False, 'import validators\n'), ((635, 658), 'PyQt5.QtGui.QIcon',... |
from aiokafka import ConsumerRecord
from kafkaesk.exceptions import ProducerUnhealthyException
from kafkaesk.kafka import KafkaTopicManager
from kafkaesk.retry import Forward
from unittest.mock import call
from unittest.mock import MagicMock
from unittest.mock import Mock
from unittest.mock import patch
import aiokafk... | [
"uuid.uuid4",
"unittest.mock.MagicMock",
"asyncio.sleep",
"unittest.mock.Mock",
"unittest.mock.AsyncMock",
"unittest.mock.patch",
"pytest.raises",
"unittest.mock.call",
"kafkaesk.retry.Forward"
] | [((6705, 6735), 'unittest.mock.Mock', 'Mock', ([], {'return_value': 'policy_mock'}), '(return_value=policy_mock)\n', (6709, 6735), False, 'from unittest.mock import Mock\n'), ((7298, 7309), 'unittest.mock.AsyncMock', 'AsyncMock', ([], {}), '()\n', (7307, 7309), False, 'from unittest.mock import AsyncMock\n'), ((7877, 7... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
Program:
Sample app
Version:
0.3.4
History:
Created on 2018/05/20
Last modified on 2021/10/08
Author:
kwkw
"""
from flask import Blueprint, Flask, jsonify
from flask_docs import ApiDoc
app = Flask(__name__)
# Using CDN
# app.config["API_DOC_CDN"]... | [
"flask_docs.ApiDoc",
"flask.jsonify",
"flask.Flask",
"flask.Blueprint"
] | [((264, 279), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (269, 279), False, 'from flask import Blueprint, Flask, jsonify\n'), ((946, 1031), 'flask_docs.ApiDoc', 'ApiDoc', (['app'], {'title': '"""Sample App"""', 'version': '"""1.0.0"""', 'description': '"""A simple app API"""'}), "(app, title='Sample Ap... |
# -*- coding: utf-8 -*-
"""Streaming price data.
demonstrate the PricingStream request and convenient handling of data using Pydantic.
Usage:
streaming_prices.py --instrument <instrument> [--instrument <instrument>] [--nice] [--timeout <timeout>] [--count <count>]
Options:
--nice json indente... | [
"logging.basicConfig",
"docopt.docopt",
"oandapyV20.API",
"exampleauth.exampleAuth",
"logging.getLogger"
] | [((798, 932), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""pricingstream.log"""', 'level': 'logging.INFO', 'format': '"""%(asctime)s [%(levelname)s] %(name)s : %(message)s"""'}), "(filename='pricingstream.log', level=logging.INFO,\n format='%(asctime)s [%(levelname)s] %(name)s : %(message)s')\... |
# Generated by Django 3.1.2 on 2020-12-30 17:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('menucard', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='alkoholfreiedrinks',
name='zusatzstoff... | [
"django.db.models.CharField",
"django.db.models.DecimalField"
] | [((342, 396), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(55)', 'null': '(True)'}), '(blank=True, max_length=55, null=True)\n', (358, 396), False, 'from django.db import migrations, models\n'), ((536, 602), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import print_function
import os
from exhibitionist import get_server
from exhibitionist.util.common import UrlDisplay
import handlers
pjoin = os.path.join
dirname = lambda x: os.path.abspath(os.path.dirname(x))
# tell the server where the templates and stat... | [
"exhibitionist.util.common.UrlDisplay",
"os.path.dirname",
"exhibitionist.get_server"
] | [((1502, 1517), 'exhibitionist.util.common.UrlDisplay', 'UrlDisplay', (['url'], {}), '(url)\n', (1512, 1517), False, 'from exhibitionist.util.common import UrlDisplay\n'), ((253, 271), 'os.path.dirname', 'os.path.dirname', (['x'], {}), '(x)\n', (268, 271), False, 'import os\n'), ((759, 850), 'exhibitionist.get_server',... |
import time
import traceback
from dataclasses import dataclass
import sqlite3
import argparse
from abc import ABC, abstractmethod
from typing import List, Any
import pandas as pd
import surprise
from aiohttp.web_exceptions import HTTPException
from surprise import KNNBaseline
from surprise import Reader, Dataset
impor... | [
"aiohttp.web.Response",
"traceback.print_exc",
"argparse.ArgumentParser",
"surprise.Dataset.load_from_df",
"surprise.Reader",
"joblib.dump",
"aiohttp.web.options",
"time.time",
"aiohttp.web.HTTPBadRequest",
"aiohttp.web.get",
"sqlite3.connect",
"aiohttp.web.run_app",
"pandas.read_sql",
"jo... | [((9562, 9576), 'aiohttp.web.Response', 'web.Response', ([], {}), '()\n', (9574, 9576), False, 'from aiohttp import web\n'), ((10217, 10279), 'aiohttp.web.Application', 'web.Application', ([], {'middlewares': '[log_middleware, cors_middleware]'}), '(middlewares=[log_middleware, cors_middleware])\n', (10232, 10279), Fal... |
import os
import hashlib
def duplicados(path, extension):
ret = {}
# Para cada arquivo no diretorio
for filename in os.listdir(path):
# Somente arquivos com a extensão desejada
if filename.endswith(extension):
# Monta o caminho completo do arquivo
fullpath = os.p... | [
"os.path.join",
"os.listdir"
] | [((131, 147), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (141, 147), False, 'import os\n'), ((332, 360), 'os.path.join', 'os.path.join', (['path', 'filename'], {}), '(path, filename)\n', (344, 360), False, 'import os\n')] |
import random
if __name__ == '__main__':
cnt=0
ans = random.randint(0,9)
print("answer is:"+str(ans))
guess = int(input("Guess a num:"))
cnt += 1
while ans != guess:
if (ans>guess):
print("你猜的数字小于正确答案")
else:
print("你猜的数字大于正确答案")
cnt +=... | [
"random.randint"
] | [((64, 84), 'random.randint', 'random.randint', (['(0)', '(9)'], {}), '(0, 9)\n', (78, 84), False, 'import random\n')] |
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
\file Grid.py
\brief Object to store a pointcloud in a regular grid.
\copyright Copyright (c) 2021 Visual Computing group of Ulm University,
Germany. See the LICENSE file at the top-level directory of
... | [
"os.path.abspath",
"tensorflow.math.ceil",
"tensorflow.reverse",
"tensorflow.gather",
"os.path.dirname",
"tensorflow.shape",
"IEProtLibModule.build_grid_ds",
"tensorflow.reduce_max",
"IEProtLibModule.compute_keys",
"os.path.join"
] | [((574, 599), 'os.path.dirname', 'os.path.dirname', (['BASE_DIR'], {}), '(BASE_DIR)\n', (589, 599), False, 'import os\n'), ((529, 554), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (544, 554), False, 'import os\n'), ((616, 655), 'os.path.join', 'os.path.join', (['ROOT_MODULE_DIR', '"""tf_op... |
# pytest -s stereo.py -k [name]
import math
import random
import pytest
from conftest import checker, ver
from unrealcv import client
class Vec3:
def __init__(self, data):
if isinstance(data, str):
self.vec = [float(v) for v in data.split(' ')]
if isinstance(data, list):
s... | [
"conftest.checker.not_error",
"math.sqrt",
"unrealcv.client.request",
"conftest.checker.is_ok",
"unrealcv.client.connect",
"random.randrange",
"conftest.ver"
] | [((957, 973), 'unrealcv.client.connect', 'client.connect', ([], {}), '()\n', (971, 973), False, 'from unrealcv import client\n'), ((1853, 1869), 'unrealcv.client.connect', 'client.connect', ([], {}), '()\n', (1867, 1869), False, 'from unrealcv import client\n'), ((1028, 1091), 'unrealcv.client.request', 'client.request... |
import itertools
from collections import defaultdict
import aocd
def chunk_iterable(iterable, size):
fill_value = object()
chunks = [iter(iterable)] * size
for chunk in itertools.zip_longest(*chunks, fillvalue=fill_value):
yield (i for i in chunk if i is not fill_value)
def parse_boards(data):
... | [
"collections.defaultdict",
"itertools.zip_longest",
"aocd.get_data"
] | [((184, 236), 'itertools.zip_longest', 'itertools.zip_longest', (['*chunks'], {'fillvalue': 'fill_value'}), '(*chunks, fillvalue=fill_value)\n', (205, 236), False, 'import itertools\n'), ((635, 652), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (646, 652), False, 'from collections import defaul... |
import nltk
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.pairwise import cosine_similarity
import string
from selenium.webdriver.common.keys import Keys
nltk.download('punkt')
nltk.download('wordnet')
lemmer = nltk.stem.WordNetLemmatizer()
remove_punct_dict = dict((ord(punct), No... | [
"sklearn.feature_extraction.text.TfidfVectorizer",
"nltk.download",
"sklearn.metrics.pairwise.cosine_similarity",
"nltk.stem.WordNetLemmatizer"
] | [((190, 212), 'nltk.download', 'nltk.download', (['"""punkt"""'], {}), "('punkt')\n", (203, 212), False, 'import nltk\n'), ((214, 238), 'nltk.download', 'nltk.download', (['"""wordnet"""'], {}), "('wordnet')\n", (227, 238), False, 'import nltk\n'), ((250, 279), 'nltk.stem.WordNetLemmatizer', 'nltk.stem.WordNetLemmatize... |
from typing import List
from xml.etree.ElementTree import Element, SubElement
from markdown import Markdown
from markdown.blockprocessors import BlockProcessor
from markdown.extensions import Extension
class ParagraphProcessor(BlockProcessor):
""" Process Paragraph blocks. """
def test(self, parent: Element... | [
"xml.etree.ElementTree.SubElement"
] | [((1614, 1647), 'xml.etree.ElementTree.SubElement', 'SubElement', (['parent', '"""REPLACE_TAG"""'], {}), "(parent, 'REPLACE_TAG')\n", (1624, 1647), False, 'from xml.etree.ElementTree import Element, SubElement\n')] |
"""
Synthesize speech from the extracted text.
"""
import os
from os import system
import matplotlib.pyplot as plt
from tqdm import tqdm
from pprint import pformat
import logging
from scipy.io import wavfile
import numpy as np
def _remove_if_exists(filepath: str):
os.remove(filepath) if os.path.isfile(filepath) ... | [
"tqdm.tqdm",
"os.remove",
"numpy.abs",
"pprint.pformat",
"os.system",
"scipy.io.wavfile.write",
"scipy.io.wavfile.read",
"logging.info",
"os.path.isfile",
"numpy.argwhere",
"os.path.join"
] | [((1039, 1074), 'os.system', 'system', (["(tts_command + '> /dev/null')"], {}), "(tts_command + '> /dev/null')\n", (1045, 1074), False, 'from os import system\n'), ((2158, 2180), 'scipy.io.wavfile.read', 'wavfile.read', (['filename'], {}), '(filename)\n', (2170, 2180), False, 'from scipy.io import wavfile\n'), ((2448, ... |
from widgetastic.widget import View
from widgetastic_patternfly4 import Button
def test_button_click(browser):
class TestView(View):
any_button = Button()
button1 = Button("Primary")
button2 = Button("Link to Core Docs")
view = TestView(browser)
assert view.any_button.is_displayed... | [
"widgetastic_patternfly4.Button"
] | [((160, 168), 'widgetastic_patternfly4.Button', 'Button', ([], {}), '()\n', (166, 168), False, 'from widgetastic_patternfly4 import Button\n'), ((187, 204), 'widgetastic_patternfly4.Button', 'Button', (['"""Primary"""'], {}), "('Primary')\n", (193, 204), False, 'from widgetastic_patternfly4 import Button\n'), ((223, 25... |
import pytest
import edera.helpers
from edera.helpers import memoized
def test_functions_can_be_memoized():
@memoized
def fibonacci(n):
fibonacci.calls += 1
return 1 if n <= 2 else fibonacci(n - 1) + fibonacci(n - 2)
fibonacci.calls = 0
assert fibonacci(100) == 35422484817926191507... | [
"pytest.raises"
] | [((1465, 1499), 'pytest.raises', 'pytest.raises', (['NotImplementedError'], {}), '(NotImplementedError)\n', (1478, 1499), False, 'import pytest\n'), ((2270, 2299), 'pytest.raises', 'pytest.raises', (['AssertionError'], {}), '(AssertionError)\n', (2283, 2299), False, 'import pytest\n'), ((2365, 2394), 'pytest.raises', '... |
# -*- coding: utf-8 -*-
# Copyright 2018 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or ... | [
"sagemaker.utils.name_from_base",
"sagemaker.utils.to_str",
"sagemaker.utils.secondary_training_status_message",
"pandas_is_not_installed.DataFrame",
"sagemaker.utils.get_config_value",
"mock.patch",
"sagemaker.utils.extract_name_from_job_arn",
"pytest.raises",
"sagemaker.utils.DeferredError",
"sa... | [((1823, 1867), 'mock.patch', 'patch', (['"""sagemaker.utils.sagemaker_timestamp"""'], {}), "('sagemaker.utils.sagemaker_timestamp')\n", (1828, 1867), False, 'from mock import patch\n'), ((1998, 2048), 'mock.patch', 'patch', (['"""sagemaker.utils.sagemaker_short_timestamp"""'], {}), "('sagemaker.utils.sagemaker_short_t... |
#!/usr/bin/python3
# -*- coding: utf-8 -*-
'''
no good way
'''
import sys
sys.path.append('../')
import cw as Test
import time
def count_str_alpha(str):
out_temp={}
for i in str:
if i.islower():
out_temp[i] =out_temp.get(i,-1)+1
else:
pass
return (out_temp)
def... | [
"sys.path.append",
"cw.it",
"time.perf_counter",
"cw.describe"
] | [((77, 99), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (92, 99), False, 'import sys\n'), ((857, 876), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (874, 876), False, 'import time\n'), ((881, 901), 'cw.describe', 'Test.describe', (['"""Mix"""'], {}), "('Mix')\n", (894, 901), T... |
"""
My solution for the Problem 2 on
Day 21 of Advent of Code 2020.
"""
from functools import reduce
import operator
from itertools import product
import networkx as nx
def hopcroft_karp(g):
"""
Given a bipartite graph,
compute a maximum matching.
:param g: A networkx graph.
:return: A dict with... | [
"networkx.algorithms.bipartite.matching.hopcroft_karp_matching",
"networkx.Graph"
] | [((430, 488), 'networkx.algorithms.bipartite.matching.hopcroft_karp_matching', 'nx.algorithms.bipartite.matching.hopcroft_karp_matching', (['g'], {}), '(g)\n', (485, 488), True, 'import networkx as nx\n'), ((2322, 2332), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (2330, 2332), True, 'import networkx as nx\n')] |
import time
import unittest
from fds.analyticsapi.engines.api.fi_calculations_api import FICalculationsApi
from fds.analyticsapi.engines.model.fi_calculation_parameters import FICalculationParameters
from fds.analyticsapi.engines.model.fi_calculation_parameters_root import FICalculationParametersRoot
from fds.analytic... | [
"unittest.main",
"fds.analyticsapi.engines.model.fi_calculation_parameters.FICalculationParameters",
"time.sleep",
"fds.analyticsapi.engines.model.fi_job_settings.FIJobSettings",
"fds.analyticsapi.engines.model.fi_security.FISecurity",
"fds.analyticsapi.engines.api.fi_calculations_api.FICalculationsApi",
... | [((3427, 3442), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3440, 3442), False, 'import unittest\n'), ((610, 644), 'common_functions.CommonFunctions.build_api_client', 'CommonFunctions.build_api_client', ([], {}), '()\n', (642, 644), False, 'from common_functions import CommonFunctions\n'), ((677, 711), 'fds.a... |
from django.conf.urls import patterns, url
from rest_framework import routers
from . import views
urlpatterns = patterns('',
url('^auth$', views.AuthView.as_view(),
name='authenticate')
)
router = routers.DefaultRouter(trailing_slash=False)
ro... | [
"rest_framework.routers.DefaultRouter"
] | [((274, 317), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {'trailing_slash': '(False)'}), '(trailing_slash=False)\n', (295, 317), False, 'from rest_framework import routers\n')] |
from sys import stderr, exit
import collections
import random
from multilanguage import Env, Lang, TALcolors
from TALinputs import TALinput
from euler_dir_lib import *
# METADATA OF THIS TAL_SERVICE:
args_list = [
('num_calls',str),
('n',int),
('m',int),
]
ENV =Env(args_list)
TAc =TALcolors(ENV)
LANG=La... | [
"multilanguage.Env",
"multilanguage.TALcolors",
"sys.exit"
] | [((278, 292), 'multilanguage.Env', 'Env', (['args_list'], {}), '(args_list)\n', (281, 292), False, 'from multilanguage import Env, Lang, TALcolors\n'), ((298, 312), 'multilanguage.TALcolors', 'TALcolors', (['ENV'], {}), '(ENV)\n', (307, 312), False, 'from multilanguage import Env, Lang, TALcolors\n'), ((1182, 1189), 's... |
from collections import deque
class Queue:
data = deque()
size = 0
def enqueue(self, val):
self.size += 1
self.data.append(val)
def dequeue(self):
self.size -= 1
return self.data.popleft()
def empty(self):
return self.size == 0
def __len__(self):
... | [
"collections.deque"
] | [((56, 63), 'collections.deque', 'deque', ([], {}), '()\n', (61, 63), False, 'from collections import deque\n')] |
"""Lux models are built on top of
* Marshmallow Schemas
* SqlAlchemy models
"""
from marshmallow import ValidationError, post_dump, post_load
from marshmallow.validate import OneOf
import inflect
from .schema import Schema, resource_name, get_schema_class
from .component import Component
from .model import ModelCont... | [
"inflect.engine"
] | [((410, 426), 'inflect.engine', 'inflect.engine', ([], {}), '()\n', (424, 426), False, 'import inflect\n')] |
import eel
from screeninfo import get_monitors
class Config:
"""Configuration class."""
__is_init = False
__cache = {}
__callbacks = {}
@staticmethod
def __init():
if not Config.__is_init:
dimension = (1200, 800)
position = [
(
... | [
"screeninfo.get_monitors"
] | [((467, 481), 'screeninfo.get_monitors', 'get_monitors', ([], {}), '()\n', (479, 481), False, 'from screeninfo import get_monitors\n')] |
"""Custom yaml tag handlers module."""
"""
Copyright 2021 Deutsche Telekom AG
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
Unles... | [
"uuid.uuid4"
] | [((1668, 1680), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (1678, 1680), False, 'import uuid\n')] |
"""
retrieves upcoming maintenance windows for RDS clusters and instances.
"""
from typing import Optional, Dict, Tuple
from datetime import datetime
import boto3
from mypy_boto3_rds import RDSClient
from aws_maintenance_window_reporter.maintenance_action import MaintenanceAction
from aws_maintenance_window_reporter.... | [
"datetime.datetime.utcnow"
] | [((3945, 3962), 'datetime.datetime.utcnow', 'datetime.utcnow', ([], {}), '()\n', (3960, 3962), False, 'from datetime import datetime\n')] |
from urllib.request import urlopen
from bs4 import BeautifulSoup
import ssl
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
html = urlopen('http://py4e-data.dr-chuck.net/comments_33075.html', context=ctx).read()
soup = BeautifulSoup(html, "html.parser")
print(sum([int(t... | [
"bs4.BeautifulSoup",
"ssl.create_default_context",
"urllib.request.urlopen"
] | [((83, 111), 'ssl.create_default_context', 'ssl.create_default_context', ([], {}), '()\n', (109, 111), False, 'import ssl\n'), ((268, 302), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (281, 302), False, 'from bs4 import BeautifulSoup\n'), ((179, 252), 'urllib.re... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2017-06-05 14:06
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('nomi', '0037_auto_20170605_1120'),
]
operations = [
migrations.CreateModel(
... | [
"django.db.models.CharField",
"django.db.models.AutoField"
] | [((626, 856), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('Nomination created', 'Nomination created'), ('Nomination out',\n 'Nomination out'), ('Interview period', 'Interview period'), (\n 'Compiled', 'Compiled')]", 'default': '"""Post created"""', 'max_length': '(50)'}), "(choices=[('No... |
# Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"re.compile"
] | [((1992, 2044), 're.compile', 're.compile', (['"""(?P<intName>\\\\S+)\\\\((?P<state>\\\\w+)\\\\)"""'], {}), "('(?P<intName>\\\\S+)\\\\((?P<state>\\\\w+)\\\\)')\n", (2002, 2044), False, 'import re\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from tqdm import tqdm
# Let's solve:
# -d^2(u)/dx^2 = sin(2 * pi * x)
# On the domain [0, 1], with the BC u_func(0) = 0, u_func(1) = 0.
# Device
run_on_gpu = False
if run_on_gpu:
assert torch.cuda.is_available(), "No CUDA-enable... | [
"torch.ones_like",
"torch.mean",
"matplotlib.pyplot.show",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.device",
"torch.linspace",
"torch.sin",
"torch.tensor"
] | [((2642, 2652), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (2650, 2652), True, 'import matplotlib.pyplot as plt\n'), ((278, 303), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (301, 303), False, 'import torch\n'), ((347, 367), 'torch.device', 'torch.device', (['"""cuda"""'], {}), ... |
from django import forms
from django.contrib.auth.forms import UserChangeForm
from django.forms import ModelForm
from usuarios.models import MyUser, Person
class SignUpForm(ModelForm):
email = forms.EmailField(required=True)
password = forms.CharField(min_length=6, widget=forms.PasswordInput())
password_... | [
"django.forms.EmailField",
"django.forms.PasswordInput",
"django.forms.ValidationError",
"usuarios.models.MyUser.objects.filter",
"django.forms.CharField"
] | [((200, 231), 'django.forms.EmailField', 'forms.EmailField', ([], {'required': '(True)'}), '(required=True)\n', (216, 231), False, 'from django import forms\n'), ((1243, 1274), 'django.forms.EmailField', 'forms.EmailField', ([], {'required': '(True)'}), '(required=True)\n', (1259, 1274), False, 'from django import form... |
# -*- coding: utf-8 -*-
import click
import logging
import pandas as pd
from pathlib import Path
def main(input_filepath, output_filepath, number_of_households):
""" Runs data processing scripts to turn raw data from (../raw) into
cleaned data ready to be analyzed (saved in ../processed).
"""
logg... | [
"logging.basicConfig",
"pandas.read_csv",
"pathlib.Path",
"pandas.to_datetime",
"pandas.melt",
"logging.getLogger"
] | [((325, 352), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (342, 352), False, 'import logging\n'), ((451, 478), 'pandas.read_csv', 'pd.read_csv', (['input_filepath'], {}), '(input_filepath)\n', (462, 478), True, 'import pandas as pd\n'), ((572, 720), 'pandas.melt', 'pd.melt', (['data'],... |
import pytest
from tartiflette import Resolver, create_engine
_SDL = """
type Query {
hello(name: String = "Unknown"): String
bye(name: String! = "Unknown"): String
}
"""
@pytest.fixture(scope="module")
async def ttftt_engine():
@Resolver("Query.hello", schema_name="test_issue213")
async def resolve_que... | [
"pytest.mark.parametrize",
"tartiflette.Resolver",
"pytest.fixture",
"tartiflette.create_engine"
] | [((180, 210), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (194, 210), False, 'import pytest\n'), ((680, 3247), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""query,variables,expected"""', '[("""\n query {\n hello\n }\n ... |
import json
from brownie import Contract, accounts, config, interface
########################## Global Variables ###########################
MAX_INT = 2**256-1
#######################################################################
def get_abi(abi):
"""
Helper function to load abis
"""
f = open(... | [
"json.load",
"brownie.interface.IAny",
"brownie.accounts.add"
] | [((369, 381), 'json.load', 'json.load', (['f'], {}), '(f)\n', (378, 381), False, 'import json\n'), ((549, 594), 'brownie.accounts.add', 'accounts.add', (["config['wallets']['privateKey']"], {}), "(config['wallets']['privateKey'])\n", (561, 594), False, 'from brownie import Contract, accounts, config, interface\n'), ((9... |
#
# (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt
# AUTHOR : <NAME>
# DATE : June 2020
#
# dGB Keras machine learning models in UserModel format
#
from keras.models import *
from keras.layers import *
from keras import backend as kb
from dgbpy.keras_classes import UserModel, DataPred... | [
"tensorflow.math.log",
"tensorflow.reduce_sum",
"tensorflow.clip_by_value",
"tensorflow.nn.weighted_cross_entropy_with_logits",
"tensorflow.convert_to_tensor",
"keras.backend.epsilon",
"tensorflow.reduce_mean",
"keras.optimizers.Adam",
"tensorflow.cast",
"dgbpy.dgbkeras.getModelDims",
"dgbpy.dgb... | [((413, 442), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', ([], {'value': 'x'}), '(value=x)\n', (433, 442), True, 'import tensorflow as tf\n'), ((982, 1030), 'tensorflow.clip_by_value', 'tf.clip_by_value', (['y_pred', '_epsilon', '(1 - _epsilon)'], {}), '(y_pred, _epsilon, 1 - _epsilon)\n', (998, 1030), True... |
from setuptools import setup, find_packages
classifiers = [
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Education',
'Operating System :: OS Independent',
'License :: OSI Approved :: MIT License',
... | [
"setuptools.find_packages"
] | [((981, 996), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (994, 996), False, 'from setuptools import setup, find_packages\n')] |
#!python3
#-*- coding: utf-8 -*-
import sys
from .agent import Agent
from .connection import QueueCommunicator
from .connection import connect_socket_connection, accept_socket_connections
class AgentServer(QueueCommunicator):
def __init__(self, port=5010):
"""
Args:
port (i... | [
"sys._getframe"
] | [((4406, 4421), 'sys._getframe', 'sys._getframe', ([], {}), '()\n', (4419, 4421), False, 'import sys\n'), ((4931, 4946), 'sys._getframe', 'sys._getframe', ([], {}), '()\n', (4944, 4946), False, 'import sys\n'), ((5558, 5573), 'sys._getframe', 'sys._getframe', ([], {}), '()\n', (5571, 5573), False, 'import sys\n'), ((57... |
#!/usr/bin/env python3
from downloadFistPem import DFPem
from threading import Thread
import urllib.request
import traceback
import socket
import time
def getRequest(url):
req = urllib.request.Request(url)
with urllib.request.urlopen(req) as res:
print(res.read())
def test():
try:
filepat... | [
"threading.Thread",
"socket.gethostname",
"downloadFistPem.DFPem.run",
"time.sleep"
] | [((418, 429), 'downloadFistPem.DFPem.run', 'DFPem.run', ([], {}), '()\n', (427, 429), False, 'from downloadFistPem import DFPem\n'), ((664, 683), 'threading.Thread', 'Thread', ([], {'target': 'test'}), '(target=test)\n', (670, 683), False, 'from threading import Thread\n'), ((738, 751), 'time.sleep', 'time.sleep', (['(... |
'''
@Author: <NAME>
@Date: 2020-04-14 10:32:20
@
# Description:
'''
import torch
import numpy as np
import torch.nn as nn
import time
from torch.autograd import Variable
import sys
import os
sys.path.append(os.path.abspath("utils"))
from config import *
from some_utils import *
def _concat(xs):
return torch.cat([x... | [
"torch.autograd.Variable",
"os.path.abspath",
"torch.no_grad",
"torch.zeros_like"
] | [((209, 233), 'os.path.abspath', 'os.path.abspath', (['"""utils"""'], {}), "('utils')\n", (224, 233), False, 'import os\n'), ((1397, 1420), 'torch.zeros_like', 'torch.zeros_like', (['theta'], {}), '(theta)\n', (1413, 1420), False, 'import torch\n'), ((1938, 1953), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (19... |
# Copyright 2022 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.context.set_context",
"numpy.zeros",
"mindspore.Tensor",
"numpy.array",
"numpy.arange",
"pytest.mark.parametrize"
] | [((2374, 2468), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""func_name"""', "['update', 'min', 'max', 'add', 'sub', 'mul', 'div']"], {}), "('func_name', ['update', 'min', 'max', 'add', 'sub',\n 'mul', 'div'])\n", (2397, 2468), False, 'import pytest\n'), ((2466, 2570), 'pytest.mark.parametrize', 'pytes... |
#!/usr/bin/python3.7
from time import time
data = open("inputs/12.txt").read().split("\n")
initialState = data[0].split()[-1]
stateChanges = dict(map(lambda x: x.split(" => "), data[2:-1]))
leftPad = 3
currentState = leftPad*"." + initialState + "."*80
def doStateChange(current, stateMap):
current = ".."+current+"... | [
"time.time"
] | [((568, 574), 'time.time', 'time', ([], {}), '()\n', (572, 574), False, 'from time import time\n'), ((803, 809), 'time.time', 'time', ([], {}), '()\n', (807, 809), False, 'from time import time\n'), ((773, 779), 'time.time', 'time', ([], {}), '()\n', (777, 779), False, 'from time import time\n'), ((1390, 1396), 'time.t... |
#!/usr/bin/env python3
###############################################################################
# Copyright 2015-2016 <NAME> - License: BSD 2-Clause License
#
# This file is a part of msu-bikedata, which currently licensed for public
# use and distribution under terms of the BSD License. Refer to the 'License'... | [
"os.mkdir",
"yaml.load",
"compiledata._load_building_names",
"random.shuffle",
"yaml.dump",
"compiledata.compile_data",
"os.path.isfile",
"visrep.inspect_summary_reports",
"os.path.join",
"math.radians",
"random.seed",
"math.cos",
"csv.writer",
"math.sqrt",
"math.sin",
"time.sleep",
... | [((1025, 1153), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""MONTESIM:%(levelname)s:%(asctime)s: %(message)s"""', 'filename': 'DEFLOGFILE', 'level': 'logging.INFO'}), "(format=\n 'MONTESIM:%(levelname)s:%(asctime)s: %(message)s', filename=DEFLOGFILE,\n level=logging.INFO)\n", (1044, 1153), ... |
# from util_content_hash import content_hash
from datetime import datetime
import hashlib
import json
import struct
import binascii
from pathlib import Path
from cfs.cfs_base import CFS_Base
#from schemas.schema_aligned_cfs import metadata
# this is an interface for the constant file system. it can be backed by a fi... | [
"hashlib.sha1",
"datetime.datetime.fromtimestamp"
] | [((858, 888), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['raw_ts'], {}), '(raw_ts)\n', (880, 888), False, 'from datetime import datetime\n'), ((3024, 3038), 'hashlib.sha1', 'hashlib.sha1', ([], {}), '()\n', (3036, 3038), False, 'import hashlib\n')] |
import numpy as np
import matplotlib.pyplot as plt
from tqdm import tqdm
from numpy.linalg import matrix_power
from pre_process import *
from eigenfaces import *
import copy
from pre_process import load_mat, separate_data
def save_dataset():
# Load the data from the matrix
X, [y] = load_mat('data/face.mat')
... | [
"numpy.save",
"pre_process.load_mat",
"numpy.load"
] | [((293, 318), 'pre_process.load_mat', 'load_mat', (['"""data/face.mat"""'], {}), "('data/face.mat')\n", (301, 318), False, 'from pre_process import load_mat, separate_data\n'), ((805, 878), 'numpy.save', 'np.save', (["(DATA_DIR + 'processed_raw/data/training.npy')", "dataset['train_x']"], {}), "(DATA_DIR + 'processed_r... |
from __future__ import print_function
import binascii
import json
import os.path
import sys
key_path = sys.argv[1]
key_path_basename = os.path.basename(key_path)
key_h_path = os.path.join(sys.argv[2], key_path_basename + '.h')
key_cc_path = os.path.join(sys.argv[2], key_path_basename + '.cc')
with open(key_path, 'r'... | [
"sys.exit",
"json.load",
"binascii.unhexlify"
] | [((338, 350), 'json.load', 'json.load', (['f'], {}), '(f)\n', (347, 350), False, 'import json\n'), ((413, 443), 'binascii.unhexlify', 'binascii.unhexlify', (["obj['key']"], {}), "(obj['key'])\n", (431, 443), False, 'import binascii\n'), ((536, 547), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (544, 547), False, 'im... |
import os
import time
import tqdm
import cv2
import h5py
from bspt_2d import *
from ops import *
class IMSEG(object):
def __init__(
self,
sess,
phase,
sample_vox_size,
is_training=False,
ef_dim=32,
gf_dim=64,
p_dim=256,
dataset_name="defaul... | [
"cv2.line",
"h5py.File",
"os.makedirs",
"os.path.basename",
"re.finditer",
"os.path.exists",
"time.time",
"os.path.join"
] | [((996, 1026), 'os.path.exists', 'os.path.exists', (['data_hdf5_name'], {}), '(data_hdf5_name)\n', (1010, 1026), False, 'import os\n'), ((10035, 10046), 'time.time', 'time.time', ([], {}), '()\n', (10044, 10046), False, 'import time\n'), ((18985, 19051), 'os.makedirs', 'os.makedirs', (["(config.sample_dir + '/mse_predi... |
# Harris Algorithm for corner detection and features extracting
# R = λ1.λ2 − k(λ1 + λ2)^2
import cv2 as cv
import numpy as np
if __name__ == "__main__":
img = cv.imread('../../assets/test10.jpg')
img = cv.resize(img, None, fx=.5, fy=.5)
cv.imshow("Original Image", img)
# input img of corner har... | [
"cv2.dilate",
"cv2.cvtColor",
"cv2.waitKey",
"numpy.float32",
"cv2.destroyAllWindows",
"cv2.imread",
"cv2.imshow",
"cv2.cornerHarris",
"cv2.resize"
] | [((167, 203), 'cv2.imread', 'cv.imread', (['"""../../assets/test10.jpg"""'], {}), "('../../assets/test10.jpg')\n", (176, 203), True, 'import cv2 as cv\n'), ((214, 250), 'cv2.resize', 'cv.resize', (['img', 'None'], {'fx': '(0.5)', 'fy': '(0.5)'}), '(img, None, fx=0.5, fy=0.5)\n', (223, 250), True, 'import cv2 as cv\n'),... |
#!/usr/bin/env python3
from __future__ import print_function
import sys
import math
import numpy as np
#ROS Imports
import rospy
from sensor_msgs.msg import Image, LaserScan
from ackermann_msgs.msg import AckermannDriveStamped, AckermannDrive
from visualization_msgs.msg import Marker
#RQT reconfigure
from dynamic_rec... | [
"rospy.Subscriber",
"rospy.Time.now",
"rospy.Publisher",
"rospy.sleep",
"numpy.argmin",
"ackermann_msgs.msg.AckermannDriveStamped",
"numpy.insert",
"numpy.append",
"numpy.sin",
"numpy.ones",
"rospy.init_node",
"visualization_msgs.msg.Marker",
"numpy.cos",
"rospy.spin",
"numpy.arctan",
... | [((8326, 8375), 'rospy.init_node', 'rospy.init_node', (['"""FollowGap_node"""'], {'anonymous': '(True)'}), "('FollowGap_node', anonymous=True)\n", (8341, 8375), False, 'import rospy\n'), ((8386, 8431), 'dynamic_reconfigure.server.Server', 'Server', (['gapparamsConfig', 'reconfigure_callback'], {}), '(gapparamsConfig, r... |
"""Check the timezone in configuration file where latitude and longitude are given.
Used by pre-commit."""
import argparse
import json
import sys
from typing import List, Union, Dict
def main(argv: Union[List[str], None] = None) -> int:
argv = argv or sys.argv[1:]
parser = argparse.ArgumentParser()
parse... | [
"json.dump",
"json.load",
"argparse.ArgumentParser",
"sys.exit"
] | [((285, 310), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (308, 310), False, 'import argparse\n'), ((1096, 1107), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1104, 1107), False, 'import sys\n'), ((1303, 1315), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1312, 1315), False, 'import ... |
from django.db import models
from apps.utils.models import TimestampedModel
class Profile(TimestampedModel):
user = models.OneToOneField('authentication.User', on_delete=models.CASCADE)
bio = models.TextField(blank=True)
avatar = models.URLField(blank=True)
followers = models.ManyToManyField('profile... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ManyToManyField",
"django.db.models.URLField"
] | [((123, 192), 'django.db.models.OneToOneField', 'models.OneToOneField', (['"""authentication.User"""'], {'on_delete': 'models.CASCADE'}), "('authentication.User', on_delete=models.CASCADE)\n", (143, 192), False, 'from django.db import models\n'), ((203, 231), 'django.db.models.TextField', 'models.TextField', ([], {'bla... |
import os
from django.conf import settings
from django.db import models
# Create your models here.
class UserSettings(models.Model):
id = models.AutoField(primary_key=True)
author = models.CharField(max_length=100, default='admin')
privilege = models.CharField(max_length=100, default='user'... | [
"django.db.models.CharField",
"django.db.models.AutoField"
] | [((154, 188), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)'}), '(primary_key=True)\n', (170, 188), False, 'from django.db import models\n'), ((206, 255), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'default': '"""admin"""'}), "(max_length=100, default... |
import json
from typing import TYPE_CHECKING
import flask.testing
import pyquery
class Response:
"""A Response wraps a response from a testing Client."""
def __init__(self, response):
self.response = response
@property
def text(self):
return self.response.data.decode(self.response.c... | [
"pyquery.PyQuery",
"json.loads"
] | [((376, 402), 'pyquery.PyQuery', 'pyquery.PyQuery', (['self.text'], {}), '(self.text)\n', (391, 402), False, 'import pyquery\n'), ((453, 474), 'json.loads', 'json.loads', (['self.text'], {}), '(self.text)\n', (463, 474), False, 'import json\n')] |
# https://github.com/NVlabs/latentfusion/blob/master/latentfusion/three/utils.py
import torch
from torch.nn import functional as F
def farthest_points(
data,
n_clusters: int,
dist_func=F.pairwise_distance,
return_center_indexes=True,
return_distances=False,
verbose=False,
init_center=True,... | [
"torch.mean",
"torch.argmax",
"torch.cat",
"torch.full",
"torch.max",
"torch.arange",
"torch.zeros",
"torch.min"
] | [((1287, 1348), 'torch.full', 'torch.full', (['(data.shape[0],)'], {'fill_value': '(-1)', 'dtype': 'torch.long'}), '((data.shape[0],), fill_value=-1, dtype=torch.long)\n', (1297, 1348), False, 'import torch\n'), ((1363, 1404), 'torch.zeros', 'torch.zeros', (['n_clusters'], {'dtype': 'torch.long'}), '(n_clusters, dtype=... |
from app.main import db
def get_available_class_specializations():
conn = db.connect()
cursor = conn.cursor()
cursor.execute("select id, name, color from m_class")
classes = {row[0]: {'name':row[1], 'color':row[2], 'specializations': {}} for row in cursor}
cursor.execute("select id, class_id, name... | [
"app.main.db.connect"
] | [((79, 91), 'app.main.db.connect', 'db.connect', ([], {}), '()\n', (89, 91), False, 'from app.main import db\n'), ((551, 563), 'app.main.db.connect', 'db.connect', ([], {}), '()\n', (561, 563), False, 'from app.main import db\n'), ((813, 825), 'app.main.db.connect', 'db.connect', ([], {}), '()\n', (823, 825), False, 'f... |
from kubernetes import client
from projects.kubernetes.kube_config import load_kube_config
def list_resource_version(group, version, namespace, plural):
"""
Determines the resource version the watcher should list from.
Parameters
----------
group : str
version : str
namespace : str
p... | [
"kubernetes.client.CustomObjectsApi",
"projects.kubernetes.kube_config.load_kube_config"
] | [((377, 395), 'projects.kubernetes.kube_config.load_kube_config', 'load_kube_config', ([], {}), '()\n', (393, 395), False, 'from projects.kubernetes.kube_config import load_kube_config\n'), ((406, 431), 'kubernetes.client.CustomObjectsApi', 'client.CustomObjectsApi', ([], {}), '()\n', (429, 431), False, 'from kubernete... |
from utils.upload_syntetic_data import upload_syntetic_data
from __app__.crop.constants import SQL_CONNECTION_STRING, SQL_TEST_DBNAME
from __app__.crop.db import drop_db
def pytest_configure(config):
"""
Allows plugins and conftest files to perform initial configuration.
This hook is called for every plu... | [
"__app__.crop.db.drop_db",
"utils.upload_syntetic_data.upload_syntetic_data.main"
] | [((492, 534), 'utils.upload_syntetic_data.upload_syntetic_data.main', 'upload_syntetic_data.main', (['SQL_TEST_DBNAME'], {}), '(SQL_TEST_DBNAME)\n', (517, 534), False, 'from utils.upload_syntetic_data import upload_syntetic_data\n'), ((746, 793), '__app__.crop.db.drop_db', 'drop_db', (['SQL_CONNECTION_STRING', 'SQL_TES... |
# -*- coding: utf-8 -*-
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('core', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Competition',
fields=[
('id', models.AutoField(verbos... | [
"django.db.models.OneToOneField",
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.models.PositiveIntegerField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
... | [((7450, 7520), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': '"""entries.SessionRound"""', 'on_delete': 'models.CASCADE'}), "(to='entries.SessionRound', on_delete=models.CASCADE)\n", (7467, 7520), False, 'from django.db import models, migrations\n'), ((7825, 7881), 'django.db.models.ManyToManyField',... |
import os
from pathlib import Path
from typing import Optional, Sequence
from unittest.mock import MagicMock
import pytest
import PIL.Image
from sciencebeam_parser.utils.bounding_box import BoundingBox
from sciencebeam_parser.document.layout_document import (
LOGGER,
LayoutDocument,
LayoutGraphic,
Lay... | [
"unittest.mock.MagicMock",
"sciencebeam_parser.document.layout_document.LayoutGraphic",
"sciencebeam_parser.document.layout_document.LOGGER.debug",
"sciencebeam_parser.document.layout_document.LayoutPageCoordinates",
"sciencebeam_parser.document.layout_document.LayoutPageMeta",
"os.path.basename",
"pyte... | [((725, 770), 'sciencebeam_parser.utils.bounding_box.BoundingBox', 'BoundingBox', ([], {'x': '(10)', 'y': '(10)', 'width': '(10)', 'height': '(100)'}), '(x=10, y=10, width=10, height=100)\n', (736, 770), False, 'from sciencebeam_parser.utils.bounding_box import BoundingBox\n'), ((774, 823), 'pytest.fixture', 'pytest.fi... |
# Generated by Django 2.2.15 on 2020-08-27 21:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wagtailcore', '0045_assign_unlock_grouppagepermission'),
('funds', '0078_add_heading_block_to_form_fields_block'),
... | [
"django.db.models.CharField",
"django.db.models.OneToOneField",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((459, 552), '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", (475, 552), False, 'from django.db import migrations, models\... |
# Generated by Django 2.0.1 on 2018-01-29 20:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ingredient', '0007_remove_ingredient_recipe'),
]
operations = [
migrations.AlterField(
model_na... | [
"django.db.models.ForeignKey"
] | [((392, 530), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""ingredients"""', 'to': '"""ingredient.IngredientGroup"""'}), "(null=True, on_delete=django.db.models.deletion.CASCADE,\n related_name='ingredients', to='ingr... |
# import tensorflow as tf
#
# a = tf.get_variable("a", dtype=tf.int32, shape=[], initializer=tf.zeros_initializer())
# b = tf.get_variable("b", dtype=tf.float32,shape=[], initializer=tf.ones_initializer())
#
# # f = tf.constant(6)
#
# # Definition of condition and body
# def cond(a, b, f):
#
# # a = tf.Print(a,[a, ... | [
"tensorflow.random_uniform",
"tensorflow.python.ops.tensor_array_ops.TensorArray",
"tensorflow.global_variables_initializer",
"tensorflow.add",
"tensorflow.Session",
"tensorflow.constant",
"tensorflow.Variable",
"tensorflow.Print",
"numpy.array",
"tensorflow.while_loop"
] | [((2001, 2111), 'tensorflow.python.ops.tensor_array_ops.TensorArray', 'tensor_array_ops.TensorArray', (['tf.int32'], {'size': '(1)', 'dynamic_size': '(True)', 'infer_shape': '(False)', 'element_shape': '[2, 2]'}), '(tf.int32, size=1, dynamic_size=True,\n infer_shape=False, element_shape=[2, 2])\n', (2029, 2111), Fal... |
"""Dataset implementations to save data for Kedro Experiment Tracking"""
__all__ = ["MetricsDataSet", "JSONDataSet"]
from contextlib import suppress
with suppress(ImportError):
from kedro.extras.datasets.tracking.metrics_dataset import MetricsDataSet
with suppress(ImportError):
from kedro.extras.datasets.tr... | [
"contextlib.suppress"
] | [((158, 179), 'contextlib.suppress', 'suppress', (['ImportError'], {}), '(ImportError)\n', (166, 179), False, 'from contextlib import suppress\n'), ((264, 285), 'contextlib.suppress', 'suppress', (['ImportError'], {}), '(ImportError)\n', (272, 285), False, 'from contextlib import suppress\n')] |
import os, logging, time
from propertysupport import *
from buildcommon import *
from pathsets import *
defineOutputDirProperty('OUTPUT_DIR', None)
from targets.writefile import *
from targets.copy import *
WriteFile('${OUTPUT_DIR}/src-file.txt', 'Hello')
WriteFile('${OUTPUT_DIR}/bar.txt', 'Hello')
Cop... | [
"time.sleep"
] | [((561, 574), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (571, 574), False, 'import os, logging, time\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.8 on 2018-01-18 10:00
from __future__ import unicode_literals
import bluebottle.utils.fields
from decimal import Decimal
from django.db import migrations, models
import django.db.models.deletion
import djmoney.models.fields
class Migration(migrations.Migration):
... | [
"django.db.models.ForeignKey",
"decimal.Decimal",
"django.db.models.CharField",
"django.db.models.AutoField"
] | [((1557, 1669), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""extra"""', 'to': '"""projects.Project"""'}), "(on_delete=django.db.models.deletion.CASCADE, related_name\n ='extra', to='projects.Project')\n", (1574, 1669), False, 'from dj... |
import lz4.stream
import pytest
import sys
_1KB = 1024
_1MB = _1KB * 1024
_1GB = _1MB * 1024
def compress(x, c_kwargs):
c = []
with lz4.stream.LZ4StreamCompressor(**c_kwargs) as proc:
for start in range(0, len(x), c_kwargs['buffer_size']):
chunk = x[start:start + c_kwargs['buffer_size']]... | [
"pytest.importorskip",
"pytest.skip"
] | [((1782, 1816), 'pytest.importorskip', 'pytest.importorskip', (['"""tracemalloc"""'], {}), "('tracemalloc')\n", (1801, 1816), False, 'import pytest\n'), ((1713, 1762), 'pytest.skip', 'pytest.skip', (['"""Py_ssize_t too small for this test"""'], {}), "('Py_ssize_t too small for this test')\n", (1724, 1762), False, 'impo... |
import unittest
import numpy as np
import scipy.linalg as la
from parla.drivers.interpolative import OSID1, OSID2, TSID1
from parla.comps.sketchers.aware import RS1
import parla.comps.sketchers.oblivious as oblivious
import parla.utils.linalg_wrappers as ulaw
import parla.tests.matmakers as matmakers
from parla.tests.t... | [
"parla.drivers.interpolative.TSID1",
"parla.comps.sketchers.oblivious.SkOpGA",
"parla.tests.test_drivers.test_lowrank.test_osid.reference_osid",
"parla.tests.matmakers.rand_low_rank",
"numpy.random.default_rng",
"scipy.linalg.norm",
"parla.comps.sketchers.aware.RS1",
"numpy.eye",
"parla.drivers.inte... | [((450, 477), 'numpy.random.default_rng', 'np.random.default_rng', (['seed'], {}), '(seed)\n', (471, 477), True, 'import numpy as np\n'), ((486, 526), 'parla.tests.matmakers.rand_low_rank', 'matmakers.rand_low_rank', (['m', 'n', 'rank', 'rng'], {}), '(m, n, rank, rng)\n', (509, 526), True, 'import parla.tests.matmakers... |
import os
import pytest
from _pytest.config import Config
from _pytest.fixtures import Parser, FixtureRequest
from database.orm.client import ORMClient
def pytest_addoption(parser: Parser) -> None:
parser.addoption('--username', default="root")
parser.addoption('--password', default="<PASSWORD>")
parser... | [
"database.orm.client.ORMClient",
"pytest.fixture",
"os.path.join"
] | [((712, 743), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (726, 743), False, 'import pytest\n'), ((832, 863), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (846, 863), False, 'import pytest\n'), ((1223, 1254), 'pytest.fixtur... |
# Generated by Django 2.0 on 2017-12-29 15:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bot', '0006_auto_20171229_2354'),
]
operations = [
migrations.AlterField(
model_name='user',
name='authority',
... | [
"django.db.models.CharField"
] | [((331, 445), 'django.db.models.CharField', 'models.CharField', ([], {'choices': "[('Master', 'Master'), ('Editor', 'Editor'), ('Watcher', 'Watcher')]", 'max_length': '(16)'}), "(choices=[('Master', 'Master'), ('Editor', 'Editor'), (\n 'Watcher', 'Watcher')], max_length=16)\n", (347, 445), False, 'from django.db imp... |
"""
市场代码,上海是0, 深圳是1。判断深圳的办法是看代码0或者3开头。
深圳用的是re模块进行分析,上海用的是XPATH,最终存储到ticker_list & ticker_detail
ticker_list 是基础,从网页上爬下来的list。
当replaceFlag(现金替代)True是允许现金替代,False是必须,False也就是意味着reportAmount需要设置为0.
essential:
config.json
geckodriver.exe
run:
poetry run python cash.py
build for exe-onefile:
poetry run pyinstaller cas... | [
"json.load",
"re.split",
"json.loads",
"selenium.webdriver.Firefox",
"time.sleep",
"pendulum.now",
"selenium.webdriver.firefox.options.Options",
"selenium.webdriver.support.ui.WebDriverWait"
] | [((3663, 3693), 're.split', 're.split', (['"""市场\n\\\\s*"""', 'raw_list'], {}), "('市场\\n\\\\s*', raw_list)\n", (3671, 3693), False, 'import re\n'), ((6965, 6974), 'selenium.webdriver.firefox.options.Options', 'Options', ([], {}), '()\n', (6972, 6974), False, 'from selenium.webdriver.firefox.options import Options\n'), ... |
from math import radians, cos, sin, asin, sqrt
def distance(lat1, long1, lat2, long2):
"""
Calculate the great circle distance in meters between two points on
Earth (specified in decimal degrees.)
Taken on May 1st 2013 from http://stackoverflow.com/a/4913653
"""
# Convert decimal degrees to ra... | [
"math.sqrt",
"math.cos",
"math.sin"
] | [((486, 499), 'math.sin', 'sin', (['(dlat / 2)'], {}), '(dlat / 2)\n', (489, 499), False, 'from math import radians, cos, sin, asin, sqrt\n'), ((569, 576), 'math.sqrt', 'sqrt', (['a'], {}), '(a)\n', (573, 576), False, 'from math import radians, cos, sin, asin, sqrt\n'), ((507, 517), 'math.cos', 'cos', (['rlat1'], {}), ... |
# Copyright (c) 2022 NVIDIA CORPORATION. All rights reserved.
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and relate... | [
"xml.etree.ElementTree.parse",
"warp.transform_inverse",
"warp.transform_identity",
"warp.transform_multiply",
"numpy.array",
"warp.quat_from_matrix",
"os.path.splitext",
"numpy.fromstring"
] | [((1012, 1030), 'xml.etree.ElementTree.parse', 'ET.parse', (['filename'], {}), '(filename)\n', (1020, 1030), True, 'import xml.etree.ElementTree as ET\n'), ((6674, 6692), 'xml.etree.ElementTree.parse', 'ET.parse', (['filename'], {}), '(filename)\n', (6682, 6692), True, 'import xml.etree.ElementTree as ET\n'), ((1951, 1... |
#!/usr/bin/env python3
import argparse
import enum
import logging
import os
import platform
import sys
import time
from typing import Any, Callable, Dict, List, Tuple
logging.basicConfig(format='%(asctime)s %(levelname)s: %(message)s', level=logging.INFO)
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirna... | [
"logging.exception",
"argparse.ArgumentParser",
"gpiozero.Button",
"logging.basicConfig",
"calchas.recorder.Recorder",
"os.path.realpath",
"time.sleep",
"logging.info",
"platform.system",
"calchas.trip.TripManager.new"
] | [((169, 262), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s %(levelname)s: %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s %(levelname)s: %(message)s', level=\n logging.INFO)\n", (188, 262), False, 'import logging\n'), ((1819, 1844), 'argparse.ArgumentParser', 'argpa... |
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the 'License');
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, s... | [
"logging.error",
"lib.record.deserialize_record",
"logging.debug",
"base64.b64decode"
] | [((929, 951), 'base64.b64decode', 'base64.b64decode', (['data'], {}), '(data)\n', (945, 951), False, 'import base64\n'), ((963, 990), 'lib.record.deserialize_record', 'deserialize_record', (['message'], {}), '(message)\n', (981, 990), False, 'from lib.record import deserialize_record\n'), ((1602, 1627), 'base64.b64deco... |
import m5
from m5.objects import Cache
from m5.objects import StridePrefetcher
from m5.objects import TaggedPrefetcher
from m5.objects import System
from m5.objects import LRURP
from m5.objects import RandomRP
m5.util.addToPath('../')
from common import ObjectList
class CustStridePref(StridePrefetcher):
def __init... | [
"common.ObjectList.rp_list.get",
"m5.objects.LRURP",
"m5.objects.RandomRP",
"m5.util.addToPath"
] | [((211, 235), 'm5.util.addToPath', 'm5.util.addToPath', (['"""../"""'], {}), "('../')\n", (228, 235), False, 'import m5\n'), ((1210, 1217), 'm5.objects.LRURP', 'LRURP', ([], {}), '()\n', (1215, 1217), False, 'from m5.objects import LRURP\n'), ((2189, 2199), 'm5.objects.RandomRP', 'RandomRP', ([], {}), '()\n', (2197, 21... |
from ipCorePackager.helpers import mkSpiElm, spi_ns_prefix
class Type():
__slots__ = ['name', 'version', 'vendor', 'library']
#@classmethod
# def fromElem(cls, elm):
# self = cls()
# for s in ['name', 'version', 'vendor', 'library']:
# setattr(self, s, elm.attrib[spi_ns_prefix + ... | [
"ipCorePackager.helpers.mkSpiElm"
] | [((389, 406), 'ipCorePackager.helpers.mkSpiElm', 'mkSpiElm', (['elmName'], {}), '(elmName)\n', (397, 406), False, 'from ipCorePackager.helpers import mkSpiElm, spi_ns_prefix\n')] |
"""Tests for the suite8080.asm80 module."""
from unittest import mock
import pytest
from suite8080 import asm80
@pytest.mark.parametrize('source_line, expected', [
# Label, mnemonic, operand1, operand2, comment
#
# Blank line
('', ('', '', '', '', '')),
# All spaces
(' ', ('', '', '', '',... | [
"suite8080.asm80.mov",
"suite8080.asm80.immediate_operand",
"suite8080.asm80.add_label",
"suite8080.asm80.is_char_constant",
"suite8080.asm80.parse_db_arguments",
"unittest.mock.patch",
"suite8080.asm80.write_symbol_table",
"suite8080.asm80.is_quote_delimited",
"suite8080.asm80.parse_db",
"pytest.... | [((118, 1242), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""source_line, expected"""', '[(\'\', (\'\', \'\', \'\', \'\', \'\')), (\' \', (\'\', \'\', \'\', \'\', \'\')), (\'\\t \\t \', (\n \'\', \'\', \'\', \'\', \'\')), (\' ; Comment only\', (\'\', \'\', \'\', \'\',\n \'Comment only\')), (\'l... |
import cv2
cap = cv2.VideoCapture(0)
ret, im = cap.read()
gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
font = cv2.FONT_HERSHEY_SIMPLEX
while True:
ret, im = cap.read()
gray = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY)
cv2.waitKey(25)
score = cv2.Laplacian(gray, cv2.CV_64F).var()
if score < 50:
cv2... | [
"cv2.putText",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.destroyAllWindows",
"cv2.Laplacian"
] | [((18, 37), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (34, 37), False, 'import cv2\n'), ((66, 102), 'cv2.cvtColor', 'cv2.cvtColor', (['im', 'cv2.COLOR_BGR2GRAY'], {}), '(im, cv2.COLOR_BGR2GRAY)\n', (78, 102), False, 'import cv2\n'), ((494, 517), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([... |
# -*- coding: utf-8 -*-
# cython: language_level=3
# BSD 3-Clause License
#
# Copyright (c) 2020-2021, Faster Speeding
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of sour... | [
"inspect.getdoc"
] | [((2334, 2366), 'inspect.getdoc', 'inspect.getdoc', (['command.callback'], {}), '(command.callback)\n', (2348, 2366), False, 'import inspect\n')] |
import logging
from datetime import datetime
from pathlib import Path
from typing import Optional
from urllib.parse import urlparse
import click
import dateutil.tz
from .misc import run_then_cancel, register_clean_shutdown, setup_logging
from .protocol import ServerSession, DuplicateBackup
from .scanner import Scanne... | [
"click.option",
"logging.getLogger",
"click.ClickException",
"click.DateTime",
"pathlib.Path",
"click.group",
"urllib.parse.urlparse"
] | [((332, 359), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (349, 359), False, 'import logging\n'), ((498, 511), 'click.group', 'click.group', ([], {}), '()\n', (509, 511), False, 'import click\n'), ((513, 565), 'click.option', 'click.option', (['"""--database"""'], {'envvar': '"""BACKUP... |
#!/usr/bin/env python -O
"""
This is the test class for testing Glass capacitor module algorithms and models.
"""
# -*- coding: utf-8 -*-
#
# tests.unit.TestGlass.py is part of The RTK Project
#
# All rights reserved.
import sys
from os.path import dirname
sys.path.insert(0, dirname(dirname(dirname(__file__)))... | [
"hardware.component.capacitor.fixed.Glass.Glass",
"os.path.dirname",
"nose.plugins.attrib.attr"
] | [((855, 880), 'nose.plugins.attrib.attr', 'attr', ([], {'all': '(True)', 'unit': '(True)'}), '(all=True, unit=True)\n', (859, 880), False, 'from nose.plugins.attrib import attr\n'), ((2313, 2338), 'nose.plugins.attrib.attr', 'attr', ([], {'all': '(True)', 'unit': '(True)'}), '(all=True, unit=True)\n', (2317, 2338), Fal... |
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 17 18:16:14 2019
@author: Kokkinos
"""
import numpy as np
from base.bci_transducer import Transducer
from base.data_setup import *
from offline import Offline
from Lib.warnings import warn
class Simul(Offline):
def __init__(self, mode = 'IMvsall', tim_window = ... | [
"offline.Offline.__init__",
"scipy.io.loadmat",
"numpy.isnan",
"time.time",
"numpy.where",
"numpy.array",
"numpy.delete"
] | [((6019, 6041), 'numpy.where', 'np.where', (['(LABELS == -1)'], {}), '(LABELS == -1)\n', (6027, 6041), True, 'import numpy as np\n'), ((6068, 6094), 'numpy.where', 'np.where', (['(tst_labels == -1)'], {}), '(tst_labels == -1)\n', (6076, 6094), True, 'import numpy as np\n'), ((6284, 6295), 'time.time', 'time.time', ([],... |
"""
<NAME>
Python 3.8
"""
import sys
from time import sleep
from modules.music_adt import MusicADT
class Menu:
"""
Class for working with Research Program.
"""
def __init__(self):
"""
Initialize menu and program.
"""
print("Welcome to the Genre Research (Spotify)!")
... | [
"time.sleep",
"sys.exit",
"modules.music_adt.MusicADT"
] | [((991, 1036), 'modules.music_adt.MusicADT', 'MusicADT', (['start', 'last'], {'fullmode': 'self.fullmode'}), '(start, last, fullmode=self.fullmode)\n', (999, 1036), False, 'from modules.music_adt import MusicADT\n'), ((3603, 3611), 'time.sleep', 'sleep', (['(3)'], {}), '(3)\n', (3608, 3611), False, 'from time import sl... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
# 导入相关模块
import numpy as np
import random
from random import shuffle
from scipy import io
import scipy.io as iso
from utils import *
# 全局变量,名字库的文件名
DataSet = "name.txt"
def preprocess(data_set=DataSet):
"""
对名字库进行预处理.
参... | [
"numpy.random.seed",
"random.shuffle",
"numpy.zeros",
"scipy.io.savemat",
"numpy.dot"
] | [((1944, 1969), 'numpy.zeros', 'np.zeros', (['(vocab_size, 1)'], {}), '((vocab_size, 1))\n', (1952, 1969), True, 'import numpy as np\n'), ((2018, 2036), 'numpy.zeros', 'np.zeros', (['(n_a, 1)'], {}), '((n_a, 1))\n', (2026, 2036), True, 'import numpy as np\n'), ((2416, 2441), 'numpy.zeros', 'np.zeros', (['(vocab_size, 1... |
import pandas as pd
import seaborn as sns
from matplotlib import pyplot as plt
from sklearn.model_selection import cross_validate, RepeatedKFold
def get_estimator_coefs_for_cv(est, cv_model):
estimator_name = list(cv_model["estimator"][0].named_steps.keys())[-1]
try:
estimator_coefs = est.named_steps... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.axvline",
"matplotlib.pyplot.show",
"matplotlib.pyplot.figure",
"seaborn.boxplot",
"matplotlib.pyplot.subplots_adjust",
"matplotlib.pyplot.xlabel",
"seaborn.stripplot",
"sklearn.model_selection.RepeatedKFold"
] | [((1478, 1504), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(9, 7)'}), '(figsize=(9, 7))\n', (1488, 1504), True, 'from matplotlib import pyplot as plt\n'), ((1513, 1572), 'seaborn.stripplot', 'sns.stripplot', ([], {'data': 'coefs', 'orient': '"""h"""', 'color': '"""k"""', 'alpha': '(0.5)'}), "(data=coef... |
import paho.mqtt.client as mqtt
import configparser
import logging
import json
import paho.mqtt.client as mqtt
class Messaging:
def __init__(self, config, subscription = None, on_message = None, clientId = None):
global on_connect
self.config = config
if (clientId):
self.clien... | [
"paho.mqtt.client.Client"
] | [((324, 337), 'paho.mqtt.client.Client', 'mqtt.Client', ([], {}), '()\n', (335, 337), True, 'import paho.mqtt.client as mqtt\n'), ((378, 399), 'paho.mqtt.client.Client', 'mqtt.Client', (['clientId'], {}), '(clientId)\n', (389, 399), True, 'import paho.mqtt.client as mqtt\n')] |
import numpy as np
import gimpact as gi
# util functions
def gen_cdmesh_vvnf(vertices, vertex_normals, faces):
"""
generate cdmesh given vertices, _, and faces
:return: gimpact.TriMesh (require gimpact to be installed)
author: weiwei
date: 20210118
"""
return gi.TriMesh(vertices, faces.flat... | [
"modeling.collision_model.CollisionModel",
"modeling.geometric_model.gen_sphere",
"gimpact.trimesh_trimesh_collision",
"numpy.array",
"visualization.panda.world.World",
"os.path.join"
] | [((678, 718), 'gimpact.trimesh_trimesh_collision', 'gi.trimesh_trimesh_collision', (['obj0', 'obj1'], {}), '(obj0, obj1)\n', (706, 718), True, 'import gimpact as gi\n'), ((892, 911), 'numpy.array', 'np.array', (['[0, 0, 1]'], {}), '([0, 0, 1])\n', (900, 911), True, 'import numpy as np\n'), ((3369, 3427), 'visualization... |
#!/usr/bin/env python3
'''This script is assumed to run from the project root'''
import subprocess as sp
import itertools as it
import os.path as op
import os
import sys
import collections as col
import json
from deepmerge import always_merger
from pathlib import Path
from util import *
CONFIG_NAMES = [op.splitext(op.... | [
"os.makedirs",
"json.loads",
"os.path.basename",
"collections.defaultdict",
"itertools.groupby",
"os.path.join",
"os.chdir"
] | [((525, 567), 'os.path.join', 'op.join', (['NATIVE_FILES_DIR', "(config + '.txt')"], {}), "(NATIVE_FILES_DIR, config + '.txt')\n", (532, 567), True, 'import os.path as op\n'), ((1162, 1194), 'collections.defaultdict', 'col.defaultdict', (['rec_defaultdict'], {}), '(rec_defaultdict)\n', (1177, 1194), True, 'import colle... |
import pandas as pd
import numpy as np
import re
import nltk
import plotly.express as px
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from wordcloud import WordCloud
import matplotlib.pyplot as plt
from sklearn.feature_extraction.text import CountVectorizer
df=pd.read_csv('tweets.csv')... | [
"sklearn.feature_extraction.text.CountVectorizer",
"matplotlib.pyplot.show",
"nltk.corpus.stopwords.extend",
"nltk.tokenize.word_tokenize",
"pandas.read_csv",
"matplotlib.pyplot.imshow",
"wordcloud.WordCloud",
"matplotlib.pyplot.update_layout",
"matplotlib.pyplot.axis",
"plotly.express.bar",
"ma... | [((295, 320), 'pandas.read_csv', 'pd.read_csv', (['"""tweets.csv"""'], {}), "('tweets.csv')\n", (306, 320), True, 'import pandas as pd\n'), ((1523, 1565), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(8, 8)', 'facecolor': 'None'}), '(figsize=(8, 8), facecolor=None)\n', (1533, 1565), True, 'import matplot... |
"""
"""
from .base_model import Entity, column_info
import uuid
class Environment(Entity):
"""
Represents an enclosure / environment.
More specifically, represents a singular deployment of
`EnvironmentNode`.
"""
def __init__(self, *args, **kwargs):
Entity.__init__(self, *args, **kwar... | [
"uuid.UUID"
] | [((613, 627), 'uuid.UUID', 'uuid.UUID', (['val'], {}), '(val)\n', (622, 627), False, 'import uuid\n')] |