code stringlengths 20 1.04M | apis list | extract_api stringlengths 75 9.94M |
|---|---|---|
from functools import partial
import re
import torch
import torch.nn.functional as F
from torch import nn, Tensor
from typing import Any, Callable, Union, Optional
from torch.nn import functional as F
relu = nn.ReLU(inplace=True)
def is_torch_version_ge_1_6():
m = re.match(r"(\d)\.(\d)", torch.__version__)
... | [
"functools.partial",
"torch.nn.ReLU",
"torch.nn.init.kaiming_normal_",
"torch.nn.Sequential",
"torch.nn.Conv3d",
"torch.nn.functional.avg_pool2d",
"torch.nn.Conv2d",
"re.match",
"torch.cat",
"torch.nn.BatchNorm2d",
"torch.nn.init.constant_",
"torch.nn.functional.avg_pool3d",
"torch.nn.functi... | [((211, 232), 'torch.nn.ReLU', 'nn.ReLU', ([], {'inplace': '(True)'}), '(inplace=True)\n', (218, 232), False, 'from torch import nn, Tensor\n'), ((274, 318), 're.match', 're.match', (['"""(\\\\d)\\\\.(\\\\d)"""', 'torch.__version__'], {}), "('(\\\\d)\\\\.(\\\\d)', torch.__version__)\n", (282, 318), False, 'import re\n'... |
from typing import Optional
import orjson
from django.db import transaction
from django.utils.timezone import now as timezone_now
from zerver.actions.realm_settings import do_set_realm_property
from zerver.models import (
Realm,
RealmAuditLog,
RealmDomain,
UserProfile,
active_user_ids,
get_rea... | [
"zerver.actions.realm_settings.do_set_realm_property",
"zerver.models.active_user_ids",
"django.utils.timezone.now",
"zerver.models.get_realm_domains",
"zerver.models.RealmDomain.objects.create",
"zerver.models.RealmDomain.objects.filter",
"django.db.transaction.atomic"
] | [((386, 418), 'django.db.transaction.atomic', 'transaction.atomic', ([], {'durable': '(True)'}), '(durable=True)\n', (404, 418), False, 'from django.db import transaction\n'), ((1406, 1438), 'django.db.transaction.atomic', 'transaction.atomic', ([], {'durable': '(True)'}), '(durable=True)\n', (1424, 1438), False, 'from... |
# -*- coding: utf-8 -*-
"""
sellar_conversions.py generated by WhatsOpt.
"""
import numpy as np
from .sellar.ttypes import *
# Disc1
def to_openmdao_disc1_inputs(ins, inputs={}):
inputs['x'] = np.array(ins.x)
inputs['z'] = np.array(ins.z)
inputs['y2'] = np.array(ins.y2)
return inputs
def to_... | [
"numpy.array"
] | [((208, 223), 'numpy.array', 'np.array', (['ins.x'], {}), '(ins.x)\n', (216, 223), True, 'import numpy as np\n'), ((242, 257), 'numpy.array', 'np.array', (['ins.z'], {}), '(ins.z)\n', (250, 257), True, 'import numpy as np\n'), ((277, 293), 'numpy.array', 'np.array', (['ins.y2'], {}), '(ins.y2)\n', (285, 293), True, 'im... |
import torch
import torch.nn as nn
import kornia
class Decoder(nn.Module):
def __init__(self, w, z, layers):
super(Decoder, self).__init__()
self.layers = layers
self.down_blocks = nn.ModuleList()
self.up_blocks = nn.ModuleList()
self.down_mappings = nn.ModuleList()
... | [
"torch.nn.ReLU",
"torch.nn.ModuleList",
"torch.nn.functional.instance_norm",
"torch.nn.Conv2d",
"torch.split",
"kornia.filters.gaussian_blur2d",
"torch.sigmoid",
"torch.nn.functional.interpolate",
"torch.nn.Linear",
"torch.nn.MaxPool2d",
"torch.nn.LeakyReLU"
] | [((211, 226), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (224, 226), True, 'import torch.nn as nn\n'), ((252, 267), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (265, 267), True, 'import torch.nn as nn\n'), ((297, 312), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (310, 312), Tr... |
from app.auth.forms import LoginForm
from .. import db
from . import main
from ..requests import get_quote
from ..models import User, Post, Comment
from .forms import PostForm,CommentForm
from flask import flash, render_template, redirect, url_for
from flask_login import login_required, current_user
from datetime impor... | [
"datetime.datetime.now",
"flask.render_template"
] | [((429, 471), 'flask.render_template', 'render_template', (['"""index.html"""'], {'quote': 'quote'}), "('index.html', quote=quote)\n", (444, 471), False, 'from flask import flash, render_template, redirect, url_for\n'), ((1112, 1165), 'flask.render_template', 'render_template', (['"""new-post.html"""'], {'post_form': '... |
#!/usr/bin/env python3
#
# This script calculates a vivacity curve as described in the paper.
# Vivacity will be calculated based on segments and on pixels, even
# though this does not have an impact in our experiments.
#
# In order to use this script correctly, you must specify a prefix for
# the individual skeletons,... | [
"skeleton_to_segments.getSegments",
"os.path.abspath",
"argparse.ArgumentParser",
"re.match",
"collections.defaultdict"
] | [((791, 816), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (814, 816), False, 'import argparse\n'), ((1944, 2001), 'skeleton_to_segments.getSegments', 'skel.getSegments', (['skeletonPath'], {'appendBranchVertices': '(True)'}), '(skeletonPath, appendBranchVertices=True)\n', (1960, 2001), True,... |
# -*- coding: utf-8 -*-
#
# Unless explicitly stated otherwise all files in this repository are licensed
# under the Apache 2 License.
#
# This product includes software developed at Datadog
# (https://www.datadoghq.com/).
#
# Copyright 2018 Datadog, Inc.
#
"""Add subscriptions table.
Revision ID: 5dc3ef40c98c
Revis... | [
"alembic.op.drop_table",
"sqlalchemy.DateTime",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.Boolean",
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.String",
"sqlalchemy.Integer"
] | [((1030, 1060), 'alembic.op.drop_table', 'op.drop_table', (['"""subscriptions"""'], {}), "('subscriptions')\n", (1043, 1060), False, 'from alembic import op\n'), ((807, 872), 'sqlalchemy.ForeignKeyConstraint', 'sa.ForeignKeyConstraint', (["['board_id']", "['boards.trello_board_id']"], {}), "(['board_id'], ['boards.trel... |
import logging, glob, os, sys
from .base import MapFix, GetDependencies
_log = logging.getLogger('byond.mapfixes')
def Load():
_log.info('Loading MapFix Modules...')
for f in glob.glob(os.path.dirname(__file__) + "/*.py"):
modName = 'byond.mapfixes.' + os.path.basename(f)[:-3]
_log.debug(' Loa... | [
"os.path.dirname",
"logging.getLogger",
"os.path.basename"
] | [((80, 115), 'logging.getLogger', 'logging.getLogger', (['"""byond.mapfixes"""'], {}), "('byond.mapfixes')\n", (97, 115), False, 'import logging, glob, os, sys\n'), ((195, 220), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (210, 220), False, 'import logging, glob, os, sys\n'), ((271, 290), ... |
# Generated by Django 2.2.13 on 2020-10-13 03:30
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("family_information", "0006_familyinformationhomepage_links_image"),
]
operations = [
migrations.AlterField... | [
"django.db.models.ForeignKey"
] | [((424, 543), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.SET_NULL', 'related_name': '"""+"""', 'to': '"""wagtailcore.Page"""'}), "(null=True, on_delete=django.db.models.deletion.SET_NULL,\n related_name='+', to='wagtailcore.Page')\n", (441, 543... |
from tkinter import *
import requests
from bs4 import BeautifulSoup
# Set our variables
refresh_time = 1000* 2 # Refresh every 2 seconds
# Background colors
original_bg = "#CECCBE"
dark_bg = 'blue'
old_bg = 'sandybrown' # This is no longer used but can be used to replace original_bg
label_old_bg = 'light goldenrod' #... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((3076, 3093), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (3088, 3093), False, 'import requests\n'), ((3105, 3144), 'bs4.BeautifulSoup', 'BeautifulSoup', (['page.text', '"""html.parser"""'], {}), "(page.text, 'html.parser')\n", (3118, 3144), False, 'from bs4 import BeautifulSoup\n')] |
def readPDB(pfile):
''' read a pdb file and return coordinates of atoms (2D list) '''
atomicCoor = [] # [[name, x, y, z]]
with open(pfile, 'r') as ifile:
rawData = ifile.readlines()
for row in rawData:
data = row.split()
if data[0] == 'ATOM':
atomicCoor.appe... | [
"os.listdir"
] | [((1058, 1074), 'os.listdir', 'os.listdir', (['tdir'], {}), '(tdir)\n', (1068, 1074), False, 'import os\n')] |
# Copyright 2019,2020,2021 Sony Corporation.
# Copyright 2021 Sony Group Corporation.
#
# 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
#
# Un... | [
"nnabla.load_parameters",
"nnabla.functions.concatenate",
"argparse.ArgumentParser",
"os.makedirs",
"nnabla.utils.image_utils.imsave",
"os.path.dirname",
"os.path.exists",
"models.LocalGenerator",
"nnabla.Variable",
"models.encode_inputs",
"os.path.join"
] | [((1478, 1503), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1501, 1503), False, 'import argparse\n'), ((4799, 4833), 'nnabla.load_parameters', 'nn.load_parameters', (['conf.load_path'], {}), '(conf.load_path)\n', (4817, 4833), True, 'import nnabla as nn\n'), ((5080, 5127), 'os.path.join', '... |
from scrapy.exceptions import DropItem
from itemadapter import ItemAdapter
class FilterDuplicatesPipeline:
"""Scrapy Item Pipeline to drop duplicate items per spider run."""
def __init__(self, *args, **kwargs):
self.ids_seen = set()
super().__init__(*args, **kwargs)
def get_unique_value... | [
"itemadapter.ItemAdapter",
"scrapy.exceptions.DropItem"
] | [((664, 681), 'itemadapter.ItemAdapter', 'ItemAdapter', (['item'], {}), '(item)\n', (675, 681), False, 'from itemadapter import ItemAdapter\n'), ((1247, 1300), 'scrapy.exceptions.DropItem', 'DropItem', (['f"""Duplicate item found: {duplicate_string}"""'], {}), "(f'Duplicate item found: {duplicate_string}')\n", (1255, 1... |
# -*- encoding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import attr
from attr import ib as Field
from addonpayments.api.transaction_management.validators import TransactionManagementValidator
from addonpayments.api.common.requests import ApiRequest
from addonpayments.api.mixins import Fiel... | [
"attr.ib"
] | [((552, 618), 'attr.ib', 'Field', ([], {'default': '""""""', 'validator': 'TransactionManagementValidator.pasref'}), "(default='', validator=TransactionManagementValidator.pasref)\n", (557, 618), True, 'from attr import ib as Field\n'), ((632, 697), 'attr.ib', 'Field', ([], {'default': '""""""', 'convert': 'str', 'vali... |
#!/usr/bin/env python3
# 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 torch.testing import FileCheck # @manual
from torchr... | [
"unittest.main",
"torchrec.models.deepfm.FMInteractionArch",
"torchrec.fx.symbolic_trace",
"torchrec.models.deepfm.SimpleDeepFMNN",
"torch.jit.script",
"torchrec.fx.Tracer",
"torch.manual_seed",
"torchrec.modules.embedding_modules.EmbeddingBagCollection",
"torch.testing.FileCheck",
"torch.Tensor",... | [((5930, 5945), 'unittest.main', 'unittest.main', ([], {}), '()\n', (5943, 5945), False, 'import unittest\n'), ((780, 800), 'torch.manual_seed', 'torch.manual_seed', (['(0)'], {}), '(0)\n', (797, 800), False, 'import torch\n'), ((920, 938), 'torch.rand', 'torch.rand', (['(B, D)'], {}), '((B, D))\n', (930, 938), False, ... |
#!/usr/bin/env python
# Copyright (C) 2015 Ion Torrent Systems, Inc. All Rights Reserved
# DataExport plugin
#
# This plugin will transfer the associated data file categories to a server.
import os
import sys
import json
import urllib
import traceback
from ion.plugin import PluginCLI, IonPlugin, RunLevel
class DataEx... | [
"json.load",
"os.path.basename",
"os.path.isdir",
"ion.plugin.IonPlugin.__init__",
"os.path.exists",
"json.dumps",
"sys._getframe",
"traceback.format_exc",
"os.path.join"
] | [((886, 910), 'ion.plugin.IonPlugin.__init__', 'IonPlugin.__init__', (['self'], {}), '(self)\n', (904, 910), False, 'from ion.plugin import PluginCLI, IonPlugin, RunLevel\n'), ((7515, 7565), 'os.path.join', 'os.path.join', (['self.output_dir', '"""status_block.html"""'], {}), "(self.output_dir, 'status_block.html')\n",... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('helios', '0002_castvote_cast_ip'),
]
operations = [
migrations.AlterField(
model_name='election',
na... | [
"django.db.models.CharField"
] | [((355, 400), 'django.db.models.CharField', 'models.CharField', ([], {'unique': '(True)', 'max_length': '(100)'}), '(unique=True, max_length=100)\n', (371, 400), False, 'from django.db import models, migrations\n')] |
## script to get data from Zhou's version of vgg
## thingys we need
from Make_activation import combine_h5_files_in_activation_table
import os
from h5_analysis_jitterer import class_code_to_name, make_class_to_line_number_look_up_table, build_label_dict
from set_up_caffe_net import set_up_caffe, CaffeSettings, Caff... | [
"Make_activation.combine_h5_files_in_activation_table",
"Automation_experimental_functions.do_jitter_plot_test",
"h5_analysis_jitterer.build_cluster_from_class_label",
"set_up_caffe_net.CaffeSettings",
"os.getcwd",
"h5_analysis_jitterer.make_class_to_line_number_look_up_table",
"h5_analysis_jitterer.com... | [((717, 732), 'set_up_caffe_net.CaffeSettings', 'CaffeSettings', ([], {}), '()\n', (730, 732), False, 'from set_up_caffe_net import set_up_caffe, CaffeSettings, Caffe_NN_setup\n'), ((1129, 1174), 'os.path.join', 'os.path.join', (['dir_root', '"""dataset/broden1_224"""'], {}), "(dir_root, 'dataset/broden1_224')\n", (114... |
import pytest
from leexportpy.service import Service
def test_process():
with pytest.raises(NotImplementedError):
service_ojb = Service("test_data", "test_api_key", {})
service_ojb.process()
def test_transform():
with pytest.raises(NotImplementedError):
service_ojb = Service("test_d... | [
"pytest.raises",
"leexportpy.service.Service"
] | [((416, 456), 'leexportpy.service.Service', 'Service', (['"""test_data"""', '"""test_api_key"""', '{}'], {}), "('test_data', 'test_api_key', {})\n", (423, 456), False, 'from leexportpy.service import Service\n'), ((85, 119), 'pytest.raises', 'pytest.raises', (['NotImplementedError'], {}), '(NotImplementedError)\n', (98... |
import sys
import numpy as np
import math
import os
import rospy
import matplotlib.pyplot as plt
import tf
from XCM.msg import CommandAdvr
from XCM.msg import JointStateAdvr
from robolearn.old_utils.trajectory_reproducer import TrajectoryReproducer
from robolearn.old_utils.iit.iit_robots_params import bigman_params
fro... | [
"numpy.load",
"rospy.Subscriber",
"rospy.ServiceProxy",
"numpy.tile",
"XCM.msg.CommandAdvr",
"robolearn.old_utils.trajectory_reproducer.TrajectoryReproducer",
"os.path.abspath",
"numpy.set_printoptions",
"numpy.zeros_like",
"os.path.dirname",
"rospy.Rate",
"robolearn.old_utils.plot_utils.plot_... | [((777, 840), 'numpy.set_printoptions', 'np.set_printoptions', ([], {'precision': '(4)', 'suppress': '(True)', 'linewidth': '(1000)'}), '(precision=4, suppress=True, linewidth=1000)\n', (796, 840), True, 'import numpy as np\n'), ((867, 891), 'os.system', 'os.system', (['"""gz log -d 0"""'], {}), "('gz log -d 0')\n", (8... |
import enum
import os
import urwid
import discurses.config
import discurses.keymaps as keymaps
import discurses.processing
from discurses.ui import (HasModal, MessageEditWidget, MessageListWidget,
SendChannelSelector, ServerTree, Statusbar)
from discurses.ui.member_list import MemberList
... | [
"urwid.Pile",
"discurses.ui.HasModal.__init__",
"discurses.ui.MessageEditWidget",
"discurses.ui.MessageListWidget",
"discurses.ui.ServerTree",
"os.popen",
"urwid.LineBox",
"urwid.Columns",
"urwid.WidgetWrap.__init__",
"discurses.ui.SendChannelSelector",
"discurses.ui.Statusbar",
"discurses.ui.... | [((550, 561), 'enum.auto', 'enum.auto', ([], {}), '()\n', (559, 561), False, 'import enum\n'), ((585, 596), 'enum.auto', 'enum.auto', ([], {}), '()\n', (594, 596), False, 'import enum\n'), ((620, 631), 'enum.auto', 'enum.auto', ([], {}), '()\n', (629, 631), False, 'import enum\n'), ((654, 665), 'enum.auto', 'enum.auto'... |
import logging
import requests
import Bio.SeqIO as bpio
from io import StringIO
from SNDG.WebServices import download_file
from SNDG import execute
_log = logging.getLogger(__name__)
unip_so_map = {'DNA-binding region': "SO:0001429",
'active site': "SO:0001104",
'binding site': "SO:0000... | [
"io.StringIO",
"SNDG.execute",
"requests.get",
"SNDG.WebServices.download_file",
"logging.getLogger"
] | [((157, 184), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (174, 184), False, 'import logging\n'), ((2392, 2505), 'SNDG.WebServices.download_file', 'download_file', (["(Uniprot.DEFAULT_UNIPROT_URL + uniprot_id + '.fasta')", 'f"""{outdir}/{uniprot_id}.fasta"""', 'overwrite'], {}), "(Unip... |
import sqlite3 as lite
import hashlib
import pickle
from datetime import datetime, timedelta, timezone
from typing import Optional
import os
from http.cookies import SimpleCookie
from email.utils import format_datetime
from util import *
class UserAlreadyExistsException(Exception):
def __init__(self, username: st... | [
"http.cookies.SimpleCookie",
"email.utils.format_datetime",
"datetime.datetime.now",
"hashlib.sha256",
"sqlite3.connect",
"datetime.timedelta",
"os.path.join",
"os.urandom"
] | [((648, 683), 'os.path.join', 'os.path.join', (['data_dir', '"""fotaro.db"""'], {}), "(data_dir, 'fotaro.db')\n", (660, 683), False, 'import os\n'), ((703, 724), 'sqlite3.connect', 'lite.connect', (['db_file'], {}), '(db_file)\n', (715, 724), True, 'import sqlite3 as lite\n'), ((807, 824), 'datetime.timedelta', 'timede... |
# Copyright 2016 Google Inc. 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 applicable law or ag... | [
"googlecloudsdk.core.credentials.gce.Metadata",
"oauth2client.clientsecrets.InvalidClientSecretsError",
"os.remove",
"googlecloudsdk.core.credentials.store.RevokeCredentials",
"json.load",
"oauth2client.client._get_application_default_credential_from_file",
"googlecloudsdk.core.log.error",
"webbrowser... | [((4857, 4886), 'oauth2client.client._get_well_known_file', 'client._get_well_known_file', ([], {}), '()\n', (4884, 4886), False, 'from oauth2client import client\n'), ((5296, 5370), 'oauth2client.client._get_application_default_credential_from_file', 'client._get_application_default_credential_from_file', (['credentia... |
import sys
import re
from xml.etree.ElementTree import Element, dump, ElementTree
def get_tex(filepath):
with open(filepath, encoding='utf-8') as filedata:
return filedata.read()
return False
def find_command(line):
r = re.compile(r'(\\[a-z]+)')
if r.match(line):
line = r.sub(r'<code>\... | [
"xml.etree.ElementTree.ElementTree",
"xml.etree.ElementTree.Element",
"re.compile"
] | [((242, 268), 're.compile', 're.compile', (['"""(\\\\\\\\[a-z]+)"""'], {}), "('(\\\\\\\\[a-z]+)')\n", (252, 268), False, 'import re\n'), ((486, 501), 'xml.etree.ElementTree.Element', 'Element', (['"""root"""'], {}), "('root')\n", (493, 501), False, 'from xml.etree.ElementTree import Element, dump, ElementTree\n'), ((51... |
from __future__ import division
import argparse
import os, sys
import os.path as osp
import time
import open3d as o3d
import mmcv
import torch
from mmcv import Config
from mmcv.runner import init_dist
from mmdet import __version__
from mmdet.apis import get_root_logger, set_random_seed, train_detector
from mmdet.dat... | [
"argparse.ArgumentParser",
"mmcv.Config.fromfile",
"os.path.join",
"shutil.copy",
"sys.path.append",
"os.path.abspath",
"mmdet.models.build_detector",
"os.path.exists",
"numpy.loadtxt",
"time.localtime",
"mmdet.apis.get_root_logger",
"mmcv.runner.init_dist",
"os.path.basename",
"os.path.re... | [((534, 559), 'sys.path.append', 'sys.path.append', (['root_dir'], {}), '(root_dir)\n', (549, 559), False, 'import os, sys\n'), ((592, 647), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Train a detector"""'}), "(description='Train a detector')\n", (615, 647), False, 'import argparse\n'... |
from __future__ import print_function
from pyorbit.classes.common import *
from pyorbit.classes.model_container_polychord import ModelContainerPolyChord
from pyorbit.classes.input_parser import yaml_parser, pars_input
from pyorbit.classes.io_subroutines import nested_sampling_save_to_cpickle, nested_sampling_load_from_... | [
"pyorbit.classes.io_subroutines.nested_sampling_create_dummy_file",
"pyorbit.classes.model_container_polychord.ModelContainerPolyChord",
"pyorbit.classes.io_subroutines.nested_sampling_save_to_cpickle",
"pyorbit.classes.results_analysis.results_resumen",
"pyorbit.classes.input_parser.pars_input"
] | [((1062, 1087), 'pyorbit.classes.model_container_polychord.ModelContainerPolyChord', 'ModelContainerPolyChord', ([], {}), '()\n', (1085, 1087), False, 'from pyorbit.classes.model_container_polychord import ModelContainerPolyChord\n'), ((1092, 1133), 'pyorbit.classes.input_parser.pars_input', 'pars_input', (['config_in'... |
from django.conf.urls import patterns, url
from django.utils.translation import ugettext_lazy as _
from wagtail.wagtailcore import hooks
from wagtail.contrib.modeladmin.options import (
ModelAdmin, modeladmin_register)
from wagtail.contrib.modeladmin.views import CreateView, EditView
from .models import Location
... | [
"django.utils.translation.ugettext_lazy",
"django.conf.urls.url",
"wagtail.wagtailcore.hooks.register"
] | [((392, 429), 'wagtail.wagtailcore.hooks.register', 'hooks.register', (['"""register_admin_urls"""'], {}), "('register_admin_urls')\n", (406, 429), False, 'from wagtail.wagtailcore import hooks\n'), ((1016, 1030), 'django.utils.translation.ugettext_lazy', '_', (['"""Locations"""'], {}), "('Locations')\n", (1017, 1030),... |
import click
from docker import APIClient, errors
from rich import print
@click.command("clean")
@click.option('--force', '-f', is_flag=True, help="Force remove freshenv flavours and environments.")
def clean(force: bool) -> None:
"""Remove all freshenv flavours and environments."""
try:
client = AP... | [
"rich.print",
"click.option",
"docker.APIClient",
"click.command"
] | [((78, 100), 'click.command', 'click.command', (['"""clean"""'], {}), "('clean')\n", (91, 100), False, 'import click\n'), ((102, 207), 'click.option', 'click.option', (['"""--force"""', '"""-f"""'], {'is_flag': '(True)', 'help': '"""Force remove freshenv flavours and environments."""'}), "('--force', '-f', is_flag=True... |
'''
Recurrent Neural network model object for the NER task
'''
import sys
import logging
import tensorflow as tf
from tensorflow.contrib import rnn
MODEL_NAMES = ["BIRNN", "BILSTM", "BILSTMP", "BIGRU", "BIUGRNN"]
class ModelHypPrms(object):
'''Class for storing model hyperparameters'''
def __init__(self, mode... | [
"tensorflow.contrib.rnn.GRUCell",
"tensorflow.contrib.rnn.BasicRNNCell",
"tensorflow.contrib.rnn.LayerNormBasicLSTMCell",
"tensorflow.reshape",
"tensorflow.matmul",
"tensorflow.nn.bidirectional_dynamic_rnn",
"tensorflow.truncated_normal",
"logging.error",
"tensorflow.nn.softmax_cross_entropy_with_lo... | [((926, 986), 'logging.info', 'logging.info', (['"""Creating model with hyperparameters: %s"""', 'hps'], {}), "('Creating model with hyperparameters: %s', hps)\n", (938, 986), False, 'import logging\n'), ((1040, 1103), 'tensorflow.placeholder', 'tf.placeholder', (['tf.float32', '[None, hps.max_len, hps.input_size]'], {... |
import pygame
class Terminal:
COLORS = [(0,0,0), (255,0,0), (0,255,0), (255,255,0), (0,0,255), (255,0,255), (0, 255, 255), (255, 255, 255)]
def __init__(self, args):
self.width = args.width
self.height = args.height
self.keys = []
pygame.font.init()
self.font =... | [
"pygame.font.match_font",
"pygame.Surface",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.Color",
"pygame.display.flip",
"pygame.font.init",
"pygame.font.get_default_font",
"pygame.font.Font"
] | [((282, 300), 'pygame.font.init', 'pygame.font.init', ([], {}), '()\n', (298, 300), False, 'import pygame\n'), ((321, 371), 'pygame.font.match_font', 'pygame.font.match_font', (['"""Monospace,dejavusansmono"""'], {}), "('Monospace,dejavusansmono')\n", (343, 371), False, 'import pygame\n'), ((475, 506), 'pygame.font.Fon... |
#!/usr/bin/python
#-----------------------------------------------------
# Apply a drop() to a DataFrame:
# drops an existing column from source DataFrame
# and returns a new DataFrame
#
# Input: NONE
#------------------------------------------------------
# Input Parameters:
# NONE
#--------------------------------... | [
"pyspark.sql.SparkSession.builder.appName"
] | [((941, 987), 'pyspark.sql.SparkSession.builder.appName', 'SparkSession.builder.appName', (['"""dataframe_drop"""'], {}), "('dataframe_drop')\n", (969, 987), False, 'from pyspark.sql import SparkSession\n')] |
from application import celery
from application.utils.factory import create_app
from waitress import serve
import logging
import subprocess
# Set the logging to info to log into log file
logging.basicConfig(format='%(asctime)s - %(message)s', level=logging.INFO)
start_worker_cmd = 'celery -A application.celery worker... | [
"application.utils.factory.create_app",
"waitress.serve",
"logging.basicConfig"
] | [((188, 263), 'logging.basicConfig', 'logging.basicConfig', ([], {'format': '"""%(asctime)s - %(message)s"""', 'level': 'logging.INFO'}), "(format='%(asctime)s - %(message)s', level=logging.INFO)\n", (207, 263), False, 'import logging\n'), ((553, 578), 'application.utils.factory.create_app', 'create_app', ([], {'celery... |
import cv2
import numpy as np
from .augmentor import DataAugment
class Rotate(DataAugment):
"""
Continuous rotatation.
The sample size for x- and y-axes should be at least sqrt(2) times larger
than the input size to make sure there is no non-valid region after center-crop.
Args:
p (fl... | [
"cv2.warpAffine",
"numpy.copy"
] | [((841, 854), 'numpy.copy', 'np.copy', (['imgs'], {}), '(imgs)\n', (848, 854), True, 'import numpy as np\n'), ((967, 1065), 'cv2.warpAffine', 'cv2.warpAffine', (['img', 'M', '(height, width)', '(1.0)'], {'flags': 'interpolation', 'borderMode': 'self.border_mode'}), '(img, M, (height, width), 1.0, flags=interpolation,\n... |
#!/usr/bin/env python
# coding: utf-8
from collections import OrderedDict
import os
import sys
import math
import functools
import cv2
import nltk
import pandas
import numpy as np
from PIL import Image, ImageEnhance
import torch
import matplotlib
import seaborn as sns
import matplotlib.pyplot as plt
import matplot... | [
"PIL.ImageEnhance.Brightness",
"seaborn.heatmap",
"torch.cat",
"matplotlib.pyplot.figure",
"numpy.arange",
"numpy.exp",
"matplotlib.pyplot.tight_layout",
"os.path.join",
"pandas.DataFrame",
"matplotlib.pyplot.register_cmap",
"numpy.meshgrid",
"matplotlib.pyplot.yticks",
"numpy.transpose",
... | [((858, 902), 'matplotlib.pyplot.register_cmap', 'plt.register_cmap', ([], {'name': '"""custom"""', 'data': 'cdict'}), "(name='custom', data=cdict)\n", (875, 902), True, 'import matplotlib.pyplot as plt\n'), ((1933, 1957), 'numpy.arange', 'np.arange', (['(-1.5)', '(1.5)', 'dx'], {}), '(-1.5, 1.5, dx)\n', (1942, 1957), ... |
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
def tf_check_type(t, y0): # Ensure Input is Correct
if not (y0.dtype.is_floating and t.dtype.is_floating):
raise TypeError('Error in Datatype')
class _Tf_Integrator():
def __init__(self,n_,F_b):
# class constructor to... | [
"tensorflow.add_n",
"tensorflow.logical_and",
"tensorflow.convert_to_tensor",
"tensorflow.less",
"tensorflow.concat",
"tensorflow.cast",
"tensorflow.shape",
"tensorflow.greater_equal",
"tensorflow.scan"
] | [((2419, 2452), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['t'], {'name': '"""t"""'}), "(t, name='t')\n", (2439, 2452), True, 'import tensorflow as tf\n'), ((2462, 2497), 'tensorflow.convert_to_tensor', 'tf.convert_to_tensor', (['y0'], {'name': '"""y0"""'}), "(y0, name='y0')\n", (2482, 2497), True, 'impo... |
"""Config flow for the Vallox integration."""
from __future__ import annotations
import logging
from typing import Any
from vallox_websocket_api import Vallox
from vallox_websocket_api.exceptions import ValloxApiException
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const impo... | [
"homeassistant.loader.async_get_integration",
"vallox_websocket_api.Vallox",
"voluptuous.Required",
"logging.getLogger",
"homeassistant.util.network.is_ip_address"
] | [((658, 685), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (675, 685), False, 'import logging\n'), ((1080, 1092), 'vallox_websocket_api.Vallox', 'Vallox', (['host'], {}), '(host)\n', (1086, 1092), False, 'from vallox_websocket_api import Vallox\n'), ((737, 760), 'voluptuous.Required', '... |
#!/usr/bin/env python3
from distutils.core import setup
setup(
name="zynqmp-pl-ps",
version="0.1",
description="Modules to interface with the AXI modules",
author="<NAME>",
author_email="<EMAIL>",
packages=["zynqmp_pl_ps"],
)
| [
"distutils.core.setup"
] | [((58, 233), 'distutils.core.setup', 'setup', ([], {'name': '"""zynqmp-pl-ps"""', 'version': '"""0.1"""', 'description': '"""Modules to interface with the AXI modules"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'packages': "['zynqmp_pl_ps']"}), "(name='zynqmp-pl-ps', version='0.1', description=\n ... |
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
from typin... | [
"typing.cast",
"azure.core.exceptions.HttpResponseError"
] | [((10675, 10725), 'typing.cast', 'cast', (['List[IndexingResult]', 'batch_response.results'], {}), '(List[IndexingResult], batch_response.results)\n', (10679, 10725), False, 'from typing import cast, List, TYPE_CHECKING\n'), ((7208, 7287), 'azure.core.exceptions.HttpResponseError', 'HttpResponseError', ([], {'message':... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Flambé documentation build configuration file, created by
# sphinx-quickstart on Fri Oct 12 02:40:58 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# aut... | [
"os.path.abspath"
] | [((726, 748), 'os.path.abspath', 'os.path.abspath', (['"""../"""'], {}), "('../')\n", (741, 748), False, 'import os\n')] |
# Better solution
# heapify the incoming list, then pop the smallest values to make it size k
# this guarantees that the 0th item will be the smallest in the
# maxheap limited by k and therefore the kth largest
# when adding, if the heap is not full, just add the new val
# else, if the val is smaller than the smallest,... | [
"heapq.heappush",
"heapq.heapify",
"heapq.heappop"
] | [((626, 654), 'heapq.heapify', 'heapq.heapify', (['self.max_heap'], {}), '(self.max_heap)\n', (639, 654), False, 'import heapq\n'), ((706, 734), 'heapq.heappop', 'heapq.heappop', (['self.max_heap'], {}), '(self.max_heap)\n', (719, 734), False, 'import heapq\n'), ((1143, 1177), 'heapq.heappush', 'heapq.heappush', (['sel... |
# Installation script for Synapse Client for Python
############################################################
import sys
import os
import setuptools
import json
# check Python version, before we do anything
if sys.version_info.major < 3 and sys.version_info.minor < 6:
sys.stderr.write("The Synapse Client for Py... | [
"os.path.expanduser",
"sys.stderr.write",
"setuptools.find_packages",
"sys.exit"
] | [((277, 349), 'sys.stderr.write', 'sys.stderr.write', (['"""The Synapse Client for Python requires Python 3.6+\n"""'], {}), "('The Synapse Client for Python requires Python 3.6+\\n')\n", (293, 349), False, 'import sys\n'), ((354, 446), 'sys.stderr.write', 'sys.stderr.write', (["('Your Python appears to be version %d.%d... |
from urllib import urlopen
from bs4 import BeautifulSoup
import datetime
import random
import re
random.seed(datetime.datetime.now())
def getLinks(articleUrl):
html = urlopen("http://en.wikipedia.org"+articleUrl)
bsObj = BeautifulSoup(html)
return bsObj.find("div",{"id":"bodyContent"}).findAll("a",href=re... | [
"bs4.BeautifulSoup",
"datetime.datetime.now",
"urllib.urlopen",
"re.compile"
] | [((110, 133), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (131, 133), False, 'import datetime\n'), ((173, 220), 'urllib.urlopen', 'urlopen', (["('http://en.wikipedia.org' + articleUrl)"], {}), "('http://en.wikipedia.org' + articleUrl)\n", (180, 220), False, 'from urllib import urlopen\n'), ((231... |
import os
import pickle
from PIL import Image
import h5py
import json
from torchmeta.utils.data import Dataset, ClassDataset, CombinationMetaDataset
from torchvision.datasets.utils import download_file_from_google_drive
class MiniImagenet(CombinationMetaDataset):
"""
The Mini-Imagenet dataset, introduced in ... | [
"os.path.expanduser",
"json.dump",
"h5py.File",
"torchvision.datasets.utils.download_file_from_google_drive",
"json.load",
"os.remove",
"tarfile.open",
"os.path.isfile",
"pickle.load",
"PIL.Image.fromarray",
"os.path.join"
] | [((6815, 6912), 'torchvision.datasets.utils.download_file_from_google_drive', 'download_file_from_google_drive', (['self.gdrive_id', 'self.root', 'self.gz_filename'], {'md5': 'self.gz_md5'}), '(self.gdrive_id, self.root, self.gz_filename,\n md5=self.gz_md5)\n', (6846, 6912), False, 'from torchvision.datasets.utils i... |
import os
import unittest
def require_hf_token(test_case):
"""
Decorator marking a test that requires huggingface hub token.
"""
use_auth_token = os.environ.get("HF_AUTH_TOKEN", None)
if use_auth_token is None:
return unittest.skip("test requires hf token as `HF_AUTH_TOKEN` environment var... | [
"os.environ.get",
"unittest.skip"
] | [((164, 201), 'os.environ.get', 'os.environ.get', (['"""HF_AUTH_TOKEN"""', 'None'], {}), "('HF_AUTH_TOKEN', None)\n", (178, 201), False, 'import os\n'), ((248, 327), 'unittest.skip', 'unittest.skip', (['"""test requires hf token as `HF_AUTH_TOKEN` environment variable"""'], {}), "('test requires hf token as `HF_AUTH_TO... |
"""
Django settings for backstage project.
Generated by 'django-admin startproject' using Django 1.9.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import os
... | [
"unipath.Path"
] | [((503, 517), 'unipath.Path', 'Path', (['__file__'], {}), '(__file__)\n', (507, 517), False, 'from unipath import Path\n')] |
# -*- coding: utf-8 -*-
'''
salt.utils.aggregation
~~~~~~~~~~~~~~~~~~~~~~
This library makes it possible to introspect dataset and aggregate nodes
when it is instructed.
.. note::
The following examples with be expressed in YAML for convenience's sake:
- !aggr-scalar will refer t... | [
"copy.copy",
"logging.getLogger"
] | [((2319, 2346), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (2336, 2346), False, 'import logging\n'), ((5123, 5134), 'copy.copy', 'copy', (['obj_b'], {}), '(obj_b)\n', (5127, 5134), False, 'from copy import copy\n'), ((4507, 4518), 'copy.copy', 'copy', (['obj_a'], {}), '(obj_a)\n', (45... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.log.warn",
"pulumi.set"
] | [((3274, 3312), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""allowCredentials"""'}), "(name='allowCredentials')\n", (3287, 3312), False, 'import pulumi\n'), ((3523, 3557), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""allowHeaders"""'}), "(name='allowHeaders')\n", (3536, 3557), False, 'import pulumi\n'), (... |
import os
import numpy as np
import random
import pickle as pkl
def bits_to_vector(bits):
"""
Given bit input (string), convert to 8x1 vector
of floats
"""
vec = np.zeros((len(bits),1))
for bit_index, bit in enumerate(bits):
vec[bit_index] = bit
return vec
def read_test_data():
... | [
"os.getcwd",
"random.shuffle",
"numpy.array"
] | [((458, 469), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (467, 469), False, 'import os\n'), ((1292, 1303), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1301, 1303), False, 'import os\n'), ((2283, 2296), 'numpy.array', 'np.array', (['vec'], {}), '(vec)\n', (2291, 2296), True, 'import numpy as np\n'), ((2801, 2812), 'os... |
import unittest
import algorithms.permutations as permutations
class GeneratorsTest(unittest.TestCase):
def setUp(self):
pass
def test_permutations(self):
p = [e for e in permutations.permutations([1, 2, 3])]
self.assertEqual(p, [[1, 2, 3], [2, 1, 3], [2, 3, 1], [1, 3, 2],
... | [
"unittest.main",
"algorithms.permutations.permutations"
] | [((528, 543), 'unittest.main', 'unittest.main', ([], {}), '()\n', (541, 543), False, 'import unittest\n'), ((200, 236), 'algorithms.permutations.permutations', 'permutations.permutations', (['[1, 2, 3]'], {}), '([1, 2, 3])\n', (225, 236), True, 'import algorithms.permutations as permutations\n'), ((428, 458), 'algorith... |
import os
import boto3
import requests
from requests_aws4auth import AWS4Auth
host = os.environ['OPENSEARCH_HOST']
region = os.environ['REGION']
role_arn = os.environ['SNAPSHOT_ROLE']
bucket = os.environ['BUCKET_NAME']
service = 'es'
credentials = boto3.Session().get_credentials()
awsauth = AWS4Auth(credentials.access... | [
"requests.put",
"requests_aws4auth.AWS4Auth",
"boto3.Session"
] | [((293, 403), 'requests_aws4auth.AWS4Auth', 'AWS4Auth', (['credentials.access_key', 'credentials.secret_key', 'region', 'service'], {'session_token': 'credentials.token'}), '(credentials.access_key, credentials.secret_key, region, service,\n session_token=credentials.token)\n', (301, 403), False, 'from requests_aws4... |
import os
import requests
import shutil
import h5py
import scipy.sparse
from .progress_bar import ProgressBar
URL_CRCNS = 'https://portal.nersc.gov/project/crcns/download/index.php'
def download_crcns(datafile, username, password, destination,
chunk_size=2 ** 20, unpack=True):
"""Download a ... | [
"shutil.unpack_archive",
"h5py.File",
"os.path.join",
"os.makedirs",
"os.path.isdir",
"requests.Session",
"os.path.dirname",
"os.path.exists",
"os.path.splitext",
"shutil.rmtree",
"os.path.expanduser"
] | [((2758, 2787), 'os.path.dirname', 'os.path.dirname', (['archive_name'], {}), '(archive_name)\n', (2773, 2787), False, 'import os\n'), ((2792, 2852), 'shutil.unpack_archive', 'shutil.unpack_archive', (['archive_name'], {'extract_dir': 'extract_dir'}), '(archive_name, extract_dir=extract_dir)\n', (2813, 2852), False, 'i... |
#!/usr/bin/env python3
# Copyright 2020 Red Hat
#
# 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 ... | [
"ansible.module_utils.gearlib.connect",
"ansible.module_utils.gearlib.run"
] | [((720, 748), 'ansible.module_utils.gearlib.connect', 'gearlib.connect', (['"""scheduler"""'], {}), "('scheduler')\n", (735, 748), False, 'from ansible.module_utils import gearlib\n'), ((787, 826), 'ansible.module_utils.gearlib.run', 'gearlib.run', (['client', '"""zuul:tenant_list"""'], {}), "(client, 'zuul:tenant_list... |
from video_to_images_converter import VideoToImagesConverter
def main():
source_folder = 'SOURCE_PATH/'
destination_folder = 'DESTINATION_PATH/'
converter = VideoToImagesConverter()
#converter.convert_single_camera(source_folder, destination_folder)
converter.convert_recording(source_folder, dest... | [
"video_to_images_converter.VideoToImagesConverter"
] | [((172, 196), 'video_to_images_converter.VideoToImagesConverter', 'VideoToImagesConverter', ([], {}), '()\n', (194, 196), False, 'from video_to_images_converter import VideoToImagesConverter\n')] |
from django import forms
from .models import NativePost
MONTHS = {
1: ("styczeń"),
2: ("luty"),
3: ("marzec"),
4: ("kwiecień"),
5: ("maj"),
6: ("czerwiec"),
7: ("lipiec"),
8: ("sierpień"),
9: ("wrzesień"),
10: ("październik"),
11: ("listopad"),
12: ("grudzień"),
}
cla... | [
"django.forms.EmailInput",
"django.forms.ClearableFileInput",
"django.forms.HiddenInput",
"django.forms.CharField",
"django.forms.SelectDateWidget"
] | [((368, 412), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Imię"""', 'max_length': '(20)'}), "(label='Imię', max_length=20)\n", (383, 412), False, 'from django import forms\n'), ((429, 477), 'django.forms.CharField', 'forms.CharField', ([], {'label': '"""Nazwisko"""', 'max_length': '(40)'}), "(label=... |
#!/usr/bin/env python
from unittest import TestCase
from hrbson import dumps, loads
class TestNonUtf8Binary(TestCase):
def setUp(self):
self.doc = {b'\x88': None}
def test_non_utf8_binary(self):
dump = dumps(self.doc)
decoded = loads(dump)
self.assertEqual(decoded, self.doc)
| [
"hrbson.loads",
"hrbson.dumps"
] | [((230, 245), 'hrbson.dumps', 'dumps', (['self.doc'], {}), '(self.doc)\n', (235, 245), False, 'from hrbson import dumps, loads\n'), ((264, 275), 'hrbson.loads', 'loads', (['dump'], {}), '(dump)\n', (269, 275), False, 'from hrbson import dumps, loads\n')] |
# Copyright (c): <NAME> 2017-2019.
# Author: <NAME>
# Email: <EMAIL>
# Update Date: 2019/4/27 下午11:06
import torch
import torch.nn as nn
from ..Arch import RB, Upsample
class Generator(nn.Module):
"""Generator for SRFeat: Single Image Super-Resolution with Feature Discrimination (ECCV 2018)
"""
def __in... | [
"torch.nn.Conv2d",
"torch.stack"
] | [((419, 455), 'torch.nn.Conv2d', 'nn.Conv2d', (['channel', 'filters', '(9)', '(1)', '(4)'], {}), '(channel, filters, 9, 1, 4)\n', (428, 455), True, 'import torch.nn as nn\n'), ((696, 732), 'torch.nn.Conv2d', 'nn.Conv2d', (['filters', 'channel', '(3)', '(1)', '(1)'], {}), '(filters, channel, 3, 1, 1)\n', (705, 732), Tru... |
#!/usr/bin/python
from websocket import create_connection
#host = "echo.websocket.org"
proto = "wss"
#host = "jitsid.otcdemo.gardener.t-systems.net"
host = "www.jitsi.otcdemo.gardener.t-systems.net"
url = "/xmpp-websocket"
ws = create_connection("%s://%s%s" % (proto, host, url))
print("Sending 'Hello, World'...")
... | [
"websocket.create_connection"
] | [((232, 283), 'websocket.create_connection', 'create_connection', (["('%s://%s%s' % (proto, host, url))"], {}), "('%s://%s%s' % (proto, host, url))\n", (249, 283), False, 'from websocket import create_connection\n')] |
# Copyright 2018 Orange
#
# 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 t... | [
"octant.common.base.Z3NotWellFormed",
"copy.deepcopy",
"octant.common.ast.Variable",
"octant.datalog.projection.Projection",
"octant.datalog.typechecker.type_theory",
"octant.common.ast.Rule",
"octant.datalog.unfolding.Unfolding",
"octant.common.ast.Atom"
] | [((1698, 1774), 'octant.datalog.typechecker.type_theory', 'typechecker.type_theory', (['self.rules', 'self.extensible_tables', 'self.datasource'], {}), '(self.rules, self.extensible_tables, self.datasource)\n', (1721, 1774), False, 'from octant.datalog import typechecker\n'), ((1872, 1939), 'octant.datalog.unfolding.Un... |
import re
import json
import time
from colors import red,green,purple,end
from auxiliary import chambering
from requester import requester
from payloads import waf_checker
def check_waf(target,proxy = None):
original_target = target
if "=" not in original_target:
print(f"{red}[!][{time}] Please pr... | [
"auxiliary.chambering",
"json.load",
"requester.requester",
"re.search"
] | [((562, 579), 'json.load', 'json.load', (['loader'], {}), '(loader)\n', (571, 579), False, 'import json\n'), ((896, 974), 'auxiliary.chambering', 'chambering', (['original_target'], {'strike': '(True)', 'payload': 'intruder', 'type': 'intruder_type'}), '(original_target, strike=True, payload=intruder, type=intruder_typ... |
# Generated by Django 2.1 on 2018-08-16 23:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('mainapp', '0031_auto_20180817_0434'),
]
operations = [
migrations.AlterField(
model_name='rescuecamp',
name='contacts'... | [
"django.db.models.TextField"
] | [((340, 409), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)', 'verbose_name': '"""Phone Numbers"""'}), "(blank=True, null=True, verbose_name='Phone Numbers')\n", (356, 409), False, 'from django.db import migrations, models\n'), ((537, 600), 'django.db.models.TextField', 'mod... |
# -*- coding: utf-8 -*-
from __future__ import print_function
import filecmp
import os
import unittest
from shutil import rmtree
from tempfile import mkdtemp
import pytest
from pelican import Pelican
from pelican.settings import read_settings
from .notebook import IPYTHON_VERSION
PLUGIN_DIR = os.path.dirname(__file... | [
"unittest.skipIf",
"os.path.abspath",
"pelican.settings.read_settings",
"os.path.dirname",
"tempfile.mkdtemp",
"pelican.Pelican",
"shutil.rmtree",
"os.path.join",
"os.chdir"
] | [((298, 323), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (313, 323), False, 'import os\n'), ((340, 377), 'os.path.join', 'os.path.join', (['PLUGIN_DIR', '"""test_data"""'], {}), "(PLUGIN_DIR, 'test_data')\n", (352, 377), False, 'import os\n'), ((860, 958), 'unittest.skipIf', 'unittest.ski... |
import pytest, os, uuid
from tenable.cs import ContainerSecurity
from tenable.errors import *
from tests.checker import check
@pytest.fixture(autouse=True)
def api():
return ContainerSecurity(
os.environ['TIO_TEST_ADMIN_ACCESS'], os.environ['TIO_TEST_ADMIN_SECRET'])
@pytest.fixture(autouse=True)
def stdap... | [
"docker.from_env",
"tenable.cs.ContainerSecurity",
"pytest.fixture"
] | [((128, 156), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (142, 156), False, 'import pytest, os, uuid\n'), ((282, 310), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (296, 310), False, 'import pytest, os, uuid\n'), ((179, 275), 'tenable.cs.... |
import re
import matplotlib.pyplot as plt
import numpy as np
from pyquaternion import *
from math import *
import os
import subprocess
def ToEulerAngles( q ):
roll = 0
pitch = 0
yaw = 0
# roll (x-axis rotation)
sinr_cosp = 2 * (q.w * q.x + q.y * q.z)
cosr_cosp = 1 - 2 * (q.x * q.x + q.y * q.y)... | [
"os.system",
"os.chdir"
] | [((1690, 1793), 'os.chdir', 'os.chdir', (['"""C:\\\\Users\\\\<NAME>\\\\Documents\\\\School\\\\5608\\\\HW2\\\\PBRT-Split-Clipping\\\\test_scenes"""'], {}), "(\n 'C:\\\\Users\\\\<NAME>\\\\Documents\\\\School\\\\5608\\\\HW2\\\\PBRT-Split-Clipping\\\\test_scenes'\n )\n", (1698, 1793), False, 'import os\n'), ((2534, 2... |
# -*- coding: utf-8 -*-
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file)
"""Machine type checkers for scitypes.
Exports
-------
check_is_mtype(obj, mtype: str, scitype: str)
checks whether obj is mtype for scitype
returns boolean yes/no and metadata
check_raise(obj, mtype: str, scitype:... | [
"sktime.datatypes._registry.mtype_to_scitype",
"deprecated.sphinx.deprecated"
] | [((1744, 1912), 'deprecated.sphinx.deprecated', 'deprecated', ([], {'version': '"""v0.10.0"""', 'reason': '"""check_is has been deprecated and will be removed in v0.11.0.Please use check_is_mtype instead."""', 'category': 'FutureWarning'}), "(version='v0.10.0', reason=\n 'check_is has been deprecated and will be rem... |
# Solution of;
# Project Euler Problem 187: Semiprimes
# https://projecteuler.net/problem=187
#
# A composite is a number containing at least two prime factors. For example,
# 15 = 3 × 5; 9 = 3 × 3; 12 = 2 × 2 × 3. There are ten composites below thirty
# containing precisely two, not necessarily distinct, prime fact... | [
"timed.caller"
] | [((636, 670), 'timed.caller', 'timed.caller', (['dummy', 'n', 'i', 'prob_id'], {}), '(dummy, n, i, prob_id)\n', (648, 670), False, 'import timed\n')] |
import json
import numbers
import os
import uuid
from pkg_resources import resource_string
from IPython.display import HTML, display
def get_foobar_js():
path = os.path.join('package_data', 'foobar-bundle.js')
foobar_js = resource_string('foobar', path).decode('utf-8')
return foobar_js
def init_notebo... | [
"json.dumps",
"uuid.uuid1",
"pkg_resources.resource_string",
"os.path.join",
"IPython.display.HTML"
] | [((169, 217), 'os.path.join', 'os.path.join', (['"""package_data"""', '"""foobar-bundle.js"""'], {}), "('package_data', 'foobar-bundle.js')\n", (181, 217), False, 'import os\n'), ((1054, 1077), 'json.dumps', 'json.dumps', (['number_list'], {}), '(number_list)\n', (1064, 1077), False, 'import json\n'), ((951, 985), 'IPy... |
import random
import json
import pyperclip # pip install pyperclip
def main(sample_space = [1,2,3,4,5,6]):
def rand_digit(List=sample_space):
"""funtion for geting sudo random numbers"""
# there are 2 method of doing this
# 1.
# random.randint(1,6)
# 2.
return random.choice(List)
def ... | [
"json.load",
"random.choice"
] | [((292, 311), 'random.choice', 'random.choice', (['List'], {}), '(List)\n', (305, 311), False, 'import random\n'), ((796, 811), 'json.load', 'json.load', (['file'], {}), '(file)\n', (805, 811), False, 'import json\n')] |
from src.list_based_collection.linked_list import Element
import pytest
from src.list_based_collection.stack import Stack
@pytest.fixture
def stack():
e1 = Element(1)
stack = Stack(e1)
return stack
def test_stack_op(stack):
e2 = Element(2)
e3 = Element(3)
e4 = Element(4)
stack.push(e2... | [
"src.list_based_collection.stack.Stack",
"src.list_based_collection.linked_list.Element"
] | [((163, 173), 'src.list_based_collection.linked_list.Element', 'Element', (['(1)'], {}), '(1)\n', (170, 173), False, 'from src.list_based_collection.linked_list import Element\n'), ((187, 196), 'src.list_based_collection.stack.Stack', 'Stack', (['e1'], {}), '(e1)\n', (192, 196), False, 'from src.list_based_collection.s... |
from __future__ import absolute_import
from __future__ import print_function
import os
import sys
templates_dir = os.path.join(os.path.dirname(__file__), "..", "shared", "templates")
sys.path.append(templates_dir)
from template_common import ActionType, TEMPLATED_LANGUAGES
from create_accounts_password import Accoun... | [
"create_grub2_bootloader_argument.GRUB2BootloaderArgumentGenerator",
"create_audit_rules_usergroup_modification.AuditRulesUserGroupModificationGenerator",
"create_audit_rules_path_syscall.AuditRulesPathSyscallGenerator",
"create_selinux_booleans.SEBoolGenerator",
"create_permissions.PermissionGenerator",
... | [((185, 215), 'sys.path.append', 'sys.path.append', (['templates_dir'], {}), '(templates_dir)\n', (200, 215), False, 'import sys\n'), ((129, 154), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (144, 154), False, 'import os\n'), ((4681, 4716), 'os.path.join', 'os.path.join', (['utils_dir', '"... |
# Copyright (c) 2017-2020 <NAME>.
# Author: <NAME>
# Email: <EMAIL>
# Update: 2020 - 6 - 15
import numpy as np
# Pre-calculated PCA array
_PCA = np.array(
[[-0.0020399868953973055,
-0.0029279158916324377,
-0.0017012208700180054,
0.0030665011145174503,
0.013115793466567993,
0.011... | [
"numpy.array"
] | [((152, 80757), 'numpy.array', 'np.array', (['[[-0.0020399868953973055, -0.0029279158916324377, -0.0017012208700180054, \n 0.0030665011145174503, 0.013115793466567993, 0.011058831587433815, \n 0.003089039819315076, 5.052147145079289e-08, -0.0030889532063156366, -\n 0.011058780364692211, -0.013115735724568367, ... |
#!/usr/bin/env python
# Copyright (c) 2018, 2019, Oracle and/or its affiliates.
# This software is made available to you under the terms of the GPL 3.0 license or the Apache 2.0 license.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Apache License v2.0
# See LICENSE.TXT ... | [
"argparse.ArgumentParser",
"json.dumps",
"collections.defaultdict",
"ansible.module_utils.six.moves.configparser.ConfigParser",
"collections.deque",
"ansible.module_utils.six.iteritems",
"traceback.format_exc",
"re.sub",
"oci.auth.signers.InstancePrincipalsSecurityTokenSigner",
"oci.config.from_fi... | [((10666, 10879), 'oci.retry.RetryStrategyBuilder', 'RetryStrategyBuilder', ([], {'max_attempts_check': '(True)', 'max_attempts': '(10)', 'retry_max_wait_between_calls_seconds': '(30)', 'retry_base_sleep_time_seconds': '(3)', 'backoff_type': 'oci.retry.BACKOFF_FULL_JITTER_EQUAL_ON_THROTTLE_VALUE'}), '(max_attempts_chec... |
from gensim.models import word2vec
model = word2vec.Word2Vec.load('text/夏目漱石.model')
| [
"gensim.models.word2vec.Word2Vec.load"
] | [((43, 84), 'gensim.models.word2vec.Word2Vec.load', 'word2vec.Word2Vec.load', (['"""text/夏目漱石.model"""'], {}), "('text/夏目漱石.model')\n", (65, 84), False, 'from gensim.models import word2vec\n')] |
import argparse
import cv2,os
import numpy as np
import torch,random
import SimpleITK as sitk
from torch.autograd import Function
from torchvision import models
from models.net2d import vgg19_bn,densenet161,vgg16,vgg19,resnet152,resnet152_plus
os.environ['CUDA_VISIBLE_DEVICES']='3'
class FeatureExtractor():
""" Cl... | [
"numpy.maximum",
"argparse.ArgumentParser",
"numpy.sum",
"numpy.abs",
"random.shuffle",
"numpy.ones",
"numpy.clip",
"numpy.mean",
"models.net2d.resnet152_plus",
"os.path.join",
"cv2.dilate",
"numpy.std",
"cv2.imwrite",
"torch.load",
"numpy.transpose",
"numpy.max",
"cv2.resize",
"nu... | [((2396, 2430), 'torch.from_numpy', 'torch.from_numpy', (['preprocessed_img'], {}), '(preprocessed_img)\n', (2412, 2430), False, 'import torch, random\n'), ((6598, 6623), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (6621, 6623), False, 'import argparse\n'), ((7848, 7866), 'numpy.clip', 'np.c... |
import numpy as np
import scipy.sparse as sp
from scipy.constants import mu_0
from SimPEG import Utils, Solver
def simulateMT(mesh, sigma, frequency, rtype="app_res"):
"""
Compute apparent resistivity and phase at each frequency.
Return apparent resistivity and phase for rtype="app_res",
or i... | [
"SimPEG.Utils.sdiag",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"numpy.arctan",
"scipy.sparse.hstack",
"SimPEG.Solver"
] | [((929, 959), 'SimPEG.Utils.sdiag', 'Utils.sdiag', (['(mesh.aveCC2F * mu)'], {}), '(mesh.aveCC2F * mu)\n', (940, 959), False, 'from SimPEG import Utils, Solver\n'), ((1038, 1059), 'SimPEG.Utils.sdiag', 'Utils.sdiag', (['sigmahat'], {}), '(sigmahat)\n', (1049, 1059), False, 'from SimPEG import Utils, Solver\n'), ((1931,... |
from typing import List, Tuple
from src.netcompany_toolkit.connector.SQLite import SQLite
def persist_entity(query: str, params: Tuple):
with SQLite(query_type='INSERT') as cur:
cur.execute(query, params)
def fetch_unique_entity(query: str, params: Tuple) -> List:
fetched_data = fetch_entities(quer... | [
"src.netcompany_toolkit.connector.SQLite.SQLite"
] | [((149, 176), 'src.netcompany_toolkit.connector.SQLite.SQLite', 'SQLite', ([], {'query_type': '"""INSERT"""'}), "(query_type='INSERT')\n", (155, 176), False, 'from src.netcompany_toolkit.connector.SQLite import SQLite\n'), ((548, 575), 'src.netcompany_toolkit.connector.SQLite.SQLite', 'SQLite', ([], {'query_type': '"""... |
# -*- coding:utf-8 -*-
# Author: hankcs
# Date: 2020-03-07 23:48
from edparser.components.parsers.biaffine_parser import BiaffineTransformerDependencyParser
from iwpt2020 import cdroot
cdroot()
save_dir = 'data/model/dep/kr_old_bert3'
parser = BiaffineTransformerDependencyParser()
parser.fit('data/parsing/ud_ko_old/k... | [
"edparser.components.parsers.biaffine_parser.BiaffineTransformerDependencyParser",
"iwpt2020.cdroot"
] | [((187, 195), 'iwpt2020.cdroot', 'cdroot', ([], {}), '()\n', (193, 195), False, 'from iwpt2020 import cdroot\n'), ((246, 283), 'edparser.components.parsers.biaffine_parser.BiaffineTransformerDependencyParser', 'BiaffineTransformerDependencyParser', ([], {}), '()\n', (281, 283), False, 'from edparser.components.parsers.... |
# encoding: utf-8
import numpy as np
import copy
from operator import itemgetter
import datetime
def rollout_policy_fn(board):
action_probs = np.random.rand(len(board.available))
return zip(board.available, action_probs)
def policy_value_fn(board):
"""a function that takes in a board and outputs a list of... | [
"copy.deepcopy",
"numpy.log",
"datetime.datetime.utcnow",
"datetime.timedelta",
"operator.itemgetter"
] | [((2062, 2103), 'datetime.timedelta', 'datetime.timedelta', ([], {'seconds': 'simulate_time'}), '(seconds=simulate_time)\n', (2080, 2103), False, 'import datetime\n'), ((4073, 4099), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (4097, 4099), False, 'import datetime\n'), ((4196, 4216), 'copy... |
"""Testing for Gaussian process classification """
# Author: <NAME> <<EMAIL>>
# License: BSD 3 clause
import numpy as np
from scipy.optimize import approx_fprime
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import RBF, ConstantKernel as C
from sklearn.utils.t... | [
"numpy.minimum",
"numpy.random.seed",
"numpy.maximum",
"numpy.abs",
"numpy.argmax",
"numpy.empty",
"sklearn.gaussian_process.kernels.ConstantKernel",
"sklearn.gaussian_process.kernels.RBF",
"numpy.random.RandomState",
"sklearn.gaussian_process.GaussianProcessClassifier",
"numpy.finfo",
"numpy.... | [((630, 658), 'numpy.empty', 'np.empty', (['y.shape'], {'dtype': 'int'}), '(y.shape, dtype=int)\n', (638, 658), True, 'import numpy as np\n'), ((770, 820), 'sklearn.gaussian_process.kernels.RBF', 'RBF', ([], {'length_scale': '(1.0)', 'length_scale_bounds': '"""fixed"""'}), "(length_scale=1.0, length_scale_bounds='fixed... |
from fms_core.models import Process, Protocol, PropertyType
from ._generic import GenericImporter
from fms_core.template_importer.row_handlers.sample_qc import SampleQCRowHandler
from .._utils import float_to_decimal_and_none, input_to_date_and_none
# {{TEMPLATE PROPERTY NAME : DB PROPERTY NAME}
TEMPLATE_PROPERTY_MA... | [
"fms_core.models.Protocol.objects.get",
"fms_core.models.Process.objects.create",
"fms_core.models.PropertyType.objects.filter"
] | [((1350, 1401), 'fms_core.models.Protocol.objects.get', 'Protocol.objects.get', ([], {'name': '"""Sample Quality Control"""'}), "(name='Sample Quality Control')\n", (1370, 1401), False, 'from fms_core.models import Process, Protocol, PropertyType\n'), ((1541, 1646), 'fms_core.models.Process.objects.create', 'Process.ob... |
import pandas as pd
import numpy as np
from keras.layers import Convolution2D, MaxPooling2D, Flatten, Dense, Dropout,BatchNormalization
from keras.models import Sequential
from keras.utils import np_utils
import matplotlib.pyplot as plt
dt= pd.read_csv('train.csv')
dt1=pd.read_csv('test.csv')
X_prediction=dt1... | [
"pandas.DataFrame",
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.gray",
"matplotlib.pyplot.show",
"keras.layers.Convolution2D",
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.close",
"keras.layers.Dropout",
"keras.layers.Flatten",
"keras.utils.np_utils.to_ca... | [((247, 271), 'pandas.read_csv', 'pd.read_csv', (['"""train.csv"""'], {}), "('train.csv')\n", (258, 271), True, 'import pandas as pd\n'), ((277, 300), 'pandas.read_csv', 'pd.read_csv', (['"""test.csv"""'], {}), "('test.csv')\n", (288, 300), True, 'import pandas as pd\n'), ((352, 385), 'numpy.array', 'np.array', (['X_pr... |
import os
import shutil
import dlib
import cv2
import numpy as np
"""
Script to generate the dataset with the cutted coins images
"""
DATASETS_PATH = "datasets"
OUTPUT_FOLDER_PATH = DATASETS_PATH + "/generated_datasets"
def get_image_region(image, x1, y1, x2, y2):
"""
Return image subregion defined by (x1,... | [
"cv2.GaussianBlur",
"os.makedirs",
"cv2.cvtColor",
"cv2.imwrite",
"os.path.exists",
"cv2.imread",
"numpy.array",
"dlib.simple_object_detector",
"shutil.rmtree",
"os.listdir",
"cv2.resize"
] | [((857, 912), 'dlib.simple_object_detector', 'dlib.simple_object_detector', (['"""assets/coin_detector.svm"""'], {}), "('assets/coin_detector.svm')\n", (884, 912), False, 'import dlib\n'), ((1117, 1151), 'os.path.exists', 'os.path.exists', (['f"""{output_folder}"""'], {}), "(f'{output_folder}')\n", (1131, 1151), False,... |
from typing import List, Tuple
import os
import json
import gym
import numpy as np
import torch
import torch.nn.functional as F
from torch.optim import Adam
device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')
class Actor(torch.nn.Module):
def __init__(self,
input_dimension:... | [
"torch.argmax",
"torch.cuda.is_available",
"torch.nn.Linear",
"torch.zeros",
"torch.no_grad",
"os.path.join"
] | [((194, 219), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (217, 219), False, 'import torch\n'), ((574, 615), 'torch.nn.Linear', 'torch.nn.Linear', (['input_dimension', 'density'], {}), '(input_dimension, density)\n', (589, 615), False, 'import torch\n'), ((634, 667), 'torch.nn.Linear', 'torc... |
"""Tests for the whole pipeline which is in test.
Focuses on verifying if all the file are created and similar to
what is expected.
Run this from project root directory:
$ python -m pytest
"""
import pytest
import subprocess
import shutil
import os
import filecmp
import textdistance
import numpy as np
@pytest.fixtu... | [
"os.mkdir",
"subprocess.Popen",
"pytest.fixture",
"numpy.mean",
"shutil.rmtree",
"os.path.join",
"textdistance.hamming",
"numpy.nanmean"
] | [((308, 339), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""session"""'}), "(scope='session')\n", (322, 339), False, 'import pytest\n'), ((364, 421), 'shutil.rmtree', 'shutil.rmtree', (['"""tests/current_output"""'], {'ignore_errors': '(True)'}), "('tests/current_output', ignore_errors=True)\n", (377, 421), Fa... |
# coding: utf-8
"""
アルゴリズムデザインコンテストのさまざまな処理
"""
import logging
import conmgr_datastore as cds
from hashlib import sha1, sha256
import datetime
from tz import gae_datetime_JST
import adcconfig
import adcusers
_state_str = {'init': 'initial',
'im0': 'intermediate_0',
'Qup': 'Q_upload',
... | [
"conmgr_datastore.create_access_token",
"conmgr_datastore.change_password",
"conmgr_datastore.get_userinfo_list",
"conmgr_datastore.get_userinfo",
"conmgr_datastore.get_username_list"
] | [((3212, 3279), 'conmgr_datastore.change_password', 'cds.change_password', (['username', "attr['password_new']", 'adcconfig.SALT'], {}), "(username, attr['password_new'], adcconfig.SALT)\n", (3231, 3279), True, 'import conmgr_datastore as cds\n'), ((3855, 3881), 'conmgr_datastore.get_userinfo', 'cds.get_userinfo', (['u... |
import random
import unittest
from ..sorting import bubble_sort, selection_sort, insertion_sort, \
merge_sort, quick_sort, heap_sort, shell_sort, comb_sort, cocktail_sort, \
quick_sort_in_place, gnome_sort
class SortingAlgorithmTestCase(unittest.TestCase):
"""
Shared code for a sorting unit test.
... | [
"random.shuffle"
] | [((385, 411), 'random.shuffle', 'random.shuffle', (['self.input'], {}), '(self.input)\n', (399, 411), False, 'import random\n')] |
# A Python program to calculate subnet values like network address, broadcast address and valid hosts within that subnet
# Importing regular expression to verify the input
import re
# Function to validate the entered IP Address
def validate_ip(ip):
# A regular expression to match the format of an IP Address
... | [
"re.match"
] | [((323, 380), 're.match', 're.match', (['"""\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}"""', 'ip'], {}), "('\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}', ip)\n", (331, 380), False, 'import re\n'), ((896, 955), 're.match', 're.match', (['"""\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}\\\\.\\\\d{1,3}"... |
# Generated by Django 2.1 on 2018-09-14 12:25
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('lepidoptera', '0010_auto_20180907_1448'),
]
operations = [
migrations.RemoveField(
model_name='family',
name='status',
... | [
"django.db.migrations.RemoveField"
] | [((229, 287), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""family"""', 'name': '"""status"""'}), "(model_name='family', name='status')\n", (251, 287), False, 'from django.db import migrations\n'), ((332, 389), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'... |
# -*- coding: utf-8 -*-
# Copyright: <NAME> <<EMAIL>>
# License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
from anki.utils import fieldChecksum, intTime, \
joinFields, splitFields, stripHTMLMedia, timestampID, guid64
class Note(object):
def __init__(self, col, model=None, id=None):
... | [
"anki.utils.guid64",
"anki.utils.joinFields",
"anki.utils.stripHTMLMedia",
"anki.utils.splitFields",
"anki.utils.timestampID",
"anki.utils.fieldChecksum",
"anki.utils.intTime"
] | [((1160, 1184), 'anki.utils.splitFields', 'splitFields', (['self.fields'], {}), '(self.fields)\n', (1171, 1184), False, 'from anki.utils import fieldChecksum, intTime, joinFields, splitFields, stripHTMLMedia, timestampID, guid64\n'), ((1879, 1908), 'anki.utils.fieldChecksum', 'fieldChecksum', (['self.fields[0]'], {}), ... |
import pdfkit
pdfkit.from_file("pdf_target.html", "chrome.pdf")
# pdfkit.from_url("https://zhuanlan.zhihu.com/p/32825491", "chrome.pdf")
from datetime import datetime
import threading
import time
# start = time.time()
# print(start)
# time.sleep(5)
# # print(time.localtime(time.time()))
# end = time.time()
#
# inte... | [
"itertools.combinations",
"pdfkit.from_file"
] | [((16, 65), 'pdfkit.from_file', 'pdfkit.from_file', (['"""pdf_target.html"""', '"""chrome.pdf"""'], {}), "('pdf_target.html', 'chrome.pdf')\n", (32, 65), False, 'import pdfkit\n'), ((1183, 1216), 'itertools.combinations', 'itertools.combinations', (['char'], {'r': '(4)'}), '(char, r=4)\n', (1205, 1216), False, 'import ... |
import sys
import gzip
import json
import pickle
from tqdm import tqdm
def load_obj(name):
with open(name + '.pkl', 'rb') as f:
return pickle.load(f)
def dictFromFileUnicode(path):
with gzip.open(path, 'r') as f:
return json.loads(f.read())
def dictToFile(dict, path):
print("Writing to {}... | [
"tqdm.tqdm",
"pickle.load",
"gzip.open",
"json.dumps"
] | [((148, 162), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (159, 162), False, 'import pickle\n'), ((204, 224), 'gzip.open', 'gzip.open', (['path', '"""r"""'], {}), "(path, 'r')\n", (213, 224), False, 'import gzip\n'), ((345, 365), 'gzip.open', 'gzip.open', (['path', '"""w"""'], {}), "(path, 'w')\n", (354, 365), ... |
# Author: <NAME>
# Copyright <NAME> 2019 Released under the MIT license
# Created on 2018-12-19
__updated__ = "2018-12-19"
__version__ = "0.0"
import logging
import math
import time
import asyncio
from server.server_generic import getNetwork as _getNetwork
from server.apphandler.client import Client
from server.ack... | [
"asyncio.gather",
"server.apphandler.client.Client",
"time.time",
"server.server_generic.getNetwork",
"logging.getLogger"
] | [((377, 411), 'logging.getLogger', 'logging.getLogger', (['"""ClientHelpers"""'], {}), "('ClientHelpers')\n", (394, 411), False, 'import logging\n'), ((651, 685), 'server.apphandler.client.Client', 'Client', (['client_id', '*args'], {}), '(client_id, *args, **kwargs)\n', (657, 685), False, 'from server.apphandler.clien... |
import random
import dateparser
from lxml import etree
from typing import List, Optional, Tuple
from PIL import ImageDraw
from urllib.parse import unquote
from pydantic import ValidationError
from nonebot.log import logger
from nonebot.adapters.mirai2 import MessageChain, MessageSegment
from .base_handle import BaseHa... | [
"nonebot.log.logger.warning",
"nonebot.log.logger.info",
"random.choice",
"random.random",
"nonebot.adapters.mirai2.MessageChain",
"lxml.etree.HTMLParser",
"PIL.ImageDraw.Draw"
] | [((4259, 4285), 'PIL.ImageDraw.Draw', 'ImageDraw.Draw', (['bg.markImg'], {}), '(bg.markImg)\n', (4273, 4285), False, 'from PIL import ImageDraw\n'), ((7552, 7592), 'nonebot.log.logger.info', 'logger.info', (['f"""{self.game_name_cn} 更新成功"""'], {}), "(f'{self.game_name_cn} 更新成功')\n", (7563, 7592), False, 'from nonebot.l... |
import streamlit as st
import numpy as np
import pandas as pd
from PIL import Image
import cv2
import time
from datetime import datetime
import torch
import torch.nn as nn
import torchvision
import albumentations as A
from albumentations.pytorch import ToTensorV2
import pytesseract
from io import StringIO
... | [
"torch.nn.Dropout",
"streamlit.image",
"cv2.approxPolyDP",
"torch.cat",
"cv2.rectangle",
"albumentations.Normalize",
"torch.no_grad",
"streamlit.spinner",
"cv2.contourArea",
"streamlit.cache",
"torch.load",
"cv2.boundingRect",
"datetime.datetime.now",
"io.StringIO",
"streamlit.header",
... | [((6376, 6412), 'streamlit.cache', 'st.cache', ([], {'allow_output_mutation': '(True)'}), '(allow_output_mutation=True)\n', (6384, 6412), True, 'import streamlit as st\n'), ((9450, 9490), 'streamlit.header', 'st.header', (['"""Data Extraction from Tables"""'], {}), "('Data Extraction from Tables')\n", (9459, 9490), Tru... |
from django.conf import settings
from django.contrib import admin
from django.urls import path, include
from api.metadata.views import MetadataView
from api.user.views import who_am_i, UserDetail
from api.core.views import admin_override
from api.assessment.urls import urlpatterns as assessment_urls
from api.barriers.... | [
"api.metadata.views.MetadataView.as_view",
"api.user.views.UserDetail.as_view",
"django.urls.path",
"django.urls.include"
] | [((744, 797), 'django.urls.path', 'path', (['"""admin/login/"""', 'admin_override'], {'name': '"""override"""'}), "('admin/login/', admin_override, name='override')\n", (748, 797), False, 'from django.urls import path, include\n'), ((827, 858), 'django.urls.path', 'path', (['"""admin/"""', 'admin.site.urls'], {}), "('a... |
"""Adapter for RunSnakeRun to load coldshot profiles"""
import logging
import wx
from coldshot import stack, loader
from runsnakerun import squaremap
log = logging.getLogger(__name__)
class BaseColdshotAdapter(squaremap.DefaultAdapter):
"""Base class for the various adapters"""
percentageView = False
t... | [
"wx.Colour",
"logging.getLogger"
] | [((159, 186), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (176, 186), False, 'import logging\n'), ((907, 934), 'wx.Colour', 'wx.Colour', (['red', 'green', 'blue'], {}), '(red, green, blue)\n', (916, 934), False, 'import wx\n')] |
import typing as tp
import jax
import jax.numpy as jnp
import numpy as np
from absl.testing import absltest
from jax import test_util as jtu
from jax.config import config
from spax.linalg import subspace_iteration as si
from spax.linalg import test_utils, utils
config.parse_flags_with_absl()
config.update("jax_enabl... | [
"jax.config.config.update",
"jax.test_util.JaxTestLoader",
"jax.jit",
"spax.linalg.subspace_iteration.eigh",
"jax.random.normal",
"spax.linalg.test_utils.random_symmetric_mat",
"jax.tree_util.Partial",
"jax.random.PRNGKey",
"jax.numpy.linalg.norm",
"spax.linalg.subspace_iteration.default_tol",
"... | [((265, 295), 'jax.config.config.parse_flags_with_absl', 'config.parse_flags_with_absl', ([], {}), '()\n', (293, 295), False, 'from jax.config import config\n'), ((296, 333), 'jax.config.config.update', 'config.update', (['"""jax_enable_x64"""', '(True)'], {}), "('jax_enable_x64', True)\n", (309, 333), False, 'from jax... |
#!python
'''
Creates a file manifest in tab separated value format
which can be used with other dataverse_util library utilities
and functions to upload files complete with metadata.
'''
import argparse
import os
import pathlib
#pathlib new for Python 3.5
#https://docs.python.org/3/library/pathlib.html
import re
impor... | [
"os.getcwd",
"pathlib.Path",
"argparse.ArgumentParser",
"sys.exit"
] | [((444, 469), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (467, 469), False, 'import argparse\n'), ((1230, 1278), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': 'description'}), '(description=description)\n', (1253, 1278), False, 'import argparse\n'), ((4637, 4647... |
from importlib import util
import os
import subprocess
import sys
BRANCH = "development"
# get current install.py directory
rootdir = os.path.dirname(os.path.abspath(__file__))
path = os.path.join(rootdir, "InstallTools.py")
if not os.path.exists(path):
cmd = (
"cd %s;rm -f InstallTools.py;curl \
... | [
"os.path.abspath",
"os.path.exists",
"importlib.util.spec_from_file_location",
"subprocess.call",
"os.path.join",
"sys.exit"
] | [((187, 227), 'os.path.join', 'os.path.join', (['rootdir', '"""InstallTools.py"""'], {}), "(rootdir, 'InstallTools.py')\n", (199, 227), False, 'import os\n'), ((524, 564), 'importlib.util.spec_from_file_location', 'util.spec_from_file_location', (['"""IT"""', 'path'], {}), "('IT', path)\n", (552, 564), False, 'from imp... |
import numba
import numpy as np
from funcs.post_processing.images.soot_foil.spectral import image
numba.NUMBA_DISABLE_JIT = 1
def test_grayscale():
test_img = np.array([100, 150, 175, 200])
expected = np.array([0, 127.5, 191.25, 255])
test_result = image.grayscale(test_img)
assert np.allclose(test_r... | [
"funcs.post_processing.images.soot_foil.spectral.image.grayscale",
"funcs.post_processing.images.soot_foil.spectral.image.get_radial_intensity",
"numpy.allclose",
"funcs.post_processing.images.soot_foil.spectral.image.get_center",
"numpy.zeros",
"funcs.post_processing.images.soot_foil.spectral.image.fspec... | [((167, 197), 'numpy.array', 'np.array', (['[100, 150, 175, 200]'], {}), '([100, 150, 175, 200])\n', (175, 197), True, 'import numpy as np\n'), ((213, 246), 'numpy.array', 'np.array', (['[0, 127.5, 191.25, 255]'], {}), '([0, 127.5, 191.25, 255])\n', (221, 246), True, 'import numpy as np\n'), ((265, 290), 'funcs.post_pr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.