code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""Classification methods."""
import numpy as np
from machine_learning.constants import N_CLASSES, FOLDS, MAX_K, RANDOM_SEED
from machine_learning.utilities import k_fold_split_indexes, get_k_nn
def classification(method, error_func, train, test, **kwargs):
"""Perform classification for data and return error.
... | [
"numpy.sum",
"numpy.log",
"numpy.argmax",
"machine_learning.utilities.k_fold_split_indexes",
"numpy.zeros",
"numpy.ones",
"numpy.random.RandomState",
"numpy.argsort",
"machine_learning.utilities.get_k_nn",
"numpy.concatenate"
] | [((3476, 3495), 'numpy.zeros', 'np.zeros', (['n_classes'], {}), '(n_classes)\n', (3484, 3495), True, 'import numpy as np\n'), ((3975, 4008), 'numpy.zeros', 'np.zeros', (['(n_classes, n_features)'], {}), '((n_classes, n_features))\n', (3983, 4008), True, 'import numpy as np\n'), ((4645, 4669), 'numpy.zeros', 'np.zeros',... |
"""Django database functions.
This module supplements Django's own coverage of Postgres
and PostGIS functions.
https://docs.djangoproject.com/en/4.0/ref/models/expressions/#func-expressions-1
"""
from django.contrib.gis.db.models import GeometryField, LineStringField, PointField
from django.db.models import FloatFi... | [
"django.contrib.gis.db.models.PointField",
"django.contrib.gis.db.models.GeometryField",
"django.db.models.FloatField",
"django.contrib.gis.db.models.LineStringField"
] | [((447, 462), 'django.contrib.gis.db.models.GeometryField', 'GeometryField', ([], {}), '()\n', (460, 462), False, 'from django.contrib.gis.db.models import GeometryField, LineStringField, PointField\n'), ((601, 613), 'django.db.models.FloatField', 'FloatField', ([], {}), '()\n', (611, 613), False, 'from django.db.model... |
import numpy as np
import pandas as pd
from . import ResError
def remove_leap_day(timeseries):
"""Removes leap days from a given timeseries
Parameters
----------
timeseries : array_like
The time series data to remove leap days from
* If something array_like is given, the length mus... | [
"numpy.array",
"pandas.date_range",
"numpy.logical_and"
] | [((1197, 1246), 'numpy.logical_and', 'np.logical_and', (['(times.day == 29)', '(times.month == 2)'], {}), '(times.day == 29, times.month == 2)\n', (1211, 1246), True, 'import numpy as np\n'), ((650, 719), 'pandas.date_range', 'pd.date_range', (['"""01-01-2000 00:00:00"""', '"""12-31-2000 23:00:00"""'], {'freq': '"""H""... |
# Generated by Django 2.2.3 on 2019-07-27 06:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Article',
fields=[
('id',... | [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.AutoField"
] | [((1016, 1059), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(50)'}), '(blank=True, max_length=50)\n', (1032, 1059), False, 'from django.db import migrations, models\n'), ((321, 414), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_... |
import csv
import sys
def write_welsh_translations(csv_file_name, output_file_name):
with open(csv_file_name, newline='') as csv_file:
messages = csv.reader(csv_file, delimiter=',')
output_file = open(output_file_name, 'w+')
# skip headers
for i in range(2):
next(messag... | [
"csv.reader"
] | [((160, 195), 'csv.reader', 'csv.reader', (['csv_file'], {'delimiter': '""","""'}), "(csv_file, delimiter=',')\n", (170, 195), False, 'import csv\n')] |
from flask import Flask, render_template, request, redirect, Blueprint
from flask_jsonpify import jsonpify
from werkzeug import secure_filename
import urllib.request
import urllib.error
import urllib.parse
import os
import json
import sys
import ase.io.cif
from ase import Atoms
import zlib
import sqlite3
import ntpath... | [
"sys.path.append",
"flask.Blueprint",
"json.loads",
"flask.render_template",
"flask_jsonpify.jsonpify"
] | [((421, 445), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (436, 445), False, 'import sys\n'), ((1927, 1985), 'flask.Blueprint', 'Blueprint', (['"""tdmaps"""', '__name__'], {'template_folder': '"""templates"""'}), "('tdmaps', __name__, template_folder='templates')\n", (1936, 1985), False,... |
from joblib import Memory
import math
import music21 as m21
import numpy as np
import os
from scipy.fftpack import fft, ifft
def get_composers():
return ["Haydn", "Mozart"]
def get_data_dir():
return "/scratch/vl1019/nemisig2018_data"
def get_dataset_name():
return "nemisig2018"
def concatenate_layer... | [
"numpy.sum",
"numpy.abs",
"numpy.zeros",
"numpy.expand_dims",
"scipy.fftpack.fft",
"scipy.fftpack.ifft",
"numpy.fft.fftshift",
"numpy.exp",
"numpy.reshape",
"numpy.dot",
"numpy.linalg.solve",
"numpy.concatenate"
] | [((429, 451), 'numpy.concatenate', 'np.concatenate', (['layers'], {}), '(layers)\n', (443, 451), True, 'import numpy as np\n'), ((546, 582), 'numpy.zeros', 'np.zeros', (['(N, 1, 2 * (J_fr - 2) + 1)'], {}), '((N, 1, 2 * (J_fr - 2) + 1))\n', (554, 582), True, 'import numpy as np\n'), ((1168, 1209), 'numpy.concatenate', '... |
## Comborbidities:
## Comborbidities:
## Asthma, Obesity, Smoking, Diabetes, Heart diseae, Hypertension
## Symptom list: Covid-Recovered, Covid-Positive, Taste, Fever, Headache,
# Pneumonia, Stomach, Myocarditis, Blood-Clots, Death
## Mild symptoms: Taste, Fever, Headache, Stomach
## Critical symptoms: Pneumonia, Myoc... | [
"pandas.DataFrame",
"numpy.random.uniform",
"numpy.matrix",
"policy.RandomPolicy",
"numpy.argmax",
"numpy.zeros",
"policy.get_action",
"numpy.random.gamma",
"numpy.array",
"numpy.random.choice",
"numpy.concatenate"
] | [((440, 477), 'numpy.random.choice', 'np.random.choice', (['(2)'], {'size': 'pop.n_genes'}), '(2, size=pop.n_genes)\n', (456, 477), True, 'import numpy as np\n'), ((500, 522), 'numpy.random.choice', 'np.random.choice', (['(2)', '(1)'], {}), '(2, 1)\n', (516, 522), True, 'import numpy as np\n'), ((542, 564), 'numpy.rand... |
from typing import Any, Dict
from asyncio import sleep
from logging import getLogger
import aioredis
log = getLogger(__name__)
class _ConnectionsPool(aioredis.ConnectionsPool):
def __init__(
self, *args: Any, retry_count: int = 5, retry_interval: int = 2, **kwargs: Any
) -> None:
super().__i... | [
"aioredis.create_pool",
"asyncio.sleep",
"logging.getLogger"
] | [((109, 128), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (118, 128), False, 'from logging import getLogger\n'), ((1326, 1392), 'aioredis.create_pool', 'aioredis.create_pool', (['address'], {'pool_cls': '_ConnectionsPool'}), '(address, pool_cls=_ConnectionsPool, **config)\n', (1346, 1392), Fal... |
# <NAME>
# <EMAIL>
# MIT License
# As-simple-as-possible training loop for an autoencoder.
import torch
import numpy as np
import torch.optim as optim
from torch import nn
from torch.utils.data import DataLoader, TensorDataset
from model.shallow_autoencoder import ConvAutoencoder
# load model definition
model = Co... | [
"torch.nn.MSELoss",
"torch.utils.data.DataLoader",
"numpy.random.random",
"model.shallow_autoencoder.ConvAutoencoder",
"torch.tensor"
] | [((318, 335), 'model.shallow_autoencoder.ConvAutoencoder', 'ConvAutoencoder', ([], {}), '()\n', (333, 335), False, 'from model.shallow_autoencoder import ConvAutoencoder\n'), ((424, 436), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (434, 436), False, 'from torch import nn\n'), ((649, 680), 'numpy.random.random'... |
import asyncio
import dataclasses
import enum
from typing import Dict, Optional, Set, Tuple
from supriya.clocks import AsyncTempoClock, Moment
from ..bases import Event
from .bases import ApplicationObject
from .parameters import ParameterGroup, ParameterObject
class Transport(ApplicationObject):
### CLASS VAR... | [
"supriya.clocks.AsyncTempoClock"
] | [((778, 795), 'supriya.clocks.AsyncTempoClock', 'AsyncTempoClock', ([], {}), '()\n', (793, 795), False, 'from supriya.clocks import AsyncTempoClock, Moment\n')] |
#
# twitter csv process
# write by @jiyang_viz
#
# require:
# https://github.com/edburnett/twitter-text-python
#
# download csv file from:
# https://github.com/bpb27/political_twitter_archive/tree/master/realdonaldtrump
#
import json
import csv
from ttp import ttp
from dateutil import parser as date_parser
# read cs... | [
"csv.DictReader",
"dateutil.parser.parse",
"json.dumps",
"ttp.ttp.Parser"
] | [((641, 653), 'ttp.ttp.Parser', 'ttp.Parser', ([], {}), '()\n', (651, 653), False, 'from ttp import ttp\n'), ((387, 419), 'csv.DictReader', 'csv.DictReader', (['f'], {'delimiter': '""","""'}), "(f, delimiter=',')\n", (401, 419), False, 'import csv\n'), ((838, 875), 'dateutil.parser.parse', 'date_parser.parse', (["item[... |
#!/usr/bin/env python
import optparse
import os
import shutil
import sys
def revert(path):
bkup = path + os.path.extsep + options.backup_suffix
if os.access(bkup, os.R_OK):
shutil.copy2(bkup, path)
os.remove(bkup)
def corrupt(path, offset, value):
if options.backup:
shutil.copy2(... | [
"os.remove",
"optparse.OptionParser",
"shutil.copy2",
"os.access",
"sys.exit"
] | [((488, 565), 'optparse.OptionParser', 'optparse.OptionParser', ([], {'usage': '"""usage: %prog file byte-offset replacment-value"""'}), "(usage='usage: %prog file byte-offset replacment-value')\n", (509, 565), False, 'import optparse\n'), ((157, 181), 'os.access', 'os.access', (['bkup', 'os.R_OK'], {}), '(bkup, os.R_O... |
# Copyright 2017 <NAME>. See LICENSE.md file for terms.
import socket
import threading
import api
import usersim
TCP_IP = 'localhost'
TCP_PORT = 5005
def run_test():
telnet_config = {'type': 'telnet',
'config': {'host': TCP_IP,
'username': 'admin',
... | [
"usersim.UserSim",
"socket.socket",
"api.validate_config"
] | [((527, 548), 'usersim.UserSim', 'usersim.UserSim', (['(True)'], {}), '(True)\n', (542, 548), False, 'import usersim\n'), ((564, 598), 'api.validate_config', 'api.validate_config', (['telnet_config'], {}), '(telnet_config)\n', (583, 598), False, 'import api\n'), ((628, 677), 'socket.socket', 'socket.socket', (['socket.... |
import copy
import json
import os
from urllib.parse import urlparse
import pkg_resources
from guillotina import app_settings
from guillotina import configure
from guillotina.api.service import Service
from guillotina.component import getMultiAdapter
from guillotina.interfaces import IAbsoluteURL
from guillotina.utils... | [
"pkg_resources.get_distribution",
"guillotina.utils.get_request_scheme",
"copy.deepcopy",
"guillotina.utils.get_full_content_path",
"guillotina.utils.get_security_policy",
"os.path.realpath",
"json.dumps",
"guillotina.configure.service",
"guillotina.utils.get_authenticated_user",
"guillotina.compo... | [((700, 822), 'guillotina.configure.service', 'configure.service', ([], {'method': '"""GET"""', 'context': 'Interface', 'name': '"""@swagger"""', 'permission': '"""guillotina.swagger.View"""', 'ignore': '(True)'}), "(method='GET', context=Interface, name='@swagger',\n permission='guillotina.swagger.View', ignore=Tru... |
import asyncio
import getpass
import json
import os
import websockets
from shape import S, Z, I, O, J, T, L, Shape
from search import *
async def agent_loop(server_address="localhost:8000", agent_name="student"):
async with websockets.connect(f"ws://{server_address}/player") as websocket:
# Receive infor... | [
"shape.Shape",
"getpass.getuser",
"asyncio.get_event_loop",
"websockets.connect",
"json.dumps",
"os.environ.get"
] | [((7052, 7076), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (7074, 7076), False, 'import asyncio\n'), ((7086, 7123), 'os.environ.get', 'os.environ.get', (['"""SERVER"""', '"""localhost"""'], {}), "('SERVER', 'localhost')\n", (7100, 7123), False, 'import os\n'), ((7131, 7161), 'os.environ.get',... |
import os.path
from blaze.test_utils import temp_dir
import blaze.toplevel as toplevel
from blaze.params import params
from blaze import dshape
from blaze.sources.chunked import CArraySource, CTableSource
from blaze.eclass import eclass
def test_open_carray():
with temp_dir() as temp:
# Create an array o... | [
"blaze.test_utils.temp_dir",
"blaze.sources.chunked.CTableSource",
"blaze.sources.chunked.CArraySource",
"blaze.dshape",
"blaze.params.params",
"blaze.toplevel.open"
] | [((273, 283), 'blaze.test_utils.temp_dir', 'temp_dir', ([], {}), '()\n', (281, 283), False, 'from blaze.test_utils import temp_dir\n'), ((393, 423), 'blaze.params.params', 'params', ([], {'storage': 'array_filename'}), '(storage=array_filename)\n', (399, 423), False, 'from blaze.params import params\n'), ((437, 454), '... |
"""Module providing miscellaneous utilities used by cmkinitramfs"""
from __future__ import annotations
import functools
import hashlib
import os.path
# Function needed for python < 3.9
def removeprefix(string: str, prefix: str) -> str:
"""Remove a prefix from a string
Add support for :meth:`str.removeprefi... | [
"hashlib.sha512",
"functools.lru_cache"
] | [((756, 777), 'functools.lru_cache', 'functools.lru_cache', ([], {}), '()\n', (775, 777), False, 'import functools\n'), ((1063, 1079), 'hashlib.sha512', 'hashlib.sha512', ([], {}), '()\n', (1077, 1079), False, 'import hashlib\n')] |
# Generated by Django 3.2 on 2022-04-08 15:01
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('travellifestyleblog22', '0008_alter_category_image'),
]
operations = [
migrations.RemoveField(
model_name='category',
name='im... | [
"django.db.migrations.RemoveField"
] | [((241, 300), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""category"""', 'name': '"""image"""'}), "(model_name='category', name='image')\n", (263, 300), False, 'from django.db import migrations\n')] |
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']= '2'
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
from tensorflow.keras.datasets import mnist
physical_devices = tf.config.list_physical_devices('GPU')
print(physical_devices)
(x_train, y_train), (x_test, y_test) = mnist.load_d... | [
"tensorflow.keras.losses.SparseCategoricalCrossentropy",
"tensorflow.keras.layers.Dense",
"tensorflow.config.list_physical_devices",
"tensorflow.keras.datasets.mnist.load_data",
"tensorflow.keras.optimizers.Adam"
] | [((204, 242), 'tensorflow.config.list_physical_devices', 'tf.config.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (235, 242), True, 'import tensorflow as tf\n'), ((308, 325), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (323, 325), False, 'from tensorflow.keras.datasets ... |
from django.conf.urls import url
import payments.views
urlpatterns = [
url(r"^webhook/$", payments.views.webhook,
name="webhook"),
]
| [
"django.conf.urls.url"
] | [((77, 134), 'django.conf.urls.url', 'url', (['"""^webhook/$"""', 'payments.views.webhook'], {'name': '"""webhook"""'}), "('^webhook/$', payments.views.webhook, name='webhook')\n", (80, 134), False, 'from django.conf.urls import url\n')] |
###############################################################
# SPDX-License-Identifier: BSD-2-Clause-Patent
# SPDX-FileCopyrightText: 2020 the prplMesh contributors (see AUTHORS.md)
# This code is subject to the terms of the BSD+Patent license.
# See LICENSE file for more details.
###################################... | [
"boardfarm.exceptions.SkipTest",
"opts.debug",
"capi.tlv",
"time.sleep"
] | [((1378, 1391), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1388, 1391), False, 'import time\n'), ((1400, 1455), 'opts.debug', 'debug', (['"""Send Associated STA Link Metrics Query message"""'], {}), "('Send Associated STA Link Metrics Query message')\n", (1405, 1455), False, 'from opts import debug\n'), ((169... |
import unittest
import requests
from assertpy import assert_that
from requests.exceptions import Timeout
from unittest.mock import Mock, patch
from src.Api import Api
from src.todos import todos
class TestApiMonkeyPatch(unittest.TestCase):
@patch('src.Api.Api', autospec=True)
def test_method_api_delete_rai... | [
"unittest.mock.patch",
"unittest.main",
"unittest.mock.Mock",
"assertpy.assert_that"
] | [((250, 285), 'unittest.mock.patch', 'patch', (['"""src.Api.Api"""'], {'autospec': '(True)'}), "('src.Api.Api', autospec=True)\n", (255, 285), False, 'from unittest.mock import Mock, patch\n'), ((8712, 8727), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8725, 8727), False, 'import unittest\n'), ((369, 375), 'un... |
from functools import cmp_to_key
from Transaction import Transaction
class pEFIM():
highUtilityItemsets = []
candidateCount = 0
utilityBinArrayLU = {}
utilityBinArraySU = {}
# a temporary buffer
temp = []
for i in range(5000):
temp.append(0)
def __init__(self, mapItemsTone... | [
"Transaction.Transaction",
"functools.cmp_to_key"
] | [((9074, 9107), 'functools.cmp_to_key', 'cmp_to_key', (['self.sort_transaction'], {}), '(self.sort_transaction)\n', (9084, 9107), False, 'from functools import cmp_to_key\n'), ((3546, 3661), 'Transaction.Transaction', 'Transaction', (['items', 'utilities', '(previousTransaction.transactionUtility + projectedTransaction... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Liblouis test harness
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later v... | [
"louis.hyphenate",
"traceback.format_exception",
"json.load",
"louis.translate",
"louis.backTranslateString",
"sys.stderr.write",
"os.path.join",
"sys.exit"
] | [((10586, 10614), 'sys.exit', 'sys.exit', (['(0 if result else 1)'], {}), '(0 if result else 1)\n', (10594, 10614), False, 'import sys\n'), ((1419, 1484), 'sys.stderr.write', 'sys.stderr.write', (['"""The harness tests require nose. Skipping...\n"""'], {}), "('The harness tests require nose. Skipping...\\n')\n", (1435,... |
'''
File: Viewer.py
Author: <NAME>. & <NAME>.
Date: 06/04/19
Description: This viewer can be run on a RaspberryPI, and pulls timelapse photos from a webserver hosted by Server.py
'''
from kivy.config import Config
import timelapseshare as tls
import PIL
import _thread
import time
import os
os.environ['KIVY_GL_BACKEND'... | [
"kivy.config.Config.set",
"argparse.ArgumentParser",
"timelapseshare.getMax",
"kivy.uix.gridlayout.GridLayout.on_touch_down",
"timelapseshare.updateStatsManually",
"kivy.core.window.Window.request_keyboard",
"_thread.start_new_thread",
"timelapseshare.setImageDirectory",
"time.sleep",
"urllib.requ... | [((430, 488), 'kivy.config.Config.set', 'Config.set', (['"""input"""', '"""mouse"""', '"""mouse,multitouch_on_demand"""'], {}), "('input', 'mouse', 'mouse,multitouch_on_demand')\n", (440, 488), False, 'from kivy.config import Config\n'), ((1357, 1426), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'descri... |
from PyQt5 import QtGui
from PyQt5.QtWidgets import QApplication,QMainWindow, QWidget, QPushButton
from PyQt5.QtGui import QPainter,QBrush, QPen
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QTimer
from PyQt5.QtGui import QTransform
from PyQt5.QtCore import QPointF
from CarMaintainer import CarMaintainer
... | [
"PyQt5.QtCore.QTimer",
"PyQt5.QtGui.QPainter",
"PyQt5.QtGui.QIcon",
"CarMaintainer.CarMaintainer",
"Algorithm.Algorithm",
"Algorithm.Algorithm.run_algorithm",
"PyQt5.QtGui.QPen",
"PyQt5.QtGui.QBrush",
"PyQt5.QtGui.QTransform",
"PyQt5.QtCore.QPointF"
] | [((485, 497), 'PyQt5.QtCore.QTimer', 'QTimer', (['self'], {}), '(self)\n', (491, 497), False, 'from PyQt5.QtCore import QTimer\n'), ((883, 898), 'CarMaintainer.CarMaintainer', 'CarMaintainer', ([], {}), '()\n', (896, 898), False, 'from CarMaintainer import CarMaintainer\n'), ((907, 918), 'Algorithm.Algorithm', 'Algorit... |
# -*- coding: utf-8 -*-
from placidity.node import Node, TreeNode
class TestNode():
def test_append_children_to_node(self):
node1, node2 = Node(), Node()
node1.children.append(node2)
assert node1.children[0] == node2
assert node2.parents[0] == node1
def test_append_parents_... | [
"placidity.node.TreeNode",
"placidity.node.Node"
] | [((3123, 3129), 'placidity.node.Node', 'Node', ([], {}), '()\n', (3127, 3129), False, 'from placidity.node import Node, TreeNode\n'), ((3262, 3268), 'placidity.node.Node', 'Node', ([], {}), '()\n', (3266, 3268), False, 'from placidity.node import Node, TreeNode\n'), ((3286, 3292), 'placidity.node.Node', 'Node', ([], {}... |
from distutils.core import setup
setup(
name = 'quicklock',
packages = ['quicklock'],
version = '0.1.7',
description = 'A simple Python resource lock to ensure only one process at a time is operating with a particular resource.',
author = '<NAME>',
author_email = '<EMAIL>',
url = 'https://github.com/NateF... | [
"distutils.core.setup"
] | [((33, 565), 'distutils.core.setup', 'setup', ([], {'name': '"""quicklock"""', 'packages': "['quicklock']", 'version': '"""0.1.7"""', 'description': '"""A simple Python resource lock to ensure only one process at a time is operating with a particular resource."""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"... |
#
# Copyright (C) 2013 - 2021 <NAME> <<EMAIL>>
# License: MIT
#
# pylint: disable=missing-docstring
"""test cases for anyconfig.cli module.
"""
import contextlib
import io
import pathlib
import sys
import tempfile
import unittest
import anyconfig.api
import anyconfig.cli as TT
from .. import base
from . import collec... | [
"io.StringIO",
"tempfile.TemporaryDirectory",
"pathlib.Path",
"anyconfig.cli.main",
"sys.exit"
] | [((2006, 2017), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (2014, 2017), False, 'import sys\n'), ((1947, 1960), 'anyconfig.cli.main', 'TT.main', (['args'], {}), '(args)\n', (1954, 1960), True, 'import anyconfig.cli as TT\n'), ((1152, 1181), 'tempfile.TemporaryDirectory', 'tempfile.TemporaryDirectory', ([], {}), '(... |
import urllib
from urllib import request, parse
import re
import os, sys
import time
import argparse
# Request headers
headers = {
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36',
'Referer': 'http://www.verifyemailaddress.or... | [
"urllib.request.Request",
"argparse.ArgumentParser",
"urllib.parse.urlencode",
"urllib.request.urlopen",
"sys.exit"
] | [((5786, 5875), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Find email address given a name and a domain."""'}), "(description=\n 'Find email address given a name and a domain.')\n", (5809, 5875), False, 'import argparse\n'), ((846, 917), 'urllib.request.Request', 'request.Request'... |
import pygame
from random import randint
# Var de trainamento
# Lista de saida [Esquerda, Cima, Direita, Baixo]
listaOutput = [0,0,0,0]
# Lista de entrada [n da rodada ,pontos obtidos
# matriz do tabuleiro] (tabuleiro incluindo
# paredes, corpo da cobra e maca)
listaEntrada = [0]*3
# Nota: a matriz sera quase 4 ve... | [
"random.randint",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.init",
"pygame.time.wait",
"pygame.display.update",
"pygame.font.Font",
"pygame.image.load",
"pygame.display.set_caption"
] | [((1193, 1206), 'pygame.init', 'pygame.init', ([], {}), '()\n', (1204, 1206), False, 'import pygame\n'), ((1254, 1289), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(600, 600)'], {}), '((600, 600))\n', (1277, 1289), False, 'import pygame\n'), ((1315, 1371), 'pygame.display.set_caption', 'pygame.display.set_... |
from typing import List, Tuple
#from flare.forms.bones.base import ReadFromClientErrorSeverity
from flare.icons import SvgIcon
from flare.i18n import translate
from flare import html5
def collectBoneErrors(errorList, currentKey,boneStructure):
'''
severity:
NotSet = 0
InvalidatesOther = 1
Empty = 2
Invalid... | [
"flare.i18n.translate",
"flare.icons.SvgIcon"
] | [((1439, 1468), 'flare.i18n.translate', 'translate', (['"""vi.tooltip.error"""'], {}), "('vi.tooltip.error')\n", (1448, 1468), False, 'from flare.i18n import translate\n'), ((1124, 1168), 'flare.icons.SvgIcon', 'SvgIcon', (['"""icon-arrow-right"""'], {'title': 'shortText'}), "('icon-arrow-right', title=shortText)\n", (... |
import cv2
import numpy as numpy
import tensorflow as tflow
from utils import label_map_util
#from ConeDetection import *
from cone_img_processing2 import *
import os
# Set threshold for detection of cone for object detector
threshold_cone = 0.5
#Set path to check point and label map
#PATH_TO_CKPT = './frozen_orange... | [
"utils.label_map_util.create_category_index",
"cv2.destroyAllWindows",
"cv2.waitKey",
"utils.label_map_util.load_labelmap",
"utils.label_map_util.convert_label_map_to_categories",
"cv2.VideoCapture",
"tensorflow.ConfigProto",
"tensorflow.gfile.GFile",
"tensorflow.Graph",
"tensorflow.import_graph_d... | [((655, 668), 'tensorflow.Graph', 'tflow.Graph', ([], {}), '()\n', (666, 668), True, 'import tensorflow as tflow\n'), ((939, 983), 'utils.label_map_util.load_labelmap', 'label_map_util.load_labelmap', (['PATH_TO_LABELS'], {}), '(PATH_TO_LABELS)\n', (967, 983), False, 'from utils import label_map_util\n'), ((997, 1111),... |
from rest_framework.test import APITestCase
from django.shortcuts import reverse
from rest_framework import status
from core.models import ProductsTbl, PurchaseTransactionTbl
# Create your tests here.
class TestProductViews(APITestCase):
def setUp(self):
self.product_url = reverse('products-list')
... | [
"core.models.PurchaseTransactionTbl.objects.create",
"django.shortcuts.reverse",
"core.models.ProductsTbl.objects.create",
"core.models.ProductsTbl.objects.get"
] | [((288, 312), 'django.shortcuts.reverse', 'reverse', (['"""products-list"""'], {}), "('products-list')\n", (295, 312), False, 'from django.shortcuts import reverse\n'), ((1157, 1182), 'django.shortcuts.reverse', 'reverse', (['"""purchases-list"""'], {}), "('purchases-list')\n", (1164, 1182), False, 'from django.shortcu... |
import cv2
from PIL import Image
import numpy as np
import constants
import os
import math
import matplotlib.pyplot as plt
import time
def hammingDistance(v1, v2):
t = 0
for i in range(len(v1)):
if v1[i] != v2[i]:
t += 1
return t
# read thresholds from thresholds.txt and then store th... | [
"matplotlib.pyplot.title",
"PyQt5.QtWidgets.QMainWindow.__init__",
"PyQt5.QtWidgets.QVBoxLayout",
"matplotlib.pyplot.figure",
"matplotlib.backends.backend_qt5agg.NavigationToolbar2QT",
"PyQt5.QtWidgets.QApplication",
"os.path.join",
"PyQt5.QtWidgets.QWidget",
"matplotlib.backends.backend_qt5agg.Figu... | [((10253, 10277), 'matplotlib.use', 'matplotlib.use', (['"""Qt5Agg"""'], {}), "('Qt5Agg')\n", (10267, 10277), False, 'import matplotlib\n'), ((1118, 1142), 'cv2.imread', 'cv2.imread', (['imagePath', '(0)'], {}), '(imagePath, 0)\n', (1128, 1142), False, 'import cv2\n'), ((1343, 1364), 'PIL.Image.fromarray', 'Image.froma... |
# Written by <NAME>
import os
def file_feature_extraction(dir, filename):
'''
Navigates through tokenized words,
reconstructs original form by following few rules
Then, extracts features for that token and adds them to the corresponding list
All features of the dataset is written in the sam... | [
"os.listdir"
] | [((4735, 4750), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (4745, 4750), False, 'import os\n'), ((4841, 4865), 'os.listdir', 'os.listdir', (['category_dir'], {}), '(category_dir)\n', (4851, 4865), False, 'import os\n')] |
""" Clinical snapshot encoders for use with CANTRIP Model.
CANTRIPModel expects a clinical snapshot encoder function which takes as input the CANTRIPModel and adds
clinical snapshot encoding ops to the graph returning the final clinical snapshot encoding as
[batch x max_seq_len x embedding_size]
"""
import tensorflo... | [
"tensorflow.compat.v1.sparse.reorder",
"tensorflow.compat.v1.keras.layers.Dropout",
"tensorflow.compat.v1.keras.layers.BatchNormalization",
"layers.rnn_layer",
"tensorflow.compat.v1.sparse_tensor_dense_matmul",
"layers.create_embeddings",
"layers.embedding_layer",
"tensorflow.compat.v1.debugging.asser... | [((5944, 5979), 'tensorflow.compat.v1.not_equal', 'tf.not_equal', (['model.observations', '(0)'], {}), '(model.observations, 0)\n', (5956, 5979), True, 'import tensorflow.compat.v1 as tf\n'), ((5992, 6006), 'tensorflow.compat.v1.where', 'tf.where', (['mask'], {}), '(mask)\n', (6000, 6006), True, 'import tensorflow.comp... |
import gzip
import unittest
import subprocess
import os
class TestPreProcessing(unittest.TestCase):
def setUp(self):
# params for the test
self.curr_path = os.path.dirname(os.path.abspath(__file__))
self.output_path = self.curr_path + "/data"
self.file_one = self.output_path + "/all_reads_... | [
"unittest.main",
"subprocess.run",
"os.remove",
"os.path.abspath",
"gzip.open",
"os.path.getsize"
] | [((2276, 2291), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2289, 2291), False, 'import unittest\n'), ((691, 861), 'subprocess.run', 'subprocess.run', (["['./test-command.sh', self.file_one, self.file_two, self.database_path,\n self.db_one_name, self.db_two_name, self.db_three_name, self.output_path]"], {})... |
######################################################################
## Copyright (c) 2019 <NAME>, Norway
## ###################################################################
## Created : wulff at 2019-3-25
## ###################################################################
## The MIT License (MIT... | [
"json.load",
"matplotlib.pyplot.show",
"pandas.Timestamp",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"click.option",
"os.path.exists",
"json.dumps",
"matplotlib.pyplot.xticks",
"click.Path",
"collections.OrderedDict",
"matplotlib.pyplot.ylabel",
"click.group",
"matplotlib.pyplo... | [((6261, 6274), 'click.group', 'click.group', ([], {}), '()\n', (6272, 6274), False, 'import click\n'), ((6330, 6400), 'click.option', 'click.option', (['"""--json"""'], {'is_flag': '(True)', 'help': '"""Set JSON as output format"""'}), "('--json', is_flag=True, help='Set JSON as output format')\n", (6342, 6400), False... |
# Generated by Django 2.0.7 on 2018-08-12 22:36
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('UserProfiles', '0005_auto_20180808_2150'),
]
operations = [
migrations.AlterField(
model_name='userprofilemodel',
na... | [
"django.db.models.ImageField",
"django.db.models.TextField"
] | [((359, 414), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'max_length': '(300)', 'null': '(True)'}), '(blank=True, max_length=300, null=True)\n', (375, 414), False, 'from django.db import migrations, models\n'), ((557, 654), 'django.db.models.ImageField', 'models.ImageField', ([], {'defau... |
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 21 15:39:43 2019
@author: Manu
"""
import mne
from mne import io
import sys
sys.path.append('C:/_MANU/_U821/Python_Dev/')
import scipy
from util import tools,asr,raw_asrcalibration
import numpy as np
import matplotlib.pyplot as plt
from mne.viz import plot_evoked_topo... | [
"mne.pick_types",
"util.asr.YW_filter",
"mne.io.read_raw_brainvision",
"util.raw_asrcalibration.raw_asrcalibration",
"numpy.arange",
"sys.path.append",
"mne.events_from_annotations",
"scipy.signal.lfilter",
"mne.channels.read_montage",
"scipy.signal.iirfilter",
"numpy.linspace",
"matplotlib.py... | [((126, 171), 'sys.path.append', 'sys.path.append', (['"""C:/_MANU/_U821/Python_Dev/"""'], {}), "('C:/_MANU/_U821/Python_Dev/')\n", (141, 171), False, 'import sys\n'), ((391, 436), 'mne.io.read_raw_brainvision', 'io.read_raw_brainvision', (['fname'], {'preload': '(False)'}), '(fname, preload=False)\n', (414, 436), Fals... |
from abc import abstractmethod
from typing import Any, Dict, Iterable, List, Optional, Type, TypeVar
from pyjackson import dumps, loads
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relatio... | [
"pyjackson.loads",
"sqlalchemy.ForeignKey",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.orm.relationship",
"ebonite.core.objects.core.Project",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.Column",
"typing.TypeVar",
"pyjackson.dumps"
] | [((1166, 1178), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (1173, 1178), False, 'from typing import Any, Dict, Iterable, List, Optional, Type, TypeVar\n'), ((1183, 1214), 'typing.TypeVar', 'TypeVar', (['"""S"""'], {'bound': '"""Attaching"""'}), "('S', bound='Attaching')\n", (1190, 1214), False, 'from ty... |
import numpy as np
import string
import re
import nltk
nltk.download('stopwords')
stop_words = nltk.corpus.stopwords.words('english')
class word_inform():
def __init__(self):
self.inform = {}
def wordinput(self):
WI = input('문장을 입력해주세요 : ') # 문장 받아오기. WI = word input.... | [
"nltk.download",
"numpy.zeros_like",
"re.sub",
"nltk.corpus.stopwords.words"
] | [((55, 81), 'nltk.download', 'nltk.download', (['"""stopwords"""'], {}), "('stopwords')\n", (68, 81), False, 'import nltk\n'), ((95, 133), 'nltk.corpus.stopwords.words', 'nltk.corpus.stopwords.words', (['"""english"""'], {}), "('english')\n", (122, 133), False, 'import nltk\n'), ((2335, 2369), 're.sub', 're.sub', (['""... |
from base import BaseTestCase
from django.contrib.auth.models import User
from redistricting.models import *
class StatisticsSetTestCase(BaseTestCase):
fixtures = [
'redistricting_testdata.json',
'redistricting_testdata_geolevel2.json',
'redistricting_statisticssets.json',
]
def... | [
"django.contrib.auth.models.User"
] | [((1242, 1269), 'django.contrib.auth.models.User', 'User', ([], {'username': '"""Stats User"""'}), "(username='Stats User')\n", (1246, 1269), False, 'from django.contrib.auth.models import User\n')] |
import argparse
import serial
import os
parser = argparse.ArgumentParser()
parser.add_argument('image', default='kernel8.img', type=str)
parser.add_argument('device',default='/dev/ttyUSB0', type=str)
args = parser.parse_args()
try:
ser = serial.Serial(args.device,115200)
except:
print("Serial init failed!")
... | [
"serial.Serial",
"argparse.ArgumentParser",
"os.stat"
] | [((50, 75), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (73, 75), False, 'import argparse\n'), ((244, 278), 'serial.Serial', 'serial.Serial', (['args.device', '(115200)'], {}), '(args.device, 115200)\n', (257, 278), False, 'import serial\n'), ((367, 385), 'os.stat', 'os.stat', (['file_path']... |
#!/usr/bin/env python3.4
import webSocketClient
import motorInterface
import json
axis = ['xLeft', 'yLeft', 'triggerLeft', 'xRight', 'yRight', 'triggerRight']
buttons = ['A', 'B', 'X', 'Y', 'LB', 'RB']
trimUp = {
'center': 0.0
}
# these are in a row
# this motor is IN3/4 on the edge of the motor controller
m1 =... | [
"motorInterface.motor",
"webSocketClient.start",
"json.loads"
] | [((321, 349), 'motorInterface.motor', 'motorInterface.motor', (['(16)', '(26)'], {}), '(16, 26)\n', (341, 349), False, 'import motorInterface\n'), ((366, 394), 'motorInterface.motor', 'motorInterface.motor', (['(12)', '(13)'], {}), '(12, 13)\n', (386, 394), False, 'import motorInterface\n'), ((421, 449), 'motorInterfac... |
from apminsight import constants
from apminsight.util import is_non_empty_string
from apminsight.agentfactory import get_agent
from .wrapper import default_wrapper
class CursorProxy():
def __init__(self, cursor, conn):
self._apm_wrap_cursor = cursor
self._apm_wrap_conn = conn
self._apm_c... | [
"apminsight.agentfactory.get_agent",
"apminsight.util.is_non_empty_string"
] | [((1679, 1707), 'apminsight.util.is_non_empty_string', 'is_non_empty_string', (['args[0]'], {}), '(args[0])\n', (1698, 1707), False, 'from apminsight.util import is_non_empty_string\n'), ((1497, 1508), 'apminsight.agentfactory.get_agent', 'get_agent', ([], {}), '()\n', (1506, 1508), False, 'from apminsight.agentfactory... |
from weatherman import weather_butler
import pytest
import datetime # noqa
import sqlite3 # noqa
import yaml
import json # noqa
import os
import unittest
mock = unittest.mock.Mock()
master_copnfig = 'etc/weatherman.yml'
with open(master_copnfig) as ycf:
config = yaml.load(ycf, Loader=yaml.FullLoader)
environment =... | [
"yaml.load",
"unittest.mock.Mock",
"pytest.fixture",
"os.environ.get",
"weatherman.weather_butler.WeatherButler"
] | [((161, 181), 'unittest.mock.Mock', 'unittest.mock.Mock', ([], {}), '()\n', (179, 181), False, 'import unittest\n'), ((321, 350), 'os.environ.get', 'os.environ.get', (['"""ENVIRONMENT"""'], {}), "('ENVIRONMENT')\n", (335, 350), False, 'import os\n'), ((353, 385), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""f... |
from mean import mean
import pytest
def test_ints():
num_list = [1, 2, 3, 4, 5]
obs = mean(num_list)
assert obs == 3
def test_not_numbers():
values = [2, "lolcats"]
with pytest.raises(TypeError):
out = mean(values)
def test_zero():
num_list = [0, 2, 4, 6]
assert mean(num_list) =... | [
"pytest.raises",
"mean.mean"
] | [((96, 110), 'mean.mean', 'mean', (['num_list'], {}), '(num_list)\n', (100, 110), False, 'from mean import mean\n'), ((194, 218), 'pytest.raises', 'pytest.raises', (['TypeError'], {}), '(TypeError)\n', (207, 218), False, 'import pytest\n'), ((234, 246), 'mean.mean', 'mean', (['values'], {}), '(values)\n', (238, 246), F... |
# -*- coding: utf-8 -*-
"""Console script for gitlab_migration."""
import os
import sys
import click
from gitlab_migration import gitlab_migration as glm
@click.group()
def cli():
pass
@cli.group()
def projects():
"""Commands for migrating projects."""
return 0
@projects.command()
@click.argument('csv... | [
"gitlab_migration.gitlab_migration.get_project_urls",
"click.argument",
"os.path.isdir",
"gitlab_migration.gitlab_migration.update_local_repo",
"click.option",
"click.echo",
"click.File",
"gitlab_migration.gitlab_migration._get_namespace_id",
"gitlab_migration.gitlab_migration.migrate_repo",
"gitl... | [((159, 172), 'click.group', 'click.group', ([], {}), '()\n', (170, 172), False, 'import click\n'), ((346, 398), 'click.argument', 'click.argument', (['"""target_base_url"""'], {'type': 'click.STRING'}), "('target_base_url', type=click.STRING)\n", (360, 398), False, 'import click\n'), ((400, 449), 'click.argument', 'cl... |
"""
Please note, this code is only for python 3+. If you are using python 2+, please modify the code accordingly.
"""
import tensorflow as tf
def add_layer(inputs, in_size, out_size, activation_function=None, ):
# add one more layer and return the output of this layer
Weights = tf.Variable(tf.random_normal... | [
"tensorflow.Session",
"tensorflow.matmul",
"tensorflow.zeros",
"tensorflow.random_normal",
"tensorflow.initialize_all_variables"
] | [((719, 731), 'tensorflow.Session', 'tf.Session', ([], {}), '()\n', (729, 731), True, 'import tensorflow as tf\n'), ((758, 787), 'tensorflow.initialize_all_variables', 'tf.initialize_all_variables', ([], {}), '()\n', (785, 787), True, 'import tensorflow as tf\n'), ((304, 341), 'tensorflow.random_normal', 'tf.random_nor... |
import unittest
from ClassCollection import ClassCollection
# Todo
# Check if the classes exist in the classCollection (helper?)
# Check if relationship already exists (helper?)
# if it does, error
# if not, add parameter pair to the relationshipCollection
class RelationshipTest(unittest.TestCase):
def testAddRel... | [
"unittest.main",
"ClassCollection.ClassCollection"
] | [((3005, 3020), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3018, 3020), False, 'import unittest\n'), ((370, 387), 'ClassCollection.ClassCollection', 'ClassCollection', ([], {}), '()\n', (385, 387), False, 'from ClassCollection import ClassCollection\n'), ((586, 603), 'ClassCollection.ClassCollection', 'ClassC... |
from mmgroup.mm_space import MMSpace, MMV, MMVector
from mmgroup.mm_space import characteristics
from mmgroup.structures.mm0_group import MM0Group
from mmgroup.tests.spaces.sparse_mm_space import SparseMmSpace
from mmgroup.tests.spaces.sparse_mm_space import SparseMmV
from mmgroup.tests.groups.mgroup_n import MGroupN
... | [
"mmgroup.mm_space.MMV",
"mmgroup.tests.groups.mgroup_n.MGroupN",
"mmgroup.structures.mm0_group.MM0Group",
"mmgroup.tests.spaces.sparse_mm_space.SparseMmV"
] | [((407, 417), 'mmgroup.structures.mm0_group.MM0Group', 'MM0Group', ([], {}), '()\n', (415, 417), False, 'from mmgroup.structures.mm0_group import MM0Group\n'), ((426, 435), 'mmgroup.tests.groups.mgroup_n.MGroupN', 'MGroupN', ([], {}), '()\n', (433, 435), False, 'from mmgroup.tests.groups.mgroup_n import MGroupN\n'), ((... |
"""Advanced Collection of Data: Collects all the walls of height 10"""
__author__ = '<NAME>'
import Autodesk.Revit.DB as DB
doc = __revit__.ActiveUIDocument.Document
uidoc = __revit__.ActiveUIDocument
height_param_id = DB.ElementId(DB.BuiltInParameter.WALL_USER_HEIGHT_PARAM)
height_param_prov = DB.ParameterValuePr... | [
"Autodesk.Revit.DB.FilterNumericEquals",
"Autodesk.Revit.DB.FilteredElementCollector",
"Autodesk.Revit.DB.ElementId",
"Autodesk.Revit.DB.FilterDoubleRule",
"Autodesk.Revit.DB.ElementParameterFilter",
"Autodesk.Revit.DB.ParameterValueProvider"
] | [((223, 279), 'Autodesk.Revit.DB.ElementId', 'DB.ElementId', (['DB.BuiltInParameter.WALL_USER_HEIGHT_PARAM'], {}), '(DB.BuiltInParameter.WALL_USER_HEIGHT_PARAM)\n', (235, 279), True, 'import Autodesk.Revit.DB as DB\n'), ((301, 343), 'Autodesk.Revit.DB.ParameterValueProvider', 'DB.ParameterValueProvider', (['height_para... |
from big_fiubrother_core import QueueTask
from big_fiubrother_core.db import Database, VideoChunk
from big_fiubrother_core.storage import raw_storage
from big_fiubrother_core.synchronization import ProcessSynchronizer
from os import path
import logging
class StoreVideoChunk(QueueTask):
def __init__(self, configu... | [
"big_fiubrother_core.synchronization.ProcessSynchronizer",
"big_fiubrother_core.db.VideoChunk",
"logging.info",
"big_fiubrother_core.storage.raw_storage",
"big_fiubrother_core.db.Database"
] | [((517, 551), 'big_fiubrother_core.db.Database', 'Database', (["self.configuration['db']"], {}), "(self.configuration['db'])\n", (525, 551), False, 'from big_fiubrother_core.db import Database, VideoChunk\n'), ((575, 617), 'big_fiubrother_core.storage.raw_storage', 'raw_storage', (["self.configuration['storage']"], {})... |
from random import randint
for i in range(5):
n = (randint(0,10))
if(i == 0):
m = n
M = n
if (n > M):
M = n
elif (n < m):
m = n
print(n, end=' ')
print(f'\nO maior número foi {M}\nE o Menor foi {m}') | [
"random.randint"
] | [((55, 69), 'random.randint', 'randint', (['(0)', '(10)'], {}), '(0, 10)\n', (62, 69), False, 'from random import randint\n')] |
# apispec-swaggerinherit - Plugin for apispec adding support for Swagger-style
# inheritance using `allOf`
# Copyright (C) 2018 <NAME>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Fre... | [
"apispec.ext.marshmallow.swagger.get_ref_path"
] | [((1390, 1443), 'apispec.ext.marshmallow.swagger.get_ref_path', 'swagger.get_ref_path', (['spec.openapi_version.version[0]'], {}), '(spec.openapi_version.version[0])\n', (1410, 1443), False, 'from apispec.ext.marshmallow import swagger\n')] |
import pytest
from aao.spiders import spiders
pytestmark = pytest.mark.sports
class TestSport():
"""Nothing to test. """
pass
class TestSoccer():
"""Test the Soccer ABC across all bookmakers. """
@pytest.fixture(scope='class', params=spiders.values())
def spider(self, request):
s = r... | [
"pytest.raises",
"aao.spiders.spiders.values"
] | [((258, 274), 'aao.spiders.spiders.values', 'spiders.values', ([], {}), '()\n', (272, 274), False, 'from aao.spiders import spiders\n'), ((1510, 1572), 'pytest.raises', 'pytest.raises', (['KeyError'], {'match': 'f"""{country} is not supported *"""'}), "(KeyError, match=f'{country} is not supported *')\n", (1523, 1572),... |
from bs_dateutil.easter import easter
from bs_dateutil.easter import EASTER_WESTERN, EASTER_ORTHODOX, EASTER_JULIAN
from datetime import date
import pytest
# List of easters between 1990 and 2050
western_easter_dates = [
date(1990, 4, 15),
date(1991, 3, 31),
date(1992, 4, 19),
date(1993, 4, 11),
d... | [
"pytest.mark.parametrize",
"pytest.raises",
"datetime.date",
"bs_dateutil.easter.easter"
] | [((4041, 4101), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""easter_date"""', 'western_easter_dates'], {}), "('easter_date', western_easter_dates)\n", (4064, 4101), False, 'import pytest\n'), ((4210, 4271), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""easter_date"""', 'orthodox_easter_date... |
"""Tests the GHDL backend."""
from unittest import TestCase
import os
import re
from plumbum import local
from .common import run_vhdeps
DIR = os.path.realpath(os.path.dirname(__file__))
class TestPatterns(TestCase):
"""Tests the test case pattern matching logic (also used by the vsim
backend)."""
def t... | [
"plumbum.local.env",
"os.path.dirname",
"re.search"
] | [((162, 187), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (177, 187), False, 'import os\n'), ((414, 474), 'plumbum.local.env', 'local.env', ([], {'PATH': "(DIR + '/ghdl/fake-ghdl:' + local.env['PATH'])"}), "(PATH=DIR + '/ghdl/fake-ghdl:' + local.env['PATH'])\n", (423, 474), False, 'from pl... |
"""
==========================================================
Sample pipeline for text feature extraction and evaluation
==========================================================
The dataset used in this example is the 20 newsgroups dataset which will be
automatically downloaded and then cached and reused for the d... | [
"sklearn.model_selection.GridSearchCV",
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.preprocessing.StandardScaler",
"logging.basicConfig",
"warnings.filterwarnings",
"sklearn.linear_model.SGDClassifier",
"time.time",
"warnings.catch_warnings",
"pprint.pprint",
"numpy.array",
"skle... | [((2196, 2288), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s %(levelname)s %(message)s"""'}), "(level=logging.INFO, format=\n '%(asctime)s %(levelname)s %(message)s')\n", (2215, 2288), False, 'import logging\n'), ((2058, 2083), 'warnings.catch_warnings', 'war... |
"""Summary
Attributes:
Configer (TYPE): Description
"""
import logging
import argparse
from src.preprocess import *
from src.item_preprocessor import *
from src.configer import *
from src import tfidf
Configer = Configer('setting.ini')
logging.basicConfig(
# filename='log.log',
format='%(asctime)s : %(l... | [
"src.tfidf.train_tfidf",
"argparse.ArgumentParser",
"logging.basicConfig"
] | [((244, 339), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s : %(levelname)s : %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s : %(levelname)s : %(message)s',\n level=logging.INFO)\n", (263, 339), False, 'import logging\n'), ((381, 406), 'argparse.ArgumentParser', 'ar... |
"""!
All functions providing plotting functionalities.
"""
import matplotlib.pylab as plt
import matplotlib.dates as mdates
import matplotlib.image as image
import pandas as pd
import re
import argparse
import datetime as dt
import numpy as np
from pandas.plotting import register_matplotlib_converters
from datetime im... | [
"matplotlib.pylab.savefig",
"pandas.DataFrame.from_dict",
"argparse.ArgumentParser",
"numpy.datetime64",
"matplotlib.pylab.title",
"pandas.plotting.register_matplotlib_converters",
"matplotlib.pylab.ylabel",
"re.match",
"matplotlib.pylab.rcParams.update",
"matplotlib.dates.HourLocator",
"matplot... | [((336, 368), 'pandas.plotting.register_matplotlib_converters', 'register_matplotlib_converters', ([], {}), '()\n', (366, 368), False, 'from pandas.plotting import register_matplotlib_converters\n'), ((369, 407), 'matplotlib.pylab.rcParams.update', 'plt.rcParams.update', (["{'font.size': 22}"], {}), "({'font.size': 22}... |
from sklearn.preprocessing import PolynomialFeatures
poly = PolynomialFeatures(6)
def map(x):
return poly.fit_transform(x)
| [
"sklearn.preprocessing.PolynomialFeatures"
] | [((61, 82), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', (['(6)'], {}), '(6)\n', (79, 82), False, 'from sklearn.preprocessing import PolynomialFeatures\n')] |
from django.utils.translation import gettext as _
DAY_CHOICES = (
(1, _('Monday')),
(2, _('Tuesday')),
(3, _('Wednesday')),
(4, _('Thursday')),
(5, _('Friday')),
(6, _('Saturday')),
(7, _('Sunday')),
) | [
"django.utils.translation.gettext"
] | [((75, 86), 'django.utils.translation.gettext', '_', (['"""Monday"""'], {}), "('Monday')\n", (76, 86), True, 'from django.utils.translation import gettext as _\n'), ((97, 109), 'django.utils.translation.gettext', '_', (['"""Tuesday"""'], {}), "('Tuesday')\n", (98, 109), True, 'from django.utils.translation import gette... |
# Generated by Django 3.1.12 on 2021-07-12 09:25
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("polio", "0016_config"),
]
operations = [
migrations.AddField(
model_name="campaign",
name="gpei_email",
... | [
"django.db.models.EmailField"
] | [((327, 383), 'django.db.models.EmailField', 'models.EmailField', ([], {'blank': '(True)', 'max_length': '(254)', 'null': '(True)'}), '(blank=True, max_length=254, null=True)\n', (344, 383), False, 'from django.db import migrations, models\n')] |
import os
import sqlite3
import random
import string
import time
import datetime
from datetime import timedelta
import operator
from tabulate import tabulate
import config
TS_GROUP_BY = dict(
timestamp=0b10000,
project=0b1000,
task=0b0100,
track=0b0010,
date=0b0001
)
class Database:
def in... | [
"random.choice",
"tabulate.tabulate",
"sqlite3.connect",
"datetime.timedelta",
"operator.itemgetter",
"datetime.datetime.now"
] | [((362, 454), 'sqlite3.connect', 'sqlite3.connect', (['db_path'], {'detect_types': '(sqlite3.PARSE_DECLTYPES | sqlite3.PARSE_COLNAMES)'}), '(db_path, detect_types=sqlite3.PARSE_DECLTYPES | sqlite3.\n PARSE_COLNAMES)\n', (377, 454), False, 'import sqlite3\n'), ((19979, 20002), 'datetime.datetime.now', 'datetime.datet... |
import json
import os
from rest_framework.renderers import JSONRenderer
from api.models import Project, DOCUMENT_CLASSIFICATION, SEQUENCE_LABELING
from api.serializers import LabelSerializer
from api.utils import JSONPainter
def extract_document_classification(label, labels):
return labels.get(pk=label["label"]... | [
"os.makedirs",
"api.utils.JSONPainter",
"os.path.exists",
"rest_framework.renderers.JSONRenderer",
"api.models.Project.objects.all",
"api.serializers.LabelSerializer"
] | [((843, 864), 'api.models.Project.objects.all', 'Project.objects.all', ([], {}), '()\n', (862, 864), False, 'from api.models import Project, DOCUMENT_CLASSIFICATION, SEQUENCE_LABELING\n'), ((768, 792), 'os.path.exists', 'os.path.exists', (['dump_dir'], {}), '(dump_dir)\n', (782, 792), False, 'import os\n'), ((802, 823)... |
# -*- coding: utf-8 -*-
from django.db import models
from gestao.contrato.models.contrato.Contrato import Contrato
from gestao.financeiro.models.movimentacoes.Despesa import Despesa
from gestao.financeiro.models.pagamento.PagamentoDespesa import PagamentoDespesa
class ContratoDespesas(models.Model):
contrato = mo... | [
"django.db.models.ForeignKey",
"gestao.financeiro.models.pagamento.PagamentoDespesa.PagamentoDespesa.objects.filter"
] | [((318, 370), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Contrato'], {'verbose_name': '"""Contrato"""'}), "(Contrato, verbose_name='Contrato')\n", (335, 370), False, 'from django.db import models\n'), ((385, 435), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Despesa'], {'verbose_name': '"""Despesa... |
from unittest import TestCase
from simplifiedpytrends.request import TrendReq
class TestTrendReq(TestCase):
def test__get_data(self):
"""Should use same values as in the documentation"""
pytrend = TrendReq()
self.assertEqual(pytrend.hl, 'en-US')
self.assertEqual(pytrend.tz, 360)
... | [
"simplifiedpytrends.request.TrendReq"
] | [((221, 231), 'simplifiedpytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (229, 231), False, 'from simplifiedpytrends.request import TrendReq\n'), ((468, 478), 'simplifiedpytrends.request.TrendReq', 'TrendReq', ([], {}), '()\n', (476, 478), False, 'from simplifiedpytrends.request import TrendReq\n')] |
from __future__ import absolute_import, print_function
from flask import Blueprint
posts = Blueprint('posts', __name__)
from . import views
from . import models
| [
"flask.Blueprint"
] | [((93, 121), 'flask.Blueprint', 'Blueprint', (['"""posts"""', '__name__'], {}), "('posts', __name__)\n", (102, 121), False, 'from flask import Blueprint\n')] |
# -*- coding:utf-8 -*-
# ###########################
# File Name: hdataset.py
# Author: geekinglcq
# Mail: <EMAIL>
# Created Time: 2020-12-28 20:17:47
# ###########################
import pandas as pd
import os
import logging
from collections import defaultdict
from torch.utils.data import DataLoader, Dataset
from .e... | [
"torch.utils.data.DataLoader",
"pandas.read_csv",
"pandas.merge",
"collections.defaultdict",
"os.path.isfile",
"pandas.concat",
"logging.getLogger"
] | [((2605, 2624), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (2622, 2624), False, 'import logging\n'), ((3038, 3055), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (3049, 3055), False, 'from collections import defaultdict\n'), ((3086, 3103), 'collections.defaultdict', 'defaultdict... |
"""
Django settings for farmblr project.
Generated by 'django-admin startproject' using Django 4.0.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
"""
import os
from... | [
"pathlib.Path",
"os.path.join"
] | [((505, 540), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""templates"""'], {}), "(BASE_DIR, 'templates')\n", (517, 540), False, 'import os\n'), ((3482, 3519), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""staticfiles"""'], {}), "(BASE_DIR, 'staticfiles')\n", (3494, 3519), False, 'import os\n'), ((3627, 3659), ... |
import os
import shutil
import pandas as pd
import torch
import PIL.Image as Image
import torchvision.transforms as transforms
import time
t = transforms.Compose([transforms.Resize((224,224))])
data_dir = '../../data'
image_dir = os.path.join(data_dir, 'isic/Images')
def main(csv_filename, include_sonic):
if in... | [
"os.mkdir",
"os.path.exists",
"time.time",
"os.path.join",
"torchvision.transforms.Resize"
] | [((233, 270), 'os.path.join', 'os.path.join', (['data_dir', '"""isic/Images"""'], {}), "(data_dir, 'isic/Images')\n", (245, 270), False, 'import os\n'), ((777, 788), 'time.time', 'time.time', ([], {}), '()\n', (786, 788), False, 'import time\n'), ((165, 194), 'torchvision.transforms.Resize', 'transforms.Resize', (['(22... |
from turtle import Screen
from snake import Snake
from food import Food
from scoreboard import Score
import time
screener = Screen()
screener.setup(width=600, height=600)
screener.bgcolor("black")
screener.title("SNAKE GAME")
screener.tracer(0)
snake = Snake()
food = Food()
scoreboard = Score()
scree... | [
"time.sleep",
"turtle.Screen",
"scoreboard.Score",
"food.Food",
"snake.Snake"
] | [((131, 139), 'turtle.Screen', 'Screen', ([], {}), '()\n', (137, 139), False, 'from turtle import Screen\n'), ((267, 274), 'snake.Snake', 'Snake', ([], {}), '()\n', (272, 274), False, 'from snake import Snake\n'), ((283, 289), 'food.Food', 'Food', ([], {}), '()\n', (287, 289), False, 'from food import Food\n'), ((304, ... |
import os
import cv2
import numpy as np
def get_emojis():
emojis_folder = 'emoji/'
emojis = []
for emoji in range(len(os.listdir(emojis_folder))):
print(emoji)
emojis.append(cv2.imread(emojis_folder + str(emoji) + '.png', -1))
return emojis[0:len(emojis) - 1]
def overlay(image, emoj... | [
"cv2.cvtColor",
"os.listdir",
"cv2.resize",
"cv2.addWeighted"
] | [((348, 373), 'cv2.resize', 'cv2.resize', (['emoji', '(w, h)'], {}), '(emoji, (w, h))\n', (358, 373), False, 'import cv2\n'), ((921, 967), 'cv2.cvtColor', 'cv2.cvtColor', (['overlay_mask', 'cv2.COLOR_GRAY2BGR'], {}), '(overlay_mask, cv2.COLOR_GRAY2BGR)\n', (933, 967), False, 'import cv2\n'), ((990, 1039), 'cv2.cvtColor... |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# 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.apa... | [
"caffe2.python.workspace.FetchBlob",
"caffe2.python.core.Net",
"numpy.allclose",
"caffe2.python.workspace.RunNetOnce",
"numpy.prod",
"ngraph.frontends.caffe2.c2_importer.importer.C2Importer",
"caffe2.python.workspace.ResetWorkspace",
"random.gauss",
"ngraph.testing.ExecutorFactory"
] | [((1256, 1282), 'caffe2.python.workspace.ResetWorkspace', 'workspace.ResetWorkspace', ([], {}), '()\n', (1280, 1282), False, 'from caffe2.python import core, workspace\n'), ((1429, 1444), 'caffe2.python.core.Net', 'core.Net', (['"""net"""'], {}), "('net')\n", (1437, 1444), False, 'from caffe2.python import core, worksp... |
# This is a module with functions that can be used to calculate the Froude
# number in a simple 2D system
# <NAME>, 2015
import numpy as np
import datetime
from salishsea_tools.nowcast import analyze
def find_mixed_depth_indices(n2, n2_thres=5e-6):
"""Finds the index of the mixed layer depth for each x-positio... | [
"numpy.abs",
"numpy.argmax",
"numpy.zeros",
"numpy.mean",
"numpy.arange",
"numpy.where",
"datetime.timedelta",
"numpy.rollaxis",
"salishsea_tools.nowcast.analyze.depth_average",
"numpy.sqrt"
] | [((1656, 1692), 'numpy.mean', 'np.mean', (['mixed_depths[xmin:xmax + 1]'], {}), '(mixed_depths[xmin:xmax + 1])\n', (1663, 1692), True, 'import numpy as np\n'), ((2228, 2250), 'numpy.arange', 'np.arange', (['n2.shape[0]'], {}), '(n2.shape[0])\n', (2237, 2250), True, 'import numpy as np\n'), ((3763, 3786), 'numpy.zeros',... |
__copyright__ = "Copyright (C) 2018 CVision AI."
__license__ = "GPLv3"
# This file is part of OpenEM, released under GPLv3.
# OpenEM 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 Lice... | [
"tensorflow.range",
"tensorflow.abs",
"tensorflow.reduce_sum",
"tensorflow.not_equal",
"tensorflow.less",
"tensorflow.nn.top_k",
"tensorflow.reduce_max",
"tensorflow.reshape",
"tensorflow.concat",
"tensorflow.minimum",
"tensorflow.ones_like",
"tensorflow.to_int32",
"tensorflow.tile",
"tens... | [((1212, 1235), 'tensorflow.abs', 'tf.abs', (['(y_true - y_pred)'], {}), '(y_true - y_pred)\n', (1218, 1235), True, 'import tensorflow as tf\n'), ((1360, 1386), 'tensorflow.reduce_sum', 'tf.reduce_sum', (['l1_loss', '(-1)'], {}), '(l1_loss, -1)\n', (1373, 1386), True, 'import tensorflow as tf\n'), ((1300, 1322), 'tenso... |
import os
from setuptools import find_packages
if __name__ == '__main__':
for package in find_packages():
if '.test' in package:
continue
os.system(f'cmd /c "python -m pytest -s {package}/test"')
| [
"os.system",
"setuptools.find_packages"
] | [((95, 110), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (108, 110), False, 'from setuptools import find_packages\n'), ((172, 229), 'os.system', 'os.system', (['f"""cmd /c "python -m pytest -s {package}/test\\""""'], {}), '(f\'cmd /c "python -m pytest -s {package}/test"\')\n', (181, 229), False, 'imp... |
# This is open-source software licensed under a BSD license.
# Please see the file LICENSE.txt for details.
"""Observation Log plugin.
**Plugin Type: Global**
``ObsLog`` is a global plugin. Only one instance can be opened.
**Usage**
***Saving the log to a file***
Put in values for the Observation Log folder and fi... | [
"pandas.DataFrame",
"pandas.read_csv",
"ginga.gw.Widgets.HBox",
"ginga.gw.Widgets.build_info",
"ginga.gw.Widgets.Button",
"ginga.gw.Widgets.Label",
"ginga.gw.Widgets.VBox",
"pandas.read_excel",
"os.path.splitext",
"collections.OrderedDict"
] | [((2491, 2506), 'collections.OrderedDict', 'OrderedDict', (['{}'], {}), '({})\n', (2502, 2506), False, 'from collections import OrderedDict\n'), ((2683, 2697), 'ginga.gw.Widgets.VBox', 'Widgets.VBox', ([], {}), '()\n', (2695, 2697), False, 'from ginga.gw import Widgets\n'), ((3384, 3436), 'ginga.gw.Widgets.build_info',... |
import argparse
import torch
import sys
import os
import json
from collections import defaultdict
import h5py
from sentence_transformers import SentenceTransformer, util
import numpy
import tqdm
from itertools import zip_longest
from utils import grouper, load_sentences, load_bnids, load_visualsem_bnids
def retrieve_... | [
"utils.load_sentences",
"h5py.File",
"os.remove",
"os.makedirs",
"argparse.ArgumentParser",
"tqdm.trange",
"os.path.realpath",
"numpy.argsort",
"sentence_transformers.util.pytorch_cos_sim",
"os.path.isfile",
"utils.load_bnids",
"numpy.array",
"torch.cuda.is_available",
"utils.load_visualse... | [((1034, 1059), 'os.path.isfile', 'os.path.isfile', (['out_fname'], {}), '(out_fname)\n', (1048, 1059), False, 'import os\n'), ((1356, 1387), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', (['model_name'], {}), '(model_name)\n', (1375, 1387), False, 'from sentence_transformers import SentenceTransf... |
import hcat.lib.functional
import hcat.lib.functional as functional
from hcat.lib.utils import calculate_indexes, load, cochlea_to_xml, correct_pixel_size, scale_to_hair_cell_diameter
from hcat.lib.cell import Cell
from hcat.lib.cochlea import Cochlea
from hcat.backends.detection import FasterRCNN_from_url
from hcat.ba... | [
"hcat.lib.utils.correct_pixel_size",
"hcat.lib.utils.warn",
"hcat.lib.utils.scale_to_hair_cell_diameter",
"numpy.zeros",
"hcat.lib.explore_lif.get_xml",
"hcat.lib.utils.calculate_indexes",
"hcat.lib.cochlea.Cochlea",
"hcat.backends.detection.FasterRCNN_from_url",
"hcat.lib.utils.load",
"torch.cuda... | [((1374, 1438), 'hcat.lib.utils.warn', 'warn', (['"""ERROR: No File to Analyze... \nAborting."""'], {'color': '"""red"""'}), '("""ERROR: No File to Analyze... \nAborting.""", color=\'red\')\n', (1378, 1438), False, 'from hcat.lib.utils import warn\n'), ((1487, 1628), 'hcat.lib.utils.warn', 'warn', (['"""WARNING: Pixel ... |
import json
from . import api, root
from .decorators import gateway_belong_to_user, require_basic_or_oauth
from userver.object.gateway import Gateway, Location
from utils.errors import KeyDuplicateError, PatchError
from .forms.form_gateway import AddGatewayForm, PatchGateway
from flask import request, Response
from .f... | [
"userver.object.gateway.Gateway.query.get",
"userver.object.gateway.Gateway.query.filter_by",
"userver.object.gateway.Location",
"json.dumps",
"userver.object.gateway.Gateway",
"flask.Response"
] | [((3413, 3516), 'userver.object.gateway.Location', 'Location', (["add_gateway['longitude'].data", "add_gateway['latitude'].data", "add_gateway['altitude'].data"], {}), "(add_gateway['longitude'].data, add_gateway['latitude'].data,\n add_gateway['altitude'].data)\n", (3421, 3516), False, 'from userver.object.gateway ... |
from django.contrib import admin
from products.views import portfolio
# Register your models here.
from . models import Product, New, About, LatestNew
class ProductAdmin(admin.ModelAdmin):
list_display = ('name','price','created_at')
list_links = ('id', 'name')
list_filter = ('name','price','created_at')... | [
"django.contrib.admin.site.register"
] | [((543, 585), 'django.contrib.admin.site.register', 'admin.site.register', (['Product', 'ProductAdmin'], {}), '(Product, ProductAdmin)\n', (562, 585), False, 'from django.contrib import admin\n'), ((586, 620), 'django.contrib.admin.site.register', 'admin.site.register', (['New', 'NewAdmin'], {}), '(New, NewAdmin)\n', (... |
"""
@author <NAME>
A.I. Engineer & Software developer
<EMAIL>
Created on 27 December, 2017 @ 12:40 AM.
Copyright © 2017. Victor. All rights reserved.
"""
import os
APP_NAME = 'folktales'
PROJECT_DIR = os.getcwd()
STATIC_DIR = os.path.join(PROJECT_DIR, 'static')
DATASET_DIR = os.path.join(STATIC_DIR,... | [
"os.getcwd",
"os.path.join"
] | [((219, 230), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (228, 230), False, 'import os\n'), ((245, 280), 'os.path.join', 'os.path.join', (['PROJECT_DIR', '"""static"""'], {}), "(PROJECT_DIR, 'static')\n", (257, 280), False, 'import os\n'), ((296, 332), 'os.path.join', 'os.path.join', (['STATIC_DIR', '"""datasets"""'],... |
import csv
import time
import numpy as np
import argparse
import warnings
warnings.filterwarnings('ignore')
from sklearn.preprocessing import scale
from sklearn.model_selection import GridSearchCV
from sklearn.neural_network import MLPRegressor
from sklearn.model_selection import train_test_split
from sklearn.feature_... | [
"argparse.ArgumentParser",
"sklearn.preprocessing.scale",
"warnings.filterwarnings",
"sklearn.model_selection.train_test_split",
"csv.DictReader",
"sklearn.neural_network.MLPRegressor",
"numpy.array",
"sklearn.feature_extraction.DictVectorizer",
"numpy.loadtxt"
] | [((74, 107), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (97, 107), False, 'import warnings\n'), ((449, 496), 'numpy.loadtxt', 'np.loadtxt', (['datafile'], {'skiprows': '(1)', 'delimiter': '""","""'}), "(datafile, skiprows=1, delimiter=',')\n", (459, 496), True, 'import... |
# (C) Copyright 2005-2021 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in LICENSE.txt and may be redistributed only under
# the conditions described in the aforementioned license. The license
# is also available online at... | [
"traits.observation._list_item_observer.ListItemObserver",
"traits.observation._metadata_filter.MetadataFilter",
"traits.observation.expression.metadata",
"traits.observation.expression.dict_items",
"traits.observation.expression.ObserverExpression",
"traits.observation.expression.match",
"traits.observ... | [((1239, 1263), 'traits.observation._observer_graph.ObserverGraph', 'ObserverGraph', ([], {'node': 'node'}), '(node=node)\n', (1252, 1263), False, 'from traits.observation._observer_graph import ObserverGraph\n'), ((1668, 1713), 'traits.observation.expression.SingleObserverExpression', 'expression.SingleObserverExpress... |
# Copyright 2016 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | [
"requests.Response",
"mock.Mock"
] | [((1842, 1861), 'requests.Response', 'requests.Response', ([], {}), '()\n', (1859, 1861), False, 'import requests\n'), ((932, 943), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (941, 943), False, 'import mock\n')] |
import csv
import matplotlib.pyplot as plt
# pip install matplotlib-venn
from matplotlib_venn import venn3
with open('../../Data/Annotations/ethnicity.csv') as f:
reader = csv.DictReader(f)
entries = list(reader)
images_per_language = {'dutch': set(), 'german': set(), 'english': set()}
for entry in entries:... | [
"csv.DictReader",
"matplotlib_venn.venn3",
"matplotlib.pyplot.savefig"
] | [((449, 585), 'matplotlib_venn.venn3', 'venn3', (["[images_per_language['dutch'], images_per_language['german'],\n images_per_language['english']]", "['Dutch', 'German', 'English']"], {}), "([images_per_language['dutch'], images_per_language['german'],\n images_per_language['english']], ['Dutch', 'German', 'Engli... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'loader2.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGu... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QProgressBar",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtWidgets.QTableWidget",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtGui.QFont",
"PyQt5.QtWidget... | [((548, 577), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['MainWindow'], {}), '(MainWindow)\n', (565, 577), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((1266, 1307), 'PyQt5.QtWidgets.QVBoxLayout', 'QtWidgets.QVBoxLayout', (['self.centralwidget'], {}), '(self.centralwidget)\n', (1287, 1307), False, 'f... |
# Script to add photometry from the BDNYC database into SIMPLE
from astrodbkit2.astrodb import Database, and_
from sqlalchemy import types # for BDNYC column overrides
verbose = True
# --------------------------------------------------------------------------------------
# Establish connection to databases
# Note ... | [
"astrodbkit2.astrodb.Database",
"sqlalchemy.types.TEXT"
] | [((1021, 1048), 'astrodbkit2.astrodb.Database', 'Database', (['connection_string'], {}), '(connection_string)\n', (1029, 1048), False, 'from astrodbkit2.astrodb import Database, and_\n'), ((869, 881), 'sqlalchemy.types.TEXT', 'types.TEXT', ([], {}), '()\n', (879, 881), False, 'from sqlalchemy import types\n'), ((949, 9... |
#!/usr/bin/python3
import scrapy
from yarl import URL
from datetime import datetime
import json
import newspaper.spiders.config as config
from newspaper.spiders.generate_links import generate_links as generate
from newspaper.spiders.makepdf import make_pdf
class IndianExpressSpider(scrapy.Spider):
name = "indian_... | [
"newspaper.spiders.generate_links.generate_links",
"datetime.datetime.strptime",
"json.load",
"scrapy.Request"
] | [((494, 514), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (503, 514), False, 'import json\n'), ((637, 662), 'newspaper.spiders.generate_links.generate_links', 'generate', (['self.name', 'term'], {}), '(self.name, term)\n', (645, 662), True, 'from newspaper.spiders.generate_links import generate_link... |
from django.shortcuts import render
from django.contrib.auth.hashers import make_password
from django.contrib.auth import authenticate, login, logout
from django.views.generic import View, ListView, DetailView,TemplateView
from django.urls import reverse
from django.http import HttpResponseRedirect,HttpRequest, HttpRes... | [
"users.forms.UserUpdateForm",
"django.contrib.auth.hashers.make_password",
"django.db.models.Q",
"django.http.JsonResponse",
"django.urls.reverse",
"users.forms.UserProfileForm",
"django.shortcuts.render",
"django.http.QueryDict"
] | [((1593, 1622), 'users.forms.UserProfileForm', 'UserProfileForm', (['request.POST'], {}), '(request.POST)\n', (1608, 1622), False, 'from users.forms import UserProfileForm, UserUpdateForm\n'), ((2381, 2409), 'django.http.JsonResponse', 'JsonResponse', (['res'], {'safe': '(True)'}), '(res, safe=True)\n', (2393, 2409), F... |
from django.conf.urls import url
from blog import views
from django.conf import settings
from django.conf.urls.static import static
app_name="blog"
urlpatterns = [
url(r'(?P<id>\d+)/post_edit/$', views.post_edit, name="post_edit"),
url(r'(?P<reqid>\d+)/(?P<proid>\d+)/(?P<posid>\d+)/(?P<comid>\d+)/report/$', vie... | [
"django.conf.urls.static.static",
"django.conf.urls.url"
] | [((168, 234), 'django.conf.urls.url', 'url', (['"""(?P<id>\\\\d+)/post_edit/$"""', 'views.post_edit'], {'name': '"""post_edit"""'}), "('(?P<id>\\\\d+)/post_edit/$', views.post_edit, name='post_edit')\n", (171, 234), False, 'from django.conf.urls import url\n'), ((240, 352), 'django.conf.urls.url', 'url', (['"""(?P<reqi... |
from django.urls import reverse
from django.contrib.auth import get_user_model
from rest_framework import status
from rest_framework.authtoken.models import Token
from rest_framework.test import APITestCase, APIClient
from .fixture import RegiaoFactory, CidadeFactory
User = get_user_model()
class CidadeViewSetTest... | [
"rest_framework.authtoken.models.Token.objects.get_or_create",
"rest_framework.test.APIClient",
"django.contrib.auth.get_user_model",
"django.urls.reverse"
] | [((278, 294), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (292, 294), False, 'from django.contrib.auth import get_user_model\n'), ((641, 652), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (650, 652), False, 'from rest_framework.test import APITestCase, APIClient\n'), ((6... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.3 on 2016-12-05 14:24
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('imageledger', '0010_auto_20161130_1814'),
]
operations = [
migrations.AlterModelOpt... | [
"django.db.migrations.AlterModelOptions"
] | [((296, 385), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""favorite"""', 'options': "{'ordering': ['-updated_on']}"}), "(name='favorite', options={'ordering': [\n '-updated_on']})\n", (324, 385), False, 'from django.db import migrations\n'), ((425, 510), 'django.db.migr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import pickle
import pandas as pd
import easygui as eg
from collections import defaultdict
from PyQt5 import QtCore as qtc
class file_entry():
def __init__(self,route_response_label,route_destiny_label):
self.route_response_label=route_response_labe... | [
"pickle.dump",
"easygui.choicebox",
"pandas.read_csv",
"os.path.dirname",
"collections.defaultdict",
"pandas.read_excel",
"pickle.load"
] | [((2245, 2281), 'easygui.choicebox', 'eg.choicebox', (['msg', 'title', 'columns_df'], {}), '(msg, title, columns_df)\n', (2257, 2281), True, 'import easygui as eg\n'), ((2446, 2459), 'collections.defaultdict', 'defaultdict', ([], {}), '()\n', (2457, 2459), False, 'from collections import defaultdict\n'), ((3165, 3192),... |
#!/usr/bin/env python3
# Copyright 2014-2018 PUNCH Cyber Analytics Group
#
# 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
#
# Un... | [
"stoq.WorkerResponse",
"stoq.helpers.get_sha1",
"time.sleep",
"requests.get",
"stoq.exceptions.StoqPluginException",
"requests.post"
] | [((4238, 4297), 'requests.post', 'requests.post', (['url'], {'data': 'data', 'files': 'files', 'headers': 'headers'}), '(url, data=data, files=files, headers=headers)\n', (4251, 4297), False, 'import requests\n'), ((4486, 4524), 'stoq.WorkerResponse', 'WorkerResponse', (['results'], {'errors': 'errors'}), '(results, er... |