code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import os
import subprocess
def subprocess_Popen(command, **params):
"""
Utility function to work around windows behavior that open windows.
:see: call_subprocess_Popen and output_subprocess_Popen
"""
startupinfo = None
if os.name == 'nt':
startupinfo = subprocess.STARTUPINFO()
... | [
"subprocess.Popen",
"subprocess.STARTUPINFO"
] | [((289, 313), 'subprocess.STARTUPINFO', 'subprocess.STARTUPINFO', ([], {}), '()\n', (311, 313), False, 'import subprocess\n'), ((1252, 1312), 'subprocess.Popen', 'subprocess.Popen', (['command'], {'startupinfo': 'startupinfo'}), '(command, startupinfo=startupinfo, **params)\n', (1268, 1312), False, 'import subprocess\n... |
#!/usr/bin/env python3
#-*- coding: utf-8 -*-
from time import time, strftime
import requests
from lxml import html
def blueprint():
try:
start = time()
domain = ""
print('\033[94m', '---------------------------------------------', '\033[0m')
print('\033... | [
"time.strftime",
"time.time",
"lxml.html.fromstring"
] | [((169, 175), 'time.time', 'time', ([], {}), '()\n', (173, 175), False, 'from time import time, strftime\n'), ((358, 387), 'time.strftime', 'strftime', (['"""%d-%m-%Y %H:%M:%S"""'], {}), "('%d-%m-%Y %H:%M:%S')\n", (366, 387), False, 'from time import time, strftime\n'), ((677, 707), 'lxml.html.fromstring', 'html.fromst... |
"""A pytest plugin for using pyfakefs as a fixture
When pyfakefs is installed, the "fs" fixture becomes available.
:Usage:
def my_fakefs_test(fs):
fs.create_file('/var/data/xx1.txt')
assert os.path.exists('/var/data/xx1.txt')
"""
import linecache
import tokenize
import py
import pytest
from pyfakefs.fake_... | [
"pyfakefs.fake_filesystem_unittest.Patcher.SKIPMODULES.add",
"pyfakefs.fake_filesystem_unittest.Patcher"
] | [((356, 387), 'pyfakefs.fake_filesystem_unittest.Patcher.SKIPMODULES.add', 'Patcher.SKIPMODULES.add', (['pytest'], {}), '(pytest)\n', (379, 387), False, 'from pyfakefs.fake_filesystem_unittest import Patcher\n'), ((388, 415), 'pyfakefs.fake_filesystem_unittest.Patcher.SKIPMODULES.add', 'Patcher.SKIPMODULES.add', (['py'... |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
r"""
References
.. [burt2020svgp]
<NAME> and <NAME> and <NAME>,
Convergence of Sparse Variational Inference in... | [
"torch.sqrt",
"gpytorch.means.ConstantMean",
"copy.deepcopy",
"gpytorch.variational.CholeskyVariationalDistribution",
"gpytorch.variational.IndependentMultitaskVariationalStrategy",
"torch.matmul",
"botorch.models.utils.validate_input_scaling",
"torch.argmax",
"gpytorch.priors.GammaPrior",
"gpytor... | [((20830, 20927), 'torch.zeros', 'torch.zeros', (['(max_length, item_size)'], {'device': 'kernel_matrix.device', 'dtype': 'kernel_matrix.dtype'}), '((max_length, item_size), device=kernel_matrix.device, dtype=\n kernel_matrix.dtype)\n', (20841, 20927), False, 'import torch\n'), ((21013, 21031), 'torch.argmax', 'torc... |
# Copyright 2018 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 a... | [
"protorpc.messages.StringField",
"protorpc.messages.BooleanField",
"protorpc.messages.MessageField"
] | [((1245, 1268), 'protorpc.messages.StringField', 'messages.StringField', (['(1)'], {}), '(1)\n', (1265, 1268), False, 'from protorpc import messages\n'), ((1280, 1319), 'protorpc.messages.BooleanField', 'messages.BooleanField', (['(2)'], {'default': '(False)'}), '(2, default=False)\n', (1301, 1319), False, 'from protor... |
"""Visualizing L-systems using pythons turtle module.
https://en.wikipedia.org/wiki/L-system
Copyright (C) 2019 <NAME>
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 the Licens... | [
"turtle.Screen",
"turtle.Turtle"
] | [((2621, 2636), 'turtle.Screen', 'turtle.Screen', ([], {}), '()\n', (2634, 2636), False, 'import turtle\n'), ((2788, 2816), 'turtle.Turtle', 'turtle.Turtle', ([], {'visible': '(False)'}), '(visible=False)\n', (2801, 2816), False, 'import turtle\n')] |
# MIT LICENSE
#
# Copyright 1997 - 2020 by IXIA Keysight
#
# 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, ... | [
"ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.peeradvertisedfeatures_a19ddfa517ec69fdc6448dae922b1e2c.PeerAdvertisedFeatures",
"ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.state_323b40267b7188796bf681a8a171debc.State",
"ixnetwork_restpy.testplatform.sessions.ixnetwork.vp... | [((6212, 6234), 'ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.switchportqueues_85c93c375f96f8d70346886eaacbe1fa.SwitchPortQueues', 'SwitchPortQueues', (['self'], {}), '(self)\n', (6228, 6234), False, 'from ixnetwork_restpy.testplatform.sessions.ixnetwork.vport.protocols.switchportqueues_85c93c375f96... |
from confluent_kafka import Consumer, TopicPartition
import certifi
import boto3
import os
BOOTSTRAP_SERVERS = os.environ["KAFKA_BOOTSTRAP_SERVERS"]
c = Consumer({
'bootstrap.servers': BOOTSTRAP_SERVERS,
'ssl.ca.location': certifi.where(),
'security.protocol': 'ssl',
'group.id': 'kafka... | [
"certifi.where"
] | [((241, 256), 'certifi.where', 'certifi.where', ([], {}), '()\n', (254, 256), False, 'import certifi\n')] |
"""empty message
Revision ID: <KEY>
Revises: <KEY>
Create Date: 2017-06-08 23:06:16.920132
"""
# revision identifiers, used by Alembic.
revision = '<KEY>'
down_revision = '<KEY>'
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql
def upgrade():
### commands auto generated by A... | [
"sqlalchemy.ForeignKeyConstraint",
"sqlalchemy.DateTime",
"alembic.op.drop_table",
"sqlalchemy.dialects.mysql.INTEGER",
"sqlalchemy.Text",
"sqlalchemy.PrimaryKeyConstraint",
"sqlalchemy.SmallInteger",
"sqlalchemy.Integer",
"sqlalchemy.String",
"alembic.op.drop_index",
"alembic.op.create_index"
] | [((1804, 1902), 'alembic.op.create_index', 'op.create_index', (['"""ix_monitor_logs_create_time"""', '"""monitor_logs"""', "['create_time']"], {'unique': '(False)'}), "('ix_monitor_logs_create_time', 'monitor_logs', [\n 'create_time'], unique=False)\n", (1819, 1902), False, 'from alembic import op\n'), ((2018, 2078)... |
import sys
sys.path.append('../')
import web
import glob
import random
import hashlib
import logging
import db_controllers
from gothonweb import map, game_lexicon
from sanitize import sanitize
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
web.config.debug = False
# Routes definition
u... | [
"logging.basicConfig",
"logging.getLogger",
"web.session.DiskStore",
"web.session.Session",
"sanitize.sanitize",
"random.choice",
"web.seeother",
"db_controllers.create_user",
"db_controllers.user_exists",
"web.input",
"web.config.get",
"gothonweb.game_lexicon.AssertLexicon",
"web.template.r... | [((11, 33), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (26, 33), False, 'import sys\n'), ((195, 234), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO'}), '(level=logging.INFO)\n', (214, 234), False, 'import logging\n'), ((244, 271), 'logging.getLogger', 'logging.g... |
import json
__all__ = (
"QuillParseError",
"Quill",
)
class QuillParseError(Exception):
def __init__(self, value):
self.value = value
def __str__(self):
return "Failed to parse value(%s)" % self.value
class Quill:
def __init__(self, json_string):
try:
self.j... | [
"json.loads"
] | [((369, 392), 'json.loads', 'json.loads', (['json_string'], {}), '(json_string)\n', (379, 392), False, 'import json\n')] |
#
# put Qidan site's aritcle items definition
#
#
from scrapy.item import Item, Field
class Article(Item):
url = Field() # url of target site
# data fields
title = Field()
cover_url = Field({ 'file_url': { 'path': 'cover_path'}})
cover_path = Field()
author_name = Field()
author_ur... | [
"scrapy.item.Field"
] | [((124, 131), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (129, 131), False, 'from scrapy.item import Item, Field\n'), ((185, 192), 'scrapy.item.Field', 'Field', ([], {}), '()\n', (190, 192), False, 'from scrapy.item import Item, Field\n'), ((209, 252), 'scrapy.item.Field', 'Field', (["{'file_url': {'path': 'cover_... |
from typing import List, Union, Tuple
import syft as sy
from syft.execution.action import Action
from syft.workers.abstract import AbstractWorker
from syft_proto.execution.v1.communication_action_pb2 import (
CommunicationAction as CommunicationActionPB,
)
COMMUNICATION_METHODS = [
"get",
"mid_get",
... | [
"syft.execution.action.Action.bufferize",
"syft_proto.execution.v1.communication_action_pb2.CommunicationAction",
"syft.execution.action.Action.unbufferize",
"syft.execution.action.Action.detail",
"syft.execution.action.Action.simplify"
] | [((2579, 2610), 'syft.execution.action.Action.simplify', 'Action.simplify', (['worker', 'action'], {}), '(worker, action)\n', (2594, 2610), False, 'from syft.execution.action import Action\n'), ((3371, 3406), 'syft.execution.action.Action.detail', 'Action.detail', (['worker', 'action_tuple'], {}), '(worker, action_tupl... |
from django.core.cache import cache
from django.shortcuts import reverse
from django_webtest import WebTest
from apps.shop.models import Category, Product
from .. import utils
class CategoryWebTests(WebTest):
fixtures = ['.././load_data.json']
def test_category_creation_by_regular_user(self):
# us... | [
"django.core.cache.cache.clear",
"apps.shop.models.Category.objects.first",
"apps.shop.models.Product.objects.all",
"apps.shop.models.Category.objects.all",
"apps.shop.models.Category.objects.filter",
"django.shortcuts.reverse",
"apps.shop.models.Product.objects.first",
"apps.shop.models.Category.obje... | [((937, 961), 'apps.shop.models.Category.objects.first', 'Category.objects.first', ([], {}), '()\n', (959, 961), False, 'from apps.shop.models import Category, Product\n'), ((2211, 2235), 'apps.shop.models.Category.objects.first', 'Category.objects.first', ([], {}), '()\n', (2233, 2235), False, 'from apps.shop.models i... |
from typing import Dict
import numpy as np
class ZDataProcessor:
def __init__(self):
self.source_to_index = {
'acoustic': 0,
'electronic': 1,
'synthetic': 2
}
self.quality_to_index = {
'bright': 0,
'dark': 1,
'distort... | [
"numpy.zeros",
"numpy.expand_dims"
] | [((1307, 1324), 'numpy.zeros', 'np.zeros', (['(1, 10)'], {}), '((1, 10))\n', (1315, 1324), True, 'import numpy as np\n'), ((970, 1012), 'numpy.expand_dims', 'np.expand_dims', (['[velocity / 127.0]'], {'axis': '(0)'}), '([velocity / 127.0], axis=0)\n', (984, 1012), True, 'import numpy as np\n'), ((1046, 1085), 'numpy.ex... |
from flask import render_template, Blueprint
qualityScoreVisualizer_blueprint = Blueprint('qualityScoreVisualizer', __name__)
@qualityScoreVisualizer_blueprint.route('/')
def index():
return render_template('index.html') | [
"flask.render_template",
"flask.Blueprint"
] | [((81, 126), 'flask.Blueprint', 'Blueprint', (['"""qualityScoreVisualizer"""', '__name__'], {}), "('qualityScoreVisualizer', __name__)\n", (90, 126), False, 'from flask import render_template, Blueprint\n'), ((194, 223), 'flask.render_template', 'render_template', (['"""index.html"""'], {}), "('index.html')\n", (209, 2... |
from machine import Pin, ADC, UART
import math
import time
import pylorawan
import creds_config
sensor_temp = ADC(4)
conversion_factor = 3.3 / (65535)
decoded_data = ""
led = Pin(25, Pin.OUT)
uart = UART(1, 115200) # use UART 1 for the RAK device
uart_debug = UART(0, 115200) # use UART 0 for debug ... | [
"pylorawan.Utils",
"pylorawan.LorawanModem",
"time.sleep",
"machine.Pin",
"math.log",
"machine.UART",
"time.time",
"machine.ADC"
] | [((122, 128), 'machine.ADC', 'ADC', (['(4)'], {}), '(4)\n', (125, 128), False, 'from machine import Pin, ADC, UART\n'), ((192, 208), 'machine.Pin', 'Pin', (['(25)', 'Pin.OUT'], {}), '(25, Pin.OUT)\n', (195, 208), False, 'from machine import Pin, ADC, UART\n'), ((217, 232), 'machine.UART', 'UART', (['(1)', '(115200)'], ... |
import pytest
from certbot_dns_loopia import LoopiaAuthenticator, DnsRecord, split_domain
from unittest.mock import MagicMock
# This config just sets all parameters to some value. It's just to make sure
# that the DNSAuthenticator constructor has all the parameters it might need
class PluginConfig:
verb = "certon... | [
"unittest.mock.MagicMock",
"certbot_dns_loopia.split_domain",
"certbot_dns_loopia.DnsRecord"
] | [((1009, 1040), 'certbot_dns_loopia.split_domain', 'split_domain', (['validation_domain'], {}), '(validation_domain)\n', (1021, 1040), False, 'from certbot_dns_loopia import LoopiaAuthenticator, DnsRecord, split_domain\n'), ((1059, 1125), 'certbot_dns_loopia.DnsRecord', 'DnsRecord', (['"""TXT"""'], {'ttl': 'LoopiaAuthe... |
import ui
from os import getcwd, listdir, mkdir, rename
from os.path import isdir, join
from threading import Thread
from random import choice
from time import sleep
leidos = 0
cambiados = 0
finish = False
def map_dirs(directory=getcwd()):
_map = []
for file in listdir(directory):
_map.append(join(directory, fi... | [
"os.listdir",
"os.rename",
"ui.load_view",
"os.path.join",
"time.sleep",
"os.getcwd",
"os.path.isdir",
"threading.Thread"
] | [((233, 241), 'os.getcwd', 'getcwd', ([], {}), '()\n', (239, 241), False, 'from os import getcwd, listdir, mkdir, rename\n'), ((268, 286), 'os.listdir', 'listdir', (['directory'], {}), '(directory)\n', (275, 286), False, 'from os import getcwd, listdir, mkdir, rename\n'), ((949, 971), 'os.rename', 'rename', (['file', '... |
from django.core import validators
from django.db import models
from ..app.models import App
class WebhookURLField(models.URLField):
default_validators = [
validators.URLValidator(schemes=["http", "https", "awssqs", "gcpubsub"])
]
class Webhook(models.Model):
name = models.CharField(max_length=... | [
"django.core.validators.URLValidator",
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.ForeignKey"
] | [((292, 347), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)', 'null': '(True)', 'blank': '(True)'}), '(max_length=255, null=True, blank=True)\n', (308, 347), False, 'from django.db import models\n'), ((358, 431), 'django.db.models.ForeignKey', 'models.ForeignKey', (['App'], {'related_name... |
# Day 15: http://adventofcode.com/2016/day/15
from itertools import count
inp = [(13, 10), (17, 15), (19, 17), (7, 1), (5, 0), (3, 1), (11, 0)]
def sculpture(arg):
for start in count():
if any((pos + time + start) % n for time, (n, pos) in enumerate(arg, start=1)):
continue
return ... | [
"itertools.count"
] | [((186, 193), 'itertools.count', 'count', ([], {}), '()\n', (191, 193), False, 'from itertools import count\n')] |
#!/usr/bin/env python
############################################################################
#
# Copyright (C) 2013-2015 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are me... | [
"px4airframes.srcscanner.SourceScanner",
"px4airframes.rcout.RCOutput",
"argparse.ArgumentParser",
"sys.exit",
"px4airframes.srcparser.SourceParser",
"px4airframes.xmlout.XMLOutput"
] | [((2136, 2206), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Process airframe documentation."""'}), "(description='Process airframe documentation.')\n", (2159, 2206), False, 'import argparse\n'), ((3455, 3481), 'px4airframes.srcscanner.SourceScanner', 'srcscanner.SourceScanner', ([], {... |
import random
def gen_reg_pair(f_reglist, f_regpair):
with open(f_reglist, 'r') as reglist:
num = 0
for line in reglist:
if line.startswith("0x"):
num += 1
with open(f_reglist, 'r') as reglist, open(f_regpair, 'w') as regpair:
regpair.write(f"{num}\n")
... | [
"random.randrange"
] | [((791, 814), 'random.randrange', 'random.randrange', (['(0)', '(32)'], {}), '(0, 32)\n', (807, 814), False, 'import random\n'), ((833, 860), 'random.randrange', 'random.randrange', (['(0)', '(2 ** 8)'], {}), '(0, 2 ** 8)\n', (849, 860), False, 'import random\n'), ((878, 906), 'random.randrange', 'random.randrange', ([... |
import time
import torch
import onnx
import os
import numpy as np
from mmcv.tensorrt import (TRTWrapper, onnx2trt, save_trt_engine,
is_tensorrt_plugin_loaded)
assert is_tensorrt_plugin_loaded(), 'Requires to complie TensorRT plugins in mmcv'
def gen_trt(onnx_file='sample.onnx', tr... | [
"numpy.mean",
"mmcv.tensorrt.TRTWrapper",
"mmcv.tensorrt.save_trt_engine",
"mmcv.tensorrt.is_tensorrt_plugin_loaded",
"os.path.join",
"torch.cuda.synchronize",
"mmcv.tensorrt.onnx2trt",
"onnx.load",
"time.time",
"torch.rand"
] | [((204, 231), 'mmcv.tensorrt.is_tensorrt_plugin_loaded', 'is_tensorrt_plugin_loaded', ([], {}), '()\n', (229, 231), False, 'from mmcv.tensorrt import TRTWrapper, onnx2trt, save_trt_engine, is_tensorrt_plugin_loaded\n'), ((359, 379), 'onnx.load', 'onnx.load', (['onnx_file'], {}), '(onnx_file)\n', (368, 379), False, 'imp... |
import copy
import matplotlib.pyplot as plt
import numpy
import pdb
import accelerated_functions as af
import constants as c
from Boundaries.inner_1D_rectangular import Inner_1D_Rectangular
from solver import location_indexes_inv
from Species.species import Species
from timing import Timing
#Inner_1D_HET (Inherits f... | [
"numpy.ones_like",
"numpy.repeat",
"numpy.asarray",
"numpy.isin",
"numpy.append",
"numpy.shape",
"numpy.zeros_like"
] | [((1933, 1978), 'numpy.ones_like', 'numpy.ones_like', (['pos[:, 0]'], {'dtype': 'numpy.bool_'}), '(pos[:, 0], dtype=numpy.bool_)\n', (1948, 1978), False, 'import numpy\n'), ((2373, 2419), 'numpy.isin', 'numpy.isin', (['self.location', 'self.exit_pot_nodes'], {}), '(self.location, self.exit_pot_nodes)\n', (2383, 2419), ... |
from datetime import timedelta
import airflow
from airflow.models import DAG
from airflow.operators.python_operator import PythonOperator, BranchPythonOperator
from airflow.operators.bash_operator import BashOperator
import random
import requests
default_args = {
'owner': 'airflow',
'depends_on_past': False,
... | [
"airflow.operators.python_operator.PythonOperator",
"requests.get",
"airflow.utils.dates.days_ago",
"airflow.models.DAG",
"datetime.timedelta"
] | [((984, 1050), 'airflow.models.DAG', 'DAG', (['"""billomat"""'], {'default_args': 'default_args', 'schedule_interval': 'None'}), "('billomat', default_args=default_args, schedule_interval=None)\n", (987, 1050), False, 'from airflow.models import DAG\n'), ((338, 369), 'airflow.utils.dates.days_ago', 'airflow.utils.dates... |
# -*- coding: utf-8 -*-
import os
import pygtk
pygtk.require('2.0')
import gtk
class XMLWidget(object):
def __init__(self, data_dir, widget_name):
self._data_dir = data_dir
self._builder = gtk.Builder()
xml_file = os.path.join(self._data_dir, 'glade', '%s.glade' % widget_name.replace('_... | [
"pygtk.require",
"gtk.Builder"
] | [((49, 69), 'pygtk.require', 'pygtk.require', (['"""2.0"""'], {}), "('2.0')\n", (62, 69), False, 'import pygtk\n'), ((214, 227), 'gtk.Builder', 'gtk.Builder', ([], {}), '()\n', (225, 227), False, 'import gtk\n')] |
# coding: utf-8
"""
Pdf4me
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501
OpenAPI spec version: v1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class... | [
"six.iteritems"
] | [((12511, 12544), 'six.iteritems', 'six.iteritems', (['self.swagger_types'], {}), '(self.swagger_types)\n', (12524, 12544), False, 'import six\n')] |
import torch
import torch.nn.functional as F
from .gradcam import GradCAM
class GradCAMPP(GradCAM):
"""Calculate GradCAM++ salinecy map.
Args:
input: Input image with shape of (1, 3, H, W)
class_idx: Class index for calculating GradCAM.
If not specified, the class index that make... | [
"torch.nn.functional.upsample",
"torch.ones_like",
"torch.nn.functional.relu"
] | [((1581, 1601), 'torch.nn.functional.relu', 'F.relu', (['saliency_map'], {}), '(saliency_map)\n', (1587, 1601), True, 'import torch.nn.functional as F\n'), ((1625, 1700), 'torch.nn.functional.upsample', 'F.upsample', (['saliency_map'], {'size': '(h, w)', 'mode': '"""bilinear"""', 'align_corners': '(False)'}), "(salienc... |
# Copyright 2019 The Dreamer Authors. Copyright 2020 Plan2Explore 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... | [
"tensorflow.gfile.Exists",
"os.path.join",
"tensorflow.gfile.Glob",
"numpy.array",
"tensorflow.py_func",
"os.path.expanduser"
] | [((854, 883), 'os.path.expanduser', 'os.path.expanduser', (['directory'], {}), '(directory)\n', (872, 883), False, 'import os\n'), ((1037, 1069), 'os.path.join', 'os.path.join', (['directory', '"""*.npz"""'], {}), "(directory, '*.npz')\n", (1049, 1069), False, 'import os\n'), ((1232, 1262), 'tensorflow.py_func', 'tf.py... |
# Import dependencies
import pandas as pd
import numpy as np
import joblib
# Load the dataset in a dataframe object and include only four features as mentioned
url = "http://s3.amazonaws.com/assets.datacamp.com/course/Kaggle/train.csv"
df = pd.read_csv(url)
include = ['Age', 'Sex', 'Embarked', 'Survived'] # Only four ... | [
"pandas.read_csv",
"sklearn.linear_model.LogisticRegression",
"joblib.load",
"pandas.get_dummies",
"joblib.dump"
] | [((242, 258), 'pandas.read_csv', 'pd.read_csv', (['url'], {}), '(url)\n', (253, 258), True, 'import pandas as pd\n'), ((563, 619), 'pandas.get_dummies', 'pd.get_dummies', (['df_'], {'columns': 'categoricals', 'dummy_na': '(True)'}), '(df_, columns=categoricals, dummy_na=True)\n', (577, 619), True, 'import pandas as pd\... |
"""Handling of module and package related details."""
import dataclasses
from typing import Any
from pytype import file_utils
from pytype import module_utils
from pytype.pyi.types import ParseError # pylint: disable=g-importing-member
from pytype.pytd import pytd
from pytype.pytd import visitors
from pytype.pytd.par... | [
"pytype.pyi.types.ParseError",
"pytype.pytd.visitors.RenameBuiltinsPrefixInName",
"pytype.pytd.pytd.Alias",
"pytype.pytd.pytd.Module",
"pytype.pytd.pytd.NamedType",
"pytype.module_utils.get_package_name",
"pytype.file_utils.is_pyi_directory_init",
"pytype.module_utils.get_absolute_name"
] | [((583, 624), 'pytype.pytd.pytd.Alias', 'pytd.Alias', (['self.new_name', 'self.pytd_node'], {}), '(self.new_name, self.pytd_node)\n', (593, 624), False, 'from pytype.pytd import pytd\n'), ((804, 846), 'pytype.file_utils.is_pyi_directory_init', 'file_utils.is_pyi_directory_init', (['filename'], {}), '(filename)\n', (836... |
import re
import pkg_resources
import mistune
SNIPPETS = {
# warning message to prepend to every page
'edit_warning': 'data/edit_warning.html',
# confluence macro for a Table of Contents
'toc': 'data/toc.xml',
# confluence macro for "popups"
# arg 'type': one of: info, note, warning.
# a... | [
"pkg_resources.resource_string",
"re.compile"
] | [((893, 955), 'pkg_resources.resource_string', 'pkg_resources.resource_string', (['"""md2confluence"""', 'SNIPPETS[name]'], {}), "('md2confluence', SNIPPETS[name])\n", (922, 955), False, 'import pkg_resources\n'), ((1338, 1362), 're.compile', 're.compile', (['"""\\\\n\\\\s{2,}"""'], {}), "('\\\\n\\\\s{2,}')\n", (1348, ... |
import numpy as np
import numpy.random as npr
from .base import Environment, Feedback, Spec
class ContextualEnv(Environment):
def __init__(self, arms, sd):
super().__init__()
self.arms = arms
self.sd = sd
self.max_rew = None
self.mean_rews = None
@property
def ... | [
"numpy.multiply",
"numpy.random.randn",
"numpy.max"
] | [((554, 571), 'numpy.random.randn', 'npr.randn', (['self.d'], {}), '(self.d)\n', (563, 571), True, 'import numpy.random as npr\n'), ((819, 841), 'numpy.max', 'np.max', (['self.mean_rews'], {}), '(self.mean_rews)\n', (825, 841), True, 'import numpy as np\n'), ((737, 779), 'numpy.multiply', 'np.multiply', (['self.arms', ... |
from django.conf.urls import url
from . import views
from django.conf import settings
from django.conf.urls.static import static
urlpatterns=[
url(r'^projects/(\d+)',views.projects,name ='projects'),
url(r'^$',views.projects_today,name='projectsToday'),
url(r'^search/', views.search_results, name='search_r... | [
"django.conf.urls.static.static",
"django.conf.urls.url"
] | [((148, 204), 'django.conf.urls.url', 'url', (['"""^projects/(\\\\d+)"""', 'views.projects'], {'name': '"""projects"""'}), "('^projects/(\\\\d+)', views.projects, name='projects')\n", (151, 204), False, 'from django.conf.urls import url\n'), ((209, 262), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.projects_toda... |
from argparse import ArgumentParser
from scipy.special import zetac
def parse_args():
parser = ArgumentParser()
parser.add_argument(
"-s",
required=True,
help="argument for ζ(s)"
)
return parser.parse_args()
def main():
args = parse_args()
print(zetac(float(args.s)))
... | [
"argparse.ArgumentParser"
] | [((101, 117), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (115, 117), False, 'from argparse import ArgumentParser\n')] |
from django.db.backends.mysql.base import *
from django.db.backends.mysql.base import DatabaseWrapper as MySQLDatabaseWrapper
from django.contrib.gis.db.backends.mysql.creation import MySQLCreation
from django.contrib.gis.db.backends.mysql.introspection import MySQLIntrospection
from django.contrib.gis.db.backends.mysq... | [
"django.contrib.gis.db.backends.mysql.introspection.MySQLIntrospection",
"django.contrib.gis.db.backends.mysql.creation.MySQLCreation",
"django.contrib.gis.db.backends.mysql.operations.MySQLOperations"
] | [((531, 550), 'django.contrib.gis.db.backends.mysql.creation.MySQLCreation', 'MySQLCreation', (['self'], {}), '(self)\n', (544, 550), False, 'from django.contrib.gis.db.backends.mysql.creation import MySQLCreation\n'), ((570, 591), 'django.contrib.gis.db.backends.mysql.operations.MySQLOperations', 'MySQLOperations', ([... |
# ------------------------------------------------------------------------------
# Hippocampus segmentation published by Dryad
# (https://datadryad.org/stash/dataset/doi:10.5061/dryad.gc72v)
# ------------------------------------------------------------------------------
import os
import SimpleITK as sitk
import mp.... | [
"os.listdir",
"SimpleITK.GetImageFromArray",
"mp.data.datasets.dataset_utils.get_original_data_path",
"numpy.where",
"os.path.join",
"SimpleITK.GetArrayFromImage",
"numpy.any",
"re.match",
"os.path.isdir",
"mp.utils.load_restore.join_path",
"SimpleITK.ReadImage",
"mp.data.datasets.dataset_util... | [((1584, 1624), 'mp.data.datasets.dataset_utils.get_dataset_name', 'du.get_dataset_name', (['global_name', 'subset'], {}), '(global_name, subset)\n', (1603, 1624), True, 'import mp.data.datasets.dataset_utils as du\n'), ((1990, 2028), 'mp.data.datasets.dataset_utils.get_original_data_path', 'du.get_original_data_path',... |
#!/usr/bin/env python2.3
#
# Copyright (C) 2004 British Broadcasting Corporation and Kamaelia Contributors(1)
# All Rights Reserved.
#
# You may only modify and redistribute this under the terms of any of the
# following licenses(2): Mozilla Public License, V1.1, GNU General
# Public License, V2.0, GNU Lesse... | [
"Kamaelia.bitfieldrec.field.mkList"
] | [((1454, 1715), 'Kamaelia.bitfieldrec.field.mkList', 'field.mkList', (["[('version', 2, None), ('padding', 1, None), ('extension', 1, None), (\n 'CSRCCount', 4, None), ('marker', 1, None), ('payloadtype', 7, None), (\n 'sequencenumber', 16, None), ('timestamp', 32, None), ('SSRC', 32, None\n ), ('CSRC', 32, li... |
'''
Created by auto_sdk on 2021.03.03
'''
from dingtalk.api.base import RestApi
class OapiAttendanceApproveCancelRequest(RestApi):
def __init__(self,url=None):
RestApi.__init__(self,url)
self.approve_id = None
self.dingtalk_approve_id = None
self.sub_type = None
self.tag_name = None
self.userid = None
de... | [
"dingtalk.api.base.RestApi.__init__"
] | [((163, 190), 'dingtalk.api.base.RestApi.__init__', 'RestApi.__init__', (['self', 'url'], {}), '(self, url)\n', (179, 190), False, 'from dingtalk.api.base import RestApi\n')] |
# -*- coding: utf-8 -*-
"""trail.trail: provides entry point main()."""
import sys # for proper exit.
import os # for OS path checking.
import datetime
import calendar
__version__ = "0.1.0"
py3 = sys.version_info[0] > 2 # creates boolean value for test that Python major version > 2
global_flag_used = F... | [
"os.getcwd",
"os.path.isfile",
"datetime.datetime.now",
"os.remove",
"datetime.date.today",
"os.path.expanduser",
"sys.stdout.write"
] | [((374, 397), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (392, 397), False, 'import os\n'), ((8026, 8061), 'os.path.isfile', 'os.path.isfile', (['path_file_to_delete'], {}), '(path_file_to_delete)\n', (8040, 8061), False, 'import os\n'), ((1184, 1219), 'sys.stdout.write', 'sys.stdout.writ... |
"""Discord API to host several functionalities.
Currently supported modules are:
``pydiscmd``
``getmedia``
"""
import nest_asyncio
# Why doesn't it work when the following line is executed after any other
# import but works perfectly when located like this?
nest_asyncio.apply()
import os
import pydiscmd
... | [
"pydiscmd.toText",
"os.listdir",
"discord.ext.commands.Bot",
"getmedia.SavedMedia",
"getmedia.SentMedia",
"datetime.datetime.now",
"pydiscmd.processCmd",
"collections.defaultdict",
"utils.config.Config",
"pydiscmd.modifyOutput",
"nest_asyncio.apply",
"discord.File"
] | [((270, 290), 'nest_asyncio.apply', 'nest_asyncio.apply', ([], {}), '()\n', (288, 290), False, 'import nest_asyncio\n'), ((574, 590), 'collections.defaultdict', 'defaultdict', (['str'], {}), '(str)\n', (585, 590), False, 'from collections import defaultdict\n'), ((1136, 1147), 'getmedia.SentMedia', 'SentMedia', ([], {}... |
from __future__ import absolute_import, print_function
import sys
import math
import time
import socket
from operator import itemgetter
from dpark.util import (
get_logger, make_progress_bar
)
from dpark.hostatus import TaskHostManager
from six.moves import range
logger = get_logger(__name__)
def readable(size):... | [
"socket.gethostbyname_ex",
"six.moves.range",
"dpark.hostatus.TaskHostManager",
"dpark.util.get_logger",
"dpark.schedule.Success",
"time.time",
"operator.itemgetter",
"math.log10",
"dpark.util.make_progress_bar"
] | [((279, 299), 'dpark.util.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (289, 299), False, 'from dpark.util import get_logger, make_progress_bar\n'), ((581, 592), 'time.time', 'time.time', ([], {}), '()\n', (590, 592), False, 'import time\n'), ((1877, 1888), 'time.time', 'time.time', ([], {}), '()\n', ... |
from django.db import models
class Pdf(models.Model):
# This is a small demo using FileField
file = models.FileField(upload_to="pdf")
slug = models.SlugField(max_length=50, blank=True)
def __unicode__(self):
return self.file
@models.permalink
def get_absolute_url(self):
retur... | [
"django.db.models.TextField",
"django.db.models.SlugField",
"django.db.models.FileField",
"django.db.models.CharField"
] | [((110, 143), 'django.db.models.FileField', 'models.FileField', ([], {'upload_to': '"""pdf"""'}), "(upload_to='pdf')\n", (126, 143), False, 'from django.db import models\n'), ((155, 198), 'django.db.models.SlugField', 'models.SlugField', ([], {'max_length': '(50)', 'blank': '(True)'}), '(max_length=50, blank=True)\n', ... |
"""
WSGI config for todolist project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""
import os
import sys
from django.core.wsgi import get_wsgi_application
sys.path.append('/djan... | [
"os.environ.setdefault",
"django.core.wsgi.get_wsgi_application",
"sys.path.append"
] | [((298, 333), 'sys.path.append', 'sys.path.append', (['"""/django/todolist"""'], {}), "('/django/todolist')\n", (313, 333), False, 'import sys\n'), ((335, 403), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""todolist.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'todolist.sett... |
import vcellapi
import sys
def main(argv):
if (len(argv)!=5):
print("usage: testapi host port clientID userid")
sys.exit(1)
host = argv[1] # "vcellapi.cam.uchc.edu"
port = argv[2] # 8080
clientID = argv[3] # "85133f8d-26f7-4247-8356-d175399fc2e6"
... | [
"vcellapi.SimulationTasksQuerySpec",
"vcellapi.VCellApi",
"vcellapi.BiomodelsQuerySpec",
"sys.exit"
] | [((403, 442), 'vcellapi.VCellApi', 'vcellapi.VCellApi', (['host', 'port', 'clientID'], {}), '(host, port, clientID)\n', (420, 442), False, 'import vcellapi\n'), ((133, 144), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (141, 144), False, 'import sys\n'), ((512, 541), 'vcellapi.BiomodelsQuerySpec', 'vcellapi.Biomodel... |
import requests
from bespin.exceptions import JobDoesNotExistException, ShareGroupNotFound, JobStrategyNotFound, WorkflowNotFound
CONTENT_TYPE = 'application/json'
class BespinApi(object):
"""
Communicates with Bespin API via REST
"""
def __init__(self, config, user_agent_str):
self.config = ... | [
"requests.post",
"requests.get",
"requests.delete"
] | [((842, 876), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (854, 876), False, 'import requests\n'), ((1264, 1310), 'requests.post', 'requests.post', (['url'], {'headers': 'headers', 'json': 'data'}), '(url, headers=headers, json=data)\n', (1277, 1310), False, 'import re... |
from urllib.parse import urlparse, parse_qs
from cement import Controller, ex
from cement.utils.version import get_version_banner
from ..core.version import get_version
from ..core.service import BamahutExporterService
VERSION_BANNER = """
Exports floors and replies in Bahamut posts %s
%s
""" % (get_version(), get_ve... | [
"urllib.parse.urlparse",
"cement.utils.version.get_version_banner"
] | [((314, 334), 'cement.utils.version.get_version_banner', 'get_version_banner', ([], {}), '()\n', (332, 334), False, 'from cement.utils.version import get_version_banner\n'), ((1254, 1282), 'urllib.parse.urlparse', 'urlparse', (['self.app.pargs.url'], {}), '(self.app.pargs.url)\n', (1262, 1282), False, 'from urllib.pars... |
from django.conf import settings
from django.template.loader import render_to_string
from base.utils import send_email_wrapper, run_in_background
from registration.models import Host
@run_in_background
def send_checkin_email_to_hosts(entry_log):
receivers = [entry_log.host.user.email]
message = render_to_str... | [
"base.utils.send_email_wrapper",
"django.template.loader.render_to_string"
] | [((307, 396), 'django.template.loader.render_to_string', 'render_to_string', (['"""entry_logs/email_templates/checkin_email.html"""', "{'log': entry_log}"], {}), "('entry_logs/email_templates/checkin_email.html', {'log':\n entry_log})\n", (323, 396), False, 'from django.template.loader import render_to_string\n'), (... |
from mcstats import mcstats
mcstats.registry.append(
mcstats.MinecraftStat(
'eat_rawmeat',
{
'title': '生食者',
'desc': '吃過的生肉數量',
'unit': 'int',
},
mcstats.StatSumReader([
mcstats.StatReader(['minecraft:used','minecraft:porkchop']),
... | [
"mcstats.mcstats.StatReader"
] | [((255, 315), 'mcstats.mcstats.StatReader', 'mcstats.StatReader', (["['minecraft:used', 'minecraft:porkchop']"], {}), "(['minecraft:used', 'minecraft:porkchop'])\n", (273, 315), False, 'from mcstats import mcstats\n'), ((328, 384), 'mcstats.mcstats.StatReader', 'mcstats.StatReader', (["['minecraft:used', 'minecraft:bee... |
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#
import subprocess
import sys
from pathlib import Path
from libcst.testing.utils import UnitTest
class TestCodemodCLI(UnitTest):
def ... | [
"pathlib.Path"
] | [((608, 622), 'pathlib.Path', 'Path', (['__file__'], {}), '(__file__)\n', (612, 622), False, 'from pathlib import Path\n')] |
import re
from . import builtin
from .. import path as _path
from ..iterutils import map_iterable
for i in (_path.Root, _path.InstallRoot):
builtin.default(context='*')(i)
builtin.default(context='*', name='Path')(_path.Path)
@builtin.function(context=('build', 'options'))
def relpath(context, path, strict=Fal... | [
"re.sub"
] | [((758, 800), 're.sub', 're.sub', (['"""(^|/)..(?=/|$)"""', '"""\\\\1PAR"""', 'suffix'], {}), "('(^|/)..(?=/|$)', '\\\\1PAR', suffix)\n", (764, 800), False, 'import re\n')] |
'''
Provider for duck dataset from <NAME>
'''
import os
import os.path
import json
import numpy as np
import sys
import pickle
import glob
class Dataset():
def __init__(self, \
root='/scr1/mengyuan/ICCV-data/MSR_processed', \
num_points = 8192, \
num_frames=2, skip_frames=1... | [
"os.listdir",
"numpy.random.choice",
"os.path.join",
"numpy.array",
"numpy.random.uniform",
"time.time",
"numpy.arange",
"numpy.random.shuffle"
] | [((2756, 2767), 'time.time', 'time.time', ([], {}), '()\n', (2765, 2767), False, 'import time\n'), ((593, 614), 'os.listdir', 'os.listdir', (['self.root'], {}), '(self.root)\n', (603, 614), False, 'import os\n'), ((2351, 2367), 'numpy.array', 'np.array', (['points'], {}), '(points)\n', (2359, 2367), True, 'import numpy... |
from django.shortcuts import render, redirect
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth import login,logout,authenticate
from django.contrib import messages
from .models import Employee, CVmaker
from .forms import ApplyForm
# Create your views here.
def home(request):
if reque... | [
"django.shortcuts.render",
"django.shortcuts.redirect"
] | [((978, 1019), 'django.shortcuts.render', 'render', (['request', '"""cv/apply.html"""', 'context'], {}), "(request, 'cv/apply.html', context)\n", (984, 1019), False, 'from django.shortcuts import render, redirect\n'), ((1054, 1088), 'django.shortcuts.render', 'render', (['request', '"""cv/success.html"""'], {}), "(requ... |
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by appli... | [
"logging.basicConfig",
"logging.getLogger",
"pycocotools.cocoeval.COCOeval",
"pycocotools.coco.COCO",
"sys.stdout.flush",
"json.dump"
] | [((776, 830), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': 'FORMAT'}), '(level=logging.INFO, format=FORMAT)\n', (795, 830), False, 'import logging\n'), ((840, 867), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (857, 867), False, 'import logging\... |
#
# Usage:
# <Directory /where/ever>
# PythonOutputFilter gzipfilter
# SetOutputFilter gzipfilter
# </Directory>
from mod_python import apache
import os
import sys
import gzip
import cStringIO
from mod_python import apache
def compress(s):
sio = cStringIO.StringIO()
f = gzip.GzipFile(mode='wb',... | [
"gzip.GzipFile",
"cStringIO.StringIO"
] | [((267, 287), 'cStringIO.StringIO', 'cStringIO.StringIO', ([], {}), '()\n', (285, 287), False, 'import cStringIO\n'), ((296, 333), 'gzip.GzipFile', 'gzip.GzipFile', ([], {'mode': '"""wb"""', 'fileobj': 'sio'}), "(mode='wb', fileobj=sio)\n", (309, 333), False, 'import gzip\n')] |
#! /usr/bin/python
# -*- coding: utf-8 -*-
import numpy as np
import traceback
# import sys
import os.path
def get_skelet3d_lib():
import ctypes
import ctypes.util
# import os
# ThinningCxxShared is C++, ThinningShared is C
# libpath = os.path.abspath(os.path.dirname(os.path.realpath(__file__)... | [
"ctypes.util.find_library",
"traceback.format_exc",
"numpy.zeros",
"ctypes.CDLL",
"numpy.frombuffer",
"ctypes.c_char_p"
] | [((575, 608), 'ctypes.util.find_library', 'ctypes.util.find_library', (['libname'], {}), '(libname)\n', (599, 608), False, 'import ctypes\n'), ((2108, 2143), 'numpy.frombuffer', 'np.frombuffer', (['sdata'], {'dtype': '"""uint8"""'}), "(sdata, dtype='uint8')\n", (2121, 2143), True, 'import numpy as np\n'), ((2212, 2246)... |
import re
from pydantic import BaseSettings, validator
class Channels(BaseSettings):
"""Channel ids."""
devlog: int = 0
@validator("devlog")
def check_ids_format(cls, v: list[int]) -> list[int]:
"""Validate discord ids format."""
if not v:
return v
assert len(st... | [
"re.compile",
"pydantic.validator"
] | [((138, 157), 'pydantic.validator', 'validator', (['"""devlog"""'], {}), "('devlog')\n", (147, 157), False, 'from pydantic import BaseSettings, validator\n'), ((621, 639), 'pydantic.validator', 'validator', (['"""token"""'], {}), "('token')\n", (630, 639), False, 'from pydantic import BaseSettings, validator\n'), ((151... |
from contextlib import contextmanager
from tarfile import open as tarfile_open
try:
import lz4.frame as lz4
except ImportError:
lz4 = None
class Lz4Tarfile:
def __init__(self, **kwargs):
self.lz4_kwargs = kwargs
@contextmanager
def read(self, path: str, mode: str):
with lz4.LZ4Fr... | [
"lz4.frame.LZ4FrameFile",
"tarfile.open"
] | [((311, 333), 'lz4.frame.LZ4FrameFile', 'lz4.LZ4FrameFile', (['path'], {}), '(path)\n', (327, 333), True, 'import lz4.frame as lz4\n'), ((365, 421), 'tarfile.open', 'tarfile_open', ([], {'mode': 'mode', 'fileobj': 'lz4d'}), '(mode=mode, fileobj=lz4d, **self.lz4_kwargs)\n', (377, 421), True, 'from tarfile import open as... |
# coding=utf-8
# Copyright 2021 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicab... | [
"tensorflow.compat.v1.compat.as_text",
"numpy.split"
] | [((1468, 1555), 'numpy.split', 'np.split', (["example['short_answers/values']", "example['short_answers/row_starts'][1:]"], {}), "(example['short_answers/values'], example[\n 'short_answers/row_starts'][1:])\n", (1476, 1555), True, 'import numpy as np\n'), ((2259, 2281), 'tensorflow.compat.v1.compat.as_text', 'tf.co... |
#!/usr/bin/env python3
from setuptools import setup, find_packages
setup(
name="django_crime",
description="An application used to report crime in Mandera county"
"for Django.",
version='3.2.5',
url="https://orukopius",
author="<NAME>",
author_email="<EMAIL>",
license="MIT",
packag... | [
"setuptools.find_packages"
] | [((323, 338), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (336, 338), False, 'from setuptools import setup, find_packages\n')] |
from sklearn.cluster import KMeans
import numpy as np
from cv2 import cv2
from collections import Counter
from skimage.color import rgb2lab, deltaE_cie76
def RGB2HEX(color):
return "#{:02x}{:02x}{:02x}".format(int(color[0]), int(color[1]), int(color[2]))
def get_image(image):
image = cv2.cvtColor(image, cv... | [
"sklearn.cluster.KMeans",
"PIL.Image.open",
"skimage.color.deltaE_cie76",
"numpy.asarray",
"collections.Counter",
"numpy.array",
"cv2.cv2.resize",
"cv2.cv2.cvtColor"
] | [((298, 336), 'cv2.cv2.cvtColor', 'cv2.cvtColor', (['image', 'cv2.COLOR_BGR2RGB'], {}), '(image, cv2.COLOR_BGR2RGB)\n', (310, 336), False, 'from cv2 import cv2\n'), ((418, 477), 'cv2.cv2.resize', 'cv2.resize', (['image', '(600, 400)'], {'interpolation': 'cv2.INTER_AREA'}), '(image, (600, 400), interpolation=cv2.INTER_A... |
#!/usr/bin/env python
"""Define Class `FastaSplitter` which splits a fasta file into
smaller files each containing `reads_per_split` reads."""
import os
import os.path as op
import sys
from Bio import SeqIO
from pbtranscript.Utils import mkdir
class FaFqSplitter(object):
"""
Splits a fasta/fastq file into... | [
"logging.getLogger",
"argparse.ArgumentParser",
"pbtranscript.Utils.setup_log",
"os.path.join",
"pbtranscript.Utils.mkdir",
"os.path.basename",
"Bio.SeqIO.write",
"pbtranscript.__init__.get_version",
"os.remove"
] | [((3589, 3678), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Split a fasta/fastq file into smaller chunks."""'}), "(description=\n 'Split a fasta/fastq file into smaller chunks.')\n", (3612, 3678), False, 'import argparse\n'), ((4545, 4572), 'logging.getLogger', 'logging.getLogger',... |
import sys
import random
import FormulaSolidityPort
import FormulaNativePython
from decimal import Decimal
from decimal import getcontext
getcontext().prec = 80 # 78 digits for a maximum of 2^256-1, and 2 more digits for after the decimal point
def singleHopTestFixed(balance1, weight1, balance2, weight2, amount):
... | [
"decimal.getcontext",
"decimal.Decimal",
"random.randrange",
"FormulaSolidityPort.calculatePurchaseReturn",
"FormulaNativePython.calculateSaleReturn",
"FormulaNativePython.calculatePurchaseReturn",
"FormulaSolidityPort.calculateSaleReturn",
"FormulaSolidityPort.calculateCrossConnectorReturn"
] | [((1251, 1266), 'decimal.Decimal', 'Decimal', (['"""+inf"""'], {}), "('+inf')\n", (1258, 1266), False, 'from decimal import Decimal\n'), ((140, 152), 'decimal.getcontext', 'getcontext', ([], {}), '()\n', (150, 152), False, 'from decimal import getcontext\n'), ((1304, 1333), 'random.randrange', 'random.randrange', (['(2... |
from django.db import models
from django.utils.text import slugify
from .media import PouzitiMedia
class Zaznam(models.Model):
nazev = models.CharField(max_length=100)
# vyřešit slug
slug = models.SlugField(max_length=100, unique=True)
popis = models.CharField(max_length=500, blank=True)
active = models.Boo... | [
"django.utils.text.slugify",
"django.db.models.BooleanField",
"django.db.models.SlugField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((138, 170), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)'}), '(max_length=100)\n', (154, 170), False, 'from django.db import models\n'), ((197, 242), 'django.db.models.SlugField', 'models.SlugField', ([], {'max_length': '(100)', 'unique': '(True)'}), '(max_length=100, unique=True)\n', ... |
import htfe as ht
import pickle as pic
import math
import random
############################## HTFE Init ##############################
cs = ht.ComputeSystem()
cs.create(ht._gpu)
prog = ht.ComputeProgram()
if not prog.loadFromFile("htfe.cl", cs):
print("Could not load program!")
h = ht.HTFE()
minNote = 21 #... | [
"pickle.load",
"math.sqrt",
"htfe.HTFE",
"htfe.LayerDesc",
"htfe.ComputeSystem",
"htfe.ComputeProgram"
] | [((144, 162), 'htfe.ComputeSystem', 'ht.ComputeSystem', ([], {}), '()\n', (160, 162), True, 'import htfe as ht\n'), ((191, 210), 'htfe.ComputeProgram', 'ht.ComputeProgram', ([], {}), '()\n', (208, 210), True, 'import htfe as ht\n'), ((295, 304), 'htfe.HTFE', 'ht.HTFE', ([], {}), '()\n', (302, 304), True, 'import htfe a... |
import torch
import torch.utils.data as data
import torch.nn as nn
import torch.optim as optim
import os
import numpy as np
import pandas as pd
import glob
import cv2
from tqdm import tqdm, trange
import matplotlib.pyplot as plt
img_size = 256
# raw data directories
X_img_path = "D:/AI in Urban Design/DL... | [
"torch.nn.ReLU",
"matplotlib.pyplot.ylabel",
"torch.from_numpy",
"numpy.array",
"torch.cuda.is_available",
"torch.sum",
"torch.nn.Sigmoid",
"torch.nn.BatchNorm2d",
"os.listdir",
"numpy.mean",
"torch.unsqueeze",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"torch.optim.lr_scheduler... | [((2538, 2589), 'torch.utils.data.random_split', 'data.random_split', (['dataset', '[train_size, test_size]'], {}), '(dataset, [train_size, test_size])\n', (2555, 2589), True, 'import torch.utils.data as data\n'), ((2744, 2803), 'torch.utils.data.random_split', 'data.random_split', (['train_dataset', '[training_size, v... |
#!/usr/bin/env python
#
# File: fakepdb_to_cops.py
# Author: <NAME>
# Created: April 2010
#
# $Id: fakepdb_to_cops.py 3909 2010-07-11 04:45:25Z alexs $
"""
fakepdb_to_cops.py - Convert fake PDB identifers back to COPS identifiers
Usage: fakepdb_to_cops.py [fakepdbids_filename] < DaliteLite-2col-output
The inpu... | [
"tsevalutils.iter_searchresult",
"sys.stderr.write",
"os.path.basename",
"sys.exit",
"sys.stdout.write"
] | [((1894, 1957), 'sys.stderr.write', 'sys.stderr.write', (["('Usage: ' + progname + ' < DaliLite2ColOut\\n')"], {}), "('Usage: ' + progname + ' < DaliLite2ColOut\\n')\n", (1910, 1957), False, 'import sys, os\n'), ((1962, 1973), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (1970, 1973), False, 'import sys, os\n'), ((2... |
import socket
import sys
import requests
#import requests_oauthlib
import prepro
import json
import time
import pandas as pd
from copulae import NormalCopula
import numpy as np
#sudo apt-get install -y python3-oauth python3-oauth2client python3-oauthlib python3-requests-oauthlib
def send_data_to_spark(data, tcp_conn... | [
"prepro.read_headers",
"socket.socket",
"pandas.read_csv",
"numpy.where",
"time.sleep",
"sys.exc_info",
"pandas.DataFrame",
"numpy.random.randn"
] | [((1351, 1451), 'pandas.read_csv', 'pd.read_csv', (['"""../nasa/event/event_wind_summary/event_wind_summary.tab"""'], {'sep': '"""\\\\s+"""', 'header': 'None'}), "('../nasa/event/event_wind_summary/event_wind_summary.tab', sep=\n '\\\\s+', header=None)\n", (1362, 1451), True, 'import pandas as pd\n'), ((1497, 1584),... |
from random import randint
def jacobi_symbol(a, b):
if (b < 0) or (b % 2 == 0):
return 0
j = 1
if a < 0:
a = -a
if b % 4 == 3:
j = -j
while a != 0:
while a % 2 == 0:
#procesam multiplii de 2
a //= 2
if (b % 8 == 3) or (b %... | [
"random.randint"
] | [((590, 607), 'random.randint', 'randint', (['(2)', '(n - 2)'], {}), '(2, n - 2)\n', (597, 607), False, 'from random import randint\n')] |
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""
from __future__ import absolute_import
import pytest
import sys
from textwrap import dedent
from osbs.cli.main import (str_on_2_unicode_on_3... | [
"osbs.cli.main.make_worker_builds_str",
"textwrap.dedent",
"osbs.cli.main.make_digests_str",
"osbs.cli.main.str_on_2_unicode_on_3"
] | [((2203, 2240), 'osbs.cli.main.make_worker_builds_str', 'make_worker_builds_str', (['worker_builds'], {}), '(worker_builds)\n', (2225, 2240), False, 'from osbs.cli.main import str_on_2_unicode_on_3, make_worker_builds_str, make_digests_str\n'), ((3513, 3538), 'osbs.cli.main.make_digests_str', 'make_digests_str', (['dig... |
# -*- coding: utf-8 -*-
"""Untitled10.ipynb
Automatically generated by Colaboratory.
Original file is located at
https://colab.research.google.com/drive/17rmrqLl4ZshmobIdJqszj4V3FqqMRHHh
**Chronic Kidney Diesease Analysis**
**Dataset: https://www.kaggle.com/mansoordaku/ckdisease**
"""
# Commented out IPython... | [
"pandas.read_csv",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.xlabel",
"seaborn.countplot",
"lightgbm.LGBMClassifier",
"seaborn.heatmap",
"pandas.get_dummies",
"sklearn.preprocessing.StandardScaler",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.subplots",
"pandas.DataFrame"... | [((1052, 1085), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (1075, 1085), False, 'import warnings\n'), ((1090, 1132), 'pandas.read_csv', 'pd.read_csv', (['"""/content/kidney_disease.csv"""'], {}), "('/content/kidney_disease.csv')\n", (1101, 1132), True, 'import pandas a... |
#############################################################
# MIT License, Copyright © 2020, ETH Zurich, <NAME>
#############################################################
import numpy as np
import tensorflow as tf
import os
from tqdm import trange
from config import get_config
from util import *
from styler_2p imp... | [
"os.path.join",
"config.get_config",
"numpy.zeros",
"numpy.stack",
"tensorflow.compat.v1.set_random_seed",
"partio.read",
"partio.write",
"os.path.basename",
"partio.create",
"styler_2p.Styler",
"sys.path.append",
"tqdm.trange",
"numpy.random.RandomState"
] | [((342, 387), 'sys.path.append', 'sys.path.append', (['"""E:/partio/build/py/Release"""'], {}), "('E:/partio/build/py/Release')\n", (357, 387), False, 'import sys\n'), ((619, 660), 'tensorflow.compat.v1.set_random_seed', 'tf.compat.v1.set_random_seed', (['config.seed'], {}), '(config.seed)\n', (647, 660), True, 'import... |
"""
Test some lldb command abbreviations.
"""
import os, time
import unittest2
import lldb
from lldbtest import *
import lldbutil
class DisassemblyTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
@dsym_test
def test_with_dsym (self):
self.buildDsym ()
se... | [
"lldbutil.run_break_set_command",
"unittest2.main",
"os.getcwd",
"lldbutil.check_breakpoint_result",
"lldb.SBDebugger.Terminate",
"lldb.SBDebugger.Initialize"
] | [((1926, 1954), 'lldb.SBDebugger.Initialize', 'lldb.SBDebugger.Initialize', ([], {}), '()\n', (1952, 1954), False, 'import lldb\n'), ((2016, 2032), 'unittest2.main', 'unittest2.main', ([], {}), '()\n', (2030, 2032), False, 'import unittest2\n'), ((687, 738), 'lldbutil.run_break_set_command', 'lldbutil.run_break_set_com... |
import json
import pandas as pd
from numpy import nan
class SourceReadError(Exception):
pass
def extract_properties(feature: dict) -> dict:
"""Extract properties from geojson"""
properties = feature["properties"]
if "addr:postcode" in properties:
properties["addr:postcode"] = str(propertie... | [
"json.load"
] | [((713, 733), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (722, 733), False, 'import json\n')] |
import unittest
from pathlib import Path
from cif.cif_file_io import CifContainer
from tests.test_utils import current_file_path
class CifFileCRCTestCase(unittest.TestCase):
def setUp(self) -> None:
current_file_path()
self.cif = CifContainer(Path('tests/examples/1979688.cif'))
def test_calc... | [
"unittest.main",
"cif.cif_file_io.CifContainer",
"tests.test_utils.current_file_path",
"pathlib.Path"
] | [((3176, 3191), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3189, 3191), False, 'import unittest\n'), ((214, 233), 'tests.test_utils.current_file_path', 'current_file_path', ([], {}), '()\n', (231, 233), False, 'from tests.test_utils import current_file_path\n'), ((507, 526), 'tests.test_utils.current_file_pat... |
# -*- coding: utf-8 -*-#
'''
# Name: NeuralNetwork-keras
# Description: 多入单处层神经网络
# Author: super
# Date: 2020/5/15
'''
from keras.layers import Dense
from keras.models import Sequential
from keras.callbacks import EarlyStopping
from sklearn.preprocessing import StandardScaler
from HelperClass... | [
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"keras.models.Sequential",
"sklearn.preprocessing.StandardScaler",
"keras.callbacks.EarlyStopping",
"keras.layers.Dense",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((598, 614), 'sklearn.preprocessing.StandardScaler', 'StandardScaler', ([], {}), '()\n', (612, 614), False, 'from sklearn.preprocessing import StandardScaler\n'), ((1100, 1112), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1110, 1112), False, 'from keras.models import Sequential\n'), ((1359, 1409), 'mat... |
# -*- coding: utf-8 -*-
# @COPYRIGHT_begin
#
# Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
#
# 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.apac... | [
"clm.models.user.User.get",
"clm.utils.decorators.admin_cm_log",
"clm.utils.cm.CM",
"clm.utils.exception.CLMException"
] | [((961, 995), 'clm.utils.decorators.admin_cm_log', 'admin_cm_log', ([], {'log': '(True)', 'pack': '(False)'}), '(log=True, pack=False)\n', (973, 995), False, 'from clm.utils.decorators import admin_cm_log, cm_request\n'), ((1142, 1176), 'clm.utils.decorators.admin_cm_log', 'admin_cm_log', ([], {'log': '(False)', 'pack'... |
"""
This module focuses on scraping and saving Game of Thrones scripts. These scripts were found through the
``genius.com/albums/Game-of-thrones`` website. All scripts are saved to the ``./scripts/`` directory (which is created
if it does not exist already).
Author: <NAME>
"""
import os
import re
from typing import ... | [
"os.path.exists",
"os.makedirs",
"re.compile",
"html2text.HTML2Text",
"requests.get",
"re.sub",
"numpy.arange",
"os.remove"
] | [((1029, 1050), 'html2text.HTML2Text', 'html2text.HTML2Text', ([], {}), '()\n', (1048, 1050), False, 'import html2text\n'), ((1215, 1232), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1227, 1232), False, 'import requests\n'), ((4482, 4497), 'numpy.arange', 'np.arange', (['(8)', '(9)'], {}), '(8, 9)\n', (4... |
import jieba
from wordfreq import word_frequency
import bottle as b
app = b.app()
@b.route('/<:re:.*>', method='OPTIONS')
def enable_cors_generic_route():
"""
This route takes priority over all others. So any request with an OPTIONS
method will be handled by this function.
See: https://github.com/bot... | [
"jieba.cut",
"bottle.app",
"bottle.route",
"bottle.hook",
"wordfreq.word_frequency"
] | [((75, 82), 'bottle.app', 'b.app', ([], {}), '()\n', (80, 82), True, 'import bottle as b\n'), ((85, 123), 'bottle.route', 'b.route', (['"""/<:re:.*>"""'], {'method': '"""OPTIONS"""'}), "('/<:re:.*>', method='OPTIONS')\n", (92, 123), True, 'import bottle as b\n'), ((457, 480), 'bottle.hook', 'b.hook', (['"""after_reques... |
import numpy as np
from scipy.spatial.distance import cdist
dat=np.array([[1,1],[1.1,1],[1.3,1],[1.5,1],[1.6,1]])
dat=np.transpose(dat)
dist_thres=0.15
num_points = dat.shape[1]
is_key_point=[False for i in range(num_points)]
print("Before filter, total {} points".format(num_points))
dat_t = np.transpose(dat)
dist = c... | [
"scipy.spatial.distance.cdist",
"numpy.array",
"numpy.transpose",
"numpy.where"
] | [((65, 123), 'numpy.array', 'np.array', (['[[1, 1], [1.1, 1], [1.3, 1], [1.5, 1], [1.6, 1]]'], {}), '([[1, 1], [1.1, 1], [1.3, 1], [1.5, 1], [1.6, 1]])\n', (73, 123), True, 'import numpy as np\n'), ((119, 136), 'numpy.transpose', 'np.transpose', (['dat'], {}), '(dat)\n', (131, 136), True, 'import numpy as np\n'), ((294... |
"""This module contains the detection code for integer overflows and
underflows."""
import json
from typing import Dict, cast, List
from mythril.analysis import solver
from mythril.analysis.report import Issue
from mythril.analysis.swc_data import INTEGER_OVERFLOW_AND_UNDERFLOW
from mythril.exceptions import UnsatErro... | [
"logging.getLogger",
"mythril.laser.smt.BVAddNoOverflow",
"mythril.laser.smt.BVSubNoUnderflow",
"json.dumps",
"mythril.laser.smt.symbol_factory.BitVecVal",
"mythril.analysis.solver.get_transaction_sequence",
"mythril.laser.smt.BVMulNoOverflow",
"mythril.analysis.solver.get_model"
] | [((694, 721), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (711, 721), False, 'import logging\n'), ((5181, 5217), 'mythril.laser.smt.symbol_factory.BitVecVal', 'symbol_factory.BitVecVal', (['value', '(256)'], {}), '(value, 256)\n', (5205, 5217), False, 'from mythril.laser.smt import BVA... |
from tkinter import Frame, Text, Scrollbar, Pack, Grid, Place
from tkinter.constants import RIGHT, LEFT, Y, X, BOTH, BOTTOM
class XYScrolledText(Text):
def __init__(self, master=None, **kw):
self.frame = Frame(master)
self.vbar = Scrollbar(self.frame)
self.vbar.pack(side=RIGHT, fill=Y)
... | [
"tkinter.Scrollbar",
"tkinter.Frame",
"tkinter.Text.__init__"
] | [((218, 231), 'tkinter.Frame', 'Frame', (['master'], {}), '(master)\n', (223, 231), False, 'from tkinter import Frame, Text, Scrollbar, Pack, Grid, Place\n'), ((252, 273), 'tkinter.Scrollbar', 'Scrollbar', (['self.frame'], {}), '(self.frame)\n', (261, 273), False, 'from tkinter import Frame, Text, Scrollbar, Pack, Grid... |
from app import app
if __name__ == '__main__':
import logging
logging.basicConfig(level=logging.DEBUG)
app.run(host='0.0.0.0')
| [
"logging.basicConfig",
"app.app.run"
] | [((71, 111), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (90, 111), False, 'import logging\n'), ((117, 140), 'app.app.run', 'app.run', ([], {'host': '"""0.0.0.0"""'}), "(host='0.0.0.0')\n", (124, 140), False, 'from app import app\n')] |
"""Resource module for shapes resources."""
from aiohttp import web
from dcat_ap_no_validator_service.adapter import ShapesGraphAdapter
class ShapesCollection(web.View):
"""Class representing a collecion of shapes resource."""
async def get(self) -> web.Response:
"""Shapes route function."... | [
"dcat_ap_no_validator_service.adapter.ShapesGraphAdapter.get_by_id",
"dcat_ap_no_validator_service.adapter.ShapesGraphAdapter.get_all",
"aiohttp.web.json_response"
] | [((497, 524), 'aiohttp.web.json_response', 'web.json_response', (['response'], {}), '(response)\n', (514, 524), False, 'from aiohttp import web\n'), ((758, 790), 'dcat_ap_no_validator_service.adapter.ShapesGraphAdapter.get_by_id', 'ShapesGraphAdapter.get_by_id', (['id'], {}), '(id)\n', (786, 790), False, 'from dcat_ap_... |
import os
import mmcv
import numpy as np
import matplotlib.pyplot as plt
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from mmcv import Config
from mmdet.datasets import build_dataset
MODEL = "smoking"
MODEL_NAME = "mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_smoking"
CONFIG_FILE = f"confi... | [
"mmdet.datasets.build_dataset",
"matplotlib.pyplot.grid",
"pycocotools.cocoeval.COCOeval",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"pycocotools.coco.COCO",
"mmcv.Config.fromfile",
"matplotlib.pyplot.ylim",
"matplotlib.pyplot.x... | [((781, 809), 'mmcv.Config.fromfile', 'Config.fromfile', (['config_file'], {}), '(config_file)\n', (796, 809), False, 'from mmcv import Config\n'), ((1074, 1102), 'mmdet.datasets.build_dataset', 'build_dataset', (['cfg.data.test'], {}), '(cfg.data.test)\n', (1087, 1102), False, 'from mmdet.datasets import build_dataset... |
# regex in python
text = "Hola, mi nombre es Larry"
import re
# search
result = re.search("nombre", text) # returns match object
if (result):
print("Match found")
else:
print("Not found")
# findall
body = """
El coche de Luis es rojo,
El coche de Antony es blanco
y el coche de Maria es rojo
"""
print(re.finda... | [
"re.sub",
"re.split",
"re.findall",
"re.search"
] | [((81, 106), 're.search', 're.search', (['"""nombre"""', 'text'], {}), "('nombre', text)\n", (90, 106), False, 'import re\n'), ((312, 343), 're.findall', 're.findall', (['"""coche.*rojo"""', 'body'], {}), "('coche.*rojo', body)\n", (322, 343), False, 'import re\n'), ((400, 423), 're.split', 're.split', (['"""\\\\s"""',... |
"""
<NAME> with Moonlight Feather Inc.
sellbrite.py
Communication with sellbrite in a hackish way through selenium
"""
from __future__ import division
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from bs4 import BeautifulSoup
import time
class Sellbrite():
login_url = "https://ap... | [
"bs4.BeautifulSoup",
"selenium.webdriver.Chrome",
"selenium.webdriver.ChromeOptions",
"time.sleep"
] | [((606, 631), 'selenium.webdriver.ChromeOptions', 'webdriver.ChromeOptions', ([], {}), '()\n', (629, 631), False, 'from selenium import webdriver\n'), ((787, 833), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {'chrome_options': 'chromeOptions'}), '(chrome_options=chromeOptions)\n', (803, 833), False, 'from sel... |
# -*- coding:utf-8 -*-
from requests import get
from requests import codes
from bs4 import BeautifulSoup
from crawler import insert_collection
def fetch(task_id, keyword, start=1, end=5):
"""
通过https://medium.com/search/posts接口获取medium的关键查询结果,并保存结果至mongodb中
:param task_id: 本次抓取所属的任务编号
:param keyword: ... | [
"bs4.BeautifulSoup",
"crawler.insert_collection",
"requests.get"
] | [((1491, 1499), 'requests.get', 'get', (['url'], {}), '(url)\n', (1494, 1499), False, 'from requests import get\n'), ((459, 531), 'requests.get', 'get', (['"""https://medium.com/search/posts"""', "{'q': keyword, 'ignore': ignore}"], {}), "('https://medium.com/search/posts', {'q': keyword, 'ignore': ignore})\n", (462, 5... |
#! /usr/bin/env python3
from configparser import ConfigParser, ExtendedInterpolation
from functools import partial
import multiprocessing as mp
import os
import sys
import time
###############################################################################
import numpy as np
import pandas as pd
######################... | [
"SatTrack.tle.TLE",
"SatTrack.visible.ComputeVisibility",
"SatTrack.output.OutputFile",
"multiprocessing.Pool",
"time.time",
"configparser.ExtendedInterpolation"
] | [((783, 794), 'time.time', 'time.time', ([], {}), '()\n', (792, 794), False, 'import time\n'), ((1259, 1320), 'SatTrack.tle.TLE', 'TLE', ([], {'satellite_brand': 'satellite_brand', 'directory': 'tle_directory'}), '(satellite_brand=satellite_brand, directory=tle_directory)\n', (1262, 1320), False, 'from SatTrack.tle imp... |
# Copyright The PyTorch Lightning team.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to i... | [
"flash.text.SummarizationTask.load_from_checkpoint",
"flash.text.SummarizationData.from_csv",
"pytorch_lightning.Trainer",
"flash.core.data.utils.download_data"
] | [((757, 830), 'flash.core.data.utils.download_data', 'download_data', (['"""https://pl-flash-data.s3.amazonaws.com/xsum.zip"""', '"""data/"""'], {}), "('https://pl-flash-data.s3.amazonaws.com/xsum.zip', 'data/')\n", (770, 830), False, 'from flash.core.data.utils import download_data\n'), ((878, 991), 'flash.text.Summar... |
import copy
import pathlib
import random
import typing
import uuid
import ditef_producer_shared.genetic_individual
import ditef_router.api_client
class Individual(ditef_producer_shared.genetic_individual.AbstractIndividual):
def individual_type(self) -> str:
return 'bitvector'
@staticmethod
def... | [
"random.randrange",
"random.choice",
"copy.deepcopy",
"uuid.uuid4"
] | [((808, 820), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (818, 820), False, 'import uuid\n'), ((1582, 1594), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (1592, 1594), False, 'import uuid\n'), ((1751, 1779), 'copy.deepcopy', 'copy.deepcopy', (['parent.genome'], {}), '(parent.genome)\n', (1764, 1779), False, 'import... |
import struct
_byteorder_structs = {
'little': struct.Struct('<I'),
'big': struct.Struct('>I'),
}
def _encode_utf32(s: str, byteorder: str):
return b''.join(_byteorder_structs[byteorder].pack(ord(c)) for c in s)
def encode_utf32le(s: str):
return _encode_utf32(s, 'little')
def encode_utf32be(s: s... | [
"struct.Struct"
] | [((52, 71), 'struct.Struct', 'struct.Struct', (['"""<I"""'], {}), "('<I')\n", (65, 71), False, 'import struct\n'), ((84, 103), 'struct.Struct', 'struct.Struct', (['""">I"""'], {}), "('>I')\n", (97, 103), False, 'import struct\n')] |
from collections import defaultdict
from typing import List, Dict
import torch
from torch import nn
from torch.nn import functional as F
import math
from detectron2.layers import ShapeSpec, NaiveSyncBatchNorm
from adet.modeling.nlos_converter.build import NLOS_CONVERTER_REGISTRY
from adet.layers import DFConv2d, Naive... | [
"torch.nn.GroupNorm",
"torch.nn.init.constant_",
"torch.nn.Sequential",
"torch.nn.init.xavier_uniform_",
"detectron2.layers.ShapeSpec",
"torch.nn.Conv2d",
"adet.layers.NaiveGroupNorm",
"torch.nn.init.normal_",
"torch.arange",
"torch.nn.Linear",
"adet.modeling.nlos_converter.build.NLOS_CONVERTER_... | [((378, 412), 'adet.modeling.nlos_converter.build.NLOS_CONVERTER_REGISTRY.register', 'NLOS_CONVERTER_REGISTRY.register', ([], {}), '()\n', (410, 412), False, 'from adet.modeling.nlos_converter.build import NLOS_CONVERTER_REGISTRY\n'), ((3875, 3909), 'adet.modeling.nlos_converter.build.NLOS_CONVERTER_REGISTRY.register',... |
from oso import Oso
from flask_oso import FlaskOso
from document import Document
import user
from user import User
def init_oso(app):
""" set up the `Oso` and `FlaskOso` objects, and add them to the global `app` instance."""
oso = Oso()
oso.register_class(Document)
oso.register_class(User)
oso.lo... | [
"oso.Oso",
"flask_oso.FlaskOso"
] | [((242, 247), 'oso.Oso', 'Oso', ([], {}), '()\n', (245, 247), False, 'from oso import Oso\n'), ((368, 394), 'flask_oso.FlaskOso', 'FlaskOso', ([], {'app': 'app', 'oso': 'oso'}), '(app=app, oso=oso)\n', (376, 394), False, 'from flask_oso import FlaskOso\n')] |
import json
import os
from enum import Enum
from typing import List
import numpy as np
import pandas
from keras.models import Sequential
from keras.layers import LSTM, Dense, RepeatVector, TimeDistributed, Activation
from matplotlib import gridspec as grid
from matplotlib import pylab as plt
from sklearn.metrics impor... | [
"numpy.convolve",
"numpy.random.rand",
"pandas.read_csv",
"numpy.array",
"matplotlib.pylab.show",
"keras.layers.Activation",
"keras.layers.Dense",
"numpy.arange",
"numpy.atleast_2d",
"matplotlib.pylab.figure",
"matplotlib.pylab.legend",
"numpy.exp",
"keras.layers.LSTM",
"numpy.linspace",
... | [((1093, 1113), 'json.load', 'json.load', (['json_file'], {}), '(json_file)\n', (1102, 1113), False, 'import json\n'), ((3962, 3974), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (3972, 3974), False, 'from keras.models import Sequential\n'), ((4789, 4837), 'matplotlib.pylab.plot', 'plt.plot', (["history.h... |
import math
import random
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable
from memory_replay import Transition
use_cuda = torch.cuda.is_available()
FloatTensor = torch.cuda.FloatTensor if use_cuda else torch.FloatTensor
LongTensor = to... | [
"torch.nn.BatchNorm2d",
"torch.nn.functional.mse_loss",
"random.randrange",
"torch.nn.Conv2d",
"torch.cuda.is_available",
"torch.nn.Linear",
"random.random",
"torch.autograd.Variable",
"torch.zeros",
"torch.cat",
"math.exp"
] | [((206, 231), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (229, 231), False, 'import torch\n'), ((2168, 2183), 'random.random', 'random.random', ([], {}), '()\n', (2181, 2183), False, 'import random\n'), ((4359, 4420), 'torch.nn.functional.mse_loss', 'F.mse_loss', (['state_action_values', 'e... |
import os
import sys
sys.path.append("../../../monk/");
import psutil
from keras_prototype import prototype
ktf = prototype(verbose=1);
ktf.Prototype("sample-project-1", "sample-experiment-1");
ktf.Default(dataset_path="../../../monk/system_check_tests/datasets/dataset_cats_dogs_train",
model_name="resnet... | [
"keras_prototype.prototype",
"sys.path.append"
] | [((21, 54), 'sys.path.append', 'sys.path.append', (['"""../../../monk/"""'], {}), "('../../../monk/')\n", (36, 54), False, 'import sys\n'), ((118, 138), 'keras_prototype.prototype', 'prototype', ([], {'verbose': '(1)'}), '(verbose=1)\n', (127, 138), False, 'from keras_prototype import prototype\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 3 19:30:35 2019
@author: yangyutu123
"""
import torch
# We need to set requires_grad=True in order to get gradient with respect to x
x = torch.ones(2,2, requires_grad=True)
# construct function y as function of tensor x
y = torch.sum(torch.mm(x.t... | [
"torch.randn",
"torch.ones"
] | [((211, 247), 'torch.ones', 'torch.ones', (['(2)', '(2)'], {'requires_grad': '(True)'}), '(2, 2, requires_grad=True)\n', (221, 247), False, 'import torch\n'), ((634, 671), 'torch.randn', 'torch.randn', (['(2)', '(2)'], {'requires_grad': '(True)'}), '(2, 2, requires_grad=True)\n', (645, 671), False, 'import torch\n')] |
# Copyright (c) 2018 Intel Corp. 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... | [
"vnfsdk_pkgtools.packager.manifest.Manifest",
"os.path.dirname",
"pytest.raises",
"os.path.basename",
"os.unlink"
] | [((3740, 3779), 'vnfsdk_pkgtools.packager.manifest.Manifest', 'manifest.Manifest', (['p.dirname', '"""test.mf"""'], {}), "(p.dirname, 'test.mf')\n", (3757, 3779), False, 'from vnfsdk_pkgtools.packager import manifest\n'), ((4161, 4200), 'vnfsdk_pkgtools.packager.manifest.Manifest', 'manifest.Manifest', (['p.dirname', '... |