code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from mylib import rev
case=int(input())
for a in range(case):
c=0
test=int(input())
for b in range(1,test+1):
if (b+rev(b))!=0:
c+=1
print(c)
| [
"mylib.rev"
] | [((123, 129), 'mylib.rev', 'rev', (['b'], {}), '(b)\n', (126, 129), False, 'from mylib import rev\n')] |
# recoverable signatures and messagesigning stuff
# Requires secp256k1 with a flag
# ./configure --enable-module-recovery
from . import secp256k1
from binascii import b2a_base64, a2b_base64
from hashlib import sha256
from io import BytesIO
def compact_encode(i:int) -> bytes:
"""Encodes an integer as a compact int... | [
"binascii.a2b_base64",
"binascii.b2a_base64"
] | [((1715, 1733), 'binascii.a2b_base64', 'a2b_base64', (['b64sig'], {}), '(b64sig)\n', (1725, 1733), False, 'from binascii import b2a_base64, a2b_base64\n'), ((1602, 1617), 'binascii.b2a_base64', 'b2a_base64', (['ser'], {}), '(ser)\n', (1612, 1617), False, 'from binascii import b2a_base64, a2b_base64\n')] |
from terminal_utils import write, print_info
# Mapping of board position to cursor action
CURSOR_ACTIONS = {
'T1': {
'up': 6,
},
'T2': {
'right': 4,
'up': 6
},
'T3': {
'right': 8,
'up': 6
},
'M1': {
'up': 4,
},
'M2': {
'right':... | [
"terminal_utils.write"
] | [((2437, 2457), 'terminal_utils.write', 'write', (['f""" {action} """'], {}), "(f' {action} ')\n", (2442, 2457), False, 'from terminal_utils import write, print_info\n'), ((2466, 2491), 'terminal_utils.write', 'write', (["('\\n' * moves['up'])"], {}), "('\\n' * moves['up'])\n", (2471, 2491), False, 'from terminal_utils... |
from xlstotex.utils import construct_header, construct_table, determine_col_widths,\
parse_line, read_csv, write_txt
def convert(inp_file: str, out_file: str):
csv_rows = read_csv(inp_file)
col_widths = determine_col_widths(csv_rows)
header = construct_header(csv_rows[0])
lines = [parse_line(row)... | [
"xlstotex.utils.determine_col_widths",
"xlstotex.utils.construct_header",
"xlstotex.utils.construct_table",
"xlstotex.utils.parse_line",
"xlstotex.utils.write_txt",
"xlstotex.utils.read_csv"
] | [((182, 200), 'xlstotex.utils.read_csv', 'read_csv', (['inp_file'], {}), '(inp_file)\n', (190, 200), False, 'from xlstotex.utils import construct_header, construct_table, determine_col_widths, parse_line, read_csv, write_txt\n'), ((218, 248), 'xlstotex.utils.determine_col_widths', 'determine_col_widths', (['csv_rows'],... |
from exec5 import max2
def max3(x, y, z):
return max2(max2(x, y), z)
print(max3(2, 4, 6))
print(max3(3, 1, 0)) | [
"exec5.max2"
] | [((59, 69), 'exec5.max2', 'max2', (['x', 'y'], {}), '(x, y)\n', (63, 69), False, 'from exec5 import max2\n')] |
#!/usr/bin/env python3
import fnmatch
import os
import re
import sys
def get_files():
# Allow running from root directory and tools directory
root_dir = ".."
if os.path.exists("addons"):
root_dir = "."
sqf_files = []
for root, _, files in os.walk(root_dir):
for file in fnmatch.f... | [
"os.path.exists",
"os.path.join",
"fnmatch.filter",
"os.walk",
"re.search"
] | [((176, 200), 'os.path.exists', 'os.path.exists', (['"""addons"""'], {}), "('addons')\n", (190, 200), False, 'import os\n'), ((272, 289), 'os.walk', 'os.walk', (['root_dir'], {}), '(root_dir)\n', (279, 289), False, 'import os\n'), ((311, 341), 'fnmatch.filter', 'fnmatch.filter', (['files', '"""*.sqf"""'], {}), "(files,... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 30 08:29:21 2019
@author: hhouse
"""
import pandas as pd
# Load datasets as pandas dataframes
df_nyc = pd.read_csv("stage3_format_nyc.csv")
df_25pct = pd.read_csv("stage3_format_nyc_25pct.csv")
# Deleting unnecessary columns
del df_nyc['confidenc... | [
"pandas.read_csv"
] | [((176, 212), 'pandas.read_csv', 'pd.read_csv', (['"""stage3_format_nyc.csv"""'], {}), "('stage3_format_nyc.csv')\n", (187, 212), True, 'import pandas as pd\n'), ((224, 266), 'pandas.read_csv', 'pd.read_csv', (['"""stage3_format_nyc_25pct.csv"""'], {}), "('stage3_format_nyc_25pct.csv')\n", (235, 266), True, 'import pan... |
#!/usr/local/bin/Python3
from vector import Vector
from plane import Plane
from hyperplane import Hyperplane
from linsys import LinearSystem
from linsysHyper import LinearSystemHyper
def main():
test_row_ops = False
test_triangular_form = False
test_rref = False
test_ge_solution = False
test_para... | [
"linsys.LinearSystem",
"linsysHyper.LinearSystemHyper",
"vector.Vector",
"plane.Plane"
] | [((824, 854), 'linsys.LinearSystem', 'LinearSystem', (['[p0, p1, p2, p3]'], {}), '([p0, p1, p2, p3])\n', (836, 854), False, 'from linsys import LinearSystem\n'), ((3767, 3789), 'linsys.LinearSystem', 'LinearSystem', (['[p4, p5]'], {}), '([p4, p5])\n', (3779, 3789), False, 'from linsys import LinearSystem\n'), ((4136, 4... |
"""Functions for using Gaussian Processes."""
import logging
from typing import Callable, Tuple
import numpy as np
def zero_mean_initialise(x: np.ndarray, kernel_fun: Callable, noise=0.0) -> Tuple[np.ndarray, np.ndarray]:
"""Initialise a zero mean GP using the provided kernel function.
Parameters
-----... | [
"numpy.identity",
"numpy.linalg.pinv",
"numpy.random.multivariate_normal",
"numpy.array",
"numpy.zeros"
] | [((642, 662), 'numpy.zeros', 'np.zeros', (['x.shape[0]'], {}), '(x.shape[0])\n', (650, 662), True, 'import numpy as np\n'), ((1527, 1588), 'numpy.random.multivariate_normal', 'np.random.multivariate_normal', (['mean_vector', 'covariance_matrix'], {}), '(mean_vector, covariance_matrix)\n', (1556, 1588), True, 'import nu... |
"""
Run the analysis on all alpha zero games and save the resulting plot
"""
from csa import csa
# Load Game from PGN
for game_id in range(1, 11):
path_to_pgn = './games/alphazero/alphazero-vs-stockfish_game{}.pgn'.format(game_id)
chess_game = csa.load_game_from_pgn(path_to_pgn)
# Evaluate Game
depths... | [
"csa.csa.load_game_from_pgn",
"csa.csa.evaluate_game"
] | [((253, 288), 'csa.csa.load_game_from_pgn', 'csa.load_game_from_pgn', (['path_to_pgn'], {}), '(path_to_pgn)\n', (275, 288), False, 'from csa import csa\n'), ((352, 474), 'csa.csa.evaluate_game', 'csa.evaluate_game', (['chess_game'], {'reset_engine': '(True)', 'halfmove_numbers': 'None', 'depths': 'depths', 'verbose': '... |
from base.models import Product, Review
from base.serializers import ProductSerializer
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import IsAdminUser, IsAuthenticated
from rest_framework.respo... | [
"rest_framework.decorators.permission_classes",
"base.models.Product.objects.create",
"base.models.Product.objects.filter",
"base.models.Product.objects.get",
"rest_framework.response.Response",
"base.serializers.ProductSerializer",
"rest_framework.decorators.api_view",
"django.core.paginator.Paginato... | [((377, 394), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (385, 394), False, 'from rest_framework.decorators import api_view, permission_classes\n'), ((1097, 1114), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (1105, 1114), False, 'from rest... |
"""Module with embedding visualization tools."""
from multiprocessing import cpu_count
from typing import Dict, List, Tuple, Union
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from ddd_subplots import subplots as subplots_3d
from ensmallen_graph import EnsmallenGraph # pyli... | [
"matplotlib.legend_handler.HandlerTuple",
"matplotlib.patches.Rectangle",
"numpy.unique",
"sklearn.decomposition.PCA",
"tsnecuda.TSNE",
"numpy.isin",
"ddd_subplots.subplots",
"multiprocessing.cpu_count",
"numpy.array",
"numpy.zeros",
"numpy.random.RandomState",
"matplotlib.pyplot.cm.get_cmap",... | [((9087, 9114), 'numpy.arange', 'np.arange', (['args[0].shape[0]'], {}), '(args[0].shape[0])\n', (9096, 9114), True, 'import numpy as np\n'), ((9138, 9184), 'numpy.random.RandomState', 'np.random.RandomState', ([], {'seed': 'self._random_state'}), '(seed=self._random_state)\n', (9159, 9184), True, 'import numpy as np\n... |
# Generated by Django 3.2.9 on 2021-11-13 12:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('accounts', '0011_auto_20211113_1443'),
]
operations = [
migrations.AlterField(
model_name='customer',
name='gifts',
... | [
"django.db.models.IntegerField"
] | [((338, 368), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (357, 368), False, 'from django.db import migrations, models\n')] |
import math
from typing import Tuple
import numpy as np
from PIL import Image
# region Shift Hue
def rgb_to_hsv(rgb):
rgb = rgb.astype('float')
hsv = np.zeros_like(rgb)
hsv[..., 3:] = rgb[..., 3:]
if rgb.shape[2] == 4:
hsv[..., 3] = rgb[..., 3]
r, g, b = rgb[..., 0], rgb[..., 1], rgb[..., ... | [
"numpy.clip",
"PIL.Image.fromarray",
"numpy.select",
"math.pow",
"numpy.floor",
"numpy.max",
"numpy.array",
"numpy.empty_like",
"numpy.min",
"numpy.zeros_like"
] | [((160, 178), 'numpy.zeros_like', 'np.zeros_like', (['rgb'], {}), '(rgb)\n', (173, 178), True, 'import numpy as np\n'), ((334, 363), 'numpy.max', 'np.max', (['rgb[..., :3]'], {'axis': '(-1)'}), '(rgb[..., :3], axis=-1)\n', (340, 363), True, 'import numpy as np\n'), ((375, 404), 'numpy.min', 'np.min', (['rgb[..., :3]'],... |
import os
# file_dir = '/data/object_detection/joash/pytorch-CycleGAN-and-pix2pix/datasets/oyo2none'
file_dir = '/Users/joash/PycharmProjects/pytorch-CycleGAN-and-pix2pix/datasets/oyo2none/'
from PIL import Image
for fi in os.listdir(file_dir + 'trainA'):
resize_z = (256, 256)
new_image = Image.new('RGB', (... | [
"PIL.Image.new",
"os.listdir",
"PIL.Image.open"
] | [((226, 257), 'os.listdir', 'os.listdir', (["(file_dir + 'trainA')"], {}), "(file_dir + 'trainA')\n", (236, 257), False, 'import os\n'), ((302, 330), 'PIL.Image.new', 'Image.new', (['"""RGB"""', '(512, 256)'], {}), "('RGB', (512, 256))\n", (311, 330), False, 'from PIL import Image\n'), ((483, 520), 'PIL.Image.open', 'I... |
import cv2
import copy
import xxhash
import numpy as np
import imgui
import OpenGL.GL as gl
from .static_vars import *
from timeit import default_timer as timer
from . import imgui_ext
import math
from typing import *
from dataclasses import dataclass
_start = timer()
USE_FAST_HASH = True
LOG_GPU_USAGE = False
"""
... | [
"numpy.uint8",
"imgui.is_item_hovered_rect",
"copy.deepcopy",
"OpenGL.GL.glTexImage2D",
"numpy.random.RandomState",
"imgui.get_io",
"imgui.get_item_rect_min",
"OpenGL.GL.glGenTextures",
"imgui.end_group",
"math.fabs",
"OpenGL.GL.glBindTexture",
"OpenGL.GL.glDeleteTextures",
"cv2.cvtColor",
... | [((262, 269), 'timeit.default_timer', 'timer', ([], {}), '()\n', (267, 269), True, 'from timeit import default_timer as timer\n'), ((3490, 3509), 'OpenGL.GL.glGenTextures', 'gl.glGenTextures', (['(1)'], {}), '(1)\n', (3506, 3509), True, 'import OpenGL.GL as gl\n'), ((5598, 5641), 'OpenGL.GL.glPixelStorei', 'gl.glPixelS... |
import re
'''
with open('first.csv') as datafile:
first=datafile.read().splitlines()[1:]
with open('second.csv') as datafile:
second=datafile.read().splitlines()[1:]
'''
with open('third.csv') as datafile:
third=datafile.read().splitlines()[1:]
output = {}
for line in (third):
line = line.split(',')
... | [
"re.match"
] | [((585, 648), 're.match', 're.match', (['"""(\\\\d\\\\d\\\\d\\\\d)-(\\\\d\\\\d\\\\d\\\\d)"""', "output[name]['year']"], {}), "('(\\\\d\\\\d\\\\d\\\\d)-(\\\\d\\\\d\\\\d\\\\d)', output[name]['year'])\n", (593, 648), False, 'import re\n'), ((944, 999), 're.match', 're.match', (['"""(.*) \\\\((\\\\d\\\\d\\\\d\\\\d)-(\\\\d\... |
import logging
from numpy import random
import pajbot.models
from pajbot.modules import BaseModule
from pajbot.modules import ModuleSetting
from pajbot.modules import QuestModule
log = logging.getLogger(__name__)
class Samples:
valid_samples = {
'4head': { 'length': 0 },
'4header': { 'l... | [
"logging.getLogger",
"pajbot.modules.ModuleSetting"
] | [((188, 215), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (205, 215), False, 'import logging\n'), ((5105, 5283), 'pajbot.modules.ModuleSetting', 'ModuleSetting', ([], {'key': '"""point_cost"""', 'label': '"""Point cost"""', 'type': '"""number"""', 'required': '(True)', 'placeholder': '... |
from behave import *
from hamcrest import *
import numpy
@given('a matrix')
def step_impl(context):
context.matrix = numpy.arange(2, 11).reshape(3, 3)
@when('project the agent')
def step_impl(context):
context.result = context.dpop_1.util_manager.project(context.matrix)
@then('result is a matrix has one ... | [
"numpy.ndenumerate",
"numpy.arange"
] | [((528, 561), 'numpy.ndenumerate', 'numpy.ndenumerate', (['context.result'], {}), '(context.result)\n', (545, 561), False, 'import numpy\n'), ((124, 143), 'numpy.arange', 'numpy.arange', (['(2)', '(11)'], {}), '(2, 11)\n', (136, 143), False, 'import numpy\n')] |
"""
The :mod:`sklearnext.metrics.regressio` contains
various metrics for regression tasks.
"""
# Author: <NAME> <<EMAIL>>
# Licence: MIT
import numpy as np
from sklearn.metrics.regression import _check_reg_targets, check_consistent_length
from sklearn.externals.six import string_types
def weighted_mean_squared_erro... | [
"sklearn.metrics.regression._check_reg_targets",
"sklearn.metrics.regression.check_consistent_length",
"numpy.average"
] | [((1784, 1831), 'sklearn.metrics.regression._check_reg_targets', '_check_reg_targets', (['y_true', 'y_pred', 'multioutput'], {}), '(y_true, y_pred, multioutput)\n', (1802, 1831), False, 'from sklearn.metrics.regression import _check_reg_targets, check_consistent_length\n'), ((1836, 1890), 'sklearn.metrics.regression.ch... |
from rest_framework.decorators import api_view, permission_classes
from rest_framework import status
from rest_framework.response import Response
from registeration.models import User
from .models import Chatroom
from join.models import Chatroom_User
from .serializers import ShowUChatroomProfileSerializer
@api_view(... | [
"join.models.Chatroom_User.objects.filter",
"rest_framework.decorators.permission_classes",
"registeration.models.User.objects.get",
"registeration.models.User.objects.filter",
"join.models.Chatroom_User.objects.create",
"rest_framework.response.Response",
"rest_framework.decorators.api_view"
] | [((311, 329), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (319, 329), False, 'from rest_framework.decorators import api_view, permission_classes\n'), ((4479, 4497), 'rest_framework.decorators.api_view', 'api_view', (["['POST']"], {}), "(['POST'])\n", (4487, 4497), False, 'from ... |
# -*- coding: utf-8 -*-
"""
Module with the logic for SIFO calculation
"""
__author__ = '<NAME>'
__email__ = '<EMAIL>'
from decimal import Decimal
from PyQt5.QtCore import pyqtSlot, QObject
from source.app import SifoExpensesProcess
from source.util import Assertor
from source.domain import Money
from .model imp... | [
"source.util.Assertor.assert_data_types",
"source.app.SifoExpensesProcess",
"PyQt5.QtCore.pyqtSlot"
] | [((2334, 2344), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (2342, 2344), False, 'from PyQt5.QtCore import pyqtSlot, QObject\n'), ((2676, 2686), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (2684, 2686), False, 'from PyQt5.QtCore import pyqtSlot, QObject\n'), ((3568, 3578), 'PyQt5.QtCore.pyqtSlot',... |
#!/usr/bin/python3
"""test for user"""
import unittest
import os
from models.user import User
from models.base_model import BaseModel
import pep8
from os import environ as env
class TestUser(unittest.TestCase):
"""this will test the User class"""
@classmethod
def setUpClass(cls):
"""set up for te... | [
"unittest.main",
"models.user.User",
"pep8.StyleGuide",
"os.remove"
] | [((2399, 2414), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2412, 2414), False, 'import unittest\n'), ((345, 351), 'models.user.User', 'User', ([], {}), '()\n', (349, 351), False, 'from models.user import User\n'), ((842, 869), 'pep8.StyleGuide', 'pep8.StyleGuide', ([], {'quiet': '(True)'}), '(quiet=True)\n', ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-05-14 18:09
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sova', '0022_event_max_people'),
]
operations = [
migrations.RenameField(
... | [
"django.db.migrations.RenameField",
"django.db.models.TextField",
"django.db.models.BooleanField"
] | [((295, 390), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""participation"""', 'old_name': '"""grade"""', 'new_name': '"""poll_grade"""'}), "(model_name='participation', old_name='grade',\n new_name='poll_grade')\n", (317, 390), False, 'from django.db import migrations, models... |
# Generated by Django 3.1.5 on 2021-01-31 17:57
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('network', '0004_auto_20210128_2324'),
]
operations = [
migrations.AlterFie... | [
"django.db.models.ManyToManyField",
"django.db.models.ForeignKey"
] | [((407, 501), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(True)', 'related_name': '"""following"""', 'to': 'settings.AUTH_USER_MODEL'}), "(blank=True, related_name='following', to=settings.\n AUTH_USER_MODEL)\n", (429, 501), False, 'from django.db import migrations, models\n'), ((6... |
#!/usr/bin/env python
# Created 01/26/15 by <NAME>
# Program to create VPD images from input template files
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2010,2014
# [+] International Business Machines Corp.
#
#
# Licensed u... | [
"out.warn",
"sys.path.insert",
"xml.etree.ElementTree.Comment",
"binascii.hexlify",
"re.search",
"os.path.exists",
"textwrap.dedent",
"xml.etree.ElementTree.parse",
"out.error",
"out.msg",
"out.debug",
"out.setIndent",
"re.match",
"struct.pack",
"os.path.isfile",
"os.path.join",
"os.... | [((1173, 1214), 'sys.path.insert', 'sys.path.insert', (['(0)', "(scriptPath + '/pymod')"], {}), "(0, scriptPath + '/pymod')\n", (1188, 1214), False, 'import sys\n'), ((20146, 20162), 'out.setIndent', 'out.setIndent', (['(0)'], {}), '(0)\n', (20159, 20162), False, 'import out\n'), ((20163, 20209), 'out.msg', 'out.msg', ... |
from rest_framework import viewsets, permissions, status
from rest_framework.response import Response
class HealthViewSet(viewsets.ViewSet):
# uncomment this to make the endpoint require authentication
# permission_classes = [permissions.IsAuthenticated]
def list(self, request, *args, **kwargs):
... | [
"rest_framework.response.Response"
] | [((369, 427), 'rest_framework.response.Response', 'Response', (["{'health': 'healthy'}"], {'status': 'status.HTTP_200_OK'}), "({'health': 'healthy'}, status=status.HTTP_200_OK)\n", (377, 427), False, 'from rest_framework.response import Response\n')] |
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 22 19:01:05 2018
Tensorflow implementation of the iris dataset classification
@author: Vishal
"""
#Using a linear classifier
import tensorflow.contrib.learn as tf
from sklearn import datasets, metrics
iris = datasets.load_iris()
clf = tf.TensorFlowLinearClassifier(n_cla... | [
"sklearn.datasets.load_iris",
"sklearn.cross_validation.train_test_split",
"tensorflow.contrib.learn.TensorFlowLinearRegressor",
"tensorflow.contrib.learn.TensorFlowLinearClassifier",
"sklearn.preprocessing.MinMaxScaler"
] | [((258, 278), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (276, 278), False, 'from sklearn import datasets, metrics, preprocessing, cross_validation\n'), ((285, 327), 'tensorflow.contrib.learn.TensorFlowLinearClassifier', 'tf.TensorFlowLinearClassifier', ([], {'n_classes': '(3)'}), '(n_classes... |
import json
import os
from pathlib import Path
from typing import Optional
from unittest.mock import patch, Mock, PropertyMock
import pytest
from confident import BaseConfig
from confident.loaders.source_loader_base import SourceLoader
from confident.utils import get_class_file_path
from tests.conftest import validat... | [
"unittest.mock.Mock",
"pathlib.Path",
"pathlib.Path.cwd",
"json.dumps",
"pytest.mark.parametrize",
"os.environ.update",
"pytest.raises",
"tests.conftest.validate_file_not_exists",
"unittest.mock.patch"
] | [((4368, 4400), 'unittest.mock.patch', 'patch', (['"""importlib.import_module"""'], {}), "('importlib.import_module')\n", (4373, 4400), False, 'from unittest.mock import patch, Mock, PropertyMock\n'), ((4402, 4469), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""exception"""', '[ImportError, AttributeError... |
from django.shortcuts import render
from config.utils import get_active_event
def index(request):
event = get_active_event()
posts = event.posts.all()[:3]
talks = (event.talks
.prefetch_related('applicants__user', 'skill_level')
.filter(keynote=False)
.order_by('?')[:3])
wor... | [
"django.shortcuts.render",
"config.utils.get_active_event"
] | [((113, 131), 'config.utils.get_active_event', 'get_active_event', ([], {}), '()\n', (129, 131), False, 'from config.utils import get_active_event\n'), ((464, 580), 'django.shortcuts.render', 'render', (['request', '"""ui/index.html"""', "{'is_frontpage': True, 'posts': posts, 'talks': talks, 'workshops': workshops}"],... |
""" Operations include: Gray, Gaussian Blur, Canny, Dilation, Erosion,
Threshold, Inverse threshold, Adaptive threshold, contours """
# Importing the computer vision library
import cv2 as cv
# reading the image
img = cv.imread('./assets/park.jpg')
cv.imshow('original', img)
""" GRAY """
# converting the image... | [
"cv2.drawContours",
"cv2.threshold",
"cv2.erode",
"cv2.imshow",
"cv2.adaptiveThreshold",
"cv2.waitKey",
"cv2.cvtColor",
"cv2.findContours",
"cv2.dilate",
"cv2.Canny",
"cv2.imread",
"cv2.GaussianBlur"
] | [((225, 255), 'cv2.imread', 'cv.imread', (['"""./assets/park.jpg"""'], {}), "('./assets/park.jpg')\n", (234, 255), True, 'import cv2 as cv\n'), ((256, 282), 'cv2.imshow', 'cv.imshow', (['"""original"""', 'img'], {}), "('original', img)\n", (265, 282), True, 'import cv2 as cv\n'), ((342, 377), 'cv2.cvtColor', 'cv.cvtCol... |
'''
(c) 2011, 2012 Georgia Tech Research Corporation
This source code is released under the New BSD license. Please see
http://wiki.quantsoftware.org/index.php?title=QSTK_License
for license details.
Created on Jan 1, 2011
@author:<NAME>
@contact: <EMAIL>
@summary: Contains tutorial for backtester and report.
'''
... | [
"datetime.datetime",
"pickle.dump",
"qstkutil.DataAccess.DataAccess",
"datetime.timedelta",
"qstkutil.qsdateutil.getNYSEdays"
] | [((1253, 1282), 'datetime.datetime', 'dt.datetime', (['t[2]', 't[0]', 't[1]'], {}), '(t[2], t[0], t[1])\n', (1264, 1282), True, 'import datetime as dt\n'), ((1334, 1363), 'datetime.datetime', 'dt.datetime', (['t[2]', 't[0]', 't[1]'], {}), '(t[2], t[0], t[1])\n', (1345, 1363), True, 'import datetime as dt\n'), ((1400, 1... |
from google.cloud.bigquery import Client, table
from .query_builder import QueryBuilder
from .table_mapper import TableMapper
class BQUnit:
def __init__(self, dataset_name: str, project_id=None):
self.__client: Client = Client(project=project_id)
self.__mapper: TableMapper = TableMapper()
... | [
"google.cloud.bigquery.Client"
] | [((236, 262), 'google.cloud.bigquery.Client', 'Client', ([], {'project': 'project_id'}), '(project=project_id)\n', (242, 262), False, 'from google.cloud.bigquery import Client, table\n')] |
import rubrik_cdm, urllib3
urllib3.disable_warnings()
rubrik = rubrik_cdm.Connect(rubrik_cdm_ip,rubrik_cdm_user_name,rubrik_cdm_password)
tunnel = rubrik.cluster_support_tunnel(True)
print(tunnel)
tunnel = rubrik.cluster_support_tunnel(False)
print(tunnel)
| [
"urllib3.disable_warnings",
"rubrik_cdm.Connect"
] | [((27, 53), 'urllib3.disable_warnings', 'urllib3.disable_warnings', ([], {}), '()\n', (51, 53), False, 'import rubrik_cdm, urllib3\n'), ((65, 141), 'rubrik_cdm.Connect', 'rubrik_cdm.Connect', (['rubrik_cdm_ip', 'rubrik_cdm_user_name', 'rubrik_cdm_password'], {}), '(rubrik_cdm_ip, rubrik_cdm_user_name, rubrik_cdm_passwo... |
import itertools
import pathlib
from abc import ABCMeta
from abc import abstractmethod
from decimal import Decimal
from typing import Iterable
from typing import Sequence
from typing import Tuple
from typing import Optional
from typing import Mapping
import ujson as json
from openpyxl import load_workbook
from openpyx... | [
"itertools.islice",
"decimal.Decimal"
] | [((2971, 3013), 'itertools.islice', 'itertools.islice', (['cell_modules', 'max_column'], {}), '(cell_modules, max_column)\n', (2987, 3013), False, 'import itertools\n'), ((3349, 3392), 'itertools.islice', 'itertools.islice', (['header_row', '(4)', 'None', 'None'], {}), '(header_row, 4, None, None)\n', (3365, 3392), Fal... |
import os
import os.path
def get_image_path():
"""get image path from environment var and validate it is a valid folder"""
image_path = os.environ.get('BING_IMAGE_PATH')
if image_path == None:
raise Exception('Failed: BING_IMAGE_PATH env var not defined')
if not os.path.isdir(image_path):
raise Exception(f'... | [
"os.path.isdir",
"os.environ.get"
] | [((139, 172), 'os.environ.get', 'os.environ.get', (['"""BING_IMAGE_PATH"""'], {}), "('BING_IMAGE_PATH')\n", (153, 172), False, 'import os\n'), ((273, 298), 'os.path.isdir', 'os.path.isdir', (['image_path'], {}), '(image_path)\n', (286, 298), False, 'import os\n')] |
# coding: utf-8
import os
import time
import json
from flask import Flask, render_template, jsonify, request, session
import git
from git_modify import RepoModifier
app = Flask(__name__)
app.config["SECRET_KEY"] = ";'AAN12#('S09KS[.:PQ9U0S'/2WEL"
def make_time_str(timestamp):
time_array = time.localtime(timesta... | [
"flask.render_template",
"json.loads",
"flask.Flask",
"time.strftime",
"os.remove",
"git_modify.RepoModifier",
"git_modify.RepoModifier.generate_command",
"os.system",
"time.localtime",
"flask.jsonify"
] | [((173, 188), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (178, 188), False, 'from flask import Flask, render_template, jsonify, request, session\n'), ((298, 323), 'time.localtime', 'time.localtime', (['timestamp'], {}), '(timestamp)\n', (312, 323), False, 'import time\n'), ((339, 376), 'time.strftime',... |
def compile(fn):
return '"C:\\Python27\\python.exe" -m compileall py\\%s.py\n' % fn
def mv(fn):
return 'move py\\%s.pyc pyc\n' % fn
def writeall(text, fn):
with open(fn, 'w') as f:
f.write(text)
TEST_FILES = [
'hello',
# ch 4
'test_if',
'test_var',
'test_while',
'simple... | [
"pathlib.Path"
] | [((547, 567), 'pathlib.Path', 'pathlib.Path', (['"""./py"""'], {}), "('./py')\n", (559, 567), False, 'import pathlib\n')] |
# coding: utf-8
"""
Consolidate Services
Description of all APIs # noqa: E501
The version of the OpenAPI document: version not set
Generated by: https://openapi-generator.tech
"""
import pprint
import re # noqa: F401
import six
from argocd_client.configuration import Configuration
class V1alp... | [
"six.iteritems",
"argocd_client.configuration.Configuration"
] | [((8437, 8470), 'six.iteritems', 'six.iteritems', (['self.openapi_types'], {}), '(self.openapi_types)\n', (8450, 8470), False, 'import six\n'), ((1839, 1854), 'argocd_client.configuration.Configuration', 'Configuration', ([], {}), '()\n', (1852, 1854), False, 'from argocd_client.configuration import Configuration\n')] |
import io
import json
import pickle
from peewee import *
from datetime import date
db = SqliteDatabase(r'data\results.db')
class PickleBlobField(BlobField):
def db_value(self, value):
return value if value is None else pickle.dumps(value)
def python_value(self, value):
return value if value ... | [
"pickle.dumps",
"pickle.loads"
] | [((234, 253), 'pickle.dumps', 'pickle.dumps', (['value'], {}), '(value)\n', (246, 253), False, 'import pickle\n'), ((333, 352), 'pickle.loads', 'pickle.loads', (['value'], {}), '(value)\n', (345, 352), False, 'import pickle\n')] |
import os.path as osp
import shutil
import torch
from collections import OrderedDict
import json
class Saver(object):
def __init__(self, cfg):
self.cfg = cfg
self.checkpoint_dir = cfg["checkpoint_dir"]
self.export_dir = cfg["export_dir"]
def save_checkpoint(self, state, is_best, filen... | [
"json.dump",
"os.path.join",
"torch.save"
] | [((422, 461), 'os.path.join', 'osp.join', (['self.checkpoint_dir', 'filename'], {}), '(self.checkpoint_dir, filename)\n', (430, 461), True, 'import os.path as osp\n'), ((485, 512), 'torch.save', 'torch.save', (['state', 'filename'], {}), '(state, filename)\n', (495, 512), False, 'import torch\n'), ((669, 692), 'json.du... |
from fastapi import FastAPI, Request, Response
from fastapi.responses import JSONResponse, StreamingResponse
from starlette.status import *
from starlette.types import Scope, Receive, Send
import json
from argparse import ArgumentParser
import os
import uvicorn
import base64
from cryptography.fernet import Fernet
impor... | [
"traceback.format_exc",
"json.loads",
"fastapi.FastAPI",
"time.ctime",
"random.choice",
"argparse.ArgumentParser",
"json.dumps",
"rsa.encrypt",
"json.load",
"re.fullmatch",
"cryptography.fernet.Fernet",
"rsa.newkeys",
"random.random",
"time.time",
"cryptography.fernet.Fernet.generate_key... | [((421, 430), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (428, 430), False, 'from fastapi import FastAPI, Request, Response\n'), ((507, 557), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Run the CHAD server."""'}), "(description='Run the CHAD server.')\n", (521, 557), False, 'from argparse... |
from stv.generators.ispl.ispl_generator import IsplGenerator
import itertools
import random
class BridgeModelIsplGenerator(IsplGenerator):
@property
def card_names(self) -> [str]:
return ["Ace", "King", "Queen", "Jack", "ten", "nine", "eight", "seven", "six", "five", "four", "three", "two"]
@pro... | [
"itertools.combinations",
"itertools.permutations",
"random.randrange"
] | [((5628, 5676), 'itertools.permutations', 'itertools.permutations', (['self._available_cards', '(4)'], {}), '(self._available_cards, 4)\n', (5650, 5676), False, 'import itertools\n'), ((6885, 6933), 'itertools.permutations', 'itertools.permutations', (['self._available_cards', '(4)'], {}), '(self._available_cards, 4)\n... |
import unittest
from .batch_count import test_batchcount
from .bucket_count import test_bucketcount
from .lazy_count import test_lazycount
# initialize the test suite
loader = unittest.TestLoader()
suite = unittest.TestSuite()
# add tests to the test suite
suite.addTests(loader.loadTestsFromModule(test_batchcount))... | [
"unittest.TestSuite",
"unittest.TextTestRunner",
"unittest.TestLoader"
] | [((179, 200), 'unittest.TestLoader', 'unittest.TestLoader', ([], {}), '()\n', (198, 200), False, 'import unittest\n'), ((209, 229), 'unittest.TestSuite', 'unittest.TestSuite', ([], {}), '()\n', (227, 229), False, 'import unittest\n'), ((483, 519), 'unittest.TextTestRunner', 'unittest.TextTestRunner', ([], {'verbosity':... |
import dataclasses
import json
from dataclasses import dataclass
from datetime import datetime, timedelta
from typing import Any, Tuple, TypeVar, Optional
T = TypeVar('T')
@dataclass
class AbsRelTime:
"""Container for absolute, relative and time."""
time: timedelta
"""The time this unit takes."""
ab... | [
"datetime.datetime.now",
"dataclasses.dataclass",
"dataclasses.asdict",
"typing.TypeVar"
] | [((160, 172), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (167, 172), False, 'from typing import Any, Tuple, TypeVar, Optional\n'), ((959, 981), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (968, 981), False, 'from dataclasses import dataclass\n'), ((3720, 3734), '... |
from setuptools import setup, find_packages
setup(name='chi_annotator', version='1.0', packages=find_packages()) | [
"setuptools.find_packages"
] | [((97, 112), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (110, 112), False, 'from setuptools import setup, find_packages\n')] |
# Generated by Django 3.2.5 on 2021-07-17 06:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('bidding', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Allotment',
fields=[
('roo... | [
"django.db.models.TextField",
"django.db.models.IntegerField"
] | [((327, 381), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (346, 381), False, 'from django.db import migrations, models\n'), ((415, 433), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (431,... |
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use ... | [
"numpy.eye",
"numpy.linalg.solve",
"numpy.sqrt",
"numpy.linalg.pinv",
"numpy.random.choice",
"timeit.default_timer",
"numpy.squeeze",
"numpy.zeros",
"numpy.random.seed",
"numpy.random.randn"
] | [((1197, 1226), 'numpy.zeros', 'np.zeros', (['(d, 1)'], {'dtype': 'float'}), '((d, 1), dtype=float)\n', (1205, 1226), True, 'import numpy as np\n'), ((1241, 1266), 'numpy.zeros', 'np.zeros', (['(d, iterations)'], {}), '((d, iterations))\n', (1249, 1266), True, 'import numpy as np\n'), ((1431, 1448), 'numpy.linalg.pinv'... |
#!/usr/bin/env python
import re
from struct import pack
from binaryninja.types import Symbol
from binaryninja.binaryview import BinaryView
from binaryninja.log import log_info, log_debug
from binaryninja.architecture import Architecture
from binaryninja.enums import SegmentFlag, SymbolType, SectionSemantics
class Re... | [
"binaryninja.binaryview.BinaryView.__init__",
"binaryninja.log.log_info",
"re.match",
"binaryninja.types.Symbol"
] | [((684, 769), 'binaryninja.binaryview.BinaryView.__init__', 'BinaryView.__init__', (['self'], {'parent_view': 'binaryView', 'file_metadata': 'binaryView.file'}), '(self, parent_view=binaryView, file_metadata=binaryView.file\n )\n', (703, 769), False, 'from binaryninja.binaryview import BinaryView\n'), ((1125, 1181),... |
from interpreter.heap import stringify
from interpreter.interpret import DTREE, CTREE
class execute():
def __init__( self, program ):
self.len = 0
self.heap = {}
self.stack = []
H = "H" + str( self.len )
self.heap[H] = { "$": "nil" }
self.len = self.len + 1
... | [
"interpreter.heap.stringify",
"interpreter.interpret.CTREE",
"interpreter.interpret.DTREE"
] | [((486, 501), 'interpreter.heap.stringify', 'stringify', (['self'], {}), '(self)\n', (495, 501), False, 'from interpreter.heap import stringify\n'), ((391, 415), 'interpreter.interpret.DTREE', 'DTREE', (['self', 'declaration'], {}), '(self, declaration)\n', (396, 415), False, 'from interpreter.interpret import DTREE, C... |
# encoding: utf-8
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *
from components.player.music_stream_queue import MusicStreamQueue
from components.data_table_widgets.table_enter_items import SongTableWidgetItems
class SongTableWidget(QTableWidget):
double_click_signal = pyqtSi... | [
"components.data_table_widgets.table_enter_items.SongTableWidgetItems"
] | [((6198, 6220), 'components.data_table_widgets.table_enter_items.SongTableWidgetItems', 'SongTableWidgetItems', ([], {}), '()\n', (6218, 6220), False, 'from components.data_table_widgets.table_enter_items import SongTableWidgetItems\n'), ((7976, 7998), 'components.data_table_widgets.table_enter_items.SongTableWidgetIte... |
"""
Perform data pre-processing for the web app.
"""
# pylint: disable=C0103,C0301,E0401
import os
import ssl
import traceback
import logging
from datetime import datetime
import numpy as np
import pandas as pd
from beaker.cache import CacheManager
from beaker.util import parse_cache_config_options
DASH_LOG_LEVEL =... | [
"traceback.format_exc",
"pandas.read_csv",
"os.getenv",
"beaker.util.parse_cache_config_options",
"logging.info",
"logging.error"
] | [((321, 364), 'os.getenv', 'os.getenv', (['"""DASH_LOG_LEVEL"""'], {'default': '"""info"""'}), "('DASH_LOG_LEVEL', default='info')\n", (330, 364), False, 'import os\n'), ((532, 592), 'logging.info', 'logging.info', (['"""Cache expire set to %s seconds"""', 'CACHE_EXPIRE'], {}), "('Cache expire set to %s seconds', CACHE... |
import unittest
from rdflib import RDFS, Namespace
from funowl.annotations import Annotation
from funowl.class_axioms import SubClassOf, EquivalentClasses, DisjointClasses, DisjointUnion, HasKey
from funowl.class_expressions import ObjectIntersectionOf, ObjectSomeValuesFrom, ObjectUnionOf
from funowl.dataproperty_exp... | [
"funowl.writers.FunctionalWriter.FunctionalWriter",
"funowl.dataproperty_expressions.DataPropertyExpression",
"funowl.class_axioms.DisjointClasses",
"funowl.class_expressions.ObjectSomeValuesFrom",
"unittest.main",
"funowl.objectproperty_expressions.ObjectPropertyExpression",
"funowl.class_expressions.O... | [((536, 571), 'rdflib.Namespace', 'Namespace', (['"""http://snomed.info/id/"""'], {}), "('http://snomed.info/id/')\n", (545, 571), False, 'from rdflib import RDFS, Namespace\n'), ((3610, 3625), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3623, 3625), False, 'import unittest\n'), ((658, 676), 'funowl.writers.Fu... |
# Generated by Django 3.1.6 on 2021-04-08 10:03
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('base', '0005_auto_20210408_1248'),
]
operations = [
migrations.RemoveField(
model_name='contact',
name='subject',
),... | [
"django.db.migrations.RemoveField"
] | [((224, 284), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""contact"""', 'name': '"""subject"""'}), "(model_name='contact', name='subject')\n", (246, 284), False, 'from django.db import migrations\n')] |
import torch
from torch import optim
from const import Phase
from batch import create_dataset
from models import Baseline
from sklearn.metrics import classification_report
def run(dataset_train,
dataset_dev,
dataset_test,
model_type,
word_embed_size,
hidden_size,
batch_... | [
"sklearn.metrics.classification_report",
"torch.optim.Adam",
"models.Baseline",
"batch.create_dataset"
] | [((784, 821), 'torch.optim.Adam', 'optim.Adam', (['optim_params'], {'lr': '(10 ** -3)'}), '(optim_params, lr=10 ** -3)\n', (794, 821), False, 'from torch import optim\n'), ((5469, 5527), 'batch.create_dataset', 'create_dataset', (['data'], {'batch_size': 'batch_size', 'device': 'device'}), '(data, batch_size=batch_size... |
import random
number = random.randint(0, 100)
guess = -1
while guess != number:
guess = eval(input("Enter your guess: "))
if guess > number:
print("Your guess is too high")
elif guess < number:
print("Your guess is too small")
print("You got it") | [
"random.randint"
] | [((24, 46), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (38, 46), False, 'import random\n')] |
from dataclasses import dataclass
from enum import Enum
from gamesim import System, Group, Selector, Rules, simulation
from pampy import ANY
class State(Enum):
START = 0
FLIP = 1
FLOP = 2
FLAP = 3
@dataclass
class Player:
state: State = State.START
def transform(self, new_state):
se... | [
"gamesim.simulation"
] | [((1183, 1209), 'gamesim.simulation', 'simulation', (['objects', 'rules'], {}), '(objects, rules)\n', (1193, 1209), False, 'from gamesim import System, Group, Selector, Rules, simulation\n')] |
from django.db import models
class Profile(models.Model):
firstname = models.CharField(max_length = 100)
lastname = models.CharField(max_length = 100)
image = models.ImageField(upload_to='pictures/', verbose_name="image")
title1 = models.CharField(max_length=600)
#contact
phone = models.CharFi... | [
"django.db.models.EmailField",
"django.db.models.TextField",
"django.db.models.ImageField",
"django.db.models.URLField",
"django.db.models.CharField"
] | [((76, 108), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (92, 108), False, 'from django.db import models\n'), ((126, 158), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (142, 158), False, 'from django.db ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-10-19 08:07
from __future__ import unicode_literals
from decimal import Decimal
from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import uuid
class Migrati... | [
"django.db.models.OneToOneField",
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.db.models.FileField",
"django.db.models.BooleanField",
"django.db.migrations.CreateModel",
"djan... | [((453, 510), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (484, 510), False, 'from django.db import migrations, models\n'), ((94057, 94276), 'django.db.migrations.CreateModel', 'migrations.CreateModel', ([], {'name':... |
from justgood import imjustgood
media = imjustgood("YOUR_APIKEY_HERE")
query = "blonde" # example query
data = media.porn(query)
# Get attributes
result = "Porn Videos"
result += "\nTitle : {}".format(data["result"]["title"])
result += "\nDuration : {}".format(data["result"]["duration"])
result += "\nQuality : {}".fo... | [
"justgood.imjustgood"
] | [((41, 71), 'justgood.imjustgood', 'imjustgood', (['"""YOUR_APIKEY_HERE"""'], {}), "('YOUR_APIKEY_HERE')\n", (51, 71), False, 'from justgood import imjustgood\n')] |
from discord.ext import commands
from backup_bot.logger import logger
from os.path import isdir
from os import mkdir
import shelve
from datetime import datetime
from discord import File, Embed
from collections import OrderedDict
extension_name = "backup"
logger = logger.getChild(extension_name)
@commands.command("ba... | [
"collections.OrderedDict",
"backup_bot.logger.logger.info",
"datetime.datetime.now",
"backup_bot.logger.logger.error",
"os.path.isdir",
"shelve.open",
"os.mkdir",
"discord.Embed",
"discord.ext.commands.command",
"discord.File",
"backup_bot.logger.logger.getChild"
] | [((265, 296), 'backup_bot.logger.logger.getChild', 'logger.getChild', (['extension_name'], {}), '(extension_name)\n', (280, 296), False, 'from backup_bot.logger import logger\n'), ((300, 326), 'discord.ext.commands.command', 'commands.command', (['"""backup"""'], {}), "('backup')\n", (316, 326), False, 'from discord.ex... |
#!/usr/bin/env python
# donut_plot_with_subgroups_from_dataframe.py
__author__ = "<NAME>" #fomightez on GitHub
__license__ = "MIT"
__version__ = "0.1.0"
# donut_plot_with_subgroups_from_dataframe.py by <NAME>
# ver 0.1
#
#*******************************************************************************
# Verified compa... | [
"pandas.read_pickle",
"matplotlib.pyplot.setp",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.random.random",
"seaborn.light_palette",
"matplotlib.pyplot.pie",
"pathlib2.Path",
"sys.stderr.write",
"numpy.random.seed",
"sys.exit",
"matplotlib.pyplot.title",... | [((7384, 7402), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (7398, 7402), True, 'import numpy as np\n'), ((15572, 15610), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'plot_figure_size'}), '(figsize=plot_figure_size)\n', (15584, 15610), True, 'import matplotlib.pyplot as plt\n'), ... |
from setuptools import setup
setup(name='modrezip',
version='1.0.0',
description='module for creating a modified copy of a zip file',
author='<NAME>',
author_email='<EMAIL>',
license='Apache License 2.0',
packages=['modrezip'],
url='https://github.com/nicholasbishop/modrezip',... | [
"setuptools.setup"
] | [((30, 312), 'setuptools.setup', 'setup', ([], {'name': '"""modrezip"""', 'version': '"""1.0.0"""', 'description': '"""module for creating a modified copy of a zip file"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""Apache License 2.0"""', 'packages': "['modrezip']", 'url': '"""https://g... |
# Generated by Django 3.1.6 on 2021-08-10 09:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('saef', '0025_auto_20210809_1555'),
]
operations = [
migrations.AddField(
model_name='settings',
name='profile_delta_... | [
"django.db.models.FloatField",
"django.db.models.IntegerField"
] | [((350, 380), 'django.db.models.FloatField', 'models.FloatField', ([], {'default': '(0.2)'}), '(default=0.2)\n', (367, 380), False, 'from django.db import migrations, models\n'), ((523, 554), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(10)'}), '(default=10)\n', (542, 554), False, 'from dj... |
'''Utils for gene expression
'''
import os, sys
import json
import hashlib
import math
from collections import OrderedDict
import h5py
import requests
import numpy as np
import pandas as pd
import scipy.sparse as sp
from scipy import io
from sklearn.preprocessing import scale
from bson.codec_options import CodecOptions... | [
"json.loads",
"numpy.log10",
"requests.post",
"math.ceil",
"pandas.read_csv",
"collections.OrderedDict",
"numpy.where",
"numpy.in1d",
"scipy.io.mmread",
"os.path.join",
"h5py.File",
"os.path.realpath",
"bson.codec_options.CodecOptions",
"pandas.DataFrame",
"scipy.sparse.csr_matrix",
"s... | [((376, 402), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (392, 402), False, 'import os, sys\n'), ((611, 629), 'h5py.File', 'h5py.File', (['fn', '"""r"""'], {}), "(fn, 'r')\n", (620, 629), False, 'import h5py\n'), ((723, 746), 'numpy.in1d', 'np.in1d', (['all_gsms', 'gsms'], {}), '(all_gs... |
import cv2
img = cv2.imread(r"..\lena.jpg")
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
h, s, v = cv2.split(hsv)
v[:, :] = 255
newHSV = cv2.merge([h, s, v])
art = cv2.cvtColor(newHSV, cv2.COLOR_HSV2BGR)
cv2.imshow("img", img)
cv2.imshow("art", art)
cv2.waitKey()
cv2.destroyAllWindows()
| [
"cv2.merge",
"cv2.imshow",
"cv2.waitKey",
"cv2.destroyAllWindows",
"cv2.split",
"cv2.cvtColor",
"cv2.imread"
] | [((18, 44), 'cv2.imread', 'cv2.imread', (['"""..\\\\lena.jpg"""'], {}), "('..\\\\lena.jpg')\n", (28, 44), False, 'import cv2\n'), ((51, 87), 'cv2.cvtColor', 'cv2.cvtColor', (['img', 'cv2.COLOR_BGR2HSV'], {}), '(img, cv2.COLOR_BGR2HSV)\n', (63, 87), False, 'import cv2\n'), ((98, 112), 'cv2.split', 'cv2.split', (['hsv'],... |
#
# Copyright 2019 The FATE 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... | [
"numpy.array"
] | [((1393, 1404), 'numpy.array', 'np.array', (['X'], {}), '(X)\n', (1401, 1404), True, 'import numpy as np\n'), ((1417, 1428), 'numpy.array', 'np.array', (['Y'], {}), '(Y)\n', (1425, 1428), True, 'import numpy as np\n')] |
from django.conf import settings
from django.core import mail
from django.urls import reverse
from django.utils.html import escape
from lib.tests.utils import BasePermissionTest, ClientTest
class PermissionTest(BasePermissionTest):
def test_password_reset(self):
url = reverse('password_reset')
t... | [
"django.utils.html.escape",
"django.urls.reverse"
] | [((285, 310), 'django.urls.reverse', 'reverse', (['"""password_reset"""'], {}), "('password_reset')\n", (292, 310), False, 'from django.urls import reverse\n'), ((717, 747), 'django.urls.reverse', 'reverse', (['"""password_reset_done"""'], {}), "('password_reset_done')\n", (724, 747), False, 'from django.urls import re... |
import numpy as np
# sigmoid function
def my_sigmoid(w,x):
return 1/(1+np.exp(-w.T.dot(x.T)))
# 损失函数
def obj_fun(w,x,y):
tmp = y.reshape(1,-1)*np.log(my_sigmoid(w,x)) + \
(1-y.reshape(1,-1))*np.log(1-my_sigmoid(w,x))
return np.sum(-tmp)
# 计算随机梯度的函数
def my_Stgrad(w,x,y):
return (my_sigmoid(w,x) - y)... | [
"numpy.sum"
] | [((241, 253), 'numpy.sum', 'np.sum', (['(-tmp)'], {}), '(-tmp)\n', (247, 253), True, 'import numpy as np\n')] |
# Packages
import os
import numpy as np
import pandas as pd
import datetime
import matplotlib.pyplot as plt
# Self-defined modules
import utility
from data_loader import DataLoader
def _add_fitness_fatigue(dataframe):
dataframe['Date'] = pd.to_datetime(dataframe.Date)
dataframe['Fatigue (ATL)'] = dataframe.ro... | [
"pandas.Series",
"matplotlib.pyplot.text",
"data_loader.DataLoader",
"utility.FeatureManager",
"pandas.to_datetime",
"matplotlib.pyplot.axhline",
"utility.load_model",
"utility.split_dataframe_by_activities",
"utility.get_train_load_model_types",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.... | [((244, 274), 'pandas.to_datetime', 'pd.to_datetime', (['dataframe.Date'], {}), '(dataframe.Date)\n', (258, 274), True, 'import pandas as pd\n'), ((1092, 1138), 'pandas.Series', 'pd.Series', (['indicators'], {'index': 'spreadsheet.index'}), '(indicators, index=spreadsheet.index)\n', (1101, 1138), True, 'import pandas a... |
from __future__ import annotations
import typing
from typing_extensions import Literal
from ctc import spec
from . import formats
@typing.overload
def keccak(
data: spec.BinaryInteger,
output_format: Literal['integer'],
library: typing.Optional[typing.Literal['pysha3', 'pycryptodome']] = None,
) -> int:... | [
"sha3.keccak_256",
"Crypto.Hash.keccak.new"
] | [((1389, 1410), 'sha3.keccak_256', 'sha3.keccak_256', (['data'], {}), '(data)\n', (1404, 1410), False, 'import sha3\n'), ((1525, 1565), 'Crypto.Hash.keccak.new', 'f_keccak.new', ([], {'digest_bits': '(256)', 'data': 'data'}), '(digest_bits=256, data=data)\n', (1537, 1565), True, 'from Crypto.Hash import keccak as f_kec... |
import looptime
def test_time_proxy_math():
proxy = looptime.LoopTimeProxy(looptime.new_event_loop(start=123.456))
assert str(proxy) == '123.456'
assert int(proxy) == 123
assert float(proxy) == 123.456
assert proxy == 123.456
assert not proxy == 456.123
assert proxy != 456.123
assert... | [
"looptime.LoopTimeProxy",
"looptime.new_event_loop"
] | [((1601, 1639), 'looptime.new_event_loop', 'looptime.new_event_loop', ([], {'start': '(123.456)'}), '(start=123.456)\n', (1624, 1639), False, 'import looptime\n'), ((1652, 1690), 'looptime.new_event_loop', 'looptime.new_event_loop', ([], {'start': '(456.123)'}), '(start=456.123)\n', (1675, 1690), False, 'import looptim... |
"""Test of parametric funsies."""
from __future__ import annotations
# funsies
from funsies import execute, Fun, morph, options, put, reduce, take
from funsies.config import MockServer
import funsies.parametric as p
def test_parametric_store_recall() -> None:
"""Test storing and recalling parametrics."""
ser... | [
"funsies.morph",
"funsies.config.MockServer",
"funsies.take",
"funsies.execute",
"funsies.options",
"funsies.put",
"funsies.reduce"
] | [((324, 336), 'funsies.config.MockServer', 'MockServer', ([], {}), '()\n', (334, 336), False, 'from funsies.config import MockServer\n'), ((941, 953), 'funsies.config.MockServer', 'MockServer', ([], {}), '()\n', (951, 953), False, 'from funsies.config import MockServer\n'), ((397, 403), 'funsies.put', 'put', (['(3)'], ... |
from django.db import models
class Municipality(models.Model):
dian_code = models.CharField(
max_length=255
)
name = models.CharField(
max_length=100,
null=False,
blank=False
)
def __str__(self):
return self.dian_code + ' - ' + self.name | [
"django.db.models.CharField"
] | [((81, 113), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (97, 113), False, 'from django.db import models\n'), ((140, 197), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'null': '(False)', 'blank': '(False)'}), '(max_length=100, ... |
"""
Module containing the code necessary to play a headless game of
Tic-Tac-Toe.
"""
import itertools
import random
class Game:
def __init__(self, players):
self.players = list(players)
def play(self):
board = Board()
game_record = GameRecord()
random.shuffle(self.players)... | [
"_minimaxplayer.MinimaxPlayer",
"itertools.cycle",
"_guiplayer.GuiPlayer",
"random.shuffle"
] | [((3318, 3343), '_guiplayer.GuiPlayer', '_guiplayer.GuiPlayer', (['"""X"""'], {}), "('X')\n", (3338, 3343), False, 'import _guiplayer\n'), ((3352, 3385), '_minimaxplayer.MinimaxPlayer', '_minimaxplayer.MinimaxPlayer', (['"""O"""'], {}), "('O')\n", (3380, 3385), False, 'import _minimaxplayer\n'), ((292, 320), 'random.sh... |
import pandas as pd
dfcsv=pd.read_csv('gruppen-zeitslots-vers3.csv')
dfcsv.T.to_json('gruppen-zeitslots.json') | [
"pandas.read_csv"
] | [((26, 68), 'pandas.read_csv', 'pd.read_csv', (['"""gruppen-zeitslots-vers3.csv"""'], {}), "('gruppen-zeitslots-vers3.csv')\n", (37, 68), True, 'import pandas as pd\n')] |
"""
Run transfer learning on FashionProductImages dataset. This will first fine-tune
a chosen model from the ImageNet model zoo on classifying the 20 most common
product and then in a second pass will fine-tune the network further on the
remaining, less common, product classes.
"""
import os
import random
import time
i... | [
"few_shot_learning.utils.allocate_inputs",
"torch.nn.CrossEntropyLoss",
"few_shot_learning.utils.AverageMeter",
"torchvision.transforms.ColorJitter",
"few_shot_learning.utils.accuracy",
"few_shot_learning.utils.save_results",
"os.path.isdir",
"os.mkdir",
"torchvision.transforms.ToTensor",
"torchvi... | [((1526, 1553), 'os.path.expanduser', 'os.path.expanduser', (['log_dir'], {}), '(log_dir)\n', (1544, 1553), False, 'import os\n'), ((1570, 1599), 'os.path.expanduser', 'os.path.expanduser', (['model_dir'], {}), '(model_dir)\n', (1588, 1599), False, 'import os\n'), ((2072, 2134), 'functools.partial', 'partial', (['alloc... |
import datetime
import logging
from flask import Blueprint, request, Response
from common import exception
from ecommerce.ali1688 import ali1688
from ecommerce.vova import vova
from ecommerce.vova import vova_merchant_rest
from model import product_model
from util import json_util, dict_util
goods = Blueprint('goods... | [
"ecommerce.vova.vova_merchant_rest.get_product_list",
"flask.request.args.get",
"ecommerce.vova.vova_merchant_rest.get_upload_status_by_batch_id",
"util.json_util.obj2json",
"util.dict_util.dict2obj",
"ecommerce.vova.vova.get_category_by_name",
"datetime.datetime.now",
"flask.Response",
"ecommerce.v... | [((304, 332), 'flask.Blueprint', 'Blueprint', (['"""goods"""', '__name__'], {}), "('goods', __name__)\n", (313, 332), False, 'from flask import Blueprint, request, Response\n'), ((764, 792), 'flask.request.args.get', 'request.args.get', (['"""category"""'], {}), "('category')\n", (780, 792), False, 'from flask import B... |
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.models import User
class UserAdmin(BaseUserAdmin):
list_display = ('username', 'email',
'first_name', 'last_name',
'is_staff', 'is_active',
)
admin.site.unregi... | [
"django.contrib.admin.site.unregister",
"django.contrib.admin.site.register"
] | [((303, 330), 'django.contrib.admin.site.unregister', 'admin.site.unregister', (['User'], {}), '(User)\n', (324, 330), False, 'from django.contrib import admin\n'), ((331, 367), 'django.contrib.admin.site.register', 'admin.site.register', (['User', 'UserAdmin'], {}), '(User, UserAdmin)\n', (350, 367), False, 'from djan... |
import socket
import sys
import json
import time
import random
import threading
from pprint import pprint
import pygame
import config
import program
import utils
import assets
info = dict()
info['conn_ok'] = False
info['server_msg'] = 'Brak'
info['score'] = 0
BUG_ID = program.BUG_ID
BUG_NAME = program.BUG_NAME
HOST... | [
"json.loads",
"pygame.transform.scale",
"socket.socket",
"pygame.Surface",
"time.sleep",
"sys.exc_info",
"program.PROGRAM",
"utils.Window",
"threading.Thread",
"assets.load_font",
"pprint.pprint",
"utils.printfr",
"assets.get_bug_img"
] | [((480, 542), 'utils.Window', 'utils.Window', ([], {'name': '"""Biedronka"""', 'size': 'config.CLIENT_WINDOW_SIZE'}), "(name='Biedronka', size=config.CLIENT_WINDOW_SIZE)\n", (492, 542), False, 'import utils\n'), ((561, 602), 'pygame.Surface', 'pygame.Surface', (['config.CLIENT_WINDOW_SIZE'], {}), '(config.CLIENT_WINDOW... |
import os
import copy
import numpy as np
import jigsawpy
def case_3_(src_path, dst_path):
# DEMO-3: generate multi-resolution spacing, via local refi-
# nement along coastlines and shallow ridges. Global grid
# resolution is 150KM, background resolution is 67KM and the
# min. adaptive resolution is 33KM.
opts... | [
"jigsawpy.savemsh",
"numpy.minimum",
"os.path.join",
"jigsawpy.cmd.marche",
"copy.copy",
"jigsawpy.jigsaw_jig_t",
"jigsawpy.jigsaw_msh_t",
"numpy.full",
"numpy.maximum"
] | [((323, 346), 'jigsawpy.jigsaw_jig_t', 'jigsawpy.jigsaw_jig_t', ([], {}), '()\n', (344, 346), False, 'import jigsawpy\n'), ((359, 382), 'jigsawpy.jigsaw_msh_t', 'jigsawpy.jigsaw_msh_t', ([], {}), '()\n', (380, 382), False, 'import jigsawpy\n'), ((395, 418), 'jigsawpy.jigsaw_msh_t', 'jigsawpy.jigsaw_msh_t', ([], {}), '(... |
from ezgraphics import GraphicsWindow
w= GraphicsWindow(640,480)
c= w.canvas()
c.setFill(0,255,255)
c.drawRect(310,260,100,100)
c.setFill(0,155,255)
c.drawRect(150,100,30,30)
c.setFill(0,55,155)
c.drawRect(180,130,50,50)
c.setFill(0,255,155)
c.drawRect(230,180,80,80)
c.setFill(0,155,155)
w.wait()
| [
"ezgraphics.GraphicsWindow"
] | [((42, 66), 'ezgraphics.GraphicsWindow', 'GraphicsWindow', (['(640)', '(480)'], {}), '(640, 480)\n', (56, 66), False, 'from ezgraphics import GraphicsWindow\n')] |
'''
Copyright 2013 <NAME>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,... | [
"fantastico.oauth2.exceptions.OAuth2InvalidClientError",
"fantastico.oauth2.exceptions.OAuth2InvalidTokenDescriptorError",
"fantastico.oauth2.exceptions.OAuth2InvalidScopesError"
] | [((3338, 3382), 'fantastico.oauth2.exceptions.OAuth2InvalidTokenDescriptorError', 'OAuth2InvalidTokenDescriptorError', (['attr_name'], {}), '(attr_name)\n', (3371, 3382), False, 'from fantastico.oauth2.exceptions import OAuth2InvalidTokenDescriptorError, OAuth2InvalidClientError, OAuth2InvalidScopesError\n'), ((3939, 4... |
from typing import Any, Dict, List, Optional, Tuple, Type, Union
import gym
import numpy as np
import torch as th
from torch.nn import functional as F
from stable_baselines3.common.buffers import ReplayBuffer
from stable_baselines3.common.noise import ActionNoise
from stable_baselines3.common.off_policy_algorithm imp... | [
"numpy.mean",
"torch.nn.functional.mse_loss",
"torch.log",
"stable_baselines3.common.preprocessing.get_action_dim",
"torch.mean",
"torch.max",
"stable_baselines3.bear.policies.VariationalAutoEncoder",
"torch.exp",
"torch.min",
"torch.no_grad",
"torch.repeat_interleave",
"stable_baselines3.comm... | [((6173, 6218), 'stable_baselines3.common.preprocessing.get_flattened_obs_dim', 'get_flattened_obs_dim', (['self.observation_space'], {}), '(self.observation_space)\n', (6194, 6218), False, 'from stable_baselines3.common.preprocessing import get_action_dim, get_flattened_obs_dim\n'), ((6240, 6273), 'stable_baselines3.c... |
from aydin.util.misc.combinatorics import closest_product
def test_closest_product():
u = [1, 2, 5, 7, 9, 10]
N = 15
result = closest_product(u, N)
print(f"closest_product({u}, {N}) = {result}")
assert result == [1, 3]
N = 27
result = closest_product(u, N)
print(f"closest_product({u... | [
"aydin.util.misc.combinatorics.closest_product"
] | [((142, 163), 'aydin.util.misc.combinatorics.closest_product', 'closest_product', (['u', 'N'], {}), '(u, N)\n', (157, 163), False, 'from aydin.util.misc.combinatorics import closest_product\n'), ((268, 289), 'aydin.util.misc.combinatorics.closest_product', 'closest_product', (['u', 'N'], {}), '(u, N)\n', (283, 289), Fa... |
# Copyright (c) 2015 <NAME>.
# Uranium is released under the terms of the LGPLv3 or higher.
from UM.PluginObject import PluginObject
import collections
from typing import Optional, Any, Callable, List
## Base class for plugins that extend the functionality of Uranium.
# Every extension adds a (sub) menu to the ex... | [
"collections.OrderedDict"
] | [((483, 508), 'collections.OrderedDict', 'collections.OrderedDict', ([], {}), '()\n', (506, 508), False, 'import collections\n')] |
"""
.. currentmodule:: clifford
========================================
clifford (:mod:`clifford`)
========================================
The Main Module. Provides two classes, Layout and MultiVector, and several helper functions to implement the algebras.
Classes
===============
.. autosummary::
:toctree:... | [
"numpy.abs",
"numpy.linalg.solve",
"numpy.power",
"functools.reduce",
"numpy.hstack",
"numpy.result_type",
"numba.njit",
"numpy.argmax",
"numpy.asarray",
"numpy.linalg.det",
"itertools.combinations",
"numpy.array",
"numpy.zeros",
"sparse.COO",
"numba.generated_jit"
] | [((2041, 2088), 'numba.njit', 'numba.njit', ([], {'parallel': 'NUMBA_PARALLEL', 'nogil': '(True)'}), '(parallel=NUMBA_PARALLEL, nogil=True)\n', (2051, 2088), False, 'import numba\n'), ((1568, 1595), 'numpy.zeros', 'np.zeros', (['(ndimout, ndimin)'], {}), '((ndimout, ndimin))\n', (1576, 1595), True, 'import numpy as np\... |
# coding: utf-8
# 我觉得变量太多的alpha factor我暂时搁置,以及我觉得rank函数比较奇怪,因为range太大了,是否需要设置一个窗口呢?
#
#
# ## Dropped Index:
# - Alpha30(要用到fama三因子)
# - Alpha75(要用到BENCHMARKINDEX)
# - Alpha143(要用到SELF函数)
# - Alpha149(要用到BENCHMARKINDEX)
# - Alpha181(要用到BENCHMARKINDEX)
# - Alpha182(要用到BENCHMARKINDEX)
### 对于:?较为复杂的表达式,我都先用一些中间变量存储中间... | [
"numpy.log"
] | [((36308, 36321), 'numpy.log', 'np.log', (['CLOSE'], {}), '(CLOSE)\n', (36314, 36321), True, 'import numpy as np, pandas as pd, matplotlib.pyplot as plt\n'), ((24007, 24020), 'numpy.log', 'np.log', (['CLOSE'], {}), '(CLOSE)\n', (24013, 24020), True, 'import numpy as np, pandas as pd, matplotlib.pyplot as plt\n'), ((241... |
import dnacauldron as dc
repository = dc.SequenceRepository()
repository.import_records(files=["gibson_sequences.fa"])
assembly_plan = dc.AssemblyPlan.from_spreadsheet(
assembly_class=dc.GibsonAssembly, path="gibson_assembly.csv"
)
plan_simulation = assembly_plan.simulate(sequence_repository=repository)
print("Ass... | [
"dnacauldron.SequenceRepository",
"dnacauldron.AssemblyPlan.from_spreadsheet",
"dnacauldron.AssemblyReportWriter"
] | [((39, 62), 'dnacauldron.SequenceRepository', 'dc.SequenceRepository', ([], {}), '()\n', (60, 62), True, 'import dnacauldron as dc\n'), ((136, 235), 'dnacauldron.AssemblyPlan.from_spreadsheet', 'dc.AssemblyPlan.from_spreadsheet', ([], {'assembly_class': 'dc.GibsonAssembly', 'path': '"""gibson_assembly.csv"""'}), "(asse... |
"""
Build script with a runtime error.
"""
from styn import chore
@chore()
def images():
"""Prepare images. Raises IOError."""
global ran_images
ran_images = True
raise IOError
@chore(images)
def android():
"""Package Android app."""
global ran_android
print("android")
ran_android = ... | [
"styn.chore"
] | [((69, 76), 'styn.chore', 'chore', ([], {}), '()\n', (74, 76), False, 'from styn import chore\n'), ((198, 211), 'styn.chore', 'chore', (['images'], {}), '(images)\n', (203, 211), False, 'from styn import chore\n')] |
import concurrent.futures
from apis import *
from build import *
import time
import sys
config = Config("../config/config.ini")
nessus = Nessus(f"{config.nessus_config.get('access_key')}", f"{config.nessus_config.get('secret_key')}", f"{config.nessus_config.get('protocol')}://{config.nessus_config.get('ip')}:{config.... | [
"time.time",
"time.sleep",
"sys.exit"
] | [((422, 433), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (430, 433), False, 'import sys\n'), ((1693, 1704), 'time.time', 'time.time', ([], {}), '()\n', (1702, 1704), False, 'import time\n'), ((2063, 2100), 'time.sleep', 'time.sleep', (['exporter.polling_interval'], {}), '(exporter.polling_interval)\n', (2073, 2100... |
# Imports
from django.contrib import admin
from django.urls import path, include
# BEGIN
urlpatterns = [
path('admin/', admin.site.urls),
path('watchdog/', include('watchdog.urls')),
path('dashboard/', include('dashboard.urls')),
path('smarttasks/', include('smarttasks.urls')),
path('nursehouse/',... | [
"django.urls.path",
"django.urls.include"
] | [((111, 142), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('admin/', admin.site.urls)\n", (115, 142), False, 'from django.urls import path, include\n'), ((166, 190), 'django.urls.include', 'include', (['"""watchdog.urls"""'], {}), "('watchdog.urls')\n", (173, 190), False, 'from django.urls i... |
"""
Classes from the 'CloudPhotoLibrary' framework.
"""
try:
from rubicon.objc import ObjCClass
except ValueError:
def ObjCClass(name):
return None
def _Class(name):
try:
return ObjCClass(name)
except NameError:
return None
CPLDateFormatter = _Class("CPLDateFormatter")
CPLP... | [
"rubicon.objc.ObjCClass"
] | [((210, 225), 'rubicon.objc.ObjCClass', 'ObjCClass', (['name'], {}), '(name)\n', (219, 225), False, 'from rubicon.objc import ObjCClass\n')] |
from pathlib import Path
import pandas as pd
from pandas.api.types import CategoricalDtype
path = Path("data/power7/original.csv")
df = pd.read_csv(path)
df = df.astype({k: CategoricalDtype(ordered=True) for k, d in df.dtypes.items() if d == "O"})
df.to_pickle(path.with_suffix(".pkl")) | [
"pandas.api.types.CategoricalDtype",
"pandas.read_csv",
"pathlib.Path"
] | [((99, 131), 'pathlib.Path', 'Path', (['"""data/power7/original.csv"""'], {}), "('data/power7/original.csv')\n", (103, 131), False, 'from pathlib import Path\n'), ((137, 154), 'pandas.read_csv', 'pd.read_csv', (['path'], {}), '(path)\n', (148, 154), True, 'import pandas as pd\n'), ((174, 204), 'pandas.api.types.Categor... |
import unittest
from django.test import TestCase, Client
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
REPO_DATA = ("local", "master")
COMMIT_SHA = ("78a325da2d00c5071ddddc8b35dfb0e1241660b1",)
PATH = ("plantilla.html",)
class TestCommitViews(TestCase):
def setUp(self):
... | [
"django.contrib.auth.models.User.objects.create_user",
"django.core.urlresolvers.reverse"
] | [((336, 384), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', (['"""test"""', '"""test"""', '"""test"""'], {}), "('test', 'test', 'test')\n", (360, 384), False, 'from django.contrib.auth.models import User\n'), ((609, 649), 'django.core.urlresolvers.reverse', 'reverse', (['"""commitlo... |
import re
# http://stackoverflow.com/a/13752628/6762004
RE_EMOJI = re.compile("[\U00010000-\U0010ffff]", flags=re.UNICODE)
def strip_emoji(text: str) -> str:
return RE_EMOJI.sub(r"", text)
def strip_spaces(text: str) -> str:
return re.sub(" +", " ", text)
| [
"re.sub",
"re.compile"
] | [((68, 114), 're.compile', 're.compile', (['"""[𐀀-\U0010ffff]"""'], {'flags': 're.UNICODE'}), "('[𐀀-\\U0010ffff]', flags=re.UNICODE)\n", (78, 114), False, 'import re\n'), ((245, 268), 're.sub', 're.sub', (['""" +"""', '""" """', 'text'], {}), "(' +', ' ', text)\n", (251, 268), False, 'import re\n')] |
from typing import Optional, Dict, TYPE_CHECKING
from algorithms.configuration.entities.agent import Agent
from algorithms.configuration.entities.entity import Entity
from algorithms.configuration.entities.extended_wall import ExtendedWall
from algorithms.configuration.entities.goal import Goal
from algorithms.configu... | [
"algorithms.configuration.entities.entity.Entity"
] | [((2038, 2097), 'algorithms.configuration.entities.entity.Entity', 'Entity', (['self._map.trace[0].position', 'self._map.agent.radius'], {}), '(self._map.trace[0].position, self._map.agent.radius)\n', (2044, 2097), False, 'from algorithms.configuration.entities.entity import Entity\n')] |
# -*- coding: utf-8 -*-
""" Code for training and evaluating Self-Explaining Neural Networks.
Copyright (C) 2018 <NAME> <<EMAIL>>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of t... | [
"torch.max",
"torch.nn.MSELoss",
"torch.bmm",
"torch.nn.functional.pad",
"os.path.exists",
"torch.autograd.Variable",
"torch.abs",
"matplotlib.pyplot.savefig",
"torch.Tensor",
"torch.autograd.grad",
"torch.nn.NLLLoss",
"torch.save",
"time.time",
"torch.cat",
"torch.autograd.backward",
... | [((2057, 2076), 'torch.ones', 'torch.ones', (['b', 'm', 'c'], {}), '(b, m, c)\n', (2067, 2076), False, 'import torch\n'), ((3180, 3195), 'torch.cat', 'torch.cat', (['J', '(2)'], {}), '(J, 2)\n', (3189, 3195), False, 'import torch\n'), ((3846, 3889), 'os.path.join', 'os.path.join', (['outpath', '"""checkpoint.pth.tar"""... |
#!/usr/bin/env python3
# Copyright 2019, Offchain Labs, 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 applica... | [
"sys.exit",
"argparse.ArgumentParser",
"build_validator_docker.build_validator",
"setup_states.setup_validator_configs",
"argparse.ArgumentTypeError",
"os.path.abspath",
"json.load",
"os.path.isfile",
"os.path.isdir",
"shutil.rmtree",
"support.run.run",
"setup_states.setup_validator_states_doc... | [((1645, 1689), 'os.path.isdir', 'os.path.isdir', (['setup_states.VALIDATOR_STATES'], {}), '(setup_states.VALIDATOR_STATES)\n', (1658, 1689), False, 'import os\n'), ((2092, 2209), 'setup_states.setup_validator_states_docker', 'setup_states.setup_validator_states_docker', (['args.contract', 'args.n_validators', 'image_n... |
#!/usr/bin/python
#coding:utf-8
###########################################################
### A Python wrapper of Plexon.h
### Written by Huangxin
###########################################################
import logging # available in Python 2.3
import logging.handlers
############# Logging #############
logge... | [
"logging.getLogger",
"logging.StreamHandler",
"ctypes.POINTER",
"logging.Formatter",
"os.path.join",
"os.path.dirname"
] | [((324, 363), 'logging.getLogger', 'logging.getLogger', (['"""SpikeRecord.Plexon"""'], {}), "('SpikeRecord.Plexon')\n", (341, 363), False, 'import logging\n'), ((412, 485), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s (%(process)d) %(levelname)s: %(message)s"""'], {}), "('%(asctime)s (%(process)d) %(leve... |