code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
"""
Notifications
-------------
Example showing how to add notifications to a characteristic and handle the responses.
Updated on 2019-07-03 by hbldh <<EMAIL>>
"""
import sys
import logging
import asyncio
import platform
from bleak import BleakClient
from bleak import _logger as logger
CH... | [
"logging.getLogger",
"logging.StreamHandler",
"asyncio.sleep",
"platform.system",
"bleak._logger.info",
"bleak.BleakClient",
"asyncio.get_event_loop",
"bleak._logger.addHandler"
] | [((1619, 1643), 'asyncio.get_event_loop', 'asyncio.get_event_loop', ([], {}), '()\n', (1641, 1643), False, 'import asyncio\n'), ((577, 594), 'platform.system', 'platform.system', ([], {}), '()\n', (592, 594), False, 'import platform\n'), ((1052, 1080), 'logging.getLogger', 'logging.getLogger', (['"""asyncio"""'], {}), ... |
from django.shortcuts import render,redirect
from .forms import usernameForm,DateForm,UsernameAndDateForm, DateForm_2
from django.contrib import messages
from django.contrib.auth.models import User
import cv2
import dlib
import imutils
from imutils import face_utils
from imutils.video import VideoStream
from imutils.fa... | [
"cv2.rectangle",
"sklearn.preprocessing.LabelEncoder",
"users.models.Time",
"django.contrib.messages.warning",
"users.models.Time.objects.filter",
"cv2.imshow",
"django.contrib.auth.models.User.objects.filter",
"numpy.array",
"face_recognition.face_encodings",
"cv2.destroyAllWindows",
"face_reco... | [((1205, 1219), 'matplotlib.use', 'mpl.use', (['"""Agg"""'], {}), "('Agg')\n", (1212, 1219), True, 'import matplotlib as mpl\n'), ((1771, 1803), 'dlib.get_frontal_face_detector', 'dlib.get_frontal_face_detector', ([], {}), '()\n', (1801, 1803), False, 'import dlib\n'), ((1817, 1905), 'dlib.shape_predictor', 'dlib.shape... |
import re
import string
DATA = '05.txt'
def react(polymer):
pairs = '|'.join([a + b + '|' + b + a for a, b in zip(string.ascii_lowercase, string.ascii_uppercase)])
length = len(polymer)
while 1:
polymer = re.sub(pairs, '', polymer)
if len(polymer) == length:
retu... | [
"re.sub"
] | [((240, 266), 're.sub', 're.sub', (['pairs', '""""""', 'polymer'], {}), "(pairs, '', polymer)\n", (246, 266), False, 'import re\n'), ((672, 706), 're.sub', 're.sub', (['c', '""""""', 'polymer'], {'flags': 're.I'}), "(c, '', polymer, flags=re.I)\n", (678, 706), False, 'import re\n')] |
import json
import cherrypy
import engine
class WebServer(object):
@cherrypy.expose
def index(self):
return open('public/index.html', encoding='utf-8')
@cherrypy.expose
class GetOptionsService(object):
@cherrypy.tools.accept(media='text/plain')
def GET(self):
return json.dumps({
... | [
"engine.get_default_dataset_headers",
"cherrypy.tools.json_out",
"cherrypy.tools.accept",
"json.loads",
"engine.get_all_default_datasets",
"engine.get_providers",
"engine.execute",
"engine.get_algorithms",
"cherrypy.HTTPError"
] | [((1500, 1525), 'cherrypy.tools.json_out', 'cherrypy.tools.json_out', ([], {}), '()\n', (1523, 1525), False, 'import cherrypy\n'), ((230, 271), 'cherrypy.tools.accept', 'cherrypy.tools.accept', ([], {'media': '"""text/plain"""'}), "(media='text/plain')\n", (251, 271), False, 'import cherrypy\n'), ((553, 594), 'cherrypy... |
from typing import Union
from tuprolog import logger
# noinspection PyUnresolvedReferences
import jpype.imports
# noinspection PyUnresolvedReferences
import it.unibo.tuprolog.solve.exception.error as errors
from tuprolog.core import Term, Atom
from tuprolog.solve import ExecutionContext, Signature
ExistenceError = err... | [
"tuprolog.logger.debug"
] | [((1800, 1906), 'tuprolog.logger.debug', 'logger.debug', (['"""Loaded JVM classes from it.unibo.tuprolog.solve.exception.error.ExistenceError.*"""'], {}), "(\n 'Loaded JVM classes from it.unibo.tuprolog.solve.exception.error.ExistenceError.*'\n )\n", (1812, 1906), False, 'from tuprolog import logger\n')] |
import pybullet as p
import pybullet_data
import gym
from gym import spaces
from gym.utils import seeding
import numpy as np
from math import sqrt
import random
import time
import math
import cv2
import torch
import os
def random_crop(imgs, out):
"""
args:
imgs: shape (B,C,H,W)
... | [
"pybullet_data.getDataPath",
"math.sqrt",
"pybullet.computeViewMatrixFromYawPitchRoll",
"pybullet.setGravity",
"time.sleep",
"numpy.array",
"pybullet.disconnect",
"gym.utils.seeding.np_random",
"pybullet.connect",
"pybullet.addUserDebugLine",
"pybullet.getNumJoints",
"pybullet.getCameraImage",... | [((431, 464), 'numpy.random.randint', 'np.random.randint', (['(0)', 'crop_max', 'n'], {}), '(0, crop_max, n)\n', (448, 464), True, 'import numpy as np\n'), ((475, 508), 'numpy.random.randint', 'np.random.randint', (['(0)', 'crop_max', 'n'], {}), '(0, crop_max, n)\n', (492, 508), True, 'import numpy as np\n'), ((524, 56... |
import dash
import dash_core_components as dcc
import dash_html_components as html
import dash_bootstrap_components as dbc
import pandas as pd
import numpy as np
import altair as alt
import vega_datasets
alt.data_transformers.enable('default')
alt.data_transformers.disable_max_rows()
app = dash.Dash(__name__, assets_f... | [
"altair.selection_single",
"pandas.read_csv",
"altair.binding_range",
"dash_html_components.P",
"dash.dependencies.Output",
"altair.Chart",
"altair.Scale",
"dash.dependencies.Input",
"altair.data_transformers.enable",
"altair.X",
"altair.Y",
"altair.Legend",
"dash_html_components.H2",
"das... | [((205, 244), 'altair.data_transformers.enable', 'alt.data_transformers.enable', (['"""default"""'], {}), "('default')\n", (233, 244), True, 'import altair as alt\n'), ((245, 285), 'altair.data_transformers.disable_max_rows', 'alt.data_transformers.disable_max_rows', ([], {}), '()\n', (283, 285), True, 'import altair a... |
import os
import pdb
import warnings
import numpy as np
import torch
import torch.nn as nn
import torch.utils.data
import torch.backends.cudnn
import torch.optim as optim
import dataloaders
from utils.utils import AverageMeter
from utils.loss import build_criterion
from utils.metrics import Evaluator
from utils.step_... | [
"retrain_model.build_autodeeplab.Retrain_Autodeeplab",
"torch.load",
"os.path.join",
"torch.nn.DataParallel",
"numpy.argmax",
"dataloaders.make_data_loader",
"os.path.isfile",
"torch.cuda.is_available",
"os.path.isdir",
"os.mkdir",
"utils.utils.AverageMeter",
"pdb.set_trace",
"torch.no_grad"... | [((518, 551), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (541, 551), False, 'import warnings\n'), ((563, 588), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (586, 588), False, 'import torch\n'), ((642, 675), 'config_utils.re_train_autodeeplab.... |
# The MIT License (MIT)
# Copyright (c) 2021 <NAME>
# 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, modify, merg... | [
"home.Home",
"login.Login",
"context.Context",
"pmu.axp192",
"machine.reset",
"settings.load"
] | [((1242, 1250), 'pmu.axp192', 'axp192', ([], {}), '()\n', (1248, 1250), False, 'from pmu import axp192\n'), ((1387, 1396), 'context.Context', 'Context', ([], {}), '()\n', (1394, 1396), False, 'from context import Context\n'), ((1655, 1670), 'machine.reset', 'machine.reset', ([], {}), '()\n', (1668, 1670), False, 'impor... |
## Program: VMTK
## Language: Python
## Date: January 12, 2018
## Version: 1.4
## Copyright (c) <NAME>, <NAME>, All rights reserved.
## See LICENSE file for details.
## This software is distributed WITHOUT ANY WARRANTY; without even
## the implied warranty of MERCHANTABILITY or FITNESS FOR A PAR... | [
"pytest.fixture",
"vmtk.vmtksurfacereader.vmtkSurfaceReader",
"vmtk.vmtksurfaceconnectivity.vmtkSurfaceConnectivity",
"os.path.join"
] | [((583, 613), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (597, 613), False, 'import pytest\n'), ((725, 758), 'vmtk.vmtksurfacereader.vmtkSurfaceReader', 'surfacereader.vmtkSurfaceReader', ([], {}), '()\n', (756, 758), True, 'import vmtk.vmtksurfacereader as surfacereader\... |
# Author: <NAME> <<EMAIL>>
# <NAME> <<EMAIL>>
#
# License: BSD-3-Clause
import os.path as op
import numpy as np
from numpy.testing import assert_array_equal
import pytest
from mne import pick_types
from mne.datasets import testing
from mne.io.tests.test_raw import _test_raw_reader
from mne.io.cnt import rea... | [
"mne.datasets.testing.data_path",
"mne.pick_types",
"mne.io.cnt.read_raw_cnt",
"os.path.join",
"mne.io.tests.test_raw._test_raw_reader",
"pytest.warns",
"numpy.array",
"numpy.testing.assert_array_equal",
"mne.annotations.read_annotations"
] | [((388, 421), 'mne.datasets.testing.data_path', 'testing.data_path', ([], {'download': '(False)'}), '(download=False)\n', (405, 421), False, 'from mne.datasets import testing\n'), ((430, 475), 'os.path.join', 'op.join', (['data_path', '"""CNT"""', '"""scan41_short.cnt"""'], {}), "(data_path, 'CNT', 'scan41_short.cnt')\... |
import urllib.request, json
import pandas as pd
baseUrl = 'https://avoindata.eduskunta.fi/api/v1/tables/VaskiData'
parameters = 'rows?columnName=Eduskuntatunnus&columnValue=LA%25&perPage=100'
page = 0
df = ''
while True:
print(f'Fetching page number {page}')
with urllib.request.urlopen(f'{baseUrl}/{parameters... | [
"pandas.DataFrame"
] | [((474, 503), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns': 'columns'}), '(columns=columns)\n', (486, 503), True, 'import pandas as pd\n'), ((563, 614), 'pandas.DataFrame', 'pd.DataFrame', (['dataRows'], {'columns': "data['columnNames']"}), "(dataRows, columns=data['columnNames'])\n", (575, 614), True, 'import p... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 20 16:15:37 2021
@author: em42363
"""
# In[1]: Import functions
'''
CatBoost is a high-performance open source library for gradient boosting
on decision trees
'''
from catboost import CatBoostRegressor
from sklearn.model_selection import train_test_split
import pandas a... | [
"numpy.mean",
"sys.path.insert",
"numpy.sqrt",
"UTuning.scorer.Precision",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"UTuning.scorer.Accuracy",
"numpy.asarray",
"UTuning.plots.error_accuracy_plot",
"catboost.CatBoostRegressor",
"os.path.dirname",
"numpy.linspace",
"UTuni... | [((425, 487), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""C:\\\\Users\\\\eduar\\\\OneDrive\\\\PhD\\\\UTuning"""'], {}), "(0, 'C:\\\\Users\\\\eduar\\\\OneDrive\\\\PhD\\\\UTuning')\n", (440, 487), False, 'import sys\n'), ((484, 548), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""C:\\\\Users\\\\em42363\\\\OneD... |
import logging
from platform import system
from tqdm import tqdm
from multiprocessing import Lock
loggers = {}
# https://stackoverflow.com/questions/38543506/
class TqdmLoggingHandler(logging.Handler):
def __init__(self, level=logging.NOTSET):
super(TqdmLoggingHandler, self).__init__(level)
def emit... | [
"logging.getLogger",
"tqdm.tqdm.write",
"logging.Formatter",
"platform.system",
"logging.getLevelName",
"multiprocessing.Lock"
] | [((787, 838), 'logging.Formatter', 'logging.Formatter', ([], {'fmt': '"""%(levelname)s: %(message)s"""'}), "(fmt='%(levelname)s: %(message)s')\n", (804, 838), False, 'import logging\n'), ((1413, 1436), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (1430, 1436), False, 'import logging\n'), ((933,... |
import cv2
import sys
import playsound
face_cascade = cv2.CascadeClassifier('cascades/haarcascade_frontalface_default.xml')
# capture video using cv2
video_capture = cv2.VideoCapture(0)
while True:
# capture frame by frame, i.e, one by one
ret, frame = video_capture.read()
gray = cv2.cvtColor(frame... | [
"cv2.rectangle",
"playsound.playsound",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.cvtColor",
"sys.exit",
"cv2.CascadeClassifier",
"cv2.waitKey"
] | [((55, 124), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""cascades/haarcascade_frontalface_default.xml"""'], {}), "('cascades/haarcascade_frontalface_default.xml')\n", (76, 124), False, 'import cv2\n'), ((168, 187), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (184, 187), False, 'import cv... |
# vim:set et sw=4 ts=4:
import logging
import sys
import jmespath
from . import sis, classes
# logging
logging.basicConfig(stream=sys.stdout, level=logging.WARNING)
logger = logging.getLogger(__name__)
# SIS endpoint
enrollments_uri = "https://apis.berkeley.edu/sis/v2/enrollments"
# apparently some courses have LA... | [
"logging.basicConfig",
"jmespath.search",
"logging.getLogger"
] | [((106, 167), 'logging.basicConfig', 'logging.basicConfig', ([], {'stream': 'sys.stdout', 'level': 'logging.WARNING'}), '(stream=sys.stdout, level=logging.WARNING)\n', (125, 167), False, 'import logging\n'), ((177, 204), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (194, 204), False, 'i... |
from flatland.envs.agent_utils import RailAgentStatus
from flatland.envs.malfunction_generators import malfunction_from_params, MalfunctionParameters
from flatland.envs.observations import GlobalObsForRailEnv
from flatland.envs.rail_env import RailEnv
from flatland.envs.rail_generators import sparse_rail_generator
from... | [
"os.path.exists",
"PIL.Image.fromarray",
"msgpack.load",
"flatland.envs.schedule_generators.sparse_schedule_generator",
"argparse.ArgumentParser",
"flatland.envs.observations.GlobalObsForRailEnv",
"os.makedirs",
"msgpack.dump",
"flatland.envs.malfunction_generators.malfunction_from_params",
"rando... | [((620, 637), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (631, 637), False, 'import random\n'), ((1379, 1396), 'random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (1390, 1396), False, 'import random\n'), ((1410, 1430), 'random.randint', 'random.randint', (['(0)', '(5)'], {}), '(0, 5)\n', (1424, 143... |
# -*- coding: utf-8 -*-
# Generated by Django 2.2.4 on 2019-08-21 19:53
# this file is auto-generated so don't do flake8 on it
# flake8: noqa
from __future__ import absolute_import, unicode_literals
from django.db import migrations, models
import django.utils.timezone
def copy_date_done_to_date_created(apps, schem... | [
"django.db.models.DateTimeField",
"django.db.migrations.RunPython",
"django.db.models.F"
] | [((1351, 1447), 'django.db.migrations.RunPython', 'migrations.RunPython', (['copy_date_done_to_date_created', 'reverse_copy_date_done_to_date_created'], {}), '(copy_date_done_to_date_created,\n reverse_copy_date_done_to_date_created)\n', (1371, 1447), False, 'from django.db import migrations, models\n'), ((522, 543)... |
import torch.nn as nn
from utils.BBBlayers import BBBConv2d, BBBLinearFactorial, FlattenLayer
class BBB3Conv3FC(nn.Module):
"""
Simple Neural Network having 3 Convolution
and 3 FC layers with Bayesian layers.
"""
def __init__(self, outputs, inputs):
super(BBB3Conv3FC, self).__init__()
... | [
"torch.nn.Softplus",
"utils.BBBlayers.FlattenLayer",
"torch.nn.ModuleList",
"utils.BBBlayers.BBBLinearFactorial",
"utils.BBBlayers.BBBConv2d",
"torch.nn.MaxPool2d"
] | [((337, 382), 'utils.BBBlayers.BBBConv2d', 'BBBConv2d', (['inputs', '(32)', '(5)'], {'stride': '(1)', 'padding': '(2)'}), '(inputs, 32, 5, stride=1, padding=2)\n', (346, 382), False, 'from utils.BBBlayers import BBBConv2d, BBBLinearFactorial, FlattenLayer\n'), ((404, 417), 'torch.nn.Softplus', 'nn.Softplus', ([], {}), ... |
import os
from tensorflow.contrib.learn.python.learn.datasets import base
import numpy as np
import IPython
from subprocess import call
from keras.preprocessing import image
from influence.dataset import DataSet
from influence.inception_v3 import preprocess_input
BASE_DIR = 'data' # TODO: change
def fill(X, Y, id... | [
"keras.preprocessing.image.img_to_array",
"numpy.arange",
"influence.inception_v3.preprocess_input",
"os.path.exists",
"numpy.savez",
"os.listdir",
"numpy.reshape",
"subprocess.call",
"numpy.random.seed",
"numpy.concatenate",
"numpy.savez_compressed",
"os.rename",
"tensorflow.contrib.learn.p... | [((361, 419), 'keras.preprocessing.image.load_img', 'image.load_img', (['img_path'], {'target_size': '(img_side, img_side)'}), '(img_path, target_size=(img_side, img_side))\n', (375, 419), False, 'from keras.preprocessing import image\n'), ((428, 451), 'keras.preprocessing.image.img_to_array', 'image.img_to_array', (['... |
import OpenPNM
import numpy as np
import OpenPNM.Physics.models as pm
class GenericLinearTransportTest:
def setup_class(self):
self.net = OpenPNM.Network.Cubic(shape=[5, 5, 5])
self.phase = OpenPNM.Phases.GenericPhase(network=self.net)
Ps = self.net.Ps
Ts = self.net.Ts
self... | [
"OpenPNM.Physics.GenericPhysics",
"numpy.ones",
"OpenPNM.Algorithms.GenericLinearTransport",
"numpy.absolute",
"numpy.size",
"OpenPNM.Network.Cubic",
"numpy.sum",
"numpy.zeros",
"OpenPNM.Phases.GenericPhase",
"numpy.array",
"numpy.isnan",
"numpy.concatenate",
"numpy.all",
"numpy.arange"
] | [((152, 190), 'OpenPNM.Network.Cubic', 'OpenPNM.Network.Cubic', ([], {'shape': '[5, 5, 5]'}), '(shape=[5, 5, 5])\n', (173, 190), False, 'import OpenPNM\n'), ((212, 257), 'OpenPNM.Phases.GenericPhase', 'OpenPNM.Phases.GenericPhase', ([], {'network': 'self.net'}), '(network=self.net)\n', (239, 257), False, 'import OpenPN... |
from optimizer.utils.intbounds import IntBounds
class TestIntBounds(object):
def test_make_gt(self):
i0 = IntBounds()
i1 = i0.make_gt(IntBounds(10, 10))
assert i1.lower == 11
def test_make_gt_already_bounded(self):
i0 = IntBounds()
i1 = i0.make_gt(IntBounds(10, 10))... | [
"optimizer.utils.intbounds.IntBounds"
] | [((120, 131), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (129, 131), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((265, 276), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (274, 276), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((419, ... |
from libTask import Queue
from common import configParams
from common import common
def main():
cp = configParams.ConfigParams("config.json")
detectGeneralQueue = Queue.DQueue(cp, len(cp.detect_general_ids), cp.modelPath, common.GENERALDETECT_METHOD_ID,
cp.GPUDevices, cp.detect_g... | [
"common.configParams.ConfigParams"
] | [((105, 145), 'common.configParams.ConfigParams', 'configParams.ConfigParams', (['"""config.json"""'], {}), "('config.json')\n", (130, 145), False, 'from common import configParams\n')] |
import torch, torchvision
import detectron2
from detectron2.utils.logger import setup_logger
setup_logger()
# import some common libraries
import numpy as np
import os, json, cv2, random
# import some common detectron2 utilities
from detectron2 import model_zoo
from detectron2.engine import DefaultPredic... | [
"detectron2.config.get_cfg",
"argparse.ArgumentParser",
"detectron2.model_zoo.get_checkpoint_url",
"detectron2.model_zoo.get_config_file",
"detectron2.data.MetadataCatalog.get",
"time.time",
"detectron2.engine.DefaultPredictor",
"cv2.imread",
"detectron2.utils.logger.setup_logger"
] | [((98, 112), 'detectron2.utils.logger.setup_logger', 'setup_logger', ([], {}), '()\n', (110, 112), False, 'from detectron2.utils.logger import setup_logger\n'), ((531, 556), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (554, 556), False, 'import argparse, time\n'), ((1217, 1232), 'cv2.imread'... |
"""AMQP Table Encoding/Decoding"""
import struct
import decimal
import calendar
from datetime import datetime
from pika import exceptions
from pika.compat import unicode_type, PY2, long, as_bytes
def encode_short_string(pieces, value):
"""Encode a string value as short string and append it to pieces list
ret... | [
"pika.exceptions.ShortStringTooLong",
"pika.exceptions.InvalidFieldTypeException",
"pika.compat.as_bytes",
"struct.pack",
"pika.exceptions.UnsupportedAMQPFieldException",
"decimal.Decimal",
"struct.unpack_from"
] | [((524, 539), 'pika.compat.as_bytes', 'as_bytes', (['value'], {}), '(value)\n', (532, 539), False, 'from pika.compat import unicode_type, PY2, long, as_bytes\n'), ((2684, 2712), 'struct.pack', 'struct.pack', (['""">I"""', 'tablesize'], {}), "('>I', tablesize)\n", (2695, 2712), False, 'import struct\n'), ((1133, 1177), ... |
from pylaas_core.abstract.abstract_service import AbstractService
import time
from pylaas_core.interface.technical.container_configurable_aware_interface import ContainerConfigurableAwareInterface
class DummyConfigurable(AbstractService, ContainerConfigurableAwareInterface):
def __init__(self) -> None:
... | [
"time.time"
] | [((375, 386), 'time.time', 'time.time', ([], {}), '()\n', (384, 386), False, 'import time\n')] |
from django.urls import reverse_lazy, reverse
from django.utils.decorators import method_decorator
from django.views.generic import ListView, DetailView, CreateView, DeleteView, UpdateView
from .models import BlogPost
from django.contrib.auth.decorators import login_required
class BlogPostHomeView(ListView):
mode... | [
"django.urls.reverse",
"django.utils.decorators.method_decorator",
"django.urls.reverse_lazy"
] | [((464, 513), 'django.utils.decorators.method_decorator', 'method_decorator', (['login_required'], {'name': '"""dispatch"""'}), "(login_required, name='dispatch')\n", (480, 513), False, 'from django.utils.decorators import method_decorator\n'), ((708, 757), 'django.utils.decorators.method_decorator', 'method_decorator'... |
# Copyright (c) 2016 <NAME>, Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required... | [
"manila.context.get_admin_context",
"manila.tests.db_utils.create_snapshot_instance",
"manila.share.snapshot_access.ShareSnapshotInstanceAccess",
"mock.Mock",
"manila.utils.IsAMatcher",
"manila.tests.db_utils.create_share",
"ddt.data",
"copy.deepcopy",
"manila.tests.db_utils.create_snapshot"
] | [((1617, 1709), 'ddt.data', 'ddt.data', (['constants.ACCESS_STATE_QUEUED_TO_APPLY', 'constants.ACCESS_STATE_QUEUED_TO_DENY'], {}), '(constants.ACCESS_STATE_QUEUED_TO_APPLY, constants.\n ACCESS_STATE_QUEUED_TO_DENY)\n', (1625, 1709), False, 'import ddt\n'), ((1190, 1250), 'manila.share.snapshot_access.ShareSnapshotIn... |
# This sample tests the type checker's reportUnnecessaryCast feature.
from typing import cast, Union
def foo(a: int):
# This should generate an error if
# reportUnnecessaryCast is enabled.
b = cast(int, a)
c: Union[int, str] = "hello"
d = cast(int, c)
| [
"typing.cast"
] | [((256, 268), 'typing.cast', 'cast', (['int', 'c'], {}), '(int, c)\n', (260, 268), False, 'from typing import cast, Union\n'), ((208, 220), 'typing.cast', 'cast', (['int', 'a'], {}), '(int, a)\n', (212, 220), False, 'from typing import cast, Union\n')] |
from http import HTTPStatus
from typing import Iterable, Union, Mapping
from flask import request
from flask_restful import Resource, fields, marshal
from metadata_service.proxy import get_proxy_client
popular_table_fields = {
'database': fields.String,
'cluster': fields.String,
'schema': fields.String,
... | [
"flask.request.args.get",
"flask_restful.fields.String",
"flask_restful.fields.Nested",
"flask_restful.marshal",
"metadata_service.proxy.get_proxy_client"
] | [((338, 369), 'flask_restful.fields.String', 'fields.String', ([], {'attribute': '"""name"""'}), "(attribute='name')\n", (351, 369), False, 'from flask_restful import Resource, fields, marshal\n'), ((396, 434), 'flask_restful.fields.String', 'fields.String', ([], {'attribute': '"""description"""'}), "(attribute='descri... |
import requests
import logging
import cfscrape
import os
from manhwaDownloader.constants import CONSTANTS as CONST
logging.basicConfig(level=logging.DEBUG)
folderPath = os.path.join(CONST.OUTPUTPATH, 'serious-taste-of-forbbiden-fruit')
logging.info(len([file for file in os.walk(folderPath)]))
walkList = [file for fi... | [
"logging.basicConfig",
"os.path.join",
"os.walk"
] | [((116, 156), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (135, 156), False, 'import logging\n'), ((171, 237), 'os.path.join', 'os.path.join', (['CONST.OUTPUTPATH', '"""serious-taste-of-forbbiden-fruit"""'], {}), "(CONST.OUTPUTPATH, 'serious-taste-of-forbbi... |
# define custom R2 metrics for Keras backend
from keras import backend as K
def r2_keras(y_true, y_pred):
SS_res = K.sum(K.square( y_true - y_pred ))
SS_tot = K.sum(K.square( y_true - K.mean(y_true) ) )
return ( 1 - SS_res/(SS_tot + K.epsilon()) )
# base model architecture definition
def model():
... | [
"pandas.read_csv",
"keras.layers.GlobalMaxPooling1D",
"numpy.array",
"keras.layers.Activation",
"keras.layers.Dense",
"keras.preprocessing.sequence.pad_sequences",
"sklearn.decomposition.FastICA",
"sklearn.model_selection.KFold",
"xgboost.sklearn.XGBRegressor",
"sklearn.metrics.r2_score",
"numpy... | [((1722, 1755), 'pandas.read_csv', 'pd.read_csv', (['"""../input/train.csv"""'], {}), "('../input/train.csv')\n", (1733, 1755), True, 'import pandas as pd\n'), ((1763, 1795), 'pandas.read_csv', 'pd.read_csv', (['"""../input/test.csv"""'], {}), "('../input/test.csv')\n", (1774, 1795), True, 'import pandas as pd\n'), ((1... |
# Copyright 2020 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... | [
"mindspore.common.api._cell_graph_executor.compile",
"numpy.ones",
"mindspore.ops.operations.Mul",
"mindspore.nn.TrainOneStepCell",
"mindspore.ops.operations.MatMul",
"mindspore.ops.operations.Reshape",
"mindspore.context.reset_auto_parallel_context",
"pytest.raises",
"mindspore.common.initializer.i... | [((2366, 2381), 'numpy.ones', 'np.ones', (['[8, 8]'], {}), '([8, 8])\n', (2373, 2381), True, 'import numpy as np\n'), ((2411, 2427), 'numpy.ones', 'np.ones', (['[64, 8]'], {}), '([64, 8])\n', (2418, 2427), True, 'import numpy as np\n'), ((2569, 2601), 'mindspore.nn.TrainOneStepCell', 'TrainOneStepCell', (['net', 'optim... |
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 7 10:59:00 2020
@author: user
"""
import numpy as np
import multiprocessing as mp
import matplotlib.pyplot as plt
import time
import itertools
import ctypes
def formfactor(args):
# with AL_dist_flat_glo.get_lock:
AL_dist_flat_glo_r = np.frombuffer(AL_dist_flat_... | [
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.xscale",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.show",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"multiprocessing.Value",
"numpy.subtract",
"matplotlib.pyplot.yscale",
"matplotlib.pyplot.figure",
"numpy.array",
"multiprocessin... | [((1464, 1493), 'numpy.load', 'np.load', (['"""./AL_dist_flat.npy"""'], {}), "('./AL_dist_flat.npy')\n", (1471, 1493), True, 'import numpy as np\n'), ((1582, 1605), 'numpy.logspace', 'np.logspace', (['(-2)', '(3)', '(100)'], {}), '(-2, 3, 100)\n', (1593, 1605), True, 'import numpy as np\n'), ((1782, 1807), 'multiproces... |
# coding: utf-8
import io
import cairo # pycairo
import cairocffi
from pycairo_to_cairocffi import _UNSAFE_pycairo_context_to_cairocffi
from cairocffi_to_pycairo import _UNSAFE_cairocffi_context_to_pycairo
import pango_example
def test():
cairocffi_context = cairocffi.Context(cairocffi.PDFSurface(N... | [
"cairocffi.PDFSurface",
"pango_example.write_example_pdf",
"io.BytesIO",
"pycairo_to_cairocffi._UNSAFE_pycairo_context_to_cairocffi",
"cairocffi_to_pycairo._UNSAFE_cairocffi_context_to_pycairo"
] | [((392, 447), 'cairocffi_to_pycairo._UNSAFE_cairocffi_context_to_pycairo', '_UNSAFE_cairocffi_context_to_pycairo', (['cairocffi_context'], {}), '(cairocffi_context)\n', (428, 447), False, 'from cairocffi_to_pycairo import _UNSAFE_cairocffi_context_to_pycairo\n'), ((474, 527), 'pycairo_to_cairocffi._UNSAFE_pycairo_conte... |
import random
goat1 = random.randint(1, 3)
goat2 = random.randint(1, 3)
while goat1 == goat2:
goat2 = random.randint(1, 3)
success = 0
tries = 1_000_000
for _ in range(tries):
options = [1, 2, 3]
choice = random.randint(1, 3)
options.remove(choice)
if choice == goat1:
options.remove(goat... | [
"random.randint"
] | [((23, 43), 'random.randint', 'random.randint', (['(1)', '(3)'], {}), '(1, 3)\n', (37, 43), False, 'import random\n'), ((52, 72), 'random.randint', 'random.randint', (['(1)', '(3)'], {}), '(1, 3)\n', (66, 72), False, 'import random\n'), ((108, 128), 'random.randint', 'random.randint', (['(1)', '(3)'], {}), '(1, 3)\n', ... |
#!/usr/bin/env python3
import random
N = 32
M = 64
# NOTE: 0 is a reserved value
randu = lambda x: random.randint(1, 2**x-1)
randU32 = lambda: randu(32)
randU64 = lambda: randu(64)
fmt_by_dtype = {
'u32hex': '0x{:08x}',
'u64hex': '0x{:016x}',
}
cpp_by_dtype = {
'u32hex': 'uint32_t',
'u64hex': 'ui... | [
"random.randint"
] | [((105, 134), 'random.randint', 'random.randint', (['(1)', '(2 ** x - 1)'], {}), '(1, 2 ** x - 1)\n', (119, 134), False, 'import random\n')] |
# ------------------------------------------------------------------
#
# RDF and CN related analysis
#
# ------------------------------------------------------------------
import sys
py_path = '../../../../postprocessing/'
sys.path.insert(0, py_path)
py_path = '../../../../postprocessing/io_operations/'
sys.path.inse... | [
"cn_and_rdf_lmp.compute_time_average",
"sys.path.insert"
] | [((225, 252), 'sys.path.insert', 'sys.path.insert', (['(0)', 'py_path'], {}), '(0, py_path)\n', (240, 252), False, 'import sys\n'), ((307, 334), 'sys.path.insert', 'sys.path.insert', (['(0)', 'py_path'], {}), '(0, py_path)\n', (322, 334), False, 'import sys\n'), ((565, 623), 'cn_and_rdf_lmp.compute_time_average', 'crl.... |
"""
Test the integrations related to the internal interface implementation and the 'Interface' interface itself
"""
import pytest
from cppython_core.schema import InterfaceConfiguration
from pytest_cppython.plugin import InterfaceIntegrationTests
from cppython.console import ConsoleInterface
class TestCLIInterface(... | [
"pytest.fixture",
"cppython_core.schema.InterfaceConfiguration",
"cppython.console.ConsoleInterface"
] | [((406, 438), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""interface"""'}), "(name='interface')\n", (420, 438), False, 'import pytest\n'), ((688, 712), 'cppython_core.schema.InterfaceConfiguration', 'InterfaceConfiguration', ([], {}), '()\n', (710, 712), False, 'from cppython_core.schema import InterfaceConfig... |
#@contact <NAME> (<EMAIL>), Georgia Institute of Technology
#@version 1.0
#@date 2021-08-17
#Influence-guided Data Augmentation for Neural Tensor Completion (DAIN)
#This software is free of charge under research purposes.
#For commercial purposes, please contact the main author.
import torch
from torch imp... | [
"torch.mul",
"model.MLP",
"torch.from_numpy",
"torch.pow",
"torch.nn.MSELoss",
"torch.cuda.is_available",
"torch.sum",
"copy.deepcopy",
"numpy.arange",
"os.path.exists",
"argparse.ArgumentParser",
"os.mkdir",
"sklearn.model_selection.train_test_split",
"torch.empty",
"torch.cuda.empty_ca... | [((636, 708), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run DAIN for the MLP architecture"""'}), "(description='Run DAIN for the MLP architecture')\n", (659, 708), False, 'import argparse\n'), ((2034, 2046), 'torch.nn.MSELoss', 'nn.MSELoss', ([], {}), '()\n', (2044, 2046), False, 'f... |
from datetime import datetime, timedelta
import jwt
from flask import current_app
from app import db
from app.user.repository import UserRepository
class AuthService:
def __init__(self) -> None:
self._user_repository = UserRepository(db.session)
def create_token(self, data) -> dict:
user = ... | [
"jwt.decode",
"datetime.timedelta",
"app.user.repository.UserRepository",
"datetime.datetime.utcnow"
] | [((235, 261), 'app.user.repository.UserRepository', 'UserRepository', (['db.session'], {}), '(db.session)\n', (249, 261), False, 'from app.user.repository import UserRepository\n'), ((1267, 1340), 'jwt.decode', 'jwt.decode', (['token', "current_app.config['SECRET_KEY']"], {'algorithms': "['HS512']"}), "(token, current_... |
import os
from Bio import AlignIO, Phylo
from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor
class Phylogenetic:
def __init__(self, PATH):
self.PATH=PATH
def binary_sequence_generator(self, input_kmer_pattern, label):
string_inp="".join([ 'A' if x==0 else 'C'... | [
"Bio.Phylo.TreeConstruction.DistanceTreeConstructor",
"os.path.join",
"Bio.Phylo.TreeConstruction.DistanceCalculator"
] | [((850, 880), 'Bio.Phylo.TreeConstruction.DistanceCalculator', 'DistanceCalculator', (['"""identity"""'], {}), "('identity')\n", (868, 880), False, 'from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor\n'), ((1047, 1072), 'Bio.Phylo.TreeConstruction.DistanceTreeConstructor', 'DistanceTreeC... |
import torch
import functools
if torch.__version__.startswith('0'):
from .sync_bn.inplace_abn.bn import InPlaceABNSync
BatchNorm2d = functools.partial(InPlaceABNSync, activation='none')
BatchNorm2d_class = InPlaceABNSync
relu_inplace = False
else:
# BatchNorm2d_class = BatchNorm2d = torch.nn.SyncBa... | [
"torch.__version__.startswith",
"functools.partial"
] | [((34, 67), 'torch.__version__.startswith', 'torch.__version__.startswith', (['"""0"""'], {}), "('0')\n", (62, 67), False, 'import torch\n'), ((142, 194), 'functools.partial', 'functools.partial', (['InPlaceABNSync'], {'activation': '"""none"""'}), "(InPlaceABNSync, activation='none')\n", (159, 194), False, 'import fun... |
import os
import sys
import numpy as np
import pandas as pd
def get_columns_percent_dataframe(df: pd.DataFrame, totals_column=None, percent_names=True) -> pd.DataFrame:
""" @param totals_column: (default = use sum of columns)
@param percent_names: Rename names from 'col' => 'col %'
Return a dataframe... | [
"pandas.read_csv",
"numpy.isnan",
"pandas.DataFrame",
"os.stat",
"pandas.notnull"
] | [((407, 435), 'pandas.DataFrame', 'pd.DataFrame', ([], {'index': 'df.index'}), '(index=df.index)\n', (419, 435), True, 'import pandas as pd\n'), ((1630, 1643), 'numpy.isnan', 'np.isnan', (['val'], {}), '(val)\n', (1638, 1643), True, 'import numpy as np\n'), ((1756, 1770), 'pandas.notnull', 'pd.notnull', (['df'], {}), '... |
from SemiBin.main import generate_data_single
import os
import pytest
import logging
import pandas as pd
def test_generate_data_coassembly():
logger = logging.getLogger('SemiBin')
logger.setLevel(logging.INFO)
sh = logging.StreamHandler()
sh.setFormatter(logging.Formatter('%(asctime)s - %(message)s'))
... | [
"logging.getLogger",
"logging.StreamHandler",
"pandas.read_csv",
"os.makedirs",
"logging.Formatter",
"SemiBin.main.generate_data_single"
] | [((156, 184), 'logging.getLogger', 'logging.getLogger', (['"""SemiBin"""'], {}), "('SemiBin')\n", (173, 184), False, 'import logging\n'), ((228, 251), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (249, 251), False, 'import logging\n'), ((351, 398), 'os.makedirs', 'os.makedirs', (['"""output_coass... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
from cx_Freeze import setup,Executable
icondata='icon.ico'
base = None
# GUI=有効, CUI=無効 にする
if sys.platform == 'win32' : base = 'win32GUI'
exe = Executable(script = 'main.py',
base = base,
#icon=icondata
... | [
"cx_Freeze.Executable",
"cx_Freeze.setup"
] | [((209, 248), 'cx_Freeze.Executable', 'Executable', ([], {'script': '"""main.py"""', 'base': 'base'}), "(script='main.py', base=base)\n", (219, 248), False, 'from cx_Freeze import setup, Executable\n'), ((326, 423), 'cx_Freeze.setup', 'setup', ([], {'name': '"""MSman"""', 'version': '"""0.1"""', 'description': '"""Mine... |
from __future__ import division
import numpy as np
import matplotlib.pyplot as plt
import shellmodelutilities as smutil
# Set bin width and range
bin_width = 0.20
Emax = 14
Nbins = int(np.ceil(Emax/bin_width))
Emax_adjusted = bin_width*Nbins # Trick to get an integer number of bins
bins = np.linspace(0,Emax_adjust... | [
"shellmodelutilities.read_energy_levels",
"numpy.ceil",
"numpy.floor",
"numpy.linspace",
"matplotlib.pyplot.FuncFormatter",
"matplotlib.colors.LogNorm",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((295, 335), 'numpy.linspace', 'np.linspace', (['(0)', 'Emax_adjusted', '(Nbins + 1)'], {}), '(0, Emax_adjusted, Nbins + 1)\n', (306, 335), True, 'import numpy as np\n'), ((498, 516), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {}), '(1, 1)\n', (510, 516), True, 'import matplotlib.pyplot as plt\n'),... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
sbpy bandpass Module
"""
__all__ = [
'bandpass'
]
import os
from astropy.utils.data import get_pkg_data_filename
def bandpass(name):
"""Retrieve bandpass transmission spectrum from sbpy.
Parameters
----------
name : string
... | [
"synphot.SpectralElement.from_file"
] | [((4891, 4928), 'synphot.SpectralElement.from_file', 'synphot.SpectralElement.from_file', (['fn'], {}), '(fn)\n', (4924, 4928), False, 'import synphot\n')] |
from django.http import HttpResponse
from django.shortcuts import render, redirect
from community.models import Community
# Create your views here.
def search_basic(request):
communities = None
if request.POST:
community_query = request.POST.get('community_search', False)
communities = Commun... | [
"django.shortcuts.render",
"community.models.Community.objects.filter"
] | [((499, 572), 'django.shortcuts.render', 'render', (['request', '"""search/search_basic.html"""', "{'communities': communities}"], {}), "(request, 'search/search_basic.html', {'communities': communities})\n", (505, 572), False, 'from django.shortcuts import render, redirect\n'), ((314, 371), 'community.models.Community... |
# OxfordInstruments_ILM200.py class, to perform the communication between the Wrapper and the device
# Copyright (c) 2017 QuTech (Delft)
# Code is available under the available under the `MIT open-source license <https://opensource.org/licenses/MIT>`__
#
# <NAME> <<EMAIL>>, 2017
# <NAME> <<EMAIL>>, 2016
# <NAME> <<EMAI... | [
"logging.info",
"logging.debug",
"time.sleep"
] | [((1353, 1407), 'logging.debug', 'logging.debug', (["(__name__ + ' : Initializing instrument')"], {}), "(__name__ + ' : Initializing instrument')\n", (1366, 1407), False, 'import logging\n'), ((2719, 2807), 'logging.info', 'logging.info', (["(__name__ + ' : Send the following command to the device: %s' % message)"], {}... |
# This file is Copyright 2019 Volatility Foundation and licensed under the Volatility Software License 1.0
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
#
"""A module containing a collection of plugins that produce data typically
found in Mac's lsmod command."""
from volatility3.framewor... | [
"volatility3.framework.renderers.format_hints.Hex",
"volatility3.framework.configuration.requirements.TranslationLayerRequirement",
"volatility3.framework.objects.utility.array_to_string",
"volatility3.framework.configuration.requirements.SymbolTableRequirement",
"volatility3.framework.contexts.Module"
] | [((1706, 1761), 'volatility3.framework.contexts.Module', 'contexts.Module', (['context', 'darwin_symbols', 'layer_name', '(0)'], {}), '(context, darwin_symbols, layer_name, 0)\n', (1721, 1761), False, 'from volatility3.framework import renderers, interfaces, contexts\n'), ((810, 952), 'volatility3.framework.configurati... |
"""Subdivided icosahedral mesh generation"""
from __future__ import print_function
import numpy as np
# following: http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html
# hierarchy:
# Icosphere -> Triangle -> Point
class IcoSphere:
"""
Usage: IcoSphere(level)
Maximum supported level =... | [
"numpy.sqrt",
"numpy.asarray",
"numpy.arcsin",
"numpy.array",
"matplotlib.pyplot.figure",
"numpy.arctan2",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"matplotlib.pyplot.show"
] | [((7381, 7414), 'numpy.sqrt', 'np.sqrt', (['(x ** 2 + y ** 2 + z ** 2)'], {}), '(x ** 2 + y ** 2 + z ** 2)\n', (7388, 7414), True, 'import numpy as np\n'), ((5460, 5472), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (5470, 5472), True, 'import matplotlib.pyplot as plt\n'), ((5538, 5580), 'numpy.asarray',... |
#!/usr/bin/env python
# Copyright JS Foundation and other contributors, http://js.foundation
#
# 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.... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"os.symlink",
"os.path.splitext",
"os.getcwd",
"os.path.normpath",
"os.path.split",
"sys.exit",
"fnmatch.filter",
"os.path.islink",
"os.path.abspath",
"os.walk",
"os.path.relpath"
] | [((2005, 2036), 'os.path.join', 'os.path.join', (['root_dir', 'sub_dir'], {}), '(root_dir, sub_dir)\n', (2017, 2036), False, 'import os\n'), ((2092, 2108), 'os.walk', 'os.walk', (['src_dir'], {}), '(src_dir)\n', (2099, 2108), False, 'import os\n'), ((3803, 3825), 'os.path.normpath', 'os.path.normpath', (['path'], {}), ... |
from math import sqrt
import emoji
num = int(input("Digite um número: "))
raiz = sqrt(num)
print("A raiz do número {0} é {1:.2f}.".format(num, raiz))
print(emoji.emojize("Hello World! :earth_americas:", use_aliases=True))
| [
"emoji.emojize",
"math.sqrt"
] | [((81, 90), 'math.sqrt', 'sqrt', (['num'], {}), '(num)\n', (85, 90), False, 'from math import sqrt\n'), ((156, 220), 'emoji.emojize', 'emoji.emojize', (['"""Hello World! :earth_americas:"""'], {'use_aliases': '(True)'}), "('Hello World! :earth_americas:', use_aliases=True)\n", (169, 220), False, 'import emoji\n')] |
from __future__ import print_function
import argparse
import os
import time, platform
import cv2
import torch
import torch.optim as optim
from torch.utils.data import DataLoader
from datasets import DATASET_NAMES, BipedDataset, TestDataset, dataset_info
from losses import *
from model import DexiNed
# from model0C ... | [
"torch.cuda.device_count",
"model.DexiNed",
"datasets.dataset_info",
"torch.utils.tensorboard.SummaryWriter",
"time.ctime",
"argparse.ArgumentParser",
"platform.system",
"utils.visualize_result",
"cv2.putText",
"os.path.isfile",
"utils.save_image_batch_to_disk",
"time.time",
"torch.cuda.empt... | [((655, 699), 'os.path.join', 'os.path.join', (['args.output_dir', '"""current_res"""'], {}), "(args.output_dir, 'current_res')\n", (667, 699), False, 'import os\n'), ((704, 747), 'os.makedirs', 'os.makedirs', (['imgs_res_folder'], {'exist_ok': '(True)'}), '(imgs_res_folder, exist_ok=True)\n', (715, 747), False, 'impor... |
from __future__ import absolute_import
from django.conf.urls import patterns, url
from django_comments.feeds import LatestCommentFeed
from custom_comments import views
feeds = {
'comments': LatestCommentFeed,
}
urlpatterns = patterns('',
url(r'^post/$', views.custom_submit_comment),
url(r'^flag/(\d+)... | [
"django.conf.urls.url",
"django_comments.feeds.LatestCommentFeed"
] | [((253, 296), 'django.conf.urls.url', 'url', (['"""^post/$"""', 'views.custom_submit_comment'], {}), "('^post/$', views.custom_submit_comment)\n", (256, 296), False, 'from django.conf.urls import patterns, url\n'), ((303, 351), 'django.conf.urls.url', 'url', (['"""^flag/(\\\\d+)/$"""', 'views.custom_flag_comment'], {})... |
from __future__ import division
from cctbx.array_family import flex
from cctbx import xray
from cctbx import crystal
from cctbx import maptbx
from cctbx.maptbx import minimization
from libtbx.test_utils import approx_equal
import random
from cctbx.development import random_structure
from cctbx import sgtbx
if (1):
r... | [
"cctbx.sgtbx.space_group_info",
"random.seed",
"libtbx.test_utils.approx_equal",
"cctbx.array_family.flex.set_random_seed",
"cctbx.xray.scatterer",
"cctbx.crystal.symmetry",
"cctbx.maptbx.minimization.run"
] | [((319, 333), 'random.seed', 'random.seed', (['(0)'], {}), '(0)\n', (330, 333), False, 'import random\n'), ((336, 359), 'cctbx.array_family.flex.set_random_seed', 'flex.set_random_seed', (['(0)'], {}), '(0)\n', (356, 359), False, 'from cctbx.array_family import flex\n'), ((397, 475), 'cctbx.crystal.symmetry', 'crystal.... |
from pytest import raises
from datek_app_utils.env_config.base import BaseConfig
from datek_app_utils.env_config.errors import InstantiationForbiddenError
class SomeOtherMixinWhichDoesntRelateToEnvConfig:
color = "red"
class TestConfig:
def test_iter(self, monkeypatch, key_volume, base_config_class):
... | [
"pytest.raises"
] | [((1550, 1585), 'pytest.raises', 'raises', (['InstantiationForbiddenError'], {}), '(InstantiationForbiddenError)\n', (1556, 1585), False, 'from pytest import raises\n')] |
# -*- coding: utf-8 -*-
# Name: comprehend
# Version: 0.1a2
# Owner: <NAME>
# Maintainer(s):
import boto3
def get_sentiment(text, language_code='en'):
"""Get sentiment.
Inspects text and returns an inference of the prevailing sentiment
(positive, neutral, mixed, or negative).
Args:
text: UT... | [
"boto3.client"
] | [((825, 851), 'boto3.client', 'boto3.client', (['"""comprehend"""'], {}), "('comprehend')\n", (837, 851), False, 'import boto3\n')] |
from sys import argv
from getopt import getopt
from os import R_OK, access
from string import Template
DEFAULT_DATASET_FILE_PATH = "dataset/data.csv"
DEFAULT_DATASET_COLUMNS = ['surface (m2)', 'height (m)', 'latitude', 'housing_type', 'longitude', 'country_code',
'city']
DEFAULT_VISU = ["sca... | [
"getopt.getopt",
"os.access",
"string.Template"
] | [((407, 480), 'getopt.getopt', 'getopt', (['argv[1:]', '"""dc"""', "['dataset-file=', 'columns=', 'visus=', 'range=']"], {}), "(argv[1:], 'dc', ['dataset-file=', 'columns=', 'visus=', 'range='])\n", (413, 480), False, 'from getopt import getopt\n'), ((1149, 1175), 'os.access', 'access', (['dataset_file', 'R_OK'], {}), ... |
# Must run example4.py first
# Read an Excel sheet and save running config of devices using pandas
import pandas as pd
from netmiko import ConnectHandler
# Read Excel file of .xlsx format
data = pd.read_excel(io="Example4-Device-Details.xlsx", sheet_name=0)
# Convert data to data frame
df = pd.DataFrame(data=data)
... | [
"pandas.DataFrame",
"netmiko.ConnectHandler",
"pandas.read_excel"
] | [((198, 260), 'pandas.read_excel', 'pd.read_excel', ([], {'io': '"""Example4-Device-Details.xlsx"""', 'sheet_name': '(0)'}), "(io='Example4-Device-Details.xlsx', sheet_name=0)\n", (211, 260), True, 'import pandas as pd\n'), ((296, 319), 'pandas.DataFrame', 'pd.DataFrame', ([], {'data': 'data'}), '(data=data)\n', (308, ... |
"""Utilities for interacting with GitHub"""
import os
import json
import webbrowser
import stat
import sys
from git import Repo
from .context import Context
event_dict = {
"added_to_project": (
lambda event: "{} added the issue to a project.".format(event["actor"]["login"])
),
"assigned": (
... | [
"os.path.expanduser",
"json.loads",
"os.makedirs",
"git.Repo.clone_from",
"webbrowser.open",
"os.chmod",
"os.path.isfile",
"os.path.isdir",
"sys.exit",
"json.dump"
] | [((3575, 3610), 'json.loads', 'json.loads', (["os.environ['GHUB_CRED']"], {}), "(os.environ['GHUB_CRED'])\n", (3585, 3610), False, 'import json\n'), ((4021, 4055), 'webbrowser.open', 'webbrowser.open', (['authorization_url'], {}), '(authorization_url)\n', (4036, 4055), False, 'import webbrowser\n'), ((4848, 4878), 'jso... |
# Generated by Django 3.0.7 on 2020-09-18 05:52
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import multiselectfield.db.fields
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(setting... | [
"django.db.models.SET",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.DateTimeField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.PositiveIntegerField",
"django.db.models.ImageField",
"django.db.mig... | [((281, 338), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (312, 338), False, 'from django.db import migrations, models\n'), ((472, 565), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import pytest
import gen
from dcos_installer import cli
def test_default_arg_parser():
parser = cli.get_argument_parser().parse_args([])
assert parser.verbose is False
assert parser.port == 9000
assert parser.action == 'genconf'
def test_set_arg_parser():
argument_parser = cli.get_argument_pars... | [
"pytest.raises",
"dcos_installer.cli.get_argument_parser"
] | [((299, 324), 'dcos_installer.cli.get_argument_parser', 'cli.get_argument_parser', ([], {}), '()\n', (322, 324), False, 'from dcos_installer import cli\n'), ((1781, 1806), 'pytest.raises', 'pytest.raises', (['SystemExit'], {}), '(SystemExit)\n', (1794, 1806), False, 'import pytest\n'), ((3221, 3245), 'pytest.raises', '... |
import hashlib
import unittest
from colicoords.cell import Cell, CellList
from colicoords.preprocess import data_to_cells
from test import testcase
from test.test_functions import load_testdata
class DataTest(testcase.ArrayTestCase):
def setUp(self):
self.data = load_testdata('ds1')
def t... | [
"test.test_functions.load_testdata",
"hashlib.md5",
"colicoords.preprocess.data_to_cells",
"colicoords.cell.CellList",
"unittest.main"
] | [((2004, 2019), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2017, 2019), False, 'import unittest\n'), ((287, 307), 'test.test_functions.load_testdata', 'load_testdata', (['"""ds1"""'], {}), "('ds1')\n", (300, 307), False, 'from test.test_functions import load_testdata\n'), ((1005, 1077), 'colicoords.preprocess... |
# --------------------------------------------------------------------------- #
# Importing section
# --------------------------------------------------------------------------- #
import os
import sys
import argparse
import logging
import json
from classes.alerts import SlackClient
from influxdb import InfluxDBClient... | [
"logging.getLogger",
"logging.basicConfig",
"influxdb.InfluxDBClient",
"classes.data_manager.DataManager",
"argparse.ArgumentParser",
"classes.alerts.SlackClient",
"os.path.isfile",
"sys.exit"
] | [((578, 602), 'classes.alerts.SlackClient', 'SlackClient', (['logger', 'cfg'], {}), '(logger, cfg)\n', (589, 602), False, 'from classes.alerts import SlackClient\n'), ((1457, 1482), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1480, 1482), False, 'import argparse\n'), ((2270, 2289), 'logging... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'ipetrash'
import re
DEBUG = False
def merge_str_literal(text: str) -> str:
def _on_match(m: re.Match):
return m.group().replace('"+"', '')
return re.sub(r'".+?"(\+".+?")+ ', _on_match, text)
lines = """
function II1I1_II takes real I... | [
"re.sub"
] | [((231, 275), 're.sub', 're.sub', (['"""".+?"(\\\\+".+?")+ """', '_on_match', 'text'], {}), '(\'".+?"(\\\\+".+?")+ \', _on_match, text)\n', (237, 275), False, 'import re\n')] |
from common.commons import *
DATA_PATH = os.environ["DATA_PATH"]
def core():
clusterPath = join(DATA_PATH, 'shapes')
roots = listdir(clusterPath)
roots = [i for i in roots if not (i.startswith('.') or i.endswith('.pickle'))]
pattern = {}
for root in roots:
root
sizes = listdir(join(... | [
"networkx.connected_component_subgraphs",
"abstractPatch.loadPairMulti",
"networkx.Graph",
"pairs.shapePairs",
"pairs.createPairs",
"pairs.importShape"
] | [((850, 862), 'pairs.shapePairs', 'shapePairs', ([], {}), '()\n', (860, 862), False, 'from pairs import shapePairs\n'), ((1263, 1283), 'pairs.createPairs', 'createPairs', (['matches'], {}), '(matches)\n', (1274, 1283), False, 'from pairs import createPairs\n'), ((1365, 1378), 'pairs.importShape', 'importShape', ([], {}... |
# -*- coding: utf-8 -*-
import os
import sys
import tensorflow as tf
import numpy as np
import data_utils
from translate import Transliteration
from flask import Flask, request, jsonify
transliteration = Transliteration()
app = Flask(__name__) # Flask 객체 선언, 파라미터로 어플리케이션 패키지의 이름을 넣어 준다.
app.config['JSON_AS_ASCII'] =... | [
"flask.jsonify",
"flask.request.args.get",
"flask.Flask",
"translate.Transliteration"
] | [((205, 222), 'translate.Transliteration', 'Transliteration', ([], {}), '()\n', (220, 222), False, 'from translate import Transliteration\n'), ((230, 245), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (235, 245), False, 'from flask import Flask, request, jsonify\n'), ((431, 456), 'flask.request.args.get'... |
# -*- coding: utf-8 -*- {{{
# vim: set fenc=utf-8 ft=python sw=4 ts=4 sts=4 et:
#
# Copyright 2019, Battelle Memorial Institute.
#
# 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... | [
"logging.getLogger",
"os.path.getsize",
"statistics.stdev",
"datetime.datetime.utcnow",
"volttron.platform.agent.utils.vip_main",
"volttron.platform.agent.utils.load_config",
"volttron.platform.vip.agent.Core.receiver",
"datetime.timedelta",
"volttron.platform.agent.utils.setup_logging",
"volttron... | [((2132, 2153), 'volttron.platform.agent.utils.setup_logging', 'utils.setup_logging', ([], {}), '()\n', (2151, 2153), False, 'from volttron.platform.agent import utils\n'), ((2161, 2188), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2178, 2188), False, 'import logging\n'), ((2578, 2608... |
# -*- coding: utf-8 -*-
"""
Global app forms
"""
# Standard Library
import re
# Django Library
from django import forms
from django.contrib.auth.forms import UserChangeForm, UserCreationForm
from django.utils.translation import ugettext_lazy as _
# Thirdparty Library
from dal import autocomplete
# Localfolder Librar... | [
"django.utils.translation.ugettext_lazy",
"django.forms.IntegerField",
"django.forms.CharField",
"django.forms.TextInput"
] | [((5135, 5192), 'django.forms.CharField', 'forms.CharField', ([], {'max_length': '(100)', 'widget': 'forms.HiddenInput'}), '(max_length=100, widget=forms.HiddenInput)\n', (5150, 5192), False, 'from django import forms\n'), ((5209, 5253), 'django.forms.IntegerField', 'forms.IntegerField', ([], {'widget': 'forms.HiddenIn... |
from unittest import mock
import pytest
from django.http import HttpRequest
from rest_framework.response import Response
from rest_framework.test import APIClient
from drf_viewset_profiler.middleware import LineProfilerViewSetMiddleware
@pytest.fixture
def api_client():
return APIClient()
@pytest.fixture
def ... | [
"unittest.mock.Mock",
"rest_framework.test.APIClient",
"rest_framework.response.Response",
"drf_viewset_profiler.middleware.LineProfilerViewSetMiddleware",
"django.http.HttpRequest"
] | [((286, 297), 'rest_framework.test.APIClient', 'APIClient', ([], {}), '()\n', (295, 297), False, 'from rest_framework.test import APIClient\n'), ((360, 373), 'django.http.HttpRequest', 'HttpRequest', ([], {}), '()\n', (371, 373), False, 'from django.http import HttpRequest\n'), ((506, 516), 'rest_framework.response.Res... |
# This allows for running the example when the repo has been cloned
import sys
from os.path import abspath
sys.path.extend([abspath(".")])
# Example code follows
import logging
import numpy as np
import matplotlib.pyplot as plt
import muDIC.vlab as vlab
import muDIC as dic
"""
This example case runs an experiment whe... | [
"matplotlib.pyplot.ylabel",
"muDIC.vlab.SyntheticImageGenerator",
"numpy.array",
"muDIC.ImageStack",
"muDIC.Mesher",
"matplotlib.pyplot.xlabel",
"muDIC.DICAnalysis",
"matplotlib.pyplot.title",
"muDIC.vlab.rosta_speckle",
"muDIC.DICInput",
"matplotlib.pyplot.show",
"logging.basicConfig",
"mat... | [((679, 768), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(name)s:%(levelname)s:%(message)s"""', 'level': 'logging.INFO'}), "(format='%(name)s:%(levelname)s:%(message)s', level=\n logging.INFO)\n", (698, 768), False, 'import logging\n'), ((998, 1076), 'muDIC.vlab.rosta_speckle', 'vlab.rosta_sp... |
import urllib.request
from bs4 import BeautifulSoup
import csv
import requests
import os
import json
import time
import glob
files = glob.glob("/Users/nakamura/git/d_iiif/iiif/src/collections/nijl/data/json/*.json")
for i in range(len(files)):
file = files[i]
file_id = file.split("/")[-1].replace(".json", "... | [
"os.path.exists",
"requests.get",
"glob.glob",
"json.load",
"json.dump"
] | [((134, 221), 'glob.glob', 'glob.glob', (['"""/Users/nakamura/git/d_iiif/iiif/src/collections/nijl/data/json/*.json"""'], {}), "(\n '/Users/nakamura/git/d_iiif/iiif/src/collections/nijl/data/json/*.json')\n", (143, 221), False, 'import glob\n'), ((434, 455), 'os.path.exists', 'os.path.exists', (['opath'], {}), '(opa... |
import numpy as np
from sawyer.mujoco.tasks.base import ComposableTask
class TransitionTask(ComposableTask):
"""
Task to pick up an object with the robot gripper.
Success condition:
- Object is grasped and has been lifted above the table
"""
def __init__(self):
pass
def compute_... | [
"numpy.array",
"numpy.linalg.norm"
] | [((1431, 1470), 'numpy.linalg.norm', 'np.linalg.norm', (['(box_pos - goal)'], {'axis': '(-1)'}), '(box_pos - goal, axis=-1)\n', (1445, 1470), True, 'import numpy as np\n'), ((1369, 1391), 'numpy.array', 'np.array', (['[0, 0, 0.04]'], {}), '([0, 0, 0.04])\n', (1377, 1391), True, 'import numpy as np\n')] |
import arcade
import os
SPRITE_SCALING = 0.5
SPRITE_NATIVE_SIZE = 128
SPRITE_SIZE = int(SPRITE_NATIVE_SIZE * SPRITE_SCALING)
SCREEN_WIDTH = SPRITE_SIZE * 14
SCREEN_HEIGHT = SPRITE_SIZE * 10
MOVEMENT_SPEED = 5
COIN_SCALE = 0.7
class Room:
"""
This class holds all the information about the
... | [
"arcade.draw_text",
"arcade.draw_texture_rectangle",
"arcade.check_for_collision_with_list",
"arcade.load_texture",
"arcade.start_render",
"arcade.load_sound",
"os.chdir",
"arcade.PhysicsEngineSimple",
"arcade.AnimatedWalkingSprite",
"arcade.run",
"os.path.abspath",
"arcade.SpriteList",
"arc... | [((1087, 1106), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\n', (1104, 1106), False, 'import arcade\n'), ((1129, 1148), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\n', (1146, 1148), False, 'import arcade\n'), ((1171, 1190), 'arcade.SpriteList', 'arcade.SpriteList', ([], {}), '()\n', (1188, 1190)... |
# Copyright (c) 2018 gevent community
#
# 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, modify, merge, publish, di... | [
"os.path.exists",
"re.split",
"os.listdir",
"os.close",
"psutil.Process",
"unittest.SkipTest",
"os.getpid",
"os.system",
"tempfile.mkstemp",
"os.remove"
] | [((2976, 3000), 'os.path.exists', 'os.path.exists', (['"""/proc/"""'], {}), "('/proc/')\n", (2990, 3000), False, 'import os\n'), ((1343, 1392), 'unittest.SkipTest', 'unittest.SkipTest', (['"""lsof not expected on Windows"""'], {}), "('lsof not expected on Windows')\n", (1360, 1392), False, 'import unittest\n'), ((1458,... |
from django.contrib.messages.constants import DEFAULT_LEVELS
from user_messages.api import get_messages
def messages(request):
"""
Return a lazy 'messages' context variable as well as
'DEFAULT_MESSAGE_LEVELS'.
"""
return {
"messages": get_messages(request=request),
"DEFAULT_MESSAG... | [
"user_messages.api.get_messages"
] | [((266, 295), 'user_messages.api.get_messages', 'get_messages', ([], {'request': 'request'}), '(request=request)\n', (278, 295), False, 'from user_messages.api import get_messages\n')] |
# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ..events import events_plot
from ..stats import standardize as nk_standardize
def signal_plot(
signal, sampling_rate=None, subplots=False, standardize=False, labels=None, **kwargs
):
"""Plot signal with events... | [
"matplotlib.pyplot.xlabel",
"numpy.diff",
"numpy.array",
"pandas.DataFrame",
"pandas.concat",
"matplotlib.pyplot.legend"
] | [((5581, 5606), 'matplotlib.pyplot.legend', 'plt.legend', (['labels'], {'loc': '(1)'}), '(labels, loc=1)\n', (5591, 5606), True, 'import matplotlib.pyplot as plt\n'), ((2079, 2093), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (2091, 2093), True, 'import pandas as pd\n'), ((2599, 2631), 'pandas.DataFrame', 'pd... |
"""Only one validation per mission, user and actor
Revision ID: <KEY>
Revises: <KEY>
Create Date: 2021-10-14 11:22:01.124488
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "<KEY>"
branch_labels = None
depends_on = None
def upgrade():
... | [
"alembic.op.drop_constraint",
"alembic.op.execute"
] | [((324, 728), 'alembic.op.execute', 'op.execute', (['"""\n WITH validation_duplicates AS (\n SELECT\n id,\n ROW_NUMBER() OVER (PARTITION BY user_id, mission_id, submitter_id ORDER BY reception_time DESC) AS rn\n FROM mission_validation\n )\n DELET... |
# Copyright 2020 <NAME> (Falcons)
# SPDX-License-Identifier: Apache-2.0
#!/usr/bin/python
import os
import sys
import argparse
from rtdb2 import RtDB2Store, RTDB2_DEFAULT_PATH
import rtdb2tools
from hexdump import hexdump
# Main structure of the program
if __name__ == "__main__":
# Argument parsing.
descript... | [
"rtdb2tools.guessAgentId",
"rtdb2.RtDB2Store",
"argparse.ArgumentParser",
"hexdump.hexdump"
] | [((938, 1066), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'descriptionTxt', 'epilog': 'exampleTxt', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), '(description=descriptionTxt, epilog=exampleTxt,\n formatter_class=argparse.RawDescriptionHelpFormatter)\n', (961, 1066), Fa... |
from __future__ import print_function
from __future__ import division
import os
import gym
import numpy as np
from skimage.transform import resize
from skimage.color import rgb2gray
class Atari(object):
s_dim = [84, 84, 1]
a_dim = 3
def __init__(self, args, record_video=False):
self.env = gym.m... | [
"os.path.exists",
"skimage.color.rgb2gray",
"numpy.reshape",
"os.makedirs",
"os.path.join",
"numpy.append",
"numpy.random.randint",
"gym.wrappers.Monitor",
"gym.make"
] | [((315, 349), 'gym.make', 'gym.make', (['"""BreakoutNoFrameskip-v4"""'], {}), "('BreakoutNoFrameskip-v4')\n", (323, 349), False, 'import gym\n'), ((2046, 2097), 'numpy.reshape', 'np.reshape', (['observ'], {'newshape': '(self.screen_size + [1])'}), '(observ, newshape=self.screen_size + [1])\n', (2056, 2097), True, 'impo... |
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | [
"logging.basicConfig",
"mxnet.callback.Speedometer",
"model.matrix_fact_model_parallel_net",
"argparse.ArgumentParser",
"mxnet.gluon.metric.create",
"mxnet.cpu",
"get_data.get_movielens_data",
"mxnet.init.Xavier",
"mxnet.gpu",
"get_data.get_movielens_iter",
"logging.info"
] | [((978, 1018), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (997, 1018), False, 'import logging\n'), ((1029, 1184), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run model parallel version of matrix factorization"""', 'format... |
#!/usr/bin/env python3
import shlex
from tkinter import *
from tkinter import messagebox
from psutil import Popen
top = Tk()
top.title("Franka Gripper Control")
top.geometry("300x75")
def open():
node_process = Popen(shlex.split('rosrun franka_interactive_controllers libfranka_gripper_run 1'))
messagebox.showinfo... | [
"shlex.split",
"tkinter.messagebox.showinfo"
] | [((301, 354), 'tkinter.messagebox.showinfo', 'messagebox.showinfo', (['"""Open Gripper"""', '"""Gripper Opened"""'], {}), "('Open Gripper', 'Gripper Opened')\n", (320, 354), False, 'from tkinter import messagebox\n'), ((499, 553), 'tkinter.messagebox.showinfo', 'messagebox.showinfo', (['"""Close Gripper"""', '"""Grippe... |
#!/usr/bin/env python
"""This tool builds or repacks the client binaries.
This handles invocations for the build across the supported platforms including
handling Visual Studio, pyinstaller and other packaging mechanisms.
"""
import logging
import os
import platform
import time
# pylint: disable=unused-import
from ... | [
"logging.getLogger",
"logging.StreamHandler",
"grr.lib.flags.StartMain",
"grr.lib.config_lib.CONFIG.MatchBuildContext",
"grr.lib.config_lib.ImportConfigManger",
"grr.lib.config_lib.CONFIG.ExportState",
"time.strftime",
"os.path.join",
"platform.linux_distribution",
"grr.lib.config_lib.CONFIG.LoadS... | [((7005, 7041), 'time.strftime', 'time.strftime', (['"""%Y-%m-%dT%H:%M:%S%z"""'], {}), "('%Y-%m-%dT%H:%M:%S%z')\n", (7018, 7041), False, 'import time\n'), ((7800, 7851), 'grr.lib.config_lib.CONFIG.Get', 'config_lib.CONFIG.Get', (['"""ClientBuilder.BuildTargets"""'], {}), "('ClientBuilder.BuildTargets')\n", (7821, 7851)... |
# coding=utf-8
# Copyright 2022 The ML Fairness Gym Authors.
#
# 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 applicab... | [
"recsim.environments.interest_exploration.create_environment",
"environments.recommenders.recsim_wrapper.RecsimWrapper",
"absl.testing.absltest.main",
"test_util.run_test_simulation"
] | [((1814, 1829), 'absl.testing.absltest.main', 'absltest.main', ([], {}), '()\n', (1827, 1829), False, 'from absl.testing import absltest\n'), ((1269, 1305), 'environments.recommenders.recsim_wrapper.RecsimWrapper', 'recsim_wrapper.RecsimWrapper', (['params'], {}), '(params)\n', (1297, 1305), False, 'from environments.r... |
import argparse
import csv
import os
from moss_client.core import submit_and_dl, parse_moss_reports
data_folder = 'data'
def handle_input(user_id, base_folder, parse, only_parse, join_file, batch):
global data_folder
abs_path = os.path.abspath(os.path.dirname(__file__))
root_data_folder = os.path.join(ab... | [
"os.path.exists",
"csv.DictReader",
"os.path.isabs",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.join",
"os.path.dirname",
"moss_client.core.submit_and_dl",
"moss_client.core.parse_moss_reports"
] | [((305, 340), 'os.path.join', 'os.path.join', (['abs_path', 'data_folder'], {}), '(abs_path, data_folder)\n', (317, 340), False, 'import os\n'), ((448, 508), 'os.path.join', 'os.path.join', (['root_data_folder', '"""links_to_moss_reports.html"""'], {}), "(root_data_folder, 'links_to_moss_reports.html')\n", (460, 508), ... |
#!/usr/bin/python
# pylint: disable=W0223
"""
Get a list of teams
"""
from html.parser import HTMLParser
import requests
class ChkTeams(HTMLParser):
"""
Extract team names from page
"""
def __init__(self):
HTMLParser.__init__(self)
self.retval = []
def handle_starttag(self, tag, a... | [
"html.parser.HTMLParser.__init__",
"requests.get"
] | [((640, 661), 'requests.get', 'requests.get', (['DATALOC'], {}), '(DATALOC)\n', (652, 661), False, 'import requests\n'), ((232, 257), 'html.parser.HTMLParser.__init__', 'HTMLParser.__init__', (['self'], {}), '(self)\n', (251, 257), False, 'from html.parser import HTMLParser\n')] |
import frappe
@frappe.whitelist()
def filt_itemby_supplier(doctype, txt, searchfield, start, page_len, filters):
return frappe.db.sql("""Select parent from `tabItem Supplier` where supplier= %s""",(filters.get("supplier")));
@frappe.whitelist()
def filteritem(doctype, txt, searchfield, start, page_len, filters... | [
"frappe.whitelist",
"frappe.db.sql"
] | [((17, 35), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (33, 35), False, 'import frappe\n'), ((235, 253), 'frappe.whitelist', 'frappe.whitelist', ([], {}), '()\n', (251, 253), False, 'import frappe\n'), ((334, 444), 'frappe.db.sql', 'frappe.db.sql', (['"""select item_code, item_name, item_group, volume, i... |
import os
import sys
import unittest
# Set Python search path to the parent directory
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from lib.config import *
class TestLibConfig(unittest.TestCase):
def test_config_noconfigfile(self):
config = BeaconConfigParser('not_exist.cfg')
wit... | [
"unittest.main",
"os.path.dirname"
] | [((974, 1000), 'unittest.main', 'unittest.main', ([], {'buffer': '(True)'}), '(buffer=True)\n', (987, 1000), False, 'import unittest\n'), ((116, 141), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (131, 141), False, 'import os\n')] |
from kivy.uix.screenmanager import ScreenManager
from kivy.uix.boxlayout import BoxLayout
from kivy.lang.builder import Builder
from kivy.animation import Animation
from kivy.core.window import Window
from kivymd.app import MDApp
import kivymd
import kivy
print(
)
def version():
kivy.require('2.0.0')
print(
) | [
"kivy.require"
] | [((287, 308), 'kivy.require', 'kivy.require', (['"""2.0.0"""'], {}), "('2.0.0')\n", (299, 308), False, 'import kivy\n')] |
import functools
import itertools
import numbers
from ..backend_object import BackendObject
from ..annotation import Annotation
def normalize_types_two_args(f):
@functools.wraps(f)
def normalizer(self, region, o):
"""
Convert any object to an object that we can process.
"""
if ... | [
"itertools.count",
"functools.wraps"
] | [((965, 982), 'itertools.count', 'itertools.count', ([], {}), '()\n', (980, 982), False, 'import itertools\n'), ((168, 186), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (183, 186), False, 'import functools\n'), ((653, 671), 'functools.wraps', 'functools.wraps', (['f'], {}), '(f)\n', (668, 671), False, '... |
import logging
from episodes import find_updates, db, count_all
from logging import error as logi
from flask import Flask, jsonify, request
def create_app(config, debug=False, testing=False, config_overrides=None):
app = Flask(__name__)
app.config.from_object(config)
app.config['JSON_AS_ASCII'] = False
... | [
"logging.basicConfig",
"flask.request.args.get",
"scraper.update_episodes",
"flask.Flask",
"episodes.db.close",
"episodes.db.connect",
"episodes.find_updates",
"episodes.count_all",
"logging.error",
"flask.request.headers.get",
"flask.jsonify"
] | [((228, 243), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (233, 243), False, 'from flask import Flask, jsonify, request\n'), ((495, 534), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (514, 534), False, 'import logging\n'), ((594, 606), 'episode... |
# -*- coding: utf-8 -*-
# catapult: runs python scripts in already running processes to eliminate the
# python interpreter startup time.
#
# The lexicon for sparv.saldo.annotate and sparv.saldo.compound can be pre-loaded and
# shared between processes. See the variable annotators in handle and start.
#
# Run scripts in... | [
"logging.basicConfig",
"os.path.exists",
"logging.getLogger",
"sparv.util.run.main",
"socket.socket",
"re.compile",
"multiprocessing.Process",
"multiprocessing.cpu_count",
"os.getcwd",
"os.chdir",
"runpy.run_module",
"builtins.range",
"sparv.util.PickledLexicon",
"sparv.util.system.kill_pr... | [((843, 911), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(process)d %(asctime)-15s %(message)s"""'}), "(format='%(process)d %(asctime)-15s %(message)s')\n", (862, 911), False, 'import logging\n'), ((918, 945), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (935, 94... |
import datetime
def iso_extract_info(string):
"""
Will get all of the info and return it as an array
:param string: ISO formatted string that will be used for extraction
:return: array [year, month, day, military_time_hour, minutes, hours]
:note: every item is an int except for minutes
... | [
"datetime.date"
] | [((3981, 4024), 'datetime.date', 'datetime.date', (['year_int', 'month_int', 'day_int'], {}), '(year_int, month_int, day_int)\n', (3994, 4024), False, 'import datetime\n'), ((5018, 5061), 'datetime.date', 'datetime.date', (['year_int', 'month_int', 'day_int'], {}), '(year_int, month_int, day_int)\n', (5031, 5061), Fals... |
from django.urls import path
from issue_template.views import IssueTemplateView
urlpatterns = [
path(
'<str:owner>/<str:repo>/<str:token_auth>/',
IssueTemplateView.as_view()
),
]
| [
"issue_template.views.IssueTemplateView.as_view"
] | [((168, 195), 'issue_template.views.IssueTemplateView.as_view', 'IssueTemplateView.as_view', ([], {}), '()\n', (193, 195), False, 'from issue_template.views import IssueTemplateView\n')] |
import collections
import nltk
import os
from sklearn import (
datasets, model_selection, feature_extraction, linear_model, naive_bayes,
ensemble
)
def extract_features(corpus):
'''Extract TF-IDF features from corpus'''
sa_stop_words = nltk.corpus.stopwords.words("english")
# words that might in... | [
"sklearn.feature_extraction.text.TfidfTransformer",
"sklearn.linear_model.SGDClassifier",
"sklearn.ensemble.VotingClassifier",
"nltk.corpus.stopwords.words",
"sklearn.model_selection.train_test_split",
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.datasets.load_files",
"sklearn.linear_mo... | [((1548, 1597), 'sklearn.datasets.load_files', 'datasets.load_files', (['data_directory'], {'shuffle': '(True)'}), '(data_directory, shuffle=True)\n', (1567, 1597), False, 'from sklearn import datasets, model_selection, feature_extraction, linear_model, naive_bayes, ensemble\n'), ((1854, 1964), 'sklearn.model_selection... |
# Copyright (c) 2021, NVIDIA CORPORATION & 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.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requ... | [
"nemo.collections.tts.torch.helpers.general_padding",
"torch.from_numpy",
"transformers.AlbertTokenizer.from_pretrained",
"nemo.utils.logging.info",
"pathlib.Path",
"torch.cuda.amp.autocast",
"torch.view_as_real",
"torch.finfo",
"json.loads",
"pickle.load",
"librosa.filters.mel",
"torch.save",... | [((11774, 11822), 'nemo.collections.asr.parts.preprocessing.features.WaveformFeaturizer', 'WaveformFeaturizer', ([], {'sample_rate': 'self.sample_rate'}), '(sample_rate=self.sample_rate)\n', (11792, 11822), False, 'from nemo.collections.asr.parts.preprocessing.features import WaveformFeaturizer\n'), ((13421, 13442), 't... |
from flask import Flask, request, jsonify
from flask_cors import CORS
from run import run_ansys
from api.validate import spec_present, data_type_validate, spec_keys_validate, ansys_overload_check
ansys_processing_count = 0
# debug
# import ipdb; ipdb.set_trace()
app = Flask(__name__)
CORS(app) # local development co... | [
"flask_cors.CORS",
"flask.Flask",
"api.validate.spec_keys_validate",
"flask.request.get_json",
"api.validate.ansys_overload_check",
"api.validate.data_type_validate",
"api.validate.spec_present",
"run.run_ansys",
"flask.jsonify"
] | [((271, 286), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (276, 286), False, 'from flask import Flask, request, jsonify\n'), ((287, 296), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (291, 296), False, 'from flask_cors import CORS\n'), ((1035, 1059), 'flask.jsonify', 'jsonify', (["ctx['response'... |
from django.db import models
class Category(models.Model):
title = models.CharField(max_length=20)
class Meta:
db_table = 'category'
verbose_name = ("Category")
verbose_name_plural = ("Categories")
def __str__(self):
return self.title
| [
"django.db.models.CharField"
] | [((77, 108), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)'}), '(max_length=20)\n', (93, 108), False, 'from django.db import models\n')] |