code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import logging
import time
try:
from urllib2 import HTTPError, urlopen
except ImportError:
from urllib.request import urlopen
from urllib.error import HTTPError
import json
import os
import subprocess
import click
import requests
@click.command(short_help='Classifies datapoints from json input file.')
d... | [
"json.load",
"json.loads",
"json.dumps",
"time.time",
"click.command",
"requests.request",
"logging.getLogger"
] | [((247, 318), 'click.command', 'click.command', ([], {'short_help': '"""Classifies datapoints from json input file."""'}), "(short_help='Classifies datapoints from json input file.')\n", (260, 318), False, 'import click\n'), ((1650, 1669), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1667, 1669), False,... |
from analysis import plot_graphs_df
from training import preprocess_doc2vec_models, preprocess_tfidf_models
if __name__ == "__main__":
csv_file_list = ['./stackoverflow/train.csv', './stackoverflow/valid.csv']
print('Some useful data insights')
plot_graphs_df(csv_file_list)
print('Predictive Ana... | [
"training.preprocess_tfidf_models",
"analysis.plot_graphs_df",
"training.preprocess_doc2vec_models"
] | [((264, 293), 'analysis.plot_graphs_df', 'plot_graphs_df', (['csv_file_list'], {}), '(csv_file_list)\n', (278, 293), False, 'from analysis import plot_graphs_df\n'), ((332, 370), 'training.preprocess_tfidf_models', 'preprocess_tfidf_models', (['csv_file_list'], {}), '(csv_file_list)\n', (355, 370), False, 'from trainin... |
# **********************************************************************
# Copyright (C) 2020 Johns Hopkins University Applied Physics Laboratory
#
# All Rights Reserved.
# For any other permission, please contact the Legal Office at JHU/APL.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# y... | [
"system.models.schemas_loader.SchemaLoader.get_model",
"shared.log.logger.error",
"shared.log.logger.log",
"datetime.datetime.utcnow",
"system.models.schemas_loader.SchemaLoader.get_queryset"
] | [((1249, 1286), 'system.models.schemas_loader.SchemaLoader.get_queryset', 'SchemaLoader.get_queryset', (['collection'], {}), '(collection)\n', (1274, 1286), False, 'from system.models.schemas_loader import SchemaLoader\n'), ((1403, 1430), 'shared.log.logger.log', 'logger.log', (['"""Invalid model"""'], {}), "('Invalid ... |
import random
from rest_framework.settings import api_settings
from django.conf import settings
from django.contrib.gis.geos import Point
from django.shortcuts import get_object_or_404
from django.db.models import Prefetch
from rest_framework import mixins
from rest_framework import viewsets
from rest_framework impo... | [
"django.contrib.gis.geos.Point",
"random.choices",
"froide.foirequest.api_views.throttle_action",
"django.shortcuts.get_object_or_404",
"rest_framework.response.Response",
"rest_framework.decorators.action",
"froide.foirequest.models.FoiRequest.objects.order_by"
] | [((2859, 2898), 'froide.foirequest.api_views.throttle_action', 'throttle_action', (['(AddLocationThrottle,)'], {}), '((AddLocationThrottle,))\n', (2874, 2898), False, 'from froide.foirequest.api_views import throttle_action\n'), ((5087, 5125), 'rest_framework.decorators.action', 'action', ([], {'detail': '(False)', 'me... |
"""
urlresolver XBMC Addon
Copyright (C) 2011 t0mm0
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
... | [
"re.search",
"re.compile",
"t0mm0.common.net.Net"
] | [((1239, 1244), 't0mm0.common.net.Net', 'Net', ([], {}), '()\n', (1242, 1244), False, 'from t0mm0.common.net import Net\n'), ((2141, 2177), 're.search', 're.search', (['"""//(.+?)/embed/(.+)"""', 'url'], {}), "('//(.+?)/embed/(.+)', url)\n", (2150, 2177), False, 'import re\n'), ((1493, 1529), 're.compile', 're.compile'... |
from django.urls import reverse_lazy
from rest_framework import serializers
from .models import Institution, Person, Place, Event, Work
import re
class InstitutionSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Institution
fields = ('id', 'name', 'uri_set', 'kind', 'colle... | [
"re.match"
] | [((2769, 2817), 're.match', 're.match', (['"""([A-Z][a-z]+)([A-Z][a-z]+)$"""', 'ent_obj'], {}), "('([A-Z][a-z]+)([A-Z][a-z]+)$', ent_obj)\n", (2777, 2817), False, 'import re\n')] |
#!/usr/bin/env python
"""
:copyright: (c) 2015 by <NAME>
:license: MIT, see LICENSE for more details.
"""
import unittest
import urllib
from urlparse import ParseResult
import requests
import ninka
class TestEndpoint(unittest.TestCase):
def runTest(self):
me = 'http://127.0.0.1:9999'
r = ninka.d... | [
"ninka.discoverMicropubEndpoints"
] | [((313, 348), 'ninka.discoverMicropubEndpoints', 'ninka.discoverMicropubEndpoints', (['me'], {}), '(me)\n', (344, 348), False, 'import ninka\n')] |
import unittest
from unittest import mock
from kafka.errors import NoBrokersAvailable
from ..producer import Producer
class ProducerTest(unittest.TestCase):
@mock.patch("kafka_postgres.kafka_helper.producer.KafkaProducer")
def test_failed_to_connect(self, mock_kafka_producer):
mock_kafka_producer.s... | [
"unittest.mock.patch",
"unittest.main",
"unittest.mock.Mock"
] | [((167, 231), 'unittest.mock.patch', 'mock.patch', (['"""kafka_postgres.kafka_helper.producer.KafkaProducer"""'], {}), "('kafka_postgres.kafka_helper.producer.KafkaProducer')\n", (177, 231), False, 'from unittest import mock\n'), ((535, 599), 'unittest.mock.patch', 'mock.patch', (['"""kafka_postgres.kafka_helper.consum... |
#
# 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 appli... | [
"argparse.ArgumentParser"
] | [((1331, 1358), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['""""""'], {}), "('')\n", (1354, 1358), False, 'import argparse\n')] |
from src.holdings_publish_service import *
from src.holding import Holding
from src.holding_schema import HoldingSchema
import src.sns_client
from decimal import Decimal
import json
holdings_url = 'https://www.xyz.com/bla?foo=bar'
topic_arn = 'arn:dummy-sns-topic'
holding1 = Holding(**{
"name": "Commonwealth Bank ... | [
"src.holding_schema.HoldingSchema",
"decimal.Decimal"
] | [((830, 845), 'src.holding_schema.HoldingSchema', 'HoldingSchema', ([], {}), '()\n', (843, 845), False, 'from src.holding_schema import HoldingSchema\n'), ((873, 888), 'src.holding_schema.HoldingSchema', 'HoldingSchema', ([], {}), '()\n', (886, 888), False, 'from src.holding_schema import HoldingSchema\n'), ((417, 435)... |
from django.urls import path
from . import views
app_name = 'twilioconfig'
urlpatterns = [
path('receive/', views.receive, name='receive'),
path('config/', views.configure, name='configure'),
path('update/', views.updateNumbers, name='update_numbers'),
path('obtain/', views.obtain_number, name='obtain... | [
"django.urls.path"
] | [((97, 144), 'django.urls.path', 'path', (['"""receive/"""', 'views.receive'], {'name': '"""receive"""'}), "('receive/', views.receive, name='receive')\n", (101, 144), False, 'from django.urls import path\n'), ((150, 200), 'django.urls.path', 'path', (['"""config/"""', 'views.configure'], {'name': '"""configure"""'}), ... |
from __future__ import print_function, division
import numpy as np
import imgaug as ia
from imgaug import augmenters as iaa
def main():
quokka = ia.quokka(size=0.5)
h, w = quokka.shape[0:2]
heatmap = np.zeros((h, w), dtype=np.float32)
heatmap[70:120, 90:150] = 0.1
heatmap[30:70, 50:65] = 0.5
... | [
"imgaug.HeatmapsOnImage",
"imgaug.augmenters.ElasticTransformation",
"imgaug.draw_grid",
"imgaug.quokka",
"numpy.zeros",
"numpy.hstack",
"imgaug.augmenters.Affine",
"imgaug.augmenters.PerspectiveTransform",
"imgaug.augmenters.CropAndPad",
"imgaug.augmenters.Scale",
"imgaug.augmenters.PiecewiseAf... | [((153, 172), 'imgaug.quokka', 'ia.quokka', ([], {'size': '(0.5)'}), '(size=0.5)\n', (162, 172), True, 'import imgaug as ia\n'), ((216, 250), 'numpy.zeros', 'np.zeros', (['(h, w)'], {'dtype': 'np.float32'}), '((h, w), dtype=np.float32)\n', (224, 250), True, 'import numpy as np\n'), ((399, 457), 'imgaug.HeatmapsOnImage'... |
import unittest
from mygrations.helpers.dotenv import dotenv
import io
import tempfile
class test_dotenv_get_contents(unittest.TestCase):
dotenv = None
test_string = 'test string'
def setUp(self):
self.dotenv = dotenv()
# get_contents should accept a number of parameters.
# It should ac... | [
"mygrations.helpers.dotenv.dotenv",
"tempfile.TemporaryFile",
"io.StringIO",
"tempfile.gettempdir"
] | [((235, 243), 'mygrations.helpers.dotenv.dotenv', 'dotenv', ([], {}), '()\n', (241, 243), False, 'from mygrations.helpers.dotenv import dotenv\n'), ((759, 783), 'tempfile.TemporaryFile', 'tempfile.TemporaryFile', ([], {}), '()\n', (781, 783), False, 'import tempfile\n'), ((1088, 1109), 'tempfile.gettempdir', 'tempfile.... |
import zmq
from functools import wraps
import pickle
import joblib
import time
class TaskZMQ():
def __init__(self):
self.context = zmq.Context()
self.taskdb = {}
self.server = "tcp://127.0.0.1:5555"
def create_socket(self, *arg):
return self.context.socket(*arg)
... | [
"pickle.loads",
"time.perf_counter",
"functools.wraps",
"zmq.Context",
"pickle.dumps"
] | [((149, 162), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (160, 162), False, 'import zmq\n'), ((394, 403), 'functools.wraps', 'wraps', (['fn'], {}), '(fn)\n', (399, 403), False, 'from functools import wraps\n'), ((619, 637), 'pickle.dumps', 'pickle.dumps', (['task'], {}), '(task)\n', (631, 637), False, 'import pick... |
from flask import Blueprint
# Create blueprint for movies module
mod_movies = Blueprint('movies', __name__)
from imdb_rest.movies.movies import *
| [
"flask.Blueprint"
] | [((80, 109), 'flask.Blueprint', 'Blueprint', (['"""movies"""', '__name__'], {}), "('movies', __name__)\n", (89, 109), False, 'from flask import Blueprint\n')] |
# -*- coding: utf-8 -*-
from cdn_static_website.settings.components import BASE_DIR, config
# Password validation
# https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidato... | [
"cdn_static_website.settings.components.config"
] | [((770, 797), 'cdn_static_website.settings.components.config', 'config', (['"""DJANGO_SECRET_KEY"""'], {}), "('DJANGO_SECRET_KEY')\n", (776, 797), False, 'from cdn_static_website.settings.components import BASE_DIR, config\n')] |
from flask import render_template, redirect, url_for, flash, request
from flask_login import login_user, logout_user, current_user, login_required
from portunus import db
from portunus.auth import bp
from portunus.auth.forms import LoginForm, RegistrationForm, UpdateAccountForm
from portunus.models import User
@bp.ro... | [
"portunus.auth.forms.LoginForm",
"portunus.db.session.add",
"portunus.auth.bp.route",
"portunus.auth.forms.UpdateAccountForm",
"flask.flash",
"flask.request.args.get",
"flask_login.login_user",
"flask_login.logout_user",
"portunus.models.User",
"flask.url_for",
"portunus.db.session.commit",
"f... | [((315, 361), 'portunus.auth.bp.route', 'bp.route', (['"""/register"""'], {'methods': "['GET', 'POST']"}), "('/register', methods=['GET', 'POST'])\n", (323, 361), False, 'from portunus.auth import bp\n'), ((918, 961), 'portunus.auth.bp.route', 'bp.route', (['"""/login"""'], {'methods': "['GET', 'POST']"}), "('/login', ... |
import requests
def return_data_zip_code(zipcode):
response = requests.get('https://viacep.com.br/ws/{}/json/' .format(zipcode))
print(response.status_code)
print(response.json())
print(type(response.json()))
data_zip_code = response.json()
print(data_zip_code['logradouro'])
print(data_zip... | [
"requests.get"
] | [((591, 608), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (603, 608), False, 'import requests\n')] |
import csv
import pytest
from telemetry_loader.streams.core import consume
from telemetry_loader.streams.core import stream
from telemetry_loader.streams.pipes import csv_pipe
from telemetry_loader.streams.pipes import json_pipe
pytestmark = pytest.mark.asyncio
async def test_dict_reader():
run, _ = stream([b'... | [
"telemetry_loader.streams.core.stream",
"telemetry_loader.streams.pipes.json_pipe",
"telemetry_loader.streams.pipes.csv_pipe"
] | [((310, 362), 'telemetry_loader.streams.core.stream', 'stream', (["[b'f1,f2\\n', b'v1.1,v1.2\\n', b'v2.1,v2.2\\n']"], {}), "([b'f1,f2\\n', b'v1.1,v1.2\\n', b'v2.1,v2.2\\n'])\n", (316, 362), False, 'from telemetry_loader.streams.core import stream\n'), ((365, 389), 'telemetry_loader.streams.pipes.csv_pipe', 'csv_pipe', ... |
import pytest
import numpy as np
import pclpy
def test_eigen_vectorxf():
a = np.array([1, 1, 1, 1], "f")
vec = pclpy.pcl.vectors.VectorXf(a)
assert np.allclose(np.array(vec), a)
| [
"numpy.array",
"pclpy.pcl.vectors.VectorXf"
] | [((84, 111), 'numpy.array', 'np.array', (['[1, 1, 1, 1]', '"""f"""'], {}), "([1, 1, 1, 1], 'f')\n", (92, 111), True, 'import numpy as np\n'), ((122, 151), 'pclpy.pcl.vectors.VectorXf', 'pclpy.pcl.vectors.VectorXf', (['a'], {}), '(a)\n', (148, 151), False, 'import pclpy\n'), ((175, 188), 'numpy.array', 'np.array', (['ve... |
import requests
import logging
import telegram
import time
import info
from bs4 import BeautifulSoup
from movie import imdbMovie
from vocabulary import Vocab
from weather import weathers
from horoscope import horoscope
from reddit_meme import reddit
from pandemic_new import hot_corona
##################################... | [
"reddit_meme.reddit",
"logging.basicConfig",
"selenium.webdriver.Firefox",
"pandemic_new.hot_corona",
"time.sleep",
"telegram.Bot",
"vocabulary.Vocab",
"requests.get",
"info.welcome.format"
] | [((885, 915), 'telegram.Bot', 'telegram.Bot', ([], {'token': 'self.token'}), '(token=self.token)\n', (897, 915), False, 'import telegram\n'), ((924, 1031), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format=\n ... |
from numeric_edahelper.flag_outliers import flag_outliers
import pandas as pd
import pytest
def test_flag_outliers():
"""
Test the correct output of variables containing outliers from given df
"""
df = pd.DataFrame({'col1': [-100,-200, 1,2,3,4,5,6,7,8,9,10, 1000],
'col2': [1,2,3,4... | [
"pandas.DataFrame",
"numeric_edahelper.flag_outliers.flag_outliers",
"pytest.raises"
] | [((221, 412), 'pandas.DataFrame', 'pd.DataFrame', (["{'col1': [-100, -200, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1000], 'col2': [1, 2, \n 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13], 'col3': [-50, 1, 2, 3, 4, 5, 6, 7,\n 8, 9, 10, 11, 50000]}"], {}), "({'col1': [-100, -200, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1000],\n 'col2': [1,... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Input files for this script are hpoTermDef.obo (downloaded from HPO, flat file of HPO term defs),
# OMIM_NumList.csv (list of OMIM Nums generated by OMIMdisease scripts, and phenotype_annotation.tab,
# a file downloaded from the online HPO, that maps HPO terms onto OMIM disea... | [
"pandas.read_csv",
"pandas.merge",
"pandas.DataFrame"
] | [((894, 988), 'pandas.read_csv', 'pd.read_csv', (['"""inputFile/phenotype_annotation.tab"""'], {'sep': '"""\t"""', 'index_col': '(0)', 'low_memory': '(False)'}), "('inputFile/phenotype_annotation.tab', sep='\\t', index_col=0,\n low_memory=False)\n", (905, 988), True, 'import pandas as pd\n'), ((1026, 1085), 'pandas.... |
from django.core.files.storage import get_storage_class
from django.shortcuts import redirect
from django.utils.cache import add_never_cache_headers
from storages.backends.s3boto3 import S3Boto3Storage
from wagtail.core import hooks
from wagtail.documents import get_document_model
from wagtail.documents.models import ... | [
"wagtail.documents.get_document_model",
"wagtail.core.hooks.register",
"django.shortcuts.redirect",
"django.core.files.storage.get_storage_class",
"django.utils.cache.add_never_cache_headers"
] | [((339, 389), 'wagtail.core.hooks.register', 'hooks.register', (['"""before_serve_document"""'], {'order': '(100)'}), "('before_serve_document', order=100)\n", (353, 389), False, 'from wagtail.core import hooks\n'), ((969, 1010), 'wagtail.core.hooks.register', 'hooks.register', (['"""construct_settings_menu"""'], {}), ... |
#!/usr/bin/env python3
from pyln.client import Plugin
plugin = Plugin()
@plugin.hook('custommsg')
def on_custommsg(peer_id, payload, plugin, message=None, **kwargs):
plugin.log("Got custommessage_a {msg} from peer {peer_id}".format(
msg=payload,
peer_id=peer_id
))
return {'result': 'conti... | [
"pyln.client.Plugin"
] | [((64, 72), 'pyln.client.Plugin', 'Plugin', ([], {}), '()\n', (70, 72), False, 'from pyln.client import Plugin\n')] |
# Copyright 2021 Google Inc. 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 applicable law or agreed ... | [
"pathlib.Path",
"os.walk",
"os.path.exists",
"os.sep.join"
] | [((806, 854), 'os.walk', 'os.walk', (['self.wrapper.destination'], {'topdown': '(False)'}), '(self.wrapper.destination, topdown=False)\n', (813, 854), False, 'import os\n'), ((1001, 1021), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1015, 1021), False, 'import os\n'), ((965, 982), 'os.sep.join', 'o... |
"""
bandage, v1.0.
Made by perpetualCreations
"""
from platform import system
from hashlib import md5
from time import time
from tempfile import gettempdir
from os import mkdir, path, remove, listdir
from shutil import unpack_archive, copyfile, make_archive, rmtree, copytree
from io import StringIO
from contextlib im... | [
"filecmp.cmpfiles",
"io.StringIO",
"json.load",
"os.path.isdir",
"tempfile.gettempdir",
"time.time",
"os.path.isfile",
"contextlib.redirect_stdout",
"urllib3.PoolManager",
"os.path.splitext",
"os.path.split",
"os.path.join",
"os.listdir"
] | [((820, 893), 'filecmp.cmpfiles', 'filecmp.cmpfiles', (['self.left', 'self.right', 'self.common_files'], {'shallow': '(False)'}), '(self.left, self.right, self.common_files, shallow=False)\n', (836, 893), False, 'import filecmp\n'), ((1429, 1450), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (1448, 1... |
import json
from fhir_types import FHIR_CodeableConcept
from google.fhir.r4.json_format import json_fhir_string_to_proto
from proto.google.fhir.proto.r4.core import datatypes_pb2
from fhir_helpers.resources.codeable_concept import (
CodeableConceptDict,
CodeableConceptProto,
)
def test_get_codings() -> None... | [
"fhir_helpers.resources.codeable_concept.CodeableConceptDict",
"json.dumps"
] | [((793, 826), 'fhir_helpers.resources.codeable_concept.CodeableConceptDict', 'CodeableConceptDict', (['test_concept'], {}), '(test_concept)\n', (812, 826), False, 'from fhir_helpers.resources.codeable_concept import CodeableConceptDict, CodeableConceptProto\n'), ((916, 940), 'json.dumps', 'json.dumps', (['test_concept'... |
"""
Copyright 2019 <NAME>
Copyright 2019 The University of Texas at Austin
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 ... | [
"os.path.join",
"os.path.exists",
"os.makedirs"
] | [((2405, 2431), 'os.path.exists', 'os.path.exists', (['out_f_dir2'], {}), '(out_f_dir2)\n', (2419, 2431), False, 'import os\n'), ((2439, 2462), 'os.makedirs', 'os.makedirs', (['out_f_dir2'], {}), '(out_f_dir2)\n', (2450, 2462), False, 'import os\n'), ((2480, 2523), 'os.path.join', 'os.path.join', (['out_f_dir1', '"""vg... |
'''Autogenerated by xml_generate script, do not edit!'''
from OpenGL import platform as _p, arrays
# Code generation uses this
from OpenGL.raw.GLES2 import _types as _cs
# End users want this...
from OpenGL.raw.GLES2._types import *
from OpenGL.raw.GLES2 import _errors
from OpenGL.constant import Constant as _C
... | [
"OpenGL.constant.Constant",
"OpenGL.platform.createFunction"
] | [((555, 591), 'OpenGL.constant.Constant', '_C', (['"""GL_UNPACK_ROW_LENGTH_EXT"""', '(3314)'], {}), "('GL_UNPACK_ROW_LENGTH_EXT', 3314)\n", (557, 591), True, 'from OpenGL.constant import Constant as _C\n'), ((620, 657), 'OpenGL.constant.Constant', '_C', (['"""GL_UNPACK_SKIP_PIXELS_EXT"""', '(3316)'], {}), "('GL_UNPACK_... |
import numpy as np
import cv2
# import faces CascadeClassifier
face_cascade = cv2.CascadeClassifier("/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml")
def find_marker(image):
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray,(5,5),0)
edged = cv2.Canny(gray,35,12... | [
"cv2.minAreaRect",
"cv2.GaussianBlur",
"cv2.Canny",
"cv2.putText",
"cv2.cvtColor",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.imread",
"cv2.rectangle",
"cv2.CascadeClassifier",
"cv2.destroyAllWindows"
] | [((79, 181), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml"""'], {}), "(\n '/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_default.xml')\n", (100, 181), False, 'import cv2\n'), ((1149, 1175), 'cv2.imread', 'cv2.imread', ... |
"""
Hackernews data via Dogsheep [[hacker-news-to-sqlite][https://github.com/dogsheep/hacker-news-to-sqlite]]
"""
from __future__ import annotations
from dataclasses import dataclass
from datetime import datetime
from typing import Iterator, Sequence, Optional, Dict
from my.config import hackernews as user_config
... | [
"dataclasses.dataclass",
"datetime.datetime.fromtimestamp"
] | [((885, 912), 'dataclasses.dataclass', 'dataclass', ([], {'unsafe_hash': '(True)'}), '(unsafe_hash=True)\n', (894, 912), False, 'from dataclasses import dataclass\n'), ((1684, 1717), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (["r['time']"], {}), "(r['time'])\n", (1706, 1717), False, 'from datetime im... |
# Generated by Django 3.0.3 on 2020-11-10 07:56
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('structure', '0032_structure_author_state'),
]
operations = [
migrations.RemoveField(
model_name... | [
"django.db.migrations.RemoveField",
"django.db.models.DecimalField",
"django.db.models.ForeignKey"
] | [((274, 344), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""structuremodelrmsd"""', 'name': '"""TM_all"""'}), "(model_name='structuremodelrmsd', name='TM_all')\n", (296, 344), False, 'from django.db import migrations, models\n'), ((389, 457), 'django.db.migrations.RemoveField', '... |
## UnitUtil
##
## Utilities for dealing with Civ4 Units and their related objects.
##
## Copyright (c) 2008 The BUG Mod.
##
## Author: EmperorFool
from CvPythonExtensions import *
import BugUtil
import PlayerUtil
# BUG - Mac Support - start
BugUtil.fixSets(globals())
# BUG - Mac Support - end
gc = Cy... | [
"PlayerUtil.playerCities",
"BugUtil.debug",
"PlayerUtil.getPlayerCities",
"PlayerUtil.getPlayerTeamAndID",
"PlayerUtil.getPlayerAndTeam",
"PlayerUtil.getTeamID",
"PlayerUtil.isSaltWaterPort",
"PlayerUtil.getPlayer"
] | [((7353, 7392), 'PlayerUtil.getPlayerAndTeam', 'PlayerUtil.getPlayerAndTeam', (['playerOrID'], {}), '(playerOrID)\n', (7380, 7392), False, 'import PlayerUtil\n'), ((7597, 7636), 'PlayerUtil.getPlayerAndTeam', 'PlayerUtil.getPlayerAndTeam', (['playerOrID'], {}), '(playerOrID)\n', (7624, 7636), False, 'import PlayerUtil\... |
import json
import pandas as pd
from werkzeug.security import generate_password_hash, check_password_hash
import sqlalchemy as sa
from api.sqlalchemy import Base
class User(Base):
__tablename__ = 'user'
id = sa.Column(sa.Integer, primary_key=True)
email = sa.Column(sa.String(100))
password = sa.Col... | [
"sqlalchemy.sql.schema.UniqueConstraint",
"sqlalchemy.ForeignKey",
"sqlalchemy.orm.relationship",
"werkzeug.security.check_password_hash",
"sqlalchemy.Column",
"sqlalchemy.String",
"werkzeug.security.generate_password_hash"
] | [((221, 260), 'sqlalchemy.Column', 'sa.Column', (['sa.Integer'], {'primary_key': '(True)'}), '(sa.Integer, primary_key=True)\n', (230, 260), True, 'import sqlalchemy as sa\n'), ((314, 334), 'sqlalchemy.Column', 'sa.Column', (['sa.String'], {}), '(sa.String)\n', (323, 334), True, 'import sqlalchemy as sa\n'), ((390, 410... |
"""
class for running sqs message launcher
Created December 22nd, 2016
@author: <NAME>
@version: 0.1.0
@license: Apache
"""
# ================
# start imports
# ================
import json
import logging
import os
import boto3
import boto3.session
# ================
# start class
# ================
sqs_logger = ... | [
"boto3.Session",
"json.dumps",
"os.environ.get",
"boto3.session.Session",
"logging.getLogger"
] | [((320, 353), 'logging.getLogger', 'logging.getLogger', (['"""sqs_listener"""'], {}), "('sqs_listener')\n", (337, 353), False, 'import logging\n'), ((1762, 1785), 'boto3.session.Session', 'boto3.session.Session', ([], {}), '()\n', (1783, 1785), False, 'import boto3\n'), ((1451, 1489), 'os.environ.get', 'os.environ.get'... |
# Generated by Django 2.2.6 on 2019-10-29 11:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('neigh1', '0029_auto_20191029_1436'),
]
operations = [
migrations.DeleteModel(
name='NeighborhoodPost',
),
]
| [
"django.db.migrations.DeleteModel"
] | [((226, 273), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""NeighborhoodPost"""'}), "(name='NeighborhoodPost')\n", (248, 273), False, 'from django.db import migrations\n')] |
#
# Copyright (c) 2017-2021 Wind River Systems, Inc.
#
# SPDX-License-Identifier: Apache-2.0
#
"""
Tests for the API /certificate_install/delete methods.
"""
import json
import mock
import os
import sys
import uuid as UUID
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from six... | [
"uuid.uuid4",
"sysinv.api.controllers.v1.certificate._check_cert_dns_name",
"sysinv.tests.db.utils.create_test_isystem",
"json.loads",
"os.path.dirname",
"mock.patch",
"sysinv.tests.db.utils.create_test_certificate",
"mock.MagicMock",
"cryptography.hazmat.backends.default_backend"
] | [((1318, 1334), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (1332, 1334), False, 'import mock\n'), ((2313, 2362), 'sysinv.api.controllers.v1.certificate._check_cert_dns_name', 'cert_api._check_cert_dns_name', (['cert', '"""vbox.local"""'], {}), "(cert, 'vbox.local')\n", (2342, 2362), True, 'from sysinv.api.co... |
# -*- coding: UTF8 -*-
'''
Web status database unit tests
@author: <NAME>
@version: 1.1
'''
import unittest
from database.utils.configuration import DBConfigurator
from database.systemStatusDB.systemStatusDBReader import SystemStatusDatabaseReader
from database.systemStatusDB.systemStatusDBWriter import SystemStatusDa... | [
"unittest.main",
"database.systemStatusDB.systemStatusDBWriter.SystemStatusDatabaseWriter",
"database.systemStatusDB.systemStatusDBReader.SystemStatusDatabaseReader",
"database.utils.configuration.DBConfigurator"
] | [((5166, 5181), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5179, 5181), False, 'import unittest\n'), ((418, 436), 'database.utils.configuration.DBConfigurator', 'DBConfigurator', (['""""""'], {}), "('')\n", (432, 436), False, 'from database.utils.configuration import DBConfigurator\n'), ((726, 800), 'database... |
#! /usr/bin/env python3
import itertools as it
import re
import sys
from typing import Generator, Iterable, List, Match, Optional, Tuple
test = False
if len(sys.argv) > 1:
if sys.argv[1] == "--test":
test = True
# Utilities
def rematch(pattern: str, string: str) -> Optional[Match]:
return re.fullmat... | [
"re.fullmatch",
"itertools.product"
] | [((310, 339), 're.fullmatch', 're.fullmatch', (['pattern', 'string'], {}), '(pattern, string)\n', (322, 339), False, 'import re\n'), ((5258, 5289), 'itertools.product', 'it.product', (['"""01"""'], {'repeat': 'num_xs'}), "('01', repeat=num_xs)\n", (5268, 5289), True, 'import itertools as it\n')] |
from setuptools import setup, find_packages
from os import path
here = path.abspath(path.dirname(__file__))
with open(path.join(here, "README.md"), encoding = "utf-8") as f:
long_description = f.read()
setup(
name = "synpp",
version = "1.5.0",
description = "Synthetic population pipeline package for ... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((85, 107), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (97, 107), False, 'from os import path\n'), ((120, 148), 'os.path.join', 'path.join', (['here', '"""README.md"""'], {}), "(here, 'README.md')\n", (129, 148), False, 'from os import path\n'), ((664, 690), 'setuptools.find_packages', 'fin... |
###############################################################
# pytest -v --capture=no tests/test_storage_azure.py
# pytest -v tests/test_storage_azure.py
# pytest -v --capture=no tests/test_storage_azure..py::TestAzureStorage::<METHODNAME>
###############################################################
import os
fr... | [
"cloudmesh.common.util.HEADING",
"cloudmesh.common.StopWatch.StopWatch.stop",
"cloudmesh.common.util.path_expand",
"cloudmesh.common.Benchmark.Benchmark.print",
"cloudmesh.common.util.writefile",
"cloudmesh.common.StopWatch.StopWatch.start",
"pprint.pprint",
"cloudmesh.common.Benchmark.Benchmark.debug... | [((922, 939), 'cloudmesh.common.Benchmark.Benchmark.debug', 'Benchmark.debug', ([], {}), '()\n', (937, 939), False, 'from cloudmesh.common.Benchmark import Benchmark\n'), ((1431, 1459), 'cloudmesh.common.util.writefile', 'writefile', (['location', 'content'], {}), '(location, content)\n', (1440, 1459), False, 'from clo... |
import pytest
from aiohttp import web
from pytest_toolbox import mktree
from aiohttp_devtools.exceptions import AiohttpDevConfigError
from aiohttp_devtools.runserver.config import Config
from .conftest import SIMPLE_APP, get_if_boxed
if_boxed = get_if_boxed(pytest)
async def test_load_simple_app(tmpworkdir):
m... | [
"pytest.raises",
"aiohttp_devtools.runserver.config.Config",
"pytest_toolbox.mktree"
] | [((319, 349), 'pytest_toolbox.mktree', 'mktree', (['tmpworkdir', 'SIMPLE_APP'], {}), '(tmpworkdir, SIMPLE_APP)\n', (325, 349), False, 'from pytest_toolbox import mktree\n'), ((354, 379), 'aiohttp_devtools.runserver.config.Config', 'Config', ([], {'app_path': '"""app.py"""'}), "(app_path='app.py')\n", (360, 379), False,... |
# simple example for saving to multiedgelists
from py3plex.core import multinet
multilayer_network = multinet.multi_layer_network().load_network(
"../datasets/goslim_mirna.gpickle",
directed=False,
input_type="gpickle_biomine")
# save to string-based representation
multilayer_network.save_network("../data... | [
"py3plex.core.multinet.multi_layer_network"
] | [((102, 132), 'py3plex.core.multinet.multi_layer_network', 'multinet.multi_layer_network', ([], {}), '()\n', (130, 132), False, 'from py3plex.core import multinet\n')] |
from tests import BaseTestCase, authenticated_user
from redash import redis_connection
from redash.models import User, db
from redash.utils import dt_from_timestamp
from redash.models.users import sync_last_active_at, update_user_active_at, LAST_ACTIVE_KEY
class TestUserUpdateGroupAssignments(BaseTestCase):
def t... | [
"redash.models.User.query.get",
"redash.models.User.find_by_email",
"redash.models.User.query.filter_by",
"tests.authenticated_user",
"redash.models.User.get_by_email_and_org",
"redash.models.db.session.refresh",
"redash.models.db.session.commit",
"redash.models.users.sync_last_active_at",
"redash.m... | [((462, 486), 'redash.models.db.session.refresh', 'db.session.refresh', (['user'], {}), '(user)\n', (480, 486), False, 'from redash.models import User, db\n'), ((754, 778), 'redash.models.db.session.refresh', 'db.session.refresh', (['user'], {}), '(user)\n', (772, 778), False, 'from redash.models import User, db\n'), (... |
import time
import json
import boto3
# import pandas as pd
from io import StringIO
from webdriver_wrapper import WebDriverWrapper
from selenium.webdriver.common.keys import Keys
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.by import By
from selen... | [
"webdriver_wrapper.WebDriverWrapper",
"re.split",
"selenium.webdriver.support.expected_conditions.element_to_be_clickable",
"boto3.client",
"selenium.webdriver.common.action_chains.ActionChains",
"selenium.webdriver.support.expected_conditions.presence_of_all_elements_located",
"json.dumps",
"time.sle... | [((875, 893), 'webdriver_wrapper.WebDriverWrapper', 'WebDriverWrapper', ([], {}), '()\n', (891, 893), False, 'from webdriver_wrapper import WebDriverWrapper\n'), ((962, 980), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (974, 980), False, 'import boto3\n'), ((1099, 1154), 'json.dumps', 'json.dumps', ... |
'''
堆排序
'''
# 1、描述
'''
堆排序(Heapsort)是指利用堆积树(堆)这种数据结构所设计的一种排序算法,它是选择排序的一种。
可以利用数组的特点快速定位指定索引的元素。堆分为大根堆和小根堆,是近似完全二叉树的结构。
大根堆:每个结点的值都大于或等于左右子结点,在堆排序算法中用于升序排列。
小根堆:每个结点的值都小于或等于左右子结点,在堆排序算法中用于降序排列。
大根堆的要求是每个节点的值都不大于其父节点的值,即A[PARENT[i]] >= A[i]。
在数组的非降序排序中,需要使用的就是大根堆,因为根据大根堆的要求可知,最大的值一定在堆顶。
堆排序的平均时间复杂度为 Ο(nlog... | [
"collections.deque"
] | [((711, 721), 'collections.deque', 'deque', (['arr'], {}), '(arr)\n', (716, 721), False, 'from collections import deque\n')] |
from datamodel import DB
if __name__ == "__main__":
DB.bind(provider="sqlite", filename="db_model.sqlite", create_db=True)
DB.generate_mapping(create_tables=True)
| [
"datamodel.DB.generate_mapping",
"datamodel.DB.bind"
] | [((57, 127), 'datamodel.DB.bind', 'DB.bind', ([], {'provider': '"""sqlite"""', 'filename': '"""db_model.sqlite"""', 'create_db': '(True)'}), "(provider='sqlite', filename='db_model.sqlite', create_db=True)\n", (64, 127), False, 'from datamodel import DB\n'), ((132, 171), 'datamodel.DB.generate_mapping', 'DB.generate_ma... |
# Generated by Django 2.0.2 on 2018-03-30 14:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('student', '0012_auto_20180330_0607'),
]
operations = [
migrations.CreateModel(
name='Time',
fields=[
... | [
"django.db.models.CharField",
"django.db.models.AutoField"
] | [((640, 687), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""NULL"""', 'max_length': '(20)'}), "(default='NULL', max_length=20)\n", (656, 687), False, 'from django.db import migrations, models\n'), ((328, 421), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'pr... |
import importlib
import os
import pkgutil
from setuptools import find_packages
from django_spring.utils.logger import get_logger
log = get_logger("[PRELOAD]")
ROOT_DIR = os.getcwd()
def preload_views():
"""
File watchers only watch files that have been loaded
Calling `preload_all_modules` loads all th... | [
"importlib.import_module",
"os.getcwd",
"pkgutil.iter_modules",
"django_spring.utils.logger.get_logger",
"setuptools.find_packages"
] | [((138, 161), 'django_spring.utils.logger.get_logger', 'get_logger', (['"""[PRELOAD]"""'], {}), "('[PRELOAD]')\n", (148, 161), False, 'from django_spring.utils.logger import get_logger\n'), ((173, 184), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (182, 184), False, 'import os\n'), ((451, 474), 'setuptools.find_packages... |
"""Handles all messages coming from trading channel"""
# pylint: disable=no-member
import json
import logging
from bpprosdk.websockets.account.account_state import AccountState
from bpprosdk.websockets.trading.trading_channel_events import Fill, Booked, Done, Tracked, Triggered
LOG = logging.getLogger(__name__)
LOG.a... | [
"bpprosdk.websockets.trading.trading_channel_events.Fill.from_json",
"bpprosdk.websockets.trading.trading_channel_events.Done.from_json",
"bpprosdk.websockets.trading.trading_channel_events.Booked.from_json",
"logging.StreamHandler",
"json.dumps",
"bpprosdk.websockets.trading.trading_channel_events.Trigge... | [((287, 314), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (304, 314), False, 'import logging\n'), ((330, 353), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (351, 353), False, 'import logging\n'), ((644, 668), 'json.dumps', 'json.dumps', (['json_message'], {}), '(... |
# Raspberry Pi Physical Dashboard LED Backpack Widget Tests
# Author: <NAME>
#
# The MIT License (MIT)
#
# Copyright (c) 2016 Adafruit Industries
#
# 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 Soft... | [
"led_backpacks.BicolorBargraph24Widget",
"led_backpacks.SevenSegmentWidget",
"led_backpacks.AlphaNum4Widget",
"time.sleep"
] | [((1336, 1351), 'time.sleep', 'time.sleep', (['(2.0)'], {}), '(2.0)\n', (1346, 1351), False, 'import time\n'), ((1459, 1507), 'led_backpacks.SevenSegmentWidget', 'led_backpacks.SevenSegmentWidget', ([], {'address': '"""0x76"""'}), "(address='0x76')\n", (1491, 1507), False, 'import led_backpacks\n'), ((1593, 1641), 'led... |
#!/usr/bin/env python3
from lelantos import tomographic_objects
import argparse
import numpy as np
parser = argparse.ArgumentParser(description='Cut the QSO catalog')
parser.add_argument('-i',
'--input', help='Input QSO catalog',required=True)
parser.add_argument('-o',
'--output... | [
"lelantos.tomographic_objects.QSOCatalog.init_from_fits",
"argparse.ArgumentParser"
] | [((109, 167), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Cut the QSO catalog"""'}), "(description='Cut the QSO catalog')\n", (132, 167), False, 'import argparse\n'), ((1065, 1167), 'lelantos.tomographic_objects.QSOCatalog.init_from_fits', 'tomographic_objects.QSOCatalog.init_from_fit... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
from alipay.aop.api.constant.ParamConstants import *
from alipay.aop.api.domain.SimpleMockModel import SimpleMockModel
class ComplextMockModel(object):
def __init__(self):
self._biz_model = None
self._biz_num = None
self._biz_type... | [
"alipay.aop.api.domain.SimpleMockModel.SimpleMockModel.from_alipay_dict"
] | [((581, 620), 'alipay.aop.api.domain.SimpleMockModel.SimpleMockModel.from_alipay_dict', 'SimpleMockModel.from_alipay_dict', (['value'], {}), '(value)\n', (613, 620), False, 'from alipay.aop.api.domain.SimpleMockModel import SimpleMockModel\n')] |
"""
Sync method tests.
"""
import pytest
from aiosmtplib.sync import async_to_sync
def test_sendmail_sync(
event_loop, smtp_client_threaded, sender_str, recipient_str, message_str
):
errors, response = smtp_client_threaded.sendmail_sync(
sender_str, [recipient_str], message_str
)
assert not ... | [
"pytest.raises",
"aiosmtplib.sync.async_to_sync"
] | [((1598, 1630), 'pytest.raises', 'pytest.raises', (['ZeroDivisionError'], {}), '(ZeroDivisionError)\n', (1611, 1630), False, 'import pytest\n'), ((1776, 1803), 'pytest.raises', 'pytest.raises', (['RuntimeError'], {}), '(RuntimeError)\n', (1789, 1803), False, 'import pytest\n'), ((1813, 1832), 'aiosmtplib.sync.async_to_... |
import biostats as bs
import pandas as pd
# ---------------------------------------------------------------
#Basic
# Numeral
data = pd.read_csv("biostats/dataset/numeral.csv")
r1, r2, r3, r4 = bs.numeral(data, ["Fish", "Crab", "Temperature"])
print(r1)
print(r2)
print(r3)
print(r4)
| [
"pandas.read_csv",
"biostats.numeral"
] | [((134, 177), 'pandas.read_csv', 'pd.read_csv', (['"""biostats/dataset/numeral.csv"""'], {}), "('biostats/dataset/numeral.csv')\n", (145, 177), True, 'import pandas as pd\n'), ((195, 244), 'biostats.numeral', 'bs.numeral', (['data', "['Fish', 'Crab', 'Temperature']"], {}), "(data, ['Fish', 'Crab', 'Temperature'])\n", (... |
from genericpath import exists
import os
PRODUCTS = []
# product class
class Product:
def __init__(self,id,name,quantity,price):
self.id = id
self.name = name
self.quantity = quantity
self.price =price
def set_name(self,name):
self.name = name
def get_name(self):
... | [
"os.rename",
"os.remove"
] | [((3356, 3380), 'os.remove', 'os.remove', (['"""product.txt"""'], {}), "('product.txt')\n", (3365, 3380), False, 'import os\n'), ((3385, 3421), 'os.rename', 'os.rename', (['"""temp.txt"""', '"""product.txt"""'], {}), "('temp.txt', 'product.txt')\n", (3394, 3421), False, 'import os\n'), ((3877, 3901), 'os.remove', 'os.r... |
from unittest.mock import patch
from .conftest import file_contents
from civic_scraper.base.cache import Cache
def test_default_cache_dir(monkeypatch):
target = "civic_scraper.utils.expanduser"
with patch(target) as mock_method:
mock_method.return_value = "/Users/you"
cache = Cache()
... | [
"unittest.mock.patch",
"civic_scraper.base.cache.Cache"
] | [((468, 481), 'civic_scraper.base.cache.Cache', 'Cache', (['tmpdir'], {}), '(tmpdir)\n', (473, 481), False, 'from civic_scraper.base.cache import Cache\n'), ((600, 613), 'civic_scraper.base.cache.Cache', 'Cache', (['tmpdir'], {}), '(tmpdir)\n', (605, 613), False, 'from civic_scraper.base.cache import Cache\n'), ((211, ... |
#!/usr/bin/python3
import os
import sqlite3
def get_connection():
connection = sqlite3.connect('db.sqlite')
return connection
def read_albums(filepath):
albums = []
with open(filepath, "r") as f:
for line in f:
artist, title, year = line.strip().split("|")
albums.a... | [
"os.path.realpath",
"sqlite3.connect",
"os.path.join"
] | [((86, 114), 'sqlite3.connect', 'sqlite3.connect', (['"""db.sqlite"""'], {}), "('db.sqlite')\n", (101, 114), False, 'import sqlite3\n'), ((2398, 2442), 'os.path.join', 'os.path.join', (['current_directory', '"""input.txt"""'], {}), "(current_directory, 'input.txt')\n", (2410, 2442), False, 'import os\n'), ((2349, 2375)... |
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from codecs import open
from os import path
here = path.abspath(path.dirname(__file__))
# Get the long description from the README file
long_description = "see https://github.com/JoinVerse/vid for mor... | [
"os.path.dirname",
"setuptools.setup"
] | [((330, 595), 'setuptools.setup', 'setup', ([], {'name': '"""vid"""', 'version': '"""1.0.0"""', 'description': '"""Python Vid Implementation"""', 'long_description': 'long_description', 'url': '"""https://github.com/JoinVerse/vid"""', 'author': '"""JoinVerse"""', 'author_email': '""""""', 'license': '"""MIT"""', 'py_mo... |
# coding=utf-8
# Copyright 2018 Google LLC & <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 o... | [
"absl.logging.info",
"tensorflow.convert_to_tensor",
"tensorflow_gan.eval.frechet_classifier_distance_from_activations",
"tensorflow.Graph"
] | [((2204, 2240), 'absl.logging.info', 'logging.info', (['"""Computing FID score."""'], {}), "('Computing FID score.')\n", (2216, 2240), False, 'from absl import logging\n'), ((1369, 1401), 'absl.logging.info', 'logging.info', (['"""Calculating FID."""'], {}), "('Calculating FID.')\n", (1381, 1401), False, 'from absl imp... |
#!/usr/bin/env python
import copy
import itertools
import pytest
import math
TEST_DATA = [
1,
0,
0,
3,
1,
1,
2,
3,
1,
3,
4,
3,
1,
5,
0,
3,
2,
13,
1,
19,
1,
6,
19,
23,
2,
6,
23,
27,
1,
5,
27,
... | [
"pytest.mark.parametrize",
"copy.copy"
] | [((2527, 2755), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""x,y"""', '[([1, 0, 0, 0, 99], [2, 0, 0, 0, 99]), ([2, 3, 0, 3, 99], [2, 3, 0, 6, 99]),\n ([2, 4, 4, 5, 99, 0], [2, 4, 4, 5, 99, 9801]), ([1, 1, 1, 4, 99, 5, 6, \n 0, 99], [30, 1, 1, 4, 2, 5, 6, 0, 99])]'], {}), "('x,y', [([1, 0, 0, 0, 99]... |
"""StyleGAN.
This module implements teh Generative Adversarial Network described in:
A Style-Based Generator Architecture for Generative Adversarial Networks
<NAME> (NVIDIA), <NAME> (NVIDIA), <NAME> (NVIDIA)
http://stylegan.xyz/paper
Code derived from:
https://github.com/SsnL/stylegan
"""
import collections
import o... | [
"torch.sqrt",
"torch.nn.Embedding",
"torch.cat",
"collections.defaultdict",
"torch.nn.functional.leaky_relu",
"torch.device",
"torch.no_grad",
"os.path.join",
"numpy.prod",
"os.path.dirname",
"torch.lerp",
"torch.zeros",
"torch.hub.load_state_dict_from_url",
"torch.mean",
"torch.randint"... | [((428, 465), 'collections.defaultdict', 'collections.defaultdict', (['(lambda : 512)'], {}), '(lambda : 512)\n', (451, 465), False, 'import collections\n'), ((790, 815), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (805, 815), False, 'import os\n'), ((2324, 2334), 'numpy.sqrt', 'np.sqrt', ... |
"""Install packages as defined in this file into the Python environment."""
from setuptools import setup, find_namespace_packages
import ps2mqtt
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(
name="ps2mqtt",
version=ps2mqtt.__version__,
author="<NAME>",
au... | [
"setuptools.setup"
] | [((233, 1015), 'setuptools.setup', 'setup', ([], {'name': '"""ps2mqtt"""', 'version': 'ps2mqtt.__version__', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'url': '"""https://github.com/dgomes/ps2mqtt"""', 'description': '"""Python daemon that gets information from psutil to an mqtt broker for integration w... |
# coding=utf-8
# Copyright 2022 The Google Research 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 applicab... | [
"supcon.classification_head.ClassificationHead",
"tensorflow.compat.v1.random.uniform",
"numpy.isnan",
"tensorflow.compat.v1.test.main",
"tensorflow.compat.v1.gradients",
"absl.testing.parameterized.named_parameters",
"tensorflow.compat.v1.compat.v1.global_variables_initializer",
"tensorflow.compat.v1... | [((882, 957), 'absl.testing.parameterized.named_parameters', 'parameterized.named_parameters', (["('rank_1', 1)", "('rank_4', 4)", "('rank_8', 8)"], {}), "(('rank_1', 1), ('rank_4', 4), ('rank_8', 8))\n", (912, 957), False, 'from absl.testing import parameterized\n'), ((1265, 1375), 'absl.testing.parameterized.named_pa... |
from enum import IntFlag
from enum import unique
from misc.utils import escape_enum
from misc.utils import pymysql_encode
__all__ = ("ClientFlags",)
@unique
@pymysql_encode(escape_enum)
class ClientFlags(IntFlag):
# NOTE: many of these flags are quite outdated and/or
# broken and are even known to false pos... | [
"misc.utils.pymysql_encode"
] | [((162, 189), 'misc.utils.pymysql_encode', 'pymysql_encode', (['escape_enum'], {}), '(escape_enum)\n', (176, 189), False, 'from misc.utils import pymysql_encode\n')] |
from django.http import HttpRequest
from rest_framework.views import APIView
from rest_framework.response import Response
from genie.services import NotebookJobServices, Connections, NotebookTemplateService
from rest_framework.decorators import api_view
class NotebookOperationsView(APIView):
"""
Class to get n... | [
"genie.services.NotebookJobServices.getNotebookJobDetails",
"genie.services.NotebookJobServices.updateSchedule",
"genie.services.NotebookJobServices.deleteSchedule",
"genie.services.NotebookJobServices.cloneNotebook",
"genie.services.NotebookJobServices.stopNotebookJob",
"genie.services.NotebookJobService... | [((3938, 3972), 'rest_framework.decorators.api_view', 'api_view', (["['GET', 'PUT', 'DELETE']"], {}), "(['GET', 'PUT', 'DELETE'])\n", (3946, 3972), False, 'from rest_framework.decorators import api_view\n'), ((4688, 4713), 'rest_framework.decorators.api_view', 'api_view', (["['GET', 'POST']"], {}), "(['GET', 'POST'])\n... |
# SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>>
#
# SPDX-License-Identifier: MIT
import cdstoolbox as ct
def get_daily_mean_for_year_and_month(year, month):
print('get temperature', year, month)
temperature = ct.catalogue.retrieve(
'reanalysis-era5-single-levels',
{
'product_type':... | [
"cdstoolbox.output.download",
"cdstoolbox.cdm.get_coordinates",
"cdstoolbox.application",
"cdstoolbox.cdstools.heuristics.growing_degree_days",
"cdstoolbox.cube.concat",
"cdstoolbox.climate.daily_mean"
] | [((1776, 1792), 'cdstoolbox.application', 'ct.application', ([], {}), '()\n', (1790, 1792), True, 'import cdstoolbox as ct\n'), ((1794, 1814), 'cdstoolbox.output.download', 'ct.output.download', ([], {}), '()\n', (1812, 1814), True, 'import cdstoolbox as ct\n'), ((1270, 1304), 'cdstoolbox.climate.daily_mean', 'ct.clima... |
# coding: utf-8
import os
import sys
import re
import pycparser.c_generator
def parse_constant(node):
if isinstance(node, pycparser.c_ast.Constant):
return node.value
elif isinstance(node, pycparser.c_ast.UnaryOp) and node.op == '-':
return '-' + parse_constant(node.expr)
else:... | [
"os.path.join",
"re.sub"
] | [((991, 1047), 'os.path.join', 'os.path.join', (['cairo_git_dir', '"""src"""', "('cairo%s.h' % suffix)"], {}), "(cairo_git_dir, 'src', 'cairo%s.h' % suffix)\n", (1003, 1047), False, 'import os\n'), ((1098, 1225), 're.sub', 're.sub', (['"""/\\\\*.*?\\\\*/|CAIRO_(BEGIN|END)_DECLS|cairo_public |^\\\\s*#.*?[^\\\\\\\\]\\\\n... |
import pytest
from bottery.message import Message
from bottery.telegram import reply
from bottery.telegram.engine import TelegramChat, TelegramEngine, TelegramUser
@pytest.fixture
def engine():
return TelegramEngine
@pytest.fixture
def user():
return TelegramUser
@pytest.fixture
def chat():
return Te... | [
"bottery.message.Message",
"bottery.telegram.reply",
"pytest.lazy_fixture",
"pytest.fixture",
"pytest.mark.parametrize"
] | [((334, 350), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (348, 350), False, 'import pytest\n'), ((1343, 1432), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""chat_type,id_expected"""', "[('group', 456), ('private', 123)]"], {}), "('chat_type,id_expected', [('group', 456), (\n 'private', 123)]... |
""" This is a temporary module, used during (and for a while after) the
transition to Python 3. This code is planned to be kept in place until
the least version of Python supported no longer requires it (and of course
until all callers no longer need it).
This code should run as-is in 2.x and also run unedited after 2... | [
"os.read"
] | [((4349, 4364), 'os.read', 'os.read', (['fd', 'sz'], {}), '(fd, sz)\n', (4356, 4364), False, 'import os, sys\n')] |
#!/usr/bin/env python
"""
Copyright (c) 2019 CIIRC, CTU in Prague
All rights reserved.
This source code is licensed under the BSD-3-Clause license found in the
LICENSE file in the root directory of this source tree.
@author: <NAME>
"""
import logging
from typing import Any, List
from nltk import ParentedTree
from n... | [
"nlp_crow.structures.tagging.Tag.Tag",
"nlp_crow.structures.tagging.ParsedText.ParsedText",
"nlp_crow.structures.tagging.ParsedText.TaggedText",
"nlp_crow.structures.tagging.ParsedText.ParseTreeNode",
"nlp_crow.structures.tagging.MorphCategory.POS",
"nlp_crow.structures.tagging.ParsedText.TaggedToken",
... | [((903, 915), 'nlp_crow.structures.tagging.ParsedText.TaggedText', 'TaggedText', ([], {}), '()\n', (913, 915), False, 'from nlp_crow.structures.tagging.ParsedText import ParsedText, TaggedText, ParseTreeNode, TaggedToken\n'), ((933, 957), 'nltk.word_tokenize', 'nltk.word_tokenize', (['text'], {}), '(text)\n', (951, 957... |
import urllib.request as ur
import urllib
"""
2017 - 4 - 10 neko34
从网络中获取对应的数据,调用对应的API
"""
def openUrl(urlString):
html = ur.urlopen(urlString).read()
return html
| [
"urllib.request.urlopen"
] | [((138, 159), 'urllib.request.urlopen', 'ur.urlopen', (['urlString'], {}), '(urlString)\n', (148, 159), True, 'import urllib.request as ur\n')] |
# Author: Fayas (https://github.com/FayasNoushad) (@FayasNoushad)
from .admin import *
from pyrogram import Client, filters
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton
START_TEXT = """Hello {} 😌
I am a link shortner telegram bot.
>> `I can short any type of link`
Made by @FayasNoushad"""... | [
"pyrogram.types.InlineKeyboardButton",
"pyrogram.types.InlineKeyboardMarkup",
"pyrogram.filters.command"
] | [((2130, 2182), 'pyrogram.types.InlineKeyboardButton', 'InlineKeyboardButton', (['"""🏘 Home"""'], {'callback_data': '"""home"""'}), "('🏘 Home', callback_data='home')\n", (2150, 2182), False, 'from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton\n'), ((2192, 2244), 'pyrogram.types.InlineKeyboardButton... |
from pylsl import StreamInlet
from PyQt5 import QtCore, QtWidgets
import pyqtgraph as pg
import pylslhandler
timestamp_arr, TP9_arr, AF7_arr, AF8_arr, TP10_arr, AUX_arr = ([] for i in range(6))
tickInterval = 1 #milliseconds
yRange = 1700 #microVolts
xRange = 500 #milliseconds of readings
class LiveEEGViewer(pg.Gr... | [
"PyQt5.QtCore.QTimer",
"pylsl.StreamInlet",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QApplication",
"pylslhandler.resolve_conn",
"pyqtgraph.mkPen"
] | [((2398, 2424), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['[]'], {}), '([])\n', (2420, 2424), False, 'from PyQt5 import QtCore, QtWidgets\n'), ((2678, 2705), 'pylslhandler.resolve_conn', 'pylslhandler.resolve_conn', ([], {}), '()\n', (2703, 2705), False, 'import pylslhandler\n'), ((2803, 2826), 'pylsl... |
# -------------------------------------------------------------------------
#
# Part of the CodeChecker project, under the Apache License v2.0 with
# LLVM Exceptions. See LICENSE for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# ---------------------------------------------------... | [
"os.path.isabs",
"os.path.basename",
"os.path.realpath",
"codechecker_analyzer.env.extend",
"codechecker_common.logger.get_logger",
"re.compile"
] | [((602, 624), 'codechecker_common.logger.get_logger', 'get_logger', (['"""analyzer"""'], {}), "('analyzer')\n", (612, 624), False, 'from codechecker_common.logger import get_logger\n'), ((1877, 1938), 'codechecker_analyzer.env.extend', 'env.extend', (['context.path_env_extra', 'context.ld_lib_path_extra'], {}), '(conte... |
from audioop import add
from numpy import mat
import tensorflow as tf
# 2차원 배열 정의
list_of_list = [[10, 20], [30, 40]]
# 텐서 변환 - constant 함수에 2차원 배열 입력
mat1 = tf.constant(list_of_list)
# 랭크 확인
print("rank:", tf.rank(mat1))
# 텐서 출력
print("mat1:", mat1)
# 1차원 벡터 정의
vec1 = tf.constant([1, 0])
vec2 = tf.constant([-1, 2... | [
"tensorflow.rank",
"tensorflow.math.add",
"tensorflow.constant",
"tensorflow.stack",
"tensorflow.matmul",
"tensorflow.math.multiply"
] | [((160, 185), 'tensorflow.constant', 'tf.constant', (['list_of_list'], {}), '(list_of_list)\n', (171, 185), True, 'import tensorflow as tf\n'), ((275, 294), 'tensorflow.constant', 'tf.constant', (['[1, 0]'], {}), '([1, 0])\n', (286, 294), True, 'import tensorflow as tf\n'), ((302, 322), 'tensorflow.constant', 'tf.const... |
#!/usr/bin/env python3
import shutil
import tempfile
import unittest
from collections import Counter, defaultdict
from os import path
from pytorch_translate.research.test import morphology_test_utils as morph_utils
from pytorch_translate.research.unsupervised_morphology.ibm_model1 import IBMModel1
class TestIBMMode... | [
"collections.defaultdict",
"shutil.rmtree",
"pytorch_translate.research.test.morphology_test_utils.get_two_same_tmp_files",
"pytorch_translate.research.unsupervised_morphology.ibm_model1.IBMModel1"
] | [((391, 402), 'pytorch_translate.research.unsupervised_morphology.ibm_model1.IBMModel1', 'IBMModel1', ([], {}), '()\n', (400, 402), False, 'from pytorch_translate.research.unsupervised_morphology.ibm_model1 import IBMModel1\n'), ((915, 926), 'pytorch_translate.research.unsupervised_morphology.ibm_model1.IBMModel1', 'IB... |
# -*- coding: utf-8 -*-
# Copyright (C) 1999-2015, <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, c... | [
"sys.stdout.write",
"os.getcwd",
"os.system",
"sys.stdout.flush",
"os.chdir"
] | [((1335, 1346), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1344, 1346), False, 'import os\n'), ((1351, 1365), 'os.chdir', 'os.chdir', (['path'], {}), '(path)\n', (1359, 1365), False, 'import os\n'), ((1510, 1532), 'sys.stdout.write', 'sys.stdout.write', (['"""\n"""'], {}), "('\\n')\n", (1526, 1532), False, 'import sy... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
---
This file is part of pygalle.core.env
Copyright (c) 2018 SAS 9 Février.
Distributed under the MIT License (license terms are at http://opensource.org/licenses/MIT).
---
"""
import unittest
import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abs... | [
"os.path.abspath",
"unittest.TestLoader"
] | [((388, 409), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (407, 409), False, 'import unittest\n'), ((309, 334), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (324, 334), False, 'import sys, os\n')] |
from gym.envs.registration import register
# gridnav: square ##############################################################
register(
id='GridNav_2-v0',
entry_point='gym_symbol.envs:SymbolicRepresentation',
kwargs={'cfg_fname': 'gridnav_2_v0.yaml'}
)
register(
id='GridNav_2-v1',
entry_point='gym_s... | [
"gym.envs.registration.register"
] | [((125, 258), 'gym.envs.registration.register', 'register', ([], {'id': '"""GridNav_2-v0"""', 'entry_point': '"""gym_symbol.envs:SymbolicRepresentation"""', 'kwargs': "{'cfg_fname': 'gridnav_2_v0.yaml'}"}), "(id='GridNav_2-v0', entry_point=\n 'gym_symbol.envs:SymbolicRepresentation', kwargs={'cfg_fname':\n 'gridn... |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Source'
db.create_table(u'thumbnails_source', (
... | [
"south.db.db.delete_table",
"south.db.db.create_unique",
"south.db.db.delete_unique",
"south.db.db.send_create_signal"
] | [((512, 560), 'south.db.db.send_create_signal', 'db.send_create_signal', (['u"""thumbnails"""', "['Source']"], {}), "(u'thumbnails', ['Source'])\n", (533, 560), False, 'from south.db import db\n'), ((1075, 1130), 'south.db.db.send_create_signal', 'db.send_create_signal', (['u"""thumbnails"""', "['ThumbnailMeta']"], {})... |
import subprocess
subprocess.Popen(['python','hear_auto.py'])
subprocess.Popen(['python','hear_auto.py'])
subprocess.Popen(['python','hear_auto.py'])
#subprocess.Popen(['python','hear_auto.py'])
#subprocess.Popen(['python','hear_auto.py'])
| [
"subprocess.Popen"
] | [((19, 63), 'subprocess.Popen', 'subprocess.Popen', (["['python', 'hear_auto.py']"], {}), "(['python', 'hear_auto.py'])\n", (35, 63), False, 'import subprocess\n'), ((63, 107), 'subprocess.Popen', 'subprocess.Popen', (["['python', 'hear_auto.py']"], {}), "(['python', 'hear_auto.py'])\n", (79, 107), False, 'import subpr... |
import hashlib, json, requests
from time import time
from uuid import uuid4
from textwrap import dedent
from flask import Flask, jsonify, request
from urllib.parse import urlparse
# block = {
# 'index': 1,
# 'timestamp': 1506057125.900785,
# 'transactions': [
# {
# 'sender': "8527147fe1... | [
"uuid.uuid4",
"flask.Flask",
"json.dumps",
"time.time",
"hashlib.sha256",
"flask.jsonify",
"requests.get",
"flask.request.get_json",
"urllib.parse.urlparse"
] | [((4167, 4182), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (4172, 4182), False, 'from flask import Flask, jsonify, request\n'), ((5555, 5573), 'flask.request.get_json', 'request.get_json', ([], {}), '()\n', (5571, 5573), False, 'from flask import Flask, jsonify, request\n'), ((6304, 6322), 'flask.reque... |
"""
SHERPA is a Python library for hyperparameter tuning of machine learning models.
Copyright (C) 2018 <NAME>, <NAME>, and <NAME>.
This file is part of SHERPA.
SHERPA is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Founda... | [
"logging.basicConfig"
] | [((937, 976), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (956, 976), False, 'import logging\n')] |
# Copyright (c) OpenMMLab. All rights reserved.
import warnings
from typing import Union
import onnx
import tensorrt as trt
import torch
from .preprocess import preprocess_onnx
def onnx2trt(onnx_model: Union[str, onnx.ModelProto],
opt_shape_dict: dict,
log_level: trt.ILogger.Severity = trt... | [
"tensorrt.Logger",
"tensorrt.OnnxParser",
"torch.empty",
"tensorrt.Builder",
"tensorrt.Runtime",
"torch.device",
"torch.cuda.current_stream",
"warnings.warn",
"torch.cuda.device",
"onnx.load"
] | [((2033, 2051), 'warnings.warn', 'warnings.warn', (['msg'], {}), '(msg)\n', (2046, 2051), False, 'import warnings\n'), ((2066, 2099), 'torch.device', 'torch.device', (['f"""cuda:{device_id}"""'], {}), "(f'cuda:{device_id}')\n", (2078, 2099), False, 'import torch\n'), ((2146, 2167), 'tensorrt.Logger', 'trt.Logger', (['l... |
from django.db import models
from django.contrib.auth.models import User
class Recipe(models.Model):
recipe_name = models.CharField(max_length=50, null=False, unique=True, blank=False, primary_key=True)
author = models.ForeignKey(User(), on_delete=models.CASCADE, blank=False)
def __str__(self):
ret... | [
"django.db.models.CharField",
"django.db.models.TextField",
"django.contrib.auth.models.User",
"django.db.models.ForeignKey"
] | [((119, 210), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'null': '(False)', 'unique': '(True)', 'blank': '(False)', 'primary_key': '(True)'}), '(max_length=50, null=False, unique=True, blank=False,\n primary_key=True)\n', (135, 210), False, 'from django.db import models\n'), ((379,... |
"""Copied and inspired from `unittest._log`, added in Python 3.4+"""
import collections
import contextlib
from io import StringIO
import logging
LoggingWatcher = collections.namedtuple(
"LoggingWatcher", ["records", "output"]
)
class CapturingHandler(logging.Handler):
def __init__(self):
super(Captu... | [
"logging.Formatter",
"collections.namedtuple"
] | [((164, 227), 'collections.namedtuple', 'collections.namedtuple', (['"""LoggingWatcher"""', "['records', 'output']"], {}), "('LoggingWatcher', ['records', 'output'])\n", (186, 227), False, 'import collections\n'), ((739, 765), 'logging.Formatter', 'logging.Formatter', ([], {'fmt': 'fmt'}), '(fmt=fmt)\n', (756, 765), Fa... |
import collections
from random import random
import sys
from time import sleep, time
start = time()
mydic = collections.defaultdict(set)
mydic['one'] = 1
mydic['one'] = 2
#mydic['one'].insert(1)
#mydic['one'] += 1
#mydic['one'].add(('fname1,3'))
#mydic['one'].add(('fname1,2'))
#mydic['one'].add(('fname2,1,2'))
pri... | [
"collections.defaultdict",
"random.random",
"time.time"
] | [((94, 100), 'time.time', 'time', ([], {}), '()\n', (98, 100), False, 'from time import sleep, time\n'), ((110, 138), 'collections.defaultdict', 'collections.defaultdict', (['set'], {}), '(set)\n', (133, 138), False, 'import collections\n'), ((1003, 1009), 'time.time', 'time', ([], {}), '()\n', (1007, 1009), False, 'fr... |
from nltk.lm import NgramCounter, Vocabulary
from nltk.lm.preprocessing import padded_everygram_pipeline
import pickle
model_dir = '../../data/ngrams/'
with open(f'{model_dir}tokenized_text.pickle', 'rb') as file:
tokenized_text = pickle.load(file)
training_ngrams, padded_sents = padded_everygram_pipeline(3,... | [
"pickle.dump",
"nltk.lm.preprocessing.padded_everygram_pipeline",
"pickle.load",
"nltk.lm.Vocabulary",
"nltk.lm.NgramCounter"
] | [((292, 336), 'nltk.lm.preprocessing.padded_everygram_pipeline', 'padded_everygram_pipeline', (['(3)', 'tokenized_text'], {}), '(3, tokenized_text)\n', (317, 336), False, 'from nltk.lm.preprocessing import padded_everygram_pipeline\n'), ((347, 376), 'nltk.lm.NgramCounter', 'NgramCounter', (['training_ngrams'], {}), '(t... |
import unittest
from test.helpers.httpretty_extension import httpretty
import six
import datetime
import pandas
from quandl.model.dataset import Dataset
from quandl.model.data import Data
from quandl.model.merged_data_list import MergedDataList
from quandl.model.merged_dataset import MergedDataset
from mock import patc... | [
"mock.patch.object",
"six.assertCountEqual",
"test.helpers.httpretty_extension.httpretty.disable",
"six.u",
"test.helpers.merged_datasets_helper.setupDatasetsTest",
"mock.call",
"datetime.date",
"mock.patch",
"datetime.datetime",
"test.helpers.httpretty_extension.httpretty.reset",
"quandl.model.... | [((685, 757), 'mock.patch', 'patch', (['"""quandl.model.merged_dataset.MergedDataset._build_dataset_object"""'], {}), "('quandl.model.merged_dataset.MergedDataset._build_dataset_object')\n", (690, 757), False, 'from mock import patch, call\n'), ((1411, 1483), 'mock.patch', 'patch', (['"""quandl.model.merged_dataset.Mer... |
from simulator.car import Car
from simulator.map import Map
from simulator.source import SourceNode
from simulator.street import Street
class Simulator:
def __init__(self, intersections, adjacencyMatrix, trafficLightsByIntersectionId, sourceNodesRaw):
streets = []
streetIdsByIntersectionId = {}
... | [
"simulator.car.Car",
"simulator.map.Map",
"simulator.street.Street",
"simulator.source.SourceNode"
] | [((859, 961), 'simulator.map.Map', 'Map', (['streets', 'intersections', 'streetIdsByIntersectionId', 'trafficLightsByIntersectionId', 'sourceNodes'], {}), '(streets, intersections, streetIdsByIntersectionId,\n trafficLightsByIntersectionId, sourceNodes)\n', (862, 961), False, 'from simulator.map import Map\n'), ((71... |
from marshmallow import Schema, fields, post_load, EXCLUDE
from ..resource import Resource
from collections import namedtuple
class PlanGroupPlans(Resource):
"""
https://dev.chartmogul.com/v1.0/reference#plan_groups
"""
_path = "/plan_groups{/uuid}/plans"
_root_key = 'plans'
_many = namedtuple... | [
"marshmallow.fields.Int",
"collections.namedtuple",
"marshmallow.fields.String"
] | [((310, 382), 'collections.namedtuple', 'namedtuple', (['"""PlanGroupPlans"""', "[_root_key, 'current_page', 'total_pages']"], {}), "('PlanGroupPlans', [_root_key, 'current_page', 'total_pages'])\n", (320, 382), False, 'from collections import namedtuple\n'), ((426, 441), 'marshmallow.fields.String', 'fields.String', (... |
# -*- coding: utf-8 -*-
"""
==========================
Flask MySQL initialisation
==========================
PROGRAM BY <NAME>, 2019
Coding Rules:
- Snake case for variables.
- Only argument is configuration file.
- No output or print, just log and files.
"""
from flask_mysqldb import MySQL
from flask import current... | [
"flask_mysqldb.MySQL"
] | [((357, 375), 'flask_mysqldb.MySQL', 'MySQL', (['application'], {}), '(application)\n', (362, 375), False, 'from flask_mysqldb import MySQL\n')] |
# -*- coding: utf-8 -*-
import utils
from tqdm import tqdm
from collections import defaultdict
import src.news_kg.util as news_kg_util
import src.wikidata.query as wiki_query
from qwikidata.linked_data_interface import get_entity_dict_from_api
from typing import List, Tuple
def retrieve_wikidata_neighbors(entities:... | [
"tqdm.tqdm",
"utils.update_cache",
"utils.get_logger",
"src.wikidata.query.get_entity_attributes",
"utils.load_or_create_cache",
"src.news_kg.util.pid2wikidata_property",
"collections.defaultdict",
"src.news_kg.util.qid2wikidata_resource",
"utils.load_cache"
] | [((1102, 1141), 'utils.load_cache', 'utils.load_cache', (['"""wiki_attributes_map"""'], {}), "('wiki_attributes_map')\n", (1118, 1141), False, 'import utils\n'), ((1220, 1234), 'tqdm.tqdm', 'tqdm', (['entities'], {}), '(entities)\n', (1224, 1234), False, 'from tqdm import tqdm\n'), ((3112, 3172), 'utils.update_cache', ... |
from torch.distributed.distributed_c10d import is_initialized
from torch.utils.data import Dataset, DistributedSampler
def get_ddp_sampler(dataset: Dataset, epoch: int):
"""
This function will create a DistributedSampler if DDP is initialized,
and will just return None if DDP is not initialized.
"""
... | [
"torch.distributed.distributed_c10d.is_initialized",
"torch.utils.data.DistributedSampler"
] | [((325, 341), 'torch.distributed.distributed_c10d.is_initialized', 'is_initialized', ([], {}), '()\n', (339, 341), False, 'from torch.distributed.distributed_c10d import is_initialized\n'), ((361, 388), 'torch.utils.data.DistributedSampler', 'DistributedSampler', (['dataset'], {}), '(dataset)\n', (379, 388), False, 'fr... |
# License: MIT
# ref: https://github.com/thomas-young-2013/open-box/blob/master/openbox/surrogate/skrf.py
import logging
import typing
import numpy as np
from typing import List, Optional, Tuple, Union
from xbbo.surrogate.base import BaseRF
from xbbo.configspace.space import DenseConfigurationSpace
from xbbo.utils.con... | [
"numpy.std",
"numpy.isfinite",
"numpy.random.RandomState",
"xbbo.utils.util.get_types",
"sklearn.ensemble.RandomForestRegressor",
"numpy.finfo",
"numpy.mean",
"numpy.var",
"logging.getLogger"
] | [((390, 417), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (407, 417), False, 'import logging\n'), ((784, 809), 'numpy.random.RandomState', 'np.random.RandomState', (['(42)'], {}), '(42)\n', (805, 809), True, 'import numpy as np\n'), ((3751, 3779), 'numpy.mean', 'np.mean', (['prediction... |
# Copyright (c) 2006, <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 conditions and the follow... | [
"binascii.hexlify"
] | [((9608, 9618), 'binascii.hexlify', 'hexlify', (['s'], {}), '(s)\n', (9615, 9618), False, 'from binascii import hexlify\n')] |
# coding: utf-8
"""
Domains
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501
The version of the OpenAPI document: v3
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from hubsp... | [
"six.iteritems",
"hubspot.cms.domains.configuration.Configuration"
] | [((64842, 64875), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (64855, 64875), False, 'import six\n'), ((7799, 7814), 'hubspot.cms.domains.configuration.Configuration', 'Configuration', ([], {}), '()\n', (7812, 7814), False, 'from hubspot.cms.domains.configuration import Con... |
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, url
from clients.views import ClientListView, ClientCreateView, ClientSetupView
from clients.views import ClientProfileIdentificationView, ClientProfileContactView, ClientProfileCommunicationView, ClientProfileReferralView, ClientProfileRelationshipView, ... | [
"clients.views.ClientSetupView.as_view",
"clients.views.ClientProfileEditOrderView.as_view",
"clients.views.ClientProfileReferralView.as_view",
"clients.views.ClientProfileOrderView.as_view",
"clients.views.ClientProfileEditIdentificationView.as_view",
"clients.views.ClientProfileIdentificationView.as_vie... | [((761, 785), 'clients.views.ClientListView.as_view', 'ClientListView.as_view', ([], {}), '()\n', (783, 785), False, 'from clients.views import ClientListView, ClientCreateView, ClientSetupView\n'), ((876, 902), 'clients.views.ClientCreateView.as_view', 'ClientCreateView.as_view', ([], {}), '()\n', (900, 902), False, '... |