code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from urllib.request import urlopen
from bs4 import BeautifulSoup
import sys, io
# Windows console uses the cp437 encoding, which only supports 256 characters,
# wich means that some unicode chars can't be rendered, so one quick fix is
# to escape those chars and print their actual code instead of rendering them.
# ba... | [
"bs4.BeautifulSoup",
"io.TextIOWrapper",
"urllib.request.urlopen",
"sys.exit"
] | [((418, 482), 'io.TextIOWrapper', 'io.TextIOWrapper', (['sys.stdout.buffer', '"""cp437"""', '"""backslashreplace"""'], {}), "(sys.stdout.buffer, 'cp437', 'backslashreplace')\n", (434, 482), False, 'import sys, io\n'), ((637, 701), 'urllib.request.urlopen', 'urlopen', (["('https://www.youtube.com/results?search_query=' ... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-25 10:52
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('oauth', '0002_auto_20170612_1258'),
('main', '0016_... | [
"django.db.models.ForeignKey"
] | [((473, 598), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'default': '(3)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""cmentor"""', 'to': '"""oauth.UserProfile"""'}), "(default=3, on_delete=django.db.models.deletion.CASCADE,\n related_name='cmentor', to='oauth.UserProfile')\n... |
# coding: utf-8
import json
import time
from datetime import datetime
from urllib.parse import urljoin
import requests
from bs4 import BeautifulSoup
from sylogger import logger
def main():
run(stop_date = "20131101", provs = ['江苏'])
def run(stop_date = "20181101", provs = []):
stop_date = datetime.strptime(stop_... | [
"requests.session",
"json.dump",
"json.load",
"urllib.parse.urljoin",
"requests.adapters.HTTPAdapter",
"time.sleep",
"datetime.datetime.strptime",
"bs4.BeautifulSoup",
"datetime.datetime.now",
"sylogger.logger"
] | [((297, 335), 'datetime.datetime.strptime', 'datetime.strptime', (['stop_date', '"""%Y%m%d"""'], {}), "(stop_date, '%Y%m%d')\n", (314, 335), False, 'from datetime import datetime\n'), ((1968, 1995), 'bs4.BeautifulSoup', 'BeautifulSoup', (['html', '"""lxml"""'], {}), "(html, 'lxml')\n", (1981, 1995), False, 'from bs4 im... |
'''
Utilities for processing semantic types
'''
import pkg_resources
lines = list(map(lambda x: x.split('|'), open(pkg_resources.resource_filename(__name__, 'SemanticTypes_2018AB.txt')).readlines()))
abbreviation_to_id = {x[0]: x[1] for x in lines}
id_to_abbreviation = {x[1]: x[0] for x in lines}
groups = {line[2]:... | [
"pkg_resources.resource_filename"
] | [((117, 186), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['__name__', '"""SemanticTypes_2018AB.txt"""'], {}), "(__name__, 'SemanticTypes_2018AB.txt')\n", (148, 186), False, 'import pkg_resources\n'), ((382, 445), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['__name... |
"""
base repository template
"""
__all__ = (
"CategoryIterValLazyDict", "PackageMapping", "VersionMapping", "tree"
)
import os
from snakeoil.klass import jit_attr
from snakeoil.mappings import DictMixin, LazyValDict
from snakeoil.osutils import pjoin
from snakeoil.sequences import iflatten_instance
from ..ebuil... | [
"snakeoil.sequences.iflatten_instance",
"os.path.abspath",
"snakeoil.osutils.pjoin",
"os.path.exists",
"os.path.normpath"
] | [((5705, 5726), 'os.path.normpath', 'os.path.normpath', (['obj'], {}), '(obj)\n', (5721, 5726), False, 'import os\n'), ((6107, 6128), 'os.path.abspath', 'os.path.abspath', (['path'], {}), '(path)\n', (6122, 6128), False, 'import os\n'), ((6180, 6204), 'os.path.exists', 'os.path.exists', (['fullpath'], {}), '(fullpath)\... |
#!/bin/env python
# -*- coding: utf-8 -*-
##
# test_live.py: Tests Azure Quantum functionality Live.
##
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
##
## IMPORTS ##
import pytest
import warnings
## TESTS ##
def connect():
import qsharp.azure
return qsharp.azure.connect(
... | [
"qsharp.azure.status",
"Microsoft.Quantum.Tests.RunTeleport.simulate",
"qsharp.azure.submit",
"time.sleep",
"Microsoft.Quantum.Tests.SampleQrng.simulate",
"qsharp.azure.connect",
"warnings.warn",
"qsharp.azure.output",
"qsharp.azure.target"
] | [((291, 337), 'qsharp.azure.connect', 'qsharp.azure.connect', ([], {'credential': '"""environment"""'}), "(credential='environment')\n", (311, 337), False, 'import qsharp\n'), ((1747, 1794), 'Microsoft.Quantum.Tests.SampleQrng.simulate', 'SampleQrng.simulate', ([], {'count': 'count', 'name': '"""andres"""'}), "(count=c... |
#!/usr/bin/python3
from typing import List
from src.word_importer import import_word_list
from src.scoring import word_scores
from src.wordle_filter import filter_from_word_info
class WordleAssistant:
"""
This class asks for input when initialized and then packages the suggestion mechanism.
"""
def ... | [
"src.scoring.word_scores",
"src.word_importer.import_word_list",
"src.wordle_filter.filter_from_word_info"
] | [((1033, 1051), 'src.word_importer.import_word_list', 'import_word_list', ([], {}), '()\n', (1049, 1051), False, 'from src.word_importer import import_word_list\n'), ((1065, 1080), 'src.scoring.word_scores', 'word_scores', (['wl'], {}), '(wl)\n', (1076, 1080), False, 'from src.scoring import word_scores\n'), ((358, 376... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import protocol
import hpstr
#http://www.hpcalc.org/details.php?id=5910
objtypes = {
0x3329: ("DOREAL","real (%) 153."),
0x7729: ("DOCMP","complex (C%) (3.,4.)"),
0x2C2A: ("DOCSTR","string ($) 'Hello'"),
0xE829: ("DOARRY","array ( [] ) [3. 4.]"),
... | [
"protocol.put",
"hpstr.tostr",
"protocol.readpacket",
"protocol.get",
"protocol.cmd"
] | [((2269, 2286), 'protocol.cmd', 'protocol.cmd', (['"""V"""'], {}), "('V')\n", (2281, 2286), False, 'import protocol\n'), ((2427, 2444), 'protocol.cmd', 'protocol.cmd', (['"""M"""'], {}), "('M')\n", (2439, 2444), False, 'import protocol\n'), ((2591, 2608), 'protocol.cmd', 'protocol.cmd', (['"""L"""'], {}), "('L')\n", (2... |
from typing import NamedTuple
from pytest import mark
from graphql import (
graphql,
GraphQLField,
GraphQLID,
GraphQLNonNull,
GraphQLObjectType,
GraphQLSchema,
GraphQLString,
)
from graphql_relay import node_definitions
class User(NamedTuple):
id: str
name: str
user_data = [Us... | [
"graphql.GraphQLNonNull",
"graphql.graphql",
"graphql.GraphQLObjectType",
"graphql.GraphQLSchema",
"graphql.GraphQLField"
] | [((798, 855), 'graphql.GraphQLObjectType', 'GraphQLObjectType', (['"""Query"""', "(lambda : {'node': node_field})"], {}), "('Query', lambda : {'node': node_field})\n", (815, 855), False, 'from graphql import graphql, GraphQLField, GraphQLID, GraphQLNonNull, GraphQLObjectType, GraphQLSchema, GraphQLString\n'), ((865, 91... |
# -*- coding: utf-8 -*-
# Copyright 1999-2018 Alibaba Group Holding 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 require... | [
"ctypes.c_char_p",
"ctypes.c_int",
"ctypes.byref",
"ctypes.create_string_buffer",
"uuid.UUID",
"collections.namedtuple",
"ctypes.c_uint",
"ctypes.CDLL",
"logging.getLogger",
"ctypes.POINTER"
] | [((838, 865), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (855, 865), False, 'import logging\n'), ((1514, 1543), 'ctypes.POINTER', 'POINTER', (['_struct_nvmlDevice_t'], {}), '(_struct_nvmlDevice_t)\n', (1521, 1543), False, 'from ctypes import c_char, c_char_p, c_int, c_uint, c_ulonglon... |
from __future__ import annotations
from asyncio import create_task, sleep
from collections import defaultdict
from dataclasses import dataclass
from json import dumps
from typing import Any, Awaitable, Callable, Mapping, Optional, Sequence, Type, Union
from aiohttp import BasicAuth, ClientResponse, ClientSession, For... | [
"asyncio.sleep",
"aiohttp.FormData",
"json.dumps",
"collections.defaultdict",
"aiohttp.ClientSession"
] | [((1129, 1416), 'collections.defaultdict', 'defaultdict', (['(lambda : HTTPError)', '{(400): BadRequest, (401): Unauthorized, (403): Forbidden, (404): NotFound,\n (405): MethodNotAllowed, (422): UnprocessableEntity, (429):\n TooManyRequests, (500): ServerError, (502): BadGateway, (503):\n ServiceUnavailable, (... |
import threading
import time
from threading import Thread
import cli_ui
def long_computation():
# Simulates a long computation
time.sleep(0.6)
def count_down(lock, start):
x = start
while x >= 0:
with lock:
# Note: the sleeps are here so that we are more likely to
# ... | [
"threading.Lock",
"threading.Thread",
"cli_ui.info",
"time.sleep"
] | [((138, 153), 'time.sleep', 'time.sleep', (['(0.6)'], {}), '(0.6)\n', (148, 153), False, 'import time\n'), ((906, 922), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (920, 922), False, 'import threading\n'), ((932, 973), 'threading.Thread', 'Thread', ([], {'target': 'count_down', 'args': '(lock, 4)'}), '(target... |
from os import name
from django.db import router
from django.urls import path
from django.urls.conf import include
from api.views.core_views import SubscribeAPIView
from api.views.order_views import BasketItemDeleteAPIView, BasketView, WishlistAPIView, WishlistDeleteAPIView
from api.views.product_views import ProductAP... | [
"api.views.product_views.ProductAPIView.as_view",
"api.views.core_views.SubscribeAPIView.as_view",
"api.views.product_views.ProductCategoryAPIView.as_view",
"api.views.order_views.BasketItemDeleteAPIView.as_view",
"api.views.order_views.WishlistAPIView.as_view",
"api.views.order_views.BasketView.as_view",... | [((497, 517), 'api.views.order_views.BasketView.as_view', 'BasketView.as_view', ([], {}), '()\n', (515, 517), False, 'from api.views.order_views import BasketItemDeleteAPIView, BasketView, WishlistAPIView, WishlistDeleteAPIView\n'), ((558, 583), 'api.views.order_views.WishlistAPIView.as_view', 'WishlistAPIView.as_view'... |
from robber import expect
from robber.explanation import Explanation
from robber.matchers.base import Base
class Called(Base):
"""
expect(mock).to.be.called()
"""
def matches(self):
try:
return self.actual.called
except AttributeError:
raise TypeError('{actual}... | [
"robber.expect.register",
"robber.explanation.Explanation"
] | [((479, 512), 'robber.expect.register', 'expect.register', (['"""called"""', 'Called'], {}), "('called', Called)\n", (494, 512), False, 'from robber import expect\n'), ((421, 476), 'robber.explanation.Explanation', 'Explanation', (['self.actual', 'self.is_negative', '"""be called"""'], {}), "(self.actual, self.is_negat... |
import os
import h5py
import torch
import numpy as np
import scipy
import json
class CorresPondenceNet(torch.utils.data.Dataset):
def __init__(self, cfg, flag='train'):
super().__init__()
with open(os.path.join(cfg['data_path'], 'name2id.json'), 'r') as f:
self.name2id = json.load(f)
... | [
"h5py.File",
"json.load",
"numpy.array",
"os.path.join",
"torch.tensor"
] | [((306, 318), 'json.load', 'json.load', (['f'], {}), '(f)\n', (315, 318), False, 'import json\n'), ((2186, 2232), 'numpy.array', 'np.array', (['self.keypoints[item]'], {'dtype': 'np.int32'}), '(self.keypoints[item], dtype=np.int32)\n', (2194, 2232), True, 'import numpy as np\n'), ((219, 265), 'os.path.join', 'os.path.j... |
import os
import time
import torch
import random
import numpy as np
from tqdm import tqdm
import torch.nn as nn
from util import epoch_time
import torch.optim as optim
from model.neural_network import RandomlyWiredNeuralNetwork
from data.data_util import fetch_dataloader, test_voc, test_imagenet
SEED = 981126
random... | [
"util.epoch_time",
"tqdm.tqdm",
"numpy.random.seed",
"torch.manual_seed",
"data.data_util.fetch_dataloader",
"model.neural_network.RandomlyWiredNeuralNetwork",
"torch.cuda.manual_seed",
"torch.nn.CrossEntropyLoss",
"time.perf_counter",
"torch.optim.lr_scheduler.CosineAnnealingLR",
"data.data_uti... | [((314, 331), 'random.seed', 'random.seed', (['SEED'], {}), '(SEED)\n', (325, 331), False, 'import random\n'), ((332, 352), 'numpy.random.seed', 'np.random.seed', (['SEED'], {}), '(SEED)\n', (346, 352), True, 'import numpy as np\n'), ((353, 376), 'torch.manual_seed', 'torch.manual_seed', (['SEED'], {}), '(SEED)\n', (37... |
from copy import deepcopy
from datetime import datetime
from os import makedirs, remove
from os.path import join, isfile, isdir, dirname
import numpy as np
import torch
def append_to_file(file, string):
dir_nm = dirname(file)
if len(dir_nm) > 0 and not isdir(dir_nm):
makedirs(dir_nm)
with open(fi... | [
"os.remove",
"os.makedirs",
"os.path.join",
"os.path.isdir",
"os.path.dirname",
"torch.load",
"torch.cat",
"torch.save",
"os.path.isfile",
"torch.no_grad",
"datetime.datetime.now"
] | [((219, 232), 'os.path.dirname', 'dirname', (['file'], {}), '(file)\n', (226, 232), False, 'from os.path import join, isfile, isdir, dirname\n'), ((287, 303), 'os.makedirs', 'makedirs', (['dir_nm'], {}), '(dir_nm)\n', (295, 303), False, 'from os import makedirs, remove\n'), ((848, 863), 'torch.no_grad', 'torch.no_grad'... |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import urllib
import urllib2
import json
import datetime
class Error(Exception):
pass
class OpenStack(object):
def __init__(self, url... | [
"urllib2.Request",
"json.dumps",
"datetime.timedelta",
"urllib.urlencode",
"datetime.datetime.now",
"urllib2.urlopen"
] | [((593, 715), 'json.dumps', 'json.dumps', (["{'auth': {'tenantName': self.user, 'passwordCredentials': {'username': self\n .user, 'password': password}}}"], {}), "({'auth': {'tenantName': self.user, 'passwordCredentials': {\n 'username': self.user, 'password': password}}})\n", (603, 715), False, 'import json\n'),... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
SPDX-FileCopyrightText: Siemens AG, 2020 <NAME> <<EMAIL>>
SPDX-License-Identifier: MIT
"""
__author__ = 'Siemens AG'
import gc
import os
import sys
import time
import base64
import hashlib
import threading
from datetime import datetime
from subprocess import PIPE, P... | [
"sys.stdout.write",
"subprocess.Popen",
"hashlib.md5",
"psutil.virtual_memory",
"os.remove",
"boto3.client",
"os.path.dirname",
"datetime.datetime.now",
"time.sleep",
"threading.Lock",
"gc.collect",
"sys.stdout.flush",
"os.path.join"
] | [((633, 649), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (647, 649), False, 'import threading\n'), ((2340, 2358), 'boto3.client', 'boto3.client', (['"""s3"""'], {}), "('s3')\n", (2352, 2358), False, 'import boto3\n'), ((5063, 5076), 'hashlib.md5', 'hashlib.md5', ([], {}), '()\n', (5074, 5076), False, 'import... |
import pygame
import math
from functools import reduce
from tower import Tower
from unit import Unit
class BoardState:
def __init__(self, board):
self.unitsDeployed = len(board._units) + board._unitsDestroyed + board._unitsThatReachedGoal
self.towersDeployed = 0
self.towersInUpperLeft = 0
... | [
"pygame.draw.line",
"math.sqrt",
"unit.Unit",
"tower.Tower",
"functools.reduce"
] | [((1719, 1739), 'math.sqrt', 'math.sqrt', (['thisTotal'], {}), '(thisTotal)\n', (1728, 1739), False, 'import math\n'), ((1761, 1782), 'math.sqrt', 'math.sqrt', (['otherTotal'], {}), '(otherTotal)\n', (1770, 1782), False, 'import math\n'), ((9188, 9233), 'functools.reduce', 'reduce', (['(lambda u1, u2: u1 and u2)', 'pat... |
import trimesh
import numpy as np
import cv2
import copy
import pickle
import torch
import pdb
def depth2normal(depth, f_pix_x, f_pix_y=None):
'''
To compute a normal map from the depth map
Input:
- depth: torch.Tensor (H, W)
- f_pix_x: K[0, 0]
- f_pix_y: K[1, 1]
Return:
- normal: t... | [
"torch.ones_like",
"copy.deepcopy",
"trimesh.sample.sample_surface",
"pickle.dump",
"torch.norm",
"torch.cat",
"pickle.load",
"torch.zeros",
"mathutils.Matrix",
"numpy.concatenate",
"torch.from_numpy"
] | [((1268, 1298), 'torch.norm', 'torch.norm', (['normal'], {'p': '(2)', 'dim': '(2)'}), '(normal, p=2, dim=2)\n', (1278, 1298), False, 'import torch\n'), ((2244, 2276), 'torch.cat', 'torch.cat', (['[R, T[:, :, None]]', '(2)'], {}), '([R, T[:, :, None]], 2)\n', (2253, 2276), False, 'import torch\n'), ((2607, 2616), 'mathu... |
import display
import board
import robot
import config as conf
import sys
import pygame
from pygame.locals import *
import time
class Checkers:
def __init__(self):
self.display = display.Display()
self.board = board.Board()
self.set_difficulty = 0
self.turn = None
self.valid_moves = []
self.curr_piec... | [
"pygame.quit",
"robot.Robot",
"pygame.mouse.get_pressed",
"pygame.event.get",
"pygame.init",
"time.sleep",
"display.Display",
"board.Board",
"pygame.display.update",
"pygame.mouse.get_pos",
"pygame.display.set_caption",
"sys.exit"
] | [((186, 203), 'display.Display', 'display.Display', ([], {}), '()\n', (201, 203), False, 'import display\n'), ((219, 232), 'board.Board', 'board.Board', ([], {}), '()\n', (230, 232), False, 'import board\n'), ((454, 467), 'pygame.init', 'pygame.init', ([], {}), '()\n', (465, 467), False, 'import pygame\n'), ((470, 520)... |
from pathlib import Path
from typing import Callable
from typing import Iterable
from typing import Tuple
from typing import Union
from django.conf import settings
from django.utils.autoreload import autoreload_started
from django.utils.autoreload import StatReloader
from .camel_case import camel_to_underscore
from .... | [
"pathlib.Path",
"werkzeug.serving.is_running_from_reloader",
"django.utils.autoreload.autoreload_started.connect"
] | [((1367, 1393), 'werkzeug.serving.is_running_from_reloader', 'is_running_from_reloader', ([], {}), '()\n', (1391, 1393), False, 'from werkzeug.serving import is_running_from_reloader\n'), ((2027, 2072), 'django.utils.autoreload.autoreload_started.connect', 'autoreload_started.connect', (['add_watched_files'], {}), '(ad... |
#!/bin/python3
"""Parse final xml and return an error if there are failures.
"""
import sys
from xml.dom.minidom import parse
dom = parse(sys.argv[1])
errors = 0
failures = 0
for nodes in dom.childNodes:
l = nodes.attributes.length
for node in range(l):
attr = nodes.attributes.item(node)
... | [
"xml.dom.minidom.parse",
"sys.exit"
] | [((135, 153), 'xml.dom.minidom.parse', 'parse', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (140, 153), False, 'from xml.dom.minidom import parse\n'), ((652, 663), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (660, 663), False, 'import sys\n'), ((729, 740), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (737, 740), F... |
import logging
import requests
logger = logging.getLogger(__name__)
# https://developer.twitter.com/en/docs/authentication/oauth-2-0/user-access-token
class TwitterProvider:
def __init__(self, configs):
self.client_id = configs['client_id']
self.redirect_uri = configs['redirect_uri']
... | [
"requests.get",
"requests.post",
"logging.getLogger"
] | [((43, 70), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (60, 70), False, 'import logging\n'), ((1041, 1280), 'requests.post', 'requests.post', (['"""https://api.twitter.com/2/oauth2/token"""'], {'data': "{'code': args['code'], 'grant_type': 'authorization_code', 'client_id':\n self.... |
# safecracker
from safecracker import safecracker as sc
from safecracker.safe import zip as safe
from safecracker.tools import mask as sct
from examples import testing
# get safe
safe = safe.Safe("examples/safe/easy.zip")
# get safecracker
pwg = sct.PasswordGenerator("-d", max_len=3) # just digits
safecracker = sc.S... | [
"examples.testing.test",
"safecracker.tools.mask.PasswordGenerator",
"safecracker.safecracker.Safecracker",
"safecracker.safe.zip.Safe"
] | [((187, 222), 'safecracker.safe.zip.Safe', 'safe.Safe', (['"""examples/safe/easy.zip"""'], {}), "('examples/safe/easy.zip')\n", (196, 222), True, 'from safecracker.safe import zip as safe\n'), ((248, 286), 'safecracker.tools.mask.PasswordGenerator', 'sct.PasswordGenerator', (['"""-d"""'], {'max_len': '(3)'}), "('-d', m... |
# -*- coding: utf-8 -*-
# -----------------------------------------------------------------------------
# Copyright 2020 by ShabaniPy Authors, see AUTHORS for more details.
#
# Distributed under the terms of the MIT license.
#
# The full license is in the file LICENCE, distributed with this software.
# ----------------... | [
"numpy.testing.assert_almost_equal",
"shabanipy.jj.fraunhofer.estimation.guess_current_distribution",
"numpy.empty_like",
"numpy.ones",
"numpy.sinc",
"numpy.array",
"numpy.linspace",
"numpy.cos"
] | [((556, 580), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(1001)'], {}), '(-1, 1, 1001)\n', (567, 580), True, 'import numpy as np\n'), ((676, 700), 'numpy.linspace', 'np.linspace', (['(-1)', '(1)', '(1001)'], {}), '(-1, 1, 1001)\n', (687, 700), True, 'import numpy as np\n'), ((885, 928), 'numpy.testing.assert_al... |
import re
from collections import defaultdict
from django.db.models import OneToOneRel
from django.core.exceptions import ValidationError
from django.conf import settings
from django.db import IntegrityError
from peeringdb import resource
import peeringdb_server.models as models
from django_peeringdb.client_adapto... | [
"collections.defaultdict"
] | [((5039, 5055), 'collections.defaultdict', 'defaultdict', (['set'], {}), '(set)\n', (5050, 5055), False, 'from collections import defaultdict\n')] |
# Copyright (C) 2013-2014 DNAnexus, Inc.
#
# This file is part of dx-toolkit (DNAnexus platform client libraries).
#
# 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.a... | [
"threading.Lock",
"threading.Semaphore",
"collections.deque"
] | [((4220, 4252), 'threading.Semaphore', 'threading.Semaphore', (['max_workers'], {}), '(max_workers)\n', (4239, 4252), False, 'import threading\n'), ((4280, 4296), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (4294, 4296), False, 'import threading\n'), ((9615, 9634), 'collections.deque', 'collections.deque', ([... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import ecstasy
import oauth2client.file
import pyperclip
import pytest
import requests
import threading
try:
from Queue import Queue
except ImportError:
from queue import Queue
from collections import namedtuple
import tests.paths
import lnk.googl.link
VERSION = 1
KE... | [
"threading.Thread",
"pyperclip.paste",
"pytest.fixture",
"threading.Lock",
"collections.namedtuple",
"pyperclip.copy",
"queue.Queue"
] | [((388, 404), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (402, 404), False, 'import threading\n'), ((413, 420), 'queue.Queue', 'Queue', ([], {}), '()\n', (418, 420), False, 'from queue import Queue\n'), ((1302, 1332), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", ... |
import string
import random
from logging import Logger
from pyspark.sql.session import SparkSession
from pyspark.sql.dataframe import DataFrame
from pyspark.sql.types import StructType
from datalakebundle.table.upsert.UpsertQueryCreator import UpsertQueryCreator
from datalakebundle.delta.DeltaStorage import DeltaStorag... | [
"random.choice"
] | [((1377, 1414), 'random.choice', 'random.choice', (['string.ascii_lowercase'], {}), '(string.ascii_lowercase)\n', (1390, 1414), False, 'import random\n')] |
"""
Author :
<NAME>
"""
import numpy as np
import matplotlib.pyplot as plt
import cv2
import os
from keras import backend as K
from tqdm.keras import TqdmCallback
from scipy.stats import spearmanr
from tensorflow.keras import Input
from tensorflow.keras import optimizers
from tensorflow.keras import models
from t... | [
"keras.models.load_model",
"numpy.load",
"numpy.abs",
"argparse.ArgumentParser",
"tensorflow.keras.layers.Dense",
"random.shuffle",
"tensorflow.keras.models.Sequential",
"tensorflow.keras.layers.Flatten",
"os.path.exists",
"tensorflow.keras.layers.Activation",
"tensorflow.keras.optimizers.Adam",... | [((1330, 1362), 'tensorflow.keras.backend.clear_session', 'tf.keras.backend.clear_session', ([], {}), '()\n', (1360, 1362), True, 'import tensorflow as tf\n'), ((1559, 1579), 'random.shuffle', 'random.shuffle', (['data'], {}), '(data)\n', (1573, 1579), False, 'import random\n'), ((3628, 3647), 'tensorflow.keras.models.... |
import logging
import json
import requests
import time
import websocket
from platypush.config import Config
from platypush.message import Message
from platypush.message.event.pushbullet import PushbulletEvent
from .. import Backend
class PushbulletBackend(Backend):
def __init__(self, token, device, **kwargs):
... | [
"logging.exception",
"logging.debug",
"json.loads",
"platypush.message.event.pushbullet.PushbulletEvent",
"platypush.message.Message.parse",
"time.time",
"logging.info",
"requests.get"
] | [((1607, 1625), 'platypush.message.Message.parse', 'Message.parse', (['msg'], {}), '(msg)\n', (1620, 1625), False, 'from platypush.message import Message\n'), ((2054, 2065), 'time.time', 'time.time', ([], {}), '()\n', (2063, 2065), False, 'import time\n'), ((3512, 3532), 'logging.exception', 'logging.exception', (['e']... |
import random
from fineract.objects.group import Group
number = random.randint(0, 10000)
def test_create_group(fineract):
group = Group.create(fineract.request_handler, 'Test ' + str(number), 1)
assert isinstance(group, Group)
def test_get_group_by_name(fineract):
group = Group.get_group_by_name(finer... | [
"random.randint"
] | [((66, 90), 'random.randint', 'random.randint', (['(0)', '(10000)'], {}), '(0, 10000)\n', (80, 90), False, 'import random\n')] |
#!/usr/bin/env python3
import argparse
note_name = [
"FX_C_0", "FX_Cs0", "FX_D_0", "FX_Ds0", "FX_E_0", "FX_F_0", "FX_Fs0", "FX_G_0", "FX_Gs0", "FX_A_0", "FX_As0", "FX_B_0",
"FX_C_1", "FX_Cs1", "FX_D_1", "FX_Ds1", "FX_E_1", "FX_F_1", "FX_Fs1", "FX_G_1", "FX_Gs1", "FX_A_1", "FX_As1", "FX_B_1",
"FX_C_2", "FX_Cs2", "FX_D... | [
"argparse.ArgumentParser"
] | [((1738, 1763), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1761, 1763), False, 'import argparse\n')] |
#!/usr/bin/env python
# coding: utf-8
import smtplib
import datetime
from dateutil.parser import parse
from flask_mail import Mail, Message
from app.auxiliary.query_tools import calc_time
from app.logger import Logger
def sendEmail(email, msg_body):
from app.fl_app import application
mail = Mail(application)... | [
"app.fl_app.application.app_context",
"flask_mail.Message",
"app.auxiliary.query_tools.calc_time",
"flask_mail.Mail",
"app.logger.Logger.debug",
"datetime.time"
] | [((303, 320), 'flask_mail.Mail', 'Mail', (['application'], {}), '(application)\n', (307, 320), False, 'from flask_mail import Mail, Message\n'), ((2225, 2248), 'app.logger.Logger.debug', 'Logger.debug', (['dateValue'], {}), '(dateValue)\n', (2237, 2248), False, 'from app.logger import Logger\n'), ((2253, 2276), 'app.lo... |
# 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.ResourceOptions",
"pulumi.set"
] | [((1727, 1758), 'pulumi.get', 'pulumi.get', (['self', '"""description"""'], {}), "(self, 'description')\n", (1737, 1758), False, 'import pulumi\n'), ((1855, 1893), 'pulumi.set', 'pulumi.set', (['self', '"""description"""', 'value'], {}), "(self, 'description', value)\n", (1865, 1893), False, 'import pulumi\n'), ((2035,... |
#
# SPDX-FileCopyrightText: Copyright (c) 2021-2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
try:
import sionna
except ImportError as e:
import sys
sys.path.append("../")
import tensorflow as tf
gpus = tf.config.list_physical_devices('GPU')
print('Number ... | [
"numpy.load",
"numpy.array_equal",
"sionna.fec.polar.utils.generate_5g_ranking",
"numpy.allclose",
"tensorflow.reshape",
"tensorflow.zeros_like",
"numpy.ones",
"numpy.isnan",
"sionna.fec.polar.decoding.Polar5GDecoder",
"numpy.arange",
"numpy.exp",
"sionna.fec.polar.decoding.PolarSCLDecoder",
... | [((267, 305), 'tensorflow.config.list_physical_devices', 'tf.config.list_physical_devices', (['"""GPU"""'], {}), "('GPU')\n", (298, 305), True, 'import tensorflow as tf\n'), ((9161, 9228), 'pytest.mark.filterwarnings', 'pytest.mark.filterwarnings', (['"""ignore: Required ressource allocation"""'], {}), "('ignore: Requi... |
#
# Bentobox
# SDK - Specifications
# Graph Specifications
#
from collections import OrderedDict
from typing import Set
from bento.ecs.graph import (
GraphComponent,
GraphEntity,
GraphNode,
to_str_attr,
wrap_const,
)
from bento.spec.ecs import ComponentDef, EntityDef
from bento.example.specs impor... | [
"bento.protos.graph_pb2.Node.Mutate",
"bento.spec.ecs.ComponentDef",
"bento.ecs.graph.wrap_const",
"bento.ecs.graph.GraphNode.wrap",
"bento.ecs.graph.GraphEntity",
"bento.ecs.graph.GraphComponent.from_def",
"bento.spec.ecs.EntityDef",
"bento.utils.to_yaml_proto",
"bento.utils.to_str_attr",
"bento.... | [((606, 653), 'bento.ecs.graph.GraphEntity', 'GraphEntity', ([], {'components': 'components', 'entity_id': '(1)'}), '(components=components, entity_id=1)\n', (617, 653), False, 'from bento.ecs.graph import GraphComponent, GraphEntity, GraphNode, to_str_attr, wrap_const\n'), ((2100, 2173), 'bento.protos.references_pb2.A... |
import torch
import torch.nn as nn
from torch import Tensor
import torch.nn.functional as F
# Resnet Blocks
class ResnetBlockFC(nn.Module):
''' Fully connected ResNet Block class.
Args:
size_in (int): input dimension
size_out (int): output dimension
size_h (int): hidden dimension
... | [
"torch.nn.functional.batch_norm",
"torch.nn.ReLU",
"torch.eye",
"torch.nn.BatchNorm1d",
"torch.nn.Conv1d",
"torch.nn.GroupNorm1d",
"torch.nn.InstanceNorm1d",
"torch.nn.init.zeros_",
"torch.nn.Linear",
"torch.nn.init.ones_",
"torch.nn.Identity",
"torch.no_grad",
"torch.tensor"
] | [((701, 727), 'torch.nn.Linear', 'nn.Linear', (['size_in', 'size_h'], {}), '(size_in, size_h)\n', (710, 727), True, 'import torch.nn as nn\n'), ((748, 775), 'torch.nn.Linear', 'nn.Linear', (['size_h', 'size_out'], {}), '(size_h, size_out)\n', (757, 775), True, 'import torch.nn as nn\n'), ((797, 806), 'torch.nn.ReLU', '... |
import pytest
import responses
import status
from django.urls import reverse
from apps.tickets.models import Purchase
pytestmark = pytest.mark.django_db
def test_event_list(admin_client, event):
url = reverse('tickets:event_list')
response = admin_client.get(url)
assert response.status_code == status.HT... | [
"django.urls.reverse",
"responses.add",
"apps.tickets.models.Purchase.objects.filter"
] | [((209, 238), 'django.urls.reverse', 'reverse', (['"""tickets:event_list"""'], {}), "('tickets:event_list')\n", (216, 238), False, 'from django.urls import reverse\n'), ((471, 519), 'django.urls.reverse', 'reverse', (['"""tickets:event_detail"""'], {'args': '[event.id]'}), "('tickets:event_detail', args=[event.id])\n",... |
from scipy.integrate import odeint
from scipy.optimize import fsolve
import numpy as np
import itertools
import matplotlib.pyplot as plt
from colorlines import colorline
from matplotlib import style
class PhaseDiagram:
def __init__(self, system):
self.system = system
self.fig, self.a... | [
"numpy.random.uniform",
"matplotlib.pyplot.show",
"scipy.integrate.odeint",
"numpy.zeros",
"scipy.optimize.fsolve",
"numpy.isclose",
"numpy.linspace",
"itertools.product",
"matplotlib.pyplot.subplots",
"colorlines.colorline"
] | [((2448, 2475), 'numpy.linspace', 'np.linspace', (['(0.1)', '(2.5)', '(1000)'], {}), '(0.1, 2.5, 1000)\n', (2459, 2475), True, 'import numpy as np\n'), ((2227, 2244), 'numpy.zeros', 'np.zeros', ([], {'shape': '(2)'}), '(shape=2)\n', (2235, 2244), True, 'import numpy as np\n'), ((324, 342), 'matplotlib.pyplot.subplots',... |
import pytest
from ocdskit.cli.__main__ import main
from tests import assert_command, assert_command_error, path
def test_command(capsys, monkeypatch):
assert_command(capsys, monkeypatch, main,
['mapping-sheet', '--infer-required', path('release-schema.json')],
'mapping-shee... | [
"pytest.mark.vcr",
"tests.path"
] | [((846, 863), 'pytest.mark.vcr', 'pytest.mark.vcr', ([], {}), '()\n', (861, 863), False, 'import pytest\n'), ((1518, 1535), 'pytest.mark.vcr', 'pytest.mark.vcr', ([], {}), '()\n', (1533, 1535), False, 'import pytest\n'), ((1980, 1997), 'pytest.mark.vcr', 'pytest.mark.vcr', ([], {}), '()\n', (1995, 1997), False, 'import... |
from sqlalchemy import Column, ForeignKey, Integer, String, Enum
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine
import psycopg2
Base = declarative_base()
# define database tables
class Person(Base):
__tablename__ = 'person'
id = C... | [
"sqlalchemy.String",
"sqlalchemy.ForeignKey",
"sqlalchemy.ext.declarative.declarative_base",
"sqlalchemy.orm.relationship",
"sqlalchemy.Column",
"sqlalchemy.create_engine"
] | [((222, 240), 'sqlalchemy.ext.declarative.declarative_base', 'declarative_base', ([], {}), '()\n', (238, 240), False, 'from sqlalchemy.ext.declarative import declarative_base\n'), ((1539, 1607), 'sqlalchemy.create_engine', 'create_engine', (['"""postgresql://charsheet:4ab62xxc@localhost/charsheet"""'], {}), "('postgres... |
import json
from tervis.environment import CurrentEnvironment
from tervis.auth import Auth
from tervis.producer import Producer
from tervis.exceptions import ApiError, PayloadTooLarge, ClientReadFailed, \
ClientBlacklisted
from tervis.web import Endpoint, ApiResponse, get_remote_addr
from tervis.filter import Filt... | [
"tervis.web.get_remote_addr",
"tervis.auth.Auth",
"json.loads",
"tervis.exceptions.ClientBlacklisted",
"tervis.environment.CurrentEnvironment",
"tervis.web.ApiResponse",
"tervis.exceptions.PayloadTooLarge",
"tervis.exceptions.ApiError",
"tervis.producer.Producer",
"tervis.filter.Filter"
] | [((504, 524), 'tervis.environment.CurrentEnvironment', 'CurrentEnvironment', ([], {}), '()\n', (522, 524), False, 'from tervis.environment import CurrentEnvironment\n'), ((536, 542), 'tervis.auth.Auth', 'Auth', ([], {}), '()\n', (540, 542), False, 'from tervis.auth import Auth\n'), ((558, 568), 'tervis.producer.Produce... |
import os
import errno
import threading
import queue
from collections import namedtuple
import jinja2
from PIL import Image
import tesserocr
import sd3.gfx
import sd3.text_table
_Char = namedtuple("_Char", ["idx", "char", "img_path"])
_WorkDesc = namedtuple("_WorkDesc", ["idx", "tile"])
_WorkRes = namedtuple("_WorkDes... | [
"threading.Thread",
"os.path.abspath",
"os.sched_getaffinity",
"os.makedirs",
"tesserocr.image_to_text",
"jinja2.FileSystemLoader",
"collections.namedtuple",
"os.path.join",
"queue.Queue"
] | [((187, 235), 'collections.namedtuple', 'namedtuple', (['"""_Char"""', "['idx', 'char', 'img_path']"], {}), "('_Char', ['idx', 'char', 'img_path'])\n", (197, 235), False, 'from collections import namedtuple\n'), ((248, 288), 'collections.namedtuple', 'namedtuple', (['"""_WorkDesc"""', "['idx', 'tile']"], {}), "('_WorkD... |
from itertools import (chain,
combinations)
import pytest
from ground.base import (Context,
Relation)
from ground.hints import Contour
from hypothesis import given
from bentley_ottmann.planar import contour_self_intersects
from tests.utils import (contour_to_edges,
... | [
"bentley_ottmann.planar.contour_self_intersects",
"tests.utils.contour_to_edges",
"itertools.combinations",
"pytest.raises",
"hypothesis.given",
"tests.utils.pop_left_vertex",
"tests.utils.reverse_contour",
"tests.utils.reverse_contour_coordinates"
] | [((482, 508), 'hypothesis.given', 'given', (['strategies.contours'], {}), '(strategies.contours)\n', (487, 508), False, 'from hypothesis import given\n'), ((637, 674), 'hypothesis.given', 'given', (['strategies.triangular_contours'], {}), '(strategies.triangular_contours)\n', (642, 674), False, 'from hypothesis import ... |
import torch
import torch.nn as nn
from torchvision import models
import numpy as np
from torch.autograd import Variable
import os
class Model:
def __init__(self, key = 'abnormal'):
self.INPUT_DIM = 224
self.MAX_PIXEL_VAL = 255
self.MEAN = 58.09
self.STDDEV = 49.73
self.mode... | [
"numpy.stack",
"torch.nn.AdaptiveAvgPool2d",
"numpy.load",
"torch.autograd.Variable",
"torch.load",
"torchvision.models.alexnet",
"torch.FloatTensor",
"torch.cat",
"torch.squeeze",
"torch.sigmoid",
"numpy.min",
"torch.max",
"numpy.max",
"torch.nn.Linear"
] | [((1031, 1062), 'numpy.stack', 'np.stack', (['((series,) * 3)'], {'axis': '(1)'}), '((series,) * 3, axis=1)\n', (1039, 1062), True, 'import numpy as np\n'), ((1084, 1109), 'torch.FloatTensor', 'torch.FloatTensor', (['series'], {}), '(series)\n', (1101, 1109), False, 'import torch\n'), ((1220, 1239), 'numpy.load', 'np.l... |
#!/usr/bin/env python3
import utils
utils.check_version((3,7))
utils.clear()
print('Hello, my name is <NAME>')
print('My favorite game is Bioshock Infinite')
print('My only concern is getting back into the groove of coding for this class')
print('I just want to learn more about what goes into creating the things I l... | [
"utils.clear",
"utils.check_version"
] | [((38, 65), 'utils.check_version', 'utils.check_version', (['(3, 7)'], {}), '((3, 7))\n', (57, 65), False, 'import utils\n'), ((65, 78), 'utils.clear', 'utils.clear', ([], {}), '()\n', (76, 78), False, 'import utils\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-10-10 16:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('contact', '0003_contactcaptchaformfield_hide_label'),
]
operations = [
mig... | [
"django.db.migrations.RemoveField",
"django.db.models.CharField",
"django.db.migrations.RenameField"
] | [((317, 406), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""contact"""', 'old_name': '"""first_names"""', 'new_name': '"""name"""'}), "(model_name='contact', old_name='first_names',\n new_name='name')\n", (339, 406), False, 'from django.db import migrations, models\n'), ((459,... |
# -*- coding: utf-8 -*-
import scrapy
import urllib
import os
from scrapy.http import Request
from scrapy.selector import Selector
from crawl_good_softwares.items import CrawlGoodSoftwaresItem
class TestSpiderSpider(scrapy.Spider):
name = "firehorse_scrapy_software_spider"
start_urls = ['http://www.filehorse.... | [
"crawl_good_softwares.items.CrawlGoodSoftwaresItem",
"scrapy.selector.Selector",
"scrapy.http.Request"
] | [((1580, 1598), 'scrapy.selector.Selector', 'Selector', (['response'], {}), '(response)\n', (1588, 1598), False, 'from scrapy.selector import Selector\n'), ((2134, 2158), 'crawl_good_softwares.items.CrawlGoodSoftwaresItem', 'CrawlGoodSoftwaresItem', ([], {}), '()\n', (2156, 2158), False, 'from crawl_good_softwares.item... |
import sys
def write(s):
"""write s to stdout"""
s = s.replace('\n', '\r\n')
sys.stdout.write(s)
sys.stdout.flush()
def make_target(options):
return write
def free_target():
pass
| [
"sys.stdout.write",
"sys.stdout.flush"
] | [((90, 109), 'sys.stdout.write', 'sys.stdout.write', (['s'], {}), '(s)\n', (106, 109), False, 'import sys\n'), ((114, 132), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (130, 132), False, 'import sys\n')] |
'''
Copyright 2017, United States Government, as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
The pyCMR platform is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obt... | [
"os.path.abspath",
"xml.etree.ElementTree.XML"
] | [((2360, 2374), 'xml.etree.ElementTree.XML', 'ET.XML', (['result'], {}), '(result)\n', (2366, 2374), True, 'import xml.etree.ElementTree as ET\n'), ((2536, 2550), 'xml.etree.ElementTree.XML', 'ET.XML', (['result'], {}), '(result)\n', (2542, 2550), True, 'import xml.etree.ElementTree as ET\n'), ((2721, 2735), 'xml.etree... |
import os
REDIS_CONFIG = {
'host': os.getenv('REDING_REDIS_HOST', 'localhost'),
'port': int(os.getenv('REDING_REDIS_PORT', 6379)),
'db': int(os.getenv('REDING_REDIS_DB', 0)),
}
DAEMON_CONFIG = {
'host': os.getenv('REDING_DAEMON_HOST', '0.0.0.0'),
'port': int(os.getenv('REDING_DAEMON_PORT', 5000)),... | [
"os.getenv"
] | [((40, 83), 'os.getenv', 'os.getenv', (['"""REDING_REDIS_HOST"""', '"""localhost"""'], {}), "('REDING_REDIS_HOST', 'localhost')\n", (49, 83), False, 'import os\n'), ((221, 263), 'os.getenv', 'os.getenv', (['"""REDING_DAEMON_HOST"""', '"""0.0.0.0"""'], {}), "('REDING_DAEMON_HOST', '0.0.0.0')\n", (230, 263), False, 'impo... |
from scipy import optimize
import matplotlib.pyplot as plt
import numpy as np
x = np.array([1, 1.1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12, 13, 14, 15], dtype=float)
y = np.array([5, 3, 7, 9, 11, 13, 15, 28.92, 42.81, 56.7, 70.59,
84.47, 98.36, 112.25, 126.14, 140.03])
# 一个输入序列,4个未知参数,2个分段函数
d... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.square",
"numpy.zeros",
"numpy.array",
"numpy.linspace",
"numpy.piecewise"
] | [((87, 166), 'numpy.array', 'np.array', (['[1, 1.1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]'], {'dtype': 'float'}), '([1, 1.1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], dtype=float)\n', (95, 166), True, 'import numpy as np\n'), ((172, 276), 'numpy.array', 'np.array', (['[5, 3, 7, 9, 11, 13, 15, 28.92, 42... |
from unittest.mock import MagicMock
import pytest
from pyspark.sql import SparkSession
from prefect.tasks.sodaspark import SodaSparkScan
class TestSodaSparkScan:
def test_construction_provide_scan_and_df(self):
expected_scan_def = "/foo/bar.yaml"
expected_df = SparkSession.builder.getOrCreate()... | [
"pytest.raises",
"prefect.tasks.sodaspark.SodaSparkScan",
"pyspark.sql.SparkSession.builder.getOrCreate"
] | [((450, 507), 'prefect.tasks.sodaspark.SodaSparkScan', 'SodaSparkScan', ([], {'scan_def': 'expected_scan_def', 'df': 'expected_df'}), '(scan_def=expected_scan_def, df=expected_df)\n', (463, 507), False, 'from prefect.tasks.sodaspark import SodaSparkScan\n'), ((709, 724), 'prefect.tasks.sodaspark.SodaSparkScan', 'SodaSp... |
# %%
"""
<NAME> любит французские багеты. Длина французского
багета равна 1 метру. За один заглот <NAME> заглатывает
кусок случайной длины равномерно распределенной на отрезке
[0; 1]. Для того, чтобы съесть весь багет удаву потребуется случайное
количество N заглотов.
Оцените P(N=2), P(N=3), E(N)
"""
# %%
import nump... | [
"pandas.DataFrame",
"numpy.mean",
"random.randint",
"random.uniform"
] | [((381, 398), 'random.uniform', 'uniform', ([], {'a': '(0)', 'b': '(1)'}), '(a=0, b=1)\n', (388, 398), False, 'from random import uniform\n'), ((795, 814), 'numpy.mean', 'np.mean', (['udaff_life'], {}), '(udaff_life)\n', (802, 814), True, 'import numpy as np\n'), ((1218, 1235), 'random.randint', 'randint', ([], {'a': '... |
import json
import pytest
from django.conf import settings as test_settings
from rest_framework import status
from rest_framework.request import ForcedAuthentication
from rest_framework.test import APIClient
from shipchain_common.utils import random_id
from shipchain_common.test_utils import get_jwt, mocked_rpc_respo... | [
"shipchain_common.test_utils.mocked_rpc_response",
"pytest.fixture",
"apps.shipments.models.Device.objects.create",
"json.dumps",
"apps.authentication.passive_credentials_auth",
"shipchain_common.test_utils.get_jwt",
"httpretty.disable",
"httpretty.enable",
"shipchain_common.utils.random_id",
"res... | [((683, 694), 'shipchain_common.utils.random_id', 'random_id', ([], {}), '()\n', (692, 694), False, 'from shipchain_common.utils import random_id\n'), ((713, 724), 'shipchain_common.utils.random_id', 'random_id', ([], {}), '()\n', (722, 724), False, 'from shipchain_common.utils import random_id\n'), ((736, 747), 'shipc... |
from setuptools import setup, Extension
import sys, os
# explode if environment isn't correct, as set in CIBW_ENVIRONMENT
CIBW_TEST_VAR = os.environ.get('CIBW_TEST_VAR')
CIBW_TEST_VAR_2 = os.environ.get('CIBW_TEST_VAR_2')
PATH = os.environ.get('PATH')
if CIBW_TEST_VAR != 'a b c':
raise Exception('CIBW_TEST_VAR sh... | [
"os.environ.get",
"setuptools.Extension"
] | [((139, 170), 'os.environ.get', 'os.environ.get', (['"""CIBW_TEST_VAR"""'], {}), "('CIBW_TEST_VAR')\n", (153, 170), False, 'import sys, os\n'), ((189, 222), 'os.environ.get', 'os.environ.get', (['"""CIBW_TEST_VAR_2"""'], {}), "('CIBW_TEST_VAR_2')\n", (203, 222), False, 'import sys, os\n'), ((230, 252), 'os.environ.get'... |
# Copyright 2019 <NAME>
# Licensed under the MIT License
import asyncio
import time
from aiohttp import request
URLS = [
"https://2019.northbaypython.org",
"https://duckduckgo.com",
"https://jreese.sh",
"https://news.ycombinator.com",
"https://python.org",
]
# Coroutines with aiohttp
async def... | [
"asyncio.gather",
"aiohttp.request"
] | [((360, 379), 'aiohttp.request', 'request', (['"""GET"""', 'url'], {}), "('GET', url)\n", (367, 379), False, 'from aiohttp import request\n'), ((504, 526), 'asyncio.gather', 'asyncio.gather', (['*coros'], {}), '(*coros)\n', (518, 526), False, 'import asyncio\n')] |
import tbf.utils as utils
class HarnessCreator(object):
def _get_vector_read_method(self):
return b"""char * parse_inp(char * __inp_var) {
unsigned int input_length = strlen(__inp_var)-1;
/* Remove '\\n' at end of input */
if (__inp_var[input_length] == '\\n') {
__inp_var[input_length... | [
"tbf.utils.get_method_head",
"tbf.utils.get_assume_method"
] | [((1231, 1256), 'tbf.utils.get_assume_method', 'utils.get_assume_method', ([], {}), '()\n', (1254, 1256), True, 'import tbf.utils as utils\n'), ((1934, 2005), 'tbf.utils.get_method_head', 'utils.get_method_head', (["method['name']", "method['type']", "method['params']"], {}), "(method['name'], method['type'], method['p... |
from django.urls import path, re_path
from declaracion.views import (DeclaracionFormView, DatosCurricularesView,
DatosEncargoActualView, ExperienciaLaboralView,
ConyugeDependientesView,
DatosCurricularesDelete,
... | [
"declaracion.views.ConyugeDependientesDeleteView.as_view",
"declaracion.views.DeclaracionFiscalFormView.as_view",
"declaracion.views.DatosCurricularesView.as_view",
"declaracion.views.DeclaracionFormView.as_view",
"declaracion.views.DeclaracionFiscalDelete.as_view",
"declaracion.views.ExperienciaLaboralVi... | [((5013, 5086), 'django.conf.urls.url', 'url', (['"""^ajax/lista_municipios/$"""', 'listaMunicipios'], {'name': '"""lista_municipios"""'}), "('^ajax/lista_municipios/$', listaMunicipios, name='lista_municipios')\n", (5016, 5086), False, 'from django.conf.urls import url\n'), ((807, 842), 'declaracion.views.DeclaracionF... |
#!/usr/bin/env python
# -*- coding: utf8 -*-
from django.shortcuts import render
from heartbeat.models import MonitorAgent, InstanceUUID
from trigger.models import Trigger
from heartbeat.serializers import MonitorAgentSerializer
from rest_framework import generics
from rest_framework.renderers import JSONRenderer
from ... | [
"heartbeat.models.MonitorAgent",
"heartbeat.models.InstanceUUID.objects.get",
"heartbeat.models.InstanceUUID",
"trigger.models.Trigger.objects.filter",
"rest_framework.response.Response",
"heartbeat.models.MonitorAgent.objects.get",
"datetime.datetime.now",
"heartbeat.models.InstanceUUID.objects.all",... | [((690, 716), 'heartbeat.models.MonitorAgent.objects.all', 'MonitorAgent.objects.all', ([], {}), '()\n', (714, 716), False, 'from heartbeat.models import MonitorAgent, InstanceUUID\n'), ((3677, 3703), 'heartbeat.models.InstanceUUID.objects.all', 'InstanceUUID.objects.all', ([], {}), '()\n', (3701, 3703), False, 'from h... |
import pandas as pd
import numpy as np
from matplotlib.collections import PatchCollection, LineCollection
from descartes.patch import PolygonPatch
try:
import geopandas # noqa: F401
except ImportError:
HAS_GEOPANDAS = False
else:
HAS_GEOPANDAS = True
from ..doctools import document
from ..exceptions impo... | [
"matplotlib.collections.LineCollection",
"descartes.patch.PolygonPatch",
"numpy.array",
"matplotlib.collections.PatchCollection",
"pandas.concat",
"numpy.all"
] | [((1860, 1913), 'numpy.array', 'np.array', (["[(g is not None) for g in data['geometry']]"], {}), "([(g is not None) for g in data['geometry']])\n", (1868, 1913), True, 'import numpy as np\n'), ((2741, 2774), 'pandas.concat', 'pd.concat', (['[data, bounds]'], {'axis': '(1)'}), '([data, bounds], axis=1)\n', (2750, 2774)... |
# Copyright 2021 IBM Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | [
"numpy.random.seed",
"sklearn.model_selection.KFold",
"logging.info",
"random.seed",
"numpy.array",
"sklearn.model_selection.StratifiedKFold",
"numpy.unique"
] | [((854, 920), 'logging.info', 'logging.info', (['"""[DATALOADER]: Initializing Spectrometer Dataloader"""'], {}), "('[DATALOADER]: Initializing Spectrometer Dataloader')\n", (866, 920), False, 'import logging\n'), ((1192, 1243), 'logging.info', 'logging.info', (['"""[DATALOADER]: Loading Dataset Files"""'], {}), "('[DA... |
#!/home/roberto/anaconda3/envs/tensorflow/bin/python
# 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 requ... | [
"os.getcwd",
"utils.label_map_util.create_category_index",
"utils.label_map_util.load_labelmap",
"tensorflow.GraphDef",
"tensorflow.Session",
"numpy.expand_dims",
"utils.label_map_util.convert_label_map_to_categories",
"cv2.VideoCapture",
"tensorflow.ConfigProto",
"numpy.where",
"tensorflow.gfil... | [((996, 1034), 'multiprocessing.Process.__init__', 'multiprocessing.Process.__init__', (['self'], {}), '(self)\n', (1028, 1034), False, 'import multiprocessing\n'), ((1340, 1351), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1349, 1351), False, 'import os\n'), ((1375, 1443), 'os.path.join', 'os.path.join', (['cwd_path'... |
""" ReshapeBarcodeWindow Class """
import tkinter
import copy
import cv2
from kalmus.tkinter_windows.gui_utils import update_graph, resource_path
class ReshapeBarcodeWindow():
"""
ReshapeBarcodeWindow Class
GUI window for user to reshape the selected barcode into the desirable shape
"""
def __in... | [
"tkinter.StringVar",
"kalmus.tkinter_windows.gui_utils.update_graph",
"copy.deepcopy",
"tkinter.Button",
"kalmus.tkinter_windows.gui_utils.resource_path",
"tkinter.Entry",
"tkinter.Radiobutton",
"tkinter.Label",
"tkinter.Tk"
] | [((816, 828), 'tkinter.Tk', 'tkinter.Tk', ([], {}), '()\n', (826, 828), False, 'import tkinter\n'), ((1018, 1048), 'tkinter.StringVar', 'tkinter.StringVar', (['self.window'], {}), '(self.window)\n', (1035, 1048), False, 'import tkinter\n'), ((1186, 1236), 'tkinter.Label', 'tkinter.Label', (['self.window'], {'text': '""... |
import tempfile
import shutil
import os
import inspect
from lib import BaseTest
class AddRepo1Test(BaseTest):
"""
add package to local repo: .deb file
"""
fixtureCmds = [
"aptly repo create -comment=Repo1 -distribution=squeeze repo1",
]
runCmd = "aptly repo add repo1 ${files}/libboost-... | [
"os.path.exists",
"tempfile.mkdtemp",
"shutil.rmtree",
"os.path.join",
"inspect.getsourcefile"
] | [((2674, 2692), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (2690, 2692), False, 'import tempfile\n'), ((4372, 4461), 'os.path.join', 'os.path.join', (['self.tempSrcDir', '"""01"""', '"""libboost-program-options-dev_1.49.0.1_i386.deb"""'], {}), "(self.tempSrcDir, '01',\n 'libboost-program-options-dev_1... |
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: mediapipe/calculators/util/landmarks_smoothing_calculator.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _messag... | [
"google.protobuf.descriptor.FieldDescriptor",
"google.protobuf.descriptor.OneofDescriptor",
"google.protobuf.symbol_database.Default",
"google.protobuf.descriptor.Descriptor",
"mediapipe.framework.calculator_options_pb2.CalculatorOptions.RegisterExtension"
] | [((530, 556), 'google.protobuf.symbol_database.Default', '_symbol_database.Default', ([], {}), '()\n', (554, 556), True, 'from google.protobuf import symbol_database as _symbol_database\n'), ((1820, 2186), 'google.protobuf.descriptor.Descriptor', '_descriptor.Descriptor', ([], {'name': '"""NoFilter"""', 'full_name': '"... |
import objax
from jax import vmap, grad, jacrev
import jax.numpy as np
from jax.scipy.linalg import cholesky, cho_factor
from .utils import inv, solve, gaussian_first_derivative_wrt_mean, gaussian_second_derivative_wrt_mean
from numpy.polynomial.hermite import hermgauss
import numpy as onp
import itertools
class Cuba... | [
"numpy.polynomial.hermite.hermgauss",
"jax.numpy.atleast_2d",
"numpy.ones",
"jax.numpy.squeeze",
"itertools.product",
"jax.numpy.diag",
"jax.numpy.sum",
"jax.vmap",
"jax.numpy.maximum",
"jax.scipy.linalg.cho_factor",
"numpy.concatenate",
"numpy.block",
"jax.jacrev",
"jax.scipy.linalg.chole... | [((2062, 2074), 'numpy.polynomial.hermite.hermgauss', 'hermgauss', (['H'], {}), '(H)\n', (2071, 2074), False, 'from numpy.polynomial.hermite import hermgauss\n'), ((2977, 2998), 'numpy.sqrt', 'onp.sqrt', (['(dim + kappa)'], {}), '(dim + kappa)\n', (2985, 2998), True, 'import numpy as onp\n'), ((4231, 4248), 'numpy.sqrt... |
import pytest
from cqc.util import parse_cqc_message
from cqc.pythonLib import CQCConnection, qubit
from cqc.pythonLib import CQCMixConnection
from cqc.cqcHeader import (
CQCCmdHeader,
CQCHeader,
CQCType,
CQC_CMD_H,
CQC_CMD_NEW,
CQC_CMD_RELEASE,
)
from utilities import get_header
from test_ca... | [
"cqc.pythonLib.qubit",
"pytest.mark.parametrize",
"utilities.get_header",
"cqc.util.parse_cqc_message"
] | [((1880, 2602), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""conn_type, commands_to_apply, get_expected_headers"""', '[(CQCConnection, commands_to_apply_simple_h, get_expected_headers_simple_h),\n (CQCConnection, commands_to_apply_flush, get_expected_headers_flush), (\n CQCMixConnection, commands_t... |
from sqlalchemy import Column
from sqlalchemy.types import JSON, Text, Boolean, TIMESTAMP, BigInteger
from sqlalchemy.dialects import postgresql as psql
from steampipe_alchemy.mixins import FormatMixins
from steampipe_alchemy import Base
class AwsVpcRoute(Base, FormatMixins):
__tablename__ = 'aws_vpc_route'
d... | [
"sqlalchemy.Column"
] | [((349, 412), 'sqlalchemy.Column', 'Column', (['"""destination_ipv6_cidr_block"""', 'psql.CIDR'], {'nullable': '(True)'}), "('destination_ipv6_cidr_block', psql.CIDR, nullable=True)\n", (355, 412), False, 'from sqlalchemy import Column\n'), ((442, 500), 'sqlalchemy.Column', 'Column', (['"""destination_cidr_block"""', '... |
from rest_framework import viewsets
from rest_framework import filters
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.authentication import SessionAuthentication
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from rest_framework.permissions import IsAuth... | [
"django.db.models.Q"
] | [((2530, 2545), 'django.db.models.Q', 'Q', ([], {}), '(**condtions1)\n', (2531, 2545), False, 'from django.db.models import Q\n'), ((6415, 6430), 'django.db.models.Q', 'Q', ([], {}), '(**condtions3)\n', (6416, 6430), False, 'from django.db.models import Q\n'), ((9076, 9091), 'django.db.models.Q', 'Q', ([], {}), '(**con... |
from RandomGenerator.randomInt import randomInt
from numpy import random
def randomIntSeed (start, end, seed):
state = random.get_state()
random.seed(seed)
try:
randIntSeeded = randomInt(start, end)
return randIntSeeded
finally:
random.set_state(state)
| [
"numpy.random.get_state",
"numpy.random.seed",
"RandomGenerator.randomInt.randomInt",
"numpy.random.set_state"
] | [((124, 142), 'numpy.random.get_state', 'random.get_state', ([], {}), '()\n', (140, 142), False, 'from numpy import random\n'), ((147, 164), 'numpy.random.seed', 'random.seed', (['seed'], {}), '(seed)\n', (158, 164), False, 'from numpy import random\n'), ((198, 219), 'RandomGenerator.randomInt.randomInt', 'randomInt', ... |
from flask_restplus import fields
from api.restplus import api
model_score = api.model('Model Score', {
'algorithm': fields.String(required=True, description='Model name'),
'source_url': fields.String(required=True, description='Source URL'),
'field_names': fields.String(required=True, description='Field ... | [
"flask_restplus.fields.String"
] | [((123, 177), 'flask_restplus.fields.String', 'fields.String', ([], {'required': '(True)', 'description': '"""Model name"""'}), "(required=True, description='Model name')\n", (136, 177), False, 'from flask_restplus import fields\n'), ((197, 251), 'flask_restplus.fields.String', 'fields.String', ([], {'required': '(True... |
from functools import partial
from music.abstract_source import AbstractSource
from music.music_util import file_detail, get_file_info
class FileSource(AbstractSource):
"""
An audio source from a file.
"""
__slots__ = ('file_path', 'title')
def __init__(self, file_path: str):
"""
... | [
"functools.partial",
"music.music_util.get_file_info"
] | [((418, 442), 'music.music_util.get_file_info', 'get_file_info', (['file_path'], {}), '(file_path)\n', (431, 442), False, 'from music.music_util import file_detail, get_file_info\n'), ((516, 578), 'functools.partial', 'partial', (['file_detail', 'self.title', 'genre', 'artist', 'album', 'length'], {}), '(file_detail, s... |
from numpy import random, pi
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
Ntrials, Nhits = 1_000_000, 0
for n in range(Ntrials):
x, y, z = random.uniform(-1, 1, 3) # draw 2 samples, each uniformly distributed over (-1,1)
if x**2 + y**2 + z**2 < 1:
Nhits += 1
print("Monte Car... | [
"numpy.random.uniform"
] | [((171, 195), 'numpy.random.uniform', 'random.uniform', (['(-1)', '(1)', '(3)'], {}), '(-1, 1, 3)\n', (185, 195), False, 'from numpy import random, pi\n')] |
'''InputHandler is an extension to add "Input commands" to bottery views
Usage:
On an Application:
app = App()
input = InputHandler(app)
On Patterns:
hang_user_pattern_input = HangUserPattern(input_example)
input.set_hang(hang_user_pattern_input, 'project')
patterns = [
hang_user_pattern_input,
Pattern('proje... | [
"collections.OrderedDict"
] | [((1981, 1994), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1992, 1994), False, 'from collections import OrderedDict\n')] |
from ipywidgets.widgets import HTML, Button
from tornado.ioloop import IOLoop
from IPython import display
import time
from traitlets import Bool
class LoopDecorator(object):
""" Runs the wrapped function in a certain interval until the user presses
the stop button. """
def __init__(self, button, interv... | [
"traitlets.Bool",
"tornado.ioloop.IOLoop.current",
"IPython.display.display",
"time.time"
] | [((1031, 1042), 'traitlets.Bool', 'Bool', (['(False)'], {}), '(False)\n', (1035, 1042), False, 'from traitlets import Bool\n'), ((438, 466), 'IPython.display.display', 'display.display', (['self.button'], {}), '(self.button)\n', (453, 466), False, 'from IPython import display\n'), ((662, 678), 'tornado.ioloop.IOLoop.cu... |
import cv2
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'DIVX')
out = cv2.VideoWriter('output.avi',fourcc,20.0,(640,480))
#cap.isOpened()=>will return true value if cammera is linked or file name is correct and false in other case
while cap.isOpened():
ret,frame=cap.read()#ret will store true or fa... | [
"cv2.VideoWriter_fourcc",
"cv2.waitKey",
"cv2.imshow",
"cv2.VideoCapture",
"cv2.VideoWriter",
"cv2.destroyAllWindows"
] | [((19, 38), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (35, 38), False, 'import cv2\n'), ((48, 79), 'cv2.VideoWriter_fourcc', 'cv2.VideoWriter_fourcc', (["*'DIVX'"], {}), "(*'DIVX')\n", (70, 79), False, 'import cv2\n'), ((86, 141), 'cv2.VideoWriter', 'cv2.VideoWriter', (['"""output.avi"""', 'fourcc... |
# Author: <NAME>
# License: BSD
import warnings
from nilearn.input_data import NiftiMasker
warnings.filterwarnings("ignore", category=DeprecationWarning)
import os
from os.path import expanduser, join
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
from joblib import Memory, dump
from jobli... | [
"sklearn.utils.check_random_state",
"modl.decomposition.fmri.fMRIDictFact",
"sklearn.model_selection.train_test_split",
"numpy.argmin",
"matplotlib.pyplot.figure",
"modl.plotting.fmri.display_maps",
"os.path.join",
"os.path.exists",
"nilearn.datasets.fetch_atlas_smith_2009",
"nilearn.input_data.Ni... | [((93, 155), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {'category': 'DeprecationWarning'}), "('ignore', category=DeprecationWarning)\n", (116, 155), False, 'import warnings\n'), ((1015, 1040), 'modl.datasets.fetch_adhd', 'fetch_adhd', ([], {'n_subjects': '(40)'}), '(n_subjects=40)\n', (10... |
"""Some additional filters that don't belong to any specific category."""
import json
from typing import Any
from typing import Optional
from typing import Mapping
from liquid.context import get_item
from liquid.filter import liquid_filter
from liquid.filter import with_context
from liquid.filter import with_environ... | [
"liquid.context.get_item",
"json.dumps"
] | [((846, 883), 'json.dumps', 'json.dumps', (['obj'], {'default': 'self.default'}), '(obj, default=self.default)\n', (856, 883), False, 'import json\n'), ((1881, 1923), 'liquid.context.get_item', 'get_item', (['translations', '*path'], {'default': 'key'}), '(translations, *path, default=key)\n', (1889, 1923), False, 'fro... |
from functools import wraps
from .helper import abline
from . import plt
def can_set_title(function):
@wraps(function)
def set_title(*args, **kwargs):
title = kwargs.pop('title', None)
r = function(*args, **kwargs)
if title:
ax = plt.gca()
ax.set_title(title)
... | [
"functools.wraps"
] | [((109, 124), 'functools.wraps', 'wraps', (['function'], {}), '(function)\n', (114, 124), False, 'from functools import wraps\n'), ((393, 408), 'functools.wraps', 'wraps', (['function'], {}), '(function)\n', (398, 408), False, 'from functools import wraps\n'), ((684, 699), 'functools.wraps', 'wraps', (['function'], {})... |
import os
import json
import codingame
import discord
from discord.ext import commands
with open("./config/config.json", "r") as cjson:
config = json.load(cjson)
with open("./config/db.json", "r") as dbjson:
db = json.load(dbjson)
intents = discord.Intents.default()
bot = commands.Bot(command_prefix=config["... | [
"codingame.Client",
"discord.Intents.default",
"json.load",
"discord.ext.commands.Bot",
"os.listdir"
] | [((252, 277), 'discord.Intents.default', 'discord.Intents.default', ([], {}), '()\n', (275, 277), False, 'import discord\n'), ((284, 346), 'discord.ext.commands.Bot', 'commands.Bot', ([], {'command_prefix': "config['prefix']", 'intents': 'intents'}), "(command_prefix=config['prefix'], intents=intents)\n", (296, 346), F... |
import time
import datetime
from Status.logList import log
from Message.sendEmail import send_email
from Message.sendMessage import send_message
from Scheduler.dataAnalysis import analysis
from Update.getData import getCurrentData_torxiong
def getTime():
# time.localtime(time.time())
# int tm_sec; /* 秒 – 取值区... | [
"Message.sendMessage.send_message",
"Scheduler.dataAnalysis.analysis",
"time.time",
"time.sleep",
"datetime.datetime.strptime",
"Status.logList.log.update",
"datetime.datetime.now",
"Update.getData.getCurrentData_torxiong"
] | [((1031, 1090), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['startTime1', '"""%Y-%m-%d %H:%M:%S"""'], {}), "(startTime1, '%Y-%m-%d %H:%M:%S')\n", (1057, 1090), False, 'import datetime\n'), ((1106, 1163), 'datetime.datetime.strptime', 'datetime.datetime.strptime', (['endTime1', '"""%Y-%m-%d %H:%M:%S"""... |
"""
Create the component-specific README files by concatenating `description.md` and
a generated description of the metadata.
"""
import json
from pycldf.terms import Terms
from csvw.metadata import Table
from cldfspec.util import REPO_DIR
def run(args):
for p in REPO_DIR.joinpath('components').glob('*/*.json'):... | [
"cldfspec.util.REPO_DIR.joinpath",
"pycldf.terms.Terms"
] | [((2706, 2735), 'pycldf.terms.Terms', 'Terms', (["(REPO_DIR / 'terms.rdf')"], {}), "(REPO_DIR / 'terms.rdf')\n", (2711, 2735), False, 'from pycldf.terms import Terms\n'), ((271, 302), 'cldfspec.util.REPO_DIR.joinpath', 'REPO_DIR.joinpath', (['"""components"""'], {}), "('components')\n", (288, 302), False, 'from cldfspe... |
import sqlite3
import sys
def get_pk_key(databasename, name, value):
connect_sqlite3 = sqlite3.connect(databasename)
cursor_sqlite3 = connect_sqlite3.cursor()
if name == "meals":
meal_name = ""
# 1) breakfast 2) brunch 3) lunch 4) supper
if int(value) == 1:
... | [
"sqlite3.connect"
] | [((98, 127), 'sqlite3.connect', 'sqlite3.connect', (['databasename'], {}), '(databasename)\n', (113, 127), False, 'import sqlite3\n'), ((8216, 8241), 'sqlite3.connect', 'sqlite3.connect', (['database'], {}), '(database)\n', (8231, 8241), False, 'import sqlite3\n'), ((1833, 1862), 'sqlite3.connect', 'sqlite3.connect', (... |
"""Test code snippets embedded in the docs.
Reference: https://sybil.readthedocs.io/en/latest/use.html#pytest
"""
from doctest import NORMALIZE_WHITESPACE
from os import chdir, getcwd
from shutil import rmtree
from tempfile import mkdtemp
import pytest
from sybil import Sybil
from sybil.parsers.doctest import DocTes... | [
"sybil.parsers.doctest.DocTestParser",
"os.getcwd",
"pytest.fixture",
"tempfile.mkdtemp",
"shutil.rmtree",
"os.chdir"
] | [((367, 397), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""module"""'}), "(scope='module')\n", (381, 397), False, 'import pytest\n'), ((424, 433), 'tempfile.mkdtemp', 'mkdtemp', ([], {}), '()\n', (431, 433), False, 'from tempfile import mkdtemp\n'), ((444, 452), 'os.getcwd', 'getcwd', ([], {}), '()\n', (450, ... |
import pyaem
import unittest
class TestHandlers(unittest.TestCase):
def test_auth_fail(self):
response = {
'http_code': 401,
'body': 'some body'
}
try:
pyaem.handlers.auth_fail(response)
self.fail('An exception should have been raised')
... | [
"unittest.main",
"pyaem.handlers.method_not_allowed",
"pyaem.handlers.auth_fail",
"pyaem.handlers.unexpected"
] | [((1734, 1749), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1747, 1749), False, 'import unittest\n'), ((221, 255), 'pyaem.handlers.auth_fail', 'pyaem.handlers.auth_fail', (['response'], {}), '(response)\n', (245, 255), False, 'import pyaem\n'), ((798, 841), 'pyaem.handlers.method_not_allowed', 'pyaem.handlers.... |
"""
Copyright 2021 Objectiv B.V.
"""
import typing
from typing import Dict, TypeVar, Tuple, List, Optional, Mapping, Hashable, Union
from sqlalchemy.engine import Dialect
from bach.expression import Expression, get_variable_tokens, VariableToken
from bach.types import value_to_dtype, get_series_type_from_dtype
from s... | [
"sql_models.util.quote_identifier",
"bach.types.get_series_type_from_dtype",
"sql_models.model.CustomSqlModelBuilder",
"bach.expression.get_variable_tokens",
"bach.expression.VariableToken.dtype_name_to_placeholder_name",
"typing.TypeVar",
"bach.types.value_to_dtype"
] | [((505, 539), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': '"""SqlModelSpec"""'}), "('T', bound='SqlModelSpec')\n", (512, 539), False, 'from typing import Dict, TypeVar, Tuple, List, Optional, Mapping, Hashable, Union\n'), ((556, 602), 'typing.TypeVar', 'TypeVar', (['"""TBachSqlModel"""'], {'bound': '"""BachSql... |
"""
Tetris in Python for Natural Selection
"""
from nat_selection.agent import Agent as NatAgent
from nat_selection.model import Model
import time
from enviorment.tetris import Tetris
env = Tetris({'reduced_grid': 0, 'reduced_shapes': 0}, 'Genetic algorithm')
def main():
agent = NatAgent(cores=4)
generation... | [
"nat_selection.agent.Agent",
"enviorment.tetris.Tetris",
"nat_selection.model.Model"
] | [((191, 260), 'enviorment.tetris.Tetris', 'Tetris', (["{'reduced_grid': 0, 'reduced_shapes': 0}", '"""Genetic algorithm"""'], {}), "({'reduced_grid': 0, 'reduced_shapes': 0}, 'Genetic algorithm')\n", (197, 260), False, 'from enviorment.tetris import Tetris\n'), ((287, 304), 'nat_selection.agent.Agent', 'NatAgent', ([],... |
#!/usr/bin/env python
#
# Copyright 2001-2004 by <NAME>. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice... | [
"_thread.get_ident",
"logging.FileHandler",
"logging.handlers.SocketHandler",
"random.choice",
"logging.Formatter",
"logging.getLogger"
] | [((1788, 1809), 'logging.getLogger', 'logging.getLogger', (['""""""'], {}), "('')\n", (1805, 1809), False, 'import logging, logging.handlers, threading, random\n'), ((2100, 2188), 'logging.Formatter', 'logging.Formatter', (['"""%(asctime)s %(levelname)-9s %(name)-8s %(thread)5s %(message)s"""'], {}), "(\n '%(asctime... |
import json
import smtplib
from socket import gaierror
import datetime as dt
port = 2525
smtp_server = "smtp.mailtrap.io"
login = "eb<PASSWORD>" # paste your login generated by Mailtrap
password = "<PASSWORD>" # paste your password generated by Mailtrap
sender = "<EMAIL>"
receiver = "<EMAIL>"
const = """\
Subject:... | [
"json.loads",
"smtplib.SMTP",
"json.dumps",
"datetime.datetime",
"datetime.datetime.strptime",
"datetime.datetime.now"
] | [((384, 407), 'datetime.datetime', 'dt.datetime', (['(2000)', '(1)', '(1)'], {}), '(2000, 1, 1)\n', (395, 407), True, 'import datetime as dt\n'), ((979, 994), 'json.loads', 'json.loads', (['msg'], {}), '(msg)\n', (989, 994), False, 'import json\n'), ((1036, 1053), 'datetime.datetime.now', 'dt.datetime.now', ([], {}), '... |
#
# (C) 2014-2017 <NAME>
# Licensed under the MIT License (MIT)
# http://opensource.org/licenses/MIT
#
import unittest
from ffws.parser import LightCycler480 as lc
class TestLightCycler480(unittest.TestCase):
def test_file_loader(self):
data = lc.file_loader("./raw/instruments/LightCycler480.txt")
... | [
"ffws.parser.LightCycler480.file_loader"
] | [((260, 314), 'ffws.parser.LightCycler480.file_loader', 'lc.file_loader', (['"""./raw/instruments/LightCycler480.txt"""'], {}), "('./raw/instruments/LightCycler480.txt')\n", (274, 314), True, 'from ffws.parser import LightCycler480 as lc\n')] |
__author__ = 'Ranjith'
import os
from .utils import find_elements_for_element
from .actions import Action
from ..common_utils import get_user_home_dir
from ..exceptions import InvalidArgumentError
from ..downloader import download_url
class File(Action):
def __init__(self, driver, locator=None, element=None, wait... | [
"os.path.isdir",
"os.path.isfile"
] | [((557, 581), 'os.path.isfile', 'os.path.isfile', (['filename'], {}), '(filename)\n', (571, 581), False, 'import os\n'), ((1125, 1149), 'os.path.isdir', 'os.path.isdir', (['directory'], {}), '(directory)\n', (1138, 1149), False, 'import os\n')] |
from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ValidationError
class Channel(models.Model):
name = models.CharField(max_length=50)
slug = models.CharField(max_length=50)
BID_TYPES_CHOICES = (
("CPC", "CPC"),
("CPM", "... | [
"django.db.models.CharField",
"django.db.models.FloatField",
"django.db.models.ForeignKey"
] | [((177, 208), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (193, 208), False, 'from django.db import models\n'), ((220, 251), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (236, 251), False, 'from django.db im... |
from fhir.resources.codeableconcept import CodeableConcept
from fhir.resources.coding import Coding
from fhir.resources.identifier import Identifier
from fhir.resources.medication import Medication, MedicationIngredient
from fhir.resources.meta import Meta
from fhir.resources.quantity import Quantity
from fhir.resource... | [
"structlog.get_logger",
"ahd2fhir.utils.fhir_utils.sha256_of_identifier",
"fhir.resources.medication.Medication.construct",
"fhir.resources.coding.Coding.construct",
"fhir.resources.coding.Coding",
"fhir.resources.quantity.Quantity.construct",
"fhir.resources.medication.MedicationIngredient.construct",
... | [((441, 453), 'structlog.get_logger', 'get_logger', ([], {}), '()\n', (451, 453), False, 'from structlog import get_logger\n'), ((664, 686), 'fhir.resources.medication.Medication.construct', 'Medication.construct', ([], {}), '()\n', (684, 686), False, 'from fhir.resources.medication import Medication, MedicationIngredi... |
"""
Plot the training progress data collected by the Monitor.
"""
import csv
import matplotlib.pyplot as plt
from microtbs_rl.utils.common_utils import *
from microtbs_rl.utils.monitor import Monitor
COLORS = ['blue', 'green', 'red', 'cyan', 'magenta', 'black', 'purple', 'pink',
'brown', 'orange', 'teal... | [
"matplotlib.pyplot.title",
"matplotlib.pyplot.show",
"csv.reader",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.legend",
"microtbs_rl.utils.monitor.Monitor.stats_filename",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.tight_layout"
] | [((2407, 2436), 'matplotlib.pyplot.title', 'plt.title', (['"""Reward over time"""'], {}), "('Reward over time')\n", (2416, 2436), True, 'import matplotlib.pyplot as plt\n'), ((2441, 2478), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Training step (batch #)"""'], {}), "('Training step (batch #)')\n", (2451, 2478), T... |
import airflow
from airflow import models,settings
from airflow.contrib.auth.backends.password_auth import PasswordUser
user = PasswordUser(models.User())
user.username = 'admin'
user.email = '<EMAIL>'
user.password = '<PASSWORD>'
#user.superuser = '1'
session = settings.Session()
session.add(user)
session.commit()
ses... | [
"airflow.models.User",
"airflow.settings.Session"
] | [((263, 281), 'airflow.settings.Session', 'settings.Session', ([], {}), '()\n', (279, 281), False, 'from airflow import models, settings\n'), ((140, 153), 'airflow.models.User', 'models.User', ([], {}), '()\n', (151, 153), False, 'from airflow import models, settings\n')] |
import requests
from apps.core.models import UserProfile
from django.conf import settings
from social.exceptions import AuthFailed
USER_INFO_LI_REQUEST_URL = ('https://api.linkedin.com/v1/people/~:('
'id,'
'firstName,'
'lastName,'
... | [
"apps.core.models.UserProfile.objects.get_or_create",
"social.exceptions.AuthFailed"
] | [((984, 1028), 'apps.core.models.UserProfile.objects.get_or_create', 'UserProfile.objects.get_or_create', ([], {'user': 'user'}), '(user=user)\n', (1017, 1028), False, 'from apps.core.models import UserProfile\n'), ((900, 954), 'social.exceptions.AuthFailed', 'AuthFailed', (['backend', '"""This is not a whitelisted ema... |