code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from preprocessing.vectorizers import Doc2VecVectorizer
from nnframework.data_builder import DataBuilder
import pandas as pd
import constants as const
import numpy as np
def generate_d2v_vectors(source_file):
df = pd.read_csv(source_file)
messages = df["Message"].values
vectorizer = Doc2VecVectorizer()
... | [
"pandas.read_csv",
"numpy.save",
"preprocessing.vectorizers.Doc2VecVectorizer"
] | [((219, 243), 'pandas.read_csv', 'pd.read_csv', (['source_file'], {}), '(source_file)\n', (230, 243), True, 'import pandas as pd\n'), ((298, 317), 'preprocessing.vectorizers.Doc2VecVectorizer', 'Doc2VecVectorizer', ([], {}), '()\n', (315, 317), False, 'from preprocessing.vectorizers import Doc2VecVectorizer\n'), ((579,... |
"""Microphone module."""
import alsaaudio
# pylint: disable=R0903, E1101
class Micro():
"""Class to use micro in a `with` bloc."""
def __init__(self, alsaaudio_capture=alsaaudio.PCM_CAPTURE,
alsaaudio_nonblock=alsaaudio.PCM_NONBLOCK):
"""Open the device in nonblocking capture mode.
... | [
"alsaaudio.PCM"
] | [((690, 732), 'alsaaudio.PCM', 'alsaaudio.PCM', (['self.capture', 'self.nonblock'], {}), '(self.capture, self.nonblock)\n', (703, 732), False, 'import alsaaudio\n')] |
# ---
# jupyter:
# jupytext:
# text_representation:
# extension: .py
# format_name: light
# format_version: '1.5'
# jupytext_version: 1.11.3
# kernelspec:
# display_name: Python 3
# name: python3
# ---
# + [markdown] id="M_qo7DmLJKLP"
# #Class-Conditional Bernoulli Mixture Model... | [
"jax.nn.log_softmax",
"conditional_bernoulli_mix_utils.fake_test_data",
"jax.random.PRNGKey",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"numpy.full",
"conditional_bernoulli_mix_utils.get_decoded_samples",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show",
"jax.vmap",
"ma... | [((1137, 1174), 'conditional_bernoulli_mix_utils.get_emnist_images_per_class', 'get_emnist_images_per_class', (['select_n'], {}), '(select_n)\n', (1164, 1174), False, 'from conditional_bernoulli_mix_utils import fake_test_data, encode, decode, get_decoded_samples, get_emnist_images_per_class\n'), ((1705, 1813), 'condit... |
from __future__ import unicode_literals
import unittest
from ddf import DDFManager, DDF_HOME
class BaseTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.dm_spark = DDFManager('spark')
cls.airlines = cls.loadAirlines(cls.dm_spark)
cls.mtcars = cls.loadMtCars(cls.dm_spark)
... | [
"ddf.DDFManager"
] | [((196, 215), 'ddf.DDFManager', 'DDFManager', (['"""spark"""'], {}), "('spark')\n", (206, 215), False, 'from ddf import DDFManager, DDF_HOME\n')] |
import difflib
import pathlib
import argparse
from .utils import fail_with_message, progress_with_message, success_with_message
try:
import PyPDF2
except ImportError:
fail_with_message(
'Please install required dependencies before using this package.\n\t> pip3 install -r requirements.txt --user')
de... | [
"argparse.ArgumentParser",
"difflib.SequenceMatcher",
"PyPDF2.PdfFileReader",
"pathlib.Path",
"PyPDF2.PdfFileWriter",
"argparse.ArgumentTypeError"
] | [((2334, 2443), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Quickly remove useless page from a huge pdf to get a readable pdf"""'}), "(description=\n 'Quickly remove useless page from a huge pdf to get a readable pdf')\n", (2357, 2443), False, 'import argparse\n'), ((805, 854), 'di... |
__author__ = 'palmer'
# every method in smoothing should accept (im,**args)
def median(im, **kwargs):
from scipy import ndimage
im = ndimage.filters.median_filter(im,**kwargs)
return im
def hot_spot_removal(xic, q=99.):
import numpy as np
xic_q = np.percentile(xic, q)
xic[xic > xic_q] = xic_q
... | [
"numpy.percentile",
"scipy.ndimage.filters.median_filter"
] | [((141, 184), 'scipy.ndimage.filters.median_filter', 'ndimage.filters.median_filter', (['im'], {}), '(im, **kwargs)\n', (170, 184), False, 'from scipy import ndimage\n'), ((268, 289), 'numpy.percentile', 'np.percentile', (['xic', 'q'], {}), '(xic, q)\n', (281, 289), True, 'import numpy as np\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from aldryn_apphooks_config.utils import get_app_instance
def apphooks_config(request):
namespace, config = get_app_instance(request)
return {
'namespace': namespace,
'config': config,
}
| [
"aldryn_apphooks_config.utils.get_app_instance"
] | [((179, 204), 'aldryn_apphooks_config.utils.get_app_instance', 'get_app_instance', (['request'], {}), '(request)\n', (195, 204), False, 'from aldryn_apphooks_config.utils import get_app_instance\n')] |
# coding: utf-8
# MultiPerceptron
# queueを使った学習
# 学習step数を記録
# 学習データはCSVの代わりにジェネレータを搭載
# 3x11x4のNNモデルに変更
# scoreを追加
import os
_FILE_DIR=os.path.abspath(os.path.dirname(__file__))
import time
import tensorflow as tf
import threading
from sklearn.utils import shuffle
import sys
sys.path.append(_FILE_DIR+'/..')
from gene... | [
"tensorflow.train.Coordinator",
"tensorflow.reset_default_graph",
"tensorflow.matmul",
"numpy.random.randint",
"tensorflow.Variable",
"tensorflow.truncated_normal",
"sys.path.append",
"tensorflow.nn.softmax",
"tensorflow.nn.relu",
"tensorflow.nn.softmax_cross_entropy_with_logits",
"os.path.dirna... | [((278, 312), 'sys.path.append', 'sys.path.append', (["(_FILE_DIR + '/..')"], {}), "(_FILE_DIR + '/..')\n", (293, 312), False, 'import sys\n'), ((369, 393), 'tensorflow.reset_default_graph', 'tf.reset_default_graph', ([], {}), '()\n', (391, 393), True, 'import tensorflow as tf\n'), ((776, 793), 'generator.SensorGenerat... |
# Generated by Django 2.2.9 on 2020-02-14 10:33
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('questions', '0050_data_migration'),
]
operations = [
migrations.AlterField(
model_name='catalog',
name='sites',
... | [
"django.db.models.ManyToManyField"
] | [((334, 489), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'help_text': '"""The sites this catalog belongs to (in a multi site setup)."""', 'to': '"""sites.Site"""', 'verbose_name': '"""Sites"""'}), "(blank=True, help_text=\n 'The sites this catalog belongs to (in a multi si... |
import pytest
from copper_sdk import COPPER_API_TOKEN, COPPER_API_EMAIL
from copper_sdk.copper import Copper
@pytest.fixture(scope='session')
def copper():
return Copper(COPPER_API_TOKEN, COPPER_API_EMAIL)
| [
"copper_sdk.copper.Copper",
"pytest.fixture"
] | [((111, 142), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (125, 142), False, 'import pytest\n'), ((168, 210), 'copper_sdk.copper.Copper', 'Copper', (['COPPER_API_TOKEN', 'COPPER_API_EMAIL'], {}), '(COPPER_API_TOKEN, COPPER_API_EMAIL)\n', (174, 210), False, 'from copper_s... |
# Copyright 2021 PaddleFSL Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... | [
"paddlefsl.backbones.RCInitVector"
] | [((649, 700), 'paddlefsl.backbones.RCInitVector', 'RCInitVector', ([], {'corpus': '"""glove-wiki"""', 'embedding_dim': '(50)'}), "(corpus='glove-wiki', embedding_dim=50)\n", (661, 700), False, 'from paddlefsl.backbones import RCInitVector\n')] |
from var_plots import plot_forecast
plot_forecast()
| [
"var_plots.plot_forecast"
] | [((37, 52), 'var_plots.plot_forecast', 'plot_forecast', ([], {}), '()\n', (50, 52), False, 'from var_plots import plot_forecast\n')] |
#!/usr/bin/python3
import argparse
import sys
def readHashFile(hashfile):
f = open(hashfile)
hashes = f.read().split('\n')[:-1]
ntlm ={"cracked":{}, "safe":{}}
f.close()
for i in hashes:
try:
h = i.split(':')
ntlm["safe"][h[3].upper()] = h[0].lower()
except ... | [
"argparse.ArgumentParser"
] | [((1512, 1619), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""List accounts compromised in public leaked NTLMs"""', 'add_help': '(True)'}), "(description=\n 'List accounts compromised in public leaked NTLMs', add_help=True)\n", (1535, 1619), False, 'import argparse\n')] |
import os
import bpy
import sys
# Names of folder and files
args = sys.argv
source_file = args[-2]
convert_file = args[-1]
save_type = convert_file.split(".")[-1]
# Deleting all objects
for scene in bpy.data.scenes:
for obj in scene.objects:
scene.objects.unlink(obj)
for bpy_data_iter in (... | [
"bpy.ops.import_scene.deusexmd",
"bpy.data.meshes.remove",
"import_DeusExMD.import_DeusExMD",
"bpy.ops.object.delete",
"bpy.ops.export_mesh.stl",
"bpy.ops.export_scene.fbx",
"bpy.ops.object.select_by_type",
"bpy.ops.export_scene.obj",
"bpy.ops.export_scene.autodesk_3ds"
] | [((513, 555), 'bpy.ops.object.select_by_type', 'bpy.ops.object.select_by_type', ([], {'type': '"""MESH"""'}), "(type='MESH')\n", (542, 555), False, 'import bpy\n'), ((559, 598), 'bpy.ops.object.delete', 'bpy.ops.object.delete', ([], {'use_global': '(False)'}), '(use_global=False)\n', (580, 598), False, 'import bpy\n'),... |
#
# Copyright (c) 2022 salesforce.com, inc.
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
# For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#
from abc import ABC
import logging
import os
from os.path import abspath, dirname, join
import sys
i... | [
"pandas.DataFrame",
"unittest.main",
"os.path.abspath",
"numpy.random.seed",
"os.makedirs",
"logging.basicConfig",
"torch.manual_seed",
"merlion.utils.TimeSeries.from_pd",
"merlion.models.defaults.DefaultDetector.load",
"merlion.post_process.threshold.AggregateAlarms",
"random.seed",
"pandas.t... | [((716, 743), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (733, 743), False, 'import logging\n'), ((774, 798), 'torch.manual_seed', 'torch.manual_seed', (['(12345)'], {}), '(12345)\n', (791, 798), False, 'import torch\n'), ((803, 821), 'random.seed', 'random.seed', (['(12345)'], {}), '... |
## TODO: define the convolutional neural network architecture
import torch
from torch.autograd import Variable
import torch.nn as nn
import torch.nn.functional as F
# can use the below import should you choose to initialize the weights of your Net
import torch.nn.init as I
class Net(nn.Module):
def __init__(sel... | [
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.Linear",
"torch.nn.MaxPool2d"
] | [((1013, 1032), 'torch.nn.Conv2d', 'nn.Conv2d', (['(1)', '(32)', '(5)'], {}), '(1, 32, 5)\n', (1022, 1032), True, 'import torch.nn as nn\n'), ((1094, 1103), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (1101, 1103), True, 'import torch.nn as nn\n'), ((1124, 1142), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', (['(2)', '(2)'],... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Support for resource tree traversal.
"""
from __future__ import division
from __future__ import print_function
from __future__ import absolute_import
from pyramid import traversal
from pyramid.compat import is_nonstr_iter
from pyramid.compat import decode_path_info
... | [
"pyramid.traversal.ResourceTreeTraverser.__init__",
"zope.traversing.interfaces.ITraversable.providedBy",
"zope.traversing.interfaces.BeforeTraverseEvent",
"zope.publisher.interfaces.browser.IBrowserRequest",
"pyramid.compat.decode_path_info",
"zope.publisher.interfaces.browser.IDefaultBrowserLayer.provid... | [((1946, 1979), 'zope.interface.implementer', 'interface.implementer', (['ITraverser'], {}), '(ITraverser)\n', (1967, 1979), False, 'from zope import interface\n'), ((2915, 2967), 'pyramid.traversal.ResourceTreeTraverser.__init__', 'traversal.ResourceTreeTraverser.__init__', (['self', 'root'], {}), '(self, root)\n', (2... |
import json
import os
from os import environ as env
from distutils.util import strtobool
if os.path.isfile("setting.json"):
with open("setting.json", "r", encoding="UTF-8_sig") as s:
setting = json.load(s)
else:
setting = {
"token": {
"discord": env["discord_token"],
"ch... | [
"os.path.isfile",
"json.load",
"distutils.util.strtobool"
] | [((93, 123), 'os.path.isfile', 'os.path.isfile', (['"""setting.json"""'], {}), "('setting.json')\n", (107, 123), False, 'import os\n'), ((206, 218), 'json.load', 'json.load', (['s'], {}), '(s)\n', (215, 218), False, 'import json\n'), ((406, 431), 'distutils.util.strtobool', 'strtobool', (["env['logging']"], {}), "(env[... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 22 18:29:44 2019
@author: tgadfort
"""
from debug import debugclass
from playTypes import noplay
from playYards import playyards
#from copy import deepcopy, copy
# create logger
import logging
module_logger = logging.getLogger('log.{0}'.format(__... | [
"debug.debugclass",
"playYards.playyards"
] | [((834, 846), 'debug.debugclass', 'debugclass', ([], {}), '()\n', (844, 846), False, 'from debug import debugclass\n'), ((874, 885), 'playYards.playyards', 'playyards', ([], {}), '()\n', (883, 885), False, 'from playYards import playyards\n')] |
import random
import time
from Character import *
from Item import create_item
def battle(fighters, max_turn=10):
"""
Battle process start->loot
:param max_turn: int turns for 1 battle, default 10
:param fighters: list of fighter
:return: None
"""
# Enter battle_process
... | [
"Item.create_item",
"random.choice",
"time.sleep"
] | [((6694, 6711), 'Item.create_item', 'create_item', (['"""A2"""'], {}), "('A2')\n", (6705, 6711), False, 'from Item import create_item\n'), ((6726, 6743), 'Item.create_item', 'create_item', (['"""A2"""'], {}), "('A2')\n", (6737, 6743), False, 'from Item import create_item\n'), ((4538, 4553), 'time.sleep', 'time.sleep', ... |
# Generated by Django 2.1.7 on 2019-08-06 16:38
import ckeditor_uploader.fields
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import sorl.thumbnail.fields
class Migration(migrations.Migration):
dependencies = [... | [
"django.db.models.ForeignKey",
"django.db.models.BooleanField"
] | [((522, 555), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (541, 555), False, 'from django.db import migrations, models\n'), ((726, 759), 'django.db.models.BooleanField', 'models.BooleanField', ([], {'default': '(True)'}), '(default=True)\n', (745, 759), False... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Module that contains frame widget implementation
"""
from __future__ import print_function, division, absolute_import
from Qt.QtCore import Qt
from Qt.QtWidgets import QSizePolicy, QFrame
from Qt.QtGui import QPainter, QPainterPath
class WelcomeFrame(QFrame, object... | [
"Qt.QtGui.QPainterPath",
"Qt.QtGui.QPainter"
] | [((885, 899), 'Qt.QtGui.QPainter', 'QPainter', (['self'], {}), '(self)\n', (893, 899), False, 'from Qt.QtGui import QPainter, QPainterPath\n'), ((968, 982), 'Qt.QtGui.QPainterPath', 'QPainterPath', ([], {}), '()\n', (980, 982), False, 'from Qt.QtGui import QPainter, QPainterPath\n')] |
# treemodels.py
from __future__ import division
import gtk
from debug import *
import numpy as np
import matplotlib.pyplot as plt
class CountingActivitiesModel (gtk.GenericTreeModel):
"""Gtk TreeModel for CountingActivity's in a Log."""
def __init__ (self, log):
gtk.GenericTreeModel.__init__ (sel... | [
"gtk.GenericTreeModel.__init__",
"gtk.gdk.Pixbuf",
"numpy.sum",
"matplotlib.pyplot.get_cmap"
] | [((286, 321), 'gtk.GenericTreeModel.__init__', 'gtk.GenericTreeModel.__init__', (['self'], {}), '(self)\n', (315, 321), False, 'import gtk\n'), ((1999, 2034), 'gtk.GenericTreeModel.__init__', 'gtk.GenericTreeModel.__init__', (['self'], {}), '(self)\n', (2028, 2034), False, 'import gtk\n'), ((3661, 3696), 'gtk.GenericTr... |
import sys
import torch
from torch.autograd import Variable
import numpy as np
import os
from os import path
import argparse
import random
import copy
from tqdm import tqdm
import pickle
from scorer.data_helper.json_reader import read_sorted_scores, read_pair_anno_scores, read_articles, \
read_processed_scores, rea... | [
"numpy.random.seed",
"argparse.ArgumentParser",
"numpy.argmax",
"random.shuffle",
"numpy.mean",
"torch.nn.Softmax",
"pickle.load",
"numpy.random.normal",
"scipy.stats.kendalltau",
"torch.no_grad",
"os.path.join",
"numpy.unique",
"torch.nn.BCELoss",
"os.path.exists",
"random.seed",
"tor... | [((1669, 1696), 'random.shuffle', 'random.shuffle', (['article_ids'], {}), '(article_ids)\n', (1683, 1696), False, 'import random\n'), ((3637, 3660), 'torch.nn.Softmax', 'torch.nn.Softmax', ([], {'dim': '(1)'}), '(dim=1)\n', (3653, 3660), False, 'import torch\n'), ((4015, 4033), 'torch.nn.BCELoss', 'torch.nn.BCELoss', ... |
import argparse
parser = argparse.ArgumentParser(prog="connvis",description='Web-based conntrack that tries to simplify the data for privacy research')
parser.add_argument('--nodnsseed', help='do not seed domains from dnsmasq history',action='store_true')
parser.add_argument('--shell', help='Enable interactive shell',a... | [
"ipaddress.ip_address",
"ipaddress.ip_network",
"argparse.ArgumentParser"
] | [((25, 157), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""connvis"""', 'description': '"""Web-based conntrack that tries to simplify the data for privacy research"""'}), "(prog='connvis', description=\n 'Web-based conntrack that tries to simplify the data for privacy research')\n", (48, 15... |
import collections
import cPickle as pickle
import glob
import itertools
import json
import operator
import os
import re
import sys
from program_synthesis.karel.dataset import dataset
from program_synthesis.karel.dataset import executor
from program_synthesis.karel.dataset.karel_runtime import KarelRuntime
from progra... | [
"program_synthesis.karel.dataset.dataset.KarelExample.from_dict",
"program_synthesis.karel.dataset.dataset.KarelExample",
"json.loads",
"program_synthesis.common.tools.saver.restore_args",
"program_synthesis.karel.models.karel_model.KarelLGRLRefineModel",
"program_synthesis.karel.dataset.executor.KarelExe... | [((822, 840), 'program_synthesis.common.tools.saver.restore_args', 'restore_args', (['args'], {}), '(args)\n', (834, 840), False, 'from program_synthesis.common.tools.saver import restore_args\n'), ((890, 928), 'program_synthesis.karel.models.karel_model.KarelLGRLRefineModel', 'karel_model.KarelLGRLRefineModel', (['arg... |
import pyximport;
pyximport.install(setup_args = {"script_args" : ["--force"]},
language_level=3)
import unittest
import uttemplate
import cymapinterfacetester as cyt
from cykhash import Int64to64Map, Int32to32Map, Float64to64Map, Float32to32Map, PyObjectMap
AS_LIST = {'int64' : cyt.as_py_list_... | [
"pyximport.install",
"uttemplate.from_templates"
] | [((19, 95), 'pyximport.install', 'pyximport.install', ([], {'setup_args': "{'script_args': ['--force']}", 'language_level': '(3)'}), "(setup_args={'script_args': ['--force']}, language_level=3)\n", (36, 95), False, 'import pyximport\n'), ((1290, 1357), 'uttemplate.from_templates', 'uttemplate.from_templates', (["['int6... |
import pytest
from tests.util import createNode
node = createNode()
@pytest.mark.query
def test_getzmqnotifications(): # 01
zmq = node.zmq.getzmqnotifications()
assert zmq or zmq == []
| [
"tests.util.createNode"
] | [((56, 68), 'tests.util.createNode', 'createNode', ([], {}), '()\n', (66, 68), False, 'from tests.util import createNode\n')] |
from pandas._config.config import reset_option
from preprocess.load_data.data_loader import load_hotel_reserve
import pandas as pd
from datetime import date, datetime
from dateutil.relativedelta import relativedelta
def main():
"""全結合処理
顧客ごとに2017年1月〜2017年3月の月間合計利用金額を計算
利用がない日は0とする
日付はチェックイン日付を利用する
... | [
"pandas.merge",
"preprocess.load_data.data_loader.load_hotel_reserve",
"dateutil.relativedelta.relativedelta",
"datetime.date",
"pandas.to_datetime"
] | [((364, 384), 'preprocess.load_data.data_loader.load_hotel_reserve', 'load_hotel_reserve', ([], {}), '()\n', (382, 384), False, 'from preprocess.load_data.data_loader import load_hotel_reserve\n'), ((792, 868), 'pandas.merge', 'pd.merge', (["customer_tb[['customer_id', 'join_key']]", 'month_mst'], {'on': '"""join_key""... |
#
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, so... | [
"os.path.isdir",
"os.path.abspath",
"os.path.join",
"os.makedirs"
] | [((961, 983), 'os.path.abspath', 'op.abspath', (['self._path'], {}), '(self._path)\n', (971, 983), True, 'import os.path as op\n'), ((1158, 1191), 'os.path.join', 'op.join', (['self._root_path', 'subpath'], {}), '(self._root_path, subpath)\n', (1165, 1191), True, 'import os.path as op\n'), ((1273, 1297), 'os.path.join'... |
"""Estimate human performance for the scruples resource."""
import json
import logging
import click
from ....baselines.metrics import METRICS
logger = logging.getLogger(__name__)
# main function
@click.command()
@click.argument(
'split_path',
type=click.Path(exists=True, file_okay=True, dir_okay=False))... | [
"json.loads",
"click.open_file",
"click.command",
"click.Path",
"logging.getLogger"
] | [((156, 183), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (173, 183), False, 'import logging\n'), ((204, 219), 'click.command', 'click.command', ([], {}), '()\n', (217, 219), False, 'import click\n'), ((958, 990), 'click.open_file', 'click.open_file', (['split_path', '"""r"""'], {}), "... |
import unittest
from datetime import datetime
from target_bigquery import stream_utils
class TestStreamUtils(unittest.TestCase):
"""
Unit Tests
"""
def test_add_metadata_values_to_record(self):
"""Test adding metadata"""
dt = "2017-11-20T16:45:33.000Z"
record = { "type": "REC... | [
"datetime.datetime.strptime",
"datetime.datetime.now",
"target_bigquery.stream_utils.add_metadata_values_to_record"
] | [((406, 456), 'target_bigquery.stream_utils.add_metadata_values_to_record', 'stream_utils.add_metadata_values_to_record', (['record'], {}), '(record)\n', (448, 456), False, 'from target_bigquery import stream_utils\n'), ((1007, 1021), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1019, 1021), False, 'from... |
# -*- coding: utf-8 -*-
# StreamOnDemand Community Edition - Kodi Addon
# ------------------------------------------------------------
# streamondemand.- XBMC Plugin
# Canale per I <NAME>
# http://www.mimediacenter.info/foro/viewforum.php?f=36
# ------------------------------------------------------------
import re
f... | [
"core.item.Item",
"core.httptools.downloadpage",
"platformcode.logger.info",
"core.scrapertools.decodeHtmlentities",
"core.servertools.find_video_items",
"re.compile"
] | [((519, 559), 'platformcode.logger.info', 'logger.info', (['"""[hokutonoken.py] mainlist"""'], {}), "('[hokutonoken.py] mainlist')\n", (530, 559), False, 'from platformcode import logger\n'), ((1427, 1464), 'platformcode.logger.info', 'logger.info', (['"""hokutonoken.py episodi"""'], {}), "('hokutonoken.py episodi')\n"... |
import os
import json, boto3
def lambda_handler(event, context):
print("Trigger Event: ")
print(event)
region = os.environ['REGION']
elbv2_client = boto3.client('elbv2', region_name=region)
available_target_groups = os.environ['AVAILABLE_TARGET_GROUPS']
arr_available_target_groups = available_... | [
"boto3.client"
] | [((165, 206), 'boto3.client', 'boto3.client', (['"""elbv2"""'], {'region_name': 'region'}), "('elbv2', region_name=region)\n", (177, 206), False, 'import json, boto3\n'), ((4075, 4121), 'boto3.client', 'boto3.client', (['"""codedeploy"""'], {'region_name': 'region'}), "('codedeploy', region_name=region)\n", (4087, 4121... |
# worldtime module by CantSayIHave
# Created 2018/01/12
#
# Fetch time and date from a location
# Uses Google Geocoding API and Google Time Zone API
import aiohttp
import time
from datetime import datetime
API_GEOCODE = 'https://maps.googleapis.com/maps/api/geocode/json?'
API_TIMEZONE = 'https://maps.googleapis.com/... | [
"aiohttp.ClientSession",
"datetime.datetime.fromtimestamp",
"time.time"
] | [((1652, 1663), 'time.time', 'time.time', ([], {}), '()\n', (1661, 1663), False, 'import time\n'), ((2454, 2477), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {}), '()\n', (2475, 2477), False, 'import aiohttp\n'), ((2072, 2109), 'datetime.datetime.fromtimestamp', 'datetime.fromtimestamp', (['location_time'], ... |
import numpy as np
from matplotlib import pyplot as plt
n = 100
x = range(0,n)
y = range(0,n)
for k in range(0, n):
y[k] = y[k] + 3*np.random.randn() + 100
plt.figure(figsize=(20,10))
plt.scatter(x, y)
plt.savefig("./images/rawData.png")
X = np.zeros([n,1])
target = np.zeros([n,1])
X[:,0] = x
target[:,0] = y
np.... | [
"numpy.random.randn",
"matplotlib.pyplot.scatter",
"numpy.savetxt",
"numpy.zeros",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.savefig"
] | [((162, 190), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(20, 10)'}), '(figsize=(20, 10))\n', (172, 190), True, 'from matplotlib import pyplot as plt\n'), ((190, 207), 'matplotlib.pyplot.scatter', 'plt.scatter', (['x', 'y'], {}), '(x, y)\n', (201, 207), True, 'from matplotlib import pyplot as plt\n'), ... |
from time import timezone
import pandas as pd
from datetime import datetime
# print(datetime.fromtimestamp(1603209600))
# print(datetime.fromtimestamp(1612868324294/1000))
# print(datetime.fromtimestamp(1613283396746//1000))
print(datetime.fromtimestamp(1640851200))
print(datetime.fromtimestamp(1640649600))
print(date... | [
"datetime.datetime.utcnow",
"pandas.Timestamp",
"datetime.datetime.now",
"datetime.datetime.fromtimestamp"
] | [((365, 379), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (377, 379), False, 'from datetime import datetime\n'), ((384, 425), 'pandas.Timestamp', 'pd.Timestamp', ([], {'ts_input': 'a', 'tzinfo': 'a.tzinfo'}), '(ts_input=a, tzinfo=a.tzinfo)\n', (396, 425), True, 'import pandas as pd\n'), ((502, 527), 'dat... |
import pytest
from now_lms import init_app, lms_app
lms_app.app_context().push()
@pytest.fixture(scope="package", autouse=True)
def setup_database():
init_app()
| [
"now_lms.init_app",
"pytest.fixture",
"now_lms.lms_app.app_context"
] | [((85, 130), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""package"""', 'autouse': '(True)'}), "(scope='package', autouse=True)\n", (99, 130), False, 'import pytest\n'), ((157, 167), 'now_lms.init_app', 'init_app', ([], {}), '()\n', (165, 167), False, 'from now_lms import init_app, lms_app\n'), ((54, 75), 'now... |
"""Sync local directories with neocities.org sites."""
import os
import sys
from . import cmdline
from . import local
from .config import load_config_file
from .ignore_files import IgnoreFiles
from .log import (debug, decrease_verbosity, error, fatal, increase_verbosity, info)
from .neocities import Neocities
from .s... | [
"os.path.expanduser"
] | [((1074, 1112), 'os.path.expanduser', 'os.path.expanduser', (['site_conf.root_dir'], {}), '(site_conf.root_dir)\n', (1092, 1112), False, 'import os\n')] |
import warnings
from typing import Type, Union
def will_be_removed(
deprecated_name: str,
use_instead: Union[str, Type],
removing_in_version: str,
stacklevel=2,
):
new_class_name = (
use_instead.__name__ # type: ignore
if isinstance(use_instead, Type) # type: ignore
else ... | [
"warnings.warn"
] | [((342, 518), 'warnings.warn', 'warnings.warn', (['f"""Please use {new_class_name} instead, {deprecated_name} will be removed in happyly v{removing_in_version}."""', 'DeprecationWarning'], {'stacklevel': 'stacklevel'}), "(\n f'Please use {new_class_name} instead, {deprecated_name} will be removed in happyly v{removi... |
import re
string = input()
template = r'never gonna let you down...'
match = re.match(template, string, flags=re.IGNORECASE)
| [
"re.match"
] | [((79, 126), 're.match', 're.match', (['template', 'string'], {'flags': 're.IGNORECASE'}), '(template, string, flags=re.IGNORECASE)\n', (87, 126), False, 'import re\n')] |
from __future__ import print_function
import time
import os
import sys
import logging
import json
import tensorflow as tf
import numpy as np
import cv2
import data.data_loader as loader
from models.cgan_model import cgan
from models.ops import *
os.system('http_proxy_on')
def linear_decay(initial=0.0001, step=0, ... | [
"data.data_loader.read_data_path",
"os.mkdir",
"argparse.ArgumentParser",
"logging.basicConfig",
"tensorflow.global_variables_initializer",
"tensorflow.Session",
"os.system",
"os.path.exists",
"logging.info",
"data.data_loader.read_image_pair",
"models.cgan_model.cgan",
"logging.getLogger"
] | [((251, 277), 'os.system', 'os.system', (['"""http_proxy_on"""'], {}), "('http_proxy_on')\n", (260, 277), False, 'import os\n'), ((717, 781), 'data.data_loader.read_data_path', 'loader.read_data_path', (['args.data_path_train'], {'name': 'args.data_name'}), '(args.data_path_train, name=args.data_name)\n', (738, 781), T... |
import os
import sys
import json
import click
import datetime
from distutils.version import StrictVersion
from jinja2 import Template
ROOTDIR = os.getcwd()
INITIAL_VERSION = '0.0.0'
DEFAULT_TEMPLATE = """# Changelog
Note: version releases in the 0.x.y range may introduce breaking changes.
{% for release in releases %}... | [
"jinja2.Template",
"os.remove",
"json.load",
"os.makedirs",
"os.getcwd",
"os.path.isdir",
"click.echo",
"json.dumps",
"datetime.datetime.utcnow",
"os.rmdir",
"click.secho",
"os.path.join",
"os.listdir",
"sys.exit"
] | [((145, 156), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (154, 156), False, 'import os\n'), ((542, 572), 'os.path.join', 'os.path.join', (['path', '""".changes"""'], {}), "(path, '.changes')\n", (554, 572), False, 'import os\n'), ((605, 640), 'os.path.join', 'os.path.join', (['path', '""".semversioner"""'], {}), "(pat... |
import requests as rq
from sys import stdout
from pathlib import Path
import re
import os
class Downloader:
"""
class to manage downloading url links
"""
def __init__(self, *args, session=None): # creates a session
self.cwd = Path.cwd()
self.src_path = Path(__file__)
... | [
"sys.stdout.write",
"os.remove",
"re.split",
"requests.Session",
"pathlib.Path",
"re.findall",
"pathlib.Path.cwd",
"re.search"
] | [((5953, 5980), 'pathlib.Path', 'Path', (['"""/home/bruno/Desktop"""'], {}), "('/home/bruno/Desktop')\n", (5957, 5980), False, 'from pathlib import Path\n'), ((262, 272), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (270, 272), False, 'from pathlib import Path\n'), ((298, 312), 'pathlib.Path', 'Path', (['__file__'... |
import random
import chess
import chess.engine
class RandomPlayer:
def __init__(self):
self.id = {
'name': 'RandomPlayer'
}
def play(self, board: chess.Board, limit=None) -> chess.engine.PlayResult:
legal_moves = list(board.legal_moves)
move = random.choice(legal_... | [
"chess.engine.PlayResult",
"random.choice"
] | [((300, 326), 'random.choice', 'random.choice', (['legal_moves'], {}), '(legal_moves)\n', (313, 326), False, 'import random\n'), ((343, 390), 'chess.engine.PlayResult', 'chess.engine.PlayResult', ([], {'move': 'move', 'ponder': 'None'}), '(move=move, ponder=None)\n', (366, 390), False, 'import chess\n')] |
# dwmDistances
# Being written September 2019 by <NAME>
# Intended for use with DWM 1001 module through UART TLV interface
# This script calls the dwm_loc_get API call as specified in the
# DWM1001 Firmware API Guide 5.3.10.
# It parses the information received to send over
# the ROS network.
# In the future, this scri... | [
"serial.Serial",
"argparse.ArgumentParser"
] | [((933, 989), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""get position info"""'}), "(description='get position info')\n", (956, 989), False, 'import argparse\n'), ((2274, 2326), 'serial.Serial', 'serial.Serial', (['myPort'], {'baudrate': '(115200)', 'timeout': 'None'}), '(myPort, baud... |
import logging
from abc import ABC
class LoggingBase(ABC):
def __init__(self, log_level: int) -> None:
self.logger = logging.getLogger(self.__class__.__name__)
self.logger.setLevel(log_level)
@property
def log_level(self) -> int:
self.logger.level | [
"logging.getLogger"
] | [((137, 179), 'logging.getLogger', 'logging.getLogger', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (154, 179), False, 'import logging\n')] |
from tracking import generate_new_tracking_key, register_event
from django.core.urlresolvers import reverse
from django.conf import settings
USER_TRACKING_LOG_HTML_FRAGMENT_RESPONSE = getattr(settings, "USER_TRACKING_LOG_HTML_FRAGMENT_RESPONSE", False)
class UserTrackingMiddleware(object):
def process_request(se... | [
"tracking.register_event",
"django.core.urlresolvers.reverse",
"tracking.generate_new_tracking_key"
] | [((813, 852), 'django.core.urlresolvers.reverse', 'reverse', (['"""user_tracking_register_event"""'], {}), "('user_tracking_register_event')\n", (820, 852), False, 'from django.core.urlresolvers import reverse\n'), ((854, 885), 'django.core.urlresolvers.reverse', 'reverse', (['"""user_tracking_verify"""'], {}), "('user... |
#!/usr/bin/python
import re
import subprocess
class workspaces():
@staticmethod
def _cmd(*args):
return subprocess.Popen(args, stdout=subprocess.PIPE).stdout.read().decode("utf-8")
@staticmethod
def get_display_size():
size = (re.split(' *', workspaces._cmd('wmctrl', '-d').replace("\n"... | [
"subprocess.Popen",
"re.split"
] | [((1480, 1503), 're.split', 're.split', (['""" *"""', 'desc', '(3)'], {}), "(' *', desc, 3)\n", (1488, 1503), False, 'import re\n'), ((121, 167), 'subprocess.Popen', 'subprocess.Popen', (['args'], {'stdout': 'subprocess.PIPE'}), '(args, stdout=subprocess.PIPE)\n', (137, 167), False, 'import subprocess\n')] |
import configargparse
def parse_args() -> dict:
parser = configargparse.ArgParser(default_config_files=['config.ini'])
parser.add_argument('--madmin_url', required=True, type=str)
parser.add_argument('--madmin_user', required=False, default='', type=str)
parser.add_argument('--madmin_password', requir... | [
"configargparse.ArgParser"
] | [((63, 124), 'configargparse.ArgParser', 'configargparse.ArgParser', ([], {'default_config_files': "['config.ini']"}), "(default_config_files=['config.ini'])\n", (87, 124), False, 'import configargparse\n')] |
# -*- coding: utf-8 -*-
## ---------------------------------------------------------------------------
## Copyright 2019 Dynatrace LLC
##
## 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
##
#... | [
"alyeska.compose.DAG",
"alyeska.compose.DAG.validate_dependency",
"alyeska.compose.Task",
"collections.defaultdict",
"pathlib.Path",
"pytest.raises",
"alyeska.compose.DAG.from_yaml"
] | [((1596, 1627), 'alyeska.compose.Task', 'Task', (['"""make_tea.py"""', '"""test-env"""'], {}), "('make_tea.py', 'test-env')\n", (1600, 1627), False, 'from alyeska.compose import Task, DAG\n'), ((1644, 1676), 'alyeska.compose.Task', 'Task', (['"""drink_tea.py"""', '"""test-env"""'], {}), "('drink_tea.py', 'test-env')\n"... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# basic import
import os
import os.path as op
import sys
import time
sys.path.insert(0, op.join(op.dirname(__file__),'..','..'))
# python libs
import numpy as np
import xarray as xr
# custom libs
from teslakit.project_site import PathControl
from teslakit.extremes import... | [
"numpy.load",
"os.path.dirname",
"teslakit.extremes.FitGEV_KMA_Frechet",
"teslakit.project_site.PathControl",
"os.path.join"
] | [((408, 421), 'teslakit.project_site.PathControl', 'PathControl', ([], {}), '()\n', (419, 421), False, 'from teslakit.project_site import PathControl\n'), ((456, 515), 'os.path.join', 'op.join', (['p_tests', '"""ClimateEmulator"""', '"""gev_fit_kma_fretchet"""'], {}), "(p_tests, 'ClimateEmulator', 'gev_fit_kma_fretchet... |
'''
Authentication urls for ToDos Users
Author: <NAME>
'''
from django.conf.urls import url
from . import views
# Authentiction urls
urlpatterns = [
url(r'^login/', views._login),
url(r'^signup/', views._register),
url(r'^change_password/', views._changePassword),
url(r'^logout/', views._logou... | [
"django.conf.urls.url"
] | [((163, 191), 'django.conf.urls.url', 'url', (['"""^login/"""', 'views._login'], {}), "('^login/', views._login)\n", (166, 191), False, 'from django.conf.urls import url\n'), ((198, 230), 'django.conf.urls.url', 'url', (['"""^signup/"""', 'views._register'], {}), "('^signup/', views._register)\n", (201, 230), False, 'f... |
from typing import List
from geneeval.fetcher.fetchers import Fetcher, LocalizationFetcher, SequenceFetcher, UniprotFetcher
class AutoFetcher:
"""A factory function which returns the correct data fetcher for the given `tasks`.
A `Fetcher` is returned which requests all the data relevant to `tasks` in a sing... | [
"geneeval.fetcher.fetchers.UniprotFetcher",
"geneeval.fetcher.fetchers.Fetcher"
] | [((723, 732), 'geneeval.fetcher.fetchers.Fetcher', 'Fetcher', ([], {}), '()\n', (730, 732), False, 'from geneeval.fetcher.fetchers import Fetcher, LocalizationFetcher, SequenceFetcher, UniprotFetcher\n'), ((760, 776), 'geneeval.fetcher.fetchers.UniprotFetcher', 'UniprotFetcher', ([], {}), '()\n', (774, 776), False, 'fr... |
import os, json
from typing import Dict, Iterable
from azure.cosmos import (CosmosClient,
PartitionKey,
ContainerProxy,
DatabaseProxy)
SETTINGS = dict(
HOST = os.getenv('COSMOSDB_HOST'),
MASTER_KEY = os.getenv('COSMOSDB_MASTER_KEY'),... | [
"azure.cosmos.CosmosClient",
"azure.cosmos.PartitionKey",
"os.getenv"
] | [((242, 268), 'os.getenv', 'os.getenv', (['"""COSMOSDB_HOST"""'], {}), "('COSMOSDB_HOST')\n", (251, 268), False, 'import os, json\n'), ((287, 319), 'os.getenv', 'os.getenv', (['"""COSMOSDB_MASTER_KEY"""'], {}), "('COSMOSDB_MASTER_KEY')\n", (296, 319), False, 'import os, json\n'), ((339, 372), 'os.getenv', 'os.getenv', ... |
import os
import sys
import cv2
import time
import caffe
import numpy as np
import config
sys.path.append('../')
from fast_mtcnn import fast_mtcnn
from gen_landmark import expand_mtcnn_box, is_valid_facebox, extract_baidu_lm72
from baidu import call_baidu_api
def create_net(model_dir, iter_num):
model_path = os.pa... | [
"sys.path.append",
"gen_landmark.extract_baidu_lm72",
"fast_mtcnn.fast_mtcnn",
"baidu.call_baidu_api",
"gen_landmark.is_valid_facebox",
"cv2.imwrite",
"gen_landmark.expand_mtcnn_box",
"time.sleep",
"cv2.imread",
"numpy.swapaxes",
"caffe.Net",
"os.path.join",
"cv2.resize"
] | [((90, 112), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (105, 112), False, 'import sys\n'), ((315, 380), 'os.path.join', 'os.path.join', (['model_dir', "('landmark_iter_%d.caffemodel' % iter_num)"], {}), "(model_dir, 'landmark_iter_%d.caffemodel' % iter_num)\n", (327, 380), False, 'import o... |
import uuid
import mongoengine as db
from flask import current_app as app
from flask_mongoengine import MongoEngine
class Properties:
name = "example"
nic = "example-nic"
disk = "example-disk"
vmId = str(uuid.uuid4())
subId = str(uuid.uuid4())
rgroup = "example-resource-group"
availabili... | [
"flask.current_app._get_current_object",
"mongoengine.StringField",
"uuid.uuid4",
"mongoengine.DictField"
] | [((444, 469), 'flask.current_app._get_current_object', 'app._get_current_object', ([], {}), '()\n', (467, 469), True, 'from flask import current_app as app\n'), ((519, 533), 'mongoengine.DictField', 'db.DictField', ([], {}), '()\n', (531, 533), True, 'import mongoengine as db\n'), ((545, 574), 'mongoengine.StringField'... |
from sendgrid.helpers.mail import Mail
from CommonCode.strings import Strings
class SendGridEmailHelper:
def builderToMail(self,emailBuilder):
fromId = Strings.getFormattedEmail(builder=emailBuilder.fromId);
toids = list()
for ids in emailBuilder.toId:
toids.append(Strings.get... | [
"sendgrid.helpers.mail.Mail",
"CommonCode.strings.Strings.getFormattedEmail"
] | [((167, 221), 'CommonCode.strings.Strings.getFormattedEmail', 'Strings.getFormattedEmail', ([], {'builder': 'emailBuilder.fromId'}), '(builder=emailBuilder.fromId)\n', (192, 221), False, 'from CommonCode.strings import Strings\n'), ((442, 521), 'sendgrid.helpers.mail.Mail', 'Mail', ([], {'from_email': 'fromId', 'to_ema... |
import json
import os
from typing import TextIO, Hashable, Iterator
from dateutil.parser import isoparse
from utils.sorts import Sort, Group
def parse_board(f: TextIO, card_mapping: dict[str, Hashable]) -> Sort:
"""
Extracts the information from a trello board json file.
A card_mapping maps the card pr... | [
"utils.sorts.Group",
"json.load",
"utils.sorts.Sort",
"dateutil.parser.isoparse",
"os.path.isfile",
"os.path.join",
"os.listdir"
] | [((649, 661), 'json.load', 'json.load', (['f'], {}), '(f)\n', (658, 661), False, 'import json\n'), ((2588, 2616), 'dateutil.parser.isoparse', 'isoparse', (["first_list['date']"], {}), "(first_list['date'])\n", (2596, 2616), False, 'from dateutil.parser import isoparse\n'), ((2632, 2661), 'dateutil.parser.isoparse', 'is... |
import abc
import logging
import math
import random
from orca.grid import BANG_GLYPH, COMMENT_GLYPH, DOT_GLYPH, MidiNoteOnEvent
from orca.ports import InputPort, OutputPort
logger = logging.getLogger(__name__)
OUTPUT_PORT_NAME = "output"
class IOperator(abc.ABC):
def __init__(
self, grid, x, y, name, ... | [
"orca.grid.MidiNoteOnEvent",
"random.randint",
"logging.warn",
"math.floor",
"orca.ports.InputPort",
"orca.ports.OutputPort",
"logging.getLogger"
] | [((185, 212), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (202, 212), False, 'import logging\n'), ((13052, 13077), 'random.randint', 'random.randint', (['low', 'high'], {}), '(low, high)\n', (13066, 13077), False, 'import random\n'), ((14333, 14377), 'orca.ports.InputPort', 'InputPort'... |
""" example plugin to extend a /test route """
from fastapi import APIRouter
router = APIRouter()
@router.get("/test")
async def tester():
""" test route """
return [{"result": "test"}]
| [
"fastapi.APIRouter"
] | [((87, 98), 'fastapi.APIRouter', 'APIRouter', ([], {}), '()\n', (96, 98), False, 'from fastapi import APIRouter\n')] |
import os
import sys
from setuptools import setup, find_packages
from fnmatch import fnmatchcase
from distutils.util import convert_path
standard_exclude = ('*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build', './dist', 'EGG-INFO', '*.egg-info')
def find_package_dat... | [
"os.path.isdir",
"distutils.util.convert_path",
"fnmatch.fnmatchcase",
"os.path.join",
"os.listdir",
"setuptools.find_packages"
] | [((567, 584), 'os.listdir', 'os.listdir', (['where'], {}), '(where)\n', (577, 584), False, 'import os\n'), ((2940, 2955), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (2953, 2955), False, 'from setuptools import setup, find_packages\n'), ((449, 468), 'distutils.util.convert_path', 'convert_path', (['w... |
import math
import zlib
from time import sleep
import struct
from timeout_decorator import timeout
from timeout_decorator.timeout_decorator import TimeoutError
from pycrc.algorithms import Crc
from .ISPChip import ISPChip
NXPReturnCodes = {
"CMD_SUCCESS" : 0x0,
"INVALID_COMMAND" ... | [
"struct.unpack",
"pycrc.algorithms.Crc",
"struct.pack",
"time.sleep",
"timeout_decorator.timeout",
"zlib.crc32"
] | [((3023, 3125), 'pycrc.algorithms.Crc', 'Crc', ([], {'width': '(32)', 'poly': 'polynomial', 'reflect_in': '(True)', 'xor_in': '((1 << 32) - 1)', 'reflect_out': '(True)', 'xor_out': '(0)'}), '(width=32, poly=polynomial, reflect_in=True, xor_in=(1 << 32) - 1,\n reflect_out=True, xor_out=0)\n', (3026, 3125), False, 'fr... |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'MozSpace'
db.create_table('mozspaces_mozspace', (
('id', self.gf('django.db.mo... | [
"south.db.db.delete_table",
"south.db.db.send_create_signal"
] | [((1650, 1698), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""mozspaces"""', "['MozSpace']"], {}), "('mozspaces', ['MozSpace'])\n", (1671, 1698), False, 'from south.db import db\n'), ((2118, 2165), 'south.db.db.send_create_signal', 'db.send_create_signal', (['"""mozspaces"""', "['Keyword']"], {}), "(... |
"""One-off functions"""
import urllib.parse, random, string
def load_yaml(path):
import yaml
try:
with open(path, 'r') as yaml_file:
data = yaml.load(yaml_file, Loader=yaml.FullLoader)
return data
except FileNotFoundError:
raise FileNotFoundError('could not load yaml at... | [
"yaml.load",
"random.choice"
] | [((170, 214), 'yaml.load', 'yaml.load', (['yaml_file'], {'Loader': 'yaml.FullLoader'}), '(yaml_file, Loader=yaml.FullLoader)\n', (179, 214), False, 'import yaml\n'), ((1046, 1068), 'random.choice', 'random.choice', (['letters'], {}), '(letters)\n', (1059, 1068), False, 'import urllib.parse, random, string\n')] |
# This file is depreciated. Controls had to be hard coded into app.py in the translate_static function. Babel could not translate from this file.
from flask_babel import Babel, _
# Controls for webapp
station_name_options = [
{'label': _('Resolute Bay, No. W. Territories'), 'value': 'Resolute Bay, No. W. Territor... | [
"flask_babel._"
] | [((242, 279), 'flask_babel._', '_', (['"""Resolute Bay, No. W. Territories"""'], {}), "('Resolute Bay, No. W. Territories')\n", (243, 279), False, 'from flask_babel import Babel, _\n'), ((341, 369), 'flask_babel._', '_', (['"""Blossom Point, Maryland"""'], {}), "('Blossom Point, Maryland')\n", (342, 369), False, 'from ... |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: command.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
fr... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper",
"google.protobuf.descriptor_pool.Default",
"google.protobuf.reflection.GeneratedProtocolMessageType"
] | [((531, 557), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (555, 557), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1468, 1511), 'google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper', 'enum_type_wrapper.EnumTypeWrapper', (['_CMDTYPE'], ... |
import argparse
import sys
from frankapy import FrankaArm
from frankapy import FrankaConstants as FC
def wait_for_enter():
if sys.version_info[0] < 3:
raw_input('Press Enter to continue:')
else:
input('Press Enter to continue:')
if __name__ == '__main__':
parser = argparse.ArgumentParser()... | [
"argparse.ArgumentParser",
"frankapy.FrankaArm"
] | [((295, 320), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (318, 320), False, 'import argparse\n'), ((523, 534), 'frankapy.FrankaArm', 'FrankaArm', ([], {}), '()\n', (532, 534), False, 'from frankapy import FrankaArm\n')] |
import hashlib
import json
import logging
from collections.abc import Mapping, Sequence
from typing import Any, List, Tuple
from nested_lookup import nested_lookup
from ordered_set import OrderedSet
from .pointer import fragment_decode, fragment_encode
LOG = logging.getLogger(__name__)
NON_MERGABLE_KEYS = ("uniqueI... | [
"hashlib.md5",
"nested_lookup.nested_lookup",
"json.dumps",
"ordered_set.OrderedSet",
"logging.getLogger"
] | [((262, 289), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (279, 289), False, 'import logging\n'), ((623, 636), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (634, 636), False, 'import hashlib\n'), ((3992, 4022), 'nested_lookup.nested_lookup', 'nested_lookup', (['REF', 'sub_schema'], ... |
# pylint: disable=redefined-outer-name,unused-variable,expression-not-assigned
import pytest
from click.testing import CliRunner
from expecter import expect
from slackoff.cli import main
@pytest.fixture
def runner():
return CliRunner()
def describe_cli():
def describe_signout():
def it_can_force_s... | [
"expecter.expect",
"click.testing.CliRunner"
] | [((232, 243), 'click.testing.CliRunner', 'CliRunner', ([], {}), '()\n', (241, 243), False, 'from click.testing import CliRunner\n'), ((414, 438), 'expecter.expect', 'expect', (['result.exit_code'], {}), '(result.exit_code)\n', (420, 438), False, 'from expecter import expect\n'), ((456, 477), 'expecter.expect', 'expect'... |
# coding: utf-8
import re
from inner_reuse import chunks
class Ptr(object):
"""
Contain operation data
"""
def __init__(self, pos, type_key):
self.position = pos
self.type_response = type_key
self.name_test = None
self.out = ""
def __repr__(self):
return s... | [
"re.finditer"
] | [((1327, 1347), 're.finditer', 're.finditer', (['OK', 'out'], {}), '(OK, out)\n', (1338, 1347), False, 'import re\n'), ((1409, 1433), 're.finditer', 're.finditer', (['FAILED', 'out'], {}), '(FAILED, out)\n', (1420, 1433), False, 'import re\n'), ((1492, 1513), 're.finditer', 're.finditer', (['RUN', 'out'], {}), '(RUN, o... |
import numpy
import pandas as pd
import matplotlib.pyplot as plt
from sklearn.metrics import r2_score
x = [1,2,3,4]
x=numpy.array(x)
print(x.shape)
x=x.reshape(2,-1)
print(x.shape)
print(x)
x=x.reshape(-1)
print(x.shape)
print(x)
y = [2,4,6,8]
#x*2=[2,4,6,8]
#x*x=[1,4,9,16]
#sum(x) = 10
pf=numpy.polyfit(x,y,3)
print... | [
"numpy.poly1d",
"numpy.array",
"numpy.polyfit"
] | [((119, 133), 'numpy.array', 'numpy.array', (['x'], {}), '(x)\n', (130, 133), False, 'import numpy\n'), ((294, 316), 'numpy.polyfit', 'numpy.polyfit', (['x', 'y', '(3)'], {}), '(x, y, 3)\n', (307, 316), False, 'import numpy\n'), ((349, 365), 'numpy.poly1d', 'numpy.poly1d', (['pf'], {}), '(pf)\n', (361, 365), False, 'im... |
#!/usr/bin/python
from ConfigParser import SafeConfigParser
import os
import string
class baseObj:
def __init__(self, multiProcess, userAgent, outputFolderName, outputFolder, deleteOutput, dateFormat, useTor, torIP, torPort, redirectLimit, hashCountLimit, urlCharLimit, osintDays, malShareApiKey, disableMalShare... | [
"ConfigParser.SafeConfigParser",
"os.path.join"
] | [((1391, 1409), 'ConfigParser.SafeConfigParser', 'SafeConfigParser', ([], {}), '()\n', (1407, 1409), False, 'from ConfigParser import SafeConfigParser\n'), ((1656, 1695), 'os.path.join', 'os.path.join', (['rootDir', 'outputFolderName'], {}), '(rootDir, outputFolderName)\n', (1668, 1695), False, 'import os\n'), ((1426, ... |
# -*- coding: utf-8 -*-
from pathlib import Path
import pytest
import manimpango
from . import CASES_DIR
from ._manim import MarkupText
from .svg_tester import SVGStyleTester
ipsum_text = (
"<b>Lorem ipsum dolor</b> sit amet, <i>consectetur</i> adipiscing elit,"
"sed do eiusmod tempor incididunt ut labore e... | [
"pytest.mark.parametrize",
"pathlib.Path",
"manimpango.MarkupUtils.validate"
] | [((720, 785), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""text"""', "['foo', '<b>bar</b>', 'வணக்கம்']"], {}), "('text', ['foo', '<b>bar</b>', 'வணக்கம்'])\n", (743, 785), False, 'import pytest\n'), ((924, 985), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""text"""', "['<b>foo', '<xyz>foo</x... |
"""
API do Gerenciador de Casas de Aluguel
======================================
"""
# https://www.pythoncentral.io/introduction-to-sqlite-in-python/
import sqlite3
import config
def make_connection():
return sqlite3.connect(config.DATABASE_URL)
class InquilinoException(Exception):
...
class CasaExcept... | [
"sqlite3.connect"
] | [((220, 256), 'sqlite3.connect', 'sqlite3.connect', (['config.DATABASE_URL'], {}), '(config.DATABASE_URL)\n', (235, 256), False, 'import sqlite3\n')] |
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: list_tool.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf i... | [
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.reflection.GeneratedProtocolMessageType"
] | [((463, 489), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (487, 489), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((8908, 9058), 'google.protobuf.reflection.GeneratedProtocolMessageType', '_reflection.GeneratedProtocolMessageType', (['"""ListT... |
import argparse
import os
import re
import sys
from inc.HRDF.Stops_Reporter.stops_reporter import HRDF_Stops_Reporter
from inc.HRDF.HRDF_Parser.hrdf_helpers import compute_formatted_date_from_hrdf_db_path
from inc.HRDF.db_helpers import compute_db_tables_report
parser = argparse.ArgumentParser(description = 'Generate... | [
"inc.HRDF.db_helpers.compute_db_tables_report",
"argparse.ArgumentParser",
"sys.exit"
] | [((273, 346), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Generate stops report from HRDF DB"""'}), "(description='Generate stops report from HRDF DB')\n", (296, 346), False, 'import argparse\n'), ((531, 572), 'inc.HRDF.db_helpers.compute_db_tables_report', 'compute_db_tables_report',... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainwindow.ui'
#
# Created by: PyQt5 UI code generator 5.13.0
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow)... | [
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QGridLayout",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtWidgets.QMenuBar"
] | [((437, 466), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['MainWindow'], {}), '(MainWindow)\n', (454, 466), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((555, 596), 'PyQt5.QtWidgets.QGridLayout', 'QtWidgets.QGridLayout', (['self.centralwidget'], {}), '(self.centralwidget)\n', (576, 596), False, 'from ... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from .models import Post, Category, Tag
from typeidea.custom_site import custom_site
from django.utils.html import format_html
from django.core.urlresolvers import reverse
from .adminforms import PostAdminForm
from typeide... | [
"django.contrib.admin.register",
"django.core.urlresolvers.reverse"
] | [((389, 427), 'django.contrib.admin.register', 'admin.register', (['Post'], {'site': 'custom_site'}), '(Post, site=custom_site)\n', (403, 427), False, 'from django.contrib import admin\n'), ((1616, 1658), 'django.contrib.admin.register', 'admin.register', (['Category'], {'site': 'custom_site'}), '(Category, site=custom... |
from adabelief_pytorch import AdaBelief
import torch_optimizer
from torch import optim
from src.sam import SAM
__OPTIMIZERS__ = {
"AdaBelief": AdaBelief,
"RAdam": torch_optimizer.RAdam,
"SAM": SAM
}
def get_optimizer(cfg, model):
optimizer_name = cfg.optimizer.name
if optimizer_name == "SAM":
... | [
"torch.optim.__getattribute__"
] | [((539, 582), 'torch.optim.__getattribute__', 'optim.__getattribute__', (['base_optimizer_name'], {}), '(base_optimizer_name)\n', (561, 582), False, 'from torch import optim\n'), ((835, 873), 'torch.optim.__getattribute__', 'optim.__getattribute__', (['optimizer_name'], {}), '(optimizer_name)\n', (857, 873), False, 'fr... |
import numpy as np
import tensorflow as tf
import random
import _pickle as pkl
import matplotlib.pyplot as plt
from pylab import rcParams
import scipy
import scipy.stats as stats
from tensorflow.python.ops import gen_nn_ops
config_gpu = tf.ConfigProto()
config_gpu.gpu_options.allow_growth = True
MEAN_IMAGE = np.zeros(... | [
"tensorflow.reduce_sum",
"numpy.abs",
"tensorflow.keras.losses.MSE",
"numpy.argmax",
"numpy.clip",
"tensorflow.ConfigProto",
"numpy.mean",
"numpy.arange",
"numpy.linalg.norm",
"numpy.random.normal",
"_pickle.load",
"numpy.zeros_like",
"tensorflow.nn.top_k",
"tensorflow.placeholder",
"num... | [((237, 253), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {}), '()\n', (251, 253), True, 'import tensorflow as tf\n'), ((598, 626), 'numpy.zeros', 'np.zeros', (['(100, 227, 227, 3)'], {}), '((100, 227, 227, 3))\n', (606, 626), True, 'import numpy as np\n'), ((635, 648), 'numpy.zeros', 'np.zeros', (['(100)'], {}), ... |
"""Implementation of the setuptools command 'pyecore'."""
import collections
import contextlib
import distutils.log as logger
import logging
import pathlib
import shlex
import pyecore.resources
import pyecoregen.ecore
import setuptools
class PyEcoreCommand(setuptools.Command):
"""A setuptools command for generat... | [
"distutils.log.warn",
"logging.basicConfig",
"shlex.split",
"collections.defaultdict",
"pathlib.Path"
] | [((2409, 2448), 'shlex.split', 'shlex.split', (['self.output'], {'comments': '(True)'}), '(self.output, comments=True)\n', (2420, 2448), False, 'import shlex\n'), ((2471, 2509), 'collections.defaultdict', 'collections.defaultdict', (['(lambda : None)'], {}), '(lambda : None)\n', (2494, 2509), False, 'import collections... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 21 15:05:24 2018
@author: Hendry
"""
from read_data import *
from TokenizeSentences import *
import numpy as np
def onehot(data,nClass):
data2 = np.zeros([len(data),nClass])
for i in range(nClass):
data2[np.where(data==i),i]= 1
return data2
... | [
"numpy.argwhere",
"numpy.where",
"numpy.array",
"numpy.unique"
] | [((2079, 2103), 'numpy.array', 'np.array', (['trainTitleDocs'], {}), '(trainTitleDocs)\n', (2087, 2103), True, 'import numpy as np\n'), ((2117, 2136), 'numpy.array', 'np.array', (['trainDocs'], {}), '(trainDocs)\n', (2125, 2136), True, 'import numpy as np\n'), ((2151, 2171), 'numpy.array', 'np.array', (['trainTitle'], ... |
import os
import sys
from pathlib import Path
sys.path.insert(0, os.path.abspath('..'))
import googlemaps_helpers
ROOT = Path('.')
DATA_DIR = Path('tests/data') | [
"pathlib.Path",
"os.path.abspath"
] | [((123, 132), 'pathlib.Path', 'Path', (['"""."""'], {}), "('.')\n", (127, 132), False, 'from pathlib import Path\n'), ((144, 162), 'pathlib.Path', 'Path', (['"""tests/data"""'], {}), "('tests/data')\n", (148, 162), False, 'from pathlib import Path\n'), ((66, 87), 'os.path.abspath', 'os.path.abspath', (['""".."""'], {})... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This module contains the base classes used
when defining mutation strategies for pfp
"""
import glob
import os
import six
get_strategy = None
StratGroup = None
FieldStrat = None
def init():
global get_strategy
global StratGroup
global FieldStrat
i... | [
"os.path.dirname",
"pfp.fuzz.rand.sample",
"six.moves.range",
"os.path.basename"
] | [((2442, 2462), 'six.moves.range', 'six.moves.range', (['num'], {}), '(num)\n', (2457, 2462), False, 'import six\n'), ((623, 651), 'os.path.basename', 'os.path.basename', (['strat_file'], {}), '(strat_file)\n', (639, 651), False, 'import os\n'), ((567, 592), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(_... |
import torch
def is_pos_def(x):
if torch.equal(x, x.t()):
try:
torch.linalg.cholesky(x)
return True
except RuntimeError:
return False
else:
return False
| [
"torch.linalg.cholesky"
] | [((88, 112), 'torch.linalg.cholesky', 'torch.linalg.cholesky', (['x'], {}), '(x)\n', (109, 112), False, 'import torch\n')] |
from rest_framework import serializers
from accounts.serializers import UserSerializer
from .models import Story
class StorySerializer(serializers.ModelSerializer):
user = UserSerializer(read_only=True)
class Meta:
model = Story
fields = [
"id",
"title",
"s... | [
"rest_framework.serializers.ValidationError",
"accounts.serializers.UserSerializer"
] | [((178, 208), 'accounts.serializers.UserSerializer', 'UserSerializer', ([], {'read_only': '(True)'}), '(read_only=True)\n', (192, 208), False, 'from accounts.serializers import UserSerializer\n'), ((918, 997), 'rest_framework.serializers.ValidationError', 'serializers.ValidationError', (['"""One of story_url or story_b... |
#!/usr/bin/env python
#
# Author: <NAME>.
# Created: Dec 11, 2014.
"""Some utility functions to handle images."""
import math
import numpy as np
import PIL.Image
from PIL.Image import ROTATE_180, ROTATE_90, ROTATE_270, FLIP_TOP_BOTTOM, FLIP_LEFT_RIGHT
import skimage.transform
def imcast(img, dtype, color_space="defa... | [
"math.sqrt",
"numpy.empty",
"numpy.asarray",
"numpy.zeros",
"numpy.array"
] | [((7824, 7872), 'numpy.empty', 'np.empty', (['mosaic_image_shape'], {'dtype': 'mosaic_dtype'}), '(mosaic_image_shape, dtype=mosaic_dtype)\n', (7832, 7872), True, 'import numpy as np\n'), ((4631, 4644), 'numpy.array', 'np.array', (['img'], {}), '(img)\n', (4639, 4644), True, 'import numpy as np\n'), ((7259, 7281), 'nump... |
# -*- coding:utf-8 -*-
import os
import sys
import numpy as np
from simulater import Simulater
from play_back import PlayBack, PlayBacks
COMMAND = ['UP', 'DOWN', 'LEFT', 'RIGHT']
def get_max_command(target_dict):
return max([(v,k) for k,v in target_dict.items()])[1]
def simplify(command):
return command[... | [
"numpy.random.uniform",
"simulater.Simulater",
"play_back.PlayBacks",
"numpy.random.normal",
"numpy.random.choice",
"play_back.PlayBack"
] | [((768, 788), 'simulater.Simulater', 'Simulater', (['file_name'], {}), '(file_name)\n', (777, 788), False, 'from simulater import Simulater\n'), ((1127, 1138), 'play_back.PlayBacks', 'PlayBacks', ([], {}), '()\n', (1136, 1138), False, 'from play_back import PlayBack, PlayBacks\n'), ((929, 947), 'numpy.random.normal', '... |
from numpy.linalg import cholesky
import numpy as np
def senti2cate(x):
if x<=-0.6:
return 0
elif x>-0.6 and x<=-0.2:
return 1
elif x>-0.2 and x<0.2:
return 2
elif x>=0.2 and x<0.6:
return 3
elif x>=0.6:
return 4
def dcg_score(y_true, y_score,... | [
"numpy.random.uniform",
"numpy.sum",
"numpy.zeros",
"numpy.argsort",
"numpy.mean",
"numpy.array",
"numpy.take",
"numpy.random.multivariate_normal",
"numpy.reshape",
"numpy.cov",
"numpy.repeat"
] | [((379, 405), 'numpy.take', 'np.take', (['y_true', 'order[:k]'], {}), '(y_true, order[:k])\n', (386, 405), True, 'import numpy as np\n'), ((497, 522), 'numpy.sum', 'np.sum', (['(gains / discounts)'], {}), '(gains / discounts)\n', (503, 522), True, 'import numpy as np\n'), ((757, 779), 'numpy.take', 'np.take', (['y_true... |
# Databricks notebook source
# MAGIC %md
# MAGIC ### Ingest qualifying json files
# COMMAND ----------
dbutils.widgets.text("p_data_source", "")
v_data_source = dbutils.widgets.get("p_data_source")
# COMMAND ----------
dbutils.widgets.text("p_file_date", "2021-03-21")
v_file_date = dbutils.widgets.get("p_file_date"... | [
"pyspark.sql.functions.lit",
"pyspark.sql.types.IntegerType",
"pyspark.sql.types.StringType"
] | [((2387, 2403), 'pyspark.sql.functions.lit', 'lit', (['v_file_date'], {}), '(v_file_date)\n', (2390, 2403), False, 'from pyspark.sql.functions import lit\n'), ((2340, 2358), 'pyspark.sql.functions.lit', 'lit', (['v_data_source'], {}), '(v_data_source)\n', (2343, 2358), False, 'from pyspark.sql.functions import lit\n'),... |
from __future__ import annotations
import typing
from typing_extensions import TypedDict
from ctc import evm
from ctc import rpc
from ctc import spec
old_pool_factory = '0x0959158b6040d32d04c301a72cbfd6b39e21c9ae'
pool_factory = '0xb9fc157394af804a3578134a6585c0dc9cc990d4'
eth_address = '0xeeeeeeeeeeeeeeeeeeeeeeeeee... | [
"asyncio.gather",
"ctc.evm.async_get_erc20s_balance_of",
"ctc.evm.async_get_eth_balance",
"ctc.evm.async_get_events",
"pandas.concat",
"ctc.evm.async_get_erc20s_symbols",
"ctc.rpc.async_eth_call"
] | [((3506, 3520), 'pandas.concat', 'pd.concat', (['dfs'], {}), '(dfs)\n', (3515, 3520), True, 'import pandas as pd\n'), ((5805, 5819), 'pandas.concat', 'pd.concat', (['dfs'], {}), '(dfs)\n', (5814, 5819), True, 'import pandas as pd\n'), ((669, 735), 'ctc.rpc.async_eth_call', 'rpc.async_eth_call', ([], {'to_address': 'fac... |
import numpy as np
import re
lineRegex = re.compile(r"(turn on|turn off|toggle) (\d+),(\d+) through (\d+),(\d+)")
def day6(fileName):
lights = np.zeros((1000, 1000), dtype=bool)
with open(fileName) as infile:
for line in infile:
match = lineRegex.match(line)
if match:
for x in range(int(match[2]), int(m... | [
"numpy.zeros",
"re.compile"
] | [((42, 117), 're.compile', 're.compile', (['"""(turn on|turn off|toggle) (\\\\d+),(\\\\d+) through (\\\\d+),(\\\\d+)"""'], {}), "('(turn on|turn off|toggle) (\\\\d+),(\\\\d+) through (\\\\d+),(\\\\d+)')\n", (52, 117), False, 'import re\n'), ((146, 180), 'numpy.zeros', 'np.zeros', (['(1000, 1000)'], {'dtype': 'bool'}), ... |
import requests,time,gevent,gevent.monkey,re,os
from threading import Thread
import schedule
from pyquery import PyQuery as pq
gevent.monkey.patch_socket()
url="http://tieba.baidu.com/mo/q---F55A5B1F58548A7A5403ABA7602FEBAE%3AFG%3D1--1-1-0--2--wapp_1510665393192_464/sign?tbs=af62312bf49309c61510669752&fid=152744&kw="
... | [
"schedule.run_pending",
"threading.Thread",
"re.compile",
"os.getcwd",
"requests.Session",
"time.sleep",
"gevent.monkey.patch_socket",
"requests.get",
"schedule.every",
"gevent.spawn",
"gevent.joinall"
] | [((127, 155), 'gevent.monkey.patch_socket', 'gevent.monkey.patch_socket', ([], {}), '()\n', (153, 155), False, 'import requests, time, gevent, gevent.monkey, re, os\n'), ((770, 788), 'requests.Session', 'requests.Session', ([], {}), '()\n', (786, 788), False, 'import requests, time, gevent, gevent.monkey, re, os\n'), (... |
# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from __future__ import print_function
import codecs
import errno
import re
import os
import os.path
import shutil
import ... | [
"os.remove",
"llnl.util.tty.warn",
"spack.util.url.local_file_path",
"shutil.copy",
"os.path.dirname",
"os.path.exists",
"traceback.format_exc",
"itertools.product",
"ssl._create_unverified_context",
"html.parser.HTMLParser.__init__",
"re.search",
"os.path.basename",
"os.rename",
"shutil.c... | [((3683, 3702), 'spack.util.url.parse', 'url_util.parse', (['url'], {}), '(url)\n', (3697, 3702), True, 'import spack.util.url as url_util\n'), ((5817, 5944), 'llnl.util.tty.warn', 'tty.warn', (['"""Spack will not check SSL certificates. You need to update your Python to enable certificate verification."""'], {}), "(\n... |
from typing import Tuple
from Simulation import Simulation
from hydrocarbon_problem.api.api_base import BaseAspenDistillationAPI
from hydrocarbon_problem.api.types import StreamSpecification, ColumnInputSpecification, \
ColumnOutputSpecification, ProductSpecification, PerCompoundProperty
PATH = 'C:/Users/s2199718... | [
"Simulation.Simulation",
"hydrocarbon_problem.api.api_tests.test_api",
"hydrocarbon_problem.api.types.PerCompoundProperty",
"hydrocarbon_problem.api.types.ColumnOutputSpecification"
] | [((8061, 8080), 'hydrocarbon_problem.api.api_tests.test_api', 'test_api', (['aspen_api'], {}), '(aspen_api)\n', (8069, 8080), False, 'from hydrocarbon_problem.api.api_tests import test_api\n'), ((481, 520), 'Simulation.Simulation', 'Simulation', ([], {'PATH': 'PATH', 'VISIBILITY': '(False)'}), '(PATH=PATH, VISIBILITY=F... |
import random
def ReLU(x, derivative=False):
""" ReLU function with corresponding derivative """
if derivative:
x[x <= 0] = 0
x[x > 0] = 1
return x
x[x < 0] = 0
return x
def ReLU_uniform_random():
""" Ideal weight starting values for ReLU """
return random.uniform(0.00... | [
"random.uniform"
] | [((301, 327), 'random.uniform', 'random.uniform', (['(0.005)', '(0.2)'], {}), '(0.005, 0.2)\n', (315, 327), False, 'import random\n'), ((442, 463), 'random.uniform', 'random.uniform', (['(-1)', '(1)'], {}), '(-1, 1)\n', (456, 463), False, 'import random\n')] |
#!/bin/python
import unittest
import logging
import os
import sys
from src.message import message
class message_test(unittest.TestCase):
def test_from_message_record(self):
message_record = message(
msg_id=185,
channel_id=82,
... | [
"unittest.main",
"src.message.message",
"src.message.message.from_message_record"
] | [((1720, 1735), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1733, 1735), False, 'import unittest\n'), ((204, 300), 'src.message.message', 'message', ([], {'msg_id': '(185)', 'channel_id': '(82)', 'source_id': '(50)', 'source_chat_id': '"""111111"""', 'msg': '"""Hello world"""'}), "(msg_id=185, channel_id=82, s... |
from sqlalchemy import Column, Integer, String, Date
from sqlalchemy.ext.associationproxy import association_proxy
from sqlalchemy.orm import relationship
from app.db.session import Base
from app.models import CharacterEpisode
class Episode(Base):
__tablename__ = "episode"
id = Column(Integer, primary_key=T... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.Column",
"app.models.CharacterEpisode"
] | [((291, 336), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)', 'index': '(True)'}), '(Integer, primary_key=True, index=True)\n', (297, 336), False, 'from sqlalchemy import Column, Integer, String, Date\n'), ((348, 375), 'sqlalchemy.Column', 'Column', (['String'], {'unique': '(True)'}), '(String, u... |
import json
#hack for python2 support
try:
from .blkdiscoveryutil import *
except:
from blkdiscoveryutil import *
class LsBlk(BlkDiscoveryUtil):
def disks(self):
retval = []
parent = self.details()
for path, diskdetails in parent.items():
if not diskdetails.get('type') ... | [
"pprint.PrettyPrinter",
"json.loads"
] | [((1317, 1347), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(4)'}), '(indent=4)\n', (1337, 1347), False, 'import pprint\n'), ((946, 967), 'json.loads', 'json.loads', (['rawoutput'], {}), '(rawoutput)\n', (956, 967), False, 'import json\n')] |