code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import cv2
import glob
import numpy as np
from keras.models import Sequential
from keras.layers import Conv2D, Flatten, Dense, MaxPooling2D, Dropout
from keras.utils.np_utils import to_categorical
from keras import losses, optimizers, regularizers
X_train = []
x_label = []
for img_class, directory in enumerate(['Red... | [
"keras.regularizers.l2",
"cv2.cvtColor",
"keras.layers.Dropout",
"keras.optimizers.Adam",
"keras.layers.Flatten",
"cv2.imread",
"keras.utils.np_utils.to_categorical",
"keras.layers.Dense",
"numpy.array",
"keras.models.Sequential",
"keras.layers.MaxPooling2D",
"cv2.resize"
] | [((832, 849), 'numpy.array', 'np.array', (['X_train'], {}), '(X_train)\n', (840, 849), True, 'import numpy as np\n'), ((860, 877), 'numpy.array', 'np.array', (['x_label'], {}), '(x_label)\n', (868, 877), True, 'import numpy as np\n'), ((902, 925), 'keras.utils.np_utils.to_categorical', 'to_categorical', (['x_label'], {... |
import pytest
from openeo.capabilities import ComparableVersion
@pytest.mark.parametrize(["a", "b", "c"], [
(ComparableVersion("1.2.3"), ComparableVersion("1.2.3"), ComparableVersion("2.3.4")),
(ComparableVersion("1.2.3"), "1.2.3", "2.3.4"),
("1.2.3", ComparableVersion("1.2.3"), ComparableVersion("2.3.4"... | [
"openeo.capabilities.ComparableVersion"
] | [((765, 791), 'openeo.capabilities.ComparableVersion', 'ComparableVersion', (['"""1.2.3"""'], {}), "('1.2.3')\n", (782, 791), False, 'from openeo.capabilities import ComparableVersion\n'), ((1132, 1158), 'openeo.capabilities.ComparableVersion', 'ComparableVersion', (['"""1.2.3"""'], {}), "('1.2.3')\n", (1149, 1158), Fa... |
import logging
import discord
import pytz
from discord.ext import commands, tasks
from datetime import datetime
from helpers.api_key import discord_key, owner_id, error_channel_id
from helpers.descriptions import bot_description, wrong_message
from helpers.ge import MissingQuery, NoResults
from helpers.hiscore import ... | [
"discord.ext.commands.when_mentioned_or",
"logging.basicConfig",
"discord.Embed",
"helpers.version.get_version",
"logging.info",
"pytz.timezone",
"discord.ext.commands.Bot",
"datetime.datetime.now"
] | [((464, 576), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""bot.log"""', 'format': '"""%(asctime)s:%(levelname)s:%(message)s"""', 'level': 'logging.INFO'}), "(filename='bot.log', format=\n '%(asctime)s:%(levelname)s:%(message)s', level=logging.INFO)\n", (483, 576), False, 'import logging\n'), (... |
import struct
import os
import sys
import Image
import random
import logging
from yad2.utils import Sprite
from yad2.encoders import Format40, Format80
class Wsa:
def __init__(self, filename):
self.logger = logging.getLogger('root')
self.filename = filename
self.filesize = os.path.getsize... | [
"yad2.utils.Sprite",
"os.path.getsize",
"yad2.encoders.Format80",
"struct.unpack",
"yad2.encoders.Format40",
"logging.getLogger"
] | [((222, 247), 'logging.getLogger', 'logging.getLogger', (['"""root"""'], {}), "('root')\n", (239, 247), False, 'import logging\n'), ((305, 335), 'os.path.getsize', 'os.path.getsize', (['self.filename'], {}), '(self.filename)\n', (320, 335), False, 'import os\n'), ((1358, 1379), 'yad2.utils.Sprite', 'Sprite', (['width',... |
import allure
import pytest
from pages.loganalysiscenter_page.db2_collection import LogHome
from common.po_base import El
from common.po_base import Page
from pages.IndexPage import IndexPage
from common.page_manage import pm
from pages.LoginPage import LoginPage
from time import sleep
from pages.sensor_page.CreateEsPa... | [
"pages.loganalysiscenter_page.db2_collection.LogHome",
"pytest.fixture",
"time.sleep",
"allure.title",
"allure.feature"
] | [((344, 374), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (358, 374), False, 'import pytest\n'), ((494, 520), 'allure.feature', 'allure.feature', (['"""db2数据库采集"""'], {}), "('db2数据库采集')\n", (508, 520), False, 'import allure\n'), ((553, 578), 'allure.title', 'allure.title',... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.ResourceOptions",
"pulumi.set"
] | [((3698, 3737), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""resourceGroupName"""'}), "(name='resourceGroupName')\n", (3711, 3737), False, 'import pulumi\n'), ((4196, 4226), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""subnetId"""'}), "(name='subnetId')\n", (4209, 4226), False, 'import pulumi\n'), ((4619,... |
##############################################################################
#
# Copyright (c) 2007 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOF... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((739, 764), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (754, 764), False, 'import os\n'), ((2359, 2379), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (2372, 2379), False, 'from setuptools import find_packages\n'), ((808, 836), 'os.path.join', 'os.path.j... |
from oscpy.server import OSCThreadServer
from time import sleep
print("Starting")
def callback(*values):
print("got values: {}".format(values))
osc = OSCThreadServer()
sock = osc.listen(address='127.0.0.1', port=8000, default=True)
osc.bind(b'/hello/world', callback, sock)
sleep(5000)
osc.stop()
| [
"oscpy.server.OSCThreadServer",
"time.sleep"
] | [((157, 174), 'oscpy.server.OSCThreadServer', 'OSCThreadServer', ([], {}), '()\n', (172, 174), False, 'from oscpy.server import OSCThreadServer\n'), ((281, 292), 'time.sleep', 'sleep', (['(5000)'], {}), '(5000)\n', (286, 292), False, 'from time import sleep\n')] |
"""Utils for date range generation."""
from datetime import datetime
from typing import Union
from pyspark.sql import DataFrame, functions
from butterfree.clients import SparkClient
from butterfree.constants import DataType
from butterfree.constants.columns import TIMESTAMP_COLUMN
def get_date_range(
client: S... | [
"pyspark.sql.functions.col"
] | [((1597, 1616), 'pyspark.sql.functions.col', 'functions.col', (['"""id"""'], {}), "('id')\n", (1610, 1616), False, 'from pyspark.sql import DataFrame, functions\n'), ((1303, 1319), 'pyspark.sql.functions.col', 'functions.col', (['c'], {}), '(c)\n', (1316, 1319), False, 'from pyspark.sql import DataFrame, functions\n')] |
# -*- coding: utf-8 -*-
"""Aplicando estilo via propriedade `name` (Gnome Builder).
Propriedade `name` é adicionada via arquivo de interface
e arquivo css é carregado via linguagem de programação.
"""
import gi
gi.require_version(namespace='Gtk', version='3.0')
from gi.repository import Gtk, Gdk
@Gtk.Template(fil... | [
"gi.repository.Gtk.Template",
"gi.require_version",
"gi.repository.Gtk.main",
"gi.repository.Gtk.StyleContext.new",
"gi.repository.Gdk.Screen",
"gi.repository.Gtk.CssProvider.new"
] | [((214, 264), 'gi.require_version', 'gi.require_version', ([], {'namespace': '"""Gtk"""', 'version': '"""3.0"""'}), "(namespace='Gtk', version='3.0')\n", (232, 264), False, 'import gi\n'), ((304, 347), 'gi.repository.Gtk.Template', 'Gtk.Template', ([], {'filename': '"""./mainwindow.glade"""'}), "(filename='./mainwindow... |
import torch
from sklearn.model_selection import train_test_split
import torch.nn.functional as F
import torch.nn as nn
import torch.optim as optim
import random
import numpy as np
import Read_Data
import Confusion_Matrix
def getdata():
features, target = Read_Data.read_data3('mushrooms_data.csv')
... | [
"torch.nn.Dropout",
"numpy.random.seed",
"Read_Data.read_data3",
"numpy.argmax",
"torch.manual_seed",
"sklearn.model_selection.train_test_split",
"torch.cuda.manual_seed",
"torch.nn.functional.cross_entropy",
"torch.cuda.manual_seed_all",
"Confusion_Matrix.main",
"random.seed",
"torch.nn.Linea... | [((274, 316), 'Read_Data.read_data3', 'Read_Data.read_data3', (['"""mushrooms_data.csv"""'], {}), "('mushrooms_data.csv')\n", (294, 316), False, 'import Read_Data\n'), ((357, 406), 'sklearn.model_selection.train_test_split', 'train_test_split', (['features', 'target'], {'test_size': '(0.2)'}), '(features, target, test_... |
#-*- coding:utf-8 -*-
#scrappingV3.py
from bs4 import BeautifulSoup
import requests
import inspect
import os
import re
import string
import pathlib
import random
import json
import logging
import datetime
current_folder = inspect.getfile(inspect.currentframe())
current_path = os.path.dirname(os.path.abspath(current_f... | [
"os.path.abspath",
"re.split",
"os.path.join",
"logging.FileHandler",
"json.loads",
"random.sample",
"logging.StreamHandler",
"random.choice",
"logging.Formatter",
"pathlib.Path",
"requests.get",
"inspect.currentframe",
"bs4.BeautifulSoup",
"datetime.datetime.now",
"os.listdir",
"loggi... | [((544, 567), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (565, 567), False, 'import datetime\n'), ((716, 767), 'os.path.join', 'os.path.join', (['os.path.sep', 'current_path', 'log_folder'], {}), '(os.path.sep, current_path, log_folder)\n', (728, 767), False, 'import os\n'), ((898, 925), 'loggi... |
"""
Python rpc agent
Use for test rpc server
"""
import socket
from threading import Thread
import logging
import json
logger = logging.getLogger('Tester')
class Agent:
def __init__(self, device_id):
self.device_id = device_id
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
... | [
"threading.Thread",
"json.loads",
"socket.socket",
"json.dumps",
"logging.getLogger"
] | [((130, 157), 'logging.getLogger', 'logging.getLogger', (['"""Tester"""'], {}), "('Tester')\n", (147, 157), False, 'import logging\n'), ((263, 312), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (276, 312), False, 'import socket\n'), ((487, 5... |
'''
Created on Dec 4, 2012
Module to handle dynamic decoration of LCIO classes
@author: <a href="mailto:<EMAIL>"><NAME></a>
'''
from ROOT import TVector3, TLorentzVector
from pyLCIO import EVENT, IMPL, IO, UTIL
from array import array
def addMethod( self, method, name=None ):
''' Convenience method to add a met... | [
"ROOT.TLorentzVector",
"pyLCIO.IMPL.LCEventImpl",
"ROOT.TVector3",
"array.array"
] | [((556, 582), 'ROOT.TVector3', 'TVector3', (['v[0]', 'v[1]', 'v[2]'], {}), '(v[0], v[1], v[2])\n', (564, 582), False, 'from ROOT import TVector3, TLorentzVector\n'), ((758, 798), 'ROOT.TLorentzVector', 'TLorentzVector', (['v[0]', 'v[1]', 'v[2]', 'energy'], {}), '(v[0], v[1], v[2], energy)\n', (772, 798), False, 'from R... |
from core.terraform.resources.aws import iam
from resources.iam.ecs_role import ECSRole
class LambdaPolicyDocument(iam.IAMPolicyDocumentData):
statement = [
{
'actions': ["sts:AssumeRole"],
'principals': {
'type': "AWS",
'identifiers': [ECSRole.get_o... | [
"resources.iam.ecs_role.ECSRole.get_output_attr"
] | [((5157, 5188), 'resources.iam.ecs_role.ECSRole.get_output_attr', 'ECSRole.get_output_attr', (['"""name"""'], {}), "('name')\n", (5180, 5188), False, 'from resources.iam.ecs_role import ECSRole\n'), ((307, 337), 'resources.iam.ecs_role.ECSRole.get_output_attr', 'ECSRole.get_output_attr', (['"""arn"""'], {}), "('arn')\n... |
import streamlit as st
import plotly.express as px
import components.base as gSlider
from utils.helpers import load_data
def admissions_plot():
df_opnames_age = load_data('COVID-19_ziekenhuis_ic_opnames_per_leeftijdsgroep.csv', dates="Date_of_statistics_week_start", index="Date_of_statistics_week_start")
df_o... | [
"plotly.express.bar",
"utils.helpers.load_data",
"streamlit.plotly_chart"
] | [((167, 316), 'utils.helpers.load_data', 'load_data', (['"""COVID-19_ziekenhuis_ic_opnames_per_leeftijdsgroep.csv"""'], {'dates': '"""Date_of_statistics_week_start"""', 'index': '"""Date_of_statistics_week_start"""'}), "('COVID-19_ziekenhuis_ic_opnames_per_leeftijdsgroep.csv', dates=\n 'Date_of_statistics_week_start... |
import torch
class ConvBlock2d(torch.nn.Module):
def __init__(
self,
input_feature_size,
output_feature_size,
internal_feature_size=None,
num_layers=4,
batch_norm=True,
dropout=None,
bias=False,
bias_initializer=None,
weight_initializ... | [
"torch.nn.BatchNorm2d",
"torch.nn.Conv2d",
"torch.nn.ReLU",
"torch.nn.Dropout2d"
] | [((1315, 1343), 'torch.nn.ReLU', 'torch.nn.ReLU', ([], {'inplace': '(False)'}), '(inplace=False)\n', (1328, 1343), False, 'import torch\n'), ((1403, 1443), 'torch.nn.BatchNorm2d', 'torch.nn.BatchNorm2d', (['input_feature_size'], {}), '(input_feature_size)\n', (1423, 1443), False, 'import torch\n'), ((1731, 1838), 'torc... |
# Author : <NAME>
# Date : July 19th, 2007
# last update: $Date: 2010/03/17 18:17:34 $ by $Author: mussgill $
import FWCore.ParameterSet.Config as cms
# DCS partitions
# "EBp","EBm","EEp","EEm","HBHEa","HBHEb","HBHEc","HF","HO","RPC"
# "DT0","DTp","DTm","CSCp","CSCm","CASTOR","TIBTID","TOB","TECp","TECm"
... | [
"FWCore.ParameterSet.Config.Sequence",
"FWCore.ParameterSet.Config.vstring",
"FWCore.ParameterSet.Config.untracked.bool",
"FWCore.ParameterSet.Config.bool"
] | [((2053, 2089), 'FWCore.ParameterSet.Config.Sequence', 'cms.Sequence', (['ALCARECOTkAlCosmicsCTF'], {}), '(ALCARECOTkAlCosmicsCTF)\n', (2065, 2089), True, 'import FWCore.ParameterSet.Config as cms\n'), ((2123, 2164), 'FWCore.ParameterSet.Config.Sequence', 'cms.Sequence', (['ALCARECOTkAlCosmicsCosmicTF'], {}), '(ALCAREC... |
from __future__ import with_statement
import datetime
import sys
import os
import requests
from akismet import Akismet, SpamStatus
from akismet.exceptions import AkismetServerError, MissingParameterError
if sys.version_info < (2, 7):
import unittest2 as unittest
else:
import unittest
USER_AGENT = 'Mozilla/5.... | [
"unittest.main",
"datetime.datetime",
"akismet.Akismet"
] | [((2662, 2677), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2675, 2677), False, 'import unittest\n'), ((698, 736), 'akismet.Akismet', 'Akismet', (['akismet_api_key'], {'is_test': '(True)'}), '(akismet_api_key, is_test=True)\n', (705, 736), False, 'from akismet import Akismet, SpamStatus\n'), ((1165, 1205), 'ak... |
"""Test cases for day 22."""
from pathlib import Path
import pytest
from aoc import log
from aoc import ROOT_PATH
from day22 import compute_reactor_state
from day22 import load_dataset
@pytest.mark.parametrize(
"dataset_path,initialisation_limit,reboot_limit",
[
[Path("day22/data/data-small.txt"), 4... | [
"aoc.ROOT_PATH.joinpath",
"pathlib.Path",
"aoc.log.info",
"day22.compute_reactor_state"
] | [((784, 825), 'day22.compute_reactor_state', 'compute_reactor_state', (['instructions', '(True)'], {}), '(instructions, True)\n', (805, 825), False, 'from day22 import compute_reactor_state\n'), ((845, 887), 'day22.compute_reactor_state', 'compute_reactor_state', (['instructions', '(False)'], {}), '(instructions, False... |
#!/usr/bin/python
import random
file("/picpic", "w").write(str(random.getrandbits(128)))
| [
"random.getrandbits"
] | [((65, 88), 'random.getrandbits', 'random.getrandbits', (['(128)'], {}), '(128)\n', (83, 88), False, 'import random\n')] |
# -*- coding: utf-8 -*-
from functools import partial
from openprocurement.api.models import get_now
from openprocurement.api.utils import (
context_unpack,
decrypt,
encrypt,
json_view,
APIResource,
)
from openprocurement.edge.utils import eaopresource
try:
import openprocurement.auctions.core... | [
"functools.partial",
"openprocurement.api.utils.json_view",
"openprocurement.api.utils.encrypt",
"openprocurement.api.utils.decrypt",
"openprocurement.api.utils.context_unpack",
"openprocurement.edge.utils.eaopresource"
] | [((1154, 1354), 'openprocurement.edge.utils.eaopresource', 'eaopresource', ([], {'name': '"""Auctions"""', 'path': '"""/auctions"""', 'description': '"""Open Contracting compatible data exchange format. See http://ocds.open-contracting.org/standard/r/master/#auction for more info"""'}), "(name='Auctions', path='/auctio... |
# script adapted from https://github.com/dezeraecox-manuscripts/COX_Proteome-stability
import os
import re
import zipfile
import gzip
import shutil
from shutil import copyfile
from loguru import logger
from contextlib import closing
import urllib.request as request
import tarfile
logger.info('Import OK')
def downloa... | [
"zipfile.ZipFile",
"os.makedirs",
"os.path.exists",
"urllib.request.urlopen",
"loguru.logger.info",
"shutil.copyfileobj"
] | [((282, 306), 'loguru.logger.info', 'logger.info', (['"""Import OK"""'], {}), "('Import OK')\n", (293, 306), False, 'from loguru import logger\n'), ((718, 749), 'os.path.exists', 'os.path.exists', (['resource_folder'], {}), '(resource_folder)\n', (732, 749), False, 'import os\n'), ((759, 787), 'os.makedirs', 'os.makedi... |
import photomosaic as pm
from skimage.io import imread, imsave
def gen_pic():
target = '28387.jpg'
image = imread(target)
dims_list = [(150, 150,), ]
# Analyze the collection (the "pool") of images.
# pool = pm.make_pool('guinnesscaps/*.jpg')
# Generate a collection of solid-color square imag... | [
"photomosaic.basic_mosaic",
"photomosaic.make_pool",
"skimage.io.imread",
"photomosaic.rainbow_of_squares"
] | [((117, 131), 'skimage.io.imread', 'imread', (['target'], {}), '(target)\n', (123, 131), False, 'from skimage.io import imread, imsave\n'), ((328, 386), 'photomosaic.rainbow_of_squares', 'pm.rainbow_of_squares', (['"""pool/"""'], {'range_params': '(0, 256, 128)'}), "('pool/', range_params=(0, 256, 128))\n", (349, 386),... |
#!/usr/bin/env python
'''
This example shows the interals of certain Python modules when they are being
imported.
'''
from pycallgraph import PyCallGraph
from pycallgraph import Config
from pycallgraph.output import GraphvizOutput
def main():
import_list = (
'pickle',
'htmllib',
'urllib2',... | [
"pycallgraph.output.GraphvizOutput",
"pycallgraph.PyCallGraph",
"pycallgraph.Config"
] | [((342, 358), 'pycallgraph.output.GraphvizOutput', 'GraphvizOutput', ([], {}), '()\n', (356, 358), False, 'from pycallgraph.output import GraphvizOutput\n'), ((372, 399), 'pycallgraph.Config', 'Config', ([], {'include_stdlib': '(True)'}), '(include_stdlib=True)\n', (378, 399), False, 'from pycallgraph import Config\n')... |
# -*- coding : utf-8 -*-
import os
'''
@brief find all files
'''
def findfiles(path, ext):
all_files = []
subdirs = [path+"/"+name for name in os.listdir(path)]
for subdir in subdirs:
try:
files = [subdir+"/"+f for f in os.listdir(subdir) if os.path.isfile(os.path.join(subdir, f)) and... | [
"os.path.join",
"os.listdir"
] | [((154, 170), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (164, 170), False, 'import os\n'), ((255, 273), 'os.listdir', 'os.listdir', (['subdir'], {}), '(subdir)\n', (265, 273), False, 'import os\n'), ((292, 315), 'os.path.join', 'os.path.join', (['subdir', 'f'], {}), '(subdir, f)\n', (304, 315), False, 'im... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy import stats
from scipy import interpolate as spin
import pandas as pd
import os
import warnings
from datetime import datetime, timedelta
import calendar
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.ticker as pltick
import matplotlib.d... | [
"matplotlib.pyplot.title",
"matplotlib.dates.MonthLocator",
"numpy.abs",
"time_tools.convert_tuple_to_8_int",
"matplotlib.pyplot.quiver",
"load_product.sea_ice_concentration_along_track",
"numpy.isnan",
"matplotlib.patches.Polygon",
"matplotlib.pyplot.figure",
"numpy.arange",
"matplotlib.pyplot.... | [((515, 565), 'os.path.isdir', 'os.path.isdir', (['"""/Applications/anaconda/share/proj"""'], {}), "('/Applications/anaconda/share/proj')\n", (528, 565), False, 'import os\n'), ((775, 839), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""', '""".*is_string_like function.*"""'], {}), "('ignore', '.*... |
# -*- coding: utf-8 -*-
"""
Created on Wed Dec 27 14:24:54 2017
@author: IACJ
"""
import os
from os import path
from os.path import expanduser
from numpy import genfromtxt
import numpy as np
from numpy import array, zeros, argmin, inf
from numpy import *
from US_DTW import US_DTW
# classify using kNN
def kNNCl... | [
"os.path.join",
"numpy.zeros",
"numpy.genfromtxt",
"numpy.tile",
"US_DTW.US_DTW",
"os.path.expanduser",
"os.listdir"
] | [((1638, 1658), 'numpy.zeros', 'np.zeros', (['numSamples'], {}), '(numSamples)\n', (1646, 1658), True, 'import numpy as np\n'), ((2650, 2670), 'numpy.zeros', 'np.zeros', (['numSamples'], {}), '(numSamples)\n', (2658, 2670), True, 'import numpy as np\n'), ((3916, 3937), 'numpy.zeros', 'zeros', (['(r + 1, c + 1)'], {}), ... |
# Generated by Django 2.0.7 on 2018-09-20 10:17
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hivs_administrative', '0007_remove_areatype'),
]
operations = [
migrations.CreateModel(
name='A... | [
"django.db.models.ForeignKey",
"django.db.models.DateTimeField",
"django.db.models.CharField",
"django.db.models.AutoField"
] | [((1073, 1239), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'related_name': '"""areas"""', 'to': '"""hivs_administrative.AreaType"""', 'verbose_name': '"""area type"""'}), "(null=True, on_delete=django.db.models.deletion.SET_NULL,\n r... |
from django.db import models
from .slugify import slugify # For persian slugs
from django.urls import reverse
'''from whoosh.fields import Schema , TEXT
from whoosh.analysis import StemmingAnalyzer
from whoosh.index import create_index_in'''
class Catalog(models.Model):
name = models.CharField(max_length=255 , u... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.SlugField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.DecimalField",
"django.urls.reverse",
"django.db.models.DateTimeField"
] | [((285, 330), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'unique': '(True)'}), '(max_length=255, unique=True)\n', (301, 330), False, 'from django.db import models\n'), ((342, 399), 'django.db.models.SlugField', 'models.SlugField', ([], {'max_length': '(255)', 'unique': '(True)', 'bla... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, <NAME> <<EMAIL>>
# (c) 2017, <NAME> <<EMAIL>>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = '''
module: manageiq_... | [
"ansible.module_utils.basic.AnsibleModule",
"ansible_collections.community.general.plugins.module_utils.manageiq.manageiq_entities",
"ansible_collections.community.general.plugins.module_utils.manageiq.manageiq_argument_spec",
"ansible_collections.community.general.plugins.module_utils.manageiq.ManageIQ"
] | [((10614, 10759), 'ansible.module_utils.basic.AnsibleModule', 'AnsibleModule', ([], {'argument_spec': 'argument_spec', 'required_if': "[('state', 'present', ['policy_profiles']), ('state', 'absent', [\n 'policy_profiles'])]"}), "(argument_spec=argument_spec, required_if=[('state', 'present',\n ['policy_profiles']... |
from django.shortcuts import render
# Create your views here.
from django.http import HttpResponseRedirect
from django.http import HttpResponse
from django.shortcuts import render
from django.core.urlresolvers import reverse
from .forms import docform
from .models import Document
def upload(request):
if request.... | [
"django.shortcuts.render",
"django.core.urlresolvers.reverse"
] | [((597, 627), 'django.shortcuts.render', 'render', (['request', '"""upload.html"""'], {}), "(request, 'upload.html')\n", (603, 627), False, 'from django.shortcuts import render\n'), ((531, 548), 'django.core.urlresolvers.reverse', 'reverse', (['"""upload"""'], {}), "('upload')\n", (538, 548), False, 'from django.core.u... |
# -*- coding: utf-8 -*-
# Copyright 2018 University of Groningen
#
# 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... | [
"vermouth.molecule.Molecule",
"vermouth.processors.canonicalize_modifications.PTMGraphMatcher",
"vermouth.processors.canonicalize_modifications.identify_ptms",
"networkx.Graph",
"pytest.mark.parametrize",
"vermouth.processors.canonicalize_modifications.find_ptm_atoms",
"pytest.mark.xfail"
] | [((1899, 3393), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""atoms, edges, expected"""', "[({}, [], []), ({(0): {'atomname': 'N', 'PTM_atom': False, 'element': 'N',\n 'resid': 1}, (1): {'atomname': 'H', 'PTM_atom': True, 'element': 'H',\n 'resid': 1}, (2): {'atomname': 'N', 'PTM_atom': True, 'eleme... |
import pickle
import time
import codecs
import logging
import numpy as np
import torch
import torch.nn as nn
import click
from itertools import chain
from pathlib import Path
from collections import OrderedDict
from tqdm import tqdm
from torch.utils.data import DataLoader
from crf import CRF
from utils import SIGHAN,... | [
"codecs.open",
"logging.basicConfig",
"torch.utils.data.DataLoader",
"click.option",
"utils.SIGHAN",
"click.command",
"utils.get_feature",
"utils.pad_sents",
"utils.token2id",
"torch.device",
"model.CharWordSeg.load",
"torch.no_grad",
"torch.tensor"
] | [((456, 550), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(levelname)s: %(asctime)s %(message)s"""', 'level': 'logging.DEBUG'}), "(format='%(levelname)s: %(asctime)s %(message)s', level=\n logging.DEBUG)\n", (475, 550), False, 'import logging\n'), ((3524, 3539), 'click.command', 'click.command... |
from unittest.mock import Mock
from .context import tohu
from tohu.v7.primitive_generators import Integer, HashDigest, FakerGenerator
from tohu.v7.custom_generator.tohu_namespace import TohuNamespace
def test_add_field_generators():
ns = TohuNamespace("Quux")
assert ns.tohu_items_cls.__name__ == "Quux"
a... | [
"unittest.mock.Mock",
"tohu.v7.primitive_generators.HashDigest",
"tohu.v7.primitive_generators.FakerGenerator",
"tohu.v7.custom_generator.tohu_namespace.TohuNamespace",
"tohu.v7.primitive_generators.Integer"
] | [((245, 266), 'tohu.v7.custom_generator.tohu_namespace.TohuNamespace', 'TohuNamespace', (['"""Quux"""'], {}), "('Quux')\n", (258, 266), False, 'from tohu.v7.custom_generator.tohu_namespace import TohuNamespace\n'), ((372, 389), 'tohu.v7.primitive_generators.Integer', 'Integer', (['(100)', '(200)'], {}), '(100, 200)\n',... |
from typing import (
Any,
AsyncIterable,
Awaitable,
Callable,
Generic,
Optional,
Tuple,
TypeVar,
)
from typing_extensions import Protocol
from tickit.core.device import Device
from tickit.utils.configuration.configurable import as_tagged_union
#: Message type
T = TypeVar("T")
# http... | [
"typing.TypeVar"
] | [((299, 311), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (306, 311), False, 'from typing import Any, AsyncIterable, Awaitable, Callable, Generic, Optional, Tuple, TypeVar\n')] |
# Random tests
import math
if 1:
def isqrt(x):
op = x
res = 0
one = 1 << 30
while one > op:
one >>= 2
while one != 0:
if op >= res + one:
op -= res + one
res += one << 1
res >>= 1
one >>= 2
... | [
"math.sqrt"
] | [((720, 732), 'math.sqrt', 'math.sqrt', (['x'], {}), '(x)\n', (729, 732), False, 'import math\n')] |
# encoding: utf-8
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
#
# Author: <NAME> (<EMAIL>)
#
from __future__ import absolute_import, division, unicode_literals
... | [
"os.environ.get",
"sys.getrecursionlimit"
] | [((657, 688), 'os.environ.get', 'os.environ.get', (['"""TRAVIS_BRANCH"""'], {}), "('TRAVIS_BRANCH')\n", (671, 688), False, 'import os\n'), ((722, 745), 'sys.getrecursionlimit', 'sys.getrecursionlimit', ([], {}), '()\n', (743, 745), False, 'import sys\n')] |
from flask_restful import Resource, abort
recipes = []
# Handles the collection
class RecipesResource(Resource):
def get(self):
return {
'data': recipes
}
def post(self):
return
# Handles the items in collection
class Recipes(Resource):
def get(self, id)... | [
"flask_restful.abort"
] | [((455, 490), 'flask_restful.abort', 'abort', (['(404)'], {'message': '"""ID not found."""'}), "(404, message='ID not found.')\n", (460, 490), False, 'from flask_restful import Resource, abort\n')] |
from django.db import models
class Base(models.Model):
createdAt = models.DateTimeField(auto_now=True)
updatedAt = models.DateTimeField(auto_now=True)
active = models.BooleanField(default=True)
class Meta:
ordering = ['id']
abstract = True
class Category(Base):
description = mode... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.EmailField",
"django.db.models.DecimalField",
"django.db.models.DateTimeField"
] | [((72, 107), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (92, 107), False, 'from django.db import models\n'), ((124, 159), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now': '(True)'}), '(auto_now=True)\n', (144, 159), False, 'fro... |
import html
from unittest.mock import Mock
import numpy as np
import pytest
from napari.utils import nbscreenshot
def test_nbscreenshot(make_napari_viewer):
"""Test taking a screenshot."""
viewer = make_napari_viewer()
np.random.seed(0)
data = np.random.random((10, 15))
viewer.add_image(data)
... | [
"numpy.random.seed",
"napari.utils.nbscreenshot",
"unittest.mock.Mock",
"numpy.random.random",
"pytest.mark.parametrize",
"html.escape"
] | [((585, 1229), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""alt_text_input, expected_alt_text"""', '[(None, None), (\'Good alt text\', \'Good alt text\'), (",./;\'[]\\\\-=",\n \',./;'[]\\\\-=\'), (\'>?:"{}|_+\', \'>?:"{}|_+\'), (\n \'!@#$%^&*()`~\', \'!@#$%^&*()`~\'), (\'😍\', \'😍... |
"""
A low level example:
This is how JenkinsAPI creates views
"""
from __future__ import print_function
import json
import requests
url = 'http://localhost:8080/createView'
str_view_name = "blahblah123"
params = {} # {'name': str_view_name}
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
data = {
... | [
"requests.post",
"json.dumps"
] | [((515, 576), 'requests.post', 'requests.post', (['url'], {'params': 'params', 'data': 'data', 'headers': 'headers'}), '(url, params=params, data=data, headers=headers)\n', (528, 576), False, 'import requests\n'), ((413, 481), 'json.dumps', 'json.dumps', (["{'name': str_view_name, 'mode': 'hudson.model.ListView'}"], {}... |
print("Starting bookie server")
import praw
import os
from datetime import datetime
import io
# import boto3
from boto3 import session
from boto3.s3.transfer import S3Transfer
import json
import string
import requests
import re
print("Imports worked")
tickerMatch = re.compile("(?:\s|^)(?:\$([A-Za-z]{1,5})|([A-Z]{2,5... | [
"json.dumps",
"boto3.session.client",
"requests.get",
"boto3.session.Session",
"praw.Reddit",
"datetime.datetime.now",
"re.compile"
] | [((269, 346), 're.compile', 're.compile', (['"""(?:\\\\s|^)(?:\\\\$([A-Za-z]{1,5})|([A-Z]{2,5}))(?=(?:[\\\\s.,?!]|$))"""'], {}), "('(?:\\\\s|^)(?:\\\\$([A-Za-z]{1,5})|([A-Z]{2,5}))(?=(?:[\\\\s.,?!]|$))')\n", (279, 346), False, 'import re\n'), ((504, 521), 'boto3.session.Session', 'session.Session', ([], {}), '()\n', (5... |
"""Collection of helpers methods that help to style tables in Jupyter Notebooks
"""
from typing import Union, Optional, List
from html import escape
import pandas as pd
import numpy as np
from pandas.io.formats.style import Styler
from pandas.api.types import is_list_like # noqa
from pandas._typing import Axis # no... | [
"helpsk.pandas.get_categorical_columns",
"pandas.MultiIndex.from_tuples",
"seaborn.color_palette",
"helpsk.pandas.get_string_columns",
"pandas.isna",
"helpsk.validation.any_none_nan",
"html.escape",
"pandas.api.types.is_list_like"
] | [((3208, 3244), 'seaborn.color_palette', 'color_palette', (['palette'], {'as_cmap': '(True)'}), '(palette, as_cmap=True)\n', (3221, 3244), False, 'from seaborn import color_palette\n'), ((5230, 5247), 'pandas.isna', 'pd.isna', (['row_item'], {}), '(row_item)\n', (5237, 5247), True, 'import pandas as pd\n'), ((8550, 856... |
import numpy as np
def random_sum(*dimensions):
return np.random.rand(*dimensions).sum()
| [
"numpy.random.rand"
] | [((61, 88), 'numpy.random.rand', 'np.random.rand', (['*dimensions'], {}), '(*dimensions)\n', (75, 88), True, 'import numpy as np\n')] |
"""iBird URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based v... | [
"django.urls.path",
"django.urls.include"
] | [((794, 825), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (798, 825), False, 'from django.urls import path, include\n'), ((832, 867), 'django.urls.path', 'path', (['"""api/test_get"""', 'test.test_get'], {}), "('api/test_get', test.test_get)\n", (836, 867), Fa... |
"""
Copyright (c) 2021 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.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writin... | [
"nncf.common.quantization.initialization.range.PerLayerRangeInitConfig.from_dict",
"nncf.common.quantization.initialization.range.RangeInitConfig.from_dict",
"nncf.common.utils.logger.logger.warning"
] | [((4288, 4378), 'nncf.common.utils.logger.logger.warning', 'logger.warning', (['"""Enabling quantization range initialization with default parameters."""'], {}), "(\n 'Enabling quantization range initialization with default parameters.')\n", (4302, 4378), False, 'from nncf.common.utils.logger import logger\n'), ((46... |
import numpy as np
import time
import sys
from ServoMotor import *
from fns import *
# Initialize motor control library & USB Port
filename = "/dev/ttyUSB0"
motor = ServoMotor(filename)
IO = motor.IO_Init()
if IO < 0:
print('IO exit')
sys.exit()
# Call corresponding function to convert sim2real/real2sim
def convFns... | [
"numpy.load",
"numpy.zeros",
"time.sleep",
"numpy.sin",
"sys.exit"
] | [((3246, 3259), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (3256, 3259), False, 'import time\n'), ((3514, 3527), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (3524, 3527), False, 'import time\n'), ((238, 248), 'sys.exit', 'sys.exit', ([], {}), '()\n', (246, 248), False, 'import sys\n'), ((524, 536), 'nu... |
# -*- coding: utf-8 -*-
"""
Atom and Bond features used in graph reaction representations
"""
import logging
from typing import List, Optional
from rdkit.Chem.rdchem import Bond, Atom
logger = logging.getLogger(__name__)
# values found on train+valid on USPTO-50k + USPTO-FULL + USPTO-MIT
ATOM_PROPS = {
'atomic_... | [
"logging.getLogger"
] | [((196, 223), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (213, 223), False, 'import logging\n')] |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from marionette_driver import expected, By, Wait
from gaiatest.apps.base import Base
class SettingsForm(Base):
_s... | [
"gaiatest.apps.contacts.app.Contacts",
"marionette_driver.expected.element_not_displayed",
"gaiatest.apps.contacts.regions.gmail.GmailLogin",
"gaiatest.apps.base.Base.__init__",
"marionette_driver.Wait",
"marionette_driver.expected.element_displayed",
"gaiatest.apps.system.regions.facebook.FacebookLogin... | [((2009, 2040), 'gaiatest.apps.base.Base.__init__', 'Base.__init__', (['self', 'marionette'], {}), '(self, marionette)\n', (2022, 2040), False, 'from gaiatest.apps.base import Base\n'), ((5222, 5249), 'gaiatest.apps.contacts.regions.gmail.GmailLogin', 'GmailLogin', (['self.marionette'], {}), '(self.marionette)\n', (523... |
from flask import render_template, request, redirect, url_for, abort
from . import main
from .forms import UpdateProfile, BlogForm
from ..models import User
from flask_login import login_required, current_user
from .. import db
import requests
import json
import os
# import markdown2
@main.route('/')
#@login_required... | [
"requests.get",
"flask.url_for",
"flask.abort",
"flask.render_template"
] | [((592, 649), 'flask.render_template', 'render_template', (['"""index.html"""'], {'title': 'title', 'random': 'random'}), "('index.html', title=title, random=random)\n", (607, 649), False, 'from flask import render_template, request, redirect, url_for, abort\n'), ((958, 1010), 'flask.render_template', 'render_template'... |
'''
Notes
TO DO
-Change the sleep timer back to 15 when done with testing.
'''
import pyautogui, time, random
# welcome message and explanation of program
print('Welcome to Mouse Wiggler by GrizzledLabs\n')
print('This program prevents computer sleeping')
print('...by wiggling your mouse every 15 seconds\n')
print(... | [
"pyautogui.moveRel",
"random.randint",
"time.sleep"
] | [((1113, 1126), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (1123, 1126), False, 'import pyautogui, time, random\n'), ((1251, 1265), 'time.sleep', 'time.sleep', (['(15)'], {}), '(15)\n', (1261, 1265), False, 'import pyautogui, time, random\n'), ((1430, 1451), 'random.randint', 'random.randint', (['(-4)', '(4)']... |
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("pyiArduinoI2Cencoder.pyx")
)
| [
"Cython.Build.cythonize"
] | [((93, 130), 'Cython.Build.cythonize', 'cythonize', (['"""pyiArduinoI2Cencoder.pyx"""'], {}), "('pyiArduinoI2Cencoder.pyx')\n", (102, 130), False, 'from Cython.Build import cythonize\n')] |
import logging
from ..base.twilltestcase import common, ShedTwillTestCase
log = logging.getLogger(__name__)
category_name = 'Test 1460 Data Manager'
category_description = 'Test script 1460 for testing Data Managers'
data_manager_repository_name = 'data_manager_1460'
data_manager_repository_description = 'Repository... | [
"logging.getLogger"
] | [((82, 109), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (99, 109), False, 'import logging\n')] |
"""
Test program that:
connects to xbee unit on COM3, which is determined by current computer
sends test1.wav
stores all actions in a continuing log
"""
import logging
import sys
import time
import serial
import wave
from communication import Communication
def main():
# Setup logging
logger = logging.getLo... | [
"wave.open",
"logging.FileHandler",
"logging.StreamHandler",
"communication.Communication",
"logging.Formatter",
"sys.exit",
"logging.getLogger"
] | [((307, 335), 'logging.getLogger', 'logging.getLogger', (['"""control"""'], {}), "('control')\n", (324, 335), False, 'import logging\n'), ((389, 420), 'logging.FileHandler', 'logging.FileHandler', (['"""main.log"""'], {}), "('main.log')\n", (408, 420), False, 'import logging\n'), ((475, 498), 'logging.StreamHandler', '... |
import json
import jsonschema
from jsonschema import validate
import abc
import error as error
from Estimator import Estimator
import sys
import numpy as np # vectors and matrices
import pandas as pd # tables and data manipulations
from dateutil.relativedel... | [
"jsonschema.validate",
"scipy.optimize.minimize",
"numpy.abs",
"warnings.filterwarnings",
"sys.path.insert",
"sklearn.model_selection.TimeSeriesSplit",
"numpy.array",
"TripleES_OM.TripleES_OM"
] | [((802, 835), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (825, 835), False, 'import warnings\n'), ((8825, 8853), 'sklearn.model_selection.TimeSeriesSplit', 'TimeSeriesSplit', ([], {'n_splits': 'cv'}), '(n_splits=cv)\n', (8840, 8853), False, 'from sklearn.model_selectio... |
import json
from typing import Any, Dict, Optional, Union
from django.db.models import Exists, OuterRef, Q
from posthog.utils import is_valid_regex
class Property:
key: str
operator: Optional[str]
value: str
type: str
def __init__(
self, key: str, value: str, operator: Optional[str] = N... | [
"django.db.models.Q",
"django.db.models.OuterRef",
"json.loads",
"posthog.utils.is_valid_regex"
] | [((1165, 1182), 'json.loads', 'json.loads', (['value'], {}), '(value)\n', (1175, 1182), False, 'import json\n'), ((2057, 2065), 'django.db.models.Q', 'Q', ([], {'pk': '(-1)'}), '(pk=-1)\n', (2058, 2065), False, 'from django.db.models import Exists, OuterRef, Q\n'), ((1966, 1987), 'posthog.utils.is_valid_regex', 'is_val... |
# main file for l2race model server, run this class to start the model server
import sys
sys.path.insert(0, './commonroad-vehicle-models/PYTHON/')
import argparse
import atexit
import copy
import socket, pickle
from queue import Empty
from typing import Dict, Tuple, List, Optional
import argcomplete
from timeit impor... | [
"atexit.register",
"argparse.ArgumentParser",
"multiprocessing.Lock",
"src.l2race_utils.set_logging_level",
"socket.socket",
"multiprocessing.Queue",
"gooey.Gooey",
"src.l2race_utils.find_unbound_port_in_range",
"pickle.dumps",
"pickle.loads",
"src.l2race_utils.my_logger",
"src.my_args.server_... | [((89, 146), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./commonroad-vehicle-models/PYTHON/"""'], {}), "(0, './commonroad-vehicle-models/PYTHON/')\n", (104, 146), False, 'import sys\n'), ((730, 749), 'src.l2race_utils.my_logger', 'my_logger', (['__name__'], {}), '(__name__)\n', (739, 749), False, 'from src.l2ra... |
# -*- coding: utf-8 -*-
# @Time : 2019/7/8 14:43
# @Author : <NAME>
from flask import render_template, session, redirect, url_for
from datetime import datetime
from . import main
from .forms import NameForm
@main.route('/', methods=['GET', 'POST'])
def index():
form = NameForm()
if form.validate_on_submi... | [
"datetime.datetime.utcnow",
"flask.url_for",
"flask.session.get"
] | [((363, 380), 'flask.url_for', 'url_for', (['""".index"""'], {}), "('.index')\n", (370, 380), False, 'from flask import render_template, session, redirect, url_for\n'), ((466, 485), 'flask.session.get', 'session.get', (['"""name"""'], {}), "('name')\n", (477, 485), False, 'from flask import render_template, session, re... |
'''
Future Update Notes:
1) Non-supervisor mode is not coded.
2) Controller functions should be updated.
3) robot_creator function takes too much arguments and more argument
necessary for options like robot tags, data transfer between real
robot and player, etc. New structure might be necessary.
4) Codes m... | [
"numpy.ndindex",
"numpy.random.randint",
"ctypes.windll.shell32.IsUserAnAdmin",
"pathlib.Path"
] | [((13388, 13426), 'numpy.random.randint', 'np.random.randint', (['(0)', '(5)'], {'size': '(10, 10)'}), '(0, 5, size=(10, 10))\n', (13405, 13426), True, 'import numpy as np\n'), ((2466, 2496), 'numpy.ndindex', 'np.ndindex', (['floor_matrix.shape'], {}), '(floor_matrix.shape)\n', (2476, 2496), True, 'import numpy as np\n... |
# coding: utf-8
# Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
# This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may c... | [
"oci.util.formatted_flat_dict",
"oci.util.value_allowed_none_or_none_sentinel"
] | [((10536, 10561), 'oci.util.formatted_flat_dict', 'formatted_flat_dict', (['self'], {}), '(self)\n', (10555, 10561), False, 'from oci.util import formatted_flat_dict, NONE_SENTINEL, value_allowed_none_or_none_sentinel\n'), ((10355, 10416), 'oci.util.value_allowed_none_or_none_sentinel', 'value_allowed_none_or_none_sent... |
""" Demonstrates the DC system from the client side, using a
DistributedNode-based avatar. """
from direct.directbase.DirectStart import *
from direct.distributed.ClientRepository import ClientRepository
from direct.gui.OnscreenText import OnscreenText
from direct.showbase.DirectObject import DirectObject
from pandac... | [
"random.uniform",
"direct.distributed.ClientRepository.ClientRepository.__init__",
"direct.showbase.DirectObject.DirectObject.__init__",
"DistributedPellet.DistributedPellet",
"sys.exit",
"direct.gui.OnscreenText.OnscreenText"
] | [((767, 823), 'direct.distributed.ClientRepository.ClientRepository.__init__', 'ClientRepository.__init__', (['self'], {'dcFileNames': 'dcFileNames'}), '(self, dcFileNames=dcFileNames)\n', (792, 823), False, 'from direct.distributed.ClientRepository import ClientRepository\n'), ((1002, 1029), 'direct.showbase.DirectObj... |
# -*- coding: utf-8 -*-
import scrapy
from scrapy.loader import ItemLoader
from knowledge.items import CommonItem
from knowledge.consts import consts
class GushiCommonSpider(scrapy.Spider):
def is_root_url(self, url):
for item in self.start_urls:
if url.find(item) != -1:
return ... | [
"knowledge.items.CommonItem"
] | [((1128, 1140), 'knowledge.items.CommonItem', 'CommonItem', ([], {}), '()\n', (1138, 1140), False, 'from knowledge.items import CommonItem\n')] |
from __future__ import print_function
import requests
from cloudmesh_client.shell.console import Console
from cloudmesh_client.common.Printer import Printer
from cloudmesh_client.db import CloudmeshDatabase
from cloudmesh_client.cloud.iaas.CloudProvider import CloudProvider
from cloudmesh_client.cloud.ListResource im... | [
"requests.packages.urllib3.disable_warnings",
"cloudmesh_client.shell.console.Console.info",
"cloudmesh_client.shell.console.Console.ok",
"cloudmesh_client.db.CloudmeshDatabase",
"cloudmesh_client.shell.console.Console.msg",
"cloudmesh_client.cloud.iaas.CloudProvider.CloudProvider",
"cloudmesh_client.sh... | [((582, 626), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {}), '()\n', (624, 626), False, 'import requests\n'), ((668, 687), 'cloudmesh_client.db.CloudmeshDatabase', 'CloudmeshDatabase', ([], {}), '()\n', (685, 687), False, 'from cloudmesh_client.db import CloudmeshD... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"aliyunsdkcore.request.RpcRequest.__init__"
] | [((901, 974), 'aliyunsdkcore.request.RpcRequest.__init__', 'RpcRequest.__init__', (['self', '"""cloudmarketing"""', '"""2018-09-10"""', '"""DescribeFile"""'], {}), "(self, 'cloudmarketing', '2018-09-10', 'DescribeFile')\n", (920, 974), False, 'from aliyunsdkcore.request import RpcRequest\n')] |
import curses
from typing import Union, Callable
from unittest.mock import Mock, MagicMock
import pytest
from pytest_mock import MockerFixture
from precon.remote_control import steer_vehicle, Screen
@pytest.fixture()
def patch_screen() -> Callable[[Union[str, int]], Mock]:
def inner(key: Union[str, int]) -> Moc... | [
"pytest.mark.parametrize",
"pytest.fixture",
"unittest.mock.MagicMock",
"precon.remote_control.steer_vehicle"
] | [((204, 220), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (218, 220), False, 'import pytest\n'), ((529, 545), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (543, 545), False, 'import pytest\n'), ((599, 615), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (613, 615), False, 'import pytest\n'), (... |
import json
from typing import Any, Dict
import boto3
import uuid
import os
from aws_lambda_powertools.utilities.typing import LambdaContext
from aws_lambda_powertools import Logger, Metrics, Tracer
_queue_name = os.getenv("QUEUE_NAME")
_bucket_name = os.getenv("BUCKET_NAME")
_s3 = boto3.resource("s3")
_sqs = boto3.r... | [
"uuid.uuid4",
"json.loads",
"json.dumps",
"boto3.resource",
"aws_lambda_powertools.Tracer",
"aws_lambda_powertools.Logger",
"aws_lambda_powertools.Metrics",
"os.getenv"
] | [((214, 237), 'os.getenv', 'os.getenv', (['"""QUEUE_NAME"""'], {}), "('QUEUE_NAME')\n", (223, 237), False, 'import os\n'), ((253, 277), 'os.getenv', 'os.getenv', (['"""BUCKET_NAME"""'], {}), "('BUCKET_NAME')\n", (262, 277), False, 'import os\n'), ((285, 305), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s... |
#!/usr/bin/env python3
import json
import os
import sys
from classes import Graph
if 'C3NAVPROJECT' in os.environ:
project = os.environ['C3NAVPROJECT']
elif len(sys.argv) > 1:
project = sys.argv[1]
else:
print('Please specify project: run.py <project> or environment variable C3NAVPROJECT')
sys.exit(1)... | [
"sys.exit",
"classes.Graph"
] | [((379, 390), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (387, 390), False, 'import sys\n'), ((455, 489), 'classes.Graph', 'Graph', (['project'], {'auto_connect': '(False)'}), '(project, auto_connect=False)\n', (460, 489), False, 'from classes import Graph\n'), ((309, 320), 'sys.exit', 'sys.exit', (['(1)'], {}), '... |
from botnet.config import Config
from botnet.modules.builtin.mumble import Mumble
from botnet.modules.builtin.mumble import mumble_pb2
from botnet.modules.builtin.mumble.mumble import encode, decode_header, \
message_types, Decoder
def test_encode_decode():
ver = mumble_pb2.Version()
ver.version = 1
v... | [
"botnet.modules.builtin.mumble.mumble.encode",
"botnet.modules.builtin.mumble.mumble.Decoder",
"botnet.modules.builtin.mumble.mumble_pb2.Version",
"botnet.modules.builtin.mumble.mumble.decode_header"
] | [((274, 294), 'botnet.modules.builtin.mumble.mumble_pb2.Version', 'mumble_pb2.Version', ([], {}), '()\n', (292, 294), False, 'from botnet.modules.builtin.mumble import mumble_pb2\n'), ((395, 406), 'botnet.modules.builtin.mumble.mumble.encode', 'encode', (['ver'], {}), '(ver)\n', (401, 406), False, 'from botnet.modules.... |
"""
This package includes my constraints/utilities/etc for cpmpy.
This cpmpy model was written by <NAME> (<EMAIL>)
See also my cpmpy page: http://hakank.org/cpmpy/
"""
import sys, math, re
import itertools
import numpy as np
from functools import reduce
from cpmpy import *
from cpmpy.expressions.globalconstraint... | [
"math.sqrt",
"itertools.combinations",
"numpy.array",
"functools.reduce",
"cpmpy.transformations.flatten_model.flatten_model",
"cpmpy.transformations.get_variables.print_variables"
] | [((29382, 29411), 'functools.reduce', 'reduce', (['(lambda a, b: a * b)', 'x'], {}), '(lambda a, b: a * b, x)\n', (29388, 29411), False, 'from functools import reduce\n'), ((38373, 38393), 'cpmpy.transformations.flatten_model.flatten_model', 'flatten_model', (['model'], {}), '(model)\n', (38386, 38393), False, 'from cp... |
# --------------
# Importing header files
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#New record
new_record=[[50, 9, 4, 1, 0, 0, 40, 0]]
#Reading file
data = np.genfromtxt(path, delimiter=",", skip_header=1)
print(data)
#Code starts here
census = np.concatenate((new_recor... | [
"numpy.sum",
"warnings.filterwarnings",
"numpy.std",
"numpy.genfromtxt",
"numpy.max",
"numpy.min",
"numpy.array",
"numpy.mean",
"numpy.concatenate"
] | [((82, 115), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (105, 115), False, 'import warnings\n'), ((203, 252), 'numpy.genfromtxt', 'np.genfromtxt', (['path'], {'delimiter': '""","""', 'skip_header': '(1)'}), "(path, delimiter=',', skip_header=1)\n", (216, 252), True, 'i... |
# coding=utf-8
# Copyright 2018 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
"os.stat",
"tensorflow.get_collection",
"re.match",
"tensorflow.add_to_collection",
"os.path.splitext",
"operator.itemgetter",
"os.path.join",
"os.listdir"
] | [((2087, 2136), 'tensorflow.add_to_collection', 'tf.add_to_collection', (['"""STAGING_AREA_PUTS"""', 'put_op'], {}), "('STAGING_AREA_PUTS', put_op)\n", (2107, 2136), True, 'import tensorflow as tf\n'), ((2232, 2251), 'os.listdir', 'os.listdir', (['log_dir'], {}), '(log_dir)\n', (2242, 2251), False, 'import os\n'), ((16... |
"""
sentry.web.frontend.projects
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2012 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect
from sentry.constants import (
PLATFORM_LI... | [
"sentry.web.helpers.render_to_string",
"django.core.urlresolvers.reverse",
"sentry.models.ProjectKey.objects.get",
"sentry.web.helpers.get_raven_js_url",
"sentry.constants.PLATFORM_ROOTS.get",
"sentry.web.helpers.render_to_response",
"sentry.models.ProjectKey.objects.filter"
] | [((1467, 1539), 'sentry.web.helpers.render_to_response', 'render_to_response', (['"""sentry/projects/client_help.html"""', 'context', 'request'], {}), "('sentry/projects/client_help.html', context, request)\n", (1485, 1539), False, 'from sentry.web.helpers import render_to_response, render_to_string, get_raven_js_url\n... |
# Generated by Django 4.0.1 on 2022-03-14 10:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('VulnerableScan', '0004_remove_exploitregister_file_object_and_more'),
]
operations = [
migrations.AddField(
model_name='vulnerab... | [
"django.db.models.BooleanField"
] | [((379, 456), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'db_column': '"""notice"""', 'default': '(False)', 'verbose_name': '"""是否钉钉通知"""'}), "(db_column='notice', default=False, verbose_name='是否钉钉通知')\n", (398, 456), False, 'from django.db import migrations, models\n')] |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
import sys
try:
from Cython.Distutils import build_ext
except ImportError:
def build_ext(*args, **kwargs):
from Cython.Distutils import build_ext
return build_ext(*args, **kwargs)
class lazy_extlist(list):
def __init__(s... | [
"Cython.Distutils.build_ext",
"numpy.get_include",
"setuptools.find_packages"
] | [((1559, 1574), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (1572, 1574), False, 'from setuptools import setup, find_packages\n'), ((247, 273), 'Cython.Distutils.build_ext', 'build_ext', (['*args'], {}), '(*args, **kwargs)\n', (256, 273), False, 'from Cython.Distutils import build_ext\n'), ((1338, 13... |
import signal, subprocess, sys
# On Linux this causes os.waitpid to fail with OSError as the OS has already
# reaped our child process. The wait() passing the OSError on to the caller
# and causing us to exit with an error is what we are testing against.
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
subprocess.Popen([... | [
"signal.signal",
"subprocess.Popen"
] | [((256, 301), 'signal.signal', 'signal.signal', (['signal.SIGCHLD', 'signal.SIG_IGN'], {}), '(signal.SIGCHLD, signal.SIG_IGN)\n', (269, 301), False, 'import signal, subprocess, sys\n'), ((302, 364), 'subprocess.Popen', 'subprocess.Popen', (['[sys.executable, \'-c\', \'print("albatross")\']'], {}), '([sys.executable, \'... |
from django.contrib import admin
from models import *
admin.site.register(Company)
admin.site.register(Job)
| [
"django.contrib.admin.site.register"
] | [((56, 84), 'django.contrib.admin.site.register', 'admin.site.register', (['Company'], {}), '(Company)\n', (75, 84), False, 'from django.contrib import admin\n'), ((85, 109), 'django.contrib.admin.site.register', 'admin.site.register', (['Job'], {}), '(Job)\n', (104, 109), False, 'from django.contrib import admin\n')] |
#!/usr/bin/env python3
import tkinter as tk
from tkinter.filedialog import askopenfilenames
import os
import csv
class ScanFtpShare(tk.Tk):
def __init__(self):
super(ScanFtpShare,self).__init__()
self.path=tk.StringVar()
self.title("Scan")
self.setup_Ui()
def selectPath... | [
"tkinter.StringVar",
"csv.reader",
"csv.writer",
"os.path.join",
"tkinter.Button",
"tkinter.filedialog.askopenfilenames",
"os.path.dirname",
"tkinter.Entry",
"tkinter.Label"
] | [((227, 241), 'tkinter.StringVar', 'tk.StringVar', ([], {}), '()\n', (239, 241), True, 'import tkinter as tk\n'), ((348, 366), 'tkinter.filedialog.askopenfilenames', 'askopenfilenames', ([], {}), '()\n', (364, 366), False, 'from tkinter.filedialog import askopenfilenames\n'), ((930, 954), 'os.path.dirname', 'os.path.di... |
import unittest
from app.user import Blog, Quote, User,Comment
class QuoteTest(unittest.TestCase):
'''
Test Class to test the behaviour of the Quote class
'''
def setUp(self):
'''
Set up method that will run before every Test
'''
self.new_quote = Quote(1, 'mango', 'tr... | [
"unittest.main",
"app.user.User",
"app.user.Quote",
"app.user.Comment",
"app.user.Blog"
] | [((1214, 1229), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1227, 1229), False, 'import unittest\n'), ((299, 388), 'app.user.Quote', 'Quote', (['(1)', '"""mango"""', '"""try me even now"""', '"""http://quotes.stormconsultancy.co.uk/quotes/7"""'], {}), "(1, 'mango', 'try me even now',\n 'http://quotes.stormc... |
try:
from . import generic as g
except BaseException:
import generic as g
class CollisionTest(g.unittest.TestCase):
def test_collision(self):
# Ensure that FCL is importable
try:
g.trimesh.collision.CollisionManager()
except ValueError:
g.log.warning('skipp... | [
"generic.unittest.main",
"generic.trimesh.collision.scene_to_collision",
"generic.trimesh.collision.CollisionManager",
"generic.np.array",
"generic.np.isclose",
"generic.get_mesh",
"generic.log.warning",
"generic.trimesh.util.attach_to_log",
"generic.np.eye"
] | [((5872, 5902), 'generic.trimesh.util.attach_to_log', 'g.trimesh.util.attach_to_log', ([], {}), '()\n', (5900, 5902), True, 'import generic as g\n'), ((5907, 5924), 'generic.unittest.main', 'g.unittest.main', ([], {}), '()\n', (5922, 5924), True, 'import generic as g\n'), ((395, 422), 'generic.get_mesh', 'g.get_mesh', ... |
import openpnm as op
import numpy as np
import matplotlib.pyplot as plt
pn = op.network.Cubic(shape=[10, 10, 10], spacing=1e-4)
geo = op.geometry.SpheresAndCylinders(network=pn, pores=pn.Ps, throats=pn.Ts)
air = op.phases.Air(network=pn, name='air')
water = op.phases.Water(network=pn, name='h2o')
phys_air = op.physics... | [
"openpnm.algorithms.InvasionPercolation",
"openpnm.phases.Air",
"openpnm.network.Cubic",
"openpnm.algorithms.StokesFlow",
"openpnm.geometry.SpheresAndCylinders",
"openpnm.physics.Standard",
"openpnm.phases.Water",
"numpy.linspace",
"openpnm.io.Statoil.export_data"
] | [((78, 130), 'openpnm.network.Cubic', 'op.network.Cubic', ([], {'shape': '[10, 10, 10]', 'spacing': '(0.0001)'}), '(shape=[10, 10, 10], spacing=0.0001)\n', (94, 130), True, 'import openpnm as op\n'), ((135, 206), 'openpnm.geometry.SpheresAndCylinders', 'op.geometry.SpheresAndCylinders', ([], {'network': 'pn', 'pores': ... |
# Copyright 2012 Nebula, 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 agree... | [
"warnings.warn",
"weakref.ref",
"six.iteritems",
"functools.wraps"
] | [((2321, 2342), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (2336, 2342), False, 'import functools\n'), ((932, 965), 'weakref.ref', 'weakref.ref', (['arg', 'remove_callback'], {}), '(arg, remove_callback)\n', (943, 965), False, 'import weakref\n'), ((6695, 6716), 'functools.wraps', 'functools.wrap... |
__author__ = 'NoNotCar'
import pygame
import os
from random import choice, randint
import math
import colorsys
from itertools import count
from collections import defaultdict
tau = math.pi * 2
hpi = math.pi / 2
np = os.path.normpath
loc = os.getcwd() + "/Assets/"
pygame.mixer.init()
from . import Colour
class Scaled... | [
"pygame.transform.flip",
"pygame.transform.rotate",
"pygame.Surface",
"random.randint",
"os.getcwd",
"pygame.mixer.init",
"pygame.Rect",
"pygame.mixer.music.play",
"random.choice",
"itertools.count",
"math.sin",
"pygame.mixer.music.get_busy",
"math.cos",
"pygame.PixelArray",
"pygame.mixe... | [((266, 285), 'pygame.mixer.init', 'pygame.mixer.init', ([], {}), '()\n', (283, 285), False, 'import pygame\n'), ((241, 252), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (250, 252), False, 'import os\n'), ((6455, 6480), 'pygame.mixer.music.stop', 'pygame.mixer.music.stop', ([], {}), '()\n', (6478, 6480), False, 'import... |
import os
import preshed
import pytest
PACKAGE_DIR = os.path.abspath(os.path.dirname(preshed.__file__))
pytest.main([PACKAGE_DIR])
| [
"os.path.dirname",
"pytest.main"
] | [((105, 131), 'pytest.main', 'pytest.main', (['[PACKAGE_DIR]'], {}), '([PACKAGE_DIR])\n', (116, 131), False, 'import pytest\n'), ((70, 103), 'os.path.dirname', 'os.path.dirname', (['preshed.__file__'], {}), '(preshed.__file__)\n', (85, 103), False, 'import os\n')] |
import torch
import numpy as np
from torchvision import models
from utils.misc import *
from utils.process_fp import process_inputs_fp
def compute_features(tg_model, free_model, tg_feature_model, is_start_iteration, evalloader, num_samples, num_features, device=None):
if device is None:
device = torch.devi... | [
"utils.process_fp.process_inputs_fp",
"torch.no_grad",
"numpy.zeros",
"torch.cuda.is_available"
] | [((493, 530), 'numpy.zeros', 'np.zeros', (['[num_samples, num_features]'], {}), '([num_samples, num_features])\n', (501, 530), True, 'import numpy as np\n'), ((558, 573), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (571, 573), False, 'import torch\n'), ((335, 360), 'torch.cuda.is_available', 'torch.cuda.is_avai... |
from pathlib import Path
from typing import Union, Dict, Any, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from models.common_layers import CBHG
from utils.text.symbols import phonemes
class Encoder(nn.Module):
def __init__(self, embed_dims, num_chars, cbhg_channels, K, num_highways,... | [
"torch.nn.Embedding",
"torch.nn.Conv1d",
"torch.nn.functional.dropout",
"torch.nn.LSTMCell",
"torch.cat",
"torch.nn.functional.softmax",
"torch.nn.init.xavier_uniform_",
"torch.nn.Linear",
"models.common_layers.CBHG",
"torch.device",
"torch.nn.functional.relu",
"torch.zeros",
"torch.nn.GRUCe... | [((383, 418), 'torch.nn.Embedding', 'nn.Embedding', (['num_chars', 'embed_dims'], {}), '(num_chars, embed_dims)\n', (395, 418), True, 'import torch.nn as nn\n'), ((481, 619), 'models.common_layers.CBHG', 'CBHG', ([], {'K': 'K', 'in_channels': 'cbhg_channels', 'channels': 'cbhg_channels', 'proj_channels': '[cbhg_channel... |
from airflow.models import BaseOperator
from airflow.utils import apply_defaults
from airflow.exceptions import AirflowException
from botocore.config import Config
import boto3
import json
import logging
import base64
class ExecuteLambdaOperator(BaseOperator):
@apply_defaults
def __init__(
self,... | [
"logging.error",
"json.dumps",
"botocore.config.Config",
"logging.info",
"airflow.exceptions.AirflowException"
] | [((2102, 2128), 'logging.info', 'logging.info', (['log_msg_logs'], {}), '(log_msg_logs)\n', (2114, 2128), False, 'import logging\n'), ((2141, 2170), 'logging.info', 'logging.info', (['log_msg_payload'], {}), '(log_msg_payload)\n', (2153, 2170), False, 'import logging\n'), ((2230, 2257), 'logging.error', 'logging.error'... |
import beluga
import logging
ocp = beluga.Problem('hanging_chain')
ocp.independent('s', 'ft')
ocp.state('x', 'cos(theta)', 'ft')
ocp.state('y', 'sin(theta)', 'ft')
ocp.control('theta', 'rad')
ocp.constant('y_floor', -10, 'ft')
ocp.constant('x_0', 0, 'ft')
ocp.constant('y_0', 0, 'ft')
ocp.constant('s_0', 0, 'ft')
... | [
"beluga.solve",
"beluga.bvp_algorithm",
"beluga.init_continuation",
"beluga.add_logger",
"beluga.guess_generator",
"beluga.Problem"
] | [((36, 67), 'beluga.Problem', 'beluga.Problem', (['"""hanging_chain"""'], {}), "('hanging_chain')\n", (50, 67), False, 'import beluga\n'), ((817, 846), 'beluga.bvp_algorithm', 'beluga.bvp_algorithm', (['"""spbvp"""'], {}), "('spbvp')\n", (837, 846), False, 'import beluga\n'), ((862, 993), 'beluga.guess_generator', 'bel... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
# Export this package's modules as members:
from ._enums import *
from .get_peer_asn import *
from .get_peering import *
from .get_peering_service impo... | [
"pulumi.ResourceOptions",
"pulumi.runtime.register_resource_module"
] | [((2027, 2116), 'pulumi.runtime.register_resource_module', 'pulumi.runtime.register_resource_module', (['"""azure-nextgen"""', '"""peering"""', '_module_instance'], {}), "('azure-nextgen', 'peering',\n _module_instance)\n", (2066, 2116), False, 'import pulumi\n'), ((1197, 1228), 'pulumi.ResourceOptions', 'pulumi.Res... |
import unittest
from caldera.app.logic.logic import Term, convert_to_action
from caldera.app.operation.operation_steps import all_steps
import itertools
class TestActionConversion(unittest.TestCase):
# We want to detect situations such as this:
# + has_property(user_id, CREDENTIAL_G, USER_ID_18)
... | [
"itertools.combinations",
"caldera.app.logic.logic.convert_to_action"
] | [((572, 614), 'caldera.app.logic.logic.convert_to_action', 'convert_to_action', (['step', 'self.unique_count'], {}), '(step, self.unique_count)\n', (589, 614), False, 'from caldera.app.logic.logic import Term, convert_to_action\n'), ((763, 800), 'itertools.combinations', 'itertools.combinations', (['terms_only', '(2)']... |
"Unit tests for Constraint, MonomialEquality and SignomialInequality"
import unittest
import numpy as np
from gpkit import Variable, SignomialsEnabled, Posynomial, VectorVariable
from gpkit.nomials import SignomialInequality, PosynomialInequality
from gpkit.nomials import MonomialEquality
from gpkit import Model, Const... | [
"gpkit.VectorVariable",
"gpkit.constraints.loose.Loose",
"gpkit.ConstraintSet",
"gpkit.constraints.relax.ConstraintsRelaxedEqually",
"gpkit.globals.NamedVariables.reset_modelnumbers",
"gpkit.nomials.PosynomialInequality",
"gpkit.tests.helpers.run_tests",
"gpkit.constraints.relax.ConstantsRelaxed",
"... | [((15753, 15769), 'gpkit.tests.helpers.run_tests', 'run_tests', (['TESTS'], {}), '(TESTS)\n', (15762, 15769), False, 'from gpkit.tests.helpers import run_tests\n'), ((997, 1010), 'gpkit.Variable', 'Variable', (['"""x"""'], {}), "('x')\n", (1005, 1010), False, 'from gpkit import Variable, SignomialsEnabled, Posynomial, ... |
from bokeh.models import ColumnDataSource, HoverTool, Range1d, Plot, LinearAxis, Grid, Paragraph,TapTool,Div
from bokeh.plotting import figure, show, output_file
from bokeh.io import curdoc
from bokeh.layouts import widgetbox , layout
from bokeh.models.widgets import Select, Slider, Button
import dim_reduction
import n... | [
"bokeh.models.Plot",
"bokeh.layouts.widgetbox",
"sklearn.preprocessing.MinMaxScaler",
"dim_reduction.project",
"pickle.load",
"data_format.get_data",
"bokeh.models.widgets.Slider",
"bokeh.models.widgets.Select",
"os.path.abspath",
"numpy.transpose",
"bokeh.io.curdoc",
"bokeh.models.Div",
"cl... | [((552, 577), 'os.path.abspath', 'os.path.abspath', (['"""./src/"""'], {}), "('./src/')\n", (567, 577), False, 'import os\n'), ((9359, 9404), 'data_format.get_data', 'data_format.get_data', (["(load_dir + 'model.json')"], {}), "(load_dir + 'model.json')\n", (9379, 9404), False, 'import data_format\n'), ((9438, 9494), '... |
#!/usr/bin/env -S conda run -n tf python
import numpy as np
import cv2
import onnxruntime
import json
import requests
from PIL import Image
from tqdm import tqdm
from pathlib import Path
from fire import Fire
from typing import List, Union, Tuple
def preprocess_image(
image_path,
min_side = 800,
max_side... | [
"json.dump",
"tqdm.tqdm",
"fire.Fire",
"pathlib.Path.home",
"cv2.cvtColor",
"PIL.Image.open",
"onnxruntime.InferenceSession",
"pathlib.Path",
"numpy.array",
"requests.get",
"PIL.Image.fromarray",
"cv2.resize"
] | [((1586, 1627), 'cv2.resize', 'cv2.resize', (['img', 'None'], {'fx': 'scale', 'fy': 'scale'}), '(img, None, fx=scale, fy=scale)\n', (1596, 1627), False, 'import cv2\n'), ((2423, 2431), 'pathlib.Path', 'Path', (['to'], {}), '(to)\n', (2427, 2431), False, 'from pathlib import Path\n'), ((2551, 2581), 'requests.get', 'req... |
import time
from functools import partial
import torch
def timer(fxn, max_time=5):
N = 0
total_time = 0
fxn()
while total_time < max_time:
start = time.perf_counter()
fxn()
total_time += time.perf_counter() - start
N += 1
return total_time / N
def task(A, target)... | [
"functools.partial",
"time.perf_counter",
"torch.rand"
] | [((174, 193), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (191, 193), False, 'import time\n'), ((664, 688), 'functools.partial', 'partial', (['task', 'A_py', '(500)'], {}), '(task, A_py, 500)\n', (671, 688), False, 'from functools import partial\n'), ((707, 731), 'functools.partial', 'partial', (['task'... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from google.ads.google_ads.v3.proto.resources import ad_pb2 as google_dot_ads_dot_googleads__v3_dot_proto_dot_resources_dot_ad__pb2
from google.ads.google_ads.v3.proto.services import ad_service_pb2 as google_dot_ads_dot_googleads__v3_do... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler"
] | [((2776, 2884), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""google.ads.googleads.v3.services.AdService"""', 'rpc_method_handlers'], {}), "(\n 'google.ads.googleads.v3.services.AdService', rpc_method_handlers)\n", (2812, 2884), False, 'import grpc\n'), ((2050, 2355), 'grpc.un... |
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 1 21:08:48 2019
@author: <NAME>
This file is for producing the table for the validation results (NN).
"""
import random
import pandas as pd
from tabulate import tabulate
def fmt(avg_, min_, max_, n):
return "{:.3f} ({:.3f}, {:.3f})".format(avg_[n], min_[n], max_[n]... | [
"pandas.read_csv",
"random.shuffle",
"tabulate.tabulate",
"pandas.notnull"
] | [((507, 526), 'random.shuffle', 'random.shuffle', (['num'], {}), '(num)\n', (521, 526), False, 'import random\n'), ((1377, 1432), 'tabulate.tabulate', 'tabulate', (['table[1:]'], {'headers': 'table[0]', 'tablefmt': '"""latex"""'}), "(table[1:], headers=table[0], tablefmt='latex')\n", (1385, 1432), False, 'from tabulate... |
#########################################
#Created by <NAME> on 12 January 2021
#NOTE: This is not a finalised version
#########################################
from labelbox import Client
from LabelboxConstants import API_KEY
import wx
from wx import App, Frame
from wx import TextCtrl, StaticText, Button, ListCtrl
fr... | [
"os.path.abspath",
"wx.Point",
"labelbox.Client",
"wx.App",
"wx.FileDialog",
"wx.MessageBox",
"wx.Size"
] | [((774, 789), 'labelbox.Client', 'Client', (['API_KEY'], {}), '(API_KEY)\n', (780, 789), False, 'from labelbox import Client\n'), ((5294, 5299), 'wx.App', 'App', ([], {}), '()\n', (5297, 5299), False, 'from wx import App, Frame\n'), ((2903, 3017), 'wx.FileDialog', 'FileDialog', (['self', '"""Open Photos"""'], {'wildcar... |
# -*- coding:utf-8 -*-
import logging
# 配置日志信息
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s%(name)-12s%(levelname)-8s%(message)s',
datefmt='%m-%d %H:%M',
filename='demo/error_exception/myapp.log',
filemode='w')
# 定义一个Handle... | [
"logging.basicConfig",
"logging.StreamHandler",
"logging.Formatter",
"logging.info",
"logging.getLogger"
] | [((48, 237), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(asctime)s%(name)-12s%(levelname)-8s%(message)s"""', 'datefmt': '"""%m-%d %H:%M"""', 'filename': '"""demo/error_exception/myapp.log"""', 'filemode': '"""w"""'}), "(level=logging.DEBUG, format=\n '%(asctime)s%(na... |
"""Class to run MR on SIMBAD results"""
from __future__ import division
__author__ = "<NAME>"
__date__ = "09 Mar 2017"
__version__ = "1.0"
import logging
import os
from pyjob.script import ScriptCollector, Script
from pyjob.exception import PyJobExecutionError
from simbad.mr import anomalous_util
from simbad.mr.op... | [
"os.mkdir",
"pandas.read_csv",
"simbad.core.mr_score.MrScore",
"simbad.util.pdb_util.PdbStructure.from_file",
"os.path.isfile",
"simbad.parsers.refmac_parser.RefmacParser",
"os.path.join",
"simbad.parsers.molrep_parser.MolrepParser",
"simbad.util.source_ccp4",
"os.path.abspath",
"pyjob.script.Sc... | [((933, 960), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (950, 960), False, 'import logging\n'), ((20288, 20314), 'os.path.isfile', 'os.path.isfile', (['refmac_log'], {}), '(refmac_log)\n', (20302, 20314), False, 'import os\n'), ((20719, 20733), 'pandas.read_csv', 'pd.read_csv', (['f'... |
"""Visualize the Fibonacci sequence in binary.
This script plots the Fibonacci sequence in binary form; the idea comes from
https://mathworld.wolfram.com/FibonacciNumber.html
and
https://www.maa.org/editorial/mathgames
This script depends on the dataset `fibonacci.dat`, which is hosted on Zenodo:
https://zenodo.o... | [
"pathlib.Path",
"numpy.zeros",
"matplotlib.colors.ListedColormap",
"matplotlib.pyplot.subplots"
] | [((916, 943), 'numpy.zeros', 'np.zeros', (['(N, B)'], {'dtype': 'int'}), '((N, B), dtype=int)\n', (924, 943), True, 'import numpy as np\n'), ((951, 962), 'numpy.zeros', 'np.zeros', (['B'], {}), '(B)\n', (959, 962), True, 'import numpy as np\n'), ((970, 981), 'numpy.zeros', 'np.zeros', (['B'], {}), '(B)\n', (978, 981), ... |