code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
import struct
import numpy as np
from .nbt import NBTFile
import io
class BufferDecoder(object):
def __init__(self,bytes) -> None:
self.bytes=bytes
self.curr=0
def read_var_uint32(self):
# 我nm真的有必要为了几个比特省到这种地步吗??uint32最多也就5个比特吧??
i,v=0,0
while i<35:
... | [
"numpy.uint32",
"io.BytesIO",
"numpy.uint64",
"struct.unpack",
"struct.pack",
"numpy.int32",
"numpy.int64"
] | [((574, 591), 'numpy.int32', 'np.int32', (['(v_ >> 1)'], {}), '(v_ >> 1)\n', (582, 591), True, 'import numpy as np\n'), ((1036, 1053), 'numpy.int64', 'np.int64', (['(v_ >> 1)'], {}), '(v_ >> 1)\n', (1044, 1053), True, 'import numpy as np\n'), ((1175, 1233), 'struct.unpack', 'struct.unpack', (['"""fff"""', 'self.bytes[s... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) IBM Corporation 2018
#
# 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
#
# U... | [
"yaml.load",
"csv.writer",
"csv.DictReader",
"os.walk",
"datetime.datetime.now",
"os.path.normpath",
"os.path.join"
] | [((3681, 3720), 'os.walk', 'os.walk', (['experiment_path_'], {'topdown': '(True)'}), '(experiment_path_, topdown=True)\n', (3688, 3720), False, 'import os\n'), ((5537, 5583), 'os.walk', 'os.walk', (['self.experiment_rootdir'], {'topdown': '(True)'}), '(self.experiment_rootdir, topdown=True)\n', (5544, 5583), False, 'im... |
import numpy as np
from pycocotools_local.coco import *
import os.path as osp
from .utils import to_tensor, random_scale
from mmcv.parallel import DataContainer as DC
import mmcv
from .custom import CustomDataset
class CocoDatasetRGB2(CustomDataset):
CLASSES = ('microbleed', 'full_bounding_box')
def load_a... | [
"numpy.zeros",
"numpy.hstack",
"numpy.array",
"mmcv.parallel.DataContainer",
"numpy.random.rand",
"mmcv.imrescale",
"os.path.join"
] | [((5455, 5502), 'os.path.join', 'osp.join', (['self.img_prefix', "img_info['filename']"], {}), "(self.img_prefix, img_info['filename'])\n", (5463, 5502), True, 'import os.path as osp\n'), ((4019, 4063), 'numpy.array', 'np.array', (['cur_slice_bboxes'], {'dtype': 'np.float32'}), '(cur_slice_bboxes, dtype=np.float32)\n',... |
from random import random
from math import cos, sin, floor, sqrt, pi, ceil
def euclidean_distance(a, b):
dx = a[0] - b[0]
dy = a[1] - b[1]
return sqrt(dx * dx + dy * dy)
def poisson_disc_samples(width, height, r, k=5, distance=euclidean_distance, random=random):
tau = 2 * pi
cellsize = r / sqrt(... | [
"math.sqrt",
"math.ceil",
"math.floor",
"math.sin",
"random.random",
"math.cos"
] | [((160, 183), 'math.sqrt', 'sqrt', (['(dx * dx + dy * dy)'], {}), '(dx * dx + dy * dy)\n', (164, 183), False, 'from math import cos, sin, floor, sqrt, pi, ceil\n'), ((315, 322), 'math.sqrt', 'sqrt', (['(2)'], {}), '(2)\n', (319, 322), False, 'from math import cos, sin, floor, sqrt, pi, ceil\n'), ((345, 367), 'math.ceil... |
from crayon import benchmark
benchmark("deepar.yml", "deepar", benchmark_id="deepar_100", runs=100)
| [
"crayon.benchmark"
] | [((30, 100), 'crayon.benchmark', 'benchmark', (['"""deepar.yml"""', '"""deepar"""'], {'benchmark_id': '"""deepar_100"""', 'runs': '(100)'}), "('deepar.yml', 'deepar', benchmark_id='deepar_100', runs=100)\n", (39, 100), False, 'from crayon import benchmark\n')] |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python toolkit for generating and analyzing nanostructure data"""
from __future__ import absolute_import, division, print_function, \
unicode_literals
__docformat__ = 'restructuredtext en'
import os
import sys
import shutil
import subprocess
from distutils.command... | [
"os.remove",
"subprocess.Popen",
"distutils.core.setup",
"scipy.version.short_version.split",
"distutils.command.clean.clean.run",
"os.path.exists",
"os.walk",
"os.environ.get",
"imp.load_source",
"shutil.rmtree",
"numpy.distutils.misc_util.Configuration",
"os.path.join",
"numpy.version.shor... | [((4346, 4372), 'os.path.exists', 'os.path.exists', (['"""MANIFEST"""'], {}), "('MANIFEST')\n", (4360, 4372), False, 'import os\n'), ((4378, 4399), 'os.remove', 'os.remove', (['"""MANIFEST"""'], {}), "('MANIFEST')\n", (4387, 4399), False, 'import os\n'), ((5804, 5826), 'os.path.exists', 'os.path.exists', (['""".git"""'... |
import arcade
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600
MOVEMENT_SPEED = 5
class Player(arcade.Sprite):
def update(self):
self.center_x += self.change_x
if self.left < 0:
self.left = 0
elif self.right > SCREEN_WIDTH - 1:
self.right = SCREEN_WIDTH - 1
class MyGame(a... | [
"arcade.SpriteList",
"arcade.start_render",
"arcade.set_background_color",
"arcade.run"
] | [((958, 970), 'arcade.run', 'arcade.run', ([], {}), '()\n', (968, 970), False, 'import arcade\n'), ((436, 483), 'arcade.set_background_color', 'arcade.set_background_color', (['arcade.color.WHEAT'], {}), '(arcade.color.WHEAT)\n', (463, 483), False, 'import arcade\n'), ((599, 618), 'arcade.SpriteList', 'arcade.SpriteLis... |
import os
def get_host(service: str):
'''
Retrieves the host. (Helps with debugging locally)
- Arguments:
- service: a Docker service
- Returns:
a string of either localhost or a Docker service
'''
inside_docker = os.environ.get('IS_DOCKER_CONTAINER', False)
return servic... | [
"os.environ.get"
] | [((258, 302), 'os.environ.get', 'os.environ.get', (['"""IS_DOCKER_CONTAINER"""', '(False)'], {}), "('IS_DOCKER_CONTAINER', False)\n", (272, 302), False, 'import os\n')] |
#!/usr/bin/env python
from build import ninja_common
build = ninja_common.Build("fishbowl/body-frame-calc")
files = [
'main.cpp',
]
build.build_cmd('auv-body-frame-calc',
files,
pkg_confs=['eigen3'],
auv_deps=[],
lflags=[],
cflags=[])
| [
"build.ninja_common.Build"
] | [((63, 109), 'build.ninja_common.Build', 'ninja_common.Build', (['"""fishbowl/body-frame-calc"""'], {}), "('fishbowl/body-frame-calc')\n", (81, 109), False, 'from build import ninja_common\n')] |
from flask import request
from flask import abort
from flask import url_for
from flask import render_template
from bson.objectid import ObjectId
from certifico import app
from certifico import mongo
from certifico import redis_queue
from certifico.mail import send_email
from certifico.forms import CertificateForm
d... | [
"certifico.app.config.get",
"bson.objectid.ObjectId",
"flask.request.args.get",
"certifico.mongo.db.certificates.insert_one",
"flask.abort",
"certifico.forms.CertificateForm"
] | [((356, 373), 'certifico.forms.CertificateForm', 'CertificateForm', ([], {}), '()\n', (371, 373), False, 'from certifico.forms import CertificateForm\n'), ((1290, 1315), 'flask.request.args.get', 'request.args.get', (['"""email"""'], {}), "('email')\n", (1306, 1315), False, 'from flask import request\n'), ((431, 569), ... |
'''
Created on 2016. 10. 26.
@author: "comfact"
'''
import re
from .model import *
def deployACI(desc, verbose=False, debug=False):
try: dom_ip = desc['Controller']['ip']
except: exit(1)
try: dom_user = desc['Controller']['user']
except: exit(1)
try: dom_pwd = desc['Controller... | [
"re.search"
] | [((1247, 1275), 're.search', 're.search', (['"""^[a-z]\\\\w*"""', 'key'], {}), "('^[a-z]\\\\w*', key)\n", (1256, 1275), False, 'import re\n')] |
"""
Config Reader
@author: <NAME>
"""
#!/usr/bin/python
from ConfigParser import ConfigParser
class ConfigParse():
'''
This class reads config.ini file and sets the required user inputs
in the class attributes.
Attributes
----------
1. word2vec_model
Type: str
D... | [
"ConfigParser.ConfigParser"
] | [((2107, 2121), 'ConfigParser.ConfigParser', 'ConfigParser', ([], {}), '()\n', (2119, 2121), False, 'from ConfigParser import ConfigParser\n')] |
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 2 12:21:09 2021
@author: Mahmu
"""
import random
import pylab
import numpy as np
x1 = random.uniform(-1, 1)
y1 = random.uniform(-1, 1)
print(str(x1) + "\n" + str(y1)) | [
"random.uniform"
] | [((137, 158), 'random.uniform', 'random.uniform', (['(-1)', '(1)'], {}), '(-1, 1)\n', (151, 158), False, 'import random\n'), ((164, 185), 'random.uniform', 'random.uniform', (['(-1)', '(1)'], {}), '(-1, 1)\n', (178, 185), False, 'import random\n')] |
# -*- coding: utf-8 -*-
from django.contrib.gis.db import models
from django.contrib.postgres.fields.jsonb import JSONField
from django.utils.translation import ugettext_lazy as _
from saywiti.common.models import TimeStampedModel
class Level(TimeStampedModel):
parent = models.ForeignKey('self', related_name='c... | [
"django.utils.translation.ugettext_lazy",
"django.contrib.gis.db.models.ForeignKey",
"django.contrib.gis.db.models.PolygonField"
] | [((279, 352), 'django.contrib.gis.db.models.ForeignKey', 'models.ForeignKey', (['"""self"""'], {'related_name': '"""children"""', 'null': '(True)', 'blank': '(True)'}), "('self', related_name='children', null=True, blank=True)\n", (296, 352), False, 'from django.contrib.gis.db import models\n'), ((598, 671), 'django.co... |
from doppelkopf.toggles import Toggle
from datetime import datetime, timedelta
toggles_from_db = [
Toggle(name="db-only", enabled=False),
Toggle(name="db-and-code", enabled=True),
]
toggles_from_code = [
Toggle(name="code-only", enabled=False),
Toggle(name="db-and-code", enabled=False),
]
def test_... | [
"datetime.datetime.utcnow",
"datetime.timedelta",
"doppelkopf.toggles.Toggle",
"doppelkopf.toggles.Toggle.merge"
] | [((105, 142), 'doppelkopf.toggles.Toggle', 'Toggle', ([], {'name': '"""db-only"""', 'enabled': '(False)'}), "(name='db-only', enabled=False)\n", (111, 142), False, 'from doppelkopf.toggles import Toggle\n'), ((148, 188), 'doppelkopf.toggles.Toggle', 'Toggle', ([], {'name': '"""db-and-code"""', 'enabled': '(True)'}), "(... |
import os,random
os.environ["KERAS_BACKEND"] = "tensorflow"
from PIL import Image
from keras.layers import Conv2D, MaxPooling2D, GlobalAveragePooling2D
import h5py
import numpy as np
from keras.layers import Input,merge,Lambda
from keras.layers.core import Reshape,Dense,Dropout,Activation,Flatten
from keras.layers.adva... | [
"keras.layers.core.Reshape",
"numpy.ones",
"keras.models.Model",
"matplotlib.pyplot.figure",
"numpy.exp",
"numpy.random.normal",
"keras.layers.core.Flatten",
"keras.layers.Input",
"keras.layers.concatenate",
"numpy.transpose",
"numpy.reshape",
"numpy.linspace",
"keras.layers.core.Dropout",
... | [((725, 765), 'functools.partial', 'partial', (['initializers.normal'], {'scale': '(0.02)'}), '(initializers.normal, scale=0.02)\n', (732, 765), False, 'from functools import partial\n'), ((1065, 1098), 'h5py.File', 'h5py.File', (['"""FERG_64_64_color.mat"""'], {}), "('FERG_64_64_color.mat')\n", (1074, 1098), False, 'i... |
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Copyright (C) 2011 ~ 2012 Deepin, Inc.
# 2011 ~ 2012 Zeng Zhi
#
# Author: <NAME> <<EMAIL>>
# Maintainer: <NAME> <<EMAIL>>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as pu... | [
"gtk.EventBox",
"gtk.Entry",
"gtk.Window",
"utils.alpha_color_hex_to_cairo",
"gtk.main_quit",
"gtk.VBox",
"draw.draw_text",
"menu.Menu",
"gobject.type_register",
"gtk.main",
"theme.ui_theme.get_color",
"utils.get_content_size",
"scrolled_window.ScrolledWindow",
"gtk.Button",
"gtk.HBox",
... | [((12004, 12032), 'gobject.type_register', 'gobject.type_register', (['Bread'], {}), '(Bread)\n', (12025, 12032), False, 'import gobject\n'), ((13880, 13912), 'gobject.type_register', 'gobject.type_register', (['BreadMenu'], {}), '(BreadMenu)\n', (13901, 13912), False, 'import gobject\n'), ((23499, 23527), 'gobject.typ... |
from pathlib import Path
result_dir = Path().home().joinpath('module_results/bfast_preanalysis')
start = """
### Start date selection
Pick the date of the timeseries' start.
"""
end = """
### End date selection
Pick the date of the timeseries' end.
"""
select = """
### Satellite selection
Select the satell... | [
"pathlib.Path"
] | [((39, 45), 'pathlib.Path', 'Path', ([], {}), '()\n', (43, 45), False, 'from pathlib import Path\n')] |
import sys
sys.path.append('../loader')
# from unaligned_data_loader import UnalignedDataLoader
from datasets.svhn import load_svhn
from datasets.mnist import load_mnist
from datasets.usps import load_usps
# from gtsrb import load_gtsrb
# from synth_traffic import load_syntraffic
from datasets.create_dataloader impor... | [
"sys.path.append",
"datasets.mnist.load_mnist",
"datasets.svhn.load_svhn",
"datasets.create_dataloader.create_DataLoader",
"datasets.usps.load_usps"
] | [((12, 40), 'sys.path.append', 'sys.path.append', (['"""../loader"""'], {}), "('../loader')\n", (27, 40), False, 'import sys\n'), ((2330, 2390), 'datasets.create_dataloader.create_DataLoader', 'create_DataLoader', (['S', 'batch_size'], {'scale': 'scale', 'shuffle': '(False)'}), '(S, batch_size, scale=scale, shuffle=Fal... |
import logging
import time
from aiogram import Dispatcher, types
from aiogram.dispatcher.middlewares import BaseMiddleware
HANDLED_STR = ["Unhandled", "Handled"]
class LoggingMiddleware(BaseMiddleware):
def __init__(self, logger=None):
if not isinstance(logger, logging.Logger):
logger = logg... | [
"logging.getLogger",
"time.time"
] | [((756, 767), 'time.time', 'time.time', ([], {}), '()\n', (765, 767), False, 'import time\n'), ((316, 358), 'logging.getLogger', 'logging.getLogger', (['self.__class__.__name__'], {}), '(self.__class__.__name__)\n', (333, 358), False, 'import logging\n'), ((599, 610), 'time.time', 'time.time', ([], {}), '()\n', (608, 6... |
from dataclasses import dataclass, field
from typing import Any
@dataclass
class Response(object):
ok: bool = field(default=False)
data: Any = field(default=None)
message: str = field(default='')
| [
"dataclasses.field"
] | [((122, 142), 'dataclasses.field', 'field', ([], {'default': '(False)'}), '(default=False)\n', (127, 142), False, 'from dataclasses import dataclass, field\n'), ((160, 179), 'dataclasses.field', 'field', ([], {'default': 'None'}), '(default=None)\n', (165, 179), False, 'from dataclasses import dataclass, field\n'), ((2... |
from django.db import models
class About(models.Model):
about_image = models.ImageField(upload_to="about/")
about_exp1 = models.TextField(blank=True, null=True)
about_exp2 = models.TextField(blank=True, null=True)
class Programms(models.Model):
name = models.CharField(max_length=255)
icon = mode... | [
"django.db.models.ImageField",
"django.db.models.TextField",
"django.db.models.CharField"
] | [((76, 113), 'django.db.models.ImageField', 'models.ImageField', ([], {'upload_to': '"""about/"""'}), "(upload_to='about/')\n", (93, 113), False, 'from django.db import models\n'), ((131, 170), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'null': '(True)'}), '(blank=True, null=True)\n', (1... |
import asyncio
import logging
import importlib.util
import os.path
import sys
# Debug
import traceback
from jshbot import commands
from jshbot.exceptions import ErrorTypes, BotException
EXCEPTION = 'Plugins'
def add_plugins(bot):
"""
Gets a list of all of the plugins and stores them as a key/value pair of
... | [
"sys.path.append",
"logging.error",
"traceback.print_exc",
"logging.debug",
"jshbot.base.get_commands",
"jshbot.commands.add_commands",
"traceback.format_exc",
"jshbot.exceptions.BotException"
] | [((1031, 1050), 'jshbot.base.get_commands', 'base.get_commands', ([], {}), '()\n', (1048, 1050), False, 'from jshbot import base\n'), ((1055, 1104), 'jshbot.commands.add_commands', 'commands.add_commands', (['bot', 'plugin_commands', 'base'], {}), '(bot, plugin_commands, base)\n', (1076, 1104), False, 'from jshbot impo... |
import zmq
from zmq import ssh
import numpy as np
from environments.inmoov.inmoov_p2p_client_ready import InmoovGymEnv
from .inmoov_server import server_connection, client_ssh_connection, client_connection
SERVER_PORT = 7777
HOSTNAME = 'localhost'
def send_array(socket, A, flags=0, copy=True, track=False):
"""se... | [
"numpy.zeros",
"environments.inmoov.inmoov_p2p_client_ready.InmoovGymEnv",
"numpy.array"
] | [((972, 1026), 'environments.inmoov.inmoov_p2p_client_ready.InmoovGymEnv', 'InmoovGymEnv', ([], {'debug_mode': '(True)', 'positional_control': '(True)'}), '(debug_mode=True, positional_control=True)\n', (984, 1026), False, 'from environments.inmoov.inmoov_p2p_client_ready import InmoovGymEnv\n'), ((655, 684), 'numpy.ze... |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
import pymongo
from scrapy.conf import settings
class BaiduPipeline(object):
def __init__(self):
host = settings[... | [
"pymongo.MongoClient"
] | [((438, 479), 'pymongo.MongoClient', 'pymongo.MongoClient', ([], {'host': 'host', 'port': 'port'}), '(host=host, port=port)\n', (457, 479), False, 'import pymongo\n')] |
# -*- coding: utf-8 -*-
"""
-------------------------------------------------
File Name: execCmd
Description :
Author : liaozhaoyan
date: 2022/3/19
-------------------------------------------------
Change Activity:
2022/3/19:
-----------------------------------------... | [
"os.read",
"os.popen",
"os.path.exists",
"shlex.split",
"select.epoll"
] | [((1878, 1892), 'select.epoll', 'select.epoll', ([], {}), '()\n', (1890, 1892), False, 'import select\n'), ((646, 663), 'os.path.exists', 'os.path.exists', (['f'], {}), '(f)\n', (660, 663), False, 'import os\n'), ((1311, 1328), 'shlex.split', 'shlex.split', (['cmds'], {}), '(cmds)\n', (1322, 1328), False, 'import shlex... |
import importlib
import json
import logging
import os
import subprocess
from typing import Any, Dict, NamedTuple, Tuple
from django.apps import AppConfig
from django.conf import settings
from . import (
definitions_registry,
extract_views_from_urlpatterns,
global_types,
template_registry,
type_reg... | [
"subprocess.Popen",
"os.makedirs",
"importlib.import_module",
"hashlib.sha1",
"os.path.exists",
"json.dumps",
"os.environ.get",
"logging.getLogger"
] | [((400, 434), 'logging.getLogger', 'logging.getLogger', (['"""django.server"""'], {}), "('django.server')\n", (417, 434), False, 'import logging\n'), ((492, 538), 'importlib.import_module', 'importlib.import_module', (['settings.ROOT_URLCONF'], {}), '(settings.ROOT_URLCONF)\n', (515, 538), False, 'import importlib\n'),... |
import threading
from pynput import keyboard
class KeyPresses():
def __init__(self):
self.keep_from_dying_thread = None
self.holding_shift = False
self.key_listener = keyboard.Listener(on_press=self.on_keydown, on_release=self.on_keyup)
self.key_listener.start()
def on_keydow... | [
"threading.Timer",
"pynput.keyboard.Listener"
] | [((197, 266), 'pynput.keyboard.Listener', 'keyboard.Listener', ([], {'on_press': 'self.on_keydown', 'on_release': 'self.on_keyup'}), '(on_press=self.on_keydown, on_release=self.on_keyup)\n', (214, 266), False, 'from pynput import keyboard\n'), ((922, 961), 'threading.Timer', 'threading.Timer', (['(1000000)', '(lambda :... |
from precise_bbcode.bbcode.tag import BBCodeTag
from precise_bbcode.tag_pool import tag_pool
class LoadDummyTag(BBCodeTag):
name = 'loaddummy01'
definition_string = '[loaddummy01]{TEXT}[/loaddummy01]'
format_string = '<loaddummy>{TEXT}</loaddummy>'
tag_pool.register_tag(LoadDummyTag)
| [
"precise_bbcode.tag_pool.tag_pool.register_tag"
] | [((265, 300), 'precise_bbcode.tag_pool.tag_pool.register_tag', 'tag_pool.register_tag', (['LoadDummyTag'], {}), '(LoadDummyTag)\n', (286, 300), False, 'from precise_bbcode.tag_pool import tag_pool\n')] |
# coding=utf-8
"""
Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-LOG 蓝鲸日志平台 is licensed under the MIT License.
License for BK-LOG 蓝鲸日志平台:
---------------------------------------------------------... | [
"django.db.models.ForeignKey",
"django.db.models.Q",
"datetime.datetime.strptime",
"pipeline.service.task_service.get_state",
"functools.reduce",
"django.utils.translation.ugettext_lazy"
] | [((7489, 7497), 'django.utils.translation.ugettext_lazy', '_', (['"""总耗时"""'], {}), "('总耗时')\n", (7490, 7497), True, 'from django.utils.translation import ugettext_lazy as _\n'), ((7586, 7595), 'django.utils.translation.ugettext_lazy', '_', (['"""IP数量"""'], {}), "('IP数量')\n", (7587, 7595), True, 'from django.utils.tran... |
from functools import wraps
import os
import tempfile
import tarfile
def TemporaryDirectory(func):
'''This decorator creates temporary directory and wraps given fuction'''
@wraps(func)
def wrapper(*args, **kwargs):
cwd = os.getcwd()
with tempfile.TemporaryDirectory() as tmp_path:
... | [
"tempfile.TemporaryDirectory",
"os.path.basename",
"os.getcwd",
"functools.wraps",
"tarfile.open",
"os.chdir"
] | [((184, 195), 'functools.wraps', 'wraps', (['func'], {}), '(func)\n', (189, 195), False, 'from functools import wraps\n'), ((244, 255), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (253, 255), False, 'import os\n'), ((516, 553), 'tarfile.open', 'tarfile.open', (['output_filename', '"""w:gz"""'], {}), "(output_filename, ... |
from django.urls import reverse
from series_tiempo_ar_api.apps.api.tests.endpoint_tests.endpoint_test_case import EndpointTestCase
class PaginationTests(EndpointTestCase):
def test_get_single_value(self):
resp = self.client.get(reverse('api:series:series'), data={'ids': self.increasing_month_series_id, ... | [
"django.urls.reverse"
] | [((244, 272), 'django.urls.reverse', 'reverse', (['"""api:series:series"""'], {}), "('api:series:series')\n", (251, 272), False, 'from django.urls import reverse\n')] |
# standard lib
from functools import wraps
# third party packages
from flask import Flask, jsonify, abort, request, Response
from flask.ext.sqlalchemy import SQLAlchemy
app = Flask(__name__)
app.debug = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///test.db'
app.secret_key = '<KEY>'
db = SQLAlchemy(app)
# ... | [
"flask.ext.sqlalchemy.SQLAlchemy",
"flask.Flask",
"flask.abort",
"flask.jsonify",
"functools.wraps",
"flask.Response"
] | [((177, 192), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (182, 192), False, 'from flask import Flask, jsonify, abort, request, Response\n'), ((300, 315), 'flask.ext.sqlalchemy.SQLAlchemy', 'SQLAlchemy', (['app'], {}), '(app)\n', (310, 315), False, 'from flask.ext.sqlalchemy import SQLAlchemy\n'), ((105... |
"""
Automatic 2D class selection tool.
MIT License
Copyright (c) 2019 <NAME> Institute of Molecular Physiology
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 with... | [
"h5py.File",
"numpy.abs",
"numpy.nan_to_num",
"os.path.basename",
"numpy.std",
"scipy.fftpack.fftshift",
"os.path.isdir",
"numpy.flipud",
"numpy.fliplr",
"os.path.isfile",
"numpy.mean",
"scipy.fftpack.fft2",
"PIL.Image.fromarray",
"h5py.is_hdf5",
"os.path.join",
"os.listdir",
"mrcfil... | [((1861, 1913), 'numpy.sqrt', 'np.sqrt', (['((X - center[0]) ** 2 + (Y - center[1]) ** 2)'], {}), '((X - center[0]) ** 2 + (Y - center[1]) ** 2)\n', (1868, 1913), True, 'import numpy as np\n'), ((2499, 2516), 'scipy.fftpack.fft2', 'fftpack.fft2', (['img'], {}), '(img)\n', (2511, 2516), False, 'from scipy import fftpack... |
# Generated by Django 2.1.7 on 2019-02-15 07:55
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [("question", "0005_merge_20190215_0616")]
operations = [
migrations.RemoveField(model_name="answer", name="is_visible"),
migrations.RemoveField(model_name=... | [
"django.db.migrations.RemoveField"
] | [((214, 276), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""answer"""', 'name': '"""is_visible"""'}), "(model_name='answer', name='is_visible')\n", (236, 276), False, 'from django.db import migrations\n'), ((286, 349), 'django.db.migrations.RemoveField', 'migrations.RemoveField',... |
"""
Plugin for better notifications with actions.
HexChat Python Interface: http://hexchat.readthedocs.io/en/latest/script_python.html
IRC String Formatting: https://github.com/myano/jenni/wiki/IRC-String-Formatting
"""
import logging
import re
import subprocess
import sys
from os import path
import dbus
import hexc... | [
"os.path.expanduser",
"hexchat.hook_unload",
"logging.error",
"dbus.SessionBus",
"sys.__excepthook__",
"logging.debug",
"logging.warning",
"hexchat.hook_print",
"hexchat.command",
"hexchat.get_info",
"logging.info",
"dbus.Interface",
"re.sub"
] | [((4898, 4986), 'logging.info', 'logging.info', (['"""HexChat notification plugin starting =============================="""'], {}), "(\n 'HexChat notification plugin starting ==============================')\n", (4910, 4986), False, 'import logging\n'), ((5074, 5131), 'logging.info', 'logging.info', (['"""Setting c... |
import csv
from ...utils import quiet_remove
from ..delimited import cant_handle_hint
from ..processing_instructions import ProcessingInstructions
from ..records_format import DelimitedRecordsFormat
from records_mover.mover_types import _assert_never
import logging
from typing import Set, Dict
logger = logging.getLog... | [
"records_mover.mover_types._assert_never",
"logging.getLogger"
] | [((306, 333), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (323, 333), False, 'import logging\n'), ((1811, 1839), 'records_mover.mover_types._assert_never', '_assert_never', (['hints.quoting'], {}), '(hints.quoting)\n', (1824, 1839), False, 'from records_mover.mover_types import _assert... |
from raptiformica.actions.prune import ensure_neighbour_removed_from_config_by_host
from tests.testcase import TestCase
class TestEnsureNeighbourRemovedFromConfigByHost(TestCase):
def setUp(self):
self._del_neighbour_by_key = self.set_up_patch(
'raptiformica.actions.prune._del_neighbour_by_key... | [
"raptiformica.actions.prune.ensure_neighbour_removed_from_config_by_host"
] | [((432, 487), 'raptiformica.actions.prune.ensure_neighbour_removed_from_config_by_host', 'ensure_neighbour_removed_from_config_by_host', (['"""1.2.3.4"""'], {}), "('1.2.3.4')\n", (476, 487), False, 'from raptiformica.actions.prune import ensure_neighbour_removed_from_config_by_host\n')] |
from math import cos, sin
import numpy as np
from ....simulator import Agent
from .quintic_polynomials_planner import quinic_polynomials_planner
class TeacherQuinticPolynomials(Agent):
def learn(self, state, action):
raise NotImplementedError()
def explore(self, state, horizon=1):
raise NotI... | [
"numpy.array",
"math.cos",
"math.sin"
] | [((953, 976), 'numpy.array', 'np.array', (['trajectory[3]'], {}), '(trajectory[3])\n', (961, 976), True, 'import numpy as np\n'), ((1292, 1303), 'math.cos', 'cos', (['action'], {}), '(action)\n', (1295, 1303), False, 'from math import cos, sin\n'), ((1343, 1354), 'math.sin', 'sin', (['action'], {}), '(action)\n', (1346... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# 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... | [
"os.listdir",
"mindspore.context.set_context",
"mindspore.ops.Argmax",
"numpy.random.seed",
"argparse.ArgumentParser",
"mindspore.ops.ExpandDims",
"numpy.fromfile",
"mindspore.ops.L2Normalize",
"mindspore.Tensor",
"mindspore.ops.BatchMatMul",
"functools.reduce",
"os.path.join",
"src.util.Ave... | [((1547, 1585), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 'shot_shape'], {}), '(lambda x, y: x * y, shot_shape)\n', (1553, 1585), False, 'from functools import reduce\n'), ((1602, 1641), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 'query_shape'], {}), '(lambda x, y: x * y, query_shape)\n', (16... |
from picamera import PiCamera
from picamera.exc import PiCameraMMALError
from time import sleep
from io import StringIO
from glob import glob
from os.path import getsize
if __name__ == "__main__":
tries = 0
while tries < 5:
try:
cam = PiCamera(camera_num=0)
except PiCameraMMALError... | [
"io.StringIO",
"os.path.getsize",
"time.sleep",
"glob.glob",
"picamera.PiCamera"
] | [((511, 519), 'time.sleep', 'sleep', (['(4)'], {}), '(4)\n', (516, 519), False, 'from time import sleep\n'), ((542, 552), 'io.StringIO', 'StringIO', ([], {}), '()\n', (550, 552), False, 'from io import StringIO\n'), ((265, 287), 'picamera.PiCamera', 'PiCamera', ([], {'camera_num': '(0)'}), '(camera_num=0)\n', (273, 287... |
from redis.client import Redis
redis = Redis()
__all__ = ['redis']
| [
"redis.client.Redis"
] | [((40, 47), 'redis.client.Redis', 'Redis', ([], {}), '()\n', (45, 47), False, 'from redis.client import Redis\n')] |
"""
[2020-02-03] Modified version of the original qcodes.plots.colors
Mofied by <NAME> for Measurement Control
It modules makes available all the colors maps from the qcodes, context menu of
the color bar from pyqtgraph, the circular colormap created by me (Victo),
and the reversed version of all of them.
Feel free t... | [
"pycqed.analysis.tools.plotting.make_anglemap45_colorlist"
] | [((7886, 7931), 'pycqed.analysis.tools.plotting.make_anglemap45_colorlist', 'make_anglemap45_colorlist', ([], {'N': '(9)', 'use_hpl': '(False)'}), '(N=9, use_hpl=False)\n', (7911, 7931), False, 'from pycqed.analysis.tools.plotting import make_anglemap45_colorlist\n')] |
import django
from channels.routing import ProtocolTypeRouter
from baserow.ws.routers import websocket_router
from django.core.asgi import get_asgi_application
django.setup()
django_asgi_app = get_asgi_application()
application = ProtocolTypeRouter(
{"http": django_asgi_app, "websocket": websocket_router}
)
| [
"django.setup",
"django.core.asgi.get_asgi_application",
"channels.routing.ProtocolTypeRouter"
] | [((164, 178), 'django.setup', 'django.setup', ([], {}), '()\n', (176, 178), False, 'import django\n'), ((198, 220), 'django.core.asgi.get_asgi_application', 'get_asgi_application', ([], {}), '()\n', (218, 220), False, 'from django.core.asgi import get_asgi_application\n'), ((236, 312), 'channels.routing.ProtocolTypeRou... |
######################################################################################################################
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# ... | [
"re.compile",
"datetime.date.today",
"logging.getLogger",
"boto3.client"
] | [((1621, 1640), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (1638, 1640), False, 'import re, boto3, logging, os\n'), ((3740, 3759), 'boto3.client', 'boto3.client', (['"""sts"""'], {}), "('sts')\n", (3752, 3759), False, 'import re, boto3, logging, os\n'), ((2393, 2414), 're.compile', 're.compile', (['"""... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils.box_utils import match
class MultiBoxLoss_combined(nn.Module):
"""SSD Weighted Loss Function
Compute Targets:
1) Produce Confidence Target Indices by matching ground truth boxes
with (default) 'priorboxes' that h... | [
"torch.sum",
"torch.cat",
"torch.exp",
"torch.clamp",
"torch.Tensor",
"torch.no_grad",
"torch.nn.functional.smooth_l1_loss",
"torch.BoolTensor",
"utils.box_utils.match"
] | [((3576, 3624), 'torch.nn.functional.smooth_l1_loss', 'F.smooth_l1_loss', (['loc_p', 'loc_t'], {'reduction': '"""none"""'}), "(loc_p, loc_t, reduction='none')\n", (3592, 3624), True, 'import torch.nn.functional as F\n'), ((5193, 5225), 'torch.cat', 'torch.cat', (['(logit_0, logit_k)', '(1)'], {}), '((logit_0, logit_k),... |
import logging
import os
import re
import uuid
from typing import List, Optional, FrozenSet
import pytest
import argclass
class TestBasics:
class Parser(argclass.Parser):
integers: List[int] = argclass.Argument(
"integers", type=int,
nargs=argclass.Nargs.ONE_OR_MORE, metavar="N",... | [
"uuid.uuid4",
"argclass.Argument",
"os.environ.pop",
"pytest.raises"
] | [((9310, 9341), 'os.environ.pop', 'os.environ.pop', (['"""TEST_REQUIRED"""'], {}), "('TEST_REQUIRED')\n", (9324, 9341), False, 'import os\n'), ((209, 338), 'argclass.Argument', 'argclass.Argument', (['"""integers"""'], {'type': 'int', 'nargs': 'argclass.Nargs.ONE_OR_MORE', 'metavar': '"""N"""', 'help': '"""an integer f... |
# Copyright (c) OpenMMLab. All rights reserved.
import warnings
from mmcv.utils import Registry, build_from_cfg
PRIOR_GENERATORS = Registry('Generator for anchors and points')
ANCHOR_GENERATORS = PRIOR_GENERATORS
def build_prior_generator(cfg, default_args=None):
return build_from_cfg(cfg, PRIOR_GEN... | [
"warnings.warn",
"mmcv.utils.build_from_cfg",
"mmcv.utils.Registry"
] | [((138, 182), 'mmcv.utils.Registry', 'Registry', (['"""Generator for anchors and points"""'], {}), "('Generator for anchors and points')\n", (146, 182), False, 'from mmcv.utils import Registry, build_from_cfg\n'), ((291, 342), 'mmcv.utils.build_from_cfg', 'build_from_cfg', (['cfg', 'PRIOR_GENERATORS', 'default_args'], ... |
"""
System tests.
<NAME> <<EMAIL>>
"""
import os
import re
import sh
from . import utils
def test_stdout():
"""Verify stdout and stderr.
pytest docs on capturing stdout and stderr
https://pytest.readthedocs.io/en/2.7.3/capture.html
"""
mailmerge_cmd = sh.Command("mailmerge")
output = mailmer... | [
"re.sub",
"os.path.join",
"sh.Command"
] | [((276, 299), 'sh.Command', 'sh.Command', (['"""mailmerge"""'], {}), "('mailmerge')\n", (286, 299), False, 'import sh\n'), ((853, 884), 're.sub', 're.sub', (['"""Date.*\\\\n"""', '""""""', 'stdout'], {}), "('Date.*\\\\n', '', stdout)\n", (859, 884), False, 'import re\n'), ((350, 401), 'os.path.join', 'os.path.join', ([... |
import argparse
import torch
import cv2
import os
import torch.nn.parallel
import modules, net, resnet, densenet, senet
import numpy as np
import loaddata_demo as loaddata
import pdb
import argparse
from volume import get_volume
from mask import get_mask
import matplotlib.image
import matplotlib.pyplot as plt
parser ... | [
"argparse.ArgumentParser",
"net.model",
"os.path.join",
"loaddata_demo.readNyu2",
"torch.load",
"os.path.exists",
"senet.senet154",
"mask.get_mask",
"cv2.resize",
"densenet.densenet161",
"modules.E_senet",
"torch.autograd.Variable",
"cv2.applyColorMap",
"os.makedirs",
"modules.E_resnet",... | [((322, 371), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""KD-network"""'}), "(description='KD-network')\n", (345, 371), False, 'import argparse\n'), ((1874, 1894), 'cv2.imread', 'cv2.imread', (['args.img'], {}), '(args.img)\n', (1884, 1894), False, 'import cv2\n'), ((1914, 1941), 'loa... |
# Generated by Django 2.1.5 on 2019-09-11 07:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('features', '0016_auto_20190605_1830'),
]
operations = [
migrations.AlterField(
model_name='feature',
name='apps',
... | [
"django.db.models.ManyToManyField"
] | [((336, 444), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ([], {'related_name': '"""app_features"""', 'to': '"""applications.Application"""', 'verbose_name': '"""关联应用"""'}), "(related_name='app_features', to=\n 'applications.Application', verbose_name='关联应用')\n", (358, 444), False, 'from django.db ... |
from django.db import models
from django.utils import timezone
from django.utils.text import slugify
from django.utils.translation import gettext_lazy as _
from modelcluster.fields import ParentalKey
from modelcluster.models import ClusterableModel
from wagtail.core.fields import RichTextField
from hextech_core.core.m... | [
"django.db.models.ManyToManyField",
"modelcluster.fields.ParentalKey",
"django.utils.translation.gettext_lazy",
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.utils.timezone.now",
"django.db.models.SlugField",
"django.db.models.BooleanField",
"django.utils.text.slugify",
"hex... | [((567, 679), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""self"""'], {'on_delete': 'models.PROTECT', 'related_name': '"""child_categories"""', 'null': '(True)', 'blank': '(True)'}), "('self', on_delete=models.PROTECT, related_name=\n 'child_categories', null=True, blank=True)\n", (584, 679), False, 'fr... |
import torch
import torch.nn.functional as F
import torch.utils.data
import torch.utils.data
from models.base_models import OCModel, PUModelRandomBatch
from models.classifiers import Net
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
# code DROCC is borrowed from https://github.com/microsoft/... | [
"torch.autograd.grad",
"torch.nn.functional.binary_cross_entropy_with_logits",
"torch.randn",
"torch.squeeze",
"torch.clamp",
"torch.cuda.is_available",
"torch.enable_grad",
"torch.zeros",
"torch.no_grad"
] | [((221, 246), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (244, 246), False, 'import torch\n'), ((1157, 1178), 'torch.squeeze', 'torch.squeeze', (['target'], {}), '(target)\n', (1170, 1178), False, 'import torch\n'), ((1358, 1386), 'torch.squeeze', 'torch.squeeze', (['logits'], {'dim': '(1)'... |
import argparse
import asyncio
import logging
import datetime
import sys
import json
from aiofile import AIOFile
async def read_from_socket(host, port):
timer = 0
reader, writer = None, None
async with AIOFile("text.txt", 'a') as _file:
while True:
try:
if not reader o... | [
"logging.error",
"logging.debug",
"argparse.ArgumentParser",
"json.loads",
"logging.basicConfig",
"logging.warning",
"asyncio.open_connection",
"asyncio.sleep",
"logging.info",
"aiofile.AIOFile",
"datetime.datetime.now",
"sys.exit"
] | [((2552, 2570), 'json.loads', 'json.loads', (['answer'], {}), '(answer)\n', (2562, 2570), False, 'import json\n'), ((2615, 2635), 'logging.debug', 'logging.debug', (['token'], {}), '(token)\n', (2628, 2635), False, 'import logging\n'), ((3093, 3132), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging... |
# coding=utf-8
# *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***
import warnings
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
from .. import... | [
"pulumi.get",
"pulumi.getter",
"pulumi.set",
"pulumi.InvokeOptions",
"pulumi.runtime.invoke"
] | [((2597, 2632), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""compartmentId"""'}), "(name='compartmentId')\n", (2610, 2632), False, 'import pulumi\n'), ((2818, 2851), 'pulumi.getter', 'pulumi.getter', ([], {'name': '"""definedTags"""'}), "(name='definedTags')\n", (2831, 2851), False, 'import pulumi\n'), ((3484, 3... |
import unittest
from flask.ext.imagine.filters.interface import ImagineFilterInterface
class TestImagineFilterInterface(unittest.TestCase):
interface = None
def setUp(self):
self.interface = ImagineFilterInterface()
def test_not_implemented_apply_method(self):
with self.assertRaises(NotI... | [
"flask.ext.imagine.filters.interface.ImagineFilterInterface"
] | [((210, 234), 'flask.ext.imagine.filters.interface.ImagineFilterInterface', 'ImagineFilterInterface', ([], {}), '()\n', (232, 234), False, 'from flask.ext.imagine.filters.interface import ImagineFilterInterface\n')] |
#!/usr/bin/env python3
"""Separates Altera's junky concatenated CSV files into unique files
We do this in two steps:
1. Move all existing *.txt files to *.tmp files
2. Go through and break up at the start of each CSV file into a new file
"""
import os
import sys
from pathlib import Path
def main(root: str):
ro... | [
"os.getcwd",
"pathlib.Path"
] | [((330, 340), 'pathlib.Path', 'Path', (['root'], {}), '(root)\n', (334, 340), False, 'from pathlib import Path\n'), ((1473, 1484), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1482, 1484), False, 'import os\n')] |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
from django.contrib import admin
from .. import models
from .bind import BindAdmin
admin.site.register(models.Bind, BindAdmin)
| [
"django.contrib.admin.site.register"
] | [((165, 208), 'django.contrib.admin.site.register', 'admin.site.register', (['models.Bind', 'BindAdmin'], {}), '(models.Bind, BindAdmin)\n', (184, 208), False, 'from django.contrib import admin\n')] |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.nn import utils
import math
class conv5x5(nn.Module):
def __init__(self, in_channels, out_channels, stride=1, dilation=1):
super(conv5x5, self).__init__()
self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=5, s... | [
"torch.nn.init._calculate_fan_in_and_fan_out",
"torch.nn.ReLU",
"math.sqrt",
"torch.nn.utils.spectral_norm",
"torch.nn.Conv2d",
"torch.nn.Unfold",
"torch.nn.init.uniform_",
"torch.nn.init.constant_",
"torch.Tensor",
"torch.nn.functional.pixel_shuffle",
"torch.nn.functional.elu"
] | [((267, 391), 'torch.nn.Conv2d', 'nn.Conv2d', (['in_channels', 'out_channels'], {'kernel_size': '(5)', 'stride': 'stride', 'padding': '(2 * dilation)', 'dilation': 'dilation', 'bias': '(False)'}), '(in_channels, out_channels, kernel_size=5, stride=stride, padding=\n 2 * dilation, dilation=dilation, bias=False)\n', (... |
import pytest
from dvc.dvcfile import Lockfile, LockfileCorruptedError
from dvc.stage import PipelineStage
from dvc.utils.serialize import dump_yaml
def test_stage_dump_no_outs_deps(tmp_dir, dvc):
stage = PipelineStage(name="s1", repo=dvc, path="path", cmd="command")
lockfile = Lockfile(dvc, "path.lock")
... | [
"dvc.stage.PipelineStage",
"dvc.utils.serialize.dump_yaml",
"pytest.raises",
"dvc.dvcfile.Lockfile",
"pytest.mark.parametrize"
] | [((1797, 2037), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""corrupt_data"""', "[{'s1': {'outs': []}}, {'s1': {}}, {'s1': {'cmd': 'command', 'outs': [{\n 'md5': 'checksum', 'path': 'path', 'random': 'value'}]}}, {'s1': {'cmd':\n 'command', 'deps': [{'md5': 'checksum'}]}}]"], {}), "('corrupt_data', ... |
# Import modulov
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
rc('text', usetex=True)
# Výpočtová oblasť
xmin = -1.0
xmax = 1.0
xn = 101 # Počet vzorkovacích bodov funkcie "f" na intervale "[xmin, xmax]"
ymin = xmin
ymax = xmax
yn = xn # Počet vzorkovacích bodov funkc... | [
"matplotlib.rc",
"matplotlib.pyplot.show",
"numpy.abs",
"numpy.sin",
"numpy.linspace",
"numpy.cos",
"matplotlib.pyplot.subplots"
] | [((94, 117), 'matplotlib.rc', 'rc', (['"""text"""'], {'usetex': '(True)'}), "('text', usetex=True)\n", (96, 117), False, 'from matplotlib import rc\n'), ((783, 830), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': '(12.0 / 2.54, 8.0 / 2.54)'}), '(figsize=(12.0 / 2.54, 8.0 / 2.54))\n', (795, 830), True, '... |
import requests
from bs4 import BeautifulSoup
from selenium import webdriver
# url = 'https://fontawesome.com/cheatsheet/pro'
# req = requests.get(url)
# markup = req.text
# print(markup)
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expe... | [
"bs4.BeautifulSoup",
"selenium.webdriver.support.expected_conditions.presence_of_element_located",
"selenium.webdriver.support.ui.WebDriverWait",
"selenium.webdriver.Chrome"
] | [((453, 471), 'selenium.webdriver.Chrome', 'webdriver.Chrome', ([], {}), '()\n', (469, 471), False, 'from selenium import webdriver\n'), ((1565, 1623), 'bs4.BeautifulSoup', 'BeautifulSoup', (['browser.page_source'], {'features': '"""html.parser"""'}), "(browser.page_source, features='html.parser')\n", (1578, 1623), Fal... |
import requests
result = requests.post(
"https://asia-northeast1-mlops-331003.cloudfunctions.net/function-1",
json={"msg": "Hello from cloud functions"},
)
print(result.json())
| [
"requests.post"
] | [((28, 164), 'requests.post', 'requests.post', (['"""https://asia-northeast1-mlops-331003.cloudfunctions.net/function-1"""'], {'json': "{'msg': 'Hello from cloud functions'}"}), "(\n 'https://asia-northeast1-mlops-331003.cloudfunctions.net/function-1',\n json={'msg': 'Hello from cloud functions'})\n", (41, 164), ... |
import os
from pathlib import Path
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = os.environ.get('SECRET_KEY')
ALLOWED_HOSTS = ['.herokuapp.com', 'localhost', '127.0.0.1']
ENIVRONMENT = os.environ.get('ENVIRONMENT', default='development... | [
"os.environ.get",
"socket.gethostname",
"pathlib.Path",
"os.path.join",
"dj_database_url.config"
] | [((165, 193), 'os.environ.get', 'os.environ.get', (['"""SECRET_KEY"""'], {}), "('SECRET_KEY')\n", (179, 193), False, 'import os\n'), ((270, 322), 'os.environ.get', 'os.environ.get', (['"""ENVIRONMENT"""'], {'default': '"""development"""'}), "('ENVIRONMENT', default='development')\n", (284, 322), False, 'import os\n'), ... |
import numpy as np
import scipy
from ._hist import take_bins
__all__ = ['ecdf']
__EPSILON__ = 1e-8
#--------------------------------------------------------------------
def ecdf(x,y=None):
'''
Empirical Cumulative Density Function (ECDF).
Parameters
-----------
* x,y: 1d ndarrays,
if y ... | [
"numpy.asarray",
"numpy.searchsorted",
"numpy.sort",
"numpy.cumsum",
"numpy.max",
"numpy.array",
"numpy.concatenate"
] | [((969, 980), 'numpy.array', 'np.array', (['x'], {}), '(x)\n', (977, 980), True, 'import numpy as np\n'), ((989, 999), 'numpy.sort', 'np.sort', (['x'], {}), '(x)\n', (996, 999), True, 'import numpy as np\n'), ((1165, 1187), 'numpy.concatenate', 'np.concatenate', (['(x, y)'], {}), '((x, y))\n', (1179, 1187), True, 'impo... |
import datetime
import json
import dateutil.parser
from django.contrib.auth import get_user_model
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from rest_framework import status
from apps.physicaldevice.models import Device
from apps.streamfilter.models import *
... | [
"django.utils.timezone.now",
"django.contrib.auth.get_user_model",
"django.urls.reverse",
"apps.physicaldevice.models.Device.objects.create_device",
"apps.physicaldevice.models.Device.objects.all"
] | [((438, 454), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (452, 454), False, 'from django.contrib.auth import get_user_model\n'), ((646, 746), 'apps.physicaldevice.models.Device.objects.create_device', 'Device.objects.create_device', ([], {'project': 'self.p1', 'label': '"""d1"""', 'templa... |
import operator
import math
import numpy as np
from rtlsdr import RtlSdr
import matplotlib.pyplot as plt
# Available sample rates
'''
3200000Hz
2800000Hz
2560000Hz
2400000Hz
2048000Hz
1920000Hz
1800000Hz
1400000Hz
1024000Hz
900001Hz
250000Hz
'''
# Receiver class. This needs receiving parameters and will receive data ... | [
"rtlsdr.RtlSdr",
"numpy.fft.fft",
"numpy.mean",
"numpy.array",
"numpy.fft.fftshift",
"numpy.linspace",
"numpy.hanning",
"numpy.log10"
] | [((446, 454), 'rtlsdr.RtlSdr', 'RtlSdr', ([], {}), '()\n', (452, 454), False, 'from rtlsdr import RtlSdr\n'), ((1237, 1303), 'numpy.linspace', 'np.linspace', ([], {'start': 'start_freq', 'stop': 'stop_freq', 'num': 'self.resolution'}), '(start=start_freq, stop=stop_freq, num=self.resolution)\n', (1248, 1303), True, 'im... |
from bindsnet.network.nodes import Input, LIFNodes
from bindsnet.network.topology import Connection
from bindsnet.learning import PostPre
source_layer = Input(n=100, traces=True)
target_layer = LIFNodes(n=1000, traces=True)
connection = Connection(
source=source_layer,
target=target_layer,
update_rule=Pos... | [
"bindsnet.network.nodes.Input",
"bindsnet.network.topology.Connection",
"bindsnet.network.nodes.LIFNodes"
] | [((154, 179), 'bindsnet.network.nodes.Input', 'Input', ([], {'n': '(100)', 'traces': '(True)'}), '(n=100, traces=True)\n', (159, 179), False, 'from bindsnet.network.nodes import Input, LIFNodes\n'), ((195, 224), 'bindsnet.network.nodes.LIFNodes', 'LIFNodes', ([], {'n': '(1000)', 'traces': '(True)'}), '(n=1000, traces=T... |
# C&C NLP tools
# Copyright (c) Universities of Edinburgh, Oxford and Sydney
# Copyright (c) <NAME>
#
# This software is covered by a non-commercial use licence.
# See LICENCE.txt for the full text of the licence.
#
# If LICENCE.txt is not included in this distribution
# please email <EMAIL> to obtain a copy.
from bas... | [
"ccg.ParserConfig",
"tagger.SuperConfig",
"ccg.IntegrationConfig"
] | [((451, 474), 'ccg.IntegrationConfig', 'ccg.IntegrationConfig', ([], {}), '()\n', (472, 474), False, 'import ccg\n'), ((489, 509), 'tagger.SuperConfig', 'tagger.SuperConfig', ([], {}), '()\n', (507, 509), False, 'import tagger\n'), ((556, 574), 'ccg.ParserConfig', 'ccg.ParserConfig', ([], {}), '()\n', (572, 574), False... |
from django.db import models
# Create your models here.
class Blog(models.Model):
"""
Represents a project model in home page.
"""
title = models.CharField(max_length=50)
description = models.CharField(max_length=150)
date = models.DateField()
def __str__(self):
return self.tit... | [
"django.db.models.CharField",
"django.db.models.DateField"
] | [((156, 187), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (172, 187), False, 'from django.db import models\n'), ((206, 238), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(150)'}), '(max_length=150)\n', (222, 238), False, 'from django.db ... |
import telnetlib
import time
tn = telnetlib.Telnet('192.168.137.226', 5051)
#tn.write(b"Client")
time.sleep(1)
for i in range(5):
print("Now writing ?Q102")
tn.write(b"?Q102\n")
status = tn.read_until(b"\n",timeout=1).decode("utf-8")
print(f"Data received: {status}")
print("Now writing ?Q104")
... | [
"telnetlib.Telnet",
"time.sleep"
] | [((35, 76), 'telnetlib.Telnet', 'telnetlib.Telnet', (['"""192.168.137.226"""', '(5051)'], {}), "('192.168.137.226', 5051)\n", (51, 76), False, 'import telnetlib\n'), ((98, 111), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (108, 111), False, 'import time\n')] |
"""Define version constants."""
import re
__version__ = '1.0.0'
__version_info__ = tuple(re.split('[.-]', __version__))
| [
"re.split"
] | [((91, 120), 're.split', 're.split', (['"""[.-]"""', '__version__'], {}), "('[.-]', __version__)\n", (99, 120), False, 'import re\n')] |
#!/usr/bin/env python
# Copyright 2013 Netflix
"""Push all repos to stash
"""
from nflx_oc.commands.dev.repos import run_for_all_repos
def main():
run_for_all_repos('git push origin master')
| [
"nflx_oc.commands.dev.repos.run_for_all_repos"
] | [((156, 199), 'nflx_oc.commands.dev.repos.run_for_all_repos', 'run_for_all_repos', (['"""git push origin master"""'], {}), "('git push origin master')\n", (173, 199), False, 'from nflx_oc.commands.dev.repos import run_for_all_repos\n')] |
from __future__ import print_function
import numpy as np
def faces_with_repeated_vertices(f):
if f.shape[1] == 3:
return np.unique(np.concatenate([
np.where(f[:, 0] == f[:, 1])[0],
np.where(f[:, 0] == f[:, 2])[0],
np.where(f[:, 1] == f[:, 2])[0],
]))
else:
... | [
"numpy.where"
] | [((734, 749), 'numpy.where', 'np.where', (['(f < 0)'], {}), '(f < 0)\n', (742, 749), True, 'import numpy as np\n'), ((174, 202), 'numpy.where', 'np.where', (['(f[:, 0] == f[:, 1])'], {}), '(f[:, 0] == f[:, 1])\n', (182, 202), True, 'import numpy as np\n'), ((219, 247), 'numpy.where', 'np.where', (['(f[:, 0] == f[:, 2])... |
import unittest
import os
from icalendar import Calendar
import random
import string
from datetime import timedelta, datetime as dt
import pytz
from util import Singleton
from .. import CalService, CalRemote, iCloudCaldavRemote, Event
@Singleton
class CalMockRemote(CalRemote):
def create_calendar(self):
... | [
"random.choices",
"datetime.datetime",
"pytz.utc.localize",
"icalendar.Calendar",
"datetime.timedelta",
"datetime.datetime.now",
"os.getenv"
] | [((336, 346), 'icalendar.Calendar', 'Calendar', ([], {}), '()\n', (344, 346), False, 'from icalendar import Calendar\n'), ((894, 919), 'pytz.utc.localize', 'pytz.utc.localize', (['dt.max'], {}), '(dt.max)\n', (911, 919), False, 'import pytz\n'), ((1276, 1313), 'os.getenv', 'os.getenv', (['"""CALDAV_PURGABLE_CALENDAR"""... |
# coding=utf-8
import itertools
from contracts.utils import raise_wrapped
from nose.tools import nottest
from geometry import MatrixLieGroup, RandomManifold, all_manifolds, logger
from .checks_generation import *
def list_manifolds():
return all_manifolds
@nottest
def get_test_points(M, num_random=2):
int... | [
"geometry.logger.warning",
"contracts.utils.raise_wrapped",
"itertools.product"
] | [((537, 596), 'geometry.logger.warning', 'logger.warning', (["('No test points for %s and not random.' % M)"], {}), "('No test points for %s and not random.' % M)\n", (551, 596), False, 'from geometry import MatrixLieGroup, RandomManifold, all_manifolds, logger\n'), ((2139, 2182), 'itertools.product', 'itertools.produc... |
import collections
import heapq
from typing import List
def find_town_judge(n: int, trust: List[List[int]]) -> int:
trusts = {i + 1: 0 for i in range(n)}
outgoing = {i + 1 for i in range(n)}
for origin, destination in trust:
if origin in outgoing:
outgoing.remove(origin)
trust... | [
"collections.defaultdict",
"heapq.heappush",
"collections.deque",
"heapq.heappop"
] | [((1303, 1325), 'collections.deque', 'collections.deque', (['[0]'], {}), '([0])\n', (1320, 1325), False, 'import collections\n'), ((4619, 4648), 'collections.defaultdict', 'collections.defaultdict', (['bool'], {}), '(bool)\n', (4642, 4648), False, 'import collections\n'), ((5197, 5225), 'collections.defaultdict', 'coll... |
# encoding: utf-8
import re
import base64
from ..utils import int_or_none
from ..extractor.arte import ArteTVBaseIE
from ..compat import (
compat_str,
)
from ..utils import (
ExtractorError,
int_or_none,
qualities,
try_get,
unified_strdate,
)
def _extract_from_json_url(self, json_url, video_... | [
"re.match",
"re.escape"
] | [((2047, 2066), 're.escape', 're.escape', (['langcode'], {}), '(langcode)\n', (2056, 2066), False, 'import re\n'), ((4321, 4345), 're.match', 're.match', (['p', 'versionCode'], {}), '(p, versionCode)\n', (4329, 4345), False, 'import re\n')] |
import os
ls=["python main.py --configs configs/eval_covid20cases_unetplusplus_timm-regnetx_002_0_CoarseDropout.yml",
"python main.py --configs configs/eval_covid20cases_unetplusplus_timm-regnetx_002_1_CoarseDropout.yml",
"python main.py --configs configs/eval_covid20cases_unetplusplus_timm-regnetx_002_2_CoarseDropout... | [
"os.system"
] | [((553, 565), 'os.system', 'os.system', (['l'], {}), '(l)\n', (562, 565), False, 'import os\n')] |
import argparse
import numpy as np
from packaging import version
import os
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="2,3"
from PIL import Image
import matplotlib.pyplot as plt
import cv2
from skimage.transform import rotate
import torch
from torch.autograd import Variable
impo... | [
"os.makedirs",
"argparse.ArgumentParser",
"numpy.argmax",
"torch.autograd.Variable",
"torch.load",
"dataset.refuge.REFUGE",
"os.path.exists",
"packaging.version.parse",
"torch.nn.Upsample",
"models.unet.UNet"
] | [((1465, 1516), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Unet Network"""'}), "(description='Unet Network')\n", (1488, 1516), False, 'import argparse\n'), ((2912, 2947), 'models.unet.UNet', 'UNet', (['(3)'], {'n_classes': 'args.num_classes'}), '(3, n_classes=args.num_classes)\n', (2... |
import os
import unittest
import subprocess
from paper2tmb.manipulator import Manipulator
class TestManipulator(unittest.TestCase):
def test_init(self):
with Manipulator('test.pdf') as m:
self.assertTrue(os.path.isdir(m.dirname))
def test_pdf2png(self):
with Manipulator("paper2t... | [
"paper2tmb.manipulator.Manipulator",
"os.path.isdir",
"os.path.exists",
"subprocess.call",
"os.path.join"
] | [((3156, 3187), 'subprocess.call', 'subprocess.call', (["['rm', target]"], {}), "(['rm', target])\n", (3171, 3187), False, 'import subprocess\n'), ((174, 197), 'paper2tmb.manipulator.Manipulator', 'Manipulator', (['"""test.pdf"""'], {}), "('test.pdf')\n", (185, 197), False, 'from paper2tmb.manipulator import Manipulato... |
from rdkit import Chem
def mol_with_atom_index(mol):
atoms = mol.GetNumAtoms()
tmp_mol = Chem.Mol(mol)
for idx in range(atoms):
tmp_mol.GetAtomWithIdx(idx).SetProp('molAtomMapNumber', str(tmp_mol.GetAtomWithIdx(idx).GetIdx()))
return tmp_mol
def unique_mols(sequence):
seen = set()
retu... | [
"rdkit.Chem.Mol"
] | [((98, 111), 'rdkit.Chem.Mol', 'Chem.Mol', (['mol'], {}), '(mol)\n', (106, 111), False, 'from rdkit import Chem\n')] |
# The frozendict is originally available under the following license:
#
# Copyright (c) 2012 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without li... | [
"copy.deepcopy",
"copy.copy"
] | [((2100, 2115), 'copy.copy', 'copy.copy', (['item'], {}), '(item)\n', (2109, 2115), False, 'import copy\n'), ((2682, 2704), 'copy.deepcopy', 'copy.deepcopy', (['v', 'memo'], {}), '(v, memo)\n', (2695, 2704), False, 'import copy\n')] |
"""
Copyright 2017-present, Airbnb Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, sof... | [
"stream_alert_cli.logger.LOGGER_CLI.error",
"stream_alert_cli.logger.LOGGER_CLI.exception",
"boto3.client",
"stream_alert_cli.logger.LOGGER_CLI.warn",
"stream_alert_cli.logger.LOGGER_CLI.info"
] | [((1351, 1475), 'stream_alert_cli.logger.LOGGER_CLI.info', 'LOGGER_CLI.info', (['"""Rolling back %s:production from version %d => %d"""', 'function_name', 'current_version', '(current_version - 1)'], {}), "('Rolling back %s:production from version %d => %d',\n function_name, current_version, current_version - 1)\n",... |
from ortools.linear_solver import pywraplp
from ortools.sat.python import cp_model
def main():
solver = pywraplp.Solver.CreateSolver('SCIP')
infinity = solver.infinity()
# wrenches
wrenches = solver.IntVar(0.0, infinity, 'wrenches')
# pliers
pliers = solver.IntVar(0.0, infinity, 'pliers')
... | [
"ortools.linear_solver.pywraplp.Solver.CreateSolver"
] | [((109, 145), 'ortools.linear_solver.pywraplp.Solver.CreateSolver', 'pywraplp.Solver.CreateSolver', (['"""SCIP"""'], {}), "('SCIP')\n", (137, 145), False, 'from ortools.linear_solver import pywraplp\n')] |
from django.urls import path, include
from . import views
urlpatterns = [
path('accounts/', include('registration.backends.simple.urls')),
path('', views.FrontPage, name='FrontPage'),
path('tags', views.TagList, name='TagList'),
path('clips', views.ClipList, name='ClipList'),
path('playlist/... | [
"django.urls.path",
"django.urls.include"
] | [((152, 195), 'django.urls.path', 'path', (['""""""', 'views.FrontPage'], {'name': '"""FrontPage"""'}), "('', views.FrontPage, name='FrontPage')\n", (156, 195), False, 'from django.urls import path, include\n'), ((202, 245), 'django.urls.path', 'path', (['"""tags"""', 'views.TagList'], {'name': '"""TagList"""'}), "('ta... |
import pandas as pd
import numpy as np
import math
import util
def gimme_pseudo_winsors(inputDf, col, pw=0.05):
return util.round_to_sf(inputDf[col].quantile(pw),3), util.round_to_sf(inputDf[col].quantile(1-pw),3)
def gimme_starting_affect(inputDf, col, segs):
x = inputDf[col]
x1 = float(segs[0])
x2 = float(segs[... | [
"pandas.DataFrame",
"util.target_input_with_output",
"util.round_to_sf"
] | [((1694, 1712), 'pandas.DataFrame', 'pd.DataFrame', (['dyct'], {}), '(dyct)\n', (1706, 1712), True, 'import pandas as pd\n'), ((1931, 1990), 'util.target_input_with_output', 'util.target_input_with_output', (['optFunc', 'goodAmt', 'start', 'end'], {}), '(optFunc, goodAmt, start, end)\n', (1960, 1990), False, 'import ut... |
# TODO: Explain 8 corners logic at the top and use it consistently
# Add comments of explanation
import numpy as np
import scipy.spatial
from .rotation import rotate_points_along_z
def get_size(box):
"""
Args:
box: 8x3
Returns:
size: [dx, dy, dz]
"""
distance = scipy.spatial.dist... | [
"numpy.arctan2",
"numpy.sum",
"numpy.logical_and",
"numpy.roll",
"numpy.zeros",
"numpy.transpose",
"numpy.mean",
"numpy.array",
"numpy.reshape",
"numpy.matmul",
"numpy.tile",
"numpy.vstack"
] | [((646, 662), 'numpy.arctan2', 'np.arctan2', (['a', 'b'], {}), '(a, b)\n', (656, 662), True, 'import numpy as np\n'), ((1004, 1031), 'numpy.reshape', 'np.reshape', (['center', '(-1, 3)'], {}), '(center, (-1, 3))\n', (1014, 1031), True, 'import numpy as np\n'), ((1417, 1441), 'numpy.transpose', 'np.transpose', (['corner... |
from merc import config
from merc import feature
from merc import message
class MotdFeature(feature.Feature):
NAME = __name__
CONFIG_SECTION = 'motd'
install = MotdFeature.install
@MotdFeature.register_config_checker
def check_config(section):
return config.validate(section, str)
class MotdReply(message.R... | [
"merc.config.validate"
] | [((263, 292), 'merc.config.validate', 'config.validate', (['section', 'str'], {}), '(section, str)\n', (278, 292), False, 'from merc import config\n')] |
# Copyright 2021 the Autoware Foundation
#
# 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 ... | [
"launch.actions.DeclareLaunchArgument",
"launch.substitutions.LaunchConfiguration",
"launch.LaunchDescription",
"ament_index_python.get_package_share_directory",
"os.path.join"
] | [((1082, 1133), 'ament_index_python.get_package_share_directory', 'get_package_share_directory', (['"""autoware_auto_launch"""'], {}), "('autoware_auto_launch')\n", (1109, 1133), False, 'from ament_index_python import get_package_share_directory\n'), ((1178, 1265), 'os.path.join', 'os.path.join', (['autoware_auto_launc... |
""" Compute resonances using the cxroots library (contour integration techniques)
Authors: <NAME>, <NAME>
Karlsruhe Institute of Technology, Germany
University of California, Merced
Last modified: 20/04/2021
"""
from sys import argv
import matplotlib.pyplot as plt
import numpy as np
... | [
"scipy.special.h1vp",
"numpy.size",
"numpy.abs",
"scipy.special.ivp",
"numpy.amin",
"numpy.angle",
"numpy.argsort",
"numpy.shape",
"cxroots.Circle",
"numpy.where",
"scipy.special.iv",
"numpy.loadtxt",
"numpy.linspace",
"cxroots.AnnulusSector",
"numpy.amax",
"scipy.special.hankel1",
"... | [((482, 493), 'numpy.sqrt', 'np.sqrt', (['(-ε)'], {}), '(-ε)\n', (489, 493), True, 'import numpy as np\n'), ((834, 902), 'cxroots.AnnulusSector', 'AnnulusSector', ([], {'center': '(0.0)', 'radii': '(rMin, rMax)', 'phiRange': '(aMin, aMax)'}), '(center=0.0, radii=(rMin, rMax), phiRange=(aMin, aMax))\n', (847, 902), Fals... |
""" Advent of code 2020 day 4/2 """
import logging
import math
from os import path
import re
record_splitter = re.compile(' |\n')
# Field info:
# byr (Birth Year) - four digits; at least 1920 and at most 2002.
# iyr (Issue Year) - four digits; at least 2010 and at most 2020.
# eyr (Expiration Year) - four digits; at... | [
"os.path.dirname",
"re.match",
"re.compile"
] | [((113, 131), 're.compile', 're.compile', (['""" |\n"""'], {}), "(' |\\n')\n", (123, 131), False, 'import re\n'), ((809, 839), 're.match', 're.match', (['"""^(\\\\d+)(cm|in)$"""', 'x'], {}), "('^(\\\\d+)(cm|in)$', x)\n", (817, 839), False, 'import re\n'), ((1611, 1640), 're.match', 're.match', (['"""^#[a-f0-9]{6}$"""',... |
import os
import sys
import subprocess
from typing import Union, TextIO, List, AnyStr
import smpl.log_module as logger
#
# This module executes commands, manages output from those commands and provides a dry-run capability.
#
# The primary function is
#
# def run(cmd, where)
#
# dry-run and output options are c... | [
"sys.stdout.write",
"subprocess.run",
"subprocess.Popen",
"os.getcwd",
"smpl.log_module.init",
"smpl.log_module.set_stdout_logfile"
] | [((4732, 4766), 'smpl.log_module.init', 'logger.init', (['logger.LOG_LEVEL_WARN'], {}), '(logger.LOG_LEVEL_WARN)\n', (4743, 4766), True, 'import smpl.log_module as logger\n'), ((4771, 4798), 'smpl.log_module.set_stdout_logfile', 'logger.set_stdout_logfile', ([], {}), '()\n', (4796, 4798), True, 'import smpl.log_module ... |
import logging
logger = logging.getLogger(__name__)
def make_file_safe_api_name(api_name):
"""Make an api name safe for use in a file name"""
return "".join([c for c in api_name if c.isalpha() or c.isdigit() or c in (".", "_", "-")])
| [
"logging.getLogger"
] | [((25, 52), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (42, 52), False, 'import logging\n')] |
#!/usr/bin/env python
#coding:utf-8
# Author: mozman --<<EMAIL>>
# Purpose: test clock_val_parser
# Created: 03.11.2010
# Copyright (C) 2010, <NAME>
# License: GPLv3
import sys
import unittest
PYTHON3 = sys.version_info[0] > 2
if PYTHON3:
import svgwrite.data.pyparsing_py3 as pp
else:
import... | [
"unittest.main",
"svgwrite.data.svgparser._build_clock_val_parser",
"svgwrite.data.svgparser._build_wall_clock_val_parser"
] | [((556, 581), 'svgwrite.data.svgparser._build_clock_val_parser', '_build_clock_val_parser', ([], {}), '()\n', (579, 581), False, 'from svgwrite.data.svgparser import _build_clock_val_parser\n'), ((1487, 1517), 'svgwrite.data.svgparser._build_wall_clock_val_parser', '_build_wall_clock_val_parser', ([], {}), '()\n', (151... |
# -*- coding: utf-8 -*-
# Copyright 2015 www.suishouguan.com
#
# Licensed under the Private License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://github.com/samuelbaizg/ssguan/blob/master/LICENSE
#
# Unless ... | [
"ssguan.ignitor.utility.kind.utcnow",
"ssguan.ignitor.etl.model.IncrExtract.all",
"ssguan.ignitor.utility.parallel.create_lock",
"ssguan.ignitor.base.context.get_user_id",
"ssguan.ignitor.etl.model.IncrExtract",
"ssguan.ignitor.utility.kind.datetime_floor",
"datetime.timedelta",
"ssguan.ignitor.utilit... | [((880, 902), 'ssguan.ignitor.utility.parallel.create_lock', 'parallel.create_lock', ([], {}), '()\n', (900, 902), False, 'from ssguan.ignitor.utility import kind, parallel\n'), ((1549, 1566), 'ssguan.ignitor.etl.model.IncrExtract.all', 'IncrExtract.all', ([], {}), '()\n', (1564, 1566), False, 'from ssguan.ignitor.etl.... |
from models import ChapterPayments
from baseapp import db
class ChapterPaymentsController:
def __init__(self):
pass
def add(self, payment):
existing = False
payments = ChapterPayments.query.filter_by(received_date=payment['received_date']).all()
for existing_payment in payment... | [
"baseapp.db.session.add",
"models.ChapterPayments.query.filter_by",
"baseapp.db.session.delete",
"baseapp.db.session.commit",
"models.ChapterPayments"
] | [((688, 705), 'models.ChapterPayments', 'ChapterPayments', ([], {}), '()\n', (703, 705), False, 'from models import ChapterPayments\n'), ((1078, 1105), 'baseapp.db.session.add', 'db.session.add', (['new_payment'], {}), '(new_payment)\n', (1092, 1105), False, 'from baseapp import db\n'), ((1118, 1137), 'baseapp.db.sessi... |
from typing import Any, List, Literal, TypedDict
from .FHIR_canonical import FHIR_canonical
from .FHIR_code import FHIR_code
from .FHIR_CodeableConcept import FHIR_CodeableConcept
from .FHIR_DataRequirement_CodeFilter import FHIR_DataRequirement_CodeFilter
from .FHIR_DataRequirement_DateFilter import FHIR_DataRequirem... | [
"typing.TypedDict"
] | [((721, 1271), 'typing.TypedDict', 'TypedDict', (['"""FHIR_DataRequirement"""', "{'id': FHIR_string, 'extension': List[Any], 'type': FHIR_code, '_type':\n FHIR_Element, 'profile': List[FHIR_canonical], 'subjectCodeableConcept':\n FHIR_CodeableConcept, 'subjectReference': FHIR_Reference, 'mustSupport':\n List[F... |
import requests
import json
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.util.retry import Retry
LOLQUIZ_CMS_URL = 'https://lolquiz-cms.herokuapp.com/questions?_sort=id&_limit={}&_start={}'
HTTP_STATUS_ERROR_CODES = [408, 502, 503, 504]
TOTAL_QUESTIONS = 100
INIT_OFFSET = 0
def get_quest... | [
"requests.packages.urllib3.util.retry.Retry",
"requests.Session",
"json.loads",
"requests.adapters.HTTPAdapter"
] | [((355, 373), 'requests.Session', 'requests.Session', ([], {}), '()\n', (371, 373), False, 'import requests\n'), ((388, 462), 'requests.packages.urllib3.util.retry.Retry', 'Retry', ([], {'total': '(5)', 'backoff_factor': '(1)', 'status_forcelist': 'HTTP_STATUS_ERROR_CODES'}), '(total=5, backoff_factor=1, status_forceli... |
import sys
import ReadFile
import pickle
import World
import importlib.util
import os.path as osp
import policy_generator as pg
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator
import numpy as np
def module_from_file(module_name, file_path):
spec = importlib.ut... | [
"matplotlib.pyplot.title",
"numpy.meshgrid",
"matplotlib.pyplot.show",
"ReadFile.ReadConfiguration",
"ReadFile.ReadFilesList",
"numpy.zeros",
"matplotlib.pyplot.subplots",
"policy_generator.generate_group_testing_tests_policy",
"numpy.arange",
"numpy.array",
"matplotlib.pyplot.ylabel",
"matplo... | [((573, 601), 'os.path.join', 'osp.join', (['path', '"""config.txt"""'], {}), "(path, 'config.txt')\n", (581, 601), True, 'import os.path as osp\n'), ((740, 790), 'os.path.join', 'osp.join', (['example_path', 'config_obj.agents_filename'], {}), '(example_path, config_obj.agents_filename)\n', (748, 790), True, 'import o... |