code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 21 17:26:11 2019
@author: samghosal
"""
from __future__ import division
"""----------------------------------------------------------------------------------------------
README: Simple Python Code for Testing and evaluating the trained CNN mo... | [
"matplotlib.pyplot.ylabel",
"gzip.open",
"sklearn.metrics.classification_report",
"keras.utils.to_categorical",
"numpy.arange",
"matplotlib.pyplot.imshow",
"keras.backend.image_data_format",
"tensorflow.Session",
"matplotlib.pyplot.xlabel",
"numpy.random.seed",
"tensorflow.ConfigProto",
"sklea... | [((1102, 1144), 'keras.backend.tensorflow_backend._get_available_gpus', 'K.tensorflow_backend._get_available_gpus', ([], {}), '()\n', (1142, 1144), True, 'from keras import backend as K\n'), ((1154, 1193), 'tensorflow.ConfigProto', 'tf.ConfigProto', ([], {'device_count': "{'GPU': 1}"}), "(device_count={'GPU': 1})\n", (... |
from portfolio import Portfolio, PM
import datetime as dt
from collections import OrderedDict
import utility
import copy
import numpy as np
class Backtester:
def __init__(self, universeObj, start=None, end=None):
if start is None:
start = universeObj.dateRange[0]
if end is None:
... | [
"collections.OrderedDict",
"portfolio.Portfolio",
"copy.deepcopy",
"portfolio.PM.getPortfolioDateRange",
"numpy.datetime64",
"datetime.timedelta"
] | [((937, 970), 'copy.deepcopy', 'copy.deepcopy', (['self.universe.data'], {}), '(self.universe.data)\n', (950, 970), False, 'import copy\n'), ((1771, 1784), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1782, 1784), False, 'from collections import OrderedDict\n'), ((588, 632), 'portfolio.PM.getPortfolioDa... |
# Graphics for Exploratory Analysis Script
# ==============================================================================
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# ^^^ pyforest auto-imports - don't write above this line
# ========================================... | [
"numpy.abs",
"seaborn.regplot",
"matplotlib.pyplot.savefig",
"numpy.sqrt",
"matplotlib.pyplot.xticks",
"seaborn.distplot",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"seaborn.diverging_palette",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.bar",
"seab... | [((949, 997), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'nrows': '(3)', 'ncols': '(1)', 'figsize': '(15, 10)'}), '(nrows=3, ncols=1, figsize=(15, 10))\n', (961, 997), True, 'import matplotlib.pyplot as plt\n'), ((1002, 1120), 'seaborn.distplot', 'sns.distplot', (['df[target]'], {'hist': '(False)', 'rug': '(Tr... |
"""This script logs metadata to mlflow server."""
import argparse
import cb_flavor
import json
import joblib
import mlflow
from mlflow.tracking import MlflowClient
import mlflow.sklearn
import os
import pandas as pd
from typing import Text
import yaml
from src.utils.errors import UnknownEstimatorError
from src.utils.... | [
"cb_flavor.log_model",
"src.utils.logging.get_logger",
"src.utils.errors.UnknownEstimatorError",
"argparse.ArgumentParser",
"mlflow.start_run",
"mlflow.tracking.MlflowClient",
"pandas.read_csv",
"json.dumps",
"mlflow.log_artifact",
"mlflow.sklearn.log_model",
"joblib.load",
"json.load",
"src... | [((1592, 1628), 'src.utils.logging.get_logger', 'get_logger', (['"""LOG_METRICS"""', 'log_level'], {}), "('LOG_METRICS', log_level)\n", (1602, 1628), False, 'from src.utils.logging import get_logger\n'), ((1832, 1846), 'mlflow.tracking.MlflowClient', 'MlflowClient', ([], {}), '()\n', (1844, 1846), False, 'from mlflow.t... |
from collections import deque
class PushSwapStacks:
"""
describe stacks for push-swap algorithm
"""
def __init__(self, initstate):
""" initstate: Iterable[_T]=..."""
self.stack_a = deque()
self.stack_b = deque()
self.new_data(initstate)
self.cmd = {
'pa': self.pa,
'pb': self.pb,
'sa': self.sa,... | [
"collections.deque"
] | [((192, 199), 'collections.deque', 'deque', ([], {}), '()\n', (197, 199), False, 'from collections import deque\n'), ((217, 224), 'collections.deque', 'deque', ([], {}), '()\n', (222, 224), False, 'from collections import deque\n')] |
import logging
from datetime import datetime
import zmq
from .handler import Handler
LOGGER = logging.getLogger(__name__)
class ZmqHandler(Handler):
"""Zmq handler.
"""
def __init__(self, connection, **kwargs):
"""Constructor.
"""
super().__init__(**kwargs)
self._connec... | [
"logging.getLogger",
"zmq.Context"
] | [((97, 124), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (114, 124), False, 'import logging\n'), ((362, 375), 'zmq.Context', 'zmq.Context', ([], {}), '()\n', (373, 375), False, 'import zmq\n')] |
import gpu
import bgl
from gpu_extras.batch import batch_for_shader
class BL_UI_Widget:
def __init__(self, x, y, width, height):
self.x = x
self.y = y
self.x_screen = x
self.y_screen = y
self.width = width
self.height = height
self._bg_color = (0.8, 0.8... | [
"gpu.shader.from_builtin",
"gpu_extras.batch.batch_for_shader",
"bgl.glDisable",
"bgl.glEnable"
] | [((1052, 1078), 'bgl.glEnable', 'bgl.glEnable', (['bgl.GL_BLEND'], {}), '(bgl.GL_BLEND)\n', (1064, 1078), False, 'import bgl\n'), ((1131, 1158), 'bgl.glDisable', 'bgl.glDisable', (['bgl.GL_BLEND'], {}), '(bgl.GL_BLEND)\n', (1144, 1158), False, 'import bgl\n'), ((1901, 1944), 'gpu.shader.from_builtin', 'gpu.shader.from_... |
import random
import discord
from discord.ext import commands
class RNG (commands.Cog):
def __init__ (self, bot):
self.bot = bot
def get_online_users (self, member_list):
online = []
for u in member_list:
if u.status == discord.Status.online and u.bot == False:
... | [
"random.choice",
"discord.ext.commands.guild_only",
"discord.ext.commands.group",
"random.command",
"random.randint"
] | [((381, 436), 'discord.ext.commands.group', 'commands.group', ([], {'name': '"""random"""', 'aliases': "['rng', 'lucky']"}), "(name='random', aliases=['rng', 'lucky'])\n", (395, 436), False, 'from discord.ext import commands\n'), ((619, 666), 'random.command', 'random.command', ([], {'name': '"""user"""', 'aliases': "[... |
import logging
import os
import os.path as osp
from tempfile import TemporaryDirectory
import pdal
import laspy
from tqdm import tqdm
from lidar_prod.tasks.utils import get_pdal_reader, get_pdal_writer, split_idx_by_dim
log = logging.getLogger(__name__)
class BuildingCompletor:
"""Logic of building completion.
... | [
"logging.getLogger",
"tempfile.TemporaryDirectory",
"pdal.Filter.ferry",
"lidar_prod.tasks.utils.split_idx_by_dim",
"pdal.Filter.cluster",
"tqdm.tqdm",
"pdal.Pipeline",
"os.path.dirname",
"lidar_prod.tasks.utils.get_pdal_writer",
"pdal.Filter.assign",
"os.path.basename",
"laspy.read",
"lidar... | [((228, 255), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (245, 255), False, 'import logging\n'), ((3145, 3160), 'pdal.Pipeline', 'pdal.Pipeline', ([], {}), '()\n', (3158, 3160), False, 'import pdal\n'), ((3181, 3210), 'lidar_prod.tasks.utils.get_pdal_reader', 'get_pdal_reader', (['src... |
from pathlib import Path
import pytest
from zoloto.calibration import parse_calibration_file
def test_loading_missing_file() -> None:
filename = Path("doesnt-exist.xml")
assert not filename.exists()
with pytest.raises(FileNotFoundError):
parse_calibration_file(filename)
def test_loading_exampl... | [
"pytest.raises",
"zoloto.calibration.parse_calibration_file",
"pathlib.Path"
] | [((153, 177), 'pathlib.Path', 'Path', (['"""doesnt-exist.xml"""'], {}), "('doesnt-exist.xml')\n", (157, 177), False, 'from pathlib import Path\n'), ((370, 442), 'zoloto.calibration.parse_calibration_file', 'parse_calibration_file', (["(fixtures_dir / 'example-calibreation-params.xml')"], {}), "(fixtures_dir / 'example-... |
import datetime
import json
from functools import reduce
__days = [
"Måndag",
"Tisdag",
"Onsdag",
"Torsdag",
"Fredag"
]
__weekly_headers = [
"Alltid på Platz",
"<NAME>",
"Veckans vegetariska"
]
def name():
return "Schnitzelplatz"
def food(api, date):
def collapse_paragraphs(ps... | [
"functools.reduce"
] | [((413, 460), 'functools.reduce', 'reduce', (["(lambda acc, s: acc + ' ' + s)", 'kv[1]', '""""""'], {}), "(lambda acc, s: acc + ' ' + s, kv[1], '')\n", (419, 460), False, 'from functools import reduce\n')] |
from kalamari import Node
import pytest
@pytest.fixture
def node_w_children():
root = Node("root")
students_node = Node("students",root)
student_one_name = Node("name", students_node)
student_one_name.add_value("Theo")
student_two_name = Node("name", students_node)
student_two_name.add_value... | [
"kalamari.Node"
] | [((92, 104), 'kalamari.Node', 'Node', (['"""root"""'], {}), "('root')\n", (96, 104), False, 'from kalamari import Node\n'), ((125, 147), 'kalamari.Node', 'Node', (['"""students"""', 'root'], {}), "('students', root)\n", (129, 147), False, 'from kalamari import Node\n'), ((171, 198), 'kalamari.Node', 'Node', (['"""name"... |
""":mod:`ShopOfOffers` -- Contains the ShopOfOffers class
.. module:: ShopOfOffers
:synopsis: Contains the ShopOfOffers class
.. moduleauthor:: <NAME> <<EMAIL>>
"""
from neolib.daily.Daily import Daily
from neolib.exceptions import dailyAlreadyDone
from neolib.exceptions import parseException
import logging
class... | [
"logging.getLogger"
] | [((1025, 1058), 'logging.getLogger', 'logging.getLogger', (['"""neolib.daily"""'], {}), "('neolib.daily')\n", (1042, 1058), False, 'import logging\n')] |
from libs.config import alias
from libs.myapp import send, color, print_tree
from libs.functions.webshell_plugins.fl import *
from json import JSONDecodeError
def get_php(file_path: str):
return get_php_fl() % file_path
@alias(True, _type="DETECT", fp="web_file_path")
def run(web_file_path: str = "/var"):
"... | [
"libs.config.alias",
"libs.myapp.send",
"libs.myapp.print_tree",
"libs.myapp.color.red"
] | [((229, 276), 'libs.config.alias', 'alias', (['(True)'], {'_type': '"""DETECT"""', 'fp': '"""web_file_path"""'}), "(True, _type='DETECT', fp='web_file_path')\n", (234, 276), False, 'from libs.config import alias\n'), ((664, 700), 'libs.myapp.print_tree', 'print_tree', (['web_file_path', 'file_tree'], {}), '(web_file_pa... |
import math
import torch
from torch import nn as nn
class JSD(nn.Module):
def __init__(self):
super().__init__()
def forward(self, x, eps=1e-8):
logN = math.log(float(x.shape[0]))
y = torch.mean(x, 0)
y = y * (y + eps).log() / logN
y = y.sum()
x = x * (x + e... | [
"torch.mean"
] | [((221, 237), 'torch.mean', 'torch.mean', (['x', '(0)'], {}), '(x, 0)\n', (231, 237), False, 'import torch\n'), ((521, 537), 'torch.mean', 'torch.mean', (['x', '(0)'], {}), '(x, 0)\n', (531, 537), False, 'import torch\n')] |
import os
import sys
sys.path.append(os.path.normpath(os.path.join(os.path.abspath(__file__), '..', '..', '..', "common")))
from env_indigo import *
indigo = Indigo()
# indigo::SmilesLoader::Error
try:
m = indigo.loadMolecule('CX')
except IndigoException as e:
print(getIndigoExceptionText(e))
# IndigoError
t... | [
"os.path.abspath"
] | [((67, 92), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (82, 92), False, 'import os\n')] |
# Example 2
# Import and initialize pygame
import pygame
pygame.init()
# Configure the screen
screen = pygame.display.set_mode([500, 500])
# Game Object
class GameObject(pygame.sprite.Sprite):
def __init__(self, x, y, image):
super(GameObject, self).__init__()
self.surf = pygame.image.load(image)
self.... | [
"pygame.init",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.flip",
"pygame.image.load"
] | [((58, 71), 'pygame.init', 'pygame.init', ([], {}), '()\n', (69, 71), False, 'import pygame\n'), ((104, 139), 'pygame.display.set_mode', 'pygame.display.set_mode', (['[500, 500]'], {}), '([500, 500])\n', (127, 139), False, 'import pygame\n'), ((581, 599), 'pygame.event.get', 'pygame.event.get', ([], {}), '()\n', (597, ... |
# Copyright 2022 iiPython
# Modules
import os
import time
import string
import random
from hashlib import sha256
from src.config import config
from iipython import Connection
# Initialization
_max_filesize = config.get("max_file_size", 5) * (1024 ** 2)
_max_msglength = config.get("max_msg_len", 400)
_files_container ... | [
"os.listdir",
"random.choice",
"os.path.join",
"os.path.dirname",
"os.path.isdir",
"os.mkdir",
"time.time",
"src.config.config.get"
] | [((272, 302), 'src.config.config.get', 'config.get', (['"""max_msg_len"""', '(400)'], {}), "('max_msg_len', 400)\n", (282, 302), False, 'from src.config import config\n'), ((210, 240), 'src.config.config.get', 'config.get', (['"""max_file_size"""', '(5)'], {}), "('max_file_size', 5)\n", (220, 240), False, 'from src.con... |
from torchvision import transforms
import torch
from torchvision import datasets
from torch.utils.data import DataLoader, WeightedRandomSampler
import numpy as np
image_transforms = {
# Train uses data augmentation
'train':
transforms.Compose([
transforms.RandomResizedCrop(size=256, scale=(0.8, 1.0... | [
"torchvision.transforms.CenterCrop",
"torchvision.transforms.RandomRotation",
"torchvision.transforms.RandomHorizontalFlip",
"torch.tensor",
"torchvision.datasets.ImageFolder",
"torchvision.transforms.ColorJitter",
"torchvision.transforms.Normalize",
"torch.utils.data.DataLoader",
"torchvision.trans... | [((2023, 2056), 'torch.tensor', 'torch.tensor', (['dataset_obj.targets'], {}), '(dataset_obj.targets)\n', (2035, 2056), False, 'import torch\n'), ((1310, 1398), 'torchvision.datasets.ImageFolder', 'datasets.ImageFolder', ([], {'root': "(datadir + '/train/')", 'transform': "image_transforms['train']"}), "(root=datadir +... |
import os
import csv
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.utils import shuffle
import cv2
from keras.models import Sequential
from keras.layers import Flatten, Dense, Lambda, Conv2D, MaxPooling2D, Cropping2D, Dropout
import pickle
from keras.callbacks import TensorBoard, ... | [
"keras.layers.Conv2D",
"pickle.dump",
"keras.layers.Flatten",
"keras.callbacks.ModelCheckpoint",
"cv2.flip",
"sklearn.model_selection.train_test_split",
"sklearn.utils.shuffle",
"keras.layers.Lambda",
"os.path.join",
"keras.models.Sequential",
"keras.callbacks.TensorBoard",
"numpy.array",
"k... | [((735, 775), 'sklearn.model_selection.train_test_split', 'train_test_split', (['samples'], {'test_size': '(0.2)'}), '(samples, test_size=0.2)\n', (751, 775), False, 'from sklearn.model_selection import train_test_split\n'), ((1974, 1986), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1984, 1986), False, ... |
"""Run Scripts from Command Line"""
from src.preprocess import make_dataset
from src.train import train_model
from src.evaluation import single_customer_evaluation, root_mean_squared_error
if __name__ == '__main__':
make_dataset()
train_model()
freq_predictions, freq_holdout = single_customer_evaluation(t... | [
"src.evaluation.root_mean_squared_error",
"src.train.train_model",
"src.preprocess.make_dataset",
"src.evaluation.single_customer_evaluation"
] | [((222, 236), 'src.preprocess.make_dataset', 'make_dataset', ([], {}), '()\n', (234, 236), False, 'from src.preprocess import make_dataset\n'), ((241, 254), 'src.train.train_model', 'train_model', ([], {}), '()\n', (252, 254), False, 'from src.train import train_model\n'), ((292, 334), 'src.evaluation.single_customer_e... |
from numpy import genfromtxt
import matplotlib
# matplotlib.use('Agg')
import matplotlib.pyplot as plt
''' ResNet-56 '''
train_error_52 = './epoch_error_train_52.csv'
train_error_52 = genfromtxt(train_error_52, delimiter=',')
valid_error_52 = './epoch_error_valid_52.csv'
valid_error_52 = genfromtxt(valid_error_52, de... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.ticklabel_format",
"matplotlib.pyplot.title",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.ylim",
"numpy.genfrom... | [((186, 227), 'numpy.genfromtxt', 'genfromtxt', (['train_error_52'], {'delimiter': '""","""'}), "(train_error_52, delimiter=',')\n", (196, 227), False, 'from numpy import genfromtxt\n'), ((291, 332), 'numpy.genfromtxt', 'genfromtxt', (['valid_error_52'], {'delimiter': '""","""'}), "(valid_error_52, delimiter=',')\n", (... |
"""Collection of classes for processed datasets."""
import os
import random
from glob import glob
from typing import List, Tuple
import numpy as np
import torch.utils.data
import torchvision.transforms
from facenet_pytorch import fixed_image_standardization
from torch import Tensor
from src.features import transform
... | [
"random.shuffle",
"os.path.join",
"os.path.splitext",
"src.features.transform.images_to_tensors",
"os.path.basename",
"numpy.load"
] | [((827, 850), 'numpy.load', 'np.load', (['self._filepath'], {}), '(self._filepath)\n', (834, 850), True, 'import numpy as np\n'), ((1257, 1293), 'src.features.transform.images_to_tensors', 'transform.images_to_tensors', (['*images'], {}), '(*images)\n', (1284, 1293), False, 'from src.features import transform\n'), ((20... |
# -*- coding: utf-8 -*-
'''
常量
'''
from django.utils.translation import ugettext_lazy as _
# ------审核规则 ReviewRule --------
REVIEWRULE_WORKMODE = (
(u'outbound', _(u'外发')),
(u'allsend', _(u'所有')),
)
REVIEWRULE_LOGIC = (
(u'all', _(u'满足所有条件')),
(u'one', _(u'满足一条即可')),
)
REVIEWRULE_PREACTION = (
... | [
"django.utils.translation.ugettext_lazy"
] | [((169, 177), 'django.utils.translation.ugettext_lazy', '_', (['u"""外发"""'], {}), "(u'外发')\n", (170, 177), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((197, 205), 'django.utils.translation.ugettext_lazy', '_', (['u"""所有"""'], {}), "(u'所有')\n", (198, 205), True, 'from django.utils.translation im... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`Quantulum` unit and entity loading functions.
"""
import json
from collections import defaultdict
from pathlib import Path
from typing import Any, List, Tuple, Union
from . import classes as c
from . import language
TOPDIR = Path(__file__).parent or Path(".")
... | [
"json.load",
"collections.defaultdict",
"pathlib.Path"
] | [((2608, 2625), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (2619, 2625), False, 'from collections import defaultdict\n'), ((2641, 2658), 'collections.defaultdict', 'defaultdict', (['dict'], {}), '(dict)\n', (2652, 2658), False, 'from collections import defaultdict\n'), ((309, 318), 'pathlib.P... |
"""Setup script."""
from setuptools import find_packages, setup
with open("requirements.txt") as f:
requirements = f.read().splitlines()
setup(
name='aiofirebase',
version='0.2.0',
packages=find_packages(),
description='Asyncio Firebase client library',
author='<NAME>',
author_email='<EMAI... | [
"setuptools.find_packages"
] | [((208, 223), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (221, 223), False, 'from setuptools import find_packages, setup\n')] |
# Generated by Django 2.1.3 on 2018-11-25 05:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0019_auto_20181125_0501'),
]
operations = [
migrations.AlterField(
model_name='reference',
name='title_origi... | [
"django.db.models.CharField"
] | [((353, 408), 'django.db.models.CharField', 'models.CharField', ([], {'blank': '(True)', 'max_length': '(255)', 'null': '(True)'}), '(blank=True, max_length=255, null=True)\n', (369, 408), False, 'from django.db import migrations, models\n')] |
from __future__ import print_function
import time
from pyinstrument import Profiler
# Utilities #
def do_nothing():
pass
def busy_wait(duration):
end_time = time.time() + duration
while time.time() < end_time:
do_nothing()
def long_function_a():
time.sleep(0.25)
def long_function_b():
... | [
"pyinstrument.Profiler",
"time.time",
"time.sleep"
] | [((276, 292), 'time.sleep', 'time.sleep', (['(0.25)'], {}), '(0.25)\n', (286, 292), False, 'import time\n'), ((321, 336), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (331, 336), False, 'import time\n'), ((412, 422), 'pyinstrument.Profiler', 'Profiler', ([], {}), '()\n', (420, 422), False, 'from pyinstrument... |
#!/usr/bin/env python
import csv
import os
import sys
import argparse
from decimal import *
from datetime import datetime
def parse_args():
parser = argparse.ArgumentParser()
parser._action_groups.pop()
# parser.add_argument('-b', '--begin_date', help="Begin date (inclusive)", type=lambda s: d... | [
"datetime.datetime.strptime",
"csv.reader",
"argparse.ArgumentParser",
"sys.exit"
] | [((165, 190), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (188, 190), False, 'import argparse\n'), ((1871, 1893), 'csv.reader', 'csv.reader', (['fills_file'], {}), '(fills_file)\n', (1881, 1893), False, 'import csv\n'), ((2651, 2702), 'datetime.datetime.strptime', 'datetime.strptime', (["tra... |
# Import tree from the sklearn library so that you can use that to train your data
from sklearn import tree
#Extract your feature from the object on which behave you are training the tree to pridect your result , here i extracted the feature from the fruits such as - texture and wieght .
features = [[150, 0], [170... | [
"sklearn.tree.DecisionTreeClassifier"
] | [((512, 541), 'sklearn.tree.DecisionTreeClassifier', 'tree.DecisionTreeClassifier', ([], {}), '()\n', (539, 541), False, 'from sklearn import tree\n')] |
# merkletree/__init__.py
"""
MerkleTree, a tree structure in which each component node as an SHA
hash associated with it. If it is a leaf, this is the hash of its
contents. If it is a tree or a document, it is the hash of the hashes
of its immediate children.
"""
import binascii
import os
import re
import sys
from ... | [
"re.compile",
"xlcrypto.SP.get_spaces",
"xlcrypto.hash.XLSHA2",
"xlcrypto.hash.XLSHA3",
"os.path.exists",
"os.listdir",
"stat.S_ISDIR",
"xlutil.make_match_re",
"xlu.file_sha3bin",
"binascii.b2a_hex",
"re.match",
"os.path.isfile",
"xlu.file_blake2b_256_bin",
"os.lstat",
"xlcrypto.hash.XLS... | [((4957, 5025), 're.compile', 're.compile', (['"""^([0-9a-f]{40}) ([a-z0-9_\\\\-\\\\./!:]+/)$"""', 're.IGNORECASE'], {}), "('^([0-9a-f]{40}) ([a-z0-9_\\\\-\\\\./!:]+/)$', re.IGNORECASE)\n", (4967, 5025), False, 'import re\n'), ((5080, 5148), 're.compile', 're.compile', (['"""^([0-9a-f]{64}) ([a-z0-9_\\\\-\\\\./!:]+/)$"... |
import re
from xkeysnail.transform import K, define_keymap, set_mark, with_mark
define_keymap(
lambda wm_class: wm_class not in ("Gnome-terminal", "Alacritty", "kitty"),
{
# cousor
K("LC-A"): with_mark(K("home")),
K("LC-E"): with_mark(K("end")),
K("LC-P"): K("UP"),
K("L... | [
"xkeysnail.transform.set_mark",
"xkeysnail.transform.K",
"re.compile"
] | [((1011, 1039), 're.compile', 're.compile', (['"""Gnome-terminal"""'], {}), "('Gnome-terminal')\n", (1021, 1039), False, 'import re\n'), ((207, 216), 'xkeysnail.transform.K', 'K', (['"""LC-A"""'], {}), "('LC-A')\n", (208, 216), False, 'from xkeysnail.transform import K, define_keymap, set_mark, with_mark\n'), ((248, 25... |
from requests.models import Response
import requests
import random
import time
class WebRequest(object):
def __init__(self, *args, **kwargs):
pass
@property
def cookies(self):
return requests.session()
@property
def user_agent(self):
ua_list = [
# 'Mozilla/5.0... | [
"requests.models.Response",
"requests.session",
"random.choice",
"time.sleep",
"requests.get"
] | [((214, 232), 'requests.session', 'requests.session', ([], {}), '()\n', (230, 232), False, 'import requests\n'), ((2516, 2538), 'random.choice', 'random.choice', (['ua_list'], {}), '(ua_list)\n', (2529, 2538), False, 'import random\n'), ((3066, 3127), 'requests.get', 'requests.get', (['url'], {'headers': 'headers', 'ti... |
# Copyright 2021 University of Nottingham Ningbo China
# Author: <NAME> <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | [
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.create_engine",
"datetime.datetime.fromtimestamp",
"sqlalchemy.orm.declarative_base"
] | [((847, 866), 'sqlalchemy.create_engine', 'create_engine', (['host'], {}), '(host)\n', (860, 866), False, 'from sqlalchemy import create_engine\n'), ((883, 901), 'sqlalchemy.orm.declarative_base', 'declarative_base', ([], {}), '()\n', (899, 901), False, 'from sqlalchemy.orm import declarative_base, sessionmaker\n'), ((... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | [
"mindspore.nn.SequentialCell",
"mindspore.nn.AvgPool2d",
"mindspore.nn.MaxPool2d",
"mindspore.nn.BatchNorm2d",
"math.sqrt",
"mindspore.nn.Conv2d",
"mindspore.nn.Pad",
"mindspore.nn.ReLU",
"mindspore.nn.Dense",
"src.net_utils.load_pretrained"
] | [((1367, 1516), 'mindspore.nn.Conv2d', 'nn.Conv2d', (['in_planes', 'out_planes'], {'kernel_size': 'kernel_size', 'stride': 'stride', 'pad_mode': '"""pad"""', 'padding': 'full_padding', 'dilation': 'dilation', 'has_bias': '(False)'}), "(in_planes, out_planes, kernel_size=kernel_size, stride=stride,\n pad_mode='pad', ... |
'''
Created on Apr 15, 2016
Evaluate the performance of Top-K recommendation:
Protocol: leave-1-out evaluation
Measures: Hit Ratio and NDCG
(more details are in: <NAME>, et al. Fast Matrix Factorization for Online Recommendation with Implicit Feedback. SIGIR'16)
@author: hexiangnan
'''
import math
... | [
"numpy.array",
"time.time",
"math.log"
] | [((4202, 4208), 'time.time', 'time', ([], {}), '()\n', (4206, 4208), False, 'from time import time\n'), ((1067, 1082), 'numpy.array', 'np.array', (['items'], {}), '(items)\n', (1075, 1082), True, 'import numpy as np\n'), ((1767, 1782), 'numpy.array', 'np.array', (['items'], {}), '(items)\n', (1775, 1782), True, 'import... |
from django.db import models
class Student(models.Model):
last_name = models.CharField(max_length=20)
middle_name = models.CharField(max_length=20)
first_name = models.CharField(max_length=20)
roll_no = models.CharField(max_length=20)
email_id = models.EmailField(max_length=30)
password=models... | [
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((76, 107), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)'}), '(max_length=20)\n', (92, 107), False, 'from django.db import models\n'), ((126, 157), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(20)'}), '(max_length=20)\n', (142, 157), False, 'from django.db impo... |
import unittest
from Ranger.src.Collections.RangeMap import RangeMap
from Ranger.src.Range.Range import Range
debug = False
class RangeMapTest(unittest.TestCase):
""" Unit Tests for RangeMap.py """
def test_contains(self):
if debug: print("Testing contains")
theMap = RangeMap()
theMap.... | [
"Ranger.src.Collections.RangeMap.RangeMap",
"Ranger.src.Range.Range.Range.closed",
"Ranger.src.Range.Range.Range.openClosed",
"Ranger.src.Range.Range.Range.open",
"unittest.main",
"Ranger.src.Range.Range.Range.closedOpen"
] | [((5637, 5662), 'unittest.main', 'unittest.main', ([], {'exit': '(False)'}), '(exit=False)\n', (5650, 5662), False, 'import unittest\n'), ((294, 304), 'Ranger.src.Collections.RangeMap.RangeMap', 'RangeMap', ([], {}), '()\n', (302, 304), False, 'from Ranger.src.Collections.RangeMap import RangeMap\n'), ((877, 887), 'Ran... |
#!/usr/bin/env python
from __future__ import print_function
"""
python marcc_reads.py dry
for dry run: write scripts but doesn't sbatch them
python marcc_reads.py wet
for normal run: write scripts and also sbatch them
"""
import os
import sys
import time
idx = 0
mem_gb = 64
hours = 16
jobs = 0
def mkdir_quiet(... | [
"os.path.exists",
"os.makedirs",
"os.path.join",
"time.sleep",
"os.path.isdir",
"os.path.abspath",
"os.system",
"os.walk"
] | [((2912, 2924), 'os.walk', 'os.walk', (['"""."""'], {}), "('.')\n", (2919, 2924), False, 'import os\n'), ((393, 410), 'os.path.isdir', 'os.path.isdir', (['dr'], {}), '(dr)\n', (406, 410), False, 'import os\n'), ((437, 452), 'os.makedirs', 'os.makedirs', (['dr'], {}), '(dr)\n', (448, 452), False, 'import os\n'), ((636, ... |
import numpy as np
import scipy.io as spio
from . import calc_R1_function_python_GEN
def calculate_r1_factor(proj, proj_angles, atom_positions, atomic_spec, atomic_numbers,
resolution,z_direction, b_factor, h_factor, axis_convention):
Result = calc_R1_function_python_GEN.calc_R1_function_... | [
"numpy.array"
] | [((403, 421), 'numpy.array', 'np.array', (['b_factor'], {}), '(b_factor)\n', (411, 421), True, 'import numpy as np\n'), ((423, 441), 'numpy.array', 'np.array', (['h_factor'], {}), '(h_factor)\n', (431, 441), True, 'import numpy as np\n'), ((443, 468), 'numpy.array', 'np.array', (['axis_convention'], {}), '(axis_convent... |
import re
txt = "The rain in Spain"
x = re.findall("^The.*Spain$", txt)
print(x)
txt = "The rain in Spain"
x = re.findall("Portugal", txt)
print(x)
txt = "The rain in Spain"
x = re.search("\s", txt)
print("The first white-space character is located in position:", x.start())
txt = "The rain in Spain"
x = re.split("\... | [
"re.split",
"re.findall",
"re.search"
] | [((41, 72), 're.findall', 're.findall', (['"""^The.*Spain$"""', 'txt'], {}), "('^The.*Spain$', txt)\n", (51, 72), False, 'import re\n'), ((113, 140), 're.findall', 're.findall', (['"""Portugal"""', 'txt'], {}), "('Portugal', txt)\n", (123, 140), False, 'import re\n'), ((181, 202), 're.search', 're.search', (['"""\\\\s"... |
from sub_capture_tool import SubCaptureTool
import numpy
import cv2
import time
time.sleep(3)
sct = SubCaptureTool()
j = 0
for i in range(60):
time.sleep(1)
for seg in sct.capture():
gray = cv2.cvtColor(seg, cv2.COLOR_RGB2GRAY)
gray, img_bin = cv2.threshold(gray,128,255, cv2.THRESH_BINARY | cv2... | [
"cv2.imwrite",
"cv2.threshold",
"sub_capture_tool.SubCaptureTool",
"time.sleep",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.cvtColor",
"cv2.bitwise_not",
"cv2.waitKey"
] | [((81, 94), 'time.sleep', 'time.sleep', (['(3)'], {}), '(3)\n', (91, 94), False, 'import time\n'), ((101, 117), 'sub_capture_tool.SubCaptureTool', 'SubCaptureTool', ([], {}), '()\n', (115, 117), False, 'from sub_capture_tool import SubCaptureTool\n'), ((433, 457), 'cv2.imshow', 'cv2.imshow', (['"""done"""', 'gray'], {}... |
# -*- coding: utf-8 -*-
"""
This file contains definition/implementation of a NodeObserver Class that Receives device notifications if NodeManager
finds Studer devices.
Inspired from and Based on hesso-valais/scom : devicesubscriber.py
<https://github.com/hesso-valais/scom/blob/0.7.3/src/sino/scom/dman/devicesubscriber... | [
"logging.getLogger"
] | [((2951, 3001), 'logging.getLogger', 'logging.getLogger', (["(__name__ + ':' + self.node_name)"], {}), "(__name__ + ':' + self.node_name)\n", (2968, 3001), False, 'import logging\n')] |
#!/usr/bin/env python3
import sys
import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5)
from PyQt5 import QtWidgets, QtCore, QtGui
from PyQt5.QtWidgets import QApplication, QMainWindow, QInputDialog, QFileDialog, QFrame, QMessageBox
from PyQt5.QtGui import QPalette, QColor, QIcon, QPixmap
from PyQt5.QtCore i... | [
"PyQt5.QtGui.QPalette",
"argparse.ArgumentParser",
"PyQt5.QtGui.QColor",
"sys.getrecursionlimit",
"PyQt5.QtWidgets.QApplication",
"sys.exit"
] | [((693, 817), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': 'program', 'description': '"""norse, nanopoore sequencing data transfer"""', 'usage': '"""norse [options]"""'}), "(prog=program, description=\n 'norse, nanopoore sequencing data transfer', usage='norse [options]')\n", (716, 817), False... |
"""
This file is part of the Semantic Quality Benchmark for Word Embeddings Tool in Python (SeaQuBe).
Copyright (c) 2021 by <NAME>
:author: <NAME>
"""
import copy
import time
from googletrans import Translator
from seaqube.augmentation.base import SingleprocessingAugmentation
from seaqube.nlp.tools i... | [
"seaqube.nlp.tools.tokenize_corpus",
"googletrans.Translator",
"copy.deepcopy",
"seaqube.package_config.log.info",
"time.time"
] | [((2218, 2230), 'googletrans.Translator', 'Translator', ([], {}), '()\n', (2228, 2230), False, 'from googletrans import Translator\n'), ((3409, 3420), 'time.time', 'time.time', ([], {}), '()\n', (3418, 3420), False, 'import time\n'), ((4493, 4549), 'seaqube.nlp.tools.tokenize_corpus', 'tokenize_corpus', (['texts[0:self... |
import supriya.osc
from supriya.commands.Request import Request
from supriya.enums import RequestId
class GroupQueryTreeRequest(Request):
"""
A /g_queryTree request.
::
>>> import supriya.commands
>>> request = supriya.commands.GroupQueryTreeRequest(
... node_id=0,
..... | [
"supriya.commands.Request.Request.__init__"
] | [((748, 770), 'supriya.commands.Request.Request.__init__', 'Request.__init__', (['self'], {}), '(self)\n', (764, 770), False, 'from supriya.commands.Request import Request\n')] |
import asyncio
import functools
import random
import time
import traceback
from random import shuffle
from discord import Embed
from musicbot import exceptions, spotify
from musicbot.entry import (GieselaEntry, RadioSongEntry, RadioStationEntry,
StreamEntry, TimestampEntry, YoutubeEntry)
f... | [
"musicbot.utils.hex_to_dec",
"musicbot.radio.RadioStations.get_random_station",
"musicbot.lib.ui.basic.LoadingBar",
"musicbot.utils.html2md",
"musicbot.utils.nice_cut",
"musicbot.utils.create_bar",
"musicbot.utils.ordinal",
"musicbot.radio.RadioStations.get_all_stations",
"musicbot.web_socket_server... | [((740, 868), 'musicbot.utils.command_info', 'command_info', (['"""2.0.2"""', '(1482252120)', "{'3.5.2': (1497712808, 'Updated help text'), '4.4.4': (1501504294,\n 'Fixed internal bug')}"], {}), "('2.0.2', 1482252120, {'3.5.2': (1497712808,\n 'Updated help text'), '4.4.4': (1501504294, 'Fixed internal bug')})\n",... |
from typing import Dict, Tuple
from unittest.mock import MagicMock
from urllib.parse import urljoin
import pytest
import requests
from pytest_mock.plugin import MockerFixture
from kinto_http import AsyncClient, Client
from kinto_http.constants import DEFAULT_AUTH, SERVER_URL, USER_AGENT
from kinto_http.endpoints impo... | [
"requests.post",
"kinto_http.exceptions.KintoException",
"kinto_http.endpoints.Endpoints",
"kinto_http.AsyncClient",
"kinto_http.Client",
"urllib.parse.urljoin",
"kinto_http.session.Session"
] | [((641, 688), 'kinto_http.AsyncClient', 'AsyncClient', ([], {'session': 'session', 'bucket': '"""mybucket"""'}), "(session=session, bucket='mybucket')\n", (652, 688), False, 'from kinto_http import AsyncClient, Client\n'), ((849, 891), 'kinto_http.Client', 'Client', ([], {'session': 'session', 'bucket': '"""mybucket"""... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-11 07:24
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('blog', '0001_initial'),
]
opera... | [
"django.db.models.ForeignKey",
"django.db.models.FileField",
"django.db.models.ImageField",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((435, 528), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (451, 528), False, 'from django.db import migrations, models\... |
from flask import Blueprint, current_app as app, request, jsonify, g
from flask_restx import Resource,Api
import sqlite3
import threading
import time
import serial
import datetime
from http import HTTPStatus
import json
from config import LOCAL_DATABASE_PATH,SERIAL_PORT, SERIAL_BOUND_SPEED, SENSOR_HR_THRESHOLD,SENSO... | [
"json.loads",
"sqlite3.connect",
"flask_restx.Api",
"serial.Serial",
"threading.Thread",
"datetime.date.today",
"flask.Blueprint"
] | [((375, 405), 'flask.Blueprint', 'Blueprint', (['"""measure"""', '__name__'], {}), "('measure', __name__)\n", (384, 405), False, 'from flask import Blueprint, current_app as app, request, jsonify, g\n'), ((420, 432), 'flask_restx.Api', 'Api', (['measure'], {}), '(measure)\n', (423, 432), False, 'from flask_restx import... |
from typing import List, Optional
from p1_utils.data_type import DataType
from p1_utils.errors import EquLabelRequiredError, EquDataTypeHasAmpersandError, DcInvalidError, \
NotFoundInSymbolTableError, ZeroDuplicationLengthError
from p1_utils.file_line import Line
from p2_assembly.mac0_generic import MacroGeneric
... | [
"p1_utils.errors.NotFoundInSymbolTableError",
"p1_utils.errors.DcInvalidError",
"p1_utils.errors.EquDataTypeHasAmpersandError",
"p1_utils.data_type.DataType",
"p1_utils.errors.EquLabelRequiredError"
] | [((3114, 3133), 'p1_utils.data_type.DataType', 'DataType', (['data_type'], {}), '(data_type)\n', (3122, 3133), False, 'from p1_utils.data_type import DataType\n'), ((6800, 6827), 'p1_utils.errors.EquLabelRequiredError', 'EquLabelRequiredError', (['line'], {}), '(line)\n', (6821, 6827), False, 'from p1_utils.errors impo... |
# Copyright (c) 2019, NVIDIA CORPORATION.
import warnings
from pyarrow import feather
from cudf.core.dataframe import DataFrame
from cudf.utils import ioutils
@ioutils.doc_read_feather()
def read_feather(path, *args, **kwargs):
"""{docstring}"""
warnings.warn(
"Using CPU via PyArrow to read feathe... | [
"cudf.utils.ioutils.doc_read_feather",
"cudf.utils.ioutils.doc_to_feather",
"pyarrow.feather.read_table",
"warnings.warn",
"cudf.core.dataframe.DataFrame.from_arrow",
"pyarrow.feather.write_feather"
] | [((165, 191), 'cudf.utils.ioutils.doc_read_feather', 'ioutils.doc_read_feather', ([], {}), '()\n', (189, 191), False, 'from cudf.utils import ioutils\n'), ((493, 517), 'cudf.utils.ioutils.doc_to_feather', 'ioutils.doc_to_feather', ([], {}), '()\n', (515, 517), False, 'from cudf.utils import ioutils\n'), ((260, 375), 'w... |
from rdflib import URIRef, Literal
from twisted.internet.defer import inlineCallbacks, returnValue
import treq
from light9 import networking
from light9.curvecalc.curve import CurveResource
from light9.namespaces import L9, RDF, RDFS
from rdfdb.patch import Patch
def clamp(x, lo, hi):
return max(lo, min(hi, x))
... | [
"twisted.internet.defer.returnValue",
"light9.curvecalc.curve.CurveResource",
"light9.networking.musicPlayer.path",
"rdflib.Literal",
"rdfdb.patch.Patch",
"rdflib.URIRef"
] | [((477, 494), 'twisted.internet.defer.returnValue', 'returnValue', (['body'], {}), '(body)\n', (488, 494), False, 'from twisted.internet.defer import inlineCallbacks, returnValue\n'), ((4982, 5003), 'rdflib.URIRef', 'URIRef', (["(uri + 'music')"], {}), "(uri + 'music')\n", (4988, 5003), False, 'from rdflib import URIRe... |
import sys
from progress.bar import FillingSquaresBar
from time import sleep
from colored import fg, bg, attr, fore, style
from colored import stylize
from functools import wraps
from colored import fg, bg, attr, fore, style
def prefix(item):
'''
This function decorates the other functions with bars
''' ... | [
"time.sleep",
"progress.bar.FillingSquaresBar",
"colored.fg",
"functools.wraps"
] | [((355, 365), 'functools.wraps', 'wraps', (['fun'], {}), '(fun)\n', (360, 365), False, 'from functools import wraps\n'), ((849, 859), 'functools.wraps', 'wraps', (['fun'], {}), '(fun)\n', (854, 859), False, 'from functools import wraps\n'), ((1926, 1945), 'colored.fg', 'fg', (['"""dodger_blue_1"""'], {}), "('dodger_blu... |
from pygame import *
from random import randint
# подгружаем отдельно функции для работы со шрифтом
font.init()
font1 = font.Font(None, 80)
back = (100, 100, 200)
lose = font1.render('YOU LOSE!', True, (180, 0, 0))
# класс-родитель для других спрайтов
class GameSprite(sprite.Sprite):
# конструктор класса
def _... | [
"random.randint"
] | [((1588, 1615), 'random.randint', 'randint', (['(80)', '(win_width - 80)'], {}), '(80, win_width - 80)\n', (1595, 1615), False, 'from random import randint\n')] |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'simsapa/assets/ui/links_browser_window.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
... | [
"PyQt5.QtWidgets.QSpinBox",
"PyQt5.QtGui.QIcon",
"PyQt5.QtWidgets.QPlainTextEdit",
"PyQt5.QtWidgets.QSizePolicy",
"PyQt5.QtWidgets.QVBoxLayout",
"PyQt5.QtWidgets.QComboBox",
"PyQt5.QtWidgets.QStatusBar",
"PyQt5.QtWidgets.QLineEdit",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtWidgets.QWidget",
"PyQt... | [((647, 684), 'PyQt5.QtWidgets.QWidget', 'QtWidgets.QWidget', (['LinksBrowserWindow'], {}), '(LinksBrowserWindow)\n', (664, 684), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((779, 821), 'PyQt5.QtWidgets.QHBoxLayout', 'QtWidgets.QHBoxLayout', (['self.central_widget'], {}), '(self.central_widget)\n', (800, 8... |
import os
import time
import tkinter.messagebox
from tkinter import *
from tkinter import filedialog, scrolledtext
import pandas as pd
import psycopg2
"""
NEED TO CHANGE THE SIZING FOR THIS WINDOW BECAUSE
IT THE TEXT BOXES ARE TOO BIG BUT I CAN SHRINK THE
SECTIONS FOR THE TEXT.
"""
tb = "inv_testing3"
con_path = r"... | [
"postgres_db.connect_to_database"
] | [((476, 497), 'postgres_db.connect_to_database', 'connect_to_database', ([], {}), '()\n', (495, 497), False, 'from postgres_db import connect_to_database\n')] |
import matplotlib
import matplotlib.pylab as plt
import os
import seaborn as sns
import pandas as pd
import numpy as np
def plot_graph(data, metric, plot_name, figsize, legend):
"""
Plot the input data to latex compatible .pgg format.
"""
pd.set_option('display.max_rows', None)
pd.set_option('di... | [
"matplotlib.pylab.subplots",
"seaborn.set",
"pandas.read_csv",
"os.makedirs",
"matplotlib.pylab.legend",
"seaborn.set_context",
"matplotlib.pylab.xlabel",
"os.path.abspath",
"pandas.set_option",
"seaborn.lineplot",
"os.path.isdir",
"pandas.DataFrame",
"pandas.concat",
"matplotlib.pylab.yla... | [((259, 298), 'pandas.set_option', 'pd.set_option', (['"""display.max_rows"""', 'None'], {}), "('display.max_rows', None)\n", (272, 298), True, 'import pandas as pd\n'), ((303, 345), 'pandas.set_option', 'pd.set_option', (['"""display.max_columns"""', 'None'], {}), "('display.max_columns', None)\n", (316, 345), True, '... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import socket
from enum import Enum
#from threading import Lock
from Utils import DebugLock as Lock
from Utils import Utils
try:
from SocketSelector import SocketSelector
from SocketPoller import SocketPoller, SocketPollFlag
except Exception ... | [
"SocketPoller.SocketPoller.get_instance",
"Utils.Utils.assertion",
"Utils.Utils.expects_type",
"Utils.Utils.print_exception",
"Utils.DebugLock"
] | [((331, 356), 'Utils.Utils.print_exception', 'Utils.print_exception', (['ex'], {}), '(ex)\n', (352, 356), False, 'from Utils import Utils\n'), ((461, 467), 'Utils.DebugLock', 'Lock', ([], {}), '()\n', (465, 467), True, 'from Utils import DebugLock as Lock\n'), ((4242, 4285), 'Utils.Utils.expects_type', 'Utils.expects_t... |
#!/usr/bin/env python3
import serial
import os
_serial = None
def close_connection():
if _serial is not None:
_serial.close()
def _init():
global _serial
try:
_serial = serial.Serial(os.getenv('DEVICE'), baudrate=9600, timeout=1, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, ... | [
"os.getenv"
] | [((216, 235), 'os.getenv', 'os.getenv', (['"""DEVICE"""'], {}), "('DEVICE')\n", (225, 235), False, 'import os\n')] |
from django.db import models
class Article(models.Model):
title = models.CharField(max_length=100)
slug = models.SlugField()
body = models.TextField()
date = models.DateTimeField(auto_now_add=True)
thumb = models.ImageField(default='deafult.png',blank=True)
def __str__(self):
r... | [
"django.db.models.TextField",
"django.db.models.ImageField",
"django.db.models.SlugField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((71, 103), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (87, 103), False, 'from django.db import models\n'), ((116, 134), 'django.db.models.SlugField', 'models.SlugField', ([], {}), '()\n', (132, 134), False, 'from django.db import models\n'), ((148, 166), 'dj... |
# -*- coding: utf-8 -*-
"""
@author:XuMing(<EMAIL>)
@description:
"""
import pycorrector
with open('eng_chi.txt', encoding='utf-8') as f1, open('a.txt', 'w', encoding='utf-8')as f2:
for line in f1:
line = line.strip()
parts = line.split('\t')
eng = parts[0]
chi = parts[1]
... | [
"pycorrector.traditional2simplified"
] | [((378, 417), 'pycorrector.traditional2simplified', 'pycorrector.traditional2simplified', (['chi'], {}), '(chi)\n', (412, 417), False, 'import pycorrector\n')] |
from enum import Enum, IntEnum
from math import isfinite
from typing import List, Optional, Union
from pydantic import validator
from geolib.geometry.one import Point
from geolib.models import BaseDataClass
from .soil_utils import Color
class SoilBaseModel(BaseDataClass):
@validator("*")
def fail_on_infini... | [
"geolib.models.dstability.internal.PersistableSuTable",
"math.isfinite",
"pydantic.validator",
"geolib.models.dsettlement.internal_soil.SoilInternal",
"geolib.models.dsheetpiling.settings.SoilTypeModulusSubgradeReaction",
"geolib.models.dsheetpiling.settings.EarthPressureCoefficients",
"geolib.models.ds... | [((283, 297), 'pydantic.validator', 'validator', (['"""*"""'], {}), "('*')\n", (292, 297), False, 'from pydantic import validator\n'), ((14015, 14042), 'geolib.models.dsheetpiling.settings.EarthPressureCoefficients', 'EarthPressureCoefficients', ([], {}), '()\n', (14040, 14042), False, 'from geolib.models.dsheetpiling.... |
import sys
from thoughtful_termites.app.widgets import UnlocksWindow
from thoughtful_termites.shared import qt
from ..controlled_processes import (
ControlledProcess,
BotControlledProcess,
GoalsProcess,
)
from thoughtful_termites.shared.resources import leaf_icon_path
class ControlPanel(qt.QWidget):
... | [
"thoughtful_termites.shared.qt.QSystemTrayIcon",
"thoughtful_termites.shared.qt.QPushButton",
"thoughtful_termites.shared.bot_config.Config.load",
"thoughtful_termites.shared.qt.QVBoxLayout",
"thoughtful_termites.app.widgets.UnlocksWindow",
"thoughtful_termites.shared.qt.QMenu",
"thoughtful_termites.sha... | [((639, 670), 'thoughtful_termites.shared.qt.QPushButton', 'qt.QPushButton', (['"""Configure Bot"""'], {}), "('Configure Bot')\n", (653, 670), False, 'from thoughtful_termites.shared import qt\n'), ((797, 824), 'thoughtful_termites.shared.qt.QPushButton', 'qt.QPushButton', (['"""Start Bot"""'], {}), "('Start Bot')\n", ... |
# Modified version of https://www.geeksforgeeks.org/auto-complete-feature-using-trie/
import db
import sys
class TrieNode():
def __init__(self):
self.children = {} # char -> node
self.last = False
class Trie():
def __init__(self):
self.root = TrieNode()
def formTrie(self, keys)... | [
"db.set_up_db",
"sys.exit"
] | [((1744, 1754), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1752, 1754), False, 'import sys\n'), ((1779, 1793), 'db.set_up_db', 'db.set_up_db', ([], {}), '()\n', (1791, 1793), False, 'import db\n')] |
import json
import numpy as np
import matplotlib.pyplot as plt
def to_seconds(s):
hr, min, sec = [float(x) for x in s.split(':')]
return hr*3600 + min*60 + sec
def extract(gst_log, script_log, debug=False):
with open(gst_log, "r") as f:
lines = f.readlines()
id_s = "create:<v4l2src"
st_s ... | [
"matplotlib.pyplot.legend",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.tight_layout",
"json.load",
"json.dump",
"matplotlib.pyplot.show"
] | [((2646, 2667), 'matplotlib.pyplot.figure', 'plt.figure', (['"""v4l2src"""'], {}), "('v4l2src')\n", (2656, 2667), True, 'import matplotlib.pyplot as plt\n'), ((2937, 2949), 'matplotlib.pyplot.legend', 'plt.legend', ([], {}), '()\n', (2947, 2949), True, 'import matplotlib.pyplot as plt\n'), ((2954, 2972), 'matplotlib.py... |
import os
import importlib
path = __file__.replace("__init__.py", "")
for file in os.listdir(path):
if "__" not in file:
globals()[file[:-3]] = getattr(importlib.import_module(__name__+"."+file[:-3]), file[:-3])
| [
"os.listdir",
"importlib.import_module"
] | [((89, 105), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (99, 105), False, 'import os\n'), ((173, 224), 'importlib.import_module', 'importlib.import_module', (["(__name__ + '.' + file[:-3])"], {}), "(__name__ + '.' + file[:-3])\n", (196, 224), False, 'import importlib\n')] |
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
data = np.load("scores.npy", allow_pickle=True).item()
fig, axs = plt.subplots(3, 1, figsize=(20, 20))
for i, score in enumerate(["insert", "delete", "irof"]):
ax = axs[i]
df = data[score]
for key in df:
if key=="rbm_flip_det... | [
"seaborn.distplot",
"numpy.load",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((141, 177), 'matplotlib.pyplot.subplots', 'plt.subplots', (['(3)', '(1)'], {'figsize': '(20, 20)'}), '(3, 1, figsize=(20, 20))\n', (153, 177), True, 'import matplotlib.pyplot as plt\n'), ((582, 592), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (590, 592), True, 'import matplotlib.pyplot as plt\n'), ((81, ... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jun 11 14:45:29 2019
@author: txuslopez
"""
'''
This Script is a RUN function which uses the cellular automation defined in 'biosystem.py' to classify data from the popular Iris Flower dataset. Error between predicted results is then calculated and c... | [
"sklearn.model_selection.GridSearchCV",
"numpy.sqrt",
"pandas.read_csv",
"sklearn.neighbors.KNeighborsClassifier",
"psutil.virtual_memory",
"scipy.stats.friedmanchisquare",
"numpy.array",
"numpy.nanmean",
"numpy.rot90",
"copy.deepcopy",
"skmultiflow.drift_detection.page_hinkley.PageHinkley",
"... | [((1422, 1449), 'matplotlib.pyplot.rc', 'plt.rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (1428, 1449), True, 'import matplotlib.pyplot as plt\n'), ((1450, 1480), 'matplotlib.pyplot.rc', 'plt.rc', (['"""font"""'], {'family': '"""serif"""'}), "('font', family='serif')\n", (1456, 1480), True, '... |
import math
t = [ [ None, 300, 500, 600, 700, 1350, 1650 ],
[ None, None, 350, 450, 600, 1150, 1500 ],
[ None, None, None, 250, 400, 1000, 1350 ],
[ None, None, None, None, 250, 850, 1300 ],
[ None, None, None, None, None, 600, 1150 ],
[ None, None, None, None, None, None, 50... | [
"math.ceil"
] | [((792, 813), 'math.ceil', 'math.ceil', (['(n / 2 / 50)'], {}), '(n / 2 / 50)\n', (801, 813), False, 'import math\n')] |
# std lib
from datetime import datetime, timedelta
# 3rd party
from sqlalchemy import and_
from flask import Blueprint, jsonify, request
# local
from project.api.models import Event
from project import cache
calendar_blueprint = Blueprint("calendar", __name__)
def _transform(index, event):
return {"index": ind... | [
"flask.request.args.get",
"datetime.datetime.utcnow",
"project.cache.cached",
"datetime.timedelta",
"flask.Blueprint",
"sqlalchemy.and_",
"flask.jsonify"
] | [((232, 263), 'flask.Blueprint', 'Blueprint', (['"""calendar"""', '__name__'], {}), "('calendar', __name__)\n", (241, 263), False, 'from flask import Blueprint, jsonify, request\n'), ((451, 496), 'project.cache.cached', 'cache.cached', ([], {'timeout': '(1000)', 'query_string': '(True)'}), '(timeout=1000, query_string=... |
import base64
import datetime
import hashlib
from io import BytesIO
from logging import getLogger
import OpenSSL.crypto
import asn1crypto.ocsp
import pytz
from OpenSSL import crypto
from OpenSSL.crypto import X509StoreContextError
from asn1crypto import pem
from bankid.experimental.helper import CompletionDataContain... | [
"logging.getLogger",
"pytz.timezone",
"hashlib.sha256",
"OpenSSL.crypto.X509Store",
"bankid.experimental.helper.make_cert",
"bankid.experimental.helper.NonceParse",
"base64.b64decode",
"bankid.experimental.helper.CompletionDataContainer",
"datetime.datetime.now",
"asn1crypto.pem.armor",
"OpenSSL... | [((354, 373), 'logging.getLogger', 'getLogger', (['__name__'], {}), '(__name__)\n', (363, 373), False, 'from logging import getLogger\n'), ((728, 787), 'bankid.experimental.helper.CompletionDataContainer', 'CompletionDataContainer', (["bank_id_response['completionData']"], {}), "(bank_id_response['completionData'])\n",... |
# Copyright 2021 Foreseeti AB <https://foreseeti.com>
#
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | [
"pytest.raises"
] | [((1041, 1080), 'pytest.raises', 'pytest.raises', (['DuplicateObjectException'], {}), '(DuplicateObjectException)\n', (1054, 1080), False, 'import pytest\n'), ((1212, 1249), 'pytest.raises', 'pytest.raises', (['MissingObjectException'], {}), '(MissingObjectException)\n', (1225, 1249), False, 'import pytest\n'), ((1591,... |
#!/usr/bin/env python
#python 3 compatibility
from __future__ import print_function
import rasterio
from scipy.io import netcdf
import numpy as np
import subprocess
import sys
from gdal import GDALGrid
from gmt import GMTGrid
def getCommandOutput(cmd):
"""
Internal method for calling external command.
@... | [
"subprocess.Popen",
"gmt.GMTGrid",
"gdal.GDALGrid.load",
"gmt.GMTGrid.load",
"numpy.arange"
] | [((520, 606), 'subprocess.Popen', 'subprocess.Popen', (['cmd'], {'shell': '(True)', 'stdout': 'subprocess.PIPE', 'stderr': 'subprocess.PIPE'}), '(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess\n .PIPE)\n', (536, 606), False, 'import subprocess\n'), ((1119, 1141), 'gmt.GMTGrid', 'GMTGrid', (['data', 'geod... |
import numpy as np
import matplotlib.pyplot as plt
def gaussian_func(sigma, x):
return 1 / np.sqrt(2 * np.pi * (sigma ** 2)) * np.exp(-(x ** 2) / (2 * (sigma ** 2)))
def gaussian_random_generator(sigma=5, numbers=100000):
uniform_random_numbers = np.random.rand(numbers, 2)
rho = sigma * np.sqrt(-2 * np.... | [
"numpy.sqrt",
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"numpy.log",
"numpy.max",
"numpy.exp",
"numpy.linspace",
"numpy.cos",
"numpy.min",
"numpy.sin",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((259, 285), 'numpy.random.rand', 'np.random.rand', (['numbers', '(2)'], {}), '(numbers, 2)\n', (273, 285), True, 'import numpy as np\n'), ((555, 586), 'numpy.min', 'np.min', (['gaussian_random_numbers'], {}), '(gaussian_random_numbers)\n', (561, 586), True, 'import numpy as np\n'), ((603, 634), 'numpy.max', 'np.max',... |
"""Generate random sentences with an LCFRS.
Reads grammar from a text file."""
import sys
import gzip
import codecs
from collections import namedtuple, defaultdict
from array import array
from random import random
SHORTUSAGE = '''Generate random sentences with a PLCFRS or PCFG.
Reads grammar from a text file in PLCFR... | [
"collections.namedtuple",
"codecs.getreader",
"array.array",
"sys.argv.remove",
"collections.defaultdict",
"sys.exit",
"random.random",
"sys.argv.index",
"sys.argv.pop"
] | [((511, 652), 'collections.namedtuple', 'namedtuple', (['"""Grammar"""', "('numrules', 'unary', 'lbinary', 'rbinary', 'bylhs', 'lexicalbyword',\n 'lexicalbylhs', 'toid', 'tolabel', 'fanout')"], {}), "('Grammar', ('numrules', 'unary', 'lbinary', 'rbinary', 'bylhs',\n 'lexicalbyword', 'lexicalbylhs', 'toid', 'tolab... |
import rqalpha
config = {
"extra": {
"log_level": "verbose",
},
"mod": {
"live_trade": {
"lib": "./mod",
"enabled": True,
"priority": 100,
}
}
}
def run(baseConf):
config["base"] = baseConf
return rqalpha.run(config)
| [
"rqalpha.run"
] | [((263, 282), 'rqalpha.run', 'rqalpha.run', (['config'], {}), '(config)\n', (274, 282), False, 'import rqalpha\n')] |
# -*- coding: utf-8 -*-
"""
Copyright [2009-2017] EMBL-European Bioinformatics Institute
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 requir... | [
"logging.getLogger",
"attr.s",
"enum.auto",
"attr.validators.instance_of",
"rnacentral_pipeline.databases.ensembl.helpers.regions",
"rnacentral_pipeline.databases.helpers.embl.rna_type"
] | [((1091, 1118), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1108, 1118), False, 'import logging\n'), ((1708, 1716), 'attr.s', 'attr.s', ([], {}), '()\n', (1714, 1716), False, 'import attr\n'), ((2191, 2199), 'attr.s', 'attr.s', ([], {}), '()\n', (2197, 2199), False, 'import attr\n'), ... |
import emoji
from time import sleep
print('\33[31m=' * 20, 'Contagem Regressiva para os Fogos de Artíficio', '=' * 20, '\33[m')
for c in range(10, -1, -1):
print(c)
sleep(1)
print(emoji.emojize('\33[34mOs fogos estão explodindo :fireworks:\33[m', use_aliases= True))
print('\33[35mBUM, BUM, BUM, BUM, BUM, BUM, ... | [
"emoji.emojize",
"time.sleep"
] | [((174, 182), 'time.sleep', 'sleep', (['(1)'], {}), '(1)\n', (179, 182), False, 'from time import sleep\n'), ((189, 279), 'emoji.emojize', 'emoji.emojize', (['"""\x1b[34mOs fogos estão explodindo :fireworks:\x1b[m"""'], {'use_aliases': '(True)'}), "('\\x1b[34mOs fogos estão explodindo :fireworks:\\x1b[m',\n use_alia... |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
sys.path.append('..')
from for_add_pools_and_workers_20.prb_post_request_2 import PrbGetWorkersStatus
from for_add_pools_and_workers_20.prb_post_request_2 import MethodForWorkers
from prb_post_request import GetPrbWorkersPoolsData
from prb_post_request ... | [
"re.search",
"prb_post_request.PostPrbRestartLifecycle.post_prb_restart_lifecycle",
"for_add_pools_and_workers_20.prb_post_request_2.MethodForWorkers",
"prb_post_request.GetPrbWorkersPoolsData",
"sys.path.append",
"for_add_pools_and_workers_20.prb_post_request_2.PrbGetWorkersStatus"
] | [((63, 84), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (78, 84), False, 'import sys\n'), ((950, 981), 'prb_post_request.GetPrbWorkersPoolsData', 'GetPrbWorkersPoolsData', (['ip_port'], {}), '(ip_port)\n', (972, 981), False, 'from prb_post_request import GetPrbWorkersPoolsData\n'), ((1878, 192... |
#CompReq.py
from riaps.run.comp import Component
import os
import random
import logging
import spdlog as spd
class CompRep(Component):
def __init__(self, logfile):
super(CompRep, self).__init__()
self.id = random.randint(0,10000)
logpath = '/tmp/riaps_%s_%d.log' % (logfile, self.id)
... | [
"os.remove",
"random.randint",
"spdlog.FileLogger"
] | [((227, 251), 'random.randint', 'random.randint', (['(0)', '(10000)'], {}), '(0, 10000)\n', (241, 251), False, 'import random\n'), ((422, 475), 'spdlog.FileLogger', 'spd.FileLogger', (["('%s_%d' % (logfile, self.id))", 'logpath'], {}), "('%s_%d' % (logfile, self.id), logpath)\n", (436, 475), True, 'import spdlog as spd... |
import json
from xbrl.xml import parser, qname
import lxml.etree as etree
from urllib.parse import urlparse
from enum import Enum
import logging
logger = logging.getLogger(__name__)
class UnknownDocumentClassError(Exception):
pass
class MissingDocumentClassError(Exception):
pass
class DocumentClass(Enum):
... | [
"logging.getLogger",
"urllib.parse.urlparse",
"xbrl.xml.qname",
"xbrl.xml.parser",
"json.load"
] | [((155, 182), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (172, 182), False, 'import logging\n'), ((463, 476), 'urllib.parse.urlparse', 'urlparse', (['url'], {}), '(url)\n', (471, 476), False, 'from urllib.parse import urlparse\n'), ((674, 688), 'json.load', 'json.load', (['fin'], {}),... |
import time
import edgeiq
import cv2
import numpy as np
import os
"""
Instance segmenataiom application used to count unique instances of bottles.
Instance Segmenataiom is currently not part of the alwaysai API's or Model Catalog.
This application demostartes how to implement instance segmenataiom using the
alwaysai pl... | [
"cv2.dnn.blobFromImage",
"cv2.rectangle",
"edgeiq.WebcamVideoStream",
"edgeiq.Streamer",
"cv2.dnn.readNetFromTensorflow",
"time.sleep",
"cv2.putText",
"numpy.array",
"numpy.random.seed",
"cv2.resize",
"edgeiq.FPS"
] | [((531, 549), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (545, 549), True, 'import numpy as np\n'), ((901, 955), 'cv2.dnn.readNetFromTensorflow', 'cv2.dnn.readNetFromTensorflow', (['weightsPath', 'configPath'], {}), '(weightsPath, configPath)\n', (930, 955), False, 'import cv2\n'), ((1117, 1129), ... |
#!/usr/bin/env python
"""
Testing harness for running pyshepseg in the tiling mode.
Handy for running a basic segmentation
but it is suggested that users call the module directly from a Python
script and handle things like scaling the data in an appripriate
manner for their application.
"""
#Copyright 2021 <NAME> an... | [
"osgeo.gdal.Open",
"argparse.ArgumentParser",
"pyshepseg.tiling.doTiledShepherdSegmentation",
"pyshepseg.utils.writeColorTableFromRatColumns",
"pyshepseg.utils.estimateStatsFromHisto",
"pyshepseg.tiling.calcHistogramTiled",
"sys.exit",
"pyshepseg.tiling.calcPerSegmentStatsTiled",
"time.time",
"pys... | [((1850, 1875), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1873, 1875), False, 'import argparse\n'), ((7790, 8368), 'pyshepseg.tiling.doTiledShepherdSegmentation', 'tiling.doTiledShepherdSegmentation', (['cmdargs.infile', 'cmdargs.outfile'], {'tileSize': 'cmdargs.tilesize', 'overlapSize': ... |
import logging
import instruction_set
import type_decoder
formatter = logging.Formatter("%(asctime)s:%(levelname)s:%(message)s")
file_handler = logging.FileHandler(f"{__name__}.log")
file_handler.setLevel(logging.ERROR)
# file_handler.setLevel(logging.DEBUG)
file_handler.setFormatter(formatter)
logger = logging.getLo... | [
"logging.getLogger",
"logging.Formatter",
"logging.FileHandler",
"type_decoder.TypeDecoder"
] | [((72, 130), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s:%(levelname)s:%(message)s"""'], {}), "('%(asctime)s:%(levelname)s:%(message)s')\n", (89, 130), False, 'import logging\n'), ((146, 184), 'logging.FileHandler', 'logging.FileHandler', (['f"""{__name__}.log"""'], {}), "(f'{__name__}.log')\n", (165, 1... |
__all__ = [
"Element",
"component",
"html_name_to_python",
"python_name_to_html",
"ParseError"
]
from typing import *
from keyword import iskeyword
from inspect import getmembers
from html.parser import HTMLParser
from xml.etree import ElementTree
def prefixed_attributes(obj, prefix):
return ... | [
"xml.etree.ElementTree.tostring",
"keyword.iskeyword",
"xml.etree.ElementTree.TreeBuilder",
"inspect.getmembers"
] | [((12223, 12238), 'keyword.iskeyword', 'iskeyword', (['name'], {}), '(name)\n', (12232, 12238), False, 'from keyword import iskeyword\n'), ((10432, 10457), 'xml.etree.ElementTree.TreeBuilder', 'ElementTree.TreeBuilder', ([], {}), '()\n', (10455, 10457), False, 'from xml.etree import ElementTree\n'), ((10549, 10610), 'x... |
import pdfplumber
import csv
from pdf_data_converter import text_pdfs_scraper_individual, table_pdfs_scraper_individual, team_pdf_scraper
from helpers import clear_tables, clear_text, clear_team_text
from VAR import HEADERS
def raw_data_from_pdfs(fis_pdf):
"""
Function extracts tabular data from pdf in two w... | [
"pdfplumber.open",
"helpers.clear_team_text",
"helpers.clear_tables",
"pdf_data_converter.text_pdfs_scraper_individual",
"csv.writer",
"pdf_data_converter.team_pdf_scraper",
"helpers.clear_text",
"pdf_data_converter.table_pdfs_scraper_individual"
] | [((586, 610), 'pdfplumber.open', 'pdfplumber.open', (['fis_pdf'], {}), '(fis_pdf)\n', (601, 610), False, 'import pdfplumber\n'), ((1188, 1218), 'helpers.clear_tables', 'clear_tables', (['content_for_list'], {}), '(content_for_list)\n', (1200, 1218), False, 'from helpers import clear_tables, clear_text, clear_team_text\... |
"""
Two Sum
===============
https://leetcode.com/problems/two-sum/
Description:
Given an array of integers,
return indices of the two numbers,
such that they add up to a specific target.
You may assume that each input would have exactly one solution,
and you may not use the same element twice.
... | [
"practice.util.DriverFactory"
] | [((1176, 1198), 'practice.util.DriverFactory', 'DriverFactory', (['"""basic"""'], {}), "('basic')\n", (1189, 1198), False, 'from practice.util import DriverFactory\n')] |
import pytest
import grpc
import uuid
from threading import Event
import yandex.cloud.compute.v1.zone_service_pb2_grpc as zone_service_pb2_grpc
import yandex.cloud.compute.v1.zone_service_pb2 as zone_service_pb2
from yandexcloud import RetryInterceptor
from yandexcloud import default_backoff, backoff_linear_with_jit... | [
"tests.grpc_server_mock.default_channel",
"tests.grpc_server_mock.grpc_server",
"yandexcloud.RetryInterceptor",
"yandex.cloud.compute.v1.zone_service_pb2.GetZoneRequest",
"threading.Event",
"yandex.cloud.compute.v1.zone_service_pb2_grpc.ZoneServiceStub",
"yandexcloud.backoff_linear_with_jitter",
"uuid... | [((909, 937), 'tests.grpc_server_mock.grpc_server', 'grpc_server', (['service.handler'], {}), '(service.handler)\n', (920, 937), False, 'from tests.grpc_server_mock import DEFAULT_ZONE, grpc_server, default_channel\n'), ((952, 997), 'yandex.cloud.compute.v1.zone_service_pb2.GetZoneRequest', 'zone_service_pb2.GetZoneReq... |
# Generated by Django 2.0.5 on 2018-06-13 14:44
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('User', '0004_auto_20180613_2107'),
]
operations = [
migrations.AlterField(
model_name='usercollection',
name='books',... | [
"django.db.models.ManyToManyField"
] | [((339, 413), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'related_name': '"""collection_users"""', 'to': '"""Content.Book"""'}), "(related_name='collection_users', to='Content.Book')\n", (361, 413), False, 'from django.db import migrations, models\n'), ((548, 633), 'django.db.models.ManyToManyF... |
"""Test the Product build process using a mock documentation.
See mock_manifest.yaml; the doc repo is github.com/lsst-sqre/mock-doc and
the packages are embedded in this repo's test_data/ directory.
"""
import os
import tempfile
import shutil
from pathlib import Path
import pytest
import sh
import ruamel.yaml
from r... | [
"ruamel.yaml.compat.StringIO",
"os.path.exists",
"sh.ls",
"ltdmason.product.Product",
"os.listdir",
"ltdmason.manifest.Manifest",
"pathlib.Path",
"sh.git.bake",
"os.path.lexists",
"os.path.join",
"os.path.dirname",
"os.path.isdir",
"tempfile.mkdtemp",
"shutil.rmtree",
"pytest.fixture",
... | [((434, 465), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (448, 465), False, 'import pytest\n'), ((1098, 1129), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (1112, 1129), False, 'import pytest\n'), ((847, 872), 'os.path.dir... |
import os
import shutil
import time
import glob
import subprocess
import web
from libs import utils, form_utils
from libs.logger import logger
import settings
subscription_versions = ['normal', 'nomail', 'digest']
def __get_ml_dir(mail):
"""Get absolute path of the root directory of mailing list account."""
... | [
"os.path.exists",
"libs.form_utils.get_dict_for_form_param",
"os.listdir",
"os.makedirs",
"shutil.move",
"os.getuid",
"subprocess.Popen",
"os.path.join",
"time.gmtime",
"os.chown",
"os.path.isfile",
"os.path.dirname",
"os.getgid",
"settings.MLMMJ_PARAM_TYPES.items",
"shutil.rmtree",
"s... | [((460, 518), 'os.path.join', 'os.path.join', (['settings.MLMMJ_SPOOL_DIR', '_domain', '_username'], {}), '(settings.MLMMJ_SPOOL_DIR, _domain, _username)\n', (472, 518), False, 'import os\n'), ((1282, 1312), 'os.path.join', 'os.path.join', (['_ml_dir', 'dirname'], {}), '(_ml_dir, dirname)\n', (1294, 1312), False, 'impo... |
# imports
import numpy as np
import matplotlib.pyplot as plt
""" Implementation of the Heaviside step Function
Defined as the integral of the dirac delta function."""
def _unit_step(n):
return 0 if n < 0 else 1
# vectorize function for increased performance
unit_step = np.vectorize(_unit_step)
# define inpu... | [
"matplotlib.pyplot.plot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.stem",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.xlim",
"numpy.vectorize",
"matplotlib.pyplot.step",
"numpy.arange",
"matplotlib.pyplot.show"
] | [((281, 305), 'numpy.vectorize', 'np.vectorize', (['_unit_step'], {}), '(_unit_step)\n', (293, 305), True, 'import numpy as np\n'), ((333, 354), 'numpy.arange', 'np.arange', (['(-10)', '(11)', '(1)'], {}), '(-10, 11, 1)\n', (342, 354), True, 'import numpy as np\n'), ((405, 417), 'matplotlib.pyplot.figure', 'plt.figure'... |
import io
import re
from setuptools import find_packages, setup
with io.open("int_rew/__init__.py", "rt", encoding="utf8") as f:
version = re.search(r"__version__ = \"(.*?)\"", f.read()).group(1)
setup(
name="intrinsic_rewards",
version=version,
url="https://github.com/kngwyu/intrinsic_rewards",
... | [
"setuptools.find_packages",
"io.open"
] | [((71, 124), 'io.open', 'io.open', (['"""int_rew/__init__.py"""', '"""rt"""'], {'encoding': '"""utf8"""'}), "('int_rew/__init__.py', 'rt', encoding='utf8')\n", (78, 124), False, 'import io\n'), ((620, 635), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (633, 635), False, 'from setuptools import find_pa... |
import sys
from appJar import gui
background_color = '#171717'
tetromino_color = '#FAE63C'
class GraphicGameFrame:
def __init__(self, grid_size, square_size):
self.last_tetromino_data = []
self.last_board_data = []
self.controls = []
self.game = None
self.grid_size = grid... | [
"appJar.gui",
"sys.exit"
] | [((515, 561), 'appJar.gui', 'gui', (['"""Tetris"""', '(width, height)'], {'showIcon': '(False)'}), "('Tetris', (width, height), showIcon=False)\n", (518, 561), False, 'from appJar import gui\n'), ((1696, 1707), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (1704, 1707), False, 'import sys\n')] |
from importlib import import_module
def type_check(obj, cls):
if not issubclass(obj, cls):
raise TypeError('object does not subclass {}'.format(cls.__name__))
def get_class(mod_path, typeof):
mp = mod_path.split('.')
mod_path = '.'.join(mp[:-1])
class_name = mp[-1]
module = import_module... | [
"importlib.import_module"
] | [((307, 330), 'importlib.import_module', 'import_module', (['mod_path'], {}), '(mod_path)\n', (320, 330), False, 'from importlib import import_module\n')] |
# SPDX-FileCopyrightText: 2017 <NAME>, written for Adafruit Industries
# SPDX-FileCopyrightText: Copyright (c) 2021 <NAME> for Adafruit Industries
#
# SPDX-License-Identifier: Unlicense
"""
The Kaluga development kit comes in two versions (v1.2 and v1.3); this demo is
tested on v1.3. It probably won't work on v1.2 wi... | [
"displayio.Bitmap",
"displayio.release_displays",
"busio.SPI",
"busio.I2C",
"adafruit_ov7670.OV7670",
"displayio.Group",
"displayio.ColorConverter",
"displayio.FourWire",
"adafruit_ili9341.ILI9341",
"time.monotonic_ns"
] | [((1264, 1292), 'displayio.release_displays', 'displayio.release_displays', ([], {}), '()\n', (1290, 1292), False, 'import displayio\n'), ((1300, 1351), 'busio.SPI', 'busio.SPI', ([], {'MOSI': 'board.LCD_MOSI', 'clock': 'board.LCD_CLK'}), '(MOSI=board.LCD_MOSI, clock=board.LCD_CLK)\n', (1309, 1351), False, 'import busi... |
import os
import random
import numpy as np
class EA_Util:
def __init__(self, gen_size, pop_size=30, eval_func=None, max_gen=50, early_stop=0):
self.gen_size = gen_size
self.pop_size = pop_size
self.max_gen = max_gen
self.early_stop = early_stop
if eval_func == None:... | [
"random.sample",
"random.choice",
"numpy.argsort",
"numpy.random.uniform",
"random.random"
] | [((1524, 1548), 'numpy.argsort', 'np.argsort', (['self.fitness'], {}), '(self.fitness)\n', (1534, 1548), True, 'import numpy as np\n'), ((627, 664), 'numpy.random.uniform', 'np.random.uniform', ([], {'size': 'self.gen_size'}), '(size=self.gen_size)\n', (644, 664), True, 'import numpy as np\n'), ((1216, 1231), 'random.r... |
import requests
from bs4 import BeautifulSoup
for i in range(1,12):
res = requests.get('https://babynames.net/all/persian?page=%i' % i , proxies={'https':'socks5://127.0.0.1:9050'})
soup = BeautifulSoup(res.text , 'html.parser')
all_names = soup.find_all('span' , attrs={'class':'result-name'})
for name... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((78, 190), 'requests.get', 'requests.get', (["('https://babynames.net/all/persian?page=%i' % i)"], {'proxies': "{'https': 'socks5://127.0.0.1:9050'}"}), "('https://babynames.net/all/persian?page=%i' % i, proxies={\n 'https': 'socks5://127.0.0.1:9050'})\n", (90, 190), False, 'import requests\n'), ((198, 236), 'bs4.... |
import numpy
from amuse.test import amusetest
from amuse.units import units, nbody_system
from amuse.ic.brokenimf import *
# Instead of random, use evenly distributed numbers, just for testing
default_options = dict(random=False)
class TestMultiplePartIMF(amusetest.TestCase):
def test1(self):
print(... | [
"numpy.array"
] | [((1487, 1510), 'numpy.array', 'numpy.array', (['[0.5, 0.5]'], {}), '([0.5, 0.5])\n', (1498, 1510), False, 'import numpy\n')] |