code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import io
import json
import trimesh
import random
import matplotlib.pyplot as plt
import numpy as np
import cv2
import torch
def load_bop_meshes(model_path, obj_ids="all"):
"""
Returns:
meshes: list[Trimesh]
objID2clsID: dict, objID (original) --> i (0-indexed)
"""
# load m... | [
"numpy.int32",
"io.BytesIO",
"numpy.array",
"cv2.imdecode",
"numpy.linalg.norm",
"numpy.arange",
"os.listdir",
"cv2.line",
"numpy.matmul",
"numpy.concatenate",
"random.randint",
"random.uniform",
"os.path.splitext",
"cv2.getRotationMatrix2D",
"cv2.imread",
"os.path.join",
"numpy.zero... | [((1627, 1650), 'random.randint', 'random.randint', (['(-dw)', 'dw'], {}), '(-dw, dw)\n', (1641, 1650), False, 'import random\n'), ((1662, 1685), 'random.randint', 'random.randint', (['(-dh)', 'dh'], {}), '(-dh, dh)\n', (1676, 1685), False, 'import random\n'), ((1699, 1765), 'numpy.array', 'np.array', (['[[1.0, 0.0, -p... |
#!/usr/bin/env python
# Copyright (c) 2019-2021, NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/... | [
"subprocess.Popen"
] | [((2295, 2354), 'subprocess.Popen', 'subprocess.Popen', (["['ldd', lib_path]"], {'stdout': 'subprocess.PIPE'}), "(['ldd', lib_path], stdout=subprocess.PIPE)\n", (2311, 2354), False, 'import subprocess\n')] |
from datetime import datetime as dt
from flask import current_app as app, request, jsonify, render_template, url_for, redirect, g, abort
from flask_basicauth import BasicAuth
from sqlalchemy.sql import text
from sqlalchemy import create_engine
from healthcheck import HealthCheck, EnvironmentDump
basic_auth = BasicA... | [
"flask.render_template",
"healthcheck.HealthCheck",
"flask.current_app.route",
"sqlalchemy.create_engine",
"sqlalchemy.sql.text",
"flask_basicauth.BasicAuth",
"flask.url_for",
"flask.request.get_json",
"healthcheck.EnvironmentDump",
"flask.current_app.errorhandler"
] | [((314, 328), 'flask_basicauth.BasicAuth', 'BasicAuth', (['app'], {}), '(app)\n', (323, 328), False, 'from flask_basicauth import BasicAuth\n'), ((1092, 1122), 'flask.current_app.errorhandler', 'app.errorhandler', (['InvalidUsage'], {}), '(InvalidUsage)\n', (1108, 1122), True, 'from flask import current_app as app, req... |
import tensorflow as tf
from onnx_tf.handlers.backend_handler import BackendHandler
from onnx_tf.handlers.handler import onnx_op
from onnx_tf.handlers.handler import tf_func
@onnx_op("Clip")
@tf_func(tf.clip_by_value)
class Cast(BackendHandler):
@classmethod
def _common(cls, node, **kwargs):
x = kwargs["ten... | [
"onnx_tf.handlers.handler.tf_func",
"onnx_tf.handlers.handler.onnx_op"
] | [((178, 193), 'onnx_tf.handlers.handler.onnx_op', 'onnx_op', (['"""Clip"""'], {}), "('Clip')\n", (185, 193), False, 'from onnx_tf.handlers.handler import onnx_op\n'), ((195, 220), 'onnx_tf.handlers.handler.tf_func', 'tf_func', (['tf.clip_by_value'], {}), '(tf.clip_by_value)\n', (202, 220), False, 'from onnx_tf.handlers... |
# Copyright 2019 The Magenta Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | [
"tensorflow.logging.warning",
"magenta.pipelines.statistics.Counter",
"magenta.pipelines.melody_pipelines.extract_melodies",
"magenta.music.sequences_lib.assert_is_relative_quantized_sequence",
"magenta.pipelines.chord_pipelines.extract_chords_for_melodies",
"copy.deepcopy",
"magenta.music.LeadSheet"
] | [((5670, 5741), 'magenta.music.sequences_lib.assert_is_relative_quantized_sequence', 'sequences_lib.assert_is_relative_quantized_sequence', (['quantized_sequence'], {}), '(quantized_sequence)\n', (5721, 5741), False, 'from magenta.music import sequences_lib\n'), ((5881, 6240), 'magenta.pipelines.melody_pipelines.extrac... |
import json
class GoldenStandardLoader:
"""
A class used to represent the golden standard (ground truth) of a dataset
Attributes
----------
expected_matches: set
The expected matches in a set of frozensets
size: int
The size of the golden standard
Methods
-------
... | [
"json.load"
] | [((1074, 1094), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (1083, 1094), False, 'import json\n')] |
# Generated by Django 2.2.1 on 2019-06-28 05:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('students', '0002_institutionalemail'),
]
operations = [
migrations.RemoveField(
model_name='institutionalemail',
name='addre... | [
"django.db.migrations.RemoveField"
] | [((228, 305), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""institutionalemail"""', 'name': '"""address_email"""'}), "(model_name='institutionalemail', name='address_email')\n", (250, 305), False, 'from django.db import migrations\n')] |
import requests
from django.contrib import messages
import time
def post_info(code):
url = 'https://www.instagram.com/p/%s/?__a=1' % code
req_session = requests.Session()
request_respond = req_session.get(url).json()['graphql']['shortcode_media']
return {
'text': request_respond['edge_media_to_... | [
"requests.Session",
"time.sleep"
] | [((161, 179), 'requests.Session', 'requests.Session', ([], {}), '()\n', (177, 179), False, 'import requests\n'), ((1114, 1132), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1130, 1132), False, 'import requests\n'), ((1546, 1560), 'time.sleep', 'time.sleep', (['(30)'], {}), '(30)\n', (1556, 1560), False, '... |
#!/usr/bin/env python
import numpy
import os
from PIL import Image
from wordcloud import WordCloud
import matplotlib.pyplot as plt
# open SECH.png
shape = numpy.array(Image.open("img/SECH.png"))
dirname = path.dirname(__file__) if "__file__" in locals() else os.getcwd()
# open sech_name.txt that contains all my pos... | [
"matplotlib.pyplot.imshow",
"PIL.Image.open",
"os.getcwd",
"wordcloud.WordCloud",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.show"
] | [((653, 700), 'matplotlib.pyplot.imshow', 'plt.imshow', (['wordcloud'], {'interpolation': '"""bilinear"""'}), "(wordcloud, interpolation='bilinear')\n", (663, 700), True, 'import matplotlib.pyplot as plt\n'), ((757, 772), 'matplotlib.pyplot.axis', 'plt.axis', (['"""off"""'], {}), "('off')\n", (765, 772), True, 'import ... |
from IMLearn.learners import UnivariateGaussian, MultivariateGaussian
import numpy as np
import plotly.graph_objects as go
import plotly.io as pio
from utils import *
pio.templates.default = "simple_white"
import plotly.io as pio
pio.renderers.default = "browser"
def test_univariate_gaussian():
mu = 10
sigma... | [
"numpy.random.normal",
"plotly.graph_objects.Layout",
"numpy.random.multivariate_normal",
"numpy.argmax",
"numpy.array",
"plotly.graph_objects.Figure",
"numpy.apply_along_axis",
"IMLearn.learners.MultivariateGaussian.log_likelihood",
"numpy.random.seed",
"numpy.linspace",
"plotly.graph_objects.S... | [((395, 428), 'numpy.random.normal', 'np.random.normal', (['mu', 'sigma', '(1000)'], {}), '(mu, sigma, 1000)\n', (411, 428), True, 'import numpy as np\n'), ((437, 457), 'IMLearn.learners.UnivariateGaussian', 'UnivariateGaussian', ([], {}), '()\n', (455, 457), False, 'from IMLearn.learners import UnivariateGaussian, Mul... |
# Copyright (C) 2017, Cyberhaven
# Copyright (C) 2017, Dependable Systems Laboratory, EPFL
#
# 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 ... | [
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"subprocess.Popen",
"os.path.join",
"os.path.isfile",
"os.path.dirname",
"os.path.basename",
"pefile.PE"
] | [((3616, 3637), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (3626, 3637), False, 'import os\n'), ((4281, 4343), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Downloads symbol files."""'}), "(description='Downloads symbol files.')\n", (4304, 4343), False, 'import ar... |
#******************************************************************************
#
# tempoGAN: A Temporally Coherent, Volumetric GAN for Super-resolution Fluid Flow
# Copyright 2018 <NAME>, <NAME>, <NAME>, <NAME>
#
# This program is free software, distributed under the terms of the
# Apache License, Version 2.0
... | [
"tensorflow.unstack",
"paramhelpers.getNextGenericPath",
"tensorflow.shape",
"tensorflow.transpose",
"numpy.array",
"fluiddataloader.FluidDataLoader",
"tensorflow.control_dependencies",
"tensorflow.ones_like",
"tensorflow.set_random_seed",
"sys.path.append",
"tensorflow.RunMetadata",
"paramhel... | [((632, 659), 'sys.path.append', 'sys.path.append', (['"""../tools"""'], {}), "('../tools')\n", (647, 659), False, 'import sys\n'), ((1003, 1044), 'paramhelpers.getParam', 'ph.getParam', (['"""basePath"""', '"""../2ddata_gan/"""'], {}), "('basePath', '../2ddata_gan/')\n", (1014, 1044), True, 'import paramhelpers as ph\... |
# -*- coding: utf-8 -*-
import json
import logging
import tempfile
import fiona
import geopandas as gpd
from pywps import LiteralInput, ComplexOutput
from pywps import Process, FORMATS
from pywps.exceptions import InvalidParameterValue
from raven.utilities import gis
from raven.utils import archive_sniffer, single_fi... | [
"logging.getLogger",
"pywps.LiteralInput",
"raven.utils.parse_lonlat",
"raven.utilities.gis.get_hydrobasins_location_wfs",
"geopandas.read_file",
"raven.utilities.gis.get_hydrobasins_attributes_wfs",
"json.dumps",
"raven.utilities.gis.hydrobasins_upstream_ids",
"raven.utils.archive_sniffer",
"temp... | [((431, 457), 'logging.getLogger', 'logging.getLogger', (['"""PYWPS"""'], {}), "('PYWPS')\n", (448, 457), False, 'import logging\n'), ((3246, 3294), 'raven.utils.parse_lonlat', 'parse_lonlat', (["request.inputs['location'][0].data"], {}), "(request.inputs['location'][0].data)\n", (3258, 3294), False, 'from raven.utils ... |
import random
from datetime import timezone
from pathlib import Path
import pymongo
import pytest
from bson import CodecOptions
from pymongo_migrate.mongo_migrate import MongoMigrate
TEST_DIR = Path(__file__).parent
@pytest.fixture
def mongo_url():
return "mongodb://localhost:27017/"
@pytest.fixture
def db_n... | [
"pathlib.Path",
"bson.CodecOptions",
"pytest.fixture",
"pymongo.MongoClient",
"random.randint"
] | [((848, 864), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (862, 864), False, 'import pytest\n'), ((1121, 1137), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1135, 1137), False, 'import pytest\n'), ((197, 211), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (201, 211), False, 'from pathl... |
from flask import Flask, render_template, jsonify, request
from json import dump
from colony import Colony
# diaspora.py is a web service that serves space colonies.
# (built with Flask, served with gunicorn, deployed with heroku)
app = Flask(__name__, static_url_path='/static')
app.config["JSON_SORT_KEYS"] = False
... | [
"flask.render_template",
"flask.jsonify",
"colony.Colony",
"flask.Flask"
] | [((239, 281), 'flask.Flask', 'Flask', (['__name__'], {'static_url_path': '"""/static"""'}), "(__name__, static_url_path='/static')\n", (244, 281), False, 'from flask import Flask, render_template, jsonify, request\n'), ((367, 375), 'colony.Colony', 'Colony', ([], {}), '()\n', (373, 375), False, 'from colony import Colo... |
#!/usr/bin/env python
"""
Python interface to CUSOLVER functions.
Note: this module does not explicitly depend on PyCUDA.
"""
from . import cudart
if int(cudart._cudart_version) < 7000:
raise ImportError('CUSOLVER library only available in CUDA 7.0 and later')
import ctypes
import sys
import numpy as np
from... | [
"ctypes.byref",
"ctypes.cdll.LoadLibrary",
"ctypes.windll.LoadLibrary",
"ctypes.CDLL",
"ctypes.c_int",
"ctypes.c_void_p"
] | [((4227, 4244), 'ctypes.c_void_p', 'ctypes.c_void_p', ([], {}), '()\n', (4242, 4244), False, 'import ctypes\n'), ((5986, 6000), 'ctypes.c_int', 'ctypes.c_int', ([], {}), '()\n', (5998, 6000), False, 'import ctypes\n'), ((6933, 6947), 'ctypes.c_int', 'ctypes.c_int', ([], {}), '()\n', (6945, 6947), False, 'import ctypes\... |
import datetime
from tinydb import TinyDB, Query, where
import random
db = TinyDB('/home/pi/Projects/db.json')
#db.purge_tables() #everytime restart, just empty the tables
table = db.table('dht22')
table.purge()
timestamp = '{:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now())
#table.insert({'temp': '10C', 'humidit... | [
"datetime.datetime.now",
"tinydb.TinyDB",
"tinydb.where",
"random.randint"
] | [((76, 111), 'tinydb.TinyDB', 'TinyDB', (['"""/home/pi/Projects/db.json"""'], {}), "('/home/pi/Projects/db.json')\n", (82, 111), False, 'from tinydb import TinyDB, Query, where\n'), ((257, 280), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (278, 280), False, 'import datetime\n'), ((563, 598), 'ti... |
from __future__ import unicode_literals
import json
import logging
from auditlog.diff import model_instance_diff
from auditlog.middleware import get_current_user
def log_create(sender, instance, created, **kwargs):
"""
Signal receiver that creates a log entry when a model instance is first saved to the data... | [
"auditlog.middleware.get_current_user",
"json.dumps",
"auditlog.diff.model_instance_diff"
] | [((572, 607), 'auditlog.diff.model_instance_diff', 'model_instance_diff', (['None', 'instance'], {}), '(None, instance)\n', (591, 607), False, 'from auditlog.diff import model_instance_diff\n'), ((2180, 2215), 'auditlog.diff.model_instance_diff', 'model_instance_diff', (['instance', 'None'], {}), '(instance, None)\n', ... |
import logging
import json
import azure.functions as func
import azure.durable_functions as df
async def main(msg: func.ServiceBusMessage, starter: str):
logging.info("starting analyze_text_handler")
message_body = msg.get_body().decode('utf-8')
logging.info(f"message body: {message_body}")
... | [
"azure.durable_functions.DurableOrchestrationClient",
"logging.info"
] | [((165, 210), 'logging.info', 'logging.info', (['"""starting analyze_text_handler"""'], {}), "('starting analyze_text_handler')\n", (177, 210), False, 'import logging\n'), ((273, 318), 'logging.info', 'logging.info', (['f"""message body: {message_body}"""'], {}), "(f'message body: {message_body}')\n", (285, 318), False... |
import os
from threading import Timer
from typing import Any, Callable
from tabulate import tabulate
from gacoan import config
def debounce(wait: float):
"""Debounce function"""
def decorator(callback: Callable[[Any], Any]):
def debounced(*args, **kwargs):
def call_it():
... | [
"tabulate.tabulate",
"os.system",
"threading.Timer"
] | [((1017, 1065), 'os.system', 'os.system', (["('cls' if os.name == 'nt' else 'clear')"], {}), "('cls' if os.name == 'nt' else 'clear')\n", (1026, 1065), False, 'import os\n'), ((3883, 4165), 'tabulate.tabulate', 'tabulate', (["[['Kasir', gacoan.cashier.utilization], ['<NAME>', gacoan.boiler.\n utilization], ['Penggor... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Initialization module for artellapipe-dccs-maya
"""
import os
import logging.config
# =================================================================================
PACKAGE = 'artellapipe.dccs.maya'
# ============================================================... | [
"os.makedirs",
"tpDcc.libs.python.importer.init_importer",
"artellapipe.dccs.maya.register.register_class",
"os.path.dirname",
"os.path.isdir",
"os.path.expanduser"
] | [((536, 577), 'artellapipe.dccs.maya.register.register_class', 'register.register_class', (['"""logger"""', 'logger'], {}), "('logger', logger)\n", (559, 577), False, 'from artellapipe.dccs.maya import register\n'), ((583, 622), 'tpDcc.libs.python.importer.init_importer', 'importer.init_importer', ([], {'package': 'PAC... |
import asyncio
import threading
from .bittorrent import Session
from .torrentsearchengine import TorrentSearchEngine
from .webapi import WebApplication
from .webviewgui import WebviewGui
def run_app(**kwargs):
name = kwargs.get("name", "TorrentTV")
host = kwargs.get("host", "localhost")
port = kwargs.get(... | [
"threading.Thread",
"asyncio.set_event_loop",
"asyncio.Queue",
"asyncio.new_event_loop"
] | [((1128, 1156), 'asyncio.set_event_loop', 'asyncio.set_event_loop', (['loop'], {}), '(loop)\n', (1150, 1156), False, 'import asyncio\n'), ((366, 390), 'asyncio.new_event_loop', 'asyncio.new_event_loop', ([], {}), '()\n', (388, 390), False, 'import asyncio\n'), ((415, 447), 'asyncio.Queue', 'asyncio.Queue', ([], {'loop'... |
import os
import torch
import torch.nn as nn
from torch.nn import CrossEntropyLoss, MSELoss
from reformer.model import ReforBertLM, Reformer
from finetuning.pretrained_model import ReforBertPreTrainedModel
class ReforBertForQA(ReforBertPreTrainedModel):
def __init__( self, config):
super().__init__(config... | [
"reformer.model.ReforBertLM",
"torch.nn.CrossEntropyLoss",
"torch.load",
"os.path.isfile",
"torch.nn.Linear",
"torch.device"
] | [((429, 591), 'reformer.model.ReforBertLM', 'ReforBertLM', ([], {'num_tokens': 'config.vocab_size', 'dim': 'config.embedding_size', 'depth': 'config.depth', 'heads': 'config.heads', 'max_seq_len': 'config.max_seq_len', 'causal': '(True)'}), '(num_tokens=config.vocab_size, dim=config.embedding_size, depth=\n config.d... |
# Check the following urls for more info about Pan-STARRS:
#
# https://outerspace.stsci.edu/display/PANSTARRS/PS1+Image+Cutout+Service#PS1ImageCutoutService-ImportantFITSimageformat,WCS,andflux-scalingnotes
# https://outerspace.stsci.edu/display/PANSTARRS/PS1+Stack+images#PS1Stackimages-Photometriccalibration
#... | [
"sep.sum_ellipse",
"numpy.log10",
"numpy.sqrt",
"numpy.log",
"numpy.nanmean",
"sep.Background",
"astropy.io.fits.open",
"photutils.CircularAnnulus",
"astropy.wcs.WCS",
"numpy.max",
"matplotlib.pyplot.close",
"photutils.CircularAperture",
"matplotlib.pyplot.subplots",
"pandas.DataFrame",
... | [((1452, 1485), 'sep.set_sub_object_limit', 'sep.set_sub_object_limit', (['(10000.0)'], {}), '(10000.0)\n', (1476, 1485), False, 'import sep\n'), ((1996, 2048), 'numpy.sqrt', 'np.sqrt', (['((X - centre[0]) ** 2 + (Y - centre[1]) ** 2)'], {}), '((X - centre[0]) ** 2 + (Y - centre[1]) ** 2)\n', (2003, 2048), True, 'impor... |
import filecmp
import os
import pathlib
from typing import Optional
from approvaltests.core.namer import Namer
from approvaltests.core.reporter import Reporter
from approvaltests.core.writer import Writer
def exists(path: str) -> bool:
return os.path.isfile(path)
class ReporterNotWorkingException(Exception):
... | [
"os.path.isfile",
"filecmp.cmp",
"pathlib.Path",
"os.remove"
] | [((250, 270), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (264, 270), False, 'import os\n'), ((1747, 1788), 'filecmp.cmp', 'filecmp.cmp', (['approved_file', 'received_file'], {}), '(approved_file, received_file)\n', (1758, 1788), False, 'import filecmp\n'), ((1336, 1360), 'os.remove', 'os.remove', (... |
from sitefab.plugins import PostProcessor
from sitefab.SiteFab import SiteFab
from tabulate import tabulate
class ReadTime(PostProcessor):
def process(self, post, site, config):
if post.md and len(post.md):
wps = config.wpm / 60
num_sec = post.nlp.stats.counts.words / wps
... | [
"tabulate.tabulate"
] | [((887, 918), 'tabulate.tabulate', 'tabulate', (['info'], {'tablefmt': '"""html"""'}), "(info, tablefmt='html')\n", (895, 918), False, 'from tabulate import tabulate\n')] |
from typing import Dict, Any
import json
from e2e.Classes.Transactions.Transactions import Transactions
from e2e.Meros.RPC import RPC
from e2e.Meros.Liver import Liver
from e2e.Meros.Syncer import Syncer
def MultiInputClaimTest(
rpc: RPC
) -> None:
with open("e2e/Vectors/Transactions/MultiInputClaim.json", "r") ... | [
"e2e.Meros.Liver.Liver",
"e2e.Meros.Syncer.Syncer",
"e2e.Classes.Transactions.Transactions.Transactions.fromJSON"
] | [((416, 462), 'e2e.Classes.Transactions.Transactions.Transactions.fromJSON', 'Transactions.fromJSON', (["vectors['transactions']"], {}), "(vectors['transactions'])\n", (437, 462), False, 'from e2e.Classes.Transactions.Transactions import Transactions\n'), ((467, 514), 'e2e.Meros.Liver.Liver', 'Liver', (['rpc', "vectors... |
from systems.manage import service, runtime, template, task
from systems.indexer import Indexer
from utility.terminal import TerminalMixin
from utility.environment import Environment
import pathlib
import copy
import logging
logger = logging.getLogger(__name__)
class Manager(
TerminalMixin,
service.Manager... | [
"logging.getLogger",
"utility.environment.Environment.get_env",
"pathlib.Path",
"copy.deepcopy",
"systems.indexer.Indexer"
] | [((237, 264), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (254, 264), False, 'import logging\n'), ((474, 495), 'utility.environment.Environment.get_env', 'Environment.get_env', ([], {}), '()\n', (493, 495), False, 'from utility.environment import Environment\n'), ((623, 636), 'systems.... |
#!/usr/bin/env python
import numpy as np
import pandas as pd
from scipy.sparse import csr_matrix
from sklearn.neighbors import NearestNeighbors
import matplotlib.pyplot as plt
from scipy.sparse import csr_matrix
# get data files
books_filename = 'BX-Books.csv'
ratings_filename = 'BX-Book-Ratings.csv'
users_filename =... | [
"pandas.read_csv",
"pandas.merge",
"pandas.set_option",
"sklearn.neighbors.NearestNeighbors",
"scipy.sparse.csr_matrix"
] | [((348, 560), 'pandas.read_csv', 'pd.read_csv', (['books_filename'], {'encoding': '"""ISO-8859-1"""', 'sep': '""";"""', 'header': '(0)', 'names': "['bookId', 'title', 'author']", 'usecols': "['bookId', 'title', 'author']", 'dtype': "{'bookId': 'str', 'title': 'str', 'author': 'str'}"}), "(books_filename, encoding='ISO-... |
""" Methods for processing submissions to the BioSimulators registry
:Author: <NAME> <<EMAIL>>
:Date: 2020-12-06
:Copyright: 2020, Center for Reproducible Biomedical Modeling
:License: MIT
"""
from .data_model import SimulatorSubmission
import io
import yamldown
__all__ = ['get_simulator_submission_from_gh_issue_bod... | [
"yamldown.load"
] | [((699, 725), 'yamldown.load', 'yamldown.load', (['body_stream'], {}), '(body_stream)\n', (712, 725), False, 'import yamldown\n')] |
description = "Restart's setup. Will require you to agree to ToS again."
import discord
import core.commands.setup as setup
import core.commands.special.removesetup as removesetup
import time
async def main(message, args, client, serverdata):
if message.author != message.guild.owner:
embed = discord.Embed... | [
"core.commands.special.removesetup.main",
"core.commands.setup.main",
"discord.Embed",
"time.sleep"
] | [((714, 864), 'discord.Embed', 'discord.Embed', ([], {'title': '"""Resetting Server"""', 'description': '"""This will take some time if the bot is under heavy load."""', 'color': '(15856113)', 'type': '"""rich"""'}), "(title='Resetting Server', description=\n 'This will take some time if the bot is under heavy load.... |
"""Custom validation logic"""
from django.core.exceptions import ValidationError
def validate_initial_cap(value):
"""Sample validation"""
if not value[0].isupper():
raise ValidationError('First character should be capital')
| [
"django.core.exceptions.ValidationError"
] | [((190, 242), 'django.core.exceptions.ValidationError', 'ValidationError', (['"""First character should be capital"""'], {}), "('First character should be capital')\n", (205, 242), False, 'from django.core.exceptions import ValidationError\n')] |
#!/usr/bin/env python
#
# Copyright 2016 <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 agre... | [
"tornado.escape.json_encode",
"tornado.escape.json_decode",
"firenado.service.served_by"
] | [((1389, 1443), 'firenado.service.served_by', 'service.served_by', (['"""ddosso.services.SocialLinkService"""'], {}), "('ddosso.services.SocialLinkService')\n", (1406, 1443), False, 'from firenado import service\n'), ((1065, 1087), 'tornado.escape.json_decode', 'json_decode', (['user_json'], {}), '(user_json)\n', (1076... |
import pytest
from django.core.exceptions import FieldDoesNotExist
from heroku_connect.models import TRIGGER_LOG_STATE, TriggerLog, TriggerLogArchive
from tests.conftest import make_trigger_log, make_trigger_log_for_model
@pytest.mark.django_db
class TestTriggerLog:
def test_is_archived(self, archived_trigger_lo... | [
"heroku_connect.models.TriggerLog.objects.failed",
"heroku_connect.models.TriggerLog.objects.all",
"heroku_connect.models.TriggerLog.objects.count",
"tests.conftest.make_trigger_log_for_model",
"tests.conftest.make_trigger_log",
"heroku_connect.models.TriggerLog.objects.related_to",
"pytest.raises",
"... | [((746, 789), 'tests.conftest.make_trigger_log_for_model', 'make_trigger_log_for_model', (['connected_model'], {}), '(connected_model)\n', (772, 789), False, 'from tests.conftest import make_trigger_log, make_trigger_log_for_model\n'), ((1444, 1468), 'heroku_connect.models.TriggerLog.objects.get', 'TriggerLog.objects.g... |
from PyQt5.QtCore import QObject, pyqtSignal, QTimer
from numpy.random import choice
from .StupidAIDetective import StupidAIDetective
from .StupidAIMrX import StupidAIMrX
from .abstractdetective import AbstractDetective
from .abstractmrx import AbstractMrX
class IllegalMoveException(Exception):
pass
class Game... | [
"PyQt5.QtCore.pyqtSignal"
] | [((362, 374), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (372, 374), False, 'from PyQt5.QtCore import QObject, pyqtSignal, QTimer\n'), ((398, 413), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', (['str'], {}), '(str)\n', (408, 413), False, 'from PyQt5.QtCore import QObject, pyqtSignal, QTimer\n')] |
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
# pyre-strict
import json
import logging
from typing import List, Optional
from fbpcp.service.onedocker import OneD... | [
"logging.getLogger",
"json.dumps",
"fbpcs.private_computation.service.utils.get_pc_status_from_stage_state",
"fbpcs.common.entity.stage_state_instance.StageStateInstance"
] | [((1666, 1693), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1683, 1693), False, 'import logging\n'), ((3644, 3756), 'fbpcs.common.entity.stage_state_instance.StageStateInstance', 'StageStateInstance', (['pc_instance.instance_id', 'pc_instance.current_stage.name'], {'containers': '[con... |
"""
Contains helper functions that can used across the module.
"""
import logging
import tempfile
from os.path import dirname
from jinja2 import Template
from ceph.utils import get_node_by_id, get_nodes_by_ids
LOG = logging.getLogger(__name__)
class UnknownSpecFound(Exception):
pass
class GenerateServiceSpec... | [
"logging.getLogger",
"jinja2.Template",
"ceph.utils.get_node_by_id",
"os.path.dirname",
"tempfile.NamedTemporaryFile",
"ceph.utils.get_nodes_by_ids"
] | [((219, 246), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (236, 246), False, 'import logging\n'), ((2265, 2307), 'ceph.utils.get_nodes_by_ids', 'get_nodes_by_ids', (['self.cluster', 'node_names'], {}), '(self.cluster, node_names)\n', (2281, 2307), False, 'from ceph.utils import get_nod... |
import random
import sys
import acpc_python_client as acpc
from tools.agent_utils import select_action, get_info_set
from tools.io_util import read_strategy_from_file
class StrategyAgent(acpc.Agent):
"""Agent able to play any game when provided with game definition and correct strategy."""
def __init__(sel... | [
"tools.io_util.read_strategy_from_file",
"tools.agent_utils.select_action",
"tools.agent_utils.get_info_set",
"sys.exit",
"acpc_python_client.Client"
] | [((1060, 1110), 'acpc_python_client.Client', 'acpc.Client', (['sys.argv[1]', 'sys.argv[3]', 'sys.argv[4]'], {}), '(sys.argv[1], sys.argv[3], sys.argv[4])\n', (1071, 1110), True, 'import acpc_python_client as acpc\n'), ((395, 444), 'tools.io_util.read_strategy_from_file', 'read_strategy_from_file', (['None', 'strategy_f... |
import torch
import numpy as np
import time
import tqdm
from .data_transforms import TransformedDataset
def test_unc_model(model, dataset, device, batch_size=1, **forward_kwargs):
pin_memory = True
if device == torch.device("cpu"):
pin_memory = False
dataloader = torch.utils.data.DataLoader(data... | [
"numpy.mean",
"numpy.sqrt",
"numpy.std",
"tqdm.tqdm",
"numpy.concatenate",
"torch.utils.data.DataLoader",
"time.time",
"torch.device"
] | [((288, 404), 'torch.utils.data.DataLoader', 'torch.utils.data.DataLoader', (['dataset'], {'batch_size': 'batch_size', 'shuffle': '(False)', 'num_workers': '(4)', 'pin_memory': 'pin_memory'}), '(dataset, batch_size=batch_size, shuffle=False,\n num_workers=4, pin_memory=pin_memory)\n', (315, 404), False, 'import torc... |
from rest_framework.routers import DefaultRouter
from django.urls import path, include
from procurement.views import ProcurementViewSet
router = DefaultRouter()
router.register(r'procurements', ProcurementViewSet, basename="procurement")
urlpatterns = [
path('', include(router.urls))
]
| [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((147, 162), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (160, 162), False, 'from rest_framework.routers import DefaultRouter\n'), ((271, 291), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (278, 291), False, 'from django.urls import path, include\n')] |
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from quedadas.views import views, user, meeting, chats, challenge, rankings, trophies
urlpatterns = [
# Views views
url(r'^$', views.api_root),
# View meetings
url(r'^meetings$', meeting.MeetingList.as_view... | [
"quedadas.views.meeting.MeetingDetail.as_view",
"quedadas.views.user.Friends.as_view",
"quedadas.views.challenge.ChallengeList.as_view",
"quedadas.views.user.UserList.as_view",
"quedadas.views.rankings.ZoneDetail.as_view",
"rest_framework.urlpatterns.format_suffix_patterns",
"django.conf.urls.url",
"q... | [((3155, 3190), 'rest_framework.urlpatterns.format_suffix_patterns', 'format_suffix_patterns', (['urlpatterns'], {}), '(urlpatterns)\n', (3177, 3190), False, 'from rest_framework.urlpatterns import format_suffix_patterns\n'), ((221, 246), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.api_root'], {}), "('^$', view... |
# -*- coding: utf-8 -*-
# %BST_LICENCE_TEXT%
import visr
import rrl
import audiointerfaces as ai
from visr_bst import RealtimeHoaObjectToBinauralRenderer
from visr_bst.tracker import RazorAHRSWithUdpCalibrationTrigger
import os
from sys import platform, exit
############ CONFIG ###############
fs = 48000
blockSize... | [
"os.path.exists",
"visr_bst.RealtimeHoaObjectToBinauralRenderer",
"audiointerfaces.AudioInterfaceFactory.create",
"audiointerfaces.AudioInterface.Configuration",
"visr.SignalFlowContext",
"rrl.checkConnectionIntegrity",
"sys.exit",
"rrl.AudioSignalFlow"
] | [((2526, 2563), 'visr.SignalFlowContext', 'visr.SignalFlowContext', (['blockSize', 'fs'], {}), '(blockSize, fs)\n', (2548, 2563), False, 'import visr\n'), ((2577, 3022), 'visr_bst.RealtimeHoaObjectToBinauralRenderer', 'RealtimeHoaObjectToBinauralRenderer', (['context', '"""HoaRenderer"""', 'None'], {'numberOfObjects': ... |
import unittest
import logging
import os, json
from micloud import MiCloud
from tests.configuration import setup_testing_environment
setup_testing_environment()
class TestMiCloud(unittest.TestCase):
"""def test_login_success(self):
mc = MiCloud(os.getenv("USERNAME"), os.getenv("PASSWORD"))
f = o... | [
"unittest.main",
"tests.configuration.setup_testing_environment",
"os.getenv"
] | [((135, 162), 'tests.configuration.setup_testing_environment', 'setup_testing_environment', ([], {}), '()\n', (160, 162), False, 'from tests.configuration import setup_testing_environment\n'), ((800, 815), 'unittest.main', 'unittest.main', ([], {}), '()\n', (813, 815), False, 'import unittest\n'), ((503, 524), 'os.gete... |
from __future__ import print_function
import diskspace
import argparse
import sys
import os
import subprocess
import re
import unittest
import StringIO
class TestDiskspace(unittest.TestCase):
def setUp(self):
self.cmd = 'du '
self.abs_directory = os.path.abspath('.')
self.cm... | [
"StringIO.StringIO",
"diskspace.subprocess_check_output",
"diskspace.show_space_list",
"diskspace.print_tree",
"diskspace.bytes_to_readable",
"unittest.main",
"os.path.abspath"
] | [((2222, 2237), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2235, 2237), False, 'import unittest\n'), ((280, 300), 'os.path.abspath', 'os.path.abspath', (['"""."""'], {}), "('.')\n", (295, 300), False, 'import os\n'), ((628, 647), 'StringIO.StringIO', 'StringIO.StringIO', ([], {}), '()\n', (645, 647), False, '... |
from django.db import models
from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from admin_sso import settings
class OpenIDUser(models.Model):
claimed_id = models.TextField(max_length=2047)
email = models.EmailField()
fullname = models.CharField(max_length=255)
... | [
"django.db.models.EmailField",
"django.utils.translation.ugettext_lazy",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.utils.timezone.now",
"django.db.models.CharField"
] | [((206, 239), 'django.db.models.TextField', 'models.TextField', ([], {'max_length': '(2047)'}), '(max_length=2047)\n', (222, 239), False, 'from django.db import models\n'), ((252, 271), 'django.db.models.EmailField', 'models.EmailField', ([], {}), '()\n', (269, 271), False, 'from django.db import models\n'), ((287, 319... |
def Poisson(lambd, N):
""" Devuelve una lista con elementos que siguen la distribución de Poisson
Parameters
----------
lambd : int
Es la tasa de la distribución
N : int
Número de puntos, tiempo trancurrido
Returns
-------
list
Lista de valores "k" para ... | [
"numpy.random.random",
"math.factorial",
"numpy.exp",
"numpy.empty",
"numpy.cumsum"
] | [((573, 587), 'numpy.empty', 'np.empty', (['maxk'], {}), '(maxk)\n', (581, 587), True, 'import numpy as np\n'), ((741, 759), 'numpy.cumsum', 'np.cumsum', (['Poisson'], {}), '(Poisson)\n', (750, 759), True, 'import numpy as np\n'), ((899, 918), 'numpy.random.random', 'np.random.random', (['N'], {}), '(N)\n', (915, 918),... |
from typing import Type, Optional
from ray.rllib.algorithms.sac import (
SAC,
SACConfig,
)
from ray.rllib.algorithms.sac.rnnsac_torch_policy import RNNSACTorchPolicy
from ray.rllib.policy.policy import Policy
from ray.rllib.utils.annotations import override
from ray.rllib.utils.typing import AlgorithmConfigDic... | [
"ray.rllib.utils.annotations.override",
"ray.rllib.utils.deprecation.Deprecated"
] | [((2427, 2446), 'ray.rllib.utils.annotations.override', 'override', (['SACConfig'], {}), '(SACConfig)\n', (2435, 2446), False, 'from ray.rllib.utils.annotations import override\n'), ((3392, 3405), 'ray.rllib.utils.annotations.override', 'override', (['SAC'], {}), '(SAC)\n', (3400, 3405), False, 'from ray.rllib.utils.an... |
"""
celeste_bot.py
"""
import requests
import re
from time import sleep
from datetime import datetime
from typing import Callable
from enum import IntEnum
from data_models import CelesteGameVersion, Credentials, CelesteGames
from random import randint, random
from requests.models import Response
from urllib.parse impo... | [
"requests.post",
"urllib.parse.urlparse",
"re.compile",
"time.sleep",
"datetime.datetime.today",
"random.random",
"twitch.TwitchHelix",
"random.randint"
] | [((2311, 2336), 're.compile', 're.compile', (['"""^\\\\d{9,11}$"""'], {}), "('^\\\\d{9,11}$')\n", (2321, 2336), False, 'import re\n'), ((2639, 2779), 'twitch.TwitchHelix', 'TwitchHelix', ([], {'scopes': '[OAUTH_SCOPE_ANALYTICS_READ_EXTENSIONS]', 'client_id': 'self.CREDS.twitch.client', 'client_secret': 'self.CREDS.twit... |
import collections
import unittest
import utils
# O(n) time. O(1) space. Hash table.
class Solution:
def commonChars(self, A):
"""
:type A: List[str]
:rtype: List[str]
"""
counter = collections.Counter(A[0])
for a in A:
counter &= collections.Counter(a)... | [
"unittest.main",
"utils.load_test_json",
"collections.Counter"
] | [((701, 716), 'unittest.main', 'unittest.main', ([], {}), '()\n', (714, 716), False, 'import unittest\n'), ((228, 253), 'collections.Counter', 'collections.Counter', (['A[0]'], {}), '(A[0])\n', (247, 253), False, 'import collections\n'), ((298, 320), 'collections.Counter', 'collections.Counter', (['a'], {}), '(a)\n', (... |
from typing import Tuple
import gym
import torch
from push_ups import agent_base
def run_episode(
agent: agent_base.Agent, env: gym.Env
) -> Tuple[agent_base.Agent, torch.Tensor]:
"""
Perform one simulation (episode) to collect data for the policy update.
"""
obs = env.reset()
rewards = torc... | [
"torch.tensor",
"torch.Tensor"
] | [((316, 334), 'torch.Tensor', 'torch.Tensor', (['(0)', '(1)'], {}), '(0, 1)\n', (328, 334), False, 'import torch\n'), ((526, 546), 'torch.tensor', 'torch.tensor', (['reward'], {}), '(reward)\n', (538, 546), False, 'import torch\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2017 <NAME>
"""dsa_signin_sheets URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app impor... | [
"signin_sheets.views.EventListView.as_view",
"django.conf.urls.url",
"signin_sheets.views.EventDetailView.as_view",
"signin_sheets.views.HomePageView.as_view",
"signin_sheets.views.EventCreateView.as_view",
"signin_sheets.views.FirstRun.as_view",
"signin_sheets.views.EventDeleteView.as_view"
] | [((1147, 1194), 'django.conf.urls.url', 'url', (['"""^login/$"""', 'auth_views.login'], {'name': '"""login"""'}), "('^login/$', auth_views.login, name='login')\n", (1150, 1194), False, 'from django.conf.urls import url\n'), ((1201, 1245), 'django.conf.urls.url', 'url', (['"""^logout/$"""', 'user_logout'], {'name': '"""... |
from dateutil.relativedelta import *
from eventtools.models import Rule
from eventtools_testapp.models import *
from eventtools.utils.dateranges import *
from datetime import datetime, date, timedelta
def fixture(obj):
obj.gallery = ExampleVenue.objects.create(name="Gallery A", slug="gallery-A")
obj.auditorium... | [
"datetime.datetime",
"datetime.timedelta",
"datetime.datetime.now",
"datetime.date",
"eventtools.models.Rule.objects.create",
"datetime.date.today",
"datetime.datetime.combine"
] | [((812, 830), 'datetime.date', 'date', (['(2010)', '(10)', '(10)'], {}), '(2010, 10, 10)\n', (816, 830), False, 'from datetime import datetime, date, timedelta\n'), ((3757, 3796), 'eventtools.models.Rule.objects.create', 'Rule.objects.create', ([], {'frequency': '"""WEEKLY"""'}), "(frequency='WEEKLY')\n", (3776, 3796),... |
from django.views import View
from articles.models import Article
from comments.models import Comment
from django.http import JsonResponse
from utils.decorators import fail_safe_api
from utils.models import nested_model_to_dict
from utils.request import parse_body, set_user
from utils.koora import deleteImageFor, gener... | [
"utils.koora.deleteImageFor",
"django.http.JsonResponse",
"utils.request.parse_body",
"utils.models.nested_model_to_dict",
"utils.koora.setTagsFor",
"comments.models.Comment.objects.create",
"utils.decorators.fail_safe_api",
"utils.koora.uploadImageFor",
"utils.request.set_user",
"articles.models.... | [((652, 684), 'utils.decorators.fail_safe_api', 'fail_safe_api', ([], {'for_model': 'Article'}), '(for_model=Article)\n', (665, 684), False, 'from utils.decorators import fail_safe_api\n'), ((1036, 1095), 'utils.decorators.fail_safe_api', 'fail_safe_api', ([], {'for_model': 'Article', 'needs_authentication': '(True)'})... |
import numpy as np
import numbers
import six
import datetime
import pyarrow as pa
MAX_LENGTH = 50
def _trim_string(value):
if len(value) > MAX_LENGTH:
value = repr(value[:MAX_LENGTH-3])[:-1] + '...'
return value
def _format_value(value):
# print("value = ", value, type(value), isinstance(value,... | [
"numpy.timedelta64",
"numpy.isnat",
"numpy.mod"
] | [((800, 815), 'numpy.isnat', 'np.isnat', (['value'], {}), '(value)\n', (808, 815), True, 'import numpy as np\n'), ((985, 1000), 'numpy.isnat', 'np.isnat', (['value'], {}), '(value)\n', (993, 1000), True, 'import numpy as np\n'), ((1169, 1192), 'numpy.mod', 'np.mod', (['tmp.seconds', '(60)'], {}), '(tmp.seconds, 60)\n',... |
import sys
import os
import argparse
import multiprocessing as mp
from montreal_forced_aligner import __version__
from montreal_forced_aligner.utils import get_available_acoustic_languages, get_available_g2p_languages, \
get_available_dict_languages, get_available_lm_languages, get_available_ivector_languages
fro... | [
"montreal_forced_aligner.command_line.g2p.run_g2p",
"montreal_forced_aligner.command_line.train_lm.run_train_lm",
"multiprocessing.freeze_support",
"sys.exit",
"montreal_forced_aligner.utils.get_available_ivector_languages",
"montreal_forced_aligner.utils.get_available_acoustic_languages",
"montreal_for... | [((2141, 2175), 'montreal_forced_aligner.utils.get_available_acoustic_languages', 'get_available_acoustic_languages', ([], {}), '()\n', (2173, 2175), False, 'from montreal_forced_aligner.utils import get_available_acoustic_languages, get_available_g2p_languages, get_available_dict_languages, get_available_lm_languages,... |
# -*- coding: utf-8 -*-
"""Testing the assembly of information from ld.dicts"""
import unittest
import os
os.environ["TESTING_LDT"] = "TRUE"
import ldt
from ldt.helpers.ignore import ignore_warnings
class Tests(unittest.TestCase):
"""
The tests in this block inspect the loading of all the information from
... | [
"unittest.main",
"ldt.relations.word.Word"
] | [((1534, 1549), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1547, 1549), False, 'import unittest\n'), ((491, 526), 'ldt.relations.word.Word', 'ldt.relations.word.Word', (['"""kindness"""'], {}), "('kindness')\n", (514, 526), False, 'import ldt\n')] |
"""
Utility to call cloudformation command with args
"""
import os
import logging
import platform
import subprocess
import sys
from samcli.cli.global_config import GlobalConfig
LOG = logging.getLogger(__name__)
def execute_command(command, args, template_file):
LOG.debug("%s command is called", command)
tr... | [
"logging.getLogger",
"samcli.cli.global_config.GlobalConfig",
"subprocess.check_call",
"subprocess.Popen",
"os.environ.copy",
"platform.system",
"sys.exit"
] | [((186, 213), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (203, 213), False, 'import logging\n'), ((450, 464), 'samcli.cli.global_config.GlobalConfig', 'GlobalConfig', ([], {}), '()\n', (462, 464), False, 'from samcli.cli.global_config import GlobalConfig\n'), ((479, 496), 'os.environ.... |
from discord.ext import commands
import aiohttp
class DadJokes:
"""Random dad jokes from icanhazdadjoke.com"""
def __init__(self, bot):
self.bot = bot
@commands.command()
async def dadjoke(self):
"""Gets a random dad joke."""
api = 'https://icanhazdadjoke.com/'
async w... | [
"discord.ext.commands.command",
"aiohttp.request"
] | [((175, 193), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (191, 193), False, 'from discord.ext import commands\n'), ((324, 385), 'aiohttp.request', 'aiohttp.request', (['"""GET"""', 'api'], {'headers': "{'Accept': 'text/plain'}"}), "('GET', api, headers={'Accept': 'text/plain'})\n", (339, 385)... |
import numpy as np
import matplotlib.pyplot as plt
years = 501
eaten = np.loadtxt(f'./data/eaten-{years}.txt')
cow = eaten[:,0]
sheep = eaten[:,1]
print(cow.shape)
print(sheep.shape)
# kg/只
MASS = [
[753, 87.5, 3.94625],
[0, 0, 0],
[0, 0, 0]
]
# calorie/kg
# 所有能量都按照 million 计算
ENERGY_PER_MASS = np.array(... | [
"numpy.array",
"save_fig.save_to_file",
"numpy.loadtxt",
"matplotlib.pyplot.subplots",
"numpy.arange"
] | [((72, 111), 'numpy.loadtxt', 'np.loadtxt', (['f"""./data/eaten-{years}.txt"""'], {}), "(f'./data/eaten-{years}.txt')\n", (82, 111), True, 'import numpy as np\n'), ((892, 939), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(1)', 'ncols': '(1)', 'figsize': '(12, 8)'}), '(nrows=1, ncols=1, figsize=(12, 8)... |
from pathlib import Path
def get_sql_queries(path):
sql_queries = {}
for query_file in Path(path).glob("*.sql"):
with open(query_file, "r") as f:
sql_queries[query_file.stem] = f.read()
return sql_queries
| [
"pathlib.Path"
] | [((97, 107), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (101, 107), False, 'from pathlib import Path\n')] |
from math import cos, pi
from scipy import signal
import scipy.signal as sig
import matplotlib.pyplot as plt
import numpy
plt.close('all')
Fs = 5000 #Sample Frequ
sample = 5000 #Number of Samples
f = 100 #Sig gen Frequ
n = 2 #Order of Filter
rs = 30 ... | [
"matplotlib.pyplot.grid",
"scipy.signal.iirfilter",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.figure",
"numpy.sin",
"scipy.signal.freqz",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((129, 145), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (138, 145), True, 'import matplotlib.pyplot as plt\n'), ((424, 499), 'scipy.signal.iirfilter', 'sig.iirfilter', (['n', 'w_c', '(0)', 'rs'], {'btype': '"""lowpass"""', 'analog': '(False)', 'ftype': '"""butter"""'}), "(n, w_c, 0, rs, ... |
from conans import ConanFile, CMake, tools
import os
required_conan_version = ">=1.35.0"
class GeotransConan(ConanFile):
name = "geotrans"
license = (
"NGA GEOTRANS ToS (https://earth-info.nga.mil/php/download.php?file=wgs-terms)"
)
url = "https://github.com/conan-io/conan-center-index"
h... | [
"os.path.join",
"conans.tools.get",
"conans.CMake",
"os.walk"
] | [((1347, 1480), 'conans.tools.get', 'tools.get', ([], {'strip_root': '(True)', 'destination': 'self._source_subfolder', 'filename': '"""master.tgz"""'}), "(**self.conan_data['sources'][self.version], strip_root=True,\n destination=self._source_subfolder, filename='master.tgz')\n", (1356, 1480), False, 'from conans i... |
import datetime
from cStringIO import StringIO
from nose.tools import eq_, ok_
import mock
from django.utils import timezone
from django.test import TestCase
from airmozilla.manage import event_hit_stats
from airmozilla.main.models import Event, EventHitStats, Template
SAMPLE_STATISTICS_XML = (
'<?xml version="... | [
"airmozilla.main.models.Template.objects.create",
"mock.patch",
"nose.tools.eq_",
"airmozilla.main.models.EventHitStats.objects.count",
"airmozilla.main.models.Event.objects.archived",
"airmozilla.manage.event_hit_stats.update",
"airmozilla.main.models.EventHitStats.objects.create",
"django.utils.time... | [((1165, 1194), 'mock.patch', 'mock.patch', (['"""urllib2.urlopen"""'], {}), "('urllib2.urlopen')\n", (1175, 1194), False, 'import mock\n'), ((4056, 4111), 'mock.patch', 'mock.patch', (['"""airmozilla.manage.event_hit_stats.logging"""'], {}), "('airmozilla.manage.event_hit_stats.logging')\n", (4066, 4111), False, 'impo... |
from time import time
def count_stuff():
flag = ""
f = open("data.dat", "r"); data = f.read().split("\n")
check_zeros = lambda x: x.count('0') % 3 == 0
check_ones = lambda x: x.count('1') % 2 == 0
checked_data = [ line for line in data if (check_ones(line) or check_zeros(line)) and line ]
... | [
"time.time"
] | [((405, 411), 'time.time', 'time', ([], {}), '()\n', (409, 411), False, 'from time import time\n'), ((474, 480), 'time.time', 'time', ([], {}), '()\n', (478, 480), False, 'from time import time\n')] |
# Copyright (c) 2003-2019 by <NAME>
#
# TreeCorr is free software: redistribution and use in source and binary forms,
# with or without modification, are permitted provided that the following
# conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice, this
# list of conditions... | [
"numpy.sqrt",
"numpy.testing.assert_equal",
"numpy.log",
"math.log",
"treecorr.NNNCrossCorrelation",
"numpy.arctan2",
"test_helper.get_script_name",
"test_helper.do_pickle",
"numpy.genfromtxt",
"numpy.random.RandomState",
"test_helper.is_ccw",
"numpy.where",
"subprocess.Popen",
"numpy.test... | [((3284, 3359), 'treecorr.NNNCorrelation', 'treecorr.NNNCorrelation', ([], {'min_sep': '(5)', 'max_sep': '(20)', 'nbins': '(20)', 'bin_type': '"""LogRUV"""'}), "(min_sep=5, max_sep=20, nbins=20, bin_type='LogRUV')\n", (3307, 3359), False, 'import treecorr\n'), ((3716, 3842), 'treecorr.NNNCorrelation', 'treecorr.NNNCorr... |
#!/usr/bin/env python
#
# Copyright 2017, Data61
# Commonwealth Scientific and Industrial Research Organisation (CSIRO)
# ABN 41 687 119 230.
#
# This software may be distributed and modified according to the terms of
# the BSD 2-Clause license. Note that NO WARRANTY is provided.
# See "LICENSE_BSD2.txt" for details.
#... | [
"capdl.Spec",
"capdl.TCB"
] | [((549, 565), 'capdl.TCB', 'capdl.TCB', (['"""foo"""'], {}), "('foo')\n", (558, 565), False, 'import capdl\n'), ((578, 594), 'capdl.TCB', 'capdl.TCB', (['"""bar"""'], {}), "('bar')\n", (587, 594), False, 'import capdl\n'), ((612, 624), 'capdl.Spec', 'capdl.Spec', ([], {}), '()\n', (622, 624), False, 'import capdl\n'), ... |
# Batch Citation Machine GUI
import re, datetime, urllib.request
from bs4 import BeautifulSoup
from dateutil import parser
# Main Citation Functions
def citation_components(web_address):
req = urllib.request.Request(web_address, headers = {"User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) ... | [
"bs4.BeautifulSoup",
"dateutil.parser.parse",
"datetime.date.today",
"re.search"
] | [((482, 516), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""html.parser"""'], {}), "(html, 'html.parser')\n", (495, 516), False, 'from bs4 import BeautifulSoup\n'), ((2372, 2393), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (2391, 2393), False, 'import re, datetime, urllib.request\n'), ((2739,... |
"""
В одном городе запретили машинам останавливаться,
кроме как для посадки пасажира. А пассажир не
согласен ждать больше 3 минут. В этом городе
пешеход заказывает такси в точку X и указывает
интервал в 180 секунд. Водитель должен приехать
ровно в этот интервал. Если приехать раньше, то
ожидать пассажира будет нельзя. ... | [
"pathlib.Path.cwd"
] | [((1731, 1741), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (1739, 1741), False, 'from pathlib import Path\n')] |
import unittest
from app.models import Source
class NewsSource(unittest.TestCase):
"""
Test Class to test the behaviour of the Source class
"""
def setUp(self):
"""
Set up method that runs before every TestCase
"""
self.new_source = Source("ktn-news",
... | [
"app.models.Source"
] | [((283, 394), 'app.models.Source', 'Source', (['"""ktn-news"""', '"""ktn-news"""', '"""north east west and south"""', '"""https://ntv.nation.co.ke"""', '"""general"""', '"""Kenya"""'], {}), "('ktn-news', 'ktn-news', 'north east west and south',\n 'https://ntv.nation.co.ke', 'general', 'Kenya')\n", (289, 394), False,... |
import scrapy
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from shutil import which
from scrapy.selector import Selector
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditio... | [
"scrapy.selector.Selector",
"selenium.webdriver.Chrome",
"selenium.webdriver.Firefox",
"selenium.webdriver.firefox.options.Options",
"urllib.parse.urljoin"
] | [((491, 500), 'selenium.webdriver.firefox.options.Options', 'Options', ([], {}), '()\n', (498, 500), False, 'from selenium.webdriver.firefox.options import Options\n'), ((704, 764), 'selenium.webdriver.Chrome', 'webdriver.Chrome', (['"""/home/ratishankar/Downloads/chromedriver"""'], {}), "('/home/ratishankar/Downloads/... |
from pydantic import BaseModel
import pandas as pd
import os
def transform_to_dataframe(class_model: BaseModel) -> pd.DataFrame:
transition_dictionary = {key:[value] for key, value in class_model.dict().items()}
data_frame = pd.DataFrame(transition_dictionary)
return data_frame | [
"pandas.DataFrame"
] | [((237, 272), 'pandas.DataFrame', 'pd.DataFrame', (['transition_dictionary'], {}), '(transition_dictionary)\n', (249, 272), True, 'import pandas as pd\n')] |
"""Django management command to import admin objects."""
import csv
import os
import progressbar
from django.core.management.base import BaseCommand, CommandError
from modoboa.core import models as core_models
from modoboa.core.extensions import exts_pool
from modoboa.lib import events
from modoboa.lib.exceptions i... | [
"progressbar.Bar",
"os.path.exists",
"modoboa.core.extensions.exts_pool.load_all",
"modoboa.core.models.User.objects.filter",
"progressbar.Percentage",
"django.core.management.base.CommandError",
"progressbar.ETA",
"csv.reader"
] | [((2727, 2747), 'modoboa.core.extensions.exts_pool.load_all', 'exts_pool.load_all', ([], {}), '()\n', (2745, 2747), False, 'from modoboa.core.extensions import exts_pool\n'), ((1345, 1369), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (1359, 1369), False, 'import os\n'), ((1389, 1419), 'djang... |
# -*- coding: utf-8 -*-
'''
:file: use_verify.py
:author: -Farmer
:url: https://blog.farmer233.top
:date: 2022/01/14 21:33:06
'''
from school_sdk.client import UserClient
from school_sdk import SchoolClient
# 实例化学校
# 并根据验证码类型指定captcha_type为kap或者cap
# 使用Kaptcha(与旧版系统类似的验证码)
Gdust = SchoolClient("172.16... | [
"school_sdk.SchoolClient"
] | [((300, 371), 'school_sdk.SchoolClient', 'SchoolClient', (['"""172.16.254.1"""'], {'exist_verify': '(True)', 'captcha_type': '"""kaptcha"""'}), "('172.16.254.1', exist_verify=True, captcha_type='kaptcha')\n", (312, 371), False, 'from school_sdk import SchoolClient\n'), ((399, 470), 'school_sdk.SchoolClient', 'SchoolCli... |
"""Errors for the binobj package."""
import typing
from typing import Any
from typing import Iterable
from typing import Optional
from typing import TypeVar
from typing import Union
import more_itertools as m_iter
from binobj.typedefs import FieldOrName
from binobj.typedefs import StructOrName
if typing.TYPE_CHECK... | [
"more_itertools.always_iterable",
"typing.TypeVar"
] | [((428, 440), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (435, 440), False, 'from typing import TypeVar\n'), ((11388, 11416), 'more_itertools.always_iterable', 'm_iter.always_iterable', (['name'], {}), '(name)\n', (11410, 11416), True, 'import more_itertools as m_iter\n')] |
"""
environment manager class
"""
import os
from enum import Enum
from typing import Type
from env_flag import env_flag
from ._version import get_versions # type:ignore
__version__ = get_versions()["version"]
del get_versions
class EnvManager:
"""
environment variables manager, ensures that all the requir... | [
"env_flag.env_flag"
] | [((2886, 2912), 'env_flag.env_flag', 'env_flag', (['env_mapping.name'], {}), '(env_mapping.name)\n', (2894, 2912), False, 'from env_flag import env_flag\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 7 20:55:52 2020
@author: zhouziyi
"""
real = []
imag = []
i = 0
with open("00_Data.txt") as Data:
readCSV = csv.reader(Data, delimiter=',')
next(readCSV)
for row in readCSV:
betar = float(row[1].split(",")[0])
#if (be... | [
"matplotlib.pyplot.MultipleLocator"
] | [((2017, 2035), 'matplotlib.pyplot.MultipleLocator', 'MultipleLocator', (['(1)'], {}), '(1)\n', (2032, 2035), False, 'from matplotlib.pyplot import MultipleLocator\n'), ((2583, 2601), 'matplotlib.pyplot.MultipleLocator', 'MultipleLocator', (['(1)'], {}), '(1)\n', (2598, 2601), False, 'from matplotlib.pyplot import Mult... |
"""
create user and role
Revision ID: 8036f244db77
Revises:
Create Date: 2017-10-11 17:22:00.467780
"""
from alembic import op
import sqlalchemy as sa
import backend
# revision identifiers, used by Alembic.
revision = '8036f244db77'
down_revision = None
branch_labels = ('security',)
depends_on = None
def upgrad... | [
"sqlalchemy.text",
"alembic.op.drop_table",
"alembic.op.f",
"backend.database.types.DateTime",
"sqlalchemy.Boolean",
"sqlalchemy.String",
"sqlalchemy.BigInteger"
] | [((2566, 2592), 'alembic.op.drop_table', 'op.drop_table', (['"""user_role"""'], {}), "('user_role')\n", (2579, 2592), False, 'from alembic import op\n'), ((2720, 2741), 'alembic.op.drop_table', 'op.drop_table', (['"""user"""'], {}), "('user')\n", (2733, 2741), False, 'from alembic import op\n'), ((2805, 2826), 'alembic... |
import pyautogui, time
time.sleep(10)
texto = open('roteiro.txt')
for frase in texto:
pyautogui.typewrite(frase)
pyautogui.press('enter')
| [
"pyautogui.press",
"time.sleep",
"pyautogui.typewrite"
] | [((24, 38), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (34, 38), False, 'import pyautogui, time\n'), ((91, 117), 'pyautogui.typewrite', 'pyautogui.typewrite', (['frase'], {}), '(frase)\n', (110, 117), False, 'import pyautogui, time\n'), ((122, 146), 'pyautogui.press', 'pyautogui.press', (['"""enter"""'], {})... |
from scrape_linkedin import ProfileScraper
from scrape_linkedin.utils import HEADLESS_OPTIONS
import json
from dotenv import load_dotenv
import os
load_dotenv()
LI_AT_COOKIE = os.getenv('LI_AT_COOKIE')
HEADLESS = True
if not LI_AT_COOKIE:
raise Exception("Please define the environment variable LI_AT_COOKIE conta... | [
"scrape_linkedin.ProfileScraper",
"os.getenv",
"dotenv.load_dotenv"
] | [((148, 161), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (159, 161), False, 'from dotenv import load_dotenv\n'), ((178, 203), 'os.getenv', 'os.getenv', (['"""LI_AT_COOKIE"""'], {}), "('LI_AT_COOKIE')\n", (187, 203), False, 'import os\n'), ((472, 531), 'scrape_linkedin.ProfileScraper', 'ProfileScraper', ([],... |
from django.shortcuts import render
from django.http import HttpResponse
from django.template import loader
from django.contrib.auth import get_user_model
User = get_user_model()
#def login_reg_view(request):
# #template = loader.get_template('login_register/templates/test.html')
# return render(request, 'login... | [
"django.contrib.auth.get_user_model",
"django.urls.reverse_lazy"
] | [((163, 179), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (177, 179), False, 'from django.contrib.auth import get_user_model\n'), ((569, 590), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""login"""'], {}), "('login')\n", (581, 590), False, 'from django.urls import reverse_lazy\n')] |
import numpy as np
import matplotlib.pyplot as plt
evenR = np.array([1.212,3.368])
oddR = np.array([2.381])
S = evenR.size+oddR.size
prop = np.zeros(S)
tunn = np.zeros(S)
i=0
j=1
a=0.469
def rad(x):
return np.sqrt((1.1*np.pi)**2-x**2)
print (S)
print (prop)
print (tunn)
while i< evenR.size:
prop[2*i] = evenR[i]... | [
"numpy.sqrt",
"numpy.exp",
"numpy.array",
"numpy.zeros",
"numpy.cos",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((60, 84), 'numpy.array', 'np.array', (['[1.212, 3.368]'], {}), '([1.212, 3.368])\n', (68, 84), True, 'import numpy as np\n'), ((91, 108), 'numpy.array', 'np.array', (['[2.381]'], {}), '([2.381])\n', (99, 108), True, 'import numpy as np\n'), ((141, 152), 'numpy.zeros', 'np.zeros', (['S'], {}), '(S)\n', (149, 152), Tru... |
# Generated by Django 3.1.7 on 2021-03-29 10:16
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import modelcluster.fields
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | [
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency"
] | [((254, 311), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (285, 311), False, 'from django.db import migrations, models\n'), ((731, 824), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
"""
WSGI config for airone project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
"""
import os
import importlib
from django.conf import settings
from configurations.wsgi import get_ws... | [
"os.environ.setdefault",
"configurations.wsgi.get_wsgi_application",
"importlib.import_module",
"airone.lib.log.Logger.warning"
] | [((370, 436), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""airone.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'airone.settings')\n", (391, 436), False, 'import os\n'), ((437, 489), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_CONFIGURATION"""', '"""Dev"""... |
'''
Author : @anushkrishnav
Built using : networkx since it is a gold standard for Python DAGs (and other graphs). You can create a networkx directed graph with a list of tuples that represent the graph edges:
'''
import networkx as nx
from matplotlib import pyplot as plt
class DAG:
def __init__(self):
... | [
"matplotlib.pyplot.savefig",
"networkx.DiGraph",
"matplotlib.pyplot.clf",
"networkx.draw_networkx",
"networkx.is_directed_acyclic_graph",
"matplotlib.pyplot.tight_layout"
] | [((336, 348), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (346, 348), True, 'import networkx as nx\n'), ((523, 563), 'networkx.is_directed_acyclic_graph', 'nx.is_directed_acyclic_graph', (['self.graph'], {}), '(self.graph)\n', (551, 563), True, 'import networkx as nx\n'), ((915, 955), 'networkx.is_directed_acyc... |
import cv2
import numpy as np
import os
print('WORKIND')
os.chdir('/Users/jyarbrou/Computer_vision/Bat_project/bat_project//Bat_images/mixed_targets')
current_directory = os.getcwd()
print(current_directory)
count = 0
# filename_0 = 'bat_111511.avi'
# filename_1 = 'bat_111603.avi'
# filename_2 = 'bat_112309.avi'
# fil... | [
"cv2.createBackgroundSubtractorMOG2",
"cv2.rectangle",
"os.listdir",
"cv2.medianBlur",
"os.getcwd",
"os.chdir",
"cv2.imshow",
"cv2.contourArea",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.findContours",
"cv2.waitKey",
"cv2.boundingRect"
] | [((58, 161), 'os.chdir', 'os.chdir', (['"""/Users/jyarbrou/Computer_vision/Bat_project/bat_project//Bat_images/mixed_targets"""'], {}), "(\n '/Users/jyarbrou/Computer_vision/Bat_project/bat_project//Bat_images/mixed_targets'\n )\n", (66, 161), False, 'import os\n'), ((172, 183), 'os.getcwd', 'os.getcwd', ([], {})... |
from argparse import (
SUPPRESS,
ArgumentDefaultsHelpFormatter,
ArgumentParser,
FileType,
Namespace,
)
from asyncio import (
CancelledError,
create_task,
get_event_loop,
run,
set_event_loop_policy,
)
from logging import DEBUG, INFO, basicConfig
from pathlib import Path
from signa... | [
"argparse.FileType",
"aiohttp_cors.ResourceOptions",
"prometheus_client.CollectorRegistry",
"argparse.ArgumentParser",
"prometheus_client.Gauge",
"pathlib.Path",
"aiohttp.web.Application",
"aiohttp.web.AppRunner",
"prometheus_client.generate_latest",
"aiohttp_cors.setup",
"uvloop.EventLoopPolicy... | [((1833, 1852), 'prometheus_client.CollectorRegistry', 'CollectorRegistry', ([], {}), '()\n', (1850, 1852), False, 'from prometheus_client import CollectorRegistry, Gauge, generate_latest\n'), ((1875, 1998), 'prometheus_client.Gauge', 'Gauge', (['"""tecoroute_http_time"""', '"""Response time from TecoRoute server"""', ... |
from StringIO import StringIO
from django import http
from django.core.serializers.json import Serializer
from django.db.models.query import QuerySet
from django.views.generic import TemplateView
class TemplateContextView(TemplateView):
""" Allow define context in as_view method.
"""
context = dict()
... | [
"StringIO.StringIO",
"django.core.serializers.json.Serializer"
] | [((1284, 1296), 'django.core.serializers.json.Serializer', 'Serializer', ([], {}), '()\n', (1294, 1296), False, 'from django.core.serializers.json import Serializer\n'), ((1524, 1534), 'StringIO.StringIO', 'StringIO', ([], {}), '()\n', (1532, 1534), False, 'from StringIO import StringIO\n')] |
#!/usr/bin/env python3
from contextlib import contextmanager
import pandas as pd
import numpy as np
import random
import torch
import time
import os
import argparse
from scipy import sparse
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.impute import ... | [
"numpy.abs",
"os.listdir",
"random.shuffle",
"pandas.read_csv",
"argparse.ArgumentParser",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"torch.nn.init.kaiming_normal_",
"torch.Tensor",
"os.path.join",
"sklearn.preprocessing.StandardScaler",
"numpy.array_sp... | [((591, 647), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Linear Regression"""'}), "(description='Linear Regression')\n", (614, 647), False, 'import argparse\n'), ((3218, 3241), 'torch.nn.Linear', 'torch.nn.Linear', (['dim', '(1)'], {}), '(dim, 1)\n', (3233, 3241), False, 'import torc... |
#!/usr/bin/env python
import sys
import os
import uploader
import json
from exif_aux import verify_mapillary_tag
from . import ipc
def upload(import_path, verbose=False, skip_subfolders=False, number_threads=None, max_attempts=None, video_import_path=None, dry_run=False,api_version=1.0):
'''
Upload local imag... | [
"uploader.get_failed_upload_file_list",
"uploader.get_total_file_list",
"sys.exit",
"uploader.log_rootpath",
"os.path.isdir",
"uploader.print_summary",
"os.path.isfile",
"os.path.dirname",
"uploader.get_upload_file_list",
"uploader.get_success_upload_file_list",
"uploader.flag_finalization",
"... | [((1655, 1713), 'uploader.get_total_file_list', 'uploader.get_total_file_list', (['import_path', 'skip_subfolders'], {}), '(import_path, skip_subfolders)\n', (1683, 1713), False, 'import uploader\n'), ((1746, 1805), 'uploader.get_upload_file_list', 'uploader.get_upload_file_list', (['import_path', 'skip_subfolders'], {... |
import pyodbc
try:
connection = pyodbc.connect(r'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\Users\micha\Documents\Database3.accdb;')
print("Database is connected")
Fullname = "<NAME>"
user_id = 6
Address = "Valenzuela"
user_id = 6
Contact = 587
user_id = 6
... | [
"pyodbc.connect"
] | [((40, 167), 'pyodbc.connect', 'pyodbc.connect', (['"""Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\\\Users\\\\micha\\\\Documents\\\\Database3.accdb;"""'], {}), "(\n 'Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=C:\\\\Users\\\\micha\\\\Documents\\\\Database3.accdb;'\n )\n", (54, 167), False,... |
from cmaketools import setup
import sys
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
python_version = str(sys.version_info.major) + "." + str(sys.version_info.minor)
print("PYTHON VER... | [
"os.path.dirname",
"cmaketools.setup",
"os.path.join"
] | [((1597, 2171), 'cmaketools.setup', 'setup', ([], {'name': '"""pyabcranger"""', 'version': '"""0.0.52"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'description': '"""ABC random forests for model choice and parameter estimation, python wrapper"""', 'long_description': 'long_description', 'long_descrip... |
import os
import pymates.fonts
from pymates.dom import DocumentNode, ParagNode, StyleNode, SpanNode, MathNode, inline
from pymates.lom import Alignment
def document():
return DocumentNode(document)
def pagesize(size):
return style(pageSize=size)
@inline("counters")
def counter(node, counterFmt, refFmt, *name... | [
"pymates.dom.inline",
"pymates.dom.StyleNode",
"os.path.join",
"pymates.sizes.landscape",
"pymates.dom.ParagNode",
"os.path.dirname",
"pymates.dom.DocumentNode"
] | [((258, 276), 'pymates.dom.inline', 'inline', (['"""counters"""'], {}), "('counters')\n", (264, 276), False, 'from pymates.dom import DocumentNode, ParagNode, StyleNode, SpanNode, MathNode, inline\n'), ((706, 724), 'pymates.dom.inline', 'inline', (['"""counters"""'], {}), "('counters')\n", (712, 724), False, 'from pyma... |
# -*- coding: utf-8 -*-
#################################################################
# File : imgfileutils.py
# Version : 1.4.5
# Author : czsrh
# Date : 10.12.2020
# Institution : Carl Zeiss Microscopy GmbH
# Location : https://github.com/zeiss-microscopy/OAD/blob/master/jupyter_noteboo... | [
"pydash.objects.has",
"PyQt5.QtGui.QColor",
"bioformats.omexml.OMEXML",
"lxml.etree.fromstring",
"aicspylibczi.CziFile",
"tifffile.TiffFile",
"os.path.exists",
"aicsimageio.AICSImage",
"numpy.mean",
"PyQt5.QtWidgets.QTableWidget",
"pathlib.Path",
"napari.gui_qt",
"tifffile.imsave",
"pandas... | [((7062, 7095), 'apeer_ometiff_library.omexmlClass.OMEXML', 'omexmlClass.OMEXML', (['omexml_string'], {}), '(omexml_string)\n', (7080, 7095), False, 'from apeer_ometiff_library import omexmlClass\n'), ((7260, 7285), 'os.path.dirname', 'os.path.dirname', (['filename'], {}), '(filename)\n', (7275, 7285), False, 'import o... |
from namespace import project
if __name__ == "__main__":
dummy = project.Dummy()
dummy.setVal(42)
print(dummy.getVal())
dummy = project.Dummy(42)
| [
"namespace.project.Dummy"
] | [((70, 85), 'namespace.project.Dummy', 'project.Dummy', ([], {}), '()\n', (83, 85), False, 'from namespace import project\n'), ((145, 162), 'namespace.project.Dummy', 'project.Dummy', (['(42)'], {}), '(42)\n', (158, 162), False, 'from namespace import project\n')] |
from ipdb import set_trace as st
import os
import time
import random
import numpy as np
from loguru import logger
import torch
def set_seed(seed):
random.seed(seed)
np.random.seed(seed)
os.environ["PYTHONHASHSEED"] = str(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed) # type: ignore
... | [
"torch.sort",
"torch.manual_seed",
"numpy.random.beta",
"torch.randperm",
"loguru.logger.info",
"random.seed",
"torch.zeros_like",
"torch.argsort",
"torch.cuda.is_available",
"numpy.random.seed",
"os.path.abspath",
"torch.cuda.manual_seed"
] | [((153, 170), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (164, 170), False, 'import random\n'), ((175, 195), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (189, 195), True, 'import numpy as np\n'), ((245, 268), 'torch.manual_seed', 'torch.manual_seed', (['seed'], {}), '(seed)\n', (26... |
from copy import deepcopy
with open("day-04/input.txt", "r") as file:
numbers = [int(i) for i in file.readline().split(",")]
boards = [
[[int(i) for i in row.split()] for row in board.strip().split("\n")]
for board in file.read().strip().split("\n\n")
]
def find_first(numbers, boards, mar... | [
"copy.deepcopy"
] | [((814, 830), 'copy.deepcopy', 'deepcopy', (['boards'], {}), '(boards)\n', (822, 830), False, 'from copy import deepcopy\n'), ((957, 973), 'copy.deepcopy', 'deepcopy', (['boards'], {}), '(boards)\n', (965, 973), False, 'from copy import deepcopy\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('conferences', '0010_auto_20150713_2331'),
]
operations = [
migrations.AlterField(
model_name='conference',
... | [
"django.db.models.PositiveSmallIntegerField"
] | [((360, 555), 'django.db.models.PositiveSmallIntegerField', 'models.PositiveSmallIntegerField', ([], {'verbose_name': '"""Current Status"""', 'choices': "[(1, 'Accepting Proposals'), (3, 'Accepting Votes'), (2,\n 'Proposal submission closed'), (4, 'Schedule Published')]"}), "(verbose_name='Current Status', choices=[... |
#############################################################################
##
## Copyright (C) 2018 The Qt Company Ltd.
## Contact: https://www.qt.io/licensing/
##
## This file is part of the plugins of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:GPL-EXCEPT$
## Commercial License Usage
## Licensees holding valid commerc... | [
"re.sub"
] | [((29800, 29847), 're.sub', 're.sub', (['"""[^a-zA-Z0-9_]"""', 'replacement_char', 'name'], {}), "('[^a-zA-Z0-9_]', replacement_char, name)\n", (29806, 29847), False, 'import re\n')] |
from aiohttp import request
from nextcord.ext.commands import Cog, command, cooldown, BucketType
from nextcord import Embed
from loguru import logger as log
class Fun(Cog):
def __init__(self, bot):
self.bot = bot
@command(name="ping",
brief="Sends a \"Hi <user>\" message",
... | [
"nextcord.ext.commands.Cog.listener",
"nextcord.ext.commands.command",
"nextcord.ext.commands.cooldown",
"nextcord.Embed",
"aiohttp.request"
] | [((234, 368), 'nextcord.ext.commands.command', 'command', ([], {'name': '"""ping"""', 'brief': '"""Sends a "Hi <user>" message"""', 'description': '"""Sends a "Hi <user>" message"""', 'aliases': "['p']", 'usage': '"""ping"""'}), '(name=\'ping\', brief=\'Sends a "Hi <user>" message\', description=\n \'Sends a "Hi <us... |
import pygame
import random
import game_object
# Defining colors
WHITE = (255, 255, 255)
RED = (255, 0, 0)
# Defining game properties
TITLE = "Survival"
WIDTH = 640
HEIGHT = 480
UPDATES_PER_SEC = 60 # Updates per second
TICK_TIME = 0.5 # Seconds per tick
# Initiating the window
pygame.init()
screen_size = (WIDTH,... | [
"game_object.GameOverScreen",
"pygame.display.set_caption",
"game_object.Character",
"pygame.init",
"pygame.sprite.groupcollide",
"pygame.event.get",
"pygame.sprite.spritecollide",
"pygame.display.set_mode",
"pygame.sprite.Group",
"pygame.display.flip",
"pygame.mouse.get_pos",
"pygame.quit",
... | [((285, 298), 'pygame.init', 'pygame.init', ([], {}), '()\n', (296, 298), False, 'import pygame\n'), ((338, 374), 'pygame.display.set_mode', 'pygame.display.set_mode', (['screen_size'], {}), '(screen_size)\n', (361, 374), False, 'import pygame\n'), ((375, 408), 'pygame.display.set_caption', 'pygame.display.set_caption'... |