code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from subprocess import run
# python -u val_resnet.py
cuda = 0 # which gpu to use
dataset = 'cifar10'
logs_path = 'logs_resnet' + '_' + dataset
manualSeed = 99
workers = 0
for model in ['resnet20', 'preact_resnet20']:
commands = [
'python', '-u', 'validate_resnet.py',
'--dataset=' + dataset,
... | [
"subprocess.run"
] | [((497, 510), 'subprocess.run', 'run', (['commands'], {}), '(commands)\n', (500, 510), False, 'from subprocess import run\n'), ((1096, 1109), 'subprocess.run', 'run', (['commands'], {}), '(commands)\n', (1099, 1109), False, 'from subprocess import run\n')] |
from akagi.data_source import DataSource
from akagi.data_file import DataFile
class SpreadsheetDataSource(DataSource):
'''SpreadsheetSource replesents a data on Google Spreadsheets
'''
def __init__(self, sheet_id, sheet_range='A:Z', no_cache=False):
self._sheet_id = sheet_id
self._sheet_r... | [
"akagi.data_file.DataFile.spreadsheet"
] | [((396, 451), 'akagi.data_file.DataFile.spreadsheet', 'DataFile.spreadsheet', (['self._sheet_id', 'self._sheet_range'], {}), '(self._sheet_id, self._sheet_range)\n', (416, 451), False, 'from akagi.data_file import DataFile\n')] |
"""
File: my_drawing.py
Name: 黃科諺
----------------------
TODO:
"""
from campy.graphics.gobjects import GOval, GRect, GLine, GLabel, GPolygon, GArc
from campy.graphics.gwindow import GWindow
def main():
"""
Meet Snorlax (卡比獸) of stanCode! He dreams of Python when he sleeps. Be like Snorlax.
"""
window... | [
"campy.graphics.gobjects.GPolygon",
"campy.graphics.gobjects.GLabel",
"campy.graphics.gwindow.GWindow",
"campy.graphics.gobjects.GLine",
"campy.graphics.gobjects.GOval"
] | [((323, 353), 'campy.graphics.gwindow.GWindow', 'GWindow', ([], {'width': '(300)', 'height': '(300)'}), '(width=300, height=300)\n', (330, 353), False, 'from campy.graphics.gwindow import GWindow\n'), ((371, 419), 'campy.graphics.gobjects.GOval', 'GOval', (['(120)', '(75)'], {'x': '((window.width - 120) / 2)', 'y': '(5... |
from girder.exceptions import ValidationException
from girder.utility import setting_utilities
class PluginSettings:
AUTO_COMPUTE = 'hashsum_download.auto_compute'
@setting_utilities.default(PluginSettings.AUTO_COMPUTE)
def _defaultAutoCompute():
return False
@setting_utilities.validator(PluginSettings.AU... | [
"girder.exceptions.ValidationException",
"girder.utility.setting_utilities.default",
"girder.utility.setting_utilities.validator"
] | [((173, 227), 'girder.utility.setting_utilities.default', 'setting_utilities.default', (['PluginSettings.AUTO_COMPUTE'], {}), '(PluginSettings.AUTO_COMPUTE)\n', (198, 227), False, 'from girder.utility import setting_utilities\n'), ((275, 331), 'girder.utility.setting_utilities.validator', 'setting_utilities.validator',... |
from collections import defaultdict, namedtuple
from dataclasses import dataclass
import distutils.util
import functools
import itertools
import json
import math
import operator
import os
import random
import uuid
import shutil
import logging
import time
from typing import List, Dict, NamedTuple, Optional
from django... | [
"logging.getLogger",
"itertools.chain",
"requests.post",
"expiringdict.ExpiringDict",
"django.shortcuts.get_list_or_404",
"django.shortcuts.get_object_or_404",
"rest_framework.decorators.api_view",
"json.loads",
"collections.namedtuple",
"random.shuffle",
"django.http.JsonResponse",
"requests.... | [((879, 906), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (896, 906), False, 'import logging\n'), ((909, 927), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (917, 927), False, 'from rest_framework.decorators import api_view\n'), ((1384, 1401), 'r... |
from __future__ import absolute_import
import os
import yaml
from ccmlib import common, extension, repository
from ccmlib.cluster import Cluster
from ccmlib.dse_cluster import DseCluster
from ccmlib.node import Node
from distutils.version import LooseVersion #pylint: disable=import-error, no-name-in-module
class... | [
"distutils.version.LooseVersion",
"ccmlib.repository.validate",
"os.path.join",
"ccmlib.common.LoadError",
"ccmlib.dse_cluster.DseCluster",
"yaml.safe_load",
"ccmlib.extension.load_from_cluster_config",
"ccmlib.common.isDse",
"ccmlib.node.Node.load",
"ccmlib.cluster.Cluster"
] | [((407, 431), 'os.path.join', 'os.path.join', (['path', 'name'], {}), '(path, name)\n', (419, 431), False, 'import os\n'), ((451, 493), 'os.path.join', 'os.path.join', (['cluster_path', '"""cluster.conf"""'], {}), "(cluster_path, 'cluster.conf')\n", (463, 493), False, 'import os\n'), ((552, 569), 'yaml.safe_load', 'yam... |
# Copyright 2019-2020 QuantumBlack Visual Analytics Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# THE SOFTWARE IS PROVIDED "AS IS"... | [
"itertools.permutations",
"copy.deepcopy",
"numpy.hstack"
] | [((7215, 7242), 'numpy.hstack', 'np.hstack', (['[X, new_columns]'], {}), '([X, new_columns])\n', (7224, 7242), True, 'import numpy as np\n'), ((8158, 8178), 'copy.deepcopy', 'deepcopy', (['tabu_edges'], {}), '(tabu_edges)\n', (8166, 8178), False, 'from copy import deepcopy\n'), ((9531, 9551), 'copy.deepcopy', 'deepcopy... |
"""Module for BlameInteractionGraph plots."""
import typing as tp
from datetime import datetime
from pathlib import Path
import click
import matplotlib.pyplot as plt
import networkx as nx
import pandas as pd
import plotly.offline as offply
from matplotlib import style
from varats.data.reports.blame_interaction_graph... | [
"varats.data.reports.blame_interaction_graph.create_blame_interaction_graph",
"click.Choice",
"datetime.datetime.utcfromtimestamp",
"datetime.datetime",
"varats.utils.git_util.create_commit_lookup_helper",
"varats.plots.chord_plot_utils.make_arc_plot",
"varats.paper_mgmt.case_study.newest_processed_revi... | [((2528, 2588), 'typing.TypeVar', 'tp.TypeVar', (['"""NodeInfoTy"""', 'ChordPlotNodeInfo', 'ArcPlotNodeInfo'], {}), "('NodeInfoTy', ChordPlotNodeInfo, ArcPlotNodeInfo)\n", (2538, 2588), True, 'import typing as tp\n'), ((2602, 2662), 'typing.TypeVar', 'tp.TypeVar', (['"""EdgeInfoTy"""', 'ChordPlotEdgeInfo', 'ArcPlotEdge... |
import re
class Rule:
def __init__(self, line):
line = line.strip().split(" contain ")
line[1] = line[1].strip(".").split(", ")
self.contents = {}
for item in line[1]:
# Grab that number out in front
regex = re.compile(r"[0-9]+")
# If we didn't f... | [
"re.compile"
] | [((270, 290), 're.compile', 're.compile', (['"""[0-9]+"""'], {}), "('[0-9]+')\n", (280, 290), False, 'import re\n')] |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi SDK Generator. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import _utilities
from... | [
"pulumi.getter",
"pulumi.log.warn",
"pulumi.set",
"pulumi.get"
] | [((2507, 2538), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""restApiId"""'}), "(name='restApiId')\n", (2520, 2538), False, 'import pulumi\n'), ((2781, 2812), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""stageName"""'}), "(name='stageName')\n", (2794, 2812), False, 'import pulumi\n'), ((6540, 6576), 'pulum... |
# ------------------------------------------------------------------------------
# Project: legohdl
# Script: workspace.py
# Author: <NAME>
# Description:
# The Workspace class. A Workspace object has a path and a list of available
# vendors. This is what the user keeps their work's scope within for a given
# "or... | [
"os.path.exists",
"os.listdir",
"os.makedirs",
"os.path.split",
"datetime.datetime.now",
"os.path.isdir",
"datetime.datetime.fromisoformat",
"shutil.rmtree",
"logging.info",
"logging.error",
"os.remove"
] | [((20508, 20547), 'logging.info', 'log.info', (['"""Collecting all unit data..."""'], {}), "('Collecting all unit data...')\n", (20516, 20547), True, 'import logging as log\n'), ((20707, 20724), 'logging.info', 'log.info', (['"""done."""'], {}), "('done.')\n", (20715, 20724), True, 'import logging as log\n'), ((28845, ... |
import os
from PIL import Image
import seaborn as sn
import matplotlib.pyplot as plt
import torch
import torch.nn.functional as F
from sidechainnet.utils.sequence import ProteinVocabulary
from einops import rearrange
# general functions
def exists(val):
return val is not None
def default(val, d):
return va... | [
"os.path.expanduser",
"os.path.exists",
"PIL.Image.open",
"torch.hub.load",
"os.makedirs",
"os.getenv",
"sidechainnet.utils.sequence.ProteinVocabulary",
"torch.load",
"matplotlib.pyplot.clf",
"os.path.join",
"einops.rearrange",
"torch.save",
"torch.nn.functional.pad",
"torch.no_grad",
"t... | [((1710, 1729), 'sidechainnet.utils.sequence.ProteinVocabulary', 'ProteinVocabulary', ([], {}), '()\n', (1727, 1729), False, 'from sidechainnet.utils.sequence import ProteinVocabulary\n'), ((3236, 3274), 'os.makedirs', 'os.makedirs', (['CACHE_PATH'], {'exist_ok': '(True)'}), '(CACHE_PATH, exist_ok=True)\n', (3247, 3274... |
from adam_visual_perception import LandmarkDetector
from adam_visual_perception.utility import *
import numpy as np
import math
import cv2
import os
import sys
class HeadGazeEstimator:
""" A class for estimating gaze ray from facial landmarks """
def __init__(self, write_video=False):
# 3D model poin... | [
"os.makedirs",
"cv2.line",
"math.sqrt",
"os.path.join",
"cv2.imshow",
"cv2.VideoWriter",
"numpy.array",
"numpy.zeros",
"cv2.solvePnP",
"cv2.destroyAllWindows",
"adam_visual_perception.LandmarkDetector",
"cv2.VideoCapture",
"sys.exit",
"cv2.VideoWriter_fourcc",
"os.path.isdir",
"os.path... | [((352, 506), 'numpy.array', 'np.array', (['[(0.0, 0.0, 0.0), (0.0, -330.0, -65.0), (-225.0, 170.0, -135.0), (225.0, \n 170.0, -135.0), (-150.0, -150.0, -125.0), (150.0, -150.0, -125.0)]'], {}), '([(0.0, 0.0, 0.0), (0.0, -330.0, -65.0), (-225.0, 170.0, -135.0), (\n 225.0, 170.0, -135.0), (-150.0, -150.0, -125.0),... |
# -*- coding: utf-8 -*-
import disnake
from disnake.ext import commands
from pypoca.config import COLOR, URLS
from pypoca.database import Server
from pypoca.ext import ALL, DEFAULT, Choice, Option
class General(commands.Cog):
def __init__(self, bot: commands.Bot):
self.bot = bot
@commands.slash_comm... | [
"disnake.Embed",
"disnake.ui.View",
"pypoca.database.Server.get_by_id",
"disnake.ext.commands.slash_command",
"disnake.ui.Button"
] | [((301, 378), 'disnake.ext.commands.slash_command', 'commands.slash_command', ([], {'name': '"""ping"""', 'description': "DEFAULT['COMMAND_PING_DESC']"}), "(name='ping', description=DEFAULT['COMMAND_PING_DESC'])\n", (323, 378), False, 'from disnake.ext import commands\n'), ((859, 936), 'disnake.ext.commands.slash_comma... |
import time
from collections import deque
import gym
import numpy as np
from stable_baselines import logger, PPO2
from stable_baselines.a2c.utils import total_episode_reward_logger
from stable_baselines.common import explained_variance, TensorboardWriter
from stable_baselines.common.runners import AbstractEnvRunner
fr... | [
"numpy.clip",
"numpy.copy",
"numpy.mean",
"stable_baselines.logger.logkv",
"collections.deque",
"stable_baselines.common.explained_variance",
"time.time",
"numpy.asarray",
"numpy.sum",
"numpy.zeros",
"stable_baselines.common.TensorboardWriter",
"stable_baselines.ppo2.ppo2.safe_mean",
"stable... | [((724, 759), 'stable_baselines.ppo2.ppo2.get_schedule_fn', 'get_schedule_fn', (['self.learning_rate'], {}), '(self.learning_rate)\n', (739, 759), False, 'from stable_baselines.ppo2.ppo2 import get_schedule_fn, safe_mean, swap_and_flatten\n'), ((785, 816), 'stable_baselines.ppo2.ppo2.get_schedule_fn', 'get_schedule_fn'... |
# -*- coding: utf-8 -*-
"""
fillRasterwithPatches.py
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Gene... | [
"osgeo.gdal.Open",
"PyQt5.QtCore.QCoreApplication.translate",
"osgeo.osr.SpatialReference",
"qgis.core.QgsApplication.locale",
"lftools.geocapt.dip.Interpolar",
"os.path.dirname",
"qgis.core.QgsProject.instance",
"lftools.geocapt.imgs.Imgs",
"osgeo.gdal_array.NumericTypeCodeToGDALTypeCode",
"osgeo... | [((2401, 2424), 'qgis.core.QgsApplication.locale', 'QgsApplication.locale', ([], {}), '()\n', (2422, 2424), False, 'from qgis.core import QgsProcessing, QgsFeatureSink, QgsWkbTypes, QgsFields, QgsField, QgsFeature, QgsPointXY, QgsGeometry, QgsProcessingException, QgsProcessingAlgorithm, QgsProcessingParameterString, Qg... |
from PyQt5.QtWidgets import QDialog
from PyQt5.QtGui import QFont
from PyQt5.QtCore import Qt
from dockwina import Ui_Form as docka
class Dialog(QDialog, docka):
def __init__(self):
super(Dialog, self).__init__()
QDialog.__init__(self)
self.setupUi(self)
self.setWindowFlag... | [
"PyQt5.QtWidgets.QDialog.__init__",
"PyQt5.QtGui.QFont"
] | [((242, 264), 'PyQt5.QtWidgets.QDialog.__init__', 'QDialog.__init__', (['self'], {}), '(self)\n', (258, 264), False, 'from PyQt5.QtWidgets import QDialog\n'), ((367, 386), 'PyQt5.QtGui.QFont', 'QFont', (['"""Tajawal"""', '(9)'], {}), "('Tajawal', 9)\n", (372, 386), False, 'from PyQt5.QtGui import QFont\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os, sys, warnings
parent = os.path.dirname(os.path.abspath(__file__))
sys.path.insert(0, parent)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "test_project.settings")
import django
from django.core.management import exe... | [
"os.environ.setdefault",
"sys.path.insert",
"django.core.management.execute_from_command_line",
"warnings.simplefilter",
"os.path.abspath",
"warnings.filterwarnings"
] | [((166, 192), 'sys.path.insert', 'sys.path.insert', (['(0)', 'parent'], {}), '(0, parent)\n', (181, 192), False, 'import os, sys, warnings\n'), ((193, 265), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""test_project.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'test_project.... |
#!/usr/bin/env python3
import concurrent.futures
import logging
import requests
from sys import argv, exit
from urllib.parse import urlparse
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger(__name__)
HEADERS = {
'User-Agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_4) AppleWebKit/537.... | [
"logging.basicConfig",
"logging.getLogger",
"urllib.parse.urlparse",
"logging.debug",
"requests.get",
"sys.exit",
"logging.info"
] | [((142, 182), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (161, 182), False, 'import logging\n'), ((192, 219), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (209, 219), False, 'import logging\n'), ((457, 492), 'sys.exit', 'ex... |
#!/usr/bin/env python
# coding: utf-8
"""
Multi-Sensor Moving Platform Simulation Example
===============================================
This example looks at how multiple sensors can be mounted on a single moving platform and exploiting a defined moving
platform as a sensor target.
"""
# %%
# Building a Simulated M... | [
"stonesoup.updater.particle.ParticleUpdater",
"stonesoup.platform.base.MovingPlatform",
"stonesoup.simulator.simple.DummyGroundTruthSimulator",
"stonesoup.measures.Mahalanobis",
"stonesoup.functions.sphere2cart",
"numpy.array",
"datetime.timedelta",
"stonesoup.simulator.platform.PlatformDetectionSimul... | [((2101, 2115), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (2113, 2115), False, 'from datetime import datetime\n'), ((3612, 3659), 'stonesoup.types.array.StateVector', 'StateVector', (['[[0], [0], [0], [50], [8000], [0]]'], {}), '([[0], [0], [0], [50], [8000], [0]])\n', (3623, 3659), False, 'from stones... |
#!/usr/bin/env python
#
# This program shows how to use MPI_Alltoall. Each processor
# send/rec a different random number to/from other processors.
#
# numpy is required
import numpy
from numpy import *
# mpi4py module
from mpi4py import MPI
import sys
def myquit(mes):
MPI.Finalize()
print(mes)
... | [
"mpi4py.MPI.Finalize",
"sys.exit"
] | [((895, 909), 'mpi4py.MPI.Finalize', 'MPI.Finalize', ([], {}), '()\n', (907, 909), False, 'from mpi4py import MPI\n'), ((284, 298), 'mpi4py.MPI.Finalize', 'MPI.Finalize', ([], {}), '()\n', (296, 298), False, 'from mpi4py import MPI\n'), ((326, 336), 'sys.exit', 'sys.exit', ([], {}), '()\n', (334, 336), False, 'import s... |
""" render_fmo.py renders obj file to rgb image with fmo model
Aviable function:
- clear_mash: delete all the mesh in the secene
- scene_setting_init: set scene configurations
- node_setting_init: set node configurations
- render: render rgb image for one obj file and one viewpoint
- render_obj: wrapper function for r... | [
"os.open",
"numpy.array",
"bpy.data.images.load",
"bpy.data.images.remove",
"os.remove",
"bpy.ops.object.delete",
"os.path.exists",
"numpy.mean",
"os.listdir",
"scipy.signal.fftconvolve",
"bpy.data.textures.remove",
"numpy.max",
"os.dup",
"numpy.linspace",
"bpy.ops.object.lamp_add",
"o... | [((869, 894), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (884, 894), False, 'import os\n'), ((911, 936), 'os.path.dirname', 'os.path.dirname', (['abs_path'], {}), '(abs_path)\n', (926, 936), False, 'import os\n'), ((1235, 1250), 'numpy.max', 'np.max', (['[2, ns]'], {}), '([2, ns])\n', (12... |
# coding=utf-8
import sys
import argparse
import os
from tensorflow.python.platform import gfile
import numpy as np
import tensorflow as tf
from tensorflow.python.layers.core import Dense
from utils.data_manager import load_data, load_data_one
from collections import defaultdict
from argparse import ArgumentParser
fro... | [
"tensorflow.local_variables_initializer",
"tensorflow.Graph",
"sys.setdefaultencoding",
"tensorflow.reset_default_graph",
"tensorflow.InteractiveSession",
"argparse.ArgumentParser",
"utils.data_manager.load_data",
"tensorflow.placeholder",
"tf_helper.decode_data_recover",
"tensorflow.train.Saver",... | [((378, 408), 'sys.setdefaultencoding', 'sys.setdefaultencoding', (['"""utf8"""'], {}), "('utf8')\n", (400, 408), False, 'import sys\n'), ((594, 619), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (617, 619), False, 'import argparse\n'), ((4551, 4575), 'tensorflow.reset_default_graph', 'tf.res... |
"""CD SEM structures."""
from functools import partial
from typing import Optional, Tuple
from gdsfactory.cell import cell
from gdsfactory.component import Component
from gdsfactory.components.straight import straight as straight_function
from gdsfactory.components.text_rectangular import text_rectangular
from gdsfact... | [
"functools.partial",
"gdsfactory.components.straight.straight",
"gdsfactory.grid.grid"
] | [((476, 509), 'functools.partial', 'partial', (['text_rectangular'], {'size': '(1)'}), '(text_rectangular, size=1)\n', (483, 509), False, 'from functools import partial\n'), ((1424, 1457), 'gdsfactory.grid.grid', 'grid', (['lines'], {'spacing': '(0, spacing)'}), '(lines, spacing=(0, spacing))\n', (1428, 1457), False, '... |
#!/usr/bin/env python3
# Copyright 2019-2022 <NAME>, <NAME>, <NAME>
#
# This file is part of WarpX.
#
# License: BSD-3-Clause-LBNL
# This script tests the reduced particle diagnostics.
# The setup is a uniform plasma with electrons, protons and photons.
# Various particle and field quantities are written to file usin... | [
"sys.path.insert",
"numpy.where",
"openpmd_api.Series",
"os.getcwd",
"checksumAPI.evaluate_checksum",
"numpy.zeros",
"yt.load",
"numpy.all"
] | [((667, 727), 'sys.path.insert', 'sys.path.insert', (['(1)', '"""../../../../warpx/Regression/Checksum/"""'], {}), "(1, '../../../../warpx/Regression/Checksum/')\n", (682, 727), False, 'import sys\n'), ((823, 834), 'yt.load', 'yt.load', (['fn'], {}), '(fn)\n', (830, 834), False, 'import yt\n'), ((964, 1025), 'openpmd_a... |
"""
The MIT License (MIT)
Copyright (c) 2017 <NAME>
Copyright (c) 2017 <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, ... | [
"os.path.splitext"
] | [((8112, 8138), 'os.path.splitext', 'os.path.splitext', (['filepath'], {}), '(filepath)\n', (8128, 8138), False, 'import os\n')] |
import json
import kfp.dsl as _kfp_dsl
import kfp.components as _kfp_components
from collections import OrderedDict
from kubernetes import client as k8s_client
def step1():
from kale.common import mlmdutils as _kale_mlmdutils
_kale_mlmdutils.init_metadata()
from kale.marshal.decorator import marshal as... | [
"kale.common.kfputils.run_pipeline",
"kfp.components.func_to_container_op",
"kale.common.runutils.ttl",
"collections.OrderedDict",
"kfp.dsl.VolumeOp",
"kfp.Client",
"kubernetes.client.V1SecurityContext",
"json.dumps",
"kale.common.mlmdutils.init_metadata",
"kfp.dsl.pipeline",
"kale.common.mlmdut... | [((1939, 1982), 'kfp.components.func_to_container_op', '_kfp_components.func_to_container_op', (['step1'], {}), '(step1)\n', (1975, 1982), True, 'import kfp.components as _kfp_components\n'), ((2002, 2045), 'kfp.components.func_to_container_op', '_kfp_components.func_to_container_op', (['step2'], {}), '(step2)\n', (203... |
from django.urls import path
from . import views
urlpatterns = [
path('list', views.list_view),
path('add', views.add_view),
] | [
"django.urls.path"
] | [((70, 99), 'django.urls.path', 'path', (['"""list"""', 'views.list_view'], {}), "('list', views.list_view)\n", (74, 99), False, 'from django.urls import path\n'), ((105, 132), 'django.urls.path', 'path', (['"""add"""', 'views.add_view'], {}), "('add', views.add_view)\n", (109, 132), False, 'from django.urls import pat... |
import json
import logging
import socket
from roombapy.roomba_info import RoombaInfo
class RoombaDiscovery:
udp_bind_address = ""
udp_address = "<broadcast>"
udp_port = 5678
roomba_message = "irobotmcs"
amount_of_broadcasted_messages = 5
server_socket = None
log = None
def __init__(s... | [
"logging.getLogger",
"json.loads",
"roombapy.roomba_info.RoombaInfo",
"socket.socket"
] | [((2621, 2637), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (2631, 2637), False, 'import json\n'), ((2649, 2889), 'roombapy.roomba_info.RoombaInfo', 'RoombaInfo', ([], {'hostname': "json_response['hostname']", 'robot_name': "json_response['robotname']", 'ip': "json_response['ip']", 'mac': "json_response['ma... |
import warnings
warnings.simplefilter("ignore", category=FutureWarning)
from pmaf.biome.essentials._metakit import EssentialFeatureMetabase
from pmaf.biome.essentials._base import EssentialBackboneBase
from pmaf.internal._constants import (
AVAIL_TAXONOMY_NOTATIONS,
jRegexGG,
jRegexQIIME,
BIOM_TAXONOMY... | [
"pmaf.internal._shared.generate_lineages_from_taxa",
"pandas.read_csv",
"pmaf.internal._shared.indentify_taxon_notation",
"pmaf.internal._shared.extract_valid_ranks",
"pmaf.internal._shared.get_rank_upto",
"biom.load_table",
"numpy.asarray",
"pandas.DataFrame",
"warnings.simplefilter",
"pandas.not... | [((17, 72), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""'], {'category': 'FutureWarning'}), "('ignore', category=FutureWarning)\n", (38, 72), False, 'import warnings\n'), ((6508, 6533), 'biom.load_table', 'biom.load_table', (['filepath'], {}), '(filepath)\n', (6523, 6533), False, 'import biom\n'), ... |
from typing import List
import numpy as np
def mask_nan(arrays: List[np.ndarray]) -> List[np.ndarray]:
"""
Drop indices from equal-sized arrays if the element at that index is NaN in
any of the input arrays.
Parameters
----------
arrays : List[np.ndarray]
list of ndarrays containing ... | [
"numpy.where",
"numpy.array",
"numpy.isnan"
] | [((908, 929), 'numpy.array', 'np.array', (['([False] * n)'], {}), '([False] * n)\n', (916, 929), True, 'import numpy as np\n'), ((988, 1001), 'numpy.isnan', 'np.isnan', (['arr'], {}), '(arr)\n', (996, 1001), True, 'import numpy as np\n'), ((1019, 1034), 'numpy.where', 'np.where', (['(~mask)'], {}), '(~mask)\n', (1027, ... |
# Generated by Django 3.1.1 on 2020-09-08 18:18
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('grocery', '0003_auto_202... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ForeignKey"
] | [((227, 284), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (258, 284), False, 'from django.db import migrations, models\n'), ((465, 582), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on... |
from os import getenv
from typing import Optional, Dict
from flask import Flask
TestConfig = Optional[Dict[str, bool]]
def create_app(test_config: TestConfig = None) -> Flask:
""" App factory method to initialize the application with given configuration """
app: Flask = Flask(__name__)
if test_config ... | [
"os.getenv",
"flask.Flask"
] | [((284, 299), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (289, 299), False, 'from flask import Flask\n'), ((951, 977), 'os.getenv', 'getenv', (['"""DOCKER_IMAGE_TAG"""'], {}), "('DOCKER_IMAGE_TAG')\n", (957, 977), False, 'from os import getenv\n')] |
# coding=utf-8
"""
This code was generated by
\ / _ _ _| _ _
| (_)\/(_)(_|\/| |(/_ v1.0.0
/ /
"""
from twilio.base import deserialize
from twilio.base import values
from twilio.base.instance_context import InstanceContext
from twilio.base.instance_resource import InstanceResource
from twilio.base.... | [
"twilio.base.deserialize.integer",
"twilio.base.deserialize.rfc2822_datetime",
"twilio.base.values.of"
] | [((4678, 4736), 'twilio.base.values.of', 'values.of', (["{'QualityScore': quality_score, 'Issue': issue}"], {}), "({'QualityScore': quality_score, 'Issue': issue})\n", (4687, 4736), False, 'from twilio.base import values\n'), ((5302, 5315), 'twilio.base.values.of', 'values.of', (['{}'], {}), '({})\n', (5311, 5315), Fal... |
from calendar import timegm
from datetime import datetime
from typing import Any, Dict
from fastapi import HTTPException
from pydantic import BaseModel, Field
from starlette import status
from .base import UserInfoAuth
from .messages import NOT_VERIFIED
from .verification import JWKS, ExtraVerifier
class FirebaseCl... | [
"pydantic.Field",
"fastapi.HTTPException",
"datetime.datetime.utcnow"
] | [((356, 378), 'pydantic.Field', 'Field', ([], {'alias': '"""user_id"""'}), "(alias='user_id')\n", (361, 378), False, 'from pydantic import BaseModel, Field\n'), ((396, 422), 'pydantic.Field', 'Field', (['None'], {'alias': '"""email"""'}), "(None, alias='email')\n", (401, 422), False, 'from pydantic import BaseModel, Fi... |
import sqlite3
import mock
import opbeat.instrumentation.control
from tests.helpers import get_tempstoreclient
from tests.utils.compat import TestCase
class InstrumentSQLiteTest(TestCase):
def setUp(self):
self.client = get_tempstoreclient()
opbeat.instrumentation.control.instrument()
@mock... | [
"sqlite3.connect",
"mock.patch",
"tests.helpers.get_tempstoreclient"
] | [((316, 372), 'mock.patch', 'mock.patch', (['"""opbeat.traces.RequestsStore.should_collect"""'], {}), "('opbeat.traces.RequestsStore.should_collect')\n", (326, 372), False, 'import mock\n'), ((236, 257), 'tests.helpers.get_tempstoreclient', 'get_tempstoreclient', ([], {}), '()\n', (255, 257), False, 'from tests.helpers... |
from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
description='This MLOps project aims to use the Transformers framework from Hugging Face in order to tweak a pre-trained NLP model to accurately gauge the sentiment of an Amazon review (being able ... | [
"setuptools.find_packages"
] | [((81, 96), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (94, 96), False, 'from setuptools import find_packages, setup\n')] |
import sys
import io
input_txt = """
44
"""
sys.stdin = io.StringIO(input_txt)
tmp = input()
# copy the below part and paste to the submission form.
# ---------function------------
def fibonacci(n):
if n <= 1:
return 1
fib_array = [1] * 45
for i in range(2, n+1):
fib_ar... | [
"io.StringIO"
] | [((65, 87), 'io.StringIO', 'io.StringIO', (['input_txt'], {}), '(input_txt)\n', (76, 87), False, 'import io\n')] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import numpy as np
# continuously differentiable
fn_dict_cdiff = {'2dpoly': 1, 'sigmoid': 2,
'sin': 3, 'frequent_sin': 4,
'3dpoly': 7, 'linear': 8}
# continuous but not differentiable
fn_dict_cont = {'abs': 0, '... | [
"numpy.random.normal",
"numpy.sqrt",
"numpy.amin",
"numpy.hstack",
"numpy.searchsorted",
"numpy.power",
"numpy.random.randint",
"numpy.random.uniform",
"numpy.arange"
] | [((1272, 1311), 'numpy.random.uniform', 'np.random.uniform', (['(-4)', '(4)'], {'size': 'n_pieces'}), '(-4, 4, size=n_pieces)\n', (1289, 1311), True, 'import numpy as np\n'), ((4108, 4151), 'numpy.random.normal', 'np.random.normal', (['(0)', '(1)'], {'size': '(n_samples, 1)'}), '(0, 1, size=(n_samples, 1))\n', (4124, 4... |
import argparse
import os
import pathlib
import cv2
import pickle
import numpy as np
from matplotlib import pyplot as plt
from PIL import Image
from numpy import genfromtxt
def parse_command_line_options(print_options=False):
parser = argparse.ArgumentParser()
parser.add_argument("-n", type=int, default=-1)... | [
"matplotlib.pyplot.fill_between",
"numpy.array",
"cv2.destroyAllWindows",
"matplotlib.pyplot.errorbar",
"numpy.mean",
"os.path.exists",
"os.listdir",
"argparse.ArgumentParser",
"matplotlib.pyplot.plot",
"os.mkdir",
"cv2.VideoWriter_fourcc",
"matplotlib.pyplot.gca",
"pickle.load",
"numpy.st... | [((243, 268), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (266, 268), False, 'import argparse\n'), ((1698, 1723), 'pickle.dump', 'pickle.dump', (['object', 'file'], {}), '(object, file)\n', (1709, 1723), False, 'import pickle\n'), ((1986, 2003), 'pickle.load', 'pickle.load', (['file'], {}), ... |
from pygments import highlight as _highlight
from pygments.lexers import SqlLexer
from pygments.formatters import HtmlFormatter
def style():
style = HtmlFormatter().get_style_defs()
return style
def highlight(text):
# Generated HTML contains unnecessary newline at the end
# before </pre> closing tag... | [
"pygments.lexers.SqlLexer",
"pygments.formatters.HtmlFormatter"
] | [((155, 170), 'pygments.formatters.HtmlFormatter', 'HtmlFormatter', ([], {}), '()\n', (168, 170), False, 'from pygments.formatters import HtmlFormatter\n'), ((510, 520), 'pygments.lexers.SqlLexer', 'SqlLexer', ([], {}), '()\n', (518, 520), False, 'from pygments.lexers import SqlLexer\n'), ((522, 537), 'pygments.formatt... |
import numpy as np
def histogram_r(r_array,height, width):
length = height * width
R_rray = []
for i in range(height):
for j in range(width):
R_rray.append(r_array[i][j])
R_rray.sort()
I_min = int(R_rray[int(length / 500)])
I_max = int(R_rray[-int(length / 500)])
array_G... | [
"numpy.zeros"
] | [((349, 374), 'numpy.zeros', 'np.zeros', (['(height, width)'], {}), '((height, width))\n', (357, 374), True, 'import numpy as np\n'), ((1279, 1304), 'numpy.zeros', 'np.zeros', (['(height, width)'], {}), '((height, width))\n', (1287, 1304), True, 'import numpy as np\n'), ((2189, 2214), 'numpy.zeros', 'np.zeros', (['(hei... |
# Copyright 2021 Sony Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"nnabla.parametric_functions.affine",
"nnabla.parametric_functions.convolution",
"nnabla.clear_parameters",
"nnabla.parametric_functions.batch_normalization",
"nnabla.parameter_scope",
"numpy.array",
"nnabla.Variable",
"numpy.sin",
"pytest.skip",
"nnabla.experimental.tb_graph_writer.TBGraphWriter"... | [((922, 943), 'nnabla.clear_parameters', 'nn.clear_parameters', ([], {}), '()\n', (941, 943), True, 'import nnabla as nn\n'), ((952, 977), 'nnabla.Variable', 'nn.Variable', (['(2, 3, 4, 4)'], {}), '((2, 3, 4, 4))\n', (963, 977), True, 'import nnabla as nn\n'), ((987, 1011), 'nnabla.parameter_scope', 'nn.parameter_scope... |
import json
import logging
LOGGER = logging.getLogger(__name__)
def start(self):
self.start_consuming()
def on_message(self, channel, method, properties, body):
"""
Invoked by pika when a message is delivered from the AMQP broker. The
channel is passed for convenience. The basic_deliver object tha... | [
"logging.getLogger",
"json.loads"
] | [((38, 65), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (55, 65), False, 'import logging\n'), ((1110, 1126), 'json.loads', 'json.loads', (['body'], {}), '(body)\n', (1120, 1126), False, 'import json\n')] |
import numpy as np
import tensorflow as tf
from time import perf_counter as timer
def main():
x = np.load('data/cifar_test_x.npy')
y = np.load('data/cifar_test_y.npy').flatten()
interpreter = tf.lite.Interpreter(model_path='data/fbnet.tflite')
interpreter.allocate_tensors()
input_details = inter... | [
"tensorflow.lite.Interpreter",
"numpy.load",
"time.perf_counter"
] | [((104, 136), 'numpy.load', 'np.load', (['"""data/cifar_test_x.npy"""'], {}), "('data/cifar_test_x.npy')\n", (111, 136), True, 'import numpy as np\n'), ((207, 258), 'tensorflow.lite.Interpreter', 'tf.lite.Interpreter', ([], {'model_path': '"""data/fbnet.tflite"""'}), "(model_path='data/fbnet.tflite')\n", (226, 258), Tr... |
from panda3d.core import *
from direct.showbase.DirectObject import DirectObject
from toontown.toonbase.ToonBaseGlobal import *
from direct.directnotify import DirectNotifyGlobal
from direct.interval.IntervalGlobal import *
from toontown.battle.BattleProps import *
from toontown.battle import MovieUtil
import math
cla... | [
"direct.directnotify.DirectNotifyGlobal.directNotify.newCategory",
"math.sin",
"toontown.battle.MovieUtil.showProp",
"toontown.battle.MovieUtil.removeProp"
] | [((365, 425), 'direct.directnotify.DirectNotifyGlobal.directNotify.newCategory', 'DirectNotifyGlobal.directNotify.newCategory', (['"""TwoDBattleMgr"""'], {}), "('TwoDBattleMgr')\n", (408, 425), False, 'from direct.directnotify import DirectNotifyGlobal\n'), ((1723, 1756), 'toontown.battle.MovieUtil.removeProp', 'MovieU... |
from collections import defaultdict
from pathlib import Path
import re
import yaml
import json
from botok import Text
import pyewts
conv = pyewts.pyewts()
def dictify_text(string, is_split=False, selection_yaml='data/dictionaries/dict_cats.yaml', expandable=True, mode='en_bo'):
"""
takes segmented text and... | [
"re.split",
"pathlib.Path",
"json.dumps",
"pyewts.pyewts",
"collections.defaultdict",
"re.findall",
"botok.Text"
] | [((142, 157), 'pyewts.pyewts', 'pyewts.pyewts', ([], {}), '()\n', (155, 157), False, 'import pyewts\n'), ((1689, 1706), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (1700, 1706), False, 'from collections import defaultdict\n'), ((2833, 2858), 're.findall', 're.findall', (['monlam', 'entry'], {}... |
# coding: utf-8
import pytest
from edipy import fields, validators, exceptions
@pytest.mark.parametrize('fixed_type, data', [
(fields.Integer(1, validators=[validators.Range(1, 5)]), '1'),
(fields.Integer(1, validators=[validators.MaxValue(3)]), '2'),
(fields.Integer(1, validators=[validators.MinValue(1... | [
"edipy.validators.MaxValue",
"edipy.validators.Email",
"pytest.fail",
"pytest.raises",
"edipy.validators.Range",
"edipy.validators.Regex",
"edipy.validators.MinValue"
] | [((903, 944), 'pytest.raises', 'pytest.raises', (['exceptions.ValidationError'], {}), '(exceptions.ValidationError)\n', (916, 944), False, 'import pytest\n'), ((1220, 1261), 'pytest.raises', 'pytest.raises', (['exceptions.ValidationError'], {}), '(exceptions.ValidationError)\n', (1233, 1261), False, 'import pytest\n'),... |
################################################################################
# Module: schedule.py
# Description: Functions for handling conversion of EnergyPlus schedule objects
# License: MIT, see full license in LICENSE.txt
# Web: https://github.com/samuelduchesne/archetypal
#####################################... | [
"archetypal.check_unique_name",
"pandas.read_csv",
"pandas.Grouper",
"archetypal.settings.unique_schedules.append",
"numpy.array",
"datetime.timedelta",
"archetypal.log",
"pandas.date_range",
"numpy.arange",
"datetime.datetime",
"numpy.mean",
"io.StringIO",
"functools.reduce",
"os.path.dir... | [((44582, 44619), 'functools.reduce', 'functools.reduce', (['logical', 'conditions'], {}), '(logical, conditions)\n', (44598, 44619), False, 'import functools\n'), ((2337, 2356), 'io.StringIO', 'io.StringIO', (['idftxt'], {}), '(idftxt)\n', (2348, 2356), False, 'import io\n'), ((2436, 2459), 'archetypal.IDF', 'archetyp... |
import os
# import torch
import argparse
import base64
import sys
import io
import torch
import torch.nn as nn
from torchvision import transforms
from torch.utils.data import DataLoader
from torch.utils.data.sampler import SubsetRandomSampler
def fullmodel2base64(model):
buffer = io.BytesIO()
torch.save(mode... | [
"base64.b64encode",
"io.BytesIO",
"base64.b64decode",
"torch.save"
] | [((288, 300), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (298, 300), False, 'import io\n'), ((305, 330), 'torch.save', 'torch.save', (['model', 'buffer'], {}), '(model, buffer)\n', (315, 330), False, 'import torch\n'), ((490, 516), 'base64.b64decode', 'base64.b64decode', (['inputrpc'], {}), '(inputrpc)\n', (506, 516... |
# coding: utf-8
import io
import os
import shutil
import tempfile
import unittest
from edo_client import WoClient
class ContentApi_DownloadTestCase(unittest.TestCase):
'''
- Basically this is to ensure
all the facilities related to HTTP range headers are working properly;
'''
@classmethod
... | [
"os.close",
"io.BytesIO",
"tempfile.mkdtemp",
"edo_client.WoClient",
"shutil.rmtree",
"os.stat",
"tempfile.mkstemp"
] | [((777, 845), 'edo_client.WoClient', 'WoClient', (["(cls.api_url + '#')", '""""""', '""""""', '""""""', '""""""'], {'account': '""""""', 'instance': '""""""'}), "(cls.api_url + '#', '', '', '', '', account='', instance='')\n", (785, 845), False, 'from edo_client import WoClient\n'), ((913, 931), 'tempfile.mkdtemp', 'te... |
import higher
from leap import Leap
import numpy as np
import os
import torch
import torch.nn as nn
import gc
def train(model, source_corpus, char2idx, args, device):
model = model.to(device)
optimizer = torch.optim.Adam(model.parameters(), lr=args.lr_init)
lr_scheduler = torch.optim.lr_scheduler.ReduceLR... | [
"higher.innerloop_ctx",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"numpy.average",
"torch.backends.cudnn.flags",
"torch.nn.functional.cosine_similarity",
"os.path.join",
"gc.collect",
"torch.nn.functional.cross_entropy",
"torch.no_grad",
"leap.Leap",
"numpy.arange"
] | [((287, 416), 'torch.optim.lr_scheduler.ReduceLROnPlateau', 'torch.optim.lr_scheduler.ReduceLROnPlateau', (['optimizer'], {'factor': 'args.lr_decay', 'patience': 'args.patience', 'threshold': 'args.threshold'}), '(optimizer, factor=args.lr_decay,\n patience=args.patience, threshold=args.threshold)\n', (329, 416), Fa... |
"""
pyexcel_xlsw
~~~~~~~~~~~~~~~~~~~
The lower level xls file format handler using xlwt
:copyright: (c) 2016-2021 by Onni Software Ltd
:license: New BSD License
"""
import datetime
import xlrd
from xlwt import XFStyle, Workbook
from pyexcel_io import constants
from pyexcel_io.plugin_api import IW... | [
"xlrd.xldate.xldate_from_time_tuple",
"xlwt.XFStyle",
"pyexcel_io.plugin_api.IWriter.write",
"xlrd.xldate.xldate_from_datetime_tuple",
"xlrd.xldate.xldate_from_date_tuple",
"xlwt.Workbook"
] | [((2968, 3032), 'xlwt.Workbook', 'Workbook', ([], {'style_compression': 'style_compression', 'encoding': 'encoding'}), '(style_compression=style_compression, encoding=encoding)\n', (2976, 3032), False, 'from xlwt import XFStyle, Workbook\n'), ((3222, 3256), 'pyexcel_io.plugin_api.IWriter.write', 'IWriter.write', (['sel... |
# Copyright 2021 <NAME> <EMAIL>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
"ortools.sat.python.cp_model.CpSolver",
"ortools.sat.python.cp_model.CpModel"
] | [((1497, 1509), 'ortools.sat.python.cp_model.CpModel', 'cp.CpModel', ([], {}), '()\n', (1507, 1509), True, 'from ortools.sat.python import cp_model as cp\n'), ((2902, 2915), 'ortools.sat.python.cp_model.CpSolver', 'cp.CpSolver', ([], {}), '()\n', (2913, 2915), True, 'from ortools.sat.python import cp_model as cp\n')] |
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
# -*- coding: utf-8 -*-
"""
# @Time : 2019/5/27
# @Author : Jiaqi&Zecheng
# @File : sem_utils.py
# @Software: PyCharm
"""
import os
import json
import re as regex
import spacy
from nltk.stem import WordNetLemmatizer
wordnet_lemmatizer =... | [
"spacy.load",
"re.sub",
"nltk.stem.WordNetLemmatizer",
"re.compile"
] | [((321, 340), 'nltk.stem.WordNetLemmatizer', 'WordNetLemmatizer', ([], {}), '()\n', (338, 340), False, 'from nltk.stem import WordNetLemmatizer\n'), ((347, 402), 'spacy.load', 'spacy.load', (['"""en_core_web_sm"""'], {'disable': "['parser', 'ner']"}), "('en_core_web_sm', disable=['parser', 'ner'])\n", (357, 402), False... |
from flask import Blueprint
from controllers.show import shows, create_shows, create_show_submission
show_bp = Blueprint('show_bp', __name__)
show_bp.route('/', methods=['GET'])(shows)
show_bp.route('/create', methods=['GET'])(create_shows)
show_bp.route('/create', methods=['POST'])(create_show_submission)
| [
"flask.Blueprint"
] | [((113, 143), 'flask.Blueprint', 'Blueprint', (['"""show_bp"""', '__name__'], {}), "('show_bp', __name__)\n", (122, 143), False, 'from flask import Blueprint\n')] |
#!/usr/bin/python
# Copyright (c) 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Module that finds and runs a binary by looking in the likely locations."""
import os
import subprocess
import sys
def run_comman... | [
"os.path.isfile",
"subprocess.Popen",
"os.path.dirname",
"os.path.join"
] | [((652, 722), 'subprocess.Popen', 'subprocess.Popen', (['args'], {'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)\n', (668, 722), False, 'import subprocess\n'), ((1373, 1424), 'os.path.join', 'os.path.join', (['trunk_path', '"""out"""', '"""Release"""'... |
import os
import asposewordscloud
import asposewordscloud.models.requests
from asposewordscloud.rest import ApiException
from shutil import copyfile
words_api = WordsApi(client_id = '####-####-####-####-####', client_secret = '##################')
file_name = 'test_doc.docx'
# Upload original document to cloud stora... | [
"asposewordscloud.models.requests.UploadFileRequest",
"asposewordscloud.models.requests.AcceptAllRevisionsRequest"
] | [((398, 488), 'asposewordscloud.models.requests.UploadFileRequest', 'asposewordscloud.models.requests.UploadFileRequest', ([], {'file_content': 'my_var1', 'path': 'my_var2'}), '(file_content=my_var1,\n path=my_var2)\n', (448, 488), False, 'import asposewordscloud\n'), ((616, 688), 'asposewordscloud.models.requests.A... |
# Copyright 2016 Cisco Systems, 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 agreed to in writin... | [
"logging.getLogger",
"os.path.exists",
"logging.StreamHandler",
"logging.Formatter",
"logging.handlers.RotatingFileHandler"
] | [((636, 660), 'logging.getLogger', 'logging.getLogger', (['"""imc"""'], {}), "('imc')\n", (653, 660), False, 'import logging\n'), ((671, 694), 'logging.StreamHandler', 'logging.StreamHandler', ([], {}), '()\n', (692, 694), False, 'import logging\n'), ((707, 780), 'logging.Formatter', 'logging.Formatter', (['"""%(asctim... |
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from datetime import datetime
from api_request import Weather
builder = Gtk.Builder()
builder.add_from_file('./glade/main.glade')
class Handler:
def __init__(self, *args, **kwargs):
super(Handler, self).__init__(*args, **kwargs... | [
"gi.repository.Gtk.main_quit",
"gi.repository.Gtk.Builder",
"api_request.Weather",
"gi.require_version",
"datetime.datetime.now",
"datetime.datetime.fromisoformat",
"re.sub",
"gi.repository.Gtk.main"
] | [((10, 42), 'gi.require_version', 'gi.require_version', (['"""Gtk"""', '"""3.0"""'], {}), "('Gtk', '3.0')\n", (28, 42), False, 'import gi\n'), ((147, 160), 'gi.repository.Gtk.Builder', 'Gtk.Builder', ([], {}), '()\n', (158, 160), False, 'from gi.repository import Gtk\n'), ((8964, 8974), 'gi.repository.Gtk.main', 'Gtk.m... |
import re
from itertools import combinations
from utils.solution_base import SolutionBase
class Solution(SolutionBase):
def solve(self, part_num: int):
self.test_runner(part_num)
func = getattr(self, f"part{part_num}")
result = func(self.data)
return result
def test_runner(s... | [
"itertools.combinations",
"re.findall"
] | [((2333, 2357), 're.findall', 're.findall', (['"""\\\\d+"""', 'line'], {}), "('\\\\d+', line)\n", (2343, 2357), False, 'import re\n'), ((2705, 2741), 're.findall', 're.findall', (['"""\\\\[(\\\\d+),(\\\\d+)\\\\]"""', 's'], {}), "('\\\\[(\\\\d+),(\\\\d+)\\\\]', s)\n", (2715, 2741), False, 'import re\n'), ((1848, 1869), ... |
import unittest
import mock
import requests
import httpretty
import settings
from bitfinex.client import Client, TradeClient
API_KEY = settings.API_KEY
API_SECRET = settings.API_SECRET
class BitfinexTest(unittest.TestCase):
def setUp(self):
self.client = Client()
def test_should_have_server(self):... | [
"bitfinex.client.TradeClient",
"bitfinex.client.Client",
"httpretty.register_uri"
] | [((271, 279), 'bitfinex.client.Client', 'Client', ([], {}), '()\n', (277, 279), False, 'from bitfinex.client import Client, TradeClient\n'), ((2261, 2331), 'httpretty.register_uri', 'httpretty.register_uri', (['httpretty.GET', 'url'], {'body': 'mock_body', 'status': '(200)'}), '(httpretty.GET, url, body=mock_body, stat... |
#!/usr/bin/env python
# encoding=utf-8
from inspect import getblock
import json
import os
from os import read
from numpy.core.fromnumeric import mean
import numpy as np
import paddlehub as hub
import six
import math
import random
import sys
from util import read_file
from config import Config
# 配置文件
conf = Config()
c... | [
"numpy.mean",
"json.loads",
"random.shuffle",
"util.read_file",
"config.Config",
"numpy.zeros",
"numpy.core.fromnumeric.mean",
"paddlehub.dataset.LCQMC"
] | [((308, 316), 'config.Config', 'Config', ([], {}), '()\n', (314, 316), False, 'from config import Config\n'), ((6858, 6879), 'numpy.zeros', 'np.zeros', (['conf.nwords'], {}), '(conf.nwords)\n', (6866, 6879), True, 'import numpy as np\n'), ((10812, 10831), 'paddlehub.dataset.LCQMC', 'hub.dataset.LCQMC', ([], {}), '()\n'... |
import numpy as np
import numpy.linalg as la
from MdlUtilities import Field, FieldList
import MdlUtilities as mdl
def get_osaCasing_fields():
OD = Field(2030)
ID = Field(2031)
Weight = Field(2032)
Density = Field(2039)
E = Field(2040)
osaCasing_fields = FieldList()
osaCasing_... | [
"MdlUtilities.physicalValue",
"numpy.mean",
"numpy.sqrt",
"MdlUtilities.Field",
"MdlUtilities.LogicalError",
"numpy.tanh",
"numpy.sinh",
"numpy.array",
"numpy.linspace",
"numpy.dot",
"MdlUtilities.calculate_buoyancyFactor",
"numpy.cos",
"numpy.cosh",
"numpy.sin",
"MdlUtilities.FieldList"... | [((167, 178), 'MdlUtilities.Field', 'Field', (['(2030)'], {}), '(2030)\n', (172, 178), False, 'from MdlUtilities import Field, FieldList\n'), ((191, 202), 'MdlUtilities.Field', 'Field', (['(2031)'], {}), '(2031)\n', (196, 202), False, 'from MdlUtilities import Field, FieldList\n'), ((215, 226), 'MdlUtilities.Field', 'F... |
"""Test converting an image to a pyramid.
"""
import numpy as np
import napari
points = np.random.randint(100, size=(50_000, 2))
with napari.gui_qt():
viewer = napari.view_points(points, face_color='red')
| [
"napari.gui_qt",
"numpy.random.randint",
"napari.view_points"
] | [((90, 129), 'numpy.random.randint', 'np.random.randint', (['(100)'], {'size': '(50000, 2)'}), '(100, size=(50000, 2))\n', (107, 129), True, 'import numpy as np\n'), ((137, 152), 'napari.gui_qt', 'napari.gui_qt', ([], {}), '()\n', (150, 152), False, 'import napari\n'), ((167, 211), 'napari.view_points', 'napari.view_po... |
from unittest import TestCase
from mock import patch
from .. import constants
class mock_service_exeTestCase(TestCase):
def setUp(self):
super(mock_service_exeTestCase, self).setUp()
self.addCleanup(patch.stopall)
self.mock_os = patch.object(constants, 'os', autospec=True).start()
d... | [
"mock.patch.object"
] | [((261, 305), 'mock.patch.object', 'patch.object', (['constants', '"""os"""'], {'autospec': '(True)'}), "(constants, 'os', autospec=True)\n", (273, 305), False, 'from mock import patch\n'), ((786, 830), 'mock.patch.object', 'patch.object', (['constants', '"""os"""'], {'autospec': '(True)'}), "(constants, 'os', autospec... |
import pytest
from array import array
from game_map import GameMap
from tests.conftest import get_relative_path
sample_map_data = tuple(
reversed(
(
array("I", (0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0)),
array("I", (0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0... | [
"pytest.raises",
"array.array",
"tests.conftest.get_relative_path"
] | [((2487, 2516), 'pytest.raises', 'pytest.raises', (['AssertionError'], {}), '(AssertionError)\n', (2500, 2516), False, 'import pytest\n'), ((2790, 2819), 'pytest.raises', 'pytest.raises', (['AssertionError'], {}), '(AssertionError)\n', (2803, 2819), False, 'import pytest\n'), ((176, 251), 'array.array', 'array', (['"""... |
# encoding: utf-8
from __future__ import unicode_literals
import six
from django.db.models import Manager
from django.db.models.query import QuerySet
from .compat import (ANNOTATION_SELECT_CACHE_NAME, ANNOTATION_TO_AGGREGATE_ATTRIBUTES_MAP, chain_query, chain_queryset,
ModelIterable, ValuesQuery... | [
"six.text_type",
"six.iteritems",
"django.db.models.Manager.from_queryset"
] | [((14474, 14524), 'django.db.models.Manager.from_queryset', 'Manager.from_queryset', (['QueryablePropertiesQuerySet'], {}), '(QueryablePropertiesQuerySet)\n', (14495, 14524), False, 'from django.db.models import Manager\n'), ((5366, 5403), 'six.text_type', 'six.text_type', (['property_ref.full_path'], {}), '(property_r... |
from __future__ import print_function, absolute_import
import unittest, math
import pandas as pd
import numpy as np
from . import *
class T(base_pandas_extensions_tester.BasePandasExtensionsTester):
def test_concat(self):
df = pd.DataFrame({'c_1':['a', 'b', 'c'], 'c_2': ['d', 'e', 'f']})
df.en... | [
"numpy.testing.assert_allclose",
"math.sqrt",
"math.log",
"numpy.array",
"pandas.DataFrame",
"numpy.testing.assert_array_equal"
] | [((244, 306), 'pandas.DataFrame', 'pd.DataFrame', (["{'c_1': ['a', 'b', 'c'], 'c_2': ['d', 'e', 'f']}"], {}), "({'c_1': ['a', 'b', 'c'], 'c_2': ['d', 'e', 'f']})\n", (256, 306), True, 'import pandas as pd\n'), ((509, 599), 'pandas.DataFrame', 'pd.DataFrame', (["{'c_1': ['a', 'b', 'c'], 'c_2': ['d', 'e', 'f'], 'c_3': ['... |
import numpy as np
import math
import pyrobot.utils.util as prutil
import rospy
import habitat_sim.agent as habAgent
import habitat_sim.utils as habUtils
from habitat_sim.agent.controls import ActuationSpec
import habitat_sim.errors
import quaternion
from tf.transformations import euler_from_quaternion, euler_from_mat... | [
"numpy.arccos",
"tf.transformations.euler_from_matrix",
"math.sqrt",
"numpy.asarray",
"habitat_sim.agent.controls.ActuationSpec",
"math.degrees",
"numpy.array",
"numpy.dot",
"numpy.cos",
"numpy.linalg.norm",
"numpy.sin",
"pyrobot.utils.util.quat_to_rot_mat"
] | [((1145, 1178), 'pyrobot.utils.util.quat_to_rot_mat', 'prutil.quat_to_rot_mat', (['quat_list'], {}), '(quat_list)\n', (1167, 1178), True, 'import pyrobot.utils.util as prutil\n'), ((1905, 1949), 'tf.transformations.euler_from_matrix', 'euler_from_matrix', (['cur_rotation'], {'axes': '"""sxzy"""'}), "(cur_rotation, axes... |
from django.contrib import admin
from .models import Chat
class ChatAdmin(admin.ModelAdmin):
list_display = ("pk",)
admin.site.register(Chat, ChatAdmin)
| [
"django.contrib.admin.site.register"
] | [((125, 161), 'django.contrib.admin.site.register', 'admin.site.register', (['Chat', 'ChatAdmin'], {}), '(Chat, ChatAdmin)\n', (144, 161), False, 'from django.contrib import admin\n')] |
# -*- coding: utf-8 -*-
from pythainlp.tokenize import etcc
print(etcc.etcc("คืนความสุข")) # /คืน/ความสุข
| [
"pythainlp.tokenize.etcc.etcc"
] | [((68, 91), 'pythainlp.tokenize.etcc.etcc', 'etcc.etcc', (['"""คืนความสุข"""'], {}), "('คืนความสุข')\n", (77, 91), False, 'from pythainlp.tokenize import etcc\n')] |
"""
PyColourChooser
Copyright (C) 2002 <NAME> <<EMAIL>>
This file is part of PyColourChooser.
This version of PyColourChooser is open source; you can redistribute it
and/or modify it under the licensed terms.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the i... | [
"wx.MemoryDC.__init__",
"wx.Colour",
"wx.PaintDC",
"wx.Brush",
"wx.Bitmap",
"wx.Window.__init__",
"wx.ClientDC"
] | [((967, 993), 'wx.MemoryDC.__init__', 'wx.MemoryDC.__init__', (['self'], {}), '(self)\n', (987, 993), False, 'import wx\n'), ((1103, 1137), 'wx.Bitmap', 'wx.Bitmap', (['self.width', 'self.height'], {}), '(self.width, self.height)\n', (1112, 1137), False, 'import wx\n'), ((1940, 1967), 'wx.Colour', 'wx.Colour', (['red',... |
#!/usr/bin/env python
"""
generate-all-graphs.py
python generate-all-graphs.py | gzip -c > all-graphs.gz
"""
import sys
import json
import itertools
import numpy as np
from tqdm import tqdm
from nasbench.lib import graph_util
from joblib import delayed, Parallel
max_vertices = 7
num_ops = 3
max_edges ... | [
"nasbench.lib.graph_util.is_full_dag",
"nasbench.lib.graph_util.num_edges",
"nasbench.lib.graph_util.gen_is_edge_fn",
"json.dumps",
"joblib.Parallel",
"nasbench.lib.graph_util.hash_module",
"joblib.delayed"
] | [((1197, 1255), 'joblib.Parallel', 'Parallel', ([], {'n_jobs': '(40)', 'backend': '"""multiprocessing"""', 'verbose': '(10)'}), "(n_jobs=40, backend='multiprocessing', verbose=10)\n", (1205, 1255), False, 'from joblib import delayed, Parallel\n'), ((387, 418), 'nasbench.lib.graph_util.gen_is_edge_fn', 'graph_util.gen_i... |
from bs4 import BeautifulSoup as soup
from selenium import webdriver
class Scrapper:
def getArticles(self, cryptoName):
url = 'https://coinmarketcap.com/currencies/' + cryptoName + '/news/'
driver = webdriver.Firefox()
driver.get(url)
page = driver.page_source
page_soup = ... | [
"bs4.BeautifulSoup",
"selenium.webdriver.Firefox"
] | [((221, 240), 'selenium.webdriver.Firefox', 'webdriver.Firefox', ([], {}), '()\n', (238, 240), False, 'from selenium import webdriver\n'), ((320, 345), 'bs4.BeautifulSoup', 'soup', (['page', '"""html.parser"""'], {}), "(page, 'html.parser')\n", (324, 345), True, 'from bs4 import BeautifulSoup as soup\n')] |
#!/usr/bin/python3
"""qsubm -- generic queue submission for task-oriented batch scripts
Environment variables:
MCSCRIPT_DIR should specify the directory in which the mcscript package is
installed, i.e., the directory where the file qsubm.py is found. (Note that
qsubm uses this information to locate c... | [
"os.path.exists",
"argparse.ArgumentParser",
"subprocess.Popen",
"os.path.join",
"os.environ.get",
"sys.stdout.flush"
] | [((3734, 4494), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Queue submission for numbered run."""', 'usage': '"""%(prog)s [option] run queue|RUN wall [var1=val1, ...]\n"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'epilog': '"""Simply omit the queue name and leave... |
from scripts.downloader import *
import fiona
from shapely.geometry import shape
import geopandas as gpd
import matplotlib.pyplot as plt
from pprint import pprint
import requests
import json
import time
import os
# Constant variables
input_min_lat = 50.751797561
input_min_lon = 5.726110232
input_max_lat = 50.938216069... | [
"os.listdir",
"os.path.join",
"os.path.basename",
"shapely.geometry.shape",
"geopandas.GeoDataFrame"
] | [((3860, 3884), 'os.listdir', 'os.listdir', (['dir_filepath'], {}), '(dir_filepath)\n', (3870, 3884), False, 'import os\n'), ((4547, 4574), 'geopandas.GeoDataFrame', 'gpd.GeoDataFrame', (['rows_list'], {}), '(rows_list)\n', (4563, 4574), True, 'import geopandas as gpd\n'), ((4206, 4226), 'shapely.geometry.shape', 'shap... |
import discord.ext.commands as dec
import database.song
from commands.common import *
class Song:
"""Song insertion, querying and manipulation"""
def __init__(self, bot):
self._bot = bot
self._db = database.song.SongInterface(bot.loop)
_help_messages = {
'group': 'Song informatio... | [
"discord.ext.commands.group",
"discord.ext.commands.UserInputError"
] | [((3790, 3878), 'discord.ext.commands.group', 'dec.group', ([], {'invoke_without_command': '(True)', 'aliases': "['s']", 'help': "_help_messages['group']"}), "(invoke_without_command=True, aliases=['s'], help=_help_messages[\n 'group'])\n", (3799, 3878), True, 'import discord.ext.commands as dec\n'), ((4899, 4987), ... |
"""
main.py
Main driver for the Linear Error Analysis program.
Can be run using `lea.sh`.
Can choose which plots to see by toggling on/off `show_fig` param.
Author(s): <NAME>, <NAME>, <NAME>
"""
import os
import matplotlib.pyplot as plt
import numpy as np
import config
import libs.gta_xch4 as gta_xch4
import libs.... | [
"errors.Errors",
"optim.Optim",
"config.parse_config",
"os.path.join",
"os.path.dirname",
"forward.Forward",
"isrf.ISRF"
] | [((478, 499), 'config.parse_config', 'config.parse_config', ([], {}), '()\n', (497, 499), False, 'import config\n'), ((515, 527), 'forward.Forward', 'Forward', (['cfg'], {}), '(cfg)\n', (522, 527), False, 'from forward import Forward\n'), ((1040, 1049), 'isrf.ISRF', 'ISRF', (['cfg'], {}), '(cfg)\n', (1044, 1049), False... |
import logging
import os
import re
import sublime
# external dependencies (see dependencies.json)
import jsonschema
import yaml # pyyaml
# This plugin generates a hidden syntax file containing rules for additional
# chainloading commands defined by the user. The syntax is stored in the cache
# directory to avoid the... | [
"logging.basicConfig",
"logging.getLogger",
"re.escape",
"sublime.cache_path",
"yaml.dump",
"os.path.join",
"os.path.isfile",
"os.path.isdir",
"jsonschema.validate",
"os.mkdir",
"sublime.load_resource",
"sublime.load_settings"
] | [((1350, 1371), 'logging.basicConfig', 'logging.basicConfig', ([], {}), '()\n', (1369, 1371), False, 'import logging\n'), ((1381, 1408), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1398, 1408), False, 'import logging\n'), ((4149, 4184), 'sublime.load_settings', 'sublime.load_settings'... |
import os
import numpy as np
import sys
sys.path.append("../")
for model in ['lenet1', 'lenet4', 'lenet5']:
for attack in ['fgsm', 'cw', 'jsma']:
for mu_var in ['gf', 'nai', 'ns', 'ws']:
os.system('CUDA_VISIBLE_DEVICES=0 python retrain_mu_mnist.py --datasets=mnist --attack=' + attack + ' --mode... | [
"os.system",
"sys.path.append"
] | [((40, 62), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (55, 62), False, 'import sys\n'), ((212, 392), 'os.system', 'os.system', (["(\n 'CUDA_VISIBLE_DEVICES=0 python retrain_mu_mnist.py --datasets=mnist --attack='\n + attack + ' --model_name=' + model + ' --mu_var=' + mu_var +\n '... |
#!/usr/bin/env python3
from __future__ import print_function
import gzip
import json
import re
import sys
# import time
from argparse import ArgumentParser
# from datetime import datetime
class Options:
def __init__(self):
self.usage = 'characterise_inauthentic_tweets.py -i <file of tweets> [-v|--verbos... | [
"re.findall",
"json.loads",
"argparse.ArgumentParser",
"gzip.open"
] | [((403, 463), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'usage': 'self.usage', 'conflict_handler': '"""resolve"""'}), "(usage=self.usage, conflict_handler='resolve')\n", (417, 463), False, 'from argparse import ArgumentParser\n'), ((3187, 3200), 'json.loads', 'json.loads', (['l'], {}), '(l)\n', (3197, 3200), F... |
# coding=utf-8
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from bika.lims.browser.bika_listing import BikaListingTable
from bika.lims.browser.worksheet.views.analyses import AnalysesView
class AnalysesTransposedView(AnalysesView):
""" The view for displaying the table of manage_results... | [
"bika.lims.browser.bika_listing.BikaListingTable.__init__",
"Products.Five.browser.pagetemplatefile.ViewPageTemplateFile"
] | [((1334, 1393), 'Products.Five.browser.pagetemplatefile.ViewPageTemplateFile', 'ViewPageTemplateFile', (['"""../templates/analyses_transposed.pt"""'], {}), "('../templates/analyses_transposed.pt')\n", (1354, 1393), False, 'from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile\n'), ((1412, 1476), 'Prod... |
from enum import Enum
from typing import Generator, Tuple, Iterable, Dict, List
import cv2
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from scipy.ndimage import label, generate_binary_structure
from scipy.ndimage.morphology import distance_transform_edt as dist_trans
import trainer.lib as... | [
"numpy.copy",
"numpy.ones_like",
"numpy.unique",
"numpy.ones",
"numpy.where",
"scipy.ndimage.generate_binary_structure",
"scipy.ndimage.label",
"numpy.any",
"numpy.max",
"numpy.invert",
"numpy.lexsort",
"numpy.split",
"numpy.zeros",
"numpy.argwhere",
"imgaug.augmenters.Sequential",
"nu... | [((431, 447), 'numpy.lexsort', 'np.lexsort', (['data'], {}), '(data)\n', (441, 447), True, 'import numpy as np\n'), ((459, 510), 'numpy.any', 'np.any', (['(data.T[ind[1:]] != data.T[ind[:-1]])'], {'axis': '(1)'}), '(data.T[ind[1:]] != data.T[ind[:-1]], axis=1)\n', (465, 510), True, 'import numpy as np\n'), ((558, 578),... |
from PyQt5.QtCore import Qt, pyqtSignal, QSize
from PyQt5.QtWidgets import (
QLabel, QWidget, QTreeWidgetItem, QHeaderView,
QVBoxLayout, QHBoxLayout,
)
from .ImageLabel import ImageLabel
from .AdaptiveTreeWidget import AdaptiveTreeWidget
class ImageDetailArea(QWidget):
# signal
imageLoaded = pyqtSig... | [
"PyQt5.QtCore.pyqtSignal",
"PyQt5.QtWidgets.QHBoxLayout",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtCore.QSize"
] | [((313, 325), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (323, 325), False, 'from PyQt5.QtCore import Qt, pyqtSignal, QSize\n'), ((345, 357), 'PyQt5.QtCore.pyqtSignal', 'pyqtSignal', ([], {}), '()\n', (355, 357), False, 'from PyQt5.QtCore import Qt, pyqtSignal, QSize\n'), ((932, 949), 'PyQt5.QtWidgets.Q... |
import argparse
import data_helper
from sklearn.model_selection import train_test_split
import re
import lstm
from lstm import *
import time
from viterbi import Viterbi
xrange = range
def simple_cut(text,dh,lm,viterbi):
"""对一个片段text(标点符号把句子划分为多个片段)进行预测。"""
if text:
#print("text: %s" %text)
te... | [
"lstm.LSTM",
"viterbi.Viterbi",
"argparse.ArgumentParser",
"re.compile",
"data_helper.DataHelper"
] | [((1117, 1167), 're.compile', 're.compile', (['u"""([0-9\\\\da-zA-Z ]+)|[。,、?!.\\\\.\\\\?,!]"""'], {}), "(u'([0-9\\\\da-zA-Z ]+)|[。,、?!.\\\\.\\\\?,!]')\n", (1127, 1167), False, 'import re\n'), ((1712, 1769), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""lstm segment args."""'}), "(descr... |
#!/usr/bin/env python
'''
Advent of Code 2021 - Day 9: Smoke Basin (Part 1)
https://adventofcode.com/2021/day/9
'''
import numpy as np
class HeightMap():
def __init__(self) -> None:
self._grid = np.array([])
def add_row(self, row):
np_row = np.array(row)
if self._grid.size != 0:
... | [
"numpy.array",
"numpy.vstack",
"numpy.ndenumerate"
] | [((211, 223), 'numpy.array', 'np.array', (['[]'], {}), '([])\n', (219, 223), True, 'import numpy as np\n'), ((270, 283), 'numpy.array', 'np.array', (['row'], {}), '(row)\n', (278, 283), True, 'import numpy as np\n'), ((514, 540), 'numpy.ndenumerate', 'np.ndenumerate', (['self._grid'], {}), '(self._grid)\n', (528, 540),... |
# Implementation of Randomised Selection
"""
Naive Approach
---------
Parameters
---------
An arry with n distinct numbers
---------
Returns
---------
i(th) order statistic, i.e: i(th) smallest element of the input array
---------
Time Complexity
---------
O(n.log... | [
"random.randrange"
] | [((650, 683), 'random.randrange', 'random.randrange', (['length_of_array'], {}), '(length_of_array)\n', (666, 683), False, 'import random\n')] |
#!/usr/bin/env python
import cgitb; cgitb.enable()
print('Content-type: text/html\n')
print(
"""<html>
<head>
<title>CGI 4 - CSS</title>
<link rel="stylesheet" type="text/css" href="../css/estilo1.css">
</head>
<body>
<h1>Colocando CSS em um script a parte</h1>
<hr>
<p>Ola imagens CGI!</p>
<di... | [
"cgitb.enable"
] | [((36, 50), 'cgitb.enable', 'cgitb.enable', ([], {}), '()\n', (48, 50), False, 'import cgitb\n')] |
from __future__ import absolute_import, division, print_function, unicode_literals
import braintree
from postgres.orm import Model
class ExchangeRoute(Model):
typname = "exchange_routes"
def __bool__(self):
return self.error != 'invalidated'
__nonzero__ = __bool__
@classmethod
def fro... | [
"gratipay.models.participant.Participant.from_username",
"braintree.PaymentMethod.delete",
"gratipay.models.participant.Participant.from_id"
] | [((3646, 3698), 'gratipay.models.participant.Participant.from_username', 'Participant.from_username', (['self.participant.username'], {}), '(self.participant.username)\n', (3671, 3698), False, 'from gratipay.models.participant import Participant\n'), ((2280, 2324), 'braintree.PaymentMethod.delete', 'braintree.PaymentMe... |
import os
from os.path import dirname
from unittest import TestCase
import src.superannotate as sa
class TestCloneProject(TestCase):
PROJECT_NAME_1 = "test create from full info1"
PROJECT_NAME_2 = "test create from full info2"
PROJECT_DESCRIPTION = "desc"
PROJECT_TYPE = "Vector"
TEST_FOLDER_PATH... | [
"src.superannotate.clone_project",
"os.path.dirname",
"src.superannotate.search_team_contributors",
"src.superannotate.create_project",
"src.superannotate.get_project_metadata",
"src.superannotate.share_project",
"src.superannotate.delete_project"
] | [((667, 755), 'src.superannotate.create_project', 'sa.create_project', (['self.PROJECT_NAME_1', 'self.PROJECT_DESCRIPTION', 'self.PROJECT_TYPE'], {}), '(self.PROJECT_NAME_1, self.PROJECT_DESCRIPTION, self.\n PROJECT_TYPE)\n', (684, 755), True, 'import src.superannotate as sa\n'), ((814, 852), 'src.superannotate.dele... |
import logging
from rhasspy_weather.data_types.request import WeatherRequest
from rhasspy_weather.parser import rhasspy_intent
from rhasspyhermes.nlu import NluIntent
log = logging.getLogger(__name__)
def parse_intent_message(intent_message: NluIntent) -> WeatherRequest:
"""
Parses any of the rhasspy weathe... | [
"logging.getLogger"
] | [((175, 202), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (192, 202), False, 'import logging\n')] |
import pytest
def vprintf_test(vamos):
if vamos.flavor == "agcc":
pytest.skip("vprintf not supported")
vamos.run_prog_check_data("vprintf")
| [
"pytest.skip"
] | [((80, 116), 'pytest.skip', 'pytest.skip', (['"""vprintf not supported"""'], {}), "('vprintf not supported')\n", (91, 116), False, 'import pytest\n')] |
#!/usr/bin/env python3
import socket
HOST = '127.0.0.1' # 服务器的主机名或者 IP 地址
PORT = 10009 # 服务器使用的端口
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
print(s)
s.connect((HOST, PORT))
s.sendall(b'Hello, world')
print(s)
data = s.recv(1024)
print('Received', repr(data))
| [
"socket.socket"
] | [((108, 157), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (121, 157), False, 'import socket\n')] |
import requests
import Mark
from colorama import Fore
from util.plugins.common import print_slow, getheaders, proxy
def StatusChanger(token, Status):
#change status
CustomStatus = {"custom_status": {"text": Status}} #{"text": Status, "emoji_name": "☢"} if you want to add an emoji to the status
try:
... | [
"util.plugins.common.print_slow",
"util.plugins.common.getheaders",
"Mark.main",
"util.plugins.common.proxy"
] | [((741, 752), 'Mark.main', 'Mark.main', ([], {}), '()\n', (750, 752), False, 'import Mark\n'), ((476, 564), 'util.plugins.common.print_slow', 'print_slow', (['f"""\n{Fore.GREEN}Status changed to {Fore.WHITE}{Status}{Fore.GREEN} """'], {}), '(\n f"""\n{Fore.GREEN}Status changed to {Fore.WHITE}{Status}{Fore.GREEN} """... |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from hashlib import sha256
from recipe_engine import recipe_test_api
class CloudBuildHelperTestApi(recipe_test_api.RecipeTestApi):
def build_success_out... | [
"hashlib.sha256"
] | [((1283, 1295), 'hashlib.sha256', 'sha256', (['name'], {}), '(name)\n', (1289, 1295), False, 'from hashlib import sha256\n'), ((470, 484), 'hashlib.sha256', 'sha256', (['target'], {}), '(target)\n', (476, 484), False, 'from hashlib import sha256\n')] |
import sklearn.mixture
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import ticker
import matplotlib.patheffects as mpatheffects
def get_gmm_and_pos_label(
array, n_components=2, n_steps=5000
):
gmm = sklearn.mixture.GaussianMixture(
n_components=n_components, covarianc... | [
"numpy.ptp",
"numpy.sqrt",
"matplotlib.patheffects.Normal",
"numpy.array",
"matplotlib.ticker.ScalarFormatter",
"numpy.arange",
"numpy.mean",
"numpy.exp",
"numpy.linspace",
"numpy.min",
"numpy.argmin",
"numpy.round",
"numpy.ediff1d",
"numpy.argmax",
"matplotlib.pyplot.get_cmap",
"numpy... | [((410, 431), 'numpy.argmax', 'np.argmax', (['gmm.means_'], {}), '(gmm.means_)\n', (419, 431), True, 'import numpy as np\n'), ((669, 700), 'numpy.linspace', 'np.linspace', (['low', 'high', 'n_steps'], {}), '(low, high, n_steps)\n', (680, 700), True, 'import numpy as np\n'), ((1099, 1120), 'numpy.argmax', 'np.argmax', (... |
"""
Copyright (c) 2022 Huawei Technologies Co.,Ltd.
openGauss is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, W... | [
"time.sleep",
"testcase.utils.Logger.Logger",
"testcase.utils.Constant.Constant",
"testcase.utils.CommonSH.CommonSH",
"time.time",
"testcase.utils.ComThread.ComThread"
] | [((1408, 1416), 'testcase.utils.Logger.Logger', 'Logger', ([], {}), '()\n', (1414, 1416), False, 'from testcase.utils.Logger import Logger\n'), ((1515, 1540), 'testcase.utils.CommonSH.CommonSH', 'CommonSH', (['"""PrimaryDbUser"""'], {}), "('PrimaryDbUser')\n", (1523, 1540), False, 'from testcase.utils.CommonSH import C... |
"""
This is a django-split-settings main file.
For more information read this:
https://github.com/sobolevn/django-split-settings
Default environment is `development`.
To change settings file:
`DJANGO_ENV=production python manage.py runserver`
"""
import django_heroku
from split_settings.tools import include
base_set... | [
"split_settings.tools.include"
] | [((1080, 1103), 'split_settings.tools.include', 'include', (['*base_settings'], {}), '(*base_settings)\n', (1087, 1103), False, 'from split_settings.tools import include\n')] |
from django.conf.urls import patterns, url, include
from django.contrib import admin
from django.conf import settings
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from .views import template_test
urlpatterns = patterns(
'',
url(r'^test/', template_test, name='template_test'),
url(r... | [
"django.conf.urls.include",
"django.conf.urls.url",
"django.contrib.staticfiles.urls.staticfiles_urlpatterns",
"django.contrib.admin.autodiscover"
] | [((401, 421), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (419, 421), False, 'from django.contrib import admin\n'), ((258, 308), 'django.conf.urls.url', 'url', (['"""^test/"""', 'template_test'], {'name': '"""template_test"""'}), "('^test/', template_test, name='template_test')\n", (261... |