code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# ExportSQLite: SQLite export plugin for MySQL Workbench
#
# Copyright (C) 2015 <NAME> (Python version)
# Copyright (C) 2009 <NAME> (Original Lua version)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software F... | [
"StringIO.StringIO",
"mforms.newBox",
"wb.DefineModule",
"mforms.newFileChooser",
"wb.wbinputs.currentCatalog",
"workbench.ui.WizardForm.__init__",
"workbench.ui.WizardPage.__init__",
"mforms.newCodeEditor",
"re.sub",
"grt.modules.Workbench.confirm",
"mforms.newButton"
] | [((1036, 1103), 'wb.DefineModule', 'DefineModule', ([], {'name': '"""ExportSQLite"""', 'author': '"""<NAME>"""', 'version': '"""0.1.0"""'}), "(name='ExportSQLite', author='<NAME>', version='0.1.0')\n", (1048, 1103), False, 'from wb import DefineModule, wbinputs\n'), ((17713, 17732), 'StringIO.StringIO', 'StringIO.Strin... |
import os
from doppel import DoppelProject, destroy_all_projects
from tests.utils import console_logger, get_root_path
ROOT_PATH = get_root_path()
def run_aikit():
controller = DoppelProject(
'aikit-controller',
path=os.path.join(ROOT_PATH, 'examples', 'aikit-example'),
entry_point='dop... | [
"os.path.join",
"tests.utils.console_logger",
"tests.utils.get_root_path",
"doppel.destroy_all_projects"
] | [((134, 149), 'tests.utils.get_root_path', 'get_root_path', ([], {}), '()\n', (147, 149), False, 'from tests.utils import console_logger, get_root_path\n'), ((1027, 1043), 'tests.utils.console_logger', 'console_logger', ([], {}), '()\n', (1041, 1043), False, 'from tests.utils import console_logger, get_root_path\n'), (... |
"""
The script expects the MViT (MDef-DETR or MDETR) detections in .txt format. For example, there should be,
One .txt file for each image and each line in the file represents a detection.
The format of a single detection should be "<label> <confidence> <x1> <y1> <x2> <y2>
Please see the 'mvit_detections' for referenc... | [
"os.path.exists",
"os.listdir",
"xml.etree.ElementTree.parse",
"numpy.minimum",
"argparse.ArgumentParser",
"os.makedirs",
"fvcore.common.file_io.PathManager.open",
"numpy.max",
"numpy.array",
"xml.etree.ElementTree.Element",
"xml.etree.ElementTree.ElementTree",
"os.path.dirname",
"os.path.ba... | [((2699, 2724), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (2722, 2724), False, 'import argparse\n'), ((4540, 4560), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (4554, 4560), False, 'import os\n'), ((6880, 6900), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path... |
# <NAME>
# initial version of the webcam detector, can be used to test HSV settings, radius, etc
import cv2
#import time
import numpy as np
#from infer_imagenet import *
FRAME_WIDTH = 640
FRAME_HEIGHT = 480
# load in the video
cap = cv2.VideoCapture(0)
cap.set(cv2.CAP_PROP_FRAME_WIDTH,FRAME_WIDTH)
cap.se... | [
"numpy.copy",
"cv2.drawContours",
"cv2.dilate",
"cv2.inRange",
"cv2.erode",
"cv2.minEnclosingCircle",
"cv2.imshow",
"numpy.sum",
"numpy.zeros",
"cv2.circle",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"cv2.moments",
"cv2.findContours",
"cv2.resize",
"cv2.GaussianBlu... | [((246, 265), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (262, 265), False, 'import cv2\n'), ((4141, 4164), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (4162, 4164), False, 'import cv2\n'), ((938, 967), 'cv2.resize', 'cv2.resize', (['frame', '(640, 480)'], {}), '(frame, (640... |
# encoding: utf-8
import logging
import os
region_name = "us-west-2"
athena_s3_result_tmp_path = "s3://yamibuy-oregon/athena/sql_result"
LOG_DIR_NAME = "log"
LOG_FILE_NAME = "athena-operation.log"
LOG_LEVEL = logging.INFO
jar_file_path = "{}/../lib*.jar".format(os.path.split(os.path.realpath(__file__))[0])
| [
"os.path.realpath"
] | [((280, 306), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (296, 306), False, 'import os\n')] |
import rospy
GAS_DENSITY = 2.858
ONE_MPH = 0.44704
IS_DEBUG = False
from yaw_controller import YawController
from pid import PID
from lowpass import LowPassFilter
class Controller(object):
#def __init__(self, *args, **kwargs):
# TODO: Implement
#pass
# init in dbw:
# self.controller = Con... | [
"yaw_controller.YawController",
"rospy.get_time",
"lowpass.LowPassFilter",
"pid.PID"
] | [((1620, 1695), 'yaw_controller.YawController', 'YawController', (['wheel_base', 'steer_ratio', '(0.1)', 'max_lat_accel', 'max_steer_angle'], {}), '(wheel_base, steer_ratio, 0.1, max_lat_accel, max_steer_angle)\n', (1633, 1695), False, 'from yaw_controller import YawController\n'), ((1872, 1895), 'pid.PID', 'PID', (['k... |
"""
Author : <NAME>
FileName : add_friends.py
Date : 5.5.17
Version : 1.0
"""
from page import *
import socket
from tkinter import messagebox
class AddFriends(Page):
def __init__(self, root, username):
Page.__init__(self, root)
self.username = username
... | [
"tkinter.messagebox.showwarning",
"socket.socket"
] | [((6723, 6738), 'socket.socket', 'socket.socket', ([], {}), '()\n', (6736, 6738), False, 'import socket\n'), ((6342, 6410), 'tkinter.messagebox.showwarning', 'messagebox.showwarning', (['"""ERROR!"""', '"""Your cannot friendship yourself!"""'], {}), "('ERROR!', 'Your cannot friendship yourself!')\n", (6364, 6410), Fals... |
#!/usr/bin/python
# Copyright (c) 2018, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT for detail... | [
"ansible.module_utils.basic.AnsibleModule",
"ansible.module_utils.oracle.oci_utils.create_service_client",
"ansible.module_utils.oracle.oci_utils.get_facts_module_arg_spec",
"ansible.module_utils.oracle.oci_utils.list_all_resources",
"ansible.module_utils.oracle.oci_utils.call_with_backoff"
] | [((4664, 4720), 'ansible.module_utils.oracle.oci_utils.get_facts_module_arg_spec', 'oci_utils.get_facts_module_arg_spec', ([], {'filter_by_name': '(True)'}), '(filter_by_name=True)\n', (4699, 4720), False, 'from ansible.module_utils.oracle import oci_utils\n'), ((4929, 4996), 'ansible.module_utils.basic.AnsibleModule',... |
#
# -*- coding: utf-8 -*-
#
# Copyright (c) 2019 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | [
"tensorflow.core.framework.graph_pb2.GraphDef",
"tensorflow.core.framework.node_def_pb2.NodeDef",
"tensorflow.python.framework.tensor_util.MakeNdarray"
] | [((2671, 2691), 'tensorflow.core.framework.graph_pb2.GraphDef', 'graph_pb2.GraphDef', ([], {}), '()\n', (2689, 2691), False, 'from tensorflow.core.framework import graph_pb2\n'), ((3293, 3315), 'tensorflow.core.framework.node_def_pb2.NodeDef', 'node_def_pb2.NodeDef', ([], {}), '()\n', (3313, 3315), False, 'from tensorf... |
import os
import imutils
import pickle
import time
import cv2
import threading
import numpy as np
from PIL import ImageFont, ImageDraw, Image
import json
import datetime
import requests
from faced import FaceDetector
from faced.utils import annotate_image
from config_reader import read_config
ZM_URL = 'http://18.179... | [
"cv2.dnn.blobFromImage",
"requests.post",
"cv2.dnn.readNetFromTorch",
"config_reader.read_config",
"numpy.argmax",
"time.sleep",
"os.path.isfile",
"imutils.resize",
"faced.FaceDetector",
"datetime.datetime.now",
"cv2.VideoCapture",
"cv2.cvtColor",
"threading.Thread",
"cv2.imread"
] | [((521, 549), 'requests.post', 'requests.post', ([], {'url': 'LOGIN_URL'}), '(url=LOGIN_URL)\n', (534, 549), False, 'import requests\n'), ((768, 793), 'cv2.VideoCapture', 'cv2.VideoCapture', (['new_url'], {}), '(new_url)\n', (784, 793), False, 'import cv2\n'), ((942, 970), 'cv2.VideoCapture', 'cv2.VideoCapture', (['str... |
import asyncio
import textwrap
import unittest
import unittest.mock
import discord
from bot import constants
from bot.cogs import information
from tests.helpers import AsyncMock, MockBot, MockContext, MockGuild, MockMember, MockRole
class InformationCogTests(unittest.TestCase):
"""Tests the Information cog."""
... | [
"tests.helpers.MockMember",
"asyncio.run",
"discord.VoiceChannel",
"tests.helpers.MockBot",
"discord.Colour.red",
"discord.Permissions",
"discord.CategoryChannel",
"bot.cogs.information.Information",
"discord.TextChannel",
"tests.helpers.AsyncMock",
"discord.Colour.blurple",
"tests.helpers.Moc... | [((3353, 3407), 'unittest.mock.patch', 'unittest.mock.patch', (['"""bot.cogs.information.time_since"""'], {}), "('bot.cogs.information.time_since')\n", (3372, 3407), False, 'import unittest\n'), ((392, 453), 'tests.helpers.MockRole', 'MockRole', ([], {'name': '"""Moderator"""', 'role_id': 'constants.Roles.moderator'}),... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.utils.translation import gettext as _
from core import models
# https://docs.djangoproject.com/en/3.0/topics/auth
# /customizing/#using-a-custom-user-model-when-starting-a-project
class UserAdmin(BaseUserAdm... | [
"django.contrib.admin.site.register",
"django.utils.translation.gettext"
] | [((974, 1017), 'django.contrib.admin.site.register', 'admin.site.register', (['models.User', 'UserAdmin'], {}), '(models.User, UserAdmin)\n', (993, 1017), False, 'from django.contrib import admin\n'), ((1018, 1049), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Tag'], {}), '(models.Tag)\n', (10... |
from django.core.mail.backends.base import BaseEmailBackend
import threading
import O365
from . import settings
from . import util
import logging
from .o365_logger import SimpleErrorHandler # Handles auth exceptions!
"""
A wrapper that manages the O365 API for sending emails.
Uses an identity (auth_flow_type == 'cr... | [
"logging.getLogger",
"threading.RLock",
"O365.Account"
] | [((1151, 1176), 'logging.getLogger', 'logging.getLogger', (['"""O365"""'], {}), "('O365')\n", (1168, 1176), False, 'import logging\n'), ((1240, 1257), 'threading.RLock', 'threading.RLock', ([], {}), '()\n', (1255, 1257), False, 'import threading\n'), ((1671, 1757), 'O365.Account', 'O365.Account', (['credentials'], {'au... |
from Cards.models import Question, TestQuestion, Test, QuestionLog
def create_new_test(user, course):
test = Test()
test.user = user
test.course = course
test.save()
questions = Question.objects.filter(course=course).all()
test_questions = []
for q in questions:
tq = TestQuestion(... | [
"Cards.models.TestQuestion.objects.bulk_create",
"Cards.models.QuestionLog",
"Cards.models.TestQuestion",
"Cards.models.Test",
"Cards.models.Question.objects.filter"
] | [((115, 121), 'Cards.models.Test', 'Test', ([], {}), '()\n', (119, 121), False, 'from Cards.models import Question, TestQuestion, Test, QuestionLog\n'), ((408, 456), 'Cards.models.TestQuestion.objects.bulk_create', 'TestQuestion.objects.bulk_create', (['test_questions'], {}), '(test_questions)\n', (440, 456), False, 'f... |
from flask import jsonify
class AppError(Exception):
"""Base class for all errors. Can represent error as HTTP response for API calls"""
status_code = 500
error_code = "INTERNAL_ERROR"
message = "Request cannot be processed at the moment."
def __init__(self, status_code=None, error_code=None, me... | [
"flask.jsonify"
] | [((639, 708), 'flask.jsonify', 'jsonify', (["{'errorCode': self.error_code, 'errorMessage': self.message}"], {}), "({'errorCode': self.error_code, 'errorMessage': self.message})\n", (646, 708), False, 'from flask import jsonify\n')] |
from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin
import parser
import subprocess
import sys
import wx
from entrypoint2 import entrypoint
class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin, ListCtrlAutoWidthMixin):
def __init__(self, parent):
wx.ListCtrl.__init__(
... | [
"wx.Button",
"wx.lib.mixins.listctrl.CheckListCtrlMixin.__init__",
"parser.command_info",
"subprocess.Popen",
"wx.BoxSizer",
"wx.lib.mixins.listctrl.ListCtrlAutoWidthMixin.__init__",
"wx.ToolTip",
"wx.CheckBox",
"wx.TextCtrl",
"wx.ListCtrl.__init__",
"wx.Frame.__init__",
"wx.App",
"wx.Panel"... | [((4166, 4194), 'parser.command_info', 'parser.command_info', (['command'], {}), '(command)\n', (4185, 4194), False, 'import parser\n'), ((4206, 4214), 'wx.App', 'wx.App', ([], {}), '()\n', (4212, 4214), False, 'import wx\n'), ((286, 363), 'wx.ListCtrl.__init__', 'wx.ListCtrl.__init__', (['self', 'parent', '(-1)'], {'s... |
# coding: utf-8
# /*##########################################################################
#
# Copyright (c) 2017-2018 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to d... | [
"pyFAI.gui.model.PeakModel.PeakModel",
"pyFAI.control_points.ControlPoints",
"numpy.array",
"numpy.empty",
"pyFAI.gui.CalibrationContext.CalibrationContext.instance"
] | [((2173, 2230), 'pyFAI.control_points.ControlPoints', 'ControlPoints', ([], {'calibrant': 'calibrant', 'wavelength': 'wavelength'}), '(calibrant=calibrant, wavelength=wavelength)\n', (2186, 2230), False, 'from pyFAI.control_points import ControlPoints\n'), ((2904, 2946), 'numpy.empty', 'numpy.empty', ([], {'shape': '(c... |
import datetime
from sqlalchemy import (
PrimaryKeyConstraint,
Boolean,
DateTime,
UniqueConstraint,
ForeignKey,
MetaData,
Table,
Column,
ForeignKey,
Integer,
String,
Date,
)
from . import meta
# TODO: type on declarative style
friends = Table('friends', meta,
... | [
"sqlalchemy.DateTime",
"sqlalchemy.Boolean",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.ForeignKey",
"sqlalchemy.UniqueConstraint",
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((659, 724), 'sqlalchemy.PrimaryKeyConstraint', 'PrimaryKeyConstraint', (['"""user_1"""', '"""user_2"""'], {'name': '"""user_1_user_2_pk"""'}), "('user_1', 'user_2', name='user_1_user_2_pk')\n", (679, 724), False, 'from sqlalchemy import PrimaryKeyConstraint, Boolean, DateTime, UniqueConstraint, ForeignKey, MetaData, ... |
# %% [markdown]
# ## Imports
# %%
import numpy as np
import scipy
import skimage
import cv2
# %%
class CornerDetector:
"""Corner detector for an image.
Args:
img (array-like): matrix representation of input image.
May be a grayscale or RGB image.
Attributes:
img (numpy.ndarray... | [
"matplotlib.pyplot.imshow",
"numpy.copy",
"scipy.signal.convolve2d",
"os.listdir",
"numpy.minimum",
"cv2.fastNlMeansDenoising",
"cv2.fastNlMeansDenoisingColored",
"skimage.filters.threshold_otsu",
"skimage.filters.sobel",
"os.path.join",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.dot"... | [((9931, 9955), 'imageio.imread', 'imageio.imread', (['file_img'], {}), '(file_img)\n', (9945, 9955), False, 'import imageio\n'), ((9960, 9988), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 20)'}), '(figsize=(20, 20))\n', (9970, 9988), True, 'import matplotlib.pyplot as plt\n'), ((9993, 10009), 'mat... |
__copyright__ = '2017 <NAME>. All Rights Reserved.'
__author__ = '<NAME>'
""" Mic file geometry and processing.
"""
import numpy as np
from xdm_toolkit import xdm_assert as xassert
def generate_vertices(mic_snp, sidewidth):
T_GEN_IDX = 4 # Triangle generation index.
T_DIR_IDX = 3 # Triangle direction inde... | [
"numpy.copy",
"numpy.sqrt",
"numpy.hstack",
"numpy.squeeze",
"numpy.vstack"
] | [((807, 838), 'numpy.squeeze', 'np.squeeze', (['mic_snp[up_idx, 2:]'], {}), '(mic_snp[up_idx, 2:])\n', (817, 838), True, 'import numpy as np\n'), ((855, 888), 'numpy.squeeze', 'np.squeeze', (['mic_snp[down_idx, 2:]'], {}), '(mic_snp[down_idx, 2:])\n', (865, 888), True, 'import numpy as np\n'), ((1403, 1421), 'numpy.cop... |
#! /usr/bin/env python
"""Make history files into timeseries"""
import os
import sys
from subprocess import check_call, Popen, PIPE
from glob import glob
import re
import click
import yaml
import tempfile
import logging
import cftime
import xarray as xr
import numpy as np
import globus
from workflow import task_man... | [
"logging.getLogger",
"numpy.mean",
"click.argument",
"logging.StreamHandler",
"os.path.exists",
"os.makedirs",
"click.option",
"os.path.join",
"globus.listdir",
"xarray.open_dataset",
"os.path.realpath",
"workflow.task_manager.wait",
"yaml.safe_load",
"workflow.task_manager.submit",
"glo... | [((341, 368), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (358, 368), False, 'import logging\n'), ((415, 448), 'logging.StreamHandler', 'logging.StreamHandler', (['sys.stdout'], {}), '(sys.stdout)\n', (436, 448), False, 'import logging\n'), ((3246, 3261), 'click.command', 'click.comman... |
"""
SimpleMDM Functions
Functions for retrieving device data and assigning device groups in
SimpleMDM using the SimpleMDM API.
Author: <NAME>
Created: 04/05/18
Updated: 10/19/18
"""
import json
try:
import requests
except ModuleNotFoundError:
from botocore.vendored import requests
from utils import *
#... | [
"botocore.vendored.requests.get",
"json.loads",
"botocore.vendored.requests.post"
] | [((1462, 1547), 'botocore.vendored.requests.get', 'requests.get', (['"""https://a.simplemdm.com/api/v1/device_groups"""'], {'auth': "(api_key, '')"}), "('https://a.simplemdm.com/api/v1/device_groups', auth=(api_key, '')\n )\n", (1474, 1547), False, 'from botocore.vendored import requests\n'), ((976, 1001), 'json.loa... |
# Generated by Django 3.1 on 2020-10-02 17:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('school', '0016_auto_20201002_1315'),
]
operations = [
migrations.CreateModel(
name='TeacherCourses',
fields=[
... | [
"django.db.models.AutoField",
"django.db.models.ManyToManyField",
"django.db.models.CharField"
] | [((680, 793), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'db_column': '"""keyword"""', 'default': '""""""', 'max_length': '(255)', 'null': '(True)', 'verbose_name': '"""关键词"""'}), "(blank=True, db_column='keyword', default='', max_length=\n 255, null=True, verbose_name='关键词')\n", (696... |
# -*- coding: utf-8 -*-
from odoo import models, fields, api
import logging
_logger = logging.getLogger(__name__)
class MaintenanceOperation(models.Model):
_name = 'maintenance_planning.operation'
_description = 'Maintenance operation'
name = fields.Char('Name', required=True)
sequence = fields.Inte... | [
"logging.getLogger",
"odoo.fields.Float",
"odoo.fields.Many2one",
"odoo.api.depends",
"odoo.fields.Integer",
"odoo.fields.One2many",
"odoo.fields.Text",
"odoo.fields.Selection",
"odoo.fields.Char",
"odoo.fields.Boolean"
] | [((88, 115), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (105, 115), False, 'import logging\n'), ((259, 293), 'odoo.fields.Char', 'fields.Char', (['"""Name"""'], {'required': '(True)'}), "('Name', required=True)\n", (270, 293), False, 'from odoo import models, fields, api\n'), ((309, 3... |
import datetime
import logging
from subprocess import Popen
from time import sleep
from unittest import expectedFailure, skip
import os
from django.test import TransactionTestCase
from django.utils.timezone import now
from random import randint
from django_clickhouse.database import connections
from django_clickhouse... | [
"logging.getLogger",
"tests.clickhouse_models.ClickHouseCollapseTestModel.get_import_key",
"subprocess.Popen",
"tests.clickhouse_models.ClickHouseTestModel.sync_batch_from_storage",
"django.utils.timezone.now",
"tests.clickhouse_models.ClickHouseMultiTestModel.sync_batch_from_storage",
"random.randint",... | [((554, 592), 'logging.getLogger', 'logging.getLogger', (['"""django-clickhouse"""'], {}), "('django-clickhouse')\n", (571, 592), False, 'import logging\n'), ((671, 713), 'tests.clickhouse_models.ClickHouseCollapseTestModel.get_database', 'ClickHouseCollapseTestModel.get_database', ([], {}), '()\n', (711, 713), False, ... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import unittest
import numpy
import quantities
quantities.set_default_units('si')
quantities.UnitQuantity('kilocalorie', 1000.0*quantities.cal, symbol='kcal')
quantities.UnitQuantity('kilojoule', 1000.0*quantities.J, symbol='kJ')
from rmgpy.chem.molecule import Molecule
from... | [
"pylab.ylabel",
"quantities.set_default_units",
"pylab.subplot",
"unittest.TextTestRunner",
"pylab.xlabel",
"pylab.legend",
"rmgpy.chem.kinetics.Arrhenius",
"pylab.figure",
"numpy.array",
"rmgpy.chem.thermo.ThermoData",
"rmgpy.chem.molecule.Molecule",
"pylab.semilogx",
"rmgpy.solver.simple.S... | [((91, 125), 'quantities.set_default_units', 'quantities.set_default_units', (['"""si"""'], {}), "('si')\n", (119, 125), False, 'import quantities\n'), ((126, 204), 'quantities.UnitQuantity', 'quantities.UnitQuantity', (['"""kilocalorie"""', '(1000.0 * quantities.cal)'], {'symbol': '"""kcal"""'}), "('kilocalorie', 1000... |
import emoji
from math import hypot
cateto_opos = float(input('Cateto oposto: '))
cateto_adja = float(input('Cateto adjacente: '))
hipotenusa = (hypot(cateto_opos, cateto_adja))
print(emoji.emojize(f'De acordo com os dados, a hipotenusa é igual a {hipotenusa:.2f} :nerd_face::thumbs_up:.')) | [
"math.hypot",
"emoji.emojize"
] | [((145, 176), 'math.hypot', 'hypot', (['cateto_opos', 'cateto_adja'], {}), '(cateto_opos, cateto_adja)\n', (150, 176), False, 'from math import hypot\n'), ((184, 299), 'emoji.emojize', 'emoji.emojize', (['f"""De acordo com os dados, a hipotenusa é igual a {hipotenusa:.2f} :nerd_face::thumbs_up:."""'], {}), "(\n f'De... |
# coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import os
import shu... | [
"pants.util.dirutil.touch",
"pants.base.build_file_aliases.BuildFileAliases.create",
"os.path.exists",
"pants.fs.archive.ZIP.create",
"textwrap.dedent",
"os.rename",
"os.path.join",
"os.path.splitext",
"pants.util.dirutil.safe_open",
"os.remove",
"os.path.dirname",
"pants.backend.jvm.tasks.ivy... | [((1770, 1970), 'pants.base.build_file_aliases.BuildFileAliases.create', 'BuildFileAliases.create', ([], {'targets': "{'android_dependency': AndroidDependency, 'android_library': AndroidLibrary,\n 'jar_library': JarLibrary, 'target': Dependencies}", 'objects': "{'jar': JarDependency}"}), "(targets={'android_dependen... |
from django.urls import path
from . import views
app_name = 'core'
urlpatterns = [
path('', views.blog, name='blog'),
path('<int:pk>/', views.post_detail, name='post_detail'),
path('<int:pk>/share/', views.post_share, name='post_share'),
path('manage/', views.ManagePostListView.as_view(), name='manag... | [
"django.urls.path"
] | [((89, 122), 'django.urls.path', 'path', (['""""""', 'views.blog'], {'name': '"""blog"""'}), "('', views.blog, name='blog')\n", (93, 122), False, 'from django.urls import path\n'), ((128, 184), 'django.urls.path', 'path', (['"""<int:pk>/"""', 'views.post_detail'], {'name': '"""post_detail"""'}), "('<int:pk>/', views.po... |
"""App utilites tests.
"""
import sys
import pytest
from django.apps import apps
from ..models import Camera
pytestmark = pytest.mark.django_db
@pytest.mark.parametrize(
"testargs, output",
[
[["python", "manage.py", "runserver"], 4],
[["python", "manage.py", "makemigration"], 0],
[... | [
"pytest.mark.parametrize",
"django.apps.apps.get_app_config"
] | [((150, 394), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""testargs, output"""', "[[['python', 'manage.py', 'runserver'], 4], [['python', 'manage.py',\n 'makemigration'], 0], [['python', 'manage.py', 'migrate'], 0], [[\n 'python', 'manage.py', 'test'], 0], [['pytest'], 0]]"], {}), "('testargs, outp... |
from typing import List, Tuple, Optional
import numpy as np
def rmse(x: List[float], y: List[float]) -> float:
r = 0
for (a, b) in zip(x, y):
r += (a - b) ** 2
return r
def lin_reg(data: List[Tuple[float, float]]) -> Tuple[float, float]:
d = np.array(data)
m = d.shape[0]
p = np.sum(d... | [
"numpy.array",
"numpy.sum"
] | [((270, 284), 'numpy.array', 'np.array', (['data'], {}), '(data)\n', (278, 284), True, 'import numpy as np\n'), ((312, 327), 'numpy.sum', 'np.sum', (['d[:, 0]'], {}), '(d[:, 0])\n', (318, 327), True, 'import numpy as np\n'), ((336, 351), 'numpy.sum', 'np.sum', (['d[:, 1]'], {}), '(d[:, 1])\n', (342, 351), True, 'import... |
""""
Parte 5: Criando Colisões
"""
#Importações necessárias para a criação da janela
import pygame
from pygame.locals import *
from sys import exit
from random import randint
#Inicialização das váriaveis e funções do pygame
pygame.init()
#Criação da tela
width = 640
height = 480
x = width/2
y = height/2
#Criando ... | [
"pygame.display.set_caption",
"sys.exit",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.key.get_pressed",
"pygame.draw.rect",
"pygame.time.Clock",
"pygame.display.update",
"random.randint"
] | [((227, 240), 'pygame.init', 'pygame.init', ([], {}), '()\n', (238, 240), False, 'import pygame\n'), ((389, 405), 'random.randint', 'randint', (['(40)', '(600)'], {}), '(40, 600)\n', (396, 405), False, 'from random import randint\n'), ((415, 431), 'random.randint', 'randint', (['(50)', '(430)'], {}), '(50, 430)\n', (42... |
# Turtle
import turtle
bob = turtle.Turtle()
print(bob)
bob.fd(100)
bob.lt(120)
bob.fd(100)
bob.lt(120)
bob.fd(100)
bob.lt(120) | [
"turtle.Turtle"
] | [((30, 45), 'turtle.Turtle', 'turtle.Turtle', ([], {}), '()\n', (43, 45), False, 'import turtle\n')] |
#!/usr/bin/env python3
"""Runs kb-stopwatch."""
from kbstopwatch.main import main
# Run it
main()
| [
"kbstopwatch.main.main"
] | [((94, 100), 'kbstopwatch.main.main', 'main', ([], {}), '()\n', (98, 100), False, 'from kbstopwatch.main import main\n')] |
from pathlib import Path
import typer
import beet
from windshader import utils
app = typer.Typer()
@app.command()
def cmd_main(
base_config: Path = typer.Argument(..., exists=True, dir_okay=False)
):
config = beet.load_config(base_config)
minecraft_version = config.meta["texture_atlas"]["minecraft_version"]
cach... | [
"beet.Cache",
"typer.Typer",
"beet.load_config",
"windshader.utils.get_uvs_root",
"beet.run_beet",
"typer.Argument"
] | [((87, 100), 'typer.Typer', 'typer.Typer', ([], {}), '()\n', (98, 100), False, 'import typer\n'), ((152, 200), 'typer.Argument', 'typer.Argument', (['...'], {'exists': '(True)', 'dir_okay': '(False)'}), '(..., exists=True, dir_okay=False)\n', (166, 200), False, 'import typer\n'), ((214, 243), 'beet.load_config', 'beet.... |
from unittest import TestCase
from tests import abspath
from pytezos.repl.interpreter import Interpreter
from pytezos.michelson.converter import michelson_to_micheline
from pytezos.repl.parser import parse_expression
class OpcodeTestlist_concat_bytes_136(TestCase):
def setUp(self):
self.maxDiff = None
... | [
"pytezos.michelson.converter.michelson_to_micheline",
"tests.abspath",
"pytezos.repl.parser.parse_expression",
"pytezos.repl.interpreter.Interpreter"
] | [((337, 360), 'pytezos.repl.interpreter.Interpreter', 'Interpreter', ([], {'debug': '(True)'}), '(debug=True)\n', (348, 360), False, 'from pytezos.repl.interpreter import Interpreter\n'), ((701, 739), 'pytezos.michelson.converter.michelson_to_micheline', 'michelson_to_micheline', (['"""0x00abcdef00"""'], {}), "('0x00ab... |
import json
from huobi.utils.http import post
from huobi.host import HOST_FUTURES
class TriggerOrder:
def __init__(self, access_key: str, secret_key: str, host: str = HOST_FUTURES):
self.__access_key = access_key
self.__secret_key = secret_key
self.__host = host
def isolated_order(se... | [
"huobi.utils.http.post"
] | [((423, 490), 'huobi.utils.http.post', 'post', (['self.__host', 'path', 'self.__access_key', 'self.__secret_key', 'data'], {}), '(self.__host, path, self.__access_key, self.__secret_key, data)\n', (427, 490), False, 'from huobi.utils.http import post\n'), ((623, 690), 'huobi.utils.http.post', 'post', (['self.__host', '... |
import csv
import gzip
import json
import re
import sys
from ast import literal_eval
from collections import Counter
from math import exp
import numpy as np
from nltk.stem.porter import PorterStemmer
from nltk.tokenize import word_tokenize
OPINION_EXP = re.compile(r"(.*)<o>(.*?)</o>(.*)")
ASPECT_EXP = re.compile(r"(.... | [
"re.compile",
"gzip.open",
"collections.Counter",
"numpy.array",
"nltk.stem.porter.PorterStemmer",
"ast.literal_eval",
"numpy.zeros",
"numpy.count_nonzero",
"sys.exc_info",
"json.load",
"re.sub",
"numpy.shape",
"json.dump",
"math.exp"
] | [((256, 290), 're.compile', 're.compile', (['"""(.*)<o>(.*?)</o>(.*)"""'], {}), "('(.*)<o>(.*?)</o>(.*)')\n", (266, 290), False, 'import re\n'), ((305, 339), 're.compile', 're.compile', (['"""(.*)<f>(.*?)</f>(.*)"""'], {}), "('(.*)<f>(.*?)</f>(.*)')\n", (315, 339), False, 'import re\n'), ((354, 384), 're.compile', 're.... |
# -*- coding: utf-8 -*-
"""
Created on Thu Dec 20 15:39:17 2018
@author: Stephanie
"""
"""
brief : Remote Call Procedure / Server procedure
Listen to the requests dispatched and send the response back on the specified queue
args :
Return :
Raises :
"""
import pika
import os
import amqp
import msgpac... | [
"sys.getsizeof",
"pika.URLParameters",
"pika.BlockingConnection",
"os.environ.get",
"msgpack.unpackb",
"pika.BasicProperties"
] | [((455, 496), 'os.environ.get', 'os.environ.get', (['"""CLOUDAMQP_URL"""', 'amqp_url'], {}), "('CLOUDAMQP_URL', amqp_url)\n", (469, 496), False, 'import os\n'), ((505, 528), 'pika.URLParameters', 'pika.URLParameters', (['url'], {}), '(url)\n', (523, 528), False, 'import pika\n'), ((569, 600), 'pika.BlockingConnection',... |
# Created by Kelvin_Clark on 2/1/2022, 2:16 PM
from app.utils.security.jwt import create_access_token, get_token_data
def test_create_token():
data = {"payload": "User data"}
token = create_access_token(data=data)
assert token is not None
def test_verify_token():
data = {"payload": "User data"}
... | [
"app.utils.security.jwt.create_access_token",
"app.utils.security.jwt.get_token_data"
] | [((193, 223), 'app.utils.security.jwt.create_access_token', 'create_access_token', ([], {'data': 'data'}), '(data=data)\n', (212, 223), False, 'from app.utils.security.jwt import create_access_token, get_token_data\n'), ((328, 358), 'app.utils.security.jwt.create_access_token', 'create_access_token', ([], {'data': 'dat... |
import boto3
from botocore.config import Config
def s3_client():
s3 = boto3.client('s3',
aws_access_key_id="secretless",
region_name="us-east-1",
aws_secret_access_key="secretless",
endpoint_url="http://secretless.empty",
... | [
"botocore.config.Config"
] | [((345, 394), 'botocore.config.Config', 'Config', ([], {'proxies': "{'http': 'http://localhost:8099'}"}), "(proxies={'http': 'http://localhost:8099'})\n", (351, 394), False, 'from botocore.config import Config\n')] |
from hashlib import md5
from project.src.core.entities.address import Address
from project.src.core.entities.contacts import ContactParameters, Contact
from project.src.core.entities.email import Email
from project.src.core.entities.name import Name
from project.src.core.entities.phones import Phone
def _create_id(c... | [
"project.src.core.entities.name.Name",
"project.src.core.entities.address.Address",
"project.src.core.entities.email.Email",
"project.src.core.entities.phones.Phone"
] | [((709, 796), 'project.src.core.entities.name.Name', 'Name', ([], {'lastName': 'contact_parameters.lastName', 'firstName': 'contact_parameters.firstName'}), '(lastName=contact_parameters.lastName, firstName=contact_parameters.\n firstName)\n', (713, 796), False, 'from project.src.core.entities.name import Name\n'), ... |
#! /bin/python3
"""
import_csv_data.py will structure the data from a CBORD CSV dump
data output will be stored into memory, and then uploaded into MongoDB
Created by: <NAME> <EMAIL>
Last Edited: May 10, 2017
"""
import os
from datetime import datetime as dt
from pprint import pprint
from pymongo import MongoClient
fil... | [
"pymongo.MongoClient",
"datetime.datetime.now",
"os.path.getmtime",
"pprint.pprint"
] | [((4750, 4791), 'pymongo.MongoClient', 'MongoClient', (['"""mongodb://localhost:27017/"""'], {}), "('mongodb://localhost:27017/')\n", (4761, 4791), False, 'from pymongo import MongoClient\n'), ((5538, 5552), 'pprint.pprint', 'pprint', (['result'], {}), '(result)\n', (5544, 5552), False, 'from pprint import pprint\n'), ... |
# Copyright (c) 2012-2020 Jicamarca Radio Observatory
# All rights reserved.
#
# Distributed under the terms of the BSD 3-clause license.
"""Base class to create plot operations
"""
import os
import sys
import zmq
import time
import numpy
import datetime
from collections import deque
from functools import wraps
from ... | [
"numpy.sqrt",
"time.sleep",
"zmq.Poller",
"numpy.isfinite",
"numpy.sin",
"datetime.timedelta",
"numpy.arange",
"datetime.datetime",
"collections.deque",
"matplotlib.ticker.FuncFormatter",
"numpy.where",
"functools.wraps",
"matplotlib._pylab_helpers.Gcf.get_active",
"numpy.vstack",
"mpl_t... | [((1323, 1366), 'matplotlib.pyplot.register_cmap', 'matplotlib.pyplot.register_cmap', ([], {'cmap': 'ncmap'}), '(cmap=ncmap)\n', (1354, 1366), False, 'import matplotlib\n'), ((395, 432), 'matplotlib.use', 'matplotlib.use', (["os.environ['BACKEND']"], {}), "(os.environ['BACKEND'])\n", (409, 432), False, 'import matplotl... |
from dataclasses import dataclass, field
from typing import Dict, List, Union
import pygamehack.struct_parser as struct_parser
from .struct_parser import tuples_to_classes, classes_to_string, Comment
from .struct_file import PythonStructSourceGenerator
__all__ = ['ReClassNet']
# TODO: ReClassNet all types
#region ... | [
"xml.dom.minidom.parse",
"dataclasses.field",
"zipfile.ZipFile"
] | [((480, 507), 'dataclasses.field', 'field', ([], {'default_factory': 'dict'}), '(default_factory=dict)\n', (485, 507), False, 'from dataclasses import dataclass, field\n'), ((548, 575), 'dataclasses.field', 'field', ([], {'default_factory': 'dict'}), '(default_factory=dict)\n', (553, 575), False, 'from dataclasses impo... |
from selenium import webdriver
from selenium.webdriver.common.by import By
chrome_driver_path = "C:/Users/st0rmg0d/Desktop/chromedriver.exe"
class scrap:
def __init__(self, currency_name):
self.currency_name = currency_name
def scrap_articles(self):
driver = webdriver.Chrome(executa... | [
"selenium.webdriver.Chrome"
] | [((296, 348), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'executable_path': 'chrome_driver_path'}), '(executable_path=chrome_driver_path)\n', (312, 348), False, 'from selenium import webdriver\n')] |
import json
from app import create_app, db
from app.models import User, UserType
from .base import BaseTest
class TestOrders(BaseTest):
def setUp(self):
self.app = create_app(config_name='testing')
self.client = self.app.test_client()
with self.app.app_context():
db.create_all(... | [
"app.db.create_all",
"app.db.drop_all",
"json.dumps",
"app.create_app"
] | [((178, 211), 'app.create_app', 'create_app', ([], {'config_name': '"""testing"""'}), "(config_name='testing')\n", (188, 211), False, 'from app import create_app, db\n'), ((306, 321), 'app.db.create_all', 'db.create_all', ([], {}), '()\n', (319, 321), False, 'from app import create_app, db\n'), ((7131, 7144), 'app.db.d... |
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"time.sleep",
"time.time",
"monascaclient.client.Client"
] | [((1535, 1586), 'monascaclient.client.Client', 'client.Client', (['api_version', 'endpoint'], {}), '(api_version, endpoint, **auth_kwargs)\n', (1548, 1586), False, 'from monascaclient import client\n'), ((2660, 2673), 'time.sleep', 'time.sleep', (['(5)'], {}), '(5)\n', (2670, 2673), False, 'import time\n'), ((1880, 189... |
# coding: utf-8
"""
Utilities to handle mongoengine classes and connections.
"""
import contextlib
from pymatgen.util.serialization import pmg_serialize
from monty.json import MSONable
from mongoengine import connect
from mongoengine.context_managers import switch_collection
from mongoengine.connection import DEFAULT_... | [
"mongoengine.context_managers.switch_collection",
"mongoengine.connect"
] | [((2112, 2235), 'mongoengine.connect', 'connect', ([], {'db': 'self.database', 'host': 'self.host', 'port': 'self.port', 'username': 'self.username', 'password': 'self.password', 'alias': 'alias'}), '(db=self.database, host=self.host, port=self.port, username=self.\n username, password=self.password, alias=alias)\n'... |
import csv
import random
from flask import Flask
from twilio.twiml.messaging_response import MessagingResponse
app = Flask(__name__)
with open('truisms.csv', 'r') as f:
reader = csv.reader(f)
truisms = list(reader)
@app.route('/sms', methods=['POST'])
def sms():
truism = random.choice(truisms)[0]
... | [
"twilio.twiml.messaging_response.MessagingResponse",
"random.choice",
"csv.reader",
"flask.Flask"
] | [((119, 134), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (124, 134), False, 'from flask import Flask\n'), ((185, 198), 'csv.reader', 'csv.reader', (['f'], {}), '(f)\n', (195, 198), False, 'import csv\n'), ((328, 347), 'twilio.twiml.messaging_response.MessagingResponse', 'MessagingResponse', ([], {}), '... |
from django.db import models
from django.core.validators import RegexValidator, MinValueValidator,MaxValueValidator
from django.core.urlresolvers import reverse
from django.dispatch import receiver
from django.db.models.signals import post_save, pre_save, pre_delete
from django.utils import timezone
from core.models... | [
"django.db.models.DateField",
"django.core.validators.MaxValueValidator",
"django.db.models.TimeField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.core.urlresolvers.reverse",
"django.utils.timezone.now",
"django.dispatch.receiver",
"django.core.validators.MinValueVali... | [((13000, 13049), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'PayCommissionOrSalary'}), '(post_save, sender=PayCommissionOrSalary)\n', (13008, 13049), False, 'from django.dispatch import receiver\n'), ((14042, 14090), 'django.dispatch.receiver', 'receiver', (['pre_save'], {'sender': 'PayCommissi... |
from config import Configuration
if __name__ == "__main__":
config = Configuration("/home/orikeidar01/config.json", "anylink")
config.database.add_user("<EMAIL>",
"ECD71870D1963316A97E3AC3408C9835AD8CF0F3C1BC703527C30265534F75AE", "anylink")
| [
"config.Configuration"
] | [((74, 131), 'config.Configuration', 'Configuration', (['"""/home/orikeidar01/config.json"""', '"""anylink"""'], {}), "('/home/orikeidar01/config.json', 'anylink')\n", (87, 131), False, 'from config import Configuration\n')] |
from django.contrib.auth import get_user_model
from django.db import models
from ordered_model.models import OrderedModel
class Rule(OrderedModel):
"""Represents a subreddit rule to which a moderator action may be link."""
name = models.CharField(max_length=255, help_text='The name of the rule')
descripti... | [
"django.contrib.auth.get_user_model",
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.CharField"
] | [((240, 306), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'help_text': '"""The name of the rule"""'}), "(max_length=255, help_text='The name of the rule')\n", (256, 306), False, 'from django.db import models\n'), ((325, 426), 'django.db.models.TextField', 'models.TextField', ([], {'bl... |
#!/usr/bin/env python
#
# ----------------------------------------------------------------------
#
# <NAME>, U.S. Geological Survey
# <NAME>, GNS Science
# <NAME>, University of Chicago
#
# This code was developed as part of the Computational Infrastructure
# for Geodynamics (http://geodynamics.org).
#
# Copyright (c) ... | [
"pylith.utils.EventLogger.EventLogger",
"pylith.utils.PetscComponent.PetscComponent.__init__",
"pylith.utils.PetscComponent.PetscComponent._configure"
] | [((956, 1011), 'pylith.utils.PetscComponent.PetscComponent.__init__', 'PetscComponent.__init__', (['self', 'name'], {'facility': '"""refiner"""'}), "(self, name, facility='refiner')\n", (979, 1011), False, 'from pylith.utils.PetscComponent import PetscComponent\n'), ((1417, 1448), 'pylith.utils.PetscComponent.PetscComp... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
from downloadautio import settings
import requests
import os
from downloadautio.file_handle import FileEntry
class Downloadau... | [
"downloadautio.file_handle.FileEntry",
"os.path.exists",
"os.makedirs",
"requests.get"
] | [((390, 401), 'downloadautio.file_handle.FileEntry', 'FileEntry', ([], {}), '()\n', (399, 401), False, 'from downloadautio.file_handle import FileEntry\n'), ((756, 780), 'os.path.exists', 'os.path.exists', (['dir_path'], {}), '(dir_path)\n', (770, 780), False, 'import os\n'), ((794, 815), 'os.makedirs', 'os.makedirs', ... |
import gym
import numpy as np
from copy import deepcopy
from gym_fabrikatioRL.envs.core import Core
from gym_fabrikatioRL.envs.core_state import State
from gym_fabrikatioRL.envs.interface_input import Input
from gym_fabrikatioRL.envs.env_utils import UndefinedOptimizerConfiguration
from gym_fabrikatioRL.envs.env_utils... | [
"gym_fabrikatioRL.envs.env_utils.UndefinedOptimizerTargetMode",
"gym.spaces.Discrete",
"gym.spaces.Box",
"gym_fabrikatioRL.envs.interface_input.Input",
"numpy.array",
"gym_fabrikatioRL.envs.env_utils.UndefinedOptimizerConfiguration",
"copy.deepcopy",
"gym_fabrikatioRL.envs.env_utils.IllegalAction",
... | [((999, 1048), 'gym_fabrikatioRL.envs.interface_input.Input', 'Input', (['scheduling_inputs', 'init_seed', 'logfile_path'], {}), '(scheduling_inputs, init_seed, logfile_path)\n', (1004, 1048), False, 'from gym_fabrikatioRL.envs.interface_input import Input\n'), ((3739, 3762), 'gym_fabrikatioRL.envs.core.Core', 'Core', ... |
import os
from .version import BaseVersion
class MetaContainer(type):
def __new__(cls, name, bases, attrs):
cclass = super(MetaContainer, cls).__new__(cls, name, bases, attrs)
cclass._versions = {}
for name, value in attrs.items():
if name.startswith('vs_') or not isinstance(va... | [
"os.path.splitext"
] | [((3197, 3236), 'os.path.splitext', 'os.path.splitext', (['self.source_file.name'], {}), '(self.source_file.name)\n', (3213, 3236), False, 'import os\n')] |
import subprocess
code = 'if (flag > {}) then 1 else 0'
n = 8 * 36
low = 0
high = 1 << n
while low <= high:
mid = (low + high) >> 1
process = subprocess.Popen(['nc', 'wolf.chal.pwning.xxx', '6808'], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
out, err = process.communicate(code.format(mid))
if o... | [
"subprocess.Popen"
] | [((154, 262), 'subprocess.Popen', 'subprocess.Popen', (["['nc', 'wolf.chal.pwning.xxx', '6808']"], {'stdin': 'subprocess.PIPE', 'stdout': 'subprocess.PIPE'}), "(['nc', 'wolf.chal.pwning.xxx', '6808'], stdin=subprocess.\n PIPE, stdout=subprocess.PIPE)\n", (170, 262), False, 'import subprocess\n')] |
# copied from https://github.com/probml/pyprobml/blob/master/scripts/sgmcmc_nuts_demo.py
# Compare NUTS, SGLD and Adam on sampling from a multivariate Gaussian
from collections import namedtuple
from typing import Any, Callable, Dict, List, NamedTuple, Optional, Tuple, Union
import jax.numpy as jnp
import optax
from ... | [
"jax.numpy.allclose",
"optax.adam",
"jax.numpy.zeros",
"jax.random.PRNGKey",
"jax.random.normal",
"sgmcmcjax.optimizer.build_optax_optimizer",
"jax.numpy.dot",
"jax.numpy.mean",
"sgmcmcjax.samplers.build_sgld_sampler"
] | [((880, 897), 'jax.random.PRNGKey', 'random.PRNGKey', (['(0)'], {}), '(0)\n', (894, 897), False, 'from jax import jit, random, vmap\n'), ((908, 932), 'jax.random.normal', 'random.normal', (['key', '(D,)'], {}), '(key, (D,))\n', (921, 932), False, 'from jax import jit, random, vmap\n'), ((1026, 1056), 'optax.adam', 'opt... |
import errno
import os
import hashlib
import requests
import subprocess
import json
class Colors:
BLACK = "\033[0;30m"
RED = "\033[0;31m"
GREEN = "\033[0;32m"
BROWN = "\033[0;33m"
BLUE = "\033[0;34m"
PURPLE = "\033[0;35m"
CYAN = "\033[0;36m"
LIGHT_GRAY = "\033[0;37m"
DARK_GRAY = "\... | [
"os.listdir",
"os.makedirs",
"os.rename",
"json.dumps",
"subprocess.run",
"os.path.join",
"requests.get",
"os.path.isfile",
"os.path.dirname",
"os.path.isdir"
] | [((1240, 1255), 'os.listdir', 'os.listdir', (['dir'], {}), '(dir)\n', (1250, 1255), False, 'import os\n'), ((1723, 1757), 'json.dumps', 'json.dumps', (['toHash'], {'sort_keys': '(True)'}), '(toHash, sort_keys=True)\n', (1733, 1757), False, 'import json\n'), ((2477, 2497), 'os.path.isfile', 'os.path.isfile', (['dest'], ... |
#This is a basic starter script for figuring out salvaging calculations in GW2
"""Basic salvage cost calculating in GW2
To determine if it is profitable:
salvage item + cost to salvage < value of goods after TP fees
To calculate the value of the goods after TP fees, I need:
Salvage rates
Value of raw sa... | [
"gw2api.GuildWars2Client"
] | [((46466, 46484), 'gw2api.GuildWars2Client', 'GuildWars2Client', ([], {}), '()\n', (46482, 46484), False, 'from gw2api import GuildWars2Client\n')] |
import os
import pytest
from io import StringIO
pytest.register_assert_rewrite('tests.common')
@pytest.fixture
def content():
def _reader(filename):
with open(filename) as f:
return f.read()
return _reader
@pytest.fixture
def expected(request):
filename = os.path.splitext(request... | [
"os.path.dirname",
"io.StringIO",
"os.path.splitext",
"pytest.register_assert_rewrite"
] | [((51, 97), 'pytest.register_assert_rewrite', 'pytest.register_assert_rewrite', (['"""tests.common"""'], {}), "('tests.common')\n", (81, 97), False, 'import pytest\n'), ((832, 842), 'io.StringIO', 'StringIO', ([], {}), '()\n', (840, 842), False, 'from io import StringIO\n'), ((296, 337), 'os.path.splitext', 'os.path.sp... |
from datetime import datetime, timedelta
from NodeDefender.db.sql import SQL, HeatModel, NodeModel, iCPEModel, GroupModel
from sqlalchemy import func
from sqlalchemy.sql import label
from itertools import groupby
def current(group):
group = SQL.session.query(GroupModel).filter(GroupModel.name ==
... | [
"NodeDefender.db.sql.iCPEModel.mac_address.in_",
"sqlalchemy.func.count",
"itertools.groupby",
"NodeDefender.db.sql.SQL.session.query",
"sqlalchemy.func.sum",
"datetime.datetime.now",
"datetime.timedelta"
] | [((4175, 4189), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (4187, 4189), False, 'from datetime import datetime, timedelta\n'), ((1603, 1617), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1615, 1617), False, 'from datetime import datetime, timedelta\n'), ((1620, 1640), 'datetime.timedelta'... |
# -*- coding: utf-8 -*-
"""
main program for IMRT QA PDF report parser
Created on Thu May 30 2019
@author: <NAME>, PhD
"""
from os.path import isdir, join, splitext, normpath
from os import walk, listdir
import zipfile
from datetime import datetime
from dateutil.parser import parse as date_parser
import numpy as np
im... | [
"numpy.mean",
"dateutil.parser.parse",
"os.listdir",
"zipfile.ZipFile",
"datetime.datetime.strptime",
"os.path.join",
"numpy.diff",
"os.path.splitext",
"os.path.normpath",
"numpy.array",
"os.path.isdir",
"datetime.datetime.today",
"codecs.open",
"os.walk"
] | [((6035, 6046), 'numpy.array', 'np.array', (['y'], {}), '(y)\n', (6043, 6046), True, 'import numpy as np\n'), ((6066, 6076), 'numpy.mean', 'np.mean', (['y'], {}), '(y)\n', (6073, 6076), True, 'import numpy as np\n'), ((6970, 6990), 'os.walk', 'walk', (['init_directory'], {}), '(init_directory)\n', (6974, 6990), False, ... |
# Last phase of the ETL: Load into an external source
import logging
import os
import pandas as pd
from config import ETL_CSV_ARGS, ETL_DATA_PATH, ETL_DATASET_CONFIG
from src.common.utils import check_df, get_folder_path
def save_dataset(dataframe, complete_path: str, csv_arguments={}) -> bool:
logging.info(f"... | [
"os.path.join",
"logging.info",
"src.common.utils.get_folder_path",
"config.ETL_DATASET_CONFIG.values"
] | [((305, 353), 'logging.info', 'logging.info', (['f"""Saving dataset: {complete_path}"""'], {}), "(f'Saving dataset: {complete_path}')\n", (317, 353), False, 'import logging\n'), ((753, 788), 'logging.info', 'logging.info', (['"""Start final loading"""'], {}), "('Start final loading')\n", (765, 788), False, 'import logg... |
#!/usr/bin/env python3
"""Algorithms for determining connected components of graphs.
Edges must be symmetric (u, v) <==> (v, u).
TODOS
-----
- Allow user input 'seed' labels
- Create generic `concomp` method (maybe use fast_sv for a few iterations then
seed that to bfs_lp_rs).
"""
__all__ = ["bfs_lp", "bfs_lp_rs", ... | [
"arkouda.unique",
"akgraph.util.get_perm",
"arkouda.argsort",
"akgraph.util.minimum",
"arkouda.GroupBy",
"arkouda.arange",
"warnings.warn",
"arkouda.max",
"arkouda.zeros_like"
] | [((1723, 1757), 'arkouda.GroupBy', 'ak.GroupBy', (['U'], {'assume_sorted': '(False)'}), '(U, assume_sorted=False)\n', (1733, 1757), True, 'import arkouda as ak\n'), ((1822, 1838), 'arkouda.zeros_like', 'ak.zeros_like', (['c'], {}), '(c)\n', (1835, 1838), True, 'import arkouda as ak\n'), ((4040, 4073), 'arkouda.GroupBy'... |
import numpy as np
from PIL import Image
from retina.retina import warp_image
class DatasetGenerator(object):
def __init__(self, data, output_dim=28, scenario=1, noise_var=None, common_dim=200):
""" DatasetGenerator initialization.
:param data: original dataset, MNIST
:param output_dim: th... | [
"numpy.mean",
"PIL.Image.fromarray",
"numpy.zeros",
"numpy.random.randn",
"retina.retina.warp_image",
"numpy.std",
"numpy.zeros_like"
] | [((1868, 1886), 'numpy.zeros_like', 'np.zeros_like', (['out'], {}), '(out)\n', (1881, 1886), True, 'import numpy as np\n'), ((1903, 1928), 'numpy.mean', 'np.mean', (['out'], {'axis': '(1, 2)'}), '(out, axis=(1, 2))\n', (1910, 1928), True, 'import numpy as np\n'), ((1944, 1968), 'numpy.std', 'np.std', (['out'], {'axis':... |
import os
import sqlite3
from typing import Optional
from loguru import logger
get_relative_path = lambda p: os.path.join(os.path.dirname(__file__), p)
class DataBase(object):
def __init__(self):
logger.info("Connecting database...")
if os.path.exists(get_relative_path('../data/data.db')):
... | [
"os.path.dirname",
"loguru.logger.info"
] | [((124, 149), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (139, 149), False, 'import os\n'), ((211, 248), 'loguru.logger.info', 'logger.info', (['"""Connecting database..."""'], {}), "('Connecting database...')\n", (222, 248), False, 'from loguru import logger\n'), ((678, 718), 'loguru.log... |
import os
import sys
import re
def parse_sample_files(sample_files, names):
sample_file_dict = {}
sample_files = sample_files.split(',')
if names is None:
names = [ os.path.splitext(os.path.basename(sample_file))[0]
for sample_file in sample_files ]
else:
... | [
"argparse.ArgumentParser",
"os.path.isfile",
"os.path.basename",
"sys.exit",
"re.search"
] | [((1406, 1494), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Combine multiple feature barcode count files"""'}), "(description=\n 'Combine multiple feature barcode count files')\n", (1429, 1494), False, 'import argparse\n'), ((953, 982), 're.search', 're.search', (['"""\tcell\t"""',... |
from FeatureProcess import *
import pandas as pd
import numpy as np
fsd = FeaturesStandard()
data = [[0, 0], [0, 0], [1, 1], [1, 1]]
scr=fsd.fit(data)
print(scr.mean_)
print(scr.transform(data))
print('--------------------')
fe = FeaturesEncoder(handle_unknown='ignore')
X = [['Male', 1], ['Female', 3], ['Female', 2... | [
"numpy.array"
] | [((586, 650), 'numpy.array', 'np.array', (['[[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]'], {}), '([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])\n', (594, 650), True, 'import numpy as np\n')] |
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
from pathlib import Path
import ptitprince as pt
# ----------
# Loss Plots
# ----------
def save_loss_plot(path, loss_function, v_path=None, show=True):
df = pd.read_csv(path)
if v_path is not None:
vdf = pd.read_csv(v_pa... | [
"matplotlib.pyplot.savefig",
"pandas.read_csv",
"pathlib.Path",
"ptitprince.RainCloud",
"os.path.join",
"numpy.concatenate",
"pandas.DataFrame",
"matplotlib.pyplot.title",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((245, 262), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (256, 262), True, 'import pandas as pd\n'), ((361, 371), 'pathlib.Path', 'Path', (['path'], {}), '(path)\n', (365, 371), False, 'from pathlib import Path\n'), ((423, 455), 'os.path.join', 'os.path.join', (['d', "(n + '_loss.png')"], {}), "(d, n... |
import argparse
import asyncio
from getpass import getuser
from .mxtunnel import open_tunnel
def main():
parser = argparse.ArgumentParser(description='Live And HTTPS Localhost')
parser.add_argument('-p', '--port', type=int, default=False, help='Port number of the local server')
parser.add_argument('-V', '... | [
"asyncio.get_event_loop",
"argparse.ArgumentParser"
] | [((120, 183), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Live And HTTPS Localhost"""'}), "(description='Live And HTTPS Localhost')\n", (143, 183), False, 'import argparse\n'), ((651, 675), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (673, 675), False, 'impor... |
from torch import nn
from torch.nn import functional as F
from .norm_module import *
# adopted from https://github.com/rosinality/stylegan2-pytorch/blob/master/model.py#L280
class NoiseInjection(nn.Module):
def __init__(self, full=False):
super().__init__()
self.noise_weight_seed = nn.Parameter(tor... | [
"torch.nn.BatchNorm2d",
"torch.nn.GroupNorm",
"torch.nn.LeakyReLU",
"torch.nn.Sequential",
"torch.nn.functional.avg_pool2d",
"torch.nn.Conv2d",
"torch.nn.functional.softplus",
"torch.nn.utils.spectral_norm",
"torch.nn.functional.interpolate",
"torch.nn.Linear"
] | [((4189, 4254), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_feat', 'out_feat', 'kernel_size', 'stride', 'pad'], {'bias': 'bias'}), '(in_feat, out_feat, kernel_size, stride, pad, bias=bias)\n', (4198, 4254), False, 'from torch import nn\n'), ((1999, 2017), 'torch.nn.LeakyReLU', 'nn.LeakyReLU', (['(0.01)'], {}), '(0.01)\n', (2... |
from dataclasses import dataclass, field
from enum import Enum
from typing import List, Optional
__NAMESPACE__ = "http://schemas.microsoft.com/office/excel/2003/xml"
class MapInfoTypeHideInactiveListBorder(Enum):
TRUE = "true"
FALSE = "false"
@dataclass
class SchemaType:
any_element: List[object] = fie... | [
"dataclasses.field"
] | [((317, 402), 'dataclasses.field', 'field', ([], {'default_factory': 'list', 'metadata': "{'type': 'Wildcard', 'namespace': '##any'}"}), "(default_factory=list, metadata={'type': 'Wildcard', 'namespace': '##any'}\n )\n", (322, 402), False, 'from dataclasses import dataclass, field\n'), ((479, 637), 'dataclasses.fiel... |
# -*- coding: utf-8 -*-
"""
LPRM time series reader
"""
from pynetcf.time_series import GriddedNcOrthoMultiTs
import os
import pygeogrids.netcdf as nc
from cadati.jd_date import jd2dt
from io_utils.utils import mjd2jd
from io_utils.read.geo_ts_readers.mixins import OrthoMultiTsCellReaderMixin
class LPRMTs(GriddedNcOr... | [
"os.path.join",
"io_utils.utils.mjd2jd",
"pygeogrids.netcdf.load_grid"
] | [((570, 593), 'pygeogrids.netcdf.load_grid', 'nc.load_grid', (['grid_path'], {}), '(grid_path)\n', (582, 593), True, 'import pygeogrids.netcdf as nc\n'), ((521, 553), 'os.path.join', 'os.path.join', (['ts_path', '"""grid.nc"""'], {}), "(ts_path, 'grid.nc')\n", (533, 553), False, 'import os\n'), ((969, 996), 'io_utils.u... |
from django.contrib import admin
from django_summernote.admin import SummernoteModelAdmin
from . import models
@admin.register(models.Post)
class PostAdmin(SummernoteModelAdmin):
# list_filter = ('post_type')
list_display = ['id','title', 'post_type', 'creator',
'view_count','created_at']
... | [
"django.contrib.admin.register"
] | [((114, 141), 'django.contrib.admin.register', 'admin.register', (['models.Post'], {}), '(models.Post)\n', (128, 141), False, 'from django.contrib import admin\n'), ((472, 503), 'django.contrib.admin.register', 'admin.register', (['models.PostLike'], {}), '(models.PostLike)\n', (486, 503), False, 'from django.contrib i... |
#!/usr/bin/env python2.7
# 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.
"""Unit test suite for common.cros.chromite."""
import test_env
import base64
import json
import unittest
from common import cros... | [
"common.cros_chromite.ChromiteConfigManager",
"common.cros_chromite.ChromitePinManager",
"base64.b64encode",
"common.cros_chromite.ChromiteTarget.Categorize",
"common.cros_chromite.ChromiteConfig.FromConfigDict",
"unittest.main"
] | [((8371, 8386), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8384, 8386), False, 'import unittest\n'), ((1717, 1782), 'common.cros_chromite.ChromiteConfig.FromConfigDict', 'cros_chromite.ChromiteConfig.FromConfigDict', (['self.CHROMITE_CONFIG'], {}), '(self.CHROMITE_CONFIG)\n', (1760, 1782), False, 'from common... |
################################################################################
#
# test_xtram.py - testing the pyfeat xtram class
#
# author: <NAME> <<EMAIL>>
# author: <NAME> <<EMAIL>>
#
################################################################################
from nose.tools import assert_raises, asse... | [
"numpy.ones"
] | [((531, 570), 'numpy.ones', 'np.ones', ([], {'shape': '(2, 3, 3)', 'dtype': 'np.intc'}), '(shape=(2, 3, 3), dtype=np.intc)\n', (538, 570), True, 'import numpy as np\n'), ((578, 610), 'numpy.ones', 'np.ones', ([], {'shape': '(10)', 'dtype': 'np.intc'}), '(shape=10, dtype=np.intc)\n', (585, 610), True, 'import numpy as n... |
import torch
import torch.nn as nn
from lightconvpoint.nn.deprecated.module import Module as LCPModule
from lightconvpoint.nn.deprecated.convolutions import FKAConv
from lightconvpoint.nn.deprecated.pooling import max_pool
from lightconvpoint.spatial.deprecated import sampling_quantized, knn, upsample_nearest
from ligh... | [
"torch.nn.ReLU",
"torch.nn.Dropout",
"lightconvpoint.nn.deprecated.pooling.max_pool",
"lightconvpoint.utils.functional.batch_gather",
"torch.nn.BatchNorm1d",
"torch.nn.Linear",
"torch.nn.Identity",
"torch.nn.Conv1d",
"torch.cat",
"lightconvpoint.spatial.deprecated.upsample_nearest"
] | [((577, 620), 'torch.nn.Conv1d', 'nn.Conv1d', (['in_channels', '(in_channels // 2)', '(1)'], {}), '(in_channels, in_channels // 2, 1)\n', (586, 620), True, 'import torch.nn as nn\n'), ((638, 670), 'torch.nn.BatchNorm1d', 'nn.BatchNorm1d', (['(in_channels // 2)'], {}), '(in_channels // 2)\n', (652, 670), True, 'import t... |
import requests
import os
url_image = 'https://www.python.org/static/community_logos/python-logo.png'
r_image = requests.get(url_image)
print(r_image.headers['Content-Type'])
# image/png
filename_image = os.path.basename(url_image)
print(filename_image)
# python-logo.png
with open('data/temp/' + filename_image, 'w... | [
"os.path.basename",
"requests.get"
] | [((114, 137), 'requests.get', 'requests.get', (['url_image'], {}), '(url_image)\n', (126, 137), False, 'import requests\n'), ((208, 235), 'os.path.basename', 'os.path.basename', (['url_image'], {}), '(url_image)\n', (224, 235), False, 'import os\n'), ((444, 465), 'requests.get', 'requests.get', (['url_zip'], {}), '(url... |
"""JsonSchemaToRDF module."""
from typing import List
from rdflib.graph import Graph
import yaml
from jsonschematordf.modelldcatnofactory import create_model_element
from jsonschematordf.parsedschema import ParsedSchema
from jsonschematordf.schema import Schema
from jsonschematordf.utils import add_elements_to_graph
... | [
"jsonschematordf.parsedschema.ParsedSchema",
"rdflib.graph.Graph",
"jsonschematordf.modelldcatnofactory.create_model_element",
"yaml.safe_load",
"jsonschematordf.schema.Schema"
] | [((1837, 1871), 'yaml.safe_load', 'yaml.safe_load', (['json_schema_string'], {}), '(json_schema_string)\n', (1851, 1871), False, 'import yaml\n'), ((2366, 2380), 'jsonschematordf.parsedschema.ParsedSchema', 'ParsedSchema', ([], {}), '()\n', (2378, 2380), False, 'from jsonschematordf.parsedschema import ParsedSchema\n')... |
from django.db import models
class DroneCategory(models.Model):
name = models.CharField(max_length=250, unique=True)
class Meta:
ordering = ('name',)
def __str__(self):
return self.name
class Drone(models.Model):
owner = models.ForeignKey('auth.User',
... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((77, 122), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)', 'unique': '(True)'}), '(max_length=250, unique=True)\n', (93, 122), False, 'from django.db import models\n'), ((259, 338), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""auth.User"""'], {'related_name': '"""drones"""'... |
# test_files.py
import unittest2 as unittest
from graphviz.files import File, Source
class TestBase(unittest.TestCase):
def setUp(self):
self.file = File()
def test_format(self):
with self.assertRaisesRegexp(ValueError, 'format'):
self.file.format = 'spam'
def test_engine(... | [
"graphviz.files.File",
"graphviz.files.Source"
] | [((166, 172), 'graphviz.files.File', 'File', ([], {}), '()\n', (170, 172), False, 'from graphviz.files import File, Source\n'), ((633, 678), 'graphviz.files.File', 'File', (['"""name"""', '"""dir"""', '"""PNG"""', '"""NEATO"""', '"""latin1"""'], {}), "('name', 'dir', 'PNG', 'NEATO', 'latin1')\n", (637, 678), False, 'fr... |
"""
This instrument description contains information
that is instrument-specific and abstracts out how we obtain
information from the data file
"""
#pylint: disable=invalid-name, too-many-instance-attributes, line-too-long, bare-except
from __future__ import absolute_import, division, print_function
import ... | [
"sys.path.insert",
"mantid.simpleapi.Transpose",
"mantid.simpleapi.MRGetTheta",
"mantid.simpleapi.RefRoi",
"sys.exc_info",
"math.fabs",
"mantid.simpleapi.Integration",
"os.path.basename",
"mantid.simpleapi.MRFilterCrossSections",
"mantid.simpleapi.LoadEventNexus",
"math.sin"
] | [((525, 573), 'sys.path.insert', 'sys.path.insert', (['(0)', 'application_conf.mantid_path'], {}), '(0, application_conf.mantid_path)\n', (540, 573), False, 'import sys\n'), ((5672, 5690), 'mantid.simpleapi.MRGetTheta', 'api.MRGetTheta', (['ws'], {}), '(ws)\n', (5686, 5690), True, 'import mantid.simpleapi as api\n'), (... |
import logging
from bson import ObjectId
from flask_restful import Resource, reqparse
from sintel.db import schema
from sintel.resources.auth_utils import requires_auth
from sintel.resources.datarun import validate_signalrun_id
LOGGER = logging.getLogger(__name__)
def get_event(event_doc):
comments = list()
... | [
"logging.getLogger",
"sintel.db.schema.Event.insert",
"flask_restful.reqparse.RequestParser",
"sintel.db.schema.Event.find_one",
"sintel.db.schema.EventInteraction.insert",
"sintel.db.schema.Signalrun.find_one",
"sintel.db.schema.Event.find",
"sintel.resources.datarun.validate_signalrun_id",
"bson.O... | [((240, 267), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (257, 267), False, 'import logging\n'), ((337, 379), 'sintel.db.schema.Annotation.find', 'schema.Annotation.find', ([], {'event': 'event_doc.id'}), '(event=event_doc.id)\n', (359, 379), False, 'from sintel.db import schema\n'), ... |
import numpy as np
from os.path import join
from os import listdir
from .utils import *
from sklearn.preprocessing import normalize
from sklearn.preprocessing import scale
from sklearn.preprocessing import MinMaxScaler
from scipy.signal import resample
from scipy.signal import decimate
import warnings
def load_data():... | [
"numpy.mean",
"os.listdir",
"numpy.std",
"numpy.asarray",
"os.path.join",
"numpy.angle",
"scipy.signal.decimate",
"numpy.split",
"numpy.zeros",
"numpy.cos",
"numpy.concatenate",
"numpy.linalg.norm",
"numpy.sin",
"numpy.loadtxt",
"sklearn.preprocessing.scale"
] | [((478, 513), 'os.path.join', 'join', (['""".."""', '"""PaHaW"""', '"""PaHaW_public"""'], {}), "('..', 'PaHaW', 'PaHaW_public')\n", (482, 513), False, 'from os.path import join\n'), ((551, 569), 'os.listdir', 'listdir', (['data_path'], {}), '(data_path)\n', (558, 569), False, 'from os import listdir\n'), ((608, 649), '... |
import NBAStatsScraper
if __name__== "__main__":
App = NBAStatsScraper.NBAStatsScraper().run() | [
"NBAStatsScraper.NBAStatsScraper"
] | [((60, 93), 'NBAStatsScraper.NBAStatsScraper', 'NBAStatsScraper.NBAStatsScraper', ([], {}), '()\n', (91, 93), False, 'import NBAStatsScraper\n')] |
import pandas as pd
from sqlalchemy import Column
from sqlalchemy.sql.sqltypes import Integer, String
from datapipe.compute import run_pipeline
from datapipe.core_steps import UpdateExternalTable
from datapipe.datatable import DataStore
from datapipe.store.database import DBConn, TableStoreDB
from datapipe.compute impo... | [
"datapipe.store.database.DBConn",
"datapipe.datatable.DataStore",
"sqlalchemy.sql.sqltypes.Integer",
"sqlalchemy.sql.sqltypes.String",
"datapipe.compute.run_pipeline",
"datapipe.core_steps.UpdateExternalTable",
"datapipe.compute.Table",
"pandas.DataFrame",
"datapipe.run_config.RunConfig"
] | [((500, 537), 'datapipe.store.database.DBConn', 'DBConn', (['dbconn.connstr', 'dbconn.schema'], {}), '(dbconn.connstr, dbconn.schema)\n', (506, 537), False, 'from datapipe.store.database import DBConn, TableStoreDB\n'), ((845, 958), 'pandas.DataFrame', 'pd.DataFrame', (["{'composite_id_1': [1, 1, 2, 2], 'composite_id_2... |
import falcon
import six
from monitorrent.settings_manager import SettingsManager
# noinspection PyUnusedLocal
class SettingsNotifyOn(object):
def __init__(self, settings_manager):
"""
:type settings_manager: SettingsManager
"""
self.settings_manager = settings_manager
def on_... | [
"falcon.HTTPBadRequest"
] | [((523, 593), 'falcon.HTTPBadRequest', 'falcon.HTTPBadRequest', (['"""BodyRequired"""', '"""Expecting not empty JSON body"""'], {}), "('BodyRequired', 'Expecting not empty JSON body')\n", (544, 593), False, 'import falcon\n'), ((717, 802), 'falcon.HTTPBadRequest', 'falcon.HTTPBadRequest', (['"""ArrayOfStringExpected"""... |
# Generated by Django 3.2.9 on 2021-11-07 16:07
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rumergy', '0002_auto_20211107_1520'),
]
operations = [
migrations.AlterField(
model_name='meter',
name='comments',
... | [
"django.db.models.CharField"
] | [((337, 400), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""No comment provided"""', 'max_length': '(200)'}), "(default='No comment provided', max_length=200)\n", (353, 400), False, 'from django.db import migrations, models\n')] |
# Importing external package dependency:
import os
import logging
from datetime import datetime
from flask import Flask, render_template, request, url_for, redirect, flash, session, abort, jsonify
from flask_migrate import Migrate
from flask_login import LoginManager, AnonymousUserMixin
from flask_mail import Ma... | [
"flask_mail.Mail",
"flask_login.LoginManager",
"logging.handlers.SMTPHandler",
"flask.Flask",
"flask_wtf.csrf.CSRFProtect",
"flask_moment.Moment",
"flask_migrate.Migrate",
"flask_sqlalchemy.SQLAlchemy",
"sellerhub.logger.setup_logging"
] | [((838, 906), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""static"""', 'template_folder': '"""templates"""'}), "(__name__, static_folder='static', template_folder='templates')\n", (843, 906), False, 'from flask import Flask, render_template, request, url_for, redirect, flash, session, abort, jsonify\n')... |
# Copyright (c) 2009 The Foundry Visionmongers Ltd. All Rights Reserved.
import nuke
import nukescripts
import random
import os
import textwrap
def copy_knobs(args):
thisGroup = nuke.thisGroup()
if( thisGroup is not nuke.root() and ( thisGroup.locked() or thisGroup.subgraphLocked() ) ):
raise RuntimeError(... | [
"os.path.exists",
"random.choice",
"nuke.connectViewer",
"nuke.nodes.Group",
"nuke.value",
"os.path.join",
"nuke.toNode",
"nuke.Panel",
"nukescripts.cut_paste_file",
"nuke.selectedNode",
"textwrap.wrap",
"nuke.thisGroup",
"nuke.root",
"nuke.pluginPath",
"nuke.delete",
"nuke.activeViewe... | [((184, 200), 'nuke.thisGroup', 'nuke.thisGroup', ([], {}), '()\n', (198, 200), False, 'import nuke\n'), ((445, 493), 'nuke.nodes.Group', 'nuke.nodes.Group', ([], {'name': '"""____tempcopyknobgroup__"""'}), "(name='____tempcopyknobgroup__')\n", (461, 493), False, 'import nuke\n'), ((1057, 1079), 'nuke.delete', 'nuke.de... |
from functionali import (
first,
ffirst,
second,
third,
fourth,
fifth,
last,
butlast,
rest,
)
def test_first():
assert 1 == first([1, 2, 3])
assert 1 == first((1, 2, 3))
assert 1 == first({1, 2, 3})
assert (1, "a") == first({1: "a", 2: "b"})
assert None == first... | [
"functionali.rest",
"functionali.second",
"functionali.butlast",
"functionali.first",
"functionali.last",
"functionali.ffirst",
"functionali.third"
] | [((166, 182), 'functionali.first', 'first', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (171, 182), False, 'from functionali import first, ffirst, second, third, fourth, fifth, last, butlast, rest\n'), ((199, 215), 'functionali.first', 'first', (['(1, 2, 3)'], {}), '((1, 2, 3))\n', (204, 215), False, 'from functionali import... |
import os
import sys
cwd = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")
if os.path.join(cwd, 'slim') not in sys.path:
sys.path.append(os.path.join(cwd, 'slim'))
| [
"os.path.abspath",
"os.path.join"
] | [((94, 119), 'os.path.join', 'os.path.join', (['cwd', '"""slim"""'], {}), "(cwd, 'slim')\n", (106, 119), False, 'import os\n'), ((57, 82), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (72, 82), False, 'import os\n'), ((157, 182), 'os.path.join', 'os.path.join', (['cwd', '"""slim"""'], {}), ... |
import torch
from lab import logger
from lab.logger.indicators import Histogram
def add_model_indicators(model: torch.nn.Module, model_name: str = "model"):
for name, param in model.named_parameters():
if param.requires_grad:
logger.add_indicator(Histogram(f"{model_name}.{name}"))
... | [
"lab.logger.store",
"lab.logger.indicators.Histogram"
] | [((556, 599), 'lab.logger.store', 'logger.store', (['f"""{model_name}.{name}"""', 'param'], {}), "(f'{model_name}.{name}', param)\n", (568, 599), False, 'from lab import logger\n'), ((612, 665), 'lab.logger.store', 'logger.store', (['f"""{model_name}.{name}.grad"""', 'param.grad'], {}), "(f'{model_name}.{name}.grad', p... |
"""A mock experiment."""
import sys
import unittest
from unittest import TestCase
from unittest.mock import MagicMock
from unittest.mock import Mock
import experiment
from workload_experiment import WorkloadExperiment
class Test_Experiment(TestCase):
"""Implements a generic experiment with dependencies mocked aw... | [
"unittest.main",
"unittest.mock.MagicMock",
"unittest.mock.Mock",
"experiment.parse_command_line_args"
] | [((2449, 2464), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2462, 2464), False, 'import unittest\n'), ((537, 573), 'experiment.parse_command_line_args', 'experiment.parse_command_line_args', ([], {}), '()\n', (571, 573), False, 'import experiment\n'), ((705, 746), 'unittest.mock.Mock', 'Mock', ([], {'return_va... |
# Copyright DST Group. Licensed under the MIT license.
import datetime
from ipaddress import IPv4Address, IPv4Network
import CybORG.Shared.Enums as CyEnums
class NetworkInterface:
"""A class for storing network interface information """
def __init__(self,
hostid: str = None,
... | [
"CybORG.Shared.Enums.FileVersion.parse_string",
"ipaddress.IPv4Address",
"CybORG.Shared.Enums.FileType.parse_string",
"datetime.strptime",
"ipaddress.IPv4Network"
] | [((545, 568), 'ipaddress.IPv4Address', 'IPv4Address', (['ip_address'], {}), '(ip_address)\n', (556, 568), False, 'from ipaddress import IPv4Address, IPv4Network\n'), ((591, 610), 'ipaddress.IPv4Network', 'IPv4Network', (['subnet'], {}), '(subnet)\n', (602, 610), False, 'from ipaddress import IPv4Address, IPv4Network\n'... |
import matplotlib.pyplot as plt
import numpy as np
import os
import pickle
def get_mean_stds(data):
return np.mean(data), np.std(data) / np.sqrt(len(data)) * 1.96
if __name__ == '__main__':
labels = ['OpenTAL', 'EDL', 'SoftMax']
result_folders = ['edl_oshead_iou', 'edl_15kc', 'default']
colors = ['k... | [
"numpy.mean",
"os.makedirs",
"os.path.join",
"pickle.load",
"numpy.array",
"numpy.zeros",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.tight_layout",
"numpy.std",
"matplotlib.pyplot.subplots"
] | [((595, 631), 'os.makedirs', 'os.makedirs', (['fig_path'], {'exist_ok': '(True)'}), '(fig_path, exist_ok=True)\n', (606, 631), False, 'import os\n'), ((681, 715), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'figsize': '(8, 5)'}), '(1, 1, figsize=(8, 5))\n', (693, 715), True, 'import matplotlib.pyplo... |
"""test_cvvidproc.py
First, shows image of ISCO pump setup, closes when user clicks spacebar
Second, shows first frame of video of inner stream, closes when user clicks spacebar
Third, computes background of samples video. Should look like first frame^ w/o objects.
"""
import time
import cv2
import cvvidproc
import s... | [
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"sys.path.append",
"cvimproc.improc.compute_bkgd_med_thread",
"cv2.waitKey",
"cv2.imread"
] | [((323, 349), 'sys.path.append', 'sys.path.append', (['"""../src/"""'], {}), "('../src/')\n", (338, 349), False, 'import sys\n'), ((428, 465), 'cv2.imread', 'cv2.imread', (['"""../input/images/img.jpg"""'], {}), "('../input/images/img.jpg')\n", (438, 465), False, 'import cv2\n'), ((466, 501), 'cv2.imshow', 'cv2.imshow'... |
# -*- coding: utf-8 -*-
# Copyright (c) 2020, LEAM Technology System and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe
from frappe.integrations.utils import make_post_request
from frappe.model.naming import make_autoname
from renovation_core.utils... | [
"frappe.flags.integration_request.json",
"frappe._dict",
"frappe.db.get_value",
"frappe.db.get_all",
"frappe.throw",
"renovation_core.utils.fcm.make_communication_doc",
"frappe.integrations.utils.make_post_request",
"frappe.get_site_config",
"frappe._",
"frappe.enqueue",
"frappe.delete_doc",
"... | [((5824, 5927), 'frappe.get_all', 'frappe.get_all', (['"""Huawei User Token"""'], {'fields': "['name', 'token', 'linked_sid']", 'filters': "{'user': user}"}), "('Huawei User Token', fields=['name', 'token', 'linked_sid'],\n filters={'user': user})\n", (5838, 5927), False, 'import frappe\n'), ((8575, 8634), 'frappe._... |