code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from qiskit import *
from qiskit import IBMQ
from qiskit.tools.monitor import job_monitor
from qiskit.providers.ibmq import least_busy
def random_qubit():
IBMQ.load_account()
provider = IBMQ.get_provider("ibm-q")
small_devices = provider.backends(
filters=lambda x: x.configuration().n_qubits == 5... | [
"qiskit.IBMQ.get_provider",
"qiskit.providers.ibmq.least_busy",
"qiskit.IBMQ.load_account",
"qiskit.tools.monitor.job_monitor"
] | [((161, 180), 'qiskit.IBMQ.load_account', 'IBMQ.load_account', ([], {}), '()\n', (178, 180), False, 'from qiskit import IBMQ\n'), ((196, 222), 'qiskit.IBMQ.get_provider', 'IBMQ.get_provider', (['"""ibm-q"""'], {}), "('ibm-q')\n", (213, 222), False, 'from qiskit import IBMQ\n'), ((383, 408), 'qiskit.providers.ibmq.least... |
from measurement.measures import Energy
class TestEnergy:
def test_dietary_calories_kwarg(self):
calories = Energy(Calorie=2000)
kilojoules = Energy(kJ=8368)
assert calories.si_value == kilojoules.si_value
| [
"measurement.measures.Energy"
] | [((122, 142), 'measurement.measures.Energy', 'Energy', ([], {'Calorie': '(2000)'}), '(Calorie=2000)\n', (128, 142), False, 'from measurement.measures import Energy\n'), ((164, 179), 'measurement.measures.Energy', 'Energy', ([], {'kJ': '(8368)'}), '(kJ=8368)\n', (170, 179), False, 'from measurement.measures import Energ... |
"""task definitions r2
Revision ID: 0818749b8790
Revises: <PASSWORD>
Create Date: 2021-04-16 10:42:10.495298
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '0818749b8790'
down_revision = '<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
... | [
"sqlalchemy.ForeignKeyConstraint",
"alembic.op.drop_table",
"alembic.op.drop_column",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Integer",
"sqlalchemy.JSON"
] | [((984, 1024), 'alembic.op.drop_column', 'op.drop_column', (['"""annotations"""', '"""task_id"""'], {}), "('annotations', 'task_id')\n", (998, 1024), False, 'from alembic import op\n'), ((1029, 1051), 'alembic.op.drop_table', 'op.drop_table', (['"""tasks"""'], {}), "('tasks')\n", (1042, 1051), False, 'from alembic impo... |
import json
import pandas as pd
import pathlib as pal
root_p = pal.Path('/home/surchs/sim_big/DATA/ABIDE_1/')
script_paths = pal.Path('/home/surchs/local_projects/abide_univariate/scripts/preprocessing/abide_1/')
raw_p = root_p / 'RAW'
script_str = '''
%%% NKI TRT preprocessing pipeline
% Script to run a preprocessin... | [
"pandas.DataFrame",
"json.load",
"pathlib.Path"
] | [((64, 110), 'pathlib.Path', 'pal.Path', (['"""/home/surchs/sim_big/DATA/ABIDE_1/"""'], {}), "('/home/surchs/sim_big/DATA/ABIDE_1/')\n", (72, 110), True, 'import pathlib as pal\n'), ((126, 223), 'pathlib.Path', 'pal.Path', (['"""/home/surchs/local_projects/abide_univariate/scripts/preprocessing/abide_1/"""'], {}), "(\n... |
from .models import Likes
from rest_framework import serializers
class LikeSerializer(serializers.ModelSerializer):
like = serializers.ReadOnlyField(source="liked_by.username")
dislike = serializers.ReadOnlyField(source="disliked_by.username")
class Meta:
model = Likes
fields = ("id", "po... | [
"rest_framework.serializers.ReadOnlyField"
] | [((129, 182), 'rest_framework.serializers.ReadOnlyField', 'serializers.ReadOnlyField', ([], {'source': '"""liked_by.username"""'}), "(source='liked_by.username')\n", (154, 182), False, 'from rest_framework import serializers\n'), ((197, 253), 'rest_framework.serializers.ReadOnlyField', 'serializers.ReadOnlyField', ([],... |
import munerator.common.database
import mongomock
import mongoengine
import eve.io.mongo.mongo
import pytest
from mock import Mock
con = mongomock.Connection()
_db = con['default']
@pytest.fixture(scope='function')
def uuid():
"""
Random id to be used in database tests.
"""
import uuid
return st... | [
"mongomock.Connection",
"mock.Mock",
"uuid.uuid4",
"pytest.yield_fixture",
"pytest.fixture"
] | [((139, 161), 'mongomock.Connection', 'mongomock.Connection', ([], {}), '()\n', (159, 161), False, 'import mongomock\n'), ((186, 218), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (200, 218), False, 'import pytest\n'), ((339, 377), 'pytest.yield_fixture', 'pytest.yield_... |
import pygame
import random
screen_width = 600
screen_height = 600
width = 25
height = 25
bombs = 75
border = 1
clicked = False
field = []
for x in range(screen_width//width):
field.append([])
for y in range(screen_height//height):
field[x].append((0, True))
pygame.... | [
"pygame.init",
"random.randrange",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip"
] | [((313, 326), 'pygame.init', 'pygame.init', ([], {}), '()\n', (324, 326), False, 'import pygame\n'), ((391, 445), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(screen_width, screen_height)'], {}), '((screen_width, screen_height))\n', (414, 445), False, 'import pygame\n'), ((498, 516), 'pygame.event.get', 'p... |
from typing import Any
from uuid import UUID
from .gitbackend.subprocess import git_load_json, git_save_json
from ..basemapper import BaseMapper
from ..reference import Reference
class MetadataRootRecordGitMapper(BaseMapper):
def map(self, ref: Reference) -> Any:
from dataladmetadatamodel.connector impo... | [
"uuid.UUID"
] | [((650, 689), 'uuid.UUID', 'UUID', (["json_object['dataset_identifier']"], {}), "(json_object['dataset_identifier'])\n", (654, 689), False, 'from uuid import UUID\n')] |
#!/usr/bin/env python3
import socket
import sys
from extract_user import dump
import ipcalc
import hashlib
import requests
import optparse
parser = optparse.OptionParser()
parser.add_option('-f', '--fileName',action="store", dest="fileName",help="enter text file", default="empty")
parser.add_option('-p', '--port',acti... | [
"socket.socket",
"extract_user.dump",
"optparse.OptionParser",
"ipcalc.Network"
] | [((149, 172), 'optparse.OptionParser', 'optparse.OptionParser', ([], {}), '()\n', (170, 172), False, 'import optparse\n'), ((1796, 1823), 'ipcalc.Network', 'ipcalc.Network', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (1810, 1823), False, 'import ipcalc\n'), ((2090, 2105), 'socket.socket', 'socket.socket', ([], {}), '()\... |
#### identify_closest_5GUU3_190218.py
##
## 2/18/2019
## <NAME> <EMAIL>
## run as: python identify_closest_5GUU3_190218.py ${input_fa} ${input_bed} ${output_filename}
## identifies the closest GUU to the crosslinked site for sequences plus and minus 10nt around crosslinked site
## ${input_fa} is a fasta
## first l... | [
"re.search"
] | [((1674, 1704), 're.search', 're.search', (['""">(.*):"""', 'read_line'], {}), "('>(.*):', read_line)\n", (1683, 1704), False, 'import re\n'), ((1716, 1747), 're.search', 're.search', (['""":(.*?)-"""', 'read_line'], {}), "(':(.*?)-', read_line)\n", (1725, 1747), False, 'import re\n'), ((1757, 1790), 're.search', 're.s... |
from waitress import serve
from flatgov.wsgi import application
if __name__ == '__main__':
serve(application, port='8000') | [
"waitress.serve"
] | [((97, 128), 'waitress.serve', 'serve', (['application'], {'port': '"""8000"""'}), "(application, port='8000')\n", (102, 128), False, 'from waitress import serve\n')] |
# python -m odf.mfs.collector
import datetime
import os
import time
from datetime import datetime
from threading import Thread
import cv2
import mss
import pandas as pd
import wave
import pyaudio
from odf.config import config
from PIL import Image
import numpy
import json
sensors = {
# up to seven groups, each g... | [
"threading.Thread.__init__",
"mss.mss",
"os.makedirs",
"json.dump",
"os.path.join",
"time.sleep",
"datetime.datetime.now",
"numpy.array",
"cv2.VideoWriter_fourcc",
"pandas.DataFrame",
"pyaudio.PyAudio",
"SimConnect.AircraftRequests",
"SimConnect.SimConnect"
] | [((5928, 5966), 'os.path.join', 'os.path.join', (['config.DATA_PATH', 'folder'], {}), '(config.DATA_PATH, folder)\n', (5940, 5966), False, 'import os\n'), ((5985, 6004), 'os.makedirs', 'os.makedirs', (['folder'], {}), '(folder)\n', (5996, 6004), False, 'import os\n'), ((6662, 6679), 'pyaudio.PyAudio', 'pyaudio.PyAudio'... |
from django.urls import path, include
from rest_framework import routers
from catalogue.api.views import (
ProductViewSet,
ProductCategoryViewSet,
MediaUploadViewSet,
AttributeGroupViewSet,
ProductAttributeViewSet,
ProductAttributeValueViewSet,
ProductStockViewSet,
)
router = routers.Def... | [
"rest_framework.routers.DefaultRouter",
"django.urls.include"
] | [((309, 332), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (330, 332), False, 'from rest_framework import routers\n'), ((940, 960), 'django.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (947, 960), False, 'from django.urls import path, include\n')] |
import os
from flask import Flask
from app.model import model
from app.appli import appli
def create_app():
app = Flask(__name__)
app.register_blueprint(model)
app.register_blueprint(appli)
return app
if __name__ == '__main__':
my_app = create_app()
my_app.run(debug=True) | [
"flask.Flask"
] | [((121, 136), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (126, 136), False, 'from flask import Flask\n')] |
# Generated by Django 3.0.10 on 2021-02-18 15:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('users', '0006_auto_20210209_0849'),
('program', '0010_mentorslotassociation_is_confirmed'),
('session', '00... | [
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey"
] | [((480, 570), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'through': '"""session.MentorSessionAssociation"""', 'to': '"""users.Mentor"""'}), "(through='session.MentorSessionAssociation', to=\n 'users.Mentor')\n", (502, 570), False, 'from django.db import migrations, models\n'), ((684, 781), '... |
import numpy as np
from matplotlib import pyplot as plt
import pickle as pkl
import starry
import celerite2.jax
from celerite2.jax import terms as jax_terms
from celerite2 import terms, GaussianProcess
from exoplanet.distributions import estimate_inverse_gamma_parameters
from matplotlib import colors
import matplotli... | [
"numpy.clip",
"numpy.sqrt",
"numpy.array",
"matplotlib.ticker.AutoMinorLocator",
"numpy.arange",
"matplotlib.colors.LogNorm",
"numpy.mean",
"numpy.diff",
"numpy.exp",
"numpy.linspace",
"matplotlib.cm.ScalarMappable",
"numpy.random.seed",
"numpy.concatenate",
"starry.Map",
"pickle.load",
... | [((525, 543), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (539, 543), True, 'import numpy as np\n'), ((12516, 12536), 'numpy.arange', 'np.arange', (['(0)', '(60)', '(10)'], {}), '(0, 60, 10)\n', (12525, 12536), True, 'import numpy as np\n'), ((12565, 12583), 'numpy.arange', 'np.arange', (['(0)', '(... |
import pytest
import responses
from sparkpost import SparkPost
from sparkpost.exceptions import SparkPostAPIException
@responses.activate
def test_success_events_message():
responses.add(
responses.GET,
'https://api.sparkpost.com/api/v1/events/message',
status=200,
content_type='a... | [
"sparkpost.SparkPost",
"responses.add",
"pytest.raises"
] | [((180, 336), 'responses.add', 'responses.add', (['responses.GET', '"""https://api.sparkpost.com/api/v1/events/message"""'], {'status': '(200)', 'content_type': '"""application/json"""', 'body': '"""{"results": []}"""'}), '(responses.GET,\n \'https://api.sparkpost.com/api/v1/events/message\', status=200,\n conten... |
#
# Copyright 2016-2017 Games Creators Club
#
# MIT License
#
import pygame, sys, time, random
import paho.mqtt.client as mqtt
import math
pygame.init()
screen = pygame.display.set_mode((600,600))
frameclock = pygame.time.Clock()
afont = pygame.font.SysFont("apple casual", 48)
distance = 150.0
def generateRando... | [
"sys.exit",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"time.strftime",
"math.degrees",
"pygame.key.get_pressed",
"math.atan2",
"pygame.time.Clock",
"pygame.font.SysFont"
] | [((141, 154), 'pygame.init', 'pygame.init', ([], {}), '()\n', (152, 154), False, 'import pygame, sys, time, random\n'), ((165, 200), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(600, 600)'], {}), '((600, 600))\n', (188, 200), False, 'import pygame, sys, time, random\n'), ((214, 233), 'pygame.time.Clock', '... |
import unittest
from src.t1000.application.dependency_injection.result_factory import EventsResultFactory, ConsoleEventsResult, HtmlEventsResult
class EventsResultFactoryTestCase(unittest.TestCase):
def setUp(self):
return super().setUp()
def tearDown(self):
return super().tearDown()
... | [
"src.t1000.application.dependency_injection.result_factory.EventsResultFactory.create"
] | [((1879, 1981), 'src.t1000.application.dependency_injection.result_factory.EventsResultFactory.create', 'EventsResultFactory.create', (['"""cmd"""', '"""events_detail"""', '"""get_events_from_today"""', '"""Events"""', '"""in_memory"""'], {}), "('cmd', 'events_detail', 'get_events_from_today',\n 'Events', 'in_memory... |
#---------------------------------------------------------------------------
# Script last modifed on: November 30, 2012 (updated for the 2013 version of the Flood Tools)
# Author: <NAME> <EMAIL>
# Usage: 3_Enhance_8bit_Web_Python_Tool (inRaster, No_STDEV)
# Setups: 1) Assumes user has set the Current Workspace in ... | [
"arcpy.GetMessageCount",
"traceback.format_tb",
"arcpy.CheckOutExtension",
"arcpy.GetRasterProperties_management",
"sys.exc_info",
"arcpy.Raster",
"arcpy.Delete_management",
"arcpy.AddMessage",
"arcpy.AddError",
"arcpy.GetSeverity",
"arcpy.CreateFolder_management",
"arcpy.CheckExtension",
"a... | [((1297, 1311), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (1309, 1311), False, 'import sys, traceback\n'), ((1329, 1352), 'traceback.format_tb', 'traceback.format_tb', (['tb'], {}), '(tb)\n', (1348, 1352), False, 'import sys, traceback\n'), ((2054, 2081), 'arcpy.GetParameterAsText', 'arcpy.GetParameterAsText', ... |
# -*- coding: utf-8 -*-
import numpy as np
from scipy.linalg import block_diag
class Network(object):
"""
Class for networks of boreholes with series, parallel, and mixed
connections between the boreholes.
Contains information regarding the physical dimensions and thermal
characteristics of the p... | [
"numpy.tile",
"numpy.eye",
"numpy.linalg.solve",
"numpy.abs",
"numpy.isscalar",
"numpy.all",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.empty",
"numpy.linalg.inv",
"scipy.linalg.block_diag",
"numpy.atleast_1d"
] | [((5461, 5477), 'numpy.isscalar', 'np.isscalar', (['T_b'], {}), '(T_b)\n', (5472, 5477), True, 'import numpy as np\n'), ((7051, 7067), 'numpy.isscalar', 'np.isscalar', (['T_b'], {}), '(T_b)\n', (7062, 7067), True, 'import numpy as np\n'), ((8583, 8599), 'numpy.isscalar', 'np.isscalar', (['T_b'], {}), '(T_b)\n', (8594, ... |
import json
from django.test import TestCase
from authors.apps.authentication.models import User
from rest_framework.test import (APIClient, APITestCase)
from django.urls import reverse
from authors.apps.profiles.tests.test_data import (
VALID_LOGIN_DATA, VALID_USER_DATA)
class BaseTestProfile(APITestCase):
d... | [
"django.urls.reverse",
"json.dumps",
"rest_framework.test.APIClient"
] | [((358, 369), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (367, 369), False, 'from rest_framework.test import APIClient, APITestCase\n'), ((398, 422), 'django.urls.reverse', 'reverse', (['"""register-user"""'], {}), "('register-user')\n", (405, 422), False, 'from django.urls import reverse\n'), ((44... |
from __future__ import print_function # Python 2/3 compatibility
import json
import boto3
from botocore.vendored import requests
import os
def lambda_handler(event, context):
print("Event:", event)
signalId = event.get('id')
actionId = event.get('actionId')
variables = event.get("variables")
... | [
"json.dumps",
"boto3.client"
] | [((894, 938), 'boto3.client', 'boto3.client', (['"""ec2"""'], {'region_name': '"""us-east-1"""'}), "('ec2', region_name='us-east-1')\n", (906, 938), False, 'import boto3\n'), ((3284, 3303), 'json.dumps', 'json.dumps', (['message'], {}), '(message)\n', (3294, 3303), False, 'import json\n')] |
import json
import unittest
import requests
from ofxtools.Parser import OFXTree
from ..settings import DDA_ACCOUNT_TRANSACTIONS, OFX_FILE_PATH, ACCESS_TOKEN, DDA_ACCOUNTSDETAILS
class TestMeta(unittest.TestCase):
def setUp(self):
pass
def test_connection(self):
pass
def test_dda_inter... | [
"requests.get"
] | [((482, 542), 'requests.get', 'requests.get', (['DDA_ACCOUNTSDETAILS'], {'headers': 'self.auth_headers'}), '(DDA_ACCOUNTSDETAILS, headers=self.auth_headers)\n', (494, 542), False, 'import requests\n')] |
import matplotlib.pyplot as pl
import os
import numpy as np
from ticle.data.dataHandler import normalizeData,load_file
from ticle.analysis.analysis import get_significant_periods
pl.rc('xtick', labelsize='x-small')
pl.rc('ytick', labelsize='x-small')
pl.rc('font', family='serif')
pl.rcParams.update({'font.size': 20})... | [
"os.makedirs",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"ticle.data.dataHandler.load_file",
"ticle.analysis.analysis.get_significant_periods",
"os.getcwd",
"ticle.data.dataHandler.normalizeData",
"matplotlib.pyplot.rcParams.updat... | [((181, 216), 'matplotlib.pyplot.rc', 'pl.rc', (['"""xtick"""'], {'labelsize': '"""x-small"""'}), "('xtick', labelsize='x-small')\n", (186, 216), True, 'import matplotlib.pyplot as pl\n'), ((217, 252), 'matplotlib.pyplot.rc', 'pl.rc', (['"""ytick"""'], {'labelsize': '"""x-small"""'}), "('ytick', labelsize='x-small')\n"... |
'''
注意:本题与主站 343 题相同:https://leetcode-cn.com/problems/integer-break/
给你一根长度为 n 的绳子,请把绳子剪成整数长度的 m 段(m、n都是整数,n>1并且m>1),
每段绳子的长度记为 k[0],k[1]...k[m] 。请问 k[0]*k[1]*...*k[m] 可能的最大乘积是多少?
例如,当绳子的长度是8时,我们把它剪成长度分别为2、3、3的三段,此时得到的最大乘积是18。
示例 1:
输入: 2
输出: 1
解释: 2 = 1 + 1, 1 × 1 = 1
示例 2:
输入: 10
输出: 36
解释: 10 = 3 + 3 + 4, 3 × 3 ×... | [
"math.pow"
] | [((1526, 1540), 'math.pow', 'math.pow', (['(3)', 'a'], {}), '(3, a)\n', (1534, 1540), False, 'import math\n'), ((1584, 1602), 'math.pow', 'math.pow', (['(3)', '(a - 1)'], {}), '(3, a - 1)\n', (1592, 1602), False, 'import math\n'), ((1648, 1662), 'math.pow', 'math.pow', (['(3)', 'a'], {}), '(3, a)\n', (1656, 1662), Fals... |
# -*- coding: utf-8 -*-
import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
"""
created by shhuan at 2017/10/20 14:23
"""
MAXN = 2000000+5
G = collections.defaultdict(list)
def addEdge(s, t):
G[s].append(t)
G[t].append(s)
N = 0
siz = [0] * MAXN... | [
"collections.defaultdict"
] | [((207, 236), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (230, 236), False, 'import collections\n')] |
# -*- coding: utf-8 -*-
import unittest
import exceptions
import operator
from ledger import *
from StringIO import *
from datetime import *
class PostingTestCase(unittest.TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_(self):
pass
def suite():
return u... | [
"unittest.main",
"unittest.TestLoader"
] | [((412, 427), 'unittest.main', 'unittest.main', ([], {}), '()\n', (425, 427), False, 'import unittest\n'), ((319, 340), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (338, 340), False, 'import unittest\n')] |
import importlib
import operator
from json import dumps, loads
import db.cache
import ht.htc
import ht.form
import ht.gui_grid
import rep.report
import bp.bpm
from evaluate_expr import eval_bool_expr, eval_elem
from common import AibError, AibDenied
from common import log, debug
async def on_click(caller, btn): # ca... | [
"evaluate_expr.eval_elem",
"common.log.write",
"importlib.import_module",
"evaluate_expr.eval_bool_expr"
] | [((14680, 14716), 'importlib.import_module', 'importlib.import_module', (['module_name'], {}), '(module_name)\n', (14703, 14716), False, 'import importlib\n'), ((10260, 10327), 'common.log.write', 'log.write', (['f"""CHG BUT {change.attrib} {button.ref} {change.tag}\n\n"""'], {}), "(f'CHG BUT {change.attrib} {button.re... |
import os
import sys
sys.path.append("..")
sys.path.append("../../")
sys.path.append("../../../")
from typing import Type, Union, Dict, List
import numpy as np
import torch.utils.data as data
from PIL import Image
from torchvision import transforms
from yacs.config import CfgNode
from datasets.augmentation import a... | [
"torchvision.transforms.ToTensor",
"os.path.join",
"datasets.augmentation.augmentation",
"numpy.ascontiguousarray",
"yacs.config.CfgNode",
"torchvision.transforms.Resize",
"lib.utils.base_utils.LoadImgs",
"lib.datasets.make_datasets.make_dataset",
"sys.path.append",
"lib.utils.base_utils.GetImgFps... | [((22, 43), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (37, 43), False, 'import sys\n'), ((44, 69), 'sys.path.append', 'sys.path.append', (['"""../../"""'], {}), "('../../')\n", (59, 69), False, 'import sys\n'), ((70, 98), 'sys.path.append', 'sys.path.append', (['"""../../../"""'], {}), "('..... |
"""
Simple Bot to reply to Telegram messages.
First, a few handler functions are defined. Then, those functions are passed to
the Dispatcher and registered at their respective places.
Then, the bot is started and runs until we press Ctrl-C on the command line.
Usage:
Basic Echobot example, repeats messages.
Press Ctrl-... | [
"logging.basicConfig",
"logging.getLogger",
"beauty.pickup",
"beauty.start",
"time.sleep",
"telegram.InputMediaPhoto",
"telegram.ext.MessageHandler",
"sys.exit",
"telegram.ext.Updater",
"telegram.ext.CommandHandler",
"telegram.ReplyKeyboardMarkup"
] | [((620, 727), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(name)s - %(levelname)s - %(message)s"""', 'level': 'logging.INFO'}), "(format=\n '%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=logging.INFO)\n", (639, 727), False, 'import logging\n'), ((753, 780), 'loggin... |
import random
import pubchem as pc
import numpy as np
import pandas as pd
import sklearn as sk
import utility
import db.db as db
from config import config as cc
import sys
from sets import Set
import data
RD = cc.exp['params']['data']
RP = cc.exp['params']['rnn']
# not entirely correct, in one partition can app... | [
"numpy.copy",
"numpy.nanstd",
"numpy.random.shuffle",
"data.denormalize",
"numpy.corrcoef",
"numpy.absolute",
"utility.equals",
"sklearn.metrics.roc_auc_score",
"utility.logloss",
"numpy.nanmean",
"numpy.zeros",
"sklearn.metrics.log_loss",
"numpy.concatenate",
"sklearn.metrics.accuracy_sco... | [((1820, 1850), 'data.denormalize', 'data.denormalize', (['labels', 'meta'], {}), '(labels, meta)\n', (1836, 1850), False, 'import data\n'), ((4235, 4251), 'numpy.zeros', 'np.zeros', (['(2, 2)'], {}), '((2, 2))\n', (4243, 4251), True, 'import numpy as np\n'), ((5554, 5584), 'data.denormalize', 'data.denormalize', (['la... |
# Copyright 2022 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
import logging
import time
import uuid
from collections import defaultdict
from dataclasses import dataclass
from typing import Type, TypeVar
from pants... | [
"logging.getLogger",
"pants.bsp.util_rules.targets.BSPCompileResult",
"dataclasses.dataclass",
"pants.engine.unions.UnionRule",
"pants.bsp.spec.compile.CompileResult",
"uuid.uuid4",
"collections.defaultdict",
"pants.engine.rules.collect_rules",
"pants.engine.internals.selectors.Get",
"time.time",
... | [((1150, 1177), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1167, 1177), False, 'import logging\n'), ((1185, 1215), 'typing.TypeVar', 'TypeVar', (['"""_FS"""'], {'bound': 'FieldSet'}), "('_FS', bound=FieldSet)\n", (1192, 1215), False, 'from typing import Type, TypeVar\n'), ((1383, 140... |
import copy
import json
class DataSaver():
@staticmethod
def get_extended_dict(existing_json, extending_json):
extended_json = copy.deepcopy(existing_json)
extended_json['logs'].append(extending_json)
return extended_json
@staticmethod
def create_dict_from_data(city, temperatu... | [
"json.load",
"json.dump",
"copy.deepcopy"
] | [((145, 173), 'copy.deepcopy', 'copy.deepcopy', (['existing_json'], {}), '(existing_json)\n', (158, 173), False, 'import copy\n'), ((869, 906), 'json.dump', 'json.dump', (['extended_dict', 'f'], {'indent': '(4)'}), '(extended_dict, f, indent=4)\n', (878, 906), False, 'import json\n'), ((588, 600), 'json.load', 'json.lo... |
from algos.custom_gym_loop import ReinforcementLearning
from collections import deque
import numpy as np
import tensorflow as tf
class Lagrangian( ReinforcementLearning ):
"""
Class that inherits from ReinforcementLearning to implements the REINFORCE algorithm, the original paper can be found here:
https://procee... | [
"numpy.mean",
"collections.deque",
"tensorflow.random.set_seed",
"numpy.where",
"tensorflow.math.log",
"tensorflow.keras.optimizers.Adam",
"tensorflow.GradientTape",
"numpy.array",
"numpy.random.seed",
"numpy.vstack",
"tensorflow.reduce_mean",
"tensorflow.gather_nd"
] | [((741, 765), 'tensorflow.random.set_seed', 'tf.random.set_seed', (['seed'], {}), '(seed)\n', (759, 765), True, 'import tensorflow as tf\n'), ((770, 790), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (784, 790), True, 'import numpy as np\n'), ((929, 955), 'tensorflow.keras.optimizers.Adam', 'tf.ke... |
#!/usr/bin/python
from os import setuid,setgid,path
from json import load
from time import time
from select import select
import socket
def handleIdent(fd):
fd.settimeout(1)
try:
data=fd.recv(1024).strip()
except:
fd.send('0,0:ERROR:UNKNOWN-ERROR\r\n') # TODO: catch exceptions which are actual errors, as opposed... | [
"select.select",
"socket.socket",
"os.path.realpath",
"os.setgid",
"json.load",
"os.setuid"
] | [((840, 852), 'json.load', 'load', (['config'], {}), '(config)\n', (844, 852), False, 'from json import load\n'), ((1217, 1243), 'os.setgid', 'setgid', (["settings['setgid']"], {}), "(settings['setgid'])\n", (1223, 1243), False, 'from os import setuid, setgid, path\n'), ((1245, 1271), 'os.setuid', 'setuid', (["settings... |
from typing import Tuple
import numpy as np
from PyGenetic.crossover import CrossoverDecidor
from PyGenetic.mutation import MutationDecidor
class FactoryPopulation():
def __init__(self):
self.crossover_decidor = CrossoverDecidor(self.crossover_type,
self.... | [
"PyGenetic.mutation.MutationDecidor",
"numpy.argsort",
"PyGenetic.crossover.CrossoverDecidor"
] | [((227, 278), 'PyGenetic.crossover.CrossoverDecidor', 'CrossoverDecidor', (['self.crossover_type', 'self.n_genes'], {}), '(self.crossover_type, self.n_genes)\n', (243, 278), False, 'from PyGenetic.crossover import CrossoverDecidor\n'), ((362, 481), 'PyGenetic.mutation.MutationDecidor', 'MutationDecidor', (['self.mutati... |
#!/usr/bin/env python
# Copyright 2019 <NAME>
#
# This file is part of RfPy.
#
# 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 the rights
# ... | [
"stdb.io.load_db",
"os.path.exists",
"argparse.ArgumentParser",
"pathlib.Path",
"rfpy.RFData"
] | [((1550, 1919), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'usage': '"""%(prog)s [arguments] <station database>"""', 'description': "('Script used to re-calculate receiver functions ' +\n 'that already exist on disk, but using different ' +\n 'processing options. The stations are processed one ' +\n 'b... |
"""
Check slice [-1:1:-1].
"""
import support
if 'abcde'[-1:1:-1] != 'edc':
raise support.TestError("slice [-1:1:-1] failed %s" % 'abcde'[-1:1:-1])
| [
"support.TestError"
] | [((88, 153), 'support.TestError', 'support.TestError', (["('slice [-1:1:-1] failed %s' % 'abcde'[-1:1:-1])"], {}), "('slice [-1:1:-1] failed %s' % 'abcde'[-1:1:-1])\n", (105, 153), False, 'import support\n')] |
#!/usr/bin/env python
#Created by <NAME>
#Meant to read from stdin a JSON blob from Jenkins master root
import json
import sys
response = json.load(sys.stdin)
jobs = map(lambda x: x['name'], response['jobs'])
views = map(lambda x: x['name'], response['views'])
assert '_jervis_generator' in jobs
assert 'GitHub Organizat... | [
"json.load"
] | [((138, 158), 'json.load', 'json.load', (['sys.stdin'], {}), '(sys.stdin)\n', (147, 158), False, 'import json\n')] |
from os.path import basename
import sys
import types
from docopt import docopt
from termcolor import colored
from c10_tools.allbus import main as allbus
from c10_tools.capture import main as capture
from c10_tools.copy import main as copy
from c10_tools.dump import main as dump
from c10_tools.find import main as fin... | [
"termcolor.colored",
"docopt.docopt",
"os.path.basename"
] | [((1258, 1285), 'termcolor.colored', 'colored', (['"""Usage:"""', '"""yellow"""'], {}), "('Usage:', 'yellow')\n", (1265, 1285), False, 'from termcolor import colored\n'), ((3217, 3247), 'termcolor.colored', 'colored', (['"""Commands:"""', '"""yellow"""'], {}), "('Commands:', 'yellow')\n", (3224, 3247), False, 'from ter... |
import time
from test_celery.tasks import download, list, fib_recursion
def do_download():
result = download.delay('https://www.python.org/static/community_logos/python-logo-master-v3-TM.png',
'python-logo.png')
return result
def do_list():
r = list.delay()
r.ready()
... | [
"test_celery.tasks.list.delay",
"test_celery.tasks.fib_recursion.delay",
"time.sleep",
"test_celery.tasks.download.delay"
] | [((106, 227), 'test_celery.tasks.download.delay', 'download.delay', (['"""https://www.python.org/static/community_logos/python-logo-master-v3-TM.png"""', '"""python-logo.png"""'], {}), "(\n 'https://www.python.org/static/community_logos/python-logo-master-v3-TM.png'\n , 'python-logo.png')\n", (120, 227), False, '... |
from send_to_kindle.downloader import get_article
from send_to_kindle.downloader.article_downloader import extract_content, load_template
import pytest
from pathlib import Path
from bs4 import BeautifulSoup
from unittest.mock import patch, MagicMock
import requests_mock
from send_to_kindle.downloader.content_extractor ... | [
"unittest.mock.MagicMock",
"requests_mock.mock",
"send_to_kindle.downloader.get_article",
"pytest.mark.parametrize",
"send_to_kindle.downloader.content_extractor.ContentExtractor",
"unittest.mock.patch",
"send_to_kindle.downloader.article_downloader.extract_content"
] | [((509, 806), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (["['input', 'expected', 'extractor']", "[('html/medium.html', 'html/medium-article.html', MediumExtractor), (\n 'html/medium_subtitled.html', 'html/medium_subtitled-article.html',\n MediumExtractor), ('html/devto.html', 'html/devto-article.html'... |
#----------------------------------------------------------------------
# This file was generated by C:\Python25\Lib\site-packages\wx-2.8-msw-unicode\wx\tools\img2py.py
#
from wx import Image, Bitmap, Icon
import cStringIO, zlib
def getData():
return zlib.decompress(
'x\xda\x01\xd4\x03+\xfc\x89PNG\r\n\x1a\n\x00\x... | [
"wx.Icon",
"zlib.decompress",
"wx.Image"
] | [((257, 2048), 'zlib.decompress', 'zlib.decompress', (['\'xÚ\\x01Ô\\x03+ü\\x89PNG\\r\\n\\x1a\\n\\x00\\x00\\x00\\rIHDR\\x00\\x00\\x00 \\x00\\x00\\x00 \\x08\\x06\\x00\\x00\\x00szzô\\x00\\x00\\x00\\x04sBIT\\x08\\x08\\x08\\x08|\\x08d\\x88\\x00\\x00\\x03\\x8bIDATX\\x85Å\\x97klSe\\x18Ç\\x7fï9íڵݨëì\\x9cdÉæ°&\\x18#Æ(Ѱ(\\n\\... |
#Simple driver to player as white against the engine
import play
import torch
import chess_model
import conversions
import chess
import sys
if (len(sys.argv) != 2):
print("Usage: %s <model path>" % sys.argv[0])
quit()
model_path = sys.argv[1]
model = chess_model.make_model()
model.load_state_dict(torch.load(model... | [
"play.alphabeta",
"torch.load",
"chess_model.make_model",
"chess.Board"
] | [((257, 281), 'chess_model.make_model', 'chess_model.make_model', ([], {}), '()\n', (279, 281), False, 'import chess_model\n'), ((337, 350), 'chess.Board', 'chess.Board', ([], {}), '()\n', (348, 350), False, 'import chess\n'), ((304, 326), 'torch.load', 'torch.load', (['model_path'], {}), '(model_path)\n', (314, 326), ... |
import threading
import requests
from bs4 import BeautifulSoup
import uuid, base64
import io
import xlsxwriter
from .tree import Tree
from .webpage_classifier import WebpageClassifier
from .steady_state_genetic import SteadyStateGenetic
from .general_regression_neural_network import GeneralRegressionNeuralNetwork
impor... | [
"threading.Thread",
"numpy.mean",
"xlsxwriter.Workbook",
"numpy.std"
] | [((2669, 2721), 'threading.Thread', 'threading.Thread', ([], {'target': 'site.save_file', 'daemon': '(True)'}), '(target=site.save_file, daemon=True)\n', (2685, 2721), False, 'import threading\n'), ((6164, 6216), 'threading.Thread', 'threading.Thread', ([], {'target': 'site.save_file', 'daemon': '(True)'}), '(target=si... |
# -*- coding: utf-8 -*-
"""Input utilities and constants for `openmx`."""
from os.path import splitext
import functools
import jsonschema
import numpy as np
_RESERVED_KEYWORDS = [
'SYSTEM_CURRRENTDIRECTORY',
'SYSTEM_NAME',
'DATA_PATH',
'LEVEL_OF_STDOUT',
'LEVEL_OF_FILEOUT',
'SPECIES_NUMBER',
... | [
"jsonschema.validators.extend",
"os.path.splitext",
"functools.partial",
"jsonschema.validators.validator_for"
] | [((2176, 2219), 'jsonschema.validators.validator_for', 'jsonschema.validators.validator_for', (['schema'], {}), '(schema)\n', (2211, 2219), False, 'import jsonschema\n'), ((2514, 2580), 'jsonschema.validators.extend', 'jsonschema.validators.extend', (['validator'], {'type_checker': 'type_checker'}), '(validator, type_c... |
# Importing the libraries
import pandas as pd
# Importing the Salary .csv data set
salaryDS = pd.read_csv('Dummy_Salary_Data.csv')
print (salaryDS)
exp = salaryDS.iloc[:, 0].values
salary = salaryDS.iloc[:, 1].values
print (exp)
print (salary)
# Importing the Titanic .csv data file
titanicDS = pd.read_csv('Dummy_T... | [
"pandas.read_csv",
"pandas.read_excel"
] | [((96, 132), 'pandas.read_csv', 'pd.read_csv', (['"""Dummy_Salary_Data.csv"""'], {}), "('Dummy_Salary_Data.csv')\n", (107, 132), True, 'import pandas as pd\n'), ((300, 337), 'pandas.read_csv', 'pd.read_csv', (['"""Dummy_Titanic_Data.csv"""'], {}), "('Dummy_Titanic_Data.csv')\n", (311, 337), True, 'import pandas as pd\n... |
#!/usr/bin/env python3
# Copyright (c) 2016 <NAME> <<EMAIL>>
#
# 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 the rights
# to use, copy, mo... | [
"telepot.Bot",
"urllib3.make_headers",
"time.sleep",
"urllib3.PoolManager",
"pprint.pprint"
] | [((2120, 2180), 'telepot.Bot', 'telepot.Bot', (['"""xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"""'], {}), "('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')\n", (2131, 2180), False, 'import telepot\n'), ((823, 834), 'pprint.pprint', 'pprint', (['msg'], {}), '(msg)\n', (829, 834), False, 'from pprint import pprint\n'... |
import os
from torch.utils.data import DataLoader
from cv2 import cv2
from geneva.data.datasets import DATASETS
from geneva.utils.config import keys, parse_config
from geneva.models.models import INFERENCE_MODELS
from geneva.data import codraw_dataset
from geneva.data import clevr_dataset
class Demonstration(object... | [
"os.path.exists",
"os.listdir",
"cv2.cv2.imread",
"os.path.join",
"os.mkdir",
"geneva.utils.config.parse_config",
"torch.utils.data.DataLoader"
] | [((2303, 2317), 'geneva.utils.config.parse_config', 'parse_config', ([], {}), '()\n', (2315, 2317), False, 'from geneva.utils.config import keys, parse_config\n'), ((919, 966), 'torch.utils.data.DataLoader', 'DataLoader', (['self.dataset'], {'batch_size': 'batch_size'}), '(self.dataset, batch_size=batch_size)\n', (929,... |
import cards.CardUtils as CardUtils
from players.Player import Player
import numpy as np
class PredictorPlayer(Player):
def __init__(self, actionPredictor, stateValuePredictor):
super().__init__()
self.actionPredictor = actionPredictor
self.stateValuePredictor = stateValuePredictor
de... | [
"numpy.sum"
] | [((967, 986), 'numpy.sum', 'np.sum', (['predictions'], {}), '(predictions)\n', (973, 986), True, 'import numpy as np\n')] |
import sys
def isort(arr):
arr_len = len(arr)
count = 0
for i in range(arr_len):
for j in range(i,0,-1):
if arr[j] > arr[j-1]:
break
else:
arr[j-1],arr[j] = arr[j],arr[j-1]
count = count + 1
return count
def __partition__... | [
"sys.stdin.readline"
] | [((834, 854), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (852, 854), False, 'import sys\n'), ((877, 897), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (895, 897), False, 'import sys\n')] |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/items.html
from scrapy import Field, Item
class CisSpidersItem(Item):
# define the fields for your item here like:
# name = Field()
idx = Field()
spider_name = Fiel... | [
"scrapy.Field"
] | [((293, 300), 'scrapy.Field', 'Field', ([], {}), '()\n', (298, 300), False, 'from scrapy import Field, Item\n'), ((316, 323), 'scrapy.Field', 'Field', ([], {}), '()\n', (321, 323), False, 'from scrapy import Field, Item\n'), ((339, 346), 'scrapy.Field', 'Field', ([], {}), '()\n', (344, 346), False, 'from scrapy import ... |
import torch
import numpy as np
from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, build_assigner,
build_sampler, merge_aug_bboxes, merge_aug_masks,
multiclass_nms)
from mmdet.core.bbox import bbox_mapping_back
from .cascade_roi_head import CascadeRoIHead
from ... | [
"mmdet.core.bbox_mapping",
"torch.stack",
"mmdet.core.bbox2roi",
"mmdet.core.bbox.bbox_mapping_back",
"mmdet.core.bbox2result",
"mmdet.core.multiclass_nms",
"numpy.argwhere"
] | [((3207, 3270), 'mmdet.core.bbox2result', 'bbox2result', (['_det_bboxes', 'det_labels', 'self.test_cfg.num_classes'], {}), '(_det_bboxes, det_labels, self.test_cfg.num_classes)\n', (3218, 3270), False, 'from mmdet.core import bbox2result, bbox2roi, bbox_mapping, build_assigner, build_sampler, merge_aug_bboxes, merge_au... |
from django.db import models
# Create your models here.
import mongoengine
class DeviceInfo(mongoengine.Document):
dev_id = mongoengine.SequenceField()
dev_name = mongoengine.StringField(required=True)
dev_desc = mongoengine.StringField()
dev_paras = mongoengine.ListField()
class ParameterInfo(mong... | [
"mongoengine.ListField",
"mongoengine.StringField",
"mongoengine.SequenceField"
] | [((131, 158), 'mongoengine.SequenceField', 'mongoengine.SequenceField', ([], {}), '()\n', (156, 158), False, 'import mongoengine\n'), ((174, 212), 'mongoengine.StringField', 'mongoengine.StringField', ([], {'required': '(True)'}), '(required=True)\n', (197, 212), False, 'import mongoengine\n'), ((228, 253), 'mongoengin... |
import setuptools
with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setuptools.setup(
name="git-analytics",
version="0.0.2",
author="n0rfas",
author_email="<EMAIL>",
description="The detailed analysis tool for git repositories.",
long_description=long_descri... | [
"setuptools.find_packages"
] | [((840, 877), 'setuptools.find_packages', 'setuptools.find_packages', ([], {'where': '"""src"""'}), "(where='src')\n", (864, 877), False, 'import setuptools\n')] |
# --------------
import yaml
# Read the data of the format .yaml type
with open(path) as f:
data = yaml.load(f)
# Find data type of the file
print(type(data))
# In which city, and at which venue the match was played and where was it played ?
print(data['info']['city'])
print(data['info']['venue'])
# Which are all ... | [
"yaml.load"
] | [((104, 116), 'yaml.load', 'yaml.load', (['f'], {}), '(f)\n', (113, 116), False, 'import yaml\n')] |
from django.conf.urls import url
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="West Oakland Air Quality API",
default_version="v1",
description=(
"West Oakland Air Quality (WOAQ) is a project of OpenOa... | [
"drf_yasg.openapi.License",
"drf_yasg.openapi.Contact"
] | [((747, 779), 'drf_yasg.openapi.Contact', 'openapi.Contact', ([], {'email': '"""<EMAIL>"""'}), "(email='<EMAIL>')\n", (762, 779), False, 'from drf_yasg import openapi\n'), ((797, 893), 'drf_yasg.openapi.License', 'openapi.License', ([], {'name': '"""MIT"""', 'url': '"""https://github.com/openoakland/woeip/blob/master/L... |
from django.contrib.auth.models import Permission
from django.core.management.base import BaseCommand, CommandError
class Command(BaseCommand):
help = "Create admin permissions"
def handle(self, *args, **options):
if args:
raise CommandError("Command doesn't accept any arguments")
... | [
"django.contrib.auth.models.Permission.objects.get_or_create",
"bananas.admin.site._registry.items",
"django.core.management.base.CommandError",
"django.contrib.admin.autodiscover"
] | [((574, 601), 'django.contrib.admin.autodiscover', 'django_admin.autodiscover', ([], {}), '()\n', (599, 601), True, 'from django.contrib import admin as django_admin\n'), ((627, 655), 'bananas.admin.site._registry.items', 'admin.site._registry.items', ([], {}), '()\n', (653, 655), False, 'from bananas import admin\n'),... |
import os
import datetime
import torch
def run(parser, dev):
args = parser.parse_args()
## Set gpu ids
str_ids = args.gpu_ids.split(',')
args.gpu_ids = []
for str_id in str_ids:
gpu_id = int(str_id)
if gpu_id >= 0:
args.gpu_ids.append(gpu_id)
if len(args.gpu_ids) > ... | [
"os.makedirs",
"os.path.join",
"datetime.datetime.now",
"torch.cuda.set_device",
"torch.device"
] | [((331, 369), 'torch.cuda.set_device', 'torch.cuda.set_device', (['args.gpu_ids[0]'], {}), '(args.gpu_ids[0])\n', (352, 369), False, 'import torch\n'), ((475, 494), 'torch.device', 'torch.device', (['"""cpu"""'], {}), "('cpu')\n", (487, 494), False, 'import torch\n'), ((1457, 1502), 'os.path.join', 'os.path.join', (['a... |
from django.conf.urls import url
from . import views
from .views import SearchResultsListView,SearchLocationListView
from django.conf import settings
from django.conf.urls.static import static
urlpatterns=[
url(r'^$',views.home,name='home'),
url(r'search/', SearchResultsListView.as_view(), name='search_results... | [
"django.conf.urls.static.static",
"django.conf.urls.url"
] | [((212, 246), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.home'], {'name': '"""home"""'}), "('^$', views.home, name='home')\n", (215, 246), False, 'from django.conf.urls import url\n'), ((443, 506), 'django.conf.urls.static.static', 'static', (['settings.STATIC_URL'], {'document_root': 'settings.STATIC_ROOT'}),... |
import logging
import logging.config
from flask import Flask
from flask.ext.uwsgi_websocket import GeventWebSocket
from .config import load_config, load_absinthe_config
from .commands import CommandServer
config = load_config()
logging.config.dictConfig(config['logger'])
logger = logging.getLogger(__name__)
absinth... | [
"logging.getLogger",
"logging.config.dictConfig",
"flask.ext.uwsgi_websocket.GeventWebSocket",
"flask.Flask"
] | [((230, 273), 'logging.config.dictConfig', 'logging.config.dictConfig', (["config['logger']"], {}), "(config['logger'])\n", (255, 273), False, 'import logging\n'), ((284, 311), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (301, 311), False, 'import logging\n'), ((361, 376), 'flask.Flask... |
import discord
from discord.ext import commands
from loguru import logger
from mainDiscord import embedCreator, yiskiConf
class TokenDiscord(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def token(self, ctx):
tokenJoke = discord.File(yiskiConf["i... | [
"mainDiscord.embedCreator",
"discord.File",
"discord.ext.commands.command",
"loguru.logger.debug"
] | [((224, 242), 'discord.ext.commands.command', 'commands.command', ([], {}), '()\n', (240, 242), False, 'from discord.ext import commands\n'), ((610, 643), 'loguru.logger.debug', 'logger.debug', (['"""Token Cog loaded."""'], {}), "('Token Cog loaded.')\n", (622, 643), False, 'from loguru import logger\n'), ((295, 347), ... |
import sys
import numpy as np
from mpi4py import MPI
comm = MPI.COMM_WORLD
name = MPI.Get_processor_name()
print("Hello world from processor {}, rank {} out of {} processors"\
.format(name, comm.rank, comm.size))
print("Now I will take up memory and waste computing power for demonstration purposes")
sys.stdout.fl... | [
"sys.stdout.flush",
"mpi4py.MPI.Get_processor_name",
"numpy.zeros"
] | [((84, 108), 'mpi4py.MPI.Get_processor_name', 'MPI.Get_processor_name', ([], {}), '()\n', (106, 108), False, 'from mpi4py import MPI\n'), ((307, 325), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (323, 325), False, 'import sys\n'), ((334, 359), 'numpy.zeros', 'np.zeros', (['(500, 500, 500)'], {}), '((500, ... |
# Copyright 2016 Amazon.com, Inc. or its affiliates.
# 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.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file ac... | [
"troposphere.Template",
"troposphere.Sub",
"re.match",
"datetime.datetime.utcnow"
] | [((3401, 3428), 're.match', 're.match', (['"""^\\\\d+$"""', 'account'], {}), "('^\\\\d+$', account)\n", (3409, 3428), False, 'import re\n'), ((1904, 1914), 'troposphere.Template', 'Template', ([], {}), '()\n', (1912, 1914), False, 'from troposphere import Template, Output, Export, Sub\n'), ((988, 1014), 'datetime.datet... |
from django.shortcuts import redirect
def logout(request):
request.session.flush()
return redirect("login")
| [
"django.shortcuts.redirect"
] | [((100, 117), 'django.shortcuts.redirect', 'redirect', (['"""login"""'], {}), "('login')\n", (108, 117), False, 'from django.shortcuts import redirect\n')] |
import cv2
import numpy as np
import os
def noisy(noise_typ,image):
if noise_typ == "gauss":
row,col,ch= image.shape
mean = 0
var = 0.1
sigma = var**0.5
gauss = np.random.normal(mean,sigma,(row,col,ch))
gauss = gauss.reshape(row,col,ch)
noisy = image + gauss
return n... | [
"cv2.normalize",
"cv2.imshow",
"os.path.exists",
"os.listdir",
"numpy.random.poisson",
"os.mkdir",
"numpy.random.normal",
"cv2.merge",
"cv2.warpAffine",
"numpy.ceil",
"cv2.cvtColor",
"cv2.split",
"numpy.log2",
"cv2.GaussianBlur",
"numpy.random.randn",
"cv2.imread",
"numpy.copy",
"c... | [((1415, 1436), 'os.listdir', 'os.listdir', (['path_from'], {}), '(path_from)\n', (1425, 1436), False, 'import os\n'), ((1530, 1555), 'os.listdir', 'os.listdir', (['(path_from + i)'], {}), '(path_from + i)\n', (1540, 1555), False, 'import os\n'), ((196, 241), 'numpy.random.normal', 'np.random.normal', (['mean', 'sigma'... |
# Copyright 2021 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 or agreed to in writing, ... | [
"airflow.contrib.operators.gcs_to_gcs.GoogleCloudStorageToGoogleCloudStorageOperator",
"airflow.operators.bash_operator.BashOperator",
"airflow.contrib.operators.gcs_to_bq.GoogleCloudStorageToBigQueryOperator",
"airflow.DAG",
"airflow.contrib.operators.gcs_delete_operator.GoogleCloudStorageDeleteOperator"
] | [((838, 1004), 'airflow.DAG', 'DAG', ([], {'dag_id': '"""covid19_tracking.state_screenshots"""', 'default_args': 'default_args', 'max_active_runs': '(1)', 'schedule_interval': '"""@once"""', 'catchup': '(False)', 'default_view': '"""graph"""'}), "(dag_id='covid19_tracking.state_screenshots', default_args=default_args,\... |
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 4 12:22:44 2017
@author: a.sancho.asensio
"""
import argparse
import base64
import json
import re, sys
import os
import glob
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import cv2
import math
import pandas as pd
... | [
"numpy.mean",
"numpy.roll",
"argparse.ArgumentParser",
"flask.Flask",
"socketio.Server",
"numpy.asarray",
"socketio.Middleware",
"eventlet.listen",
"base64.b64decode",
"numpy.zeros",
"numpy.random.seed",
"cv2.resize",
"tensorflow.set_random_seed"
] | [((1637, 1666), 'numpy.zeros', 'np.zeros', (['(10)'], {'dtype': '"""float32"""'}), "(10, dtype='float32')\n", (1645, 1666), True, 'import numpy as np\n'), ((1726, 1743), 'socketio.Server', 'socketio.Server', ([], {}), '()\n', (1741, 1743), False, 'import socketio\n'), ((1751, 1766), 'flask.Flask', 'Flask', (['__name__'... |
"""
Core views
"""
from celery.app import shared_task
from drf_spectacular.utils import extend_schema
from rest_framework import mixins, generics, status
from rest_framework.response import Response
from .serializers import (
JobSerializer,
KeywordSearchSerializer,
URLSearchSerializer,
TagSearchSeriali... | [
"drf_spectacular.utils.extend_schema",
"rest_framework.response.Response"
] | [((1351, 1398), 'drf_spectacular.utils.extend_schema', 'extend_schema', ([], {'responses': '{(201): JobSerializer}'}), '(responses={(201): JobSerializer})\n', (1364, 1398), False, 'from drf_spectacular.utils import extend_schema\n'), ((2251, 2312), 'rest_framework.response.Response', 'Response', (['job_serializer.data'... |
# Script to set up (and back up) the links set up in an early version of the site.
from app import db
from app.models import Link
ops_resources = [
Link(title="Roster", url='/roster', category='ops_resources', order=1,
cac_required=False, login_required=True, gov_only=False),
Link(title="OGV ICE home... | [
"app.db.session.commit",
"app.db.session.add",
"app.models.Link"
] | [((154, 285), 'app.models.Link', 'Link', ([], {'title': '"""Roster"""', 'url': '"""/roster"""', 'category': '"""ops_resources"""', 'order': '(1)', 'cac_required': '(False)', 'login_required': '(True)', 'gov_only': '(False)'}), "(title='Roster', url='/roster', category='ops_resources', order=1,\n cac_required=False, ... |
from contextlib import closing
import psycopg
class PostgreSQLConnectionChecker:
def __init__(self, **kwargs):
self.host = kwargs.get('host')
self.port = kwargs.get('port')
self.user = kwargs.get('user')
self.password = kwargs.get('password')
self.database = kwargs.get('dat... | [
"psycopg.connect",
"contextlib.closing"
] | [((387, 535), 'psycopg.connect', 'psycopg.connect', (['f"""host={self.host} port={self.port} dbname={self.database} user={self.user} password={self.password}"""'], {'connect_timeout': '(10)'}), "(\n f'host={self.host} port={self.port} dbname={self.database} user={self.user} password={self.password}'\n , connect_t... |
import networkx as nx
import pathFind as pf
import nested_dict as nd
import random as rn
from queue import PriorityQueue
from math import inf
import utils as ut
import modification as md
max = inf
CBR = ut.getBlockHeight()
LND_RISK_FACTOR = 0.000000015
C_RISK_FACTOR = 10
RISK_BIAS = 1
DEFAULT_FUZZ = 0.05
MIN_DELAY = 9... | [
"modification.is_not_possible_mod",
"pathFind.c_cost_fun",
"pathFind.Dijkstra_general",
"nested_dict.nested_dict",
"utils.getBlockHeight",
"pathFind.Dijkstra",
"queue.PriorityQueue",
"pathFind.eclair_cost_fun",
"pathFind.lnd_cost_fun"
] | [((204, 223), 'utils.getBlockHeight', 'ut.getBlockHeight', ([], {}), '()\n', (221, 223), True, 'import utils as ut\n'), ((1286, 1302), 'nested_dict.nested_dict', 'nd.nested_dict', ([], {}), '()\n', (1300, 1302), True, 'import nested_dict as nd\n'), ((1336, 1352), 'nested_dict.nested_dict', 'nd.nested_dict', ([], {}), '... |
# -*- coding: utf-8 -*-
# Spider for 91 buddha
#
# See documentation in:
# https://doc.scrapy.org/en/latest/topics/spiders.html
import scrapy
import logging
import random
from buddha_item import BuddhaItem
from utils.data_store import DataStore
import math
import time
date_string = time.strftime("%Y_%m_%d", time.l... | [
"logging.basicConfig",
"logging.getLogger",
"utils.data_store.DataStore",
"buddha_item.BuddhaItem",
"scrapy.Request",
"time.localtime",
"random.randint"
] | [((332, 431), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': "('buddha_%s.log' % date_string)", 'level': 'logging.DEBUG', 'filemode': '"""w"""'}), "(filename='buddha_%s.log' % date_string, level=logging.\n DEBUG, filemode='w')\n", (351, 431), False, 'import logging\n'), ((449, 476), 'logging.getLogg... |
from __future__ import unicode_literals
from __future__ import print_function
import time
import unittest
import numpy as np
from hartigan_diptest import dip
class testModality(unittest.TestCase):
def setUp(self):
self.data = np.random.randn(1000)
def test_hartigan_diptest(self):
t0 = time... | [
"unittest.main",
"hartigan_diptest.dip",
"numpy.random.randn",
"time.time"
] | [((462, 477), 'unittest.main', 'unittest.main', ([], {}), '()\n', (475, 477), False, 'import unittest\n'), ((243, 264), 'numpy.random.randn', 'np.random.randn', (['(1000)'], {}), '(1000)\n', (258, 264), True, 'import numpy as np\n'), ((316, 327), 'time.time', 'time.time', ([], {}), '()\n', (325, 327), False, 'import ti... |
import dash_vtk
import dash
from dash.dependencies import Input, Output
import dash_html_components as html
app = dash.Dash(__name__)
server = app.server
app.layout = html.Div(
style={"width": "100%", "height": "calc(100vh - 16px)"},
children=[
dash_vtk.View(
id="view",
childre... | [
"dash_vtk.Reader",
"dash_vtk.DataArray",
"dash_vtk.Algorithm",
"dash.Dash",
"dash_html_components.Div"
] | [((115, 134), 'dash.Dash', 'dash.Dash', (['__name__'], {}), '(__name__)\n', (124, 134), False, 'import dash\n'), ((2641, 2662), 'dash_html_components.Div', 'html.Div', ([], {'id': '"""output"""'}), "(id='output')\n", (2649, 2662), True, 'import dash_html_components as html\n'), ((419, 511), 'dash_vtk.Algorithm', 'dash_... |
from django.contrib.auth.validators import UnicodeUsernameValidator
from rest_framework import serializers, status
from .models import *
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('username', 'email', 'password')
extra_kwargs = {
'user... | [
"rest_framework.serializers.ValidationError",
"rest_framework.serializers.CharField",
"django.contrib.auth.validators.UnicodeUsernameValidator"
] | [((2379, 2451), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'style': "{'input_type': 'password'}", 'write_only': '(True)'}), "(style={'input_type': 'password'}, write_only=True)\n", (2400, 2451), False, 'from rest_framework import serializers, status\n'), ((1474, 1561), 'rest_framework.serial... |
from setuptools import setup
from torch.utils.cpp_extension import BuildExtension, CppExtension
setup(
name='BinActivateFunc_cpp',
ext_modules=[
CppExtension('BinActivateFunc_cpp', ['BinActivateFunc.cpp']),
],
cmdclass={
'build_ext': BuildExtension
})
| [
"torch.utils.cpp_extension.CppExtension"
] | [((162, 222), 'torch.utils.cpp_extension.CppExtension', 'CppExtension', (['"""BinActivateFunc_cpp"""', "['BinActivateFunc.cpp']"], {}), "('BinActivateFunc_cpp', ['BinActivateFunc.cpp'])\n", (174, 222), False, 'from torch.utils.cpp_extension import BuildExtension, CppExtension\n')] |
""" test models """
import pytest
from django.utils.timezone import localtime
from zoo_checks.models import Animal, AnimalCount, Enclosure, Group, GroupCount, Species
def test_animal_instance(animal_A):
assert isinstance(animal_A, Animal)
assert animal_A.name == "A_name"
def test_animal_count_instance(ani... | [
"django.utils.timezone.localtime",
"zoo_checks.models.Enclosure.all_counts"
] | [((2618, 2648), 'zoo_checks.models.Enclosure.all_counts', 'Enclosure.all_counts', (['enc_list'], {}), '(enc_list)\n', (2638, 2648), False, 'from zoo_checks.models import Animal, AnimalCount, Enclosure, Group, GroupCount, Species\n'), ((486, 497), 'django.utils.timezone.localtime', 'localtime', ([], {}), '()\n', (495, 4... |
import cv2
import sys
import numpy as np
#rectangle in Python is a tuple of (x,y,w,h)
#for rectangle
def union(a, b):
x = min(a[0], b[0])
y = min(a[1], b[1])
w = max(a[0]+a[2], b[0]+b[2]) - x
h = max(a[1]+a[3], b[1]+b[3]) - y
return (x, y, w, h)
#for rectangle
def intersection(a, b):
x = max(a... | [
"cv2.rectangle",
"cv2.imwrite",
"numpy.delete",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.MSER_create",
"cv2.resize",
"cv2.imread"
] | [((1986, 2028), 'cv2.MSER_create', 'cv2.MSER_create', ([], {'_delta': '(10)', '_min_area': '(1000)'}), '(_delta=10, _min_area=1000)\n', (2001, 2028), False, 'import cv2\n'), ((2037, 2060), 'cv2.imread', 'cv2.imread', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (2047, 2060), False, 'import cv2\n'), ((2068, 2105), 'cv2.cvt... |
import math
n, m = [int(x) for x in input().split(' ')]
arr = [
[j * m + i + 1 for i in range(m)] for j in range(n)
]
s = set(x + 1 for x in range(n * m))
for _ in range(int(math.log2(n * m))):
print(arr)
if m > n:
for j in range(n):
for i in range(m // 2):
arr[j][i] += arr[j][m-i-1]
... | [
"math.log2"
] | [((179, 195), 'math.log2', 'math.log2', (['(n * m)'], {}), '(n * m)\n', (188, 195), False, 'import math\n')] |
# Presupunem ca in acelasi folder cu script-ul avem directoarele test/ si train/ si fisierele .scv
import os
import pandas as pd
folder = 'train/'
#filenames = glob.glob(folder + '*.jpg')
#nrFiles = len(filenames)
df = pd.read_csv('train.csv',delimiter=',')
nrLines = df.shape[0]
print('Grouping', nrLines, 'files')
fo... | [
"os.makedirs",
"os.path.exists",
"os.rename",
"pandas.read_csv"
] | [((221, 260), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {'delimiter': '""","""'}), "('train.csv', delimiter=',')\n", (232, 260), True, 'import pandas as pd\n'), ((1019, 1042), 'os.path.exists', 'os.path.exists', (['current'], {}), '(current)\n', (1033, 1042), False, 'import os\n'), ((586, 616), 'os.path.e... |
"""
/llrws/__init__.py
Concerns all things LLR Web Suite.
"""
from flask import Flask
from flask_cors import CORS
from flask_restful import Api
from llrws.config import Config
from llrws.api.routes import initialize_routes
application = Flask(__name__)
def create_app(config_class=Config):
"""Creates Flask app... | [
"llrws.api.routes.initialize_routes",
"flask_restful.Api",
"flask_cors.CORS",
"flask.Flask"
] | [((241, 256), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (246, 256), False, 'from flask import Flask\n'), ((395, 412), 'flask_cors.CORS', 'CORS', (['application'], {}), '(application)\n', (399, 412), False, 'from flask_cors import CORS\n'), ((662, 673), 'flask_restful.Api', 'Api', (['api_bp'], {}), '(a... |
import tensorflow as tf
import datetime
import numpy as np
import zutils.tf_math_funcs as tmf
from zutils.py_utils import *
from scipy.io import savemat
class OneEpochRunner:
def __init__(
self, data_module, output_list=None,
net_func=None, batch_axis=0, num_samples=None, disp_time_interv... | [
"numpy.concatenate",
"datetime.datetime.now",
"scipy.io.savemat",
"zutils.tf_math_funcs.is_tf_data"
] | [((4642, 4686), 'scipy.io.savemat', 'savemat', (["(self.output_fn + '.mat')", 'output_val'], {}), "(self.output_fn + '.mat', output_val)\n", (4649, 4686), False, 'from scipy.io import savemat\n'), ((4118, 4204), 'scipy.io.savemat', 'savemat', (["(self.output_fn + '_' + '%06d' % num_samples_finished + '.mat')", 'output_... |
from flask_wtf import FlaskForm
from wtforms import StringField, SelectField, IntegerField, SubmitField, PasswordField
from wtforms.validators import DataRequired, EqualTo, InputRequired, Length
from wtforms.widgets import TextArea
class DataForm(FlaskForm):
type = SelectField(label='Type',
... | [
"wtforms.widgets.TextArea",
"wtforms.validators.InputRequired",
"wtforms.SubmitField",
"wtforms.validators.EqualTo",
"wtforms.validators.Length",
"wtforms.validators.DataRequired"
] | [((976, 997), 'wtforms.SubmitField', 'SubmitField', (['"""Submit"""'], {}), "('Submit')\n", (987, 997), False, 'from wtforms import StringField, SelectField, IntegerField, SubmitField, PasswordField\n'), ((1774, 1795), 'wtforms.SubmitField', 'SubmitField', (['"""Submit"""'], {}), "('Submit')\n", (1785, 1795), False, 'f... |
from .choices import valid_extensions
def validate_file_extension(value):
import os
from django.core.exceptions import ValidationError
ext = os.path.splitext(value.name)[1] # [0] returns path+filename
extensions = valid_extensions
if not ext.lower() in extensions:
raise ValidationError('U... | [
"os.path.splitext",
"django.core.exceptions.ValidationError"
] | [((155, 183), 'os.path.splitext', 'os.path.splitext', (['value.name'], {}), '(value.name)\n', (171, 183), False, 'import os\n'), ((302, 348), 'django.core.exceptions.ValidationError', 'ValidationError', (['"""Unsupported file extension."""'], {}), "('Unsupported file extension.')\n", (317, 348), False, 'from django.cor... |
#!/user/bin/env python
'''columnarStructureX.py
Inheritance class of ColumnarStructure
'''
__author__ = "<NAME>) Huang"
__maintainer__ = "Mars (Shih-Cheng) Huang"
__email__ = "<EMAIL>"
__version__ = "0.2.0"
__status__ = "Done"
import numpy as np
import sys
from mmtfPyspark.utils import ColumnarStructure
from sympy i... | [
"numpy.array",
"mmtfPyspark.utils.ColumnarStructure.__init__"
] | [((696, 755), 'mmtfPyspark.utils.ColumnarStructure.__init__', 'ColumnarStructure.__init__', (['self', 'structure', 'firstModelOnly'], {}), '(self, structure, firstModelOnly)\n', (722, 755), False, 'from mmtfPyspark.utils import ColumnarStructure\n'), ((3669, 3697), 'numpy.array', 'np.array', (['calpha_coords_list'], {}... |
# Generated by Django 3.1.2 on 2021-01-14 18:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('core', '0003_auto_20210114_1150'),
]
operations = [
migrations.AddField(
model_name='produto',
... | [
"django.db.models.ForeignKey"
] | [((368, 463), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""core.status"""'}), "(null=True, on_delete=django.db.models.deletion.CASCADE,\n to='core.status')\n", (385, 463), False, 'from django.db import migrations, models\n')] |
import pytest
from django.test import Client, RequestFactory
from striper.payments.models import Order
from striper.payments.views import OrderList
from striper.payments.tests.factories import ItemFactory
pytestmark = pytest.mark.django_db
STATUS_OK = 200
STATUS_REDIRECTED = 302
def test_index(rf: RequestFactory)... | [
"striper.payments.models.Order.objects.create",
"striper.payments.models.Order.objects.last",
"striper.payments.views.OrderList.as_view",
"striper.payments.models.Order.objects.count",
"striper.payments.tests.factories.ItemFactory"
] | [((390, 412), 'striper.payments.models.Order.objects.create', 'Order.objects.create', ([], {}), '()\n', (410, 412), False, 'from striper.payments.models import Order\n'), ((653, 675), 'striper.payments.models.Order.objects.create', 'Order.objects.create', ([], {}), '()\n', (673, 675), False, 'from striper.payments.mode... |
''' flask web_service with mongo '''
import os
import json
import datetime
from bson.objectid import ObjectId
from flask import Flask
from flask_pymongo import PyMongo
import connexion
from connexion import NoContent
from flask_jwt_extended import JWTManager
from flask_bcrypt import Bcrypt
from flask_cors import CORS
... | [
"connexion.App",
"datetime.timedelta",
"json.JSONEncoder.default",
"flask_cors.CORS"
] | [((612, 635), 'connexion.App', 'connexion.App', (['__name__'], {}), '(__name__)\n', (625, 635), False, 'import connexion\n'), ((671, 684), 'flask_cors.CORS', 'CORS', (['app.app'], {}), '(app.app)\n', (675, 684), False, 'from flask_cors import CORS\n'), ((926, 952), 'datetime.timedelta', 'datetime.timedelta', ([], {'day... |
from simple_zpl2 import ZPLDocument
def add_to_zdoc(upc):
zdoc = ZPLDocument()
zdoc.add_barcode(upc)
return zdoc
| [
"simple_zpl2.ZPLDocument"
] | [((71, 84), 'simple_zpl2.ZPLDocument', 'ZPLDocument', ([], {}), '()\n', (82, 84), False, 'from simple_zpl2 import ZPLDocument\n')] |
from django.contrib import admin
from seller.models import Seller
# Register your models here.
admin.site.register(Seller)
| [
"django.contrib.admin.site.register"
] | [((96, 123), 'django.contrib.admin.site.register', 'admin.site.register', (['Seller'], {}), '(Seller)\n', (115, 123), False, 'from django.contrib import admin\n')] |
import unittest, sys, os, io, copy
import numpy as np
import cctk
if __name__ == '__main__':
unittest.main()
class TestOrca(unittest.TestCase):
def test_write(self):
read_path = "test/static/test_peptide.xyz"
path = "test/static/test_peptide.inp"
new_path = "test/static/test_peptide_co... | [
"cctk.XYZFile.read_file",
"os.remove",
"unittest.main",
"cctk.OrcaFile.read_file",
"cctk.OrcaFile",
"cctk.ConformationalEnsemble"
] | [((98, 113), 'unittest.main', 'unittest.main', ([], {}), '()\n', (111, 113), False, 'import unittest, sys, os, io, copy\n'), ((344, 377), 'cctk.XYZFile.read_file', 'cctk.XYZFile.read_file', (['read_path'], {}), '(read_path)\n', (366, 377), False, 'import cctk\n'), ((945, 964), 'os.remove', 'os.remove', (['new_path'], {... |
from setuptools import setup
import os.path
import sys
setup(
name="ev3devlogging",
version="1.0.1",
description="easy logging library for ev3dev",
long_description="""
easy logging library for ev3dev
For more info: https://github.com/ev3dev-python-tools/ev3devlogging
""",
url="https://... | [
"setuptools.setup"
] | [((57, 1429), 'setuptools.setup', 'setup', ([], {'name': '"""ev3devlogging"""', 'version': '"""1.0.1"""', 'description': '"""easy logging library for ev3dev"""', 'long_description': '"""\neasy logging library for ev3dev\n\nFor more info: https://github.com/ev3dev-python-tools/ev3devlogging\n"""', 'url': '"""https://git... |
# Metafier V3: writes directly to output.mc
# Avoids memory errors for large programs
# Assumes the pattern width is less than or equal to 1024
# ===REQUIRES metatemplate11.mc===
import golly as g
import numpy as np
from shutil import copyfile
g.show("Retrieving selection...")
#Get the selection
selection = g.getselr... | [
"golly.getcells",
"numpy.reshape",
"golly.getselrect",
"golly.exit",
"golly.show",
"golly.addlayer",
"golly.open",
"numpy.zeros",
"shutil.copyfile",
"numpy.log2"
] | [((246, 279), 'golly.show', 'g.show', (['"""Retrieving selection..."""'], {}), "('Retrieving selection...')\n", (252, 279), True, 'import golly as g\n'), ((311, 325), 'golly.getselrect', 'g.getselrect', ([], {}), '()\n', (323, 325), True, 'import golly as g\n'), ((625, 646), 'golly.getcells', 'g.getcells', (['selection... |
from typing import List, Optional
from uuid import UUID
from celery import Celery
from fastapi import BackgroundTasks, Depends
from loguru import logger
from sqlmodel.ext.asyncio.session import AsyncSession
from joj.horse import models, schemas
from joj.horse.schemas import Empty, StandardListResponse, StandardRespon... | [
"joj.horse.utils.router.MyRouter",
"joj.horse.utils.parser.parse_ordering_query",
"loguru.logger.exception",
"loguru.logger.info",
"joj.horse.models.Record.submit",
"joj.horse.utils.parser.parse_problem_without_validation",
"joj.horse.schemas.StandardListResponse",
"joj.horse.models.Record.get_user_la... | [((915, 925), 'joj.horse.utils.router.MyRouter', 'MyRouter', ([], {}), '()\n', (923, 925), False, 'from joj.horse.utils.router import MyRouter\n'), ((1133, 1164), 'fastapi.Depends', 'Depends', (['parse_domain_from_auth'], {}), '(parse_domain_from_auth)\n', (1140, 1164), False, 'from fastapi import BackgroundTasks, Depe... |
import torch
import torch.nn as nn
from utils.helper import get_lr, evaluate
from utils import constants
from pytorchtools import EarlyStopping
def fit_one_cycle(epochs, max_lr, model, train_loader, val_loader, weight_decay=0, grad_clip=None, opt_func=torch.optim.SGD):
torch.cuda.empty_cache()
history = []
... | [
"utils.helper.evaluate",
"utils.helper.get_lr",
"torch.stack",
"torch.cuda.empty_cache"
] | [((277, 301), 'torch.cuda.empty_cache', 'torch.cuda.empty_cache', ([], {}), '()\n', (299, 301), False, 'import torch\n'), ((1380, 1407), 'utils.helper.evaluate', 'evaluate', (['model', 'val_loader'], {}), '(model, val_loader)\n', (1388, 1407), False, 'from utils.helper import get_lr, evaluate\n'), ((1287, 1304), 'utils... |
from optparse import make_option
import pprint
import requests
from django.core.management.base import BaseCommand
from market.models import Price, PriceCurrency
domains = {
'prod': 'https://marketplace.firefox.com',
'stage': 'https://marketplace.allizom.org',
'dev': 'https://marketplace-dev.allizom.or... | [
"market.models.PriceCurrency.objects.all",
"market.models.Price.objects.all",
"requests.get",
"optparse.make_option",
"pprint.pprint"
] | [((559, 706), 'optparse.make_option', 'make_option', (['"""--prod"""'], {'action': '"""store_const"""', 'const': "domains['prod']", 'dest': '"""domain"""', 'default': "domains['prod']", 'help': '"""Use prod as source of data."""'}), "('--prod', action='store_const', const=domains['prod'], dest=\n 'domain', default=d... |
# -*- coding: utf-8 -*-
"""
python setup.py sdist upload -r pypi
"""
from setuptools import setup, find_packages
from stallions import __version__
VERSION = __version__
readability_lxml = "readability-lxml"
setup(
name='stallions',
version=VERSION,
description='Extract the content of the web page.',
... | [
"setuptools.find_packages"
] | [((698, 713), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (711, 713), False, 'from setuptools import setup, find_packages\n')] |
import os
import onedrivesdk
from onedrivesdk.helpers import GetAuthCodeServer
redirect_uri = 'http://localhost:8080/'
client_secret = '<KEY>'
client_id='00000000401CDF7B'
api_base_url='https://api.onedrive.com/v2.0/'
scopes=['wl.signin', 'wl.offline_access', 'onedrive.readwrite']
client = onedrivesdk.get_default_cli... | [
"onedrivesdk.get_default_client",
"onedrivesdk.helpers.GetAuthCodeServer.get_auth_code"
] | [((293, 359), 'onedrivesdk.get_default_client', 'onedrivesdk.get_default_client', ([], {'client_id': 'client_id', 'scopes': 'scopes'}), '(client_id=client_id, scopes=scopes)\n', (323, 359), False, 'import onedrivesdk\n'), ((473, 528), 'onedrivesdk.helpers.GetAuthCodeServer.get_auth_code', 'GetAuthCodeServer.get_auth_co... |