code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import numpy as np
from matplotlib import pyplot as plt
from .interval import Interval
class Pbox(object):
def __init__(self, left=None, right=None, steps=200, shape=None, mean_left=None, mean_right=None, var_left=None, var_right=None, interpolation='linear'):
if (left is not None) and (right is None):
... | [
"numpy.minimum",
"numpy.maximum",
"matplotlib.pyplot.show",
"numpy.copy",
"matplotlib.pyplot.plot",
"numpy.flip",
"numpy.empty",
"numpy.isinf",
"numpy.isnan",
"numpy.any",
"numpy.sort",
"numpy.max",
"numpy.mean",
"numpy.array",
"numpy.min",
"numpy.linspace",
"numpy.all",
"numpy.rep... | [((18611, 18621), 'numpy.sort', 'np.sort', (['u'], {}), '(u)\n', (18618, 18621), True, 'import numpy as np\n'), ((18830, 18843), 'numpy.sort', 'np.sort', (['vals'], {}), '(vals)\n', (18837, 18843), True, 'import numpy as np\n'), ((20015, 20026), 'numpy.array', 'np.array', (['u'], {}), '(u)\n', (20023, 20026), True, 'im... |
from django.contrib import admin
from .models import Bulletin
admin.site.register(Bulletin)
| [
"django.contrib.admin.site.register"
] | [((64, 93), 'django.contrib.admin.site.register', 'admin.site.register', (['Bulletin'], {}), '(Bulletin)\n', (83, 93), False, 'from django.contrib import admin\n')] |
# Lint as: python3
# Copyright 2021 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... | [
"tensorflow.test.main",
"tensorflow.range",
"model.recommendation_model_launcher.prepare_model_config",
"tensorflow.train.Example",
"model.input_pipeline.get_input_dataset",
"tensorflow.saved_model.load",
"tensorflow.io.TFRecordWriter",
"os.path.exists",
"model.recommendation_model_launcher.define_f... | [((2677, 2695), 'tensorflow.train.Example', 'tf.train.Example', ([], {}), '()\n', (2693, 2695), True, 'import tensorflow as tf\n'), ((8043, 8066), 'model.recommendation_model_launcher.define_flags', 'launcher.define_flags', ([], {}), '()\n', (8064, 8066), True, 'from model import recommendation_model_launcher as launch... |
from __future__ import absolute_import
import unittest
from src.solver import Solver
class TestSolver(unittest.TestCase):
def test_ctor(self):
solver = Solver("", "", False)
self.assertEqual(solver.name, "")
self.assertEqual(solver.quiet_mode, False)
if __name__ == "__main__":
uni... | [
"unittest.main",
"src.solver.Solver"
] | [((317, 332), 'unittest.main', 'unittest.main', ([], {}), '()\n', (330, 332), False, 'import unittest\n'), ((168, 189), 'src.solver.Solver', 'Solver', (['""""""', '""""""', '(False)'], {}), "('', '', False)\n", (174, 189), False, 'from src.solver import Solver\n')] |
import random
rock = '''
_______
---' ____)
(_____)
(_____)
(____)
---.__(___)
'''
paper = '''
_______
---' ____)____
______)
_______)
_______)
---.__________)
'''
scissors = '''
_______
---' ____)____
______)
__________)
(____)
-... | [
"random.randint"
] | [((588, 608), 'random.randint', 'random.randint', (['(0)', '(2)'], {}), '(0, 2)\n', (602, 608), False, 'import random\n')] |
from __future__ import division
from iotbx.option_parser import option_parser
from scitbx.array_family import flex
import sys
from libtbx.utils import Sorry
from mmtbx import scaling
import math
from iotbx import data_plots
def plotit(fobs,
sigma,
fcalc,
alpha,
beta,
... | [
"math.sqrt",
"mmtbx.scaling.likelihood_ratio_outlier_test",
"scitbx.array_family.flex.max",
"iotbx.data_plots.plot_data_loggraph",
"iotbx.data_plots.plot_data",
"iotbx.option_parser.option_parser",
"scitbx.array_family.flex.bool",
"scitbx.array_family.flex.double",
"scitbx.array_family.flex.exp",
... | [((469, 488), 'scitbx.array_family.flex.double', 'flex.double', (['[fobs]'], {}), '([fobs])\n', (480, 488), False, 'from scitbx.array_family import flex\n'), ((505, 525), 'scitbx.array_family.flex.double', 'flex.double', (['[fcalc]'], {}), '([fcalc])\n', (516, 525), False, 'from scitbx.array_family import flex\n'), ((5... |
# Link: https://github.com/nicolas3470/Python-synchronization/blob/master/q06.py
from threading import Lock, Condition
from utils import Thread, execution_manager
from barbershop import Barber, Customer
def delay():
time.sleep(random.randint(0, 2))
class BarberShop:
def __init__(self, num_seats):
s... | [
"threading.Lock",
"threading.Condition",
"utils.Thread"
] | [((1631, 1648), 'utils.Thread', 'Thread', (['Barber', 'i'], {}), '(Barber, i)\n', (1637, 1648), False, 'from utils import Thread, execution_manager\n'), ((1679, 1698), 'utils.Thread', 'Thread', (['Customer', 'i'], {}), '(Customer, i)\n', (1685, 1698), False, 'from utils import Thread, execution_manager\n'), ((443, 449)... |
""" test automol.graph
"""
import numpy
import automol
from automol import graph
C8H13O_CGR = (
{0: ('C', 3, None), 1: ('C', 2, None), 2: ('C', 3, None),
3: ('C', 1, None), 4: ('C', 1, None), 5: ('C', 1, None),
6: ('C', 1, None), 7: ('C', 1, None), 8: ('O', 0, None)},
{frozenset({1, 4}): (1, None),... | [
"automol.graph.transform_keys",
"automol.graph.atom_symbols",
"automol.graph.from_index_based_stereo",
"automol.graph.stereogenic_bond_keys",
"automol.graph.atom_stereo_parities",
"automol.graph.string",
"automol.graph.subgraph",
"automol.graph.resonance_dominant_radical_atom_keys",
"automol.graph.t... | [((14521, 14548), 'automol.graph.atom_keys', 'graph.atom_keys', (['C8H13O_CGR'], {}), '(C8H13O_CGR)\n', (14536, 14548), False, 'from automol import graph\n'), ((14559, 14656), 'automol.graph.set_atom_implicit_hydrogen_valences', 'graph.set_atom_implicit_hydrogen_valences', (['C8H13O_CGR', '{atm_key: (0) for atm_key in ... |
import botbowl
from botbowl.core import Action, Agent
import numpy as np
from copy import deepcopy
import random
import time
from botbowl.core.model import Team
PRINT = False
IGNORE_IN_GAME = [botbowl.ActionType.PLACE_PLAYER, botbowl.ActionType.END_SETUP, botbowl.ActionType.SETUP_FORMATION_SPREAD,
b... | [
"copy.deepcopy",
"numpy.log",
"numpy.argmax",
"time.time",
"botbowl.core.Action",
"numpy.random.choice",
"botbowl.register_bot"
] | [((7138, 7191), 'botbowl.register_bot', 'botbowl.register_bot', (['"""MCTS-bot-budget-10"""', 'SearchBot'], {}), "('MCTS-bot-budget-10', SearchBot)\n", (7158, 7191), False, 'import botbowl\n'), ((3561, 3575), 'copy.deepcopy', 'deepcopy', (['game'], {}), '(game)\n', (3569, 3575), False, 'from copy import deepcopy\n'), (... |
# -*- mode: python; coding: utf-8 -*-
# Copyright 2016-2017 the HERA Collaboration
# Licensed under the BSD License.
"Files."
__all__ = str('''
File
FileInstance
FileEvent
''').split()
import sys
import datetime
import json
import os.path
import re
from flask import flash, redirect, render_template, url_for
from s... | [
"flask.flash",
"json.loads",
"astropy.time.Time",
"hera_librarian.utils.normalize_and_validate_md5",
"json.dumps",
"datetime.datetime.utcnow",
"flask.url_for",
"flask.render_template",
"datetime.datetime.fromtimestamp",
"sys.exc_info"
] | [((26869, 27004), 'flask.render_template', 'render_template', (['"""file-individual.html"""'], {'title': "('%s File %s' % (file.type, file.name))", 'file': 'file', 'instances': 'instances', 'events': 'events'}), "('file-individual.html', title='%s File %s' % (file.type,\n file.name), file=file, instances=instances, ... |
import logging
class LoggerFileClass:
LOGGER_TYPE_FILE = "file"
LOGGER_TYPE_MONGO_DB = "mongo_db"
LOG_FILE_NM = "LoggerFile.log"
"""
Description: This class is used to do logging of events, events like user action, exception, error.
"""
def __init__(self, logger_nm):
"""
... | [
"logging.Formatter",
"logging.FileHandler",
"logging.getLogger"
] | [((518, 546), 'logging.getLogger', 'logging.getLogger', (['logger_nm'], {}), '(logger_nm)\n', (535, 546), False, 'import logging\n'), ((600, 667), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s:%(levelname)s:%(name)s:%(message)s"""'], {}), "('%(asctime)s:%(levelname)s:%(name)s:%(message)s')\n", (617, 667),... |
import math
import matplotlib
import numpy as np
from typing import Sequence
from PIL import Image
from io import BytesIO
from contextlib import contextmanager
from matplotlib.artist import Artist
from matplotlib.axes import Axes
from figpptx.slide_editor import SlideTransformer, Box
def to_image(arg, **kwargs):
... | [
"io.BytesIO",
"math.ceil",
"figpptx.slide_editor.Box.from_vertices",
"math.floor",
"numpy.clip",
"figpptx.artist_misc.to_figure",
"PIL.Image.open",
"numpy.min",
"numpy.where",
"numpy.array",
"numpy.max",
"figpptx.slide_editor.Box.union",
"figpptx.slide_editor.SlideTransformer"
] | [((1432, 1441), 'io.BytesIO', 'BytesIO', ([], {}), '()\n', (1439, 1441), False, 'from io import BytesIO\n'), ((4024, 4039), 'numpy.array', 'np.array', (['image'], {}), '(image)\n', (4032, 4039), True, 'import numpy as np\n'), ((4081, 4101), 'numpy.where', 'np.where', (['(alpha != 0)'], {}), '(alpha != 0)\n', (4089, 410... |
# Eitaa PyKit
# v1.1
import requests
from bs4 import BeautifulSoup
class Eitaa(object):
def __init__(self, token):
self.token = token
def send_message(self, chat_id, text, pin=False, view_delete=-1):
r = requests.post(
f"https://eitaayar.ir/api/{self.token}/sendMessage",... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((1248, 1295), 'requests.get', 'requests.get', (['f"""https://eitaa.com/{channel_id}"""'], {}), "(f'https://eitaa.com/{channel_id}')\n", (1260, 1295), False, 'import requests\n'), ((1312, 1348), 'bs4.BeautifulSoup', 'BeautifulSoup', (['r.text', '"""html.parser"""'], {}), "(r.text, 'html.parser')\n", (1325, 1348), Fals... |
# -*- coding: utf-8 -*-
from django.core.management import CommandError, call_command
from django.test import TestCase
from django.test.utils import override_settings
from six import StringIO
try:
from unittest import mock
except ImportError:
import mock
class ResetSchemaExceptionsTests(TestCase):
"""Tes... | [
"mock.call",
"mock.patch",
"django.core.management.call_command",
"mock.Mock",
"django.test.utils.override_settings"
] | [((990, 1171), 'django.test.utils.override_settings', 'override_settings', ([], {'DATABASES': "{'default': {'ENGINE': 'django.db.backends.postgresql_psycopg2', 'NAME':\n 'test', 'USER': 'test', 'PASSWORD': '<PASSWORD>', 'HOST': 'localhost'}}"}), "(DATABASES={'default': {'ENGINE':\n 'django.db.backends.postgresql_... |
from flask import (
Flask,
render_template,
make_response,
redirect,
url_for,
request,
)
import json
import datetime
import glob
import random
# set random seed 42 for reproducibility (important to maintain stable word lists)
random.seed(42)
app = Flask(__name__)
############################... | [
"json.load",
"flask.redirect",
"random.shuffle",
"flask.Flask",
"datetime.datetime",
"flask.request.url.replace",
"datetime.datetime.utcnow",
"random.seed",
"flask.render_template",
"glob.glob",
"flask.request.url.startswith"
] | [((252, 267), 'random.seed', 'random.seed', (['(42)'], {}), '(42)\n', (263, 267), False, 'import random\n'), ((275, 290), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (280, 290), False, 'from flask import Flask, render_template, make_response, redirect, url_for, request\n'), ((764, 776), 'json.load', 'js... |
import pytest
import numpy as np
from numpy.testing import assert_, run_module_suite
from qutip import (smesolve, mesolve, photocurrent_mesolve, liouvillian,
QobjEvo, spre, spost, destroy, coherent, parallel_map,
qeye, fock_dm, general_stochastic, ket2dm, num)
def f(t, args):
... | [
"qutip.num",
"qutip.coherent",
"numpy.sin",
"qutip.destroy",
"qutip.fock_dm",
"numpy.testing.run_module_suite",
"numpy.linspace",
"qutip.photocurrent_mesolve",
"qutip.mesolve",
"qutip.spre",
"numpy.stack",
"qutip.smesolve",
"numpy.tanh",
"qutip.qeye",
"numpy.testing.assert_",
"numpy.co... | [((583, 593), 'numpy.cos', 'np.cos', (['th'], {}), '(th)\n', (589, 593), True, 'import numpy as np\n'), ((605, 615), 'numpy.sin', 'np.sin', (['th'], {}), '(th)\n', (611, 615), True, 'import numpy as np\n'), ((692, 699), 'qutip.qeye', 'qeye', (['N'], {}), '(N)\n', (696, 699), False, 'from qutip import smesolve, mesolve,... |
"""
===============================
A demo of rooms environment
===============================
Illustration of NRooms environment
.. video:: ../../video_plot_rooms.mp4
:width: 600
"""
# sphinx_gallery_thumbnail_path = 'thumbnails/video_plot_rooms.jpg'
from rlberry.envs.benchmarks.grid_exploration.nroom import N... | [
"rlberry.agents.dynprog.ValueIterationAgent",
"rlberry.envs.benchmarks.grid_exploration.nroom.NRoom"
] | [((387, 497), 'rlberry.envs.benchmarks.grid_exploration.nroom.NRoom', 'NRoom', ([], {'nrooms': '(9)', 'remove_walls': '(False)', 'room_size': '(9)', 'initial_state_distribution': '"""center"""', 'include_traps': '(True)'}), "(nrooms=9, remove_walls=False, room_size=9, initial_state_distribution\n ='center', include_... |
from typing import Dict, List, Union
from typeguard import check_argument_types
import tensorflow as tf
import numpy as np
from neuralmonkey.decoders.autoregressive import AutoregressiveDecoder
from neuralmonkey.decoders.sequence_labeler import SequenceLabeler
from neuralmonkey.decorators import tensor
from neuralmon... | [
"numpy.mean",
"typeguard.check_argument_types"
] | [((1083, 1105), 'typeguard.check_argument_types', 'check_argument_types', ([], {}), '()\n', (1103, 1105), False, 'from typeguard import check_argument_types\n'), ((739, 789), 'numpy.mean', 'np.mean', (["[res['xents'] for res in results]"], {'axis': '(0)'}), "([res['xents'] for res in results], axis=0)\n", (746, 789), T... |
from ged4py import GedcomReader
path = r"C:\Python\Python38\Django\familysite\ca1z66_78236416fprf45ca4e51z3.ged"
people = []
with GedcomReader(path) as parser:
for i, indi in enumerate(parser.records0("INDI")):
people.append(i)
json = ''
json += '[ \n'
with GedcomReader(path) as parser:
for i, ... | [
"ged4py.GedcomReader"
] | [((133, 151), 'ged4py.GedcomReader', 'GedcomReader', (['path'], {}), '(path)\n', (145, 151), False, 'from ged4py import GedcomReader\n'), ((278, 296), 'ged4py.GedcomReader', 'GedcomReader', (['path'], {}), '(path)\n', (290, 296), False, 'from ged4py import GedcomReader\n')] |
from PIL import Image
from image import crop_to_bin
img = Image.open('ui.png')
count = 0
card_name_dict = ["7s", "5p", "5s", "5z", "6m",
"6p", "6s", "6z", "7m", "7p",
"5m", "7z", "8m", "8p", "8s",
"9m", "9p", "9s", "", "2z",
"0p", "1s", "1z", "2m"... | [
"image.crop_to_bin",
"PIL.Image.open"
] | [((59, 79), 'PIL.Image.open', 'Image.open', (['"""ui.png"""'], {}), "('ui.png')\n", (69, 79), False, 'from PIL import Image\n'), ((788, 809), 'image.crop_to_bin', 'crop_to_bin', (['crop_img'], {}), '(crop_img)\n', (799, 809), False, 'from image import crop_to_bin\n')] |
# %%
from operator import index
import os
try:
os.chdir(os.path.join(os.getcwd(), '.'))
print(os.getcwd())
except:
pass
# %%
from IPython import get_ipython
# %%
import pandas as pd
import numpy as np
import os
#%%
wordle = pd.read_csv('./data/wordle.csv.zip', sep=',', encoding="utf-8", index_col=0)
wor... | [
"pandas.read_csv",
"os.getcwd"
] | [((240, 316), 'pandas.read_csv', 'pd.read_csv', (['"""./data/wordle.csv.zip"""'], {'sep': '""","""', 'encoding': '"""utf-8"""', 'index_col': '(0)'}), "('./data/wordle.csv.zip', sep=',', encoding='utf-8', index_col=0)\n", (251, 316), True, 'import pandas as pd\n'), ((102, 113), 'os.getcwd', 'os.getcwd', ([], {}), '()\n'... |
from sqlalchemy import Column, Integer, String, Boolean
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
Base = declarative_base()
class Server(Base):
__tablename__ = 'example_server'
id = Column(Integer, primary_key=True)
ip = Column(String, nullable=Fals... | [
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.Column"
] | [((160, 178), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (176, 178), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((248, 281), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (254, 281), False, 'f... |
from django.conf import settings
from django.urls import path
from django.conf.urls.static import static
from . import views
urlpatterns = [
path('generic', views.GenericClassView.as_view(), name='generic_view'),
path('template', views.TemplateClassView.as_view(), name='template_view'),
path('list', views... | [
"django.conf.urls.static.static"
] | [((529, 592), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}), '(settings.STATIC_URL, document_root=settings.STATIC_ROOT)\n', (535, 592), False, 'from django.conf.urls.static import static\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.25 on 2019-11-07 10:15
from __future__ import unicode_literals
from django.db import migrations
import norduniclient as nc
def forwards_func(apps, schema_editor):
NodeType = apps.get_model('noclook', 'NodeType')
NodeHandle = apps.get_model('noclook', 'NodeHa... | [
"django.db.migrations.RunPython",
"norduniclient.get_node_model"
] | [((809, 870), 'norduniclient.get_node_model', 'nc.get_node_model', (['nc.graphdb.manager', 'organization.handle_id'], {}), '(nc.graphdb.manager, organization.handle_id)\n', (826, 870), True, 'import norduniclient as nc\n'), ((1279, 1328), 'django.db.migrations.RunPython', 'migrations.RunPython', (['forwards_func', 'rev... |
from utils.utils import mount_message
class GameServer:
def __init__(self, queue_send, queue_receive):
self.queue_send = queue_send
self.queue_receive = queue_receive
def _return_function(self, send):
def f():
self.queue_send.put(send)
return f
def create_roo... | [
"utils.utils.mount_message"
] | [((568, 632), 'utils.utils.mount_message', 'mount_message', (['"""menu_create"""', '(name_player, name_room, password)'], {}), "('menu_create', (name_player, name_room, password))\n", (581, 632), False, 'from utils.utils import mount_message\n'), ((914, 975), 'utils.utils.mount_message', 'mount_message', (['"""menu_ent... |
import os
from django.conf import settings
from factory import DjangoModelFactory, Sequence, SubFactory
from factory.fuzzy import FuzzyInteger, FuzzyChoice
from mii_sorter.models import Episode, Season, Serie, Movie, RegexRenaming
class SerieFactory(DjangoModelFactory):
class Meta:
model = Serie
... | [
"factory.fuzzy.FuzzyInteger",
"factory.SubFactory",
"factory.fuzzy.FuzzyChoice",
"factory.Sequence",
"os.path.join"
] | [((367, 410), 'factory.fuzzy.FuzzyChoice', 'FuzzyChoice', (["['Serie1', 'Serie2', 'Serie3']"], {}), "(['Serie1', 'Serie2', 'Serie3'])\n", (378, 410), False, 'from factory.fuzzy import FuzzyInteger, FuzzyChoice\n'), ((559, 587), 'factory.fuzzy.FuzzyInteger', 'FuzzyInteger', ([], {'low': '(1)', 'high': '(10)'}), '(low=1,... |
# Form / Message Bar
# Use message bars to indicate relevant status information.
# #form #message_bar
# ---
from h2o_wave import site, ui
page = site['/demo']
page['example'] = ui.form_card(
box='1 1 4 -1',
items=[
ui.message_bar(type='blocked', text='This action is blocked.'),
ui.message_bar(... | [
"h2o_wave.ui.message_bar"
] | [((233, 295), 'h2o_wave.ui.message_bar', 'ui.message_bar', ([], {'type': '"""blocked"""', 'text': '"""This action is blocked."""'}), "(type='blocked', text='This action is blocked.')\n", (247, 295), False, 'from h2o_wave import site, ui\n'), ((305, 366), 'h2o_wave.ui.message_bar', 'ui.message_bar', ([], {'type': '"""er... |
# ******************************************************************************
# Copyright 2017-2018 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | [
"ngraph.transformers.exop.ExecutionState",
"future.utils.itervalues",
"ngraph.transformers.passes.exopdelegate.ExOpGraphOpAccessor",
"ngraph.util.trace_events.TraceEventTracker",
"future.utils.with_metaclass",
"future.utils.iteritems",
"weakref.WeakValueDictionary"
] | [((3541, 3576), 'future.utils.with_metaclass', 'with_metaclass', (['abc.ABCMeta', 'object'], {}), '(abc.ABCMeta, object)\n', (3555, 3576), False, 'from future.utils import with_metaclass\n'), ((1740, 1783), 'ngraph.util.trace_events.TraceEventTracker', 'TraceEventTracker', (['self.computation_op.name'], {}), '(self.com... |
from mars_profiling.report.presentation.core import FrequencyTable
from mars_profiling.report.presentation.flavours.html import templates
class HTMLFrequencyTable(FrequencyTable):
def render(self):
return templates.template("frequency_table.html").render(**self.content)
| [
"mars_profiling.report.presentation.flavours.html.templates.template"
] | [((219, 261), 'mars_profiling.report.presentation.flavours.html.templates.template', 'templates.template', (['"""frequency_table.html"""'], {}), "('frequency_table.html')\n", (237, 261), False, 'from mars_profiling.report.presentation.flavours.html import templates\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 1 15:45:38 2022
@author: erri
"""
import numpy as np
import os
run = 'q07_1'
DoD_name = 'DoD_s1-s0_filt_nozero_rst.txt'
home_dir = os.getcwd()
DoDs_dir = os.path.join(home_dir, 'DoDs')
DoD_path = os.path.join(DoDs_dir, 'DoD_' + run, DoD_name)
DoD ... | [
"numpy.nansum",
"numpy.sum",
"numpy.abs",
"os.getcwd",
"numpy.nanstd",
"numpy.isnan",
"numpy.where",
"numpy.loadtxt",
"os.path.join",
"numpy.nanmean"
] | [((204, 215), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (213, 215), False, 'import os\n'), ((227, 257), 'os.path.join', 'os.path.join', (['home_dir', '"""DoDs"""'], {}), "(home_dir, 'DoDs')\n", (239, 257), False, 'import os\n'), ((269, 315), 'os.path.join', 'os.path.join', (['DoDs_dir', "('DoD_' + run)", 'DoD_name'],... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
#
# Copyright 2012 New Dream Network, LLC (DreamHost)
# 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
#
# h... | [
"quantum.db.migration.should_run",
"mock.patch.object",
"quantum.db.migration.cli.main",
"mock.call",
"quantum.db.migration.cli.CONF.reset"
] | [((1269, 1313), 'mock.patch.object', 'mock.patch.object', (['cli', '"""do_alembic_command"""'], {}), "(cli, 'do_alembic_command')\n", (1286, 1313), False, 'import mock\n'), ((1444, 1460), 'quantum.db.migration.cli.CONF.reset', 'cli.CONF.reset', ([], {}), '()\n', (1458, 1460), False, 'from quantum.db.migration import cl... |
# pylint: disable=no-self-use,unused-variable,expression-not-assigned
from unittest.mock import Mock, patch
import log
import pytest
from expecter import expect
from gitman import cli
from gitman.common import _Config
from gitman.exceptions import ScriptFailure, UncommittedChanges
class TestMain:
"""Unit tests... | [
"log.debug",
"unittest.mock.Mock",
"expecter.expect",
"gitman.cli.main",
"unittest.mock.patch",
"pytest.raises",
"log.warning",
"pytest.mark.parametrize",
"log.error"
] | [((1594, 1623), 'unittest.mock.patch', 'patch', (['"""gitman.commands.init"""'], {}), "('gitman.commands.init')\n", (1599, 1623), False, 'from unittest.mock import Mock, patch\n'), ((1876, 1908), 'unittest.mock.patch', 'patch', (['"""gitman.commands.install"""'], {}), "('gitman.commands.install')\n", (1881, 1908), Fals... |
# SPDX-FileCopyrightText: 2018 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
`adafruit_l3gd20`
====================================================
Adafruit 9-DOF Absolute Orientation IMU Fusion Breakout - L3GD20
This is a CircuitPython driver for the Bosch L3GD20 nine degree of freedom
inertia... | [
"adafruit_register.i2c_struct.Struct",
"micropython.const",
"adafruit_bus_device.spi_device.SPIDevice",
"ustruct.unpack",
"adafruit_bus_device.i2c_device.I2CDevice"
] | [((1171, 1179), 'micropython.const', 'const', (['(0)'], {}), '(0)\n', (1176, 1179), False, 'from micropython import const\n'), ((1202, 1210), 'micropython.const', 'const', (['(1)'], {}), '(1)\n', (1207, 1210), False, 'from micropython import const\n'), ((1234, 1242), 'micropython.const', 'const', (['(2)'], {}), '(2)\n'... |
from __future__ import print_function, absolute_import, unicode_literals, division
import six
from six.moves import (zip, filter, map, reduce, input, range)
from IPython.core.display import Image as display_image
from .dot import (
render_nx_as_dot, clear_formatting,
format_graph_for_lifespan,
format_grap... | [
"IPython.core.display.Image"
] | [((1148, 1172), 'IPython.core.display.Image', 'display_image', (['temp_file'], {}), '(temp_file)\n', (1161, 1172), True, 'from IPython.core.display import Image as display_image\n'), ((2234, 2258), 'IPython.core.display.Image', 'display_image', (['temp_file'], {}), '(temp_file)\n', (2247, 2258), True, 'from IPython.cor... |
from __future__ import absolute_import
from __future__ import print_function
import sys
import os
import math
# the next line can be removed after installation
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))))
from veriloggen import *
t... | [
"math.log",
"os.path.abspath"
] | [((385, 399), 'math.log', 'math.log', (['v', '(2)'], {}), '(v, 2)\n', (393, 399), False, 'import math\n'), ((260, 285), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (275, 285), False, 'import os\n')] |
"""
Utilities for working with datasets in
`YOLO format <https://github.com/AlexeyAB/darknet>`_.
| Copyright 2017-2021, Voxel51, Inc.
| `voxel51.com <https://voxel51.com/>`_
|
"""
import os
import eta.core.utils as etau
import fiftyone as fo
import fiftyone.core.labels as fol
import fiftyone.core.utils as fou
import... | [
"fiftyone.core.utils.UniqueFilenameMaker",
"fiftyone.core.labels.Detection",
"os.path.basename",
"os.path.exists",
"fiftyone.core.labels.Detections",
"os.path.relpath",
"os.path.splitext",
"eta.core.utils.ensure_dir",
"os.path.join"
] | [((10264, 10301), 'fiftyone.core.labels.Detections', 'fol.Detections', ([], {'detections': 'detections'}), '(detections=detections)\n', (10278, 10301), True, 'import fiftyone.core.labels as fol\n'), ((10617, 10670), 'fiftyone.core.labels.Detection', 'fol.Detection', ([], {'label': 'label', 'bounding_box': 'bounding_box... |
# Copyright 2016 <NAME> and The Novo Nordisk Foundation Center for Biosustainability, DTU.
# 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
# Unle... | [
"pickle.loads",
"gzip.open",
"pickle.dumps",
"IProgress.Percentage",
"os.path.getsize",
"os.path.dirname",
"numpy.dtype",
"time.time",
"cameo.fba",
"cameo.flux_analysis.analysis.n_carbon",
"shutil.copyfileobj",
"os.path.join",
"logging.getLogger",
"re.compile"
] | [((1086, 1122), 'os.path.join', 'os.path.join', (['config.prj_dir', '"""data"""'], {}), "(config.prj_dir, 'data')\n", (1098, 1122), False, 'import os\n'), ((1136, 1174), 'os.path.join', 'os.path.join', (['config.prj_dir', '"""models"""'], {}), "(config.prj_dir, 'models')\n", (1148, 1174), False, 'import os\n'), ((1185,... |
from PyKaraokeSearch import search_clubdam, ClubDamSearchQuery
if __name__ == '__main__':
import json
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('keyword', type=str)
parser.add_argument('-o', '--output_path', type=str)
parser.add_argument('-t', '--timeout', type=flo... | [
"json.dump",
"argparse.ArgumentParser",
"PyKaraokeSearch.ClubDamSearchQuery"
] | [((141, 166), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (164, 166), False, 'import argparse\n'), ((474, 509), 'PyKaraokeSearch.ClubDamSearchQuery', 'ClubDamSearchQuery', ([], {'keyword': 'keyword'}), '(keyword=keyword)\n', (492, 509), False, 'from PyKaraokeSearch import search_clubdam, Clu... |
from flask import Flask, render_template
from formulario import CadastroForm
app = Flask (__name__)
app.config['SECRET_KEY'] = 'dkshvfdikhgolfhvljh'
@app.route('/')
def home():
return render_template('home.html')
@app.route('/cadastro', methods=["GET", "POST"])
def Cadastro():
formulario=Cadastr... | [
"formulario.CadastroForm",
"flask.Flask",
"flask.render_template"
] | [((90, 105), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (95, 105), False, 'from flask import Flask, render_template\n'), ((199, 227), 'flask.render_template', 'render_template', (['"""home.html"""'], {}), "('home.html')\n", (214, 227), False, 'from flask import Flask, render_template\n'), ((313, 327), ... |
from __future__ import division
import random
import threading
import numpy as np
# Major -> Mixolydian (-) | Lydian (-) 0
# Dorian -> Minor (-) | Mixolydian (+) 1
# Phyrgian -> Locrian (-) | Minor (+) 2
# Lydian -> Mixolydian (-) | Major (+) 3
# Mixolydian -> Dorian (-) | Major (+) 4
# Min... | [
"threading.Timer",
"random.choice",
"numpy.clip",
"random.random",
"numpy.mean",
"numpy.exp",
"numpy.sign",
"numpy.log10"
] | [((2880, 2926), 'numpy.clip', 'np.clip', (['tempo', '(old_tempo - 20)', '(old_tempo + 20)'], {}), '(tempo, old_tempo - 20, old_tempo + 20)\n', (2887, 2926), True, 'import numpy as np\n'), ((3557, 3591), 'numpy.sign', 'np.sign', (['(target_scale - scale_rank)'], {}), '(target_scale - scale_rank)\n', (3564, 3591), True, ... |
import pstree
from pstree import Tree
EXAMPLE_TREE = (
Tree("init", Tree("amd")
, Tree("2*[strsd]")
, Tree("atd")
, Tree("crond")
, Tree("deskguide_apple")
, Tree("eth0")
, Tree("gdm", Tree("gdm", Tree("X")
, Tree("gn... | [
"pstree.print_tree",
"io.StringIO",
"pstree.Tree"
] | [((70, 81), 'pstree.Tree', 'Tree', (['"""amd"""'], {}), "('amd')\n", (74, 81), False, 'from pstree import Tree\n'), ((95, 112), 'pstree.Tree', 'Tree', (['"""2*[strsd]"""'], {}), "('2*[strsd]')\n", (99, 112), False, 'from pstree import Tree\n'), ((126, 137), 'pstree.Tree', 'Tree', (['"""atd"""'], {}), "('atd')\n", (130,... |
#!/usr/bin/env python3
# coding:utf-8
from datetime import date # 和 004_11.py 换汤不换药,date(y1, m1, d1).__sub__(date(y2, m2, d2)) 计算两个日期之差
year_input, month_input, day_input = [ int(x) for x in input("input year/month/day(e.g. 2019/1/1): ").split('/')]
print(date(year_input, month_input, day_input).__sub__(date(year_in... | [
"datetime.date"
] | [((308, 336), 'datetime.date', 'date', (['(year_input - 1)', '(12)', '(31)'], {}), '(year_input - 1, 12, 31)\n', (312, 336), False, 'from datetime import date\n'), ((259, 299), 'datetime.date', 'date', (['year_input', 'month_input', 'day_input'], {}), '(year_input, month_input, day_input)\n', (263, 299), False, 'from d... |
import torch
from torch.nn.functional import one_hot
import h5py
import shutil
import numpy as np
from pathlib import Path
from tqdm import tqdm
from time import time
from utils.metrics import calc_ece, calc_nll_brier, BrierLoss
from runners.base_runner import BaseRunner, reduce_tensor, gather_tensor
class CnnRunne... | [
"tqdm.tqdm",
"h5py.File",
"runners.base_runner.gather_tensor",
"runners.base_runner.reduce_tensor",
"shutil.copy2",
"torch.load",
"time.time",
"pathlib.Path",
"numpy.mean",
"torch.distributed.get_world_size",
"utils.metrics.calc_nll_brier",
"torch.no_grad",
"utils.metrics.calc_ece",
"numpy... | [((2154, 2169), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (2167, 2169), False, 'import torch\n'), ((883, 917), 'torch.distributed.get_world_size', 'torch.distributed.get_world_size', ([], {}), '()\n', (915, 917), False, 'import torch\n'), ((4048, 4083), 'tqdm.tqdm', 'tqdm', (['loader'], {'total': 'self.loader... |
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import sys
import unittest
import mock
from g... | [
"dashboard.models.anomaly.Anomaly.query",
"dashboard.common.testing_common.AddRows",
"dashboard.common.utils.GetTestContainerKey",
"dashboard.common.utils.OldStyleTestKey",
"dashboard.models.anomaly_config.AnomalyConfig",
"dashboard.common.testing_common.AddTests",
"dashboard.models.subscription.Subscri... | [((2595, 2927), 'dashboard.find_change_points.ChangePoint', 'find_change_points.ChangePoint', ([], {'x_value': 'x_value', 'median_before': 'median_before', 'median_after': 'median_after', 'window_start': '(1)', 'window_end': '(8)', 'size_before': 'None', 'size_after': 'None', 'relative_change': 'None', 'std_dev_before'... |
from pyflakes.checker import Checker
import sys
import ast
import os
from pathlib import Path
from filecmp import dircmp
import subprocess
from pytest import raises
import pytest
from ..removestar import (names_to_replace, star_imports, get_names,
get_names_from_dir, get_names_dynamically, ... | [
"subprocess.run",
"os.path.abspath",
"os.makedirs",
"pathlib.Path",
"pytest.mark.parametrize",
"ast.parse",
"os.chdir",
"filecmp.dircmp"
] | [((11458, 11508), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""relative"""', '[True, False]'], {}), "('relative', [True, False])\n", (11481, 11508), False, 'import pytest\n'), ((31880, 31930), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""relative"""', '[True, False]'], {}), "('relative', [... |
from json import JSONDecodeError
from logging import getLogger
from httpx import HTTPStatusError, Request, RequestError, Response
logger = getLogger(__name__)
def log_request(request: Request) -> None:
"""Hook to log http requests"""
logger.debug(
f"Request event hook: {request.method} {request.url}... | [
"logging.getLogger"
] | [((141, 160), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (150, 160), False, 'from logging import getLogger\n')] |
try:
from setuptools import setup, find_packages
except ImportError:
from ez_setup import use_setuptools
use_setuptools()
from setuptools import setup, find_packages
import sys
PY2 = sys.version_info[0] == 2
PY26 = PY2 and sys.version_info[1] < 7
NAME = 'pyexcel-gantt'
AUTHOR = 'C.W.'
VERSION = '0.0.1'... | [
"ez_setup.use_setuptools",
"setuptools.find_packages"
] | [((1184, 1240), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['ez_setup', 'examples', 'tests']"}), "(exclude=['ez_setup', 'examples', 'tests'])\n", (1197, 1240), False, 'from setuptools import setup, find_packages\n'), ((117, 133), 'ez_setup.use_setuptools', 'use_setuptools', ([], {}), '()\n', (131, 1... |
import numpy as np
import torch
# 相交矩形的面积
def intersect(box_a, box_b):
"""计算两组矩形两两之间相交区域的面积
Args:
box_a: (tensor) bounding boxes, Shape: [A, 4].
box_b: (tensor) bounding boxes, Shape: [B, 4].
Return:
(tensor) intersection area, Shape: [A, B].
"""
A = box_a.size(0)
B = bo... | [
"torch.where",
"torch.argsort",
"torch.cat",
"torch.exp",
"torch.sigmoid",
"torch.clamp",
"torch.Tensor",
"torch.arange",
"torch.cuda.is_available",
"torch.zeros",
"torch.from_numpy"
] | [((608, 643), 'torch.clamp', 'torch.clamp', (['(max_xy - min_xy)'], {'min': '(0)'}), '(max_xy - min_xy, min=0)\n', (619, 643), False, 'import torch\n'), ((3757, 3800), 'torch.argsort', 'torch.argsort', (['cate_scores'], {'descending': '(True)'}), '(cate_scores, descending=True)\n', (3770, 3800), False, 'import torch\n'... |
#!/usr/bin/env python
#
# Copyright (C) 2015 <NAME> <<EMAIL>>
#
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright notice,
# t... | [
"os.path.abspath",
"os.path.splitext",
"platform.system",
"os.path.join",
"os.listdir"
] | [((1797, 1821), 'os.path.abspath', 'os.path.abspath', (['dirName'], {}), '(dirName)\n', (1812, 1821), False, 'import os\n'), ((1829, 1848), 'os.listdir', 'os.listdir', (['dirName'], {}), '(dirName)\n', (1839, 1848), False, 'import os\n'), ((1883, 1903), 'os.path.splitext', 'os.path.splitext', (['fn'], {}), '(fn)\n', (1... |
import os
import torch
import pickle
import pytest
import tempfile
import h5py
import numpy as np
from timeit import timeit
from tianshou.data import Batch, SegmentTree, \
ReplayBuffer, ListReplayBuffer, PrioritizedReplayBuffer
from tianshou.data.utils.converter import to_hdf5
if __name__ == '__main__':
from ... | [
"os.remove",
"numpy.abs",
"numpy.allclose",
"numpy.ones",
"numpy.random.randint",
"numpy.arange",
"os.close",
"timeit.timeit",
"tianshou.data.ListReplayBuffer",
"numpy.random.randn",
"tianshou.data.PrioritizedReplayBuffer",
"tianshou.data.SegmentTree",
"pytest.raises",
"numpy.random.choice... | [((453, 468), 'test.base.env.MyTestEnv', 'MyTestEnv', (['size'], {}), '(size)\n', (462, 468), False, 'from test.base.env import MyTestEnv\n'), ((479, 500), 'tianshou.data.ReplayBuffer', 'ReplayBuffer', (['bufsize'], {}), '(bufsize)\n', (491, 500), False, 'from tianshou.data import Batch, SegmentTree, ReplayBuffer, List... |
import torch
import torch.nn.functional as F
from .. import BaseModel, register_model
from cogdl.utils import (
add_remaining_self_loops,
remove_self_loops,
row_normalization,
symmetric_normalization,
to_undirected,
spmm,
dropout_adj,
)
def get_adj(row, col, asymm_norm=False, set_diag=Tru... | [
"cogdl.utils.dropout_adj",
"torch.log_softmax",
"torch.ones",
"torch.stack",
"torch.nn.ModuleList",
"torch.nn.BatchNorm1d",
"cogdl.utils.to_undirected",
"torch.cat",
"torch.nn.functional.dropout",
"cogdl.utils.symmetric_normalization",
"cogdl.utils.spmm",
"torch.max",
"torch.nn.Linear",
"t... | [((360, 383), 'torch.stack', 'torch.stack', (['[row, col]'], {}), '([row, col])\n', (371, 383), False, 'import torch\n'), ((503, 550), 'cogdl.utils.add_remaining_self_loops', 'add_remaining_self_loops', (['edge_index', 'edge_attr'], {}), '(edge_index, edge_attr)\n', (527, 550), False, 'from cogdl.utils import add_remai... |
# -*- coding: utf-8 -*-
import os
import shutil
from tempfile import mkstemp
from typing import Optional
import cx_Oracle
import psycopg2
from psycopg2.extras import execute_values
from pyinterprod import logger
from pyinterprod.utils.kvdb import KVdb
from pyinterprod.utils.pg import url2dict
def import_similarity... | [
"os.remove",
"tempfile.mkstemp",
"pyinterprod.utils.kvdb.KVdb",
"os.path.getsize",
"pyinterprod.logger.info",
"os.close",
"pyinterprod.utils.pg.url2dict",
"shutil.copyfile",
"cx_Oracle.connect",
"psycopg2.extras.execute_values"
] | [((363, 388), 'pyinterprod.logger.info', 'logger.info', (['"""populating"""'], {}), "('populating')\n", (374, 388), False, 'from pyinterprod import logger\n'), ((2547, 2570), 'pyinterprod.logger.info', 'logger.info', (['"""complete"""'], {}), "('complete')\n", (2558, 2570), False, 'from pyinterprod import logger\n'), (... |
# API endpoints for uploaded media, including avatars
from flask import Blueprint, current_app, jsonify, request, send_from_directory, send_file
from flask_jwt_extended import get_jwt_identity, jwt_required
from liblio import db, jwt, liblio_uploads
from liblio.error import APIError
from liblio.models import Upload, ... | [
"liblio.helpers.decode_printable_id",
"flask.Blueprint",
"liblio.error.APIError",
"liblio.liblio_uploads.path",
"flask.send_file"
] | [((506, 561), 'flask.Blueprint', 'Blueprint', (['"""media"""', '__name__'], {'url_prefix': 'BLUEPRINT_PATH'}), "('media', __name__, url_prefix=BLUEPRINT_PATH)\n", (515, 561), False, 'from flask import Blueprint, current_app, jsonify, request, send_from_directory, send_file\n'), ((809, 844), 'liblio.liblio_uploads.path'... |
import pickle
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from src.data_process_utils import create_folder, standardize_smi, get_encoded_smi
from src.CONSTS import BATCH_SIZE_PRED
def get_train_val_test_data():
create_folder('predictor_data/train_data/')
create_... | [
"src.data_process_utils.get_encoded_smi",
"pickle.dump",
"numpy.quantile",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"src.data_process_utils.create_folder",
"pickle.load",
"pandas.concat",
"numpy.vstack"
] | [((265, 308), 'src.data_process_utils.create_folder', 'create_folder', (['"""predictor_data/train_data/"""'], {}), "('predictor_data/train_data/')\n", (278, 308), False, 'from src.data_process_utils import create_folder, standardize_smi, get_encoded_smi\n'), ((313, 355), 'src.data_process_utils.create_folder', 'create_... |
__author__ = "arunrajms"
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.decorators.csrf import csrf_exempt
from views import DiscoveryRuleList
from views import DiscoveryRuleDetailList
urlpatterns = patterns('',
url(r'^$',DiscoveryRuleList.as_v... | [
"views.DiscoveryRuleDetailList.as_view",
"views.DiscoveryRuleList.as_view"
] | [((298, 325), 'views.DiscoveryRuleList.as_view', 'DiscoveryRuleList.as_view', ([], {}), '()\n', (323, 325), False, 'from views import DiscoveryRuleList\n'), ((373, 406), 'views.DiscoveryRuleDetailList.as_view', 'DiscoveryRuleDetailList.as_view', ([], {}), '()\n', (404, 406), False, 'from views import DiscoveryRuleDetai... |
# (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import pytest
from datadog_checks.errors import CheckException
from datadog_checks.mcache.mcache import InvalidConfigError
from common import (PORT, SERVICE_CHECK, HOST)
def test_bad_config(check):
"""
... | [
"pytest.raises"
] | [((402, 435), 'pytest.raises', 'pytest.raises', (['InvalidConfigError'], {}), '(InvalidConfigError)\n', (415, 435), False, 'import pytest\n'), ((672, 701), 'pytest.raises', 'pytest.raises', (['CheckException'], {}), '(CheckException)\n', (685, 701), False, 'import pytest\n')] |
import os
import sys
import re
import datetime
import calendar
import boto3
import botocore
s3client = boto3.client('s3')
BUCKET_NAME = os.getenv('bucket_name') # S3 bucket of transaction emails
ddbclient = boto3.client('dynamodb')
TABLE_NAME = os.getenv('table_name') # DynamoDB table of transaction data
NUM_DIGIT... | [
"sys.exit",
"os.getenv",
"boto3.client"
] | [((106, 124), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (118, 124), False, 'import boto3\n'), ((139, 163), 'os.getenv', 'os.getenv', (['"""bucket_name"""'], {}), "('bucket_name')\n", (148, 163), False, 'import os\n'), ((211, 235), 'boto3.client', 'boto3.client', (['"""dynamodb"""'], {}), "('dynamo... |
import mock
from octoprint_discordremote import DiscordRemotePlugin
from unittests.discordremotetestcase import DiscordRemoteTestCase
def mock_global_get_boolean(array):
return {
str(['webcam', 'flipV']): False,
str(['webcam', 'flipH']): False,
str(['webcam', 'rotate90']): False,
}[st... | [
"mock.patch",
"mock.Mock",
"octoprint_discordremote.DiscordRemotePlugin"
] | [((436, 457), 'octoprint_discordremote.DiscordRemotePlugin', 'DiscordRemotePlugin', ([], {}), '()\n', (455, 457), False, 'from octoprint_discordremote import DiscordRemotePlugin\n'), ((485, 496), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (494, 496), False, 'import mock\n'), ((535, 546), 'mock.Mock', 'mock.Mock', ([],... |
################
## adaline.py ##
################
# original implementation
# <NAME>, Python Machine Learning, 3rd Edition
#############
## imports ##
#############
import numpy as np
from sklearn.base import BaseEstimator, ClassifierMixin
from sklearn.utils.validation import check_X_y, check_is_fitted
from sklear... | [
"rktools.monitors.ProgressBar",
"sklearn.utils.validation.check_X_y",
"numpy.random.RandomState",
"sklearn.utils.validation.check_is_fitted",
"sklearn.utils.multiclass.unique_labels",
"numpy.dot"
] | [((1768, 1808), 'numpy.random.RandomState', 'np.random.RandomState', (['self.random_state'], {}), '(self.random_state)\n', (1789, 1808), True, 'import numpy as np\n'), ((2423, 2438), 'sklearn.utils.validation.check_X_y', 'check_X_y', (['X', 'y'], {}), '(X, y)\n', (2432, 2438), False, 'from sklearn.utils.validation impo... |
# Sum of numbers that can be written as the sum of their fifth power.
from __future__ import print_function
import timeit
try:
range = xrange
except NameError:
pass
start = timeit.default_timer()
def euler_30():
fifth_pow = lambda x: x**5
return sum([i for i in range(2, 1000000) if
... | [
"timeit.default_timer"
] | [((186, 208), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (206, 208), False, 'import timeit\n'), ((413, 435), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (433, 435), False, 'import timeit\n')] |
"""
# Copyright 2022 Red Hat
#
# 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 agr... | [
"io.StringIO",
"json.load",
"tempfile.TemporaryDirectory",
"testcontainers.core.waiting_utils.wait_container_is_ready",
"git.Repo.clone_from",
"requests.get",
"requests.put",
"testcontainers.compose.DockerCompose"
] | [((902, 927), 'testcontainers.core.waiting_utils.wait_container_is_ready', 'wait_container_is_ready', ([], {}), '()\n', (925, 927), False, 'from testcontainers.core.waiting_utils import wait_container_is_ready\n'), ((962, 979), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (974, 979), False, 'import request... |
import numpy as np
from odeintw import odeintw
from epidemioptim.environments.models.base_model import BaseModel
from epidemioptim.utils import *
PATH_TO_DATA = get_repo_path() + '/data/jane_model_data/ScenarioPlanFranceOne16.xlsx'
PATH_TO_HOME_MATRIX = get_repo_path() + '/data/jane_model_data/contactHome.txt'
PATH_... | [
"numpy.divide",
"numpy.array",
"numpy.arange",
"numpy.linspace",
"numpy.atleast_2d"
] | [((3881, 3897), 'numpy.divide', 'np.divide', (['Xm', 'T'], {}), '(Xm, T)\n', (3890, 3897), True, 'import numpy as np\n'), ((4130, 4143), 'numpy.array', 'np.array', (['pv2'], {}), '(pv2)\n', (4138, 4143), True, 'import numpy as np\n'), ((4154, 4167), 'numpy.array', 'np.array', (['pv3'], {}), '(pv3)\n', (4162, 4167), Tru... |
from allauth.account.views import LoginView, LogoutView
from django.conf import settings
from django.conf.urls import include
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.urls import path
from django.views.generic import TemplateView
from bar.views import MenuV... | [
"django.contrib.auth.decorators.login_required",
"people.views.PeopleView.as_view",
"villages.views.VillageDetailView.as_view",
"django.conf.urls.include",
"django.urls.path",
"sponsors.views.SponsorsView.as_view",
"allauth.account.views.LoginView.as_view",
"camps.views.CampDetailView.as_view",
"cam... | [((799, 831), 'django.contrib.auth.decorators.login_required', 'login_required', (['admin.site.login'], {}), '(admin.site.login)\n', (813, 831), False, 'from django.contrib.auth.decorators import login_required\n'), ((1927, 1958), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.... |
# from matplotlib import rc
import matplotlib.cm as mplcm
import matplotlib.colors as colors
import matplotlib.pyplot as plt
import numpy as np
import os
import seaborn as sns
from particle.statistics import (
calculate_avg_vel,
calculate_l1_convergence,
moving_average,
)
from particle.processing import (
... | [
"matplotlib.pyplot.tight_layout",
"particle.processing.get_parameter_range",
"matplotlib.pyplot.show",
"matplotlib.pyplot.get_cmap",
"matplotlib.cm.ScalarMappable",
"particle.processing.load_traj_data",
"particle.statistics.calculate_l1_convergence",
"matplotlib.pyplot.subplots",
"matplotlib.colors.... | [((465, 503), 'seaborn.set', 'sns.set', ([], {'style': '"""white"""', 'context': '"""talk"""'}), "(style='white', context='talk')\n", (472, 503), True, 'import seaborn as sns\n'), ((878, 893), 'os.chdir', 'os.chdir', (['"""E:/"""'], {}), "('E:/')\n", (886, 893), False, 'import os\n'), ((1157, 1183), 'particle.processin... |
import argparse
import functools
import os
from datetime import datetime
import paddle
from paddle.static import InputSpec
from utils.se_resnet_vd import SE_ResNet_vd
from utils.utility import add_arguments, print_arguments
parser = argparse.ArgumentParser(description=__doc__)
add_arg = functools.partial(add_argumen... | [
"functools.partial",
"argparse.ArgumentParser",
"utils.utility.print_arguments",
"datetime.datetime.now",
"paddle.summary",
"utils.se_resnet_vd.SE_ResNet_vd",
"os.path.join",
"paddle.static.InputSpec"
] | [((236, 280), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '__doc__'}), '(description=__doc__)\n', (259, 280), False, 'import argparse\n'), ((291, 341), 'functools.partial', 'functools.partial', (['add_arguments'], {'argparser': 'parser'}), '(add_arguments, argparser=parser)\n', (308, 341)... |
# -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# 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 o... | [
"proto.RepeatedField",
"proto.module",
"proto.Field"
] | [((796, 1152), 'proto.module', 'proto.module', ([], {'package': '"""google.ads.googleads.v4.services"""', 'marshal': '"""google.ads.googleads.v4"""', 'manifest': "{'ListMerchantCenterLinksRequest', 'ListMerchantCenterLinksResponse',\n 'GetMerchantCenterLinkRequest', 'MutateMerchantCenterLinkRequest',\n 'MerchantC... |
# -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modif... | [
"unittest.main",
"qiskit.QuantumCircuit",
"qiskit.converters.circuit_to_dagdependency.circuit_to_dagdependency",
"qiskit.ClassicalRegister",
"qiskit.converters.dagdependency_to_circuit.dagdependency_to_circuit",
"qiskit.QuantumRegister"
] | [((1698, 1724), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1711, 1724), False, 'import unittest\n'), ((1090, 1108), 'qiskit.QuantumRegister', 'QuantumRegister', (['(3)'], {}), '(3)\n', (1105, 1108), False, 'from qiskit import QuantumRegister, ClassicalRegister, QuantumCircuit\n'),... |
#!/usr/bin/env python3
"""Tool for determing and diplaying controller version and build info."""
import argparse
import re
import os
import subprocess
from subprocess import check_output
from datetime import datetime
from pipes import quote
def cmp(a, b):
return (a > b) - (a < b)
def normalize(s):
"""Con... | [
"argparse.ArgumentParser",
"subprocess.check_output",
"os.environ.get",
"datetime.datetime.now",
"argparse.FileType"
] | [((10617, 10657), 'os.environ.get', 'os.environ.get', (['"""OVERRIDE_VERSION"""', 'None'], {}), "('OVERRIDE_VERSION', None)\n", (10631, 10657), False, 'import os\n'), ((11042, 11093), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Version Tool"""'}), "(description='Version Tool')\n", (11... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from Cryptodome import Random
from Cryptodome.Cipher import AES
from Cryptodome.Util.Padding import pad, unpad
class AESHandler(object):
@staticmethod
def generate_iv():
return Random.new().read(AES.block_size)
@staticmethod
def generate_key():
... | [
"Cryptodome.Cipher.AES.new",
"Cryptodome.Random.new",
"Cryptodome.Random.get_random_bytes",
"Cryptodome.Util.Padding.pad"
] | [((334, 361), 'Cryptodome.Random.get_random_bytes', 'Random.get_random_bytes', (['(32)'], {}), '(32)\n', (357, 361), False, 'from Cryptodome import Random\n'), ((504, 549), 'Cryptodome.Cipher.AES.new', 'AES.new', ([], {'key': 'key', 'mode': 'AES.MODE_GCM', 'nonce': 'iv'}), '(key=key, mode=AES.MODE_GCM, nonce=iv)\n', (5... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.4 on 2017-01-24 15:14
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('climatemodels', '0074_remove_inputdatainformation_climate_data_sets'),
]
operations... | [
"django.db.models.BooleanField"
] | [((452, 485), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (471, 485), False, 'from django.db import migrations, models\n')] |
from train_lstm import JigsawLSTMModel, CONFIG
from pre_process import encode_sentence
import numpy as np
import torch
import pandas as pd
from tqdm import tqdm
import gc
import ast,emoji, string, re
from torch.utils.data import Dataset, DataLoader
# PyTorch Lightning
import pytorch_lightning as pl
MODEL_PATHS = [
... | [
"train_lstm.JigsawLSTMModel.load_from_checkpoint",
"torch.utils.data.DataLoader",
"pandas.read_csv",
"gc.collect",
"numpy.mean",
"numpy.array",
"numpy.fromstring",
"numpy.concatenate"
] | [((1535, 1547), 'gc.collect', 'gc.collect', ([], {}), '()\n', (1545, 1547), False, 'import gc\n'), ((2256, 2278), 'numpy.array', 'np.array', (['final_preds1'], {}), '(final_preds1)\n', (2264, 2278), True, 'import numpy as np\n'), ((2298, 2327), 'numpy.mean', 'np.mean', (['final_preds1'], {'axis': '(0)'}), '(final_preds... |
# This file is part of Indico.
# Copyright (C) 2002 - 2019 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from __future__ import unicode_literals
from indico.core import signals
from indico.core.logger import Lo... | [
"indico.core.logger.Logger.get",
"indico.modules.events.notes.models.notes.EventNoteRevision.find"
] | [((336, 362), 'indico.core.logger.Logger.get', 'Logger.get', (['"""events.notes"""'], {}), "('events.notes')\n", (346, 362), False, 'from indico.core.logger import Logger\n'), ((518, 559), 'indico.modules.events.notes.models.notes.EventNoteRevision.find', 'EventNoteRevision.find', ([], {'user_id': 'source.id'}), '(user... |
# -*- coding: utf-8 -*-
# @Time : 2020/11/4 16:04
# @Email : <EMAIL>
# @Software: PyCharm
# @License: BSD 3-Clause
from itertools import combinations_with_replacement
import torch.nn.functional as F
import numpy as np
import os
import torch
from numpy import random
from torch import nn
from torch.nn import Module... | [
"torch.nn.Dropout",
"os.remove",
"numpy.random.seed",
"torch.cat",
"numpy.random.randint",
"cams.cam3d.GradCAM3dpp",
"torch.device",
"os.path.join",
"torch.flatten",
"torch.nn.Conv3d",
"torch.load",
"torch.utils.tensorboard.SummaryWriter",
"torch.nn.Linear",
"torch.zeros",
"torch.random.... | [((3557, 3571), 'numpy.random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (3568, 3571), False, 'from numpy import random\n'), ((3572, 3599), 'torch.random.manual_seed', 'torch.random.manual_seed', (['(0)'], {}), '(0)\n', (3596, 3599), False, 'import torch\n'), ((5152, 5227), 'torch.utils.tensorboard.SummaryWriter', '... |
import logging
logging.basicConfig(
level=logging.DEBUG,
format="%(levelname)s: %(asctime)s {%(filename)s:%(lineno)d}: %(message)s "
)
from sanskrit_data.schema import common
class RootAnalysis(common.JsonObject):
schema = common.recursively_merge_json_schemas(JsonObject.schema, ({
"type": "object",
"... | [
"logging.basicConfig",
"sanskrit_data.schema.common.recursively_merge_json_schemas"
] | [((15, 137), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG', 'format': '"""%(levelname)s: %(asctime)s {%(filename)s:%(lineno)d}: %(message)s """'}), "(level=logging.DEBUG, format=\n '%(levelname)s: %(asctime)s {%(filename)s:%(lineno)d}: %(message)s ')\n", (34, 137), False, 'import loggi... |
from wtforms import Form, BooleanField, StringField, validators
# from wtforms import HiddenField
from wtforms import PasswordField
class LoginForm(Form):
login = StringField('Username', [validators.Length(min=4, max=40)])
password = PasswordField('password', [validators.Length(min=4, max=40)])
class TaskFo... | [
"wtforms.BooleanField",
"wtforms.validators.Length"
] | [((415, 451), 'wtforms.BooleanField', 'BooleanField', (['"""Status"""'], {'default': '(True)'}), "('Status', default=True)\n", (427, 451), False, 'from wtforms import Form, BooleanField, StringField, validators\n'), ((194, 226), 'wtforms.validators.Length', 'validators.Length', ([], {'min': '(4)', 'max': '(40)'}), '(mi... |
# coding:utf-8
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2018 yutiansut/QUANTAXIS
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation th... | [
"QUANTAXIS.QAUtil.QA_util_random_with_topic"
] | [((5386, 5426), 'QUANTAXIS.QAUtil.QA_util_random_with_topic', 'QA_util_random_with_topic', ([], {'topic': '"""Order"""'}), "(topic='Order')\n", (5411, 5426), False, 'from QUANTAXIS.QAUtil import QA_util_log_info, QA_util_random_with_topic, QA_util_to_json_from_pandas\n')] |
"""
Python implementation of the MSD radix sort algorithm.
It used the binary representation of the integers to sort
them...
https://en.wikipedia.org/wiki/Radix_sort
"""
from __future__ import annotations
def msd_radix_sort(list_of_ints: list[int]) -> list[int]:
"""
Implementation of the MSD radix sort algorit... | [
"doctest.testmod"
] | [((4684, 4701), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (4699, 4701), False, 'import doctest\n')] |
#!/usr/bin/python
# this script will update the versions in plist and installer files to match that in resource.h
import plistlib, os, datetime, fileinput, glob, sys, string
scriptpath = os.path.dirname(os.path.realpath(__file__))
def replacestrs(filename, s, r):
files = glob.glob(filename)
for line in filein... | [
"sys.stdout.write",
"fileinput.input",
"os.path.realpath",
"plistlib.readPlist",
"datetime.date.today",
"glob.glob",
"plistlib.writePlist"
] | [((205, 231), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (221, 231), False, 'import plistlib, os, datetime, fileinput, glob, sys, string\n'), ((277, 296), 'glob.glob', 'glob.glob', (['filename'], {}), '(filename)\n', (286, 296), False, 'import glob\n'), ((314, 347), 'fileinput.input', '... |
from django.contrib import admin
from django.contrib.flatpages.admin import FlatPageAdmin
from django.contrib.flatpages.models import FlatPage
from django.contrib.sites.models import Site
from django.utils.translation import ugettext as _
from pagedown.widgets import AdminPagedownWidget
from explorer.models import *
f... | [
"django.contrib.sites.models.Site.objects.get_current",
"django.utils.translation.ugettext",
"django.contrib.admin.site.register",
"django.contrib.admin.site.unregister"
] | [((1402, 1444), 'django.contrib.admin.site.register', 'admin.site.register', (['Mission', 'MissionAdmin'], {}), '(Mission, MissionAdmin)\n', (1421, 1444), False, 'from django.contrib import admin\n'), ((1445, 1491), 'django.contrib.admin.site.register', 'admin.site.register', (['Challenge', 'ChallengeAdmin'], {}), '(Ch... |
import sys
from taurus.external.qt import Qt
from taurus.qt.qtgui.container import TaurusWidget
from taurus.qt.qtgui.display import TaurusLabel
from taurus.qt.qtgui.input import TaurusWheelEdit
from taurus.qt.qtgui.application import TaurusApplication
app = TaurusApplication(sys.argv)
panel = TaurusWidget()
layout = ... | [
"taurus.qt.qtgui.input.TaurusWheelEdit",
"taurus.qt.qtgui.container.TaurusWidget",
"taurus.qt.qtgui.display.TaurusLabel",
"taurus.qt.qtgui.application.TaurusApplication",
"taurus.external.qt.Qt.QHBoxLayout"
] | [((259, 286), 'taurus.qt.qtgui.application.TaurusApplication', 'TaurusApplication', (['sys.argv'], {}), '(sys.argv)\n', (276, 286), False, 'from taurus.qt.qtgui.application import TaurusApplication\n'), ((296, 310), 'taurus.qt.qtgui.container.TaurusWidget', 'TaurusWidget', ([], {}), '()\n', (308, 310), False, 'from tau... |
# Autogenerated by onnx-model-maker. Don't modify it manually.
import onnx
import onnx.helper
import onnx.numpy_helper
from onnx_model_maker import omm
from onnx_model_maker import onnx_mm_export
from onnx_model_maker.ops.op_helper import _add_input
@onnx_mm_export("v3.GRU")
def GRU(X, W, R, B=None, sequence_lens=No... | [
"onnx_model_maker.omm.model.graph.node.append",
"onnx.helper.make_node",
"onnx.checker.check_node",
"onnx_model_maker.ops.op_helper._add_input",
"onnx_model_maker.onnx_mm_export"
] | [((254, 278), 'onnx_model_maker.onnx_mm_export', 'onnx_mm_export', (['"""v3.GRU"""'], {}), "('v3.GRU')\n", (268, 278), False, 'from onnx_model_maker import onnx_mm_export\n'), ((513, 625), 'onnx.helper.make_node', 'onnx.helper.make_node', (['"""GRU"""', '_inputs', "[f'_t_GRU_{idx}_Y', f'_t_GRU_{idx}_Y_h']"], {'name': '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 1999-2020 Alibaba Group Holding Ltd.
#
# 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-... | [
"inspect.getfullargspec",
"copy.copy",
"numpy.ravel_multi_index",
"itertools.product",
"functools.reduce",
"math.log",
"builtins.sum"
] | [((1376, 1405), 'functools.reduce', 'reduce', (['operator.mul', 'x.shape'], {}), '(operator.mul, x.shape)\n', (1382, 1405), False, 'from functools import reduce\n'), ((18610, 18630), 'copy.copy', 'copy.copy', (['in_tensor'], {}), '(in_tensor)\n', (18619, 18630), False, 'import copy\n'), ((6480, 6520), 'itertools.produc... |
# 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 json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class GetBucketObjectResult:
"""
... | [
"pulumi.runtime.invoke"
] | [((7594, 7682), 'pulumi.runtime.invoke', 'pulumi.runtime.invoke', (['"""aws:s3/getBucketObject:getBucketObject"""', '__args__'], {'opts': 'opts'}), "('aws:s3/getBucketObject:getBucketObject', __args__,\n opts=opts)\n", (7615, 7682), False, 'import pulumi\n')] |
###
# Copyright (c) 2005, <NAME>
# Copyright (c) 2010-2021, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# ... | [
"supybot.i18n.PluginInternationalization",
"supybot.conf.registerGroup",
"supybot.conf.registerPlugin"
] | [((1793, 1826), 'supybot.i18n.PluginInternationalization', 'PluginInternationalization', (['"""RSS"""'], {}), "('RSS')\n", (1819, 1826), False, 'from supybot.i18n import PluginInternationalization, internationalizeDocstring\n'), ((2554, 2580), 'supybot.conf.registerPlugin', 'conf.registerPlugin', (['"""RSS"""'], {}), "... |
# Módulos servem para dividir grandes problemas em problemas menores
# Exemplo:
# inteiro ficaria dessa forma, mas se fosse um programa realmente grande, ou colossal, eu posso pegas as funções
import Aula22uteis
num = int(input("Digite um valor: "))
fat = Aula22uteis.fatorial(num)
print(f"O fatorial de {num} é {fat}"... | [
"Aula22uteis.dobro",
"Aula22uteis.fatorial"
] | [((258, 283), 'Aula22uteis.fatorial', 'Aula22uteis.fatorial', (['num'], {}), '(num)\n', (278, 283), False, 'import Aula22uteis\n'), ((351, 373), 'Aula22uteis.dobro', 'Aula22uteis.dobro', (['num'], {}), '(num)\n', (368, 373), False, 'import Aula22uteis\n')] |
import requests
from uniswap import Uniswap
PROVIDER = 'https://eth.elara.cybernode.ai/'
address = "0x0000000000000000000000000000000000000000"
private_key = None
uniswap_wrapper = Uniswap(address, private_key, version=2, provider=PROVIDER) # pass version=2 to use Uniswap v2
eth = "0x00000000000000000000000000000... | [
"uniswap.Uniswap",
"requests.get"
] | [((186, 245), 'uniswap.Uniswap', 'Uniswap', (['address', 'private_key'], {'version': '(2)', 'provider': 'PROVIDER'}), '(address, private_key, version=2, provider=PROVIDER)\n', (193, 245), False, 'from uniswap import Uniswap\n'), ((535, 598), 'requests.get', 'requests.get', (['"""https://api.coingecko.com/api/v3/coins/e... |
# -*- coding: utf-8 -*-
import pickle
import torch
from torch.autograd import Variable
# N is batch size; D_in is input dimension;
# H is hidden dimension; D_out is output dimension.
from dataset_gen import DatasetGenerator
file = 'train'
with open(file, mode='rb') as f:
pos, neg = pickle.load(f)
train = []... | [
"torch.nn.MSELoss",
"torch.nn.ReLU",
"torch.randn",
"dataset_gen.DatasetGenerator",
"torch.nn.NLLLoss",
"pickle.load",
"torch.nn.Linear"
] | [((814, 845), 'torch.nn.NLLLoss', 'torch.nn.NLLLoss', ([], {'weight': '[5, 1]'}), '(weight=[5, 1])\n', (830, 845), False, 'import torch\n'), ((856, 892), 'torch.nn.MSELoss', 'torch.nn.MSELoss', ([], {'size_average': '(False)'}), '(size_average=False)\n', (872, 892), False, 'import torch\n'), ((1191, 1209), 'dataset_gen... |
"""
The REST API is using the Python package 'klein', which makes it possible to
create HTTP routes and handlers with Twisted in a similar style to Flask:
https://github.com/twisted/klein
"""
import json
from klein import Klein
from logzero import logger
from neo.Network.NodeLeader import NodeLeader
from neo.Implemen... | [
"neo.Network.NodeLeader.NodeLeader.Instance",
"neo.Core.Blockchain.Blockchain.Default",
"neocore.UInt256.UInt256.ParseString",
"logzero.logger.info",
"neo.Implementations.Notifications.LevelDB.NotificationDB.NotificationDB.instance",
"klein.Klein",
"neocore.UInt160.UInt160.ParseString"
] | [((626, 633), 'klein.Klein', 'Klein', ([], {}), '()\n', (631, 633), False, 'from klein import Klein\n'), ((697, 722), 'neo.Implementations.Notifications.LevelDB.NotificationDB.NotificationDB.instance', 'NotificationDB.instance', ([], {}), '()\n', (720, 722), False, 'from neo.Implementations.Notifications.LevelDB.Notifi... |
from eng_to_ipa import transcribe
import sqlite3
import re
from os.path import join, abspath, dirname
conn = sqlite3.connect(join(abspath(dirname(__file__)),
"../eng_to_ipa/resources/CMU_dict.db"))
c = conn.cursor()
def create_dictionary_table():
try:
c.execute("""CREATE TABLE... | [
"os.path.dirname",
"eng_to_ipa.transcribe.cmu_to_ipa"
] | [((139, 156), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (146, 156), False, 'from os.path import join, abspath, dirname\n'), ((830, 847), 'os.path.dirname', 'dirname', (['__file__'], {}), '(__file__)\n', (837, 847), False, 'from os.path import join, abspath, dirname\n'), ((1165, 1223), 'eng_to_ip... |
import gzip
import os
from mup.converters.utils import readFile, skipHeader
class Converter(object):
name = 'Unnamed'
# Set to True if this converter wraps the reference implementation for the
# markup it supports
reference = False
# Set to True if this converter uses online tools
online = Fa... | [
"mup.converters.utils.readFile",
"gzip.open",
"os.path.splitext",
"mup.converters.utils.skipHeader"
] | [((605, 617), 'mup.converters.utils.readFile', 'readFile', (['fl'], {}), '(fl)\n', (613, 617), False, 'from mup.converters.utils import readFile, skipHeader\n'), ((633, 648), 'mup.converters.utils.skipHeader', 'skipHeader', (['src'], {}), '(src)\n', (643, 648), False, 'from mup.converters.utils import readFile, skipHea... |
""" This is algos.euler.views module.
This module provides the view of the REST API from the Euler algo.
"""
from algos.euler.models import training_samples as ts
from algos.euler.models import predictions
from algos.euler.serializers import PredictionSerializer, PriceChangeSerializer
from rest_framework.response i... | [
"algos.euler.serializers.PriceChangeSerializer",
"algos.euler.models.training_samples.get_all",
"rest_framework.response.Response",
"algos.euler.serializers.PredictionSerializer",
"algos.euler.models.predictions.Prediction.objects.filter"
] | [((794, 842), 'algos.euler.serializers.PredictionSerializer', 'PredictionSerializer', (['all_predictions'], {'many': '(True)'}), '(all_predictions, many=True)\n', (814, 842), False, 'from algos.euler.serializers import PredictionSerializer, PriceChangeSerializer\n'), ((854, 879), 'rest_framework.response.Response', 'Re... |
"""
# Copyright 2021 21CN Corporation Limited
#
# 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... | [
"os.remove",
"uuid.uuid4",
"zipfile.ZipFile",
"os.makedirs",
"pathlib.Path",
"os.path.isfile",
"jwt.decode",
"os.rmdir",
"os.listdir",
"re.compile"
] | [((1919, 1929), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (1923, 1929), False, 'from pathlib import Path\n'), ((2056, 2076), 'os.path.isfile', 'os.path.isfile', (['path'], {}), '(path)\n', (2070, 2076), False, 'import os\n'), ((2130, 2146), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (2140, 2146),... |
import xgboost as xgb
from sklearn.multiclass import OneVsRestClassifier
from sklearn.multioutput import MultiOutputClassifier, MultiOutputRegressor
import mlrun
import mlrun.frameworks.xgboost as mlrun_xgboost
from mlrun.frameworks._ml_common.utils import AlgorithmFunctionality, ModelType
from ..functions import MLF... | [
"mlrun.frameworks._ml_common.utils.AlgorithmFunctionality",
"xgboost.XGBRegressor",
"mlrun.frameworks.xgboost.apply_mlrun",
"xgboost.XGBClassifier"
] | [((531, 578), 'mlrun.frameworks._ml_common.utils.AlgorithmFunctionality', 'AlgorithmFunctionality', (['algorithm_functionality'], {}), '(algorithm_functionality)\n', (553, 578), False, 'from mlrun.frameworks._ml_common.utils import AlgorithmFunctionality, ModelType\n'), ((866, 961), 'mlrun.frameworks.xgboost.apply_mlru... |
from django.contrib import messages
from django.urls import reverse, resolve
def warn_no_phone_number(get_response):
def middleware(request):
if request.user.is_authenticated and not (request.user.is_staff or request.user.is_superuser) \
and request.user.phone_number is None:
... | [
"django.urls.reverse",
"django.urls.resolve",
"django.contrib.messages.add_message"
] | [((331, 357), 'django.urls.resolve', 'resolve', (['request.path_info'], {}), '(request.path_info)\n', (338, 357), False, 'from django.urls import reverse, resolve\n'), ((1172, 1198), 'django.urls.resolve', 'resolve', (['request.path_info'], {}), '(request.path_info)\n', (1179, 1198), False, 'from django.urls import rev... |
from abc import ABC
import itertools
from collections.abc import Iterator
from typing import TypeVar
from bolinette import core
_T = TypeVar("_T")
class Properties(ABC):
def __init__(self, parent):
self.parent = parent
@staticmethod
def _get_cls_attributes_of_type(
obj: type, attr_type:... | [
"typing.TypeVar"
] | [((135, 148), 'typing.TypeVar', 'TypeVar', (['"""_T"""'], {}), "('_T')\n", (142, 148), False, 'from typing import TypeVar\n')] |
#!/usr/bin/env python2
"""Cleanup interactive transcript received on standard input.
This mostly consists in pretty-pretting JSON messages and sorting their
fields, to permit text-based comparisons against reference transcripts.
Usage: python cleanup.py fname.clean < fname.dirty
"""
import json
import sys
import re... | [
"re.sub",
"json.loads",
"json.dumps"
] | [((740, 790), 're.sub', 're.sub', (['"""\\\\b(?<![\\\\\\\\])u[0-9]+\\\\b"""', '"""u[...]"""', 'line'], {}), "('\\\\b(?<![\\\\\\\\])u[0-9]+\\\\b', 'u[...]', line)\n", (746, 790), False, 'import re\n'), ((810, 826), 'json.loads', 'json.loads', (['line'], {}), '(line)\n', (820, 826), False, 'import json\n'), ((1108, 1158)... |
# Sample usage of mealoptimizer
import mealoptimizer as mp
mp.print_foods_in_database()
# Make a list of things you want in a meal
food_list = [ 'whole milk','almonds','banana','apple' ]
# Set your target macro ratios ( in percentages )
protein_carb_fat_ratio_percentages = [ 30, 50, 20 ] # must add to 100%
# Set C... | [
"mealoptimizer.get_macro_weight_targets",
"mealoptimizer.print_meal_analysis",
"mealoptimizer.print_foods_in_database",
"mealoptimizer.optimize_food_amounts"
] | [((61, 89), 'mealoptimizer.print_foods_in_database', 'mp.print_foods_in_database', ([], {}), '()\n', (87, 89), True, 'import mealoptimizer as mp\n'), ((475, 554), 'mealoptimizer.get_macro_weight_targets', 'mp.get_macro_weight_targets', (['calorie_target', 'protein_carb_fat_ratio_percentages'], {}), '(calorie_target, pr... |
import torch
import torch.nn.functional as F
import numpy
from babyai.rl.utils import DictList
# dictionary that defines what head is required for each extra info used for auxiliary supervision
required_heads = {'seen_state': 'binary',
'see_door': 'binary',
'see_obj': 'binary',
... | [
"torch.zeros",
"numpy.mean",
"babyai.rl.utils.DictList",
"torch.tensor"
] | [((3547, 3571), 'babyai.rl.utils.DictList', 'DictList', (['collected_info'], {}), '(collected_info)\n', (3555, 3571), False, 'from babyai.rl.utils import DictList\n'), ((3605, 3632), 'babyai.rl.utils.DictList', 'DictList', (['extra_predictions'], {}), '(extra_predictions)\n', (3613, 3632), False, 'from babyai.rl.utils ... |
import random as rd
import numpy as np
import networkx as nx
from sklearn.metrics.cluster import normalized_mutual_info_score
from sklearn.metrics.cluster import adjusted_rand_score
from sklearn import metrics
from numpy import linalg as LA
import matplotlib.pyplot as plt
from sklearn.cluster import SpectralClu... | [
"sklearn.metrics.cluster.contingency_matrix",
"numpy.sum",
"sklearn.cluster.SpectralClustering",
"sklearn.metrics.cluster.adjusted_rand_score",
"numpy.zeros",
"numpy.ones",
"numpy.amax",
"networkx.Graph",
"numpy.matmul",
"networkx.is_isomorphic",
"networkx.DiGraph",
"sklearn.metrics.cluster.no... | [((337, 349), 'networkx.DiGraph', 'nx.DiGraph', ([], {}), '()\n', (347, 349), True, 'import networkx as nx\n'), ((353, 363), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (361, 363), True, 'import networkx as nx\n'), ((655, 705), 'sklearn.metrics.cluster.contingency_matrix', 'metrics.cluster.contingency_matrix', (['y... |
# Copyright (C) 2020 Intel Corporation
import requests
import json
import base64
import urllib.parse
import hashlib ## python3
import time
import random
from collections import OrderedDict
import argparse
import sys
def main(args):
params = OrderedDict()
params['device'] = args.device
params['local'] = ... | [
"collections.OrderedDict",
"requests.post",
"argparse.ArgumentParser",
"time.time"
] | [((249, 262), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (260, 262), False, 'from collections import OrderedDict\n'), ((396, 407), 'time.time', 'time.time', ([], {}), '()\n', (405, 407), False, 'import time\n'), ((536, 567), 'requests.post', 'requests.post', (['url'], {'data': 'params'}), '(url, data=p... |