code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
#!/usr/bin/env python3
from setuptools import setup, find_packages
# configure the setup to install from specific repos and users
DESC = 'memscrimper_parser'
setup(name='memscrimper-parser',
version='1.0',
description=DESC,
author='<NAME>',
author_email='<EMAIL>',
install_requires=[],
... | [
"setuptools.find_packages"
] | [((332, 352), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (345, 352), False, 'from setuptools import setup, find_packages\n')] |
import requests
from django.utils import timezone
file_token = open('token.txt', 'r')
token = file_token.readline()
file_key = open('key.txt', 'r')
key = file_key.readline()
board_id = '5bdb65794ac71e0cc84ec17b'
api_url = 'https://api.trello.com/1'
smtp_host = 'br84.hostgator.com.br'
smtp_port = 26
# board labels
... | [
"requests.post",
"requests.delete",
"requests.get"
] | [((2689, 2726), 'requests.get', 'requests.get', (['url'], {'params': 'querystring'}), '(url, params=querystring)\n', (2701, 2726), False, 'import requests\n'), ((2921, 2959), 'requests.post', 'requests.post', (['url'], {'params': 'querystring'}), '(url, params=querystring)\n', (2934, 2959), False, 'import requests\n'),... |
import cv2
img_path = input("Enter image path: ")
file_name = input("Enter file name(with converting extension example: my_file_name.png or my_file_name.jpg): ")
try:
img = cv2.imread(img_path, -1)
except Exception as error:
print(error)
print("image path is wrong")
input()
print("convert... | [
"cv2.imread",
"cv2.imwrite"
] | [((185, 209), 'cv2.imread', 'cv2.imread', (['img_path', '(-1)'], {}), '(img_path, -1)\n', (195, 209), False, 'import cv2\n'), ((340, 380), 'cv2.imwrite', 'cv2.imwrite', ([], {'filename': 'file_name', 'img': 'img'}), '(filename=file_name, img=img)\n', (351, 380), False, 'import cv2\n')] |
# -*- coding: utf-8 -*-
import base
from ecl.network import network_service
from ecl import resource2
class ColocationSpace(base.NetworkBaseResource):
resource_key = 'colocation_space'
resources_key = 'colocation_spaces'
service = network_service.NetworkService("v2.0")
base_path = '/' + service.versi... | [
"ecl.resource2.Body",
"ecl.resource2.QueryParameters",
"ecl.network.network_service.NetworkService"
] | [((246, 284), 'ecl.network.network_service.NetworkService', 'network_service.NetworkService', (['"""v2.0"""'], {}), "('v2.0')\n", (276, 284), False, 'from ecl.network import network_service\n'), ((452, 530), 'ecl.resource2.QueryParameters', 'resource2.QueryParameters', (['"""description"""', '"""id"""', '"""name"""', '... |
import logging
import urllib.parse
from dockermake.utils.helpers import System
def get_gitsha1_hash_of_head():
cmd = ["git", "rev-parse", "--short=8", "HEAD"]
out, _, _ = System.run_command(cmd, fail_on_bad_return_code=False)
return out
def get_git_remote_origin_url():
cmd = ["git", "config", "--ge... | [
"dockermake.utils.helpers.System.run_command",
"logging.debug"
] | [((182, 236), 'dockermake.utils.helpers.System.run_command', 'System.run_command', (['cmd'], {'fail_on_bad_return_code': '(False)'}), '(cmd, fail_on_bad_return_code=False)\n', (200, 236), False, 'from dockermake.utils.helpers import System\n'), ((361, 415), 'dockermake.utils.helpers.System.run_command', 'System.run_com... |
# -*- coding: utf-8 -*-
"""
evaluation related module
__author__ = 'Jamie (<EMAIL>)'
__copyright__ = 'Copyright (C) 2019-, Kakao Corp. All rights reserved.'
"""
###########
# imports #
###########
from collections import Counter
import logging
from typing import List, TextIO, Tuple
from khaiii.train.sentence impor... | [
"collections.Counter"
] | [((474, 483), 'collections.Counter', 'Counter', ([], {}), '()\n', (481, 483), False, 'from collections import Counter\n'), ((3202, 3261), 'collections.Counter', 'Counter', (['[(morph.morph, morph.pos_tag) for morph in morphs]'], {}), '([(morph.morph, morph.pos_tag) for morph in morphs])\n', (3209, 3261), False, 'from c... |
from pyetherscan import Address
from dynaconf import settings
class WatchDog(object):
def get_available_volume(self, coin, market):
market_ico_address = settings[market].get("ICO_ADDRESS")
address = Address(market_ico_address)
contract_address = settings["CONTRACTS"].get(coin)
ret... | [
"pyetherscan.Address"
] | [((221, 248), 'pyetherscan.Address', 'Address', (['market_ico_address'], {}), '(market_ico_address)\n', (228, 248), False, 'from pyetherscan import Address\n')] |
from easydict import EasyDict
cfg = EasyDict()
cfg.stride = 8.0
cfg.weigh_part_predictions = False
cfg.weigh_negatives = False
cfg.fg_fraction = 0.25
cfg.weigh_only_present_joints = False
cfg.mean_pixel = [123.68, 116.779, 103.939]
cfg.shuffle = True
cfg.snapshot_prefix = "snapshot"
cfg.log_dir = "log"
cfg.global_sca... | [
"easydict.EasyDict"
] | [((37, 47), 'easydict.EasyDict', 'EasyDict', ([], {}), '()\n', (45, 47), False, 'from easydict import EasyDict\n')] |
"""
Data handling classes
Author: <NAME>
Email: <EMAIL> | <EMAIL>
"""
import os
import torch
import numpy as np
import random
from PIL import Image
from collections import OrderedDict
from torchvision.transforms.transforms import *
from torch.utils.data.dataloader import *
from torch.utils.data.dataset import *
def... | [
"os.path.join",
"torch.stack",
"PIL.Image.open"
] | [((9642, 9670), 'torch.stack', 'torch.stack', (['sequence'], {'dim': '(0)'}), '(sequence, dim=0)\n', (9653, 9670), False, 'import torch\n'), ((6315, 6379), 'os.path.join', 'os.path.join', (['self.parent_dir', "self.packed_data['data'][data_id]"], {}), "(self.parent_dir, self.packed_data['data'][data_id])\n", (6327, 637... |
import numpy as np
import matplotlib.pyplot as plt
from sklearn import linear_model
data_full = [[ 0., 10., 20., 30., 40., 50., 60., 70., 80., 90., 100., 110., 120., 130.,
140., 150., 160., 170., 180., 190., 200., 210., 220., 230., 240., 250., 260., 270.,
280., 290., 300., ... | [
"matplotlib.pyplot.show",
"numpy.concatenate",
"matplotlib.pyplot.plot",
"numpy.abs",
"matplotlib.pyplot.legend",
"numpy.expand_dims",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"sklearn.linear_model.Lasso"
] | [((1223, 1242), 'numpy.array', 'np.array', (['data_full'], {}), '(data_full)\n', (1231, 1242), True, 'import numpy as np\n'), ((1290, 1323), 'numpy.expand_dims', 'np.expand_dims', (['arr[0, :]'], {'axis': '(1)'}), '(arr[0, :], axis=1)\n', (1304, 1323), True, 'import numpy as np\n'), ((1371, 1404), 'numpy.expand_dims', ... |
#!/usr/bin/env python
from setuptools import (find_packages, setup)
import os
HERE = os.path.abspath(os.path.dirname(__file__))
version = {}
with open(os.path.join(HERE, 'xtp_job_control', '__version__.py')) as f:
exec(f.read(), version)
def readme():
with open('README.md') as f:
return f.read()
se... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((102, 127), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (117, 127), False, 'import os\n'), ((152, 207), 'os.path.join', 'os.path.join', (['HERE', '"""xtp_job_control"""', '"""__version__.py"""'], {}), "(HERE, 'xtp_job_control', '__version__.py')\n", (164, 207), False, 'import os\n'), ((7... |
import torch
from torch.optim import SGD
torch.manual_seed(1)
def get_sgd_optimizer(model, lr, momentum=0, weight_decay=0):
return SGD(model.parameters(), lr=lr, momentum=momentum, weight_decay=weight_decay, nesterov=True)
| [
"torch.manual_seed"
] | [((43, 63), 'torch.manual_seed', 'torch.manual_seed', (['(1)'], {}), '(1)\n', (60, 63), False, 'import torch\n')] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib import messages
from .helpers import generate_key
from .models import APIKey
class ApiKeyAdmin(admin.ModelAdmin):
"""
Clase para administrar las API Keys de la plataforma
"""
list_displa... | [
"django.contrib.admin.site.register",
"django.contrib.messages.add_message"
] | [((1087, 1127), 'django.contrib.admin.site.register', 'admin.site.register', (['APIKey', 'ApiKeyAdmin'], {}), '(APIKey, ApiKeyAdmin)\n', (1106, 1127), False, 'from django.contrib import admin\n'), ((967, 1069), 'django.contrib.messages.add_message', 'messages.add_message', (['request', 'messages.WARNING', "('The API Ke... |
from conans import ConanFile, tools
from conans.errors import ConanInvalidConfiguration
import os
class Sol2Conan(ConanFile):
name = "sol2"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/ThePhD/sol2"
description = "C++17 Lua bindings"
topics = ("conan", "lua"... | [
"conans.tools.get",
"os.rename",
"conans.tools.Version",
"conans.tools.check_min_cppstd",
"os.path.join"
] | [((1621, 1674), 'conans.tools.get', 'tools.get', ([], {}), "(**self.conan_data['sources'][self.version])\n", (1630, 1674), False, 'from conans import ConanFile, tools\n'), ((1738, 1786), 'os.rename', 'os.rename', (['extracted_dir', 'self._source_subfolder'], {}), '(extracted_dir, self._source_subfolder)\n', (1747, 1786... |
import numpy as np
def im2col(input_data, filter_h, filter_w, stride, pad):
"""
(function) im2col
-----------------
- Convert the shape of the data from image to column
Parameter
---------
- input_data : input data
- filter_h : filter height
- filter_w : filter width
- stride :... | [
"numpy.pad",
"numpy.zeros"
] | [((660, 732), 'numpy.pad', 'np.pad', (['input_data', '[(0, 0), (0, 0), (pad, pad), (pad, pad)]', '"""constant"""'], {}), "(input_data, [(0, 0), (0, 0), (pad, pad), (pad, pad)], 'constant')\n", (666, 732), True, 'import numpy as np\n'), ((743, 793), 'numpy.zeros', 'np.zeros', (['(N, C, filter_h, filter_w, out_h, out_w)'... |
"""
Interface for interacting with StormLock backends.
Classes:
Backend
LockHeldException
LockExpiredException
Lease
Functions:
get_backend
find_backend
"""
from abc import ABC, abstractmethod
from datetime import datetime, timedelta
from importlib import metadata
from typing import NamedTuple... | [
"importlib.metadata.entry_points"
] | [((6044, 6067), 'importlib.metadata.entry_points', 'metadata.entry_points', ([], {}), '()\n', (6065, 6067), False, 'from importlib import metadata\n')] |
# SPDX-License-Identifier: Apache-2.0-only
# Copyright (c) 2019-2022 @bhaskar792
import argparse
import os
import json
class arg_parser:
def __init__(self):
self.set_args()
self.parse_args()
def set_args(self):
self.parser = argparse.ArgumentParser()
self.parser.add_argument... | [
"json.load",
"os.system",
"argparse.ArgumentParser"
] | [((702, 766), 'os.system', 'os.system', (['f"""{tshark_path} -r {pcap_path} -T json > tshark.json"""'], {}), "(f'{tshark_path} -r {pcap_path} -T json > tshark.json')\n", (711, 766), False, 'import os\n'), ((767, 822), 'os.system', 'os.system', (['f"""{tshark_path} -r {pcap_path} > tshark.txt"""'], {}), "(f'{tshark_path... |
# Copyright 2022, <NAME>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing... | [
"onnxruntime.InferenceSession",
"transformers.AutoTokenizer.from_pretrained",
"onnxruntime.SessionOptions",
"fastapi.FastAPI"
] | [((784, 793), 'fastapi.FastAPI', 'FastAPI', ([], {}), '()\n', (791, 793), False, 'from fastapi import FastAPI\n'), ((804, 820), 'onnxruntime.SessionOptions', 'SessionOptions', ([], {}), '()\n', (818, 820), False, 'from onnxruntime import GraphOptimizationLevel, InferenceSession, SessionOptions\n'), ((902, 997), 'onnxru... |
from setuptools import setup
setup(
name='msslib',
version='0.1.0',
url='https://github.com/boothmanrylan/msslib/',
description='A python port of Justin Braatens msslib: '
'https://github.com/gee-community/msslib',
author='<NAME>',
author_email='<EMAIL>',
packages=['msslib']... | [
"setuptools.setup"
] | [((30, 351), 'setuptools.setup', 'setup', ([], {'name': '"""msslib"""', 'version': '"""0.1.0"""', 'url': '"""https://github.com/boothmanrylan/msslib/"""', 'description': '"""A python port of Justin Braatens msslib: https://github.com/gee-community/msslib"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', '... |
# -*- coding: utf-8 -*-
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.slider import Slider
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.graphics.texture import Texture
from kivy.clock import Clock
import cv2
class CvCam... | [
"kivy.uix.slider.Slider",
"kivy.graphics.texture.Texture.create",
"kivy.uix.image.Image",
"kivy.uix.button.Button",
"cv2.VideoCapture",
"kivy.uix.boxlayout.BoxLayout",
"kivy.uix.label.Label",
"kivy.clock.Clock.schedule_interval",
"cv2.flip"
] | [((379, 398), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (395, 398), False, 'import cv2\n'), ((527, 657), 'kivy.uix.button.Button', 'Button', ([], {'text': '"""ボタン"""', 'size_hint': '(1.0, 0.1)', 'font_name': '"""/usr/local/texlive/texmf-local/fonts/truetype/cjk-gs-integrate/ipag.ttf"""'}), "(text=... |
"""
Source: https://github.com/yanxinzju/CSS-VQA/blob/0e2bfa68232f346adc9ad61e90e97ee38ad59f96/language_model.py#L31
"""
import torch
import torch.nn as nn
import numpy as np
from torch.autograd import Variable
from torch.nn.utils.weight_norm import weight_norm
__all__ = ['WordEmbedding', 'QuestionEmbedding', 'FCNet'... | [
"torch.nn.Dropout",
"numpy.load",
"torch.nn.ReLU",
"torch.nn.Sequential",
"torch.nn.Embedding",
"torch.cat",
"torch.nn.Linear"
] | [((615, 668), 'torch.nn.Embedding', 'nn.Embedding', (['(ntoken + 1)', 'emb_dim'], {'padding_idx': 'ntoken'}), '(ntoken + 1, emb_dim, padding_idx=ntoken)\n', (627, 668), True, 'import torch.nn as nn\n'), ((690, 709), 'torch.nn.Dropout', 'nn.Dropout', (['dropout'], {}), '(dropout)\n', (700, 709), True, 'import torch.nn a... |
import collections
import math
from heapq import heappush, heappop
from .geometry import LineSegment
max_distance_for_neighbors_in_different_trajectories = 1
class FilteredTrajectory:
def __init__(self, trajectory, id):
self.id = id
self.trajectory = trajectory
class FilteredTrajectoryConnecti... | [
"math.pow",
"heapq.heappush",
"collections.deque",
"heapq.heappop"
] | [((3455, 3474), 'collections.deque', 'collections.deque', ([], {}), '()\n', (3472, 3474), False, 'import collections\n'), ((5128, 5177), 'heapq.heappush', 'heappush', (['priority_queue', '(0.0, start_node_index)'], {}), '(priority_queue, (0.0, start_node_index))\n', (5136, 5177), False, 'from heapq import heappush, hea... |
"""Utils for the test_runner module."""
import os
import types
from golem.core import utils
def import_page_into_test_module(base_path, parent_module, page_path_list):
"""Import a page module into a (test) module provided
the relative dot path to the page.
"""
if len(page_path_list) > 1:
new_... | [
"types.ModuleType",
"golem.core.utils.import_module",
"os.path.join"
] | [((624, 662), 'os.path.join', 'os.path.join', (['base_path', 'new_node_name'], {}), '(base_path, new_node_name)\n', (636, 662), False, 'import os\n'), ((835, 885), 'os.path.join', 'os.path.join', (['base_path', "(page_path_list[0] + '.py')"], {}), "(base_path, page_path_list[0] + '.py')\n", (847, 885), False, 'import o... |
from webdav4.client import Client
from webdav4.client import ResourceAlreadyExists
import configparser
import BingImage_AutoDownloader
from os import remove
import ConsoleLog
import sys
log = ConsoleLog.ConsoleLog(
'C:\\Users\\Administrator\\desktop\\BingImage_Log\\', 'BingImage_AutoDownloader')
# 实例化... | [
"os.remove",
"webdav4.client.Client",
"sys._getframe",
"BingImage_AutoDownloader.GetImage",
"configparser.ConfigParser",
"ConsoleLog.ConsoleLog"
] | [((201, 308), 'ConsoleLog.ConsoleLog', 'ConsoleLog.ConsoleLog', (['"""C:\\\\Users\\\\Administrator\\\\desktop\\\\BingImage_Log\\\\"""', '"""BingImage_AutoDownloader"""'], {}), "('C:\\\\Users\\\\Administrator\\\\desktop\\\\BingImage_Log\\\\',\n 'BingImage_AutoDownloader')\n", (222, 308), False, 'import ConsoleLog\n')... |
"""Tests for Ralph ldp storage backend"""
import datetime
import gzip
import json
import os.path
import sys
import uuid
from collections.abc import Iterable
from io import BytesIO
from pathlib import Path, PurePath
from urllib.parse import urlparse
import ovh
import pytest
import requests
from ralph.backends.storage... | [
"io.BytesIO",
"gzip.open",
"json.dumps",
"pytest.raises",
"pathlib.Path",
"uuid.UUID",
"ralph.backends.storage.ldp.LDPStorage",
"datetime.datetime.now",
"urllib.parse.urlparse"
] | [((666, 794), 'ralph.backends.storage.ldp.LDPStorage', 'LDPStorage', ([], {'endpoint': '"""ovh-eu"""', 'application_key': '"""fake_key"""', 'application_secret': '"""fake_secret"""', 'consumer_key': '"""another_fake_key"""'}), "(endpoint='ovh-eu', application_key='fake_key',\n application_secret='fake_secret', consu... |
# test_771.py
import unittest
from jewels_and_stones_771 import j_and_s_3
class jewels_and_stones_test(unittest.TestCase):
def test_j_and_s1(self):
self.assertTrue(j_and_s_3("aA", "aAAbbbb") == 3)
def test_j_and_s2(self):
self.assertTrue(j_and_s_3("z", "ZZ") == 0)
def test_j_and_s_empty... | [
"unittest.main",
"jewels_and_stones_771.j_and_s_3"
] | [((497, 512), 'unittest.main', 'unittest.main', ([], {}), '()\n', (510, 512), False, 'import unittest\n'), ((179, 205), 'jewels_and_stones_771.j_and_s_3', 'j_and_s_3', (['"""aA"""', '"""aAAbbbb"""'], {}), "('aA', 'aAAbbbb')\n", (188, 205), False, 'from jewels_and_stones_771 import j_and_s_3\n'), ((266, 286), 'jewels_an... |
import requests
import urlparse
from bs4 import BeautifulSoup
from django.contrib.auth.models import User
from django.db import models
from taggit.managers import TaggableManager
class Link(models.Model):
title = models.CharField(max_length=255)
url = models.URLField('URL', max_length=255)
count = model... | [
"django.db.models.URLField",
"django.db.models.TextField",
"urlparse.urlsplit",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"taggit.managers.TaggableManager",
"requests.get",
"bs4.BeautifulSoup",
"django.db.models.DateTimeField"
] | [((221, 253), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (237, 253), False, 'from django.db import models\n'), ((264, 302), 'django.db.models.URLField', 'models.URLField', (['"""URL"""'], {'max_length': '(255)'}), "('URL', max_length=255)\n", (279, 302), False... |
# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-10 21:11
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('choicapp', '0005_auto_20160410_2102'),
]
operations = [
migrations.RenameField(
... | [
"django.db.migrations.RenameField"
] | [((292, 380), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""item"""', 'old_name': '"""visibility"""', 'new_name': '"""points"""'}), "(model_name='item', old_name='visibility', new_name=\n 'points')\n", (314, 380), False, 'from django.db import migrations\n')] |
"""
GatewayValidationService
"""
from waves_gateway.model import KeyPair
from .address_validation_service import AddressValidationService
from waves_gateway.common import Injectable, InvalidConfigError, CUSTOM_CURRENCY_NAME, GATEWAY_OWNER_ADDRESS, \
GATEWAY_COIN_ADDRESS_SECRET, GATEWAY_WAVES_ADDRESS_SECRET
from .w... | [
"waves_gateway.common.Injectable",
"waves_gateway.common.InvalidConfigError"
] | [((443, 636), 'waves_gateway.common.Injectable', 'Injectable', ([], {'deps': '[WavesAddressValidationService, COIN_ADDRESS_VALIDATION_SERVICE,\n GATEWAY_WAVES_ADDRESS_SECRET, GATEWAY_OWNER_ADDRESS,\n CUSTOM_CURRENCY_NAME, GATEWAY_COIN_ADDRESS_SECRET]'}), '(deps=[WavesAddressValidationService,\n COIN_ADDRESS_VA... |
##############################################################################
#
# Copyright (c) 2005 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS I... | [
"Products.CMFActionIcons.exportimport.importActionIconsTool",
"Products.CMFActionIcons.exportimport.exportActionIconsTool",
"zope.component.getSiteManager",
"unittest.makeSuite",
"Products.GenericSetup.tests.common.DummyExportContext",
"Products.CMFActionIcons.ActionIconsTool.ActionIconsTool",
"OFS.Fold... | [((2381, 2407), 'Products.CMFCore.tests.base.utils._setUpDefaultTraversable', '_setUpDefaultTraversable', ([], {}), '()\n', (2405, 2407), False, 'from Products.CMFCore.tests.base.utils import _setUpDefaultTraversable\n'), ((2434, 2451), 'OFS.Folder.Folder', 'Folder', ([], {'id': '"""site"""'}), "(id='site')\n", (2440, ... |
"""
When running this code with pycharm:
- Edit configurations...
- check the checkbox Emulate terminal in output console
"""
"""
images of gauge:
Copyright (C) 2018 FireEye, Inc., created by <NAME>. All Rights Reserved.
"""
import datetime
import tkinter
import pyglet
pyglet.options['audio'] = ('openal', 'pulse')
im... | [
"pickle.dump",
"pyglet.media.Player",
"os.makedirs",
"tkinter.Canvas",
"argparse.ArgumentParser",
"os.path.basename",
"random.shuffle",
"pyglet.media.load",
"datetime.datetime.now",
"PIL.Image.open",
"pickle.load",
"random.seed",
"music21.converter.parse",
"os.path.join",
"tkinter.Tk"
] | [((1803, 1850), 'os.path.join', 'os.path.join', (['"""resources"""', '"""standard_heads_mp3"""'], {}), "('resources', 'standard_heads_mp3')\n", (1815, 1850), False, 'import os\n'), ((1881, 1934), 'os.path.join', 'os.path.join', (['standard_head_mp3_dir', '"""Blue_bossa.mp3"""'], {}), "(standard_head_mp3_dir, 'Blue_boss... |
"""
# Made by <NAME> , January 2020
# Contact at : <EMAIL>
# GitHub : https://github.com/Whole-Brain
"""
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import re
class ColumnInfos:
"""
Each column of the pandas DataFrame is a object that holds its own infos and advices.
"""
... | [
"pandas.to_datetime",
"pandas.isnull"
] | [((14498, 14520), 'pandas.to_datetime', 'pd.to_datetime', (['sample'], {}), '(sample)\n', (14512, 14520), True, 'import pandas as pd\n'), ((2359, 2378), 'pandas.to_datetime', 'pd.to_datetime', (['col'], {}), '(col)\n', (2373, 2378), True, 'import pandas as pd\n'), ((8928, 8949), 'pandas.isnull', 'pd.isnull', (['corr_va... |
from validate_config import validate
from exp_templates import (common_trial_params, common_early_exit, run_template)
from relay_util import cnn_setup, cnn_trial, cnn_teardown
if __name__ == '__main__':
run_template(validate_config=validate,
check_early_exit=common_early_exit({'frameworks': 'relay... | [
"exp_templates.common_trial_params",
"exp_templates.common_early_exit"
] | [((281, 323), 'exp_templates.common_early_exit', 'common_early_exit', (["{'frameworks': 'relay'}"], {}), "({'frameworks': 'relay'})\n", (298, 323), False, 'from exp_templates import common_trial_params, common_early_exit, run_template\n'), ((359, 546), 'exp_templates.common_trial_params', 'common_trial_params', (['"""r... |
import InputReader
import re
def main():
found = []
for line in InputReader.readInputFileLines(5):
line = re.sub("[FL]", "0", re.sub("[BR]", "1", line))
found.append(int(line, 2))
found.sort()
print(f"Highest found seat id is {found[-1]}.")
last = 0
for seat in found:
... | [
"InputReader.readInputFileLines",
"re.sub"
] | [((74, 107), 'InputReader.readInputFileLines', 'InputReader.readInputFileLines', (['(5)'], {}), '(5)\n', (104, 107), False, 'import InputReader\n'), ((144, 169), 're.sub', 're.sub', (['"""[BR]"""', '"""1"""', 'line'], {}), "('[BR]', '1', line)\n", (150, 169), False, 'import re\n')] |
from mail_handlers.base_handler import BaseHandler
import requests
import os
class MailgunHandler(BaseHandler):
def __init__(self):
self._api_key = os.environ.get('MAILGUN')
self._domain_name = os.environ.get('DOMAIN')
self._request_url = f'https://api.mailgun.net/v3/{self._domain_name}/m... | [
"os.environ.get",
"requests.post"
] | [((163, 188), 'os.environ.get', 'os.environ.get', (['"""MAILGUN"""'], {}), "('MAILGUN')\n", (177, 188), False, 'import os\n'), ((217, 241), 'os.environ.get', 'os.environ.get', (['"""DOMAIN"""'], {}), "('DOMAIN')\n", (231, 241), False, 'import os\n'), ((1019, 1104), 'requests.post', 'requests.post', (['self._request_url... |
import pysnowball as ball
import time
import os
import datetime
import sys
import pandas as pd
dir_path = os.path.dirname(os.path.abspath(__file__))
cal = str(datetime.date.today().strftime('%m%d'))
print(cal)
# with open('./testdata/stock/attention.txt', 'r') as file_object:
# stock_list = file_object.readlines()... | [
"os.path.abspath",
"pysnowball.private_packet",
"datetime.date.today",
"pysnowball.private_pick",
"time.sleep"
] | [((122, 147), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (137, 147), False, 'import os\n'), ((704, 729), 'pysnowball.private_pick', 'ball.private_pick', (['symbol'], {}), '(symbol)\n', (721, 729), True, 'import pysnowball as ball\n'), ((734, 799), 'pysnowball.private_packet', 'ball.privat... |
#!/usr/bin/env python
# -*- coding:UTF-8 -*-
# File Name : preprocess.py
# Purpose :
# Creation Date : 10-12-2017
# Last Modified : Thu 18 Jan 2018 05:34:42 PM CST
# Created By : <NAME> [jeasinema[at]gmail[dot]com]
import os
import multiprocessing
import numpy as np
from config import cfg
data_dir = 'velodyne'
def... | [
"numpy.random.shuffle",
"numpy.logical_and",
"numpy.floor",
"numpy.zeros",
"numpy.array",
"os.path.splitext",
"numpy.array_split",
"multiprocessing.Process",
"os.path.join",
"os.listdir",
"numpy.unique"
] | [((1029, 1059), 'numpy.random.shuffle', 'np.random.shuffle', (['point_cloud'], {}), '(point_cloud)\n', (1046, 1059), True, 'import numpy as np\n'), ((1281, 1353), 'numpy.logical_and', 'np.logical_and', (['(voxel_index[:, 2] >= 0)', '(voxel_index[:, 2] < grid_size[2])'], {}), '(voxel_index[:, 2] >= 0, voxel_index[:, 2] ... |
from setuptools import setup
setup(name='py_meteo_suisse',
version='0.1',
description='Get weather forecast in Switzerland',
url='http://github.com/matthieuharbich/py_meteo_suisse',
author='<NAME>',
author_email='<EMAIL>',
license='MIT',
packages=['py_meteo_suisse'],
zip... | [
"setuptools.setup"
] | [((30, 302), 'setuptools.setup', 'setup', ([], {'name': '"""py_meteo_suisse"""', 'version': '"""0.1"""', 'description': '"""Get weather forecast in Switzerland"""', 'url': '"""http://github.com/matthieuharbich/py_meteo_suisse"""', 'author': '"""<NAME>"""', 'author_email': '"""<EMAIL>"""', 'license': '"""MIT"""', 'packa... |
from __future__ import print_function
import json
import time
import types
from django.http.response import HttpResponse, HttpResponseNotFound
from django import VERSION
if VERSION[:2] == (1, 9):
MiddlewareMixin = object
else:
from django.utils.deprecation import MiddlewareMixin
from . import exceptions # n... | [
"django.http.response.HttpResponseNotFound",
"types.MethodType",
"json.loads",
"time.time"
] | [((1887, 1927), 'types.MethodType', 'types.MethodType', (['record_timing', 'request'], {}), '(record_timing, request)\n', (1903, 1927), False, 'import types\n'), ((2265, 2289), 'json.loads', 'json.loads', (['request.body'], {}), '(request.body)\n', (2275, 2289), False, 'import json\n'), ((867, 906), 'django.http.respon... |
import torchvision.transforms as transforms
class data_transform:
def __init__(self):
self.model_pretrain_params = {}
self.model_pretrain_params['input_size'] = [3, 224, 224]
self.model_pretrain_params['mean'] = [0.485, 0.456, 0.406]
self.model_pretrain_params['std'] = [0.229, 0.224... | [
"torchvision.transforms.CenterCrop",
"torchvision.transforms.Normalize",
"torchvision.transforms.ToTensor",
"torchvision.transforms.Resize"
] | [((464, 498), 'torchvision.transforms.Resize', 'transforms.Resize', (['self.resize_dim'], {}), '(self.resize_dim)\n', (481, 498), True, 'import torchvision.transforms as transforms\n'), ((536, 604), 'torchvision.transforms.CenterCrop', 'transforms.CenterCrop', (["self.model_pretrain_params['input_size'][1:3]"], {}), "(... |
from typing import Dict
import numpy as np
import math
import cv2
from nxs_types.model import NxsModel
class AttrDict(dict):
__getattr__ = dict.__getitem__
__setattr__ = dict.__setitem__
class Config:
search_size = 255
exemplar_size = 127
base_size = 8
stride = 8
score_size = (search_si... | [
"numpy.stack",
"numpy.sum",
"numpy.maximum",
"math.sqrt",
"numpy.argmax",
"numpy.zeros",
"numpy.expand_dims",
"numpy.transpose",
"numpy.amax",
"numpy.max",
"numpy.array",
"numpy.exp",
"numpy.tile",
"numpy.hanning",
"numpy.sqrt"
] | [((712, 760), 'numpy.zeros', 'np.zeros', (['(cfg.num_anchors, 4)'], {'dtype': 'np.float32'}), '((cfg.num_anchors, 4), dtype=np.float32)\n', (720, 760), True, 'import numpy as np\n'), ((1211, 1276), 'numpy.stack', 'np.stack', (['[(x1 + x2) * 0.5, (y1 + y2) * 0.5, x2 - x1, y2 - y1]', '(1)'], {}), '([(x1 + x2) * 0.5, (y1 ... |
from importlib import import_module as _import_module
import logging
import glob
import os.path
from .core.base_spider import BaseSpider
__all__ = [
'import_module', 'logger', 'import_spiders', 'middleware',
'before_push_request', 'before_request', 'after_request', 'make_spider'
]
logger = logging.getLogger('... | [
"importlib.import_module",
"logging.getLogger"
] | [((301, 327), 'logging.getLogger', 'logging.getLogger', (['"""grapy"""'], {}), "('grapy')\n", (318, 327), False, 'import logging\n'), ((527, 560), 'importlib.import_module', '_import_module', (['module_name[:idx]'], {}), '(module_name[:idx])\n', (541, 560), True, 'from importlib import import_module as _import_module\n... |
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Profile(models.Model):
'''
The Profile Model inherits from the User model
from from django.contrib.auth.models
'''
user = models.OneToOneField(User, on_delete = models.CASCADE)
profile_pho... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.ImageField",
"django.db.models.DateTimeField"
] | [((250, 302), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE'}), '(User, on_delete=models.CASCADE)\n', (270, 302), False, 'from django.db import models\n'), ((325, 392), 'django.db.models.ImageField', 'models.ImageField', ([], {'default': '"""default.jpg"""', 'upload_... |
""" Vista de Viajes"""
# Django REST Framework
from rest_framework import mixins, viewsets, status
from rest_framework.generics import get_object_or_404
from rest_framework.decorators import action
from rest_framework.response import Response
# Filters
from rest_framework.filters import SearchFilter, OrderingFilter
... | [
"django.utils.timezone.now",
"cride.rides.serializers.RideModelSerializer",
"rest_framework.response.Response",
"rest_framework.decorators.action",
"datetime.timedelta",
"rest_framework.generics.get_object_or_404"
] | [((4298, 4335), 'rest_framework.decorators.action', 'action', ([], {'detail': '(True)', 'methods': "['post']"}), "(detail=True, methods=['post'])\n", (4304, 4335), False, 'from rest_framework.decorators import action\n'), ((5480, 5517), 'rest_framework.decorators.action', 'action', ([], {'detail': '(True)', 'methods': ... |
from flask import render_template, abort, request, redirect, url_for, flash
from . import main
from .. import db
from app.models import Tale, User
from .forms import CreateBlog, UpdateProfile
from flask_login import login_required, current_user
from ..requests import random_quotes
@main.route('/', methods = ['GET', '... | [
"app.models.Tale.query.all",
"flask.flash",
"app.models.Tale",
"flask.abort",
"flask.url_for",
"app.models.User.query.filter_by",
"flask.render_template"
] | [((382, 398), 'app.models.Tale.query.all', 'Tale.query.all', ([], {}), '()\n', (396, 398), False, 'from app.models import Tale, User\n'), ((410, 467), 'flask.render_template', 'render_template', (['"""index.html"""'], {'quotes': 'quotes', 'tales': 'tales'}), "('index.html', quotes=quotes, tales=tales)\n", (425, 467), F... |
'''
Tarot Attributes of the Occult Bot
'''
# 1. Imports
import requests, json
import random
# 2. Variables
# Tarot Card Data from https://github.com/ekelen
# Thank ekelen for putting this all together!
tarot_json = 'https://raw.githubusercontent.com/CelinaWalkowicz/tarot-api/master/static/card_data.json'
# 2. Fu... | [
"random.randint",
"json.loads",
"requests.get"
] | [((398, 422), 'requests.get', 'requests.get', (['tarot_json'], {}), '(tarot_json)\n', (410, 422), False, 'import requests, json\n'), ((439, 464), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (449, 464), False, 'import requests, json\n'), ((7773, 7793), 'random.randint', 'random.randint', ([... |
#Desafio: Crie um módulo chamado moeda.py que tenha as funções incorporadas aumentar(), diminuir(), dobro() e metade().
#Faça também um programa que importe esse módulo e use algumas dessas funções.
import moeda
p = float(input('Digite o preço: R$ '))
print(f'A metade de {p} é {moeda.metade(p)}')
print(f'O dobro de {... | [
"moeda.diminuir",
"moeda.aumentar",
"moeda.metade",
"moeda.dobro"
] | [((282, 297), 'moeda.metade', 'moeda.metade', (['p'], {}), '(p)\n', (294, 297), False, 'import moeda\n'), ((327, 341), 'moeda.dobro', 'moeda.dobro', (['p'], {}), '(p)\n', (338, 341), False, 'import moeda\n'), ((375, 396), 'moeda.aumentar', 'moeda.aumentar', (['p', '(10)'], {}), '(p, 10)\n', (389, 396), False, 'import m... |
#
# Инициализация модуля, отвечающего за работу
# с базой данных;
#
############################################################
# import
import random
from sqlalchemy import func
from sqlalchemy.orm import sessionmaker
from app.bd.table import *
from nvxsct import sct
############################... | [
"nvxsct.sct",
"random.choice",
"sqlalchemy.func.min",
"sqlalchemy.orm.sessionmaker",
"sqlalchemy.func.max"
] | [((406, 426), 'sqlalchemy.orm.sessionmaker', 'sessionmaker', (['engine'], {}), '(engine)\n', (418, 426), False, 'from sqlalchemy.orm import sessionmaker\n'), ((2271, 2319), 'nvxsct.sct', 'sct', ([], {'token': 'token', 'query': 'None', 'sets': 'sets', 'count': '(0)'}), '(token=token, query=None, sets=sets, count=0)\n', ... |
from html2text import html2text
import requests
from bs4 import BeautifulSoup
DEFAULT_IMAGE = 'https://storage.googleapis.com/cbn-public/default-backgroud.jpg'
def extract(url):
print('ZDNet extract {}'.format(url))
response = requests.get(url)
soup = BeautifulSoup(response.text, 'html5lib')
article ... | [
"bs4.BeautifulSoup",
"requests.get"
] | [((238, 255), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (250, 255), False, 'import requests\n'), ((267, 307), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.text', '"""html5lib"""'], {}), "(response.text, 'html5lib')\n", (280, 307), False, 'from bs4 import BeautifulSoup\n')] |
""" 学習の一時中断、再開を行う処理を提供する
"""
import os
import tensorflow as tf
from . context import Context
from . colab import IS_ON_COLABOLATORY_WITH_GOOGLE_DRIVE, Colaboratory
def ENABLE_SUSPEND_RESUME_TRAINING():
""" 一時中断、再開を行う学習を実施する
冒頭でリジュームを宣言してください。
Example:
ENABLE_SUSPEND_RESUME_TRAINING()
... | [
"tensorflow.io.gfile.makedirs",
"tensorflow.io.gfile.exists",
"tensorflow.io.gfile.GFile"
] | [((1230, 1261), 'tensorflow.io.gfile.GFile', 'tf.io.gfile.GFile', (['rp'], {'mode': '"""r"""'}), "(rp, mode='r')\n", (1247, 1261), True, 'import tensorflow as tf\n'), ((3444, 3477), 'tensorflow.io.gfile.GFile', 'tf.io.gfile.GFile', (['file'], {'mode': '"""w"""'}), "(file, mode='w')\n", (3461, 3477), True, 'import tenso... |
from torchfm.dataset.criteo import CriteoDataset
dataset = CriteoDataset()
import json
import numpy as np
n_items = 4096
total_items = 500
input_data = []
for i in range(3):
x = dataset[i][0]
tiled_x = np.tile(x,n_items)
tiled_x = tiled_x.reshape(n_items,-1)
tiled_x[:,-1] = np.random.choice(range(tota... | [
"json.dump",
"numpy.tile",
"torchfm.dataset.criteo.CriteoDataset"
] | [((59, 74), 'torchfm.dataset.criteo.CriteoDataset', 'CriteoDataset', ([], {}), '()\n', (72, 74), False, 'from torchfm.dataset.criteo import CriteoDataset\n'), ((212, 231), 'numpy.tile', 'np.tile', (['x', 'n_items'], {}), '(x, n_items)\n', (219, 231), True, 'import numpy as np\n'), ((543, 566), 'json.dump', 'json.dump',... |
import yaml
import logging
from lando.exceptions import get_or_raise_config_exception, InvalidConfigException
from lando.server.config import WorkQueue, BespinApiSettings
def create_server_config(filename):
with open(filename, 'r') as infile:
data = yaml.safe_load(infile)
if not data:
... | [
"yaml.safe_load",
"lando.exceptions.get_or_raise_config_exception"
] | [((264, 286), 'yaml.safe_load', 'yaml.safe_load', (['infile'], {}), '(infile)\n', (278, 286), False, 'import yaml\n'), ((1908, 1951), 'lando.exceptions.get_or_raise_config_exception', 'get_or_raise_config_exception', (['data', '"""host"""'], {}), "(data, 'host')\n", (1937, 1951), False, 'from lando.exceptions import ge... |
import sys
import os
import json
from collections import OrderedDict
from setup_app.pylib.ldif4.ldif import LDIFWriter
with open(sys.argv[1]) as f:
data = json.load(f, object_pairs_hook=OrderedDict)
stdout = os.fdopen(sys.stdout.fileno(), "wb", closefd=False)
ldif_writer = LDIFWriter(stdout, cols=10000)
for en... | [
"json.load",
"setup_app.pylib.ldif4.ldif.LDIFWriter",
"sys.stdout.fileno"
] | [((283, 313), 'setup_app.pylib.ldif4.ldif.LDIFWriter', 'LDIFWriter', (['stdout'], {'cols': '(10000)'}), '(stdout, cols=10000)\n', (293, 313), False, 'from setup_app.pylib.ldif4.ldif import LDIFWriter\n'), ((161, 204), 'json.load', 'json.load', (['f'], {'object_pairs_hook': 'OrderedDict'}), '(f, object_pairs_hook=Ordere... |
from conans import ConanFile, AutoToolsBuildEnvironment, tools
import os
class VoroPlusPlusConan(ConanFile):
name = "voro++"
description = "Voro++ is a open source software library for the computation of the Voronoi diagram."
topics = ("conan", "voro++", "logging")
url = "https://github.com/bincrafter... | [
"conans.tools.get",
"os.unlink",
"os.rename",
"conans.tools.chdir",
"conans.AutoToolsBuildEnvironment",
"os.path.join",
"conans.tools.collect_libs"
] | [((915, 968), 'conans.tools.get', 'tools.get', ([], {}), "(**self.conan_data['sources'][self.version])\n", (924, 968), False, 'from conans import ConanFile, AutoToolsBuildEnvironment, tools\n'), ((1032, 1080), 'os.rename', 'os.rename', (['extracted_dir', 'self._source_subfolder'], {}), '(extracted_dir, self._source_sub... |
import pandas as pd
from pathlib import Path
import sys
forces = ['Avon and Somerset', 'Beds Cambs Herts', 'Cheshire',
'City of London', 'Cleveland', 'Cumbria', 'Derbyshire',
'Devon and Cornwall', 'Dorset', 'Durham', 'Dyfed-Powys', 'Essex',
'Gloucestershire', 'Greater Manchester', 'Gwent'... | [
"pandas.read_csv",
"pathlib.Path"
] | [((824, 858), 'pathlib.Path', 'Path', (['f"""./model-output/{scenario}"""'], {}), "(f'./model-output/{scenario}')\n", (828, 858), False, 'from pathlib import Path\n'), ((983, 1025), 'pandas.read_csv', 'pd.read_csv', (["(path / 'deployment_times.csv')"], {}), "(path / 'deployment_times.csv')\n", (994, 1025), True, 'impo... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Oct 10 16:43:52 2017
@author: leminen
"""
import os
import tensorflow as tf
import matplotlib.pyplot as plt
import src.data.process_dataset as process_dataset
import src.models.ops_util as ops
import src.utils as utils
class BasicModel(object):
d... | [
"tensorflow.contrib.data.TFRecordDataset",
"tensorflow.summary.scalar",
"tensorflow.train.Saver",
"tensorflow.global_variables_initializer",
"os.path.basename",
"tensorflow.Session",
"src.utils.checkfolder",
"tensorflow.placeholder",
"tensorflow.summary.FileWriter",
"tensorflow.name_scope",
"os.... | [((592, 631), 'src.utils.checkfolder', 'utils.checkfolder', (['self.dir_checkpoints'], {}), '(self.dir_checkpoints)\n', (609, 631), True, 'import src.utils as utils\n'), ((640, 672), 'src.utils.checkfolder', 'utils.checkfolder', (['self.dir_logs'], {}), '(self.dir_logs)\n', (657, 672), True, 'import src.utils as utils\... |
import math
class heap():
c = []
l = 0
levels = 0
def __getitem__(self, val):
return self.c[val]
def __setitem__(self, ind, it):
self.c[ind] = it
def __init__(self, val=[]):
self.c = list(val)
self.l = len(self.c)
self.levels = 0 if not self.c else in... | [
"math.log2"
] | [((322, 339), 'math.log2', 'math.log2', (['self.l'], {}), '(self.l)\n', (331, 339), False, 'import math\n')] |
# Generated by Django 2.2.7 on 2019-11-26 17:22
from django.db import migrations
import djrichtextfield.models
class Migration(migrations.Migration):
dependencies = [
('sitecampus', '0012_auto_20191122_1316'),
]
operations = [
migrations.RemoveField(
model_name='post',
... | [
"django.db.migrations.RemoveField"
] | [((260, 318), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""post"""', 'name': '"""conteudo"""'}), "(model_name='post', name='conteudo')\n", (282, 318), False, 'from django.db import migrations\n')] |
import copy
import os
import time
import torch
from torch import nn
import forge.experiment_tools as fet
from math import cos, pi, sin
# from matplotlib.lines import Line2D
# import matplotlib.pyplot as plt
# import numpy as np
def rotate(X, angle):
rotation_matrix = torch.tensor(
[[cos(angle), -sin(ang... | [
"copy.deepcopy",
"os.remove",
"torch.load",
"forge.experiment_tools.find_model_files",
"math.sin",
"time.time",
"torch.save",
"math.cos"
] | [((2328, 2355), 'torch.load', 'torch.load', (['checkpoint_path'], {}), '(checkpoint_path)\n', (2338, 2355), False, 'import torch\n'), ((3497, 3531), 'torch.save', 'torch.save', (['state', 'epoch_ckpt_file'], {}), '(state, epoch_ckpt_file)\n', (3507, 3531), False, 'import torch\n'), ((3673, 3699), 'os.remove', 'os.remov... |
# Generated by Django 3.0.5 on 2020-05-02 12:04
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('cookbook', '0038_auto_20200502_1259'),
]
operati... | [
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField"
] | [((194, 251), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (225, 251), False, 'from django.db import migrations, models\n'), ((439, 535), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'blank': '(... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# d... | [
"heat.common.template_format.parse",
"heat.tests.utils.setup_dummy_db",
"heat.engine.scheduler.TaskRunner",
"heat.engine.resources.instance.Restarter",
"heat.tests.utils.parse_stack",
"mock.Mock"
] | [((1175, 1197), 'heat.tests.utils.setup_dummy_db', 'utils.setup_dummy_db', ([], {}), '()\n', (1195, 1197), False, 'from heat.tests import utils\n'), ((1249, 1290), 'heat.common.template_format.parse', 'template_format.parse', (['restarter_template'], {}), '(restarter_template)\n', (1270, 1290), False, 'from heat.common... |
#!/usr/bin/python
# -*- encoding: utf-8 -*-
import os
import cv2
import numpy as np
from tqdm import tqdm
import glob
def calculate_mean_std(path):
# folder = os.listdir(path)
folder = glob.glob(path, recursive=False)
mean = []
std = []
R_mean = 0.0
G_mean = 0.0
B_mean = 0.0
# for i... | [
"tqdm.tqdm",
"numpy.power",
"cv2.imread",
"numpy.mean",
"glob.glob"
] | [((196, 228), 'glob.glob', 'glob.glob', (['path'], {'recursive': '(False)'}), '(path, recursive=False)\n', (205, 228), False, 'import glob\n'), ((455, 494), 'tqdm.tqdm', 'tqdm', (['folder'], {'desc': '"""calculate_mean_std"""'}), "(folder, desc='calculate_mean_std')\n", (459, 494), False, 'from tqdm import tqdm\n'), ((... |
import numpy as np
import random
from pyquil import Program
from pyquil.gates import RX, RZ, CZ, RY
class AnsatzCircuitGenerator:
"""
creates an instence of the state preparation circuit for VQE input
constructor takes arguments to specify the qubits and the
circuit depth
two methods apply ent... | [
"pyquil.gates.CZ",
"pyquil.gates.RY",
"pyquil.gates.RX",
"random.seed",
"pyquil.Program",
"pyquil.gates.RZ"
] | [((777, 786), 'pyquil.Program', 'Program', ([], {}), '()\n', (784, 786), False, 'from pyquil import Program\n'), ((1000, 1009), 'pyquil.Program', 'Program', ([], {}), '()\n', (1007, 1009), False, 'from pyquil import Program\n'), ((1240, 1258), 'random.seed', 'random.seed', (['(99999)'], {}), '(99999)\n', (1251, 1258), ... |
# -*- coding: utf-8 -*-
from flask import Blueprint, jsonify, send_from_directory, request
from ktrade.decorators import check_configured
from settings import ROOT_PATH
from application import db
# from ktrade.models import Configuration
from ktrade.queues import inbound_queue
from ktrade.queue_messages.buy_message im... | [
"flask.jsonify",
"flask.Blueprint",
"ktrade.queue_messages.buy_message.BuyMessage"
] | [((393, 428), 'flask.Blueprint', 'Blueprint', (['"""trade_routes"""', '__name__'], {}), "('trade_routes', __name__)\n", (402, 428), False, 'from flask import Blueprint, jsonify, send_from_directory, request\n'), ((562, 575), 'flask.jsonify', 'jsonify', (['"""OK"""'], {}), "('OK')\n", (569, 575), False, 'from flask impo... |
# Python script, calls gdal_translate for each output file to convert to tiff
import os,glob,subprocess
from concurrent.futures import ProcessPoolExecutor
from osgeo import gdal
# Converts an ascii file to geotiff and deletes original file if successful
def convert_single(f,f_tif):
if not os.path.exists(f_tif):
pri... | [
"os.remove",
"concurrent.futures.ProcessPoolExecutor",
"subprocess.check_output",
"os.path.exists",
"osgeo.gdal.Translate",
"glob.glob",
"os.path.join",
"osgeo.gdal.BuildVRT"
] | [((782, 801), 'glob.glob', 'glob.glob', (['fpattern'], {}), '(fpattern)\n', (791, 801), False, 'import os, glob, subprocess\n'), ((1098, 1120), 'os.path.exists', 'os.path.exists', (['folder'], {}), '(folder)\n', (1112, 1120), False, 'import os, glob, subprocess\n'), ((1301, 1340), 'os.path.join', 'os.path.join', (['fol... |
import numpy as np
from napari.layers.utils.color_manager_utils import (
guess_continuous,
is_color_mapped,
)
def test_guess_continuous():
continuous_annotation = np.array([1, 2, 3], dtype=np.float32)
assert guess_continuous(continuous_annotation)
categorical_annotation_1 = np.array([True, False... | [
"napari.layers.utils.color_manager_utils.guess_continuous",
"numpy.array",
"napari.layers.utils.color_manager_utils.is_color_mapped"
] | [((178, 215), 'numpy.array', 'np.array', (['[1, 2, 3]'], {'dtype': 'np.float32'}), '([1, 2, 3], dtype=np.float32)\n', (186, 215), True, 'import numpy as np\n'), ((227, 266), 'napari.layers.utils.color_manager_utils.guess_continuous', 'guess_continuous', (['continuous_annotation'], {}), '(continuous_annotation)\n', (243... |
from src.score_model import *
from sklearn.linear_model import LogisticRegression, Perceptron
from sklearn.neighbors import KNeighborsClassifier
from sklearn.tree import DecisionTreeClassifier
from sklearn.svm import LinearSVC, SVC
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import RandomFor... | [
"sklearn.ensemble.RandomForestClassifier",
"sklearn.preprocessing.StandardScaler",
"skopt.space.Categorical",
"sklearn.model_selection.train_test_split",
"skopt.space.Integer"
] | [((740, 796), 'sklearn.model_selection.train_test_split', 'train_test_split', (['dataset'], {'test_size': '(0.2)', 'random_state': '(0)'}), '(dataset, test_size=0.2, random_state=0)\n', (756, 796), False, 'from sklearn.model_selection import cross_val_predict, train_test_split, ParameterGrid\n'), ((2153, 2169), 'sklear... |
# -*- coding: utf-8 -*-
"""
Copyright 2019 CS Systèmes d'Information
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... | [
"ikats.IkatsAPI",
"ikats.extra.timeseries.gen_random_ts",
"ikats.tests.lib.delete_ts_if_exists"
] | [((1003, 1060), 'ikats.IkatsAPI', 'IkatsAPI', ([], {'host': '"""http://localhost"""', 'port': '(80)', 'emulate': '(False)'}), "(host='http://localhost', port=80, emulate=False)\n", (1011, 1060), False, 'from ikats import IkatsAPI\n'), ((1258, 1315), 'ikats.IkatsAPI', 'IkatsAPI', ([], {'host': '"""http://localhost"""', ... |
import base64
import os
from cli.utils import get_base64_string
DUMMY_BINARY_FILE_PATH = os.path.join(os.path.dirname(__file__),
'dummy_binary_file')
def test_get_base64_string():
with open(DUMMY_BINARY_FILE_PATH, 'rb') as f:
file_size = os.path.getsize(DUMMY_BINARY_... | [
"os.path.getsize",
"os.path.dirname",
"cli.utils.get_base64_string"
] | [((104, 129), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (119, 129), False, 'import os\n'), ((291, 330), 'os.path.getsize', 'os.path.getsize', (['DUMMY_BINARY_FILE_PATH'], {}), '(DUMMY_BINARY_FILE_PATH)\n', (306, 330), False, 'import os\n'), ((414, 455), 'cli.utils.get_base64_string', 'ge... |
import json
from moto.core.responses import BaseResponse
from tests.deployment.sagemaker.sagemaker_moto.model import sagemaker_backends
class SageMakerResponse(BaseResponse):
"""SageMaker response for moto mock.
References API operations and result from
https://docs.aws.amazon.com/sagemaker/latest/dg/AP... | [
"json.loads",
"json.dumps"
] | [((404, 425), 'json.loads', 'json.loads', (['self.body'], {}), '(self.body)\n', (414, 425), False, 'import json\n'), ((925, 964), 'json.dumps', 'json.dumps', (["{'ModelArn': result['arn']}"], {}), "({'ModelArn': result['arn']})\n", (935, 964), False, 'import json\n'), ((1273, 1321), 'json.dumps', 'json.dumps', (["{'End... |
# DIRECTORY: ~/kpyreb/eSims/MSims/integrate.py
#
# Integrates using whfast by default. This can be set by the user as an optional
# keyword. Auto calculates the timestep to be 1/1000 of the shortest orbit
# (Rein & Tamayo 2015). Sympletic corrector can be used if set by the user.
#
# This is the worker of the simulatio... | [
"numpy.arctan2",
"math.sqrt",
"numpy.zeros",
"numpy.array",
"numpy.linspace"
] | [((3395, 3434), 'numpy.linspace', 'np.linspace', (['(0)', 'simlength', '(Noutputs + 1)'], {}), '(0, simlength, Noutputs + 1)\n', (3406, 3434), True, 'import numpy as np\n'), ((24428, 24450), 'numpy.zeros', 'np.zeros', (['(Noutputs + 1)'], {}), '(Noutputs + 1)\n', (24436, 24450), True, 'import numpy as np\n'), ((24468, ... |
from functools import lru_cache
import torch
import numpy as np
from nltk.tokenize import word_tokenize
from nltk.translate.bleu_score import sentence_bleu, SmoothingFunction
class Evaluator:
def __init__(self, corpus, n_ref, sample_params=None,
blue_span=(2, 5), blue_smooth='epsilon'):
... | [
"torch.stack",
"nltk.translate.bleu_score.sentence_bleu",
"numpy.array",
"torch.device",
"nltk.translate.bleu_score.SmoothingFunction",
"functools.lru_cache"
] | [((2420, 2443), 'functools.lru_cache', 'lru_cache', ([], {'maxsize': 'None'}), '(maxsize=None)\n', (2429, 2443), False, 'from functools import lru_cache\n'), ((479, 527), 'numpy.array', 'np.array', (['([1 / i] * i + [0] * (blue_span[1] - i))'], {}), '([1 / i] * i + [0] * (blue_span[1] - i))\n', (487, 527), True, 'impor... |
import sys
from auger.api.cloud.auth import AugerAuthApi
from auger.api.credentials import Credentials
from auger.api.cloud.utils.exception import AugerException
class AugerAuth(object):
def __init__(self, ctx):
self.ctx = ctx
self.credentials = Credentials(ctx).load()
def login(self, usern... | [
"auger.api.cloud.auth.AugerAuthApi",
"auger.api.credentials.Credentials"
] | [((270, 286), 'auger.api.credentials.Credentials', 'Credentials', (['ctx'], {}), '(ctx)\n', (281, 286), False, 'from auger.api.credentials import Credentials\n'), ((548, 570), 'auger.api.cloud.auth.AugerAuthApi', 'AugerAuthApi', (['self.ctx'], {}), '(self.ctx)\n', (560, 570), False, 'from auger.api.cloud.auth import Au... |
# Desktop Wallpaper Changer
# Random wallpapers require internet connection
import os
import ctypes
import requests
import tkinter as tk
from tkinter import PhotoImage
from tkinter import filedialog
from tkinter import messagebox
cwd = os.getcwd()
# function to check if os size is 64 bit windows or 32 bit
def is_64b... | [
"tkinter.PhotoImage",
"tkinter.Label",
"os.path.abspath",
"os.getcwd",
"ctypes.sizeof",
"tkinter.Button",
"tkinter.messagebox.showerror",
"tkinter.filedialog.askopenfilename",
"requests.get",
"ctypes.windll.user32.SystemParametersInfoA",
"tkinter.LabelFrame",
"tkinter.Tk",
"ctypes.windll.use... | [((238, 249), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (247, 249), False, 'import os\n'), ((3882, 3889), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (3887, 3889), True, 'import tkinter as tk\n'), ((3971, 4004), 'tkinter.PhotoImage', 'PhotoImage', ([], {'file': '"""icons/clip.png"""'}), "(file='icons/clip.png')\n", (398... |
import os
import pytest
from crawler.helpers import LoggingCollection
from unittest.mock import patch
from crawler.constants import (
FIELD_MONGODB_ID,
FIELD_DATE_TESTED,
FIELD_LAB_ID,
FIELD_RESULT,
FIELD_RNA_ID,
FIELD_ROOT_SAMPLE_ID,
FIELD_PLATE_BARCODE,
FIELD_COORDINATE,
FIELD_SOU... | [
"crawler.helpers.unpad_coordinate",
"crawler.helpers.get_config",
"bson.objectid.ObjectId",
"crawler.helpers.map_mongo_doc_to_sql_columns",
"crawler.helpers.parse_date_tested",
"datetime.datetime",
"pytest.raises",
"crawler.helpers.LoggingCollection",
"crawler.helpers.map_lh_doc_to_sql_columns"
] | [((1059, 1078), 'crawler.helpers.LoggingCollection', 'LoggingCollection', ([], {}), '()\n', (1076, 1078), False, 'from crawler.helpers import LoggingCollection\n'), ((1896, 1915), 'crawler.helpers.LoggingCollection', 'LoggingCollection', ([], {}), '()\n', (1913, 1915), False, 'from crawler.helpers import LoggingCollect... |
# Generated by Django 3.1.1 on 2020-10-09 23:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('DasherApp', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='Budget',
fields=[
('id',... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.AutoField",
"django.db.models.DecimalField",
"django.db.models.DateField"
] | [((321, 414), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (337, 414), False, 'from django.db import migrations, models\... |
# Copyright 2021 Raven 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 applicable law or ... | [
"pyhive.hive.connect"
] | [((1046, 1071), 'pyhive.hive.connect', 'hive.connect', (['"""localhost"""'], {}), "('localhost')\n", (1058, 1071), False, 'from pyhive import hive\n')] |
# Generated by Django 3.2.5 on 2021-09-03 04:41
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('users', '0002_alter_profile_user_id'),
]
operations = [
migrations.RenameField(
model_name='profile',
old_name='user_id',
... | [
"django.db.migrations.RenameField"
] | [((228, 314), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""profile"""', 'old_name': '"""user_id"""', 'new_name': '"""user"""'}), "(model_name='profile', old_name='user_id', new_name=\n 'user')\n", (250, 314), False, 'from django.db import migrations\n')] |
import time
from contextlib import contextmanager
from typing import Any, Callable, Dict, Iterator, List, Optional, Union
import simplejson
from typing_extensions import Protocol
from .const import ONE_MINUTE
from .exceptions import ExperimentValidateError
from .experiment import NamespaceItem, TrackingGroup
from .lo... | [
"simplejson.dumps",
"time.time"
] | [((1966, 1977), 'time.time', 'time.time', ([], {}), '()\n', (1975, 1977), False, 'import time\n'), ((2042, 2053), 'time.time', 'time.time', ([], {}), '()\n', (2051, 2053), False, 'import time\n'), ((8989, 9013), 'simplejson.dumps', 'simplejson.dumps', (['params'], {}), '(params)\n', (9005, 9013), False, 'import simplej... |
# -*- coding: utf-8 -*-
from . import base
from ecl.virtual_network_appliance import virtual_network_appliance_service
from ecl import resource2
class VirtualNetworkAppliancePlan(base.VirtualNetworkApplianceBaseResource):
resources_key = "virtual_network_appliance_plans"
resource_key = "virtual_network_appli... | [
"ecl.resource2.QueryParameters",
"ecl.virtual_network_appliance.virtual_network_appliance_service.VirtualNetworkApplianceService",
"ecl.resource2.Body"
] | [((345, 417), 'ecl.virtual_network_appliance.virtual_network_appliance_service.VirtualNetworkApplianceService', 'virtual_network_appliance_service.VirtualNetworkApplianceService', (['"""v1.0"""'], {}), "('v1.0')\n", (409, 417), False, 'from ecl.virtual_network_appliance import virtual_network_appliance_service\n'), ((5... |
from os import makedirs, environ
from shutil import copy, rmtree
from subprocess import Popen, PIPE
import unittest
# It must be set before import "utils"
environ["SATNOGS_GUT_CONFIG_DIR"] = "tests/config"
from utils import CONFIG_DIRECTORY
CLI = "./cli.py"
class TestCli(unittest.TestCase):
def setUp(self):
... | [
"subprocess.Popen",
"os.makedirs",
"shutil.rmtree",
"os.access",
"shutil.copy"
] | [((326, 367), 'os.makedirs', 'makedirs', (['CONFIG_DIRECTORY'], {'exist_ok': '(True)'}), '(CONFIG_DIRECTORY, exist_ok=True)\n', (334, 367), False, 'from os import makedirs, environ\n'), ((376, 418), 'shutil.copy', 'copy', (['"""tests/config.yml"""', 'CONFIG_DIRECTORY'], {}), "('tests/config.yml', CONFIG_DIRECTORY)\n", ... |
# -*- coding: utf-8 -*-
# ------------------------------------------------------------------------------
#
# Copyright 2018-2019 Fetch.AI Limited
#
# 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 ... | [
"aea.helpers.search.generic.GenericDataModel"
] | [((2316, 2373), 'aea.helpers.search.generic.GenericDataModel', 'GenericDataModel', (['self._data_model_name', 'self._data_model'], {}), '(self._data_model_name, self._data_model)\n', (2332, 2373), False, 'from aea.helpers.search.generic import GenericDataModel\n')] |
from django.contrib.auth.models import User
from django_filters.rest_framework import (
CharFilter,
ChoiceFilter,
DjangoFilterBackend,
FilterSet,
BooleanFilter,
IsoDateTimeFilter,
)
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_fra... | [
"django_filters.rest_framework.CharFilter",
"task_manager.tasks.models.Task.objects.all",
"task_manager.tasks.models.TaskHistory.objects.all",
"task_manager.tasks.models.Task.objects.filter",
"task_manager.tasks.models.TaskHistory.objects.filter",
"rest_framework.response.Response",
"django_filters.rest... | [((859, 894), 'django_filters.rest_framework.CharFilter', 'CharFilter', ([], {'lookup_expr': '"""icontains"""'}), "(lookup_expr='icontains')\n", (869, 894), False, 'from django_filters.rest_framework import CharFilter, ChoiceFilter, DjangoFilterBackend, FilterSet, BooleanFilter, IsoDateTimeFilter\n'), ((908, 944), 'dja... |
# -*- coding: utf-8 -*-
from django import http
from django.contrib import messages
from django.contrib.auth import get_user_model, login, logout
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import HttpResponseRedirect
from django.ur... | [
"django.urls.reverse_lazy",
"django.contrib.messages.error",
"django.contrib.auth.get_user_model",
"django.contrib.auth.logout",
"django.contrib.messages.info",
"django.http.HttpResponseRedirect",
"sitetree.sitetreeapp.get_sitetree",
"django.contrib.messages.warning"
] | [((546, 562), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (560, 562), False, 'from django.contrib.auth import get_user_model, login, logout\n'), ((785, 805), 'django.urls.reverse_lazy', 'reverse_lazy', (['"""home"""'], {}), "('home')\n", (797, 805), False, 'from django.urls import reverse_... |
import ipdb
import torch
import torch.nn as nn
import torch.nn.functional as F
from torchvision import models
class ResNet50(torch.nn.Module):
"""Modified ResNet50 for feature extraction"""
def __init__(self):
super(ResNet50, self).__init__()
self.features = nn.Sequential(*list(models.resnet5... | [
"torch.nn.AlphaDropout",
"torch.nn.GRU",
"torch.nn.Dropout",
"torch.nn.ReLU",
"torch.nn.functional.adaptive_avg_pool2d",
"torchvision.models.resnet50",
"torch.nn.Linear",
"torch.zeros",
"torch.nn.functional.relu",
"torch.nn.Bilinear"
] | [((1126, 1161), 'torch.nn.Linear', 'nn.Linear', (['input_size', 'reduced_size'], {}), '(input_size, reduced_size)\n', (1135, 1161), True, 'import torch.nn as nn\n'), ((1185, 1213), 'torch.nn.AlphaDropout', 'nn.AlphaDropout', ([], {'p': 'dropout_p'}), '(p=dropout_p)\n', (1200, 1213), True, 'import torch.nn as nn\n'), ((... |
import requests,json
# windows
from app.authorization import dingding_token, dingding_secret, recv_window,api_secret,api_key
from app.BinanceAPI import BinanceAPI
import time
import hmac
import hashlib
import base64
import urllib.parse
# linux
# from app.authorization import dingding_token
class Message:
def bu... | [
"app.BinanceAPI.BinanceAPI",
"hmac.new",
"json.dumps",
"time.time",
"base64.b64encode"
] | [((2275, 2302), 'base64.b64encode', 'base64.b64encode', (['hmac_code'], {}), '(hmac_code)\n', (2291, 2302), False, 'import base64\n'), ((1839, 1860), 'json.dumps', 'json.dumps', (['json_text'], {}), '(json_text)\n', (1849, 1860), False, 'import requests, json\n'), ((2160, 2226), 'hmac.new', 'hmac.new', (['secret_enc', ... |
# Table creation
commands = (# Table 1
'''Create Table TwitterUser(User_Id BIGINT PRIMARY KEY, User_Name TEXT);''',
# Table 2
'''Create Table TwitterTweet(Tweet_Id BIGINT PRIMARY KEY,
User_Id BIGINT,
Tw... | [
"psycopg2.connect"
] | [((1076, 1188), 'psycopg2.connect', 'psycopg2.connect', ([], {'host': '"""localhost"""', 'database': '"""TwitterDB"""', 'port': '(5432)', 'user': '"""postgres"""', 'password': '"""<PASSWORD>"""'}), "(host='localhost', database='TwitterDB', port=5432, user=\n 'postgres', password='<PASSWORD>')\n", (1092, 1188), False... |
import unittest
from pandas import read_csv
from fp.traindata_samplers import CompleteData, BalancedExamplesSampler
class TestSuitePreProcessors(unittest.TestCase):
def setUp(self):
self.label_name = 'credit'
self.positive_label = 1
self.n = 600
self.random_state = 0xbe... | [
"unittest.main",
"fp.traindata_samplers.CompleteData",
"pandas.read_csv",
"fp.traindata_samplers.BalancedExamplesSampler"
] | [((1762, 1777), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1775, 1777), False, 'import unittest\n'), ((344, 388), 'pandas.read_csv', 'read_csv', (['"""fp/tests/resource/input/data.csv"""'], {}), "('fp/tests/resource/input/data.csv')\n", (352, 388), False, 'from pandas import read_csv\n'), ((462, 476), 'fp.tra... |
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 3 21:22:35 2019
@author: Reuben
The persist module helps the user save and load Box instances. It is
able to be extended for use with any handler.
The module instantiates a Manager class and copies its load and save methods
to the module level, for easier usage by cli... | [
"numpy.load",
"json.loads",
"json.dumps",
"numpy.savez_compressed",
"numpy.array",
"zlib.decompress",
"json.JSONEncoder.default"
] | [((5526, 5561), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'obj'], {}), '(self, obj)\n', (5550, 5561), False, 'import json\n'), ((5679, 5727), 'numpy.array', 'np.array', (["dct['__ndarray__']"], {'dtype': "dct['dtype']"}), "(dct['__ndarray__'], dtype=dct['dtype'])\n", (5687, 5727), True, 'import ... |
import logging
import sys, os
import structlog
from copy import copy
import re
def copy_config(config):
'''Copy relevant information from one config to another.'''
new_config = {}
new_logging = config['logging'].copy()
new_structlog = {k:copy(v) for k,v in config['structlog'].items()}
new_config.... | [
"structlog.configure",
"structlog.processors.StackInfoRenderer",
"logging.basicConfig",
"structlog.processors.UnicodeDecoder",
"structlog.stdlib.PositionalArgumentsFormatter",
"structlog.processors.TimeStamper",
"copy.copy",
"os.environ.get",
"structlog.processors.JSONRenderer",
"structlog.stdlib.... | [((2135, 2161), 'structlog.get_logger', 'structlog.get_logger', (['name'], {}), '(name)\n', (2155, 2161), False, 'import structlog\n'), ((256, 263), 'copy.copy', 'copy', (['v'], {}), '(v)\n', (260, 263), False, 'from copy import copy\n'), ((1037, 1078), 'os.environ.get', 'os.environ.get', (['"""ASNAKE_LOG_CONFIG"""', '... |
import re
import urllib.request
import os
from translate import Translator
"""
one way to get HTML page
"""
def getHTML(myurl):
# declare url and simulate browsers
myheaders = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36'}
... | [
"re.findall",
"os.path.exists",
"translate.Translator",
"re.compile"
] | [((999, 1615), 're.compile', 're.compile', (['(\n \'<a href=\\\\"/work/\\\\">作品紹介</a> > (.*)</p>[\\\\s\\\\S]*<div class=\\\\"work-img\\\\">\\\\n\'\n +\n \'<img width=\\\\"\\\\d+\\\\" height=\\\\"\\\\d+\\\\" src=\\\\"(.+.[jp][pn]g)\\\\"[\\\\s\\\\S]*\'\n + \'<li><dl><dt><span>放送期間</span></dt><dd>(.*)</dd... |
# 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 json
import warnings
import pulumi
import pulumi.runtime
from .. import utilities, tables
class Cluster(pulumi.CustomResource):... | [
"warnings.warn"
] | [((2804, 2879), 'warnings.warn', 'warnings.warn', (['"""explicit use of __name__ is deprecated"""', 'DeprecationWarning'], {}), "('explicit use of __name__ is deprecated', DeprecationWarning)\n", (2817, 2879), False, 'import warnings\n'), ((2962, 3061), 'warnings.warn', 'warnings.warn', (['"""explicit use of __opts__ i... |
import logging
from aiohttp.web import json_response
from ... import conf
from ...utils.db import fetch_filtering_terms
from ...utils.stream import json_stream
LOG = logging.getLogger(__name__)
# If not defined in conf.py
autocomplete_limit = getattr(conf, 'autocomplete_limit', 16)
autocomplete_ellipsis = getattr(c... | [
"logging.getLogger"
] | [((169, 196), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (186, 196), False, 'import logging\n')] |
import flask
import sys
from flask import g
from flask import render_template
from flask import request
from flask import url_for
from sklearn.metrics.pairwise import euclidean_distances
import json
import logging
# Date handling
import arrow # Replacement for datetime, based on moment.js
# import datetime # But ... | [
"pymongo.MongoClient",
"arrow.get",
"flask.request.args.get",
"flask.Flask",
"flask.url_for",
"flask.render_template",
"sys.exit"
] | [((779, 800), 'flask.Flask', 'flask.Flask', (['__name__'], {}), '(__name__)\n', (790, 800), False, 'import flask\n'), ((908, 937), 'pymongo.MongoClient', 'MongoClient', (['MONGO_CLIENT_URL'], {}), '(MONGO_CLIENT_URL)\n', (919, 937), False, 'from pymongo import MongoClient\n'), ((1287, 1322), 'flask.render_template', 'f... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Course(models.Model):
course_id = models.CharField(max_length=10, null = True)
course_name = models.CharField(max_length=50,null = True)
def __str__(self):
return self.cou... | [
"django.db.models.CharField"
] | [((166, 208), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(10)', 'null': '(True)'}), '(max_length=10, null=True)\n', (182, 208), False, 'from django.db import models\n'), ((229, 271), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'null': '(True)'}), '(max_lengt... |
from flask import session, jsonify, g, current_app, request
from functools import wraps
class APIError(Exception):
def __init__(self, code, msg):
super().__init__(code, msg)
self.code = code
self.msg = msg
def response(self) -> dict:
msg = self.msg
return dict(cod... | [
"flask.jsonify",
"functools.wraps",
"flask.request.json.get",
"flask.current_app.logger.info",
"flask.current_app.logger.error"
] | [((618, 626), 'functools.wraps', 'wraps', (['f'], {}), '(f)\n', (623, 626), False, 'from functools import wraps\n'), ((1672, 1682), 'flask.jsonify', 'jsonify', (['r'], {}), '(r)\n', (1679, 1682), False, 'from flask import session, jsonify, g, current_app, request\n'), ((1728, 1756), 'flask.current_app.logger.info', 'cu... |
import torch
from model.base_model import BaseModel
from model.networks import base_function, external_function
import model.networks as network
from util import task, util
import itertools
import data as Dataset
import numpy as np
from itertools import islice
import random
import os
import matplotlib.pyplot as plt
fro... | [
"cv2.VideoWriter_fourcc",
"torch.cat",
"util.util.flow2color",
"model.networks.external_function.PerceptualCorrectness",
"model.networks.base_function._freeze",
"glob.glob",
"torch.nn.MSELoss",
"model.networks.define_g",
"model.networks.base_function._unfreeze",
"model.networks.external_function.A... | [((2812, 2841), 'model.base_model.BaseModel.__init__', 'BaseModel.__init__', (['self', 'opt'], {}), '(self, opt)\n', (2830, 2841), False, 'from model.base_model import BaseModel\n'), ((3570, 3836), 'model.networks.define_g', 'network.define_g', (['opt'], {'image_nc': 'opt.image_nc', 'structure_nc': 'opt.structure_nc', ... |
from django.contrib.staticfiles.storage import staticfiles_storage
from django.urls import reverse
from jinja2 import Environment
# from widget_tweaks import render_field, add_class, set_attr
import widget_tweaks
def environment(**options):
env = Environment(**options)
env.globals.update(
{
... | [
"jinja2.Environment"
] | [((254, 276), 'jinja2.Environment', 'Environment', ([], {}), '(**options)\n', (265, 276), False, 'from jinja2 import Environment\n')] |
#!/usr/bin/env python3
"""
Extracts passphrases for SSH private keys from Bitwarden vault
Then adds them to ssh-agent
"""
from typing import Dict
import csv
import pathlib
import config
import argparse
import json
import logging
import os
import subprocess
from pkg_resources import parse_version
def memoize(func):... | [
"subprocess.run",
"pkg_resources.parse_version",
"logging.error",
"logging.debug",
"json.loads",
"argparse.ArgumentParser",
"logging.basicConfig",
"logging.warning",
"csv.reader",
"os.environ.get",
"logging.info",
"pathlib.Path"
] | [((742, 842), 'subprocess.run', 'subprocess.run', (["['bw', '--version']"], {'stdout': 'subprocess.PIPE', 'universal_newlines': '(True)', 'check': '(True)'}), "(['bw', '--version'], stdout=subprocess.PIPE,\n universal_newlines=True, check=True)\n", (756, 842), False, 'import subprocess\n'), ((1371, 1399), 'os.enviro... |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
import click
from celery.bin.celery import celery as celery_cmd
from indico.core.celery.util import unloc... | [
"celery.bin.celery.celery.command",
"click.argument",
"click.secho",
"indico.core.celery.util.unlock_task"
] | [((399, 419), 'celery.bin.celery.celery.command', 'celery_cmd.command', ([], {}), '()\n', (417, 419), True, 'from celery.bin.celery import celery as celery_cmd\n'), ((421, 443), 'click.argument', 'click.argument', (['"""name"""'], {}), "('name')\n", (435, 443), False, 'import click\n'), ((688, 705), 'indico.core.celery... |