code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import collections
import decimal
import json
import logging
from django.apps import apps
from django.conf import settings
from django.contrib.contenttypes.fields import GenericRelation
from django.contrib.postgres.fields import JSONField
from django.core.exceptions import ValidationError
from django.core.validators i... | [
"logging.getLogger",
"django.db.models.DateField",
"django.contrib.postgres.fields.JSONField",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.Count",
"django.utils.translation.gettext_lazy",
"django.urls.reverse",
"logging.error",
"django.db.models.Max",
"django... | [((1227, 1254), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1244, 1254), False, 'import logging\n'), ((14369, 14409), 'django.dispatch.dispatcher.receiver', 'receiver', (['post_delete'], {'sender': 'PacketFile'}), '(post_delete, sender=PacketFile)\n', (14377, 14409), False, 'from djan... |
import os
import matplotlib as mpl
import torch
import torchvision
from data_management import IPDataset, Jitter, SimulateMeasurements
from networks import IterativeNet, Tiramisu
from operators import Radon
# ----- load configuration -----
import config # isort:skip
# ----- global configuration -----
mpl.use("agg... | [
"operators.Radon",
"os.makedirs",
"matplotlib.use",
"networks.IterativeNet",
"os.path.join",
"data_management.Jitter",
"torch.nn.MSELoss",
"data_management.SimulateMeasurements",
"torch.cuda.set_device",
"torch.linspace",
"torch.device"
] | [((308, 322), 'matplotlib.use', 'mpl.use', (['"""agg"""'], {}), "('agg')\n", (315, 322), True, 'import matplotlib as mpl\n'), ((332, 354), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (344, 354), False, 'import torch\n'), ((355, 379), 'torch.cuda.set_device', 'torch.cuda.set_device', (['(0)']... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import time
import requests
from cleep.exception import CommandError, MissingParameter
from cleep.libs.internals.task import Task
from cleep.core import CleepModule
from cleep.common import CATEGORIES
__all__ = ["Openweathermap"]
class Openweathermap(CleepMo... | [
"cleep.core.CleepModule.__init__",
"time.time",
"cleep.libs.internals.task.Task",
"requests.get"
] | [((4444, 4496), 'cleep.core.CleepModule.__init__', 'CleepModule.__init__', (['self', 'bootstrap', 'debug_enabled'], {}), '(self, bootstrap, debug_enabled)\n', (4464, 4496), False, 'from cleep.core import CleepModule\n'), ((6387, 6445), 'cleep.libs.internals.task.Task', 'Task', (['self.OWM_TASK_DELAY', 'self._weather_ta... |
from pywps import Service
from pywps.tests import assert_response_success
from .common import client_for, get_output
from emu.processes.wps_dummy import Dummy
def test_wps_dummy():
client = client_for(Service(processes=[Dummy()]))
datainputs = "input1=10;input2=2"
resp = client.get(
service='WPS'... | [
"pywps.tests.assert_response_success",
"emu.processes.wps_dummy.Dummy"
] | [((428, 457), 'pywps.tests.assert_response_success', 'assert_response_success', (['resp'], {}), '(resp)\n', (451, 457), False, 'from pywps.tests import assert_response_success\n'), ((227, 234), 'emu.processes.wps_dummy.Dummy', 'Dummy', ([], {}), '()\n', (232, 234), False, 'from emu.processes.wps_dummy import Dummy\n')] |
#!/usr/bin/env python
import rospy
from std_msgs.msg import String
def talker():
pub = rospy.Publisher('chatter', String)
rospy.init_node('talker', anonymous=True)
while not rospy.is_shutdown():
str = "%s: hello world %s" % (rospy.get_name(), rospy.get_time())
rospy.loginfo(str)
pu... | [
"std_msgs.msg.String",
"rospy.is_shutdown",
"rospy.init_node",
"rospy.get_time",
"rospy.get_name",
"rospy.sleep",
"rospy.Publisher",
"rospy.loginfo"
] | [((93, 127), 'rospy.Publisher', 'rospy.Publisher', (['"""chatter"""', 'String'], {}), "('chatter', String)\n", (108, 127), False, 'import rospy\n'), ((132, 173), 'rospy.init_node', 'rospy.init_node', (['"""talker"""'], {'anonymous': '(True)'}), "('talker', anonymous=True)\n", (147, 173), False, 'import rospy\n'), ((188... |
from sklearn import preprocessing, svm
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn import cross_validation
import pandas as pd
import numpy as np
import quandl
import math
df = quandl.get('WIKI/GOOGL')
df = df[['Adj. Open', 'Adj. High', 'Adj. Lo... | [
"numpy.array",
"quandl.get",
"sklearn.cross_validation.train_test_split",
"sklearn.linear_model.LinearRegression",
"sklearn.preprocessing.scale"
] | [((250, 274), 'quandl.get', 'quandl.get', (['"""WIKI/GOOGL"""'], {}), "('WIKI/GOOGL')\n", (260, 274), False, 'import quandl\n'), ((826, 847), 'numpy.array', 'np.array', (["df['label']"], {}), "(df['label'])\n", (834, 847), True, 'import numpy as np\n'), ((852, 874), 'sklearn.preprocessing.scale', 'preprocessing.scale',... |
import datetime
import os
import yaml
import numpy as np
import pandas as pd
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output
from scipy.integrate import solve_ivp
from scipy.optimize import minimize
import plotly.graph_objs as go
ENV_F... | [
"pandas.read_csv",
"numpy.arange",
"dash_core_components.RadioItems",
"dash_core_components.Input",
"dash.dependencies.Output",
"os.path.join",
"yaml.load",
"dash.dependencies.Input",
"dash_core_components.Dropdown",
"dash_html_components.Label",
"datetime.date",
"dash_core_components.Markdown... | [((530, 622), 'os.path.join', 'os.path.join', (['ROOT_DIR', "params['directories']['processed']", "params['files']['all_data']"], {}), "(ROOT_DIR, params['directories']['processed'], params['files'][\n 'all_data'])\n", (542, 622), False, 'import os\n'), ((1497, 1527), 'dash.Dash', 'dash.Dash', (['"""C0VID-19 Explore... |
import pytest
from astropy.io import fits
import numpy as np
from lightkurve.io.kepseismic import read_kepseismic_lightcurve
from lightkurve.io.detect import detect_filetype
@pytest.mark.remote_data
def test_detect_kepseismic():
"""Can we detect the correct format for KEPSEISMIC files?"""
url = "https://arch... | [
"lightkurve.io.kepseismic.read_kepseismic_lightcurve",
"lightkurve.io.detect.detect_filetype",
"numpy.sum",
"astropy.io.fits.open"
] | [((461, 475), 'astropy.io.fits.open', 'fits.open', (['url'], {}), '(url)\n', (470, 475), False, 'from astropy.io import fits\n'), ((878, 909), 'lightkurve.io.kepseismic.read_kepseismic_lightcurve', 'read_kepseismic_lightcurve', (['url'], {}), '(url)\n', (904, 909), False, 'from lightkurve.io.kepseismic import read_keps... |
from ggplot import aes, geom_point, ggplot, mtcars
import matplotlib.pyplot as plt
from pandas import DataFrame
from bokeh import mpl
from bokeh.plotting import output_file, show
g = ggplot(mtcars, aes(x='wt', y='mpg', color='qsec')) + geom_point()
g.make()
plt.title("Point ggplot-based plot in Bokeh.")
output_fil... | [
"bokeh.mpl.to_bokeh",
"bokeh.plotting.output_file",
"matplotlib.pyplot.title",
"ggplot.aes",
"ggplot.geom_point"
] | [((262, 308), 'matplotlib.pyplot.title', 'plt.title', (['"""Point ggplot-based plot in Bokeh."""'], {}), "('Point ggplot-based plot in Bokeh.')\n", (271, 308), True, 'import matplotlib.pyplot as plt\n'), ((310, 375), 'bokeh.plotting.output_file', 'output_file', (['"""ggplot_point.html"""'], {'title': '"""ggplot_point.p... |
#!/usr/bin/env python
# coding: utf-8
# In[1]:
from __future__ import absolute_import, division, print_function
import argparse
import logging
import os
import random
import sys
from io import open
import numpy as np
import torch
import json
from torch.utils.data import (DataLoader, SequentialSampler, RandomSampl... | [
"logging.getLogger",
"models.modeling_bert.Config.from_json_file",
"ray.tune.track.log",
"apex.amp.scale_loss",
"utils.korquad_utils.RawResult",
"torch.cuda.device_count",
"io.open",
"ray.tune.grid_search",
"apex.amp.initialize",
"torch.cuda.is_available",
"ray.init",
"os.path.exists",
"json... | [((887, 1030), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(levelname)s - %(name)s - %(message)s"""', 'datefmt': '"""%m/%d/%Y %H:%M:%S"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(levelname)s - %(name)s - %(message)s', datefmt=\n '%m/%d/%Y %H:%M:%S', level=... |
from datetime import date
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from phonenumber_field.formfields import PhoneNumberField
from .models import Profile
from .options import STATE_CHOICES, YEARS
from .utils import AgeValidator
class ... | [
"django.forms.Select",
"phonenumber_field.formfields.PhoneNumberField",
"django.forms.SelectDateWidget",
"django.forms.TextInput",
"datetime.date.today"
] | [((1503, 1638), 'phonenumber_field.formfields.PhoneNumberField', 'PhoneNumberField', ([], {'required': '(False)', 'initial': '"""+977"""', 'help_text': '"""Phone number must contain country calling code (e.g. +97798XXYYZZSS)"""'}), "(required=False, initial='+977', help_text=\n 'Phone number must contain country cal... |
from django.urls import path
from . import views
app_name = 'trip'
urlpatterns = [
path('', views.index, name='index'),
path('tripblog/', views.AllTrip.as_view(), name="tripplan"),
path('likereview/', views.like_comment_view, name="like_comment"),
path('tripdetail/<int:pk>/', views.trip_detail, name="t... | [
"django.urls.path"
] | [((88, 123), 'django.urls.path', 'path', (['""""""', 'views.index'], {'name': '"""index"""'}), "('', views.index, name='index')\n", (92, 123), False, 'from django.urls import path\n'), ((194, 259), 'django.urls.path', 'path', (['"""likereview/"""', 'views.like_comment_view'], {'name': '"""like_comment"""'}), "('likerev... |
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import re
... | [
"pants.build_graph.address.Address.parse",
"re.compile",
"pants.base.cmd_line_spec_parser.CmdLineSpecParser",
"os.path.join",
"pants.build_graph.build_file_aliases.BuildFileAliases"
] | [((672, 717), 'pants.build_graph.build_file_aliases.BuildFileAliases', 'BuildFileAliases', ([], {'targets': "{'generic': Target}"}), "(targets={'generic': Target})\n", (688, 717), False, 'from pants.build_graph.build_file_aliases import BuildFileAliases\n'), ((1088, 1143), 'pants.base.cmd_line_spec_parser.CmdLineSpecPa... |
import os
import json
from torchblocks.metrics import SequenceLabelingScore
from torchblocks.trainer import SequenceLabelingTrainer
from torchblocks.callback import TrainLogger
from torchblocks.processor import SequenceLabelingProcessor, InputExample
from torchblocks.utils import seed_everything, dict_to_text, bu... | [
"os.path.exists",
"torchblocks.data.Vocabulary",
"torchblocks.metrics.SequenceLabelingScore",
"os.makedirs",
"torchblocks.utils.dict_to_text",
"os.path.join",
"torchblocks.callback.TrainLogger",
"torchblocks.utils.seed_everything",
"torchblocks.utils.get_checkpoints",
"torchblocks.processor.InputE... | [((808, 820), 'torchblocks.data.Vocabulary', 'Vocabulary', ([], {}), '()\n', (818, 820), False, 'from torchblocks.data import Vocabulary, VOCAB_NAME\n'), ((839, 874), 'os.path.join', 'os.path.join', (['vocab_dir', 'VOCAB_NAME'], {}), '(vocab_dir, VOCAB_NAME)\n', (851, 874), False, 'import os\n'), ((883, 909), 'os.path.... |
# -*- coding: utf-8 -*-
"""
Created on Wed Nov 20 01:33:18 2019
@author: iqbalsublime
"""
from Customer import Customer
from Restaurent import Restaurent
from Reserve import Reserve
from Menu import Menu
from Order import Order
cust1= Customer(1,"Iqbal", "0167****671")
rest1= Restaurent(1,"Farmgate", "102 Kazi Naz... | [
"Customer.Customer",
"Order.Order",
"Menu.Menu",
"Reserve.Reserve",
"Restaurent.Restaurent"
] | [((240, 275), 'Customer.Customer', 'Customer', (['(1)', '"""Iqbal"""', '"""0167****671"""'], {}), "(1, 'Iqbal', '0167****671')\n", (248, 275), False, 'from Customer import Customer\n'), ((282, 343), 'Restaurent.Restaurent', 'Restaurent', (['(1)', '"""Farmgate"""', '"""102 Kazi Nazrul Islam Ave, Dhaka"""'], {}), "(1, 'F... |
# -*- test-case-name: twisted.logger.test.test_io -*-
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
File-like object that logs.
"""
import sys
from typing import AnyStr, Iterable, Optional
from constantly import NamedConstant
from incremental import Version
from twisted.python.deprecat... | [
"sys.getdefaultencoding",
"incremental.Version"
] | [((838, 866), 'incremental.Version', 'Version', (['"""Twisted"""', '(21)', '(2)', '(0)'], {}), "('Twisted', 21, 2, 0)\n", (845, 866), False, 'from incremental import Version\n'), ((1581, 1605), 'sys.getdefaultencoding', 'sys.getdefaultencoding', ([], {}), '()\n', (1603, 1605), False, 'import sys\n')] |
from dataclasses import dataclass
# from pprint import pprint
import aiohttp
import discord
from discord.ext import commands
from bot import constants
API_URL = "https://livescore6.p.rapidapi.com/matches/v2/"
LIVE_MATCHES_URL = API_URL + "list-live"
HEADERS = {
"x-rapidapi-key": constants.RAPIDAPI_KEY,
"x-r... | [
"aiohttp.ClientSession",
"discord.ext.commands.command",
"discord.Colour.random"
] | [((1400, 1418), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (1416, 1418), False, 'from discord.ext import commands\n'), ((1612, 1635), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {}), '()\n', (1633, 1635), False, 'import aiohttp\n'), ((798, 821), 'discord.Colour.random', 'discord.Co... |
import os
import os.path
from datetime import datetime
import time
from stat import *
import pathlib
import json
def generateFileManifest(filename, manifest_filename=None):
string = ""
data = {}
if os.path.isfile(filename):
f = pathlib.Path(filename)
data[os.path.abspath(filename)] = {
... | [
"os.path.isfile",
"json.dumps",
"os.path.abspath",
"pathlib.Path"
] | [((212, 236), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (226, 236), False, 'import os\n'), ((250, 272), 'pathlib.Path', 'pathlib.Path', (['filename'], {}), '(filename)\n', (262, 272), False, 'import pathlib\n'), ((565, 581), 'json.dumps', 'json.dumps', (['data'], {}), '(data)\n', (575, 581... |
import unittest
import os
from six import StringIO
from package_manager import util
CHECKSUM_TXT = "1915adb697103d42655711e7b00a7dbe398a33d7719d6370c01001273010d069"
DEBIAN_JESSIE_OS_RELEASE = """PRETTY_NAME="Distroless"
NAME="Debian GNU/Linux"
ID="debian"
VERSION_ID="8"
VERSION="Debian GNU/Linux 8 (jessie)"
HOME_UR... | [
"os.path.join",
"package_manager.util.sha256_checksum",
"os.path.dirname",
"package_manager.util.generate_os_release",
"six.StringIO",
"unittest.main"
] | [((2461, 2476), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2474, 2476), False, 'import unittest\n'), ((1955, 1980), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1970, 1980), False, 'import os\n'), ((2000, 2053), 'os.path.join', 'os.path.join', (['current_dir', '"""testdata"""', '... |
# Generated by Django 2.2.1 on 2022-02-25 15:50
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('mutational_landscape', '0002_auto_20180117_1457'),
]
operations = [
migrations.RemoveField(
model_name='diseasemutations',
n... | [
"django.db.migrations.DeleteModel",
"django.db.migrations.RemoveField"
] | [((240, 309), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""diseasemutations"""', 'name': '"""protein"""'}), "(model_name='diseasemutations', name='protein')\n", (262, 309), False, 'from django.db import migrations\n'), ((354, 423), 'django.db.migrations.RemoveField', 'migrations... |
# Apache License Version 2.0
#
# Copyright (c) 2021., Redis Labs
# All rights reserved.
#
# This attribute is the only one place that the version number is written down,
# so there is only one place to change it when the version number changes.
import pkg_resources
PKG_NAME = "redis-benchmarks-specification"
try:
... | [
"pkg_resources.get_distribution"
] | [((338, 378), 'pkg_resources.get_distribution', 'pkg_resources.get_distribution', (['PKG_NAME'], {}), '(PKG_NAME)\n', (368, 378), False, 'import pkg_resources\n')] |
import requests
from utils import loginFile, dataAnalysis
import os
import datetime
from dateutil.relativedelta import relativedelta
import json
from utils.logCls import Logger
dirpath = os.path.dirname(__file__)
cookieFile = f"{dirpath}/utils/cookies.txt"
dataFile = f"{dirpath}/datas"
class DevopsProject:
def... | [
"os.path.exists",
"dateutil.relativedelta.relativedelta",
"utils.dataAnalysis.sendMessage",
"utils.dataAnalysis.dataSummary",
"requests.get",
"os.path.dirname",
"datetime.datetime.now",
"utils.dataAnalysis.parseData",
"utils.loginFile.loginDevops",
"utils.dataAnalysis.data2html",
"utils.dataAnal... | [((188, 213), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (203, 213), False, 'import os\n'), ((2102, 2141), 'requests.get', 'requests.get', (['checkUrl'], {'headers': 'headers'}), '(checkUrl, headers=headers)\n', (2114, 2141), False, 'import requests\n'), ((6279, 6314), 'utils.dataAnalysis... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# Copyright (c) 2018 - huwei <<EMAIL>>
"""
This is a python script for the ezalor tools which is used to io monitor.
You can use the script to open or off the switch, or point the package name which you want to monitor it only.
The core function is to export data what ezalor... | [
"record.Record",
"markhelper.MarkHelper.get_io_mark",
"getopt.getopt",
"datetime.datetime.fromtimestamp",
"sqlite3.connect",
"subprocess.getstatusoutput",
"style.Style",
"datetime.datetime.now",
"sys.exit",
"os.system",
"re.findall",
"xlsxwriter.Workbook",
"os.remove"
] | [((1644, 1655), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1652, 1655), False, 'import sys, getopt\n'), ((1982, 1999), 'xlsxwriter.Workbook', 'xw.Workbook', (['path'], {}), '(path)\n', (1993, 1999), True, 'import xlsxwriter as xw\n'), ((2024, 2039), 'style.Style', 'Style', (['workbook'], {}), '(workbook)\n', (202... |
import pytest
from moto import mock_ec2
from moto.ec2.models import AMIS
from aec.command.ami import delete, describe, share
@pytest.fixture
def mock_aws_config():
mock = mock_ec2()
mock.start()
return {
"region": "ap-southeast-2",
}
def test_describe_images(mock_aws_config):
# describ... | [
"moto.mock_ec2",
"aec.command.ami.describe",
"aec.command.ami.delete",
"aec.command.ami.share"
] | [((178, 188), 'moto.mock_ec2', 'mock_ec2', ([], {}), '()\n', (186, 188), False, 'from moto import mock_ec2\n'), ((551, 583), 'aec.command.ami.describe', 'describe', ([], {'config': 'mock_aws_config'}), '(config=mock_aws_config)\n', (559, 583), False, 'from aec.command.ami import delete, describe, share\n'), ((1109, 116... |
import torch
from lib.utils import is_parallel
import numpy as np
np.set_printoptions(threshold=np.inf)
import cv2
from sklearn.cluster import DBSCAN
def build_targets(cfg, predictions, targets, model, bdd=True):
'''
predictions
[16, 3, 32, 32, 85]
[16, 3, 16, 16, 85]
[16, 3, 8, 8, 85]
torch.t... | [
"lib.utils.is_parallel",
"numpy.polyfit",
"torch.max",
"numpy.array",
"torch.arange",
"numpy.mean",
"numpy.asarray",
"numpy.linspace",
"numpy.polyval",
"torch.zeros_like",
"torch.ones_like",
"cv2.polylines",
"cv2.morphologyEx",
"cv2.cvtColor",
"torch.cat",
"numpy.set_printoptions",
"... | [((66, 103), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'threshold': 'np.inf'}), '(threshold=np.inf)\n', (85, 103), True, 'import numpy as np\n'), ((1059, 1095), 'torch.ones', 'torch.ones', (['(7)'], {'device': 'targets.device'}), '(7, device=targets.device)\n', (1069, 1095), False, 'import torch\n'), ((361... |
from django.views.generic import View
from django.http import HttpResponse
from django.shortcuts import render
def index(request):
return render(request, 'treasurehunt/treasurehunt_index.html') | [
"django.shortcuts.render"
] | [((143, 198), 'django.shortcuts.render', 'render', (['request', '"""treasurehunt/treasurehunt_index.html"""'], {}), "(request, 'treasurehunt/treasurehunt_index.html')\n", (149, 198), False, 'from django.shortcuts import render\n')] |
# Copyright 2022 @ReneFreingruber
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"mutators.testcase_mutators_helpers.get_proto_change_rhs",
"tagging_engine.tagging.add_tag",
"mutators.testcase_mutators_helpers.get_random_line_number_to_insert_code",
"mutators.testcase_mutators_helpers.get_proto_change_lhs",
"mutators.testcase_mutators_helpers.get_start_and_end_line_symbols"
] | [((849, 892), 'tagging_engine.tagging.add_tag', 'tagging.add_tag', (['Tag.MUTATION_CHANGE_PROTO1'], {}), '(Tag.MUTATION_CHANGE_PROTO1)\n', (864, 892), True, 'import tagging_engine.tagging as tagging\n'), ((1168, 1238), 'mutators.testcase_mutators_helpers.get_random_line_number_to_insert_code', 'testcase_mutators_helper... |
"""
ckwg +31
Copyright 2016 by Kitware, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the ... | [
"vital.types.eigen.EigenArray.from_iterable",
"numpy.allclose",
"vital.types.eigen.EigenArray.c_ptr_type",
"vital.types.eigen.EigenArray",
"vital.util.VitalErrorHandle"
] | [((3614, 3676), 'vital.types.eigen.EigenArray.from_iterable', 'EigenArray.from_iterable', (['principle_point'], {'target_shape': '(2, 1)'}), '(principle_point, target_shape=(2, 1))\n', (3638, 3676), False, 'from vital.types.eigen import EigenArray\n'), ((4645, 4689), 'vital.types.eigen.EigenArray.c_ptr_type', 'EigenArr... |
import numpy as np
import util.data
def ndcg(X_test, y_test, y_pred, ):
Xy_pred = X_test.copy([['srch_id', 'prop_id', 'score']])
Xy_pred['score_pred'] = y_pred
Xy_pred['score'] = y_test
Xy_pred.sort_values(['srch_id', 'score_pred'], ascending=[True, False])
dcg_test = DCG_dict(Xy_pred)
ndcg = ... | [
"numpy.asfarray",
"numpy.arange"
] | [((683, 697), 'numpy.asfarray', 'np.asfarray', (['r'], {}), '(r)\n', (694, 697), True, 'import numpy as np\n'), ((790, 814), 'numpy.arange', 'np.arange', (['(2)', '(r.size + 1)'], {}), '(2, r.size + 1)\n', (799, 814), True, 'import numpy as np\n'), ((881, 905), 'numpy.arange', 'np.arange', (['(2)', '(r.size + 2)'], {})... |
# Copyright 2014 Intel Corp.
#
# 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, soft... | [
"heat.objects.resource_data.ResourceData",
"oslo_versionedobjects.fields.ListOfObjectsField",
"heat.db.api.resource_delete",
"heat.db.api.resource_purge_deleted",
"heat.db.api.resource_get_all_by_stack",
"oslo_serialization.jsonutils.dumps",
"heat.objects.fields.JsonField",
"heat.db.api.resource_get",... | [((1033, 1111), 'oslo_config.cfg.CONF.import_opt', 'cfg.CONF.import_opt', (['"""encrypt_parameters_and_properties"""', '"""heat.common.config"""'], {}), "('encrypt_parameters_and_properties', 'heat.common.config')\n", (1052, 1111), False, 'from oslo_config import cfg\n'), ((1245, 1365), 'retrying.retry', 'retrying.retr... |
import struct
from six import binary_type
from capnpy import ptr
from capnpy.packing import mychr
from capnpy.printer import print_buffer
class SegmentBuilder(object):
def __init__(self, length=None):
self.buf = bytearray()
def get_length(self):
return len(self.buf)
def as_string(self):... | [
"capnpy.segment._copy_pointer.copy_pointer",
"capnpy.segment._copy_list.copy_from_list",
"capnpy.ptr.new_struct",
"capnpy.ptr.new_list",
"six.binary_type",
"capnpy.segment._copy_pointer._copy_struct_inline",
"struct.pack_into",
"capnpy.ptr.round_up_to_word",
"capnpy.packing.mychr",
"struct.unpack_... | [((336, 357), 'six.binary_type', 'binary_type', (['self.buf'], {}), '(self.buf)\n', (347, 357), False, 'from six import binary_type\n'), ((569, 610), 'struct.pack_into', 'struct.pack_into', (['"""b"""', 'self.buf', 'i', 'value'], {}), "('b', self.buf, i, value)\n", (585, 610), False, 'import struct\n'), ((657, 698), 's... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-05-14 07:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('test_app', '0001_initial'),
]
operations = [
migrations.AddField(
... | [
"django.db.models.TextField",
"django.db.models.IntegerField"
] | [((389, 417), 'django.db.models.TextField', 'models.TextField', ([], {'default': '""""""'}), "(default='')\n", (405, 417), False, 'from django.db import migrations, models\n'), ((534, 565), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(22)'}), '(default=22)\n', (553, 565), False, 'from djan... |
import unittest.mock as mock
from app import utils
@mock.patch("app.utils.get_current_timestamp")
def test_generate_filename_generates_formatted_timestamp(mock_timestamp):
mock_timestamp.return_value = 1_555_555_555.555_555
filename = utils.generate_filename()
assert mock_timestamp.called is True
a... | [
"app.utils.generate_filename",
"unittest.mock.patch"
] | [((55, 100), 'unittest.mock.patch', 'mock.patch', (['"""app.utils.get_current_timestamp"""'], {}), "('app.utils.get_current_timestamp')\n", (65, 100), True, 'import unittest.mock as mock\n'), ((247, 272), 'app.utils.generate_filename', 'utils.generate_filename', ([], {}), '()\n', (270, 272), False, 'from app import uti... |
# coding=utf-8
# Copyright 2020 The TensorFlow Datasets 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 appl... | [
"csv.DictReader",
"tensorflow_datasets.public_api.features.Text",
"os.path.join",
"tensorflow_datasets.public_api.core.Version",
"tensorflow.compat.v2.io.gfile.GFile"
] | [((3341, 3367), 'tensorflow_datasets.public_api.core.Version', 'tfds.core.Version', (['"""0.2.0"""'], {}), "('0.2.0')\n", (3358, 3367), True, 'import tensorflow_datasets.public_api as tfds\n'), ((4911, 4938), 'tensorflow.compat.v2.io.gfile.GFile', 'tf.io.gfile.GFile', (['filename'], {}), '(filename)\n', (4928, 4938), T... |
import os
from functools import partial
from django.conf.urls.i18n import i18n_patterns
from django.urls import include, path, re_path
from django.utils.translation import gettext_lazy as _
from django.views import defaults, i18n, static
from . import views
base_dir = os.path.dirname(os.path.abspath(__file__))
media... | [
"django.urls.include",
"django.utils.translation.gettext_lazy",
"os.path.join",
"django.views.i18n.JSONCatalog.as_view",
"django.views.i18n.JavaScriptCatalog.as_view",
"functools.partial",
"os.path.abspath",
"django.urls.re_path",
"django.urls.path"
] | [((327, 358), 'os.path.join', 'os.path.join', (['base_dir', '"""media"""'], {}), "(base_dir, 'media')\n", (339, 358), False, 'import os\n'), ((372, 404), 'os.path.join', 'os.path.join', (['base_dir', '"""locale"""'], {}), "(base_dir, 'locale')\n", (384, 404), False, 'import os\n'), ((288, 313), 'os.path.abspath', 'os.p... |
import sys
import os
import tempfile
from pathlib import Path
import pytest
sys.path.insert(1, os.path.join(sys.path[0], "../../"))
import rips
import dataroot
@pytest.mark.skipif(
sys.platform.startswith("linux"),
reason="Brugge is currently exceptionally slow on Linux",
)
def test_create_and_export_surfac... | [
"tempfile.TemporaryDirectory",
"os.path.join",
"sys.platform.startswith",
"pathlib.Path"
] | [((96, 131), 'os.path.join', 'os.path.join', (['sys.path[0]', '"""../../"""'], {}), "(sys.path[0], '../../')\n", (108, 131), False, 'import os\n'), ((189, 221), 'sys.platform.startswith', 'sys.platform.startswith', (['"""linux"""'], {}), "('linux')\n", (212, 221), False, 'import sys\n'), ((701, 743), 'tempfile.Temporar... |
"""
Entry point for the CLI
"""
import logging
import click
from samcli import __version__
from .options import debug_option
from .context import Context
from .command import BaseCommand
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%Y-%m-%d %... | [
"logging.getLogger",
"logging.basicConfig",
"click.make_pass_decorator",
"click.version_option",
"click.command"
] | [((199, 226), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (216, 226), False, 'import logging\n'), ((227, 333), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(asctime)s %(message)s"""', 'datefmt': '"""%Y-%m-%d %H:%M:%S"""'}), "(level=logging... |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2020/3/4 0004 2:09
# @Author : Gpp
# @File : obtain_url.py
from app.web import api
from flask_restful import Resource
from flask import make_response, send_from_directory, jsonify
from app.helper.encrypt import two_encrypting
from app.crud.proxy_crud i... | [
"flask.send_from_directory",
"app.crud.proxy_crud.ProtocolCrud.get_all_share",
"app.web.api.resource",
"app.helper.get_one_encrypt.get_one_encrypt_data"
] | [((735, 780), 'app.web.api.resource', 'api.resource', (['"""/generate/<proxy_information>"""'], {}), "('/generate/<proxy_information>')\n", (747, 780), False, 'from app.web import api\n'), ((879, 907), 'app.crud.proxy_crud.ProtocolCrud.get_all_share', 'ProtocolCrud.get_all_share', ([], {}), '()\n', (905, 907), False, '... |
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.contrib.auth import login
from django.shortcuts import redirect, get_object_or_404
from django.contrib.auth.decorators import login_required
from Aluno.views.utils import aluno_exist
from annoying.decorators import render_to
from django.contrib... | [
"annoying.decorators.render_to"
] | [((405, 439), 'annoying.decorators.render_to', 'render_to', (['"""avaliacao/exibir.html"""'], {}), "('avaliacao/exibir.html')\n", (414, 439), False, 'from annoying.decorators import render_to\n')] |
from __future__ import division
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.ticker as mticker
import gsd
import gsd.fl
import numpy as np
import os
import sys
import datetime
import time
import pickle
from shutil import copyfile
import inspect
import md_tools... | [
"numpy.sqrt",
"numpy.log",
"matplotlib.ticker.ScalarFormatter",
"matplotlib.rc",
"os.walk",
"numpy.mean",
"md_tools27.correct_jumps",
"numpy.where",
"matplotlib.pyplot.close",
"numpy.dot",
"os.path.isdir",
"numpy.linalg.lstsq",
"numpy.ones",
"matplotlib.use",
"pickle.load",
"inspect.cu... | [((59, 73), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (66, 73), True, 'import matplotlib as mpl\n'), ((880, 949), 'matplotlib.rc', 'rc', (['"""font"""'], {}), "('font', **{'family': 'serif', 'serif': ['Computer Modern Roman']})\n", (882, 949), False, 'from matplotlib import rc\n'), ((947, 970), 'ma... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
from conans.errors import ConanException
import os
import shutil
def sort_libs(correct_order, libs, lib_suffix='', reverse_result=False):
# Add suffix for correct string matching
correct_order[:] = [s.__add__(lib_suffix)... | [
"conans.tools.collect_libs",
"conans.CMake",
"os.path.join",
"shutil.move"
] | [((2766, 2821), 'shutil.move', 'shutil.move', (['"""CMakeLists.txt"""', '"""CMakeListsOriginal.txt"""'], {}), "('CMakeLists.txt', 'CMakeListsOriginal.txt')\n", (2777, 2821), False, 'import shutil\n'), ((2961, 2972), 'conans.CMake', 'CMake', (['self'], {}), '(self)\n', (2966, 2972), False, 'from conans import ConanFile,... |
import pytest
from fastjsonschema import JsonSchemaException
exc = JsonSchemaException('data must be null', value='{data}', name='data', definition='{definition}', rule='type')
@pytest.mark.parametrize('value, expected', [
(0, exc),
(None, None),
(True, exc),
('abc', exc),
([], exc),
({}, exc... | [
"pytest.mark.parametrize",
"fastjsonschema.JsonSchemaException"
] | [((70, 183), 'fastjsonschema.JsonSchemaException', 'JsonSchemaException', (['"""data must be null"""'], {'value': '"""{data}"""', 'name': '"""data"""', 'definition': '"""{definition}"""', 'rule': '"""type"""'}), "('data must be null', value='{data}', name='data',\n definition='{definition}', rule='type')\n", (89, 18... |
import boto3
import json
def init(ACCESS_KEY, SECRET_KEY):
return boto3.client(service_name='comprehend', region_name="us-west-2", aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY)
def get_entities(client, title):
return client.detect_entities(Text=title, LanguageCode='en').get('Entitie... | [
"boto3.client"
] | [((77, 209), 'boto3.client', 'boto3.client', ([], {'service_name': '"""comprehend"""', 'region_name': '"""us-west-2"""', 'aws_access_key_id': 'ACCESS_KEY', 'aws_secret_access_key': 'SECRET_KEY'}), "(service_name='comprehend', region_name='us-west-2',\n aws_access_key_id=ACCESS_KEY, aws_secret_access_key=SECRET_KEY)\... |
import discord
from discord.ext import commands
from discord import Embed, Permissions
from Util import logger
import os
import database
# Import the config
try:
import config
except ImportError:
print("Couldn't import config.py! Exiting!")
exit()
# Import a monkey patch, if that exists
try:
import mo... | [
"database.getBans",
"Util.logger.logDebug",
"discord.PermissionOverwrite",
"os.getenv",
"discord.Game",
"database.newBan",
"Util.logger.setup_logger",
"Util.logger.log",
"database.isBanned",
"discord.Color.red"
] | [((3055, 3120), 'Util.logger.logDebug', 'logger.logDebug', (['"""----------[LOGIN SUCESSFULL]----------"""', '"""INFO"""'], {}), "('----------[LOGIN SUCESSFULL]----------', 'INFO')\n", (3070, 3120), False, 'from Util import logger\n'), ((3125, 3183), 'Util.logger.logDebug', 'logger.logDebug', (["(' Username: ' + bo... |
from django.conf.urls import url
from django.conf.urls.i18n import i18n_patterns
from django.utils.translation import gettext_lazy as _
from django.views.generic import TemplateView
view = TemplateView.as_view(template_name='dummy.html')
app_name = 'account'
urlpatterns = i18n_patterns(
url(_(r'^register... | [
"django.views.generic.TemplateView.as_view",
"django.utils.translation.gettext_lazy"
] | [((195, 243), 'django.views.generic.TemplateView.as_view', 'TemplateView.as_view', ([], {'template_name': '"""dummy.html"""'}), "(template_name='dummy.html')\n", (215, 243), False, 'from django.views.generic import TemplateView\n'), ((307, 323), 'django.utils.translation.gettext_lazy', '_', (['"""^register/$"""'], {}),... |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from collections import OrderedDict
from moz_sql_parser import parse as parse_sql
import pyparsing
import re
from six.moves.urllib import parse
FROM_REGEX = re.compile... | [
"six.moves.urllib.parse.parse_qs",
"collections.OrderedDict",
"re.compile",
"six.moves.urllib.parse.urlparse",
"six.moves.urllib.parse.urlunparse",
"six.moves.urllib.parse.urlencode",
"moz_sql_parser.parse"
] | [((310, 356), 're.compile', 're.compile', (['""" from ("http.*?")"""', 're.IGNORECASE'], {}), '(\' from ("http.*?")\', re.IGNORECASE)\n', (320, 356), False, 'import re\n'), ((420, 439), 'six.moves.urllib.parse.urlparse', 'parse.urlparse', (['url'], {}), '(url)\n', (434, 439), False, 'from six.moves.urllib import parse\... |
# -*- coding:utf-8 -*-
# Bot2Human
#
# Replaces messages from bots to humans
# typically used in channels that are connected with other IMs using bots
#
# For example, if a bot send messages from XMPP is like `[nick] content`,
# weechat would show `bot | [nick] content` which looks bad; this script
# make weecaht displ... | [
"weechat.config_get_plugin",
"weechat.hook_config",
"weechat.info_get",
"weechat.config_is_set_plugin",
"weechat.register",
"weechat.config_set_plugin",
"weechat.info_get_hashtable",
"weechat.hook_modifier",
"weechat.nicklist_search_nick",
"weechat.nicklist_add_nick",
"re.sub",
"weechat.nickli... | [((2810, 2855), 're.sub', 're.sub', (['"""\\\\x03[\\\\d,]+|[\\\\x00-\\\\x1f]"""', '""""""', 'msg'], {}), "('\\\\x03[\\\\d,]+|[\\\\x00-\\\\x1f]', '', msg)\n", (2816, 2855), False, 'import re\n'), ((2964, 3026), 'weechat.info_get_hashtable', 'w.info_get_hashtable', (['"""irc_message_parse"""', "{'message': string}"], {})... |
import xlrd
import pandas as pd
from openpyxl import load_workbook
from xlrd import open_workbook
import nltk
from nltk.tree import Tree
from nltk.parse.generate import generate
from nltk.tree import *
import os
from nltk.tokenize import word_tokenize
from nltk.tokenize import sent_tokenize
import xml.etree.... | [
"nltk.PCFG.fromstring",
"sys.setrecursionlimit",
"nltk.ViterbiParser",
"nltk.tokenize.word_tokenize"
] | [((547, 574), 'sys.setrecursionlimit', 'sys.setrecursionlimit', (['(5000)'], {}), '(5000)\n', (568, 574), False, 'import sys\n'), ((696, 714), 'nltk.tokenize.word_tokenize', 'word_tokenize', (['sen'], {}), '(sen)\n', (709, 714), False, 'from nltk.tokenize import word_tokenize\n'), ((9894, 9920), 'nltk.PCFG.fromstring',... |
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import string
import unittest
from uuid import uuid4
from unittest import mock
from random import random, randint
from datetime import datetime, timedelta
pkg_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) # noqa
sys.path.insert(0, pkg... | [
"dss.util.version.datetime_to_version_format",
"sys.path.insert",
"dss.logging.configure_test_logging",
"datetime.datetime.utcnow",
"dss.storage.identifiers.UUID_REGEX.match",
"dss.storage.bundles.get_tombstoned_bundles",
"tests.infra.MockStorageHandler",
"uuid.uuid4",
"os.path.dirname",
"dss.Conf... | [((298, 326), 'sys.path.insert', 'sys.path.insert', (['(0)', 'pkg_root'], {}), '(0, pkg_root)\n', (313, 326), False, 'import sys\n'), ((2450, 2474), 'dss.logging.configure_test_logging', 'configure_test_logging', ([], {}), '()\n', (2472, 2474), False, 'from dss.logging import configure_test_logging\n'), ((3073, 3118), ... |
#!/usr/bin/env python
# coding: utf-8
# BEGIN --- required only for testing, remove in real world code --- BEGIN
import os
import sys
THISDIR = os.path.dirname(os.path.abspath(__file__))
APPDIR = os.path.abspath(os.path.join(THISDIR, os.path.pardir, os.path.pardir))
sys.path.insert(0, APPDIR)
# END --- required only f... | [
"os.path.abspath",
"sys.path.insert",
"os.path.join"
] | [((268, 294), 'sys.path.insert', 'sys.path.insert', (['(0)', 'APPDIR'], {}), '(0, APPDIR)\n', (283, 294), False, 'import sys\n'), ((161, 186), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (176, 186), False, 'import os\n'), ((213, 266), 'os.path.join', 'os.path.join', (['THISDIR', 'os.path.p... |
# Copyright (c) 2021 NVIDIA Corporation. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"logging.basicConfig",
"argparse.ArgumentParser",
"json.dumps",
"logging.info",
"google.cloud.pubsub_v1.PublisherClient",
"sys.exit",
"warnings.simplefilter",
"tritonclient.grpc.InferenceServerClient",
"cudf.read_parquet",
"tritonclient.grpc.InferRequestedOutput"
] | [((1240, 1267), 'google.cloud.pubsub_v1.PublisherClient', 'pubsub_v1.PublisherClient', ([], {}), '()\n', (1265, 1267), False, 'from google.cloud import pubsub_v1\n'), ((1965, 1990), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1988, 1990), False, 'import argparse\n'), ((4047, 4155), 'logging... |
"""
throughput dialog
"""
import tkinter as tk
from tkinter import ttk
from typing import TYPE_CHECKING
from core.gui.dialogs.colorpicker import ColorPickerDialog
from core.gui.dialogs.dialog import Dialog
from core.gui.themes import FRAME_PAD, PADX, PADY
if TYPE_CHECKING:
from core.gui.app import Application
c... | [
"tkinter.IntVar",
"tkinter.ttk.Checkbutton",
"tkinter.ttk.Button",
"tkinter.ttk.Scale",
"tkinter.ttk.Entry",
"tkinter.ttk.Frame",
"tkinter.ttk.Label",
"tkinter.Button",
"tkinter.ttk.LabelFrame",
"tkinter.DoubleVar",
"core.gui.dialogs.colorpicker.ColorPickerDialog"
] | [((577, 595), 'tkinter.IntVar', 'tk.IntVar', ([], {'value': '(1)'}), '(value=1)\n', (586, 595), True, 'import tkinter as tk\n'), ((630, 648), 'tkinter.IntVar', 'tk.IntVar', ([], {'value': '(1)'}), '(value=1)\n', (639, 648), True, 'import tkinter as tk\n'), ((677, 695), 'tkinter.IntVar', 'tk.IntVar', ([], {'value': '(1)... |
class Human():
def __init__(self, name="Human"):
self.name = name
def action(self, game):
safe_input = False
while not safe_input:
pos = input("choose a position: ")
if pos == "draw":
game.draw()
elif pos == "exit":
imp... | [
"sys.exit"
] | [((344, 354), 'sys.exit', 'sys.exit', ([], {}), '()\n', (352, 354), False, 'import sys\n')] |
#!/usr/bin/env python3
import matplotlib
matplotlib.use('pgf')
import matplotlib.pyplot as plt
import numpy as np
from multi_isotope_calculator import Multi_isotope
import plotsettings as ps
plt.style.use('seaborn-darkgrid')
plt.rcParams.update(ps.tex_fonts())
def main():
plot()
#figure5()
def figure1():
... | [
"plotsettings.set_size",
"matplotlib.pyplot.savefig",
"matplotlib.use",
"multi_isotope_calculator.Multi_isotope",
"plotsettings.tex_fonts",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.close",
"matplotlib.pyplot.rcParams.update",
"numpy.argsort",
"numpy.empty",
"matplotlib.pyplot.tight_layo... | [((42, 63), 'matplotlib.use', 'matplotlib.use', (['"""pgf"""'], {}), "('pgf')\n", (56, 63), False, 'import matplotlib\n'), ((194, 227), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""seaborn-darkgrid"""'], {}), "('seaborn-darkgrid')\n", (207, 227), True, 'import matplotlib.pyplot as plt\n'), ((248, 262), 'plotse... |
import boto3
client = boto3.client('rds')
def lambda_handler(event, context):
target_db_cluster_identifier=event['TargetDBClusterIdentifier']
payload = event.copy()
try:
response = client.describe_db_clusters(DBClusterIdentifier=target_db_cluster_identifier)
payload... | [
"boto3.client"
] | [((23, 42), 'boto3.client', 'boto3.client', (['"""rds"""'], {}), "('rds')\n", (35, 42), False, 'import boto3\n')] |
import wx
from wx.lib.agw.floatspin import FloatSpin
from shs.input.fdf_options import ChoiceLine, MeasuredLine, NumberLine, ThreeNumberLine
try:
from geom import Geom
except ImportError:
from shs.geom import Geom
class Bravais(ChoiceLine):
label = 'Composition'
choices = ['BCC', 'FCC', 'SC']
o... | [
"wx.Button",
"wx.lib.agw.floatspin.FloatSpin",
"wx.Dialog.__init__",
"wx.BoxSizer",
"wx.StaticBoxSizer",
"wx.TextCtrl",
"wx.StaticText",
"shs.geom.Geom",
"wx.StaticBox"
] | [((883, 922), 'wx.Dialog.__init__', 'wx.Dialog.__init__', (['self', '*args'], {}), '(self, *args, **kwds)\n', (901, 922), False, 'import wx\n'), ((1692, 1729), 'wx.StaticBox', 'wx.StaticBox', (['self', '(-1)', '"""Composition"""'], {}), "(self, -1, 'Composition')\n", (1704, 1729), False, 'import wx\n'), ((1751, 1795), ... |
#!/usr/bin/env python3
import datetime
import time
import os
import matplotlib.pyplot as plt
import matplotlib.dates as md
import numpy as np
class handle_data:
data_file = "./data/data.log"
data_list = []
def __init__(self):
pass
def insert_data(self, timestamp, temp, state_onoff, state_light, state_cool... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.close",
"datetime.datetime.now",
"numpy.genfromtxt",
"matplotlib.pyplot.subplots"
] | [((1935, 2190), 'numpy.genfromtxt', 'np.genfromtxt', (['self.data_file'], {'delimiter': '""";"""', 'skip_header': '(1)', 'names': "['Time', 'Temp', 'Onoff', 'Light', 'Cooling', 'Heating']", 'dtype': "[('Time', '<U30'), ('Temp', '<f8'), ('Onoff', '<f8'), ('Light', '<f8'), (\n 'Cooling', '<f8'), ('Heating', '<f8')]"})... |
# Created by <NAME> on 2021/6/6, 21:08
from turtle import Turtle
import turtle
def draw_rectangle(turtle: Turtle, llx, lly, width, height):
turtle.up()
turtle.goto(llx, lly)
turtle.begin_fill()
turtle.down()
turtle.goto(llx + width, lly)
turtle.goto(llx + width, lly + height)
turtle.goto(... | [
"turtle.begin_fill",
"turtle.down",
"turtle.Screen",
"turtle.goto",
"turtle.up",
"turtle.end_fill",
"turtle.Turtle"
] | [((147, 158), 'turtle.up', 'turtle.up', ([], {}), '()\n', (156, 158), False, 'import turtle\n'), ((163, 184), 'turtle.goto', 'turtle.goto', (['llx', 'lly'], {}), '(llx, lly)\n', (174, 184), False, 'import turtle\n'), ((189, 208), 'turtle.begin_fill', 'turtle.begin_fill', ([], {}), '()\n', (206, 208), False, 'import tur... |
from pythonneat.neat.Species import Species
import pythonneat.neat.Speciation as Speciation
import pythonneat.neat.utils.Parameters as Parameters
current_genomes = []
def add_genome(genome):
"""Adds genome to the species list based on its
compatability distance to already existing species
Inputs:
ge... | [
"pythonneat.neat.Speciation.compatibility_distance",
"pythonneat.neat.Species.Species"
] | [((602, 611), 'pythonneat.neat.Species.Species', 'Species', ([], {}), '()\n', (609, 611), False, 'from pythonneat.neat.Species import Species\n'), ((450, 498), 'pythonneat.neat.Speciation.compatibility_distance', 'Speciation.compatibility_distance', (['genome', 'first'], {}), '(genome, first)\n', (483, 498), True, 'imp... |
"""
This is a simple application for sentence embeddings: clustering
Sentences are mapped to sentence embeddings and then agglomerative clustering with a threshold is applied.
"""
from sentence_transformers import SentenceTransformer
from sklearn.cluster import AgglomerativeClustering
import numpy as np
embedder = Se... | [
"sklearn.cluster.AgglomerativeClustering",
"sentence_transformers.SentenceTransformer",
"numpy.linalg.norm"
] | [((318, 364), 'sentence_transformers.SentenceTransformer', 'SentenceTransformer', (['"""paraphrase-MiniLM-L6-v2"""'], {}), "('paraphrase-MiniLM-L6-v2')\n", (337, 364), False, 'from sentence_transformers import SentenceTransformer\n'), ((1165, 1229), 'sklearn.cluster.AgglomerativeClustering', 'AgglomerativeClustering', ... |
import pandas as pd
wine = pd.read_csv('https://bit.ly/wine-date')
# wine = pd.read_csv('../data/wine.csv')
print(wine.head())
data = wine[['alcohol', 'sugar', 'pH']].to_numpy()
target = wine['class'].to_numpy()
from sklearn.model_selection import train_test_split
train_input, test_input, train_target, test_target ... | [
"scipy.stats.randint",
"numpy.mean",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.model_selection.cross_validate",
"sklearn.tree.DecisionTreeClassifier",
"scipy.stats.uniform",
"numpy.argmax",
"numpy.max",
"sklearn.model_selection.StratifiedKFold",
"numpy.arange"
] | [((28, 67), 'pandas.read_csv', 'pd.read_csv', (['"""https://bit.ly/wine-date"""'], {}), "('https://bit.ly/wine-date')\n", (39, 67), True, 'import pandas as pd\n'), ((322, 384), 'sklearn.model_selection.train_test_split', 'train_test_split', (['data', 'target'], {'test_size': '(0.2)', 'random_state': '(42)'}), '(data, t... |
# Module to build a potential landscape
import numpy as np
def gauss(x,mean=0.0,stddev=0.02,peak=1.0):
'''
Input:
x : x-coordintes
Output:
f(x) where f is a Gaussian with the given mean, stddev and peak value
'''
stddev = 5*(x[1] - x[0])
return peak*np.exp(-(x-mean)**2/(2*stddev**2))
d... | [
"numpy.exp",
"numpy.zeros",
"numpy.random.rand"
] | [((659, 684), 'numpy.random.rand', 'np.random.rand', (['(n_dot + 1)'], {}), '(n_dot + 1)\n', (673, 684), True, 'import numpy as np\n'), ((747, 758), 'numpy.zeros', 'np.zeros', (['N'], {}), '(N)\n', (755, 758), True, 'import numpy as np\n'), ((283, 327), 'numpy.exp', 'np.exp', (['(-(x - mean) ** 2 / (2 * stddev ** 2))']... |
from sys import stdin
input = stdin.readline
from collections import deque
N, Q = map(int, input().split())
tree = [[] for _ in range(N + 1)]
level = [0] * (N + 1)
for _ in range(N - 1):
a, b = map(int, input().split())
tree[a].append(b)
tree[b].append(a)
visited = [False] * (N + 1)
def bfs(st):
glo... | [
"collections.deque"
] | [((338, 345), 'collections.deque', 'deque', ([], {}), '()\n', (343, 345), False, 'from collections import deque\n')] |
import json
def get_all_pets():
pets = read_from_file()
pets_in_store = []
for k, v in pets.items():
current_pet = {"id": k, **v}
pets_in_store.append(current_pet)
return pets
def remove_pet(id):
pets = read_from_file()
del pets[id]
write_to_file(pets)
def update_pet(i... | [
"json.dumps"
] | [((871, 890), 'json.dumps', 'json.dumps', (['content'], {}), '(content)\n', (881, 890), False, 'import json\n')] |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
# Copyright (C) 2020 Northwestern University.
#
# Invenio-Drafts-Resources is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
# details.
"""Invenio Drafts Resources module to create REST APIs.""... | [
"flask_resources.response_handler",
"flask_resources.resource_requestctx.headers.get",
"invenio_records_resources.resources.records.utils.es_preference",
"flask_resources.JSONSerializer"
] | [((3034, 3061), 'flask_resources.response_handler', 'response_handler', ([], {'many': '(True)'}), '(many=True)\n', (3050, 3061), False, 'from flask_resources import JSONSerializer, ResponseHandler, resource_requestctx, response_handler, route, with_content_negotiation\n'), ((3455, 3482), 'flask_resources.response_handl... |
# Copyright 2020 <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softw... | [
"os.dup2",
"rdkit.Chem.AddHs",
"os.close",
"rdkit.Chem.MolFromSmiles",
"rdkit.Chem.MolToSmiles",
"rdkit.Chem.RemoveHs",
"os.dup",
"os.path.realpath",
"io.StringIO",
"rdkit.Chem.SanitizeMol",
"rdkit.Chem.AllChem.ReactionFromSmarts",
"copy.deepcopy",
"rdkit.Chem.MolFromSmarts",
"rdkit.RDLogg... | [((1597, 1627), 'rdkit.RDLogger.DisableLog', 'RDLogger.DisableLog', (['"""rdApp.*"""'], {}), "('rdApp.*')\n", (1616, 1627), False, 'from rdkit import RDLogger\n'), ((10293, 10308), 'rdkit.Chem.AddHs', 'Chem.AddHs', (['mol'], {}), '(mol)\n', (10303, 10308), False, 'from rdkit import Chem\n'), ((11817, 11921), 'rdkit.Che... |
import threading
from queue import Queue
from blessed import Terminal
FPS = 60
class Game:
"""The top level class for the game"""
def __init__(self, manager_cls: type):
self.manager_cls = manager_cls
def run(self) -> None:
"""The run method for the game, handling the TUI"""
ter... | [
"threading.Thread",
"blessed.Terminal",
"queue.Queue"
] | [((324, 334), 'blessed.Terminal', 'Terminal', ([], {}), '()\n', (332, 334), False, 'from blessed import Terminal\n'), ((357, 364), 'queue.Queue', 'Queue', ([], {}), '()\n', (362, 364), False, 'from queue import Queue\n'), ((445, 477), 'threading.Thread', 'threading.Thread', ([], {'target': 'manager'}), '(target=manager... |
import logging
from main.fileextractors.compressedfile import get_compressed_file
from main.utilities.fileutils import dir_path
from main.utilities.subtitlesadjuster import ArchiveAdjuster
class FileExtractor:
def __init__(self, subname, movfile):
self.sn, self.mn = subname, movfile
self.subzip = ... | [
"logging.getLogger",
"main.fileextractors.compressedfile.get_compressed_file",
"main.utilities.subtitlesadjuster.ArchiveAdjuster",
"main.utilities.fileutils.dir_path"
] | [((320, 348), 'main.fileextractors.compressedfile.get_compressed_file', 'get_compressed_file', (['self.sn'], {}), '(self.sn)\n', (339, 348), False, 'from main.fileextractors.compressedfile import get_compressed_file\n'), ((368, 395), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (385, 39... |
import curses
from get_json import get_json
def body(screen):
div = curses.newwin(curses.LINES - 2, curses.COLS, 1, 0)
div.box() # draw border around container window
# use a sub-window so we don't clobber the the container window's border.
txt = div.subwin(curses.LINES - 5, curses.COLS - 4, 2, 2)
... | [
"curses.doupdate",
"curses.newwin"
] | [((74, 124), 'curses.newwin', 'curses.newwin', (['(curses.LINES - 2)', 'curses.COLS', '(1)', '(0)'], {}), '(curses.LINES - 2, curses.COLS, 1, 0)\n', (87, 124), False, 'import curses\n'), ((438, 455), 'curses.doupdate', 'curses.doupdate', ([], {}), '()\n', (453, 455), False, 'import curses\n')] |
import sys, os, seaborn as sns, rasterio, pandas as pd
import numpy as np
import matplotlib.pyplot as plt
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from config.definitions import ROOT_DIR, ancillary_path, city,year
attr_value ="totalpop"
gtP = ROOT_DIR + "/Evaluation/{0}_groundT... | [
"seaborn.lmplot",
"matplotlib.pyplot.ylabel",
"numpy.where",
"rasterio.open",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"pandas.DataFrame",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylim",
"os.path.abspath",
"matplo... | [((378, 396), 'rasterio.open', 'rasterio.open', (['gtP'], {}), '(gtP)\n', (391, 396), False, 'import sys, os, seaborn as sns, rasterio, pandas as pd\n'), ((789, 806), 'rasterio.open', 'rasterio.open', (['cp'], {}), '(cp)\n', (802, 806), False, 'import sys, os, seaborn as sns, rasterio, pandas as pd\n'), ((1003, 1021), ... |
import numpy as np
import pytest
import nengo
from nengo.builder import Builder
from nengo.builder.operator import Reset, Copy
from nengo.builder.signal import Signal
from nengo.dists import UniformHypersphere
from nengo.exceptions import ValidationError
from nengo.learning_rules import LearningRuleTypeParam, PES, BCM... | [
"nengo.learning_rules.BCM",
"nengo.dists.Uniform",
"nengo.processes.WhiteSignal",
"nengo.Node",
"numpy.array",
"numpy.var",
"numpy.linalg.norm",
"numpy.arange",
"nengo.builder.operator.Copy",
"nengo.builder.operator.Reset",
"nengo.Ensemble",
"numpy.where",
"numpy.asarray",
"nengo.learning_... | [((7196, 7245), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""weights"""', '[False, True]'], {}), "('weights', [False, True])\n", (7219, 7245), False, 'import pytest\n'), ((11392, 11467), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""learning_rule"""', '[nengo.PES, nengo.BCM, nengo.Oja]'], {... |
# coding: utf-8
"""
joplin-web
"""
from django.conf import settings
from django.http.response import JsonResponse
from django.urls import reverse
from joplin_api import JoplinApiSync
from joplin_web.utils import nb_notes_by_tag, nb_notes_by_folder
import logging
from rich import console
console = console.Console()
... | [
"logging.getLogger",
"joplin_api.JoplinApiSync",
"joplin_web.utils.nb_notes_by_tag",
"rich.console.Console",
"joplin_web.utils.nb_notes_by_folder",
"django.http.response.JsonResponse"
] | [((301, 318), 'rich.console.Console', 'console.Console', ([], {}), '()\n', (316, 318), False, 'from rich import console\n'), ((329, 364), 'logging.getLogger', 'logging.getLogger', (['"""joplin_web.app"""'], {}), "('joplin_web.app')\n", (346, 364), False, 'import logging\n'), ((375, 428), 'joplin_api.JoplinApiSync', 'Jo... |
import numpy as np
from django.core.management.base import BaseCommand
from oscar.core.loading import get_classes
StatsSpe, StatsItem, Test, Speciality, Item, Conference = get_classes(
'confs.models',
(
"StatsSpe", "StatsItem", "Test", "Speciality", "Item", "Conference"
)
)
class Command(BaseCo... | [
"numpy.mean",
"numpy.median",
"oscar.core.loading.get_classes",
"numpy.std"
] | [((175, 277), 'oscar.core.loading.get_classes', 'get_classes', (['"""confs.models"""', "('StatsSpe', 'StatsItem', 'Test', 'Speciality', 'Item', 'Conference')"], {}), "('confs.models', ('StatsSpe', 'StatsItem', 'Test', 'Speciality',\n 'Item', 'Conference'))\n", (186, 277), False, 'from oscar.core.loading import get_c... |
from aiohttp import web
from aiohttp import WSMsgType
from Settings import log
class WebSocket(web.View):
async def get(self):
ws = web.WebSocketResponse()
await ws.prepare(self.request)
self.request.app['websockets'].append(ws)
async for msg in ws:
if msg.type == WS... | [
"aiohttp.web.WebSocketResponse"
] | [((147, 170), 'aiohttp.web.WebSocketResponse', 'web.WebSocketResponse', ([], {}), '()\n', (168, 170), False, 'from aiohttp import web\n')] |
import json
import os
def qald(in_folder, out_folder):
train = json.load(open(os.path.join(in_folder, "qald-7-train-en-wikidata.json")))
test = json.load(open(os.path.join(in_folder, "qald-7-test-en-wikidata-withoutanswers.json")))
train_q = []
test_q = []
for qs in train["questions"]:
fo... | [
"os.path.join"
] | [((83, 139), 'os.path.join', 'os.path.join', (['in_folder', '"""qald-7-train-en-wikidata.json"""'], {}), "(in_folder, 'qald-7-train-en-wikidata.json')\n", (95, 139), False, 'import os\n'), ((168, 238), 'os.path.join', 'os.path.join', (['in_folder', '"""qald-7-test-en-wikidata-withoutanswers.json"""'], {}), "(in_folder,... |
""" Test utility functionality."""
import datetime
import decimal
import json
import sys
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
from mock import patch
from ..utils import JSONSerializable, DatetimeDecimalEncoder
class TestJSONSerializable(unittest.TestCase):
""... | [
"json.dumps",
"mock.patch.object",
"datetime.datetime.now",
"datetime.date.today",
"decimal.Decimal"
] | [((1262, 1283), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (1281, 1283), False, 'import datetime\n'), ((1547, 1570), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (1568, 1570), False, 'import datetime\n'), ((1833, 1855), 'decimal.Decimal', 'decimal.Decimal', (['"""0.1"""'], {}... |
from __future__ import annotations
from coredis.response.callbacks import ResponseCallback
from coredis.response.types import LibraryDefinition
from coredis.response.utils import flat_pairs_to_dict
from coredis.typing import Any, AnyStr, Mapping, Union
from coredis.utils import EncodingInsensitiveDict
class Function... | [
"coredis.utils.EncodingInsensitiveDict",
"coredis.response.types.LibraryDefinition",
"coredis.response.utils.flat_pairs_to_dict"
] | [((600, 625), 'coredis.utils.EncodingInsensitiveDict', 'EncodingInsensitiveDict', ([], {}), '()\n', (623, 625), False, 'from coredis.utils import EncodingInsensitiveDict\n'), ((1816, 1844), 'coredis.response.utils.flat_pairs_to_dict', 'flat_pairs_to_dict', (['response'], {}), '(response)\n', (1834, 1844), False, 'from ... |
from models.tilemap import TileMap
class EditorController:
def __init__(self, view):
self.view = view
self.tilemap = TileMap()
def place_tile(self, coord, ttype):
self.tilemap.add_tile(coord, ttype)
self.view.board.update_tiles({coord: ttype})
def place_spawn(self, coor... | [
"models.tilemap.TileMap"
] | [((141, 150), 'models.tilemap.TileMap', 'TileMap', ([], {}), '()\n', (148, 150), False, 'from models.tilemap import TileMap\n')] |
# -*- coding: utf-8 -*-
import pandas as pd
import pytest
from bio_hansel.qc import QC
from bio_hansel.subtype import Subtype
from bio_hansel.subtype_stats import SubtypeCounts
from bio_hansel.subtyper import absent_downstream_subtypes, sorted_subtype_ints, empty_results, \
get_missing_internal_subtypes
from bio_... | [
"pandas.Series",
"bio_hansel.subtyper.empty_results",
"bio_hansel.utils.expand_degenerate_bases",
"bio_hansel.subtyper.sorted_subtype_ints",
"pytest.raises",
"bio_hansel.subtype_stats.SubtypeCounts._check_subtype",
"bio_hansel.subtype.Subtype",
"bio_hansel.utils.find_inconsistent_subtypes",
"bio_han... | [((1417, 1477), 'pandas.Series', 'pd.Series', (["['1', '1.1', '1.1.1', '1.1.1.99', '1.1', '1.1.1']"], {}), "(['1', '1.1', '1.1.1', '1.1.1.99', '1.1', '1.1.1'])\n", (1426, 1477), True, 'import pandas as pd\n'), ((1574, 1817), 'bio_hansel.subtype.Subtype', 'Subtype', ([], {'sample': '"""test"""', 'file_path': '"""tests/d... |
import gzip
import json
import pickle
from collections import defaultdict
from pathlib import Path
from zipfile import ZipFile
from tqdm import tqdm
from capreolus import ConfigOption, Dependency, constants
from capreolus.utils.common import download_file, remove_newline
from capreolus.utils.loginit import get_logger... | [
"json.loads",
"capreolus.Dependency",
"zipfile.ZipFile",
"pathlib.Path",
"gzip.open",
"capreolus.utils.loginit.get_logger",
"capreolus.ConfigOption",
"capreolus.utils.trec.topic_to_trectxt",
"collections.defaultdict",
"capreolus.utils.common.download_file"
] | [((406, 426), 'capreolus.utils.loginit.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (416, 426), False, 'from capreolus.utils.loginit import get_logger\n'), ((773, 844), 'capreolus.Dependency', 'Dependency', ([], {'key': '"""collection"""', 'module': '"""collection"""', 'name': '"""codesearchnet"""'}),... |
from click.testing import CliRunner
from honeybee_radiance_folder.cli import filter_json_file
import json
import os
def test_filter_file():
runner = CliRunner()
input_file = './tests/assets/project_folder/grid_info.json'
output_file = './tests/assets/temp/grid_filtered_0.json'
result = runner.invoke(
... | [
"json.load",
"os.unlink",
"click.testing.CliRunner"
] | [((155, 166), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (164, 166), False, 'from click.testing import CliRunner\n'), ((601, 623), 'os.unlink', 'os.unlink', (['output_file'], {}), '(output_file)\n', (610, 623), False, 'import os\n'), ((670, 681), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', ... |
import os, time
import numpy as np
import logging
import fire
import torch
import torch.optim as optim
import torch.nn as nn
from torch.utils.data import DataLoader
from model import *
from dataset import *
def train(dataloader, model, optimizer, criterion, device):
epoch_loss = 0.0
total_nu... | [
"logging.basicConfig",
"logging.getLogger",
"os.path.exists",
"torch.nn.CrossEntropyLoss",
"os.makedirs",
"fire.Fire",
"logging.Formatter",
"torch.max",
"os.path.join",
"torch.cuda.is_available",
"logging.FileHandler",
"torch.utils.data.DataLoader",
"torch.no_grad"
] | [((1536, 1601), 'logging.Formatter', 'logging.Formatter', (['"""[ %(levelname)s: %(asctime)s ] - %(message)s"""'], {}), "('[ %(levelname)s: %(asctime)s ] - %(message)s')\n", (1553, 1601), False, 'import logging\n'), ((1623, 1723), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '... |
# Generated by Django 2.0.2 on 2018-06-13 22:10
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("ddcz", "0009_auto_201806... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.SlugField",
"django.db.models.AutoField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((507, 600), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# coding=utf-8
# Copyright 2020 The Learning-to-Prompt 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 appli... | [
"tensorflow.unstack",
"tensorflow.image.resize_with_crop_or_pad",
"tensorflow.random.experimental.stateless_split",
"tensorflow.shape",
"tensorflow.image.crop_to_bounding_box",
"tensorflow.image.resize",
"tensorflow.image.stateless_random_flip_left_right",
"tensorflow.image.decode_and_crop_jpeg",
"t... | [((2128, 2179), 'tensorflow.image.resize', 'tf.image.resize', (['image', '[h, w]'], {'antialias': 'antialias'}), '(image, [h, w], antialias=antialias)\n', (2143, 2179), True, 'import tensorflow as tf\n'), ((2408, 2461), 'tensorflow.image.crop_to_bounding_box', 'tf.image.crop_to_bounding_box', (['image', 'top', 'left', ... |
from __future__ import absolute_import, division, print_function
from matplotlib.backends.backend_qt5 import NavigationToolbar2QT
from glue.config import viewer_tool
from glue.viewers.common.tool import CheckableTool, Tool
__all__ = ['MatplotlibTool', 'MatplotlibCheckableTool', 'HomeTool', 'SaveTool',
'P... | [
"matplotlib.backends.backend_qt5.NavigationToolbar2QT"
] | [((505, 563), 'matplotlib.backends.backend_qt5.NavigationToolbar2QT', 'NavigationToolbar2QT', (['viewer.central_widget.canvas', 'viewer'], {}), '(viewer.central_widget.canvas, viewer)\n', (525, 563), False, 'from matplotlib.backends.backend_qt5 import NavigationToolbar2QT\n')] |
import matplotlib.pyplot as plt
import numpy as np
from ipywidgets import interactive, interactive_output, fixed, HBox, VBox
import ipywidgets as widgets
def true_function_old(x):
x_copy = -1 * x
f = 2 * x_copy * np.sin(0.8*x_copy) + 0.5 * x_copy**2 - 5
return f
def sigmoid(x, L=10, k=2, x_0=20):
re... | [
"numpy.exp",
"numpy.sin",
"numpy.random.RandomState"
] | [((717, 752), 'numpy.random.RandomState', 'np.random.RandomState', (['random_state'], {}), '(random_state)\n', (738, 752), True, 'import numpy as np\n'), ((334, 356), 'numpy.exp', 'np.exp', (['(-k * (x - x_0))'], {}), '(-k * (x - x_0))\n', (340, 356), True, 'import numpy as np\n'), ((223, 243), 'numpy.sin', 'np.sin', (... |
#!/usr/bin/env python
import os
import sys
import jieba
import numpy as np
jieba.setLogLevel(60) # quiet
fname = sys.argv[1]
with open(fname) as f:
text = f.read()
tokenizer = jieba.Tokenizer()
tokens = list(tokenizer.cut(text))
occurences = np.array([tokenizer.FREQ[w] for w in tokens if w in tokenizer.FREQ])... | [
"numpy.mean",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.gca",
"numpy.array",
"os.path.basename",
"numpy.percentile",
"jieba.setLogLevel",
"jieba.Tokenizer",
"matplotlib.pyplot.show"
] | [((77, 98), 'jieba.setLogLevel', 'jieba.setLogLevel', (['(60)'], {}), '(60)\n', (94, 98), False, 'import jieba\n'), ((186, 203), 'jieba.Tokenizer', 'jieba.Tokenizer', ([], {}), '()\n', (201, 203), False, 'import jieba\n'), ((252, 320), 'numpy.array', 'np.array', (['[tokenizer.FREQ[w] for w in tokens if w in tokenizer.F... |
from itertools import tee
from typing import Dict, Iterator, List, Sequence, Tuple
from brown_clustering.defaultvaluedict import DefaultValueDict
Corpus = Sequence[Sequence[str]]
class BigramCorpus:
def __init__(
self,
corpus: Corpus,
alpha: float = 1,
start_symbo... | [
"brown_clustering.defaultvaluedict.DefaultValueDict",
"itertools.tee"
] | [((2763, 2779), 'itertools.tee', 'tee', (['sequence', '(2)'], {}), '(sequence, 2)\n', (2766, 2779), False, 'from itertools import tee\n'), ((454, 473), 'brown_clustering.defaultvaluedict.DefaultValueDict', 'DefaultValueDict', (['(0)'], {}), '(0)\n', (470, 473), False, 'from brown_clustering.defaultvaluedict import Defa... |
import sys
# for development
sys.path.append('../../src')
from screencastscript import ScreencastScript # noqa: E402
screencast = ScreencastScript()
screencast.sleep(1)
screencast.i3wm_focus_left()
screencast.sleep(1)
screencast.i3wm_zoom_in()
screencast.sleep(1)
screencast.i3wm_zoom_out()
screencast.sleep(1)
sc... | [
"sys.path.append",
"screencastscript.ScreencastScript"
] | [((29, 57), 'sys.path.append', 'sys.path.append', (['"""../../src"""'], {}), "('../../src')\n", (44, 57), False, 'import sys\n'), ((133, 151), 'screencastscript.ScreencastScript', 'ScreencastScript', ([], {}), '()\n', (149, 151), False, 'from screencastscript import ScreencastScript\n')] |
from django.views.generic import ListView, DetailView
from django.views.generic.edit import CreateView, UpdateView, DeleteView
from django.urls import reverse_lazy, reverse
from django.shortcuts import redirect
from .models import StockEntry, StockEntryLine
from .forms import StockEntryForm, StockEntryLineForm, StockEn... | [
"django.urls.reverse",
"django.shortcuts.redirect",
"django.urls.reverse_lazy"
] | [((1654, 1682), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""stock:detail"""'], {}), "('stock:detail')\n", (1666, 1682), False, 'from django.urls import reverse_lazy, reverse\n'), ((1378, 1432), 'django.urls.reverse', 'reverse', (['"""stock:detail"""'], {'kwargs': "{'pk': self.object.id}"}), "('stock:detail', kwar... |
import setuptools
setuptools.setup(
name="synmetric",
version="0.2.dev1",
license='MIT',
author="<NAME>",
author_email="<EMAIL>",
description="Metric to evaluate data quality for synthetic data.",
url="https://github.com/harsh020/synthetic_metric",
download_url = 'https://github.com/ha... | [
"setuptools.find_packages"
] | [((698, 724), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (722, 724), False, 'import setuptools\n')] |
from django.urls import path, include
from . import views
from rest_framework import routers
router = routers.SimpleRouter()
router.register(r'players', views.PlayerView, basename='players')
router.register(r'teams', views.TeamView, basename='teams')
urlpatterns = [
path('', views.APIWelcomeView),
path('', ... | [
"rest_framework.routers.SimpleRouter",
"django.urls.path",
"django.urls.include"
] | [((103, 125), 'rest_framework.routers.SimpleRouter', 'routers.SimpleRouter', ([], {}), '()\n', (123, 125), False, 'from rest_framework import routers\n'), ((275, 305), 'django.urls.path', 'path', (['""""""', 'views.APIWelcomeView'], {}), "('', views.APIWelcomeView)\n", (279, 305), False, 'from django.urls import path, ... |
import requests
from sanic import Sanic
from sanic.response import json
from sanic_limiter import Limiter, get_remote_address
from bs4 import BeautifulSoup
async def ratelimit_handler(request, exception):
return json({"error": f"Ratelimit exceeded {exception}."}, status=429)
app = Sanic()
app.error_handler.add(... | [
"sanic_limiter.Limiter",
"sanic.Sanic",
"sanic.response.json",
"requests.get"
] | [((290, 297), 'sanic.Sanic', 'Sanic', ([], {}), '()\n', (295, 297), False, 'from sanic import Sanic\n'), ((361, 457), 'sanic_limiter.Limiter', 'Limiter', (['app'], {'global_limits': "['1 per 3 seconds', '50 per hour']", 'key_func': 'get_remote_address'}), "(app, global_limits=['1 per 3 seconds', '50 per hour'], key_fun... |
#! python3
# coding: utf-8
from vpc.nos import NetworkElement,NetworkElementEvent,event_t,EventChain
class OVSEvent(NetworkElementEvent):
def __init__(self,ne_id,type):
super().__init__(ne_id,type)
class OVS(NetworkElement):
def __init__(self,channel,datapath):
super().__init__()
self... | [
"vpc.nos.EventChain"
] | [((577, 589), 'vpc.nos.EventChain', 'EventChain', ([], {}), '()\n', (587, 589), False, 'from vpc.nos import NetworkElement, NetworkElementEvent, event_t, EventChain\n')] |
# -*- coding: utf-8 -*-
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
# Func1: change density map into count map
# density map: batch size * 1 * w * h
def get_local_count(density_map,psize,pstride):
IF_gpu = torch.cuda.is_available() # if gpu, return gpu
IF_r... | [
"torch.nn.functional.conv2d",
"torch.Tensor",
"torch.from_numpy",
"torch.tensor",
"torch.cuda.is_available",
"torch.ones"
] | [((264, 289), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (287, 289), False, 'import torch\n'), ((486, 537), 'torch.ones', 'torch.ones', (['(1)', '(1)', 'psize', 'psize'], {'dtype': 'torch.float32'}), '(1, 1, psize, psize, dtype=torch.float32)\n', (496, 537), False, 'import torch\n'), ((648,... |
# 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, software
# distributed under t... | [
"shade._utils._iterate_timeout",
"mock.patch",
"testtools.ExpectedException",
"shade.tests.fakes.make_fake_server",
"uuid.uuid4",
"mock.patch.object"
] | [((1867, 1923), 'mock.patch.object', 'mock.patch.object', (['shade.OpenStackCloud', '"""search_images"""'], {}), "(shade.OpenStackCloud, 'search_images')\n", (1884, 1923), False, 'import mock\n'), ((2180, 2236), 'mock.patch.object', 'mock.patch.object', (['shade.OpenStackCloud', '"""search_images"""'], {}), "(shade.Ope... |
# -*- coding: utf-8 -*-
# pylint: disable-msg=E1101,W0612
from warnings import catch_warnings, simplefilter
from pandas import Panel
from pandas.util.testing import assert_panel_equal
from .test_generic import Generic
class TestPanel(Generic):
_typ = Panel
_comparator = lambda self, x, y: assert_panel_equa... | [
"warnings.simplefilter",
"pandas.util.testing.assert_panel_equal",
"warnings.catch_warnings"
] | [((303, 343), 'pandas.util.testing.assert_panel_equal', 'assert_panel_equal', (['x', 'y'], {'by_blocks': '(True)'}), '(x, y, by_blocks=True)\n', (321, 343), False, 'from pandas.util.testing import assert_panel_equal\n'), ((1038, 1065), 'warnings.catch_warnings', 'catch_warnings', ([], {'record': '(True)'}), '(record=Tr... |
# coding: utf-8
"""
paginate.py
```````````
: 分页api
"""
from flask import url_for
def pagination(lit, page, perpage,endpoint):
"""
返回当前分页的列表对象,
next、last链接
{current: next_lit}
"""
_yu = len(lit) % perpage
_chu = len(lit) // perpage
if _yu == 0:
last = _chu
else:... | [
"flask.url_for"
] | [((547, 575), 'flask.url_for', 'url_for', (['endpoint'], {'page': 'last'}), '(endpoint, page=last)\n', (554, 575), False, 'from flask import url_for\n'), ((454, 486), 'flask.url_for', 'url_for', (['endpoint'], {'page': '(page + 1)'}), '(endpoint, page=page + 1)\n', (461, 486), False, 'from flask import url_for\n')] |
import a as b
import b.c as e
b.foo(1)
e.baz(1)
| [
"a.foo",
"b.c.baz"
] | [((31, 39), 'a.foo', 'b.foo', (['(1)'], {}), '(1)\n', (36, 39), True, 'import a as b\n'), ((40, 48), 'b.c.baz', 'e.baz', (['(1)'], {}), '(1)\n', (45, 48), True, 'import b.c as e\n')] |
'''
:class:`eulxml.xmlmap.XmlObject` classes for working with ABBYY
FineReadux OCR XML.
Currently supports **FineReader6-schema-v1** and
**FineReader8-schema-v2**.
----
'''
from eulxml import xmlmap
class Base(xmlmap.XmlObject):
'''Base :class:`eulxml.xmlmap.XmlObject` for ABBYY OCR XML with
common namespace... | [
"eulxml.xmlmap.IntegerField",
"eulxml.xmlmap.StringField"
] | [((604, 633), 'eulxml.xmlmap.StringField', 'xmlmap.StringField', (['"""@xml:id"""'], {}), "('@xml:id')\n", (622, 633), False, 'from eulxml import xmlmap\n'), ((1320, 1347), 'eulxml.xmlmap.StringField', 'xmlmap.StringField', (['"""@lang"""'], {}), "('@lang')\n", (1338, 1347), False, 'from eulxml import xmlmap\n'), ((140... |