code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# created_on: 2018-07-27 21:37
"""
auto_node_create.py
AIM: Automatically:
1. Install Multichain
2. Check/Use or Create new Node
3. Connect Node with MoD-i Blockchain
Pre-requisites:
1. OS: Linux(Debian) or Windows
2. `sud... | [
"logging.getLogger",
"re.escape",
"os.listdir",
"re.compile",
"pathlib.Path.home",
"subprocess.run",
"os.path.join",
"os.chdir",
"os.mkdir",
"sys.exit",
"getpass.getuser",
"socket.gethostname"
] | [((694, 721), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (711, 721), False, 'import logging\n'), ((734, 754), 'socket.gethostname', 'socket.gethostname', ([], {}), '()\n', (752, 754), False, 'import socket\n'), ((762, 779), 'getpass.getuser', 'getpass.getuser', ([], {}), '()\n', (777,... |
#!/usr/bin/env python
####
#### mhp.py -- A Monty Hall simulation. First runs through and has the
#### contestant never change their guess after being shown a goat. Then runs
#### again to show the results if the contestant always changes their choice.
#### Theory states that changing to the other door is always ... | [
"mhprand.genDoors",
"mhpui.notifyStart",
"mhprand.doorChoice",
"mhputil.changeChoice",
"mhputil.showGoat",
"mhpui.notifyStop",
"mhpui.getItCount"
] | [((556, 571), 'mhpui.getItCount', 'ui.getItCount', ([], {}), '()\n', (569, 571), True, 'import mhpui as ui\n'), ((766, 788), 'mhpui.notifyStart', 'ui.notifyStart', (['passes'], {}), '(passes)\n', (780, 788), True, 'import mhpui as ui\n'), ((1149, 1210), 'mhpui.notifyStop', 'ui.notifyStop', (['passes', 'nc_wins', 'nc_lo... |
from argparse import ArgumentParser
def main():
parser = ArgumentParser()
parser.add_argument("indent", type=int, help="indent for report")
parser.add_argument("input_file", help="read data from this file") #1
parser.add_argument("-f", "--file", dest="filename", #2
help... | [
"argparse.ArgumentParser"
] | [((62, 78), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (76, 78), False, 'from argparse import ArgumentParser\n')] |
import os
import SimpleITK as sitk
import numpy as np
from itertools import combinations
# Install surface_distance from https://github.com/amrane99/surface-distance using pip install git+https://github.com/amrane99/surface-distance
from surface_distance import metrics
def calculateSegmentationsSimilarity(segmentation... | [
"SimpleITK.ImageFileReader",
"SimpleITK.ReadImage",
"surface_distance.metrics.compute_surface_distances",
"surface_distance.metrics.compute_surface_dice_at_tolerance"
] | [((1081, 1103), 'SimpleITK.ImageFileReader', 'sitk.ImageFileReader', ([], {}), '()\n', (1101, 1103), True, 'import SimpleITK as sitk\n'), ((1762, 1880), 'surface_distance.metrics.compute_surface_distances', 'metrics.compute_surface_distances', (['segmentations_dict[combination[0]]', 'segmentations_dict[combination[1]]'... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""Test a trained classification model."""
import argparse
import numpy as np
import sys
import torch
from sscls.cor... | [
"sscls.utils.checkpoint.load_checkpoint",
"sscls.utils.metrics.flops_count",
"sys.exit",
"sscls.utils.distributed.scaled_all_reduce",
"argparse.ArgumentParser",
"sscls.datasets.loader.construct_test_loader",
"sscls.core.config.cfg.merge_from_file",
"numpy.random.seed",
"sscls.core.config.cfg.merge_f... | [((700, 723), 'sscls.utils.logging.get_logger', 'lu.get_logger', (['__name__'], {}), '(__name__)\n', (713, 723), True, 'import sscls.utils.logging as lu\n'), ((1525, 1540), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (1538, 1540), False, 'import torch\n'), ((789, 863), 'argparse.ArgumentParser', 'argparse.Argum... |
# -*- coding: utf-8 -*-
import tensorflow as tf
import librosa
import numpy as np
import os
from scipy.signal import butter, lfilter, freqz
import matplotlib.pyplot as plt
def conv_net(X,W,b,keepprob,mfcc_n,img_size):
input_img=tf.reshape(X,shape=[-1,mfcc_n,img_size,1])
# conv_net
layer1=tf.nn.relu(tf.add... | [
"tensorflow.nn.conv2d",
"tensorflow.nn.max_pool",
"tensorflow.matmul",
"tensorflow.nn.dropout",
"tensorflow.reshape"
] | [((234, 280), 'tensorflow.reshape', 'tf.reshape', (['X'], {'shape': '[-1, mfcc_n, img_size, 1]'}), '(X, shape=[-1, mfcc_n, img_size, 1])\n', (244, 280), True, 'import tensorflow as tf\n'), ((407, 438), 'tensorflow.nn.dropout', 'tf.nn.dropout', (['layer1', 'keepprob'], {}), '(layer1, keepprob)\n', (420, 438), True, 'imp... |
from imageai.Detection.Custom import DetectionModelTrainer
import tensorflow as tf
# from tensorflow import
# from tensorflow import InteractiveSession
# config = ConfigProto()
# config.gpu_options.allow_growth = True
# session = InteractiveSession(config=config)
'''
模型训练
'''
trainer = DetectionModelTrainer()
trainer.s... | [
"imageai.Detection.Custom.DetectionModelTrainer"
] | [((287, 310), 'imageai.Detection.Custom.DetectionModelTrainer', 'DetectionModelTrainer', ([], {}), '()\n', (308, 310), False, 'from imageai.Detection.Custom import DetectionModelTrainer\n')] |
#!/usr/bin/env python3
#!/usr/bin/python
# -*- coding: iso-8859-15 -*-
import time
import datetime
now = datetime.datetime.now()
print(("now = %s" % str(now)))
print(now)
today = datetime.datetime.today()
print(("today = %s" % str(today)))
print(today)
dow = datetime.datetime.today().weekday()
print(("dow = %s" % str... | [
"datetime.datetime.today",
"datetime.datetime.now",
"datetime.datetime"
] | [((107, 130), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (128, 130), False, 'import datetime\n'), ((181, 206), 'datetime.datetime.today', 'datetime.datetime.today', ([], {}), '()\n', (204, 206), False, 'import datetime\n'), ((334, 384), 'datetime.datetime', 'datetime.datetime', (['(2012)', '(3)... |
import torch
import os
from . import attribute_classifier
import glob
softmax = torch.nn.Softmax(dim=1)
def downsample(images, size=256):
# Downsample to 256x256. The attribute classifiers were built for 256x256.
# follows https://github.com/NVlabs/stylegan/blob/master/metrics/linear_separability.py#L127
... | [
"torch.nn.Softmax",
"torch.load",
"os.path.join",
"os.path.abspath",
"torch.cat"
] | [((81, 104), 'torch.nn.Softmax', 'torch.nn.Softmax', ([], {'dim': '(1)'}), '(dim=1)\n', (97, 104), False, 'import torch\n'), ((1101, 1151), 'os.path.abspath', 'os.path.abspath', (["(__file__ + '/../../../pth_celeba')"], {}), "(__file__ + '/../../../pth_celeba')\n", (1116, 1151), False, 'import os\n'), ((1174, 1224), 'o... |
import unittest
from app.models import User, Comment
from flask_login import current_user
from app import db
class TestComments(unittest.TestCase):
def setUp(self):
self.new_comment = Comment(pitch_id=12, title='Awesome', comment="Nice presentation...", postedAt="2019-05-27 14:15:43.587649", user_i... | [
"app.models.Comment",
"app.models.Comment.query.delete"
] | [((205, 328), 'app.models.Comment', 'Comment', ([], {'pitch_id': '(12)', 'title': '"""Awesome"""', 'comment': '"""Nice presentation..."""', 'postedAt': '"""2019-05-27 14:15:43.587649"""', 'user_id': '(1)'}), "(pitch_id=12, title='Awesome', comment='Nice presentation...',\n postedAt='2019-05-27 14:15:43.587649', user... |
from tensorflow.examples.tutorials.mnist import input_data
from modeler.gaussianAE import GaussianAutoencoderModel
from trainer.tftrainer import TFTrainer
import sklearn.preprocessing as prep
import numpy as np
class GaussianAETrainer(TFTrainer):
def __init__(self):
self.training_epochs = 20
self... | [
"numpy.random.normal",
"tensorflow.examples.tutorials.mnist.input_data.read_data_sets",
"sklearn.preprocessing.StandardScaler",
"modeler.gaussianAE.GaussianAutoencoderModel"
] | [((456, 509), 'tensorflow.examples.tutorials.mnist.input_data.read_data_sets', 'input_data.read_data_sets', (['"""MNIST_data"""'], {'one_hot': '(True)'}), "('MNIST_data', one_hot=True)\n", (481, 509), False, 'from tensorflow.examples.tutorials.mnist import input_data\n'), ((734, 760), 'modeler.gaussianAE.GaussianAutoen... |
from functools import reduce
from operator import mul
def product(iterable=(), start=1):
""" kata currently supports only Python 3.4.3 """
return reduce(mul, iterable, start)
# __builtins__.product = product
| [
"functools.reduce"
] | [((156, 184), 'functools.reduce', 'reduce', (['mul', 'iterable', 'start'], {}), '(mul, iterable, start)\n', (162, 184), False, 'from functools import reduce\n')] |
"""Glob tag handler tests."""
from pathlib import Path
from marshpy.core.errors import ErrorCode
from marshpy.tag_handlers.glob_handler import GlobHandler
from tests.tag_handlers.path_handler_helpers import check_path_tag
from tests.tag_handlers.path_handler_helpers import check_path_tag_error
def test_glob_tag_han... | [
"tests.tag_handlers.path_handler_helpers.check_path_tag",
"tests.tag_handlers.path_handler_helpers.check_path_tag_error"
] | [((416, 507), 'tests.tag_handlers.path_handler_helpers.check_path_tag', 'check_path_tag', (['GlobHandler', '"""!glob folder/**/*"""', "['file_1', 'file_2']"], {'roots': '[datadir]'}), "(GlobHandler, '!glob folder/**/*', ['file_1', 'file_2'],\n roots=[datadir])\n", (430, 507), False, 'from tests.tag_handlers.path_han... |
#!/usr/bin/env python3
"""
Author: <NAME>
Purpose: Chapter 5 - Howler Improved
"""
import io
import os
import sys
import argparse
def get_args():
""" Get command-line arguments """
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter, description="Howler's Second Program")
... | [
"os.path.exists",
"argparse.ArgumentParser",
"os.path.isfile",
"os.umask",
"os.mkdir",
"os.path.basename",
"io.StringIO"
] | [((200, 323), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter', 'description': '"""Howler\'s Second Program"""'}), '(formatter_class=argparse.\n ArgumentDefaultsHelpFormatter, description="Howler\'s Second Program")\n', (223, 323), False, 'import... |
import numpy as np
import scipy.misc
import time
import h5py
def make_generator(hdf5_file, n_images, batch_size, res, res_slack=2, label_name=None):
epoch_count = [1]
def get_epoch():
images = np.zeros((batch_size, 3, res, res), dtype='int32')
labels = np.zeros(batch_size, dtype='int32')
... | [
"h5py.File",
"numpy.zeros",
"time.time",
"numpy.amax",
"numpy.random.RandomState"
] | [((1486, 1511), 'h5py.File', 'h5py.File', (['data_file', '"""r"""'], {}), "(data_file, 'r')\n", (1495, 1511), False, 'import h5py\n'), ((2080, 2091), 'time.time', 'time.time', ([], {}), '()\n', (2089, 2091), False, 'import time\n'), ((210, 260), 'numpy.zeros', 'np.zeros', (['(batch_size, 3, res, res)'], {'dtype': '"""i... |
import json
import unittest as ut
import api.authorization.authorization as gt
import api.helpers.names as names
import requests
# from django.test import TestCase
class TestGetSession(ut.TestCase):
def setUp(self):
self.response = {
names.ANSWER: None,
names.SESSION: None,
... | [
"requests.post",
"json.loads",
"api.authorization.authorization.Authorization.authorization"
] | [((1171, 1210), 'api.authorization.authorization.Authorization.authorization', 'gt.Authorization.authorization', (['request'], {}), '(request)\n', (1201, 1210), True, 'import api.authorization.authorization as gt\n'), ((1229, 1249), 'json.loads', 'json.loads', (['response'], {}), '(response)\n', (1239, 1249), False, 'i... |
import unittest
from BobsConditions import FooEqual, FooDifference
class MyTestCase(unittest.TestCase):
def test_something(self):
condition_1 = FooEqual('test_foo_equal', None, 12)
condition_2 = FooDifference('test_foo_difference', None, 10)
conditions = [
condition_1,
... | [
"unittest.main",
"BobsConditions.FooEqual",
"BobsConditions.FooDifference"
] | [((497, 512), 'unittest.main', 'unittest.main', ([], {}), '()\n', (510, 512), False, 'import unittest\n'), ((159, 195), 'BobsConditions.FooEqual', 'FooEqual', (['"""test_foo_equal"""', 'None', '(12)'], {}), "('test_foo_equal', None, 12)\n", (167, 195), False, 'from BobsConditions import FooEqual, FooDifference\n'), ((2... |
from simplefit.classifier import classifier
import pandas as pd
import pytest
from pytest import raises
from sklearn.model_selection import train_test_split
def test_classifier():
"""Testing classifier function"""
income_df = pd.read_csv("tests/data/adult.csv")
train_df, test_df = train_test_split(income_... | [
"sklearn.model_selection.train_test_split",
"pytest.raises",
"pandas.read_csv",
"simplefit.classifier.classifier"
] | [((236, 271), 'pandas.read_csv', 'pd.read_csv', (['"""tests/data/adult.csv"""'], {}), "('tests/data/adult.csv')\n", (247, 271), True, 'import pandas as pd\n'), ((296, 357), 'sklearn.model_selection.train_test_split', 'train_test_split', (['income_df'], {'test_size': '(0.97)', 'random_state': '(123)'}), '(income_df, tes... |
# -*- coding: utf-8 -*-
# Copyright 2015 Elico Corp
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
import unittest
from addons import *
class RepoTest(unittest.TestCase):
def test_check_is_url(self):
remote_url = 'connector'
self.repo = Repo(remote_url)
self.assertTrue(se... | [
"unittest.main"
] | [((8013, 8028), 'unittest.main', 'unittest.main', ([], {}), '()\n', (8026, 8028), False, 'import unittest\n')] |
from core.models import GitlabUser
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from social_django.models import UserSocialAuth
@receiver(post_save, sender=UserSocialAuth)
def create_gitlab_user(sender, instance, **kwargs):
def cre... | [
"django.dispatch.receiver",
"core.models.GitlabUser.objects.create",
"django.contrib.auth.models.User.objects.get",
"core.models.GitlabUser.objects.get"
] | [((214, 256), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'UserSocialAuth'}), '(post_save, sender=UserSocialAuth)\n', (222, 256), False, 'from django.dispatch import receiver\n'), ((642, 679), 'django.contrib.auth.models.User.objects.get', 'User.objects.get', ([], {'id': 'instance.user_id'}), '(i... |
#!/Users/zachmcquiston/ReactProjects/saleor/bin/python3.7
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| [
"django.core.management.execute_from_command_line"
] | [((125, 163), 'django.core.management.execute_from_command_line', 'management.execute_from_command_line', ([], {}), '()\n', (161, 163), False, 'from django.core import management\n')] |
# -*- coding: utf-8 -*-
"""FFT functions.
This module contains FFT functions that support centered operation.
"""
import numpy as np
from sigpy import backend, config, interp, util
if config.cupy_enabled:
import cupy as cp
__all__ = ['fft', 'ifft', 'nufft', 'nufft_adjoint', 'estimate_shape']
def fft(input, o... | [
"numpy.i0",
"sigpy.util._normalize_axes",
"sigpy.interp.gridding",
"numpy.issubdtype",
"sigpy.backend.get_device",
"sigpy.util.resize",
"sigpy.interp.interpolate",
"sigpy.backend.to_device",
"numpy.arange"
] | [((799, 824), 'sigpy.backend.get_device', 'backend.get_device', (['input'], {}), '(input)\n', (817, 824), False, 'from sigpy import backend, config, interp, util\n'), ((1806, 1831), 'sigpy.backend.get_device', 'backend.get_device', (['input'], {}), '(input)\n', (1824, 1831), False, 'from sigpy import backend, config, i... |
import os
import logging
import src.globals as glo
class CustomAdapter(logging.LoggerAdapter):
"""
https://docs.python.org/2/howto/logging-cookbook.html#using
-loggeradapters-to-impart-contextual-information
This example adapter expects the passed in dict-like object to have a
'connid' key, whose ... | [
"logging.getLogger",
"logging.Formatter",
"os.path.join",
"logging.FileHandler"
] | [((3016, 3060), 'os.path.join', 'os.path.join', (['glo.DIR_PROJECT', '"""pyspark.log"""'], {}), "(glo.DIR_PROJECT, 'pyspark.log')\n", (3028, 3060), False, 'import os\n'), ((2134, 2161), 'logging.getLogger', 'logging.getLogger', (['log_name'], {}), '(log_name)\n', (2151, 2161), False, 'import logging\n'), ((2247, 2282),... |
# tests.test_target.test_class_balance
# Tests for the ClassBalance visualizer
#
# Author: <NAME>
# Created: Thu Jul 19 10:21:49 2018 -0400
#
# Copyright (C) 2018 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: test_class_balance.py [d742c57] <EMAIL> $
"""
Tests for the ClassBalance visual... | [
"yellowbrick.datasets.load_occupancy",
"sklearn.model_selection.train_test_split",
"tests.fixtures.Split",
"pytest.raises",
"pytest.mark.skipif",
"tests.fixtures.Dataset",
"sklearn.datasets.make_classification"
] | [((1702, 1731), 'sklearn.datasets.make_classification', 'make_classification', ([], {}), '(**kwargs)\n', (1721, 1731), False, 'from sklearn.datasets import make_classification\n'), ((1916, 1929), 'tests.fixtures.Dataset', 'Dataset', (['X', 'y'], {}), '(X, y)\n', (1923, 1929), False, 'from tests.fixtures import Dataset,... |
# ! /usr/bin/python
# -*- coding: utf-8 -*-
# =============================================================================
# Copyright 2020 NVIDIA. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obta... | [
"pytest.mark.usefixtures",
"nemo.core.run_only_on_device"
] | [((906, 947), 'pytest.mark.usefixtures', 'pytest.mark.usefixtures', (['"""neural_factory"""'], {}), "('neural_factory')\n", (929, 947), False, 'import pytest\n'), ((1246, 1292), 'nemo.core.run_only_on_device', 'run_only_on_device', ([], {'device_type': 'DeviceType.CPU'}), '(device_type=DeviceType.CPU)\n', (1264, 1292),... |
from app import db
class Appointment(db.Model):
__tablename__ = 'appointment'
id = db.Column(db.Integer, primary_key=True)
start = db.Column(db.DateTime, nullable=False)
end = db.Column(db.DateTime, nullable=False)
description = db.Column(db.String(1000, collation='utf8_general_ci'),
... | [
"app.db.String",
"app.db.Column",
"app.db.ForeignKey"
] | [((94, 133), 'app.db.Column', 'db.Column', (['db.Integer'], {'primary_key': '(True)'}), '(db.Integer, primary_key=True)\n', (103, 133), False, 'from app import db\n'), ((146, 184), 'app.db.Column', 'db.Column', (['db.DateTime'], {'nullable': '(False)'}), '(db.DateTime, nullable=False)\n', (155, 184), False, 'from app i... |
# ----------------------------------------------------------------------------
# Copyright 2015-2016 Nervana Systems Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apa... | [
"neon.initializers.GlorotUniform",
"neon.transforms.Logistic",
"neon.layers.MergeMultistream",
"neon.initializers.Uniform",
"neon.layers.LookupTable",
"neon.data.BABI",
"neon.models.Model",
"neon.initializers.Orthonormal",
"neon.transforms.Softmax",
"neon.transforms.Tanh"
] | [((2000, 2045), 'neon.data.BABI', 'BABI', ([], {'path': 'data_dir', 'task': 'task', 'subset': 'subset'}), '(path=data_dir, task=task, subset=subset)\n', (2004, 2045), False, 'from neon.data import BABI\n'), ((3295, 3315), 'neon.models.Model', 'Model', ([], {'layers': 'layers'}), '(layers=layers)\n', (3300, 3315), False... |
from tkinter import *
from math import *
from random import randrange
import random
from copy import deepcopy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from random import randrange
haut =50 #hauteur du tableau
larg =50 #largeur du tableau
cote =10 #dimension d'une case... | [
"random.randrange",
"random.choice",
"copy.deepcopy",
"matplotlib.pyplot.show"
] | [((8662, 8672), 'matplotlib.pyplot.show', 'plt.show', ([], {}), '()\n', (8670, 8672), True, 'import matplotlib.pyplot as plt\n'), ((2909, 2923), 'random.randrange', 'randrange', (['(100)'], {}), '(100)\n', (2918, 2923), False, 'from random import randrange\n'), ((4887, 4900), 'random.randrange', 'randrange', (['(10)'],... |
from django.test import TestCase
from dojo.tools.bugcrowd.parser import BugCrowdCSVParser
from dojo.models import Test
class TestBugCrowdParser(TestCase):
def test_parse_without_file_has_no_findings(self):
parser = BugCrowdCSVParser(None, Test())
self.assertEqual(0, len(parser.items))
def te... | [
"dojo.models.Test"
] | [((254, 260), 'dojo.models.Test', 'Test', ([], {}), '()\n', (258, 260), False, 'from dojo.models import Test\n'), ((490, 496), 'dojo.models.Test', 'Test', ([], {}), '()\n', (494, 496), False, 'from dojo.models import Test\n'), ((727, 733), 'dojo.models.Test', 'Test', ([], {}), '()\n', (731, 733), False, 'from dojo.mode... |
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from profiles_api import views
router = DefaultRouter()
router.register('hello-viewset',views.HelloViewSet,base_name='hvset2')
router.register('profile', views.UserProfileViewSet)
router.register('feed', views.UserProfileFeedViewSet... | [
"django.urls.include",
"profiles_api.views.UserLoginApiView.as_view",
"profiles_api.views.HelloApiView.as_view",
"profiles_api.views.HelloApiView2.as_view",
"rest_framework.routers.DefaultRouter"
] | [((128, 143), 'rest_framework.routers.DefaultRouter', 'DefaultRouter', ([], {}), '()\n', (141, 143), False, 'from rest_framework.routers import DefaultRouter\n'), ((405, 433), 'profiles_api.views.HelloApiView.as_view', 'views.HelloApiView.as_view', ([], {}), '()\n', (431, 433), False, 'from profiles_api import views\n'... |
import unittest
from solutions.home.non_unique_elements import my_solution
class TestSolution(unittest.TestCase):
def test_solution(self):
self.assertIsInstance(my_solution([1]), list)
self.assertEqual(my_solution([1, 2, 3, 1, 3]), [1, 3, 1, 3])
self.assertEqual(my_solution([1, 2, 3, 4, ... | [
"unittest.main",
"solutions.home.non_unique_elements.my_solution"
] | [((516, 531), 'unittest.main', 'unittest.main', ([], {}), '()\n', (529, 531), False, 'import unittest\n'), ((177, 193), 'solutions.home.non_unique_elements.my_solution', 'my_solution', (['[1]'], {}), '([1])\n', (188, 193), False, 'from solutions.home.non_unique_elements import my_solution\n'), ((226, 254), 'solutions.h... |
# Provides current locations of all the global paths.
import pathlib
_stage = 2
def init(distdir, masterdir, hostdir):
global _ddir, _mdir, _hdir, _srcs, _cbdir
cwd = pathlib.Path.cwd()
_ddir = pathlib.Path(distdir)
_mdir = (cwd / masterdir).resolve()
_hdir = (cwd / hostdir).resolve()
_srcs... | [
"pathlib.Path.cwd",
"pathlib.Path"
] | [((179, 197), 'pathlib.Path.cwd', 'pathlib.Path.cwd', ([], {}), '()\n', (195, 197), False, 'import pathlib\n'), ((210, 231), 'pathlib.Path', 'pathlib.Path', (['distdir'], {}), '(distdir)\n', (222, 231), False, 'import pathlib\n')] |
from django.shortcuts import render, HttpResponse
# Create your views here.
def home(request):
return HttpResponse("Welcome")
def about(request):
return HttpResponse("About page") | [
"django.shortcuts.HttpResponse"
] | [((107, 130), 'django.shortcuts.HttpResponse', 'HttpResponse', (['"""Welcome"""'], {}), "('Welcome')\n", (119, 130), False, 'from django.shortcuts import render, HttpResponse\n'), ((163, 189), 'django.shortcuts.HttpResponse', 'HttpResponse', (['"""About page"""'], {}), "('About page')\n", (175, 189), False, 'from djang... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
File: questionnaire.py
Author: SpaceLis
Email: <EMAIL>
Github: none
Description:
Make data for questionnaires
"""
import sys
import json
import logging
import pandas as pd
def merge_expertise(expertise_file, ranking_file):
""" Merge estimated expertise for ea... | [
"pandas.DataFrame",
"logging.basicConfig",
"pandas.read_csv"
] | [((1190, 1215), 'pandas.read_csv', 'pd.read_csv', (['ranking_file'], {}), '(ranking_file)\n', (1201, 1215), True, 'import pandas as pd\n'), ((1530, 1577), 'pandas.DataFrame', 'pd.DataFrame', (['ue_list'], {'columns': 'EXPERTISE_SCHEMA'}), '(ue_list, columns=EXPERTISE_SCHEMA)\n', (1542, 1577), True, 'import pandas as pd... |
"""
.. See the NOTICE file distributed with this work for additional information
regarding copyright ownership.
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.... | [
"flask_restful.reqparse.RequestParser",
"flask_restful.Api",
"flask.jsonify",
"yaml.load",
"flask.current_app.genome_store.check_if_genome_exists",
"flask.abort",
"flask.Blueprint",
"flask.current_app.genome_store.get_genome"
] | [((844, 874), 'flask.Blueprint', 'Blueprint', (['"""genomes"""', '__name__'], {}), "('genomes', __name__)\n", (853, 874), False, 'from flask import Blueprint, jsonify, make_response, abort\n'), ((881, 896), 'flask_restful.Api', 'Api', (['genomes_bp'], {}), '(genomes_bp)\n', (884, 896), False, 'from flask_restful import... |
import re
from .red_eclipse_server import RedEclipseServer
import typing
if typing.TYPE_CHECKING:
from .remote_master_server import RemoteMasterServer
class ServerListParser:
def __init__(self, remote_master_server: "RemoteMasterServer"):
self._remote_master_server = remote_master_server
def p... | [
"re.match"
] | [((465, 574), 're.match', 're.match', (['b\'addserver ([0-9\\\\.]+) ([0-9]+) ([0-9-]+) "([^"]+)" "([^"]*)" "([^"]*)" "([^"]*)"\'', 'line'], {}), '(\n b\'addserver ([0-9\\\\.]+) ([0-9]+) ([0-9-]+) "([^"]+)" "([^"]*)" "([^"]*)" "([^"]*)"\'\n , line)\n', (473, 574), False, 'import re\n')] |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"maya.cmds.intField",
"maya.cmds.ls",
"re.compile",
"os.path.split",
"maya.cmds.textField",
"maya.cmds.SaveScene",
"os.path.basename",
"maya.cmds.file",
"maya.cmds.getAttr",
"maya.cmds.optionMenu"
] | [((4318, 4334), 're.compile', 're.compile', (['"""#+"""'], {}), "('#+')\n", (4328, 4334), False, 'import re\n'), ((1164, 1216), 'maya.cmds.getAttr', 'cmds.getAttr', (['"""defaultRenderGlobals.imageFilePrefix"""'], {}), "('defaultRenderGlobals.imageFilePrefix')\n", (1176, 1216), False, 'from maya import mel, cmds\n'), (... |
"""
datalite3.constraints module introduces constraint
types that can be used to hint field variables,
that can be used to signal datalite decorator
constraints in the database.
"""
from typing import TypeVar, Union, Tuple, List
T = TypeVar('T')
# TODO: starting with Python 3.9 the Annotated type is avai... | [
"typing.TypeVar"
] | [((246, 258), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (253, 258), False, 'from typing import TypeVar, Union, Tuple, List\n')] |
import traceback
from .celery import app
from .models import Stack
from .stack_processor import process_stack, StackPostProcessingError, send_update
@app.task
def process_stack_task(stack_name):
stack = Stack.objects.get(name=stack_name)
if stack.status != Stack.ENQUEUED_STATUS:
return
try:
... | [
"traceback.format_exc"
] | [((732, 754), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (752, 754), False, 'import traceback\n'), ((911, 933), 'traceback.format_exc', 'traceback.format_exc', ([], {}), '()\n', (931, 933), False, 'import traceback\n')] |
import pandas as pd
IN_FILE = 'aus-domain-urls.txt'
START_IDX = 1186
BLOCK_SIZE = 100
OUT_FILE_PREFIX = 'partition_data/aus-domain-urls'
data = pd.read_csv(IN_FILE)
data_length = len(data)
for i in range(int(data_length - START_IDX / BLOCK_SIZE)):
if i == 0:
lower_bound = START_IDX
else:
lower... | [
"pandas.read_csv"
] | [((146, 166), 'pandas.read_csv', 'pd.read_csv', (['IN_FILE'], {}), '(IN_FILE)\n', (157, 166), True, 'import pandas as pd\n')] |
#!/usr/bin/python3
# coding: utf-8
import paho.mqtt.client as mqtt
from network.driver import Driver, error_management
import time
import json
from log import logger
from distutils.util import strtobool
class Blind(Driver):
def __init__(self, broker_ip, mac, version):
Driver.__init__(self, broker_ip, "b... | [
"network.driver.Driver.__init__",
"json.loads",
"distutils.util.strtobool",
"json.dumps",
"time.sleep",
"log.logger.info",
"time.time"
] | [((285, 347), 'network.driver.Driver.__init__', 'Driver.__init__', (['self', 'broker_ip', "('blind/' + mac)", 'mac', 'version'], {}), "(self, broker_ip, 'blind/' + mac, mac, version)\n", (300, 347), False, 'from network.driver import Driver, error_management\n'), ((3596, 3612), 'json.loads', 'json.loads', (['data'], {}... |
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"os.path.exists",
"sys.platform.startswith",
"os.path.abspath",
"numpy.sum",
"os.path.sep.join",
"paddle.to_tensor",
"paddle.dot",
"site.getsitepackages",
"numpy.random.uniform",
"unittest.main",
"os.system",
"paddle.set_device"
] | [((2921, 2936), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2934, 2936), False, 'import unittest\n'), ((1044, 1058), 'os.system', 'os.system', (['cmd'], {}), '(cmd)\n', (1053, 1058), False, 'import os\n'), ((1787, 1852), 'os.path.sep.join', 'os.path.sep.join', (["[paddle_lib_path, '..', '..', 'paddle-plugins']... |
# coding:utf-8
# Test for upsample_2d
# Created : 7, 5, 2018
# Revised : 7, 5, 2018
# All rights reserved
#------------------------------------------------------------------------------------------------
__author__ = 'dawei.leng'
import os, sys
os.environ['THEANO_FLAGS'] = "floatX=float32, mode=FAST_RUN, warn... | [
"numpy.abs",
"lasagne_ext.utils.get_layer_by_name",
"theano.function",
"numpy.random.rand",
"lasagne.layers.InputLayer",
"os.path.split",
"lasagne.layers.get_output",
"numpy.random.randint",
"theano.tensor.ftensor4",
"lasagne.layers.Upscale2DLayer",
"dandelion.functional.upsample_2d"
] | [((577, 610), 'os.path.split', 'os.path.split', (['dandelion.__file__'], {}), '(dandelion.__file__)\n', (590, 610), False, 'import os, sys\n'), ((1124, 1144), 'theano.tensor.ftensor4', 'tensor.ftensor4', (['"""x"""'], {}), "('x')\n", (1139, 1144), False, 'from theano import tensor\n'), ((1174, 1252), 'lasagne.layers.In... |
# -*- coding: utf-8 -*-
from .derivest import derivest
import numpy as np
def directional_diff(fun, x, d, par = None, normalize = True, **kwargs):
"""
Estimate the directional derivative of a function of n variables.
Uses the derivest method to provide both a directional derivative
and an error e... | [
"numpy.array",
"numpy.zeros_like",
"numpy.sum"
] | [((2724, 2753), 'numpy.array', 'np.array', (['d'], {'dtype': 'np.float64'}), '(d, dtype=np.float64)\n', (2732, 2753), True, 'import numpy as np\n'), ((2651, 2662), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (2659, 2662), True, 'import numpy as np\n'), ((3022, 3038), 'numpy.zeros_like', 'np.zeros_like', (['d'], {}... |
import tensorflow as tf
cluster = tf.train.ClusterSpec({"local": ["192.168.122.171:2222", "192.168.122.40:2222"]})
x = tf.constant(2)
with tf.device("/job:local/task:1"):
y2 = x - 66
with tf.device("/job:local/task:0"):
y1 = x + 300
y = y1 + y2
with tf.Session("grpc://192.168.122.40:2222") as sess:
... | [
"tensorflow.train.ClusterSpec",
"tensorflow.device",
"tensorflow.Session",
"tensorflow.constant"
] | [((36, 121), 'tensorflow.train.ClusterSpec', 'tf.train.ClusterSpec', (["{'local': ['192.168.122.171:2222', '192.168.122.40:2222']}"], {}), "({'local': ['192.168.122.171:2222', '192.168.122.40:2222']}\n )\n", (56, 121), True, 'import tensorflow as tf\n'), ((122, 136), 'tensorflow.constant', 'tf.constant', (['(2)'], {... |
from django.contrib import admin
from .models import User, Listings, Bids, Comments, Watchlist
# admin user interface can be used to view, add, edit, delete from tables
# Use 'python manage.py createsuperuser' to create a superuser logged_in_user
# access admin page using '/admin'
# Register your models here.
admin.s... | [
"django.contrib.admin.site.register"
] | [((313, 338), 'django.contrib.admin.site.register', 'admin.site.register', (['User'], {}), '(User)\n', (332, 338), False, 'from django.contrib import admin\n'), ((339, 368), 'django.contrib.admin.site.register', 'admin.site.register', (['Listings'], {}), '(Listings)\n', (358, 368), False, 'from django.contrib import ad... |
import sys
from urllib.parse import urljoin, urlparse
from flask import Blueprint, abort, redirect, render_template, request, url_for
from flask_login import current_user, login_required, login_user, logout_user
from config.settings import users_collection
from web_messaging.blueprints.user.models import Anonymous, U... | [
"flask.render_template",
"web_messaging.blueprints.user.models.User",
"flask.request.args.get",
"urllib.parse.urlparse",
"flask_login.login_user",
"flask_login.logout_user",
"web_messaging.extensions.bc.generate_password_hash",
"flask.url_for",
"web_messaging.extensions.bc.check_password_hash",
"u... | [((394, 450), 'flask.Blueprint', 'Blueprint', (['"""user"""', '__name__'], {'template_folder': '"""templates"""'}), "('user', __name__, template_folder='templates')\n", (403, 450), False, 'from flask import Blueprint, abort, redirect, render_template, request, url_for\n'), ((570, 599), 'flask.render_template', 'render_... |
from multiprocessing import Queue
from pypykatz_server.server import *
from pypykatz_server.resultprocess import ResultProcessing
if __name__ == '__main__':
import argparse
import glob
parser = argparse.ArgumentParser(description='PypyKatz server')
subparsers = parser.add_subparsers(help = 'servertype')
su... | [
"pypykatz_server.resultprocess.ResultProcessing",
"multiprocessing.Queue",
"argparse.ArgumentParser"
] | [((203, 257), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""PypyKatz server"""'}), "(description='PypyKatz server')\n", (226, 257), False, 'import argparse\n'), ((856, 863), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (861, 863), False, 'from multiprocessing import Queue\n'), ((... |
# snippet-comment:[These are tags for the AWS doc team's sample catalog. Do not remove.]
# snippet-sourcedescription:[list_findings.py lists Amazon Inspector findings.]
# snippet-service:[inspector]
# snippet-keyword:[Amazon Inspector]
# snippet-keyword:[Python]
# snippet-keyword:[Code Sample]
# snippet-sourcetype:[sni... | [
"datetime.datetime",
"boto3.client"
] | [((1247, 1267), 'datetime.datetime', 'datetime', (['(2019)', '(1)', '(1)'], {}), '(2019, 1, 1)\n', (1255, 1267), False, 'from datetime import datetime\n'), ((1279, 1300), 'datetime.datetime', 'datetime', (['(2019)', '(12)', '(1)'], {}), '(2019, 12, 1)\n', (1287, 1300), False, 'from datetime import datetime\n'), ((1314,... |
import datetime
import mock
import pytest
from aiohttp import ClientSession
from pytest_mock import MockerFixture
from topgg import DBLClient, StatsWrapper
from topgg.autopost import AutoPoster
from topgg.errors import ServerError, TopGGException, Unauthorized
@pytest.fixture
def session() -> ClientSes... | [
"mock.Mock",
"topgg.errors.ServerError",
"pytest.raises",
"topgg.errors.Unauthorized",
"datetime.timedelta",
"topgg.DBLClient"
] | [((338, 362), 'mock.Mock', 'mock.Mock', (['ClientSession'], {}), '(ClientSession)\n', (347, 362), False, 'import mock\n'), ((653, 680), 'mock.Mock', 'mock.Mock', (['"""reason, status"""'], {}), "('reason, status')\n", (662, 680), False, 'import mock\n'), ((876, 887), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (885, 88... |
# Copyright 2015 Google 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, ... | [
"unittest.main",
"main.app.test_client"
] | [((2113, 2128), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2126, 2128), False, 'import unittest\n'), ((948, 970), 'main.app.test_client', 'main.app.test_client', ([], {}), '()\n', (968, 970), False, 'import main\n')] |
from django.test import TestCase
from events.models import Event, RawEvent
class EventTestsRuntimeTagValueTests(TestCase):
def test_runtime_tag_value(self):
event = Event(runtime_name="runtime", runtime_version="0.1")
self.assertEqual(event.runtime_tag_value(), "runtime-0.1")
def test_runti... | [
"events.models.RawEvent",
"events.models.Event"
] | [((180, 232), 'events.models.Event', 'Event', ([], {'runtime_name': '"""runtime"""', 'runtime_version': '"""0.1"""'}), "(runtime_name='runtime', runtime_version='0.1')\n", (185, 232), False, 'from events.models import Event, RawEvent\n'), ((369, 397), 'events.models.Event', 'Event', ([], {'runtime_version': '"""0.1"""'... |
from add_score_compute import add_score_compute
from Team import Team
from Member import Member
if __name__ == '__main__':
us_smile = Team("µ's smile", [
Member('UR_Honoka', 5540, 4, 0, 'Grade'),
Member('SSR_Honoka', 5860, 3, add_score_compute('note', 24, 0.31, 435), 'Grade... | [
"add_score_compute.add_score_compute",
"Member.Member"
] | [((179, 219), 'Member.Member', 'Member', (['"""UR_Honoka"""', '(5540)', '(4)', '(0)', '"""Grade"""'], {}), "('UR_Honoka', 5540, 4, 0, 'Grade')\n", (185, 219), False, 'from Member import Member\n'), ((445, 482), 'Member.Member', 'Member', (['"""SSR_Rin"""', '(5920)', '(3)', '(0)', '"""Unit"""'], {}), "('SSR_Rin', 5920, ... |
# -*- coding: utf-8 -*-
"""
@Time: 2021/9/2 14:54
@Author: zzhang <EMAIL>
@File: dir_tree.py
@desc:
"""
from collect.service_imp.flow.omnis_ssh import OmnisSSHService
from collect.utils.collect_utils import get_safe_data
class FileContent(OmnisSSHService):
fc_const = {
"file_name": "file",
}
def... | [
"os.path.exists",
"collect.service_imp.common.filters.template_tool.TemplateTool"
] | [((706, 740), 'collect.service_imp.common.filters.template_tool.TemplateTool', 'TemplateTool', ([], {'op_user': 'self.op_user'}), '(op_user=self.op_user)\n', (718, 740), False, 'from collect.service_imp.common.filters.template_tool import TemplateTool\n'), ((882, 902), 'os.path.exists', 'os.path.exists', (['file'], {})... |
# Copyright 2021 <NAME>
#
# 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, softw... | [
"pypipeline.cellio.Output",
"pypipeline.connection.Connection",
"pypipeline.cellio.InputPort",
"pypipeline.cellio.InternalInput",
"pypipeline.cellio.RuntimeParameter",
"pypipeline.cellio.OutputPort",
"pypipeline.cellio.Input",
"pypipeline.cellio.InternalOutput",
"pytest.raises",
"pytest.fixture",
... | [((1790, 1806), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1804, 1806), False, 'import pytest\n'), ((1884, 1900), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1898, 1900), False, 'import pytest\n'), ((1964, 1980), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (1978, 1980), False, 'import p... |
import unittest
import pyslow5 as slow5
import time
import numpy as np
"""
Run from root dir of repo after making pyslow5
python3 -m unittest -v python/test.py
"""
#globals
debug = 0 #TODO: make this an argument with -v
class TestBase(unittest.TestCase):
def setUp(self):
self.s5 = slow5.Open('e... | [
"unittest.main",
"pyslow5.Open"
] | [((10413, 10428), 'unittest.main', 'unittest.main', ([], {}), '()\n', (10426, 10428), False, 'import unittest\n'), ((307, 361), 'pyslow5.Open', 'slow5.Open', (['"""examples/example.slow5"""', '"""r"""'], {'DEBUG': 'debug'}), "('examples/example.slow5', 'r', DEBUG=debug)\n", (317, 361), True, 'import pyslow5 as slow5\n'... |
import torch
import gym
from collections import deque
from typing import List, Union
from rlkit.samplers.data_collector.base import PathCollector
from self_supervised.base.data_collector.rollout import Rollouter
from self_supervised.policy.skill_policy import MakeDeterministic, \
SkillTanhGaussianPolicy
import se... | [
"collections.deque",
"self_supervised.base.data_collector.rollout.Rollouter"
] | [((862, 907), 'collections.deque', 'deque', ([], {'maxlen': 'self._max_num_epoch_paths_saved'}), '(maxlen=self._max_num_epoch_paths_saved)\n', (867, 907), False, 'from collections import deque\n'), ((1065, 1103), 'self_supervised.base.data_collector.rollout.Rollouter', 'Rollouter', ([], {'env': 'env', 'policy': 'self.p... |
# -*- coding: utf-8 -*-
"""Command Line Interface Module
Module that contains the special command line tools
"""
import os
import uuid
from datetime import datetime, timedelta
from app.threads import UpdatePipelineData
def register(app):
@app.cli.command('seed_aff_types_db')
def seed_aff_types_db():
... | [
"app.db.session.commit",
"app.threads.UpdatePipelineData",
"app.db.session.merge",
"git.Repo.clone_from",
"app.models.Dataset.query.filter_by",
"app.models.User.query.filter",
"app.db.session.add",
"app.models.AffiliationType.query.filter",
"datetime.datetime.today",
"datetime.timedelta",
"app.m... | [((2419, 2438), 'app.db.session.commit', 'db.session.commit', ([], {}), '()\n', (2436, 2438), False, 'from app import db\n'), ((3847, 3867), 'app.threads.UpdatePipelineData', 'UpdatePipelineData', ([], {}), '()\n', (3865, 3867), False, 'from app.threads import UpdatePipelineData\n'), ((4866, 4898), 'datalad.api.Dataset... |
import unittest
import stocklab
from lib import StocklabTestCase
class TestNode(StocklabTestCase):
def setUp(self):
super().setUp()
from stocklab.node import Node, Args, Arg
class FooNode(Node):
args = Args(
a = Arg(),
b = Arg(type=int),
... | [
"unittest.main",
"stocklab.eval",
"stocklab.core.bundle.register",
"stocklab.node.Arg"
] | [((983, 998), 'unittest.main', 'unittest.main', ([], {}), '()\n', (996, 998), False, 'import unittest\n'), ((623, 674), 'stocklab.core.bundle.register', 'bundle.register', (['self.FooNode'], {'allow_overwrite': '(True)'}), '(self.FooNode, allow_overwrite=True)\n', (638, 674), False, 'from stocklab.core import bundle\n'... |
from unittest import TestCase
import os
import mock
from aws_lambda_builders import utils
from aws_lambda_builders.path_resolver import PathResolver
class TestPathResolver(TestCase):
def setUp(self):
self.path_resolver = PathResolver(runtime="chitti2.0", binary="chitti")
def test_inits(self):
... | [
"mock.patch.object",
"aws_lambda_builders.path_resolver.PathResolver",
"os.getcwd"
] | [((237, 287), 'aws_lambda_builders.path_resolver.PathResolver', 'PathResolver', ([], {'runtime': '"""chitti2.0"""', 'binary': '"""chitti"""'}), "(runtime='chitti2.0', binary='chitti')\n", (249, 287), False, 'from aws_lambda_builders.path_resolver import PathResolver\n'), ((661, 708), 'mock.patch.object', 'mock.patch.ob... |
import os
import sub_module # Important, do not remove!
from harvester.theharvester import HarvesterBot
from sc2 import Race
from sc2.player import Bot
from bot_loader import GameStarter, BotDefinitions
from version import update_version_txt
def add_definitions(definitions: BotDefinitions):
definitions.add_bot... | [
"bot_loader.BotDefinitions",
"os.path.join",
"bot_loader.GameStarter",
"os.path.abspath",
"version.update_version_txt",
"bot_loader.BotDefinitions.index_check"
] | [((681, 701), 'version.update_version_txt', 'update_version_txt', ([], {}), '()\n', (699, 701), False, 'from version import update_version_txt\n'), ((783, 803), 'os.path.join', 'os.path.join', (['"""Bots"""'], {}), "('Bots')\n", (795, 803), False, 'import os\n'), ((827, 867), 'os.path.join', 'os.path.join', (['root_dir... |
"""
Tests for a running Pyro server, without timeouts.
Pyro - Python Remote Objects. Copyright by <NAME> (<EMAIL>).
"""
import time
import threading
import serpent
import pytest
import Pyro5.core
import Pyro5.client
import Pyro5.server
import Pyro5.errors
import Pyro5.serializers
import Pyro5.protocol
import Pyro5.c... | [
"time.sleep",
"threading.Event",
"pytest.raises",
"copy.copy",
"time.time",
"serpent.tobytes"
] | [((1069, 1086), 'time.sleep', 'time.sleep', (['delay'], {}), '(delay)\n', (1079, 1086), False, 'import time\n'), ((1124, 1141), 'time.sleep', 'time.sleep', (['delay'], {}), '(delay)\n', (1134, 1141), False, 'import time\n'), ((1230, 1247), 'time.sleep', 'time.sleep', (['delay'], {}), '(delay)\n', (1240, 1247), False, '... |
# system packages
from pathlib import Path
from typing import List
import re
# local packages
from src.config import Config
from src.plot import Plot
class Plots:
'''
Process plots in log files. A log file may contain more than one plot entry.
'''
def __init__ (self, config:Config) -> None:
self._config ... | [
"src.plot.Plot",
"re.findall"
] | [((1267, 1300), 're.findall', 're.findall', (['pattern', 'data_replace'], {}), '(pattern, data_replace)\n', (1277, 1300), False, 'import re\n'), ((1521, 1561), 'src.plot.Plot', 'Plot', (['self._config', 'log_file_path', 'index'], {}), '(self._config, log_file_path, index)\n', (1525, 1561), False, 'from src.plot import ... |
import unittest
from pygame.tests.test_utils import question, prompt
import pygame
pygame.cdrom.init()
# The number of CD drives available for testing.
CD_DRIVE_COUNT = pygame.cdrom.get_count()
pygame.cdrom.quit()
class CDROMModuleTest(unittest.TestCase):
def setUp(self):
pygame.cdrom.ini... | [
"pygame.tests.test_utils.prompt",
"pygame.tests.test_utils.question",
"pygame.cdrom.init",
"unittest.skipIf",
"pygame.cdrom.get_count",
"pygame.cdrom.quit",
"pygame.cdrom.get_init",
"unittest.main",
"pygame.cdrom.CD"
] | [((92, 111), 'pygame.cdrom.init', 'pygame.cdrom.init', ([], {}), '()\n', (109, 111), False, 'import pygame\n'), ((180, 204), 'pygame.cdrom.get_count', 'pygame.cdrom.get_count', ([], {}), '()\n', (202, 204), False, 'import pygame\n'), ((206, 225), 'pygame.cdrom.quit', 'pygame.cdrom.quit', ([], {}), '()\n', (223, 225), F... |
import discord
import datetime
class sets:
__slots__ = ["checkFile", "channels", "Tags", "APIToken", "token"]
def __init__(self, token, APIToken=None, **kwargs):
self.checkFile = kwargs.get("checkFile", "check.json")
self.channels = list(map(int, kwargs.get("channels", "").split()))
s... | [
"datetime.datetime.utcnow"
] | [((1477, 1503), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (1501, 1503), False, 'import datetime\n')] |
# -*- coding: utf-8 -*-
# Copyright 2018, IBM.
#
# This source code is licensed under the Apache License, Version 2.0 found in
# the LICENSE.txt file in the root directory of this source tree.
"""Tests for the wrapper functionality."""
import unittest
from qiskit.providers.ibmq import IBMQ
from qiskit.tools.monitor... | [
"qiskit.tools.monitor.backend_overview",
"qiskit.providers.ibmq.IBMQ.enable_account",
"qiskit.providers.ibmq.IBMQ.backends",
"unittest.main",
"qiskit.tools.monitor.backend_monitor"
] | [((1047, 1073), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (1060, 1073), False, 'import unittest\n'), ((615, 652), 'qiskit.providers.ibmq.IBMQ.enable_account', 'IBMQ.enable_account', (['qe_token', 'qe_url'], {}), '(qe_token, qe_url)\n', (634, 652), False, 'from qiskit.providers.ibm... |
from glob import glob
import pytube
import pytube.exceptions
import requests
import urllib.request
import urllib.parse
import os
import colors
import utils
import units
import messages
import zipfile
import time
CWD = os.getcwd()
def SearchForVideos(query:str) -> str:
Search = pytube.Search(query... | [
"os.path.exists",
"zipfile.ZipFile",
"pytube.Playlist",
"os.makedirs",
"units.Data.FindFitUnitSize",
"time.strftime",
"pytube.YouTube",
"messages.ERR_NOT_YOUTUBE_VIDEO_URL_OR_ID_REMATCHERR.replace",
"requests.get",
"os.getcwd",
"utils.UncompleteSentence",
"utils.printProgressBar",
"pytube.Se... | [((233, 244), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (242, 244), False, 'import os\n'), ((301, 327), 'pytube.Search', 'pytube.Search', ([], {'query': 'query'}), '(query=query)\n', (314, 327), False, 'import pytube\n'), ((3857, 3876), 'pytube.YouTube', 'pytube.YouTube', (['url'], {}), '(url)\n', (3871, 3876), False... |
import datetime
from dataclasses import dataclass
import aiohttp
from typing import Optional, TYPE_CHECKING
if TYPE_CHECKING:
from purdue.models import Address, Meal
@dataclass
class Location:
id: str
name: str
formal_name: str
phone_number: str
latitude: str
longitude: str
short_name... | [
"aiohttp.ClientSession",
"datetime.date.today"
] | [((861, 884), 'aiohttp.ClientSession', 'aiohttp.ClientSession', ([], {}), '()\n', (882, 884), False, 'import aiohttp\n'), ((1014, 1035), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (1033, 1035), False, 'import datetime\n')] |
from setuptools import setup
setup(
name='libris',
version='1.1.0',
description='PDF generator that uses Markdown sources.',
url='https://github.com/lazy-scrivener-games/libris',
download_url='https://github.com/lazy-scrivener-games/libris/archive/refs/tags/v1.1.tar.gz',
author='<NAME>',
aut... | [
"setuptools.setup"
] | [((29, 1198), 'setuptools.setup', 'setup', ([], {'name': '"""libris"""', 'version': '"""1.1.0"""', 'description': '"""PDF generator that uses Markdown sources."""', 'url': '"""https://github.com/lazy-scrivener-games/libris"""', 'download_url': '"""https://github.com/lazy-scrivener-games/libris/archive/refs/tags/v1.1.ta... |
import unittest
from typing import List
from sorting import bubble_sort
arr: List[int] = [10, 2, 1, 7, 5, 3, 4, 6, 8, 9]
class TestInsertionSort(unittest.TestCase):
def test_bubble_sort_asc(self):
expected: List[int] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
bubble_sort.bubble_sort(arr)
self.asse... | [
"unittest.main",
"sorting.bubble_sort.bubble_sort"
] | [((861, 876), 'unittest.main', 'unittest.main', ([], {}), '()\n', (874, 876), False, 'import unittest\n'), ((274, 302), 'sorting.bubble_sort.bubble_sort', 'bubble_sort.bubble_sort', (['arr'], {}), '(arr)\n', (297, 302), False, 'from sorting import bubble_sort\n'), ((451, 485), 'sorting.bubble_sort.bubble_sort', 'bubble... |
from PIL import Image
from numpy import *
im_man = array(Image.open('man.jpg').convert('L'),'f')
im_j = array(Image.open('j.jpg').convert('L'),'f')
im_t = array(Image.open('t.jpg').convert('L'),'f')
pil_man = Image.fromarray(uint8(im_man))
pil_man.save('conver/im_man.jpg')
Image.fromarray(uint8(im_j)).save('conver/i... | [
"PIL.Image.open"
] | [((58, 79), 'PIL.Image.open', 'Image.open', (['"""man.jpg"""'], {}), "('man.jpg')\n", (68, 79), False, 'from PIL import Image\n'), ((111, 130), 'PIL.Image.open', 'Image.open', (['"""j.jpg"""'], {}), "('j.jpg')\n", (121, 130), False, 'from PIL import Image\n'), ((162, 181), 'PIL.Image.open', 'Image.open', (['"""t.jpg"""... |
from random import randrange
import re
def test_phones_on_home_page(app):
list_of_contacts_from_home_page = app.contact.get_contact_list()
index = randrange(len(list_of_contacts_from_home_page))
contact_from_home_page = list_of_contacts_from_home_page[index]
contact_from_edit_page = app.contact.get_con... | [
"re.sub"
] | [((2067, 2090), 're.sub', 're.sub', (['"""[() -]"""', '""""""', 's'], {}), "('[() -]', '', s)\n", (2073, 2090), False, 'import re\n')] |
import os
from testtools import TestCase
from testtools.matchers import Contains
from . import makeprefs
from mock import Mock, patch
from StringIO import StringIO
from twisted.internet import defer
class LoginCommandTest(TestCase):
def setUp(self):
super(LoginCommandTest, self).setUp()
self.pref... | [
"mock.patch",
"mock.Mock",
"os.path.join",
"testtools.matchers.Contains",
"lacli.main.LaLoginCommand",
"twisted.internet.defer.succeed"
] | [((695, 737), 'mock.patch', 'patch', (['"""sys.stdout"""'], {'new_callable': 'StringIO'}), "('sys.stdout', new_callable=StringIO)\n", (700, 737), False, 'from mock import Mock, patch\n'), ((1118, 1160), 'mock.patch', 'patch', (['"""sys.stdout"""'], {'new_callable': 'StringIO'}), "('sys.stdout', new_callable=StringIO)\n... |
# Space: O(n)
# Time: O(n)
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
import collections
class Solution:
def pseudoPalindromicPaths(self, root):
if root.l... | [
"collections.Counter"
] | [((916, 942), 'collections.Counter', 'collections.Counter', (['alist'], {}), '(alist)\n', (935, 942), False, 'import collections\n')] |
import argparse
import xml.etree.ElementTree as ET
import zipfile
from pathlib import Path
import sys
import pymap3d
import shapely.geometry as SHP
from descartes.patch import PolygonPatch
from matplotlib import pyplot as plt
from matplotlib.collections import PatchCollection, LineCollection
from shapely.geometry impor... | [
"zipfile.ZipFile",
"isoxmlviz.LineStringUtil.extract_lines_within",
"descartes.patch.PolygonPatch",
"matplotlib.collections.LineCollection",
"shapely.geometry.Polygon",
"xml.etree.ElementTree.parse",
"argparse.ArgumentParser",
"pathlib.Path",
"matplotlib.pyplot.close",
"matplotlib.pyplot.cla",
"... | [((445, 471), 'pymap3d.Ellipsoid', 'pymap3d.Ellipsoid', (['"""wgs84"""'], {}), "('wgs84')\n", (462, 471), False, 'import pymap3d\n'), ((759, 800), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""isoxmlviz"""'}), "(prog='isoxmlviz')\n", (782, 800), False, 'import argparse\n'), ((4715, 4726), 'mat... |
import datetime
import re
from .get_data import get_data
def Float(x):
try:
rtn = float(x)
except:
rtn = float('NaN')
return rtn
def get_jhu_ts():
stmp = __path__[0] # e.g. "../jhu"
stmp = re.split('jhu',stmp)[0] # e.g. "../"
base = stmp+'../covid-19-JH/csse_covid_19_data/cs... | [
"datetime.datetime.strptime",
"re.split",
"datetime.timedelta"
] | [((230, 251), 're.split', 're.split', (['"""jhu"""', 'stmp'], {}), "('jhu', stmp)\n", (238, 251), False, 'import re\n'), ((2060, 2095), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['dd', 'fmt'], {}), '(dd, fmt)\n', (2086, 2095), False, 'import datetime\n'), ((2153, 2195), 'datetime.datetime.strptime', ... |
from setuptools import setup
setup(
name='cgi_utils',
version='0.1.0',
url='https://github.com/zeevro/cgi_utils',
download_url='https://github.com/zeevro/cgi_utils/archive/master.zip',
author='<NAME>',
author_email='<EMAIL>',
maintainer='<NAME>',
maintainer_email='<EMAIL>',
classif... | [
"setuptools.setup"
] | [((31, 739), 'setuptools.setup', 'setup', ([], {'name': '"""cgi_utils"""', 'version': '"""0.1.0"""', 'url': '"""https://github.com/zeevro/cgi_utils"""', 'download_url': '"""https://github.com/zeevro/cgi_utils/archive/master.zip"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'maintainer': '"""<NAME>"""'... |
import paddle.fluid as fluid
from forwardAttentionLayer import ForwardAttention
from reverseAttentionLayer import ReverseAttention, ReverseMaskConv
class LBAMModel():
def __init__(self, num_filters):
self.num_filters = num_filters
def net(self, inputImgs, masks):
ef1, mu1, skipConnect1, forwa... | [
"forwardAttentionLayer.ForwardAttention",
"paddle.fluid.layers.concat",
"paddle.fluid.layers.tanh",
"reverseAttentionLayer.ReverseAttention",
"reverseAttentionLayer.ReverseMaskConv",
"paddle.fluid.layers.conv2d_transpose"
] | [((329, 377), 'forwardAttentionLayer.ForwardAttention', 'ForwardAttention', (['inputImgs', 'masks', '(64)'], {'bn': '(False)'}), '(inputImgs, masks, 64, bn=False)\n', (345, 377), False, 'from forwardAttentionLayer import ForwardAttention\n'), ((437, 468), 'forwardAttentionLayer.ForwardAttention', 'ForwardAttention', ([... |
# coding=utf-8
# --------------------------------------------------------------------------
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is
# regenerated.
# --------------------------------------------------------------------------
from ... | [
"msrest.Serializer",
"msrest.Deserializer"
] | [((6140, 6165), 'msrest.Serializer', 'Serializer', (['client_models'], {}), '(client_models)\n', (6150, 6165), False, 'from msrest import Serializer, Deserializer\n'), ((6194, 6221), 'msrest.Deserializer', 'Deserializer', (['client_models'], {}), '(client_models)\n', (6206, 6221), False, 'from msrest import Serializer,... |
import turtle
import pandas
screen = turtle.Screen()
screen.title("U.S. States Game")
image = "blank_states_img.gif"
screen.addshape(image)
turtle.shape(image)
data = pandas.read_csv("50_states.csv")
states = data.state.to_list()
guessed_states = []
while len(guessed_states) < 50:
answer_states = screen.textinpu... | [
"turtle.shape",
"pandas.DataFrame",
"pandas.read_csv",
"turtle.mainloop",
"turtle.Screen",
"turtle.Turtle"
] | [((38, 53), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (51, 53), False, 'import turtle\n'), ((141, 160), 'turtle.shape', 'turtle.shape', (['image'], {}), '(image)\n', (153, 160), False, 'import turtle\n'), ((169, 201), 'pandas.read_csv', 'pandas.read_csv', (['"""50_states.csv"""'], {}), "('50_states.csv')\n", ... |
# Standard Libraries
# Third party packages
from pydantic import validator, root_validator
from pydantic.typing import Literal, List, Union, Optional
# Local package
from net_models.validators import *
from net_models.fields import *
from net_models.models import VendorIndependentBaseModel
# Local module
class Inter... | [
"pydantic.validator",
"pydantic.root_validator"
] | [((1787, 1819), 'pydantic.root_validator', 'root_validator', ([], {'allow_reuse': '(True)'}), '(allow_reuse=True)\n', (1801, 1819), False, 'from pydantic import validator, root_validator\n'), ((2151, 2205), 'pydantic.validator', 'validator', (['"""allowed_vlans"""'], {'pre': '(True)', 'allow_reuse': '(True)'}), "('allo... |
""" Real time calibration pipeline
"""
__all__ = ['rcal']
import collections
from rascil.data_models.memory_data_models import BlockVisibility, GainTable
from rascil.processing_components.visibility.base import copy_visibility
from rascil.processing_components.calibration.solvers import solve_gaintable
from rascil.... | [
"rascil.processing_components.calibration.solvers.solve_gaintable",
"rascil.processing_components.visibility.base.copy_visibility",
"rascil.processing_components.imaging.dft_skycomponent_visibility"
] | [((1034, 1070), 'rascil.processing_components.visibility.base.copy_visibility', 'copy_visibility', (['vischunk'], {'zero': '(True)'}), '(vischunk, zero=True)\n', (1049, 1070), False, 'from rascil.processing_components.visibility.base import copy_visibility\n'), ((1089, 1137), 'rascil.processing_components.imaging.dft_s... |
from typing import Optional, Union
from collections import defaultdict
from necrobot.league import leaguedb
from necrobot.gsheet.makerequest import make_request
from necrobot.gsheet.sheetrange import SheetRange
from necrobot.gsheet.spreadsheets import Spreadsheets
class StandingsSheet(object):
"""
Represents ... | [
"necrobot.gsheet.spreadsheets.Spreadsheets",
"necrobot.league.leaguedb.get_standings_data_raw",
"collections.defaultdict",
"necrobot.gsheet.makerequest.make_request"
] | [((2079, 2107), 'collections.defaultdict', 'defaultdict', (['(lambda : [0, 0])'], {}), '(lambda : [0, 0])\n', (2090, 2107), False, 'from collections import defaultdict\n'), ((861, 875), 'necrobot.gsheet.spreadsheets.Spreadsheets', 'Spreadsheets', ([], {}), '()\n', (873, 875), False, 'from necrobot.gsheet.spreadsheets i... |
"""
Created on February 28, 2020
@author: <NAME>
Implementation of vignette_filter function in the pymagine package.
"""
import numpy as np
import cv2
def vignette_filter(
image_path,
strength=1.0,
x=0.5,
y=0.5,
file_name="vignette.jpg"):
"""
Applies vignette filter to... | [
"cv2.getGaussianKernel",
"numpy.copy",
"cv2.imwrite",
"cv2.imread"
] | [((1923, 1948), 'cv2.imread', 'cv2.imread', (['image_path', '(1)'], {}), '(image_path, 1)\n', (1933, 1948), False, 'import cv2\n'), ((2661, 2675), 'numpy.copy', 'np.copy', (['image'], {}), '(image)\n', (2668, 2675), True, 'import numpy as np\n'), ((2978, 3016), 'cv2.imwrite', 'cv2.imwrite', (['file_name', 'image_modifi... |
from gatekeeping.db import get_db
from flask import abort
from datetime import datetime
def get_gatekeeping(id):
gatekeeping = get_db().execute(
'SELECT *'
' FROM gatekeeping '
' WHERE id = ?',
(id,)
).fetchone()
if gatekeeping is None:
abort(404, "Gatekeeping id {0... | [
"datetime.datetime.now",
"gatekeeping.db.get_db"
] | [((132, 140), 'gatekeeping.db.get_db', 'get_db', ([], {}), '()\n', (138, 140), False, 'from gatekeeping.db import get_db\n'), ((422, 430), 'gatekeeping.db.get_db', 'get_db', ([], {}), '()\n', (428, 430), False, 'from gatekeeping.db import get_db\n'), ((565, 579), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n... |
import connexion
from swagger_server.models.add_host_response import AddHostResponse
from swagger_server.models.host import Host
from datetime import date, datetime
from typing import List, Dict
from six import iteritems
from ..util import deserialize_date, deserialize_datetime
from orm.hosts import Hosts
def add_hos... | [
"orm.hosts.Hosts.add_host",
"orm.hosts.Hosts.get_hosts"
] | [((501, 526), 'orm.hosts.Hosts.add_host', 'Hosts.add_host', (['connexion'], {}), '(connexion)\n', (515, 526), False, 'from orm.hosts import Hosts\n'), ((738, 768), 'orm.hosts.Hosts.get_hosts', 'Hosts.get_hosts', (['offset', 'limit'], {}), '(offset, limit)\n', (753, 768), False, 'from orm.hosts import Hosts\n')] |
# -*- coding: utf-8 -*-
import itertools
from datetime import timedelta
import pendulum
_TIME_DENOMINATIONS = {
's': 'seconds',
'm': 'minutes',
'h': 'hours',
'd': 'days',
'w': 'weeks',
}
def duration_from_string(value):
value = value.replace(' ', '')
parts = [''.join(e) for _, e in iter... | [
"pendulum.interval.instance",
"pendulum.Interval",
"itertools.groupby",
"pendulum.interval"
] | [((805, 840), 'pendulum.Interval', 'pendulum.Interval', ([], {}), '(**duration_input)\n', (822, 840), False, 'import pendulum\n'), ((925, 957), 'pendulum.interval', 'pendulum.interval', ([], {'seconds': 'value'}), '(seconds=value)\n', (942, 957), False, 'import pendulum\n'), ((1031, 1064), 'pendulum.interval.instance',... |
from contextlib import contextmanager
from typing import (
Dict,
List
)
import os
import boto3
import pytest
from moto import mock_s3
BUCKET_NAME = "mock"
FILENAME = "tests/resources/mock_file.csv"
EMPTY_FILE = "tests/resources/empty.data"
@pytest.fixture(scope="module")
def aws_credentials():
os.envir... | [
"boto3.session.Session",
"os.makedirs",
"os.path.join",
"pytest.yield_fixture",
"pytest.fixture",
"moto.mock_s3"
] | [((254, 284), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (268, 284), False, 'import pytest\n'), ((553, 589), 'pytest.yield_fixture', 'pytest.yield_fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (573, 589), False, 'import pytest\n'), ((2771, 2803), 'os.ma... |
from setuptools import setup, find_packages
import os
packages = []
root_dir = os.path.dirname(__file__)
if root_dir:
os.chdir(root_dir)
f = open('README.md')
readme = f.read()
f.close()
setup(
name='bw2preagg',
version="0.2.3",
packages=find_packages(),
author="<NAME>",
author_email="<EMAIL>... | [
"os.chdir",
"os.path.dirname",
"setuptools.find_packages"
] | [((80, 105), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (95, 105), False, 'import os\n'), ((123, 141), 'os.chdir', 'os.chdir', (['root_dir'], {}), '(root_dir)\n', (131, 141), False, 'import os\n'), ((257, 272), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (270, 272), Fal... |
"""
Module for background tasks cog specific discord embeds
"""
from datetime import datetime
from discord import Embed, Colour
from unsigned_bot.emojis import *
from unsigned_bot.urls import *
from unsigned_bot.fetch import get_ipfs_url_from_file
from unsigned_bot.embedding import list_marketplace_base_urls
async ... | [
"datetime.datetime.utcfromtimestamp",
"unsigned_bot.embedding.list_marketplace_base_urls",
"discord.Colour.dark_blue",
"unsigned_bot.fetch.get_ipfs_url_from_file",
"discord.Embed"
] | [((560, 578), 'discord.Colour.dark_blue', 'Colour.dark_blue', ([], {}), '()\n', (576, 578), False, 'from discord import Embed, Colour\n'), ((591, 647), 'discord.Embed', 'Embed', ([], {'title': 'title', 'description': 'description', 'color': 'color'}), '(title=title, description=description, color=color)\n', (596, 647),... |
import pytest
from cleo.io.inputs.token_parser import TokenParser
@pytest.mark.parametrize(
"string, tokens",
[
("", []),
("foo", ["foo"]),
(" foo bar ", ["foo", "bar"]),
('"quoted"', ["quoted"]),
("'quoted'", ["quoted"]),
("'a\rb\nc\td'", ["a\rb\nc\td"]),
... | [
"pytest.mark.parametrize",
"cleo.io.inputs.token_parser.TokenParser"
] | [((70, 1437), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""string, tokens"""', '[(\'\', []), (\'foo\', [\'foo\']), (\' foo bar \', [\'foo\', \'bar\']), (\'"quoted"\',\n [\'quoted\']), ("\'quoted\'", [\'quoted\']), ("\'a\\rb\\nc\\td\'", [\'a\\rb\\nc\\td\']),\n ("\'a\'\\r\'b\'\\n\'c\'\\t\'d\'", [\... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup
setup(name='python-magic-bin',
description='File type identification using libmagic binary package',
author='<NAME>, <NAME>, <NAME>',
author_email='<EMAIL>, <EMAIL>, <EMAIL>',
url="http://github.com/julian-r/python-magi... | [
"setuptools.setup"
] | [((77, 991), 'setuptools.setup', 'setup', ([], {'name': '"""python-magic-bin"""', 'description': '"""File type identification using libmagic binary package"""', 'author': '"""<NAME>, <NAME>, <NAME>"""', 'author_email': '"""<EMAIL>, <EMAIL>, <EMAIL>"""', 'url': '"""http://github.com/julian-r/python-magic"""', 'version':... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import unittest
import torch
from test.test_utils import assert_expected
from torchmultimodal.modules.losses.v... | [
"torchmultimodal.modules.losses.vqvae.CommitmentLoss",
"torch.Tensor",
"test.test_utils.assert_expected"
] | [((482, 519), 'torch.Tensor', 'torch.Tensor', (['[[-1, 0, 1], [2, 1, 0]]'], {}), '([[-1, 0, 1], [2, 1, 0]])\n', (494, 519), False, 'import torch\n'), ((543, 582), 'torch.Tensor', 'torch.Tensor', (['[[-2, -1, 0], [0, 2, -2]]'], {}), '([[-2, -1, 0], [0, 2, -2]])\n', (555, 582), False, 'import torch\n'), ((609, 625), 'tor... |
import json
from collections import namedtuple
import pytest
import requests
from globus_sdk import AuthAPIError, TransferAPIError, exc
_TestResponse = namedtuple("_TestResponse", ("data", "r"))
def _mk_response(data, status, headers=None, data_transform=None):
resp = requests.Response()
if data_transform... | [
"globus_sdk.exc.convert_request_exception",
"collections.namedtuple",
"globus_sdk.AuthAPIError",
"requests.Response",
"json.dumps",
"globus_sdk.TransferAPIError",
"globus_sdk.exc.GlobusAPIError",
"requests.ConnectionError",
"requests.Timeout",
"requests.RequestException"
] | [((155, 197), 'collections.namedtuple', 'namedtuple', (['"""_TestResponse"""', "('data', 'r')"], {}), "('_TestResponse', ('data', 'r'))\n", (165, 197), False, 'from collections import namedtuple\n'), ((278, 297), 'requests.Response', 'requests.Response', ([], {}), '()\n', (295, 297), False, 'import requests\n'), ((1734... |
#!/usr/bin/python
# A Change is an operation to a filesystem, such as writen file, or deleted one.
# A Changeset is a list of changes. Cumulative changes are a list of changes
# that are the result of applying a range of changesets (referred to as playback).
# In practice, it represents a complete filesystem and is us... | [
"posixpath.join",
"hashlib.md5",
"os.makedirs",
"shutil.copy2",
"pathlib.PosixPath",
"json.dump",
"uuid.uuid4",
"os.path.isfile",
"os.umask",
"json.load",
"os.walk"
] | [((2942, 2975), 'os.walk', 'os.walk', (['path'], {'onerror': 'errhandler'}), '(path, onerror=errhandler)\n', (2949, 2975), False, 'import os\n'), ((3558, 3573), 'json.load', 'json.load', (['file'], {}), '(file)\n', (3567, 3573), False, 'import json\n'), ((3766, 3796), 'pathlib.PosixPath', 'pathlib.PosixPath', (['sys.ar... |
import doctest
import unittest
from hypothesis import given
from hypothesis.strategies import (builds, from_regex, integers, just, lists,
recursive, tuples)
from src.main import *
def test__from_list():
data = [(0, "aaa"), (1, "bbb"), (2, "ccc"), (1, "ddd"), (2, "eee"), (2, "f... | [
"hypothesis.strategies.integers",
"hypothesis.strategies.from_regex",
"hypothesis.strategies.just",
"hypothesis.strategies.recursive",
"hypothesis.given"
] | [((2812, 2840), 'hypothesis.strategies.from_regex', 'from_regex', (['"""\\\\A[a-z]{3}\\\\Z"""'], {}), "('\\\\A[a-z]{3}\\\\Z')\n", (2822, 2840), False, 'from hypothesis.strategies import builds, from_regex, integers, just, lists, recursive, tuples\n'), ((2989, 2997), 'hypothesis.strategies.just', 'just', (['[]'], {}), '... |
#!/usr/bin/env python3
"""
Created on 4 Nov 2017
@author: <NAME> (<EMAIL>)
source repo: scs_philips_hue
DESCRIPTION
The chroma utility is used to map environmental data domain values to chromaticity locations. Input data is received
from stdin, and is interpreted as a float value. The mapped value is written to std... | [
"scs_core.sys.signalled_exit.SignalledExit.construct",
"scs_core.data.json.JSONify.dumps",
"sys.stderr.flush",
"scs_philips_hue.cmd.cmd_chroma.CmdChroma",
"sys.stdout.flush",
"scs_philips_hue.config.chroma_conf.ChromaConf.load",
"scs_philips_hue.data.light.light_state.LightState"
] | [((1501, 1512), 'scs_philips_hue.cmd.cmd_chroma.CmdChroma', 'CmdChroma', ([], {}), '()\n', (1510, 1512), False, 'from scs_philips_hue.cmd.cmd_chroma import CmdChroma\n'), ((1777, 1798), 'scs_philips_hue.config.chroma_conf.ChromaConf.load', 'ChromaConf.load', (['Host'], {}), '(Host)\n', (1792, 1798), False, 'from scs_ph... |
import csv
import os
import sys
import time
import numpy as np
import matplotlib.pyplot as plt
from path import Path
from vector_math import *
from find_matches import *
from file_paths import *
#********************
#**** this function reads a CSV file and returns a header, and a list that has been converted to fl... | [
"numpy.amax",
"numpy.amin",
"csv.writer",
"matplotlib.pyplot.plot",
"path.Path",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.scatter",
"time.time",
"csv.reader"
] | [((439, 459), 'csv.reader', 'csv.reader', (['fileopen'], {}), '(fileopen)\n', (449, 459), False, 'import csv\n'), ((1189, 1200), 'time.time', 'time.time', ([], {}), '()\n', (1198, 1200), False, 'import time\n'), ((7903, 7924), 'csv.writer', 'csv.writer', (['final_out'], {}), '(final_out)\n', (7913, 7924), False, 'impor... |
import pandas as pd
import datetime
def getWavesMonth(row):
dateStr = row['Transaction Date']
dateObj = datetime.datetime.strptime(dateStr, '%Y-%m-%d')
return dateObj.month
def getWavesYear(row):
dateStr = row['Transaction Date']
dateObj = datetime.datetime.strptime(dateStr, '%Y-%m-%d')
retur... | [
"datetime.datetime.strptime",
"pandas.read_csv"
] | [((113, 160), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['dateStr', '"""%Y-%m-%d"""'], {}), "(dateStr, '%Y-%m-%d')\n", (139, 160), False, 'import datetime\n'), ((263, 310), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['dateStr', '"""%Y-%m-%d"""'], {}), "(dateStr, '%Y-%m-%d')\n", (289... |
"""OEM104 Create tables
Revision ID: <KEY>
Revises:
Create Date: 2020-02-19 16:42:26.558005
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from sqlalchemy.schema import Sequence, CreateSequence, DropSequence
# revision identifiers, used by Alembic.
revision = '<KEY>'
do... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.text",
"sqlalchemy.schema.Sequence",
"alembic.op.drop_table",
"sqlalchemy.Text",
"sqlalchemy.DateTime",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.dialects.postgresql.UUID",
"alembic.op.drop_index",
"sqlalchemy.BigInteger",
"alembic.op.create_in... | [((1063, 1209), 'alembic.op.create_index', 'op.create_index', (['"""process_status_detail_idx"""', '"""process_status_detail"""', "['fwan_process_id', 'file_id', 'component_id', 'status']"], {'unique': '(False)'}), "('process_status_detail_idx', 'process_status_detail', [\n 'fwan_process_id', 'file_id', 'component_i... |