code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import pickle
import numpy as np
from sklearn.model_selection import GridSearchCV
from sklearn.metrics import confusion_matrix
from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
from sklearn.externals import joblib
from nmapy.classification import *
def main():
#n... | [
"pickle.dump",
"sklearn.preprocessing.StandardScaler",
"numpy.histogram",
"numpy.array",
"sklearn.svm.SVC",
"sklearn.metrics.confusion_matrix",
"os.path.join"
] | [((2094, 2120), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {'copy': '(False)'}), '(copy=False)\n', (2108, 2120), False, 'from sklearn.preprocessing import StandardScaler\n'), ((3058, 3125), 'sklearn.svm.SVC', 'SVC', ([], {'C': '(12.041044961603584)', 'kernel': '"""linear"""', 'gamma': '(4.9585726444... |
"""
This file contains a testing function + resources for testing whether the graph value estimations
from graphvals.py return the correct estimates.
"""
__author__ = '<NAME>'
__maintainer__ = '<NAME>'
__email__ = '<EMAIL>'
__status__ = 'Development'
__license__ = 'Apache 2.0'
import unittest
import networkx as nx
im... | [
"unittest.main",
"anuran.graphvals.generate_graph_frame",
"pandas.DataFrame",
"anuran.graphvals.generate_graph_properties",
"anuran.graphvals._generate_graph_rows",
"networkx.Graph",
"networkx.set_edge_attributes"
] | [((1401, 1411), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1409, 1411), True, 'import networkx as nx\n'), ((1458, 1514), 'networkx.set_edge_attributes', 'nx.set_edge_attributes', (['a'], {'values': 'weights', 'name': '"""weight"""'}), "(a, values=weights, name='weight')\n", (1480, 1514), True, 'import networkx as... |
# Copyright 2018 GoDaddy
#
# 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 ... | [
"tempest.lib.decorators.skip_because",
"dateutil.parser.parse",
"tempest.lib.common.utils.data_utils.rand_name",
"octavia_tempest_plugin.tests.waiters.wait_for_deleted_status_or_not_found",
"testtools.TestCase.skipException",
"octavia_tempest_plugin.tests.waiters.wait_for_status",
"tempest.lib.common.ut... | [((4133, 4197), 'tempest.lib.decorators.idempotent_id', 'decorators.idempotent_id', (['"""ecdd65b0-cf8f-48ee-972b-2f09425472f1"""'], {}), "('ecdd65b0-cf8f-48ee-972b-2f09425472f1')\n", (4157, 4197), False, 'from tempest.lib import decorators\n'), ((4454, 4518), 'tempest.lib.decorators.idempotent_id', 'decorators.idempot... |
#!/usr/bin/env python
import argparse
import threading
import cibot
import json
import sys
import time
parser = argparse.ArgumentParser(description='Listens for requested CI',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument(
"-f",
"--frequency",
... | [
"threading.Thread",
"json.load",
"argparse.ArgumentParser",
"cibot.test_commit",
"cibot.add_commit_status",
"time.sleep",
"cibot.write_to_log",
"sys.exit"
] | [((113, 236), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Listens for requested CI"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description='Listens for requested CI',\n formatter_class=argparse.ArgumentDefaultsHelpFormatter)\n", (136, 236), False, 'import ... |
import logging
from django.utils.translation import ugettext as _
from django.views.generic.base import ContextMixin
logger = logging.getLogger(__name__)
# pylint: disable=too-few-public-methods
class LanguageTreeContextMixin(ContextMixin):
"""
This mixin provides extra context for language tree views
"... | [
"django.utils.translation.ugettext",
"logging.getLogger"
] | [((128, 155), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (145, 155), False, 'import logging\n'), ((809, 878), 'django.utils.translation.ugettext', '_', (['"""Please confirm that you really want to delete this language node"""'], {}), "('Please confirm that you really want to delete th... |
#######################
# Author: slurpxbt
#######################
import binance_candle_data as bcd
import pnl_display_funcs as pnl
from pathlib import Path
import pandas as pd
import datetime
import matplotlib.pyplot as plt
import numpy as np
# pandas display, pycharm otherwise doesn't display all columns
pd.set_opt... | [
"pnl_display_funcs.display_pnl",
"datetime.datetime",
"binance_candle_data.get_data_by_date",
"pathlib.Path",
"pandas.set_option"
] | [((310, 351), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', '(100)'], {}), "('display.max_columns', 100)\n", (323, 351), True, 'import pandas as pd\n'), ((372, 417), 'pandas.set_option', 'pd.set_option', (['"""display.width"""', 'desired_width'], {}), "('display.width', desired_width)\n", (385, 4... |
import os
import time
import traceback
from .abstract_device import AbstractDevice
from .view_hierarchy import view_hierarchy
class AndroidDevice(AbstractDevice):
def __init__(self, device_name, screen_wdth=1080, screen_height=1920):
self.screen_width = screen_wdth
self.screen_height = screen_hei... | [
"traceback.print_exc",
"os.system",
"time.sleep"
] | [((700, 718), 'os.system', 'os.system', (['command'], {}), '(command)\n', (709, 718), False, 'import os\n'), ((727, 742), 'time.sleep', 'time.sleep', (['(0.4)'], {}), '(0.4)\n', (737, 742), False, 'import time\n'), ((1157, 1175), 'os.system', 'os.system', (['command'], {}), '(command)\n', (1166, 1175), False, 'import o... |
# Copyright 2021 RangiLyu.
#
# 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, so... | [
"nanodet.model.arch.build_model",
"nanodet.util.get_model_complexity_info",
"nanodet.util.load_config"
] | [((745, 770), 'nanodet.model.arch.build_model', 'build_model', (['config.model'], {}), '(config.model)\n', (756, 770), False, 'from nanodet.model.arch import build_model\n'), ((791, 836), 'nanodet.util.get_model_complexity_info', 'get_model_complexity_info', (['model', 'input_shape'], {}), '(model, input_shape)\n', (81... |
import os
import json
import zipfile
def load_project_resource(file_path: str):
"""
Tries to load a resource:
1. directly
2. from the egg zip file
3. from the egg directory
This is necessary, because the files are bundled with the project.
:return: the file as json
"""
... | [
"os.path.isfile",
"json.load",
"zipfile.ZipFile"
] | [((337, 362), 'os.path.isfile', 'os.path.isfile', (['file_path'], {}), '(file_path)\n', (351, 362), False, 'import os\n'), ((450, 474), 'os.path.isfile', 'os.path.isfile', (['egg_path'], {}), '(egg_path)\n', (464, 474), False, 'import os\n'), ((1133, 1145), 'json.load', 'json.load', (['f'], {}), '(f)\n', (1142, 1145), ... |
#!/usr/bin/env python
"""
synopsis:
Lazy Pirate server
Binds REQ socket to tcp://*:5555
Like hwserver except:
- echoes request as-is
- randomly runs slowly
- randomly exits to simulate a crash.
Modified for async/ioloop: <NAME> <dkuhlman(at)davekuhlman(dot)org>
usage:
python lpserver... | [
"zmq.eventloop.ioloop.IOLoop.current",
"tornado.gen.sleep",
"functools.partial",
"random.randint",
"zmq.eventloop.future.Context",
"tornado.gen.Return",
"sys.exit"
] | [((640, 649), 'zmq.eventloop.future.Context', 'Context', ([], {}), '()\n', (647, 649), False, 'from zmq.eventloop.future import Context\n'), ((1511, 1540), 'tornado.gen.Return', 'gen.Return', (['(context, server)'], {}), '((context, server))\n', (1521, 1540), False, 'from tornado import gen\n'), ((1703, 1720), 'sys.exi... |
from sklearn.decomposition import PCA
from sklearn import datasets
from sklearn import preprocessing
boston = datasets.load_boston()
X = preprocessing.scale(boston.data)
pca = PCA(n_components='mle')
pca.fit(X)
print(pca.explained_variance_ratio_) | [
"sklearn.datasets.load_boston",
"sklearn.decomposition.PCA",
"sklearn.preprocessing.scale"
] | [((111, 133), 'sklearn.datasets.load_boston', 'datasets.load_boston', ([], {}), '()\n', (131, 133), False, 'from sklearn import datasets\n'), ((138, 170), 'sklearn.preprocessing.scale', 'preprocessing.scale', (['boston.data'], {}), '(boston.data)\n', (157, 170), False, 'from sklearn import preprocessing\n'), ((178, 201... |
from django.test import TestCase
from suggestion.algorithm.abstract_algorithm import AbstractSuggestionAlgorithm
from suggestion.algorithm.base_hyperopt_algorithm import BaseHyperoptAlgorithm
class BaseHyperoptAlgorithmTest(TestCase):
def setUp(self):
pass
def tearDown(self):
pass
def test_init(self)... | [
"suggestion.algorithm.base_hyperopt_algorithm.BaseHyperoptAlgorithm"
] | [((337, 360), 'suggestion.algorithm.base_hyperopt_algorithm.BaseHyperoptAlgorithm', 'BaseHyperoptAlgorithm', ([], {}), '()\n', (358, 360), False, 'from suggestion.algorithm.base_hyperopt_algorithm import BaseHyperoptAlgorithm\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import click
import json
@click.command(help='Dump source URLs from a pipe definition.')
@click.argument('input', type=click.File('r'))
def main(input):
pipe = json.load(input)
definition = json.loads(pipe['PIPE']['live'])
for mod in definition['modules']:
... | [
"click.File",
"json.load",
"json.loads",
"click.command"
] | [((74, 136), 'click.command', 'click.command', ([], {'help': '"""Dump source URLs from a pipe definition."""'}), "(help='Dump source URLs from a pipe definition.')\n", (87, 136), False, 'import click\n'), ((212, 228), 'json.load', 'json.load', (['input'], {}), '(input)\n', (221, 228), False, 'import json\n'), ((246, 27... |
import json
class FixtureBeaxy:
TRADE_WS_DATA = json.dumps({"symbol": "BTCUSDC", "price": 9462.28, "size": 0.001, "side": "SELL", "timestamp": 1590694156771})
| [
"json.dumps"
] | [((55, 169), 'json.dumps', 'json.dumps', (["{'symbol': 'BTCUSDC', 'price': 9462.28, 'size': 0.001, 'side': 'SELL',\n 'timestamp': 1590694156771}"], {}), "({'symbol': 'BTCUSDC', 'price': 9462.28, 'size': 0.001, 'side':\n 'SELL', 'timestamp': 1590694156771})\n", (65, 169), False, 'import json\n')] |
from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
height = models.IntegerField()
weight = models.IntegerField()
class Book(models.Model):
name = models.CharField(max_length=100)
author = models.ForeignKey(Author)
| [
"django.db.models.CharField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey"
] | [((69, 101), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (85, 101), False, 'from django.db import models\n'), ((115, 136), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (134, 136), False, 'from django.db import models\n'), ((150, 171... |
#!/usr/bin/python3
# Added some data points as of this link
# https://diysolarforum.com/threads/decoding-the-daly-smartbms-protocol.21898/
import time
import argparse
import json
import asyncio
import multiprocessing
from modules import DalyBMSBluetooth
from modules import Logger
from modules import get_logger
from mo... | [
"asyncio.get_event_loop",
"argparse.ArgumentParser",
"asyncio.sleep",
"json.dumps",
"time.sleep",
"time.time",
"modules.DalyBMSBluetooth",
"paho.mqtt.client.Client",
"modules.get_logger"
] | [((355, 380), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (378, 380), False, 'import argparse\n'), ((2217, 2249), 'modules.get_logger', 'get_logger', ([], {'level': 'args.log_level'}), '(level=args.log_level)\n', (2227, 2249), False, 'from modules import get_logger\n'), ((2311, 2324), 'time.... |
import numpy as np
import torch
import torch_struct as ts
def nk2ts(chart):
# chart: batch x time x time x num_classes
# need to make indices inclusive to be compatible with torchstruct
# and add 1st dimension corresponding to size of semiring
return chart[:,:-1, 1:]
def batch_marg(chart, semiring=t... | [
"torch.BoolTensor",
"numpy.zeros",
"torch.arange"
] | [((937, 957), 'numpy.zeros', 'np.zeros', (['x.shape[0]'], {}), '(x.shape[0])\n', (945, 957), True, 'import numpy as np\n'), ((1273, 1299), 'numpy.zeros', 'np.zeros', (['(bsz * len_padded)'], {}), '(bsz * len_padded)\n', (1281, 1299), True, 'import numpy as np\n'), ((1449, 1496), 'torch.arange', 'torch.arange', (['(0)',... |
from __future__ import division
from typing import Union, Optional
import numpy as np # type: ignore
import cupy as cp # type: ignore
from gepapy.operations import Operations
class Job_Shop(Operations):
"""Job_Shop."""
def __init__(
self,
processing_time: Optional[Union[list, np.ndarray, c... | [
"cupy.array"
] | [((3288, 3318), 'cupy.array', 'cp.array', (['[]'], {'dtype': 'cp.float32'}), '([], dtype=cp.float32)\n', (3296, 3318), True, 'import cupy as cp\n'), ((3346, 3376), 'cupy.array', 'cp.array', (['[]'], {'dtype': 'cp.float32'}), '([], dtype=cp.float32)\n', (3354, 3376), True, 'import cupy as cp\n')] |
#This analysis script takes one or more staircase datafiles as input
#from a GUI. It then plots the staircases on top of each other on
#the left and a combined psychometric function from the same data
#on the right
import sys, os
sys.path.append('./submodules')
from psychopy import data, gui, core
from psychopy.tools.... | [
"sys.path.append",
"psychopy.gui.fileOpenDlg",
"matplotlib.font_manager.FontProperties",
"matplotlib.backends.backend_agg.FigureCanvasAgg",
"psychopy.tools.filetools.fromFile",
"matplotlib.figure.Figure",
"os.path.splitext",
"psychopy.core.quit"
] | [((231, 262), 'sys.path.append', 'sys.path.append', (['"""./submodules"""'], {}), "('./submodules')\n", (246, 262), False, 'import sys, os\n'), ((559, 579), 'psychopy.gui.fileOpenDlg', 'gui.fileOpenDlg', (['"""."""'], {}), "('.')\n", (574, 579), False, 'from psychopy import data, gui, core\n'), ((638, 646), 'matplotlib... |
from django import forms
from .models import Product
# class ProductForm(forms.Form):
# title = forms.CharField()
class ProductModelForm(forms.ModelForm):
# title = forms.CharField()
class Meta:
model = Product
fields = [
"title",
"content",
"price",
... | [
"django.forms.ValidationError"
] | [((446, 510), 'django.forms.ValidationError', 'forms.ValidationError', (['"""Title must be 3 or more characters long"""'], {}), "('Title must be 3 or more characters long')\n", (467, 510), False, 'from django import forms\n')] |
#!/usr/bin/env python3
import requests
import os,time,sys
from time import sleep
import threading
import socket
def video():
r=requests.get("http://10.5.5.9/gp/gpControl/execute?p1=gpStream&c1=restart")
print(r.text)
time.sleep(3.0);
os.system("ffplay -fflags nobuffer -f:v mpegts -probesize 8192 udp://... | [
"threading.Thread.__init__",
"socket.socket",
"os.system",
"time.sleep",
"requests.get"
] | [((132, 207), 'requests.get', 'requests.get', (['"""http://10.5.5.9/gp/gpControl/execute?p1=gpStream&c1=restart"""'], {}), "('http://10.5.5.9/gp/gpControl/execute?p1=gpStream&c1=restart')\n", (144, 207), False, 'import requests\n'), ((230, 245), 'time.sleep', 'time.sleep', (['(3.0)'], {}), '(3.0)\n', (240, 245), False,... |
#pyhton version 3.5.1
import os
import re
def rename_files():
#get file names from a folder
file_names = os.listdir(r"Path to the text file")
#print (file_names)
save_path = os.getcwd()
print("Current working directory is "+save_path)
os.chdir(r"Path to text files")
saved_path = os.getcwd()... | [
"os.getcwd",
"os.listdir",
"os.chdir"
] | [((114, 149), 'os.listdir', 'os.listdir', (['"""Path to the text file"""'], {}), "('Path to the text file')\n", (124, 149), False, 'import os\n'), ((191, 202), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (200, 202), False, 'import os\n'), ((260, 290), 'os.chdir', 'os.chdir', (['"""Path to text files"""'], {}), "('Path ... |
import pandas as pd
notlar = pd.read_csv('ders_notlar.csv', index_col='ad', skipinitialspace=True)
# indekslenen sutun
#print(notlar.index)
# tüm sutunlar
#print(notlar.columns)
# Herhangi bir ogrencinin butun notlari
#print(notlar.loc['ogrenci28'])
# Tum arasinav notlari
#print(notlar['arasinav'])
#print(notlar["durum... | [
"pandas.read_csv"
] | [((29, 98), 'pandas.read_csv', 'pd.read_csv', (['"""ders_notlar.csv"""'], {'index_col': '"""ad"""', 'skipinitialspace': '(True)'}), "('ders_notlar.csv', index_col='ad', skipinitialspace=True)\n", (40, 98), True, 'import pandas as pd\n')] |
from quart import Quart, redirect, jsonify, send_file
import linhas
import emdec2gtfs
import asyncio
import aiocache
from asyncio_pool import AioPool
app = Quart(__name__)
#app.config['JSONIFY_PRETTYPRINT_REGULAR'] = True
app.config['JSON_AS_ASCII'] = False
app.config['JSON_SORT_KEYS'] = False
async def all_routes():... | [
"quart.redirect",
"asyncio_pool.AioPool",
"quart.jsonify",
"quart.send_file",
"emdec2gtfs.build_gtfs",
"quart.Quart",
"linhas.linhas"
] | [((157, 172), 'quart.Quart', 'Quart', (['__name__'], {}), '(__name__)\n', (162, 172), False, 'from quart import Quart, redirect, jsonify, send_file\n'), ((1136, 1188), 'quart.redirect', 'redirect', (['"""https://github.com/paulo-raca/emdec-gtfs"""'], {}), "('https://github.com/paulo-raca/emdec-gtfs')\n", (1144, 1188), ... |
from django.db import models
class Destaque(models.Model):
nome = models.CharField(max_length=100)
image = models.ImageField(upload_to='uploads/', blank=True, null=True)
def __str__(self):
return self.nome
| [
"django.db.models.CharField",
"django.db.models.ImageField"
] | [((72, 104), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (88, 104), False, 'from django.db import models\n'), ((117, 179), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""uploads/"""', 'blank': '(True)', 'null': '(True)'}), "(upload_t... |
#!/usr/bin/env python2.7
'''
Bidirectional mapping/set of alignments between two sequences.
The mapping holds token offsets within the sequences.
@author: <NAME> (nschneid)
@since: 2012-07-26
'''
from __future__ import print_function
import os, sys, re
from collections import defaultdict
class Alignment(object):
''... | [
"collections.defaultdict",
"re.search",
"doctest.testmod"
] | [((12997, 13014), 'doctest.testmod', 'doctest.testmod', ([], {}), '()\n', (13012, 13014), False, 'import doctest\n'), ((2654, 2670), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (2665, 2670), False, 'from collections import defaultdict\n'), ((2776, 2792), 'collections.defaultdict', 'defaultdict',... |
import asyncio
import os
from aries_cloudagency.config.default_context import DefaultContextBuilder
from aries_cloudagency.core.conductor import Conductor
contextBuilder = DefaultContextBuilder()
def str_to_bool(s):
if s == 'true':
return True
elif s == 'false':
return False
else:
... | [
"aries_cloudagency.config.default_context.DefaultContextBuilder",
"aries_cloudagency.core.conductor.Conductor",
"asyncio.get_event_loop",
"os.getenv"
] | [((174, 197), 'aries_cloudagency.config.default_context.DefaultContextBuilder', 'DefaultContextBuilder', ([], {}), '()\n', (195, 197), False, 'from aries_cloudagency.config.default_context import DefaultContextBuilder\n'), ((442, 478), 'os.getenv', 'os.getenv', (['"""admin_api_key"""', '"""secret"""'], {}), "('admin_ap... |
"""
Creates a test suite-specific cs.status file from a template
"""
from CIME.XML.standard_module_setup import *
import CIME.utils
import os
import stat
def create_cs_status(test_root, test_id, extra_args='', filename=None):
"""Create a test suite-specific cs.status file from the template
Arguments:
tes... | [
"os.stat",
"os.path.join",
"os.makedirs",
"os.path.exists"
] | [((1211, 1263), 'os.path.join', 'os.path.join', (['python_libs_root', '"""cs.status.template"""'], {}), "(python_libs_root, 'cs.status.template')\n", (1223, 1263), False, 'import os\n'), ((1793, 1826), 'os.path.join', 'os.path.join', (['test_root', 'filename'], {}), '(test_root, filename)\n', (1805, 1826), False, 'impo... |
__author__ = ('<NAME>', '<NAME>')
import sys
import unittest
import os
import platform
import numpy as np
import pandas as pd
import tables as pt
from pypet import SharedPandasFrame, ObjectTable, make_ordinary_result, Result, \
make_shared_result, compact_hdf5_file, SharedCArray, SharedEArray, \
SharedVLArr... | [
"pypet.SharedTable",
"pypet.make_shared_result",
"numpy.ones",
"pypet.SharedEArray",
"pypet.ObjectTable",
"numpy.random.randint",
"pypet.StorageContextManager",
"pypet.compact_hdf5_file",
"pandas.DataFrame",
"tables.atom.FloatAtom",
"tables.Int32Col",
"pypet.load_trajectory",
"pypet.SharedAr... | [((707, 720), 'tables.Int32Col', 'pt.Int32Col', ([], {}), '()\n', (718, 720), True, 'import tables as pt\n'), ((732, 748), 'tables.StringCol', 'pt.StringCol', (['(15)'], {}), '(15)\n', (744, 748), True, 'import tables as pt\n'), ((763, 779), 'tables.StringCol', 'pt.StringCol', (['(15)'], {}), '(15)\n', (775, 779), True... |
# -*- coding: utf-8 -*-
from blaze.type_reconstruction import *
from blaze.test_utils import assert_raises
DEBUG = True
def test_reconstruct():
var1 = var()
var2 = var()
product_t = con("x", (var1, var2), infix=True)
sum_t = con("+", (var1, var2), infix=True)
dynamic_t = con("?", [])
#... | [
"blaze.test_utils.assert_raises"
] | [((1648, 1672), 'blaze.test_utils.assert_raises', 'assert_raises', (['TypeError'], {}), '(TypeError)\n', (1661, 1672), False, 'from blaze.test_utils import assert_raises\n')] |
from collections import Counter, OrderedDict
from logging import getLogger
from typing import List
from typing import OrderedDict as OrderedDictType
from typing import Tuple
import numpy as np
from ordered_set import OrderedSet
from pandas import DataFrame
from recording_script_generator.core.types import (ReadingPass... | [
"pandas.DataFrame",
"tqdm.tqdm",
"numpy.median",
"recording_script_generator.core.types.get_utterance_duration_s",
"text_utils.get_ngrams",
"recording_script_generator.core.types.utterance_to_symbols",
"recording_script_generator.core.types.utterance_to_str",
"numpy.mean",
"numpy.array",
"collecti... | [((942, 961), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (951, 961), False, 'from logging import getLogger\n'), ((6309, 6352), 'pandas.DataFrame', 'DataFrame', ([], {'data': 'utterances', 'columns': 'columns'}), '(data=utterances, columns=columns)\n', (6318, 6352), False, 'from pandas import ... |
"""Cleaning module. Holds SheetCleaner which holds df kinds of cleanings."""
import re
from typing import List, Union
import inflection
import numpy as np
import pandas
class SheetCleaner:
"""Class containing all sheet cleaning related methods and ochestrators for such cleaning."""
def __init__(self, df: pa... | [
"inflection.underscore",
"re.sub"
] | [((3170, 3196), 'inflection.underscore', 'inflection.underscore', (['col'], {}), '(col)\n', (3191, 3196), False, 'import inflection\n'), ((2312, 2358), 're.sub', 're.sub', (['regex_string', 'default_replacement', 'col'], {}), '(regex_string, default_replacement, col)\n', (2318, 2358), False, 'import re\n')] |
import json
import urllib.request, urllib.parse, urllib.error
key = False
location = input("Enter the location: ")
if len(location) < 1 : location = "South Federal University"
if key is False :
key = "42"
else :
key = input("Enter API key: ")
service_url = "https://py4e-data.dr-chuck.net/json?"
params = di... | [
"json.loads"
] | [((572, 588), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (582, 588), False, 'import json\n')] |
import matplotlib.pyplot as plt
import numpy as np
# name_dict = {'1': 1, '32': 2, '64': 3, '128': 4, '256': 5}
# threads = [1, 2, 3, 4, 5]
# threads = [1, 32, 64, 128, 256]
cpu = [0.003138, 0.005464, 0.012608, 0.149415, 1.004396, 7.811107]
gpu = [0.003586, 0.007852, 0.014832, 0.053753, 0.094673, 0.158172]
X_axis = n... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.bar",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.gca",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xticks",
"matplotlib.pyplot.xlabel"
] | [((340, 389), 'matplotlib.pyplot.bar', 'plt.bar', (['(X_axis - 0.2)', 'cpu', '(0.4)'], {'label': '"""CPU only"""'}), "(X_axis - 0.2, cpu, 0.4, label='CPU only')\n", (347, 389), True, 'import matplotlib.pyplot as plt\n'), ((390, 439), 'matplotlib.pyplot.bar', 'plt.bar', (['(X_axis + 0.2)', 'gpu', '(0.4)'], {'label': '""... |
#!/usr/bin/python
#-*- coding:utf-8 -*-
import sys
import struct
import numpy as np
import tensorflow as tf
def floor_divide_f32():
para = []
# init the input data and parameters
batch = int(np.random.randint(1, high=4, size=1))
in_channel = int(np.random.randint(16, high=64, size=1))
in_h... | [
"numpy.random.randint",
"tensorflow.Session",
"numpy.random.normal",
"tensorflow.math.floordiv"
] | [((771, 848), 'numpy.random.normal', 'np.random.normal', (['zero_point1', 'std1', '(batch, in_channel, in_height, in_width)'], {}), '(zero_point1, std1, (batch, in_channel, in_height, in_width))\n', (787, 848), True, 'import numpy as np\n'), ((904, 981), 'numpy.random.normal', 'np.random.normal', (['zero_point2', 'std2... |
import math
import matplotlib.pyplot as plt
# First Order Derivatives
def forward_order_derivative(function_definition, value_x, value_h):
return (function_definition(value_x + value_h) - function_definition(value_x)) / value_h
def backward_order_derivative(function_definition, value_x, value_h):
return (fu... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"math.tan",
"matplotlib.pyplot.legend",
"math.cos",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((3056, 3080), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Value of h"""'], {}), "('Value of h')\n", (3066, 3080), True, 'import matplotlib.pyplot as plt\n'), ((3081, 3114), 'matplotlib.pyplot.ylabel', 'plt.ylabel', (['"""Value of derivative"""'], {}), "('Value of derivative')\n", (3091, 3114), True, 'import matpl... |
#
#
# =================================================================
# =================================================================
from paxes_cinder.k2aclient import _
from paxes_cinder.k2aclient.v1.k2uom import k2attr as uom_k2attr
from paxes_cinder.k2aclient.v1.k2uom import typeset as uom_typeset
from paxes... | [
"paxes_cinder.k2aclient._",
"paxes_k2.k2operator.K2Element",
"logging.getLogger"
] | [((540, 567), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (557, 567), False, 'import logging\n'), ((2180, 2267), 'paxes_k2.k2operator.K2Element', 'K2Element', (['attr'], {'ns': 'ns', 'attrib': "{'schemaVersion': K2_SCHEMA_VERSION}", 'children': 'k2nes'}), "(attr, ns=ns, attrib={'schema... |
import discord
from discord.ext import commands
from discord_slash import cog_ext
from discord_slash.context import SlashContext
from discord_slash.model import SlashCommandPermissionType
from discord_slash.utils.manage_commands import create_permission
import platform
import random
from typing import Optional
from .u... | [
"discord.ext.commands.command",
"platform.node",
"discord_slash.utils.manage_commands.create_permission",
"random.choice",
"discord.ext.commands.Cog.listener",
"discord.Game",
"discord.ext.commands.is_owner"
] | [((396, 422), 'discord.Game', 'discord.Game', (['"""wow - &wow"""'], {}), "('wow - &wow')\n", (408, 422), False, 'import discord\n'), ((719, 742), 'discord.ext.commands.Cog.listener', 'commands.Cog.listener', ([], {}), '()\n', (740, 742), False, 'from discord.ext import commands\n'), ((994, 1017), 'discord.ext.commands... |
# 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, software
# distributed under th... | [
"bndl_cassandra.session._prepare.cache_info"
] | [((796, 817), 'bndl_cassandra.session._prepare.cache_info', '_prepare.cache_info', ([], {}), '()\n', (815, 817), False, 'from bndl_cassandra.session import _prepare\n'), ((1237, 1258), 'bndl_cassandra.session._prepare.cache_info', '_prepare.cache_info', ([], {}), '()\n', (1256, 1258), False, 'from bndl_cassandra.sessio... |
#! /usr/bin/python3
from env.env import env
import vlc
import time
import pymongo
# Initialize mongo
client = pymongo.MongoClient(f"mongodb://{env['mongodb_ip']}:{env['mongodb_port']}/")
db = client[env['database']]
def play():
state = "Stopped"
p = ''
url = ''
station = ''
restart_timer = 0
... | [
"pymongo.MongoClient",
"time.strftime",
"time.sleep",
"time.time",
"vlc.Instance"
] | [((112, 188), 'pymongo.MongoClient', 'pymongo.MongoClient', (['f"""mongodb://{env[\'mongodb_ip\']}:{env[\'mongodb_port\']}/"""'], {}), '(f"mongodb://{env[\'mongodb_ip\']}:{env[\'mongodb_port\']}/")\n', (131, 188), False, 'import pymongo\n'), ((976, 987), 'time.time', 'time.time', ([], {}), '()\n', (985, 987), False, 'i... |
# Copyright 2019 ChangyuLiu Authors. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"numpy.set_printoptions",
"tensorflow.keras.layers.Dense",
"tensorflow.keras.Input",
"tensorflow.reshape",
"tensorflow.concat",
"tensorflow.keras.Model",
"tensorflow.cast",
"tensorflow.keras.utils.get_file",
"tensorflow.strings.regex_replace",
"tensorflow.equal",
"tensorflow.data.experimental.ma... | [((1016, 1068), 'tensorflow.keras.utils.get_file', 'tf.keras.utils.get_file', (['"""train.csv"""', 'TRAIN_DATA_URL'], {}), "('train.csv', TRAIN_DATA_URL)\n", (1039, 1068), True, 'import tensorflow as tf\n'), ((1086, 1136), 'tensorflow.keras.utils.get_file', 'tf.keras.utils.get_file', (['"""eval.csv"""', 'TEST_DATA_URL'... |
import os
import pytest
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import UploadedFile
from hs_core.hydroshare import add_file_to_resource, ResourceFile, add_resource_files
from hs_core.views.utils import move_or_rename_file_or_folder
from hs_file_types.forms import ModelIn... | [
"hs_core.hydroshare.add_resource_files",
"hs_file_types.models.NetCDFLogicalFile.objects.first",
"hs_file_types.models.ModelProgramLogicalFile.objects.count",
"os.path.join",
"hs_file_types.forms.ModelInstanceMetadataValidationForm",
"hs_file_types.models.NetCDFLogicalFile.objects.count",
"hs_file_types... | [((628, 667), 'pytest.mark.django_db', 'pytest.mark.django_db', ([], {'transaction': '(True)'}), '(transaction=True)\n', (649, 667), False, 'import pytest\n'), ((2334, 2373), 'pytest.mark.django_db', 'pytest.mark.django_db', ([], {'transaction': '(True)'}), '(transaction=True)\n', (2355, 2373), False, 'import pytest\n'... |
import os
import unittest
import json
from mock import patch
from spotinst_sdk2 import SpotinstSession
from spotinst_sdk2.models.elastigroup.gcp import *
class SimpleNamespace:
def __init__(self, **kwargs):
self.__dict__.update(kwargs)
class GcpInitTestCase(unittest.TestCase):
def setUp(self):
self.s... | [
"json.load",
"os.path.realpath",
"spotinst_sdk2.SpotinstSession",
"mock.patch",
"json.dumps"
] | [((862, 884), 'mock.patch', 'patch', (['"""requests.post"""'], {}), "('requests.post')\n", (867, 884), False, 'from mock import patch\n'), ((1461, 1482), 'mock.patch', 'patch', (['"""requests.put"""'], {}), "('requests.put')\n", (1466, 1482), False, 'from mock import patch\n'), ((2089, 2113), 'mock.patch', 'patch', (['... |
from argparse import ArgumentParser
from os import environ
from telegram_unvoicer_bot.server import run_gunicorn_workers
__all__ = [
'run',
]
def run():
parser = ArgumentParser()
parser.add_argument('--daemon', '-D',
nargs='?',
default=False,
... | [
"telegram_unvoicer_bot.server.run_gunicorn_workers",
"argparse.ArgumentParser"
] | [((174, 190), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (188, 190), False, 'from argparse import ArgumentParser\n'), ((755, 815), 'telegram_unvoicer_bot.server.run_gunicorn_workers', 'run_gunicorn_workers', ([], {'daemon': 'args.daemon', 'reload': 'args.reload'}), '(daemon=args.daemon, reload=args.... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 12 16:02:05 2019
@author: Titus
"""
import tclab
import time
# Connect to Arduino
a = tclab.TCLab()
print('LED On')
a.LED(100)
# Pause for 1 second
time.sleep(1.0)
print('LED Off')
a.LED(0)
a.close() | [
"tclab.TCLab",
"time.sleep"
] | [((136, 149), 'tclab.TCLab', 'tclab.TCLab', ([], {}), '()\n', (147, 149), False, 'import tclab\n'), ((198, 213), 'time.sleep', 'time.sleep', (['(1.0)'], {}), '(1.0)\n', (208, 213), False, 'import time\n')] |
import re
# Limits to Alphanumeric characters, 5-25 characters in length
jobs_name_regex = re.compile(
r'^[a-zA-Z0-9\x20]{5,25}$')
# Limits to Brewhouse, Finishing only
jobs_area_regex = re.compile(
r'\b(Brewhouse|Finishing)\b')
| [
"re.compile"
] | [((93, 131), 're.compile', 're.compile', (['"""^[a-zA-Z0-9\\\\x20]{5,25}$"""'], {}), "('^[a-zA-Z0-9\\\\x20]{5,25}$')\n", (103, 131), False, 'import re\n'), ((194, 235), 're.compile', 're.compile', (['"""\\\\b(Brewhouse|Finishing)\\\\b"""'], {}), "('\\\\b(Brewhouse|Finishing)\\\\b')\n", (204, 235), False, 'import re\n')... |
from django.db import models
import datetime as dt
# Create your models here.
class Location(models.Model):
location_name = models.CharField(max_length=30)
def __str__(self):
return self.location_name
def save_location(self):
self.save()
@classmethod
def get_locatio... | [
"django.db.models.CharField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ImageField"
] | [((133, 164), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (149, 164), False, 'from django.db import models\n'), ((594, 625), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(30)'}), '(max_length=30)\n', (610, 625), False, 'from django.db im... |
__author__ = 'JordSti'
import item
class gui_list(item.item):
def __init__(self):
item.item.__init__(self)
self.obj = self.lib.List_new()
def add(self, vo):
self.lib.List_add(self.obj, vo.obj) | [
"item.item.__init__"
] | [((97, 121), 'item.item.__init__', 'item.item.__init__', (['self'], {}), '(self)\n', (115, 121), False, 'import item\n')] |
#Pascal's triangle
def PascalNumber(n,k):
from math import factorial as mmfac
from sympy import Float as mmmfloat
from sympy import Integer as mmmint
def _autoFloat(f):
from math import log10 as mloggg
digits = (mloggg(f))+1
if(digits>15):
return mmmfloat(f)
... | [
"pandas.DataFrame",
"math.log10",
"math.factorial",
"sympy.Float",
"sympy.Integer"
] | [((1021, 1054), 'pandas.DataFrame', 'mmpd', (['s'], {'columns': 'colk', 'index': 'colk'}), '(s, columns=colk, index=colk)\n', (1025, 1054), True, 'from pandas import DataFrame as mmpd\n'), ((250, 259), 'math.log10', 'mloggg', (['f'], {}), '(f)\n', (256, 259), True, 'from math import log10 as mloggg\n'), ((305, 316), 's... |
# Generated by Django 3.1 on 2020-10-02 12:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('App', '0020_auto_20201002_1455'),
]
operations = [
migrations.AddField(
model_name='product',
name='remaining_quantity... | [
"django.db.models.DecimalField",
"django.db.models.BooleanField"
] | [((341, 404), 'django.db.models.DecimalField', 'models.DecimalField', ([], {'decimal_places': '(2)', 'default': '(0)', 'max_digits': '(12)'}), '(decimal_places=2, default=0, max_digits=12)\n', (360, 404), False, 'from django.db import migrations, models\n'), ((547, 610), 'django.db.models.DecimalField', 'models.Decimal... |
"""
Script name: MalGAN_v2.py
Reproduced for reader's convenience from the original code available at:
https://github.com/yanminglai/Malware-GAN/blob/master/MalGAN_v2.py
Released under GPL 3.0 LICENSE: https://github.com/yanminglai/Malware-GAN/blob/master/LICENSE
"""
from keras.layers import Input, Dense,... | [
"sklearn.model_selection.train_test_split",
"numpy.ones",
"keras.models.Model",
"matplotlib.pyplot.figure",
"numpy.random.randint",
"keras.layers.Input",
"numpy.add",
"sklearn.ensemble.RandomForestClassifier",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"keras.optimizers.Adam",
"kera... | [((1089, 1103), 'keras.optimizers.Adam', 'Adam', ([], {'lr': '(0.001)'}), '(lr=0.001)\n', (1093, 1103), False, 'from keras.optimizers import Adam\n'), ((1657, 1693), 'keras.layers.Input', 'Input', ([], {'shape': '(self.apifeature_dims,)'}), '(shape=(self.apifeature_dims,))\n', (1662, 1693), False, 'from keras.layers im... |
import csv
import numpy as np
from mpl_toolkits import mplot3d
import matplotlib.pyplot as plt
fig = plt.figure()
ax = plt.axes(projection='3d')
f=open('consensus_line_2.csv')
csv_f = csv.reader(f)
agent2=[]
agent4=[]
agent5=[]
agent7=[]
dt=[]
i=0
csv_f=csv.reader(f)
for row in csv_f:
a=(row[0])
a=a[1:... | [
"csv.reader",
"matplotlib.pyplot.show",
"matplotlib.pyplot.axes",
"matplotlib.pyplot.figure",
"numpy.array",
"numpy.fromstring"
] | [((108, 120), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (118, 120), True, 'import matplotlib.pyplot as plt\n'), ((126, 151), 'matplotlib.pyplot.axes', 'plt.axes', ([], {'projection': '"""3d"""'}), "(projection='3d')\n", (134, 151), True, 'import matplotlib.pyplot as plt\n'), ((194, 207), 'csv.reader',... |
from subprocess import check_output
import subprocess
import os
import signal
def get_pid(name):
return check_output(["pidof",name])
try:
pid = get_pid("rdiscoveryd").decode("utf-8")
if pid != "":
os.kill(int(pid), signal.SIGINT)
except subprocess.CalledProcessError as e:
print("No process wi... | [
"subprocess.check_output"
] | [((109, 138), 'subprocess.check_output', 'check_output', (["['pidof', name]"], {}), "(['pidof', name])\n", (121, 138), False, 'from subprocess import check_output\n')] |
"""
decks.py
"""
import random
from cards import *
"""
Cards in deck are stored in the following format:
[(face, suit, value), -> 1st card
(face, suit, value), -> 2nd card
... ] -> nth card
"""
def createdeck() -> list:
deck = [(faceschars[i], s, cardsvalues[i]) for s in... | [
"random.shuffle"
] | [((636, 656), 'random.shuffle', 'random.shuffle', (['deck'], {}), '(deck)\n', (650, 656), False, 'import random\n')] |
from collections import OrderedDict
class Solution:
def isIsomorphic(self, s: str, t: str) -> bool:
d1, d2 = OrderedDict(), OrderedDict()
for k in range(len(s)):
if s[k] in d1:
d1[s[k]].append(k)
else:
d1[s[k]] = [k]
if t[k] in d2:... | [
"collections.OrderedDict"
] | [((122, 135), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (133, 135), False, 'from collections import OrderedDict\n'), ((137, 150), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (148, 150), False, 'from collections import OrderedDict\n')] |
import datetime
from abc import ABCMeta, abstractmethod
from pprint import pprint
from sqlite3 import IntegrityError
################################################################################
################################################################################
#################################... | [
"datetime.datetime.today",
"datetime.datetime.strptime",
"pprint.pprint"
] | [((1627, 1656), 'pprint.pprint', 'pprint', (['self.fileManager.info'], {}), '(self.fileManager.info)\n', (1633, 1656), False, 'from pprint import pprint\n'), ((1740, 1765), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (1763, 1765), False, 'import datetime\n'), ((1976, 2050), 'datetime.datetim... |
import tensorflow as tf
import numpy as np
import streamlit as st
from PIL import Image
import cv2
def app():
filters = st.sidebar.selectbox("Select filters",("Pencil Sketch","Detail Enhancement","Bilateral Filter","Pencil Edges","White Box"))
st.write(filters)
def resize_crop(image... | [
"cv2.GaussianBlur",
"streamlit.image",
"cv2.bitwise_and",
"cv2.medianBlur",
"cv2.adaptiveThreshold",
"numpy.clip",
"numpy.shape",
"cv2.bilateralFilter",
"streamlit.sidebar.selectbox",
"cv2.cvtColor",
"cv2.imwrite",
"cv2.detailEnhance",
"cv2.divide",
"cv2.resize",
"cv2.Laplacian",
"stre... | [((149, 281), 'streamlit.sidebar.selectbox', 'st.sidebar.selectbox', (['"""Select filters"""', "('Pencil Sketch', 'Detail Enhancement', 'Bilateral Filter', 'Pencil Edges',\n 'White Box')"], {}), "('Select filters', ('Pencil Sketch',\n 'Detail Enhancement', 'Bilateral Filter', 'Pencil Edges', 'White Box'))\n", (16... |
"""
Command line utility to extract basic statistics from gpx file(s)
"""
import sys as mod_sys
import logging as mod_logging
import math as mod_math
import argparse as mod_argparse
from . import common
# import gpxpy.gpx as gpxpy
import gpxpy as gpx_parser
import glob
from typing import *
def main() -> None:
pa... | [
"argparse.ArgumentParser",
"gpxpy.parse",
"glob.glob"
] | [((327, 432), 'argparse.ArgumentParser', 'mod_argparse.ArgumentParser', ([], {'description': '"""Simplify tracks using the Ramer-Douglas-Peucker algorithm"""'}), "(description=\n 'Simplify tracks using the Ramer-Douglas-Peucker algorithm')\n", (354, 432), True, 'import argparse as mod_argparse\n'), ((1075, 1102), 'g... |
from jax import jacfwd, jit
import jax.numpy as jnp
from tqdm import tqdm
# Test, how parallel gradients of two function g1 and g2 are.
# Integrate absolute value of area of parallelogram spanned by g1/norm(g1) and g2/norm(g2)
# 2dimensions: determinant (3d: cross product, nd: using Graam matrices)
def compare_conto... | [
"jax.numpy.array",
"tqdm.tqdm",
"jax.numpy.linalg.norm",
"jax.numpy.hstack",
"jax.jacfwd"
] | [((358, 368), 'jax.jacfwd', 'jacfwd', (['g1'], {}), '(g1)\n', (364, 368), False, 'from jax import jacfwd, jit\n'), ((379, 389), 'jax.jacfwd', 'jacfwd', (['g2'], {}), '(g2)\n', (385, 389), False, 'from jax import jacfwd, jit\n'), ((815, 824), 'tqdm.tqdm', 'tqdm', (['xx1'], {}), '(xx1)\n', (819, 824), False, 'from tqdm i... |
import json
import unittest
from datetime import datetime
from google.appengine.api import users
from restler.serializers import ModelStrategy, to_json, SKIP
from tests.models import Model1, Model2
def flip(*args, **kwargs):
return json.loads(to_json(*args, **kwargs))
class TestJsonSerialization(unittest.Tes... | [
"restler.serializers.to_json",
"tests.models.Model1",
"google.appengine.api.users.get_current_user",
"tests.models.Model2.all",
"restler.serializers.ModelStrategy",
"tests.models.Model1.all",
"tests.models.Model2",
"datetime.datetime.now"
] | [((252, 276), 'restler.serializers.to_json', 'to_json', (['*args'], {}), '(*args, **kwargs)\n', (259, 276), False, 'from restler.serializers import ModelStrategy, to_json, SKIP\n'), ((367, 379), 'tests.models.Model1.all', 'Model1.all', ([], {}), '()\n', (377, 379), False, 'from tests.models import Model1, Model2\n'), (... |
import random
from .gene_property import GeneProperty
class ScalarGeneProperty(GeneProperty):
def __init__(self, min, max, value):
self._min = min
self._max = max
self._value = value
@property
def value(self):
return self._value
def mutate(self, configuration):
... | [
"random.normalvariate",
"random.random"
] | [((327, 342), 'random.random', 'random.random', ([], {}), '()\n', (340, 342), False, 'import random\n'), ((500, 530), 'random.normalvariate', 'random.normalvariate', (['(0)', 'sigma'], {}), '(0, sigma)\n', (520, 530), False, 'import random\n')] |
from __future__ import unicode_literals
from django.utils.encoding import python_2_unicode_compatible
from django.db import models
from django.db.models import Q
from django.contrib.auth.models import User
# Options
STATUS_BIT_ARTICLE = (
(1, 'Active'),
(0, 'In Active'),
)
# Queryset section
class ArticlesQuerySet(... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.Q",
"django.db.models.BooleanField",
"django.db.models.DecimalField",
"django.db.models.DateTimeField"
] | [((795, 851), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(300)', 'null': '(True)', 'unique': '(True)'}), '(max_length=300, null=True, unique=True)\n', (811, 851), False, 'from django.db import models\n'), ((863, 910), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now'... |
import datetime, copy
def dateFromString(s):
try:
return datetime.datetime.strptime(s, "%Y-%m-%d")
except ValueError:
return datetime.datetime.strptime(s, "%d %b %Y")
def getPrettyDate(d):
return d.strftime("%d/%m/%Y")
def addToDictKey(d, k, v):
if k in d:
d[k] += v
else:... | [
"copy.deepcopy",
"datetime.datetime.strptime"
] | [((70, 111), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['s', '"""%Y-%m-%d"""'], {}), "(s, '%Y-%m-%d')\n", (96, 111), False, 'import datetime, copy\n'), ((336, 352), 'copy.deepcopy', 'copy.deepcopy', (['v'], {}), '(v)\n', (349, 352), False, 'import datetime, copy\n'), ((150, 191), 'datetime.datetime.s... |
"""InvalidToken Added
Revision ID: 6f1b9a5361a8
Revises: <PASSWORD>
Create Date: 2021-02-17 12:08:28.538745
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '2<PASSWORD>'
branch_labels = None
depends_on = None
def upgrade():
# ### c... | [
"alembic.op.drop_table",
"sqlalchemy.Integer",
"sqlalchemy.String",
"sqlalchemy.PrimaryKeyConstraint"
] | [((678, 709), 'alembic.op.drop_table', 'op.drop_table', (['"""invalid_tokens"""'], {}), "('invalid_tokens')\n", (691, 709), False, 'from alembic import op\n'), ((518, 547), 'sqlalchemy.PrimaryKeyConstraint', 'sa.PrimaryKeyConstraint', (['"""id"""'], {}), "('id')\n", (541, 547), True, 'import sqlalchemy as sa\n'), ((433... |
#!/usr/bin/env python3
"""
Tests the asana_extensions.rules.rule_meta functionality.
Per [pytest](https://docs.pytest.org/en/reorganize-docs/new-docs/user/naming_conventions.html),
all tiles, classes, and methods will be prefaced with `test_/Test` to comply
with auto-discovery (others may exist, but will not be part o... | [
"asana_extensions.rules.rule_meta.Rule.parse_timeframe",
"asana_extensions.rules.rule_meta.Rule.parse_time_arg",
"dateutil.relativedelta.relativedelta",
"asana_extensions.rules.rule_meta.Rule.parse_timedelta_arg",
"asana_extensions.general.config.read_conf_file",
"pytest.raises",
"datetime.time.fromisof... | [((3381, 3435), 'asana_extensions.general.config.read_conf_file', 'config.read_conf_file', (['"""mock_rule_meta.conf"""', 'conf_dir'], {}), "('mock_rule_meta.conf', conf_dir)\n", (3402, 3435), False, 'from asana_extensions.general import config\n'), ((6506, 6537), 'datetime.time.fromisoformat', 'dt.time.fromisoformat',... |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community
Edition) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in co... | [
"django.utils.translation.ugettext_lazy"
] | [((1412, 1421), 'django.utils.translation.ugettext_lazy', '_', (['"""容器服务"""'], {}), "('容器服务')\n", (1413, 1421), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((1431, 1440), 'django.utils.translation.ugettext_lazy', '_', (['"""仓库管理"""'], {}), "('仓库管理')\n", (1432, 1440), True, 'from django.utils.tr... |
from .. import bp_account
from ..forms import ResetPassword
from web_app.helpers.senders import send_reset_link
from database.models import User
from flask import request, render_template
@bp_account.route('/reset', methods=('GET', 'POST',))
def reset():
"""Reset password"""
form = ResetPassword(r... | [
"web_app.helpers.senders.send_reset_link",
"database.models.User.query.filter_by",
"flask.render_template"
] | [((543, 600), 'flask.render_template', 'render_template', (['"""account/forgot_password.pug"""'], {'form': 'form'}), "('account/forgot_password.pug', form=form)\n", (558, 600), False, 'from flask import request, render_template\n'), ((509, 530), 'web_app.helpers.senders.send_reset_link', 'send_reset_link', (['user'], {... |
from setuptools import setup, find_packages
setup(
name='subword_nmt',
version='0.3.6',
description='Unsupervised Word Segmentation for Neural Machine Translation and Text Generation',
url='https://github.com/tanbro/subword-nmt',
author='<NAME>',
license='MIT',
classifiers=[
'Intend... | [
"setuptools.find_packages"
] | [((571, 638), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['*.tests', '*.tests.*', 'tests.*', 'tests']"}), "(exclude=['*.tests', '*.tests.*', 'tests.*', 'tests'])\n", (584, 638), False, 'from setuptools import setup, find_packages\n')] |
""" PeerManagement module for the blockchain client.
"""
import ipaddress
import os
import socket
import time
from typing import Tuple, Set
from queue import Queue
Address = Tuple[str, int]
class PeerManager(object):
""" PeerManager that handles all aspects of the Peer2Peer connections.
Call setup() before ... | [
"os.path.exists",
"ipaddress.ip_address",
"time.time",
"socket.gethostbyname",
"socket.gethostname"
] | [((1221, 1241), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (1239, 1241), False, 'import socket\n'), ((1260, 1290), 'socket.gethostbyname', 'socket.gethostbyname', (['hostname'], {}), '(hostname)\n', (1280, 1290), False, 'import socket\n'), ((2599, 2610), 'time.time', 'time.time', ([], {}), '()\n', (2... |
import sys, os
import pandas as pd
import time
import argparse
from dotenv import load_dotenv
from utils import check_arguments
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from sort import sort
from methods import video_data
YTB_TRENDING_BASE_URL='https://www.youtube.com/feed... | [
"pandas.DataFrame",
"sort.sort.sortByVideoTitle",
"methods.video_data.get_video_data",
"sort.sort.sortByView",
"argparse.ArgumentParser",
"os.makedirs",
"selenium.webdriver.Firefox",
"os.path.exists",
"dotenv.load_dotenv",
"sort.sort.sortByTime",
"selenium.webdriver.firefox.options.Options",
"... | [((363, 433), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Youtube Trending Viedos Scraper"""'}), "(description='Youtube Trending Viedos Scraper')\n", (386, 433), False, 'import argparse\n'), ((1311, 1324), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (1322, 1324), False, 'fr... |
import pytest
import pydash
import yaml
from sqlalchemy.orm import Session
from typing import Any, Dict, Generator
from fidesops.core.config import load_file, load_toml
from fidesops.models.connectionconfig import (
AccessLevel,
ConnectionConfig,
ConnectionType,
)
from fidesops.models.datasetconfig import... | [
"fidesops.core.config.load_file",
"fidesops.models.datasetconfig.DatasetConfig.create",
"pydash.get",
"pytest.fixture",
"yaml.safe_load",
"fidesops.models.connectionconfig.ConnectionConfig.create",
"tests.fixtures.application_fixtures.load_dataset",
"fidesops.core.config.load_toml"
] | [((586, 615), 'fidesops.core.config.load_toml', 'load_toml', (['"""saas_config.toml"""'], {}), "('saas_config.toml')\n", (595, 615), False, 'from fidesops.core.config import load_file, load_toml\n'), ((618, 650), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (632, 650), ... |
# Generated by Django 4.0.2 on 2022-02-22 19:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('blog', '0003_photo_blogpost_main_photo'),
]
operations = [
migrations.AddField(
model_name='photo',
name='tags',
... | [
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((335, 421), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(250)', 'null': '(True)', 'verbose_name': '"""Mots clés"""'}), "(blank=True, max_length=250, null=True, verbose_name=\n 'Mots clés')\n", (351, 421), False, 'from django.db import migrations, models\n'), ((534, 611... |
import subprocess
import time
from helpers.processcall import run_with_timeout
__author__ = 'thurley'
def run_all_on_list(timeout, cnf_list, binaries):
list = []
for p in cnf_list:
instance_entry = [p]
for binary in binaries:
time = take_time(binary, p, timeout)
insta... | [
"helpers.processcall.run_with_timeout",
"time.time"
] | [((522, 588), 'helpers.processcall.run_with_timeout', 'run_with_timeout', (['timeout', '[binary, arg]'], {'stderr': 'subprocess.STDOUT'}), '(timeout, [binary, arg], stderr=subprocess.STDOUT)\n', (538, 588), False, 'from helpers.processcall import run_with_timeout\n'), ((976, 987), 'time.time', 'time.time', ([], {}), '(... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib as mpl
import os
import json
from typing import List
import pandas as pd
import re
import ir_thermography.thermometry as irt
import matplotlib.ticker as ticker
import matplotlib.gridspec as gridspec
# base_path = r'C:\Users\erick\OneDrive\Documents\u... | [
"pandas.DataFrame",
"json.load",
"matplotlib.pyplot.show",
"os.path.join",
"numpy.abs",
"numpy.empty",
"matplotlib.rcParams.update",
"numpy.empty_like",
"matplotlib.pyplot.figure",
"os.path.splitext",
"numpy.linspace",
"ir_thermography.thermometry.PDThermometer",
"matplotlib.ticker.MultipleL... | [((943, 974), 'matplotlib.rcParams.update', 'mpl.rcParams.update', (['plot_style'], {}), '(plot_style)\n', (962, 974), True, 'import matplotlib as mpl\n'), ((990, 1004), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), '()\n', (1002, 1004), True, 'import matplotlib.pyplot as plt\n'), ((1061, 1102), 'numpy.empty_... |
# coding: utf-8
"""
Aspose.PDF Cloud API Reference
Copyright (c) 2021 Aspose.PDF Cloud
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 r... | [
"six.iteritems"
] | [((13931, 13960), 'six.iteritems', 'iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (13940, 13960), False, 'from six import iteritems\n')] |
cat_oposto = float(input('digite o valor do cateto oposto: '))
cat_adjacente = float(input('digite o valor do cateto adjacente: '))
hipotenusa = cat_adjacente**2 + cat_oposto**2
hipotenusa = hipotenusa**(1/2)
print('o valor da hipotenusa é: {:.2f}'.format(hipotenusa))
#com import
import math
hipotenusa_math = math.hyp... | [
"math.hypot"
] | [((312, 349), 'math.hypot', 'math.hypot', (['cat_oposto', 'cat_adjacente'], {}), '(cat_oposto, cat_adjacente)\n', (322, 349), False, 'import math\n')] |
#!/usr/bin/python3
import requests
from urllib3.exceptions import InsecureRequestWarning
# site: https://self-signed.badssl.com
# state should be: bad, certificate should be expired
# verification: disabled
badssl_startsite = "https://expired.badssl.com"
https_verification = False
def verification_on():
if http... | [
"requests.packages.urllib3.disable_warnings",
"requests.post"
] | [((481, 556), 'requests.packages.urllib3.disable_warnings', 'requests.packages.urllib3.disable_warnings', ([], {'category': 'InsecureRequestWarning'}), '(category=InsecureRequestWarning)\n', (523, 556), False, 'import requests\n'), ((756, 814), 'requests.post', 'requests.post', (['badssl_startsite'], {'verify': 'https_... |
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. #
# All rights reserved. #
# This file is part of the AiiDA-FLEUR package. ... | [
"os.path.abspath",
"aiida.orm.Dict",
"os.path.dirname",
"pytest.mark.timeout",
"pytest.mark.skip",
"os.path.join",
"pytest.mark.usefixtures",
"aiida_fleur.workflows.base_fleur.FleurBaseWorkChain.get_builder"
] | [((1076, 1113), 'os.path.dirname', 'os.path.dirname', (['aiida_fleur.__file__'], {}), '(aiida_fleur.__file__)\n', (1091, 1113), False, 'import os\n'), ((1134, 1191), 'os.path.join', 'os.path.join', (['aiida_path', '"""tests/files/inpxml/Si/inp.xml"""'], {}), "(aiida_path, 'tests/files/inpxml/Si/inp.xml')\n", (1146, 119... |
from django import forms
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import Profile, Image, Comment
class SignupForm(UserCreationForm):
email = forms.EmailField(max_length=200, help_text='Required')
class Meta:
model = User
f... | [
"django.forms.EmailField"
] | [((218, 272), 'django.forms.EmailField', 'forms.EmailField', ([], {'max_length': '(200)', 'help_text': '"""Required"""'}), "(max_length=200, help_text='Required')\n", (234, 272), False, 'from django import forms\n')] |
# Little hack because the WDT's .feed doesn't really work on ESP8266 yet
# This is required because sometimes, importing the 'moisture' module
# fails with a MemoryError
import machine
irq = machine.disable_irq()
from moisture import MoistureMonitor
import network
import time
import ntptime
import config
machine.ena... | [
"moisture.MoistureMonitor",
"ntptime.settime",
"network.WLAN",
"machine.disable_irq",
"time.sleep",
"time.time",
"machine.enable_irq",
"machine.RTC",
"time.localtime",
"machine.Pin"
] | [((191, 212), 'machine.disable_irq', 'machine.disable_irq', ([], {}), '()\n', (210, 212), False, 'import machine\n'), ((309, 332), 'machine.enable_irq', 'machine.enable_irq', (['irq'], {}), '(irq)\n', (327, 332), False, 'import machine\n'), ((340, 368), 'network.WLAN', 'network.WLAN', (['network.STA_IF'], {}), '(networ... |
# -*- coding: utf-8 -*-
import os
from nomenclator.vendor.Qt import QtWidgets, QtCore
class LocationWidget(QtWidgets.QFrame):
"""Widget used to manage location path."""
#: :term:`Qt Signal` emitted when location has been updated.
updated = QtCore.Signal()
def __init__(self, parent=None):
"... | [
"nomenclator.vendor.Qt.QtWidgets.QPushButton",
"nomenclator.vendor.Qt.QtWidgets.QComboBox",
"os.path.dirname",
"nomenclator.vendor.Qt.QtCore.Signal",
"nomenclator.vendor.Qt.QtWidgets.QCompleter",
"nomenclator.vendor.Qt.QtWidgets.QDirModel",
"os.path.isfile",
"nomenclator.vendor.Qt.QtWidgets.QHBoxLayou... | [((257, 272), 'nomenclator.vendor.Qt.QtCore.Signal', 'QtCore.Signal', ([], {}), '()\n', (270, 272), False, 'from nomenclator.vendor.Qt import QtWidgets, QtCore\n'), ((676, 704), 'os.path.isfile', 'os.path.isfile', (['current_path'], {}), '(current_path)\n', (690, 704), False, 'import os\n'), ((1210, 1237), 'nomenclator... |
from bunnyhop.billing import Billing
from bunnyhop.purge import Purge
from bunnyhop.stats import Stats
from bunnyhop.storage import Storage, StorageZone
from bunnyhop.zone import Zone
class Bunny(object):
def __init__(self, api_key):
self.Zone = Zone(api_key)
self.Purge = Purge(api_key)
s... | [
"bunnyhop.purge.Purge",
"bunnyhop.billing.Billing",
"bunnyhop.storage.Storage",
"bunnyhop.storage.StorageZone",
"bunnyhop.zone.Zone",
"bunnyhop.stats.Stats"
] | [((261, 274), 'bunnyhop.zone.Zone', 'Zone', (['api_key'], {}), '(api_key)\n', (265, 274), False, 'from bunnyhop.zone import Zone\n'), ((296, 310), 'bunnyhop.purge.Purge', 'Purge', (['api_key'], {}), '(api_key)\n', (301, 310), False, 'from bunnyhop.purge import Purge\n'), ((334, 350), 'bunnyhop.storage.Storage', 'Storag... |
import psycopg2
import psycopg2.extras
from .config import config
import io
def _db():
connection_string = config["connection_string"]
con = psycopg2.connect(connection_string)
if not config.get("batch_mode", False):
con.set_session(autocommit=True)
return con
def init():
db = _db()
... | [
"io.StringIO",
"psycopg2.extras.execute_values",
"psycopg2.connect"
] | [((152, 187), 'psycopg2.connect', 'psycopg2.connect', (['connection_string'], {}), '(connection_string)\n', (168, 187), False, 'import psycopg2\n'), ((4444, 4457), 'io.StringIO', 'io.StringIO', ([], {}), '()\n', (4455, 4457), False, 'import io\n'), ((3838, 3996), 'psycopg2.extras.execute_values', 'psycopg2.extras.execu... |
import os
import sys
sys.path.append(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
from api import demo_web_app
from api import GPT, Example, UIConfig
import tqdm
import random
from transcript_utils import get_args, \
get_secret_key, \
save_transcript, \
load_faqs, \
load_squad_queries... | [
"tqdm.tqdm",
"random.shuffle",
"os.path.realpath",
"transcript_utils.save_transcript",
"transcript_utils.get_args",
"transcript_utils.load_faqs",
"api.GPT",
"transcript_utils.get_secret_key",
"transcript_utils.load_squad_queries",
"api.Example",
"os.listdir"
] | [((346, 356), 'transcript_utils.get_args', 'get_args', ([], {}), '()\n', (354, 356), False, 'from transcript_utils import get_args, get_secret_key, save_transcript, load_faqs, load_squad_queries\n'), ((361, 377), 'transcript_utils.get_secret_key', 'get_secret_key', ([], {}), '()\n', (375, 377), False, 'from transcript_... |
# matplotlib backtest for missing $DISPLAY
import matplotlib
matplotlib.use('TkAgg')
import numpy as np
from reader import fetch_data
from normaliser import normalise
from sklearn.decomposition import PCA
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import seaborn as sns
sns_blue, sns... | [
"seaborn.set_style",
"reader.fetch_data",
"matplotlib.use",
"sklearn.decomposition.PCA",
"seaborn.color_palette",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.savefig"
] | [((61, 84), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (75, 84), False, 'import matplotlib\n'), ((347, 373), 'seaborn.color_palette', 'sns.color_palette', (['"""muted"""'], {}), "('muted')\n", (364, 373), True, 'import seaborn as sns\n'), ((374, 396), 'seaborn.set_style', 'sns.set_style',... |
# flake8: noqa
import pandas as pd
import numpy
import anndata
import os
from scipy import sparse
# -----------------------------------------------------------------#
# General example information
SCHEMA_VERSION = "2.0.0"
FIXTURES_ROOT = os.path.join(os.path.dirname(__file__))
# --------------------------------------... | [
"pandas.DataFrame",
"os.path.dirname",
"numpy.zeros",
"scipy.sparse.csr_matrix",
"os.path.join",
"pandas.concat"
] | [((385, 421), 'os.path.join', 'os.path.join', (['FIXTURES_ROOT', '"""h5ads"""'], {}), "(FIXTURES_ROOT, 'h5ads')\n", (397, 421), False, 'import os\n'), ((435, 479), 'os.path.join', 'os.path.join', (['h5ad_dir', '"""example_valid.h5ad"""'], {}), "(h5ad_dir, 'example_valid.h5ad')\n", (447, 479), False, 'import os\n'), ((4... |
#!/usr/bin/env python
# vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2017 <NAME> <<EMAIL>>
#
# See LICENSE comming with the source of python-quilt for details.
import os.path
from six.moves import cStringIO
import sys
from helpers im... | [
"quilt.utils.TmpDirectory",
"six.moves.cStringIO",
"sys.stderr.getvalue",
"helpers.tmp_series",
"quilt.db.Patch",
"helpers.make_file"
] | [((626, 637), 'quilt.db.Patch', 'Patch', (['name'], {}), '(name)\n', (631, 637), False, 'from quilt.db import Patch\n'), ((741, 754), 'quilt.db.Patch', 'Patch', (['"""same"""'], {}), "('same')\n", (746, 754), False, 'from quilt.db import Patch\n'), ((841, 854), 'quilt.db.Patch', 'Patch', (['"""same"""'], {}), "('same')... |
import os
import json
import joblib
import numpy as np
from scipy.stats import rankdata
import scipy.stats
from sklearn.metrics import mean_squared_error
from .... import logger
from ...setup.setup import Session
from .... import MODELS_PATH
MAX_N = 10
class Predictor(object):
def __init__(self, mdl):
... | [
"os.listdir",
"numpy.load",
"json.load",
"numpy.median",
"os.path.exists",
"numpy.zeros",
"scipy.stats.rankdata",
"numpy.argsort",
"numpy.min",
"numpy.max",
"numpy.array",
"numpy.random.choice",
"joblib.load",
"os.path.join",
"sklearn.metrics.mean_squared_error",
"numpy.sqrt"
] | [((498, 509), 'numpy.array', 'np.array', (['p'], {}), '(p)\n', (506, 509), True, 'import numpy as np\n'), ((527, 538), 'numpy.array', 'np.array', (['q'], {}), '(q)\n', (535, 538), True, 'import numpy as np\n'), ((741, 760), 'numpy.sqrt', 'np.sqrt', (['divergence'], {}), '(divergence)\n', (748, 760), True, 'import numpy... |
from random import random
import gym
# os.chdir(os.path.join(os.path.abspath(os.path.curdir), "hw1/"))
import load_policy
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import tf_util
from keras import Sequential
from keras.layers import Dense
def roll_out(env_name, policy_fn, render=Fals... | [
"gym.make",
"matplotlib.pyplot.plot",
"keras.Sequential",
"tensorflow.Session",
"random.random",
"numpy.vstack",
"keras.layers.Dense",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.savefig",
"tf_util.initialize"
] | [((354, 372), 'gym.make', 'gym.make', (['env_name'], {}), '(env_name)\n', (362, 372), False, 'import gym\n'), ((1153, 1165), 'keras.Sequential', 'Sequential', ([], {}), '()\n', (1163, 1165), False, 'from keras import Sequential\n'), ((1515, 1539), 'matplotlib.pyplot.plot', 'plt.plot', (['novice_returns'], {}), '(novice... |
import os
import sys
from ..utils import pushd, listdir
from ..utils import run_command
from ..utils.tests import run_test
from ..utils.marksheet import Marksheet
from ..utils.report import generate_report
import json
def mark_submission(student, marker):
'''
Given a student identifier, run all the test case... | [
"os.path.isdir",
"json.dump",
"os.path.isfile",
"os.path.join"
] | [((557, 592), 'os.path.join', 'os.path.join', (['"""candidates"""', 'student'], {}), "('candidates', student)\n", (569, 592), False, 'import os\n'), ((2969, 3018), 'os.path.join', 'os.path.join', (["self.cfg['assgn_dir']", '"""candidates"""'], {}), "(self.cfg['assgn_dir'], 'candidates')\n", (2981, 3018), False, 'import... |
# (C) 2022 GoodData Corporation
from __future__ import annotations
from typing import Union
import gooddata_afm_client.models as afm_models
from gooddata_sdk.compute.model.base import ExecModelEntity, ObjId
class Attribute(ExecModelEntity):
def __init__(self, local_id: str, label: Union[ObjId, str]) -> None:
... | [
"gooddata_sdk.compute.model.base.ObjId"
] | [((762, 783), 'gooddata_sdk.compute.model.base.ObjId', 'ObjId', (['label', '"""label"""'], {}), "(label, 'label')\n", (767, 783), False, 'from gooddata_sdk.compute.model.base import ExecModelEntity, ObjId\n')] |
import json
import os
import pandas as pd
import plotly.express as px
class VisualizeLoss:
def __init__(self, config=None):
self.config = config
if config:
self.read_data(config)
def read_data(self, config):
log_file_path = os.path.join(config['model_dir'], 'train_log.json')
with open(log_... | [
"pandas.DataFrame",
"json.load",
"os.path.join",
"plotly.express.line"
] | [((249, 300), 'os.path.join', 'os.path.join', (["config['model_dir']", '"""train_log.json"""'], {}), "(config['model_dir'], 'train_log.json')\n", (261, 300), False, 'import os\n'), ((353, 365), 'json.load', 'json.load', (['f'], {}), '(f)\n', (362, 365), False, 'import json\n'), ((599, 670), 'plotly.express.line', 'px.l... |
# Generated by Django 3.2.5 on 2021-08-02 13:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_alter_painting_thumbnail'),
]
operations = [
migrations.RemoveField(
model_name='review_celebrity',
nam... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField"
] | [((238, 306), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""review_celebrity"""', 'name': '"""author"""'}), "(model_name='review_celebrity', name='author')\n", (260, 306), False, 'from django.db import migrations, models\n'), ((351, 414), 'django.db.migrations.RemoveField', 'migr... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative wo... | [
"numpy.append",
"logging.getLogger"
] | [((768, 795), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (785, 795), False, 'import logging\n'), ((3478, 3505), 'numpy.append', 'np.append', (['output', 'ext2_out'], {}), '(output, ext2_out)\n', (3487, 3505), True, 'import numpy as np\n')] |
import matplotlib.pyplot as plt
import numpy as np
def plot_curve(data, plot_file, keys=None,
clip=True, label_min=True, label_end=True):
if not keys:
keys = data.keys()
plt.figure()
for i,key in enumerate(keys):
plt.subplot(len(keys),1,i+1)
if clip:
lim... | [
"numpy.abs",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.close",
"matplotlib.pyplot.legend",
"numpy.clip",
"numpy.argmin",
"matplotlib.pyplot.figure",
"numpy.min",
"matplotlib.pyplot.savefig"
] | [((204, 216), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (214, 216), True, 'import matplotlib.pyplot as plt\n'), ((807, 829), 'matplotlib.pyplot.savefig', 'plt.savefig', (['plot_file'], {}), '(plot_file)\n', (818, 829), True, 'import matplotlib.pyplot as plt\n'), ((834, 845), 'matplotlib.pyplot.close',... |
'''
Date: Feb, 2020
Author: <NAME> , <NAME>
This file is originally from "'Double DIP" (https://github.com/yossigandelsman/DoubleDIP)
Some modifications are built to define the baselines
'''
import glob
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision
import matplotlib
import m... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.clf",
"PIL.ImageCms.applyTransform",
"numpy.clip",
"numpy.mean",
"numpy.rot90",
"torch.arange",
"glob.glob",
"os.path.join",
"torch.nn.functional.pad",
"matplotlib.pyplot.close",
"matplotlib.pyplot.imshow",
"os.path.exists",
"torch.exp",
"tor... | [((517, 538), 'matplotlib.use', 'matplotlib.use', (['"""agg"""'], {}), "('agg')\n", (531, 538), False, 'import matplotlib\n'), ((1683, 1745), 'torch.nn.functional.pad', 'F.pad', (['x', '(padding, padding, padding, padding)'], {'mode': '"""reflect"""'}), "(x, (padding, padding, padding, padding), mode='reflect')\n", (16... |
import datetime
import pytest
from django.contrib.auth.models import AnonymousUser
from django.contrib.sessions.middleware import SessionMiddleware
from django.test import RequestFactory
from .factories import UserFactory
@pytest.fixture
def user():
return UserFactory()
@pytest.fixture
def user_without_librar... | [
"django.contrib.auth.models.AnonymousUser",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.test.RequestFactory"
] | [((944, 960), 'django.test.RequestFactory', 'RequestFactory', ([], {}), '()\n', (958, 960), False, 'from django.test import RequestFactory\n'), ((1015, 1030), 'django.contrib.auth.models.AnonymousUser', 'AnonymousUser', ([], {}), '()\n', (1028, 1030), False, 'from django.contrib.auth.models import AnonymousUser\n'), ((... |
from django.db import models
# Create your models here.
from django.conf import settings
class Auditable(models.Model):
CREATE_TIMESTAMP = models.DateTimeField(auto_now_add=True, blank=True, null=True)
# CREATE_USER = models.ForeignKey('User', related_name='%(app_label)s_%(class)s_CREATE_USER', blank=True, n... | [
"django.db.models.DateTimeField"
] | [((146, 208), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now_add': '(True)', 'blank': '(True)', 'null': '(True)'}), '(auto_now_add=True, blank=True, null=True)\n', (166, 208), False, 'from django.db import models\n'), ((354, 412), 'django.db.models.DateTimeField', 'models.DateTimeField', ([],... |
from decimal import Decimal
from statistics import mean
import factory
from django.http import HttpResponse
from rest_framework.generics import GenericAPIView
from .abstract.abstract_get_api_test import AbstractGetApiTest
from ...api import CarListCreateApi
from ...factory import CarFactory, RatingFactory
from ...mod... | [
"statistics.mean",
"rest_framework.generics.GenericAPIView.as_view",
"factory.Iterator",
"decimal.Decimal"
] | [((602, 626), 'rest_framework.generics.GenericAPIView.as_view', 'GenericAPIView.as_view', ([], {}), '()\n', (624, 626), False, 'from rest_framework.generics import GenericAPIView\n'), ((1741, 1768), 'decimal.Decimal', 'Decimal', (['returned_avg_value'], {}), '(returned_avg_value)\n', (1748, 1768), False, 'from decimal ... |
import requests,os,sys,time
from bs4 import BeautifulSoup as BS
class docter:
def __init__(self):
self.ses=requests.Session()
def klikdok(self,num):
req1=self.ses.get('https://m.klikdokter.com/users/create')
bs=BS(req1.text,'html.parser')
token=bs.find('input',{'name':'_token'})['value']
# print(token)
... | [
"bs4.BeautifulSoup",
"requests.Session",
"os.system",
"sys.exit"
] | [((112, 130), 'requests.Session', 'requests.Session', ([], {}), '()\n', (128, 130), False, 'import requests, os, sys, time\n'), ((222, 250), 'bs4.BeautifulSoup', 'BS', (['req1.text', '"""html.parser"""'], {}), "(req1.text, 'html.parser')\n", (224, 250), True, 'from bs4 import BeautifulSoup as BS\n'), ((1206, 1224), 'os... |