code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from flask import Flask, current_app, request, send_file, Response
import json
import io
import base64
import numpy as np
import tensorflow as tf
from PIL import Image
import cv2
from scipy.spatial import distance
import scipy.misc
from keras.preprocessing import image
from Model.bone_variational_auto_encoder import cr... | [
"keras.preprocessing.image.img_to_array",
"Model.bone_variational_auto_encoder.create_variational_bone_auto_encoder",
"PIL.Image.open",
"flask.Flask",
"json.dumps",
"io.BytesIO",
"base64.b64decode",
"numpy.array",
"numpy.empty",
"numpy.expand_dims"
] | [((647, 713), 'Model.bone_variational_auto_encoder.create_variational_bone_auto_encoder', 'create_variational_bone_auto_encoder', ([], {'dims': 'img_dim', 'latent_dim': '(128)'}), '(dims=img_dim, latent_dim=128)\n', (683, 713), False, 'from Model.bone_variational_auto_encoder import create_variational_bone_auto_encoder... |
from django.db import models, migrations
from django.db.models import CASCADE
from tree.fields import PathField
from tree.operations import CreateTreeTrigger
from tree.sql.base import ALPHANUM_LEN
class Migration(migrations.Migration):
dependencies = [
('tree', '0001_initial'),
]
operations = [
... | [
"tree.operations.CreateTreeTrigger",
"tree.fields.PathField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((873, 905), 'tree.operations.CreateTreeTrigger', 'CreateTreeTrigger', (['"""tests.Place"""'], {}), "('tests.Place')\n", (890, 905), False, 'from tree.operations import CreateTreeTrigger\n'), ((422, 515), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'serialize': '(False)', 'auto_... |
import requests
import logging
from src.Luogu_problem import Problem
logger = logging.getLogger(__name__)
header = {
'Host': 'www.luogu.org',
'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.... | [
"logging.getLogger",
"src.Luogu_problem.Problem",
"requests.get"
] | [((78, 105), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (95, 105), False, 'import logging\n'), ((651, 743), 'requests.get', 'requests.get', (["('http://www.luogu.org/space/ajax_getuid?username=%s' % uid)"], {'headers': 'header'}), "('http://www.luogu.org/space/ajax_getuid?username=%s'... |
from tensorflow.keras.layers import Dense, Flatten
from tensorflow.keras.models import Sequential
class SimpleModel(object):
@staticmethod
def build_model(observation, actions, name=None):
return Sequential([
Flatten(input_shape=(1, observation)),
Dense(observation * 8, activat... | [
"tensorflow.keras.layers.Flatten",
"tensorflow.keras.layers.Dense"
] | [((239, 276), 'tensorflow.keras.layers.Flatten', 'Flatten', ([], {'input_shape': '(1, observation)'}), '(input_shape=(1, observation))\n', (246, 276), False, 'from tensorflow.keras.layers import Dense, Flatten\n'), ((290, 331), 'tensorflow.keras.layers.Dense', 'Dense', (['(observation * 8)'], {'activation': '"""relu"""... |
# TM35FIN.py
#
# convert WGS84 (or other) lat/lon to ETRS-TM35FIN
# and figure out their TM35 map tiles
#
# 2012-2014 <NAME>
# License: ICCLEIYSIUYA (http://evvk.com/evvktvh.html)
import numpy
# ['L4', 'L4L', 'L41', 'L41L', 'L411', 'L411R', 'L4113', 'L4131R', 'L4113H', 'L4113H3']
# list for using r... | [
"pyproj.transform",
"pyproj.Proj"
] | [((1517, 1538), 'pyproj.Proj', 'pyproj.Proj', ([], {'init': 'src'}), '(init=src)\n', (1528, 1538), False, 'import pyproj\n'), ((1573, 1602), 'pyproj.Proj', 'pyproj.Proj', ([], {'init': '"""epsg:3067"""'}), "(init='epsg:3067')\n", (1584, 1602), False, 'import pyproj\n'), ((1636, 1686), 'pyproj.transform', 'pyproj.transf... |
import json
import os
import urlparse
def parse_db_url(url):
url_parts = urlparse.urlparse(url)
connection = {'threadlocals': True}
if url_parts.hostname and not url_parts.path:
connection['name'] = url_parts.hostname
else:
connection['name'] = url_parts.path[1:]
connection['h... | [
"os.path.dirname",
"os.environ.get",
"urlparse.urlparse"
] | [((814, 854), 'os.environ.get', 'os.environ.get', (['"""REDASH_NAME"""', '"""re:dash"""'], {}), "('REDASH_NAME', 're:dash')\n", (828, 854), False, 'import os\n'), ((868, 930), 'os.environ.get', 'os.environ.get', (['"""REDASH_REDIS_URL"""', '"""redis://localhost:6379/0"""'], {}), "('REDASH_REDIS_URL', 'redis://localhost... |
"""
Plot graph structures
---------------------
This functions show how to plot graph structures, such as the transition matrix.
"""
import cellrank as cr
import numpy as np
adata = cr.datasets.pancreas_preprocessed("../example.h5ad")
adata
# %%
# First, we create a forward transition matrix using the high-level ... | [
"numpy.where",
"cellrank.tl.transition_matrix",
"cellrank.datasets.pancreas_preprocessed",
"cellrank.pl.graph"
] | [((186, 238), 'cellrank.datasets.pancreas_preprocessed', 'cr.datasets.pancreas_preprocessed', (['"""../example.h5ad"""'], {}), "('../example.h5ad')\n", (219, 238), True, 'import cellrank as cr\n'), ((330, 433), 'cellrank.tl.transition_matrix', 'cr.tl.transition_matrix', (['adata'], {'show_progress_bar': '(False)', 'wei... |
import os
from peewee import *
from app.common import uuid_gen
home_dir = os.getenv("HOME")
db = SqliteDatabase(home_dir + "/crypto_rider_candles.db")
class CandleStick(Model):
id = UUIDField(primary_key=True)
exchange = CharField()
timestamp = BigIntegerField()
market = CharField()
open = Floa... | [
"app.common.uuid_gen",
"os.getenv"
] | [((77, 94), 'os.getenv', 'os.getenv', (['"""HOME"""'], {}), "('HOME')\n", (86, 94), False, 'import os\n'), ((898, 908), 'app.common.uuid_gen', 'uuid_gen', ([], {}), '()\n', (906, 908), False, 'from app.common import uuid_gen\n'), ((1767, 1777), 'app.common.uuid_gen', 'uuid_gen', ([], {}), '()\n', (1775, 1777), False, '... |
#!/usr/local/bin/python
"""
vector to matrix
"""
from __future__ import print_function
from __future__ import division
import sys
import argparse
import subprocess
import shlex
import logging
import itertools
import time
import gzip
import re
import os
import math
import uuid
import socket
from datetime import datet... | [
"logging.basicConfig",
"numpy.float",
"argparse.ArgumentParser",
"gzip.open",
"time.strftime",
"os.path.realpath",
"datetime.datetime.now",
"numpy.zeros",
"numpy.array",
"os.path.isfile",
"os.path.basename",
"sys.exit",
"re.sub",
"socket.gethostname"
] | [((630, 788), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""convert 1 or 2 vectors into a matrix (TXT - matrix.gz)"""', 'formatter_class': 'argparse.ArgumentDefaultsHelpFormatter'}), "(description=\n 'convert 1 or 2 vectors into a matrix (TXT - matrix.gz)',\n formatter_class=argpa... |
#!/usr/bin/env python
# wujian@2020
"""
Compute directional/angle feature using steer vector (based on array geometry)
"""
import argparse
import numpy as np
from libs.data_handler import SpectrogramReader, ArchiveWriter, ScpReader
from libs.opts import StftParser
from libs.spatial import directional_feats
from lib... | [
"libs.data_handler.ScpReader",
"argparse.ArgumentParser",
"libs.data_handler.ArchiveWriter",
"libs.spatial.directional_feats",
"numpy.stack",
"libs.utils.get_logger",
"numpy.load",
"libs.data_handler.SpectrogramReader"
] | [((356, 376), 'libs.utils.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (366, 376), False, 'from libs.utils import get_logger\n'), ((699, 745), 'libs.data_handler.SpectrogramReader', 'SpectrogramReader', (['args.wav_scp'], {}), '(args.wav_scp, **stft_kwargs)\n', (716, 745), False, 'from libs.data_handl... |
"""Unit test module for app_text"""
import sys
from urllib.parse import parse_qsl, unquote_plus, urlparse
from flask import render_template_string
from flask_webtest import SessionScope
import pytest
from portal.extensions import db
from portal.models.app_text import (
AppText,
MailResource,
Unversioned... | [
"flask_webtest.SessionScope",
"portal.models.app_text.MailResource",
"urllib.parse.urlparse",
"portal.models.app_text.VersionedResource",
"portal.models.app_text.UnversionedResource",
"portal.models.app_text.app_text",
"flask.render_template_string",
"portal.models.user.User.query.get",
"portal.mode... | [((1202, 1297), 'flask.render_template_string', 'render_template_string', (['"""<html></head><body>{{ app_text("landing title") }}<body/><html/>"""'], {}), '(\n \'<html></head><body>{{ app_text("landing title") }}<body/><html/>\')\n', (1224, 1297), False, 'from flask import render_template_string\n'), ((2674, 2704),... |
from calendar import timegm
from datetime import datetime
from rest_framework_jwt.compat import get_username, get_username_field
from rest_framework_jwt.settings import api_settings
from rest_framework_jwt.authentication import JSONWebTokenAuthentication
from rest_framework_jwt.utils import jwt_decode_handler
from djan... | [
"rest_framework_jwt.compat.get_username_field",
"datetime.datetime.utcnow",
"rest_framework_jwt.compat.get_username",
"rest_framework_jwt.authentication.JSONWebTokenAuthentication",
"rest_framework_jwt.utils.jwt_decode_handler",
"django_otp.models.Device.from_persistent_id"
] | [((478, 498), 'rest_framework_jwt.compat.get_username_field', 'get_username_field', ([], {}), '()\n', (496, 498), False, 'from rest_framework_jwt.compat import get_username, get_username_field\n'), ((514, 532), 'rest_framework_jwt.compat.get_username', 'get_username', (['user'], {}), '(user)\n', (526, 532), False, 'fro... |
from __future__ import print_function
from __future__ import division
from __future__ import absolute_import
import json
# import tensorflow.keras
from tensorflow.keras.utils import to_categorical
import numpy as np
import os
import random
import scipy.io as sio
import tqdm
STEP = 256
def data_generator(batch_size, ... | [
"numpy.mean",
"json.loads",
"numpy.fromfile",
"random.shuffle",
"numpy.hstack",
"tqdm.tqdm",
"os.path.splitext",
"scipy.io.loadmat",
"numpy.std",
"numpy.load"
] | [((586, 609), 'random.shuffle', 'random.shuffle', (['batches'], {}), '(batches)\n', (600, 609), False, 'import random\n'), ((2617, 2629), 'numpy.hstack', 'np.hstack', (['x'], {}), '(x)\n', (2626, 2629), True, 'import numpy as np\n'), ((2866, 2881), 'tqdm.tqdm', 'tqdm.tqdm', (['data'], {}), '(data)\n', (2875, 2881), Fal... |
import pytest
import falcon
from falcon import App, status_codes, testing
from _util import create_app # NOQA: I100
class CustomCookies:
def items(self):
return [('foo', 'bar'), ('baz', 'foo')]
def another_dummy_wsgi_app(environ, start_response):
start_response(status_codes.HTTP_OK, [('Content-Ty... | [
"falcon.testing.TestClient",
"falcon.testing.simulate_post",
"falcon.App",
"falcon.request.Request",
"falcon.testing.simulate_request",
"pytest.mark.parametrize",
"falcon.testing.closed_wsgi_iterable",
"pytest.raises",
"_util.create_app",
"falcon.testing.create_req",
"falcon.testing.create_envir... | [((622, 719), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""items"""', "[(), (b'1',), (b'1', b'2'), (b'Hello, ', b'World', b'!\\n')]"], {}), "('items', [(), (b'1',), (b'1', b'2'), (b'Hello, ',\n b'World', b'!\\n')])\n", (645, 719), False, 'import pytest\n'), ((870, 1118), 'pytest.mark.parametrize', 'py... |
"""
This file is part of the magtifun.abgeo.dev.
(c) 2021 <NAME> <<EMAIL>>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
"""
from typing import List
from fastapi import APIRouter, Depends
from app.api.dependencies.auth import get_current_us... | [
"app.services.magtifun.get_sms_history",
"app.services.magtifun.send_sms",
"fastapi.APIRouter",
"fastapi.Depends",
"app.services.magtifun.remove_sms_from_history"
] | [((583, 621), 'fastapi.APIRouter', 'APIRouter', ([], {'prefix': '"""/sms"""', 'tags': "['SMS']"}), "(prefix='/sms', tags=['SMS'])\n", (592, 621), False, 'from fastapi import APIRouter, Depends\n'), ((729, 754), 'fastapi.Depends', 'Depends', (['get_current_user'], {}), '(get_current_user)\n', (736, 754), False, 'from fa... |
from typing import List, Dict
import re
NUM_RECENT_POSTS = 12
class AccountProfile(object):
def __init__(self, username):
self.username = username
self.n_followers = 0
self.n_following = 0
self.n_posts = 0
self.biography = ""
self.email = ""
# post fields
... | [
"re.findall"
] | [((1539, 1569), 're.findall', 're.findall', (['"""#(\\\\w+)"""', 'caption'], {}), "('#(\\\\w+)', caption)\n", (1549, 1569), False, 'import re\n')] |
#!/usr/bin/python
from __future__ import print_function
from pga import PGA, PGA_REPORT_STRING
from operator import mul
import sys
try :
from functools import reduce
except ImportError:
pass
class Cards (PGA) :
def __init__ (self) :
super (self.__class__, self).__init__ \
( bool, 10
... | [
"functools.reduce"
] | [((1104, 1124), 'functools.reduce', 'reduce', (['mul', 'g[1]', '(1)'], {}), '(mul, g[1], 1)\n', (1110, 1124), False, 'from functools import reduce\n'), ((927, 947), 'functools.reduce', 'reduce', (['mul', 'g[1]', '(1)'], {}), '(mul, g[1], 1)\n', (933, 947), False, 'from functools import reduce\n')] |
#!/usr/bin/python3
"""
################################################################################
This script checks for CVE-2017-9248
https://nvd.nist.gov/vuln/detail/CVE-2017-9248
Telerik Web UI's Cryptographic Weakness
################################################################################
"""
import... | [
"requests.get"
] | [((1669, 1686), 'requests.get', 'requests.get', (['url'], {}), '(url)\n', (1681, 1686), False, 'import requests\n'), ((1727, 1761), 'requests.get', 'requests.get', (['(url + dialog_handler)'], {}), '(url + dialog_handler)\n', (1739, 1761), False, 'import requests\n')] |
import json
import numpy as np
import torch
from torch.utils.data import Dataset, DataLoader
import sentencepiece as spm
from .import FairseqDataset
from .fairseq_dataset import TAG_DICT
from .indexed_dataset import IndexedRawTextDataset
from .collaters import Seq2SeqCollater
class TaggedDataset(IndexedRawTextDatas... | [
"sentencepiece.decode",
"numpy.array",
"sentencepiece.SentencePieceProcessor",
"json.load"
] | [((2590, 2666), 'sentencepiece.SentencePieceProcessor', 'spm.SentencePieceProcessor', ([], {'model_file': '"""../../../data/wmtchat2020/spm.model"""'}), "(model_file='../../../data/wmtchat2020/spm.model')\n", (2616, 2666), True, 'import sentencepiece as spm\n'), ((1680, 1704), 'numpy.array', 'np.array', (['self.src_siz... |
# Lint as: python3
"""
Main module to run the algorithms.
"""
import os
import atexit
import csv
import itertools
import multiprocessing
import socket
import random
import time
import psutil
# absl needs to be upgraded to >= 0.10.0, otherwise joblib might not work
from absl import app
from absl import flags
import nu... | [
"csv.DictWriter",
"multiprocessing.cpu_count",
"time.sleep",
"absl.flags.DEFINE_list",
"itertools.product",
"optimal_stopping.run.write_figures.write_figures",
"absl.app.run",
"telegram_notifications.send_bot_message.send_notification",
"numpy.random.seed",
"socket.gethostname",
"atexit.register... | [((1372, 1399), 'multiprocessing.cpu_count', 'multiprocessing.cpu_count', ([], {}), '()\n', (1397, 1399), False, 'import multiprocessing\n'), ((1657, 1721), 'absl.flags.DEFINE_list', 'flags.DEFINE_list', (['"""nb_stocks"""', 'None', '"""List of number of Stocks"""'], {}), "('nb_stocks', None, 'List of number of Stocks'... |
#!/usr/bin/env python3
import logging
import sys
from .ToolChainExplorer import ToolChainExplorer
class ToolChainExplorerDFS(ToolChainExplorer):
def __init__(
self,
simgr,
max_length,
exp_dir,
nameFileShort,
worker,
):
super(ToolChainExplorerDFS, self)._... | [
"logging.getLogger",
"sys.exc_info"
] | [((468, 509), 'logging.getLogger', 'logging.getLogger', (['"""ToolChainExplorerDFS"""'], {}), "('ToolChainExplorerDFS')\n", (485, 509), False, 'import logging\n'), ((1728, 1742), 'sys.exc_info', 'sys.exc_info', ([], {}), '()\n', (1740, 1742), False, 'import sys\n')] |
# Generated from /Users/nhphung/Documents/fromSamsungLaptop/Monhoc/KS-NNLT/Materials/Assignments/MC/MC1-Python/Assignment2/upload/src/main/mc/parser/MC.g4 by ANTLR 4.7.1
# encoding: utf-8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
import sys
def serializedATN():
with StringIO() as bu... | [
"io.StringIO"
] | [((304, 314), 'io.StringIO', 'StringIO', ([], {}), '()\n', (312, 314), False, 'from io import StringIO\n')] |
# Generated by Django 3.1.4 on 2021-01-21 09:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('cmspages', '0003_auto_20210119_1359'),
]
operations = [
migrations.AlterField(
model_name='page',
name='description'... | [
"django.db.models.TextField"
] | [((340, 418), 'django.db.models.TextField', 'models.TextField', ([], {'blank': '(True)', 'help_text': '"""Description used for SEO."""', 'null': '(True)'}), "(blank=True, help_text='Description used for SEO.', null=True)\n", (356, 418), False, 'from django.db import migrations, models\n')] |
readMe = """This is script to create a copy of a template-based network that preserves as many of the
network's settings as possible, while not relying on a configuration template. The initial focus of
the script is converting MX appliance networks.
Syntax:
removetemplate -k <key> -o <org name> -n <source ... | [
"getopt.getopt",
"ipaddress.ip_address",
"requests.utils.parse_header_links",
"sys.exit",
"urllib.parse.urlencode",
"ipaddress.ip_network"
] | [((22530, 22541), 'sys.exit', 'sys.exit', (['(0)'], {}), '(0)\n', (22538, 22541), False, 'import sys, getopt, time, json, ipaddress\n'), ((22622, 22633), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (22630, 22633), False, 'import sys, getopt, time, json, ipaddress\n'), ((5362, 5405), 'requests.utils.parse_header_lin... |
"""
Grab information needed from a resource and store it.
"""
import asyncio
from abc import ABC, abstractmethod
from datetime import datetime
from utils import get_logger, get_date_cache_key
from crawler.models.bid import (
insert_new_bid,
get_bid_by_signature,
)
from crawler.models.resource import Resource
... | [
"datetime.datetime.now",
"crawler.models.bid.insert_new_bid",
"crawler.models.bid.get_bid_by_signature",
"asyncio.gather"
] | [((2437, 2466), 'asyncio.gather', 'asyncio.gather', (['*insert_tasks'], {}), '(*insert_tasks)\n', (2451, 2466), False, 'import asyncio\n'), ((1619, 1633), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1631, 1633), False, 'from datetime import datetime\n'), ((2090, 2127), 'crawler.models.bid.insert_new_bid... |
# -*- coding: utf-8
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
class DjVueConfig(AppConfig):
name = "djvue"
verbose_name = _("DjVue")
| [
"django.utils.translation.gettext_lazy"
] | [((179, 189), 'django.utils.translation.gettext_lazy', '_', (['"""DjVue"""'], {}), "('DjVue')\n", (180, 189), True, 'from django.utils.translation import gettext_lazy as _\n')] |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-03-10 10:11
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dashboard2', '0003_config_latest_value'),
]
operations = [
migrations.Alter... | [
"django.db.models.IntegerField"
] | [((411, 442), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(20)'}), '(default=20)\n', (430, 442), False, 'from django.db import migrations, models\n')] |
from __future__ import annotations
import os
import sys
import traceback
from itertools import count
from signal import SIGINT, SIGTERM, signal
from threading import Event, Lock
from typing import Any, cast
from eventsourcing.system import System
from eventsourcing.utils import TopicError, resolve_topic
from eventso... | [
"eventsourcing_grpc.application_server.start_server",
"signal.signal",
"traceback.format_exc",
"threading.Lock",
"os.environ.copy",
"eventsourcing.utils.resolve_topic",
"threading.Event",
"eventsourcing_grpc.runner.GrpcRunner",
"itertools.count",
"sys.exit"
] | [((923, 930), 'threading.Event', 'Event', ([], {}), '()\n', (928, 930), False, 'from threading import Event, Lock\n'), ((942, 948), 'threading.Lock', 'Lock', ([], {}), '()\n', (946, 948), False, 'from threading import Event, Lock\n'), ((1310, 1340), 'signal.signal', 'signal', (['SIGINT', 'signal_handler'], {}), '(SIGIN... |
from datetime import datetime as dt
from .timehacks import Local
def standard_formatter(status_code, environ, content_length):
return "{0} {1}".format(dt.now().isoformat(), status_code)
# noinspection PyPep8Naming
def ApacheFormatter(with_response_time=True):
""" A factory that returns the wanted formatter... | [
"datetime.datetime.now"
] | [((1284, 1300), 'datetime.datetime.now', 'dt.now', ([], {'tz': 'Local'}), '(tz=Local)\n', (1290, 1300), True, 'from datetime import datetime as dt\n'), ((158, 166), 'datetime.datetime.now', 'dt.now', ([], {}), '()\n', (164, 166), True, 'from datetime import datetime as dt\n')] |
import components
def AclContentCacheSimpleTest ():
"""ACL content cache test"""
ctx = components.Context (['a', 'b', 'cc'],\
['ip_a', 'ip_b', 'ip_cc'])
net = components.Network (ctx)
a = components.EndHost(ctx.a, net, ctx)
b = components.EndHost(ctx.b, net, ctx)
... | [
"components.Context",
"components.AclContentCache",
"components.PropertyChecker",
"components.EndHost",
"components.Network"
] | [((95, 158), 'components.Context', 'components.Context', (["['a', 'b', 'cc']", "['ip_a', 'ip_b', 'ip_cc']"], {}), "(['a', 'b', 'cc'], ['ip_a', 'ip_b', 'ip_cc'])\n", (113, 158), False, 'import components\n'), ((201, 224), 'components.Network', 'components.Network', (['ctx'], {}), '(ctx)\n', (219, 224), False, 'import co... |
# -*- coding: utf-8 -*-
"""
This module contains a definition of a simple helper class
"SnappiFanoutManager" which can be used to manage cards and ports of Snappi
chassis instead of reading it from fanout_graph_facts fixture.
"""
from tests.common.helpers.assertions import pytest_assert
from tests.common.snappi.common... | [
"tests.common.snappi.common_helpers.get_peer_snappi_chassis",
"time.sleep",
"tests.common.snappi.common_helpers.ansible_stdout_to_str"
] | [((8247, 8318), 'tests.common.snappi.common_helpers.get_peer_snappi_chassis', 'get_peer_snappi_chassis', ([], {'conn_data': 'conn_data', 'dut_hostname': 'dut_hostname'}), '(conn_data=conn_data, dut_hostname=dut_hostname)\n', (8270, 8318), False, 'from tests.common.snappi.common_helpers import ansible_stdout_to_str, get... |
from django.urls import reverse
from django.test import RequestFactory, TestCase
from django.utils.http import urlencode
from feder.cases.models import Case
from feder.institutions.factories import InstitutionFactory
from feder.letters.factories import IncomingLetterFactory
from feder.letters.models import Letter
from... | [
"django.test.RequestFactory",
"feder.cases.models.Case.objects.by_addresses",
"feder.parcels.factories.IncomingParcelPostFactory",
"feder.institutions.factories.InstitutionFactory",
"feder.teryt.factories.CountyJSTFactory",
"feder.letters.factories.IncomingLetterFactory",
"django.utils.http.urlencode",
... | [((722, 750), 'feder.users.factories.UserFactory', 'UserFactory', ([], {'username': '"""john"""'}), "(username='john')\n", (733, 750), False, 'from feder.users.factories import UserFactory\n'), ((1513, 1534), 'django.urls.reverse', 'reverse', (['"""cases:list"""'], {}), "('cases:list')\n", (1520, 1534), False, 'from dj... |
from django.conf.urls import include, url
from django.contrib import admin
from users.views import logout_user, connection
urlpatterns = [
url(
r'^customers/',
include('customers.urls', namespace="customers", app_name='customers')
),
url(
r'^users/',
include('users.urls',... | [
"django.conf.urls.include",
"django.conf.urls.url"
] | [((594, 629), 'django.conf.urls.url', 'url', (['"""^$"""', 'connection'], {'name': '"""login"""'}), "('^$', connection, name='login')\n", (597, 629), False, 'from django.conf.urls import include, url\n'), ((636, 679), 'django.conf.urls.url', 'url', (['"""^logout$"""', 'logout_user'], {'name': '"""logout"""'}), "('^logo... |
# import twythonaccess to be able to make twitter requests
from . import twythonaccess
# import apikeys
from . import apikeys
# import twythonstreamer for the SwedishMiner down below
from twython import TwythonStreamer
# import threading
from threading import Thread
# import time
import time
# this class provides Swed... | [
"threading.Thread",
"time.sleep"
] | [((1324, 1366), 'threading.Thread', 'Thread', ([], {'target': 'self.swedish_miner_streamer'}), '(target=self.swedish_miner_streamer)\n', (1330, 1366), False, 'from threading import Thread\n'), ((3187, 3226), 'threading.Thread', 'Thread', ([], {'target': 'self.mine_some_followers'}), '(target=self.mine_some_followers)\n... |
"""Map drawing utilities for U.S. sentiment data."""
from graphics import Canvas
from geo import position_to_xy, us_states
# A fixed gradient of sentiment colors from negative (blue) to positive (red)
# Colors chosen via Cynthia Brewer's Color Brewer (colorbrewer2.com)
SENTIMENT_COLORS = ["#313695", "#4575B4", "#74AD... | [
"geo.position_to_xy",
"graphics.Canvas"
] | [((1634, 1658), 'geo.position_to_xy', 'position_to_xy', (['location'], {}), '(location)\n', (1648, 1658), False, 'from geo import position_to_xy, us_states\n'), ((1953, 1977), 'geo.position_to_xy', 'position_to_xy', (['location'], {}), '(location)\n', (1967, 1977), False, 'from geo import position_to_xy, us_states\n'),... |
from django.db import models
'''
activity
datetime
user (FK)
type
'''
class Log(models.Model):
activity = models.CharField(max_length=50, null=False, default='')
datetime = models.DateTimeField(auto_now=True)
user = models.ForeignKey(
to='users.User'
,on_delete=models.CASCAD... | [
"django.db.models.DateTimeField",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((117, 172), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', 'null': '(False)', 'default': '""""""'}), "(max_length=50, null=False, default='')\n", (133, 172), False, 'from django.db import models\n'), ((191, 226), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {'auto_now'... |
from pycsp3.tools.curser import queue_in
class Diagram:
def __init__(self, transitions):
self.transitions = Diagram._add_transitions(transitions)
def __contains__(self, other):
queue_in.append((self, other))
return True
MSG_STATE = "states must given under the form of strings"
... | [
"pycsp3.tools.curser.queue_in.append"
] | [((204, 234), 'pycsp3.tools.curser.queue_in.append', 'queue_in.append', (['(self, other)'], {}), '((self, other))\n', (219, 234), False, 'from pycsp3.tools.curser import queue_in\n')] |
import shutil
from pathlib import Path
from typing import List, Set, Tuple, Dict
import Swit.common.paths as path_to
from Swit.common.exceptions import CommitIdError, ImpossibleCheckoutError
from Swit.common.helper_funcs import (
get_head_id, get_relpaths, handle_references_file
)
from loguru import logger
import... | [
"Swit.inner.status.print_section",
"Swit.inner.status.get_status_info",
"Swit.common.helper_funcs.handle_references_file",
"loguru.logger.info",
"Swit.common.helper_funcs.resolve_commit_id",
"Swit.common.helper_funcs.get_head_id",
"loguru.logger.warning",
"shutil.copytree",
"Swit.common.helper_funcs... | [((2347, 2408), 'Swit.common.helper_funcs.get_relpaths', 'get_relpaths', (['path_to.repo'], {'ignore_wit': '(True)', 'only_files': '(False)'}), '(path_to.repo, ignore_wit=True, only_files=False)\n', (2359, 2408), False, 'from Swit.common.helper_funcs import get_head_id, get_relpaths, handle_references_file\n'), ((3075,... |
"""
Units tests for openff.evaluator.utils.tcp
"""
from openff.evaluator.utils import tcp
def test_message_packing():
"""Test that packing / unpacking ints works as expected"""
assert tcp.unpack_int(tcp.pack_int(20))[0] == 20
def test_message_type_enum():
"""Test the message type enum creation."""
a... | [
"openff.evaluator.utils.tcp.EvaluatorMessageTypes",
"openff.evaluator.utils.tcp.pack_int"
] | [((326, 354), 'openff.evaluator.utils.tcp.EvaluatorMessageTypes', 'tcp.EvaluatorMessageTypes', (['(0)'], {}), '(0)\n', (351, 354), False, 'from openff.evaluator.utils import tcp\n'), ((406, 434), 'openff.evaluator.utils.tcp.EvaluatorMessageTypes', 'tcp.EvaluatorMessageTypes', (['(1)'], {}), '(1)\n', (431, 434), False, ... |
# -*- coding: utf-8 -*-
from zgrobot.utils import to_text
def get_value(instance, path, default=None):
dic = instance.__dict__
for entry in path.split('.'):
dic = dic.get(entry)
if dic is None:
return default
return dic or default
class BaseEntry(object):
def __init__(sel... | [
"zgrobot.utils.to_text"
] | [((976, 986), 'zgrobot.utils.to_text', 'to_text', (['v'], {}), '(v)\n', (983, 986), False, 'from zgrobot.utils import to_text\n')] |
from subprocess import Popen, PIPE
from time import sleep
from datetime import datetime
import board
import digitalio
import adafruit_character_lcd.character_lcd as characterlcd
import os
path_img = 'assets/'
path_log = 'assets/log/log.txt'
# Modify this if you have a different sized character LCD
lcd_columns = 16
lc... | [
"digitalio.DigitalInOut",
"os.listdir",
"adafruit_character_lcd.character_lcd.Character_LCD_Mono",
"time.sleep"
] | [((395, 428), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.D16'], {}), '(board.D16)\n', (417, 428), False, 'import digitalio\n'), ((438, 471), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['board.D12'], {}), '(board.D12)\n', (460, 471), False, 'import digitalio\n'), ((481, 514), 'digitalio.Digit... |
#***************************************************#
# This file is part of PFNET. #
# #
# Copyright (c) 2015, <NAME>. #
# #
# PFNET is released under the BSD 2-clause license. #
#***********... | [
"pfnet.Parser",
"sys.path.append"
] | [((374, 394), 'sys.path.append', 'sys.path.append', (['"""."""'], {}), "('.')\n", (389, 394), False, 'import sys\n'), ((446, 471), 'pfnet.Parser', 'pfnet.Parser', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (458, 471), False, 'import pfnet\n')] |
# Copyright 2015 Google 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, ... | [
"logging.NullHandler",
"logging.getLogger"
] | [((1382, 1403), 'logging.NullHandler', 'logging.NullHandler', ([], {}), '()\n', (1401, 1403), False, 'import logging\n'), ((1343, 1370), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1360, 1370), False, 'import logging\n')] |
from twilio.twiml.voice_response import VoiceResponse, Say
response = VoiceResponse()
response.say('Chapeau!', voice='alice', language='fr-FR')
print(response)
| [
"twilio.twiml.voice_response.VoiceResponse"
] | [((71, 86), 'twilio.twiml.voice_response.VoiceResponse', 'VoiceResponse', ([], {}), '()\n', (84, 86), False, 'from twilio.twiml.voice_response import VoiceResponse, Say\n')] |
#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @author : Feifei
# @IDE : Pycharm
# @file : VGGNet.py
# @time : 2019/5/22 16:27
# @info : 实现VGG16的版本
from datetime import datetime
import math
import time
import tensorflow as tf
def conv_op(input_op,name,kh,kw,n_out,dh,dw,p):
'''
:param inpu... | [
"math.sqrt",
"tensorflow.gradients",
"tensorflow.nn.dropout",
"tensorflow.nn.softmax",
"tensorflow.Graph",
"tensorflow.random_normal",
"tensorflow.placeholder",
"tensorflow.Session",
"tensorflow.nn.relu_layer",
"tensorflow.contrib.layers.xavier_initializer_conv2d",
"tensorflow.nn.conv2d",
"ten... | [((2336, 2437), 'tensorflow.nn.max_pool', 'tf.nn.max_pool', (['input_op'], {'ksize': '[1, kh, kw, 1]', 'strides': '[1, dh, dw, 1]', 'padding': '"""SAME"""', 'name': 'name'}), "(input_op, ksize=[1, kh, kw, 1], strides=[1, dh, dw, 1],\n padding='SAME', name=name)\n", (2350, 2437), True, 'import tensorflow as tf\n'), (... |
# -*- coding: utf8 -*-
import os
if __name__ == '__main__':
# change working dir to script location
abspath = os.path.abspath(__file__)
dname = os.path.dirname(os.path.dirname(abspath))
os.chdir(dname)
for index, file in enumerate(os.listdir(dname + "\\temp\\")):
os.remove(dname + "\\temp\... | [
"os.listdir",
"os.chdir",
"os.path.dirname",
"os.path.abspath",
"os.remove"
] | [((119, 144), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (134, 144), False, 'import os\n'), ((203, 218), 'os.chdir', 'os.chdir', (['dname'], {}), '(dname)\n', (211, 218), False, 'import os\n'), ((173, 197), 'os.path.dirname', 'os.path.dirname', (['abspath'], {}), '(abspath)\n', (188, 197)... |
import json
import re
import os
from enum import Enum
from collections import defaultdict
import yaml
class SwaggerJSONEncoder(json.JSONEncoder):
def default(self, obj):
if 'serialize' in dir(obj):
return obj.serialize()
return json.JSONEncoder.default(self, obj)
class SwaggerModel(... | [
"json.JSONEncoder.default",
"json.dumps",
"yaml.load",
"os.path.realpath",
"collections.defaultdict",
"re.findall",
"re.search"
] | [((263, 298), 'json.JSONEncoder.default', 'json.JSONEncoder.default', (['self', 'obj'], {}), '(self, obj)\n', (287, 298), False, 'import json\n'), ((2784, 2824), 'json.dumps', 'json.dumps', (['self'], {'cls': 'SwaggerJSONEncoder'}), '(self, cls=SwaggerJSONEncoder)\n', (2794, 2824), False, 'import json\n'), ((3427, 3467... |
# coding: utf-8
from unittest import TestCase
import time
from weblib.control import sleep, repeat
class ControlTestCase(TestCase):
def test_sleep(self):
now = time.time()
sleep(0.9, 1.1)
self.assertTrue(1.2 > (time.time() - now) > 0.8)
now = time.time()
sleep(0, 0.5)
... | [
"weblib.control.sleep",
"weblib.control.repeat",
"time.time"
] | [((174, 185), 'time.time', 'time.time', ([], {}), '()\n', (183, 185), False, 'import time\n'), ((194, 209), 'weblib.control.sleep', 'sleep', (['(0.9)', '(1.1)'], {}), '(0.9, 1.1)\n', (199, 209), False, 'from weblib.control import sleep, repeat\n'), ((282, 293), 'time.time', 'time.time', ([], {}), '()\n', (291, 293), Fa... |
#!/usr/bin/env python3
"""Categorical Feature Encoding Challengeの実験用コード。"""
import pathlib
import numpy as np
import pandas as pd
import sklearn.metrics
import pytoolkit as tk
nfold = 5
params = {
"objective": "binary",
"metric": "auc",
"learning_rate": 0.01,
"nthread": -1,
# "verbosity": -1,
... | [
"pandas.read_csv",
"pathlib.Path",
"pytoolkit.preprocessing.encode_cyclic",
"pytoolkit.data.Dataset",
"pytoolkit.validation.split",
"pytoolkit.log.get",
"pytoolkit.preprocessing.encode_ordinal",
"pytoolkit.preprocessing.FeaturesEncoder",
"pandas.DataFrame",
"pytoolkit.cli.App",
"pytoolkit.prepro... | [((541, 583), 'pathlib.Path', 'pathlib.Path', (['"""data/kaggle_cat-in-the-dat"""'], {}), "('data/kaggle_cat-in-the-dat')\n", (553, 583), False, 'import pathlib\n'), ((657, 690), 'pytoolkit.cli.App', 'tk.cli.App', ([], {'output_dir': 'models_dir'}), '(output_dir=models_dir)\n', (667, 690), True, 'import pytoolkit as tk... |
# Generated by Django 3.1.2 on 2020-10-31 16:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('hoodapp', '0008_auto_20201031_1609'),
]
operations = [
migrations.RemoveField(
model_name='prof... | [
"django.db.migrations.RemoveField",
"django.db.models.ForeignKey"
] | [((268, 329), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""profile"""', 'name': '"""hood_ref"""'}), "(model_name='profile', name='hood_ref')\n", (290, 329), False, 'from django.db import migrations, models\n'), ((482, 612), 'django.db.models.ForeignKey', 'models.ForeignKey', ([]... |
#! /usr/bin/env python3
import math
PRECISION = 0.1
def getCorrection(start, end, pos):
"""Correct the angle for the trajectory adjustment
Function to get the correct angle correction when the robot deviates from
it's estimated trajectory.
Args:
start: The starting position of the robot.
... | [
"math.asin",
"math.sqrt"
] | [((1645, 1701), 'math.sqrt', 'math.sqrt', (['((xp - xi) * (xp - xi) + (yp - yi) * (yp - yi))'], {}), '((xp - xi) * (xp - xi) + (yp - yi) * (yp - yi))\n', (1654, 1701), False, 'import math\n'), ((1716, 1772), 'math.sqrt', 'math.sqrt', (['((xp - xe) * (xp - xe) + (yp - ye) * (yp - ye))'], {}), '((xp - xe) * (xp - xe) + (... |
"""Tests for models."""
import pytest
import pytorch_lightning as pl
from torch import nn
from fair_bolts.datamodules import CelebaDataModule
from fair_bolts.models.erm_baseline import ErmBaseline
from fair_bolts.models.laftr_baseline import Laftr
@pytest.mark.parametrize("dm_class", [CelebaDataModule])
def test_laf... | [
"pytest.mark.parametrize",
"fair_bolts.models.laftr_baseline.Laftr",
"pytorch_lightning.Trainer",
"fair_bolts.models.erm_baseline.ErmBaseline"
] | [((252, 307), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dm_class"""', '[CelebaDataModule]'], {}), "('dm_class', [CelebaDataModule])\n", (275, 307), False, 'import pytest\n'), ((893, 948), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""dm_class"""', '[CelebaDataModule]'], {}), "('dm_class'... |
from __future__ import absolute_import
import json
import logging
import requests
import xml.etree.ElementTree as ET
from caighdean import Translator
from caighdean.exceptions import TranslationError
from six.moves.urllib.parse import quote
from uuid import uuid4
from django.conf import settings
from django.http imp... | [
"logging.getLogger",
"json.loads",
"requests.post",
"pontoon.base.models.Entity.objects.get",
"django.http.JsonResponse",
"pontoon.base.models.Locale.objects.all",
"caighdean.Translator",
"pontoon.machinery.utils.get_google_translate_data",
"requests.get",
"uuid.uuid4",
"pontoon.machinery.utils.... | [((725, 752), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (742, 752), False, 'import logging\n'), ((1923, 1968), 'pontoon.machinery.utils.get_translation_memory_data', 'get_translation_memory_data', (['text', 'locale', 'pk'], {}), '(text, locale, pk)\n', (1950, 1968), False, 'from pont... |
# Copyright 2013 Cloudbase Solutions Srl
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless r... | [
"os_win.utils.winapi.libs.get_shared_lib_handle",
"oslo_log.log.getLogger",
"os_win.utils.storage.diskutils.DiskUtils",
"ctypes.c_wchar_p",
"os_win.utils.winapi.wintypes.HANDLE",
"os_win.utils.win32utils.Win32Utils",
"os.path.exists",
"os.remove",
"os_win.utils.winapi.libs.virtdisk.MERGE_VIRTUAL_DIS... | [((1475, 1518), 'os_win.utils.winapi.libs.get_shared_lib_handle', 'w_lib.get_shared_lib_handle', (['w_lib.KERNEL32'], {}), '(w_lib.KERNEL32)\n', (1502, 1518), True, 'from os_win.utils.winapi import libs as w_lib\n'), ((1530, 1573), 'os_win.utils.winapi.libs.get_shared_lib_handle', 'w_lib.get_shared_lib_handle', (['w_li... |
from django.db import models
from django.db.models import Q
from django.conf import settings
from django_extensions.db.fields import AutoSlugField
from django.core.files.uploadedfile import InMemoryUploadedFile
from django.utils import timezone
from werkzeug.datastructures import MultiDict
from time import mktime
imp... | [
"logging.getLogger",
"django.db.models.TextField",
"re.compile",
"apps.requests.models.Request.objects.filter",
"logging.info",
"StringIO.StringIO",
"datetime.datetime",
"django_extensions.db.fields.AutoSlugField",
"django.db.models.ForeignKey",
"email.utils.parseaddr",
"django.utils.timezone.no... | [((713, 741), 'logging.getLogger', 'logging.getLogger', (['"""default"""'], {}), "('default')\n", (730, 741), False, 'import logging\n'), ((759, 799), 're.compile', 're.compile', (['"""LOOKUP:[a-zA-Z1234567890]*"""'], {}), "('LOOKUP:[a-zA-Z1234567890]*')\n", (769, 799), False, 'import re\n'), ((1029, 1074), 'django.db.... |
from django.urls import re_path
from .import views
urlpatterns = [
re_path(r'^query/$',views.queryfunc),
# re_path(r'^weather/([a-z]+)/(\d{4})/$',views.routerfunc),
re_path(r'^weather/(?P<city>[a-z]+)/(?P<year>\d{4})/$',views.routerfunc1),
re_path(r'^form/$',views.formfunc),
]
| [
"django.urls.re_path"
] | [((72, 108), 'django.urls.re_path', 're_path', (['"""^query/$"""', 'views.queryfunc'], {}), "('^query/$', views.queryfunc)\n", (79, 108), False, 'from django.urls import re_path\n'), ((178, 252), 'django.urls.re_path', 're_path', (['"""^weather/(?P<city>[a-z]+)/(?P<year>\\\\d{4})/$"""', 'views.routerfunc1'], {}), "('^w... |
#!/usr/bin/env python3
########################################################################################
## This script provides an easy way to aggregate the token holders of Art Blocks
## projects.
##
## In this current example, all projects are being queried. However, projectIDFilter
## can be changed to quer... | [
"csv.DictWriter",
"requests.Session",
"time.sleep",
"pandas.read_csv"
] | [((3728, 3746), 'requests.Session', 'requests.Session', ([], {}), '()\n', (3744, 3746), False, 'import requests\n'), ((4409, 4422), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (4419, 4422), False, 'import time\n'), ((4652, 4715), 'csv.DictWriter', 'csv.DictWriter', (['f'], {'quoting': 'csv.QUOTE_ALL', 'fieldnam... |
#!/usr/bin/env python
import os
if __name__ == '__main__':
os.environ['CLASSPATH'] = ''
jar = os.path.join(os.path.dirname(__file__), '..', '..', 'src', 'test',
'resources', 'test-app', 'test-application.jar')
os.popen2('java -jar %s' % jar) | [
"os.path.dirname",
"os.popen2"
] | [((248, 279), 'os.popen2', 'os.popen2', (["('java -jar %s' % jar)"], {}), "('java -jar %s' % jar)\n", (257, 279), False, 'import os\n'), ((117, 142), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (132, 142), False, 'import os\n')] |
from django.core.urlresolvers import reverse
from django.contrib.auth.mixins import LoginRequiredMixin
from django.contrib import messages
from django.views.generic import CreateView, DetailView, UpdateView, TemplateView
from .forms import CreateUserProfileForm
from .models import UserProfile
from . import mixins
cla... | [
"django.core.urlresolvers.reverse",
"django.contrib.messages.success"
] | [((513, 576), 'django.contrib.messages.success', 'messages.success', (['self.request', '"""Profile successfully created."""'], {}), "(self.request, 'Profile successfully created.')\n", (529, 576), False, 'from django.contrib import messages\n'), ((592, 683), 'django.core.urlresolvers.reverse', 'reverse', (['"""accounts... |
"""LISC plots - plots for words data."""
from lisc.plts.utils import check_ax, savefig
from lisc.plts.wordcloud import create_wordcloud, conv_freqs
from lisc.core.modutils import safe_import
plt = safe_import('.pyplot', 'matplotlib')
###################################################################################... | [
"lisc.plts.utils.check_ax",
"lisc.core.modutils.safe_import",
"lisc.plts.wordcloud.conv_freqs"
] | [((199, 235), 'lisc.core.modutils.safe_import', 'safe_import', (['""".pyplot"""', '"""matplotlib"""'], {}), "('.pyplot', 'matplotlib')\n", (210, 235), False, 'from lisc.core.modutils import safe_import\n'), ((861, 881), 'lisc.plts.utils.check_ax', 'check_ax', (['ax', '(8, 8)'], {}), '(ax, (8, 8))\n', (869, 881), False,... |
# -*- coding: utf-8 -*-
import json
data = {}
with open('data/still_i_rise.json') as f:
data = json.load(f)
transcript = data["transcript"]
transcriptLen = len(transcript)
offset = 0
for i, entry in enumerate(data["words"]):
word = entry["word"]
wordLen = len(word)
offsetEnd = offset+wordLen
su... | [
"json.load",
"json.dump"
] | [((101, 113), 'json.load', 'json.load', (['f'], {}), '(f)\n', (110, 113), False, 'import json\n'), ((678, 706), 'json.dump', 'json.dump', (['data', 'f'], {'indent': '(2)'}), '(data, f, indent=2)\n', (687, 706), False, 'import json\n')] |
# This file is part of Indico.
# Copyright (C) 2002 - 2022 CERN
#
# Indico is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see the
# LICENSE file for more details.
from datetime import timedelta
from flask import g
import indico.modules.events.contributions.models.con... | [
"datetime.timedelta",
"indico.modules.events.contributions.models.contributions.Contribution.allocate_friendly_ids"
] | [((1158, 1208), 'indico.modules.events.contributions.models.contributions.Contribution.allocate_friendly_ids', 'Contribution.allocate_friendly_ids', (['dummy_event', '(8)'], {}), '(dummy_event, 8)\n', (1192, 1208), False, 'from indico.modules.events.contributions.models.contributions import Contribution\n'), ((904, 925... |
import os
import pickle
import numpy as np
import torch
from loguru import logger
from tqdm import tqdm
def make_adj_list(N, edge_index_transposed):
A = np.eye(N)
for edge in edge_index_transposed:
A[edge[0], edge[1]] = 1
adj_list = A != 0
return adj_list
def make_adj_list_wrapper(x):
r... | [
"os.path.exists",
"numpy.eye",
"pickle.dump",
"loguru.logger.debug",
"loguru.logger.info",
"tqdm.tqdm",
"pickle.load"
] | [((160, 169), 'numpy.eye', 'np.eye', (['N'], {}), '(N)\n', (166, 169), True, 'import numpy as np\n'), ((437, 478), 'tqdm.tqdm', 'tqdm', (['data', '"""adjacency list"""'], {'leave': '(False)'}), "(data, 'adjacency list', leave=False)\n", (441, 478), False, 'from tqdm import tqdm\n'), ((902, 927), 'os.path.exists', 'os.p... |
import binascii
from unittest import TestCase
from aioquic.buffer import Buffer, encode_uint_var
from aioquic.h3.connection import (
H3_ALPN,
ErrorCode,
FrameType,
FrameUnexpected,
H3Connection,
MessageError,
Setting,
SettingsError,
StreamType,
encode_frame,
encode_settings,... | [
"aioquic.h3.connection.validate_push_promise_headers",
"aioquic.h3.connection.parse_settings",
"aioquic.quic.configuration.QuicConfiguration",
"aioquic.h3.connection.encode_frame",
"aioquic.h3.events.PushPromiseReceived",
"aioquic.h3.events.HeadersReceived",
"aioquic.h3.connection.H3Connection",
"aioq... | [((5840, 5865), 'aioquic.h3.connection.H3Connection', 'H3Connection', (['quic_server'], {}), '(quic_server)\n', (5852, 5865), False, 'from aioquic.h3.connection import H3_ALPN, ErrorCode, FrameType, FrameUnexpected, H3Connection, MessageError, Setting, SettingsError, StreamType, encode_frame, encode_settings, parse_set... |
import json
import math
import os
import tempfile
from os import remove
from os.path import isfile
import numpy as np
import pandas as pd
from pandapower.auxiliary import _add_ppc_options, _add_opf_options, _add_auxiliary_elements
from pandapower.build_branch import _calc_line_parameter
from pandapower.pd2ppc import ... | [
"logging.getLogger",
"pandapower.pd2ppc._pd2ppc",
"numpy.allclose",
"json.dump",
"pandapower.results.init_results",
"math.radians",
"os.path.isfile",
"numpy.array",
"numpy.zeros",
"pandapower.build_branch._calc_line_parameter",
"tempfile.gettempdir",
"pandas.item",
"tempfile._get_candidate_n... | [((3286, 3313), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (3303, 3313), False, 'import logging\n'), ((2754, 3025), 'pandapower.auxiliary._add_opf_options', '_add_opf_options', (['net'], {'trafo_loading': '"""power"""', 'ac': 'ac', 'init': '"""flat"""', 'numba': '(True)', 'pp_to_pm_ca... |
import board
import busio
import digitalio
import analogio
import time
import neopixel
from random import randint
import os
import adafruit_dht
from adafruit_wiznet5k.adafruit_wiznet5k import *
import adafruit_wiznet5k.adafruit_wiznet5k_socket as socket
from adafruit_io.adafruit_io import IO_MQTT
impo... | [
"adafruit_io.adafruit_io.IO_MQTT",
"busio.SPI",
"analogio.AnalogIn",
"time.sleep",
"neopixel.NeoPixel",
"digitalio.DigitalInOut",
"adafruit_minimqtt.adafruit_minimqtt.MQTT",
"adafruit_minimqtt.adafruit_minimqtt.set_socket"
] | [((1383, 1410), 'analogio.AnalogIn', 'analogio.AnalogIn', (['board.A1'], {}), '(board.A1)\n', (1400, 1410), False, 'import analogio\n'), ((1428, 1462), 'digitalio.DigitalInOut', 'digitalio.DigitalInOut', (['W5x00_RSTn'], {}), '(W5x00_RSTn)\n', (1450, 1462), False, 'import digitalio\n'), ((1560, 1592), 'digitalio.Digita... |
# Generated by Django 2.1.1 on 2018-09-11 23:08
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('games', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='gameposting',
... | [
"django.db.models.ForeignKey"
] | [((357, 495), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'null': '(True)', 'on_delete': 'django.db.models.deletion.CASCADE', 'related_name': '"""gmed_games"""', 'to': '"""gamer_profiles.GamerProfile"""'}), "(null=True, on_delete=django.db.models.deletion.CASCADE,\n related_name='gmed_games', to='gamer... |
'''
VrahProxyStar - utility for checking proxy in terminal under the GNU GPL V3.0 Licensy
AUTHORS: G0rillaz
Version: 0.1
'''
from sys import argv
import urllib3
from os import system as terminal
import os
import requests
from colorama import Fore,Style
URL = "http://google.com"
CMD_CLEAR_TERM = "clear"... | [
"os.system",
"requests.Session"
] | [((1937, 1961), 'os.system', 'terminal', (['CMD_CLEAR_TERM'], {}), '(CMD_CLEAR_TERM)\n', (1945, 1961), True, 'from os import system as terminal\n'), ((543, 561), 'requests.Session', 'requests.Session', ([], {}), '()\n', (559, 561), False, 'import requests\n'), ((2703, 2727), 'os.system', 'terminal', (['CMD_CLEAR_TERM']... |
import torch
import numpy as np
import torch.nn as nn
import torch.nn.functional as F
from . import util,dataloader
def default_eval(refer_loader,query_loader,model,class_acc=False):
fb_vector = None
if hasattr(model,'get_fb_vector'):
fb_vector = get_fb_vector(refer_loader,model)
centroid = g... | [
"torch.mean",
"torch.load",
"torch.eq",
"torch.sum",
"torch.no_grad",
"torch.zeros"
] | [((4072, 4087), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (4085, 4087), False, 'import torch\n'), ((593, 614), 'torch.zeros', 'torch.zeros', (['way', 'dim'], {}), '(way, dim)\n', (604, 614), False, 'import torch\n'), ((1478, 1494), 'torch.zeros', 'torch.zeros', (['way'], {}), '(way)\n', (1489, 1494), False, '... |
from tfcgp.config import Config
from tfcgp.chromosome import Chromosome
from tfcgp.classifier import Classifier
from tfcgp.problem import Problem
import numpy as np
import tensorflow as tf
from sklearn import datasets
c = Config()
c.update("cfg/test.yaml")
data = datasets.load_iris()
p = Problem(data.data, data.targ... | [
"sklearn.datasets.load_iris",
"numpy.copy",
"tfcgp.chromosome.Chromosome",
"tfcgp.config.Config",
"numpy.any",
"tfcgp.classifier.Classifier",
"tfcgp.problem.Problem",
"numpy.all"
] | [((223, 231), 'tfcgp.config.Config', 'Config', ([], {}), '()\n', (229, 231), False, 'from tfcgp.config import Config\n'), ((266, 286), 'sklearn.datasets.load_iris', 'datasets.load_iris', ([], {}), '()\n', (284, 286), False, 'from sklearn import datasets\n'), ((292, 323), 'tfcgp.problem.Problem', 'Problem', (['data.data... |
#!/usr/bin/env python
import numpy,genutil
import unittest
class GENUTIL(unittest.TestCase):
def assertArraysEqual(self,A,B):
self.assertTrue(numpy.all(numpy.equal(A,B)))
def testStatisticsNumpy(self):
a=numpy.ones((15,25),'d')
rk = [0.0, 91.66666666666667, 87.5, 83.33333333333333, 79.... | [
"numpy.equal",
"numpy.ones",
"genutil.statistics.rank",
"genutil.statistics.variance"
] | [((230, 255), 'numpy.ones', 'numpy.ones', (['(15, 25)', '"""d"""'], {}), "((15, 25), 'd')\n", (240, 255), False, 'import numpy, genutil\n'), ((707, 741), 'genutil.statistics.rank', 'genutil.statistics.rank', (['a'], {'axis': '(1)'}), '(a, axis=1)\n', (730, 741), False, 'import numpy, genutil\n'), ((166, 183), 'numpy.eq... |
from __future__ import division
from __future__ import absolute_import
from __future__ import print_function
from __future__ import unicode_literals
from os import path, listdir
import os
import pickle as pkl
import argparse
import re
import numpy as np
import xgboost as xgb
from scipy.special import expit
from util... | [
"os.path.exists",
"argparse.ArgumentParser",
"numpy.hstack",
"os.makedirs",
"os.path.join",
"numpy.random.seed"
] | [((332, 351), 'numpy.random.seed', 'np.random.seed', (['(998)'], {}), '(998)\n', (346, 351), True, 'import numpy as np\n'), ((983, 1016), 'numpy.hstack', 'np.hstack', (['(X_train, X_train_ext)'], {}), '((X_train, X_train_ext))\n', (992, 1016), True, 'import numpy as np\n'), ((1026, 1057), 'numpy.hstack', 'np.hstack', (... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
This is an Astropy affiliated package.
"""
# Affiliated packages may add whatever they like to this file, but
# should keep this content at the top.
# ----------------------------------------------------------------------------
from ._astropy_init imp... | [
"os.path.dirname",
"astropy.config.configuration.ConfigurationDefaultMissingWarning",
"os.environ.get",
"astropy.config.configuration.update_default_config"
] | [((676, 727), 'os.environ.get', 'os.environ.get', (['"""ASTROPY_SKIP_CONFIG_UPDATE"""', '(False)'], {}), "('ASTROPY_SKIP_CONFIG_UPDATE', False)\n", (690, 727), False, 'import os\n'), ((750, 775), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (765, 775), False, 'import os\n'), ((801, 868), 'a... |
from datetime import datetime
import factory
from ..models import Project, Grant, GrantReport
class ProjectFactory(factory.DjangoModelFactory):
class Meta:
model = Project
name = factory.Sequence(lambda n: 'project{}'.format(n))
code = factory.Sequence(lambda n: 'p{}'.format(n))
iacuc_numbe... | [
"factory.SubFactory",
"factory.LazyFunction",
"factory.Sequence"
] | [((379, 408), 'factory.Sequence', 'factory.Sequence', (['(lambda n: n)'], {}), '(lambda n: n)\n', (395, 408), False, 'import factory\n'), ((662, 691), 'factory.Sequence', 'factory.Sequence', (['(lambda n: n)'], {}), '(lambda n: n)\n', (678, 691), False, 'import factory\n'), ((805, 837), 'factory.SubFactory', 'factory.S... |
import pytest
from datalake_ingester import S3Notification
from freezegun import freeze_time
def _import_exception(exception_name):
mod_name = '.'.join(exception_name.split('.')[0:-1])
exception_name = exception_name.split('.')[-1]
mod = __import__(mod_name, fromlist=[str(exception_name)])
return geta... | [
"freezegun.freeze_time",
"pytest.raises",
"datalake_ingester.S3Notification"
] | [((522, 557), 'freezegun.freeze_time', 'freeze_time', (['"""1977-07-01T03:01:00Z"""'], {}), "('1977-07-01T03:01:00Z')\n", (533, 557), False, 'from freezegun import freeze_time\n'), ((390, 421), 'datalake_ingester.S3Notification', 'S3Notification', (['s3_notification'], {}), '(s3_notification)\n', (404, 421), False, 'fr... |
#!/usr/bin/env python
# encoding:utf8
import time
import sqlite3
from config import page_config2
class DB:
conn = None
def __init__(self, mysql_db):
self.mysql_db = mysql_db
def connect(self):
print("conn start" + self.mysql_db)
self.conn = sqlite3.connect(self.mysql_db)
... | [
"sqlite3.connect",
"time.sleep",
"config.page_config2.keys"
] | [((281, 311), 'sqlite3.connect', 'sqlite3.connect', (['self.mysql_db'], {}), '(self.mysql_db)\n', (296, 311), False, 'import sqlite3\n'), ((761, 813), 'sqlite3.connect', 'sqlite3.connect', (['self.mysql_db'], {'isolation_level': 'None'}), '(self.mysql_db, isolation_level=None)\n', (776, 813), False, 'import sqlite3\n')... |
#!/usr/bin/env python3
#
# planet.py
# SWN Planet Generator
# This script generates a complete planet with a world description,
# society, fauna, aliens (sometimes), a faction or two, a religion,
# some political parties and NPCs.
#
# Copyright (c) 2014 <NAME> <<EMAIL>>
#
# This file is part of the SWN Toolbox.
#
# Per... | [
"world.World",
"random.choice",
"political_party.PoliticalParty",
"corporation.Corporation",
"heresy.Heresy",
"society.Society",
"trade.Trade",
"architecture.Architecture",
"religion.Religion",
"adventure.Adventure",
"faction.Faction",
"animal.Animal",
"npc.NPC"
] | [((1804, 1811), 'world.World', 'World', ([], {}), '()\n', (1809, 1811), False, 'from world import World\n'), ((1897, 1906), 'society.Society', 'Society', ([], {}), '()\n', (1904, 1906), False, 'from society import Society\n'), ((1944, 1965), 'random.choice', 'random.choice', (['[2, 3]'], {}), '([2, 3])\n', (1957, 1965)... |
import os
import os.path
import random
import re
import shutil
import traceback
import urllib.request
import asyncio
from utils import register_command
import utils
class IntroManager:
def __init__(self, client, ohm_server):
self.client = client
self.ohm_server = ohm_server
self.intro_cou... | [
"random.choice",
"shutil.copyfileobj",
"asyncio.get_event_loop",
"utils.get_server",
"asyncio.Lock",
"asyncio.Event",
"utils.register_command",
"os.path.realpath",
"re.findall",
"traceback.print_exc",
"utils.connect_to_voice"
] | [((1344, 1392), 'utils.register_command', 'register_command', (['"""introstop"""', '"""stopintro"""', '"""is"""'], {}), "('introstop', 'stopintro', 'is')\n", (1360, 1392), False, 'from utils import register_command\n'), ((1862, 1892), 'utils.register_command', 'register_command', (['"""intro"""', '"""i"""'], {}), "('in... |
# -*- coding: utf-8 -*-
"""
Establish a socket connection through an HTTP proxy.
Author: <NAME> <<EMAIL>>
License:
This code can be used, modified and distributed freely, as long as it is this
note containing the original author, the source and this license, is put
along with the source code.
<NAME>, modified fr... | [
"urllib.request.getproxies",
"urllib.parse.urlparse",
"socket.socket",
"future.standard_library.hooks"
] | [((637, 661), 'future.standard_library.hooks', 'standard_library.hooks', ([], {}), '()\n', (659, 661), False, 'from future import standard_library\n'), ((865, 877), 'urllib.request.getproxies', 'getproxies', ([], {}), '()\n', (875, 877), False, 'from urllib.request import getproxies\n'), ((2657, 2706), 'socket.socket',... |
# (c) Copyright 2013 Hewlett-Packard Development Company, L.P.
#
# 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 re... | [
"six.text_type",
"os_brick.i18n._",
"traceback.format_exception",
"oslo_log.log.getLogger"
] | [((832, 859), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (849, 859), True, 'from oslo_log import log as logging\n'), ((1123, 1158), 'os_brick.i18n._', '_', (['"""An unknown exception occurred."""'], {}), "('An unknown exception occurred.')\n", (1124, 1158), False, 'from os_brick.... |
import pytest
class Examples:
small_example = [
"""
describe "This":
before_each:
self.x = 5
describe "That":
before_each:
self.y = 6
describe "Meh":
after_each:
self.y = None
describe "Blah... | [
"pytest.helpers.assert_example"
] | [((6273, 6467), 'pytest.helpers.assert_example', 'pytest.helpers.assert_example', (['[\'describe "Something testable"\',\n """\n class TestSomethingTestable :pass\n\n TestSomethingTestable .is_noy_spec =True\n """\n ]'], {}), '([\'describe "Something testable"\',\n """\n ... |
import unittest
import requests
import webtest
from main import init_app_without_routes
from modules.users.helpers import get_or_create_user
class TrottoTestCase(unittest.TestCase):
def setUp(self):
self.init_app()
# always put some data in the database since it seems like in Linux, the datastore emulat... | [
"modules.users.helpers.get_or_create_user",
"requests.post",
"webtest.TestApp",
"main.init_app_without_routes"
] | [((400, 448), 'modules.users.helpers.get_or_create_user', 'get_or_create_user', (['"""<EMAIL>"""', '"""test.trotto.dev"""'], {}), "('<EMAIL>', 'test.trotto.dev')\n", (418, 448), False, 'from modules.users.helpers import get_or_create_user\n'), ((569, 613), 'requests.post', 'requests.post', (['"""http://localhost:8082/r... |
#!/usr/bin/env python3
# --------------------( LICENSE )--------------------
# Copyright (c) 2014-2021 Beartype authors.
# See "LICENSE" for further details.
'''
Project-wide **callable tester** (i.e., callable testing various properties of
passed callables) utilities.
This private submodule... | [
"beartype._util.func.utilfunccodeobj.get_func_unwrapped_codeobj_or_none"
] | [((8699, 8739), 'beartype._util.func.utilfunccodeobj.get_func_unwrapped_codeobj_or_none', 'get_func_unwrapped_codeobj_or_none', (['func'], {}), '(func)\n', (8733, 8739), False, 'from beartype._util.func.utilfunccodeobj import get_func_unwrapped_codeobj_or_none\n'), ((10124, 10164), 'beartype._util.func.utilfunccodeobj.... |
"""
Encapsulates external dependencies to retrieve hardware metadata
"""
import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Dict, Iterable, List, Optional
from codecarbon.core.gpu import get_gpu_details
from codecarbon.core.units import Power
logger = logging.getL... | [
"logging.getLogger",
"codecarbon.core.gpu.get_gpu_details"
] | [((308, 335), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (325, 335), False, 'import logging\n'), ((943, 960), 'codecarbon.core.gpu.get_gpu_details', 'get_gpu_details', ([], {}), '()\n', (958, 960), False, 'from codecarbon.core.gpu import get_gpu_details\n'), ((1720, 1737), 'codecarbon... |
import numpy as np
import os.path
class IdentityMetadata():
def __init__(self, base, name, file):
# dataset base directory
self.base = base
# identity name
self.name = name
# image file name
self.file = file
def __repr__(self):
return self.image_path()
... | [
"numpy.array"
] | [((828, 846), 'numpy.array', 'np.array', (['metadata'], {}), '(metadata)\n', (836, 846), True, 'import numpy as np\n')] |
import asyncio
import html
import io
import logging
import re
from asyncio import TimeoutError
from base64 import b64encode
from datetime import datetime, timedelta, timezone
from random import choices
import disnake
from aiohttp import ClientTimeout
from aiohttp.client_exceptions import ClientConnectorError
from bs4 ... | [
"logging.getLogger",
"disnake.ext.commands.Cog.listener",
"disnake.ext.commands.cooldown",
"re.compile",
"random.choices",
"datetime.timedelta",
"disnake.ext.commands.is_owner",
"disnake.File",
"disnake.ext.commands.command",
"disnake.ext.tasks.loop",
"disnake.Object",
"disnake.Color.green",
... | [((632, 659), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (649, 659), False, 'import logging\n'), ((797, 868), 'disnake.ext.commands.CommandError', 'commands.CommandError', (['"""Sorry, couldn\'t find an entry similar to that."""'], {}), '("Sorry, couldn\'t find an entry similar to tha... |
"""performs procrustes analysis on the two embeddings given, calculates distance between them, returns values as a pandas dataframe. Can also return a procrustes analysis figure for you (if clade membership is given, it will be colored by that"""
import argparse
from augur.utils import read_node_data
from augur.utils i... | [
"augur.utils.write_json",
"numpy.mean",
"matplotlib.pyplot.savefig",
"argparse.ArgumentParser",
"pandas.read_csv",
"numpy.where",
"pandas.merge",
"augur.utils.read_node_data",
"seaborn.catplot",
"matplotlib.collections.LineCollection",
"numpy.sum",
"matplotlib.pyplot.subplots",
"numpy.std",
... | [((618, 643), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (641, 643), False, 'import argparse\n'), ((2148, 2179), 'pandas.read_csv', 'pd.read_csv', (['args.embeddings[0]'], {}), '(args.embeddings[0])\n', (2159, 2179), True, 'import pandas as pd\n'), ((2201, 2232), 'pandas.read_csv', 'pd.read... |
from pymoo.core.problem import Problem
from pymoo.problems.meta import MetaProblem
from pymoo.util.misc import at_least_2d_array
class ConstraintsAsPenalty(MetaProblem):
def __init__(self, problem, penalty=1e6):
super().__init__(problem)
self.penalty = penalty
# set the constraints to be... | [
"pymoo.util.misc.at_least_2d_array",
"pymoo.core.problem.Problem.calc_constraint_violation"
] | [((628, 664), 'pymoo.core.problem.Problem.calc_constraint_violation', 'Problem.calc_constraint_violation', (['G'], {}), '(G)\n', (661, 664), False, 'from pymoo.core.problem import Problem\n'), ((554, 581), 'pymoo.util.misc.at_least_2d_array', 'at_least_2d_array', (["out['F']"], {}), "(out['F'])\n", (571, 581), False, '... |
import socket # for connecting to the server
import _thread # to manage multiple clients
import json # to enconde and decode the data
host = '127.0.0.1'
port = 5000 # initiate port no above 1024
clients = {}
def server_program():
print('Starting Relay Server at ' + host + ':' + str(port)) # show in terminal
... | [
"json.loads",
"json.dumps",
"_thread.start_new_thread",
"socket.socket"
] | [((375, 390), 'socket.socket', 'socket.socket', ([], {}), '()\n', (388, 390), False, 'import socket\n'), ((1122, 1140), 'json.loads', 'json.loads', (['msgRaw'], {}), '(msgRaw)\n', (1132, 1140), False, 'import json\n'), ((679, 735), '_thread.start_new_thread', '_thread.start_new_thread', (['on_new_client', '(conn, addre... |
#
# Copyright (c) 2021 Airbyte, Inc., all rights reserved.
#
import pyarrow as pa
import pytest
from airbyte_cdk import AirbyteLogger
from source_s3.source_files_abstract.formats.abstract_file_parser import AbstractFileParser
LOGGER = AirbyteLogger()
class TestAbstractFileParserStatics:
@pytest.mark.parametrize... | [
"airbyte_cdk.AirbyteLogger",
"pyarrow.float16",
"pyarrow.timestamp",
"pyarrow.int16",
"pyarrow.utf8",
"pyarrow.uint16",
"pyarrow.int8",
"pyarrow.date32",
"pyarrow.float32",
"pyarrow.int64",
"pyarrow.float64",
"pyarrow.bool_",
"pyarrow.large_binary",
"source_s3.source_files_abstract.formats... | [((237, 252), 'airbyte_cdk.AirbyteLogger', 'AirbyteLogger', ([], {}), '()\n', (250, 252), False, 'from airbyte_cdk import AirbyteLogger\n'), ((1047, 1108), 'source_s3.source_files_abstract.formats.abstract_file_parser.AbstractFileParser.json_type_to_pyarrow_type', 'AbstractFileParser.json_type_to_pyarrow_type', (['inpu... |
# -*- coding: utf-8 -*-
# © 2004-2010 OpenERP SA
# © 2014 <NAME> <<EMAIL>>
# © 2015 <NAME> <<EMAIL>>
# © 2016 <NAME> <<EMAIL>>
# Copyright 2016-2017 LasLabs Inc.
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class AccountAnalyticContract(models.Model):
_name... | [
"odoo.fields.Many2one",
"odoo.fields.Integer",
"odoo.fields.One2many",
"odoo.fields.Selection",
"odoo.fields.Char"
] | [((456, 482), 'odoo.fields.Char', 'fields.Char', ([], {'required': '(True)'}), '(required=True)\n', (467, 482), False, 'from odoo import api, fields, models\n'), ((517, 586), 'odoo.fields.Many2one', 'fields.Many2one', ([], {'comodel_name': '"""product.pricelist"""', 'string': '"""Pricelist"""'}), "(comodel_name='produc... |
import datetime
import json
import os
import discord
from discord.errors import HTTPException
from discord.ext import commands
class Logging(commands.Cog, description="Keep a track of what members do in your server with this category."):
def __init__(self, bot):
self.bot = bot
with open("storage/... | [
"discord.ext.commands.has_permissions",
"discord.ext.commands.Cog.listener",
"datetime.datetime.utcnow",
"discord.Color.dark_red",
"discord.Color.random",
"json.dump",
"discord.Color.green",
"json.load",
"discord.Embed",
"discord.ext.commands.command",
"discord.File",
"os.remove"
] | [((425, 654), 'discord.ext.commands.command', 'commands.command', ([], {'name': '"""messagelogschannel"""', 'aliases': "['seteditedlogschannel', 'setdeletedlogschannel', 'setlogschannel',\n 'setlogchannel']", 'description': '"""Sets the channel in which edited/deleted message logs are sent."""'}), "(name='messagelog... |
"""
This file contains methods for loading the dictionary challenge.
"""
import spacy
from config import CHECKPOINT_PATH, DICTIONARY_PATH, GLOVE_PATH, GLOVE_TYPE
import os
from text.torchtext.data import Field, Dataset, Example, BucketIterator
import dill as pkl
from data.attribute_loader import _load_attributes
import... | [
"os.path.exists",
"random.shuffle",
"os.path.join",
"text.torchtext.data.Field",
"lib.bucket_iterator.DictionaryChallengeIter",
"random.seed",
"data.attribute_loader._load_attributes",
"torch.autograd.Variable",
"dill.dump",
"dill.load"
] | [((1612, 1665), 'os.path.join', 'os.path.join', (['CHECKPOINT_PATH', '"""vocab_pretrained.pkl"""'], {}), "(CHECKPOINT_PATH, 'vocab_pretrained.pkl')\n", (1624, 1665), False, 'import os\n'), ((2223, 2269), 'text.torchtext.data.Field', 'Field', ([], {'sequential': '(False)', 'include_lengths': '(False)'}), '(sequential=Fa... |
"""Provides an interface for handling user input and printing output."""
import traceback
from typing import Any, Callable, Dict, List, Optional
from teletype import codes
from teletype.components import ChoiceHelper, SelectOne
from teletype.io import style_format, style_print
from mnamer.const import SYSTEM
from mn... | [
"traceback.format_exc",
"teletype.io.style_format",
"mnamer.language.Language.all",
"teletype.components.ChoiceHelper"
] | [((3082, 3111), 'teletype.components.ChoiceHelper', 'ChoiceHelper', (['metadata', 'label'], {}), '(metadata, label)\n', (3094, 3111), False, 'from teletype.components import ChoiceHelper, SelectOne\n'), ((937, 976), 'teletype.io.style_format', 'style_format', (["chars['arrow']", '"""magenta"""'], {}), "(chars['arrow'],... |
from leasing.models import BasisOfRent, BasisOfRentDecision, BasisOfRentPropertyIdentifier, BasisOfRentRate, Index
from .base import BaseImporter
from .mappings import (
BASIS_OF_RENT_BUILD_PERMISSION_MAP, BASIS_OF_RENT_PLOT_TYPE_MAP, BASIS_OF_RENT_RATE_AREA_UNIT_MAP,
DECISION_MAKER_MAP, FINANCING_MAP, MANAGEM... | [
"leasing.models.Index.objects.get",
"cx_Oracle.connect",
"leasing.models.BasisOfRentRate.objects.get_or_create",
"leasing.models.BasisOfRentPropertyIdentifier.objects.get_or_create",
"auditlog.registry.auditlog._registry.keys",
"auditlog.registry.auditlog.unregister"
] | [((568, 693), 'cx_Oracle.connect', 'cx_Oracle.connect', ([], {'user': '"""mvj"""', 'password': '"""<PASSWORD>"""', 'dsn': '"""localhost:1521/ORCLPDB1"""', 'encoding': '"""UTF-8"""', 'nencoding': '"""UTF-8"""'}), "(user='mvj', password='<PASSWORD>', dsn=\n 'localhost:1521/ORCLPDB1', encoding='UTF-8', nencoding='UTF-8... |
import datetime
import pytest
import time_machine
from convbump.configs import UpdateConfig
from convbump.versions.calver import SHORT_YEAR_START, CalVer
UTCNOW = datetime.datetime.utcnow()
YEAR = UTCNOW.year
SHORT_YEAR = YEAR - SHORT_YEAR_START
MONTH = UTCNOW.month
DAY = UTCNOW.day
@pytest.mark.parametrize(
... | [
"convbump.versions.calver.CalVer.parse",
"time_machine.travel",
"datetime.datetime.utcnow",
"convbump.configs.UpdateConfig",
"pytest.mark.parametrize",
"convbump.versions.calver.CalVer.initial"
] | [((166, 192), 'datetime.datetime.utcnow', 'datetime.datetime.utcnow', ([], {}), '()\n', (190, 192), False, 'import datetime\n'), ((291, 456), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""schema, expected"""', "(('YY.MINOR.MICRO', f'{SHORT_YEAR}.1.0'), ('YYYY.MM.DD',\n f'{YEAR}.{MONTH}.{DAY}'), ('YYYY_... |
import os
import re
from typing import Optional
from DLBMoveMethodLoader import DLBMoveMethodLoader
from JBMoveMethodLoader import JBMoveMethodLoader
from JDeodorantMoveMethodLoader import JDeodorantMoveMethodLoader
from ProjectEvaluationResult import ProjectEvaluationResult
class JDeodorantProjectEvaluator:
goo... | [
"re.split",
"JBMoveMethodLoader.JBMoveMethodLoader.load",
"ProjectEvaluationResult.ProjectEvaluationResult",
"os.path.join",
"DLBMoveMethodLoader.DLBMoveMethodLoader.load",
"os.path.isfile",
"os.path.basename",
"re.findall",
"JDeodorantMoveMethodLoader.JDeodorantMoveMethodLoader.load"
] | [((546, 571), 're.findall', 're.findall', (['"""[&|]"""', 'tools'], {}), "('[&|]', tools)\n", (556, 571), False, 'import re\n'), ((593, 616), 're.split', 're.split', (['"""[&|]"""', 'tools'], {}), "('[&|]', tools)\n", (601, 616), False, 'import re\n'), ((640, 670), 'os.path.basename', 'os.path.basename', (['project_pat... |
__source__ = 'https://leetcode.com/problems/implement-stack-using-queues/'
# https://github.com/kamyu104/LeetCode/blob/master/Python/implement-stack-using-queues.py
# Time: push: O(n), pop: O(1), top: O(1)
# Space: O(n)
#
# Description: Leetcode # 225. Implement Stack using Queues
#
# Implement the following operations... | [
"unittest.main",
"collections.deque"
] | [((3410, 3425), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3423, 3425), False, 'import unittest\n'), ((1205, 1224), 'collections.deque', 'collections.deque', ([], {}), '()\n', (1222, 1224), False, 'import collections\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Выполнить индивидуальное задание лабораторной работы 2.11,
оформив все функции программы в виде отдельного модуля.
Разработанный модуль должен быть подключен в основную программу
с помощью одного из вариантов команды import . Номер варианта
уточнить у преподавателя.
""... | [
"zzz.func"
] | [((487, 498), 'zzz.func', 'zzz.func', (['k'], {}), '(k)\n', (495, 498), False, 'import zzz\n')] |
from sqlalchemy import Column, Integer, String
from .database import Base
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True)
username = Column(String, unique=True)
| [
"sqlalchemy.Column"
] | [((133, 166), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (139, 166), False, 'from sqlalchemy import Column, Integer, String\n'), ((182, 209), 'sqlalchemy.Column', 'Column', (['String'], {'unique': '(True)'}), '(String, unique=True)\n', (188, 209), False, 'f... |