code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
__author__ = 'marrabld'
import sys
import seaborn as sns
import numpy as np
import scipy
# !mkdir tmp
import pylab
import sys
sys.path.append("..")
import libbootstrap
import libbootstrap.deconv
rrs_file = '/home/marrabld/Projects/phd/test_dataset/bootstrappy_test/1_batch_report.csv'
# np.savetxt(rrs_file, np.vst... | [
"sys.path.append",
"pylab.show",
"libbootstrap.deconv.QAA",
"pylab.ylabel",
"scipy.asarray",
"libbootstrap.deconv.HopeDeep",
"pylab.xlabel",
"pylab.legend",
"pylab.plot"
] | [((130, 151), 'sys.path.append', 'sys.path.append', (['""".."""'], {}), "('..')\n", (145, 151), False, 'import sys\n'), ((385, 524), 'scipy.asarray', 'scipy.asarray', (['[410.0, 430.0, 450.0, 470.0, 490.0, 510.0, 530.0, 550.0, 570.0, 590.0, \n 610.0, 630.0, 650.0, 670.0, 690.0, 710.0, 730.0]'], {}), '([410.0, 430.0,... |
from django.db.models.signals import pre_delete
from django.dispatch.dispatcher import receiver
from examiner.models import Pdf
@receiver(pre_delete, sender=Pdf, dispatch_uid='delete_backed_up_pdf')
def delete_pdf_backup_on_deletion(sender, instance, **kwargs):
"""Delete Pdf on disk when Pdf model object is dele... | [
"django.dispatch.dispatcher.receiver"
] | [((132, 201), 'django.dispatch.dispatcher.receiver', 'receiver', (['pre_delete'], {'sender': 'Pdf', 'dispatch_uid': '"""delete_backed_up_pdf"""'}), "(pre_delete, sender=Pdf, dispatch_uid='delete_backed_up_pdf')\n", (140, 201), False, 'from django.dispatch.dispatcher import receiver\n')] |
# -*- coding: utf-8 -*-
# Mutated from https://github.com/aerospike-examples/aerospike-modeling
from args import options
import aerospike
from aerospike import exception as ex
from aerospike_helpers.operations import list_operations as lh
import pprint
import sys
if options.set == "None":
options.set = None
confi... | [
"aerospike.client",
"pprint.PrettyPrinter",
"aerospike_helpers.operations.list_operations.list_append_items",
"sys.exit",
"aerospike.null",
"aerospike_helpers.operations.list_operations.list_set_order"
] | [((637, 667), 'pprint.PrettyPrinter', 'pprint.PrettyPrinter', ([], {'indent': '(2)'}), '(indent=2)\n', (657, 667), False, 'import pprint\n'), ((619, 630), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (627, 630), False, 'import sys\n'), ((2205, 2256), 'aerospike_helpers.operations.list_operations.list_set_order', 'lh... |
from base import cdecl
# Just the bare minimum to bootstrap bedrock
malloc = cdecl('malloc', 'int -> a')
free = cdecl('free', 'a -> void')
fail = cdecl('fail', 'str -> noreturn')
fail_with_code = cdecl('fail_with_code', 'int -> noreturn')
_getenv = cdecl('_getenv', '(Env, c) -> a')
_haveenv = cdecl('_haveenv', '(Env,... | [
"base.cdecl"
] | [((78, 105), 'base.cdecl', 'cdecl', (['"""malloc"""', '"""int -> a"""'], {}), "('malloc', 'int -> a')\n", (83, 105), False, 'from base import cdecl\n'), ((113, 139), 'base.cdecl', 'cdecl', (['"""free"""', '"""a -> void"""'], {}), "('free', 'a -> void')\n", (118, 139), False, 'from base import cdecl\n'), ((147, 179), 'b... |
#/usr/bin/python
import sys
sys.path.append('/home/pi/pythondev/RelayPiPy/RelayPiPy')
from RelayPiPy import RelayPiPy
#import threading
import time
import queue
import pdb
class Accessory:
"""Accessory """
def __init__(self):
"""__init__ initializes class variables."""
self._running = True... | [
"sys.path.append",
"RelayPiPy.RelayPiPy",
"time.sleep"
] | [((29, 86), 'sys.path.append', 'sys.path.append', (['"""/home/pi/pythondev/RelayPiPy/RelayPiPy"""'], {}), "('/home/pi/pythondev/RelayPiPy/RelayPiPy')\n", (44, 86), False, 'import sys\n'), ((649, 660), 'RelayPiPy.RelayPiPy', 'RelayPiPy', ([], {}), '()\n', (658, 660), False, 'from RelayPiPy import RelayPiPy\n'), ((1835, ... |
#!/usr/bin/env python3
import subprocess
import sys
import os
def main():
lib_produced_filename = 'ctor'
program_produced_filename = 'main'
try:
os.remove(lib_produced_filename)
except FileNotFoundError:
pass
try:
os.remove(program_produced_filename)
except FileNotFou... | [
"subprocess.run",
"os.environ.copy",
"os.path.exists",
"os.remove"
] | [((467, 484), 'os.environ.copy', 'os.environ.copy', ([], {}), '()\n', (482, 484), False, 'import os\n'), ((573, 629), 'subprocess.run', 'subprocess.run', (['"""./codeinjector-caller"""'], {'env': 'environment'}), "('./codeinjector-caller', env=environment)\n", (587, 629), False, 'import subprocess\n'), ((168, 200), 'os... |
from __future__ import unicode_literals
"""
S3 bucket CRUD operations core module
Based on https://github.com/krux/python-krux-boto-s3/blob/master/krux_s3/s3.py
"""
import logging
import time
from difflib import SequenceMatcher
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from boto.s3.lifecy... | [
"boto.s3.lifecycle.Transition",
"time.sleep",
"time.time",
"difflib.SequenceMatcher",
"boto.s3.lifecycle.Lifecycle",
"boto.s3.connection.S3Connection",
"boto.s3.lifecycle.Rule",
"boto.s3.key.Key"
] | [((1772, 1828), 'boto.s3.connection.S3Connection', 'S3Connection', (['self.access_key_id', 'self.secret_access_key'], {}), '(self.access_key_id, self.secret_access_key)\n', (1784, 1828), False, 'from boto.s3.connection import S3Connection\n'), ((2836, 2852), 'boto.s3.key.Key', 'Key', (['self.bucket'], {}), '(self.bucke... |
import unittest
from shminspector.api.semver import SemVer
from shminspector.api.validator import Status
from shminspector.components.python import PythonInfo, PythonInfoStrictValidator
from tests.testutil import test_context
class PythonInfoStrictValidatorTest(unittest.TestCase):
def test_validate(self):
... | [
"unittest.main",
"shminspector.api.semver.SemVer",
"tests.testutil.test_context"
] | [((1897, 1924), 'shminspector.api.semver.SemVer', 'SemVer', (['major', 'minor', 'patch'], {}), '(major, minor, patch)\n', (1903, 1924), False, 'from shminspector.api.semver import SemVer\n'), ((1958, 1973), 'unittest.main', 'unittest.main', ([], {}), '()\n', (1971, 1973), False, 'import unittest\n'), ((1800, 1827), 'sh... |
from tortoise import models, fields
class User(models.Model):
id = fields.IntField(pk=True)
username = fields.CharField(max_length=255, unique=True)
email = fields.CharField(max_length=255, unique=True)
password = fields.CharField(max_length=255)
first_name = fields.CharField(max_length=255, null=... | [
"tortoise.fields.BooleanField",
"tortoise.fields.CharField",
"tortoise.fields.DatetimeField",
"tortoise.fields.BinaryField",
"tortoise.fields.IntField",
"tortoise.fields.ForeignKeyField"
] | [((73, 97), 'tortoise.fields.IntField', 'fields.IntField', ([], {'pk': '(True)'}), '(pk=True)\n', (88, 97), False, 'from tortoise import models, fields\n'), ((113, 158), 'tortoise.fields.CharField', 'fields.CharField', ([], {'max_length': '(255)', 'unique': '(True)'}), '(max_length=255, unique=True)\n', (129, 158), Fal... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 9 12:08:36 2019
@author: yangyutu123
"""
import json
jsonData = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
text = json.loads(jsonData)
print(text)
# write to a file
with open('data.json','w') as outputFile:
json.dump(text,outputFile)
# read fro... | [
"json.dump",
"json.load",
"json.loads"
] | [((181, 201), 'json.loads', 'json.loads', (['jsonData'], {}), '(jsonData)\n', (191, 201), False, 'import json\n'), ((281, 308), 'json.dump', 'json.dump', (['text', 'outputFile'], {}), '(text, outputFile)\n', (290, 308), False, 'import json\n'), ((381, 401), 'json.load', 'json.load', (['inputFile'], {}), '(inputFile)\n'... |
from django.contrib.auth.models import User
from authlib.integrations.django_client import OAuth
from .models import OAuth2Token
def fetch_token(name, request):
token = OAuth2Token.objects.get(name=name, user=request.user)
return token.to_token()
def update_token(name, token, refresh_token=None, access_t... | [
"django.contrib.auth.models.User.objects.filter",
"django.contrib.auth.models.User.objects.create_user",
"authlib.integrations.django_client.OAuth"
] | [((1096, 1153), 'authlib.integrations.django_client.OAuth', 'OAuth', ([], {'fetch_token': 'fetch_token', 'update_token': 'update_token'}), '(fetch_token=fetch_token, update_token=update_token)\n', (1101, 1153), False, 'from authlib.integrations.django_client import OAuth\n'), ((1847, 2027), 'django.contrib.auth.models.... |
import json
import os
import re
from pprint import pprint
from typing import AnyStr, Match, List
import fasttext
import requests
model = fasttext.load_model('lid.176.bin')
LANG_CODE = {
'독일어': 'de',
'러시아어': 'ru',
'베트남어': 'vi',
'스페인어': 'es',
'영어': 'en',
'이탈리아어': 'it',
'인도네시아어': 'id',
'... | [
"json.loads",
"json.dumps",
"fasttext.load_model",
"pprint.pprint",
"requests.post",
"re.sub",
"os.getenv",
"re.compile"
] | [((139, 173), 'fasttext.load_model', 'fasttext.load_model', (['"""lid.176.bin"""'], {}), "('lid.176.bin')\n", (158, 173), False, 'import fasttext\n'), ((1787, 1848), 'requests.post', 'requests.post', (['PAPAGO_ENDPOINT'], {'data': 'payload', 'headers': 'headers'}), '(PAPAGO_ENDPOINT, data=payload, headers=headers)\n', ... |
import smtplib, imaplib, ssl
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
def set_syspath():
from pathlib import Path
import os
import sys
root_directory = str(Path(os.path.abspath(__file__)).parent.parent.absolute())
if root_directory not in sys.path:
... | [
"imaplib.IMAP4_SSL",
"os.path.abspath",
"smtplib.SMTP_SSL",
"email.mime.text.MIMEText",
"db.get_email_template",
"ssl.create_default_context",
"db.config.read",
"sys.path.insert",
"email.mime.multipart.MIMEMultipart"
] | [((451, 497), 'db.get_email_template', 'db.get_email_template', (['"""client_email_template"""'], {}), "('client_email_template')\n", (472, 497), False, 'import db, db.config\n'), ((688, 733), 'db.get_email_template', 'db.get_email_template', (['"""admin_email_template"""'], {}), "('admin_email_template')\n", (709, 733... |
#!/usr/bin/env python
'''
Program: pgaws.py
Author: <NAME>
Created: 20170117
Modified: 20170117
Program creates connection to AWS RDS instance and returns cursor to the
instance and DB specified.
Most connection options kept in environment variables. Best practice would
be to encrypt these. That is a... | [
"os.getenv",
"psycopg2.connect"
] | [((1618, 1644), 'psycopg2.connect', 'psycopg2.connect', (['conn_str'], {}), '(conn_str)\n', (1634, 1644), False, 'import psycopg2\n'), ((805, 830), 'os.getenv', 'os.getenv', (['"""PGINST"""', 'None'], {}), "('PGINST', None)\n", (814, 830), False, 'import os\n'), ((888, 913), 'os.getenv', 'os.getenv', (['"""PGPORT"""', ... |
import os, sys
from os.path import join
ROOT_DIR = os.path.abspath(os.curdir)
if ROOT_DIR not in sys.path:
sys.path.append(ROOT_DIR)
sys.path.append(join(ROOT_DIR, 'opmatch'))
import match
import create_test_data
import numpy as np
from util import vis
X, y, ps = create_test_data.get_test_data(False, 30, 1, .1... | [
"sys.path.append",
"os.path.abspath",
"numpy.sum",
"util.vis.plot_matching",
"match.match",
"os.path.join",
"create_test_data.get_test_data"
] | [((51, 77), 'os.path.abspath', 'os.path.abspath', (['os.curdir'], {}), '(os.curdir)\n', (66, 77), False, 'import os, sys\n'), ((273, 323), 'create_test_data.get_test_data', 'create_test_data.get_test_data', (['(False)', '(30)', '(1)', '(0.15)'], {}), '(False, 30, 1, 0.15)\n', (303, 323), False, 'import create_test_data... |
# coding=utf-8
from OTLMOW.OTLModel.Datatypes.KeuzelijstField import KeuzelijstField
from OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde import KeuzelijstWaarde
# Generated with OTLEnumerationCreator. To modify: extend, do not edit
class KlLEGCOpeningType(KeuzelijstField):
"""Types van opening."""
naam = 'KlLEGCO... | [
"OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde.KeuzelijstWaarde"
] | [((656, 863), 'OTLMOW.OTLModel.Datatypes.KeuzelijstWaarde.KeuzelijstWaarde', 'KeuzelijstWaarde', ([], {'invulwaarde': '"""dienstopening"""', 'label': '"""dienstopening"""', 'definitie': '"""dienstopening"""', 'objectUri': '"""https://wegenenverkeer.data.vlaanderen.be/id/concept/KlLEGCOpeningType/dienstopening"""'}), "(... |
import matplotlib
matplotlib.use('Agg')
import argparse
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import subprocess
def setup_args():
parser = argparse.ArgumentParser()
parser._action_groups.pop()
requiredArguments = parser.add_argument_group('required arguments')
... | [
"os.getcwd",
"matplotlib.use",
"matplotlib.pyplot.subplots",
"argparse.ArgumentParser"
] | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((188, 213), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (211, 213), False, 'import argparse\n'), ((2740, 2754), 'matplotlib.pyplot.subplots', 'plt.subplots', ([], {}), ... |
# Generated by Django 4.0.1 on 2022-03-10 16:05
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Tasks',
fields=[
('id', mod... | [
"django.db.models.BigAutoField",
"django.db.models.DateTimeField",
"django.db.models.CharField"
] | [((317, 413), 'django.db.models.BigAutoField', 'models.BigAutoField', ([], {'auto_created': '(True)', 'primary_key': '(True)', 'serialize': '(False)', 'verbose_name': '"""ID"""'}), "(auto_created=True, primary_key=True, serialize=False,\n verbose_name='ID')\n", (336, 413), False, 'from django.db import migrations, m... |
import json
def bar(s):
return json.loads(s)
| [
"json.loads"
] | [((36, 49), 'json.loads', 'json.loads', (['s'], {}), '(s)\n', (46, 49), False, 'import json\n')] |
from setuptools import find_packages, setup
setup(
name='fel',
version='0.1.0',
description='Study of optimization methods for XFEL accelerator tuning.',
author='<NAME>, <NAME>',
license='MIT',
packages=find_packages('src'),
package_dir={'': 'src/'},
)
| [
"setuptools.find_packages"
] | [((217, 237), 'setuptools.find_packages', 'find_packages', (['"""src"""'], {}), "('src')\n", (230, 237), False, 'from setuptools import find_packages, setup\n')] |
import random as rd
class Method_Data:
data_dict={ 'nucleic':{'a':{'dna':'a','rna':'a'},
'g':{'dna':'g','rna':'g'},
'c':{'dna':'c','rna':'c'},
't':{'dna':'t','rna':'u'},
'u':{'dna':'t','rn... | [
"random.choice"
] | [((4379, 4408), 'random.choice', 'rd.choice', (['self.codon_pref_ls'], {}), '(self.codon_pref_ls)\n', (4388, 4408), True, 'import random as rd\n')] |
from apps.core.models import City, State
from rest_framework.response import Response
from rest_framework.permissions import IsAdminUser, IsAuthenticated
from rest_framework.views import APIView
from rest_framework import status
from apps.location.serializers.city_serializers import (
CitySerializer,
CreateCity... | [
"apps.location.validators.location_validators.state_is_valid_or_errors",
"apps.location.validators.location_validators.city_is_valid_or_errors",
"apps.location.serializers.city_serializers.CitySerializer",
"apps.core.models.State.objects.all",
"rest_framework.response.Response",
"apps.core.models.City.obj... | [((668, 687), 'apps.core.models.State.objects.all', 'State.objects.all', ([], {}), '()\n', (685, 687), False, 'from apps.core.models import City, State\n'), ((715, 749), 'apps.location.serializers.state_serializers.StateSerializer', 'StateSerializer', (['states'], {'many': '(True)'}), '(states, many=True)\n', (730, 749... |
from sys import argv
import getopt
import simulator
def convert_bool_value(opVal):
if opVal == "True":
return True
elif opVal == "False":
return False
else:
exit()
try:
optlist,args = getopt.getopt(argv[1:],'vt:', ["solar_panels=",
"smart_battery=",
"smart_home=... | [
"getopt.getopt",
"simulator.main"
] | [((900, 973), 'simulator.main', 'simulator.main', (['solar_panels', 'smart_battery', 'smart_home', 'look_ahead_depth'], {}), '(solar_panels, smart_battery, smart_home, look_ahead_depth)\n', (914, 973), False, 'import simulator\n'), ((226, 333), 'getopt.getopt', 'getopt.getopt', (['argv[1:]', '"""vt:"""', "['solar_panel... |
# coding: utf-8
from collections import defaultdict
from utils import dd_int, dd_float
__author__ = "<NAME>"
def _compute_window(idx, window_width, arr):
left_min = max(idx - window_width, 0)
left_max = idx
right_min = idx + 1
right_max = min(idx + window_width + 1, len(arr))
return arr[left_min... | [
"collections.defaultdict"
] | [((442, 461), 'collections.defaultdict', 'defaultdict', (['dd_int'], {}), '(dd_int)\n', (453, 461), False, 'from collections import defaultdict\n'), ((1001, 1022), 'collections.defaultdict', 'defaultdict', (['dd_float'], {}), '(dd_float)\n', (1012, 1022), False, 'from collections import defaultdict\n')] |
import os
import unittest
from os import environ
from pyramid.config import Configurator
from pyramid.paster import get_appsettings
from pyramid import testing
from pymongo import MongoClient
import prf
class PrfTestCase(unittest.TestCase):
def setUp(self):
test_ini_file = environ.get('INI_FILE', 'test.in... | [
"pyramid.testing.DummyRequest",
"prf.includeme",
"pyramid.testing.setUp",
"os.environ.get",
"pyramid.testing.tearDown",
"pyramid.paster.get_appsettings"
] | [((288, 323), 'os.environ.get', 'environ.get', (['"""INI_FILE"""', '"""test.ini"""'], {}), "('INI_FILE', 'test.ini')\n", (299, 323), False, 'from os import environ\n'), ((348, 385), 'pyramid.paster.get_appsettings', 'get_appsettings', (['test_ini_file', '"""prf"""'], {}), "(test_ini_file, 'prf')\n", (363, 385), False, ... |
"""vt_graph_api.node.
This module provides the Python object wrapper for
VTGraph node representation.
"""
import re
URL_RE = re.compile(r"https?://", re.IGNORECASE)
SHA1_RE = re.compile(r"^[0-9a-fA-F]{40}$")
MD5_RE = re.compile(r"^[0-9a-fA-F]{32}$")
SHA256_RE = re.compile(r"^[0-9a-fA-F]{64}$")
IPV4_RE = re.compile... | [
"re.compile"
] | [((130, 168), 're.compile', 're.compile', (['"""https?://"""', 're.IGNORECASE'], {}), "('https?://', re.IGNORECASE)\n", (140, 168), False, 'import re\n'), ((180, 211), 're.compile', 're.compile', (['"""^[0-9a-fA-F]{40}$"""'], {}), "('^[0-9a-fA-F]{40}$')\n", (190, 211), False, 'import re\n'), ((222, 253), 're.compile', ... |
import torch.nn as nn
from .helper import init, make_standard_block
import torch
class PAFModel(nn.Module):
def __init__(self, backend, backend_outp_feats, n_joints, n_paf, n_stages=7):
super(PAFModel, self).__init__()
assert (n_stages > 0)
self.backend = backend
stages = [Stage(ba... | [
"torch.nn.Conv2d",
"torch.cat",
"torch.nn.ModuleList",
"torch.nn.Sequential"
] | [((1971, 1993), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (1984, 1993), True, 'import torch.nn as nn\n'), ((2443, 2465), 'torch.nn.Sequential', 'nn.Sequential', (['*layers'], {}), '(*layers)\n', (2456, 2465), True, 'import torch.nn as nn\n'), ((499, 520), 'torch.nn.ModuleList', 'nn.Modul... |
from ..shuffleindex import Leaf, InnerNode
from collections import namedtuple
from datalayer import DataLayer
from array import array
import struct
_ENC = 'UTF-16LE' # little endian (LE) to remove the BOM character
_HEAD, _HSIZE = '<QQQ?', 128 # pack header as ID, PID, elems, is_leaf
_LEAF, _L... | [
"struct.calcsize",
"collections.namedtuple",
"array.array",
"struct.pack_into",
"struct.unpack_from"
] | [((724, 780), 'collections.namedtuple', 'namedtuple', (['"""_Header"""', "['ID', 'PID', 'elems', 'is_leaf']"], {}), "('_Header', ['ID', 'PID', 'elems', 'is_leaf'])\n", (734, 780), False, 'from collections import namedtuple\n'), ((481, 503), 'struct.calcsize', 'struct.calcsize', (['_HEAD'], {}), '(_HEAD)\n', (496, 503),... |
import requests
data = requests.get("http://dl.ppt123.net/pptbj/51/20181115/5plurgisrd4.jpg")
# 获取连接的资源
target = data.content
# 建立连接
value = open("../out/02.jpg", "wb")
# 创建输入的对象,使用二进制的形式写入
value.write(target)
# 写入对象
value.close()
# 关闭资源
| [
"requests.get"
] | [((24, 94), 'requests.get', 'requests.get', (['"""http://dl.ppt123.net/pptbj/51/20181115/5plurgisrd4.jpg"""'], {}), "('http://dl.ppt123.net/pptbj/51/20181115/5plurgisrd4.jpg')\n", (36, 94), False, 'import requests\n')] |
# -*- coding: utf-8 -*-
from setuptools import setup, find_packages
with open('requirements.txt', 'r') as fh:
requirements = fh.read().split('\n')
setup(
name='project',
packages=find_packages(),
version='0.1',
install_requires=requirements,
entry_points={
'console_scripts': ['project ... | [
"setuptools.find_packages"
] | [((193, 208), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (206, 208), False, 'from setuptools import setup, find_packages\n')] |
# -*- coding: utf-8 -*-
"""
Tencent is pleased to support the open source community by making BK-BASE 蓝鲸基础平台 available.
Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
BK-BASE 蓝鲸基础平台 is licensed under the MIT License.
License for BK-BASE 蓝鲸基础平台:
---------------------------------------------... | [
"json.loads",
"common.decorators.params_valid",
"common.base_utils.model_to_dict",
"datamanage.exceptions.ParamBlankError",
"gevent.monkey.patch_all",
"datamanage.utils.time_tools.tznow",
"datamanage.lite.dmonitor.flow_models.ProcessingBatchInfo.objects.all",
"rest_framework.response.Response",
"dat... | [((2155, 2210), 'common.decorators.params_valid', 'params_valid', ([], {'serializer': 'DmonitorBatchMonitorSerializer'}), '(serializer=DmonitorBatchMonitorSerializer)\n', (2167, 2210), False, 'from common.decorators import list_route, params_valid\n'), ((5491, 5538), 'common.decorators.list_route', 'list_route', ([], {... |
#todo chapter5. pandas 시작하기
from pandas import Series, DataFrame
import pandas as pd
import numpy as np
#todo 5.1 pandas 자료 구조 소개
'''
pandas 에 대해서 알아보려면 Series 와 DataFrame, 이 두 가지 자료 구조에 익숙해질 필요가 있다.
이 두 가지 자료 구조로 모든 문제를 해결할 수는 없지만 대부분의 애플리케이션에서 사용하기 쉽고 탄탄한 기반을 제공한다.
'''
#todo 5.1.1 Series
'''
Series 는 일련의... | [
"pandas.DataFrame",
"numpy.abs",
"numpy.random.randn",
"pandas.isnull",
"pandas.notnull",
"numpy.arange",
"numpy.exp",
"pandas.Series"
] | [((472, 493), 'pandas.Series', 'Series', (['[4, 7, -5, 3]'], {}), '([4, 7, -5, 3])\n', (478, 493), False, 'from pandas import Series, DataFrame\n'), ((791, 840), 'pandas.Series', 'Series', (['[4, 7, -5, 3]'], {'index': "['d', 'b', 'a', 'c']"}), "([4, 7, -5, 3], index=['d', 'b', 'a', 'c'])\n", (797, 840), False, 'from p... |
import io
import argparse
import json
import os
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = ""
def transcribe_gcs(gcs_uri):
from google.cloud import speech_v1p1beta1 as speech
client = speech.SpeechClient()
audio = speech.types.RecognitionAudio(uri=gcs_uri)
config = speech.types.RecognitionConf... | [
"google.cloud.speech_v1p1beta1.types.RecognitionAudio",
"google.cloud.speech_v1p1beta1.types.RecognitionConfig",
"argparse.ArgumentParser",
"google.cloud.speech_v1p1beta1.SpeechClient"
] | [((200, 221), 'google.cloud.speech_v1p1beta1.SpeechClient', 'speech.SpeechClient', ([], {}), '()\n', (219, 221), True, 'from google.cloud import speech_v1p1beta1 as speech\n'), ((235, 277), 'google.cloud.speech_v1p1beta1.types.RecognitionAudio', 'speech.types.RecognitionAudio', ([], {'uri': 'gcs_uri'}), '(uri=gcs_uri)\... |
import sys
import abc
import re
import random
from source_code_tokenizer.languages.python.regex import PyRegex
from source_code_tokenizer.languages.c.regex import CRegex
from source_code_tokenizer.languages.cpp.regex import CPPRegex
from source_code_tokenizer.languages.java.regex import JavaRegex
from source_code_token... | [
"source_code_tokenizer.languages.java.regex.JavaRegex",
"source_code_tokenizer.languages.python.regex.PyRegex",
"source_code_tokenizer.languages.js.regex.JSRegex",
"source_code_tokenizer.languages.c.regex.CRegex",
"source_code_tokenizer.languages.cpp.regex.CPPRegex",
"re.compile"
] | [((1542, 1586), 're.compile', 're.compile', (['self.TOKENIZED_STR', 're.MULTILINE'], {}), '(self.TOKENIZED_STR, re.MULTILINE)\n', (1552, 1586), False, 'import re\n'), ((5701, 5745), 're.compile', 're.compile', (['self.TOKENIZED_STR', 're.MULTILINE'], {}), '(self.TOKENIZED_STR, re.MULTILINE)\n', (5711, 5745), False, 'im... |
# -*- coding: utf-8 -*-
"""
Sends email with attachment to distribution list
"""
import smtplib
import pathlib
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication
from email.header import Header
fr... | [
"email.header.Header",
"smtplib.SMTP_SSL",
"pandas.read_csv",
"email.mime.text.MIMEText",
"decouple.config",
"email.mime.multipart.MIMEMultipart",
"pathlib.Path.cwd"
] | [((416, 436), 'decouple.config', 'config', (['"""EMAIL_USER"""'], {}), "('EMAIL_USER')\n", (422, 436), False, 'from decouple import config\n'), ((454, 478), 'decouple.config', 'config', (['"""EMAIL_PASSWORD"""'], {}), "('EMAIL_PASSWORD')\n", (460, 478), False, 'from decouple import config\n'), ((491, 509), 'pathlib.Pat... |
import argparse
import os
import torch
from repmlpnet import *
parser = argparse.ArgumentParser(description='RepMLPNet Conversion')
parser.add_argument('load', metavar='LOAD', help='path to the source weights file')
parser.add_argument('save', metavar='SAVE', help='path to the target weights file')
parser.add_argument... | [
"os.path.isfile",
"torch.load",
"argparse.ArgumentParser"
] | [((73, 132), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""RepMLPNet Conversion"""'}), "(description='RepMLPNet Conversion')\n", (96, 132), False, 'import argparse\n'), ((660, 685), 'os.path.isfile', 'os.path.isfile', (['args.load'], {}), '(args.load)\n', (674, 685), False, 'import os\n... |
import numpy as np
import matplotlib.pyplot as plt
x=np.array(["Anmol","Sushant","Arardhya","Aniket","Deepak"])
y=np.array([70,56,83,54,75])
'''plt.plot(x,np.sin(x),"y*")
plt.plot(x,np.cos(x),"b^")
plt.plot(x,np.tan(x),"r--")
plt.plot(x,x*2,"b")
plt.title("Graph")
plt.xlabel("x")
plt.ylabel("y")'''
z=np.array([40,85,62... | [
"numpy.array",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((53, 115), 'numpy.array', 'np.array', (["['Anmol', 'Sushant', 'Arardhya', 'Aniket', 'Deepak']"], {}), "(['Anmol', 'Sushant', 'Arardhya', 'Aniket', 'Deepak'])\n", (61, 115), True, 'import numpy as np\n'), ((114, 144), 'numpy.array', 'np.array', (['[70, 56, 83, 54, 75]'], {}), '([70, 56, 83, 54, 75])\n', (122, 144), Tr... |
'''OpenGL extension ANGLE.pack_reverse_row_order
This module customises the behaviour of the
OpenGL.raw.GLES2.ANGLE.pack_reverse_row_order to provide a more
Python-friendly API
Overview (from the spec)
This extension introduces a mechanism to allow reversing the order
in which image rows are written into a pack... | [
"OpenGL.extensions.hasGLExtension"
] | [((1468, 1510), 'OpenGL.extensions.hasGLExtension', 'extensions.hasGLExtension', (['_EXTENSION_NAME'], {}), '(_EXTENSION_NAME)\n', (1493, 1510), False, 'from OpenGL import extensions\n')] |
import math
from inspect import isfunction
import torch
from einops import rearrange
from torch import nn
def exists(x):
return x is not None
def default(val, d):
if exists(val):
return val
return d() if isfunction(d) else d
class Residual(nn.Module):
def __init__(self, fn):
super... | [
"torch.mean",
"torch.ones",
"torch.var",
"torch.nn.ConvTranspose2d",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.nn.Identity",
"torch.nn.GELU",
"torch.einsum",
"torch.nn.Linear",
"einops.rearrange",
"torch.arange",
"inspect.isfunction",
"torch.zeros",
"math.log"
] | [((912, 949), 'torch.nn.ConvTranspose2d', 'nn.ConvTranspose2d', (['dim', 'dim', '(4)', '(2)', '(1)'], {}), '(dim, dim, 4, 2, 1)\n', (930, 949), False, 'from torch import nn\n'), ((984, 1012), 'torch.nn.Conv2d', 'nn.Conv2d', (['dim', 'dim', '(4)', '(2)', '(1)'], {}), '(dim, dim, 4, 2, 1)\n', (993, 1012), False, 'from to... |
"""
PureExpressions detects functions without side-effects.
"""
from pythran.analyses.aliases import Aliases
from pythran.analyses.argument_effects import ArgumentEffects
from pythran.analyses.global_effects import GlobalEffects
from pythran.passmanager import ModuleAnalysis
from pythran.intrinsic import Intrinsic
im... | [
"gast.iter_child_nodes",
"gast.literal_eval"
] | [((923, 949), 'gast.iter_child_nodes', 'ast.iter_child_nodes', (['node'], {}), '(node)\n', (943, 949), True, 'import gast as ast\n'), ((1973, 1994), 'gast.literal_eval', 'ast.literal_eval', (['arg'], {}), '(arg)\n', (1989, 1994), True, 'import gast as ast\n')] |
# Copyright 1997 - 2018 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish,... | [
"ixnetwork_restpy.steps.Steps"
] | [((12699, 12710), 'ixnetwork_restpy.steps.Steps', 'Steps', (['self'], {}), '(self)\n', (12704, 12710), False, 'from ixnetwork_restpy.steps import Steps\n')] |
# ===============================================================================
#
# Copyright (c) 2013-2017 Qualcomm Technologies, Inc.
# All Rights Reserved.
# Confidential and Proprietary - Qualcomm Technologies, Inc.
#
# ===============================================================================
import os
... | [
"sectools.common.utils.c_misc.load_data_from_file",
"sectools.features.isc.signer.signerutils.test.intf.get_test_asset",
"sectools.common.utils.c_path.join",
"os.path.isfile",
"os.path.normpath",
"sectools.common.utils.c_path.validate_file",
"sectools.common.data_provisioning.data_prov.DataProvisioner",... | [((4200, 4234), 'os.path.normpath', 'os.path.normpath', (['self.dp_basepath'], {}), '(self.dp_basepath)\n', (4216, 4234), False, 'import os\n'), ((7395, 7443), 'os.path.join', 'os.path.join', (['query_result.path', 'asset_file_name'], {}), '(query_result.path, asset_file_name)\n', (7407, 7443), False, 'import os\n'), (... |
import colorsys
import copy
import os
import numpy as np
from PIL import Image
import cv2
from BASNET import ModelBASNet
# --------------------------------------------#
# 使用自己训练好的模型预测需要修改2个参数
# model_path和num_classes都需要修改!
# 如果出现shape不匹配
# 一定要注意训练时的model_path和num_classes数的修改
# ---------------------------------... | [
"PIL.Image.new",
"copy.deepcopy",
"numpy.uint8",
"colorsys.hsv_to_rgb",
"numpy.expand_dims",
"PIL.Image.open",
"numpy.array",
"BASNET.ModelBASNet",
"PIL.Image.blend",
"os.listdir"
] | [((5045, 5061), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (5055, 5061), False, 'import os\n'), ((5094, 5116), 'PIL.Image.open', 'Image.open', (['(path + png)'], {}), '(path + png)\n', (5104, 5116), False, 'from PIL import Image\n'), ((1192, 1226), 'BASNET.ModelBASNet', 'ModelBASNet', (['self.model_image_s... |
# ########################################################## ##
# FlatCAM: 2D Post-processing for Manufacturing #
# http://flatcam.org #
# Author: <NAME> (c) #
# Date: 2/5/2014 #
# MIT Lice... | [
"copy.deepcopy",
"shapely.geometry.Point",
"shapely.affinity.translate",
"shapely.affinity.scale",
"shapely.affinity.rotate",
"shapely.geometry.LineString",
"re.findall",
"traceback.format_exc",
"numpy.interp",
"shapely.affinity.skew",
"re.search",
"logging.getLogger",
"re.compile"
] | [((783, 808), 'logging.getLogger', 'logging.getLogger', (['"""base"""'], {}), "('base')\n", (800, 808), False, 'import logging\n'), ((3281, 3301), 'copy.deepcopy', 'deepcopy', (['self.zeros'], {}), '(self.zeros)\n', (3289, 3301), False, 'from copy import deepcopy\n'), ((4904, 4923), 're.compile', 're.compile', (['"""^M... |
#
# Collective Knowledge (individual environment - setup)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
import os
def setup(i):
env_prefix = i["customize"]["env_prefix"]
root_dir = os.path.dirname(os.path.dirname(i["customize"]["full_path"]))
i["env"][env_pre... | [
"os.path.dirname",
"os.path.join"
] | [((396, 439), 'os.path.join', 'os.path.join', (['root_dir', '"""ptd_client_server"""'], {}), "(root_dir, 'ptd_client_server')\n", (408, 439), False, 'import os\n'), ((482, 538), 'os.path.join', 'os.path.join', (['root_dir', '"""ptd_client_server"""', '"""client.py"""'], {}), "(root_dir, 'ptd_client_server', 'client.py'... |
import json
from django.http import HttpResponse, Http404
from django.shortcuts import redirect
from django.template import loader
from django.utils import timezone
from datetime import datetime, date, timedelta
from mycalendar.settings import TIME_ZONE
from .models import *
from .week_view import *
def current(req... | [
"datetime.datetime.fromisocalendar",
"django.shortcuts.redirect",
"django.utils.timezone.now",
"datetime.date",
"datetime.date.today",
"datetime.timedelta",
"django.http.Http404",
"datetime.datetime.now",
"django.template.loader.get_template"
] | [((412, 448), 'django.shortcuts.redirect', 'redirect', (["('y/%d/w/%d' % (year, week))"], {}), "('y/%d/w/%d' % (year, week))\n", (420, 448), False, 'from django.shortcuts import redirect\n'), ((1556, 1594), 'django.template.loader.get_template', 'loader.get_template', (['"""main/index.html"""'], {}), "('main/index.html... |
from collections import namedtuple
from pytest import approx, fixture, raises
from symplyphysics import (
units, convert_to, SI, errors
)
from symplyphysics.definitions import volume_number_density
@fixture
def test_args():
objects = 100
V = units.Quantity('V')
SI.set_quantity_dimension(V, units.volum... | [
"symplyphysics.SI.get_dimension_system",
"symplyphysics.definitions.volume_number_density.calculate_number_density",
"symplyphysics.convert_to",
"pytest.raises",
"symplyphysics.SI.set_quantity_dimension",
"collections.namedtuple",
"pytest.approx",
"symplyphysics.SI.set_quantity_scale_factor",
"sympl... | [((256, 275), 'symplyphysics.units.Quantity', 'units.Quantity', (['"""V"""'], {}), "('V')\n", (270, 275), False, 'from symplyphysics import units, convert_to, SI, errors\n'), ((280, 322), 'symplyphysics.SI.set_quantity_dimension', 'SI.set_quantity_dimension', (['V', 'units.volume'], {}), '(V, units.volume)\n', (305, 32... |
# Copyright (c) 2017 Red Hat, 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 writ... | [
"tripleo_common.utils.swift.create_container",
"tripleo_common.utils.swift.get_object_string",
"mock.call",
"mock.MagicMock",
"tripleo_common.utils.swift.put_object_string",
"tripleo_common.utils.swift.empty_container"
] | [((851, 867), 'mock.MagicMock', 'mock.MagicMock', ([], {}), '()\n', (865, 867), False, 'import mock\n'), ((1405, 1471), 'tripleo_common.utils.swift.empty_container', 'swift_utils.empty_container', (['self.swiftclient', 'self.container_name'], {}), '(self.swiftclient, self.container_name)\n', (1432, 1471), True, 'from t... |
#! /usr/bin/env python3
import rospy
import numpy as np
import sys
from geometry_msgs.msg import PoseWithCovarianceStamped
class SimBall:
def __init__(self):
rospy.init_node('ball_sim')
self.pub_frequency = 20
if len(sys.argv) > 1:
self.pub_frequency = int(sys.argv[1])
... | [
"numpy.random.randn",
"numpy.zeros",
"rospy.Publisher",
"rospy.Rate",
"rospy.is_shutdown",
"numpy.array",
"rospy.init_node",
"geometry_msgs.msg.PoseWithCovarianceStamped",
"numpy.random.rand"
] | [((173, 200), 'rospy.init_node', 'rospy.init_node', (['"""ball_sim"""'], {}), "('ball_sim')\n", (188, 200), False, 'import rospy\n'), ((418, 434), 'numpy.array', 'np.array', (['[2, 4]'], {}), '([2, 4])\n', (426, 434), True, 'import numpy as np\n'), ((460, 471), 'numpy.zeros', 'np.zeros', (['(2)'], {}), '(2)\n', (468, 4... |
# Generated by Django 3.1.4 on 2021-01-22 18:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('home', '0002_auto_20210123_0010'),
]
operations = [
migrations.AlterField(
model_name='alltask',
name='task_id',
... | [
"django.db.models.AutoField"
] | [((335, 386), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (351, 386), False, 'from django.db import migrations, models\n')] |
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from models.logistic import logistic
from models.toy_shallow_nn import toy_shallow_nn
from models.neural_network import neural_network
from models.summary import summary
from utils.datasets import load_cats
cats = os.getenv('CATS')
trai... | [
"utils.datasets.load_cats",
"models.neural_network.neural_network",
"models.summary.summary.set_accuracies",
"models.summary.summary.save_to_csv",
"os.path.join",
"os.getenv"
] | [((298, 315), 'os.getenv', 'os.getenv', (['"""CATS"""'], {}), "('CATS')\n", (307, 315), False, 'import os\n'), ((329, 359), 'os.path.join', 'os.path.join', (['cats', '"""train.h5"""'], {}), "(cats, 'train.h5')\n", (341, 359), False, 'import os\n'), ((372, 401), 'os.path.join', 'os.path.join', (['cats', '"""test.h5"""']... |
import torch
import torch.nn as nn
class BEGANDiscriminator(nn.Module):
def __init__(self, img_size, channels):
super(BEGANDiscriminator, self).__init__()
self.down = nn.Sequential(nn.Conv2d(channels, 64, 3, 2, 1), nn.ReLU())
self.down_size = img_size // 2
down_dim = 64 *... | [
"torch.nn.ReLU",
"torch.nn.BatchNorm1d",
"torch.nn.Conv2d",
"torch.nn.Upsample",
"torch.nn.Linear"
] | [((204, 236), 'torch.nn.Conv2d', 'nn.Conv2d', (['channels', '(64)', '(3)', '(2)', '(1)'], {}), '(channels, 64, 3, 2, 1)\n', (213, 236), True, 'import torch.nn as nn\n'), ((238, 247), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (245, 247), True, 'import torch.nn as nn\n'), ((387, 410), 'torch.nn.Linear', 'nn.Linear', ... |
import unittest
import torch
from models import encoders
from templates import ModelTestsMixin, FrozenLayerCheckMixin
class TestDenseEncoder(ModelTestsMixin, unittest.TestCase):
def setUp(self):
self.test_inputs = torch.randn(16, 1, 32, 32)
self.output_shape = torch.Size((16, 32))
self.n... | [
"models.encoders.DenseEncoder",
"models.encoders.StackedEncoder",
"torch.randn",
"models.encoders.ShallowEncoder",
"torch.Size"
] | [((230, 256), 'torch.randn', 'torch.randn', (['(16)', '(1)', '(32)', '(32)'], {}), '(16, 1, 32, 32)\n', (241, 256), False, 'import torch\n'), ((285, 305), 'torch.Size', 'torch.Size', (['(16, 32)'], {}), '((16, 32))\n', (295, 305), False, 'import torch\n'), ((325, 381), 'models.encoders.DenseEncoder', 'encoders.DenseEnc... |
from rest_framework import serializers
from model.models import Conference
class ConferenceListSerializer(serializers.ModelSerializer):
sponsors = serializers.ListField(required=False)
classifications = serializers.ListField(required=False)
class Meta:
model = Conference
fields = [
... | [
"rest_framework.serializers.ListField"
] | [((154, 191), 'rest_framework.serializers.ListField', 'serializers.ListField', ([], {'required': '(False)'}), '(required=False)\n', (175, 191), False, 'from rest_framework import serializers\n'), ((214, 251), 'rest_framework.serializers.ListField', 'serializers.ListField', ([], {'required': '(False)'}), '(required=Fals... |
from vedastr.utils import Registry
RECTIFICATORS = Registry('Rectificator')
| [
"vedastr.utils.Registry"
] | [((52, 76), 'vedastr.utils.Registry', 'Registry', (['"""Rectificator"""'], {}), "('Rectificator')\n", (60, 76), False, 'from vedastr.utils import Registry\n')] |
"""
The way matplotlib does text layout is counter-intuitive to some, so
this example is designed to make it a little clearer. The text is
aligned by it's bounding box (the rectangular box that surrounds the
ink rectangle). The order of operations is basically rotation then
alignment, rather than alignment then rotat... | [
"matplotlib.pyplot.subplot",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.yticks",
"matplotlib.pyplot.text",
"numpy.arange",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.grid"
] | [((1114, 1130), 'matplotlib.pyplot.subplot', 'plt.subplot', (['(211)'], {}), '(211)\n', (1125, 1130), True, 'import matplotlib.pyplot as plt\n'), ((1187, 1201), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(0)', '(5)'], {}), '(0, 5)\n', (1195, 1201), True, 'import matplotlib.pyplot as plt\n'), ((1241, 1270), 'matplotlib.py... |
'''
k Bandit problem
'''
import numpy as np
import matplotlib.pyplot as plt
class Bandit():
def __init__(self, k):
self.k = k # number of bandits
self.true_val = np.random.normal(0,1,self.k) # q*(a)
def reward(self, t):
return np.random.normal(self.true_val[t],1,1) #R_t
class Ag... | [
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"numpy.argmax",
"numpy.zeros",
"numpy.random.random",
"numpy.array",
"numpy.random.randint",
"numpy.random.normal",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel"
] | [((1187, 1201), 'numpy.zeros', 'np.zeros', (['(1000)'], {}), '(1000)\n', (1195, 1201), True, 'import numpy as np\n'), ((1435, 1452), 'matplotlib.pyplot.plot', 'plt.plot', (['rewards'], {}), '(rewards)\n', (1443, 1452), True, 'import matplotlib.pyplot as plt\n'), ((1453, 1472), 'matplotlib.pyplot.xlabel', 'plt.xlabel', ... |
#!/usr/bin/env python3
import zipfile
import re
import sys
# This parser is to parse bugreport logs and find Bugle health information
#unzip
log_file = open("helth_matrics.txt", "w+")
def unzip_log_file(logfile):
zip_ref = zipfile.ZipFile(logfile, 'r')
zip_ref.extractall(".")
zip_ref.close()
... | [
"zipfile.ZipFile",
"re.match",
"sys.exit"
] | [((233, 262), 'zipfile.ZipFile', 'zipfile.ZipFile', (['logfile', '"""r"""'], {}), "(logfile, 'r')\n", (248, 262), False, 'import zipfile\n'), ((480, 516), 're.match', 're.match', (['"""(.*)(B|b)ugle(.*)"""', 'bugle'], {}), "('(.*)(B|b)ugle(.*)', bugle)\n", (488, 516), False, 'import re\n'), ((5740, 5751), 'sys.exit', '... |
print('Importing dependencies...', end='')
import sys
sys.stdout.flush()
sys.path.append('/home/pi/.local/lib/python3.7/site-packages')
from time import sleep
import numpy as np
import board
import neopixel
import scara_arm as arm
import scara_imaging as imaging
print('done.')
def read_config(filen... | [
"sys.path.append",
"scara_arm.arm_deinit",
"scara_imaging.camera_init",
"scara_imaging.find_target",
"scara_arm.servo_calibration",
"time.sleep",
"scara_arm.arm_init",
"sys.stdout.flush",
"numpy.array",
"scara_imaging.calibrate_camera",
"scara_imaging.image_capture",
"neopixel.NeoPixel",
"nu... | [((56, 74), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (72, 74), False, 'import sys\n'), ((76, 138), 'sys.path.append', 'sys.path.append', (['"""/home/pi/.local/lib/python3.7/site-packages"""'], {}), "('/home/pi/.local/lib/python3.7/site-packages')\n", (91, 138), False, 'import sys\n'), ((9704, 9722), 's... |
import os
import logging
import warnings
logger = logging.getLogger(__name__)
warnings.simplefilter('ignore', UserWarning)
import torch
import torch.optim as optim
from torch.utils.data import DataLoader
from torchvision.utils import save_image
from lib import augmentation, build_dataset, teachaugment
from lib.util... | [
"torch.cuda.synchronize",
"lib.utils.lr_scheduler.MultiStepLRWithLinearWarmup",
"argparse.ArgumentParser",
"lib.teachaugment.TeachAugment",
"lib.augmentation.replay_buffer.ReplayBuffer",
"lib.losses.non_saturating_loss.NonSaturatingLoss",
"torch.no_grad",
"os.path.join",
"lib.build_dataset",
"warn... | [((51, 78), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (68, 78), False, 'import logging\n'), ((79, 123), 'warnings.simplefilter', 'warnings.simplefilter', (['"""ignore"""', 'UserWarning'], {}), "('ignore', UserWarning)\n", (100, 123), False, 'import warnings\n'), ((555, 580), 'torch.c... |
import json, struct
import numpy as np
from pandas import DataFrame
from collections import defaultdict
from tqdm import tqdm
from os.path import getsize
type_lookup = {
'float': 'f',
'int': 'i',
'uint32': 'I',
float: 'f',
int: 'i'
}
def reverse_dict(d):
'''
Retard function
'''
return dict(map(rever... | [
"pandas.DataFrame",
"tqdm.tqdm",
"json.load",
"os.path.getsize",
"struct.unpack"
] | [((1709, 1745), 'tqdm.tqdm', 'tqdm', (['log_entries'], {'total': 'num_entries'}), '(log_entries, total=num_entries)\n', (1713, 1745), False, 'from tqdm import tqdm\n'), ((2194, 2212), 'pandas.DataFrame', 'DataFrame', (['logdict'], {}), '(logdict)\n', (2203, 2212), False, 'from pandas import DataFrame\n'), ((452, 495), ... |
from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
from torch.autograd import Variable
import time
import os
import argparse
from torch.autograd import Function
import ssenet_resnet
import numpy as np
import cv2
import mat... | [
"os.mkdir",
"xlwt.Workbook",
"argparse.ArgumentParser",
"ActivationMap.GradCam",
"matplotlib.pyplot.figure",
"os.path.isfile",
"os.path.join",
"cv2.cvtColor",
"matplotlib.pyplot.imshow",
"SimpleITK.ReadImage",
"matplotlib.pyplot.close",
"numpy.transpose",
"torch.load",
"SimpleITK.GetArrayF... | [((536, 560), 'SimpleITK.ReadImage', 'sitk.ReadImage', (['img_path'], {}), '(img_path)\n', (550, 560), True, 'import SimpleITK as sitk\n'), ((667, 678), 'numpy.max', 'np.max', (['img'], {}), '(img)\n', (673, 678), True, 'import numpy as np\n'), ((693, 704), 'numpy.min', 'np.min', (['img'], {}), '(img)\n', (699, 704), T... |
'''
Adapted streaming code from Google, uses the gstreamer "api" in
this folder.
Inference times end up being faster than my own queue detection.
'''
import argparse
import time
import re
import svgwrite
import imp
import os
from edgetpu.detection.engine import DetectionEngine
# a streaming library for google
import gs... | [
"argparse.ArgumentParser",
"edgetpu.detection.engine.DetectionEngine",
"gstreamer.run_pipeline",
"time.monotonic",
"os.path.join",
"re.compile"
] | [((390, 418), 're.compile', 're.compile', (['"""\\\\s*(\\\\d+)(.+)"""'], {}), "('\\\\s*(\\\\d+)(.+)')\n", (400, 418), False, 'import re\n'), ((1966, 1991), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (1989, 1991), False, 'import argparse\n'), ((2665, 2692), 'edgetpu.detection.engine.Detectio... |
import datetime
from django.db import models
from django.utils import timezone
class Input(models.Model):
input_text = models.CharField(max_length=250)
def __str__(self):
return self.input_text
class Question(models.Model):
def was_published_recently(self):
return self.pub_date >= timez... | [
"django.db.models.CharField",
"datetime.timedelta",
"django.utils.timezone.now"
] | [((125, 157), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(250)'}), '(max_length=250)\n', (141, 157), False, 'from django.db import models\n'), ((315, 329), 'django.utils.timezone.now', 'timezone.now', ([], {}), '()\n', (327, 329), False, 'from django.utils import timezone\n'), ((332, 358), '... |
from django.shortcuts import render
from django.conf.urls import url
from . import views
from django.conf.urls.static import static
from django.conf import settings
urlpatterns=[
url(r'^$',views.index,name = 'index'),
url(r'^gallery/', views.gallery, name='gallery'),
url(r'^search/', views.search, name='se... | [
"django.conf.urls.url"
] | [((184, 220), 'django.conf.urls.url', 'url', (['"""^$"""', 'views.index'], {'name': '"""index"""'}), "('^$', views.index, name='index')\n", (187, 220), False, 'from django.conf.urls import url\n'), ((227, 274), 'django.conf.urls.url', 'url', (['"""^gallery/"""', 'views.gallery'], {'name': '"""gallery"""'}), "('^gallery... |
# -*- coding: utf-8 -*-
# <nbformat>3.0</nbformat>
# <codecell>
import numpy as np
# <codecell>
def SetInitialConditions(ICs, ICset = 'Howell', ICtestcase = 0, numPoints = 2000):
# user inputs
#ICset = 'Howell' # 'Sharp' 'Howell' 'Barbee'
#ICtestcase = 0
#numPoints = 2000
# assign simul... | [
"numpy.matrix",
"numpy.zeros",
"numpy.ones",
"numpy.array",
"numpy.linspace"
] | [((439, 493), 'numpy.linspace', 'np.linspace', (['(0)', "ICs[ICset]['T'][ICtestcase]", 'numPoints'], {}), "(0, ICs[ICset]['T'][ICtestcase], numPoints)\n", (450, 493), True, 'import numpy as np\n'), ((1243, 2435), 'numpy.matrix', 'np.matrix', (['[[0.994, 0.0, -2.1138987966945026, 5.43679543926019], [0.994, 0.0, -\n 2... |
import tkinter as tk
def button_pressed(button):
previous = equation.get()
equation.set(previous + button)
def clear_s():
equation.set('')
def equal():
try:
equation.set(eval(equation.get()))
except:
pass
Janela = tk.Tk()
Janela.title('tk calculator')
pixel = tk.PhotoImage(widt... | [
"tkinter.StringVar",
"tkinter.PhotoImage",
"tkinter.Button",
"tkinter.Entry",
"tkinter.Tk"
] | [((255, 262), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (260, 262), True, 'import tkinter as tk\n'), ((302, 334), 'tkinter.PhotoImage', 'tk.PhotoImage', ([], {'width': '(1)', 'height': '(1)'}), '(width=1, height=1)\n', (315, 334), True, 'import tkinter as tk\n'), ((388, 402), 'tkinter.StringVar', 'tk.StringVar', ([], {}... |
# -*- coding: utf-8 -*-
from smartPeak.io.SequenceWriter import SequenceWriter
from smartPeak.io.FileReaderOpenMS import FileReaderOpenMS
from . import data_dir
from smartPeak.core.RawDataHandler import RawDataHandler
from smartPeak.core.SequenceHandler import SequenceHandler
import copy
class TestSequenceWriter():
... | [
"smartPeak.core.RawDataHandler.RawDataHandler",
"copy.copy",
"smartPeak.io.SequenceWriter.SequenceWriter",
"smartPeak.io.FileReaderOpenMS.FileReaderOpenMS",
"smartPeak.core.SequenceHandler.SequenceHandler"
] | [((391, 408), 'smartPeak.core.SequenceHandler.SequenceHandler', 'SequenceHandler', ([], {}), '()\n', (406, 408), False, 'from smartPeak.core.SequenceHandler import SequenceHandler\n'), ((429, 445), 'smartPeak.io.SequenceWriter.SequenceWriter', 'SequenceWriter', ([], {}), '()\n', (443, 445), False, 'from smartPeak.io.Se... |
"""
python test_PETA.py -g 0 -c 61 -b 256 -m GoogLeNetSPP -w ../models/
python test_PETA.py -g 0 -c 61 -b 256 -m GoogLeNet -w ../models/
python test_PETA.py -g 0 -c 61 -b 256 -m GoogLeNet -w ../models/imagenet_models/GoogLeNet_PETA/binary61_depth
python test_PETA.py -g 1 -c 68 -b 256 -m OEDCGoogLeNetSPP -w ../models... | [
"keras.preprocessing.image.ImageDataGenerator",
"tqdm.tqdm",
"network.GoogLenetSPP.GoogLeNetSPP.build",
"numpy.save",
"argparse.ArgumentParser",
"network.GoogleLenet.GoogLeNet.build",
"keras.utils.multi_gpu_model",
"pandas.read_csv",
"numpy.zeros",
"re.match",
"network.OEDC_GoogLenetSPP.OEDCGoog... | [((1526, 1588), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""training of the WPAL..."""'}), "(description='training of the WPAL...')\n", (1549, 1588), False, 'import argparse\n'), ((2846, 2868), 'numpy.zeros', 'np.zeros', (['(class_num,)'], {}), '((class_num,))\n', (2854, 2868), True, ... |
import urlparse, urllib
def fixurl(url):
# turn string into unicode
if not isinstance(url,unicode):
url = url.decode('utf8')
# parse it
parsed = urlparse.urlsplit(url)
# divide the netloc further
userpass,at,hostport = parsed.netloc.rpartition('@')
user,colon1,pass_ = userpass.par... | [
"urlparse.urlunsplit",
"urllib.unquote",
"urlparse.urlsplit"
] | [((171, 193), 'urlparse.urlsplit', 'urlparse.urlsplit', (['url'], {}), '(url)\n', (188, 193), False, 'import urlparse, urllib\n'), ((1113, 1173), 'urlparse.urlunsplit', 'urlparse.urlunsplit', (['(scheme, netloc, path, query, fragment)'], {}), '((scheme, netloc, path, query, fragment))\n', (1132, 1173), False, 'import u... |
# -*- coding: utf-8 -*-
import os
class Config(object):
DEBUG = True if os.environ.get("DEBUG", None) else False
SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:'
SQLALCHEMY_TRACK_MODIFICATIONS = False
ALPHA_API_KEY = os.environ.get("ALPHA_API_KEY", None)
class DevelopmentConfig(Config):
DEBUG = Tr... | [
"os.environ.get"
] | [((233, 270), 'os.environ.get', 'os.environ.get', (['"""ALPHA_API_KEY"""', 'None'], {}), "('ALPHA_API_KEY', None)\n", (247, 270), False, 'import os\n'), ((78, 107), 'os.environ.get', 'os.environ.get', (['"""DEBUG"""', 'None'], {}), "('DEBUG', None)\n", (92, 107), False, 'import os\n')] |
# Copyright 2022 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | [
"tensorflow.python.util.nest.flatten_with_joined_string_paths",
"tensorflow.python.ops.embedding_ops.embedding_lookup_v2",
"tensorflow.python.ops.array_ops.slice",
"tensorflow.python.ops.array_ops.reshape",
"tensorflow.python.tpu.tpu.outside_compilation",
"tensorflow.python.util.nest.flatten",
"tensorfl... | [((1634, 1688), 'tensorflow.python.util.tf_export.tf_export', 'tf_export', (['"""tpu.experimental.embedding.TPUEmbeddingV0"""'], {}), "('tpu.experimental.embedding.TPUEmbeddingV0')\n", (1643, 1688), False, 'from tensorflow.python.util.tf_export import tf_export\n'), ((5546, 5590), 'tensorflow.python.distribute.distribu... |
#!/usr/bin/env python
"""
mbed SDK
Copyright (c) 2011-2018 ARM Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable ... | [
"argparse.ArgumentParser",
"pkg_resources.require",
"os.path.exists",
"prettytable.PrettyTable",
"sys.exit"
] | [((1777, 1797), 'prettytable.PrettyTable', 'PrettyTable', (['columns'], {}), '(columns)\n', (1788, 1797), False, 'from prettytable import PrettyTable\n'), ((3984, 4062), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""fastmodel agent command line interface."""'}), "(description='fastmodel... |
"""
Adapted from https://gist.github.com/grantjenks/095de18c51fa8f118b68be80a624c45a
"""
import importlib
import os
import socketserver
import stat
import sys
from types import ModuleType
from xmlrpc.server import SimpleXMLRPCDispatcher, SimpleXMLRPCRequestHandler
# Make sure the current working directory is added to... | [
"bundle.submit",
"xmlrpc.server.SimpleXMLRPCDispatcher.__init__",
"os.chmod",
"os.getcwd",
"bundle.delete",
"socketserver.UnixStreamServer.__init__",
"bundle.status",
"importlib.reload",
"bundle.cancel",
"bundle.working_directory"
] | [((380, 391), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (389, 391), False, 'import os\n'), ((1495, 1519), 'importlib.reload', 'importlib.reload', (['module'], {}), '(module)\n', (1511, 1519), False, 'import importlib\n'), ((2473, 2497), 'importlib.reload', 'importlib.reload', (['module'], {}), '(module)\n', (2489, 24... |
from django.db import models
from django.db.models import UniqueConstraint
from users.models import CustomUser
class RatingManager(models.Manager):
def get_user_star(self, item, user):
user_star_if_exist = self.only('star').filter(item=item, user=user).first()
if user_star_if_exist:
r... | [
"django.db.models.ForeignKey",
"django.db.models.UniqueConstraint",
"django.db.models.PositiveSmallIntegerField"
] | [((592, 679), 'django.db.models.PositiveSmallIntegerField', 'models.PositiveSmallIntegerField', ([], {'verbose_name': '"""Оценка"""', 'choices': 'choices', 'default': '(0)'}), "(verbose_name='Оценка', choices=choices,\n default=0)\n", (624, 679), False, 'from django.db import models\n'), ((687, 800), 'django.db.mode... |
def sanitize(string):
"""
Ensure that the text does not contain any malicious HTML code which might
break the page.
"""
from html5lib import parseFragment, serialize
parsed = parseFragment(string)
clean = serialize(parsed, sanitize=True, omit_optional_tags=False,
quote... | [
"html5lib.serialize",
"html5lib.parseFragment"
] | [((200, 221), 'html5lib.parseFragment', 'parseFragment', (['string'], {}), '(string)\n', (213, 221), False, 'from html5lib import parseFragment, serialize\n'), ((234, 324), 'html5lib.serialize', 'serialize', (['parsed'], {'sanitize': '(True)', 'omit_optional_tags': '(False)', 'quote_attr_values': '"""always"""'}), "(pa... |
from __future__ import division
from itertools import product
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
__alll__ = [
"datasets_from_frame", "categorical_longform", "continuous_longform",
"plot_categorical_diff", "plot_continuous_diff", "TrainTestDiff"
]
def... | [
"pandas.DataFrame",
"numpy.ceil",
"seaborn.factorplot",
"numpy.empty",
"seaborn.barplot",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.subplots_adjust",
"pandas.concat",
"numpy.repeat"
] | [((1823, 1837), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (1835, 1837), True, 'import pandas as pd\n'), ((1860, 1893), 'numpy.repeat', 'np.repeat', (['name', 'dataset.shape[0]'], {}), '(name, dataset.shape[0])\n', (1869, 1893), True, 'import numpy as np\n'), ((1916, 1952), 'numpy.repeat', 'np.repeat', (['fe... |
# -*- coding: utf-8 -*-
# Local imports
from cpenv import paths
from . import data_path
from .utils import make_files
def test_exclusive_walk_includes_prebuilt_pyc():
'''Ensure exclusive_walk keeps prebuilt .pyc files'''
source_files = [
data_path('paths/source/A.pyc'),
data_path('paths/sour... | [
"cpenv.paths.normalize"
] | [((760, 787), 'cpenv.paths.normalize', 'paths.normalize', (['root', 'file'], {}), '(root, file)\n', (775, 787), False, 'from cpenv import paths\n')] |
import numpy as np
def load_train_data(dim):
from tensorflow.keras.datasets import mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
x_train_convert = [convert_pic(data,dim) for data in x_train]
x_test_convert = [convert_pic(data,dim) for data in x_test]
return (np.array(x_train_convert),y_train),(... | [
"cv2.imread",
"numpy.array",
"cv2.resize",
"tensorflow.keras.datasets.mnist.load_data"
] | [((132, 149), 'tensorflow.keras.datasets.mnist.load_data', 'mnist.load_data', ([], {}), '()\n', (147, 149), False, 'from tensorflow.keras.datasets import mnist\n'), ((402, 453), 'cv2.resize', 'cv2.resize', (['data', 'dim'], {'interpolation': 'cv2.INTER_AREA'}), '(data, dim, interpolation=cv2.INTER_AREA)\n', (412, 453),... |
from napari import Viewer
def test_multi_viewers_dont_clash(qapp):
v1 = Viewer(show=False, title='v1')
v2 = Viewer(show=False, title='v2')
assert not v1.grid.enabled
assert not v2.grid.enabled
v1.window.activate() # a click would do this in the actual gui
v1.window._qt_viewer.viewerButtons.g... | [
"napari.Viewer"
] | [((78, 108), 'napari.Viewer', 'Viewer', ([], {'show': '(False)', 'title': '"""v1"""'}), "(show=False, title='v1')\n", (84, 108), False, 'from napari import Viewer\n'), ((118, 148), 'napari.Viewer', 'Viewer', ([], {'show': '(False)', 'title': '"""v2"""'}), "(show=False, title='v2')\n", (124, 148), False, 'from napari im... |
# Generated by Django 2.2.19 on 2021-03-17 17:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('inspire_eu', '0002_inspire_eu_core'),
]
operations = [
migrations.RenameField(
model_name='cadastralparcel',
old_name='nati... | [
"django.db.migrations.RenameField"
] | [((228, 366), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""cadastralparcel"""', 'old_name': '"""national_cadastal_reference"""', 'new_name': '"""national_cadastral_reference"""'}), "(model_name='cadastralparcel', old_name=\n 'national_cadastal_reference', new_name='national_c... |
import logging
import logging.config
import os
import pathlib
import pprint
import sys
import typing
import services.pv_simulator.constants as constants
def initialize_loggers(current_dir_path: pathlib.Path) -> logging.Logger:
print("initialize_loggers()")
logging_leve: int = constants\
.LOGGING_LEVE... | [
"logging.config.dictConfig",
"os.getenv",
"pprint.pprint",
"logging.getLogger"
] | [((1026, 1058), 'pprint.pprint', 'pprint.pprint', (['constants.LOGGING'], {}), '(constants.LOGGING)\n', (1039, 1058), False, 'import pprint\n'), ((1063, 1107), 'logging.config.dictConfig', 'logging.config.dictConfig', (['constants.LOGGING'], {}), '(constants.LOGGING)\n', (1088, 1107), False, 'import logging\n'), ((1126... |
#!/usr/bin/python3
'''
This module is the manager of threadings locks.
A LockMgr manages multiple threadings locks.
'''
import threading
class LockMgr:
def __init__(self):
# self.locks will store multiple locks by their names.
self.locks = {}
# the lock of self.locks, is to ensure that ... | [
"threading.Lock"
] | [((393, 409), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (407, 409), False, 'import threading\n'), ((595, 611), 'threading.Lock', 'threading.Lock', ([], {}), '()\n', (609, 611), False, 'import threading\n')] |
'''Functions for estimating an adjustment to the posterior prediction
over subtypes when making predictions online.
Author: <NAME>
'''
import numpy as np
import logging
from scipy.optimize import minimize
from scipy.misc import logsumexp
class OnlineAdjustment:
def __init__(self, model, penalty, seed=0):
... | [
"scipy.optimize.minimize",
"numpy.zeros_like",
"numpy.log",
"numpy.zeros",
"numpy.ones",
"scipy.misc.logsumexp",
"numpy.array",
"numpy.exp",
"numpy.dot",
"numpy.round"
] | [((827, 881), 'scipy.optimize.minimize', 'minimize', (['f', 'w0'], {'jac': 'g', 'method': '"""BFGS"""', 'options': 'options'}), "(f, w0, jac=g, method='BFGS', options=options)\n", (835, 881), False, 'from scipy.optimize import minimize\n'), ((1054, 1065), 'numpy.array', 'np.array', (['p'], {}), '(p)\n', (1062, 1065), T... |
# -*- coding: utf-8 -*-
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
import xml.etree.ElementTree as et
CLASSES = ('ore carrier', 'bulk cargo carrier', 'container ship',
'general cargo ship', 'fishing boat', 'passenger ship')
class BboxAnalyze:
def __init__(self, data_root,... | [
"matplotlib.pyplot.show",
"matplotlib.pyplot.hist",
"numpy.argmax",
"numpy.histogram",
"numpy.array",
"matplotlib.pyplot.xticks",
"os.path.join",
"numpy.concatenate"
] | [((4887, 4915), 'numpy.concatenate', 'np.concatenate', (['bbox'], {'axis': '(0)'}), '(bbox, axis=0)\n', (4901, 4915), True, 'import numpy as np\n'), ((4932, 4961), 'numpy.concatenate', 'np.concatenate', (['label'], {'axis': '(0)'}), '(label, axis=0)\n', (4946, 4961), True, 'import numpy as np\n'), ((416, 439), 'os.path... |
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import os
import re
import shlex
import sys
import time
from configparser import ConfigParser
from contextlib import suppress
from inspect import stack, FrameInfo
from io import TextIOBase
from math import log
from pathlib import Path
from queue import Queue, Empty
from se... | [
"threading.Thread",
"os.get_terminal_size",
"contextlib.suppress",
"time.time",
"math.log",
"pathlib.Path",
"select.select",
"sys.stdout.isatty",
"sys.stdout.flush",
"typing.TypeVar",
"colorama.ansi.clear_line",
"inspect.stack",
"queue.Queue",
"re.compile"
] | [((575, 603), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {'bound': 'Hashable'}), "('T', bound=Hashable)\n", (582, 603), False, 'from typing import Hashable, Any, Dict, Set, List, Iterable, TypeVar, Iterator, Tuple, Optional, Union, IO\n'), ((1869, 1939), 're.compile', 're.compile', (['"""(?P<option>[^=\\\\n\\\\s]+)\\\\... |
import pandas as pd
def getSpiritual():
df = pd.read_csv('./data/spiritual.csv')
return df
resp = getSpiritual()
print(f"DataFrame = {resp}") | [
"pandas.read_csv"
] | [((50, 85), 'pandas.read_csv', 'pd.read_csv', (['"""./data/spiritual.csv"""'], {}), "('./data/spiritual.csv')\n", (61, 85), True, 'import pandas as pd\n')] |
import pandas as pd
import numpy as np
# some helper methods mostly to improve legibility in main notebooks
def load_wdi(data_path='../data/wdi/WDIData.csv', series_path='../data/wdi/WDISeries.csv'):
return pd.read_csv(data_path, low_memory=False), pd.read_csv(series_path, low_memory=False)
def project_size_USD_cal... | [
"pandas.read_csv",
"numpy.any",
"numpy.average",
"pandas.to_datetime"
] | [((1083, 1123), 'pandas.read_csv', 'pd.read_csv', (['data_path'], {'low_memory': '(False)'}), '(data_path, low_memory=False)\n', (1094, 1123), True, 'import pandas as pd\n'), ((1981, 2049), 'pandas.to_datetime', 'pd.to_datetime', (['df[start_date_col]'], {'format': '"""%d%b%Y"""', 'errors': '"""coerce"""'}), "(df[start... |
#---------------------------------------------------------------------------------------------------------------#
#Chapter 4 Building a "fake news" classifier
#---------------------------------------------------------------------------------------------------------------#
#CountVectorizer for text classifica... | [
"sklearn.feature_extraction.text.CountVectorizer",
"sklearn.naive_bayes.MultinomialNB",
"sklearn.feature_extraction.text.TfidfVectorizer",
"sklearn.model_selection.train_test_split",
"sklearn.metrics.accuracy_score",
"sklearn.metrics.confusion_matrix"
] | [((647, 711), 'sklearn.model_selection.train_test_split', 'train_test_split', (["df['text']", 'y'], {'test_size': '(0.33)', 'random_state': '(53)'}), "(df['text'], y, test_size=0.33, random_state=53)\n", (663, 711), False, 'from sklearn.model_selection import train_test_split\n'), ((791, 828), 'sklearn.feature_extracti... |
import click
import asyncio
import aiohttp
import csv
import json
import sys
from toolz import curry, identity, dissoc
def _safe_json_parse(record):
try:
return json.loads(record)
except json.JSONDecodeError:
return record
def _csv_reader(file_handle, delimiter=","):
return csv.reader(f... | [
"csv.reader",
"asyncio.get_event_loop",
"json.loads",
"csv.writer",
"csv.DictReader",
"click.option",
"click.File",
"json.dumps",
"click.command",
"aiohttp.ClientSession",
"click.Choice",
"toolz.curry",
"toolz.dissoc",
"asyncio.Queue",
"sys.exit",
"csv.DictWriter"
] | [((7242, 7257), 'click.command', 'click.command', ([], {}), '()\n', (7255, 7257), False, 'import click\n'), ((7545, 7674), 'click.option', 'click.option', (['"""--num-tasks"""', '"""-n"""'], {'type': 'int', 'default': '(1)', 'help': '"""The number of async tasks to issue requests from. Default: 1."""'}), "('--num-tasks... |
import os
class OfflineConfiguration:
SQLALCHEMY_DATABASE_URI = f"mysql://{os.environ.get('parsyLocalUser')}:{os.environ.get('parsyLocalPassword')}@localhost/myAssist"
SQLALCHEMY_TRACK_MODIFICATIONS = False
'''class OnlineConfiguration:
SQLALCHEMY_DATABASE_URI = f"mysql://{os.environ.get('parsyProdUser')}... | [
"os.environ.get"
] | [((80, 112), 'os.environ.get', 'os.environ.get', (['"""parsyLocalUser"""'], {}), "('parsyLocalUser')\n", (94, 112), False, 'import os\n'), ((115, 151), 'os.environ.get', 'os.environ.get', (['"""parsyLocalPassword"""'], {}), "('parsyLocalPassword')\n", (129, 151), False, 'import os\n'), ((518, 548), 'os.environ.get', 'o... |
from django.urls import path
from .views import send_webhook, viber_check_webhook
urlpatterns = [
path('send_webhook', send_webhook, name='send_webhook'),
path('viber_check_webhook', viber_check_webhook, name='viber_check_webhook'),
]
| [
"django.urls.path"
] | [((103, 158), 'django.urls.path', 'path', (['"""send_webhook"""', 'send_webhook'], {'name': '"""send_webhook"""'}), "('send_webhook', send_webhook, name='send_webhook')\n", (107, 158), False, 'from django.urls import path\n'), ((164, 240), 'django.urls.path', 'path', (['"""viber_check_webhook"""', 'viber_check_webhook'... |
#!/usr/bin/env python
"""
Generate molecules for test system using OpenEye tools.
"""
molecules = { 'BEN' : 'benzene',
'TOL' : 'toluene' }
from openeye import oechem
from openeye import oeomega
from openeye import oeiupac
from openeye import oequacpac
# Create molecules.
for resname in molecules:
... | [
"openeye.oeomega.OEOmega",
"openeye.oechem.OETriposAtomNames",
"openeye.oeiupac.OEParseIUPACName",
"openeye.oechem.OEMol",
"openeye.oechem.oemolostream",
"openeye.oechem.OEWriteMolecule",
"openeye.oechem.OEAddExplicitHydrogens",
"openeye.oechem.OEAssignAromaticFlags",
"openeye.oequacpac.OEAssignPart... | [((418, 432), 'openeye.oechem.OEMol', 'oechem.OEMol', ([], {}), '()\n', (430, 432), False, 'from openeye import oechem\n'), ((437, 477), 'openeye.oeiupac.OEParseIUPACName', 'oeiupac.OEParseIUPACName', (['molecule', 'name'], {}), '(molecule, name)\n', (461, 477), False, 'from openeye import oeiupac\n'), ((537, 576), 'op... |
import speech_recognition as sr
from os import path
from pydub import AudioSegment
# convert mp3 file to wav
sound = AudioSegment.from_mp3("transcript.mp3")
sound.export("transcript.wav", format="wav")
# transcribe audio file ... | [
"pydub.AudioSegment.from_mp3",
"speech_recognition.AudioFile",
"speech_recognition.Recognizer"
] | [((178, 217), 'pydub.AudioSegment.from_mp3', 'AudioSegment.from_mp3', (['"""transcript.mp3"""'], {}), "('transcript.mp3')\n", (199, 217), False, 'from pydub import AudioSegment\n'), ((470, 485), 'speech_recognition.Recognizer', 'sr.Recognizer', ([], {}), '()\n', (483, 485), True, 'import speech_recognition as sr\n'), (... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# MIT License
#
# Copyright (c) 2021 Pagliacii
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitat... | [
"functools.partial"
] | [((1792, 1832), 'functools.partial', 'partial', (['self.additional_text', 'font_size'], {}), '(self.additional_text, font_size)\n', (1799, 1832), False, 'from functools import partial\n')] |
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean CLI v1.0. Copyright 2021 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache... | [
"responses.RequestsMock",
"lean.container.container.traverse",
"pathlib.Path.home",
"os.path.dirname",
"pytest.fixture",
"lean.container.container.reset_override",
"lean.container.container.reset_singletons",
"certifi.where"
] | [((1000, 1028), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (1014, 1028), False, 'import pytest\n'), ((2138, 2166), 'pytest.fixture', 'pytest.fixture', ([], {'autouse': '(True)'}), '(autouse=True)\n', (2152, 2166), False, 'import pytest\n'), ((2428, 2456), 'pytest.fixture', 'pyt... |
from metatools.deprecate import module_renamed
module_renamed('.new')
| [
"metatools.deprecate.module_renamed"
] | [((47, 69), 'metatools.deprecate.module_renamed', 'module_renamed', (['""".new"""'], {}), "('.new')\n", (61, 69), False, 'from metatools.deprecate import module_renamed\n')] |
#!/usr/bin/env python3
# Run make build-standalone_build-all first
import os
import re
import shutil
import subprocess
from common import benchmark_utils
from experiment import runner
# Clean and create out directory
OUT_DIR = os.path.abspath("./benchmarks_bin/")
if os.path.isdir(OUT_DIR):
shutil.rmtree(OUT_DIR... | [
"subprocess.run",
"os.path.abspath",
"os.makedirs",
"os.path.isdir",
"experiment.runner._clean_seed_corpus",
"re.findall",
"common.benchmark_utils.get_fuzz_target",
"shutil.rmtree",
"os.path.join",
"os.listdir"
] | [((231, 267), 'os.path.abspath', 'os.path.abspath', (['"""./benchmarks_bin/"""'], {}), "('./benchmarks_bin/')\n", (246, 267), False, 'import os\n'), ((271, 293), 'os.path.isdir', 'os.path.isdir', (['OUT_DIR'], {}), '(OUT_DIR)\n', (284, 293), False, 'import os\n'), ((322, 342), 'os.makedirs', 'os.makedirs', (['OUT_DIR']... |
###############################################################################
# WaterTAP Copyright (c) 2021, The Regents of the University of California,
# through Lawrence Berkeley National Laboratory, Oak Ridge National
# Laboratory, National Renewable Energy Laboratory, and National Energy
# Technology Laboratory ... | [
"watertap.core.build_sido_reactive",
"pyomo.environ.Var",
"watertap.core.ZeroOrderBaseData.CONFIG",
"pyomo.environ.units.convert",
"idaes.core.declare_process_block_class"
] | [((1048, 1087), 'idaes.core.declare_process_block_class', 'declare_process_block_class', (['"""CANDOPZO"""'], {}), "('CANDOPZO')\n", (1075, 1087), False, 'from idaes.core import declare_process_block_class\n'), ((1204, 1230), 'watertap.core.ZeroOrderBaseData.CONFIG', 'ZeroOrderBaseData.CONFIG', ([], {}), '()\n', (1228,... |
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 26 21:07:22 2020
@author: DINGMAN
"""
import tkinter as tk
from user_interface import Setting
from monitoring_scan import Monitoring
from sensor import Sensor
from scan import Scan
from subprocess import call
class Run():
def __init__(self):
... | [
"scan.Scan",
"monitoring_scan.Monitoring",
"subprocess.call",
"sensor.Sensor",
"user_interface.Setting",
"tkinter.Tk"
] | [((338, 345), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (343, 345), True, 'import tkinter as tk\n'), ((370, 388), 'user_interface.Setting', 'Setting', (['self.root'], {}), '(self.root)\n', (377, 388), False, 'from user_interface import Setting\n'), ((2899, 2905), 'scan.Scan', 'Scan', ([], {}), '()\n', (2903, 2905), Fals... |