code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from pybricks.hubs import EV3Brick
from pybricks.ev3devices import Motor, TouchSensor, InfraredSensor
from pybricks.media.ev3dev import ImageFile, SoundFile
from pybricks.parameters import Direction, Port, Stop, Color
from pybricks.tools import wait
from time import sleep, time
from random import randint, uniform
cl... | [
"pybricks.ev3devices.InfraredSensor",
"random.uniform",
"pybricks.ev3devices.Motor",
"pybricks.tools.wait",
"pybricks.ev3devices.TouchSensor",
"time.sleep",
"pybricks.hubs.EV3Brick",
"time.time",
"random.randint"
] | [((615, 625), 'pybricks.hubs.EV3Brick', 'EV3Brick', ([], {}), '()\n', (623, 625), False, 'from pybricks.hubs import EV3Brick\n'), ((653, 720), 'pybricks.ev3devices.Motor', 'Motor', ([], {'port': 'left_motor_port', 'positive_direction': 'Direction.CLOCKWISE'}), '(port=left_motor_port, positive_direction=Direction.CLOCKW... |
# Generated by Django 3.0 on 2021-03-17 23:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('polls', '0005_auto_20210317_2328'),
]
operations = [
migrations.RemoveField(
model_name='tcyequip... | [
"django.db.models.OneToOneField",
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((264, 327), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""tcyequipment"""', 'name': '"""key0k"""'}), "(model_name='tcyequipment', name='key0k')\n", (286, 327), False, 'from django.db import migrations, models\n'), ((476, 548), 'django.db.models.IntegerField', 'models.IntegerFie... |
#!/usr/bin/env python2
# coding=utf-8
import xml.etree.ElementTree as ET
from email.Utils import formatdate
import config
TREE = None
CHANNEL = None
def init():
global TREE, CHANNEL
TREE = ET.parse(config.feed_path)
root = TREE.getroot()
CHANNEL = root.findall("channel")[0]
def close():
trim_feed(config.max_... | [
"xml.etree.ElementTree.SubElement",
"email.Utils.formatdate",
"xml.etree.ElementTree.parse"
] | [((195, 221), 'xml.etree.ElementTree.parse', 'ET.parse', (['config.feed_path'], {}), '(config.feed_path)\n', (203, 221), True, 'import xml.etree.ElementTree as ET\n'), ((610, 640), 'xml.etree.ElementTree.SubElement', 'ET.SubElement', (['CHANNEL', '"""item"""'], {}), "(CHANNEL, 'item')\n", (623, 640), True, 'import xml.... |
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
# 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 Apach... | [
"heronpy.streamlet.impl.contextimpl.ContextImpl"
] | [((2106, 2145), 'heronpy.streamlet.impl.contextimpl.ContextImpl', 'ContextImpl', (['context', 'self._state', 'self'], {}), '(context, self._state, self)\n', (2117, 2145), False, 'from heronpy.streamlet.impl.contextimpl import ContextImpl\n'), ((2176, 2208), 'heronpy.streamlet.impl.contextimpl.ContextImpl', 'ContextImpl... |
# Copyright 2020 <NAME> <<EMAIL>>
#
# 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... | [
"test._helper.ExampleWritable",
"time.sleep",
"test._helper.AsyncMock",
"test._helper.InterfaceThreadRunner",
"asyncio.sleep",
"asyncio.get_event_loop",
"test._helper.ExampleSubscribable"
] | [((1090, 1150), 'test._helper.InterfaceThreadRunner', 'InterfaceThreadRunner', (['shc.web.WebServer', '"""localhost"""', '(42080)'], {}), "(shc.web.WebServer, 'localhost', 42080)\n", (1111, 1150), False, 'from test._helper import ExampleReadable, InterfaceThreadRunner, ExampleWritable, ExampleSubscribable, async_test, ... |
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import linear_model
plt.style.use('fivethirtyeight')
datafile = 'datafile.txt'
data = np.loadtxt(datafile,delimiter=',',usecols=(0,1,2),unpack=True)
X = np.transpose(np.array(data[:-1]))
Y = np.transpose(np.array(data[-1:]))
pos = np... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.ylabel",
"numpy.arange",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.style.use",
"matplotlib.pyplot.pcolormesh",
"sklearn.linear_model.LogisticRegression",
"numpy.array",
"matplotlib.pyplot.figu... | [((104, 136), 'matplotlib.pyplot.style.use', 'plt.style.use', (['"""fivethirtyeight"""'], {}), "('fivethirtyeight')\n", (117, 136), True, 'import matplotlib.pyplot as plt\n'), ((171, 238), 'numpy.loadtxt', 'np.loadtxt', (['datafile'], {'delimiter': '""","""', 'usecols': '(0, 1, 2)', 'unpack': '(True)'}), "(datafile, de... |
# Generated by Django 2.0.9 on 2018-12-02 17:02
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("games", "0008_auto_20181202_1524")]
operations = [
migrations.AddField(
model_name="gamesessionplayersignup",
name="reported",
... | [
"django.db.models.NullBooleanField"
] | [((336, 398), 'django.db.models.NullBooleanField', 'models.NullBooleanField', ([], {'default': 'None', 'verbose_name': '"""Reported"""'}), "(default=None, verbose_name='Reported')\n", (359, 398), False, 'from django.db import migrations, models\n')] |
import pytest
import struct
import math
class STDFRecordTest:
def __init__(self , file, endian, debug = False):
self.file = file
self.endian = endian
self.debug = debug
if (endian == '>'):
self.byteorder = 'big'
elif (endian == '<'):
... | [
"pytest.approx",
"struct.unpack",
"math.ceil"
] | [((1089, 1114), 'math.ceil', 'math.ceil', (['(bits_count / 8)'], {}), '(bits_count / 8)\n', (1098, 1114), False, 'import math\n'), ((2243, 2278), 'struct.unpack', 'struct.unpack', (['format', 'readed_value'], {}), '(format, readed_value)\n', (2256, 2278), False, 'import struct\n'), ((2610, 2645), 'struct.unpack', 'stru... |
from sqlalchemy import Column, Unicode
from . import db, Base
class Place(Base):
__tablename__ = 'places'
path = Column(Unicode(1000), primary_key=True)
name = Column(Unicode(100), unique=True)
description = Column(Unicode(1000))
| [
"sqlalchemy.Unicode"
] | [((128, 141), 'sqlalchemy.Unicode', 'Unicode', (['(1000)'], {}), '(1000)\n', (135, 141), False, 'from sqlalchemy import Column, Unicode\n'), ((178, 190), 'sqlalchemy.Unicode', 'Unicode', (['(100)'], {}), '(100)\n', (185, 190), False, 'from sqlalchemy import Column, Unicode\n'), ((229, 242), 'sqlalchemy.Unicode', 'Unico... |
import arrow
import datetime
from converge import settings
from apphelpers.rest.hug import user_id
from apphelpers.errors import NotFoundError
from app.models import Asset, PendingComment, Comment, Member, groups
from app.libs import comment as commentlib
from app.libs import member as memberlib
from app.libs import p... | [
"app.models.Asset.get_or_none",
"app.models.PendingComment.select",
"app.models.PendingComment.id.desc",
"app.libs.comment.get",
"arrow.utcnow",
"app.models.Asset.select",
"app.models.Asset.update",
"app.models.Asset.created.desc",
"app.models.Comment.id.desc",
"app.models.Comment.select",
"app.... | [((721, 849), 'app.models.Asset.create', 'Asset.create', ([], {'id': 'id', 'url': 'url', 'title': 'title', 'publication': 'publication', 'open_till': 'open_till', 'moderation_policy': 'moderation_policy'}), '(id=id, url=url, title=title, publication=publication,\n open_till=open_till, moderation_policy=moderation_po... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
import journal.models
class Migration(migrations.Migration):
dependencies = [
('auth', '0001_initial'),
]
operations = [
... | [
"django.db.models.EmailField",
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.FileField",
"django.db.models.BooleanField",
"django.db.models.ImageField",
"django.db.models.AutoField",
"django.db.m... | [((19859, 19926), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'to': '"""journal.Review"""', 'verbose_name': '"""Reviews"""'}), "(to='journal.Review', verbose_name='Reviews')\n", (19881, 19926), False, 'from django.db import models, migrations\n'), ((20094, 20167), 'django.db.models.ForeignKey', ... |
import datetime
import time
print(datetime.datetime.now())
dt = datetime.datetime(2019, 10, 21, 16, 29, 0)
print(dt)
print(dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second)
print(datetime.datetime.fromtimestamp(1_000_000_000))
print(datetime.datetime.fromtimestamp(time.time()))
today = datetime.datetime.now()
... | [
"datetime.datetime",
"datetime.datetime.fromtimestamp",
"datetime.datetime.strptime",
"datetime.datetime.now",
"datetime.timedelta",
"time.time"
] | [((65, 107), 'datetime.datetime', 'datetime.datetime', (['(2019)', '(10)', '(21)', '(16)', '(29)', '(0)'], {}), '(2019, 10, 21, 16, 29, 0)\n', (82, 107), False, 'import datetime\n'), ((296, 319), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (317, 319), False, 'import datetime\n'), ((332, 370), 'd... |
from dataclasses import dataclass
import hashlib
import blosc
import numpy as np
def HashedKey(*args, version=None):
""" BOSS Key creation function
Takes a list of different key string elements, joins them with the '&' char,
and prepends the MD5 hash of the key to the key.
Args (Common usage):
... | [
"numpy.frombuffer"
] | [((2670, 2705), 'numpy.frombuffer', 'np.frombuffer', (['rawdata'], {'dtype': 'dtype'}), '(rawdata, dtype=dtype)\n', (2683, 2705), True, 'import numpy as np\n')] |
from __future__ import print_function, division, absolute_import
from llvm.core import Type, Constant
import llvm.core as lc
import llvm.ee as le
from llvm import LLVMException
from numba.config import PYVERSION
import numba.ctypes_support as ctypes
from numba import types, utils, cgutils, _helperlib, assume
_PyNone ... | [
"llvm.core.Type.function",
"llvm.core.Constant.int",
"llvm.core.Type.int",
"numba.cgutils.get_record_data",
"numba.cgutils.alloca_once",
"numba.ctypes_support.sizeof",
"numba.cgutils.init_record_by_ptr",
"numba.cgutils.is_not_null",
"numba.utils.builtins.__dict__.values",
"llvm.core.Type.double",
... | [((921, 953), 'numba.utils.builtins.__dict__.values', 'utils.builtins.__dict__.values', ([], {}), '()\n', (951, 953), False, 'from numba import types, utils, cgutils, _helperlib, assume\n'), ((555, 580), 'numba.ctypes_support.addressof', 'ctypes.addressof', (['_PyNone'], {}), '(_PyNone)\n', (571, 580), True, 'import nu... |
from pathlib import Path
from fastapi import FastAPI, File, UploadFile
from fastapi.responses import HTMLResponse
app = FastAPI()
local_path = '../backend/examples'
@app.post("/media/")
async def upload_file(file: UploadFile = File(...)):
# Upload the file - make it available for the denoiser
content: byte... | [
"fastapi.FastAPI",
"fastapi.File",
"fastapi.responses.HTMLResponse",
"pathlib.Path"
] | [((122, 131), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (129, 131), False, 'from fastapi import FastAPI, File, UploadFile\n'), ((232, 241), 'fastapi.File', 'File', (['...'], {}), '(...)\n', (236, 241), False, 'from fastapi import FastAPI, File, UploadFile\n'), ((785, 814), 'fastapi.responses.HTMLResponse', 'HTMLR... |
from pid import PID
from yaw_controller import YawController
from lowpass import LowPassFilter
import rospy
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
class Controller(object):
def __init__(self, vehicle_mass, fuel_capacity, brake_deadband, decel_limit, accel_limit, wheel_radius, wheel_base, steer_ratio, max_lat_acc... | [
"yaw_controller.YawController",
"rospy.get_time",
"lowpass.LowPassFilter",
"pid.PID"
] | [((427, 512), 'yaw_controller.YawController', 'YawController', (['wheel_base', 'steer_ratio', 'min_speed', 'max_lat_accel', 'max_steer_angle'], {}), '(wheel_base, steer_ratio, min_speed, max_lat_accel,\n max_steer_angle)\n', (440, 512), False, 'from yaw_controller import YawController\n'), ((674, 697), 'pid.PID', 'P... |
# -*- coding: utf-8 -*-
"""Tools for loading, shuffling, and batching ANI datasets
The `torchani.data.load(path)` creates an iterable of raw data,
where species are strings, and coordinates are numpy ndarrays.
You can transform these iterable by using transformations.
To do transformation, just do `it.transformation_... | [
"os.listdir",
"random.shuffle",
"importlib.util.find_spec",
"math.sqrt",
"os.path.join",
"functools.wraps",
"collections.Counter",
"numpy.array",
"os.path.isfile",
"os.path.isdir",
"functools.partial",
"gc.collect",
"numpy.linalg.lstsq"
] | [((4524, 4557), 'importlib.util.find_spec', 'importlib.util.find_spec', (['"""pkbar"""'], {}), "('pkbar')\n", (4548, 4557), False, 'import importlib\n'), ((8171, 8183), 'gc.collect', 'gc.collect', ([], {}), '()\n', (8181, 8183), False, 'import gc\n'), ((9419, 9449), 'math.sqrt', 'math.sqrt', (['(std / n - mean ** 2)'],... |
import numpy as np
from torch.autograd import Variable
import torch as torch
import copy
from torch.autograd.gradcheck import zero_gradients
def deepfool(image, net, num_classes, overshoot, max_iter):
"""
:param image: Image of size HxWx3
:param net: network (input: images, output: values of activa... | [
"torch.autograd.gradcheck.zero_gradients",
"numpy.linalg.norm",
"torch.from_numpy",
"numpy.zeros",
"torch.cuda.is_available",
"copy.deepcopy",
"torch.autograd.Variable",
"numpy.float32"
] | [((799, 824), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (822, 824), True, 'import torch as torch\n'), ((1140, 1160), 'copy.deepcopy', 'copy.deepcopy', (['image'], {}), '(image)\n', (1153, 1160), False, 'import copy\n'), ((1169, 1190), 'numpy.zeros', 'np.zeros', (['input_shape'], {}), '(inp... |
import urllib2
import json
import simplejson
import nltk
from nltk import word_tokenize
from nltk.tokenize import RegexpTokenizer
import requests
def run(term=""):
url=''+term
r=requests.get(url)
data=r.json()
titles=[]
for hit in data['hits']['hits']:
titles.append(hit['_source']['title'])
return json.dumps... | [
"json.dumps",
"requests.get"
] | [((182, 199), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (194, 199), False, 'import requests\n'), ((310, 328), 'json.dumps', 'json.dumps', (['titles'], {}), '(titles)\n', (320, 328), False, 'import json\n')] |
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
admin.autodiscover()
urlpatterns = patterns('',
url(r'^admin/', include(admin.site.urls)),
url(r'^crs/$', 'login.views.login'),
# url(r'^captcha/'... | [
"django.conf.urls.include",
"django.conf.urls.static.static",
"django.conf.urls.url",
"django.contrib.admin.autodiscover"
] | [((161, 181), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (179, 181), False, 'from django.contrib import admin\n'), ((5070, 5131), 'django.conf.urls.static.static', 'static', (['settings.MEDIA_URL'], {'document_root': 'settings.MEDIA_ROOT'}), '(settings.MEDIA_URL, document_root=settings... |
import tweepy , tkinter, datetime, os, sys, random, time, pytz
from keys import *
from tweepy import TweepError
#Create oauth handler for tokens setting
auth = tweepy.OAuthHandler(consumer_token, consumer_secret)
auth.set_access_token(key,secret)
api = tweepy.API(auth)
random_lyrics = 'Lyrics.txt'
t... | [
"pytz.timezone",
"random.randrange",
"time.sleep",
"tweepy.API",
"tweepy.OAuthHandler"
] | [((170, 222), 'tweepy.OAuthHandler', 'tweepy.OAuthHandler', (['consumer_token', 'consumer_secret'], {}), '(consumer_token, consumer_secret)\n', (189, 222), False, 'import tweepy, tkinter, datetime, os, sys, random, time, pytz\n'), ((267, 283), 'tweepy.API', 'tweepy.API', (['auth'], {}), '(auth)\n', (277, 283), False, '... |
import sys
from lib.canvas import create_canvas, draw_pencils
def main(pencils, test=False):
window = create_canvas()
draw_pencils(pencils)
if test:
return
window.mainloop()
if __name__ == "__main__":
p1 = 'красный', 5.3, True
p2 = 'желтый', 15.3, True
p3 = 'синий',... | [
"lib.canvas.create_canvas",
"lib.canvas.draw_pencils",
"sys.exit"
] | [((109, 124), 'lib.canvas.create_canvas', 'create_canvas', ([], {}), '()\n', (122, 124), False, 'from lib.canvas import create_canvas, draw_pencils\n'), ((129, 150), 'lib.canvas.draw_pencils', 'draw_pencils', (['pencils'], {}), '(pencils)\n', (141, 150), False, 'from lib.canvas import create_canvas, draw_pencils\n'), (... |
import unittest
from test.test_case import TestCase
from tr_cli.cli import Cli
class TestCli(TestCase):
_cli = None
def setUp(self) -> None:
super().setUp()
self._mock_yaml.load.return_value = {'auth': {
'user_id': 'user_id',
'token': 'token'
}}
self.... | [
"unittest.main"
] | [((1730, 1745), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1743, 1745), False, 'import unittest\n')] |
#!/usr/bin/env python
# encoding: utf-8
# The MIT License (MIT)
# Copyright (c) 2018-2020 CNRS
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limita... | [
"torch.nn.Sigmoid",
"numpy.int64",
"torch.nn.Sequential",
"torch.load",
"numpy.sum",
"torch.tensor",
"torch.nn.MSELoss",
"torch.nn.NLLLoss",
"torch.sparse.torch.eye",
"torch.nn.LogSoftmax",
"torch.nn.Linear"
] | [((4880, 4912), 'numpy.sum', 'np.sum', (['Y'], {'axis': '(1)', 'keepdims': '(True)'}), '(Y, axis=1, keepdims=True)\n', (4886, 4912), True, 'import numpy as np\n'), ((4967, 4994), 'numpy.int64', 'np.int64', (['(speaker_count > 0)'], {}), '(speaker_count > 0)\n', (4975, 4994), True, 'import numpy as np\n'), ((9820, 9884)... |
from rest_framework import serializers
from enterprise_manage.apps.score_center.models import *
class ScoreResultSerializer(serializers.ModelSerializer):
user_photo = serializers.CharField(source='user_photo.url')
class Meta:
model = UserProfile
fields = ['name', 'user_photo']
class ScoreP... | [
"rest_framework.serializers.CharField"
] | [((174, 220), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'source': '"""user_photo.url"""'}), "(source='user_photo.url')\n", (195, 220), False, 'from rest_framework import serializers\n')] |
import os
from src.multi_site_inputs_parser import multi_site_csv_parser
from src.parse_api_responses_to_csv import parse_responses_to_csv_with_template
from src.post_and_poll import get_api_results
from src.parse_api_responses_to_excel import parse_api_responses_to_excel
"""
Change these values
"""
##################... | [
"src.multi_site_inputs_parser.multi_site_csv_parser",
"src.parse_api_responses_to_excel.parse_api_responses_to_excel",
"src.parse_api_responses_to_csv.parse_responses_to_csv_with_template",
"os.path.join"
] | [((479, 501), 'os.path.join', 'os.path.join', (['"""inputs"""'], {}), "('inputs')\n", (491, 501), False, 'import os\n'), ((517, 540), 'os.path.join', 'os.path.join', (['"""outputs"""'], {}), "('outputs')\n", (529, 540), False, 'import os\n'), ((559, 609), 'os.path.join', 'os.path.join', (['outputs_path', '"""results_te... |
import click
import json
import sys
import flair
import torch
from typing import List
from flair.data import MultiCorpus
from flair.datasets import ColumnCorpus, NER_HIPE_2022
from flair.embeddings import (
TokenEmbeddings,
StackedEmbeddings,
TransformerWordEmbeddings
)
from flair import set_seed
from fl... | [
"flair.trainers.ModelTrainer",
"flair.embeddings.TransformerWordEmbeddings",
"flair.datasets.NER_HIPE_2022",
"flair.set_seed",
"json.load",
"flair.models.SequenceTagger",
"flair.data.MultiCorpus"
] | [((1116, 1130), 'flair.set_seed', 'set_seed', (['seed'], {}), '(seed)\n', (1124, 1130), False, 'from flair import set_seed\n'), ((2637, 2698), 'flair.data.MultiCorpus', 'MultiCorpus', ([], {'corpora': 'corpus_list', 'sample_missing_splits': '(False)'}), '(corpora=corpus_list, sample_missing_splits=False)\n', (2648, 269... |
import arcade
TILE_SCALING = 1.0
def test_csv_left_up():
# Read in the tiled map
my_map = arcade.load_tilemap("../tiled_maps/csv_left_up_embedded.json")
assert my_map.tile_width == 128
assert my_map.tile_height == 128
assert my_map.width == 10
assert my_map.height == 10
# --- Platforms ... | [
"arcade.load_tilemap"
] | [((101, 163), 'arcade.load_tilemap', 'arcade.load_tilemap', (['"""../tiled_maps/csv_left_up_embedded.json"""'], {}), "('../tiled_maps/csv_left_up_embedded.json')\n", (120, 163), False, 'import arcade\n'), ((805, 870), 'arcade.load_tilemap', 'arcade.load_tilemap', (['"""../tiled_maps/csv_right_down_external.json"""'], {... |
#!/usr/bin/env python
from __future__ import print_function
from argparse import ArgumentParser
from androguard.cli import androlyze_main
from androguard.core.androconf import *
from androguard.misc import *
import os
import sql
import sqlstorehash
LIST_NAME_METHODS=["sendBroadcast", "onReceive","startService","onHan... | [
"sql.CheckExist",
"os.listdir",
"sqlstorehash.hashMd5Sha1Sha256",
"sql.InsertApp"
] | [((2439, 2461), 'os.listdir', 'os.listdir', (['pathFolder'], {}), '(pathFolder)\n', (2449, 2461), False, 'import os\n'), ((2815, 2849), 'sqlstorehash.hashMd5Sha1Sha256', 'sqlstorehash.hashMd5Sha1Sha256', (['lp'], {}), '(lp)\n', (2845, 2849), False, 'import sqlstorehash\n'), ((2515, 2537), 'os.listdir', 'os.listdir', ([... |
import FWCore.ParameterSet.Config as cms
'''
Configuration for Pi Zero producer plugins.
Author: <NAME>, UC Davis
'''
from RecoTauTag.RecoTau.PFRecoTauQualityCuts_cfi import PFTauQualityCuts
# Produce a PiZero candidate for each photon - the "trivial" case
allSinglePhotons = cms.PSet(
name = cms.string("1"),
... | [
"FWCore.ParameterSet.Config.string",
"FWCore.ParameterSet.Config.double",
"FWCore.ParameterSet.Config.vint32",
"FWCore.ParameterSet.Config.int32",
"FWCore.ParameterSet.Config.uint32",
"FWCore.ParameterSet.Config.bool"
] | [((303, 318), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""1"""'], {}), "('1')\n", (313, 318), True, 'import FWCore.ParameterSet.Config as cms\n'), ((333, 373), 'FWCore.ParameterSet.Config.string', 'cms.string', (['"""RecoTauPiZeroTrivialPlugin"""'], {}), "('RecoTauPiZeroTrivialPlugin')\n", (343, 373), True... |
# 首先需要加入以下的路径到环境变量,因为当前只对内部测试开放,所以需要手动申明一下路径
import os
os.environ['FASTNLP_BASE_URL'] = 'http://10.141.222.118:8888/file/download/'
os.environ['FASTNLP_CACHE_DIR'] = '/remote-home/hyan01/fastnlp_caches'
from fastNLP.io.data_loader import IMDBLoader
from fastNLP.embeddings import StaticEmbedding
from model.lstm import ... | [
"model.lstm.BiLSTMSentiment",
"fastNLP.embeddings.StaticEmbedding",
"fastNLP.Trainer",
"fastNLP.CrossEntropyLoss",
"fastNLP.io.data_loader.IMDBLoader",
"fastNLP.AccuracyMetric"
] | [((744, 756), 'fastNLP.io.data_loader.IMDBLoader', 'IMDBLoader', ([], {}), '()\n', (754, 756), False, 'from fastNLP.io.data_loader import IMDBLoader\n'), ((910, 996), 'fastNLP.embeddings.StaticEmbedding', 'StaticEmbedding', (['vocab'], {'model_dir_or_name': '"""en-glove-840b-300"""', 'requires_grad': '(True)'}), "(voca... |
import os
import re
import dgl
import numpy as np
from data import *
def get_edgelists(edgelist_expression, directory):
if "," in edgelist_expression:
return edgelist_expression.split(",")
files = os.listdir(directory)
compiled_expression = re.compile(edgelist_expression)
return [filename for... | [
"os.listdir",
"dgl.heterograph",
"dgl.graph",
"re.compile",
"os.path.join",
"numpy.array"
] | [((216, 237), 'os.listdir', 'os.listdir', (['directory'], {}), '(directory)\n', (226, 237), False, 'import os\n'), ((264, 295), 're.compile', 're.compile', (['edgelist_expression'], {}), '(edgelist_expression)\n', (274, 295), False, 'import re\n'), ((1942, 1968), 'dgl.heterograph', 'dgl.heterograph', (['edgelists'], {}... |
try: # import the important library
from urllib import request
from urllib.request import urlopen
import threading # import threadding
import json # import json
import random # import random
impo... | [
"geocoder.ip",
"json.loads",
"requests.post",
"Adafruit_IO.Client",
"ssl._create_unverified_context",
"requests.get",
"datetime.datetime.now",
"serial.Serial",
"requests.put",
"datetime.fromtimestamp",
"urllib.request.urlopen"
] | [((5189, 5222), 'datetime.fromtimestamp', 'datetime.fromtimestamp', (['timestamp'], {}), '(timestamp)\n', (5211, 5222), False, 'import datetime\n'), ((7401, 7436), 'Adafruit_IO.Client', 'Client', (['self.username', 'self.Aio_key'], {}), '(self.username, self.Aio_key)\n', (7407, 7436), False, 'from Adafruit_IO import Cl... |
'''
MAP Client, a program to generate detailed musculoskeletal models for OpenSim.
Copyright (C) 2012 University of Auckland
This file is part of MAP Client. (http://launchpad.net/mapclient)
MAP Client is free software: you can redistribute it and/or modify
it under the terms of the GNU Genera... | [
"gias2.mappluginutils.mayaviviewer.MayaviViewerObjectsContainer",
"traits.api.on_trait_change",
"PySide2.QtGui.QIntValidator",
"PySide2.QtWidgets.QTableWidgetItem",
"numpy.array",
"PySide2.QtWidgets.QDialog.__init__",
"mapclientplugins.pelvislandmarkshjcpredictionstep.ui_hjcpredictionviewerwidget.Ui_Dia... | [((13893, 13927), 'traits.api.on_trait_change', 'on_trait_change', (['"""scene.activated"""'], {}), "('scene.activated')\n", (13908, 13927), False, 'from traits.api import HasTraits, Instance, on_trait_change, Int, Dict\n'), ((1983, 2013), 'PySide2.QtWidgets.QDialog.__init__', 'QDialog.__init__', (['self', 'parent'], {... |
from protocol import ServerProtocol
from protocol.models.client_keys import ClientKeys
from protocol.models.server_messages import BroadCastClientKeys, ServerKeyBroadcast
def test_server_protocol_broadcast_keys():
protocol = ServerProtocol()
# generate key broadcasts
broadcasts = []
for i in range(5)... | [
"protocol.ServerProtocol",
"protocol.models.server_messages.BroadCastClientKeys",
"protocol.models.client_keys.ClientKeys"
] | [((231, 247), 'protocol.ServerProtocol', 'ServerProtocol', ([], {}), '()\n', (245, 247), False, 'from protocol import ServerProtocol\n'), ((337, 349), 'protocol.models.client_keys.ClientKeys', 'ClientKeys', ([], {}), '()\n', (347, 349), False, 'from protocol.models.client_keys import ClientKeys\n'), ((421, 475), 'proto... |
import numpy as np
import autoarray as aa
import autogalaxy as ag
from autolens.lens.model.result import ResultDataset
class ResultInterferometer(ResultDataset):
@property
def max_log_likelihood_fit(self):
return self.analysis.fit_interferometer_for_instance(instance=self.instance)
... | [
"autoarray.Visibilities.zeros"
] | [((2240, 2333), 'autoarray.Visibilities.zeros', 'aa.Visibilities.zeros', ([], {'shape_slim': '(self.max_log_likelihood_fit.visibilities.shape_slim,)'}), '(shape_slim=(self.max_log_likelihood_fit.visibilities.\n shape_slim,))\n', (2261, 2333), True, 'import autoarray as aa\n')] |
# To add a new cell, type '# %%'
# To add a new markdown cell, type '# %% [markdown]'
# # 3.3 线性回归的简洁实现
import torch
from torch import nn
import numpy as np
torch.manual_seed(1)
print(torch.__version__)
torch.set_default_tensor_type('torch.FloatTensor')
# ## 3.3.1 生成数据集
num_inputs = 2
num_examples = 1000
true_w = ... | [
"numpy.random.normal",
"torch.manual_seed",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.utils.data.TensorDataset",
"torch.set_default_tensor_type",
"torch.nn.MSELoss",
"torch.nn.Linear",
"torch.utils.data.DataLoader",
"torch.nn.init.normal_"
] | [((158, 178), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (175, 178), False, 'import torch\n'), ((205, 255), 'torch.set_default_tensor_type', 'torch.set_default_tensor_type', (['"""torch.FloatTensor"""'], {}), "('torch.FloatTensor')\n", (234, 255), False, 'import torch\n'), ((695, 731), 'torch.uti... |
from direct.directnotify import DirectNotifyGlobal
from toontown.coghq.DistributedCogHQDoorAI import DistributedCogHQDoorAI
class DistributedSellbotHQDoorAI(DistributedCogHQDoorAI):
notify = DirectNotifyGlobal.directNotify.newCategory("DistributedSellbotHQDoorAI")
def informPlayer(self, todo0):
pass
| [
"direct.directnotify.DirectNotifyGlobal.directNotify.newCategory"
] | [((196, 269), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'DirectNotifyGlobal.directNotify.newCategory', (['"""DistributedSellbotHQDoorAI"""'], {}), "('DistributedSellbotHQDoorAI')\n", (239, 269), False, 'from direct.directnotify import DirectNotifyGlobal\n')] |
from setuptools import find_packages, setup
requires = ["google-auth", "gspread", "requests"]
with open("README.md", "r", encoding="utf-8") as f:
readme = f.read()
setup(
name="gssetting",
version="0.0.1",
description="Load setting value from Google Sheets",
long_description=readme,
long_desc... | [
"setuptools.find_packages"
] | [((500, 515), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (513, 515), False, 'from setuptools import find_packages, setup\n')] |
import csv
import insertdb
import cv2
import numpy as np
####################################department insertion##########################
departmentDb = {
"1": "Department of Architecture",
"2": "Department of Civil Engineering",
"3": "Department of Electrical Engineering",
"4": "Department of Mechan... | [
"insertdb.insertDepartment",
"insertdb.insertSubject",
"csv.DictReader",
"insertdb.insertClass",
"insertdb.insertIntoTeaches",
"insertdb.insertAdmin",
"insertdb.insertStudent",
"insertdb.insertTeacher"
] | [((5356, 5400), 'insertdb.insertTeacher', 'insertdb.insertTeacher', (['"""001"""', '"""<NAME>"""', '"""5"""'], {}), "('001', '<NAME>', '5')\n", (5378, 5400), False, 'import insertdb\n'), ((5470, 5532), 'insertdb.insertIntoTeaches', 'insertdb.insertIntoTeaches', (['"""001"""', '"""PUL075BCTCD"""', '"""CT652"""', '"""6""... |
import unittest
import os
import evacsim.node
import evacsim.edge
import evacsim.disaster
import evacsim.exporter
class TestExporter(unittest.TestCase):
"""Tests functionality in the exporter module. There isn't much to be tested here, so it simply tests
that a KML file with the proper name is created when ... | [
"os.path.exists",
"os.remove"
] | [((936, 957), 'os.remove', 'os.remove', (['"""test.kml"""'], {}), "('test.kml')\n", (945, 957), False, 'import os\n'), ((900, 926), 'os.path.exists', 'os.path.exists', (['"""test.kml"""'], {}), "('test.kml')\n", (914, 926), False, 'import os\n')] |
from matplotlib.pyplot import figure
import xarray
import numpy as np
__all__ = ["precip", "ver"]
def density(iono: xarray.Dataset):
fig = figure()
axs = fig.subplots(1, 2, sharey=True)
fig.suptitle("Number Density")
ax = axs[0]
for v in ("O", "N2", "O2", "NO"):
ax.plot(iono[v], iono[v]... | [
"matplotlib.pyplot.figure",
"numpy.isnan",
"numpy.nanmax"
] | [((146, 154), 'matplotlib.pyplot.figure', 'figure', ([], {}), '()\n', (152, 154), False, 'from matplotlib.pyplot import figure\n'), ((1909, 1940), 'matplotlib.pyplot.figure', 'figure', ([], {'constrained_layout': '(True)'}), '(constrained_layout=True)\n', (1915, 1940), False, 'from matplotlib.pyplot import figure\n'), ... |
import os
import numpy as np
def getParamsFromInfo(folder):
infoFiles = ["criterion", "test_criterion", "test_loader", "train_loader", "opimizer", "test_data_set", "train_data_set", "weight"]
for idx, f in enumerate(infoFiles):
infoFiles[i] = os.path.join(folder, f+"_info.txt")
criterion = get... | [
"numpy.array",
"os.path.join"
] | [((1844, 1864), 'numpy.array', 'np.array', (['levelrange'], {}), '(levelrange)\n', (1852, 1864), True, 'import numpy as np\n'), ((260, 297), 'os.path.join', 'os.path.join', (['folder', "(f + '_info.txt')"], {}), "(folder, f + '_info.txt')\n", (272, 297), False, 'import os\n')] |
import json
import os
from nmfamv2.graphics import MetaboliteGraphic, MixtureGraphic, ScaledGraphic
class RunLog:
def __init__(self, user_dir):
self.user_dir = user_dir
self.top_dirname = os.path.join(user_dir, "logs")
self.mixture_dir = os.path.join(self.top_dirname, "mixtures")
... | [
"nmfamv2.graphics.MixtureGraphic",
"json.dumps",
"os.path.join",
"nmfamv2.spectrum.Spectrum",
"nmfamv2.graphics.ScaledGraphic",
"os.path.isdir",
"os.mkdir",
"nmfamv2.metabolite.metabolite.Metabolite",
"nmfamv2.graphics.MetaboliteGraphic"
] | [((2374, 2434), 'nmfamv2.spectrum.Spectrum', 'Spectrum', (['[0, 1, 2, 3, 4, 5, 6, 7]', '[1, 1, 1, 1, 1, 1, 1, 1]'], {}), '([0, 1, 2, 3, 4, 5, 6, 7], [1, 1, 1, 1, 1, 1, 1, 1])\n', (2382, 2434), False, 'from nmfamv2.spectrum import Spectrum\n'), ((3422, 3482), 'nmfamv2.spectrum.Spectrum', 'Spectrum', (['[0, 1, 2, 3, 4, 5... |
from __future__ import annotations
import collections
import functools
import operator
import os
import re
from dataclasses import dataclass
from typing import NewType
Ingredient = NewType('Ingredient', str)
Allergen = NewType('Allergen', str)
RECIPE_RE = re.compile(
r'(?P<ingredients>\w+(?: \w+)*) '
r'\(con... | [
"re.compile",
"functools.reduce",
"os.path.join",
"typing.NewType",
"os.path.abspath"
] | [((183, 209), 'typing.NewType', 'NewType', (['"""Ingredient"""', 'str'], {}), "('Ingredient', str)\n", (190, 209), False, 'from typing import NewType\n'), ((221, 245), 'typing.NewType', 'NewType', (['"""Allergen"""', 'str'], {}), "('Allergen', str)\n", (228, 245), False, 'from typing import NewType\n'), ((259, 360), 'r... |
from __future__ import division
import numpy as np
from scipy.optimize import fmin_bfgs
from itertools import combinations_with_replacement
import causalinference.utils.tools as tools
from .data import Dict
class Propensity(Dict):
"""
Dictionary-like class containing propensity score data.
Propensity score rel... | [
"causalinference.utils.tools.gen_reg_entries",
"causalinference.utils.tools.add_line",
"numpy.exp",
"numpy.dot",
"numpy.zeros",
"numpy.empty",
"numpy.linalg.inv",
"causalinference.utils.tools.add_row",
"itertools.combinations_with_replacement"
] | [((3478, 3498), 'numpy.empty', 'np.empty', (['x.shape[0]'], {}), '(x.shape[0])\n', (3486, 3498), True, 'import numpy as np\n'), ((3762, 3782), 'numpy.empty', 'np.empty', (['x.shape[0]'], {}), '(x.shape[0])\n', (3770, 3782), True, 'import numpy as np\n'), ((4408, 4442), 'numpy.dot', 'np.dot', (['(phat * (1 - phat) * X.T... |
"""
Simple demo of microservice in Flask.
Personal project for learning Flask and Docker.
The app returns a list of files and folders and some of their properties
from given subdirectory of a directory specified in 'cofig.py'.
$ pip install -r requirements.txt
$ python -m microservice_demo.app
"""
import log... | [
"logging.basicConfig",
"string.Template",
"flask.Flask",
"logging.warning",
"os.environ.get",
"waitress.serve",
"microservice_demo.dir_data.get_dir_data",
"re.findall",
"flask.jsonify"
] | [((546, 561), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (551, 561), False, 'from flask import Flask, jsonify\n'), ((612, 720), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""[%(asctime)s] %(message)s"""', 'datefmt': '"""%d-%m-%y %H:%M:%S"""'}), "(level=loggi... |
#!/usr/bin/env python
import wx
# use the numpy code instead of the raw access code for comparison
USE_NUMPY = False
# time the execution of making a bitmap?
TIMEIT = False
# how big to make the bitmaps
DIM = 100
# should we use a wx.GraphicsContext for painting?
TEST_GC = False
#---------------------------------... | [
"wx.PaintDC",
"timeit.Timer",
"wx.BitmapFromBufferRGBA",
"numpy.empty",
"wx.AlphaPixelData",
"wx.GraphicsContext.Create",
"os.path.basename",
"numarray.array",
"wx.Bitmap",
"wx.Panel.__init__"
] | [((1051, 1086), 'wx.Panel.__init__', 'wx.Panel.__init__', (['self', 'parent', '(-1)'], {}), '(self, parent, -1)\n', (1068, 1086), False, 'import wx\n'), ((2284, 2300), 'wx.PaintDC', 'wx.PaintDC', (['self'], {}), '(self)\n', (2294, 2300), False, 'import wx\n'), ((3016, 3039), 'wx.Bitmap', 'wx.Bitmap', (['DIM', 'DIM', '(... |
# coding=utf-8
import os
__author__ = 'zephor'
ROOT = os.path.abspath(os.path.dirname(__file__))
DATA_RAW = os.path.join(ROOT, 'data_raw/')
DATA_PREPROCESSED = os.path.join(ROOT, 'data_prep/')
DATA_NAMED = os.path.join(ROOT, 'data_named/')
| [
"os.path.dirname",
"os.path.join"
] | [((111, 142), 'os.path.join', 'os.path.join', (['ROOT', '"""data_raw/"""'], {}), "(ROOT, 'data_raw/')\n", (123, 142), False, 'import os\n'), ((163, 195), 'os.path.join', 'os.path.join', (['ROOT', '"""data_prep/"""'], {}), "(ROOT, 'data_prep/')\n", (175, 195), False, 'import os\n'), ((209, 242), 'os.path.join', 'os.path... |
from dataserv_client import common
import os
import tempfile
import unittest
import datetime
import json
import psutil
from future.moves.urllib.request import urlopen
from dataserv_client import cli
from dataserv_client import api
from btctxstore import BtcTxStore
from dataserv_client import exceptions
url = "http://... | [
"dataserv_client.cli.main",
"dataserv_client.api.Client",
"psutil.disk_usage",
"json.dumps",
"dataserv_client.common.address2nodeid",
"future.moves.urllib.request.urlopen",
"btctxstore.BtcTxStore",
"tempfile.mktemp",
"datetime.datetime.now",
"datetime.timedelta",
"os.mkdir",
"unittest.main",
... | [((13991, 14039), 'unittest.skip', 'unittest.skip', (['"""to many blockchain api requests"""'], {}), "('to many blockchain api requests')\n", (14004, 14039), False, 'import unittest\n'), ((19036, 19051), 'unittest.main', 'unittest.main', ([], {}), '()\n', (19049, 19051), False, 'import unittest\n'), ((484, 496), 'btctx... |
import sys
import base64
import json
import os.path
if len(sys.argv) < 3:
print("USAGE: pdfp-extract.py [pdfp_path] [output_path]")
sys.exit()
f = open(sys.argv[1])
pdfp = f.read()
f.close()
pdfp = pdfp.replace("local_pdf(", "").replace(")", "")
pdfp = json.loads(pdfp)
pdf = base64.b64decode(pdfp['pdf'])
... | [
"json.loads",
"base64.b64decode",
"sys.exit"
] | [((266, 282), 'json.loads', 'json.loads', (['pdfp'], {}), '(pdfp)\n', (276, 282), False, 'import json\n'), ((290, 319), 'base64.b64decode', 'base64.b64decode', (["pdfp['pdf']"], {}), "(pdfp['pdf'])\n", (306, 319), False, 'import base64\n'), ((142, 152), 'sys.exit', 'sys.exit', ([], {}), '()\n', (150, 152), False, 'impo... |
"""
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 use this ... | [
"train_test.validation.validation",
"torch.nn.CrossEntropyLoss",
"utils.optimizer_option.get_optimizer",
"utils.load_data.load_mnist",
"torch.nn.MSELoss",
"utils.load_data.load_tiny_imagenet",
"utils.load_data.load_cifar10",
"utils.load_data.load_svhn",
"utils.lr_decay.adjust_lr",
"utils.load_data... | [((2580, 2601), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (2599, 2601), True, 'import torch.nn as nn\n'), ((2622, 2634), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (2632, 2634), True, 'import torch.nn as nn\n'), ((2651, 2691), 'utils.optimizer_option.get_optimizer', 'get_optimizer',... |
################################################################
# Copyright 2012 Sheffler
################################################################
try:
import pkg_resources
version = pkg_resources.require("StreamProx")[0].version
except:
## i.e. no setuptools or no package installed ...
versio... | [
"pkg_resources.require"
] | [((201, 236), 'pkg_resources.require', 'pkg_resources.require', (['"""StreamProx"""'], {}), "('StreamProx')\n", (222, 236), False, 'import pkg_resources\n')] |
# Generated by Django 2.0.5 on 2018-05-22 21:02
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('room', '0006_room_grid_size'),
('enemy', '0006_auto_20180522_1953'),
]
operations = [
migrations.Cr... | [
"django.db.models.OneToOneField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((610, 666), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""enemy"""', 'name': '"""tiles"""'}), "(model_name='enemy', name='tiles')\n", (632, 666), False, 'from django.db import migrations, models\n'), ((807, 914), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'blank'... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from misc.utils import initialize_weights
class BasicConv(nn.Module):
def __init__(self, in_channels, out_channels, use_bn=False, **kwargs):
super(BasicConv, self).__init__()
self.use_bn = use_bn
self.conv = nn.Conv2d(in_ch... | [
"torch.nn.InstanceNorm2d",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.functional.relu",
"torch.nn.ConvTranspose2d",
"torch.cat"
] | [((305, 373), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'out_channels'], {'bias': '(not self.use_bn)'}), '(in_channels, out_channels, bias=not self.use_bn, **kwargs)\n', (314, 373), True, 'import torch.nn as nn\n'), ((580, 603), 'torch.nn.functional.relu', 'F.relu', (['x'], {'inplace': '(True)'}), '(x, inplace=T... |
import unittest
from bisect import bisect_right
from time import time
from namedlist import namedlist
Process = namedlist('Process', ['name', 'ti', 't', ('tf', None), ('T', None), ('E', None), ('I', None)])
def find_le(a, x, lo, hi):
# Find rightmost value less than or equal to x
i = bisect_right(a, x, lo, ... | [
"unittest.main",
"namedlist.namedlist",
"bisect.bisect_right"
] | [((114, 212), 'namedlist.namedlist', 'namedlist', (['"""Process"""', "['name', 'ti', 't', ('tf', None), ('T', None), ('E', None), ('I', None)]"], {}), "('Process', ['name', 'ti', 't', ('tf', None), ('T', None), ('E',\n None), ('I', None)])\n", (123, 212), False, 'from namedlist import namedlist\n'), ((297, 323), 'bi... |
import unittest # Importing the unittest module
from credential import Credential # Importing the credential class
class TestCredential(unittest.TestCase):
'''
Test class that defines test cases for the credential class behaviours.
Args:
unittest.TestCase: TestCase class that helps in creating te... | [
"credential.Credential.find_by_username",
"credential.Credential",
"credential.Credential.display_credentials",
"unittest.main",
"credential.Credential.credential_exist"
] | [((3348, 3363), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3361, 3363), False, 'import unittest\n'), ((465, 512), 'credential.Credential', 'Credential', (['"""instagram"""', '"""ironman"""', '"""ironman20"""'], {}), "('instagram', 'ironman', 'ironman20')\n", (475, 512), False, 'from credential import Credenti... |
from __future__ import annotations
from ..typecheck import *
from ..import core
from ..import ui
from ..debugger import dap
from ..views.input_list_view import InputListView
from ..import commands
from ..import settings
from .import util
import re
import threading
class LLDBTransport(dap.SocketTransport):
def ... | [
"threading.Thread"
] | [((569, 644), 'threading.Thread', 'threading.Thread', ([], {'target': 'self._read', 'args': '(self.process.stderr, log_stderr)'}), '(target=self._read, args=(self.process.stderr, log_stderr))\n', (585, 644), False, 'import threading\n')] |
# <NAME> (github: @elaguerta)
# LBNL GIG
# File created: 19 February 2021
# Create NR3 Solution class, a namespace for calculations used by nr3
from . solution import Solution
from . circuit import Circuit
import numpy as np
from . nr3_lib.compute_NR3FT import compute_NR3FT
from . nr3_lib.compute_NR3JT import compute_... | [
"numpy.abs",
"numpy.sqrt",
"numpy.ones",
"numpy.array",
"numpy.zeros",
"numpy.linalg.inv",
"numpy.sin"
] | [((1776, 1865), 'numpy.zeros', 'np.zeros', (['(2 * 3 * (nnode + nline) + 2 * tf_lines + 2 * 2 * vr_lines, 1)'], {'dtype': 'float'}), '((2 * 3 * (nnode + nline) + 2 * tf_lines + 2 * 2 * vr_lines, 1),\n dtype=float)\n', (1784, 1865), True, 'import numpy as np\n'), ((3627, 3716), 'numpy.zeros', 'np.zeros', (['(6, 2 * 3... |
'''
Unit tests for wind.py
'''
import unittest
import datetime
import pytz
import pandas as pd
import numpy as np
from envirodataqc import wind
class test_wind(unittest.TestCase):
def setUp(self):
'''
Create a pandas dataframe for tests
This dataset is somewhat arbitrary but meant to
... | [
"datetime.datetime",
"pytz.timezone",
"pandas.DataFrame",
"envirodataqc.wind.check_windsp_ratio",
"unittest.main"
] | [((2301, 2316), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2314, 2316), False, 'import unittest\n'), ((1121, 1184), 'pandas.DataFrame', 'pd.DataFrame', (["{'spvals': spvals, 'dirvals': dirvals}"], {'index': 'dts'}), "({'spvals': spvals, 'dirvals': dirvals}, index=dts)\n", (1133, 1184), True, 'import pandas as... |
from collator import Collator
from database import Database
from driver import Driver
from extractor import Extractor
from parser import Parser
from pathlib import Path
import sys, os, json
class Schema():
# Schema get the input from the Collator and the Extractor to feed the Parser
# and generate a list of re... | [
"os.path.exists",
"driver.Driver",
"os.makedirs",
"pathlib.Path",
"collator.Collator",
"parser.Parser",
"extractor.Extractor",
"json.dump"
] | [((407, 425), 'collator.Collator', 'Collator', (['database'], {}), '(database)\n', (415, 425), False, 'from collator import Collator\n'), ((452, 463), 'extractor.Extractor', 'Extractor', ([], {}), '()\n', (461, 463), False, 'from extractor import Extractor\n'), ((487, 495), 'parser.Parser', 'Parser', ([], {}), '()\n', ... |
import click
import time
import gi
gi.require_version('Notify', '0.7')
from gi.repository import Notify
Notify.init("Pypom")
#countdown code
def countdown(t):
t = t*60
while t:
mins, secs = divmod(t, 60)
timeformat = '{:02d}:{:02d}'.format(mins, secs)
print(timeformat, end='\r')
... | [
"click.option",
"gi.repository.Notify.uninit",
"gi.require_version",
"time.sleep",
"gi.repository.Notify.Notification.new",
"gi.repository.Notify.init",
"click.command"
] | [((35, 70), 'gi.require_version', 'gi.require_version', (['"""Notify"""', '"""0.7"""'], {}), "('Notify', '0.7')\n", (53, 70), False, 'import gi\n'), ((104, 124), 'gi.repository.Notify.init', 'Notify.init', (['"""Pypom"""'], {}), "('Pypom')\n", (115, 124), False, 'from gi.repository import Notify\n'), ((371, 386), 'clic... |
import datetime as dt
import logging
import time
import os
def date_hash():
return dt.datetime.now().strftime('%y%m%d%H%M') + str(hash(time.time()))[:4]
def print_log(fname, content):
logging.basicConfig(filename=os.path.join(fname + '.log'), level=logging.ERROR)
logger = logging.getLogger('model')
... | [
"logging.getLogger",
"datetime.datetime.now",
"os.path.join",
"time.time"
] | [((289, 315), 'logging.getLogger', 'logging.getLogger', (['"""model"""'], {}), "('model')\n", (306, 315), False, 'import logging\n'), ((225, 253), 'os.path.join', 'os.path.join', (["(fname + '.log')"], {}), "(fname + '.log')\n", (237, 253), False, 'import os\n'), ((89, 106), 'datetime.datetime.now', 'dt.datetime.now', ... |
import random
import string
from django.contrib.auth import get_user_model
from comments.models import Comment
from recipes.models import Recipe
User = get_user_model()
def random_comment(recipe):
length = random.randint(50, 1000)
text = "".join([random.choice(string.printable) for _ in range(length)])
... | [
"django.contrib.auth.get_user_model",
"comments.models.Comment",
"random.randint",
"random.choice"
] | [((156, 172), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (170, 172), False, 'from django.contrib.auth import get_user_model\n'), ((215, 239), 'random.randint', 'random.randint', (['(50)', '(1000)'], {}), '(50, 1000)\n', (229, 239), False, 'import random\n'), ((465, 509), 'comments.models.... |
from django.conf.urls import patterns, url
from cms import views
urlpatterns = [
url(r'^record/$', views.record_list, name='record_list'), # List
url(r'^record/add/$', views.record_edit, name='record_add'), # Add
url(r'^record/mod/(?P<record_id>\d+)/$', views.record_edit, name='record_mod'), # Edit
... | [
"django.conf.urls.url",
"cms.views.ReviewList.as_view"
] | [((86, 141), 'django.conf.urls.url', 'url', (['"""^record/$"""', 'views.record_list'], {'name': '"""record_list"""'}), "('^record/$', views.record_list, name='record_list')\n", (89, 141), False, 'from django.conf.urls import patterns, url\n'), ((159, 217), 'django.conf.urls.url', 'url', (['"""^record/add/$"""', 'views.... |
from __future__ import absolute_import
from __future__ import unicode_literals
from flask_wtf import FlaskForm
from wtforms import BooleanField, SelectField, validators
from wtforms.fields.html5 import EmailField
class ProfileEditForm(FlaskForm):
email = EmailField('Email Address', [validators.Required(), valid... | [
"wtforms.BooleanField",
"wtforms.SelectField",
"wtforms.validators.Email",
"wtforms.validators.Required"
] | [((365, 487), 'wtforms.SelectField', 'SelectField', (['"""Preferred Ebook Format"""'], {'choices': "[('-', '-'), ('Kindle AZW Format', '.azw3'), ('ePub Format', '.epub')]"}), "('Preferred Ebook Format', choices=[('-', '-'), (\n 'Kindle AZW Format', '.azw3'), ('ePub Format', '.epub')])\n", (376, 487), False, 'from wt... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import requests
import tempfile
import pytz
import datetime
import codecs
import sys
import itertools
import operator
from .calendarEvent import CalendarEvent
from dateutil import rrule
from icalendar import Calendar
from pprint import pprin... | [
"logging.getLogger",
"dateutil.rrule.rruleset",
"progressbar.Bar",
"pytz.timezone",
"dateutil.rrule.rrulestr",
"requests.get",
"progressbar.SimpleProgress",
"tempfile.NamedTemporaryFile",
"codecs.open",
"sys.exit",
"icalendar.Calendar.from_ical",
"progressbar.ProgressBar"
] | [((645, 676), 'logging.getLogger', 'logging.getLogger', (['"""Tube4Droid"""'], {}), "('Tube4Droid')\n", (662, 676), False, 'import logging\n'), ((8149, 8165), 'dateutil.rrule.rruleset', 'rrule.rruleset', ([], {}), '()\n', (8163, 8165), False, 'from dateutil import rrule\n'), ((8224, 8265), 'dateutil.rrule.rrulestr', 'r... |
import dpkt
from multiprocessing import Queue
import socket
from dpkt.compat import compat_ord
from utils.print_log import Printer
import logging
import hashlib
class LocalProcessUnit():
"""Queue size"""
QUEUE_SIZE = 20000
alive = True
def __init__(self, db_queue: Queue, queue_size=QUEUE_SIZE):
... | [
"hashlib.sha256",
"socket.inet_ntop",
"dpkt.ethernet.Ethernet",
"utils.print_log.Printer",
"multiprocessing.Queue",
"socket.inet_ntoa",
"dpkt.compat.compat_ord"
] | [((363, 380), 'multiprocessing.Queue', 'Queue', (['queue_size'], {}), '(queue_size)\n', (368, 380), False, 'from multiprocessing import Queue\n'), ((404, 413), 'utils.print_log.Printer', 'Printer', ([], {}), '()\n', (411, 413), False, 'from utils.print_log import Printer\n'), ((813, 840), 'dpkt.ethernet.Ethernet', 'dpk... |
import os
import tkinter as tk
from PIL import ImageTk
from anstoss3k.ui.definitions import MEDIA_PATH
from anstoss3k.ui.menu import MenuStateScreen
class TeamSelectionStateScreen(MenuStateScreen):
def _draw_static_graphics(self):
img_path = os.path.join(MEDIA_PATH, 'backgrounds', 'Team Selection (graf... | [
"os.path.join",
"PIL.ImageTk.PhotoImage"
] | [((259, 348), 'os.path.join', 'os.path.join', (['MEDIA_PATH', '"""backgrounds"""', '"""Team Selection (grafik_cpr-0000001450).jpg"""'], {}), "(MEDIA_PATH, 'backgrounds',\n 'Team Selection (grafik_cpr-0000001450).jpg')\n", (271, 348), False, 'import os\n'), ((371, 404), 'PIL.ImageTk.PhotoImage', 'ImageTk.PhotoImage',... |
from ctypes import cdll, string_at,create_string_buffer
carrierManager = cdll.LoadLibrary("./libcarrierManager.so")
def start(ip, port, data_dir):
hostname = bytes(ip, encoding='utf-8')
data_dir = bytes(data_dir, encoding='utf-8')
print(hostname, port, data_dir)
carrierManager.start(hostname,port,data... | [
"ctypes.cdll.LoadLibrary",
"ctypes.create_string_buffer",
"ctypes.string_at"
] | [((73, 115), 'ctypes.cdll.LoadLibrary', 'cdll.LoadLibrary', (['"""./libcarrierManager.so"""'], {}), "('./libcarrierManager.so')\n", (89, 115), False, 'from ctypes import cdll, string_at, create_string_buffer\n'), ((466, 498), 'ctypes.create_string_buffer', 'create_string_buffer', (['(1024 * 512)'], {}), '(1024 * 512)\n... |
# Copyright 2011 OpenStack LLC.
# 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 b... | [
"nova.tests.scheduler.fakes.mox_host_manager_db_calls",
"nova.scheduler.least_cost.WeightedHost",
"nova.scheduler.host_manager.HostState",
"nova.context.RequestContext",
"nova.tests.scheduler.fakes.FakeFilterScheduler"
] | [((1447, 1474), 'nova.tests.scheduler.fakes.FakeFilterScheduler', 'fakes.FakeFilterScheduler', ([], {}), '()\n', (1472, 1474), False, 'from nova.tests.scheduler import fakes\n'), ((1499, 1540), 'nova.context.RequestContext', 'context.RequestContext', (['"""user"""', '"""project"""'], {}), "('user', 'project')\n", (1521... |
from flask_restplus import Namespace, Resource, reqparse
from flask_login import login_required, current_user
from werkzeug.datastructures import FileStorage
from flask import send_file
from ..util import query_util, coco_util
from database import (
ImageModel,
DatasetModel,
AnnotationModel
)
from PIL imp... | [
"flask_restplus.reqparse.RequestParser",
"flask_restplus.Namespace",
"os.path.exists",
"PIL.Image.open",
"flask_login.current_user.can_delete",
"os.makedirs",
"database.DatasetModel.objects",
"os.path.join",
"io.BytesIO",
"flask_login.current_user.can_download",
"database.ImageModel",
"datetim... | [((374, 432), 'flask_restplus.Namespace', 'Namespace', (['"""image"""'], {'description': '"""Image related operations"""'}), "('image', description='Image related operations')\n", (383, 432), False, 'from flask_restplus import Namespace, Resource, reqparse\n'), ((447, 471), 'flask_restplus.reqparse.RequestParser', 'req... |
from util.tf_util import *
from util.pointnet_util import pointnet_sa_module, pointnet_sa_module_msg
import tensorflow as tf
def placeholder_inputs(batch_size, num_point):
pointclouds_pl = tf.placeholder(tf.float32, shape=(batch_size, num_point, 3))
labels_pl = tf.placeholder(tf.int32, shape=(batch_size))
... | [
"tensorflow.placeholder",
"util.pointnet_util.pointnet_sa_module_msg",
"tensorflow.nn.sparse_softmax_cross_entropy_with_logits",
"tensorflow.reshape",
"tensorflow.reduce_mean",
"tensorflow.summary.scalar",
"tensorflow.add_to_collection",
"util.pointnet_util.pointnet_sa_module"
] | [((195, 255), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '(batch_size, num_point, 3)'}), '(tf.float32, shape=(batch_size, num_point, 3))\n', (209, 255), True, 'import tensorflow as tf\n'), ((272, 314), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': 'batch_size'}), '(tf.... |
import math
def det(a, b, c, d):
return a * d - b * c
class Point:
def __init__(self, x, y):
self.x = x
self.y = y
def lies_on(self, segment):
return Segment(segment.a, self).length + Segment(
segment.b, self).length == segment.length
class Segment:
def __init_... | [
"math.sqrt"
] | [((395, 441), 'math.sqrt', 'math.sqrt', (['((a.x - b.x) ** 2 + (a.y - b.y) ** 2)'], {}), '((a.x - b.x) ** 2 + (a.y - b.y) ** 2)\n', (404, 441), False, 'import math\n')] |
from dtl.api.dtl_loc import shp_get
from est.db.cur import con_cur
import json
from io import StringIO
import psycopg2
from psycopg2 import sql
### NEED TO COME BACK HERE TO FIGURE OUT HOW TO CONVERT ARCGIS RINGS INTO POSTGIS POLY
def wrt_loc(a):
y = shp_get()
buffer = StringIO()
y.to_csv(buffer, index_... | [
"dtl.api.dtl_loc.shp_get",
"io.StringIO",
"est.db.cur.con_cur",
"psycopg2.sql.Identifier",
"psycopg2.sql.SQL"
] | [((258, 267), 'dtl.api.dtl_loc.shp_get', 'shp_get', ([], {}), '()\n', (265, 267), False, 'from dtl.api.dtl_loc import shp_get\n'), ((282, 292), 'io.StringIO', 'StringIO', ([], {}), '()\n', (290, 292), False, 'from io import StringIO\n'), ((390, 399), 'est.db.cur.con_cur', 'con_cur', ([], {}), '()\n', (397, 399), False,... |
# Copyright 2020 The MuLT Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | [
"sklearn.model_selection.train_test_split",
"sklearn.datasets.load_wine",
"pipeline.SMLA"
] | [((965, 980), 'sklearn.datasets.load_wine', 'load_wine', (['(True)'], {}), '(True)\n', (974, 980), False, 'from sklearn.datasets import load_wine\n'), ((1128, 1162), 'pipeline.SMLA', 'SMLA', (['LGBMModel', 'LightGBMOptimizer'], {}), '(LGBMModel, LightGBMOptimizer)\n', (1132, 1162), False, 'from pipeline import SMLA\n')... |
"""
Simple Plot Frame : supporting only copy, print, scale
"""
import wx
from sas.sasgui.guiframe.local_perspectives.plotting.Plotter2D import ModelPanel2D as PlotPanel
from sas.sasgui.plottools.toolbar import NavigationToolBar
from sas.sasgui.plottools.plottables import Graph
from sas.sasgui.guiframe.utils import Pane... | [
"sas.sasgui.plottools.toolbar.NavigationToolBar",
"wx.NewId",
"sas.sasgui.guiframe.local_perspectives.plotting.Plotter2D.ModelPanel2D.__init__",
"sas.sasgui.plottools.plottables.Graph",
"wx.MenuBar",
"wx.Size",
"wx.Menu",
"wx.MenuItem",
"wx.Frame.__init__",
"sas.sasgui.guiframe.events.StatusEvent"... | [((661, 723), 'sas.sasgui.guiframe.local_perspectives.plotting.Plotter2D.ModelPanel2D.__init__', 'PlotPanel.__init__', (['self', 'parent'], {'id': 'id', 'style': 'style'}), '(self, parent, id=id, style=style, **kwargs)\n', (679, 723), True, 'from sas.sasgui.guiframe.local_perspectives.plotting.Plotter2D import ModelPan... |
#!/usr/bin/env python
__author__ = "<NAME>"
__copyright__ = "Copyright 2020, The Spark Structured Playground Project"
__credits__ = []
__license__ = "Apache License"
__version__ = "2.0"
__maintainer__ = "<NAME>"
__email__ = "<EMAIL>"
__status__ = "Education Purpose"
import gin
from datetime import datetime
from pyspa... | [
"ssp.logger.pretty_print.print_info",
"ssp.spark.streaming.common.twitter_streamer_base.TwitterStreamerBase.__init__",
"datetime.datetime.now",
"pyspark.sql.functions.col",
"pyspark.sql.SparkSession.builder.appName",
"ssp.spark.udf.tensorflow_serving_api_udf.get_text_classifier_udf"
] | [((2635, 2886), 'ssp.spark.streaming.common.twitter_streamer_base.TwitterStreamerBase.__init__', 'TwitterStreamerBase.__init__', (['self'], {'spark_master': 'spark_master', 'checkpoint_dir': 'checkpoint_dir', 'warehouse_location': 'warehouse_location', 'kafka_bootstrap_servers': 'kafka_bootstrap_servers', 'kafka_topic'... |
import base64
import gzip
import json
from typing import Dict
class RserverExchange:
"""Data-oriented class to simplify dealing with RStudio messages decoded from the MITM log
Attributes are stored in a way that is ready for activity records. bytes get decoded, and images get
base64-encoded.
"""
... | [
"base64.b64encode",
"gzip.decompress"
] | [((1315, 1346), 'gzip.decompress', 'gzip.decompress', (['response_bytes'], {}), '(response_bytes)\n', (1330, 1346), False, 'import gzip\n'), ((1675, 1707), 'base64.b64encode', 'base64.b64encode', (['response_bytes'], {}), '(response_bytes)\n', (1691, 1707), False, 'import base64\n')] |
from typing import List, Tuple
import numpy as np
from l5kit.data import ChunkedDataset
from l5kit.data.filter import (filter_agents_by_frames, filter_agents_by_labels, filter_tl_faces_by_frames,
filter_tl_faces_by_status)
from l5kit.data.labels import PERCEPTION_LABELS
from l5kit.data.... | [
"l5kit.rasterization.semantic_rasterizer.indices_in_bounds",
"numpy.eye",
"l5kit.data.filter.filter_agents_by_frames",
"numpy.hstack",
"l5kit.visualization.visualizer.common.EgoVisualization",
"l5kit.rasterization.box_rasterizer.get_ego_as_agent",
"l5kit.data.filter.filter_tl_faces_by_status",
"numpy.... | [((4222, 4290), 'l5kit.rasterization.semantic_rasterizer.indices_in_bounds', 'indices_in_bounds', (['ego_xy', "mapAPI.bounds_info['lanes']['bounds']", '(50)'], {}), "(ego_xy, mapAPI.bounds_info['lanes']['bounds'], 50)\n", (4239, 4290), False, 'from l5kit.rasterization.semantic_rasterizer import indices_in_bounds\n'), (... |
import machine
import network
import time
import ugfx
import util
from home.launcher import ButtonGroup, Button, Display
class ConfigManager(Display):
def __init__(self, parent=None):
self.parent = parent
super().__init__()
def reload(self):
if self.parent:
self.parent... | [
"home.launcher.ButtonGroup",
"ugfx.input_attach",
"ugfx.HTML2COLOR",
"ugfx.poll",
"time.sleep",
"util.Config",
"network.WLAN",
"util.reboot"
] | [((662, 704), 'ugfx.input_attach', 'ugfx.input_attach', (['ugfx.BTN_B', 'util.reboot'], {}), '(ugfx.BTN_B, util.reboot)\n', (679, 704), False, 'import ugfx\n'), ((1670, 1698), 'network.WLAN', 'network.WLAN', (['network.STA_IF'], {}), '(network.STA_IF)\n', (1682, 1698), False, 'import network\n'), ((1720, 1747), 'networ... |
# Implementation of the Gaborfilter
# https://en.wikipedia.org/wiki/Gabor_filter
import numpy as np
from cv2 import COLOR_BGR2GRAY, CV_8UC3, cvtColor, filter2D, imread, imshow, waitKey
def gabor_filter_kernel(
ksize: int, sigma: int, theta: int, lambd: int, gamma: int, psi: int
) -> np.ndarray:
"""
:param... | [
"cv2.filter2D",
"cv2.imshow",
"numpy.exp",
"numpy.zeros",
"cv2.waitKey",
"doctest.testmod",
"numpy.cos",
"cv2.cvtColor",
"numpy.sin",
"cv2.imread"
] | [((1158, 1200), 'numpy.zeros', 'np.zeros', (['(ksize, ksize)'], {'dtype': 'np.float32'}), '((ksize, ksize), dtype=np.float32)\n', (1166, 1200), True, 'import numpy as np\n'), ((1937, 1954), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (1952, 1954), False, 'import doctest\n'), ((1991, 2023), 'cv2.imread', 'im... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2020 Kyoto University (<NAME>)
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Evaluate the wordpiece-level model by BLEU."""
import codecs
import logging
from tqdm import tqdm
from nltk.translate.bleu_score import corpus_bleu, sentence_bleu
... | [
"logging.getLogger",
"neural_sp.utils.mkdir_join",
"codecs.open",
"nltk.translate.bleu_score.corpus_bleu"
] | [((370, 397), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (387, 397), False, 'import logging\n'), ((1614, 1667), 'neural_sp.utils.mkdir_join', 'mkdir_join', (['models[0].save_path', 'recog_dir', '"""ref.trn"""'], {}), "(models[0].save_path, recog_dir, 'ref.trn')\n", (1624, 1667), False... |
import io
import os
import sys
from setuptools import find_packages, setup
# Package meta-data.
NAME = "{{ PROJECT }}"
DESCRIPTION = "{{ DESCRIPTION }}"
LICENSE = "{{ LICENSE }}"
URL = "{{ URL }}"
EMAIL = "{{ EMAIL }}"
AUTHOR = "{{ AUTHOR }}"
REQUIRES_PYTHON = ">={{ PYTHON }}"
INSTALL_REQUIRES = [""]
# Optional pack... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join",
"io.open"
] | [((621, 688), 'os.path.join', 'os.path.join', (['this_file_path', '"""lib"""', '"""{{ PROJECT }}"""', '"""__init__.py"""'], {}), "(this_file_path, 'lib', '{{ PROJECT }}', '__init__.py')\n", (633, 688), False, 'import os\n'), ((550, 575), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (565, 57... |
import sys
from SALib.analyze.ff import analyze
from SALib.sample.ff import sample
from SALib.util import read_param_file
sys.path.append('../..')
# Read the parameter range file and generate samples
problem = read_param_file('../../src/SALib/test_functions/params/Ishigami.txt')
# or define manually without a parame... | [
"SALib.sample.ff.sample",
"SALib.analyze.ff.analyze",
"sys.path.append",
"SALib.util.read_param_file"
] | [((124, 148), 'sys.path.append', 'sys.path.append', (['"""../.."""'], {}), "('../..')\n", (139, 148), False, 'import sys\n'), ((213, 282), 'SALib.util.read_param_file', 'read_param_file', (['"""../../src/SALib/test_functions/params/Ishigami.txt"""'], {}), "('../../src/SALib/test_functions/params/Ishigami.txt')\n", (228... |
"""This example simulates the start-up behavior of the squirrel cage induction motor connected to
an ideal three-phase grid. The state and action space is continuous.
Running the example will create a formatted plot that show the motor's angular velocity, the drive torque,
the applied voltage in three-phase abc-coordin... | [
"matplotlib.pyplot.grid",
"gym_electric_motor.make",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.tick_params",
"numpy.append",
"numpy.array",
"matplotlib.pyplot.rcParams.update",
"matplotlib.pyplot.yticks",
"n... | [((1312, 1398), 'gym_electric_motor.make', 'gem.make', (['"""AbcCont-CC-SCIM-v0"""'], {'ode_solver': '"""scipy.ode"""', 'constraints': '()', 'tau': '(1e-05)'}), "('AbcCont-CC-SCIM-v0', ode_solver='scipy.ode', constraints=(), tau=\n 1e-05)\n", (1320, 1398), True, 'import gym_electric_motor as gem\n'), ((2085, 2098), ... |
#!/usr/bin/env python3
"""Solution for https://www.hackerrank.com/challenges/even-tree"""
from collections import defaultdict, deque
from typing import Dict, Set
Vertex = int
Tree = Dict[Vertex, Set[Vertex]]
def trim_tree(tree: Tree, root=1) -> None:
"""Make tree a directed graph."""
for child in tree[root]... | [
"collections.deque",
"collections.defaultdict"
] | [((933, 967), 'collections.deque', 'deque', (['[x for x in subtree[start]]'], {}), '([x for x in subtree[start]])\n', (938, 967), False, 'from collections import defaultdict, deque\n'), ((1372, 1388), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (1383, 1388), False, 'from collections import defau... |
"""generator.py
Created by <NAME>, <NAME>.
Copyright (c) NREL. All rights reserved.
Electromagnetic design based on conventional magnetic circuit laws
Structural design based on McDonald's thesis """
import numpy as np
import openmdao.api as om
import wisdem.drivetrainse.generator_models as gm
# -------------------... | [
"numpy.deg2rad",
"numpy.zeros",
"openmdao.api.ExecComp"
] | [((6801, 6812), 'numpy.zeros', 'np.zeros', (['(3)'], {}), '(3)\n', (6809, 6812), True, 'import numpy as np\n'), ((18493, 18563), 'openmdao.api.ExecComp', 'om.ExecComp', (['"""v = 0.5*E/G - 1.0"""'], {'E': "{'units': 'Pa'}", 'G': "{'units': 'Pa'}"}), "('v = 0.5*E/G - 1.0', E={'units': 'Pa'}, G={'units': 'Pa'})\n", (1850... |
import pytest
from stuff.accum import Accumulator
@pytest.fixture
def accum():
return Accumulator() | [
"stuff.accum.Accumulator"
] | [((91, 104), 'stuff.accum.Accumulator', 'Accumulator', ([], {}), '()\n', (102, 104), False, 'from stuff.accum import Accumulator\n')] |
from typing import Any
from annotypes import Anno, add_call_types
from scanpointgenerator import CompoundGenerator
from malcolm.core import Context, PartRegistrar
from malcolm.modules import ADCore, builtin, scanning
with Anno("Sample frequency of ADC signal in Hz"):
ASampleFreq = float
with Anno("Is the input ... | [
"malcolm.modules.builtin.util.no_save",
"annotypes.Anno",
"malcolm.modules.scanning.infos.ParameterTweakInfo",
"scanpointgenerator.CompoundGenerator.from_dict"
] | [((567, 618), 'malcolm.modules.builtin.util.no_save', 'builtin.util.no_save', (['"""postCount"""', '"""averageSamples"""'], {}), "('postCount', 'averageSamples')\n", (587, 618), False, 'from malcolm.modules import ADCore, builtin, scanning\n'), ((225, 269), 'annotypes.Anno', 'Anno', (['"""Sample frequency of ADC signal... |
#!/usr/bin/env python3
import paths
paths.add_modules_to_path()
import os
from behavior_tree_learning.sbt import BehaviorNodeFactory, BehaviorTreeExecutor, ExecutionParameters
from tiago_pnp.paths import get_log_directory
from tiago_pnp import bt_collection
from tiago_pnp.execution_nodes import get_behaviors
from tia... | [
"behavior_tree_learning.sbt.BehaviorTreeExecutor",
"paths.add_modules_to_path",
"tiago_pnp.paths.get_log_directory",
"tiago_pnp.world.ApplicationWorld",
"tiago_pnp.execution_nodes.get_behaviors",
"behavior_tree_learning.sbt.ExecutionParameters",
"tiago_pnp.bt_collection.select_bt"
] | [((37, 64), 'paths.add_modules_to_path', 'paths.add_modules_to_path', ([], {}), '()\n', (62, 64), False, 'import paths\n'), ((504, 537), 'tiago_pnp.bt_collection.select_bt', 'bt_collection.select_bt', (['scenario'], {}), '(scenario)\n', (527, 537), False, 'from tiago_pnp import bt_collection\n'), ((467, 490), 'tiago_pn... |
from typing import Any
from boa3.builtin.interop.contract import create_contract
def Main(script: bytes, manifest: bytes, arg0: Any):
create_contract(script, manifest, arg0)
| [
"boa3.builtin.interop.contract.create_contract"
] | [((141, 180), 'boa3.builtin.interop.contract.create_contract', 'create_contract', (['script', 'manifest', 'arg0'], {}), '(script, manifest, arg0)\n', (156, 180), False, 'from boa3.builtin.interop.contract import create_contract\n')] |
from .models import Customer, Category
from django.shortcuts import get_object_or_404
def base(request):
category_list = list()
category_name = Category.objects.distinct().values('category_name')
for category in category_name:
lop_list = list()
query1 = Category.objects.filter(category_name... | [
"django.shortcuts.get_object_or_404"
] | [((673, 732), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Customer'], {'pk': "request.session['customer']"}), "(Customer, pk=request.session['customer'])\n", (690, 732), False, 'from django.shortcuts import get_object_or_404\n')] |
import pytest
from ninja import NinjaAPI, Router
from ninja.testing import TestClient
api = NinjaAPI()
@api.get("/endpoint")
# view->api
def global_op(request):
return "global"
first_router = Router()
@first_router.get("/endpoint_1")
# view->router, router->api
def router_op1(request):
return "first 1"
... | [
"pytest.mark.parametrize",
"ninja.Router",
"ninja.testing.TestClient",
"ninja.NinjaAPI"
] | [((94, 104), 'ninja.NinjaAPI', 'NinjaAPI', ([], {}), '()\n', (102, 104), False, 'from ninja import NinjaAPI, Router\n'), ((202, 210), 'ninja.Router', 'Router', ([], {}), '()\n', (208, 210), False, 'from ninja import NinjaAPI, Router\n'), ((342, 350), 'ninja.Router', 'Router', ([], {}), '()\n', (348, 350), False, 'from ... |
from typing import Any, Callable, Dict, List, Optional, Union, Tuple
from homeassistant.config_entries import ConfigEntry
from homeassistant.helpers.typing import HomeAssistantType
from homeassistant.components.light import (
LightEntity,
SUPPORT_BRIGHTNESS, SUPPORT_COLOR, SUPPORT_COLOR_TEMP, SUPPORT_WHITE_VAL... | [
"homeassistant.util.color.color_RGB_to_hs",
"homeassistant.util.color.color_hs_to_RGB"
] | [((6145, 6169), 'homeassistant.util.color.color_RGB_to_hs', 'color_RGB_to_hs', (['r', 'g', 'b'], {}), '(r, g, b)\n', (6160, 6169), False, 'from homeassistant.util.color import color_hs_to_RGB, color_RGB_to_hs\n'), ((3308, 3329), 'homeassistant.util.color.color_hs_to_RGB', 'color_hs_to_RGB', (['h', 's'], {}), '(h, s)\n'... |
# -*- coding: utf-8 -*-
"""Tests for webhooks functions."""
import logging
import json
from types import SimpleNamespace as SimpleObject
from urllib.parse import urlparse
from flask_login import login_user
from unittest.mock import MagicMock, patch
from orcid_hub import utils
from orcid_hub.models import Client, Orc... | [
"logging.getLogger",
"logging.StreamHandler",
"orcid_hub.utils.send_orcid_update_summary",
"orcid_hub.utils.disable_org_webhook",
"orcid_hub.utils.timedelta",
"unittest.mock.patch",
"orcid_hub.models.OrcidToken.select",
"orcid_hub.models.Token.get",
"orcid_hub.models.Organisation.get",
"json.loads... | [((365, 392), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (382, 392), False, 'import logging\n'), ((441, 464), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (462, 464), False, 'import logging\n'), ((1705, 1730), 'orcid_hub.models.User.get', 'User.get', ([], {'emai... |
import os
import subprocess
import sys
import re
import getopt
import uuid
device = "hci0"
uuid = "E20A39F473F54BC4A12F17D1AD07A961"
major = 0
minor = 0
power = 200
def hexsplit(string):
""" Split a hex string into 8-bit/2-hex-character groupings separated by spaces"""
return ' '.join([string[i:i+2] for i in ... | [
"os.system"
] | [((596, 614), 'os.system', 'os.system', (['command'], {}), '(command)\n', (605, 614), False, 'import os\n')] |
import json
from didself import registry
from jwcrypto import jwk
from didselfsvci import svci
# DID creation
# Generate DID and initial secret key
did_key = jwk.JWK.generate(kty='OKP', crv='Ed25519')
# Initialize registry
registry = registry.DIDSelfRegistry(did_key)
# Generate the DID document
did_key_dict = did_key.... | [
"didself.registry.read",
"jwcrypto.jwk.JWK.generate",
"json.dumps",
"didself.registry.DIDSelfRegistry",
"didselfsvci.svci.generate_svci_header",
"didself.registry.create"
] | [((159, 201), 'jwcrypto.jwk.JWK.generate', 'jwk.JWK.generate', ([], {'kty': '"""OKP"""', 'crv': '"""Ed25519"""'}), "(kty='OKP', crv='Ed25519')\n", (175, 201), False, 'from jwcrypto import jwk\n'), ((235, 268), 'didself.registry.DIDSelfRegistry', 'registry.DIDSelfRegistry', (['did_key'], {}), '(did_key)\n', (259, 268), ... |
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import wx
class MyFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent,-1, 'Hello World', size=(300, 300))
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
panel.SetSizer(sizer)
txt =... | [
"wx.Button",
"wx.BoxSizer",
"wx.StaticText",
"wx.Frame.__init__",
"wx.Panel"
] | [((120, 187), 'wx.Frame.__init__', 'wx.Frame.__init__', (['self', 'parent', '(-1)', '"""Hello World"""'], {'size': '(300, 300)'}), "(self, parent, -1, 'Hello World', size=(300, 300))\n", (137, 187), False, 'import wx\n'), ((212, 226), 'wx.Panel', 'wx.Panel', (['self'], {}), '(self)\n', (220, 226), False, 'import wx\n')... |
import json
import os
from urllib.parse import urlparse, quote
import urllib3
def cookies_to_header(cookies):
if cookies is None:
return {}
return {
'Cookie': ';'.join(map(lambda cookie: f'{cookie["name"]}={cookie["value"]}', cookies))
}
def get_json(url, cookies=None):
headers = co... | [
"json.loads",
"os.path.basename",
"urllib3.PoolManager",
"urllib.parse.urlparse"
] | [((356, 377), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (375, 377), False, 'import urllib3\n'), ((462, 480), 'json.loads', 'json.loads', (['r.data'], {}), '(r.data)\n', (472, 480), False, 'import json\n'), ((579, 600), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (598, 600), Fal... |