code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from http.server import BaseHTTPRequestHandler,HTTPServer
from socketserver import ThreadingMixIn
import threading
import subprocess
import urllib.parse
# todo: factor out common server stuff
# todo: these should probably have limited
# access to files, so something like only
# uploads dir may be good.
# then there i... | [
"subprocess.Popen"
] | [((1828, 1854), 'subprocess.Popen', 'subprocess.Popen', (['cmd_list'], {}), '(cmd_list)\n', (1844, 1854), False, 'import subprocess\n')] |
from solution import str_range
def test_same_start_end():
r = str_range('a', 'a')
assert iter(r) == r
assert ''.join(list(r)) == 'a'
def test_simple():
r = str_range('a', 'c')
assert ''.join(list(r)) == 'abc'
def test_simple_with_step():
r = str_range('a', 'c', 2)
assert ''.join(list(r... | [
"solution.str_range"
] | [((68, 87), 'solution.str_range', 'str_range', (['"""a"""', '"""a"""'], {}), "('a', 'a')\n", (77, 87), False, 'from solution import str_range\n'), ((176, 195), 'solution.str_range', 'str_range', (['"""a"""', '"""c"""'], {}), "('a', 'c')\n", (185, 195), False, 'from solution import str_range\n'), ((272, 294), 'solution.... |
#MenuTitle: Find And Replace In Anchor Names
# -*- coding: utf-8 -*-
from __future__ import division, print_function, unicode_literals
from builtins import str
__doc__="""
Replaces strings in anchor names of all selected glyphs.
"""
import vanilla
class SearchAndReplaceInAnchorNames( object ):
def __init__( self ):... | [
"vanilla.EditText",
"vanilla.FloatingWindow",
"vanilla.TextBox",
"vanilla.Button"
] | [((523, 815), 'vanilla.FloatingWindow', 'vanilla.FloatingWindow', (['(windowWidth, windowHeight)', '"""Search And Replace In Anchor Names"""'], {'minSize': '(windowWidth, windowHeight)', 'maxSize': '(windowWidth + windowWidthResize, windowHeight + windowHeightResize)', 'autosaveName': '"""com.mekkablue.SearchAndReplace... |
#!/usr/bin/python
# Copyright 2018 GRAIL, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | [
"subprocess.check_output",
"json.loads",
"os.getenv",
"shlex.split",
"subprocess.Popen",
"os.chdir",
"os.path.realpath",
"sys.exit",
"os.path.abspath",
"re.sub",
"os.path.relpath"
] | [((1188, 1224), 'os.getenv', 'os.getenv', (['"""BAZEL_COMPDB_BAZEL_PATH"""'], {}), "('BAZEL_COMPDB_BAZEL_PATH')\n", (1197, 1224), False, 'import os\n'), ((2039, 2090), 'subprocess.Popen', 'subprocess.Popen', (['query_cmd'], {'stdout': 'subprocess.PIPE'}), '(query_cmd, stdout=subprocess.PIPE)\n', (2055, 2090), False, 'i... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import argparse
import glob
import os
import pygame
import random
import subprocess
import time
import maze_map
MIN_MARGIN = 32
PROGRESS_BAR_HEIGHT = 8
SELF_DIR = os.path.dirname(os.path.realpath(__file__))
class Game:
def __init__(self, map_size: int, maze: bool... | [
"pygame.init",
"pygame.quit",
"pygame.key.get_mods",
"pygame.mixer.music.set_volume",
"argparse.ArgumentParser",
"pygame.display.set_mode",
"pygame.display.flip",
"subprocess.Popen",
"maze_map.MazeMap",
"pygame.image.load",
"pygame.mixer.music.load",
"pygame.Rect",
"glob.glob",
"random.cho... | [((229, 255), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (245, 255), False, 'import os\n'), ((8055, 8099), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Snake"""'}), "(description='Snake')\n", (8078, 8099), False, 'import argparse\n'), ((8313, 8326), 'py... |
from flask import Flask, render_template, flash,request,redirect,url_for
from flask_sqlalchemy import SQLAlchemy
from flaskmodel.config import *
from flask_wtf import FlaskForm
from wtforms import StringField,SubmitField
from wtforms.validators import DataRequired
app = Flask(__name__)
# 创建数据库连接
db = SQLAlchemy(app)
... | [
"flask.render_template",
"flask.flash",
"flask.Flask",
"wtforms.SubmitField",
"flask.url_for",
"flask_sqlalchemy.SQLAlchemy",
"wtforms.validators.DataRequired"
] | [((272, 287), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (277, 287), False, 'from flask import Flask, render_template, flash, request, redirect, url_for\n'), ((303, 318), 'flask_sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (313, 318), False, 'from flask_sqlalchemy import SQLAlchemy\n... |
from typing import Union, List, Optional, Tuple, Set
from hwt.hdl.operator import Operator
from hwt.hdl.operatorDefs import AllOps
from hwt.hdl.portItem import HdlPortItem
from hwt.hdl.statements.assignmentContainer import HdlAssignmentContainer
from hwt.hdl.statements.codeBlockContainer import HdlStmCodeBlockContaine... | [
"hwtHls.ssa.basicBlock.SsaBasicBlock.__init__",
"hwtHls.ssa.basicBlock.SsaBasicBlock",
"hwtHls.ssa.instr.SsaInstr",
"hwtHls.hlsStreamProc.statements.HlsStreamProcWhile",
"hwtHls.ssa.translation.fromAst.memorySSAUpdater.MemorySSAUpdater"
] | [((1344, 1384), 'hwtHls.ssa.basicBlock.SsaBasicBlock.__init__', 'SsaBasicBlock.__init__', (['self', 'ctx', 'label'], {}), '(self, ctx, label)\n', (1366, 1384), False, 'from hwtHls.ssa.basicBlock import SsaBasicBlock\n'), ((3187, 3224), 'hwtHls.ssa.basicBlock.SsaBasicBlock', 'SsaBasicBlock', (['ssaCtx', 'startBlockName'... |
import io
import unittest
from unittest.mock import patch
from kattis import k_apaxiaaans
###############################################################################
class SampleInput(unittest.TestCase):
'''Problem statement sample inputs and outputs'''
def test_sample_input_1(self):
'''Run and a... | [
"unittest.main",
"kattis.k_apaxiaaans.main",
"io.StringIO",
"unittest.mock.patch"
] | [((1719, 1734), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1732, 1734), False, 'import unittest\n'), ((509, 554), 'unittest.mock.patch', 'patch', (['"""sys.stdout"""'], {'new_callable': 'io.StringIO'}), "('sys.stdout', new_callable=io.StringIO)\n", (514, 554), False, 'from unittest.mock import patch\n'), ((57... |
"""
# !/usr/bin/env python
# -*- coding: utf-8 -*-
@Time : 2022/2/24 20:12
@Author : <EMAIL>
@ProjectName : udacity-program_self_driving_car_engineer_v1.0_source.0
@File : full_pipeline.py
"""
import numpy as np
import cv2
import os
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
im... | [
"cv2.rectangle",
"numpy.hstack",
"numpy.polyfit",
"matplotlib.image.imread",
"cv2.imshow",
"numpy.array",
"cv2.warpPerspective",
"cv2.destroyAllWindows",
"cv2.calibrateCamera",
"cv2.findChessboardCorners",
"numpy.mean",
"os.listdir",
"cv2.undistort",
"numpy.max",
"cv2.addWeighted",
"nu... | [((442, 482), 'glob.glob', 'glob.glob', (['"""camera_cal/calibration*.jpg"""'], {}), "('camera_cal/calibration*.jpg')\n", (451, 482), False, 'import glob\n'), ((560, 592), 'numpy.zeros', 'np.zeros', (['(6 * 9, 3)', 'np.float32'], {}), '((6 * 9, 3), np.float32)\n', (568, 592), True, 'import numpy as np\n'), ((1607, 1680... |
"""Author: Trinity Core Team
MIT License
Copyright (c) 2018 Trinity
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,... | [
"re.split",
"json.loads",
"json.dumps",
"copy.deepcopy"
] | [((1359, 1380), 're.split', 're.split', (['"""[@:]"""', 'uri'], {}), "('[@:]', uri)\n", (1367, 1380), False, 'import re\n'), ((2413, 2432), 'json.loads', 'json.loads', (['tr_json'], {}), '(tr_json)\n', (2423, 2432), False, 'import json\n'), ((2577, 2596), 'json.loads', 'json.loads', (['tr_json'], {}), '(tr_json)\n', (2... |
# ---------------------------------------------------------------------------------
# QKeithleySweep -> QVisaApplication
# Copyright (C) 2019 <NAME>
# github: https://github.com/mesoic
# email: <EMAIL>
# ---------------------------------------------------------------------------------
#
# Permission is hereby grant... | [
"PyQt5.QtWidgets.QMessageBox",
"time.sleep",
"PyQt5.QtWidgets.QStackedWidget",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QComboBox",
"numpy.where",
"PyQt5.QtWidgets.QLabel",
"PyQtVisa.widgets.QVisaUnitSelector.QVisaUnitSelector",
"numpy.concatenate",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.Q... | [((5102, 5115), 'PyQt5.QtWidgets.QHBoxLayout', 'QHBoxLayout', ([], {}), '()\n', (5113, 5115), False, 'from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QHBoxLayout, QMessageBox, QComboBox, QSpinBox, QDoubleSpinBox, QPushButton, QCheckBox, QLabel, QLineEdit, QStackedWidget, QSizePolicy\n'), ((5533, 5542), ... |
#!/usr/bin/python3
# RS-274X per standard Revision 2021.02
import re
import copy
import numpy as np
import vertices
# TODO replace all vertices with outline class
# Meant for extracting substrings only
# Cast to int or float will catch invalid strings
RE_INT = r'[+-]?[0-9]+'
RE_DEC = r'[+-]?[0-9\.]+?'
EXPOSURE_ON... | [
"vertices.rotate",
"numpy.flip",
"vertices.rounded_arc",
"vertices.thick_line",
"vertices.translate",
"vertices.regular_poly",
"vertices.rounded_line",
"vertices.OutlineVertices",
"vertices.circle",
"numpy.array",
"vertices.rectangle",
"copy.copy",
"re.search"
] | [((5454, 5517), 're.search', 're.search', (['"""%FSLAX([1-6])([3-6])Y([1-6])([3-6])\\\\*%"""', 'statement'], {}), "('%FSLAX([1-6])([3-6])Y([1-6])([3-6])\\\\*%', statement)\n", (5463, 5517), False, 'import re\n'), ((7133, 7212), 're.search', 're.search', (['f"""(X{RE_INT})?(Y{RE_INT})?(I{RE_INT})?(J{RE_INT})?D01\\\\*"""... |
from functools import partial
from typing import Callable
from typing import TYPE_CHECKING
from ...config import Conf
from .menu import Menu, MenuEntry, MenuSeparator
if TYPE_CHECKING:
from ...ui.views.disassembly_view import DisassemblyView
class DisasmInsnContextMenu(Menu):
"""
Dissembly Instruction's ... | [
"functools.partial"
] | [((3178, 3201), 'functools.partial', 'partial', (['callback', 'self'], {}), '(callback, self)\n', (3185, 3201), False, 'from functools import partial\n')] |
from requests.exceptions import ConnectionError
from panoptes.pocs import __version__
from panoptes.utils.database import PanDB
from panoptes.utils.config import client
from panoptes.pocs.utils.logger import get_logger
from panoptes.pocs import hardware
# Global database.
PAN_DB_OBJ = None
class PanBase(object):
... | [
"panoptes.utils.config.client.get_config",
"panoptes.utils.database.PanDB",
"panoptes.utils.config.client.set_config",
"panoptes.pocs.utils.logger.get_logger"
] | [((631, 643), 'panoptes.pocs.utils.logger.get_logger', 'get_logger', ([], {}), '()\n', (641, 643), False, 'from panoptes.pocs.utils.logger import get_logger\n'), ((968, 1007), 'panoptes.utils.database.PanDB', 'PanDB', ([], {'db_type': 'db_type', 'db_name': 'db_name'}), '(db_type=db_type, db_name=db_name)\n', (973, 1007... |
"""A wrapper env that handles multiple tasks from different envs.
Useful while training multi-task reinforcement learning algorithms.
It provides observations augmented with one-hot representation of tasks.
"""
import random
import akro
import gym
import numpy as np
def round_robin_strategy(num_tasks, last_task=No... | [
"numpy.prod",
"numpy.ones",
"numpy.zeros",
"numpy.concatenate",
"akro.Box",
"random.randint"
] | [((896, 928), 'random.randint', 'random.randint', (['(0)', '(num_tasks - 1)'], {}), '(0, num_tasks - 1)\n', (910, 928), False, 'import random\n'), ((1566, 1606), 'numpy.prod', 'np.prod', (['envs[0].observation_space.shape'], {}), '(envs[0].observation_space.shape)\n', (1573, 1606), True, 'import numpy as np\n'), ((2630... |
import numpy as np
import pandas as pd
import warnings
warnings.simplefilter(action='ignore', category=FutureWarning)
from sklearn.model_selection import train_test_split, cross_validate
from sklearn.preprocessing import OneHotEncoder, StandardScaler, OrdinalEncoder
from sklearn.impute import SimpleImputer
from sklearn... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"sklearn.preprocessing.OneHotEncoder",
"sklearn.model_selection.cross_validate",
"sklearn.compose.make_column_transformer",
"sklearn.preprocessing.StandardScaler",
"sklearn.impute.SimpleImputer",
"warnings.simplefilter",
"sklearn.svm.SVC... | [((55, 117), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'FutureWarning'}), "(action='ignore', category=FutureWarning)\n", (76, 117), False, 'import warnings\n'), ((491, 522), 'pandas.read_csv', 'pd.read_csv', (['"""data/pokemon.csv"""'], {}), "('data/pokemon.csv')\n", ... |
import numpy as np
np.random.seed(10)
import matplotlib.pyplot as plt
from mpi4py import MPI
# For shared memory deployment: `export OPENBLAS_NUM_THREADS=1`
# Method of snapshots
def generate_right_vectors(A):
'''
A - Snapshot matrix - shape: NxS
returns V - truncated right singular vectors
'''
ne... | [
"matplotlib.pyplot.ylabel",
"numpy.save",
"numpy.linalg.qr",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.matmul",
"numpy.random.seed",
"numpy.concatenate",
"numpy.random.normal",
"numpy.abs",
"numpy.linalg.eig",
"numpy.argmax",
"numpy.linalg.svd",
"matplotlib.pyplot.title"... | [((19, 37), 'numpy.random.seed', 'np.random.seed', (['(10)'], {}), '(10)\n', (33, 37), True, 'import numpy as np\n'), ((368, 390), 'numpy.linalg.eig', 'np.linalg.eig', (['new_mat'], {}), '(new_mat)\n', (381, 390), True, 'import numpy as np\n'), ((434, 459), 'numpy.argmax', 'np.argmax', (['(svals < 0.0001)'], {}), '(sva... |
import html
import json
import re
from datetime import date
from autoslug import AutoSlugField
from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.core.validators import MinLengthValidator
from django.db.models.aggregates import Count
from django.db import models
fr... | [
"django.utils.text.slugify",
"json.loads",
"pycompanies.models.UserCompanyProfile.objects.filter",
"django.utils.translation.gettext",
"django.contrib.contenttypes.models.ContentType.objects.get",
"django.db.models.ForeignKey",
"autoslug.AutoSlugField",
"html.unescape",
"django.db.models.Q",
"djan... | [((4512, 4561), 'autoslug.AutoSlugField', 'AutoSlugField', ([], {'populate_from': '"""title"""', 'unique': '(True)'}), "(populate_from='title', unique=True)\n", (4525, 4561), False, 'from autoslug import AutoSlugField\n'), ((9125, 9178), 'django.db.models.ForeignKey', 'models.ForeignKey', (['JobOffer'], {'on_delete': '... |
# Copyright 2015, 2017 IBM Corp.
#
# 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 require... | [
"mock.patch",
"mock.Mock",
"nova_powervm.virt.powervm.mgmt.discover_vscsi_disk",
"nova_powervm.virt.powervm.mgmt.remove_block_dev",
"pypowervm.tests.test_utils.pvmhttp.load_pvm_resp",
"mock.call",
"nova_powervm.virt.powervm.mgmt.mgmt_uuid",
"pypowervm.tests.test_fixtures.AdapterFx"
] | [((1344, 1417), 'mock.patch', 'mock.patch', (['"""pypowervm.tasks.partition.get_this_partition"""'], {'autospec': '(True)'}), "('pypowervm.tasks.partition.get_this_partition', autospec=True)\n", (1354, 1417), False, 'import mock\n'), ((1962, 2000), 'mock.patch', 'mock.patch', (['"""glob.glob"""'], {'autospec': '(True)'... |
import random
from plugin import plugin
ANSWERS = [
"No",
"Yes",
"You Can Do It!",
"I Cant Help You",
"Sorry To hear That, But You Must Forget :(",
"Keep It Up!",
"Nice",
"Dont Do It Ever Again",
"I Like It, Good Job",
"I Am Not Certain",
"Too Bad For You, Try To Find Something Else To Do And Enj... | [
"plugin.plugin"
] | [((556, 580), 'plugin.plugin', 'plugin', (['"""give me advice"""'], {}), "('give me advice')\n", (562, 580), False, 'from plugin import plugin\n')] |
import argparse
from ucsmsdk.ucshandle import UcsHandle
from ucsmsdk.mometa.vnic.VnicEtherIf import VnicEtherIf
from ucsmsdk.mometa.fabric.FabricVlan import FabricVlan
parser = argparse.ArgumentParser()
parser.add_argument('ucsm_ip')
parser.add_argument('username')
parser.add_argument('password')
parser.add_argument('... | [
"ucsmsdk.ucshandle.UcsHandle",
"argparse.ArgumentParser"
] | [((178, 203), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (201, 203), False, 'import argparse\n'), ((520, 573), 'ucsmsdk.ucshandle.UcsHandle', 'UcsHandle', (['args.ucsm_ip', 'args.username', 'args.password'], {}), '(args.ucsm_ip, args.username, args.password)\n', (529, 573), False, 'from ucs... |
# Copyright (c) 2012 - 2015 <NAME>, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
from pytest import raises
from jenkinsflow.flow import serial, parallel, FailedChildJobException, FailedChildJobsException, Propagation, BuildResult
from .framework import api_select
from .framewo... | [
"jenkinsflow.flow.serial",
"jenkinsflow.flow.parallel",
"pytest.raises"
] | [((852, 980), 'jenkinsflow.flow.serial', 'serial', (['api'], {'timeout': '(70)', 'job_name_prefix': 'api.job_name_prefix', 'report_interval': '(3)', 'propagation': 'Propagation.FAILURE_TO_UNSTABLE'}), '(api, timeout=70, job_name_prefix=api.job_name_prefix,\n report_interval=3, propagation=Propagation.FAILURE_TO_UNST... |
import torch
from torch import nn
from net.init_net import xavier_init
from net.basic_cnn import DWConvBnReluPool
"""
DW-DW-PW
"""
class Head(nn.Module):
def __init__(self,reg_max = 8, #defalut =8个bbox,用于分布, general focal loss format
inChannels = 96, #
clsOutChannels = 7):
... | [
"net.init_net.xavier_init",
"torch.nn.ModuleList",
"net.basic_cnn.DWConvBnReluPool",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torchsummary.summary"
] | [((1402, 1430), 'torchsummary.summary', 'summary', (['net', '(96, 320, 320)'], {}), '(net, (96, 320, 320))\n', (1409, 1430), False, 'from torchsummary import summary\n'), ((535, 550), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (548, 550), False, 'from torch import nn\n'), ((814, 883), 'torch.nn.Conv2d', ... |
'''
THis is the main training code.
'''
import os
os.environ["CUDA_VISIBLE_DEVICES"] = "0" # set GPU id at the very begining
import argparse
import random
import math
import numpy as np
import torch
import torch.nn.parallel
import torch.optim as optim
import torch.utils.data
import torch.nn.functional as F
from torch.m... | [
"dataset.synthtext.PAN_Synth",
"torch.cuda.is_available",
"torch.multiprocessing.freeze_support",
"loss.loss.loss",
"argparse.ArgumentParser",
"models.pan.PAN",
"torch.mean",
"dataset.custom.PAN_CTW",
"torch.set_num_threads",
"numpy.random.seed",
"sys.stdout.flush",
"dataset.ic15.PAN_IC15",
... | [((647, 671), 'torch.set_num_threads', 'torch.set_num_threads', (['(2)'], {}), '(2)\n', (668, 671), False, 'import torch\n'), ((720, 736), 'torch.multiprocessing.freeze_support', 'freeze_support', ([], {}), '()\n', (734, 736), False, 'from torch.multiprocessing import freeze_support\n'), ((750, 775), 'argparse.Argument... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('library', '0011_auto_20150706_0957'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
... | [
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((258, 315), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (289, 315), False, 'from django.db import models, migrations\n'), ((1484, 1530), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'to': '"""reviews.S... |
import doctest
from nose.tools import assert_equal, assert_true
from corehq.apps.fixtures.models import (
FieldList,
FixtureDataItem,
FixtureItemField,
)
from custom.abt.reports import fixture_utils
from custom.abt.reports.fixture_utils import (
dict_values_in,
fixture_data_item_to_dict,
)
def t... | [
"corehq.apps.fixtures.models.FieldList",
"nose.tools.assert_true",
"custom.abt.reports.fixture_utils.dict_values_in",
"doctest.testmod",
"custom.abt.reports.fixture_utils.fixture_data_item_to_dict",
"nose.tools.assert_equal",
"corehq.apps.fixtures.models.FixtureItemField"
] | [((407, 436), 'custom.abt.reports.fixture_utils.dict_values_in', 'dict_values_in', (['swallow', 'None'], {}), '(swallow, None)\n', (421, 436), False, 'from custom.abt.reports.fixture_utils import dict_values_in, fixture_data_item_to_dict\n'), ((441, 460), 'nose.tools.assert_true', 'assert_true', (['result'], {}), '(res... |
import os, sys
sys.path.append(os.getcwd())
import time
import numpy as np
import tensorflow as tf
import tflib as lib
import tflib.ops.linear
import tflib.ops.conv2d
import tflib.ops.batchnorm
import tflib.ops.deconv2d
import tflib.save_images
import tflib.plot
import tflib.flow_handler as fh
import tflib.SINTELdata... | [
"tensorflow.div",
"tflib.plot.plot",
"tensorflow.get_variable",
"tensorflow.tanh",
"tensorflow.group",
"tflib.ops.linear.Linear",
"tflib.ops.deconv2d.Deconv2D",
"tensorflow.reduce_mean",
"tensorflow.ones_like",
"tensorflow.cast",
"numpy.mean",
"tensorflow.random_normal",
"tflib.ops.conv2d.Co... | [((4611, 4671), 'tensorflow.placeholder', 'tf.placeholder', (['tf.int32'], {'shape': '[BATCH_SIZE, 2 * OUTPUT_DIM]'}), '(tf.int32, shape=[BATCH_SIZE, 2 * OUTPUT_DIM])\n', (4625, 4671), True, 'import tensorflow as tf\n'), ((4908, 4971), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32'], {'shape': '[BATCH_SIZE,... |
# Copyright 2021 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import annotations
from dataclasses import dataclass
from pants.engine.rules import collect_rules
from pants.engine.target import (
COMMON_TARGET_FIELDS,
Dependen... | [
"pants.engine.target.generate_multiple_sources_field_help_message",
"pants.util.strutil.softwrap",
"dataclasses.dataclass",
"pants.engine.rules.collect_rules"
] | [((763, 785), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (772, 785), False, 'from dataclasses import dataclass\n'), ((634, 750), 'pants.engine.target.generate_multiple_sources_field_help_message', 'generate_multiple_sources_field_help_message', (['"""Example: `sources=[\'exampl... |
"""
@author: <NAME>
@date: 11-Jul-17
@intepreter: Python 3.6
Worst Case Analysis: Selection Sort -> O(n^2)
"""
from timeit import Timer, default_timer
from random import shuffle
ARR = list()
def selection_sort(data):
"""Selection sort implementation"""
for i in range(len(data)):
min_pos = i
... | [
"timeit.default_timer",
"timeit.Timer",
"random.shuffle"
] | [((536, 551), 'timeit.default_timer', 'default_timer', ([], {}), '()\n', (549, 551), False, 'from timeit import Timer, default_timer\n'), ((556, 568), 'random.shuffle', 'shuffle', (['ARR'], {}), '(ARR)\n', (563, 568), False, 'from random import shuffle\n'), ((897, 908), 'timeit.Timer', 'Timer', (['main'], {}), '(main)\... |
import random
import torch
import pandas as pd
import numpy as np
from glove_model import get_model
from intent_initializer import read_all_intents, read_all_responses
from GloVe_helper import GloVeLoader
PATH = './config/'
BOT_NAME = 'Bavardez'
def load_bot():
model_details = torch.load(PATH+'model_details_GloVe.pt... | [
"random.choice",
"torch.nn.Softmax",
"torch.load",
"glove_model.get_model",
"GloVe_helper.GloVeLoader",
"intent_initializer.read_all_responses",
"torch.argmax"
] | [((281, 324), 'torch.load', 'torch.load', (["(PATH + 'model_details_GloVe.pt')"], {}), "(PATH + 'model_details_GloVe.pt')\n", (291, 324), False, 'import torch\n'), ((332, 434), 'glove_model.get_model', 'get_model', (["model_details['input_size']", "model_details['hidden_size']", "model_details['output_size']"], {}), "(... |
"""
This file contains tests for plotter_utils.py.
@author: <NAME>
"""
import matplotlib.pyplot as plt
import numpy as np
import pytest
from matplotlib.figure import Figure
from gdef_reporter.plotter_styles import get_plotter_style_histogram
from gdef_reporter.plotter_utils import plot_to_ax, create_plot, plot_z_hist... | [
"gdef_reporter.plotter_utils.save_figure",
"gdef_reporter.plotter_utils.create_summary_plot",
"gdef_reporter.plotter_styles.get_plotter_style_histogram",
"gdef_reporter.plotter_utils.create_z_histogram_plot",
"gdef_reporter.plotter_utils.create_rms_plot",
"gdef_reporter.plotter_utils.plot_to_ax",
"gdef_... | [((759, 825), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(1)', '(1)'], {'dpi': 'ORIGINAL_DPI', 'figsize': 'ORIGINAL_FIGURE_SIZE'}), '(1, 1, dpi=ORIGINAL_DPI, figsize=ORIGINAL_FIGURE_SIZE)\n', (771, 825), True, 'import matplotlib.pyplot as plt\n'), ((834, 883), 'gdef_reporter.plotter_utils.plot_to_ax', 'plot_to_ax... |
import os
import sys
import configparser
class Config:
def __init__(self):
pass
#
# a simple function to read an array of configuration files into a config object
#
def read_config(self, cfg_files):
if(cfg_files != None):
config = configparser.RawConfigParser()
#... | [
"os.path.exists",
"configparser.RawConfigParser",
"os.listdir",
"sys.exit"
] | [((280, 310), 'configparser.RawConfigParser', 'configparser.RawConfigParser', ([], {}), '()\n', (308, 310), False, 'import configparser\n'), ((423, 447), 'os.path.exists', 'os.path.exists', (['cfg_file'], {}), '(cfg_file)\n', (437, 447), False, 'import os\n'), ((702, 713), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n'... |
# %%
"""
Let's get familiar with Grouping and Aggregating.
Aggregating means combining multiple pieces of data into a single result.
Mean, median or the mod are aggregating functions.
"""
import pandas as pd
# %%
df = pd.read_csv(
"developer_survey_2019/survey_results_public.csv", index_col="Respondent")... | [
"pandas.concat",
"pandas.read_csv",
"pandas.set_option"
] | [((228, 319), 'pandas.read_csv', 'pd.read_csv', (['"""developer_survey_2019/survey_results_public.csv"""'], {'index_col': '"""Respondent"""'}), "('developer_survey_2019/survey_results_public.csv', index_col=\n 'Respondent')\n", (239, 319), True, 'import pandas as pd\n'), ((334, 421), 'pandas.read_csv', 'pd.read_csv'... |
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import minmax_scale
import matplotlib.pyplot as plt
from model.loss import CategoricalCrossEntropy
from model.layers.dense import Dense
from model.layers.relu import LeakyReLU
from model.layers.softmax import Softmax
fro... | [
"model.loss.CategoricalCrossEntropy",
"model.layers.relu.LeakyReLU",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"model.layers.dense.Dense",
"numpy.zeros",
"numpy.linspace",
"sklearn.preprocessing.minmax_scale",
"model.layers.softmax.Softmax",
"numpy.cos",
... | [((1123, 1160), 'sklearn.preprocessing.minmax_scale', 'minmax_scale', (['X'], {'feature_range': '(0, 1)'}), '(X, feature_range=(0, 1))\n', (1135, 1160), False, 'from sklearn.preprocessing import minmax_scale\n'), ((2273, 2329), 'matplotlib.pyplot.plot', 'plt.plot', (['epochs', 'train_loss', '"""g"""'], {'label': '"""Tr... |
# Copyright (C) 2019 Apple Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | [
"logging.getLogger",
"signal.signal",
"os.path.dirname",
"os.path.basename",
"os.getpid",
"linecache.getline"
] | [((1405, 1432), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1422, 1432), False, 'import logging\n'), ((2804, 2842), 'signal.signal', 'signal.signal', (['signal.SIGTERM', 'handler'], {}), '(signal.SIGTERM, handler)\n', (2817, 2842), False, 'import signal\n'), ((3118, 3155), 'signal.sig... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-09-10 16:15
from __future__ import unicode_literals
from django.db import migrations, models
import django_extensions.db.fields
import items.models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
... | [
"django.db.models.ImageField",
"django.db.models.TextField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((418, 511), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (434, 511), False, 'from django.db import migrations, models\... |
from PyQt5.QtCore import Qt
from PyQt5.QtCore import QSettings
from PyQt5.QtCore import QPoint, QSize
from PyQt5.QtWidgets import QGraphicsScene
from PyQt5.QtWidgets import QMainWindow
from PyQt5.QtWidgets import QGraphicsItem
from PyQt5.QtWidgets import QAction, QApplication, QWidget
from cadnano import app
from cad... | [
"PyQt5.QtWidgets.QWidget",
"cadnano.views.sliceview.tools.slicetoolmanager.SliceToolManager",
"PyQt5.QtWidgets.QApplication.translate",
"cadnano.app",
"PyQt5.QtWidgets.QAction",
"PyQt5.QtWidgets.QWidget.resizeEvent",
"PyQt5.QtWidgets.QWidget.changeEvent",
"cadnano.views.gridview.tools.gridtoolmanager.... | [((1579, 1617), 'PyQt5.QtCore.QSettings', 'QSettings', (['"""cadnano.org"""', '"""cadnano2.5"""'], {}), "('cadnano.org', 'cadnano2.5')\n", (1588, 1617), False, 'from PyQt5.QtCore import QSettings\n'), ((4553, 4585), 'PyQt5.QtWidgets.QWidget.resizeEvent', 'QWidget.resizeEvent', (['self', 'event'], {}), '(self, event)\n'... |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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,... | [
"uhd_restpy.testplatform.sessions.ixnetwork.topology.learnedinfo.learnedinfo_ff4d5e5643a63bccb40b6cf64fc58100.LearnedInfo",
"uhd_restpy.testplatform.sessions.ixnetwork.topology.connector_d0d942810e4010add7642d3914a1f29b.Connector"
] | [((3810, 3825), 'uhd_restpy.testplatform.sessions.ixnetwork.topology.connector_d0d942810e4010add7642d3914a1f29b.Connector', 'Connector', (['self'], {}), '(self)\n', (3819, 3825), False, 'from uhd_restpy.testplatform.sessions.ixnetwork.topology.connector_d0d942810e4010add7642d3914a1f29b import Connector\n'), ((4368, 438... |
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('accounts/', include('django.contrib.auth.urls')),
path('', include('home.urls')),
path('admin/', admin.site.urls),
path('registration/medic', include('medic.urls')),
path('registration/patient', include('pa... | [
"django.urls.path",
"django.urls.include"
] | [((188, 219), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (192, 219), False, 'from django.urls import path, include\n'), ((110, 145), 'django.urls.include', 'include', (['"""django.contrib.auth.urls"""'], {}), "('django.contrib.auth.urls')\n", (117, 145), Fals... |
import requests
import re
url=input("Enter Url [ex: example.com]: ")
def getSubDomain(url):
url=url.replace("www.","").replace("https://","").replace("http://","")
pattern = "[\w]{1,256}\.[a-zA-Z0-9()]{1,6}"
_l = re.compile(pattern)
if _l.match(url):
response = requests.get(f"https://sonar.omn... | [
"requests.get",
"re.compile"
] | [((227, 246), 're.compile', 're.compile', (['pattern'], {}), '(pattern)\n', (237, 246), False, 'import re\n'), ((288, 347), 'requests.get', 'requests.get', (['f"""https://sonar.omnisint.io/subdomains/{url}"""'], {}), "(f'https://sonar.omnisint.io/subdomains/{url}')\n", (300, 347), False, 'import requests\n')] |
from django.urls import path
from .views import start_bot, end_bot
urlpatterns = [
path('startbot/', start_bot),
path('endbot/', end_bot),
] | [
"django.urls.path"
] | [((86, 114), 'django.urls.path', 'path', (['"""startbot/"""', 'start_bot'], {}), "('startbot/', start_bot)\n", (90, 114), False, 'from django.urls import path\n'), ((118, 142), 'django.urls.path', 'path', (['"""endbot/"""', 'end_bot'], {}), "('endbot/', end_bot)\n", (122, 142), False, 'from django.urls import path\n')] |
import json
import numpy as np
import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
from model import NeuralNetwork
from nltk_utils import stem, tokenize, bag_of_words
with open('./data/data.json', 'r') as f:
data = json.load(f)
all_words = []
tags = []
xy = []
for intent... | [
"torch.nn.CrossEntropyLoss",
"numpy.array",
"nltk_utils.bag_of_words",
"nltk_utils.tokenize",
"torch.cuda.is_available",
"torch.save",
"torch.utils.data.DataLoader",
"json.load",
"model.NeuralNetwork",
"nltk_utils.stem"
] | [((896, 913), 'numpy.array', 'np.array', (['x_train'], {}), '(x_train)\n', (904, 913), True, 'import numpy as np\n'), ((924, 941), 'numpy.array', 'np.array', (['y_train'], {}), '(y_train)\n', (932, 941), True, 'import numpy as np\n'), ((1468, 1547), 'torch.utils.data.DataLoader', 'DataLoader', ([], {'dataset': 'dataset... |
def voto(num):
from datetime import date
anoatual = date.today().year
idade = anoatual - num
if idade < 16:
return f"Com {idade} anos: NÃO VOTA"
elif 16 <= idade < 18 or idade > 65:
return f'Com {idade} anos: VOTO OPCIONAL'
else:
return f"Com {idade} anos: VOTO OBRIGATORI... | [
"datetime.date.today"
] | [((60, 72), 'datetime.date.today', 'date.today', ([], {}), '()\n', (70, 72), False, 'from datetime import date\n')] |
import random
import libtcodpy as libtcod
GRAY_PALETTE = [
# libtcod.Color(242, 242, 242),
libtcod.Color(204, 204, 204),
libtcod.Color(165, 165, 165),
libtcod.Color(127, 127, 127),
libtcod.Color(89, 89, 89),
]
class Tile:
"""
A tile on a map. It may or may not be blocked, and may or may ... | [
"libtcodpy.console_set_char_background",
"libtcodpy.console_put_char",
"random.choice",
"libtcodpy.console_set_char_foreground",
"random.random",
"libtcodpy.Color"
] | [((101, 129), 'libtcodpy.Color', 'libtcod.Color', (['(204)', '(204)', '(204)'], {}), '(204, 204, 204)\n', (114, 129), True, 'import libtcodpy as libtcod\n'), ((135, 163), 'libtcodpy.Color', 'libtcod.Color', (['(165)', '(165)', '(165)'], {}), '(165, 165, 165)\n', (148, 163), True, 'import libtcodpy as libtcod\n'), ((169... |
"""
Fatture in Cloud API v2 - API Reference
Connect your software with Fatture in Cloud, the invoicing platform chosen by more than 400.000 businesses in Italy. The Fatture in Cloud API is based on REST, and makes possible to interact with the user related data prior authorization via OAuth2 protocol. # noq... | [
"fattureincloud_python_sdk.model.vat_type.VatType",
"fattureincloud_python_sdk.model.list_units_of_measure_response.ListUnitsOfMeasureResponse",
"unittest.main",
"fattureincloud_python_sdk.model.list_countries_response.ListCountriesResponse",
"fattureincloud_python_sdk.model.list_product_categories_response... | [((16192, 16207), 'unittest.main', 'unittest.main', ([], {}), '()\n', (16205, 16207), False, 'import unittest\n'), ((3160, 3169), 'fattureincloud_python_sdk.api.info_api.InfoApi', 'InfoApi', ([], {}), '()\n', (3167, 3169), False, 'from fattureincloud_python_sdk.api.info_api import InfoApi\n'), ((3476, 3518), 'unittest.... |
"""
Script to convert Zarr store to the NetCDF format file.
Usage:
python zarr_to_netcdf.py -i ZarrStoreName -o NetCDFFileName
Convert Zarr data stored in ZarrStoreName to the NetCDF file NetCDFFileName.
"""
import argparse
import timeit
import warnings
import xarray as xr
from itscube_types import Coords, DataVars... | [
"timeit.default_timer",
"xarray.open_zarr",
"warnings.filterwarnings"
] | [((354, 387), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (377, 387), False, 'import warnings\n'), ((1080, 1102), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (1100, 1102), False, 'import timeit\n'), ((1215, 1263), 'xarray.open_zarr', 'xr.open_zarr'... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools
import os
class CppHttpLibConan(ConanFile):
name = "cpp-httplib"
version = "0.2.1"
url = "https://github.com/zinnion/conan-cpp-httplib"
description = "A single file C++11 header-only HTTP/HTTPS server and client l... | [
"os.rename"
] | [((711, 746), 'os.rename', 'os.rename', (['extracted_dir', '"""sources"""'], {}), "(extracted_dir, 'sources')\n", (720, 746), False, 'import os\n')] |
from rest_framework.viewsets import ReadOnlyModelViewSet
from backmarker.api.serializers.driver_serializer import DriverSerializer
from backmarker.models.driver import Driver
class DriverViewSet(ReadOnlyModelViewSet):
queryset = Driver.objects.all()
serializer_class = DriverSerializer
lookup_field = "ref... | [
"backmarker.models.driver.Driver.objects.all"
] | [((236, 256), 'backmarker.models.driver.Driver.objects.all', 'Driver.objects.all', ([], {}), '()\n', (254, 256), False, 'from backmarker.models.driver import Driver\n')] |
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from pathlib import Path
import pytest
from pants.option.custom_types import (
DictValueComponent,
ListValueComponent,
UnsetBool,
dict_with_files_option,
dir_option,
... | [
"pytest.raises",
"pants.testutil.rule_runner.RuleRunner",
"pants.option.options_fingerprinter.OptionsFingerprinter"
] | [((519, 531), 'pants.testutil.rule_runner.RuleRunner', 'RuleRunner', ([], {}), '()\n', (529, 531), False, 'from pants.testutil.rule_runner import RuleRunner\n'), ((1871, 1896), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (1884, 1896), False, 'import pytest\n'), ((912, 934), 'pants.option.o... |
import os
import sys
import syglass as sy
from syglass import pyglass
import numpy as np
import tifffile
import subprocess
def extract(projectPath):
project = sy.get_project(projectPath)
head, tail = os.path.split(projectPath)
# Get a dictionary showing the number of blocks in each level
#codebreak()
resolution_... | [
"subprocess.run",
"numpy.asarray",
"os.path.split",
"os.path.dirname",
"syglass.get_project",
"tifffile.imwrite"
] | [((162, 189), 'syglass.get_project', 'sy.get_project', (['projectPath'], {}), '(projectPath)\n', (176, 189), True, 'import syglass as sy\n'), ((204, 230), 'os.path.split', 'os.path.split', (['projectPath'], {}), '(projectPath)\n', (217, 230), False, 'import os\n'), ((736, 765), 'numpy.asarray', 'np.asarray', (['[1, xsi... |
# Lee el fichero y procésalo de tal manera que sea capaz de mostrar
# la temperatura máxima para una ciudad dada. Esa ciudad la debe poder
# recibir como un argumento de entrada. Si la ciudad no existe, se deberá
# manejar a través de una excepción.
import csv
provincia = input('Diga el nombre de la ciudad: ')
with... | [
"csv.reader"
] | [((389, 423), 'csv.reader', 'csv.reader', (['csvfile'], {'delimiter': '""","""'}), "(csvfile, delimiter=',')\n", (399, 423), False, 'import csv\n')] |
# Copyright (c) 2015 IBM Corporation and others.
#
# 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... | [
"brunel.brunel_main.display",
"brunel.brunel_main.get_dataset_names",
"brunel.brunel_main.to_csv"
] | [((1351, 1383), 'brunel.brunel_main.get_dataset_names', 'brunel.get_dataset_names', (['action'], {}), '(action)\n', (1375, 1383), True, 'import brunel.brunel_main as brunel\n'), ((2254, 2308), 'brunel.brunel_main.display', 'brunel.display', (['action', 'data', 'width', 'height', 'online_js'], {}), '(action, data, width... |
#!/usr/bin/python
import fileinput
import json
url_base = "https://dds.cr.usgs.gov/srtm/version2_1/SRTM3"
regions = [
"Africa",
"Australia",
"Eurasia",
"Islands",
"North_America",
"South_America",
]
srtm_dict = {}
srtm_directory = "srtm.json"
for region in regions:
print("Processing", ... | [
"fileinput.input",
"json.dump"
] | [((336, 359), 'fileinput.input', 'fileinput.input', (['region'], {}), '(region)\n', (351, 359), False, 'import fileinput\n'), ((611, 660), 'json.dump', 'json.dump', (['srtm_dict', 'f'], {'indent': '(2)', 'sort_keys': '(True)'}), '(srtm_dict, f, indent=2, sort_keys=True)\n', (620, 660), False, 'import json\n')] |
from __future__ import absolute_import
from datetime import datetime, timedelta
import six
import time
import logging
from sentry.utils.compat.mock import patch, Mock
from sentry.event_manager import EventManager
from sentry.eventstream.kafka import KafkaEventStream
from sentry.eventstream.snuba import SnubaEventStre... | [
"datetime.datetime.utcnow",
"datetime.timedelta",
"sentry.utils.compat.mock.patch",
"sentry.eventstream.kafka.KafkaEventStream",
"sentry.utils.compat.mock.Mock",
"sentry.eventstream.snuba.SnubaEventStream",
"six.text_type",
"sentry.utils.json.loads",
"sentry.event_manager.EventManager"
] | [((1894, 1928), 'sentry.utils.compat.mock.patch', 'patch', (['"""sentry.eventstream.insert"""'], {}), "('sentry.eventstream.insert')\n", (1899, 1928), False, 'from sentry.utils.compat.mock import patch, Mock\n'), ((2954, 2988), 'sentry.utils.compat.mock.patch', 'patch', (['"""sentry.eventstream.insert"""'], {}), "('sen... |
"""User specific settings."""
import matplotlib as mpl
import matplotlib.pyplot as plt
mpl.rcParams['font.size'] = 7
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
mpl.rcParams['font.family'] = 'arial'
mpl.rcParams['mathtext.fontset'] = 'stix'
seqcmap = mpl.cm.cool_r
try:
import seaborn as sn... | [
"seaborn.color_palette"
] | [((377, 402), 'seaborn.color_palette', 'sns.color_palette', (['"""deep"""'], {}), "('deep')\n", (394, 402), True, 'import seaborn as sns\n')] |
#!/bin/python3
# author: <NAME>
import tests
tests.fix_paths()
import yaml
from unittest import TestCase
from cihpc.cfg.config import global_configuration
from cihpc.common.utils import extend_yaml
repeat_yaml = '''
foo: !repeat a 5
'''
range_yaml = '''
foo: !range 1 5
bar: !range 1 2 6
'''
sh_yaml = '''
foo: !... | [
"yaml.load",
"cihpc.common.utils.extend_yaml.extend",
"tests.fix_paths"
] | [((48, 65), 'tests.fix_paths', 'tests.fix_paths', ([], {}), '()\n', (63, 65), False, 'import tests\n'), ((416, 436), 'cihpc.common.utils.extend_yaml.extend', 'extend_yaml.extend', ([], {}), '()\n', (434, 436), False, 'from cihpc.common.utils import extend_yaml\n'), ((732, 752), 'cihpc.common.utils.extend_yaml.extend', ... |
import os
import sys
from dataclasses import dataclass
import click
import numpy as np
import xgboost as xgb
from rich import print, traceback
WD = os.path.dirname(__file__)
@click.command()
@click.option('-i', '--input', required=True, type=str, help='Path to data file to predict.')
@click.option('-m', '--model', ... | [
"rich.traceback.install",
"click.option",
"os.path.dirname",
"rich.print",
"numpy.array",
"xgboost.Booster",
"numpy.savetxt",
"os.path.abspath",
"xgboost.DMatrix",
"click.command"
] | [((150, 175), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (165, 175), False, 'import os\n'), ((179, 194), 'click.command', 'click.command', ([], {}), '()\n', (192, 194), False, 'import click\n'), ((196, 293), 'click.option', 'click.option', (['"""-i"""', '"""--input"""'], {'required': '(Tr... |
from __future__ import division, absolute_import, print_function
from past.builtins import xrange
import unittest
import numpy.testing as testing
import numpy as np
import fitsio
import os
from numpy import random
from redmapper import Cluster
from redmapper import Configuration
from redmapper import CenteringWcenZre... | [
"numpy.radians",
"redmapper.Cluster",
"redmapper.CenteringWcenZred",
"os.path.join",
"numpy.testing.assert_almost_equal",
"numpy.zeros",
"redmapper.ZlambdaCorrectionPar",
"redmapper.CenteringRandom",
"redmapper.CenteringBCG",
"numpy.random.seed",
"unittest.main",
"redmapper.GalaxyCatalog",
"... | [((6462, 6477), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6475, 6477), False, 'import unittest\n'), ((1209, 1282), 'redmapper.ZlambdaCorrectionPar', 'ZlambdaCorrectionPar', (["(file_path + '/' + corr_filename)"], {'zlambda_pivot': '(30.0)'}), "(file_path + '/' + corr_filename, zlambda_pivot=30.0)\n", (1229, ... |
from PIL import Image
from PIL import ImageFile
from io import BytesIO
import _webp
def _accept(prefix):
return prefix[:4] == b"RIFF" and prefix[8:16] == b"WEBPVP8 "
class WebPImageFile(ImageFile.ImageFile):
format = "WEBP"
format_description = "WebP image"
def _open(self):
self.mode = "RGB"... | [
"PIL.Image.register_save",
"io.BytesIO",
"PIL.Image.register_extension",
"PIL.Image.register_mime",
"PIL.Image.register_open"
] | [((807, 858), 'PIL.Image.register_open', 'Image.register_open', (['"""WEBP"""', 'WebPImageFile', '_accept'], {}), "('WEBP', WebPImageFile, _accept)\n", (826, 858), False, 'from PIL import Image\n'), ((859, 893), 'PIL.Image.register_save', 'Image.register_save', (['"""WEBP"""', '_save'], {}), "('WEBP', _save)\n", (878, ... |
from turtle import Turtle, Screen
from random import choice
from time import sleep
from queue import SimpleQueue
w: int
w, h = (853, 480)
wn = Screen()
wn.screensize(w, h)
wn.bgcolor("#d3d3d3")
Room_state = {"Clean": "#FFFFFF",
"Dirty": "#b5651d"}
cleaned = 0
def filler(t, color, delay=0, vacclean = ... | [
"random.choice",
"time.sleep",
"turtle.Screen",
"queue.SimpleQueue",
"turtle.Turtle"
] | [((145, 153), 'turtle.Screen', 'Screen', ([], {}), '()\n', (151, 153), False, 'from turtle import Turtle, Screen\n'), ((1792, 1800), 'turtle.Turtle', 'Turtle', ([], {}), '()\n', (1798, 1800), False, 'from turtle import Turtle, Screen\n'), ((1893, 1901), 'turtle.Turtle', 'Turtle', ([], {}), '()\n', (1899, 1901), False, ... |
"""
Copyright (c) 2017 Cyberhaven
Copyright (c) 2017 Dependable Systems Laboratory, EPFL
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 right... | [
"logging.getLogger",
"s2e_env.utils.images.ImageDownloader",
"sh.touch",
"os.getuid",
"time.sleep",
"s2e_env.utils.images.get_image_templates",
"sh.cp",
"s2e_env.utils.images.translate_image_name",
"s2e_env.utils.images.get_app_templates",
"os.path.exists",
"pwd.getpwnam",
"sh.rm",
"s2e_env.... | [((1756, 1788), 'logging.getLogger', 'logging.getLogger', (['"""image_build"""'], {}), "('image_build')\n", (1773, 1788), False, 'import logging\n'), ((2453, 2652), 's2e_env.command.CommandError', 'CommandError', (['f"""You must belong to the {group_name} group in order to build images. Please run the following command... |
import json
from PIL import Image
with open('/home/tianpei.qian/workspace/data_local/sl4_front_1.0/sl4_side_val_1.7.json') as f:
val_1_7 = json.load(f)
with open('sl4_side_val_1.7/results.json') as f:
new_1_8 = json.load(f)
ROOT = '/home/tianpei.qian/workspace/data_local/sl4_front_1.0/'
for old, new in zip(... | [
"json.load",
"PIL.Image.open",
"json.dump"
] | [((144, 156), 'json.load', 'json.load', (['f'], {}), '(f)\n', (153, 156), False, 'import json\n'), ((221, 233), 'json.load', 'json.load', (['f'], {}), '(f)\n', (230, 233), False, 'import json\n'), ((386, 416), 'PIL.Image.open', 'Image.open', (["(ROOT + old['file'])"], {}), "(ROOT + old['file'])\n", (396, 416), False, '... |
"""
Generate data for ablation analysis for ICML 2017 workshop paper.
"""
import random
from torch.nn import functional as F
from railrl.envs.pygame.water_maze import (
WaterMazeMemory,
)
from railrl.exploration_strategies.ou_strategy import OUStrategy
from railrl.launchers.launcher_util import (
run_experime... | [
"random.randint",
"railrl.launchers.launcher_util.run_experiment"
] | [((3523, 3547), 'random.randint', 'random.randint', (['(0)', '(10000)'], {}), '(0, 10000)\n', (3537, 3547), False, 'import random\n'), ((3564, 3680), 'railrl.launchers.launcher_util.run_experiment', 'run_experiment', (['bptt_ddpg_launcher'], {'exp_prefix': 'exp_prefix', 'seed': 'seed', 'mode': 'mode', 'variant': 'varia... |
"""Classes for use with Yambo
Representation of a spectrum.
Main functionality is to read from Yambo output, o.qp files
and also netcdf databases.
"""
import re
import copy as cp
import numpy as np
import asetk.atomistic.fundamental as fu
import asetk.atomistic.constants as atc
from . import cube
class Dispersion:
... | [
"numpy.intersect1d",
"numpy.where",
"netCDF4.Dataset",
"asetk.atomistic.fundamental.Energylevels",
"re.findall",
"numpy.array",
"numpy.concatenate",
"copy.copy",
"numpy.genfromtxt",
"asetk.atomistic.fundamental.EnergyLevels",
"re.search"
] | [((1070, 1090), 'numpy.concatenate', 'np.concatenate', (['list'], {}), '(list)\n', (1084, 1090), True, 'import numpy as np\n'), ((1501, 1529), 'copy.copy', 'cp.copy', (['spectrum.__kvectors'], {}), '(spectrum.__kvectors)\n', (1508, 1529), True, 'import copy as cp\n'), ((1555, 1582), 'copy.copy', 'cp.copy', (['spectrum.... |
import unittest
import os
import json
import pandas as pd
import numpy as np
class TestingExercise2_07(unittest.TestCase):
def setUp(self) -> None:
ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(ROOT_DIR, '..', 'dtypes.json'), 'r') as jsonfile:
self.dtyp =... | [
"unittest.main",
"json.load",
"os.path.abspath",
"os.path.join"
] | [((718, 733), 'unittest.main', 'unittest.main', ([], {}), '()\n', (731, 733), False, 'import unittest\n'), ((188, 213), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (203, 213), False, 'import os\n'), ((321, 340), 'json.load', 'json.load', (['jsonfile'], {}), '(jsonfile)\n', (330, 340), Fals... |
from uuid import UUID
from sqlalchemy import select, bindparam
from nivo_api.cli.bra_record_helper.persist import persist_zone, persist_massif
from nivo_api.core.db.connection import connection_scope
from nivo_api.core.db.models.sql.bra import ZoneTable, DepartmentTable, MassifTable
from test.pytest_fixtures import... | [
"nivo_api.core.db.connection.connection_scope",
"nivo_api.cli.bra_record_helper.persist.persist_zone",
"sqlalchemy.bindparam",
"sqlalchemy.select",
"nivo_api.core.db.models.sql.bra.ZoneTable.join",
"nivo_api.cli.bra_record_helper.persist.persist_massif"
] | [((410, 443), 'nivo_api.core.db.connection.connection_scope', 'connection_scope', (['database.engine'], {}), '(database.engine)\n', (426, 443), False, 'from nivo_api.core.db.connection import connection_scope\n'), ((468, 503), 'nivo_api.cli.bra_record_helper.persist.persist_zone', 'persist_zone', (['con', '"""this_is_a... |
import itertools
import numpy as np
from jspp_imageutils.image.types import GenImgArray, GenImgBatch
from typing import Tuple, Iterable, Iterator
# TODO: fix everywhere the x and y axis nomenclature
"""
chunk_image_on_position -> returns images
chunk_image_generator -> returns images
chunk_data_image_generator -> re... | [
"itertools.product",
"numpy.asarray",
"numpy.concatenate"
] | [((1915, 1930), 'numpy.asarray', 'np.asarray', (['img'], {}), '(img)\n', (1925, 1930), True, 'import numpy as np\n'), ((2354, 2391), 'itertools.product', 'itertools.product', (['x_starts', 'y_starts'], {}), '(x_starts, y_starts)\n', (2371, 2391), False, 'import itertools\n'), ((4118, 4144), 'numpy.concatenate', 'np.con... |
"""Manage interfaces on HPCOM7 devices.
"""
from pyhpecw7.utils.xml.lib import reverse_value_map
from pyhpecw7.features.errors import InterfaceCreateError, InterfaceTypeError,\
InterfaceAbsentError, InterfaceParamsError, InterfaceVlanMustExist
from pyhpecw7.features.vlan import Vlan
from pyhpecw7.utils.xml.lib im... | [
"pyhpecw7.utils.xml.lib.reverse_value_map",
"pyhpecw7.features.errors.InterfaceParamsError",
"pyhpecw7.features.errors.InterfaceVlanMustExist",
"pyhpecw7.features.errors.InterfaceCreateError",
"pyhpecw7.features.errors.InterfaceAbsentError",
"pyhpecw7.features.vlan.Vlan"
] | [((2982, 3033), 'pyhpecw7.utils.xml.lib.reverse_value_map', 'reverse_value_map', (['self._r_key_map', 'self._value_map'], {}), '(self._r_key_map, self._value_map)\n', (2999, 3033), False, 'from pyhpecw7.utils.xml.lib import reverse_value_map\n'), ((7232, 7273), 'pyhpecw7.features.errors.InterfaceCreateError', 'Interfac... |
from django.contrib import admin
from django.urls import path, include
from src.base import urls as base_api
urlpatterns = [
path('admin/', admin.site.urls),
path('rest_api/', include(
base_api.urlpatterns
)),
] | [
"django.urls.path",
"django.urls.include"
] | [((131, 162), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (135, 162), False, 'from django.urls import path, include\n'), ((186, 215), 'django.urls.include', 'include', (['base_api.urlpatterns'], {}), '(base_api.urlpatterns)\n', (193, 215), False, 'from django.... |
"""Compute ordinary Voronoi diagrams in Shapely geometries."""
import operator
import numpy
import scipy.spatial
import shapely.geometry
import shapely.geometry.base
import shapely.prepared
def pointset_bounds(coords):
return (
min(coords, key=operator.itemgetter(0))[0],
min(coords, key=operator... | [
"numpy.array",
"operator.itemgetter",
"numpy.concatenate"
] | [((1145, 1183), 'numpy.concatenate', 'numpy.concatenate', (['(points, boundgens)'], {}), '((points, boundgens))\n', (1162, 1183), False, 'import numpy\n'), ((1550, 1594), 'numpy.array', 'numpy.array', (['[pt.coords[0] for pt in points]'], {}), '([pt.coords[0] for pt in points])\n', (1561, 1594), False, 'import numpy\n'... |
"""Plots composite saliency map."""
import argparse
import numpy
import matplotlib
matplotlib.use('agg')
from matplotlib import pyplot
from gewittergefahr.gg_utils import general_utils as gg_general_utils
from gewittergefahr.gg_utils import file_system_utils
from gewittergefahr.plotting import imagemagick_utils
from m... | [
"ml4tc.plotting.plotting_utils.concat_panels",
"numpy.array",
"numpy.ravel",
"gewittergefahr.gg_utils.general_utils.apply_gaussian_filter",
"numpy.repeat",
"argparse.ArgumentParser",
"matplotlib.pyplot.Normalize",
"matplotlib.pyplot.close",
"numpy.linspace",
"ml4tc.machine_learning.neural_net.find... | [((84, 105), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (98, 105), False, 'import matplotlib\n'), ((637, 672), 'numpy.array', 'numpy.array', (['[numpy.nan, 0, 1.5, 3]'], {}), '([numpy.nan, 0, 1.5, 3])\n', (648, 672), False, 'import numpy\n'), ((2217, 2242), 'argparse.ArgumentParser', 'argpars... |
""" Setup file """
import os
from setuptools import setup, find_packages
HERE = os.path.abspath(os.path.dirname(__file__))
README = open(os.path.join(HERE, "README.rst")).read()
CHANGES = open(os.path.join(HERE, "CHANGES.rst")).read()
REQUIREMENTS = [
"dynamo3>=0.4.7",
"future>=0.15.0",
"pyparsing==2.1.... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((99, 124), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (114, 124), False, 'import os\n'), ((140, 172), 'os.path.join', 'os.path.join', (['HERE', '"""README.rst"""'], {}), "(HERE, 'README.rst')\n", (152, 172), False, 'import os\n'), ((196, 229), 'os.path.join', 'os.path.join', (['HERE', '... |
import multiprocessing
import csv_exporter
from combination.brute_force_combination_algorithm import \
BruteForceCombinationAlgorithm
from combination.combiner import Combiner
from combination.constrained_combination_algorithm import \
ConstrainedCombinationAlgorithm
from config.config_importer import ConfigIm... | [
"mhw_db_loaders.data_loader.load_json",
"combination.constrained_combination_algorithm.ConstrainedCombinationAlgorithm",
"config.config_importer.ConfigImporter",
"multiprocessing.cpu_count",
"csv_exporter.export_combinations",
"scorer.Scorer",
"combination.brute_force_combination_algorithm.BruteForceCom... | [((3291, 3367), 'csv_exporter.export_combinations', 'csv_exporter.export_combinations', (['combinations', 'skill_ranks', 'export_location'], {}), '(combinations, skill_ranks, export_location)\n', (3323, 3367), False, 'import csv_exporter\n'), ((1329, 1376), 'config.config_importer.ConfigImporter', 'ConfigImporter', (['... |
from setuptools import setup
import src
setup(name='lsankidb',
version=src.__version__,
install_requires=['AnkiTools'],
description='"ls" for your local Anki database.',
#FIXME this duplicates README.md
long_description="""
.. image:: https://cdn.jsdelivr.net/gh/AurelienLourot/lsankidb@c... | [
"setuptools.setup"
] | [((41, 1624), 'setuptools.setup', 'setup', ([], {'name': '"""lsankidb"""', 'version': 'src.__version__', 'install_requires': "['AnkiTools']", 'description': '""""ls" for your local Anki database."""', 'long_description': '"""\n.. image:: https://cdn.jsdelivr.net/gh/AurelienLourot/lsankidb@c9735756451d135f94601b81646912... |
import logging
from injector import inject, singleton
from starlette.config import Config
from common.database import BaseDatabase
LOGGER = logging.getLogger(__name__)
@singleton
@inject
class MasterDatabase(BaseDatabase):
def __init__(self, config: Config) -> None:
super().__init__(config)
se... | [
"logging.getLogger"
] | [((143, 170), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (160, 170), False, 'import logging\n')] |
# python3
"""Testing code to run the typed_ast based pyi parser."""
import sys
from pytype import module_utils
from pytype.pyi import parser
from pytype.pyi.types import ParseError # pylint: disable=g-importing-member
from pytype.pytd import pytd_utils
if __name__ == '__main__':
filename = sys.argv[1]
with op... | [
"pytype.pytd.pytd_utils.Print",
"sys.exit",
"pytype.pyi.parser.parse_pyi_debug",
"pytype.module_utils.path_to_module_name"
] | [((380, 422), 'pytype.module_utils.path_to_module_name', 'module_utils.path_to_module_name', (['filename'], {}), '(filename)\n', (412, 422), False, 'from pytype import module_utils\n'), ((463, 528), 'pytype.pyi.parser.parse_pyi_debug', 'parser.parse_pyi_debug', (['src', 'filename', 'module_name', 'version', 'None'], {}... |
from django.contrib import admin
from .models import *
admin.site.register(University)
admin.site.register(Faculty)
admin.site.register(Subject)
admin.site.register(Teacher)
| [
"django.contrib.admin.site.register"
] | [((57, 88), 'django.contrib.admin.site.register', 'admin.site.register', (['University'], {}), '(University)\n', (76, 88), False, 'from django.contrib import admin\n'), ((89, 117), 'django.contrib.admin.site.register', 'admin.site.register', (['Faculty'], {}), '(Faculty)\n', (108, 117), False, 'from django.contrib impo... |
import multiprocessing
import os
bind = "{0}:{1}".format(os.environ.get('HOST', '0.0.0.0'), os.environ.get('PORT', '8080'))
workers = os.environ.get('WORKERS', multiprocessing.cpu_count() * 2 + 1)
| [
"os.environ.get",
"multiprocessing.cpu_count"
] | [((59, 92), 'os.environ.get', 'os.environ.get', (['"""HOST"""', '"""0.0.0.0"""'], {}), "('HOST', '0.0.0.0')\n", (73, 92), False, 'import os\n'), ((94, 124), 'os.environ.get', 'os.environ.get', (['"""PORT"""', '"""8080"""'], {}), "('PORT', '8080')\n", (108, 124), False, 'import os\n'), ((162, 189), 'multiprocessing.cpu_... |
import numpy as np
def import_accuracy(y_test, predictions):
errors = abs(predictions - y_test)
mape = 100 * (errors / y_test)
accuracy = 100 - np.mean(mape)
return accuracy
| [
"numpy.mean"
] | [((148, 161), 'numpy.mean', 'np.mean', (['mape'], {}), '(mape)\n', (155, 161), True, 'import numpy as np\n')] |
import numpy as np
import os
import torch
import torch.utils.data as data
import pdb
import pickle
from pathlib import Path
from scipy import signal
import librosa
import scipy
from itertools import permutations
from numpy.linalg import solve
import numpy as np
import soundfile as sf
from convolutive_prediction import ... | [
"numpy.trace",
"numpy.sqrt",
"torch.sqrt",
"numpy.iinfo",
"torch.from_numpy",
"convolutive_prediction.Apply_ConvolutivePrediction",
"torch.squeeze",
"numpy.linalg.norm",
"scipy.signal.get_window",
"numpy.reshape",
"pathlib.Path",
"torch.unsqueeze",
"numpy.conjugate",
"numpy.empty",
"torc... | [((1067, 1112), 'scipy.signal.get_window', 'scipy.signal.get_window', (['"""hann"""', 'self.nperseg'], {}), "('hann', self.nperseg)\n", (1090, 1112), False, 'import scipy\n'), ((17637, 17687), 'scipy.signal.get_window', 'scipy.signal.get_window', (['self.window', 'self.nperseg'], {}), '(self.window, self.nperseg)\n', (... |
import os
TRANSFORMERS = '/home/noone/documents/github/transformers'
TOKENIZERS = '/home/noone/documents/github/tokenizers'
DATASETS = '/home/noone/documents/github/datasets'
MODELS = os.path.join(TRANSFORMERS, 'src/transformers/models')
DEBERTA_V2 = os.path.join(MODELS, 'deberta_v2')
DEBERTA_V3 = os.path.join(MO... | [
"os.path.join"
] | [((188, 241), 'os.path.join', 'os.path.join', (['TRANSFORMERS', '"""src/transformers/models"""'], {}), "(TRANSFORMERS, 'src/transformers/models')\n", (200, 241), False, 'import os\n'), ((256, 290), 'os.path.join', 'os.path.join', (['MODELS', '"""deberta_v2"""'], {}), "(MODELS, 'deberta_v2')\n", (268, 290), False, 'impo... |
#Par ou Impar- para qnd o jogador perder e mostra o tanto de vitoria consecutivas
from random import randint
c = 0
while True:
print('\033[1;33m-' * 30)
n = int(input('ESCOLHA UM NÚMERO: '))
e = str(input('PAR OU IMPAR? ')).strip().upper()[0]
print('-' * 30)
j = randint(0, 10)
if e == 'P':
... | [
"random.randint"
] | [((283, 297), 'random.randint', 'randint', (['(0)', '(10)'], {}), '(0, 10)\n', (290, 297), False, 'from random import randint\n')] |
"""
This file tests that sendmmsg works correctly.
Target files:
- libdesock/src/write.c
"""
import ctypes
import desock
import helper
data = bytes(range(65, 115))
cursor = 0
def _get_data(size):
global cursor
ret = bytes(data[cursor: cursor + size])
assert(len(ret) == size)
cursor += size
r... | [
"desock.sendmsg",
"helper.StdoutPipe",
"helper.create_iovec",
"desock.writev",
"desock._debug_instant_fd",
"desock.sendmmsg",
"desock.sendto"
] | [((361, 388), 'desock._debug_instant_fd', 'desock._debug_instant_fd', (['(0)'], {}), '(0)\n', (385, 388), False, 'import desock\n'), ((937, 964), 'desock._debug_instant_fd', 'desock._debug_instant_fd', (['(0)'], {}), '(0)\n', (961, 964), False, 'import desock\n'), ((1274, 1301), 'desock._debug_instant_fd', 'desock._deb... |
import argparse
import os
import shutil
import numpy as np
import torch as t
from torch.optim import Adam
from utils.batch_loader import BatchLoader
from utils.parameters import Parameters
from model.rvae_dilated import RVAE_dilated
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='RV... | [
"numpy.random.normal",
"os.path.exists",
"utils.batch_loader.BatchLoader",
"argparse.ArgumentParser",
"torch.load",
"os.path.isfile",
"numpy.array",
"utils.parameters.Parameters",
"torch.cuda.is_available",
"shutil.copyfile",
"model.rvae_dilated.RVAE_dilated",
"os.remove"
] | [((281, 332), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""RVAE_dilated"""'}), "(description='RVAE_dilated')\n", (304, 332), False, 'import argparse\n'), ((1653, 1690), 'utils.batch_loader.BatchLoader', 'BatchLoader', (['""""""', 'prefix', 'word_is_char'], {}), "('', prefix, word_is_ch... |
__author__ = '<NAME>'
from os import path
from azure.storage.blob import BlockBlobService
from flow.core.abstract_filesystem import AbstractFilesystem, splitpath
class AzureBlobFilesystem(AbstractFilesystem):
""" implementation of Azure Page Blob filesystem
https://docs.microsoft.com/en-us/azure/storage/b... | [
"flow.core.abstract_filesystem.splitpath",
"os.path.basename",
"os.path.join",
"azure.storage.blob.BlockBlobService"
] | [((1577, 1596), 'flow.core.abstract_filesystem.splitpath', 'splitpath', (['uri_path'], {}), '(uri_path)\n', (1586, 1596), False, 'from flow.core.abstract_filesystem import AbstractFilesystem, splitpath\n'), ((596, 720), 'azure.storage.blob.BlockBlobService', 'BlockBlobService', ([], {'account_name': "context.settings['... |
import asyncio
import pytest
import re
import uuid
from aiohttp.test_utils import teardown_test_loop
from aioredis import create_redis
from arq import ArqRedis, Worker
from atoolbox.db import prepare_database
from atoolbox.db.helpers import DummyPgPool
from atoolbox.test_utils import DummyServer, create_dummy_server
fr... | [
"morpheus.app.worker.startup",
"aioredis.create_redis",
"atoolbox.db.helpers.DummyPgPool",
"asyncio.new_event_loop",
"morpheus.app.settings.Settings",
"uuid.uuid4",
"arq.Worker",
"aiohttp.test_utils.teardown_test_loop",
"buildpg.Values",
"morpheus.app.main.create_app",
"atoolbox.test_utils.creat... | [((896, 944), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""', 'name': '"""clean_db"""'}), "(scope='session', name='clean_db')\n", (910, 944), False, 'import pytest\n'), ((1241, 1271), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""db_conn"""'}), "(name='db_conn')\n", (1255, 1271), False, 'imp... |
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import View
urlpatterns = [
url(r'^client/', include('client.urls', namespace = 'client', app_name = 'client')),
url(r'^app/', include('app.urls', namespace = 'app', app_name = 'app')),
url('', include('django.... | [
"django.conf.urls.include"
] | [((149, 210), 'django.conf.urls.include', 'include', (['"""client.urls"""'], {'namespace': '"""client"""', 'app_name': '"""client"""'}), "('client.urls', namespace='client', app_name='client')\n", (156, 210), False, 'from django.conf.urls import include, url\n'), ((233, 285), 'django.conf.urls.include', 'include', (['"... |
"""
imutils/big/make_shards.py
Generate one or more webdataset-compatible tar archive shards from an image classification dataset.
Based on script: https://github.com/tmbdev-archive/webdataset-examples/blob/7f56e9a8b978254c06aa0a98572a1331968b0eb3/makeshards.py
Added on: Sunday March 6th, 2022
Example usage:
pytho... | [
"os.listdir",
"argparse.ArgumentParser",
"os.makedirs",
"imutils.ml.data.datamodule.Herbarium2022DataModule",
"tqdm.tqdm",
"os.path.join",
"rich.print",
"webdataset.ShardWriter"
] | [((2524, 2561), 'os.makedirs', 'os.makedirs', (['shard_dir'], {'exist_ok': '(True)'}), '(shard_dir, exist_ok=True)\n', (2535, 2561), False, 'import os\n'), ((2573, 2633), 'os.path.join', 'os.path.join', (['shard_dir', 'f"""herbarium_2022-{subset}-%06d.tar"""'], {}), "(shard_dir, f'herbarium_2022-{subset}-%06d.tar')\n",... |
# -*- coding: utf-8 -*-
# Copyright (c) 2018-2021, earthobservations developers.
# Distributed under the MIT License. See LICENSE for more info.
import os
from io import BytesIO
from typing import List, Optional, Union
from fsspec.implementations.cached import WholeFileCacheFileSystem
from fsspec.implementations.http ... | [
"os.path.join",
"fsspec.implementations.cached.WholeFileCacheFileSystem",
"fsspec.implementations.http.HTTPFileSystem",
"io.BytesIO"
] | [((2241, 2416), 'fsspec.implementations.http.HTTPFileSystem', 'HTTPFileSystem', ([], {'use_listings_cache': '(True)', 'listings_expiry_time': '(not WD_CACHE_DISABLE and ttl.value)', 'listings_cache_type': '"""filedircache"""', 'listings_cache_location': 'cache_dir'}), "(use_listings_cache=True, listings_expiry_time=not... |
from pymongo import MongoClient
from bson import ObjectId
from bson.json_util import dumps
from json import loads
client = MongoClient('localhost', 27017)
IOT_DB = client.iot_db
IOT_SCHEMAS = IOT_DB.iot_schemas
IOT_DATA = IOT_DB.iot_data | [
"pymongo.MongoClient"
] | [((124, 155), 'pymongo.MongoClient', 'MongoClient', (['"""localhost"""', '(27017)'], {}), "('localhost', 27017)\n", (135, 155), False, 'from pymongo import MongoClient\n')] |
# -*- coding: utf-8 -*-
"""
Django settings for demo project.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
# Build paths inside the project like this: os.path.j... | [
"os.path.abspath",
"os.path.join",
"django.core.urlresolvers.reverse_lazy"
] | [((3107, 3139), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""media/"""'], {}), "(BASE_DIR, 'media/')\n", (3119, 3139), False, 'import os\n'), ((3155, 3188), 'os.path.join', 'os.path.join', (['BASE_DIR', '"""static/"""'], {}), "(BASE_DIR, 'static/')\n", (3167, 3188), False, 'import os\n'), ((3250, 3279), 'django.co... |
from Cryptodome.PublicKey import RSA
import hashlib
import json
def recover(key):
private_key_readable = key.exportKey().decode("utf-8")
public_key_readable = key.publickey().exportKey().decode("utf-8")
address = hashlib.sha224(public_key_readable.encode("utf-8")).hexdigest()
wallet_dict = {}
wal... | [
"Cryptodome.PublicKey.RSA.importKey",
"json.dump"
] | [((769, 804), 'Cryptodome.PublicKey.RSA.importKey', 'RSA.importKey', (['private_key_readable'], {}), '(private_key_readable)\n', (782, 804), False, 'from Cryptodome.PublicKey import RSA\n'), ((525, 560), 'json.dump', 'json.dump', (['wallet_dict', 'wallet_file'], {}), '(wallet_dict, wallet_file)\n', (534, 560), False, '... |
'''
Stolen straight from https://stackoverflow.com/a/51337247/1224827
'''
try:
import PIL
import PIL.Image as PILimage
from PIL import ImageDraw, ImageFont, ImageEnhance
from PIL.ExifTags import TAGS, GPSTAGS
import os
import glob
except ImportError as err:
exit(err)
class Worker(object):
... | [
"PIL.Image.open",
"os.path.splitext",
"os.path.join",
"PIL.ExifTags.TAGS.get",
"os.getcwd",
"PIL.ExifTags.GPSTAGS.get",
"glob.glob"
] | [((1394, 1432), 'os.path.join', 'os.path.join', (['input_directory', '"""*.jpg"""'], {}), "(input_directory, '*.jpg')\n", (1406, 1432), False, 'import os\n'), ((1450, 1470), 'glob.glob', 'glob.glob', (['glob_path'], {}), '(glob_path)\n', (1459, 1470), False, 'import glob\n'), ((1356, 1367), 'os.getcwd', 'os.getcwd', ([... |
#!/usr/bin/python3
#### A tool for blocking all verified users on Twitter.
## You may want to create a (public or private) Twitter list named 'exceptions' and add verified users to it.
## This 'exceptions' list that you create on Twitter is for verified accounts that you like and do not want to block.
#### Import dep... | [
"tweepy.OAuth2AppHandler",
"tweepy.Cursor",
"timeit.default_timer",
"tweepy.API",
"tweepy.Client"
] | [((436, 458), 'timeit.default_timer', 'timeit.default_timer', ([], {}), '()\n', (456, 458), False, 'import timeit\n'), ((1903, 1938), 'tweepy.Client', 'tweepy.Client', (["Keys['Bearer Token']"], {}), "(Keys['Bearer Token'])\n", (1916, 1938), False, 'import tweepy\n'), ((1948, 2046), 'tweepy.OAuth2AppHandler', 'tweepy.O... |
# Exploit Title: PHP 8.1.0-dev - 'User-Agentt' Remote Code Execution
# Date: 23 may 2021
# Exploit Author: flast101
# Vendor Homepage: https://www.php.net/
# Software Link:
# - https://hub.docker.com/r/phpdaily/php
# - https://github.com/phpdaily/php
# Version: 8.1.0-dev
# Tested on: Ubuntu 20.04
# References:
... | [
"requests.Session"
] | [((1141, 1159), 'requests.Session', 'requests.Session', ([], {}), '()\n', (1157, 1159), False, 'import requests\n')] |
"""
Module that contains the command line app.
Why does this file exist, and why not put this in __main__?
You might be tempted to import things from __main__ later, but that will cause
problems: the code will get executed twice:
- When you run `python -mflashcards` python will execute
``__main__.py`` as a... | [
"argparse.ArgumentParser"
] | [((686, 745), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Command description."""'}), "(description='Command description.')\n", (709, 745), False, 'import argparse\n'), ((1624, 1721), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""flashcards"""', 'description'... |
import aiohttp
import asyncio
import time
start_time = time.time()
async def get_pokemon(session,url):
async with session.get(url) as resp:
pokemon = await resp.json()
return pokemon["name"]
async def main():
async with aiohttp.ClientSession(connector=aiohttp.TCPConnector(limit=64,verif... | [
"aiohttp.TCPConnector",
"time.time",
"asyncio.gather"
] | [((56, 67), 'time.time', 'time.time', ([], {}), '()\n', (65, 67), False, 'import time\n'), ((592, 614), 'asyncio.gather', 'asyncio.gather', (['*tasks'], {}), '(*tasks)\n', (606, 614), False, 'import asyncio\n'), ((285, 333), 'aiohttp.TCPConnector', 'aiohttp.TCPConnector', ([], {'limit': '(64)', 'verify_ssl': '(False)'}... |
# -*- coding: utf-8 -*-
import logging
from logging import handlers
import pickle
import time
import uuid
from bson.binary import Binary
from bson.json_util import dumps
from flask import request
from flask_classful import FlaskView
import pymongo
from requests import ConnectTimeout, ConnectionError
from katana.share... | [
"logging.getLogger",
"katana.shared_utils.mongoUtils.mongoUtils.add",
"logging.StreamHandler",
"katana.shared_utils.mongoUtils.mongoUtils.update",
"katana.shared_utils.mongoUtils.mongoUtils.delete_all",
"bson.binary.Binary",
"katana.shared_utils.nfvoUtils.osmUtils.Osm",
"logging.Formatter",
"katana.... | [((439, 466), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (456, 466), False, 'import logging\n'), ((482, 555), 'logging.handlers.RotatingFileHandler', 'handlers.RotatingFileHandler', (['"""katana.log"""'], {'maxBytes': '(10000)', 'backupCount': '(5)'}), "('katana.log', maxBytes=10000, ... |
import threading
import traceback
import socketserver
import struct
import time
import sys
import http.client
import json
import uuid
import config
import dns.rdatatype
import dns.rdataclass
args = config.args
QTYPES = {1:'A', 15: 'MX', 6: 'SOA'}
custom_mx = uuid.uuid4().hex
# https://github.com/shuque/pydig GNUv2... | [
"struct.unpack",
"struct.unpack_from",
"struct.pack",
"uuid.uuid4"
] | [((263, 275), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (273, 275), False, 'import uuid\n'), ((6808, 6837), 'struct.pack', 'struct.pack', (['"""!H"""', 'request.id'], {}), "('!H', request.id)\n", (6819, 6837), False, 'import struct\n'), ((6850, 6874), 'struct.pack', 'struct.pack', (['"""!H"""', 'flags'], {}), "('!H... |
from unittest.mock import MagicMock
import datetime
import json
import unittest
from tda.orders import EquityOrderBuilder
from tda.utils import Utils
from . import test_utils
class MockResponse:
def __init__(self, json, ok, headers=None):
self._json = json
self.ok = ok
self.headers = hea... | [
"tda.utils.Utils",
"unittest.mock.MagicMock"
] | [((490, 501), 'unittest.mock.MagicMock', 'MagicMock', ([], {}), '()\n', (499, 501), False, 'from unittest.mock import MagicMock\n'), ((555, 595), 'tda.utils.Utils', 'Utils', (['self.mock_client', 'self.account_id'], {}), '(self.mock_client, self.account_id)\n', (560, 595), False, 'from tda.utils import Utils\n')] |