code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
def setup_binary_path():
import sys
sys.path.append("/Users/amorris/sci/shapeworks/bin/bin")
| [
"sys.path.append"
] | [((44, 100), 'sys.path.append', 'sys.path.append', (['"""/Users/amorris/sci/shapeworks/bin/bin"""'], {}), "('/Users/amorris/sci/shapeworks/bin/bin')\n", (59, 100), False, 'import sys\n')] |
from rest_framework import serializers
DT_FMT = "%Y/%m/%d %H:%M:%S"
class LogSerial(serializers.Serializer):
file_name = serializers.CharField()
file_size = serializers.CharField()
modified_time = serializers.DateTimeField(format=DT_FMT)
preview = serializers.URLField()
archive = serializers.URLF... | [
"rest_framework.serializers.DateField",
"rest_framework.serializers.ListField",
"rest_framework.serializers.JSONField",
"rest_framework.serializers.CharField",
"rest_framework.serializers.URLField",
"rest_framework.serializers.DateTimeField"
] | [((128, 151), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (149, 151), False, 'from rest_framework import serializers\n'), ((168, 191), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {}), '()\n', (189, 191), False, 'from rest_framework import serializers\n'),... |
import pytest
from apps.jsons.serializers import JsonSerializer
@pytest.mark.parametrize(
"data",
["{}", '{"key": "value"}', '{"key": 123}', '{"key": ["val", "ue"]}', '{"key": {"a": "b"}}'],
)
def test_json_serializer_validation_ok(data):
ser = JsonSerializer(data={"data": data})
assert ser.is_valid(... | [
"pytest.mark.parametrize",
"apps.jsons.serializers.JsonSerializer"
] | [((68, 196), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data"""', '[\'{}\', \'{"key": "value"}\', \'{"key": 123}\', \'{"key": ["val", "ue"]}\',\n \'{"key": {"a": "b"}}\']'], {}), '(\'data\', [\'{}\', \'{"key": "value"}\', \'{"key": 123}\',\n \'{"key": ["val", "ue"]}\', \'{"key": {"a": "b"}}\'])\n... |
from aws_cdk import (
aws_s3 as s3,
aws_s3_deployment as s3deploy,
core
)
class S3Stack(core.Stack):
@property
def bucket(self):
return self._bucket
def __init__(self, scope: core.Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)... | [
"aws_cdk.aws_s3_deployment.Source.asset",
"aws_cdk.aws_s3.Bucket"
] | [((366, 586), 'aws_cdk.aws_s3.Bucket', 's3.Bucket', (['self', '"""AEModelingBucket"""'], {'bucket_name': 'f"""ae-modeling-bucket-{self.account}"""', 'block_public_access': 's3.BlockPublicAccess.BLOCK_ALL', 'removal_policy': 'core.RemovalPolicy.DESTROY', 'auto_delete_objects': '(True)'}), "(self, 'AEModelingBucket', buc... |
from django.shortcuts import render
from django.http import HttpResponseBadRequest, HttpResponse,JsonResponse
from libs.captcha.captcha import captcha
from django_redis import get_redis_connection
from utils.response_code import RETCODE
from random import randint
from libs.yuntongxun.sms import CCP
from django.views i... | [
"libs.yuntongxun.sms.CCP",
"django.http.HttpResponse",
"random.randint",
"django.http.HttpResponseBadRequest",
"django.http.JsonResponse",
"libs.captcha.captcha.captcha.generate_captcha",
"django.shortcuts.render",
"django_redis.get_redis_connection",
"logging.getLogger"
] | [((353, 380), 'logging.getLogger', 'logging.getLogger', (['"""django"""'], {}), "('django')\n", (370, 380), False, 'import logging\n'), ((487, 519), 'django.shortcuts.render', 'render', (['request', '"""register.html"""'], {}), "(request, 'register.html')\n", (493, 519), False, 'from django.shortcuts import render\n'),... |
import warnings
from scipy.sparse import coo_matrix,csr_matrix
import numpy as np
from .floquet import floquet
def floquet_matrix(h0,h1,q_bands,freq):
"""
user facing function to check the inputs to the function arent gunna fuck shit up.
Parameters
==========
h0: matrix
must be square... | [
"scipy.sparse.csr_matrix"
] | [((1195, 1209), 'scipy.sparse.csr_matrix', 'csr_matrix', (['h1'], {}), '(h1)\n', (1205, 1209), False, 'from scipy.sparse import coo_matrix, csr_matrix\n'), ((930, 944), 'scipy.sparse.csr_matrix', 'csr_matrix', (['h0'], {}), '(h0)\n', (940, 944), False, 'from scipy.sparse import coo_matrix, csr_matrix\n')] |
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'recipi.settings')
import django
django.setup()
import nltk
from nltk.classify import MaxentClassifier
from nltk.tag import pos_tag, map_tag
from nltk.corpus import stopwords as corpus_stopwords
from nltk.stem.snowball import EnglishStemmer
from textblob impo... | [
"nltk.tag.map_tag",
"os.environ.setdefault",
"django.setup",
"nltk.pos_tag",
"nltk.sent_tokenize",
"nltk.stem.snowball.EnglishStemmer",
"nltk.classify.MaxentClassifier.train",
"textblob.TextBlob",
"nltk.corpus.stopwords.words",
"nltk.trigrams",
"nltk.word_tokenize"
] | [((11, 77), 'os.environ.setdefault', 'os.environ.setdefault', (['"""DJANGO_SETTINGS_MODULE"""', '"""recipi.settings"""'], {}), "('DJANGO_SETTINGS_MODULE', 'recipi.settings')\n", (32, 77), False, 'import os\n'), ((93, 107), 'django.setup', 'django.setup', ([], {}), '()\n', (105, 107), False, 'import django\n'), ((948, 9... |
#-*- coding:utf-8; mode:python; indent-tabs-mode: nil; c-basic-offset: 2; tab-width: 2 -*-
import os.path as path, os
class which(object):
'Find executables in the system just like unix which.'
@classmethod
def _is_executable(clazz, p):
'Return True if the path is executable.'
return path.exists(p) and... | [
"os.path.isabs",
"os.path.exists",
"os.path.split",
"os.path.join",
"os.access"
] | [((661, 680), 'os.path.split', 'path.split', (['program'], {}), '(program)\n', (671, 680), True, 'import os.path as path, os\n'), ((302, 316), 'os.path.exists', 'path.exists', (['p'], {}), '(p)\n', (313, 316), True, 'import os.path as path, os\n'), ((321, 342), 'os.access', 'os.access', (['p', 'os.X_OK'], {}), '(p, os.... |
#
# Copyright (c) 2015 Juniper Networks, Inc. All rights reserved.
#
import unittest
import tempfile
import sys, os
class BroadviewTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
pass
#if (os.getenv('LD_LIBRARY_PATH', '').find('build/lib') < 0):
# if (os.getenv('DYLD_LIBR... | [
"unittest.main"
] | [((773, 803), 'unittest.main', 'unittest.main', ([], {'catchbreak': '(True)'}), '(catchbreak=True)\n', (786, 803), False, 'import unittest\n')] |
from fabric.contrib.files import append,exists,sed
from fabric.api import env, local, run, sudo
import random
REPO_URL = "https://github.com/mdclark01/CryptoMessage.git"
env.key_filename = "~/.ssh/capstoneekey"
env.host = ['172.16.31.10']
env.user = 'colan'
env.use_ssh_config = True
def deploy():
site_folder = '/hom... | [
"fabric.contrib.files.exists",
"fabric.api.sudo",
"fabric.api.local",
"fabric.contrib.files.sed",
"fabric.api.run"
] | [((869, 900), 'fabric.contrib.files.exists', 'exists', (["(source_folder + '/.git')"], {}), "(source_folder + '/.git')\n", (875, 900), False, 'from fabric.contrib.files import append, exists, sed\n'), ((1025, 1072), 'fabric.api.local', 'local', (['"""git log -n 1 --format=%H"""'], {'capture': '(True)'}), "('git log -n ... |
#!/usr/bin/env python
from __future__ import print_function
from argparse import ArgumentParser
import json
import os
import sys
try:
import requests
except ImportError:
print('Please install Requests (http://python-requests.org).')
raise
def travis_request(endpoint, method='get', post_data=None, travis_... | [
"requests.request",
"argparse.ArgumentParser",
"sys.exit",
"json.loads"
] | [((604, 668), 'requests.request', 'requests.request', (['method', 'url'], {'params': 'post_data', 'headers': 'headers'}), '(method, url, params=post_data, headers=headers)\n', (620, 668), False, 'import requests\n'), ((2752, 2934), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""Restart the latest... |
import os
import tweepy as tw
import pandas as pd
import api_keys
consumer_key = api_keys.consumer_key
consumer_secret = api_keys.consumer_secret
access_token = api_keys.access_token
access_token_secret= api_keys.access_token_secret
auth = tw.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_to... | [
"pandas.DataFrame",
"tweepy.OAuthHandler",
"tweepy.Cursor",
"tweepy.API"
] | [((242, 288), 'tweepy.OAuthHandler', 'tw.OAuthHandler', (['consumer_key', 'consumer_secret'], {}), '(consumer_key, consumer_secret)\n', (257, 288), True, 'import tweepy as tw\n'), ((352, 389), 'tweepy.API', 'tw.API', (['auth'], {'wait_on_rate_limit': '(True)'}), '(auth, wait_on_rate_limit=True)\n', (358, 389), True, 'i... |
import os
import shlex
from serpens import parameters
from serpens import secrets
def get(key, default=None):
result = os.getenv(key, default)
if result is None:
raise NameError(f"Environment var '{key}' is not defined")
if result.startswith("parameters://"):
tmp = result.split("://")[1... | [
"os.path.isfile",
"shlex.shlex",
"serpens.secrets.get",
"os.getenv",
"serpens.parameters.get"
] | [((126, 149), 'os.getenv', 'os.getenv', (['key', 'default'], {}), '(key, default)\n', (135, 149), False, 'import os\n'), ((337, 356), 'serpens.parameters.get', 'parameters.get', (['tmp'], {}), '(tmp)\n', (351, 356), False, 'from serpens import parameters\n'), ((544, 580), 'serpens.secrets.get', 'secrets.get', (['secret... |
import time
import epics
import pvnames
import random
import numpy
import sys
driver = epics.PV(pvnames.subarr_driver)
sub1 = epics.PV(pvnames.subarr1)
sub2 = epics.PV(pvnames.subarr2)
sub3 = epics.PV(pvnames.subarr3)
sub4 = epics.PV(pvnames.subarr4)
s1_0 = int(epics.caget("%s.INDX" % pvnames.subarr1))
s2_0 ... | [
"sys.stdout.write",
"epics.PV",
"time.sleep",
"random.random",
"epics.caget",
"sys.exit"
] | [((87, 118), 'epics.PV', 'epics.PV', (['pvnames.subarr_driver'], {}), '(pvnames.subarr_driver)\n', (95, 118), False, 'import epics\n'), ((128, 153), 'epics.PV', 'epics.PV', (['pvnames.subarr1'], {}), '(pvnames.subarr1)\n', (136, 153), False, 'import epics\n'), ((163, 188), 'epics.PV', 'epics.PV', (['pvnames.subarr2'], ... |
'''
This function compares the experimental FRFs of each structure with the simulated FRFs of their respective numerical models.
'''
from flask import render_template
from dtApp import app
from dtApp import date
import plotly
import plotly.graph_objs as go
from plotly.subplots import make_subplots
import pandas as pd
i... | [
"plotly.subplots.make_subplots",
"json.dumps",
"flask.render_template",
"dtApp.app.route"
] | [((561, 583), 'dtApp.app.route', 'app.route', (['"""/crossval"""'], {}), "('/crossval')\n", (570, 583), False, 'from dtApp import app\n'), ((714, 738), 'dtApp.app.route', 'app.route', (['"""/crossval_1"""'], {}), "('/crossval_1')\n", (723, 738), False, 'from dtApp import app\n'), ((3517, 3541), 'dtApp.app.route', 'app.... |
from src.interfaces.abstract_collector import AbstractCollector, HitInfo, HTTPInfo
from dataclasses import dataclass
from typing import List, Dict
from time import time
@dataclass(frozen=True)
class TrafficInfo:
"""
Used only internally to this module.
"""
timestamp: float
traffic_len: int
class... | [
"src.interfaces.abstract_collector.HitInfo",
"dataclasses.dataclass",
"time.time"
] | [((172, 194), 'dataclasses.dataclass', 'dataclass', ([], {'frozen': '(True)'}), '(frozen=True)\n', (181, 194), False, 'from dataclasses import dataclass\n'), ((1911, 1917), 'time.time', 'time', ([], {}), '()\n', (1915, 1917), False, 'from time import time\n'), ((2309, 2315), 'time.time', 'time', ([], {}), '()\n', (2313... |
#!/usr/bin/python3 -m unittest
#
# testing transient memory (needs modified Numpy)
#
import unittest
import pymm
import numpy as np
import torch
import gc
def colored(r, g, b, text):
return "\033[38;2;{};{};{}m{} \033[38;2;255;255;255m".format(r, g, b, text)
def log(*args):
print(colored(0,255,255,*args))
sh... | [
"unittest.main",
"gc.collect",
"pymm.shelf",
"pymm.bytes"
] | [((326, 401), 'pymm.shelf', 'pymm.shelf', (['"""myShelf"""'], {'size_mb': '(1024)', 'pmem_path': '"""/mnt/pmem0"""', 'force_new': '(True)'}), "('myShelf', size_mb=1024, pmem_path='/mnt/pmem0', force_new=True)\n", (336, 401), False, 'import pymm\n'), ((2121, 2136), 'unittest.main', 'unittest.main', ([], {}), '()\n', (21... |
# import the following dependencies
import threading
from kafka import KafkaConsumer, KafkaProducer
from web3 import Web3
import asyncio
import os, yaml, json, time
import logging
from .discord_client import send_message_to_discord
def web3_setup(contracts_yaml_, infura_url_):
# add your blockchain connection info... | [
"threading._active.items",
"threading.Thread.__init__",
"threading.Thread.join",
"asyncio.get_event_loop",
"json.loads",
"web3.Web3.HTTPProvider",
"asyncio.set_event_loop",
"time.sleep",
"os.environ.get",
"logging.info",
"web3.Web3.toChecksumAddress",
"web3.Web3.toJSON",
"asyncio.new_event_l... | [((1819, 1837), 'web3.Web3.toJSON', 'Web3.toJSON', (['event'], {}), '(event)\n', (1830, 1837), False, 'from web3 import Web3\n'), ((6078, 6118), 'logging.info', 'logging.info', (['"""Thread: starting thread"""'], {}), "('Thread: starting thread')\n", (6090, 6118), False, 'import logging\n'), ((373, 402), 'web3.Web3.H... |
import torch
import torch.nn as nn
class GlobalAttention(nn.Module):
def __init__(self, dim, out_dim=None):
super(GlobalAttention, self).__init__()
if out_dim is None:
self.linear_in = nn.Linear(dim, dim, bias=False)
else:
self.linear_in = nn.Linear(dim, out_dim, bia... | [
"torch.bmm",
"torch.nn.Softmax",
"torch.nn.Linear"
] | [((347, 359), 'torch.nn.Softmax', 'nn.Softmax', ([], {}), '()\n', (357, 359), True, 'import torch.nn as nn\n'), ((218, 249), 'torch.nn.Linear', 'nn.Linear', (['dim', 'dim'], {'bias': '(False)'}), '(dim, dim, bias=False)\n', (227, 249), True, 'import torch.nn as nn\n'), ((293, 328), 'torch.nn.Linear', 'nn.Linear', (['di... |
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
import grpc
from . import kvstore_pb2 as kvstore__pb2
class KVStoreStub(object):
"""kvstore.KVStore Key-Value键值存储服务
"""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"... | [
"grpc.method_handlers_generic_handler",
"grpc.unary_stream_rpc_method_handler",
"grpc.unary_unary_rpc_method_handler",
"grpc.experimental.unary_stream",
"grpc.experimental.unary_unary"
] | [((4642, 4718), 'grpc.method_handlers_generic_handler', 'grpc.method_handlers_generic_handler', (['"""kvstore.KVStore"""', 'rpc_method_handlers'], {}), "('kvstore.KVStore', rpc_method_handlers)\n", (4678, 4718), False, 'import grpc\n'), ((3218, 3398), 'grpc.unary_unary_rpc_method_handler', 'grpc.unary_unary_rpc_method_... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from django.conf.urls import url
from . import views
from django.contrib.auth.views import login, logout
urlpatterns = [
url(r'^$', views.HomeView.as_view(), name='home'),
url(r'^(?P<pk>[0-9]+)/$', views.article_detail, name='full'),
url(r'^login/$', login, {... | [
"django.conf.urls.url"
] | [((229, 288), 'django.conf.urls.url', 'url', (['"""^(?P<pk>[0-9]+)/$"""', 'views.article_detail'], {'name': '"""full"""'}), "('^(?P<pk>[0-9]+)/$', views.article_detail, name='full')\n", (232, 288), False, 'from django.conf.urls import url\n'), ((295, 369), 'django.conf.urls.url', 'url', (['"""^login/$"""', 'login', "{'... |
import unittest
from aoc2019_03 import case01
class Case01(unittest.TestCase):
def test_example(self):
result = case01.main(
"R8,U5,L5,D3",
"U7,R6,D4,L4"
)
self.assertEqual(6, result)
def test_sample01(self):
result = case01.main(
"R75,D30,R... | [
"unittest.main",
"aoc2019_03.case01.main"
] | [((694, 709), 'unittest.main', 'unittest.main', ([], {}), '()\n', (707, 709), False, 'import unittest\n'), ((125, 166), 'aoc2019_03.case01.main', 'case01.main', (['"""R8,U5,L5,D3"""', '"""U7,R6,D4,L4"""'], {}), "('R8,U5,L5,D3', 'U7,R6,D4,L4')\n", (136, 166), False, 'from aoc2019_03 import case01\n'), ((285, 373), 'aoc2... |
""" EfficientNet (Flax Linen) Model and Factory
Hacked together by / Copyright 2020 <NAME> (https://github.com/rwightman)
"""
import re
from typing import Any, Callable, Sequence, Dict
from functools import partial
from flax import linen as nn
import flax.linen.initializers as initializers
import jax
import jax.numpy... | [
"functools.partial",
"jeffnet.common.get_model_cfg",
"jax.random.PRNGKey",
"jeffnet.common.round_features",
"jax.numpy.ones",
"jax.random.split",
"re.compile"
] | [((635, 699), 'functools.partial', 'partial', (['initializers.variance_scaling', '(2.0)', '"""fan_out"""', '"""normal"""'], {}), "(initializers.variance_scaling, 2.0, 'fan_out', 'normal')\n", (642, 699), False, 'from functools import partial\n'), ((717, 786), 'functools.partial', 'partial', (['initializers.variance_sca... |
"""Module which handles the clarifai api and checks
the image for invalid content"""
from clarifai.client import ClarifaiApi
def check_image(browser, clarifai_id, clarifai_secret, img_tags):
"""Uses the link to the image to check for invalid content
in the image"""
clarifai_api = ClarifaiApi(clarifai_id, clarifa... | [
"clarifai.client.ClarifaiApi"
] | [((288, 329), 'clarifai.client.ClarifaiApi', 'ClarifaiApi', (['clarifai_id', 'clarifai_secret'], {}), '(clarifai_id, clarifai_secret)\n', (299, 329), False, 'from clarifai.client import ClarifaiApi\n')] |
# coding: utf-8
import typing
from rolling.exception import UnknownStuffError
if typing.TYPE_CHECKING:
from rolling.kernel import Kernel
from rolling.model.stuff import StuffProperties
class StuffManager:
def __init__(self, kernel: "Kernel", items: typing.List["StuffProperties"]) -> None:
self._... | [
"rolling.exception.UnknownStuffError"
] | [((704, 752), 'rolling.exception.UnknownStuffError', 'UnknownStuffError', (['f"""Unknown stuff "{stuff_id}\\""""'], {}), '(f\'Unknown stuff "{stuff_id}"\')\n', (721, 752), False, 'from rolling.exception import UnknownStuffError\n')] |
import argparse
import os
import re
import string
import time
import inflect
import sounddevice as sd
from pytube import YouTube as PyTube
from utils import color_print as cp
from utils import util, CsvWriter, YoutubeCrawler
from url_fetcher import FileReader, YoutubeSearcher
SAMPLE_RATE = 16000
def main():
par... | [
"inflect.engine",
"utils.color_print.print_instruction",
"sounddevice.stop",
"url_fetcher.FileReader",
"utils.YoutubeCrawler",
"argparse.ArgumentParser",
"url_fetcher.YoutubeSearcher",
"os.path.exists",
"utils.color_print.print_error",
"utils.util.get_youtube_url",
"time.sleep",
"utils.color_p... | [((326, 351), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (349, 351), False, 'import argparse\n'), ((1668, 1709), 'utils.color_print.print_progress', 'cp.print_progress', (['"""keyword is """', 'keyword'], {}), "('keyword is ', keyword)\n", (1685, 1709), True, 'from utils import color_print ... |
import uuid
from django.db import models
from .course import Course
from .learner import LearnerProfile
class Cart(models.Model):
id = models.UUIDField(unique=True, primary_key=True, default=uuid.uuid4, editable=False)
course_id = models.ForeignKey(Course, blank=False, on_delete=models.CASCADE, related_name=... | [
"django.db.models.ForeignKey",
"django.db.models.UUIDField",
"django.db.models.DateTimeField"
] | [((142, 229), 'django.db.models.UUIDField', 'models.UUIDField', ([], {'unique': '(True)', 'primary_key': '(True)', 'default': 'uuid.uuid4', 'editable': '(False)'}), '(unique=True, primary_key=True, default=uuid.uuid4,\n editable=False)\n', (158, 229), False, 'from django.db import models\n'), ((242, 333), 'django.db... |
import threading
import numpy as np
from baselines.common.segment_tree import SumSegmentTree, MinSegmentTree
import math
from scipy.stats import rankdata
import json
class ReplayBuffer:
def __init__(self, buffer_shapes, size_in_transitions, T, sample_transitions):
"""Creates a replay buffer.
Args:... | [
"numpy.sum",
"numpy.empty",
"numpy.einsum",
"threading.Lock",
"numpy.random.randint",
"numpy.arange",
"numpy.array",
"numpy.exp",
"numpy.linalg.norm",
"numpy.linalg.det",
"numpy.concatenate"
] | [((1158, 1174), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (1172, 1174), False, 'import threading\n'), ((4693, 4717), 'numpy.empty', 'np.empty', (['[self.size, 1]'], {}), '([self.size, 1])\n', (4701, 4717), True, 'import numpy as np\n'), ((5077, 5093), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (5... |
from ics_demo.dao.interfaces import base
from ics_demo.dao.orm.vsan import VsanStore
from ics_demo.helpers import uuidgen
def get_all():
return base.class_get_all_to_dict(VsanStore)
def get_one(uuid):
return base.class_get_one_by_uuid_to_dict(VsanStore, uuid)
def get_obj(uuid):
return ... | [
"ics_demo.dao.interfaces.base.class_get_one_by_uuid_to_dict",
"ics_demo.dao.interfaces.base.class_get_one_by_ID_to_obj",
"ics_demo.dao.interfaces.base.class_get_one_by_uuid_to_obj",
"ics_demo.dao.interfaces.base.class_get_keys",
"ics_demo.helpers.uuidgen",
"ics_demo.dao.interfaces.base.class_get_all_to_di... | [((158, 195), 'ics_demo.dao.interfaces.base.class_get_all_to_dict', 'base.class_get_all_to_dict', (['VsanStore'], {}), '(VsanStore)\n', (184, 195), False, 'from ics_demo.dao.interfaces import base\n'), ((232, 283), 'ics_demo.dao.interfaces.base.class_get_one_by_uuid_to_dict', 'base.class_get_one_by_uuid_to_dict', (['Vs... |
from setuptools import setup, find_packages
import os
rootDir = os.path.abspath(os.path.dirname(__file__))
reqPath = os.path.join(rootDir, 'requirements.txt')
readmePath = os.path.join(rootDir, 'README.md')
dir_1 = os.path.join(rootDir, 'mapel')
with open(reqPath) as f:
required = f.read().splitlines()
with... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((119, 160), 'os.path.join', 'os.path.join', (['rootDir', '"""requirements.txt"""'], {}), "(rootDir, 'requirements.txt')\n", (131, 160), False, 'import os\n'), ((174, 208), 'os.path.join', 'os.path.join', (['rootDir', '"""README.md"""'], {}), "(rootDir, 'README.md')\n", (186, 208), False, 'import os\n'), ((217, 247), ... |
#!/usr/bin/env python3
from pathlib import Path
from binascii import crc32
from io import StringIO, BytesIO
from argparse import ArgumentParser
BUFF_SIZE = 2048
def checksum(data: (bytes, bytearray)) -> int:
cksm = 0
with BytesIO(data) as bio:
while b := bio.read(BUFF_SIZE):
cksm = crc32(b, cksm)
return cksm... | [
"io.BytesIO",
"io.StringIO",
"argparse.ArgumentParser",
"pathlib.Path",
"binascii.crc32"
] | [((352, 428), 'argparse.ArgumentParser', 'ArgumentParser', ([], {'description': '"""A script to generate build configs for XeBuild"""'}), "(description='A script to generate build configs for XeBuild')\n", (366, 428), False, 'from argparse import ArgumentParser\n'), ((564, 574), 'pathlib.Path', 'Path', (['"""./"""'], {... |
import functools
import unittest
import requests
from mailgun.api import MailgunApi
from mailgun.domain import Domain
from mailgun.mailing_list import MailingList
class MailgunApiTestCase(unittest.TestCase):
def test_init(self):
api = MailgunApi()
self.assertIsNone(api.api_key)
self.asse... | [
"mailgun.api.MailgunApi"
] | [((251, 263), 'mailgun.api.MailgunApi', 'MailgunApi', ([], {}), '()\n', (261, 263), False, 'from mailgun.api import MailgunApi\n'), ((521, 533), 'mailgun.api.MailgunApi', 'MailgunApi', ([], {}), '()\n', (531, 533), False, 'from mailgun.api import MailgunApi\n'), ((825, 837), 'mailgun.api.MailgunApi', 'MailgunApi', ([],... |
from setuptools import setup
setup(name='nighttimeParenting',
version='1.0',
description='Infrastructure Layer for Project',
author=['<NAME>', '<NAME>', '<NAME>'],
author_email='<EMAIL>',
url='<EMAIL>:computer-lov/Nighttime-Parenting-Device.git',
install_requires=['spidev','pygame'... | [
"setuptools.setup"
] | [((30, 425), 'setuptools.setup', 'setup', ([], {'name': '"""nighttimeParenting"""', 'version': '"""1.0"""', 'description': '"""Infrastructure Layer for Project"""', 'author': "['<NAME>', '<NAME>', '<NAME>']", 'author_email': '"""<EMAIL>"""', 'url': '"""<EMAIL>:computer-lov/Nighttime-Parenting-Device.git"""', 'install_r... |
from new_scores import ao5_calc
def test_all_five_times_with_default_event_1():
times = {
"e1t1": 19.34,
"e1t2": 18.20,
"e1t3": 21.49,
"e1t4": 20.01,
"e1t5": 17.78
}
assert ao5_calc(times) == 19.18
def test_all_five_times_with_specified_event():
times = {
... | [
"new_scores.ao5_calc"
] | [((227, 242), 'new_scores.ao5_calc', 'ao5_calc', (['times'], {}), '(times)\n', (235, 242), False, 'from new_scores import ao5_calc\n'), ((447, 471), 'new_scores.ao5_calc', 'ao5_calc', (['times'], {'event': '(3)'}), '(times, event=3)\n', (455, 471), False, 'from new_scores import ao5_calc\n'), ((648, 672), 'new_scores.a... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib
import mlpredict
gpu = 'V100'
opt = 'SGD'
MLP = mlpredict.import_tools.import_dnn('MLP')
MLP.describe()
batchsize = 2**np.arange(0,10,1)
time_layer = np.zeros([2,10])
time_total = np.zeros(10)
for i in range(len(batchsize)):
time_total[i], ... | [
"matplotlib.pyplot.tight_layout",
"matplotlib.rc",
"matplotlib.pyplot.show",
"matplotlib.pyplot.legend",
"numpy.zeros",
"matplotlib.ticker.ScalarFormatter",
"numpy.arange",
"matplotlib.pyplot.NullFormatter",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.subplots",
... | [((121, 161), 'mlpredict.import_tools.import_dnn', 'mlpredict.import_tools.import_dnn', (['"""MLP"""'], {}), "('MLP')\n", (154, 161), False, 'import mlpredict\n'), ((225, 242), 'numpy.zeros', 'np.zeros', (['[2, 10]'], {}), '([2, 10])\n', (233, 242), True, 'import numpy as np\n'), ((255, 267), 'numpy.zeros', 'np.zeros',... |
import atexit
import time
import yaml
import copy
import argparse
from pathlib import Path
from dataclasses import dataclass
from typing import Dict, List, Tuple
from pydantic import ValidationError
import helper
from logger import logger
from steps import StepItems
class InvalidYAMLSyntax(SyntaxError):
""" Exce... | [
"atexit.register",
"copy.deepcopy",
"argparse.ArgumentParser",
"time.sleep",
"logger.logger.info",
"pathlib.Path",
"logger.logger.error",
"yaml.safe_load"
] | [((4181, 4219), 'atexit.register', 'atexit.register', (['helper.terminate_test'], {}), '(helper.terminate_test)\n', (4196, 4219), False, 'import atexit\n'), ((4233, 4258), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (4256, 4258), False, 'import argparse\n'), ((899, 924), 'copy.deepcopy', 'co... |
import cv2
import time
import numpy as np
from grabscreen import grab_screen
from directkeys import PressKey, ReleaseKey
from directkeys import W, A, D
from countdown import CountDown
'''
Most of the code in this script was taken from Sentdex's Python plays GTA-V
'''
def roi(img, vertices):
mask = np.zeros_like(... | [
"cv2.GaussianBlur",
"cv2.bitwise_and",
"cv2.fillPoly",
"numpy.mean",
"cv2.HoughLinesP",
"cv2.line",
"numpy.zeros_like",
"cv2.cvtColor",
"directkeys.ReleaseKey",
"directkeys.PressKey",
"cv2.destroyAllWindows",
"cv2.Canny",
"numpy.median",
"cv2.waitKey",
"countdown.CountDown",
"time.slee... | [((306, 324), 'numpy.zeros_like', 'np.zeros_like', (['img'], {}), '(img)\n', (319, 324), True, 'import numpy as np\n'), ((329, 362), 'cv2.fillPoly', 'cv2.fillPoly', (['mask', 'vertices', '(255)'], {}), '(mask, vertices, 255)\n', (341, 362), False, 'import cv2\n'), ((376, 402), 'cv2.bitwise_and', 'cv2.bitwise_and', (['i... |
# Generated by Django 2.2.2 on 2019-06-19 06:06
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='book',
name='book_author',
fie... | [
"django.db.models.CharField"
] | [((323, 391), 'django.db.models.CharField', 'models.CharField', ([], {'help_text': '"""Book Author"""', 'max_length': '(100)', 'null': '(True)'}), "(help_text='Book Author', max_length=100, null=True)\n", (339, 391), False, 'from django.db import migrations, models\n'), ((509, 575), 'django.db.models.CharField', 'model... |
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 23 16:29:44 2018
NOTE THIS REACTOR IS NOT CLOSE TO BEING FULLY COMPLETED, ALL IT CAN DO IS REACT TWO META ATOMS TOGETHER
This class defines the metaReactor, this reactor is used to bond metaatoms to generate metarings. To do this a soup of metaatoms
is generated and... | [
"random.randint",
"random.shuffle",
"metaAtomGenerator_v2.atomGenerator",
"pickle.load",
"metaBondingProtocol_v2.bondMetaAtoms",
"MetaMolecule_v1.MetaMolecule"
] | [((3437, 3466), 'MetaMolecule_v1.MetaMolecule', 'MetaMolecule.MetaMolecule', (['(20)'], {}), '(20)\n', (3462, 3466), True, 'import MetaMolecule_v1 as MetaMolecule\n'), ((3516, 3564), 'metaBondingProtocol_v2.bondMetaAtoms', 'mBP.bondMetaAtoms', (['metaAtom1', 'metaAtom2', 'metaMol'], {}), '(metaAtom1, metaAtom2, metaMol... |
# -*- coding: utf-8 -*-
import urllib
import csv
import json
import scrapy
from scrapy.utils.project import get_project_settings
from scrapy.exceptions import CloseSpider
from dominic.items import DominicItem
settings = get_project_settings()
class ImagesSpider(scrapy.Spider):
name = "images"
allowed_dom... | [
"scrapy.exceptions.CloseSpider",
"json.loads",
"dominic.items.DominicItem",
"csv.DictReader",
"scrapy.utils.project.get_project_settings"
] | [((224, 246), 'scrapy.utils.project.get_project_settings', 'get_project_settings', ([], {}), '()\n', (244, 246), False, 'from scrapy.utils.project import get_project_settings\n'), ((1866, 1891), 'json.loads', 'json.loads', (['response.body'], {}), '(response.body)\n', (1876, 1891), False, 'import json\n'), ((1985, 1998... |
import os
from shutil import copyfile, rmtree, copytree
import pandas as pd
import matplotlib.pyplot as plt
import json
from collections import Counter
home_dir = os.getcwd()
mapilary_dir = home_dir+'/mapilary'
new_mapilary_dir = home_dir+'/organized_mapilary_dataset'
new_fully_mapilary_dir = new_mapilary_dir+'/fully'... | [
"os.mkdir",
"json.load",
"shutil.copytree",
"pandas.DataFrame.from_dict",
"shutil.rmtree",
"os.getcwd",
"shutil.copyfile",
"collections.Counter",
"os.listdir"
] | [((164, 175), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (173, 175), False, 'import os\n'), ((816, 842), 'os.mkdir', 'os.mkdir', (['new_mapilary_dir'], {}), '(new_mapilary_dir)\n', (824, 842), False, 'import os\n'), ((1498, 1568), 'shutil.copytree', 'copytree', (['fully_annotated_dir', "(new_fully_mapilary_dir + '/ann... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 21 10:52:40 2019
@author: guido
"""
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 21 10:30:25 2018
@author: guido
"""
import os
import pandas as pd
import numpy as np
from oneibl.one import ONE
from define_paths import ana... | [
"matplotlib.pyplot.title",
"os.mkdir",
"numpy.abs",
"matplotlib.pyplot.figure",
"numpy.exp",
"os.path.join",
"numpy.unique",
"matplotlib.pyplot.xlabel",
"pandas.DataFrame",
"matplotlib.pyplot.close",
"os.path.exists",
"oneibl.one.ONE",
"scipy.optimize.curve_fit",
"matplotlib.pyplot.ylabel"... | [((635, 640), 'oneibl.one.ONE', 'ONE', ([], {}), '()\n', (638, 640), False, 'from oneibl.one import ONE\n'), ((1096, 1111), 'define_paths.analysis_path', 'analysis_path', ([], {}), '()\n', (1109, 1111), False, 'from define_paths import analysis_path\n'), ((1218, 1296), 'pandas.DataFrame', 'pd.DataFrame', ([], {'columns... |
__author__ = "<NAME>"
# University of South Carolina
# <NAME>-Simpers group
# Starting Date: June, 2016
import matplotlib.pyplot as plt
import numpy as np
from scripts import ternary
def plt_ternary_save(data, tertitle='', labelNames=('Species A','Species B','Species C'), scale=100,
sv=False... | [
"scripts.ternary.figure",
"matplotlib.pyplot.axis",
"matplotlib.pyplot.subplots",
"numpy.array",
"matplotlib.pyplot.tight_layout"
] | [((2008, 2037), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {'figsize': 'figsize'}), '(figsize=figsize)\n', (2020, 2037), True, 'import matplotlib.pyplot as plt\n'), ((2108, 2142), 'scripts.ternary.figure', 'ternary.figure', ([], {'ax': 'ax', 'scale': 'scale'}), '(ax=ax, scale=scale)\n', (2122, 2142), False, 'fr... |
from src.detect import detect
from src.detect import detect_close_tweets
from src.detect import detect_tweets
from src.collection.collect import get_replies
from src.collection.twitter.connection import twitter_setup
class TestDetect:
def detect_test(self):
text = "Fuck you, cunt!"
assert detect(te... | [
"src.detect.detect_close_tweets",
"src.detect.detect"
] | [((547, 572), 'src.detect.detect_close_tweets', 'detect_close_tweets', (['text'], {}), '(text)\n', (566, 572), False, 'from src.detect import detect_close_tweets\n'), ((311, 323), 'src.detect.detect', 'detect', (['text'], {}), '(text)\n', (317, 323), False, 'from src.detect import detect\n'), ((398, 410), 'src.detect.d... |
# -*- coding: utf-8 -*-
from openerp import tools
from openerp import models,fields,api
from openerp.tools.translate import _
class is_product_packaging(models.Model):
_name='is.product.packaging'
_order='product_tmpl_id,sequence,id'
_auto = False
product_tmpl_id = fields.Many2one('pr... | [
"openerp.tools.drop_view_if_exists",
"openerp.fields.Many2one",
"openerp.fields.Integer",
"openerp.fields.Float",
"openerp.fields.Char"
] | [((301, 347), 'openerp.fields.Many2one', 'fields.Many2one', (['"""product.template"""', '"""Article"""'], {}), "('product.template', 'Article')\n", (316, 347), False, 'from openerp import models, fields, api\n'), ((374, 422), 'openerp.fields.Many2one', 'fields.Many2one', (['"""is.product.segment"""', '"""Segment"""'], ... |
import os
from MCSolver import lifted_multicut_workflow
from MetaSet import MetaSet
from ExperimentSettings import ExperimentSettings
import vigra
from init_exp import meta
def snemi3d_lmc(ds_train_str, ds_test_str,
seg_id_train, seg_id_test,
local_feats_list, lifted_feats_list, mc_params, gamma = ... | [
"ExperimentSettings.ExperimentSettings",
"vigra.writeHDF5",
"init_exp.meta.load",
"init_exp.meta.get_dataset",
"os.path.join",
"MCSolver.lifted_multicut_workflow"
] | [((330, 341), 'init_exp.meta.load', 'meta.load', ([], {}), '()\n', (339, 341), False, 'from init_exp import meta\n'), ((358, 388), 'init_exp.meta.get_dataset', 'meta.get_dataset', (['ds_train_str'], {}), '(ds_train_str)\n', (374, 388), False, 'from init_exp import meta\n'), ((403, 432), 'init_exp.meta.get_dataset', 'me... |
from django import forms
from django.core import validators
from django.db.models import fields
from django.forms.widgets import Widget
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import Image, Comment, Profile
class RegistrationForm(UserCreationForm... | [
"django.forms.TextInput",
"django.forms.FileInput",
"django.forms.PasswordInput",
"django.forms.Textarea"
] | [((501, 611), 'django.forms.TextInput', 'forms.TextInput', ([], {'attrs': "{'class': 'form-control names', 'placeholder': 'First Name', 'label':\n 'First Name'}"}), "(attrs={'class': 'form-control names', 'placeholder':\n 'First Name', 'label': 'First Name'})\n", (516, 611), False, 'from django import forms\n'), ... |
'''
Antares Python v1.0.0
Available functions:
setAccessKey()
getAccessKey()
get()
getAll()
getAllId()
getDevices()
getSpecific()
send()
'''
import requests
import json
_antaresAccessKey = ''
_debug = False
def getDebug():
global _debug;
return _debug;
def setDebug(debugStatus):
global _debug
_... | [
"requests.post",
"json.loads",
"requests.get",
"json.dumps"
] | [((1056, 1090), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (1068, 1090), False, 'import requests\n'), ((2056, 2090), 'requests.get', 'requests.get', (['url'], {'headers': 'headers'}), '(url, headers=headers)\n', (2068, 2090), False, 'import requests\n'), ((2990, 3024)... |
from rest_framework import serializers
from .models import ParcelDelivery
class ParcelDeliverySerializer(serializers.ModelSerializer):
pickup_location = serializers.CharField(
required=True, error_messages={"required": "Pickup location is required"}
)
destination = serializers.CharField(
... | [
"rest_framework.serializers.CharField",
"rest_framework.serializers.IntegerField"
] | [((160, 260), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'required': '(True)', 'error_messages': "{'required': 'Pickup location is required'}"}), "(required=True, error_messages={'required':\n 'Pickup location is required'})\n", (181, 260), False, 'from rest_framework import serializers\n... |
import requests
import json
import pandas as pd
import numpy as np
import sys
import logging
from pathlib import Path
logging.basicConfig(filename='logging_for_adding_group_permissions.log',level=logging.INFO)
"""
This python script is used to add group permissions based on the group_permissions_input file.
python3 ad... | [
"logging.basicConfig",
"pandas.read_csv",
"json.dumps",
"numpy.shape",
"logging.info",
"pathlib.Path",
"requests.get",
"requests.post"
] | [((118, 214), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': '"""logging_for_adding_group_permissions.log"""', 'level': 'logging.INFO'}), "(filename='logging_for_adding_group_permissions.log',\n level=logging.INFO)\n", (137, 214), False, 'import logging\n'), ((450, 474), 'logging.info', 'logging.inf... |
# -*- coding: ISO-8859-1 -*-
#
# generated by wxGlade 0.9.3 on Thu Jun 27 21:45:40 2019
#
import platform
import wx
from .choicepropertypanel import ChoicePropertyPanel
from .icons import icons8_administrative_tools_50
from .mwindow import MWindow
_ = wx.GetTranslation
MILS_IN_MM = 39.3701
class PreferencesUnitsP... | [
"wx.Panel.__init__",
"wx.ComboBox",
"wx.BoxSizer",
"wx.TextCtrl",
"platform.system"
] | [((498, 536), 'wx.Panel.__init__', 'wx.Panel.__init__', (['self', '*args'], {}), '(self, *args, **kwds)\n', (515, 536), False, 'import wx\n'), ((587, 613), 'wx.BoxSizer', 'wx.BoxSizer', (['wx.HORIZONTAL'], {}), '(wx.HORIZONTAL)\n', (598, 613), False, 'import wx\n'), ((2430, 2468), 'wx.Panel.__init__', 'wx.Panel.__init_... |
'''
Created on Nov 21, 2011
@author: vkrivoku
'''
import software_versions as sftw
import re
import sys
dopy2 = False
try:
# Python 3 way
import urllib.request as client
except ImportError:
import urllib as client
dopy2 = True
def check_sendmail():
'''
Checks sendmail stable version from t... | [
"re.split",
"urllib.urlopen",
"re.findall",
"sys.exc_info",
"re.search"
] | [((10879, 10898), 'urllib.urlopen', 'client.urlopen', (['url'], {}), '(url)\n', (10893, 10898), True, 'import urllib as client\n'), ((11430, 11465), 're.findall', 're.findall', (['pattern', 'content', 'flags'], {}), '(pattern, content, flags)\n', (11440, 11465), False, 'import re\n'), ((11811, 11834), 're.split', 're.s... |
from setuptools import setup, find_packages
setup(
name="aocr",
version="0.1",
description="Parsing text output for Advent of Code puzzles",
url="https://github.com/cqkh42/aoc_letters",
author="cqkh42",
author_email="<EMAIL>",
long_description=open("README.md").read(),
long_description_... | [
"setuptools.find_packages"
] | [((521, 536), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (534, 536), False, 'from setuptools import setup, find_packages\n')] |
import sublime
import sublime_plugin
import os
from Default.exec import ExecCommand
# Related reading:
# https://forum.sublimetext.com/t/how-can-i-create-a-new-build-system-to-run-python-from-project-root/47461/2
#
# This is an example of a custom build target that can execute Pythion code
# as a module by calcu... | [
"os.path.splitext",
"sublime.expand_variables",
"os.path.relpath"
] | [((1363, 1416), 'os.path.relpath', 'os.path.relpath', (["var_list['file']", "var_list['folder']"], {}), "(var_list['file'], var_list['folder'])\n", (1378, 1416), False, 'import os\n'), ((1966, 2008), 'sublime.expand_variables', 'sublime.expand_variables', (['kwargs', 'var_list'], {}), '(kwargs, var_list)\n', (1990, 200... |
import torch
import numpy as np
import pandas as pd
import torch.optim as optim
from agents.common.logger import Logger
from agents.common.replay_buffer import ReplayBuffer
from agents.common.utils import quantile_huber_loss
class EGreedyAgent():
def __init__(self,env,
network,
epsilon=0.05,
n_quanti... | [
"numpy.random.uniform",
"numpy.min",
"numpy.random.randint",
"torch.as_tensor",
"agents.common.replay_buffer.ReplayBuffer",
"torch.no_grad",
"agents.common.logger.Logger"
] | [((3554, 3569), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (3567, 3569), False, 'import torch\n'), ((719, 733), 'agents.common.replay_buffer.ReplayBuffer', 'ReplayBuffer', ([], {}), '()\n', (731, 733), False, 'from agents.common.replay_buffer import ReplayBuffer\n'), ((1680, 1734), 'agents.common.logger.Logger... |
#!/usr/bin/env python3
#encoding=utf-8
#------------------------------------------------------------
# Usage: python3 timeseqs_timer2.py
# Description: timer test for multiple implementation
#------------------------------------------------------------
import sys, timer2
reps = 10000
repslist = list(range(reps))
... | [
"timer2.bestoftotal"
] | [((819, 865), 'timer2.bestoftotal', 'timer2.bestoftotal', (['test'], {'_reps1': '(5)', '_reps': '(1000)'}), '(test, _reps1=5, _reps=1000)\n', (837, 865), False, 'import sys, timer2\n')] |
from classes.separator import Separator
from classes.gram import Gram
from classes.merge import Merge
from classes.structure import Structure
def main():
arr_files = ['esportes', 'policia', 'problema', 'trabalhador']
separator = Separator()
gram = Gram()
merge = Merge()
for f in arr_files:
... | [
"classes.separator.Separator",
"classes.gram.Gram",
"classes.merge.Merge",
"classes.structure.Structure"
] | [((238, 249), 'classes.separator.Separator', 'Separator', ([], {}), '()\n', (247, 249), False, 'from classes.separator import Separator\n'), ((261, 267), 'classes.gram.Gram', 'Gram', ([], {}), '()\n', (265, 267), False, 'from classes.gram import Gram\n'), ((280, 287), 'classes.merge.Merge', 'Merge', ([], {}), '()\n', (... |
from __future__ import division
from __future__ import print_function
import sys
from os import path
from argparse import ArgumentParser
import numpy as np
import json
sys.path.append(path.dirname(path.dirname(path.dirname(path.abspath(__file__)))) + '/utils/')
sys.path.append(path.dirname(path.dirname(path... | [
"os.path.abspath",
"argparse.ArgumentParser",
"json.dumps",
"algorithm_utils.set_algorithms_output_data",
"multhist_lib.multipleHist2_Loc2Glob_TD.load"
] | [((2371, 2395), 'json.dumps', 'json.dumps', (['myjsonresult'], {}), '(myjsonresult)\n', (2381, 2395), False, 'import json\n'), ((2448, 2464), 'argparse.ArgumentParser', 'ArgumentParser', ([], {}), '()\n', (2462, 2464), False, 'from argparse import ArgumentParser\n'), ((2635, 2668), 'os.path.abspath', 'path.abspath', ([... |
import logging
import time
from time import sleep
import pytest
import tqdm
from rich.logging import RichHandler
from tali.datasets.dataloaders import SampleParallelismDataLoader
from torch.utils.data import default_collate
from tali.config_repository import DatasetConfig, ImageShape, ModalityConfig
from tali.dataset... | [
"tali.config_repository.ModalityConfig",
"tali.datasets.dataloaders.SampleParallelismDataLoader",
"time.time",
"logging.Formatter",
"time.sleep",
"pytest.mark.parametrize",
"tali.config_repository.ImageShape",
"rich.logging.RichHandler",
"logging.getLogger"
] | [((368, 395), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (385, 395), False, 'import logging\n'), ((429, 442), 'rich.logging.RichHandler', 'RichHandler', ([], {}), '()\n', (440, 442), False, 'from rich.logging import RichHandler\n'), ((502, 550), 'logging.Formatter', 'logging.Formatter... |
#encoding:utf-8
from django.urls import path
from django.contrib import admin
from main import views
urlpatterns = [
path('', views.index),
path('populate/', views.populateDB),
path('loadRS', views.loadRS),
path('recommendedFilmsItems', views.recommendedFilmsItems),
path('recommendedFilmsUser', vi... | [
"django.urls.path"
] | [((123, 144), 'django.urls.path', 'path', (['""""""', 'views.index'], {}), "('', views.index)\n", (127, 144), False, 'from django.urls import path\n'), ((150, 185), 'django.urls.path', 'path', (['"""populate/"""', 'views.populateDB'], {}), "('populate/', views.populateDB)\n", (154, 185), False, 'from django.urls import... |
##########################################################################
#
# Copyright (c) 2008-2010, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redis... | [
"unittest.main",
"IECore.CompoundVectorParameter",
"IECore.StringParameter",
"IECore.StringVectorData",
"IECore.BoolVectorData",
"imath.V2f",
"IECore.IntVectorData"
] | [((3371, 3386), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3384, 3386), False, 'import unittest\n'), ((1931, 1974), 'IECore.CompoundVectorParameter', 'IECore.CompoundVectorParameter', (['"""a"""', '"""dest"""'], {}), "('a', 'dest')\n", (1961, 1974), False, 'import IECore\n'), ((2641, 2684), 'IECore.CompoundVe... |
from setuptools import setup, find_packages
from irasutoya import __version__
setup(
name='irasutoya',
version=__version__,
author='<NAME>',
author_email='<EMAIL>',
description='Scrapes over www.irasutoya.com and fetchs information about illustrations provided there',
long_description=open('R... | [
"setuptools.find_packages"
] | [((749, 764), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (762, 764), False, 'from setuptools import setup, find_packages\n')] |
import json
import re
from ..delta import Delta
SAMPLE_CHANGE = '{"deleted": ["key-1"]}'
SAMPLE_CHANGE_BASE64 = "eyJkZWxldGVkIjogWyJrZXktMSJdfQ=="
def test_ctor_with_json_str(sample_delta):
d = sample_delta
assert d.change == SAMPLE_CHANGE_BASE64
assert d.by == []
assert d.when
assert d.hash
... | [
"re.search"
] | [((1177, 1210), 're.search', 're.search', (['""""when": "20[^"]+\\""""', 's'], {}), '(\'"when": "20[^"]+"\', s)\n', (1186, 1210), False, 'import re\n')] |
import statistics
# variables
stop_count = 0 # counter used in current person count display
stops = [(9, 0), (6, 3), (2, 6), (1, 0), (3, 1), (4, 5), (8, 4), (4, 5), (5, 10)] # random numbers and stops
print("---Bus Persons Calculator--")
# 1. Calculate the number of stops.
total_stops = len(stops)
print("Total numbe... | [
"statistics.pstdev"
] | [((1537, 1570), 'statistics.pstdev', 'statistics.pstdev', (['total_capacity'], {}), '(total_capacity)\n', (1554, 1570), False, 'import statistics\n')] |
# -*- coding: utf-8 -*-
"""Command-line interface for Crypto Candlesticks."""
import time
from datetime import datetime
import click
from crypto_candlesticks.get_data import get_data
from crypto_candlesticks.symbols.intervals import intervals
from crypto_candlesticks.symbols.quote_currency import quote_currency
cli... | [
"crypto_candlesticks.get_data.get_data",
"datetime.datetime.today",
"click.option",
"click.command",
"click.Choice",
"datetime.datetime",
"click.DateTime",
"time.time",
"click.secho"
] | [((317, 387), 'click.secho', 'click.secho', (['"""Welcome, what data do you wish to download?"""'], {'fg': '"""green"""'}), "('Welcome, what data do you wish to download?', fg='green')\n", (328, 387), False, 'import click\n'), ((391, 406), 'click.command', 'click.command', ([], {}), '()\n', (404, 406), False, 'import c... |
import sys
import torch
from torch.utils.data import Dataset
sys.path.append('../')
from utils import read_h5py
from data_loader.base_data_loader import BaseDataLoader
class GqnDataset(Dataset):
"""
A general dataloder for the GQN data (.h5). The data support segmentation evaluation
"""
def __init__(s... | [
"sys.path.append",
"utils.read_h5py",
"torch.tensor",
"torch.from_numpy"
] | [((61, 83), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (76, 83), False, 'import sys\n'), ((624, 644), 'utils.read_h5py', 'read_h5py', (['data_file'], {}), '(data_file)\n', (633, 644), False, 'from utils import read_h5py\n'), ((2255, 2278), 'torch.from_numpy', 'torch.from_numpy', (['image'],... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-06-26 08:08
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('App', '0006_goods'),
]
operations = [
migrations.CreateModel(
n... | [
"django.db.models.CharField",
"django.db.models.EmailField",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((376, 469), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (392, 469), False, 'from django.db import migrations, models\... |
import extract_global, config
import os, argparse
def parse_arguments():
parser = argparse.ArgumentParser(description='Extract frame FVs')
parser.add_argument(
'--sift_mode', # mode = 0 -> SIFT detector; 1 -> Hessian affine detector
type=int,
required=False,
default=1
)
... | [
"extract_global.generateGlobalFeatureFrame",
"os.makedirs",
"argparse.ArgumentParser",
"os.path.exists",
"os.path.join"
] | [((87, 143), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Extract frame FVs"""'}), "(description='Extract frame FVs')\n", (110, 143), False, 'import os, argparse\n'), ((728, 787), 'os.path.join', 'os.path.join', (['config.OUTPUT_DIR', '"""output_frame_descriptors"""'], {}), "(config.OU... |
#!/usr/bin/env python3
# <NAME> (c) 2017
# BSD 2-Clause
# Full licence terms located in LICENCE file
from blacklistparser.core import App
if __name__ == '__main__':
try:
App.App()
except KeyboardInterrupt:
raise
| [
"blacklistparser.core.App.App"
] | [((185, 194), 'blacklistparser.core.App.App', 'App.App', ([], {}), '()\n', (192, 194), False, 'from blacklistparser.core import App\n')] |
#!/usr/bin/env python
"""
Simple implementation of colour-sending functionality,
without the ACK/retry functionality. Send only, no listen.
Author: <NAME>
"""
import socket
import time
import sys
import random
import tools
from tools import gen_packet, get_colour_zones_packet
RETRIES = 2
DELAY = 0.05
UDP_PORT = 567... | [
"tools.get_colour_zones_packet",
"socket.socket",
"random.randint",
"time.sleep"
] | [((333, 355), 'random.randint', 'random.randint', (['(0)', '(255)'], {}), '(0, 255)\n', (347, 355), False, 'import random\n'), ((904, 952), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (917, 952), False, 'import socket\n'), ((744, 761), 'time.... |
# -*- coding: utf-8 -*-
"""ex_perturbationparameters.py
Example:
A container to hold all possible perturbation parameters.
These perturbation parameters are used when homogenized cross sections
are defined.
Created on Mon Apr 04 15:45:00 2022 @author: <NAME>
Last updated on Mon Apr 04 15:45:00 2022 @author: <NAME>
... | [
"xsInterface.containers.perturbationparameters.Perturbations"
] | [((783, 937), 'xsInterface.containers.perturbationparameters.Perturbations', 'Perturbations', ([], {'branchN': '(3)', 'branches': "['fuel', 'dens', 'cool']", 'histN': '(2)', 'histories': "['nom', 'pert']", 'timeValues': '[0, 2, 2.5, 3, 4]', 'timeUnits': '"""MWd/kg"""'}), "(branchN=3, branches=['fuel', 'dens', 'cool'], ... |
import os
from os import path
from pathlib import Path
from shutil import rmtree
from typing import Union
from pyspark.sql.types import DataType
from pyspark.sql.types import StructType
from spark_fhir_schemas.r4.complex_types.address import AddressSchema
from spark_fhir_schemas.r4.resources.explanationofbenefit impor... | [
"os.mkdir",
"spark_fhir_schemas.r4.resources.patient.PatientSchema.get_schema",
"spark_fhir_schemas.r4.resources.explanationofbenefit.ExplanationOfBenefitSchema.get_schema",
"shutil.rmtree",
"os.path.isdir",
"pathlib.Path",
"spark_fhir_schemas.r4.complex_types.address.AddressSchema.get_schema"
] | [((564, 587), 'os.path.isdir', 'path.isdir', (['temp_folder'], {}), '(temp_folder)\n', (574, 587), False, 'from os import path\n'), ((622, 643), 'os.mkdir', 'os.mkdir', (['temp_folder'], {}), '(temp_folder)\n', (630, 643), False, 'import os\n'), ((687, 713), 'spark_fhir_schemas.r4.resources.patient.PatientSchema.get_sc... |
import json
import os
from unittest import TestCase, mock
from climacell.api import Client, Measurement, Response, Error
from climacell.fields import (
FIELD_TEMP, FIELD_DEW_POINT, FIELD_HUMIDITY,
FIELD_WIND_SPEED, FIELD_WIND_GUST, FIELD_WIND_DIRECTION,
FIELD_SUNRISE, FIELD_SUNSET,
)
from climacell.utils i... | [
"json.load",
"climacell.api.Response",
"climacell.api.Measurement",
"os.path.dirname",
"unittest.mock.patch",
"climacell.api.Error",
"climacell.utils.join_fields",
"climacell.api.Client"
] | [((353, 378), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (368, 378), False, 'import os\n'), ((422, 447), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (437, 447), False, 'import os\n'), ((491, 516), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__... |
from multiprocessing import Queue
import re
import threading
from typing import Optional, Tuple
import zlib
from ..candidate import CandidateResult
from ..helpers import exception_to_string
from ..permuter import (
EvalError,
EvalResult,
Feedback,
FeedbackItem,
Finished,
Message,
NeedMoreWo... | [
"threading.Thread",
"re.match",
"zlib.compress",
"zlib.decompress",
"multiprocessing.Queue"
] | [((9204, 9211), 'multiprocessing.Queue', 'Queue', ([], {}), '()\n', (9209, 9211), False, 'from multiprocessing import Queue\n'), ((9357, 9403), 'threading.Thread', 'threading.Thread', ([], {'target': 'conn.run', 'daemon': '(True)'}), '(target=conn.run, daemon=True)\n', (9373, 9403), False, 'import threading\n'), ((1697... |
#!/usr/bin/env python3
"""
How to Run
-s keepItSimple -a 1 -a 2 -c -A -B
"""
__author__ = "<NAME>"
__version__ = "0.1.0"
__license__ = "MIT"
import argparse
from logzero import logger
def main(args):
""" Main entry point of the app """
# logger.info("hello world")
# logger.info(args)
print( 'simple_value ='... | [
"argparse.ArgumentParser"
] | [((654, 679), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (677, 679), False, 'import argparse\n')] |
import discord
from discord.ext import commands
from random import randint
class Bottlespin:
"""Spins a bottle and lands on a random user."""
def __init__(self, bot):
self.bot = bot
@commands.command(pass_context=True, no_pm=True, alias=["bottlespin"])
async def spin(self, ctx, role):
... | [
"discord.ext.commands.command"
] | [((208, 277), 'discord.ext.commands.command', 'commands.command', ([], {'pass_context': '(True)', 'no_pm': '(True)', 'alias': "['bottlespin']"}), "(pass_context=True, no_pm=True, alias=['bottlespin'])\n", (224, 277), False, 'from discord.ext import commands\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import click
from calendar import month_abbr
from datetime import datetime, date, timedelta
from dateutil.relativedelta import relativedelta
FILLED = u'\u25CF'
EMPTY = u'\u25CB'
row_label_formats = {
'year': '{year:<{max_year_width}}',
'age': 'Age {age:<{max... | [
"click.option",
"dateutil.relativedelta.relativedelta",
"datetime.date.today",
"click.command",
"datetime.date",
"click.echo",
"click.Choice",
"datetime.datetime.strptime",
"datetime.timedelta",
"click.secho"
] | [((1043, 1058), 'click.command', 'click.command', ([], {}), '()\n', (1056, 1058), False, 'import click\n'), ((1237, 1364), 'click.option', 'click.option', (['"""--life-expectancy"""', '"""-l"""', '"""expected_years"""'], {'type': 'int', 'default': '(85)', 'help': '"""Number of years you expect to live"""'}), "('--life-... |
import json
import zlib
def compress(message):
try:
return zlib.compress(
json.dumps(message,
separators=(',', ':')),
9
)
except:
return ''
def decompress(message):
try:
return json.loads(
zlib.decompress(message)
... | [
"zlib.decompress",
"json.dumps"
] | [((99, 141), 'json.dumps', 'json.dumps', (['message'], {'separators': "(',', ':')"}), "(message, separators=(',', ':'))\n", (109, 141), False, 'import json\n'), ((294, 318), 'zlib.decompress', 'zlib.decompress', (['message'], {}), '(message)\n', (309, 318), False, 'import zlib\n')] |
"""
NOTE: This file is not using to.testing.assert_allclose because most methods need to work for both torch and numpy.
"""
import pytest
import numpy as np
import torch as to
import itertools
import pickle
from typing import NamedTuple
from pyrado.algorithms.utils import ReplayMemory
from pyrado.sampling.step_sequenc... | [
"pyrado.sampling.step_sequence.StepSequence.concat",
"numpy.ones_like",
"pyrado.algorithms.utils.ReplayMemory",
"numpy.random.randn",
"numpy.empty_like",
"pyrado.sampling.step_sequence.StepSequence",
"torch.cat",
"pyrado.environments.pysim.ball_on_beam.BallOnBeamSim",
"numpy.array",
"pyrado.sampli... | [((1826, 1952), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""data_format, tensor_type"""', "[('numpy', np.ndarray), ('torch', to.Tensor)]"], {'ids': "['numpy', 'torch']"}), "('data_format, tensor_type', [('numpy', np.ndarray),\n ('torch', to.Tensor)], ids=['numpy', 'torch'])\n", (1849, 1952), False, '... |
# This code is part of Qiskit.
#
# (C) Copyright IBM 2020, 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivat... | [
"unittest.main",
"numpy.sum",
"warnings.simplefilter",
"test.datasets.get_deprecated_msg_ref",
"numpy.testing.assert_array_equal",
"numpy.ones",
"warnings.catch_warnings",
"numpy.array",
"qiskit_machine_learning.datasets.gaussian"
] | [((2435, 2450), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2448, 2450), False, 'import unittest\n'), ((860, 896), 'warnings.catch_warnings', 'warnings.catch_warnings', ([], {'record': '(True)'}), '(record=True)\n', (883, 896), False, 'import warnings\n'), ((917, 948), 'warnings.simplefilter', 'warnings.simple... |
#%%
import numpy as np
import pandas as pd
import tqdm
import vdj.io
import vdj.bayes
import vdj.stats
# Load data and stan model
data = pd.read_csv('../../data/compiled_dwell_times.csv')
model = vdj.bayes.StanModel('../stan/pooled_exponential_sum.stan', force_compile=True)
#%%
# Iterate through the data and fit whil... | [
"pandas.read_csv",
"pandas.concat"
] | [((138, 188), 'pandas.read_csv', 'pd.read_csv', (['"""../../data/compiled_dwell_times.csv"""'], {}), "('../../data/compiled_dwell_times.csv')\n", (149, 188), True, 'import pandas as pd\n'), ((1058, 1077), 'pandas.concat', 'pd.concat', (['samps_df'], {}), '(samps_df)\n', (1067, 1077), True, 'import pandas as pd\n'), ((1... |
from django.conf.urls import include
from django.urls import re_path
from rest_framework.routers import SimpleRouter
from olympia.shelves import views
router = SimpleRouter()
router.register('', views.ShelfViewSet, basename='shelves')
router.register(
'sponsored', views.SponsoredShelfViewSet, basename='sponsore... | [
"django.conf.urls.include",
"rest_framework.routers.SimpleRouter"
] | [((164, 178), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {}), '()\n', (176, 178), False, 'from rest_framework.routers import SimpleRouter\n'), ((364, 384), 'django.conf.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (371, 384), False, 'from django.conf.urls import include\n')] |
import os
print("Starting Capsian Setup Tool...")
print("This script will install all the dependencies you need")
input("Press enter to continue or close to terminate ")
_pip_type = "pip"
if os.name == "posix":
_pip_type = "pip3"
os.system(_pip_type + " install pyglet==1.5.6")
os.system(_pip_type + " install PyO... | [
"os.system"
] | [((237, 284), 'os.system', 'os.system', (["(_pip_type + ' install pyglet==1.5.6')"], {}), "(_pip_type + ' install pyglet==1.5.6')\n", (246, 284), False, 'import os\n'), ((285, 327), 'os.system', 'os.system', (["(_pip_type + ' install PyOpenGL')"], {}), "(_pip_type + ' install PyOpenGL')\n", (294, 327), False, 'import o... |
import json
def Serialize(path: str, settings: dict):
with open (path, "w", encoding="utf-8") as f:
f.write(json.dumps(settings, indent=4))
def Deserialize(path: str):
settings = dict()
with open(path, "r", encoding="utf-8") as f:
settings = json.load(f)
return settings | [
"json.load",
"json.dumps"
] | [((273, 285), 'json.load', 'json.load', (['f'], {}), '(f)\n', (282, 285), False, 'import json\n'), ((122, 152), 'json.dumps', 'json.dumps', (['settings'], {'indent': '(4)'}), '(settings, indent=4)\n', (132, 152), False, 'import json\n')] |
from fastapi import Path
# example for /pep/{namespace}
example_namespace = Path(
...,
description="A namespace that holds projects.",
regex=r"^\w+$",
example="demo",
)
example_pep_id = Path(
...,
description="A project name inside a particular namespace",
example="BiocProject"
) | [
"fastapi.Path"
] | [((77, 170), 'fastapi.Path', 'Path', (['...'], {'description': '"""A namespace that holds projects."""', 'regex': '"""^\\\\w+$"""', 'example': '"""demo"""'}), "(..., description='A namespace that holds projects.', regex='^\\\\w+$',\n example='demo')\n", (81, 170), False, 'from fastapi import Path\n'), ((204, 300), '... |
import tensorflow as tf
from tensorflow.keras.layers import Conv2D, MaxPool2D
class LocalisationNet(tf.keras.layers.Layer):
def __init__(self):
super(LocalisationNet, self).__init__()
self.conv_1 = Conv2D(8, kernel_size=7, activation="relu", kernel_initializer="he_normal")
self.maxpool_1 = ... | [
"tensorflow.keras.layers.MaxPool2D",
"tensorflow.keras.layers.Conv2D"
] | [((219, 294), 'tensorflow.keras.layers.Conv2D', 'Conv2D', (['(8)'], {'kernel_size': '(7)', 'activation': '"""relu"""', 'kernel_initializer': '"""he_normal"""'}), "(8, kernel_size=7, activation='relu', kernel_initializer='he_normal')\n", (225, 294), False, 'from tensorflow.keras.layers import Conv2D, MaxPool2D\n'), ((32... |
from flask_mongoengine import Document
from qingmi.utils.encoding import smart_text
def get_model_field(model):
""" get the verbose_name of all fields in the model """
field_dict = dict()
for field in model._fields:
attr = getattr(model, field)
if hasattr(attr, 'verbose_name'):
... | [
"qingmi.utils.encoding.smart_text"
] | [((2474, 2495), 'qingmi.utils.encoding.smart_text', 'smart_text', (['old_value'], {}), '(old_value)\n', (2484, 2495), False, 'from qingmi.utils.encoding import smart_text\n'), ((2497, 2518), 'qingmi.utils.encoding.smart_text', 'smart_text', (['new_value'], {}), '(new_value)\n', (2507, 2518), False, 'from qingmi.utils.e... |
"""
Tasks for conda world
"""
# TODO: must have already said this somewhere, but the parameter
# handling is a nightmare. For so many reasons. Like when chaining
# tasks, all must support the same parameters.
# TODO: conda env file/package generation: sort within each section (e.g. run dependencies, build dependenci... | [
"os.remove",
"yaml.dump",
"setuptools._vendor.packaging.version.Version",
"os.path.join",
"conda.models.match_spec.MatchSpec",
"doit.action.CmdAction",
"os.path.dirname",
"os.path.exists",
"urllib.urlretrieve",
"collections.Counter",
"conda_env.env.from_environment",
"re.sub",
"os.path.basen... | [((2831, 2867), 'os.environ.get', 'os.environ.get', (['"""CONDA_EXE"""', '"""conda"""'], {}), "('CONDA_EXE', 'conda')\n", (2845, 2867), False, 'import os\n'), ((14277, 14305), 're.sub', 're.sub', (['"""\\\\[.*?\\\\]"""', '""""""', 'dep'], {}), "('\\\\[.*?\\\\]', '', dep)\n", (14283, 14305), False, 'import re\n'), ((145... |
import hotkeys
import time
def test_function(event,parameter):
print(event)
if(event.name=='SPACE'):
parameter['running']=False
#print("Space")
parameters={'running':True}
hotkeysdetector=hotkeys.HotKeysDetector(parameters=True)
hotkeysdetector.addhotkeys("CONTROL_L+f12",test_function,para... | [
"time.sleep",
"hotkeys.HotKeysDetector"
] | [((218, 258), 'hotkeys.HotKeysDetector', 'hotkeys.HotKeysDetector', ([], {'parameters': '(True)'}), '(parameters=True)\n', (241, 258), False, 'import hotkeys\n'), ((447, 462), 'time.sleep', 'time.sleep', (['(0.1)'], {}), '(0.1)\n', (457, 462), False, 'import time\n')] |
from queue import Queue
from threading import Thread
import time
class Student(Thread):
def __init__(self, name, queue):
super().__init__()
self.name = name
self.queue = queue
def run(self):
while True:
# 阻塞程序,时刻监听老师,接收消息
msg = self.queue.get()
... | [
"queue.Queue",
"time.sleep"
] | [((651, 658), 'queue.Queue', 'Queue', ([], {}), '()\n', (656, 658), False, 'from queue import Queue\n'), ((821, 834), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (831, 834), False, 'import time\n')] |
import tempfile
from os import path
import pytest
from dateutil import parser
from jinja2.loaders import PackageLoader
from jtex.TemplateRenderer import TemplateRenderer
def test_not_initialized_on_construction():
renderer = TemplateRenderer()
assert renderer.jinja is None
@pytest.fixture(name="renderer")... | [
"dateutil.parser.parse",
"tempfile.TemporaryDirectory",
"jinja2.loaders.PackageLoader",
"pytest.fixture",
"jtex.TemplateRenderer.TemplateRenderer",
"os.path.join"
] | [((289, 320), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""renderer"""'}), "(name='renderer')\n", (303, 320), False, 'import pytest\n'), ((233, 251), 'jtex.TemplateRenderer.TemplateRenderer', 'TemplateRenderer', ([], {}), '()\n', (249, 251), False, 'from jtex.TemplateRenderer import TemplateRenderer\n'), ((353... |
import asyncio
import dbm
import hashlib
import logging
import os
import random
import threading
import zmq
import zmq.asyncio
from cachetools.ttl import TTLCache
from dataclasses import dataclass, field
from typing import Any, List, Optional, Set
from ..boards.memory_board import Board, MemoryBoard
from ..messages.b... | [
"dbm.open",
"os.unlink",
"asyncio.Condition",
"zmq.asyncio.Context",
"dataclasses.field",
"hashlib.sha256",
"random.randrange",
"logging.getLogger"
] | [((1328, 1345), 'dataclasses.field', 'field', ([], {'repr': '(False)'}), '(repr=False)\n', (1333, 1345), False, 'from dataclasses import dataclass, field\n'), ((1573, 1590), 'dataclasses.field', 'field', ([], {'repr': '(False)'}), '(repr=False)\n', (1578, 1590), False, 'from dataclasses import dataclass, field\n'), ((1... |
from __future__ import division
import math
import random
import logging
import torch
from torchtext.data.utils import RandomShuffler
from torchtext.data.dataset import Dataset
logger = logging.getLogger(__name__)
class MyBatch(object):
"""Defines a batch of examples along with its Fields.
Attributes:
... | [
"torch.is_tensor",
"torchtext.data.utils.RandomShuffler",
"torch.typename",
"logging.getLogger"
] | [((189, 216), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (206, 216), False, 'import logging\n'), ((3449, 3472), 'torch.is_tensor', 'torch.is_tensor', (['tensor'], {}), '(tensor)\n', (3464, 3472), False, 'import torch\n'), ((4039, 4061), 'torch.typename', 'torch.typename', (['tensor'],... |
from keras.datasets import boston_housing
from keras import models, layers
import numpy as np
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
print("获取数据集")
(train_data, train_targets), (test_data, test_targets) = boston_housing.load_data()
print("训练数据大小", train_data.shape)
print("测试数据大小", t... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.clf",
"keras.models.Sequential",
"matplotlib.use",
"numpy.mean",
"keras.layers.Dense",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"numpy.concatenate",
"keras.datasets.boston_housing.load_data"
] | [((113, 136), 'matplotlib.use', 'matplotlib.use', (['"""TkAgg"""'], {}), "('TkAgg')\n", (127, 136), False, 'import matplotlib\n'), ((242, 268), 'keras.datasets.boston_housing.load_data', 'boston_housing.load_data', ([], {}), '()\n', (266, 268), False, 'from keras.datasets import boston_housing\n'), ((2150, 2170), 'matp... |
#!/usr/bin/env python
from setuptools import find_packages, setup
setup(
name='default_pickling',
version='0.3',
description=(
'A base class that provides default pickling and copying method '
'implementations for use in inheritance.'),
author='<NAME>',
author_email='<EMAIL>',
p... | [
"setuptools.find_packages"
] | [((583, 598), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (596, 598), False, 'from setuptools import find_packages, setup\n')] |
#!/usr/bin/python3
# ap_reader.py
# Date: 15/09/2021
# Author: <NAME>
# Email: <EMAIL>
import pathlib
import pandas as pd
"""
This module is responsible for reading an application profile (for diffing) from a CSV file.
"""
NA_VALUES = {"class": "", "property": "", "object property": "", "preview property": "", ... | [
"pandas.read_csv"
] | [((561, 590), 'pandas.read_csv', 'pd.read_csv', (['ap_csv_file_path'], {}), '(ap_csv_file_path)\n', (572, 590), True, 'import pandas as pd\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#########################################
fuente = ("courier new", "10")
fuenteNeg = ("courier new", "10", "bold")
ancho = 160
alto = 16
windowTitleBase = "Sim2bHaptcis"
autoScroll = True
cycleTime = 0.042
configFile = 'Sim2bHap.ini'
logfile = 'Sim2bHap.log'
h... | [
"il2bBHap.Sim",
"logging.exception",
"os.path.basename",
"DCSBHap.Sim",
"os.path.realpath",
"time.sleep",
"msfsBHap.Sim",
"logging.info",
"time.time",
"WThBHap.Sim",
"traceback.format_exc",
"configparser.ConfigParser",
"os.path.join",
"os.chdir",
"logging.getLogger"
] | [((8104, 8133), 'os.path.basename', 'os.path.basename', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (8120, 8133), False, 'import os, sys, os.path\n'), ((8941, 8968), 'configparser.ConfigParser', 'configparser.ConfigParser', ([], {}), '()\n', (8966, 8968), False, 'import configparser\n'), ((19739, 19779), 'logging.info', ... |
#!/usr/bin/env python
###
### Safe Stack Hash (EIP-based)
###
import sys,struct
class Triage( gdb.Command ):
"""
EIP-based triage: triage DEPTH
Construct a unique hash for a given program state.
"""
def __init__( self ):
gdb.Command.__init__( self, "triage", gdb.COMMAND_STACK )
def invoke( se... | [
"struct.calcsize"
] | [((613, 633), 'struct.calcsize', 'struct.calcsize', (['"""P"""'], {}), "('P')\n", (628, 633), False, 'import sys, struct\n')] |
from django.contrib import admin
from uptodo.models import TodoTask
admin.site.register(TodoTask)
| [
"django.contrib.admin.site.register"
] | [((71, 100), 'django.contrib.admin.site.register', 'admin.site.register', (['TodoTask'], {}), '(TodoTask)\n', (90, 100), False, 'from django.contrib import admin\n')] |
import logging
from abc import ABC, abstractmethod
from typing import BinaryIO, Dict, List, Optional, Union
import httpx
from pydantic import ValidationError
from ..exceptions import (
AccountBanned,
BadAPIKey,
FileIsTooLarge,
ImageInvalid,
LongLimitReached,
ShortLimitReached,
TooManyFaile... | [
"logging.getLogger"
] | [((669, 696), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (686, 696), False, 'import logging\n')] |