code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from P4 import P4, P4Exception
p4 = P4()
p4.user = "koichi"
p4.port = "tea.example.com:1667"
p4.client = "koichi.Windows_Workspace"
try:
p4.connect()
info = p4.run("info")
for key in info[0]:
print(key, "=", info[0][key])
p4.disconnect()
except P4Exception:
for e in p4.errors:
prin... | [
"P4.P4"
] | [((37, 41), 'P4.P4', 'P4', ([], {}), '()\n', (39, 41), False, 'from P4 import P4, P4Exception\n')] |
import os
import pandas as pd
from pathlib import Path
project_dir = Path(__file__).resolve().parents[2]
raw_dir = os.path.join(project_dir, 'data', 'raw')
interim_dir = os.path.join(project_dir, 'data', 'interim')
external_data_dir = os.path.join(project_dir, 'data', 'external')
country_codes = pd.read_csv(os.path.j... | [
"pathlib.Path",
"pandas.merge",
"os.path.join",
"pandas.read_excel",
"pandas.DataFrame"
] | [((116, 156), 'os.path.join', 'os.path.join', (['project_dir', '"""data"""', '"""raw"""'], {}), "(project_dir, 'data', 'raw')\n", (128, 156), False, 'import os\n'), ((171, 215), 'os.path.join', 'os.path.join', (['project_dir', '"""data"""', '"""interim"""'], {}), "(project_dir, 'data', 'interim')\n", (183, 215), False,... |
"""Test the build_featurizer code."""
import os
import random
import warnings
import logging
import keras.backend as K
import numpy as np
import pytest
from keras.layers import Dense, Activation, Input
from keras.layers.merge import add
from keras.models import Sequential, Model
from pic2vec.build_featurizer import (... | [
"pic2vec.build_featurizer._decapitate_model",
"numpy.array",
"keras.layers.Activation",
"pytest.fixture",
"keras.layers.Dense",
"logging.error",
"os.remove",
"keras.backend.constant",
"keras.layers.merge.add",
"keras.models.Model",
"pic2vec.build_featurizer._find_pooling_constant",
"pic2vec.bu... | [((670, 690), 'random.seed', 'random.seed', (['(5102020)'], {}), '(5102020)\n', (681, 690), False, 'import random\n'), ((739, 767), 'keras.backend.constant', 'K.constant', (['(3)'], {'shape': '(3, 12)'}), '(3, shape=(3, 12))\n', (749, 767), True, 'import keras.backend as K\n'), ((844, 872), 'keras.backend.constant', 'K... |
# -*- coding: utf-8 -*-#
"""
-------------------------------------------------------------------
Copyright (c) 2019-2022 Snow Lake Inc. All rights reserved.
Description :
File Name: __init__.py.py
Author : <EMAIL>
create date: 2021/7/8
--------------------------------------------------------... | [
"numpy.fromfile",
"cv2.imshow",
"numpy.swapaxes",
"numpy.zeros",
"numba.jit",
"cv2.waitKey",
"numpy.full",
"cv2.resize",
"cv2.imread"
] | [((382, 406), 'numba.jit', 'numba.jit', ([], {'nopython': '(True)'}), '(nopython=True)\n', (391, 406), False, 'import numba\n'), ((587, 637), 'numpy.zeros', 'np.zeros', (['(h, w, image.shape[2])'], {'dtype': 'np.float32'}), '((h, w, image.shape[2]), dtype=np.float32)\n', (595, 637), True, 'import numpy as np\n'), ((649... |
import os
from hashlib import sha256
def convert_type(value, target_type, default=None):
"""Attempts to convert the ``value`` to the given ``target_type``. Will
return ``default`` if the conversion fails.
Supported ``target_type`` values are:
* `int` -- Convert to an integer value
* `boolean` -... | [
"hashlib.sha256",
"os.path.join",
"os.walk"
] | [((2881, 2889), 'hashlib.sha256', 'sha256', ([], {}), '()\n', (2887, 2889), False, 'from hashlib import sha256\n'), ((3834, 3852), 'os.walk', 'os.walk', (['base_path'], {}), '(base_path)\n', (3841, 3852), False, 'import os\n'), ((4223, 4255), 'os.path.join', 'os.path.join', (['basepath', 'filename'], {}), '(basepath, f... |
import unittest
from unittest import TestCase
from crossword import NumberedCell
class TestNumberedCell(TestCase):
def test_just_r_and_c(self):
numbered_cell = NumberedCell(1, 3, 2)
expected = "NumberedCell(seq=1,r=3,c=2)"
actual = str(numbered_cell)
self.assertEqual(expected, ac... | [
"crossword.NumberedCell.from_json",
"crossword.NumberedCell"
] | [((176, 197), 'crossword.NumberedCell', 'NumberedCell', (['(1)', '(3)', '(2)'], {}), '(1, 3, 2)\n', (188, 197), False, 'from crossword import NumberedCell\n'), ((468, 494), 'crossword.NumberedCell', 'NumberedCell', (['(1)', '(3)', '(2)'], {'a': '(4)'}), '(1, 3, 2, a=4)\n', (480, 494), False, 'from crossword import Numb... |
import pandas as pd
import re, json
import argparse
'''
preprocessing for mimic discharge summary note
1. load NOTEEVENTS.csv
2. get discharge sumamry notes
a) NOTEVENTS.CATEGORY = 'Discharge Summary'
b) NOTEVENTS.DESCRIPTION = 'Report'
c) eliminate a short-note
3. preprocess discharge sumamry notes
... | [
"argparse.ArgumentParser",
"re.compile",
"pandas.read_csv",
"re.sub",
"pandas.concat",
"pandas.to_datetime"
] | [((493, 518), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (516, 518), False, 'import argparse\n'), ((792, 814), 'pandas.read_csv', 'pd.read_csv', (['file_path'], {}), '(file_path)\n', (803, 814), True, 'import pandas as pd\n'), ((864, 927), 'pandas.to_datetime', 'pd.to_datetime', (['df.CHART... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 11 14:34:08 2020
@author: <NAME> (<EMAIL>),
Finnish Meteorological Institute)
Olli's python implementation of ESA SNAP s2toolbox biophysical processor and
computation of vegetation indices.
See ATBD at https://step.esa.int/docs/extra/ATBD_S2ToolBox_L2B_V1.1.pdf
And java... | [
"numpy.radians",
"numpy.copy",
"numpy.shape",
"numpy.ones_like",
"numpy.log",
"numpy.any",
"xarray.concat",
"os.path.dirname",
"numpy.array",
"xarray.DataArray",
"numpy.loadtxt",
"xarray.apply_ufunc",
"numpy.zeros_like"
] | [((1240, 1265), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (1255, 1265), False, 'import os\n'), ((1393, 1470), 'numpy.loadtxt', 'np.loadtxt', (["(snap_bio_path + '%s/%s_Normalisation' % (var, var))"], {'delimiter': '""","""'}), "(snap_bio_path + '%s/%s_Normalisation' % (var, var), delimit... |
"""
top-level interface methods so user doesn't need to directly construct
a dbsession
"""
import debug_session
# default session
_dbsession=None
def debug(evals,feed_dict=None,breakpoints=None,break_immediately=False,session=None):
"""
spawns a new debug session
"""
global _dbsession
_dbsession=debug_session.D... | [
"debug_session.DebugSession"
] | [((305, 340), 'debug_session.DebugSession', 'debug_session.DebugSession', (['session'], {}), '(session)\n', (331, 340), False, 'import debug_session\n')] |
"""
Authors: <NAME>.
Copyright:
Copyright (c) 2021 Microsoft Research
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, mo... | [
"os.path.exists",
"argparse.ArgumentParser",
"zipfile.ZipFile",
"CompilerScripts.parse_config.get_params",
"CompilerScripts.compile_tf.compile",
"os.path.join",
"os.getcwd",
"os.chdir",
"os.path.dirname",
"os.path.basename",
"TFCompiler.ProcessTFGraph.process_tf_graph",
"os.path.abspath",
"C... | [((1409, 1470), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'RawTextHelpFormatter'}), '(formatter_class=RawTextHelpFormatter)\n', (1432, 1470), False, 'import argparse\n'), ((4998, 5009), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (5007, 5009), False, 'import os\n'), ((5090, 5117), '... |
import requests
from bs4 import BeautifulSoup
# WHY
# The SearchRequest module contains all the internal logic for the library.
#
# This encapsulates the logic,
# ensuring users can work at a higher level of abstraction.
# USAGE
# req = search_request.SearchRequest("[QUERY]", search_type="[title]")
class SearchRequ... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((1365, 1389), 'requests.get', 'requests.get', (['search_url'], {}), '(search_url)\n', (1377, 1389), False, 'import requests\n'), ((1516, 1555), 'bs4.BeautifulSoup', 'BeautifulSoup', (['search_page.text', '"""lxml"""'], {}), "(search_page.text, 'lxml')\n", (1529, 1555), False, 'from bs4 import BeautifulSoup\n')] |
import extract as extract
import numpy as np
from nltk.tokenize import word_tokenize
from sklearn import svm
import matplotlib.pyplot as plt
from sklearn.metrics import f1_score
import seaborn as sns
from sklearn import metrics
def build_train(filename):
extracted = extract.extract(filename)
train_x = []
train_y = ... | [
"sklearn.metrics.f1_score",
"sklearn.metrics.confusion_matrix",
"matplotlib.pyplot.show",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"seaborn.heatmap",
"nltk.tokenize.word_tokenize",
"numpy.array",
"extract.extract",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.title",
"sklearn.... | [((269, 294), 'extract.extract', 'extract.extract', (['filename'], {}), '(filename)\n', (284, 294), True, 'import extract as extract\n'), ((627, 652), 'extract.extract', 'extract.extract', (['filename'], {}), '(filename)\n', (642, 652), True, 'import extract as extract\n'), ((995, 1011), 'nltk.tokenize.word_tokenize', ... |
from flarmnet.record import Record
class Reader:
def __init__(self, file):
self.file = file
def read(self):
for line in self.file:
# Valid records have at least 172 characters
if len(line) < 172:
continue
yield Record(line)
| [
"flarmnet.record.Record"
] | [((290, 302), 'flarmnet.record.Record', 'Record', (['line'], {}), '(line)\n', (296, 302), False, 'from flarmnet.record import Record\n')] |
from apistar import test
from app import APP
CLIENT = test.TestClient(APP)
def test_todo_item_get():
response = CLIENT.get('/todos/1')
assert response.status_code == 200
assert response.json() == {'id': 1, 'task': 'Buy milk'}
def test_todo_item_put():
response = CLIENT.put('/todos/100', {'task': 'Bu... | [
"apistar.test.TestClient"
] | [((56, 76), 'apistar.test.TestClient', 'test.TestClient', (['APP'], {}), '(APP)\n', (71, 76), False, 'from apistar import test\n')] |
# -*- coding: utf-8 -*-
# @Author: rjezequel
# @Date: 2019-12-20 09:18:14
# @Last Modified by: ronanjs
# @Last Modified time: 2020-07-17 11:10:11
try:
from ansible.module_utils.datamodel import DataModel
from ansible.module_utils.logger import Logger
except ImportError:
from module_utils.datamodel impo... | [
"requests.Session",
"fnmatch.translate",
"json.dumps",
"re.match",
"requests.get",
"module_utils.logger.Logger"
] | [((445, 463), 'module_utils.logger.Logger', 'Logger', (['"""stc-rest"""'], {}), "('stc-rest')\n", (451, 463), False, 'from module_utils.logger import Logger\n'), ((667, 685), 'requests.Session', 'requests.Session', ([], {}), '()\n', (683, 685), False, 'import requests\n'), ((4997, 5024), 'fnmatch.translate', 'fnmatch.t... |
# -*- coding: utf-8 -*-
#!/usr/bin/env python3
"""
Created on Tue Jan 8 20:03:12 2019
@author: yansl
Target:
1. due to discreteness of image, the boundaries of two circles need to repair.
2. The core resolution is that the median filtering technique will be executed.
"""
import cv2
import numpy... | [
"cv2.circle",
"numpy.zeros",
"cv2.inpaint"
] | [((630, 680), 'cv2.inpaint', 'cv2.inpaint', (['temp', 'mask', 'radius', 'cv2.INPAINT_TELEA'], {}), '(temp, mask, radius, cv2.INPAINT_TELEA)\n', (641, 680), False, 'import cv2\n'), ((1409, 1437), 'numpy.zeros', 'np.zeros', (['sp'], {'dtype': 'np.uint8'}), '(sp, dtype=np.uint8)\n', (1417, 1437), True, 'import numpy as np... |
import asyncio
import base64
import json
import os
import yaml
from dotenv import load_dotenv
from langs import Langs
from pyromod import listen, filters
from pyrogram import Client
# Load variables on .env to os.environ
load_dotenv()
def tryint(value):
try:
return int(value)
except:
return ... | [
"yaml.safe_load",
"json.loads",
"os.getenv",
"dotenv.load_dotenv"
] | [((224, 237), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (235, 237), False, 'from dotenv import load_dotenv\n'), ((984, 1011), 'json.loads', 'json.loads', (['pyrogram_config'], {}), '(pyrogram_config)\n', (994, 1011), False, 'import json\n'), ((873, 901), 'os.getenv', 'os.getenv', (['"""PYROGRAM_CONFIG"""']... |
import re
def get_query():
query = {
"_source": [
"text",
"full_text",
"extended_tweet.full_text",
"quoted_status.text",
"quoted_status.full_text",
"quoted_status.extended_tweet.full_text"
],
"query": {
"bool": {
"filter": [
{
... | [
"re.sub"
] | [((1392, 1419), 're.sub', 're.sub', (['"""[\\\\s]+"""', '""" """', 'text'], {}), "('[\\\\s]+', ' ', text)\n", (1398, 1419), False, 'import re\n'), ((1429, 1457), 're.sub', 're.sub', (['"""http\\\\S+"""', '""""""', 'text'], {}), "('http\\\\S+', '', text)\n", (1435, 1457), False, 'import re\n'), ((1467, 1490), 're.sub', ... |
import hashlib
import pickle
import os
import sys
import subprocess
import time
class Colors:
HEADER = '\033[95m'
BLUE = '\033[94m'
GREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'
cache = {}
hashes = []
def get_cache(... | [
"os.listdir",
"pickle.dump",
"hashlib.md5",
"os.makedirs",
"subprocess.Popen",
"pickle.load",
"os.path.splitext",
"os.path.isdir",
"sys.stdout.flush",
"time.time",
"sys.stdout.write"
] | [((699, 724), 'pickle.dump', 'pickle.dump', (['cache', 'afile'], {}), '(cache, afile)\n', (710, 724), False, 'import pickle\n'), ((857, 870), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (868, 870), False, 'import hashlib\n'), ((1046, 1069), 'os.listdir', 'os.listdir', (['main_folder'], {}), '(main_folder)\n', (1056... |
# Copyright Contributors to the Pyro project.
# SPDX-License-Identifier: Apache-2.0
import pytest
import torch
import pyro.distributions as dist
from pyro.contrib.epidemiology import OverdispersedSEIRModel, SimpleSEIRModel
@pytest.mark.parametrize("duration", [3, 7])
@pytest.mark.parametrize("forecast", [0, 7])
@py... | [
"pyro.contrib.epidemiology.OverdispersedSEIRModel",
"pytest.mark.parametrize",
"pyro.distributions.CoalescentTimes",
"pyro.contrib.epidemiology.SimpleSEIRModel",
"torch.rand"
] | [((228, 271), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""duration"""', '[3, 7]'], {}), "('duration', [3, 7])\n", (251, 271), False, 'import pytest\n'), ((273, 316), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""forecast"""', '[0, 7]'], {}), "('forecast', [0, 7])\n", (296, 316), False, 'im... |
import pandas as pd
import os
from tqdm import tqdm
from model.bert_things.pytorch_pretrained_bert.tokenization import BertTokenizer
from model.bert_things.pytorch_pretrained_bert import BertConfig, BertModel, BertPreTrainedModel
from model.bert_text_model import BertTextModel
from data_loader.utils.vocab import Vocab
... | [
"logging.getLogger",
"pandas.to_timedelta",
"torch.cuda.device_count",
"pandas.read_pickle",
"os.path.exists",
"argparse.ArgumentParser",
"model.bert_text_model.BertTextModel",
"model.bert_things.pytorch_pretrained_bert.tokenization.BertTokenizer",
"model.bert_things.pytorch_pretrained_bert.BertConf... | [((1252, 1318), 'torch.zeros', 'torch.zeros', (['(bert_seq_length, max_seq_len_text)'], {'dtype': 'torch.long'}), '((bert_seq_length, max_seq_len_text), dtype=torch.long)\n', (1263, 1318), False, 'import torch\n'), ((1332, 1380), 'torch.zeros', 'torch.zeros', (['(bert_seq_length, max_seq_len_text)'], {}), '((bert_seq_l... |
from flask import Flask
from flask_cors import CORS
from resources.fit_out_cost_prediction import fitout_cost_prediction_api
DEBUG = True
HOST = '0.0.0.0'
PORT = 8080
app = Flask(__name__)
app.register_blueprint(fitout_cost_prediction_api)
cors = CORS(app, resources={
r"/*": {
"origins": ["https://testi... | [
"flask_cors.CORS",
"flask.Flask"
] | [((175, 190), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (180, 190), False, 'from flask import Flask\n'), ((251, 438), 'flask_cors.CORS', 'CORS', (['app'], {'resources': "{'/*': {'origins': ['https://testing-cost-predictor.firebaseapp.com',\n 'http://localhost:9000',\n 'https://frontend-cost-pred... |
import requests
import json
import matplotlib.pyplot as plt # Biblioteca de gráficos do pyhton
import math
#-------------------------------------------------------------------------------
titulo = '''
Gráfico de medições
Py4Delphi + Rest Dataware
'''
... | [
"json.loads",
"matplotlib.pyplot.hist",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.hist2d",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"requests.get",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.title",
"math.sin",
"matplotlib.pyplot.show"
] | [((494, 511), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (506, 511), False, 'import requests\n'), ((585, 605), 'json.loads', 'json.loads', (['req.text'], {}), '(req.text)\n', (595, 605), False, 'import json\n'), ((1493, 1510), 'matplotlib.pyplot.title', 'plt.title', (['titulo'], {}), '(titulo)\n', (1502,... |
#!/usr/bin/env python3
from aws_cdk import App, Aspects
from eks_cis_cdk.eks_cis_cdk_stack import CdkConfigEksStack
from eks_cis_cdk.config_cis_cdk_stack import lambdaStack
# from config_cis_cdk.eks_cis_cdk_stack import lambdaStack
# from eks_cis_cdk.eks_test_stack import lambdaTestStack
############### Deployment P... | [
"aws_cdk.App",
"eks_cis_cdk.eks_cis_cdk_stack.CdkConfigEksStack",
"eks_cis_cdk.config_cis_cdk_stack.lambdaStack"
] | [((704, 709), 'aws_cdk.App', 'App', ([], {}), '()\n', (707, 709), False, 'from aws_cdk import App, Aspects\n'), ((722, 808), 'eks_cis_cdk.eks_cis_cdk_stack.CdkConfigEksStack', 'CdkConfigEksStack', (['app', '"""eksconfigexample"""'], {'eks_admin_rolename': 'eks_admin_rolename'}), "(app, 'eksconfigexample', eks_admin_rol... |
from c0101_retrieve_ref import retrieve_ref
from c0101_retrieve_ref import retrieve_ref_color
from c0101_retrieve_ref import retrieve_sensor_unit
from c0102_timestamp import timestamp_source
from c0103_trim_record_to_max import trim_record_to_max
from c0104_plot_timestamp import plot_timestamp
from c0105_find_records i... | [
"pandas.isnull",
"c0108_save_meta.save_meta",
"c0109_retrieve_meta.retrieve_meta",
"c0111_retrieve_analyzed.retrieve_analyzed",
"c0101_retrieve_ref.retrieve_ref"
] | [((1003, 1029), 'c0101_retrieve_ref.retrieve_ref', 'retrieve_ref', (['"""study_list"""'], {}), "('study_list')\n", (1015, 1029), False, 'from c0101_retrieve_ref import retrieve_ref\n'), ((1150, 1170), 'c0109_retrieve_meta.retrieve_meta', 'retrieve_meta', (['study'], {}), '(study)\n', (1163, 1170), False, 'from c0109_re... |
from __future__ import absolute_import, division, print_function, unicode_literals
from collections import namedtuple
import six
import sys
from echomesh.base.AddExceptionSuffix import add_exception_suffix
from echomesh.base import GetPrefix
from echomesh.base import Join
from echomesh.util import Importer
from echo... | [
"echomesh.base.GetPrefix.get_prefix",
"echomesh.base.Join.join_words",
"echomesh.util.registry.Entry.Entry",
"echomesh.util.Log.logger",
"six.iteritems",
"echomesh.base.AddExceptionSuffix.add_exception_suffix"
] | [((392, 412), 'echomesh.util.Log.logger', 'Log.logger', (['__name__'], {}), '(__name__)\n', (402, 412), False, 'from echomesh.util import Log\n'), ((1426, 1445), 'six.iteritems', 'six.iteritems', (['kwds'], {}), '(kwds)\n', (1439, 1445), False, 'import six\n'), ((2250, 2279), 'six.iteritems', 'six.iteritems', (['self._... |
'''
Function:
鱼C论坛客户端
Author:
Charles
微信公众号:
Charles的皮卡丘
更新日期:
2022-03-11
'''
import re
from .baseclient import BaseClient
'''鱼C论坛客户端'''
class FishCClient(BaseClient):
def __init__(self, reload_history=True, **kwargs):
super(FishCClient, self).__init__(website_name='fishc', reload_history=... | [
"re.findall"
] | [((527, 580), 're.findall', 're.findall', (['"""title="访问我的空间">(.*?)</a>"""', 'response.text'], {}), '(\'title="访问我的空间">(.*?)</a>\', response.text)\n', (537, 580), False, 'import re\n')] |
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : <NAME> (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers who take t... | [
"openerp.osv.fields.char",
"openerp.osv.fields.many2one",
"openerp.osv.fields.binary",
"openerp.osv.fields.float",
"openerp.osv.fields.text",
"openerp.osv.fields.selection"
] | [((1592, 1633), 'openerp.osv.fields.many2one', 'fields.many2one', (['"""res.company"""', '"""Company"""'], {}), "('res.company', 'Company')\n", (1607, 1633), False, 'from openerp.osv import fields, osv\n'), ((1652, 1713), 'openerp.osv.fields.text', 'fields.text', (['"""webkit header"""'], {'help': '"""Set Webkit Report... |
"""Test that the app behaves as expected."""
from os import getenv
from click.testing import CliRunner
from circleci_branch.cli import app
RUNNER = CliRunner(
env={"CIRCLE_PULL_REQUEST": None, "GITHUB_TOKEN": None}, # type: ignore
)
PR_1 = "https://github.com/j5api/circleci_branch/pull/1"
PR_2 = "https://github... | [
"click.testing.CliRunner",
"os.getenv"
] | [((151, 217), 'click.testing.CliRunner', 'CliRunner', ([], {'env': "{'CIRCLE_PULL_REQUEST': None, 'GITHUB_TOKEN': None}"}), "(env={'CIRCLE_PULL_REQUEST': None, 'GITHUB_TOKEN': None})\n", (160, 217), False, 'from click.testing import CliRunner\n'), ((964, 986), 'os.getenv', 'getenv', (['"""GITHUB_TOKEN"""'], {}), "('GIT... |
# Copyright 2013 The Swarming Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0 that
# can be found in the LICENSE file.
"""subprocess42 is the answer to life the universe and everything.
It has the particularity of having a Popen implementation that can yield o... | [
"signal.signal",
"select.select",
"ctypes.wintypes.DWORD",
"os.getpgid",
"os.setpgid",
"ctypes.wintypes.byref",
"fcntl.fcntl",
"time.sleep",
"os.killpg",
"ctypes.wintypes.create_string_buffer",
"ctypes.wintypes.GetLastError",
"time.time"
] | [((1187, 1203), 'ctypes.wintypes.DWORD', 'wintypes.DWORD', ([], {}), '()\n', (1201, 1203), False, 'from ctypes import wintypes\n'), ((1215, 1263), 'ctypes.wintypes.create_string_buffer', 'wintypes.create_string_buffer', (['(desired_bytes + 1)'], {}), '(desired_bytes + 1)\n', (1244, 1263), False, 'from ctypes import win... |
import collections
import logging
import nltk
import operator
import os
import pathlib
import re
from typing import List, Optional, Tuple
from transformers import PreTrainedTokenizer
logging.basicConfig(level=logging.DEBUG)
VOCAB_FILES_NAMES = {"vocab_file": "vocab.txt"}
class NEA_NLTK_Tokenizer(object):
"""... | [
"logging.basicConfig",
"collections.OrderedDict",
"nltk.word_tokenize",
"os.makedirs",
"pathlib.Path",
"logging.warning",
"re.sub",
"operator.itemgetter"
] | [((186, 226), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (205, 226), False, 'import logging\n'), ((853, 877), 'nltk.word_tokenize', 'nltk.word_tokenize', (['text'], {}), '(text)\n', (871, 877), False, 'import nltk\n'), ((5211, 5236), 'collections.OrderedDi... |
import uuid
from django.contrib.auth.models import AbstractUser , PermissionsMixin
from django.db import models
from django.urls import reverse
from django.utils.translation import ugettext_lazy as _
from backend.users.managers import UserManager
USER_TYPE = (
("0" , "client"),
("1" , "delivery")
)
class User... | [
"django.utils.translation.ugettext_lazy",
"backend.users.managers.UserManager",
"django.db.models.ForeignKey",
"django.urls.reverse",
"django.db.models.BooleanField",
"uuid.uuid4",
"django.db.models.CharField",
"django.db.models.UUIDField"
] | [((447, 492), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'blank': '(False)'}), '(max_length=255, blank=False)\n', (463, 492), False, 'from django.db import models\n'), ((510, 555), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'blank': '(False)'}), '(... |
import os
import torch
from torch import nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
VERBOSE = True
USE_CUDA = True
def model_summary(model):
for idx, m in enumerate(model.modules()):
print(idx, '->', m)
def save_checkpoint(state, loss, prefix, ckptpat... | [
"numpy.mean",
"torch.nn.functional.cosine_similarity",
"os.path.join",
"torch.nn.functional.cosine_embedding_loss",
"torch.nn.MSELoss",
"torch.is_tensor",
"torch.save",
"numpy.arange",
"numpy.random.shuffle"
] | [((344, 398), 'os.path.join', 'os.path.join', (['ckptpath', "('%s_%.5f.tar' % (prefix, loss))"], {}), "(ckptpath, '%s_%.5f.tar' % (prefix, loss))\n", (356, 398), False, 'import os\n'), ((403, 435), 'torch.save', 'torch.save', (['state', 'filename_late'], {}), '(state, filename_late)\n', (413, 435), False, 'import torch... |
def generateTable(data,k=4):
T = {}
for i in range(len(data)-k):
X = data[i:i+k]
Y = data[i+k]
#print("X %s and Y %s "%(X,Y))
if T.get(X) is None:
T[X] = {}
T[X][Y] = 1
else:
if T[X].get(Y) is None:
... | [
"numpy.random.choice",
"numpy.random.seed"
] | [((1078, 1093), 'numpy.random.seed', 'random.seed', (['(11)'], {}), '(11)\n', (1089, 1093), False, 'from numpy import random\n'), ((1371, 1422), 'numpy.random.choice', 'np.random.choice', (['possible_Chars'], {'p': 'possible_values'}), '(possible_Chars, p=possible_values)\n', (1387, 1422), True, 'import numpy as np\n')... |
from apps.fhir.bluebutton.models import Crosswalk
from django.contrib import admin
class CrosswalkAdmin(admin.ModelAdmin):
list_display = ('get_user_username', 'fhir_id')
search_fields = ('user__username', '_fhir_id')
raw_id_fields = ("user", )
def get_user_username(self, obj):
return obj.use... | [
"django.contrib.admin.site.register"
] | [((441, 487), 'django.contrib.admin.site.register', 'admin.site.register', (['Crosswalk', 'CrosswalkAdmin'], {}), '(Crosswalk, CrosswalkAdmin)\n', (460, 487), False, 'from django.contrib import admin\n')] |
import os
try:
basestring
except NameError:
basestring = str
class ListenImports:
ROBOT_LISTENER_API_VERSION = 2
def __init__(self, imports):
self.imports = open(imports, 'w')
def library_import(self, name, attrs):
self._imported("Library", name, attrs)
def resource_import(... | [
"os.path.isabs"
] | [((886, 906), 'os.path.isabs', 'os.path.isabs', (['entry'], {}), '(entry)\n', (899, 906), False, 'import os\n')] |
"""
tests.support.pytest.helpers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PyTest helpers functions
"""
import logging
import os
import pathlib
import shutil
import tempfile
import textwrap
import types
import warnings
from contextlib import contextmanager
import pytest
from tests.support.pytest.loader import LoaderMo... | [
"logging.getLogger",
"os.path.exists",
"textwrap.dedent",
"os.makedirs",
"pathlib.Path",
"os.close",
"tests.support.pytest.loader.LoaderModuleMock",
"os.path.join",
"os.path.isdir",
"tempfile.mkdtemp",
"os.unlink",
"shutil.rmtree",
"warnings.warn"
] | [((384, 411), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (401, 411), False, 'import logging\n'), ((7779, 7821), 'tests.support.pytest.loader.LoaderModuleMock', 'LoaderModuleMock', (['loader_modules'], {}), '(loader_modules, **kwargs)\n', (7795, 7821), False, 'from tests.support.pytest... |
import re
import requests
from .exceptions import MsalServiceError
WORLD_WIDE = 'login.microsoftonline.com' # There was an alias login.windows.net
WELL_KNOWN_AUTHORITY_HOSTS = set([
WORLD_WIDE,
'login.chinacloudapi.cn',
'login-us.microsoftonline.com',
'login.microsoftonline.us',
'login.microsof... | [
"requests.get"
] | [((3864, 3913), 'requests.get', 'requests.get', (['tenant_discovery_endpoint'], {}), '(tenant_discovery_endpoint, **kwargs)\n', (3876, 3913), False, 'import requests\n')] |
import cv2
from matplotlib import pyplot as plt
import numpy as np
import glob
import pickle
images = glob.glob('images/*.jpg')
keypoints = []
scale_percent = 5
width = 300
height = 200
dim = (width, height)
objectpoints = []
path_image_founds = []
for im_name in images:
im = cv2.cvtColor(cv2.imread(im_name), cv2... | [
"matplotlib.pyplot.imshow",
"cv2.projectPoints",
"matplotlib.pyplot.plot",
"numpy.squeeze",
"numpy.zeros",
"cv2.calibrateCamera",
"cv2.findChessboardCorners",
"cv2.resize",
"cv2.imread",
"glob.glob",
"matplotlib.pyplot.show"
] | [((103, 128), 'glob.glob', 'glob.glob', (['"""images/*.jpg"""'], {}), "('images/*.jpg')\n", (112, 128), False, 'import glob\n'), ((780, 841), 'cv2.calibrateCamera', 'cv2.calibrateCamera', (['objectpoints', 'keypoints', 'dim', 'None', 'None'], {}), '(objectpoints, keypoints, dim, None, None)\n', (799, 841), False, 'impo... |
# python3
"""Importance weighted advantage actor-critic (IMPALA) agent implementation."""
from typing import Callable
from acme import specs
from acme.jax import networks
from acme.utils import counting
from acme.utils import loggers
import haiku as hk
from magi.agents.impala import builder as builder_lib
from magi.... | [
"haiku.transform",
"magi.agents.impala.builder.IMPALABuilder"
] | [((1126, 1188), 'magi.agents.impala.builder.IMPALABuilder', 'builder_lib.IMPALABuilder', (['config'], {'initial_state': 'initial_state'}), '(config, initial_state=initial_state)\n', (1151, 1188), True, 'from magi.agents.impala import builder as builder_lib\n'), ((1064, 1094), 'haiku.transform', 'hk.transform', (['initi... |
from unittest import TestCase
from barentsz._attribute import Attribute
class TestAttribute(TestCase):
def test_is_private_or_public(self):
# SETUP
attribute1 = Attribute(
name='attr',
type_=int,
value=42,
doc='some doc',
comment='some ... | [
"barentsz._attribute.Attribute"
] | [((185, 359), 'barentsz._attribute.Attribute', 'Attribute', ([], {'name': '"""attr"""', 'type_': 'int', 'value': '(42)', 'doc': '"""some doc"""', 'comment': '"""some comment"""', 'hint': '"""int"""', 'module': 'None', 'assigned_value': '"""42"""', 'line': '"""attr: int = 42"""', 'line_nr': '(-1)'}), "(name='attr', type... |
#!/usr/bin/env python3
## TODO: optimize c-mcpu metric; early-stop handler; fp16/int8; Kill pyRPC;
import numpy as np
import tvm
import logging
import math
import re
import sys, time, subprocess, os, random, hashlib
from tvm import autotvm
import topi
import json
from topi.util import get_const_tuple
import importlib... | [
"logging.getLogger",
"subprocess.getoutput",
"logging.StreamHandler",
"tvm.autotvm.task.ConfigEntity.from_json_dict",
"math.floor",
"tvm.autotvm.task.dispatcher.ApplyConfig",
"time.sleep",
"tvm.context",
"sys.exit",
"tvm.lower",
"os.remove",
"tvm.autotvm.tuner.XGBTuner",
"tvm.autotvm.LocalRu... | [((1961, 1985), 'json.dumps', 'json.dumps', (['search_space'], {}), '(search_space)\n', (1971, 1985), False, 'import json\n'), ((3128, 3180), 'os.system', 'os.system', (['(\'mkdir -p "%s/%s"\' % (dir_space, dir_sid))'], {}), '(\'mkdir -p "%s/%s"\' % (dir_space, dir_sid))\n', (3137, 3180), False, 'import sys, time, subp... |
import urllib3
from bs4 import BeautifulSoup
import os
import re
dest_folder = 'D:/workspace/doc/novatel'
def mkdir(path):
# 引入模块
import os
# 去除首位空格
path = path.strip()
# 去除尾部 \ 符号
path = path.rstrip("\\")
# 判断路径是否存在
# 存在 True
# 不存在 False
isExists = os.path.exists(path... | [
"os.path.exists",
"os.makedirs",
"re.compile",
"bs4.BeautifulSoup",
"urllib3.PoolManager"
] | [((301, 321), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (315, 321), False, 'import os\n'), ((614, 635), 'urllib3.PoolManager', 'urllib3.PoolManager', ([], {}), '()\n', (633, 635), False, 'import urllib3\n'), ((433, 450), 'os.makedirs', 'os.makedirs', (['path'], {}), '(path)\n', (444, 450), False, ... |
import nose
import requests
requests.packages.urllib3.disable_warnings()
if __name__ == '__main__':
nose.main()
| [
"nose.main",
"requests.packages.urllib3.disable_warnings"
] | [((29, 73), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {}), '()\n', (71, 73), False, 'import requests\n'), ((107, 118), 'nose.main', 'nose.main', ([], {}), '()\n', (116, 118), False, 'import nose\n')] |
"""Strategies and fuzzer class module"""
import random
import re
from wafamole.payloadfuzzer.fuzz_utils import (
replace_random,
filter_candidates,
random_string,
num_tautology,
string_tautology,
num_contradiction,
string_contradiction,
)
def reset_inline_comments(payload: str):
"""Re... | [
"random.choice",
"wafamole.payloadfuzzer.fuzz_utils.num_tautology",
"wafamole.payloadfuzzer.fuzz_utils.random_string",
"wafamole.payloadfuzzer.fuzz_utils.string_contradiction",
"wafamole.payloadfuzzer.fuzz_utils.filter_candidates",
"wafamole.payloadfuzzer.fuzz_utils.num_contradiction",
"wafamole.payload... | [((696, 723), 'random.choice', 'random.choice', (['replacements'], {}), '(replacements)\n', (709, 723), False, 'import random\n'), ((1021, 1050), 're.search', 're.search', (['"""(#|-- )"""', 'payload'], {}), "('(#|-- )', payload)\n", (1030, 1050), False, 'import re\n'), ((1792, 1814), 'random.choice', 'random.choice', ... |
from typing import Tuple
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import ec
from ... import serialize
__all__ = ["generate_key_pair", "generate_shared_key"]
def generate_key_pair(curve: ec.EllipticCurve) -> Tuple[bytes, bytes]:
priv_key = e... | [
"cryptography.hazmat.primitives.asymmetric.ec.derive_private_key",
"cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey.from_encoded_point",
"cryptography.hazmat.primitives.asymmetric.ec.generate_private_key",
"cryptography.hazmat.primitives.asymmetric.ec.ECDH",
"cryptography.hazmat.primitiv... | [((319, 349), 'cryptography.hazmat.primitives.asymmetric.ec.generate_private_key', 'ec.generate_private_key', (['curve'], {}), '(curve)\n', (342, 349), False, 'from cryptography.hazmat.primitives.asymmetric import ec\n'), ((747, 808), 'cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey.from_encoded_poi... |
import string
import torch
from torch.utils.data import DataLoader
from torchvision import transforms
from torchvision.datasets import ImageFolder
def dataset(data_path: string, crop_size: int, training_size: float, validation_size: float):
"""Process image into dataset format
Args:
data_path (string)... | [
"torch.utils.data.random_split",
"torchvision.datasets.ImageFolder",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torchvision.transforms.ToTensor",
"torchvision.transforms.RandomResizedCrop"
] | [((850, 894), 'torchvision.datasets.ImageFolder', 'ImageFolder', (['data_path'], {'transform': 'preprocess'}), '(data_path, transform=preprocess)\n', (861, 894), False, 'from torchvision.datasets import ImageFolder\n'), ((1098, 1171), 'torch.utils.data.random_split', 'torch.utils.data.random_split', (['dataset', '[trai... |
# coding=utf-8
import MySQLdb
from time import sleep
import mysql.connector
def connector():
""" method to make a connection with database """
global cnx
while True:
try:
cnx = mysql.connector.connect(user='', password='',
host="o... | [
"time.sleep"
] | [((756, 765), 'time.sleep', 'sleep', (['(30)'], {}), '(30)\n', (761, 765), False, 'from time import sleep\n'), ((851, 860), 'time.sleep', 'sleep', (['(30)'], {}), '(30)\n', (856, 860), False, 'from time import sleep\n')] |
# as_GPS.py Asynchronous device driver for GPS devices using a UART.
# Sentence parsing based on MicropyGPS by <NAME>
# https://github.com/inmcm/micropyGPS
# http://www.gpsinformation.org/dale/nmea.htm
# Docstrings removed because of question marks over their use in resource
# constrained systems e.g. https://github.co... | [
"collections.deque",
"as_GPS_utils.date_string",
"micropython.const",
"as_GPS_utils.compass_direction",
"asyncio.sleep",
"asyncio.get_event_loop",
"aioserial.AioSerial"
] | [((802, 810), 'micropython.const', 'const', (['(1)'], {}), '(1)\n', (807, 810), False, 'from micropython import const\n'), ((817, 825), 'micropython.const', 'const', (['(2)'], {}), '(2)\n', (822, 825), False, 'from micropython import const\n'), ((831, 839), 'micropython.const', 'const', (['(3)'], {}), '(3)\n', (836, 83... |
#coding: UTF-8
# 信息利用率低:不同的机器学习算法和模型对数据中信息的利用是不同的,之前提到在线性模型中,使用对定性特征哑编码可以达到非线性的效果。类似地,对定量变量多项式化,或者进行其他的转换,都能达到非线性的效果。
from sklearn.preprocessing import PolynomialFeatures
import numpy as np
X = np.arange(6).reshape(3, 2)
print(X)
poly = PolynomialFeatures(2)
print(poly.fit_transform(X))
poly = PolynomialFeatures(int... | [
"sklearn.preprocessing.PolynomialFeatures",
"numpy.arange"
] | [((239, 260), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', (['(2)'], {}), '(2)\n', (257, 260), False, 'from sklearn.preprocessing import PolynomialFeatures\n'), ((298, 339), 'sklearn.preprocessing.PolynomialFeatures', 'PolynomialFeatures', ([], {'interaction_only': '(True)'}), '(interaction_only=Tr... |
from django.db import models
# Create your models here.
class System(models.Model):
hostname = models.CharField(max_length=128,default="firewall")
domain = models.CharField(max_length=128,default="lan")
apply_iptables = models.BooleanField(default=True)
apply_ipaddrs = models.BooleanField(default=Fals... | [
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.CharField",
"django.db.models.BooleanField"
] | [((101, 153), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)', 'default': '"""firewall"""'}), "(max_length=128, default='firewall')\n", (117, 153), False, 'from django.db import models\n'), ((166, 213), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(128)', 'default... |
# Copyright 2016 - Nokia.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar... | [
"django.utils.translation.ungettext_lazy",
"django.utils.translation.ugettext_lazy",
"mistraldashboard.default.smart_cell.init",
"mistraldashboard.api.action_execution_delete",
"mistraldashboard.api.action_execution_get",
"django.urls.reverse"
] | [((864, 881), 'mistraldashboard.default.smart_cell.init', 'smart_cell.init', ([], {}), '()\n', (879, 881), False, 'from mistraldashboard.default import smart_cell\n'), ((1688, 1699), 'django.utils.translation.ugettext_lazy', '_', (['"""Update"""'], {}), "('Update')\n", (1689, 1699), True, 'from django.utils.translation... |
import redis
class Cache:
def __init__(self, host, port):
self.conn = redis.Redis(host=host, port=port)
def get(self, key):
return self.conn.get(key)
def sef(self, key, value):
self.conn.set(key, value)
def hgetall(self, key):
return self.conn.hgetall(key)
def hmset(self, key, value):
self.conn.hms... | [
"redis.Redis"
] | [((75, 108), 'redis.Redis', 'redis.Redis', ([], {'host': 'host', 'port': 'port'}), '(host=host, port=port)\n', (86, 108), False, 'import redis\n')] |
#!/bin/env python
#
# Utilities to generate an automated workflow with GNU make
# makefile_init is used to initialize the make, then makefile_append
# or makefile_secondary to add commands and makefile_run to run the workflow.
# <NAME>
# 03/2019
import os
import sys
from tempfile import NamedTemporaryFile
import trace... | [
"os.path.exists",
"traceback.print_stack",
"subprocess.Popen",
"subprocess.run",
"os.path.normpath",
"tempfile.NamedTemporaryFile",
"sys.exit",
"packaging.version.parse"
] | [((652, 708), 'subprocess.Popen', 'subprocess.Popen', (["['make', '-v']"], {'stdout': 'subprocess.PIPE'}), "(['make', '-v'], stdout=subprocess.PIPE)\n", (668, 708), False, 'import subprocess\n'), ((1056, 1075), 'packaging.version.parse', 'version.parse', (['vnum'], {}), '(vnum)\n', (1069, 1075), False, 'from packaging ... |
import os
import csv
import pkg_resources
import re
import traceback
import nbformat as nf
import nbconvert as nc
from urllib.parse import quote as urlquote
def isdir(path):
'''
Checks whether given path is a directory
'''
if not os.path.isdir(path):
raise OSError('"' + path + '"' + ' is not ... | [
"nbconvert.HTMLExporter",
"os.listdir",
"csv.DictReader",
"traceback.extract_stack",
"nbformat.read",
"nbconvert.filters.markdown2html",
"os.path.join",
"pkg_resources.resource_filename",
"urllib.parse.quote",
"nbformat.v4.new_notebook",
"os.path.isdir",
"re.sub",
"nbformat.v4.new_markdown_c... | [((1919, 1953), 'nbformat.read', 'nf.read', (['filehandle', 'nf.NO_CONVERT'], {}), '(filehandle, nf.NO_CONVERT)\n', (1926, 1953), True, 'import nbformat as nf\n'), ((5178, 5209), 'nbconvert.filters.markdown2html', 'nc.filters.markdown2html', (['title'], {}), '(title)\n', (5202, 5209), True, 'import nbconvert as nc\n'),... |
import pickle
import spacy
nlp= pickle.load(open("veronica/data/en_core_web_md","rb"))
nlp=spacy.load("en_core_web_md")
while True:
d1= nlp(input("S1 = "))
d2= nlp(input("S2 = "))
print("{} {} || {}".format(d1.ents,d2.ents,d1.similarity(d2))) | [
"spacy.load"
] | [((92, 120), 'spacy.load', 'spacy.load', (['"""en_core_web_md"""'], {}), "('en_core_web_md')\n", (102, 120), False, 'import spacy\n')] |
import re
import torch
from torch import nn
import pandas as pd
import numpy as np
from torch._six import container_abcs, string_classes, int_classes
from torch.nn.utils import rnn as rnn_utils
from typing import TypeVar, Dict, List, Tuple
from ..typing import SocSeqList, SocSeqBatch, SocSeqPolicyBatch, SocSeqPolicyLis... | [
"torch.ones_like",
"torch.as_tensor",
"numpy.sqrt",
"re.compile",
"torch.utils.data.get_worker_info",
"numpy.round",
"torch.stack",
"torch.sqrt",
"torch.nn.utils.rnn.pad_sequence",
"torch.tensor",
"torch.round",
"numpy.concatenate",
"pandas.DataFrame",
"torch.no_grad",
"torch.zeros_like"... | [((390, 437), 'typing.TypeVar', 'TypeVar', (['"""DataTensor"""', 'np.ndarray', 'torch.Tensor'], {}), "('DataTensor', np.ndarray, torch.Tensor)\n", (397, 437), False, 'from typing import TypeVar, Dict, List, Tuple\n'), ((465, 485), 're.compile', 're.compile', (['"""[SaUO]"""'], {}), "('[SaUO]')\n", (475, 485), False, 'i... |
import pytest
config = """
from universum.configuration_support import Configuration
def step(name, cmd=False):
return Configuration([dict(name=name, command=[] if not cmd else ["bash", "-c", '''echo "run step"'''])])
configs = step('parent 1 ') * (step('step 1', True) + step('step 2', True))
configs += step('pa... | [
"pytest.mark.parametrize"
] | [((385, 1200), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""filters,expected_logs, unexpected_logs"""', "(['parent 1', ['parent 1', 'step 1', 'step 2'], ['parent 2']], ['!parent 2',\n ['parent 1', 'step 1', 'step 2'], ['parent 2']], ['parent 1:parent 2',\n ['parent 1', 'step 1', 'step 2', 'parent 2... |
from setuptools import setup, find_packages
from os import path
requires = [
"asyncpg",
"click-plugins",
"click",
"colorlog",
"cookiecutter",
"cryptography",
# docstring-parser has been known to publish non-backwards compatible minors in the past
"docstring-parser>=0.10,<0.13",
"ema... | [
"os.path.dirname",
"setuptools.find_packages",
"os.path.join"
] | [((856, 878), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (868, 878), False, 'from os import path\n'), ((890, 928), 'os.path.join', 'path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (899, 928), False, 'from os import path\n'), ((2171, 2191), 'setupto... |
# Generated with Hysteresis
#
from enum import Enum
from enum import auto
class Hysteresis(Enum):
""""""
NO_HYSTERESIS = auto()
GENERATED_HYSTERESIS = auto()
def label(self):
if self == Hysteresis.NO_HYSTERESIS:
return "No hysteresis"
if self == Hysteresis.GENERATED_HYSTER... | [
"enum.auto"
] | [((131, 137), 'enum.auto', 'auto', ([], {}), '()\n', (135, 137), False, 'from enum import auto\n'), ((165, 171), 'enum.auto', 'auto', ([], {}), '()\n', (169, 171), False, 'from enum import auto\n')] |
# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json
class Component:
DESCRIPTION = "Run Python function"
class Input:
FUNCTION = "function"
INPUT = "input"
class Output:
RESULT1 = "result1"
RESULT2 = "result2"
class RunInput(komand.Input):
schema = json.loads("""
... | [
"json.loads"
] | [((303, 921), 'json.loads', 'json.loads', (['"""\n {\n "type": "object",\n "title": "Variables",\n "properties": {\n "function": {\n "type": "string",\n "title": "Function",\n "displayType": "python",\n "description": "Function definition. Must be named `run`. Accepts the `input` object as p... |
# model.py
import torch
from torch import nn
from torch import Tensor
from torch.autograd import Variable
import numpy as np
from sklearn.metrics import accuracy_score
class CNNText(nn.Module):
def __init__(self, config):
super(CNNText, self).__init__()
self.config = config
# Conv... | [
"torch.nn.MaxPool1d",
"torch.cuda.LongTensor",
"torch.nn.ReLU",
"torch.nn.Dropout",
"numpy.mean",
"torch.nn.Softmax",
"torch.Tensor",
"torch.nn.Conv2d",
"numpy.array",
"torch.cat"
] | [((465, 647), 'torch.nn.Conv2d', 'nn.Conv2d', ([], {'in_channels': 'self.config.in_channels', 'out_channels': 'self.config.num_channels', 'kernel_size': '(self.config.kernel_size[0], self.config.embed_size)', 'stride': '(1)', 'padding': '(0)'}), '(in_channels=self.config.in_channels, out_channels=self.config.\n num_... |
from utils.gui import convert_input
def check_none(ret):
if ret is not None:
raise Exception
def test_convert_input():
# Test bool
ret = convert_input("1", "bool", "param", "bool")
check_none(ret)
ret = convert_input("3.67", "bool", "param", "bool")
check_none(ret)
ret = convert_... | [
"utils.gui.convert_input"
] | [((159, 202), 'utils.gui.convert_input', 'convert_input', (['"""1"""', '"""bool"""', '"""param"""', '"""bool"""'], {}), "('1', 'bool', 'param', 'bool')\n", (172, 202), False, 'from utils.gui import convert_input\n'), ((234, 280), 'utils.gui.convert_input', 'convert_input', (['"""3.67"""', '"""bool"""', '"""param"""', '... |
# Copyright 2016 Isotoma 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
#
# Unless required by applicable law or agreed to in writing... | [
"touchdown.tests.fixtures.aws.VpcFixture"
] | [((1447, 1481), 'touchdown.tests.fixtures.aws.VpcFixture', 'VpcFixture', (['goal', 'account.resource'], {}), '(goal, account.resource)\n', (1457, 1481), False, 'from touchdown.tests.fixtures.aws import VpcFixture\n')] |
import configparser
import logging
import os
from github import Github
def github_conn(filename="$HOME/.github_api"):
config = configparser.ConfigParser()
config.read(os.path.expandvars(filename))
token = config['api']['token']
return Github(token)
| [
"os.path.expandvars",
"configparser.ConfigParser",
"github.Github"
] | [((134, 161), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (159, 161), False, 'import configparser\n'), ((255, 268), 'github.Github', 'Github', (['token'], {}), '(token)\n', (261, 268), False, 'from github import Github\n'), ((178, 206), 'os.path.expandvars', 'os.path.expandvars', (['file... |
"""
fact_table_converter.py - Converts Fact Tables to Fact2 format.
Creates the new schema for mecha3's version of the Fact Manager, and converts
existing facts to the new format.
NULL entries will have default values inserted.
This script is STANDALONE and is not intended to be invoked by mecha.
Do not import this ... | [
"psycopg2.pool.SimpleConnectionPool",
"getpass.getpass"
] | [((1289, 1335), 'getpass.getpass', 'getpass.getpass', (['"""Database Password [mecha3]:"""'], {}), "('Database Password [mecha3]:')\n", (1304, 1335), False, 'import getpass\n'), ((1951, 2107), 'psycopg2.pool.SimpleConnectionPool', 'psycopg2.pool.SimpleConnectionPool', (['(1)', '(5)'], {'host': 'database_host', 'port': ... |
# Copyright 2022 VMware, Inc.
# SPDX-License-Identifier: MIT
import json
import datetime
from .a11y_tl import *
from .a11y_rpt import *
def saveAccessibilityResult(result_utility_type,uuid,user,result_type,screenshot_uid,original_url,url_to_accessibility,accessibility_result,create_time,result_api_type):
url={"o... | [
"datetime.datetime.now",
"json.dumps"
] | [((399, 414), 'json.dumps', 'json.dumps', (['url'], {}), '(url)\n', (409, 414), False, 'import json\n'), ((465, 488), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (486, 488), False, 'import datetime\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-10-19 15:00
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sponsors', '0006_auto_20160929_1218'),
]
operations = [
migrations.AlterFie... | [
"django.db.models.PositiveSmallIntegerField"
] | [((402, 571), 'django.db.models.PositiveSmallIntegerField', 'models.PositiveSmallIntegerField', ([], {'choices': "[(1, 'Platinum'), (2, 'Gold'), (3, 'Silver'), (4, 'Bronze'), (5,\n 'Diversity'), (6, 'Media'), (7, 'Coffee')]", 'default': '(3)'}), "(choices=[(1, 'Platinum'), (2, 'Gold'), (3,\n 'Silver'), (4, 'Bronz... |
# Copyright (c) 2014, Vienna University of Technology (TU Wien), Department
# of Geodesy and Geoinformation (GEO).
# All rights reserved.
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source co... | [
"numpy.ma.average",
"numpy.sqrt",
"pandas.DataFrame",
"numpy.array",
"poets.timedate.dekad.get_dekad_period",
"numpy.ma.masked_invalid",
"numpy.nansum",
"numpy.choose"
] | [((2499, 2519), 'numpy.array', 'np.array', (['data[cols]'], {}), '(data[cols])\n', (2507, 2519), True, 'import numpy as np\n'), ((2530, 2555), 'numpy.ma.masked_invalid', 'np.ma.masked_invalid', (['dat'], {}), '(dat)\n', (2550, 2555), True, 'import numpy as np\n'), ((2750, 2802), 'pandas.DataFrame', 'pd.DataFrame', (['a... |
# Copyright 2018 Open Source Robotics Foundation, 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... | [
"pytest.fixture",
"pathlib.Path",
"rosidl_parser.parser.parse_idl_file"
] | [((1622, 1652), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (1636, 1652), False, 'import pytest\n'), ((7089, 7119), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (7103, 7119), False, 'import pytest\n'), ((7636, 7666), 'pytest.fi... |
#!/usr/bin/python3
# -*- encoding: utf-8 -*-
"""
Copyright 2015 Nb<<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 appli... | [
"unittest.main",
"la_json.serialise"
] | [((2533, 2548), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2546, 2548), False, 'import unittest\n'), ((2475, 2497), 'la_json.serialise', 'serialise', (['test_2_json'], {}), '(test_2_json)\n', (2484, 2497), False, 'from la_json import parse, serialise\n')] |
#!/usr/bin/env python3
import json
# Read the configuration from the json file
config_file_name = "config_aimslab.json"
json_file = open(config_file_name)
config_data = json.load(json_file)
a = config_data["QUALISYS"]["IP_MOCAP_SERVER"]
b = config_data['MAMBO']["BLUETOOTH_ADDRESS"]
c = int(config_data['PHASESPACE'... | [
"json.load"
] | [((170, 190), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (179, 190), False, 'import json\n')] |
import base64
import copy
import json
import os
from cloud_info_provider import exceptions
from cloud_info_provider.providers import base
from cloud_info_provider.providers import static
from cloud_info_provider import utils
try:
import defusedxml.ElementTree
from defusedxml import xmlrpc
from six.moves i... | [
"six.moves.xmlrpc_client.ServerProxy",
"defusedxml.xmlrpc.monkey_patch",
"cloud_info_provider.exceptions.OpenNebulaProviderException",
"cloud_info_provider.providers.static.StaticProvider",
"json.loads",
"cloud_info_provider.utils.pythonize_network_info",
"os.path.join",
"base64.b64decode",
"cloud_i... | [((429, 450), 'defusedxml.xmlrpc.monkey_patch', 'xmlrpc.monkey_patch', ([], {}), '()\n', (448, 450), False, 'from defusedxml import xmlrpc\n'), ((545, 588), 'cloud_info_provider.exceptions.OpenNebulaProviderException', 'exceptions.OpenNebulaProviderException', (['msg'], {}), '(msg)\n', (583, 588), False, 'from cloud_in... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
import cheese_pb2 as cheese__pb2
class CheeseServiceStub(object):
# missing associated documentation comment in .proto file
pass
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_unary_rpc_method_handler"
] | [((1254, 1343), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""cheesefarm.CheeseService"""', 'rpc_method_handlers'], {}), "('cheesefarm.CheeseService',\n rpc_method_handlers)\n", (1290, 1343), False, 'import grpc\n'), ((1021, 1199), 'grpc.unary_unary_rpc_method_handler', 'grpc.... |
""" ``test_helloworld`` module.
"""
import unittest
from helloworld import main
from wheezy.http.functional import WSGIClient
class HelloworldTestCase(unittest.TestCase):
def setUp(self):
self.client = WSGIClient(main)
def tearDown(self):
del self.client
self.client = None
def ... | [
"wheezy.http.functional.WSGIClient"
] | [((218, 234), 'wheezy.http.functional.WSGIClient', 'WSGIClient', (['main'], {}), '(main)\n', (228, 234), False, 'from wheezy.http.functional import WSGIClient\n')] |
import apache_beam as beam
import tensorflow as tf
from apache_beam.options.pipeline_options import PipelineOptions
from apache_beam.options.pipeline_options import SetupOptions
from regnety.utils.image_utils import *
def _bytes_feature(value):
"""Returns a bytes_list from a string / byte."""
if isinstance(v... | [
"tensorflow.image.resize",
"tensorflow.io.read_file",
"tensorflow.train.Int64List",
"tensorflow.train.BytesList",
"tensorflow.image.grayscale_to_rgb",
"tensorflow.constant",
"tensorflow.train.FloatList",
"apache_beam.Create",
"tensorflow.io.decode_jpeg",
"tensorflow.io.encode_jpeg",
"apache_beam... | [((968, 983), 'apache_beam.Pipeline', 'beam.Pipeline', ([], {}), '()\n', (981, 983), True, 'import apache_beam as beam\n'), ((331, 345), 'tensorflow.constant', 'tf.constant', (['(0)'], {}), '(0)\n', (342, 345), True, 'import tensorflow as tf\n'), ((474, 507), 'tensorflow.train.BytesList', 'tf.train.BytesList', ([], {'v... |
from mock import AsyncMock
import pytest
from opentrons.drivers.smoothie_drivers import SmoothieDriver
from opentrons.tools import write_pipette_memory
@pytest.fixture
def mock_driver() -> AsyncMock:
return AsyncMock(spec=SmoothieDriver)
async def test_write_identifiers(mock_driver: AsyncMock) -> None:
"""... | [
"opentrons.tools.write_pipette_memory._parse_model_from_barcode",
"mock.AsyncMock",
"opentrons.tools.write_pipette_memory.write_identifiers",
"pytest.raises",
"opentrons.tools.write_pipette_memory.check_previous_data"
] | [((214, 244), 'mock.AsyncMock', 'AsyncMock', ([], {'spec': 'SmoothieDriver'}), '(spec=SmoothieDriver)\n', (223, 244), False, 'from mock import AsyncMock\n'), ((571, 682), 'opentrons.tools.write_pipette_memory.write_identifiers', 'write_pipette_memory.write_identifiers', ([], {'mount': 'mount', 'new_id': 'new_id', 'new_... |
import numpy as np
from scipy import fft
from scipy.io import wavfile
from sklearn.linear_model import LogisticRegression
import pickle
import pprint
# 准备音乐数据
def create_fft(g, n):
rad = "d:/tmp/genres/" + g + "/converted/" + g + "." + str(n).zfill(5) + ".au.wav"
(sample_rate, X) = wavfile.read(rad)
fft_f... | [
"scipy.fft",
"scipy.io.wavfile.read",
"numpy.save"
] | [((293, 310), 'scipy.io.wavfile.read', 'wavfile.read', (['rad'], {}), '(rad)\n', (305, 310), False, 'from scipy.io import wavfile\n'), ((419, 445), 'numpy.save', 'np.save', (['sad', 'fft_features'], {}), '(sad, fft_features)\n', (426, 445), True, 'import numpy as np\n'), ((334, 340), 'scipy.fft', 'fft', (['X'], {}), '(... |
from typing import List, Callable
import nltk
import re
from pathlib import Path
import re
class BaseTokenizer(object):
def tokenize_text(self, text: str) -> List[List[str]]:
"""Splits text into sentences or treats entire text as sentence, splits sentences into tokens.
:param text: Text to be t... | [
"pathlib.Path",
"spacy.lang.en.English",
"re.match",
"nltk.stem.porter.PorterStemmer",
"re.sub",
"re.findall"
] | [((4778, 4802), 're.sub', 're.sub', (['"""-"""', '""" - """', 'text'], {}), "('-', ' - ', text)\n", (4784, 4802), False, 'import re\n'), ((4818, 4854), 're.sub', 're.sub', (['"""[^A-Za-z0-9\\\\-]"""', '""" """', 'text'], {}), "('[^A-Za-z0-9\\\\-]', ' ', text)\n", (4824, 4854), False, 'import re\n'), ((4870, 4895), 're.... |
import torch
import numpy as np
import time
import tempfile
import random
from itertools import count
import gc
import os
import glob
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import utils
default_variables_dict = utils.get_default_variable_dict()
LEAVE_PRINT_EVERY_N_SECS = d... | [
"torch.distributions.Categorical",
"numpy.array",
"numpy.mean",
"torch.nn.ModuleList",
"numpy.linspace",
"numpy.empty",
"numpy.random.seed",
"os.unlink",
"numpy.logspace",
"utils.get_gif_html",
"tempfile.mkdtemp",
"gc.collect",
"numpy.std",
"utils.get_default_variable_dict",
"time.time",... | [((258, 291), 'utils.get_default_variable_dict', 'utils.get_default_variable_dict', ([], {}), '()\n', (289, 291), False, 'import utils\n'), ((761, 818), 'numpy.logspace', 'np.logspace', (['(0)', 'T'], {'num': 'T', 'base': 'self.gamma', 'endpoint': '(False)'}), '(0, T, num=T, base=self.gamma, endpoint=False)\n', (772, 8... |
# *****************************************************************************
# Copyright (c) 2019, Intel Corporation All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sou... | [
"numpy.random.ranf",
"numpy.sqrt",
"time.time",
"pandas.DataFrame"
] | [((1617, 1628), 'time.time', 'time.time', ([], {}), '()\n', (1626, 1628), False, 'import time\n'), ((1637, 1654), 'numpy.random.ranf', 'np.random.ranf', (['n'], {}), '(n)\n', (1651, 1654), True, 'import numpy as np\n'), ((1663, 1680), 'numpy.random.ranf', 'np.random.ranf', (['n'], {}), '(n)\n', (1677, 1680), True, 'imp... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Basic Set Valve Position example
This example shows how to change the position of a valve
Requires at least one Fluigent valve controller (M-Switch, L-Switch,
2-Switch or P-Switch)
Copyright (c) Fluigent 2021. All Rights Reserved.
"""
# Print function for Python 2 c... | [
"Fluigent.SDK.fgt_init",
"Fluigent.SDK.fgt_get_valveRange",
"Fluigent.SDK.fgt_get_valvePosition",
"Fluigent.SDK.fgt_set_valvePosition",
"Fluigent.SDK.fgt_get_valveChannelCount",
"Fluigent.SDK.fgt_close"
] | [((665, 675), 'Fluigent.SDK.fgt_init', 'fgt_init', ([], {}), '()\n', (673, 675), False, 'from Fluigent.SDK import fgt_init, fgt_close\n'), ((1435, 1446), 'Fluigent.SDK.fgt_close', 'fgt_close', ([], {}), '()\n', (1444, 1446), False, 'from Fluigent.SDK import fgt_init, fgt_close\n'), ((720, 747), 'Fluigent.SDK.fgt_get_va... |
# -*- coding: utf-8 -*-
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(root + '/python')
import ccxt # noqa: E402
print('CCXT Version:', ccxt.__version__)
def table(values):
first = values[0]
keys = list(first.keys()) if isinstance(... | [
"os.path.abspath",
"ccxt.ftx",
"sys.path.append"
] | [((131, 164), 'sys.path.append', 'sys.path.append', (["(root + '/python')"], {}), "(root + '/python')\n", (146, 164), False, 'import sys\n'), ((585, 646), 'ccxt.ftx', 'ccxt.ftx', (["{'apiKey': 'YOUR_API_KEY', 'secret': 'YOUR_SECRET'}"], {}), "({'apiKey': 'YOUR_API_KEY', 'secret': 'YOUR_SECRET'})\n", (593, 646), False, ... |
import os
from pyfakefs.fake_filesystem_unittest import TestCase
from starwhale.utils import config as sw_config
from starwhale.utils.error import NotFoundError
from starwhale.utils.config import (
SWCliConfigMixed,
load_swcli_config,
get_swcli_config_path,
)
from .. import get_predefined_config_yaml
_e... | [
"os.path.exists",
"starwhale.utils.config.get_swcli_config_path",
"starwhale.utils.config.load_swcli_config",
"os.stat",
"starwhale.utils.config.SWCliConfigMixed"
] | [((542, 565), 'starwhale.utils.config.get_swcli_config_path', 'get_swcli_config_path', ([], {}), '()\n', (563, 565), False, 'from starwhale.utils.config import SWCliConfigMixed, load_swcli_config, get_swcli_config_path\n'), ((693, 712), 'starwhale.utils.config.load_swcli_config', 'load_swcli_config', ([], {}), '()\n', ... |
# IAIS Views
# <NAME> 1/18/21
import logging
import uuid
import json
from django.http import HttpResponseRedirect
from django.http.response import HttpResponse, JsonResponse
from django.contrib.auth import login, authenticate, logout
from django.contrib.auth.decorators import login_required
from django.views.decorators... | [
"django.shortcuts.render",
"django.contrib.auth.authenticate",
"json.loads",
"django.contrib.auth.login",
"uuid.uuid4",
"django.shortcuts.redirect",
"django.urls.reverse",
"logging.info",
"django.http.response.JsonResponse",
"django.contrib.auth.logout",
"django.core.paginator.Paginator"
] | [((3187, 3260), 'django.shortcuts.render', 'render', (['request', '"""imageais/register.html"""', "{'registerform': registerform}"], {}), "(request, 'imageais/register.html', {'registerform': registerform})\n", (3193, 3260), False, 'from django.shortcuts import render, redirect\n'), ((7978, 8048), 'django.shortcuts.ren... |
# project/api/exercises/exercises.py
from sqlalchemy import exc
from flask import Blueprint, jsonify, request
from project import db
from project.api.utils import authenticate
from project.api.exercises.models import Exercise
exercises_blueprint = Blueprint('exercises', __name__)
@exercises_blueprint.route('/exe... | [
"project.db.session.commit",
"project.db.session",
"project.api.exercises.models.Exercise.query.all",
"flask.request.get_json",
"project.api.exercises.models.Exercise",
"flask.Blueprint",
"flask.jsonify"
] | [((253, 285), 'flask.Blueprint', 'Blueprint', (['"""exercises"""', '__name__'], {}), "('exercises', __name__)\n", (262, 285), False, 'from flask import Blueprint, jsonify, request\n'), ((415, 435), 'project.api.exercises.models.Exercise.query.all', 'Exercise.query.all', ([], {}), '()\n', (433, 435), False, 'from projec... |
from flask import Blueprint, jsonify, request
from psycopg2 import sql
from app.postgres import Database
from app.models import check_auth, authorize
from vacancy.create_new_vacancy import check_fields
manage_candidat_bp = Blueprint('manage_candidat', __name__)
@manage_candidat_bp.route('/get_statuses_candidat', m... | [
"app.postgres.Database",
"psycopg2.sql.SQL",
"app.models.check_auth",
"psycopg2.sql.Literal",
"vacancy.create_new_vacancy.check_fields",
"flask.request.get_json",
"flask.Blueprint",
"flask.request.headers.get",
"flask.jsonify"
] | [((226, 264), 'flask.Blueprint', 'Blueprint', (['"""manage_candidat"""', '__name__'], {}), "('manage_candidat', __name__)\n", (235, 264), False, 'from flask import Blueprint, jsonify, request\n'), ((376, 413), 'app.models.check_auth', 'check_auth', (['request.headers', '__name__'], {}), '(request.headers, __name__)\n',... |
from xweb import App, Model, RESTController
class UserModel(Model):
schema = {
"type": "object",
"properties": {
"username": {"type": "string"},
"password": {"type": "string"},
},
"required": ['username']
}
class EventController(RESTController):
as... | [
"xweb.App",
"xweb.Model.validate"
] | [((428, 433), 'xweb.App', 'App', ([], {}), '()\n', (431, 433), False, 'from xweb import App, Model, RESTController\n'), ((347, 376), 'xweb.Model.validate', 'Model.validate', (['self.ctx.json'], {}), '(self.ctx.json)\n', (361, 376), False, 'from xweb import App, Model, RESTController\n')] |
import os
from molecool import open_pdb
pdb_file = os.path.join('molecool','data','pdb','water.pdb')
symbols, coords = open_pdb(pdb_file)
symbols | [
"os.path.join",
"molecool.open_pdb"
] | [((51, 103), 'os.path.join', 'os.path.join', (['"""molecool"""', '"""data"""', '"""pdb"""', '"""water.pdb"""'], {}), "('molecool', 'data', 'pdb', 'water.pdb')\n", (63, 103), False, 'import os\n'), ((119, 137), 'molecool.open_pdb', 'open_pdb', (['pdb_file'], {}), '(pdb_file)\n', (127, 137), False, 'from molecool import ... |
# -*- coding: utf-8 -*-
'''
Module for defining the classes related to the :math:`\\mathrm{A}^\\ast`
algorithm.
:math:`\\mathrm{A}^\\ast` algorithm (pronounced as "A star") is a search
algorithm proposed in 1968 by
`<NAME> & Raphael (1968) <https://doi.org/10.1109/TSSC.1968.300136>`_.
It optimally finds the minimum co... | [
"matplotlib.pyplot.gca",
"matplotlib.pyplot.colorbar",
"numpy.any",
"shapely.geometry.Point",
"numpy.array",
"matplotlib.pyplot.figure",
"shapely.geometry.LineString",
"numpy.empty",
"numpy.isinf",
"matplotlib.colors.LinearSegmentedColormap.from_list"
] | [((3406, 3422), 'numpy.array', 'array', (['coordsIdx'], {}), '(coordsIdx)\n', (3411, 3422), False, 'from numpy import array\n'), ((14228, 14276), 'numpy.empty', 'np.empty', (['(numberRows, numberCols)'], {'dtype': 'object'}), '((numberRows, numberCols), dtype=object)\n', (14236, 14276), True, 'import numpy as np\n'), (... |
from explorer import FileExplorer
def main():
explorer = FileExplorer()
explorer.to_string()
if __name__ == "__main__":
main() | [
"explorer.FileExplorer"
] | [((62, 76), 'explorer.FileExplorer', 'FileExplorer', ([], {}), '()\n', (74, 76), False, 'from explorer import FileExplorer\n')] |
import os
from askapdev.rbuild.builders import Scons as Builder
# This directory is expected by the build system
if not os.path.exists("icegenerated"):
os.makedirs("icegenerated")
b = Builder(".")
b.build()
# See Issue #2462 as to why we need to run the builder twice.
# build() method in Code removes the ins... | [
"askapdev.rbuild.builders.Scons",
"os.path.exists",
"os.makedirs"
] | [((194, 206), 'askapdev.rbuild.builders.Scons', 'Builder', (['"""."""'], {}), "('.')\n", (201, 206), True, 'from askapdev.rbuild.builders import Scons as Builder\n'), ((121, 151), 'os.path.exists', 'os.path.exists', (['"""icegenerated"""'], {}), "('icegenerated')\n", (135, 151), False, 'import os\n'), ((157, 184), 'os.... |
import math
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from rest_framework.test import APIClient
from apis.betterself.v1.constants import UNIQUE_KEY_CONSTANT
from apis.betterself.v1.signup.fixtures.builders import DemoHistoricalDataBuilder
from even... | [
"events.models.SupplementLog.objects.filter",
"django.contrib.auth.get_user_model",
"rest_framework.test.APIClient",
"math.isnan",
"supplements.models.Supplement.objects.filter",
"events.models.SleepLog.objects.filter",
"events.models.DailyProductivityLog.objects.filter",
"apis.betterself.v1.signup.fi... | [((433, 449), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (447, 449), False, 'from django.contrib.auth import get_user_model\n'), ((644, 687), 'apis.betterself.v1.signup.fixtures.builders.DemoHistoricalDataBuilder', 'DemoHistoricalDataBuilder', (['cls.default_user'], {}), '(cls.default_use... |
"""OS identification method using netflows -- User-Agent
This module contains implementation of UserAgent class which is a method for OS
identification using User-Agent technique.
"""
import structlog
class UserAgent:
"""UserAgent OS identification technique
This class provides an interface for performing OS... | [
"structlog.get_logger"
] | [((2479, 2501), 'structlog.get_logger', 'structlog.get_logger', ([], {}), '()\n', (2499, 2501), False, 'import structlog\n')] |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"os.path.abspath",
"azure.cli.testsdk.JMESPathCheck",
"azure.cli.testsdk.ResourceGroupPreparer"
] | [((737, 784), 'azure.cli.testsdk.ResourceGroupPreparer', 'ResourceGroupPreparer', ([], {'location': '"""canadacentral"""'}), "(location='canadacentral')\n", (758, 784), False, 'from azure.cli.testsdk import ScenarioTest, ResourceGroupPreparer, JMESPathCheck\n'), ((2051, 2092), 'azure.cli.testsdk.ResourceGroupPreparer',... |
import pyift.pyift as ift
import argparse
def str2bool(v):
if v.lower() in ('yes', 'true', 't', 'y', '1'):
return True
elif v.lower() in ('no', 'false', 'f', 'n', '0'):
return False
else:
raise argparse.ArgumentTypeError('Boolean value expected.')
def check_io_img(s):
if '.pn... | [
"argparse.ArgumentParser",
"pyift.pyift.ImageToMImage",
"pyift.pyift.DynTreeRoot",
"argparse.ArgumentTypeError",
"pyift.pyift.DynTreeClosestRoot",
"pyift.pyift.Circular",
"pyift.pyift.Normalize",
"pyift.pyift.LabeledSetFromSeedImage",
"pyift.pyift.ReadImageByExt"
] | [((699, 770), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""Image segmentation using Dynamic Trees."""'}), "(prog='Image segmentation using Dynamic Trees.')\n", (722, 770), False, 'import argparse\n'), ((1854, 1890), 'pyift.pyift.ReadImageByExt', 'ift.ReadImageByExt', (['args.input_image'], {}... |
# Copyright 2021 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0
from django.contrib.auth.models import User
from django.test import TestCase, Client
from django.test.client import RequestFactory
def get_user(netid):
try:
user = User.objects.get(username=netid)
return user
... | [
"django.contrib.auth.models.User.objects.get",
"django.test.client.RequestFactory",
"django.test.Client"
] | [((266, 298), 'django.contrib.auth.models.User.objects.get', 'User.objects.get', ([], {'username': 'netid'}), '(username=netid)\n', (282, 298), False, 'from django.contrib.auth.models import User\n'), ((578, 615), 'django.test.Client', 'Client', ([], {'HTTP_USER_AGENT': '"""Mozilla/5.0"""'}), "(HTTP_USER_AGENT='Mozilla... |
import json
import numpy as np
import pandas as pd
from pyplan_engine.classes.evaluators.BaseEvaluator import BaseEvaluator
from pyplan_engine.common.classes.filterChoices import filterChoices
from pyplan_engine.common.classes.indexValuesReq import IndexValuesReq
from cubepy.cube import kindToString
class PandasEva... | [
"numpy.prod",
"cubepy.cube.kindToString",
"json.dumps",
"numpy.concatenate",
"pandas.DataFrame",
"numpy.isinf",
"pandas.DataFrame.pivot_table"
] | [((20206, 20221), 'json.dumps', 'json.dumps', (['res'], {}), '(res)\n', (20216, 20221), False, 'import json\n'), ((2670, 2799), 'pandas.DataFrame.pivot_table', 'pd.DataFrame.pivot_table', (['_filteredDataFrame'], {'index': '_rows', 'columns': '_columns', 'aggfunc': 'sby', 'margins': '(False)', 'margins_name': '"""Total... |
import pandas as pd
pd.read_csv('Resources/cities.csv').to_html('Resources/table.html') | [
"pandas.read_csv"
] | [((21, 56), 'pandas.read_csv', 'pd.read_csv', (['"""Resources/cities.csv"""'], {}), "('Resources/cities.csv')\n", (32, 56), True, 'import pandas as pd\n')] |
from Hw.H5_CNN_Explaination.data import ImgDataset
from Hw.H5_CNN_Explaination.utils import *
from Hw.H5_CNN_Explaination.model import Classifier
from Hw.H3_CNN.model import CNN5
from Hw.H3_CNN.utils import get_best_checkpoint_path, test, evaluate
import copy
import matplotlib.pyplot as plt
import numpy as np
from lime... | [
"torch.nn.CrossEntropyLoss",
"argparse.ArgumentParser",
"matplotlib.pyplot.show",
"torch.load",
"lime.lime_image.LimeImageExplainer",
"matplotlib.pyplot.close",
"Hw.H5_CNN_Explaination.data.ImgDataset",
"Hw.H3_CNN.utils.get_best_checkpoint_path",
"torch.cuda.is_available",
"os.path.isdir",
"os.m... | [((449, 527), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '"""it\'s usage tip."""', 'description': '"""--h help info."""'}), '(usage="it\'s usage tip.", description=\'--h help info.\')\n', (472, 527), False, 'import argparse\n'), ((1744, 1769), 'torch.cuda.is_available', 'torch.cuda.is_availabl... |