code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*-coding:Utf-8 -*
# Copyright (c) 2010-2017 <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# raise o... | [
"primaires.interpreteur.masque.parametre.Parametre.__init__"
] | [((1844, 1885), 'primaires.interpreteur.masque.parametre.Parametre.__init__', 'Parametre.__init__', (['self', '"""tenir"""', '"""hold"""'], {}), "(self, 'tenir', 'hold')\n", (1862, 1885), False, 'from primaires.interpreteur.masque.parametre import Parametre\n')] |
# Generated by Django 2.2.2 on 2019-06-14 14:37
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Card',
fields=[
('id', models.AutoField(pri... | [
"django.db.models.CharField",
"django.db.models.BooleanField",
"django.db.models.AutoField"
] | [((300, 351), 'django.db.models.AutoField', 'models.AutoField', ([], {'primary_key': '(True)', 'serialize': '(False)'}), '(primary_key=True, serialize=False)\n', (316, 351), False, 'from django.db import migrations, models\n'), ((379, 435), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)', '... |
import json
from django.core.paginator import Paginator
from django.shortcuts import render, redirect
from django.contrib import messages
from django.utils.translation import gettext as _
from .forms import (
OnboardingRegistrationForm,
OnboardingCreateTrustChain,
OnboardingValidatingTrustMarkForm
)
from .... | [
"spid_cie_oidc.entity.jwks.new_rsa_key",
"spid_cie_oidc.entity.jwks.private_pem_from_jwk",
"json.loads",
"spid_cie_oidc.entity.jwtse.unpad_jwt_head",
"django.utils.translation.gettext",
"django.shortcuts.redirect",
"spid_cie_oidc.authority.views.resolve_entity_statement",
"spid_cie_oidc.entity.jwks.pu... | [((707, 749), 'django.shortcuts.render', 'render', (['request', '"""onboarding_landing.html"""'], {}), "(request, 'onboarding_landing.html')\n", (713, 749), False, 'from django.shortcuts import render, redirect\n'), ((1277, 1333), 'django.shortcuts.render', 'render', (['request', '"""onboarding_registration.html"""', '... |
"""Implements Comet Logger."""
from abc import ABC
from typing import TYPE_CHECKING, List
from torchflare.callbacks.callback import Callbacks
from torchflare.callbacks.states import CallbackOrder
from torchflare.utils.imports_check import module_available
if TYPE_CHECKING:
from torchflare.experiments.experiment ... | [
"comet_ml.Experiment",
"torchflare.utils.imports_check.module_available"
] | [((352, 379), 'torchflare.utils.imports_check.module_available', 'module_available', (['"""come_ml"""'], {}), "('come_ml')\n", (368, 379), False, 'from torchflare.utils.imports_check import module_available\n'), ((2061, 2207), 'comet_ml.Experiment', 'comet_ml.Experiment', ([], {'project_name': 'self.project_name', 'api... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
from shutil import copyfile
class Task(object):
"""
Documentation: https://docs.droppyapp.com/tasks/filter-by-extensions
"""
def __init__(self, input_dir, output_dir, **kwargs):
# Get keyword arguments... | [
"os.path.isdir",
"os.walk",
"os.path.isfile",
"os.path.splitext",
"shutil.copyfile",
"os.path.join",
"os.listdir"
] | [((464, 485), 'os.listdir', 'os.listdir', (['input_dir'], {}), '(input_dir)\n', (474, 485), False, 'import os\n'), ((1630, 1663), 'os.path.splitext', 'os.path.splitext', (['full_input_path'], {}), '(full_input_path)\n', (1646, 1663), False, 'import os\n'), ((511, 545), 'os.path.join', 'os.path.join', (['input_dir', 'it... |
from __future__ import unicode_literals, print_function
from netmiko import Netmiko
from getpass import getpass
from jinja2 import FileSystemLoader, StrictUndefined
from jinja2.environment import Environment
password = getpass()
env = Environment()
env.loader = FileSystemLoader('.')
cisco3 = {
"host": 'cisco3.lasth... | [
"getpass.getpass",
"jinja2.FileSystemLoader",
"jinja2.environment.Environment",
"netmiko.Netmiko"
] | [((219, 228), 'getpass.getpass', 'getpass', ([], {}), '()\n', (226, 228), False, 'from getpass import getpass\n'), ((235, 248), 'jinja2.environment.Environment', 'Environment', ([], {}), '()\n', (246, 248), False, 'from jinja2.environment import Environment\n'), ((262, 283), 'jinja2.FileSystemLoader', 'FileSystemLoader... |
# -*- coding: utf-8 -*-
# flake8: noqa
__version__ = '2.0.1'
import logging
import utool as ut
ut.noinject(__name__, '[guitool.__init__]')
# try:
# # try seeing if importing plottool before any guitool things helps
# import wbia.plottool
# except Exception as ex:
# import utool as ut
# ut.printex(ex, '... | [
"wbia.guitool.guitool_decorators.rrr",
"wbia.guitool.guitool_misc.rrr",
"utool._internal.util_importer.dynamic_import",
"wbia.guitool.guitool_tables.rrr",
"wbia.guitool.guitool_dialogs.rrr",
"utool.inject2",
"utool.noinject",
"wbia.guitool.api_item_model.rrr",
"wbia.guitool.qtype.rrr",
"utool.get_... | [((98, 141), 'utool.noinject', 'ut.noinject', (['__name__', '"""[guitool.__init__]"""'], {}), "(__name__, '[guitool.__init__]')\n", (109, 141), True, 'import utool as ut\n'), ((1039, 1075), 'utool.inject2', 'utool.inject2', (['__name__', '"""[guitool]"""'], {}), "(__name__, '[guitool]')\n", (1052, 1075), False, 'import... |
import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
import setup_malcolm_paths
from collections import OrderedDict
import unittest
from mock import MagicMock, patch, call
# logging
# import logging
# logging.basicConfig(level=logging.DEBUG)
# module imports
from malcolm.controllers.d... | [
"unittest.main",
"malcolm.core.vmetas.StringMeta",
"os.path.dirname",
"malcolm.core.ClientController",
"malcolm.parts.demo.HelloPart",
"collections.OrderedDict",
"mock.MagicMock",
"malcolm.controllers.defaultcontroller.DefaultController",
"malcolm.compat.queue.Queue"
] | [((4114, 4140), 'unittest.main', 'unittest.main', ([], {'verbosity': '(2)'}), '(verbosity=2)\n', (4127, 4140), False, 'import unittest\n'), ((50, 75), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (65, 75), False, 'import os\n'), ((627, 638), 'mock.MagicMock', 'MagicMock', ([], {}), '()\n', ... |
# Some implementation details regarding PyBullet:
#
# PyBullet's IK solver uses damped least squares (DLS) optimization. This is commonly
# known as Levenberg-Marquardt (LM) optimization.
from __future__ import annotations
import dataclasses
from typing import NamedTuple, Optional
import numpy as np
import pybullet ... | [
"numpy.random.uniform",
"coffee.client.ClientConfig",
"numpy.sum",
"coffee.joints.Joints.from_body_id",
"numpy.empty",
"dm_robotics.transformations.transformations.quat_diff_active",
"numpy.clip",
"coffee.utils.geometry_utils.as_quaternion_wxyz",
"coffee.utils.geometry_utils.as_quaternion_xyzw",
"... | [((2359, 2415), 'coffee.joints.Joints.from_body_id', 'Joints.from_body_id', (['shadow_body_id', 'self._shadow_client'], {}), '(shadow_body_id, self._shadow_client)\n', (2378, 2415), False, 'from coffee.joints import Joints\n'), ((10821, 10882), 'dm_robotics.transformations.transformations.quat_diff_active', 'tr.quat_di... |
from qcrash.backends.base import BaseBackend
from qcrash.formatters.email import EmailFormatter
import pytest
def test_qsettings():
b = BaseBackend(None, '', '', None)
assert b.qsettings() is not None
def test_set_formatter():
b = BaseBackend(None, '', '', None)
assert b.formatter is None
b.set... | [
"qcrash.formatters.email.EmailFormatter",
"pytest.raises",
"qcrash.backends.base.BaseBackend"
] | [((143, 174), 'qcrash.backends.base.BaseBackend', 'BaseBackend', (['None', '""""""', '""""""', 'None'], {}), "(None, '', '', None)\n", (154, 174), False, 'from qcrash.backends.base import BaseBackend\n'), ((248, 279), 'qcrash.backends.base.BaseBackend', 'BaseBackend', (['None', '""""""', '""""""', 'None'], {}), "(None,... |
import sys
sys.path.insert(0,'./shield/enableConfigure/lambda')
import json
import boto3
import os
import botocore
import urllib3
import cfnresponse
import logging
logger = logging.getLogger('hc')
logger.setLevel('DEBUG')
shield_client = boto3.client('shield')
iam_client = boto3.client('iam')
s3_client = boto3.client... | [
"cfnresponse.send",
"sys.path.insert",
"logging.getLogger",
"boto3.client"
] | [((11, 64), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""./shield/enableConfigure/lambda"""'], {}), "(0, './shield/enableConfigure/lambda')\n", (26, 64), False, 'import sys\n'), ((174, 197), 'logging.getLogger', 'logging.getLogger', (['"""hc"""'], {}), "('hc')\n", (191, 197), False, 'import logging\n'), ((240, 26... |
from django.contrib import admin
from .models import Bar
@admin.register(Bar)
class BarAdmin(admin.ModelAdmin):
pass
| [
"django.contrib.admin.register"
] | [((60, 79), 'django.contrib.admin.register', 'admin.register', (['Bar'], {}), '(Bar)\n', (74, 79), False, 'from django.contrib import admin\n')] |
import os
import json
import shutil
import argparse
import numpy as np
from PIL import Image
def getSeqInfo(dataset_dir, seq):
ann_dir = os.path.join(dataset_dir, 'Annotations', '480p')
seq_path = os.path.join(ann_dir, seq)
frame_list = os.listdir(seq_path)
frame_num = len(frame_list)
frames = os... | [
"json.dump",
"argparse.ArgumentParser",
"os.makedirs",
"os.path.isdir",
"os.path.exists",
"shutil.copyfile",
"os.path.join",
"os.listdir",
"numpy.unique"
] | [((143, 191), 'os.path.join', 'os.path.join', (['dataset_dir', '"""Annotations"""', '"""480p"""'], {}), "(dataset_dir, 'Annotations', '480p')\n", (155, 191), False, 'import os\n'), ((207, 233), 'os.path.join', 'os.path.join', (['ann_dir', 'seq'], {}), '(ann_dir, seq)\n', (219, 233), False, 'import os\n'), ((251, 271), ... |
#graph_visualize.py
from graphviz import Digraph
import pairwise
# Given a vector of the form generated in pairwise.py for
# easy reading into NNs, produce a diagram of the represented graph
def vec_to_graph(vec, name='no_name_graph', save=False, fromTorch=True):
matrix = None
if fromTorch:
matrix = ... | [
"pairwise.vec_to_matrix",
"graphviz.Digraph",
"pairwise.process_vote"
] | [((450, 499), 'graphviz.Digraph', 'Digraph', ([], {'comment': '"""Preference Graph"""', 'format': '"""png"""'}), "(comment='Preference Graph', format='png')\n", (457, 499), False, 'from graphviz import Digraph\n'), ((383, 410), 'pairwise.vec_to_matrix', 'pairwise.vec_to_matrix', (['vec'], {}), '(vec)\n', (405, 410), Fa... |
from tensorflow.keras.datasets import cifar10
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense, Dropout, Activation, Flatten
from tensorflow.keras.layers import Conv2D, MaxPooling2D
from tensorflow.keras import utils
import matplotlib.pyplot as plt
num_classes = 10
im_rows = 32
... | [
"matplotlib.pyplot.title",
"tensorflow.keras.utils.to_categorical",
"matplotlib.pyplot.show",
"matplotlib.pyplot.plot",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.MaxPooling2D",
"tensorflow.keras.layers.Dropout",
"matplotlib.pyplot.legend",
"tensorflow.keras.layers.Dense",
"tensorf... | [((406, 425), 'tensorflow.keras.datasets.cifar10.load_data', 'cifar10.load_data', ([], {}), '()\n', (423, 425), False, 'from tensorflow.keras.datasets import cifar10\n'), ((520, 562), 'tensorflow.keras.utils.to_categorical', 'utils.to_categorical', (['y_train', 'num_classes'], {}), '(y_train, num_classes)\n', (540, 562... |
# Generated by Django 3.0.7 on 2020-06-09 12:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('program', '0006_auto_20200609_1522'),
]
operations = [
migrations.AlterField(
model_name='shedu... | [
"django.db.models.ForeignKey",
"django.db.models.CharField",
"django.db.migrations.DeleteModel",
"django.db.models.PositiveSmallIntegerField"
] | [((903, 939), 'django.db.migrations.DeleteModel', 'migrations.DeleteModel', ([], {'name': '"""Group"""'}), "(name='Group')\n", (925, 939), False, 'from django.db import migrations, models\n'), ((369, 488), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': ... |
from django.db.models import fields
from rest_framework import serializers
from country_manager.countries.models import Country, Currency
class SerializerCurrency(serializers.ModelSerializer):
class Meta:
model = Currency
fields = ['code']
class BaseSerializerCountry(serializers.ModelSerializer... | [
"rest_framework.serializers.StringRelatedField"
] | [((339, 381), 'rest_framework.serializers.StringRelatedField', 'serializers.StringRelatedField', ([], {'many': '(False)'}), '(many=False)\n', (369, 381), False, 'from rest_framework import serializers\n')] |
# @Created Date: 2020-01-12 01:27:18 pm
# @Filename: api.py
# @Email: <EMAIL>
# @Author: <NAME>
# @Last Modified: 2020-02-11 04:22:22 pm
# @Copyright (c) 2020 MinghuiGroup, Soochow University
from numpy import array, nan, count_nonzero
import pandas as pd
from typing import Union, Optional, Iterator, Iterable, Dict, L... | [
"pdb_profiling.ensure.EnsureBase",
"tenacity.stop_after_attempt",
"tenacity.retry_if_exception_type",
"aiofiles.open",
"pdb_profiling.utils.pipe_out",
"random.choice",
"pdb_profiling.utils.dumpsParams",
"pathlib.Path",
"pdb_profiling.exceptions.WithoutExpectedKeyError",
"tenacity.wait_random",
"... | [((1111, 1123), 'pdb_profiling.ensure.EnsureBase', 'EnsureBase', ([], {}), '()\n', (1121, 1123), False, 'from pdb_profiling.ensure import EnsureBase\n'), ((1146, 1164), 'tenacity.wait_random', 'wait_random', ([], {'max': '(1)'}), '(max=1)\n', (1157, 1164), False, 'from tenacity import retry, wait_random, stop_after_att... |
from time import time
from pitop.pma.servo_controller import ServoHardwareSpecs
from .simple_pid import PID
class PanTiltObjectTracker:
_pid_tunings = {
"slow": {"kp": 0.075, "ki": 0.002, "kd": 0.04},
"normal": {"kp": 0.25, "ki": 0.005, "kd": 0.1},
}
_target_lock_range = 10
_slow_fps... | [
"time.time"
] | [((487, 493), 'time.time', 'time', ([], {}), '()\n', (491, 493), False, 'from time import time\n'), ((1005, 1011), 'time.time', 'time', ([], {}), '()\n', (1009, 1011), False, 'from time import time\n')] |
# Copyright 2013 VMware, 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... | [
"oslo_log.log.getLogger",
"vmware_nsx.db.nsxv_db.delete_nsxv_router_binding",
"vmware_nsx.plugins.nsx_v.vshield.edge_utils.get_vdr_transit_network_plr_address",
"vmware_nsx.plugins.nsx_v.vshield.edge_utils.remove_irrelevant_keys_from_edge_request",
"vmware_nsx._i18n._",
"vmware_nsx.plugins.nsx_v.vshield.e... | [((1462, 1489), 'oslo_log.log.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1479, 1489), True, 'from oslo_log import log as logging\n'), ((1765, 1778), 'random.seed', 'random.seed', ([], {}), '()\n', (1776, 1778), False, 'import random\n'), ((31756, 31868), 'vmware_nsx.plugins.nsx_v.vshield.task... |
#!/usr/bin/env python
"""
Created by: <NAME>
Description: Functions for HMMER-DB.
"""
# Imports & Setup:
import csv
import sys
from Bio import SeqIO
import subprocess
import re
# Regex's
LocusRegex = re.compile("\(Locus:\s\S*\)")
LocationRegex = re.compile("\(Location:\s\[(\S*)\:(\S*)\]\((\S)\)\)")
# ---------... | [
"Bio.SeqIO.parse",
"csv.reader",
"sys.exit",
"re.compile"
] | [((207, 240), 're.compile', 're.compile', (['"""\\\\(Locus:\\\\s\\\\S*\\\\)"""'], {}), "('\\\\(Locus:\\\\s\\\\S*\\\\)')\n", (217, 240), False, 'import re\n'), ((253, 317), 're.compile', 're.compile', (['"""\\\\(Location:\\\\s\\\\[(\\\\S*)\\\\:(\\\\S*)\\\\]\\\\((\\\\S)\\\\)\\\\)"""'], {}), "('\\\\(Location:\\\\s\\\\[(\\... |
# (C) Copyright 2010-2020 Enthought, Inc., Austin, TX
# All rights reserved.
from traits.api import Bool
from force_bdss.api import BaseUIHooksFactory, BaseUIHooksManager
class ProbeUIHooksManager(BaseUIHooksManager):
before_execution_called = Bool()
after_execution_called = Bool()
before_save_called =... | [
"traits.api.Bool"
] | [((253, 259), 'traits.api.Bool', 'Bool', ([], {}), '()\n', (257, 259), False, 'from traits.api import Bool\n'), ((289, 295), 'traits.api.Bool', 'Bool', ([], {}), '()\n', (293, 295), False, 'from traits.api import Bool\n'), ((321, 327), 'traits.api.Bool', 'Bool', ([], {}), '()\n', (325, 327), False, 'from traits.api imp... |
# -*- coding: utf-8 -*-
# Define here the models for your scraped items
#
# See documentation in:
# http://doc.scrapy.org/en/latest/topics/items.html
import scrapy
class YokaBotItem(scrapy.Item):
# define the fields for your item here like:
# name = scrapy.Field()
pass
class YokaBotBrandListItem(scrap... | [
"scrapy.Field"
] | [((345, 359), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (357, 359), False, 'import scrapy\n'), ((371, 385), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (383, 385), False, 'import scrapy\n'), ((397, 411), 'scrapy.Field', 'scrapy.Field', ([], {}), '()\n', (409, 411), False, 'import scrapy\n'), ((425, 439), ... |
# -*- coding: utf-8 -*-
"""
Created on Sun Feb 2 22:40:45 2020
@author: yashm
"""
import json
from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
from flask import current_app
from epollchain import login_manager#db,
from flask_login import UserMixin
@login_manager.user_loader
def load_user(user_... | [
"itsdangerous.TimedJSONWebSignatureSerializer",
"json.load"
] | [((460, 475), 'json.load', 'json.load', (['file'], {}), '(file)\n', (469, 475), False, 'import json\n'), ((846, 903), 'itsdangerous.TimedJSONWebSignatureSerializer', 'Serializer', (["current_app.config['SECRET_KEY']", 'expires_sec'], {}), "(current_app.config['SECRET_KEY'], expires_sec)\n", (856, 903), True, 'from itsd... |
#!/usr/bin/env python3
#
# Copyright (C) 2020 Trillium Solutions <<EMAIL>>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this program except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# ... | [
"subprocess.run",
"zipfile.is_zipfile",
"zipfile.ZipFile",
"argparse.ArgumentParser",
"csv.DictReader",
"pathlib.Path",
"argparse.FileType"
] | [((833, 1290), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'allow_abbrev': '(False)', 'description': '"""\n Find the lat/lon bounds of a GTFS file.\n\n If an OSM input file is provided, create an output file which is a\n trimmed version of the input file.\n\n ... |
#
# Created by djz on 2022/04/01.
#
import numpy as np
from typing import Dict
from transformers.file_utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available
from .base import GenericTensor, Pipeline
def sigmoid(_outputs):
return 1.0 / (1.0 + np.exp(-_outputs))
def softmax(_outputs):
... | [
"numpy.max",
"numpy.exp"
] | [((331, 371), 'numpy.max', 'np.max', (['_outputs'], {'axis': '(-1)', 'keepdims': '(True)'}), '(_outputs, axis=-1, keepdims=True)\n', (337, 371), True, 'import numpy as np\n'), ((390, 414), 'numpy.exp', 'np.exp', (['(_outputs - maxes)'], {}), '(_outputs - maxes)\n', (396, 414), True, 'import numpy as np\n'), ((276, 293)... |
import torch
from utils import AverageMeter
import time
import math
class OutdoorVlnTrainer:
def __init__(self, opts, agent, optimizer):
self.opts = opts
self.agent = agent
self.optimizer = optimizer
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
de... | [
"time.time",
"torch.no_grad",
"torch.cuda.is_available",
"utils.AverageMeter"
] | [((681, 695), 'utils.AverageMeter', 'AverageMeter', ([], {}), '()\n', (693, 695), False, 'from utils import AverageMeter\n'), ((717, 731), 'utils.AverageMeter', 'AverageMeter', ([], {}), '()\n', (729, 731), False, 'from utils import AverageMeter\n'), ((747, 758), 'time.time', 'time.time', ([], {}), '()\n', (756, 758), ... |
# -*- coding: utf-8 -*
import hmac
import base64
import time
import hashlib
import os
import sys
import pika
class AliyunCredentialsProvider:
"""
Python2.7适用,根据阿里云的 accessKey,accessSecret,instanceId算出amqp连接使用的username和password
instanceId可以从AMQP控制台首页复制
"""
ACCESS_FROM_USER = 0
def __init__(sel... | [
"time.time"
] | [((696, 707), 'time.time', 'time.time', ([], {}), '()\n', (705, 707), False, 'import time\n')] |
from django.contrib import admin
from . import models
@admin.register(models.Message)
class MessageAdmin(admin.ModelAdmin):
list_filter = ('owner', 'created')
list_display = ('text', 'to_chat')
search_fields = ('owner', 'to_chat')
@admin.register(models.Chat)
class ChatAdmin(admin.ModelAdmin):
pass
... | [
"django.contrib.admin.register"
] | [((57, 87), 'django.contrib.admin.register', 'admin.register', (['models.Message'], {}), '(models.Message)\n', (71, 87), False, 'from django.contrib import admin\n'), ((248, 275), 'django.contrib.admin.register', 'admin.register', (['models.Chat'], {}), '(models.Chat)\n', (262, 275), False, 'from django.contrib import ... |
# (c) Copyright IBM Corporation 2020.
# LICENSE: Apache License 2.0 (Apache-2.0)
# http://www.apache.org/licenses/LICENSE-2.0
import glob
import logging
import os
import traceback
from collections import Counter
from enum import Enum
from typing import Mapping, List, Sequence, Tuple, Set
import lrtc_lib.data_access.... | [
"lrtc_lib.orchestrator.core.state_api.orchestrator_state_api.get_current_category_recommendations",
"os.remove",
"lrtc_lib.orchestrator.core.state_api.orchestrator_state_api.create_workspace",
"lrtc_lib.orchestrator.core.state_api.orchestrator_state_api.get_all_workspaces",
"lrtc_lib.orchestrator.core.state... | [((1547, 1584), 'lrtc_lib.data_access.data_access_factory.get_data_access', 'data_access_factory.get_data_access', ([], {}), '()\n', (1582, 1584), True, 'import lrtc_lib.data_access.data_access_factory as data_access_factory\n'), ((1616, 1718), 'lrtc_lib.training_set_selector.training_set_selector_factory.get_training_... |
#!/usr/bin/env python
import os
import crowdai_api
########################################################################
# Instatiate Event Notifier
########################################################################
crowdai_events = crowdai_api.events.CrowdAIEvents()
class CrowdAIMarloEvents:
REQUEST_ENV... | [
"crowdai_api.CrowdAIEvents",
"os.getenv",
"crowdai_api.events.CrowdAIEvents"
] | [((243, 277), 'crowdai_api.events.CrowdAIEvents', 'crowdai_api.events.CrowdAIEvents', ([], {}), '()\n', (275, 277), False, 'import crowdai_api\n'), ((1229, 1267), 'os.getenv', 'os.getenv', (['"""CROWDAI_IS_GRADING"""', '(False)'], {}), "('CROWDAI_IS_GRADING', False)\n", (1238, 1267), False, 'import os\n'), ((1734, 1761... |
import os
import json
import numpy as np
import pandas as pd
import requests
from sklearn.datasets import load_boston
from sklearn.pipeline import FeatureUnion
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.preprocessing import PolynomialFeatures
from tqdm import tq... | [
"source.code.preprocessing.itemsselector.ItemSelector",
"sklearn.preprocessing.StandardScaler",
"os.path.exists",
"sklearn.datasets.load_boston",
"sklearn.preprocessing.PolynomialFeatures",
"requests.get",
"source.code.preprocessing.mylabelbinarizer.MyLabelBinarizer",
"source.code.preprocessing.utils.... | [((758, 791), 'os.path.join', 'os.path.join', (['to_param', 'file_name'], {}), '(to_param, file_name)\n', (770, 791), False, 'import os\n'), ((4344, 4372), 'sklearn.datasets.load_boston', 'load_boston', ([], {'return_X_y': '(True)'}), '(return_X_y=True)\n', (4355, 4372), False, 'from sklearn.datasets import load_boston... |
import setuptools
# read the contents of your README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
setuptools.setup(
name='AD-cs207',
version='1.0.0',
author='<NA... | [
"os.path.dirname",
"os.path.join",
"setuptools.find_packages"
] | [((110, 132), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (122, 132), False, 'from os import path\n'), ((144, 182), 'os.path.join', 'path.join', (['this_directory', '"""README.md"""'], {}), "(this_directory, 'README.md')\n", (153, 182), False, 'from os import path\n'), ((567, 593), 'setuptool... |
import requests
import json
import ctypes
import tempfile
import os
import time
import base64
from dotenv import load_dotenv
load_dotenv()
REFRESH_TOKEN = os.getenv("REFRESH_TOKEN")
ACCESS_TOKEN = os.getenv("ACCESS_TOKEN")
EXPIRATION_TIME = float(os.getenv("EXPIRATION_TIME"))
CLIENT_ID = os.getenv("CLIENT_ID")
CLIEN... | [
"os.mkdir",
"json.loads",
"os.path.isdir",
"tempfile.gettempdir",
"os.path.exists",
"time.sleep",
"dotenv.load_dotenv",
"time.time",
"requests.get",
"requests.post",
"os.getenv",
"ctypes.windll.user32.SystemParametersInfoW"
] | [((126, 139), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (137, 139), False, 'from dotenv import load_dotenv\n'), ((158, 184), 'os.getenv', 'os.getenv', (['"""REFRESH_TOKEN"""'], {}), "('REFRESH_TOKEN')\n", (167, 184), False, 'import os\n'), ((200, 225), 'os.getenv', 'os.getenv', (['"""ACCESS_TOKEN"""'], {})... |
import csv
from io import StringIO
import os.path as op
from flask import request, redirect, Response, flash, url_for
from werkzeug.exceptions import HTTPException
from flask_admin import Admin
from flask_admin.base import expose
from flask_admin.contrib.sqla import ModelView
from flask_admin.contrib.fileadmin import ... | [
"io.StringIO",
"flask_admin.Admin",
"flask.flash",
"flask_admin.base.expose",
"csv.DictReader",
"os.path.dirname",
"app.provider.Provider.from_dict",
"flask_admin.contrib.fileadmin.FileAdmin",
"flask.request.environ.get",
"app.admin.ProviderImportForm",
"flask.url_for",
"app.db.session.merge",... | [((518, 570), 'flask_admin.Admin', 'Admin', (['app'], {'name': '"""Admin"""', 'template_mode': '"""bootstrap3"""'}), "(app, name='Admin', template_mode='bootstrap3')\n", (523, 570), False, 'from flask_admin import Admin\n'), ((1394, 1436), 'flask_admin.base.expose', 'expose', (['"""/import"""'], {'methods': "['GET', 'P... |
# Generated by Django 3.1.1 on 2020-10-15 19:02
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... | [
"django.db.models.TextField",
"django.db.migrations.swappable_dependency",
"django.db.models.ManyToManyField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField"
] | [((276, 333), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (307, 333), False, 'from django.db import migrations, models\n'), ((467, 560), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
from re import sub
from os import walk, mkdir, rename, remove
from sys import stderr
from shutil import rmtree
from os.path import isfile, isdir, join, basename, splitext, exists
from filecmp import dircmp
import mekpie.debug as debug
import mekpie.messages as messages
from .cli import panic, log
#... | [
"os.mkdir",
"os.remove",
"os.path.join",
"os.path.basename",
"os.path.isdir",
"os.rename",
"mekpie.messages.directory_not_found.format",
"os.path.exists",
"os.walk",
"os.path.isfile",
"mekpie.messages.file_not_found.format",
"shutil.rmtree",
"re.sub",
"filecmp.dircmp"
] | [((1411, 1452), 're.sub', 'sub', (['"""^|\\\\n"""', "('\\n' + spaces * ' ')", 'string'], {}), "('^|\\\\n', '\\n' + spaces * ' ', string)\n", (1414, 1452), False, 'from re import sub\n'), ((2090, 2102), 'os.path.exists', 'exists', (['path'], {}), '(path)\n', (2096, 2102), False, 'from os.path import isfile, isdir, join,... |
#!/usr/bin/env python
#
# Copyright 2019 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 la... | [
"yaml.load",
"os.getcwd",
"os.walk",
"os.path.exists",
"re.match",
"os.path.split",
"os.path.join",
"os.listdir",
"sys.exit"
] | [((4621, 4634), 'sys.exit', 'sys.exit', (['ret'], {}), '(ret)\n', (4629, 4634), False, 'import sys\n'), ((1199, 1210), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (1208, 1210), False, 'import os\n'), ((1943, 1959), 'os.listdir', 'os.listdir', (['path'], {}), '(path)\n', (1953, 1959), False, 'import os\n'), ((2799, 2812... |
#coding: UTF-8
import sys
import os
import os.path
import glob
import cv2
import numpy as np
CAPTUREDDIR = './captured'
CALIBFLAG = 0 # cv2.CALIB_FIX_K3
def calibFromImages(dirname, chess_shape, chess_block_size):
if not os.path.exists(dirname):
print('Directory \'' + dirname + '\' was not found')
... | [
"cv2.findChessboardCorners",
"numpy.zeros",
"os.path.exists",
"cv2.imread",
"cv2.FileStorage",
"cv2.Rodrigues",
"numpy.array",
"cv2.calibrateCamera",
"glob.glob"
] | [((548, 606), 'numpy.zeros', 'np.zeros', (['(chess_shape[0] * chess_shape[1], 3)', 'np.float32'], {}), '((chess_shape[0] * chess_shape[1], 3), np.float32)\n', (556, 606), True, 'import numpy as np\n'), ((1422, 1513), 'cv2.calibrateCamera', 'cv2.calibrateCamera', (['objp_list', 'imgp_list', 'img_shape', 'None', 'None', ... |
#!/usr/bin/env python3
# Copyright 2019 ZTE corporation. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0
import re
import subprocess
def main():
subject_regex = re.compile(r'[^a-z\s]\S*( \S+)*[^.]')
has_failure = False
commit_messages = subprocess.check_output(args=['git', 'log', '--format=%... | [
"subprocess.check_output",
"re.compile"
] | [((180, 219), 're.compile', 're.compile', (['"""[^a-z\\\\s]\\\\S*( \\\\S+)*[^.]"""'], {}), "('[^a-z\\\\s]\\\\S*( \\\\S+)*[^.]')\n", (190, 219), False, 'import re\n'), ((265, 372), 'subprocess.check_output', 'subprocess.check_output', ([], {'args': "['git', 'log', '--format=%s', 'origin/master..']", 'universal_newlines'... |
# -*- encoding: utf-8 -*-
'''
Created on 2012-3-22
@author: Neil
'''
from django.db import models
# from photo import Photo
from user import User
class Comment(models.Model):
"""
评论的数据模型
"""
photo_id = models.IntegerField()
photo_owner = models.ForeignKey(User, related_name='comment_photo_owner')... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.BooleanField",
"django.db.models.IntegerField",
"django.db.models.DateTimeField"
] | [((221, 242), 'django.db.models.IntegerField', 'models.IntegerField', ([], {}), '()\n', (240, 242), False, 'from django.db import models\n'), ((261, 320), 'django.db.models.ForeignKey', 'models.ForeignKey', (['User'], {'related_name': '"""comment_photo_owner"""'}), "(User, related_name='comment_photo_owner')\n", (278, ... |
import re
import string
import tensorflow_hub as hub
from scipy.spatial.distance import cdist
module_url = "https://tfhub.dev/google/universal-sentence-encoder/4"
class SimilarityModel():
def __init__(self):
print("Loading model from tf hub...")
self.model = hub.load(module_url)
print("mo... | [
"scipy.spatial.distance.cdist",
"tensorflow_hub.load",
"re.sub",
"re.escape"
] | [((282, 302), 'tensorflow_hub.load', 'hub.load', (['module_url'], {}), '(module_url)\n', (290, 302), True, 'import tensorflow_hub as hub\n'), ((592, 619), 're.sub', 're.sub', (['"""i\'m"""', '"""i am"""', 'text'], {}), '("i\'m", \'i am\', text)\n', (598, 619), False, 'import re\n'), ((636, 665), 're.sub', 're.sub', (['... |
import numpy as np
import torch
import torch.nn as nn
from modules.envelope import Envelope
from modules.initializers import GlorotOrthogonal
class EmbeddingBlock(nn.Module):
def __init__(self,
emb_size,
num_radial,
bessel_funcs,
cutoff,
... | [
"torch.stack",
"torch.nn.Embedding",
"torch.cat",
"modules.envelope.Envelope",
"torch.nn.Linear",
"numpy.sqrt",
"modules.initializers.GlorotOrthogonal"
] | [((598, 625), 'modules.envelope.Envelope', 'Envelope', (['envelope_exponent'], {}), '(envelope_exponent)\n', (606, 625), False, 'from modules.envelope import Envelope\n'), ((651, 689), 'torch.nn.Embedding', 'nn.Embedding', (['num_atom_types', 'emb_size'], {}), '(num_atom_types, emb_size)\n', (663, 689), True, 'import t... |
import pygame
from gamesettings import GameSettings as gs
class TextInput(pygame.sprite.Sprite):
def __init__(self, x, y, width, height):
"""Inputs any kind of text on screen.
Parameters
----------
x: int
X axis position of the input bar.
y: int
Y... | [
"pygame.draw.rect",
"pygame.Rect",
"pygame.font.SysFont"
] | [((741, 793), 'pygame.Rect', 'pygame.Rect', (['self.x', 'self.y', 'self.width', 'self.height'], {}), '(self.x, self.y, self.width, self.height)\n', (752, 793), False, 'import pygame\n'), ((814, 857), 'pygame.font.SysFont', 'pygame.font.SysFont', (['None', '(self.height // 2)'], {}), '(None, self.height // 2)\n', (833, ... |
#!/usr/bin/python3
#
# Copyright (c) 2012 <NAME> <<EMAIL>>
#
# 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, modif... | [
"typing.TypeVar",
"copy.deepcopy",
"itertools.zip_longest"
] | [((1350, 1362), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (1357, 1362), False, 'from typing import Any, AnyStr, Callable, Dict, FrozenSet, Hashable, Iterable, Iterator, List, Sequence, Tuple, TypeVar, Union, overload\n'), ((4462, 4511), 'itertools.zip_longest', 'itertools.zip_longest', (['*args'], {'fi... |
# -*- coding: utf-8 -*-
""" Various registration routines to reduce duplication. """
import numpy as np
import sksurgerycore.transforms.matrix as mt
import sksurgerysurfacematch.interfaces.rigid_registration as rr
def do_rigid_registration(reconstructed_cloud,
reference_cloud,
... | [
"numpy.transpose",
"numpy.linalg.inv",
"numpy.matmul",
"sksurgerycore.transforms.matrix.construct_rigid_transformation"
] | [((1492, 1516), 'numpy.linalg.inv', 'np.linalg.inv', (['transform'], {}), '(transform)\n', (1505, 1516), True, 'import numpy as np\n'), ((1148, 1177), 'numpy.transpose', 'np.transpose', (['reference_cloud'], {}), '(reference_cloud)\n', (1160, 1177), True, 'import numpy as np\n'), ((1628, 1721), 'sksurgerycore.transform... |
# From https://groups.google.com/forum/#!topic/networkx-discuss/FwYk0ixLDuY
# Plot weighted directed positive/negative network graph
import networkx as nx
import matplotlib.pyplot as plt
from matplotlib.patches import FancyArrowPatch, Circle
import numpy as np
def draw_curvy_network(G, pos, ax, node_radius=0.02, nod... | [
"matplotlib.pyplot.show",
"networkx.MultiDiGraph",
"hips.plotting.colormaps.harvard_colors",
"matplotlib.patches.FancyArrowPatch",
"matplotlib.pyplot.axis",
"matplotlib.patches.Circle",
"numpy.sign",
"networkx.spring_layout",
"matplotlib.pyplot.gca"
] | [((2141, 2214), 'networkx.MultiDiGraph', 'nx.MultiDiGraph', (['[(1, 1), (1, 2), (2, 1), (2, 3), (3, 4), (2, 4), (3, 2)]'], {}), '([(1, 1), (1, 2), (2, 1), (2, 3), (3, 4), (2, 4), (3, 2)])\n', (2156, 2214), True, 'import networkx as nx\n'), ((2226, 2245), 'networkx.spring_layout', 'nx.spring_layout', (['G'], {}), '(G)\n... |
import json
import requests
from rest_framework import status
from presqt.utilities import PresQTResponseException
def zenodo_upload_helper(auth_parameter, project_title=None):
"""
Initialize a new project on Zenodo.
Parameters
----------
auth_parameter : str
The Authentication paramete... | [
"requests.post",
"json.dumps"
] | [((471, 584), 'requests.post', 'requests.post', (['"""https://zenodo.org/api/deposit/depositions"""'], {'params': 'auth_parameter', 'json': '{}', 'headers': 'headers'}), "('https://zenodo.org/api/deposit/depositions', params=\n auth_parameter, json={}, headers=headers)\n", (484, 584), False, 'import requests\n'), ((... |
#
# Copyright (c) 2016-present, Cisco Systems, Inc. All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
#
from django.core.management.base import BaseCommand, CommandError
from dashboard.models import Alert
from... | [
"dashboard.models.Alert.objects.all"
] | [((458, 477), 'dashboard.models.Alert.objects.all', 'Alert.objects.all', ([], {}), '()\n', (475, 477), False, 'from dashboard.models import Alert\n')] |
from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
# Monkey patching ftw...
import dolweb.utils.monkey
admin.autodiscover()
urlpatterns = p... | [
"django.contrib.admin.autodiscover",
"django.contrib.staticfiles.urls.staticfiles_urlpatterns",
"django.conf.urls.include",
"django.conf.urls.url",
"django.conf.urls.static.static"
] | [((283, 303), 'django.contrib.admin.autodiscover', 'admin.autodiscover', ([], {}), '()\n', (301, 303), False, 'from django.contrib import admin\n'), ((1022, 1047), 'django.contrib.staticfiles.urls.staticfiles_urlpatterns', 'staticfiles_urlpatterns', ([], {}), '()\n', (1045, 1047), False, 'from django.contrib.staticfile... |
import copy
import types
from smach_based_introspection_framework.online_part.framework_core.states import (
RollBackRecovery,
)
import introspection_execute
from smach_based_introspection_framework.online_part.robot_screen_visualization.setter import(
show_anomaly_detected,
show_everyhing_is_good,
)
def r... | [
"smach_based_introspection_framework.online_part.framework_core.states.RollBackRecovery",
"copy.deepcopy",
"types.MethodType"
] | [((384, 409), 'copy.deepcopy', 'copy.deepcopy', (['sm._states'], {}), '(sm._states)\n', (397, 409), False, 'import copy\n'), ((594, 646), 'types.MethodType', 'types.MethodType', (['introspection_execute.execute', 'obj'], {}), '(introspection_execute.execute, obj)\n', (610, 646), False, 'import types\n'), ((1322, 1366),... |
#!/usr/bin/python
# -*- coding: utf-8 -*-
# created: 2014-12-02
"""Demo and test program to verify WS server."""
import sys
from autobahn.twisted.websocket import WebSocketClientFactory
from autobahn.twisted.websocket import WebSocketClientProtocol
from twisted.internet import reactor
from twisted.python import log... | [
"twisted.python.log.startLogging",
"twisted.internet.reactor.connectTCP",
"twisted.internet.reactor.run",
"twisted.internet.reactor.stop",
"autobahn.twisted.websocket.WebSocketClientFactory"
] | [((908, 936), 'twisted.python.log.startLogging', 'log.startLogging', (['sys.stdout'], {}), '(sys.stdout)\n', (924, 936), False, 'from twisted.python import log\n'), ((956, 980), 'autobahn.twisted.websocket.WebSocketClientFactory', 'WebSocketClientFactory', ([], {}), '()\n', (978, 980), False, 'from autobahn.twisted.web... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 3 23:36:17 2017
Unit tests for utils.py
@author: duc
"""
import unittest
import utils as ut
from nltk.corpus import cmudict
def to_string(tokenized):
return " ".join(sum(tokenized, []))
class UtilTests(unittest.TestCase):
#------ test boo... | [
"unittest.main",
"utils.is_not_emoticon",
"utils.remove_retweets",
"utils.remove_emoticons",
"utils.is_not_contraction",
"utils.get_word_syllables",
"utils.split_compounds",
"utils.remove_links",
"utils.split_contractions",
"utils.remove_stopwords",
"utils.get_word_syllables_offline",
"utils.r... | [((6796, 6811), 'unittest.main', 'unittest.main', ([], {}), '()\n', (6809, 6811), False, 'import unittest\n'), ((4774, 4788), 'nltk.corpus.cmudict.dict', 'cmudict.dict', ([], {}), '()\n', (4786, 4788), False, 'from nltk.corpus import cmudict\n'), ((5526, 5540), 'nltk.corpus.cmudict.dict', 'cmudict.dict', ([], {}), '()\... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest
import numpy as np
import scipy.io
# Exercise 5 | Regularized Linear Regression and Bias-Variance
#
# Instructions
# ------------
#
# This file contains code that helps you get started on the
# exercise. You will need to complete the following funct... | [
"matplotlib.pyplot.title",
"ex5_regularized_linear_regressionand_bias_vs_variance.trainLinearReg.trainLinearReg",
"numpy.ones",
"ex5_regularized_linear_regressionand_bias_vs_variance.featureNormalize.featureNormalize",
"numpy.shape",
"matplotlib.pyplot.figure",
"numpy.mean",
"unittest.main",
"matplo... | [((13315, 13330), 'unittest.main', 'unittest.main', ([], {}), '()\n', (13328, 13330), False, 'import unittest\n'), ((1535, 1548), 'matplotlib.pyplot.figure', 'plt.figure', (['(1)'], {}), '(1)\n', (1545, 1548), True, 'import matplotlib.pyplot as plt\n'), ((1557, 1596), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Cha... |
from selectors import EpollSelector
from scipy import ma
import torch
from torch.cuda.amp import autocast
from advbench import attacks
from einops import repeat, rearrange
import torch.nn.functional as F
from tqdm import tqdm
from advbench.datasets import FFCV_AVAILABLE
class PerturbationEval():
def __init__(self... | [
"torch.ones_like",
"torch.cuda.amp.autocast",
"torch.column_stack",
"torch.empty",
"torch.nn.functional.cross_entropy",
"einops.rearrange",
"torch.concat",
"advbench.attacks.Grid_Search",
"torch.tensor",
"torch.no_grad",
"einops.repeat"
] | [((4211, 4370), 'advbench.attacks.Grid_Search', 'attacks.Grid_Search', (['algorithm.classifier', 'algorithm.hparams', 'algorithm.device'], {'perturbation': 'algorithm.perturbation_name', 'grid_size': 'max_perturbations'}), '(algorithm.classifier, algorithm.hparams, algorithm.\n device, perturbation=algorithm.perturb... |
# remove some of the asim-style columns added by marin_work_tour_mode_choice.py
# so data input files look 'realistic' - and that work is done instaed by 'import_tours' annotation expression files
import os
import pandas as pd
import openmatrix as omx
input_dir = './data_3_marin'
output_dir = './data_3_marin/fix' # ... | [
"os.path.join"
] | [((419, 452), 'os.path.join', 'os.path.join', (['input_dir', 'filenane'], {}), '(input_dir, filenane)\n', (431, 452), False, 'import os\n'), ((493, 527), 'os.path.join', 'os.path.join', (['output_dir', 'filenane'], {}), '(output_dir, filenane)\n', (505, 527), False, 'import os\n')] |
import RPi.GPIO as GPIO
import time
import random
GPIO.setmode(GPIO.BOARD)
BTN_PIN = 11
BTN_PIN1 = 10
LED_PIN = 12
WAIT_TIME = 200
status = GPIO.LOW
GPIO.setup(BTN_PIN, GPIO.IN, pull_up_down = GPIO.PUD_UP)
# GPIO.setup(LED_PIN, GPIO.OUT, initial = status)
R_pin = 33 # R:33 號腳位(第 33 根 pin)
G_pin = ... | [
"RPi.GPIO.setmode",
"RPi.GPIO.cleanup",
"RPi.GPIO.setup",
"time.ctime",
"time.sleep",
"random.random",
"RPi.GPIO.PWM"
] | [((51, 75), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BOARD'], {}), '(GPIO.BOARD)\n', (63, 75), True, 'import RPi.GPIO as GPIO\n'), ((170, 224), 'RPi.GPIO.setup', 'GPIO.setup', (['BTN_PIN', 'GPIO.IN'], {'pull_up_down': 'GPIO.PUD_UP'}), '(BTN_PIN, GPIO.IN, pull_up_down=GPIO.PUD_UP)\n', (180, 224), True, 'import RPi.GP... |
import cv2
eyeCascade = cv2.CascadeClassifier('haarcascade_eye.xml')
video_capture = cv2.VideoCapture(0)
while True:
ret,frame = video_capture.read()
gray = cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
eyes = eyeCascade.detectMultiScale(gray,
scaleFactor=1.2,
minNeighbors=5,
minSize=(30,30))
for(x,y,w,h) in eyes... | [
"cv2.cvtColor",
"cv2.waitKey",
"cv2.VideoCapture",
"cv2.rectangle",
"cv2.DestroyAllWindows",
"cv2.CascadeClassifier",
"cv2.imshow"
] | [((25, 69), 'cv2.CascadeClassifier', 'cv2.CascadeClassifier', (['"""haarcascade_eye.xml"""'], {}), "('haarcascade_eye.xml')\n", (46, 69), False, 'import cv2\n'), ((86, 105), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (102, 105), False, 'import cv2\n'), ((475, 498), 'cv2.DestroyAllWindows', 'cv2.Des... |
###################################################################
# This implementation is based on the following papaer:
#
# <NAME> and <NAME>. Automatic data and computation
# decomposition on distributed# memory parallel computers.
# ACM Transactions on Programming Languages and Systems,
# 24(1):1–50, Jan. 2002... | [
"heterocl.for_",
"heterocl.placeholder",
"numpy.random.randint",
"heterocl.build",
"heterocl.create_schedule",
"heterocl.init",
"heterocl.scalar",
"heterocl.Int",
"heterocl.Float"
] | [((621, 630), 'heterocl.Int', 'hcl.Int', ([], {}), '()\n', (628, 630), True, 'import heterocl as hcl\n'), ((651, 666), 'heterocl.init', 'hcl.init', (['dtype'], {}), '(dtype)\n', (659, 666), True, 'import heterocl as hcl\n'), ((675, 705), 'heterocl.placeholder', 'hcl.placeholder', (['(Nx, Ny)', '"""u"""'], {}), "((Nx, N... |
#
#Copyright Odin Solutions S.L. All Rights Reserved.
#
#SPDX-License-Identifier: Apache-2.0
#
import json
import uuid
#import os
from subprocess import Popen, PIPE
def processUri(uri):
try:
if(str(uri).upper().startswith("/v1".upper()) == False ):
uri = "/v1"+uri
return uri
e... | [
"subprocess.Popen",
"uuid.uuid4"
] | [((1561, 1601), 'subprocess.Popen', 'Popen', (['command'], {'stdout': 'PIPE', 'stderr': 'PIPE'}), '(command, stdout=PIPE, stderr=PIPE)\n', (1566, 1601), False, 'from subprocess import Popen, PIPE\n'), ((3024, 3036), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (3034, 3036), False, 'import uuid\n')] |
import os
import time
vd = os.environ['CUDA_VISIBLE_DEVICES']
print(f'gpu_id={vd}')
num_gpus = len(vd.split(','))
if vd == '' or num_gpus != 1:
raise Exception('There must be one visible gpu.')
time.sleep(0.5)
| [
"time.sleep"
] | [((201, 216), 'time.sleep', 'time.sleep', (['(0.5)'], {}), '(0.5)\n', (211, 216), False, 'import time\n')] |
"""This program will focus on developing a program package for the application of RFM (Recency, Frequency, Monetary Value)
model and output the customer classification results into a new document.
Name: <NAME>
Date:28/05/2020
"""
from app.saver import Saver
if __name__ == '__main__':
saver = Saver()
saver.re... | [
"app.saver.Saver"
] | [((300, 307), 'app.saver.Saver', 'Saver', ([], {}), '()\n', (305, 307), False, 'from app.saver import Saver\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
from typing import Iterable
from refinery.units.blockwise import Arg, BlockTransformationBase
from refinery.units.encoding.base import base as BaseUnit
from refinery.lib.argformats import number
from refinery.lib.patterns import formats
class pack(BlockTransfo... | [
"refinery.units.encoding.base.base",
"refinery.units.blockwise.Arg.Number",
"refinery.units.blockwise.Arg",
"refinery.units.blockwise.Arg.Switch",
"re.compile"
] | [((2157, 2196), 'refinery.units.encoding.base.base', 'BaseUnit', (['base', '(not self.args.bigendian)'], {}), '(base, not self.args.bigendian)\n', (2165, 2196), True, 'from refinery.units.encoding.base import base as BaseUnit\n'), ((912, 1076), 'refinery.units.blockwise.Arg', 'Arg', ([], {'type': 'number[2:36]', 'help'... |
# Shows how to delete files
import glob
import os
from os import listdir
from os.path import isfile, join
def get_and_delete_symbol_files(path, symbol):
filenames = []
pattern = path + "/" + symbol + "-*.csv"
for name in glob.glob(pattern):
filenames.append(name)
for filename in filenames:
... | [
"os.remove",
"os.path.exists",
"glob.glob"
] | [((236, 254), 'glob.glob', 'glob.glob', (['pattern'], {}), '(pattern)\n', (245, 254), False, 'import glob\n'), ((422, 446), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (436, 446), False, 'import os\n'), ((591, 609), 'glob.glob', 'glob.glob', (['pattern'], {}), '(pattern)\n', (600, 609), Fals... |
# Copyright (C) 2020 MoveAngel and MinaProject
#
# Licensed under the Raphielscape Public License, Version 1.d (the "License");
# you may not use this file except in compliance with the License.
#
# Multifunction memes
#
# Based code + improve from AdekMaulana and aidilaryanto
import asyncio
import os
import random
im... | [
"os.remove",
"userbot.bot.download_file",
"userbot.utils.check_media",
"textwrap.wrap",
"userbot.utils.progress",
"os.path.join",
"telethon.events.NewMessage",
"userbot.bot.send_read_acknowledge",
"PIL.ImageDraw.Draw",
"re.sub",
"glitch_this.ImageGlitcher",
"userbot.bot.conversation",
"async... | [((802, 925), 're.compile', 're.compile', (['"""[\U0001f1e0-🇿🌀-🗿😀-🙏🚀-\U0001f6ff🜀-\U0001f77f🞀-\U0001f7ff🠀-\U0001f8ff🤀-🧿🨀-\U0001fa6f🩰-\U0001faff✂-➰]+"""'], {}), "(\n '[\\U0001f1e0-🇿🌀-🗿😀-🙏🚀-\\U0001f6ff🜀-\\U0001f77f🞀-\\U0001f7ff🠀-\\U0001f8ff🤀-🧿🨀-\\U0001fa6f🩰-\\U0001faff✂-➰]+'\n )\n", (812, 9... |
# -*- coding: utf-8 -*-
"""Jinja2 template engine."""
import os
import re
from jinja2 import Environment
from jinja2.exceptions import UndefinedError, TemplateSyntaxError
from piecutter.engines import Engine
from piecutter.exceptions import TemplateError
def path_join(*args, **kwargs):
"""Return ``args`` joined... | [
"piecutter.exceptions.TemplateError",
"jinja2.Environment",
"os.path.normpath",
"re.search",
"os.path.join"
] | [((1570, 1589), 'os.path.join', 'os.path.join', (['*args'], {}), '(*args)\n', (1582, 1589), False, 'import os\n'), ((2749, 2771), 'os.path.normpath', 'os.path.normpath', (['path'], {}), '(path)\n', (2765, 2771), False, 'import os\n'), ((4207, 4238), 're.search', 're.search', (['"""{{ .+ }}"""', 'template'], {}), "('{{ ... |
# Copyright 2020 Cognite AS
#
# 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... | [
"threading.Thread",
"prometheus_client.exposition.delete_from_gateway",
"arrow.get",
"os.getpid",
"prometheus_client.Info",
"prometheus_client.exposition.pushadd_to_gateway",
"time.sleep",
"prometheus_client.core.REGISTRY.collect",
"threading.Event",
"prometheus_client.exposition.basic_auth_handle... | [((4121, 4220), 'prometheus_client.Gauge', 'Gauge', (['f"""{extractor_name}_start_time"""', '"""Timestamp (seconds) of when the extractor last started"""'], {}), "(f'{extractor_name}_start_time',\n 'Timestamp (seconds) of when the extractor last started')\n", (4126, 4220), False, 'from prometheus_client import Gauge... |
# -*- coding: utf-8 -*-
# Copyright (c) CKM Analytix Corp. All rights reserved.
# Authors: <NAME> (<EMAIL>), <NAME> (<EMAIL>)
"""
Metrics for determining quality of community structure
"""
import numpy as np
from scipy.sparse import identity
__all__ = ['modularity_r', 'modularity_density', 'mula_modularity_density']... | [
"numpy.count_nonzero",
"numpy.sum",
"numpy.zeros",
"numpy.ones",
"scipy.sparse.identity",
"numpy.unique"
] | [((1202, 1237), 'numpy.zeros', 'np.zeros', (['adj_r.shape[0]'], {'dtype': 'int'}), '(adj_r.shape[0], dtype=int)\n', (1210, 1237), True, 'import numpy as np\n'), ((5019, 5043), 'scipy.sparse.identity', 'identity', ([], {'n': 'adj.shape[0]'}), '(n=adj.shape[0])\n', (5027, 5043), False, 'from scipy.sparse import identity\... |
import numpy as np
from scipy.stats import gamma as RVgamma
# the gamma distribution consider a varying shape parameter and a scale parameter equal to 1
class HMM_approxSEIR_expanded:
def __init__( self, N, beta, rho, gamma, q, eta_zero, q_r, t_star ):
self.N = N
self.beta = beta
... | [
"numpy.size",
"numpy.sum",
"numpy.zeros",
"numpy.transpose",
"numpy.ones",
"numpy.exp"
] | [((547, 563), 'numpy.zeros', 'np.zeros', (['(4, T)'], {}), '((4, T))\n', (555, 563), True, 'import numpy as np\n'), ((999, 1018), 'numpy.size', 'np.size', (['y[0, 0, :]'], {}), '(y[0, 0, :])\n', (1006, 1018), True, 'import numpy as np\n'), ((1108, 1124), 'numpy.zeros', 'np.zeros', (['[4, T]'], {}), '([4, T])\n', (1116,... |
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("textfile", "0001_initial")]
operations = [
migrations.CreateModel(
name="TextFileTranslation",
fields=[
(
"id",
models.Aut... | [
"django.db.models.TextField",
"django.db.models.CharField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.migrations.AlterUniqueTogether"
] | [((1486, 1596), 'django.db.migrations.AlterUniqueTogether', 'migrations.AlterUniqueTogether', ([], {'name': '"""textfiletranslation"""', 'unique_together': "{('language_code', 'master')}"}), "(name='textfiletranslation', unique_together=\n {('language_code', 'master')})\n", (1516, 1596), False, 'from django.db impor... |
from django.db import models
from cookiedjango.core.models import TimeStampedModel
class TwitterPost(TimeStampedModel):
tag = models.CharField(max_length=140)
text = models.TextField()
| [
"django.db.models.CharField",
"django.db.models.TextField"
] | [((131, 163), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(140)'}), '(max_length=140)\n', (147, 163), False, 'from django.db import models\n'), ((175, 193), 'django.db.models.TextField', 'models.TextField', ([], {}), '()\n', (191, 193), False, 'from django.db import models\n')] |
import torch
import torch.nn.functional as F
import torch.nn as nn
from torch.nn import BatchNorm1d
from torch_geometric.nn import GCNConv, GraphConv, GATConv, GatedGraphConv
from torch_geometric.utils import add_remaining_self_loops, add_self_loops
class BasicNet(torch.nn.Module):
def __init__(self):
s... | [
"torch_geometric.nn.GCNConv",
"torch_geometric.nn.GraphConv",
"torch.sigmoid",
"torch.nn.functional.relu"
] | [((373, 387), 'torch_geometric.nn.GCNConv', 'GCNConv', (['(1)', '(16)'], {}), '(1, 16)\n', (380, 387), False, 'from torch_geometric.nn import GCNConv, GraphConv, GATConv, GatedGraphConv\n'), ((409, 423), 'torch_geometric.nn.GCNConv', 'GCNConv', (['(16)', '(1)'], {}), '(16, 1)\n', (416, 423), False, 'from torch_geometri... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.29 on 2021-01-28 16:46
from __future__ import unicode_literals
import contentcuration.models
from django.db import migrations, models
import django.db.models.functions.text
class Migration(migrations.Migration):
dependencies = [
('contentcuration', '011... | [
"django.db.models.Q"
] | [((548, 577), 'django.db.models.Q', 'models.Q', (["('is_active', True)"], {}), "(('is_active', True))\n", (556, 577), False, 'from django.db import migrations, models\n')] |
#!/usr/bin/env python
'''
Initialize a molecular system.
There are many methods to define/initialize a molecule. This example presents
three methods to create/initialize the molecular object. Mole object is a
Python object. You can initialize the Mole object using any methods supported
by Python.
See also
pyscf/... | [
"pyscf.gto.M",
"pyscf.gto.Mole"
] | [((625, 635), 'pyscf.gto.Mole', 'gto.Mole', ([], {}), '()\n', (633, 635), False, 'from pyscf import gto\n'), ((824, 834), 'pyscf.gto.Mole', 'gto.Mole', ([], {}), '()\n', (832, 834), False, 'from pyscf import gto\n'), ((981, 1037), 'pyscf.gto.M', 'gto.M', ([], {'atom': '"""O 0 0 0; H 0 1 0; H 0 0 1"""', 'basis': '"""st... |
import uuid
from aiogram.utils.callback_data import CallbackData
POSTS = {
str(uuid.uuid4()): {
'title': f'Grup Yönetimi\n',
'body': '\n@Combot \n@MissRose_bot \n@baymax_en_bot',
}
}
posts_cb = CallbackData('post','id', 'action')
| [
"aiogram.utils.callback_data.CallbackData",
"uuid.uuid4"
] | [((223, 259), 'aiogram.utils.callback_data.CallbackData', 'CallbackData', (['"""post"""', '"""id"""', '"""action"""'], {}), "('post', 'id', 'action')\n", (235, 259), False, 'from aiogram.utils.callback_data import CallbackData\n'), ((85, 97), 'uuid.uuid4', 'uuid.uuid4', ([], {}), '()\n', (95, 97), False, 'import uuid\n... |
from __future__ import print_function, absolute_import, division, unicode_literals
import numpy as np
from astropy.io import ascii
from pkg_resources import resource_filename
'''
Function to read in atomic line information for a given rest frame wavelength.
Or
For the line matching the ... | [
"astropy.io.ascii.read",
"numpy.abs",
"numpy.double",
"numpy.float",
"pkg_resources.resource_filename",
"numpy.int",
"numpy.str"
] | [((1244, 1275), 'numpy.double', 'np.double', (["line_str[i]['wrest']"], {}), "(line_str[i]['wrest'])\n", (1253, 1275), True, 'import numpy as np\n'), ((1286, 1315), 'numpy.float', 'np.float', (["line_str[i]['fval']"], {}), "(line_str[i]['fval'])\n", (1294, 1315), True, 'import numpy as np\n'), ((1326, 1352), 'numpy.str... |
from fylesdk import FyleSDK
from django.conf import settings
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from accounting_integrations.allauth.providers.fylein.provider import FyleProvider
class FyleOAuth2Adapter(OAuth2Adapter):
prov... | [
"fylesdk.FyleSDK",
"allauth.socialaccount.providers.oauth2.views.OAuth2CallbackView.adapter_view",
"allauth.socialaccount.providers.oauth2.views.OAuth2LoginView.adapter_view",
"django.conf.settings.FYLE_BASE_URL.rstrip"
] | [((1206, 1253), 'allauth.socialaccount.providers.oauth2.views.OAuth2LoginView.adapter_view', 'OAuth2LoginView.adapter_view', (['FyleOAuth2Adapter'], {}), '(FyleOAuth2Adapter)\n', (1234, 1253), False, 'from allauth.socialaccount.providers.oauth2.views import OAuth2Adapter, OAuth2CallbackView, OAuth2LoginView\n'), ((1272... |
#!/usr/bin/env python
# Google Code Jam
# Google Code Jam 2017
# Round 1C 2017
# Problem A. <NAME>
# Solved small test set
from __future__ import print_function, division
import math
import itertools
def get_k_highest_pancakes(n_pancakes, k):
n_pancakes = sorted(n_pancakes, key=lambda x: -x[1])
return n_pa... | [
"itertools.combinations",
"os.path.realpath"
] | [((1284, 1319), 'itertools.combinations', 'itertools.combinations', (['pancakes', 'k'], {}), '(pancakes, k)\n', (1306, 1319), False, 'import itertools\n'), ((1962, 1988), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (1978, 1988), False, 'import os\n'), ((2667, 2693), 'os.path.realpath', '... |
# Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmcv.ops import Correlation
_input1 = [[[[1., 2., 3.], [0., 1., 2.], [3., 5., 2.]]]]
_input2 = [[[[1., 2., 3.], [3., 1., 2.], [8., 5., 2.]]]]
gt_out_shape = (1, 1, 1, 3, 3)
_gt_out = [[[[[1., 4., 9.], [0., 1., 4.], [24., 25., 4.]]]]]
gt_... | [
"torch.ones_like",
"mmcv.ops.Correlation",
"torch.cuda.is_available",
"torch.tensor"
] | [((563, 594), 'mmcv.ops.Correlation', 'Correlation', ([], {'max_displacement': '(0)'}), '(max_displacement=0)\n', (574, 594), False, 'from mmcv.ops import Correlation\n'), ((843, 863), 'torch.ones_like', 'torch.ones_like', (['out'], {}), '(out)\n', (858, 863), False, 'import torch\n'), ((1275, 1300), 'torch.cuda.is_ava... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# **************************************************************************
# Copyright © 2016 jianglin
# File Name: lazy.py
# Author: jianglin
# Email: <EMAIL>
# Created: 2016-11-08 23:02:24 (CST)
# Last Update: Wednesday 2018-09-26 10:52:51 (CST)
# By:
# Descrip... | [
"werkzeug.import_string"
] | [((867, 891), 'werkzeug.import_string', 'import_string', (['self.name'], {}), '(self.name)\n', (880, 891), False, 'from werkzeug import import_string, cached_property\n'), ((1597, 1640), 'werkzeug.import_string', 'import_string', (['(self.module + self.blueprint)'], {}), '(self.module + self.blueprint)\n', (1610, 1640)... |
from flask import Flask
#import json
import RPi.GPIO as GPIO
GPIO.setwarnings(False) # Ignore warning for now
GPIO.setmode(GPIO.BCM) # Use physical pin numbering
GPIO.setup(21, GPIO.OUT, initial=GPIO.LOW)
app = Flask(__name__)
@app.route("/")
def hello():
return "Lets Have a Party"
@app.route("/<key>")
def... | [
"RPi.GPIO.setmode",
"RPi.GPIO.setup",
"flask.Flask",
"RPi.GPIO.output",
"RPi.GPIO.setwarnings"
] | [((62, 85), 'RPi.GPIO.setwarnings', 'GPIO.setwarnings', (['(False)'], {}), '(False)\n', (78, 85), True, 'import RPi.GPIO as GPIO\n'), ((114, 136), 'RPi.GPIO.setmode', 'GPIO.setmode', (['GPIO.BCM'], {}), '(GPIO.BCM)\n', (126, 136), True, 'import RPi.GPIO as GPIO\n'), ((168, 210), 'RPi.GPIO.setup', 'GPIO.setup', (['(21)'... |
import datetime
import warnings
from copy import copy
from types import MappingProxyType
from typing import Sequence, Callable, Mapping, Union, TypeVar, TYPE_CHECKING
import numpy as np
import pandas as pd
import sidekick as sk
from .clinical_acessor import Clinical
from .metaclass import ModelMeta
from .. import fit... | [
"numpy.arange",
"pandas.DataFrame",
"pydemic_ui.model.UIProperty",
"sidekick.property",
"numpy.isfinite",
"datetime.timedelta",
"typing.TypeVar",
"sidekick.import_later",
"datetime.datetime.now",
"pandas.concat",
"types.MappingProxyType",
"datetime.date",
"pandas.to_datetime",
"pandas.Seri... | [((704, 716), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (711, 716), False, 'from typing import Sequence, Callable, Mapping, Union, TypeVar, TYPE_CHECKING\n'), ((723, 746), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (744, 746), False, 'import datetime\n'), ((755, 798), 'datetime... |
""" Testing module for the Proof-Of-Work implementation
of the blockchain client.
"""
import hashlib
import math
import time
from queue import Queue
from queue import Empty
import nacl.encoding
import nacl.signing
from chains import Transaction, Block, Header, PoW_Blockchain
import utils
VERSION = 0.7
class TestP... | [
"math.ceil",
"time.time",
"chains.PoW_Blockchain",
"chains.Block",
"utils.set_debug",
"queue.Queue",
"chains.Header"
] | [((512, 529), 'utils.set_debug', 'utils.set_debug', ([], {}), '()\n', (527, 529), False, 'import utils\n'), ((552, 559), 'queue.Queue', 'Queue', ([], {}), '()\n', (557, 559), False, 'from queue import Queue\n'), ((586, 593), 'queue.Queue', 'Queue', ([], {}), '()\n', (591, 593), False, 'from queue import Queue\n'), ((62... |
import os
import torch
from torchvision import datasets
from utils.boxlist import BoxList
import cv2
import numpy as np
import random
def has_only_empty_bbox(annot):
# if bbox width and height <=1 , then it is a empty box
return all(any(o <= 1 for o in obj['bbox'][2:]) for obj in annot)
def ... | [
"cv2.cvtColor",
"utils.boxlist.BoxList",
"torch.as_tensor",
"os.path.join",
"torch.tensor"
] | [((4207, 4255), 'utils.boxlist.BoxList', 'BoxList', (['boxes', '(width, height)'], {'mode': '"""xyxyxyxy"""'}), "(boxes, (width, height), mode='xyxyxyxy')\n", (4214, 4255), False, 'from utils.boxlist import BoxList\n'), ((4536, 4557), 'torch.tensor', 'torch.tensor', (['classes'], {}), '(classes)\n', (4548, 4557), False... |
# -*- coding: utf-8 -*-
"""
colorful
~~~~~~~~
Terminal string styling done right, in Python.
:copyright: (c) 2017 by <NAME> <<EMAIL>>
:license: MIT, see LICENSE for more details.
"""
import sys
import colorful
def show():
"""
Show the modifiers and colors
"""
# modifiers
s... | [
"colorful.on_yellow",
"colorful.inversed",
"colorful.on_blue",
"colorful.concealed",
"colorful.on_green",
"colorful.italic",
"colorful.green",
"colorful.on_white",
"colorful.struckthrough",
"colorful.cyan",
"colorful.on_red",
"colorful.on_cyan",
"colorful.white",
"colorful.red",
"colorfu... | [((336, 357), 'colorful.bold', 'colorful.bold', (['"""bold"""'], {}), "('bold')\n", (349, 357), False, 'import colorful\n'), ((386, 411), 'colorful.dimmed', 'colorful.dimmed', (['"""dimmed"""'], {}), "('dimmed')\n", (401, 411), False, 'import colorful\n'), ((440, 465), 'colorful.italic', 'colorful.italic', (['"""italic... |
# AUTOGENERATED! DO NOT EDIT! File to edit: 09_rnn.ipynb (unless otherwise specified).
__all__ = ['generate_data', 'encode', 'decode']
# Cell
from tqdm import tqdm
from sklearn.model_selection import train_test_split
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, TimeDistribu... | [
"tqdm.tqdm"
] | [((448, 473), 'tqdm.tqdm', 'tqdm', ([], {'total': 'training_size'}), '(total=training_size)\n', (452, 473), False, 'from tqdm import tqdm\n')] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
query_processing.py - Matches the query against the saved indexed chunks and returns a list of dictionaries with docID
author: <NAME>
email: <EMAIL>
date: 12/1/2017
"""
from bs4 import BeautifulSoup
sample_indexed_chunks_dict = {"'s": {'doc_id': {'0'... | [
"bs4.BeautifulSoup"
] | [((15479, 15503), 'bs4.BeautifulSoup', 'BeautifulSoup', (["a['html']"], {}), "(a['html'])\n", (15492, 15503), False, 'from bs4 import BeautifulSoup\n')] |
from rest_captcha.serializers import RestCaptchaSerializer
from rest_framework import serializers
from .models import OrgAdditionRequest
from apps.profiles.models import UserProfile
class OrgAdditionRequestSerializer(serializers.ModelSerializer):
class Meta:
model = OrgAdditionRequest
fields = ('o... | [
"rest_framework.serializers.CharField"
] | [((519, 628), 'rest_framework.serializers.CharField', 'serializers.CharField', ([], {'max_length': '(24)', 'min_length': '(24)', 'allow_blank': '(False)', 'allow_null': '(False)', 'write_only': '(True)'}), '(max_length=24, min_length=24, allow_blank=False,\n allow_null=False, write_only=True)\n', (540, 628), False, ... |
from posixpath import dirname
from flask import Flask, request, render_template,redirect, url_for,abort,send_from_directory
from werkzeug.utils import secure_filename
import os.path
import tempfile
import io
import os
import base64
from datetime import datetime
from pathlib import Path
import torchvision
from torchvi... | [
"os.remove",
"flask.request.form.get",
"flask.Flask",
"flask.abort",
"werkzeug.utils.secure_filename",
"PIL.Image.open",
"pathlib.Path",
"torchvision.models.detection.fasterrcnn_resnet50_fpn",
"flask.url_for",
"os.path.splitext",
"flask.render_template",
"torch.unsqueeze",
"flask.send_from_d... | [((5165, 5234), 'torchvision.models.detection.fasterrcnn_resnet50_fpn', 'torchvision.models.detection.fasterrcnn_resnet50_fpn', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (5217, 5234), False, 'import torchvision\n'), ((5586, 5601), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (5591, 5601), Fa... |
# -*- coding: utf-8 -*-
from multiprocessing import Pool
import os
import time
start = time.time()
def f(x):
time.sleep(1)
value = x * x
print('{}s passed...\t{}\t(pid:{})'.format(int(time.time() - start), value, os.getpid()))
return value
timeout = time.time() + 10 # sec
while True:
with Pool(pr... | [
"time.sleep",
"multiprocessing.Pool",
"os.getpid",
"time.time"
] | [((88, 99), 'time.time', 'time.time', ([], {}), '()\n', (97, 99), False, 'import time\n'), ((115, 128), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (125, 128), False, 'import time\n'), ((269, 280), 'time.time', 'time.time', ([], {}), '()\n', (278, 280), False, 'import time\n'), ((313, 330), 'multiprocessing.Poo... |
"""
GradeFast Grader - Runs commands on submissions and controls the grading process.
Licensed under the MIT License. For more, see the LICENSE file.
Author: <NAME> <<EMAIL>>
"""
import difflib
import os
import random
import re
from collections import defaultdict
from typing import Any, Dict, List, Mapping, Optional... | [
"iochannels.MemoryLog",
"difflib.ndiff",
"gradefast.events.EndOfSubmissionsEvent",
"gradefast.events.NewSubmissionsEvent",
"gradefast.events.SubmissionStartedEvent",
"pyprovide.inject",
"gradefast.loggingwrapper.get_logger",
"random.choice",
"collections.defaultdict",
"iochannels.HTMLMemoryLog",
... | [((799, 819), 'gradefast.loggingwrapper.get_logger', 'get_logger', (['"""grader"""'], {}), "('grader')\n", (809, 819), False, 'from gradefast.loggingwrapper import get_logger\n'), ((923, 965), 'pyprovide.inject', 'inject', ([], {'injector': 'Injector.CURRENT_INJECTOR'}), '(injector=Injector.CURRENT_INJECTOR)\n', (929, ... |
# Copyright 2015-2016 F5 Networks 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 ... | [
"os.path.join"
] | [((703, 761), 'os.path.join', 'os.path.join', (['SupportedDir', '"""f5_plugins"""', '"""deploy_lb.yaml"""'], {}), "(SupportedDir, 'f5_plugins', 'deploy_lb.yaml')\n", (715, 761), False, 'import os\n')] |
###############################################################################
# plot_afefeh: the basic [a/Fe] vs. [Fe/H] plot for the data section
###############################################################################
import sys
import matplotlib
import numpy
from scipy import special
matplotlib.use('Agg')
f... | [
"galpy.util.bovy_plot.bovy_print",
"define_rcsample._highalpha_lowafe",
"numpy.arange",
"define_rcsample._solar_lowfeh",
"define_rcsample._highfeh_highafe",
"define_rcsample._solar_highfeh",
"define_rcsample._highalpha_lowfeh",
"define_rcsample.get_rcsample",
"define_rcsample._highfeh_lowafe",
"de... | [((297, 318), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (311, 318), False, 'import matplotlib\n'), ((466, 496), 'define_rcsample.get_rcsample', 'define_rcsample.get_rcsample', ([], {}), '()\n', (494, 496), False, 'import define_rcsample\n'), ((521, 543), 'galpy.util.bovy_plot.bovy_print', 'b... |
#!/usr/bin/env python
#=========================================================================
# This is OPEN SOURCE SOFTWARE governed by the Gnu General Public
# License (GPL) version 3, as described at www.opensource.org.
# Author:<NAME>
#=========================================================================
fro... | [
"builtins.open",
"ProgramName.get",
"gzip.open",
"builtins.int"
] | [((1404, 1423), 'builtins.open', 'open', (['outFile', '"""wt"""'], {}), "(outFile, 'wt')\n", (1408, 1423), False, 'from builtins import bytes, dict, int, list, object, range, str, ascii, chr, hex, input, next, oct, open, pow, round, super, filter, map, zip\n'), ((1109, 1132), 'gzip.open', 'gzip.open', (['mtxFile', '"""... |
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
class TransactionsConfig(AppConfig):
name = 'bejmy.transactions'
category = 'transactions'
verbose_name = _("transactions")
def ready(self):
# apply signal receivers after all apps are ready
impo... | [
"django.utils.translation.ugettext_lazy"
] | [((210, 227), 'django.utils.translation.ugettext_lazy', '_', (['"""transactions"""'], {}), "('transactions')\n", (211, 227), True, 'from django.utils.translation import ugettext_lazy as _\n')] |
"""
Copyright (c) 2021 <NAME>
"""
import statedb
import traceback
import time
import datetime
from devicedetectionskill import DetectDevicePresenceSkill
from wheatherskill import WeatherSkill
from daytimeskill import DaytimeSkill
from raumfeldskill import RaumfeldTVWakeup
from hueskill import HueDaytimeAndWeatherSkil... | [
"devicedetectionskill.DetectDevicePresenceSkill",
"daytimeskill.DaytimeSkill",
"time.sleep",
"raumfeldskill.RaumfeldTVWakeup",
"statedb.StateDataBase",
"hueskill.HueDaytimeAndWeatherSkill",
"wheatherskill.WeatherSkill"
] | [((456, 479), 'statedb.StateDataBase', 'statedb.StateDataBase', ([], {}), '()\n', (477, 479), False, 'import statedb\n'), ((498, 571), 'devicedetectionskill.DetectDevicePresenceSkill', 'DetectDevicePresenceSkill', ([], {'statedb': 'statedb', 'settingsFile': 'jsonSettingsFile'}), '(statedb=statedb, settingsFile=jsonSett... |
import logging
import torch
from torch import nn
from transformers import AutoModel
from ..pooling import MeanPooling
logger = logging.getLogger(__name__)
class SiameseTransformer(nn.Module):
def __init__(self, args, config):
super(SiameseTransformer, self).__init__()
self.model_a = AutoModel.fro... | [
"torch.nn.CrossEntropyLoss",
"torch.cat",
"transformers.AutoModel.from_pretrained",
"logging.info",
"torch.nn.Linear",
"logging.getLogger"
] | [((129, 156), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (146, 156), False, 'import logging\n'), ((307, 395), 'transformers.AutoModel.from_pretrained', 'AutoModel.from_pretrained', (['args.model_name'], {'config': 'config', 'cache_dir': 'args.cache_dir'}), '(args.model_name, config=co... |
# Code generated by `typeddictgen`. DO NOT EDIT.
"""V1WindowsSecurityContextOptionsDict generated type."""
from typing import TypedDict
V1WindowsSecurityContextOptionsDict = TypedDict(
"V1WindowsSecurityContextOptionsDict",
{
"gmsaCredentialSpec": str,
"gmsaCredentialSpecName": str,
"ru... | [
"typing.TypedDict"
] | [((175, 322), 'typing.TypedDict', 'TypedDict', (['"""V1WindowsSecurityContextOptionsDict"""', "{'gmsaCredentialSpec': str, 'gmsaCredentialSpecName': str, 'runAsUserName': str\n }"], {'total': '(False)'}), "('V1WindowsSecurityContextOptionsDict', {'gmsaCredentialSpec': str,\n 'gmsaCredentialSpecName': str, 'runAsU... |
from urllib import parse
from flask import Flask, send_from_directory
from flask_restful import Resource, Api, reqparse, fields, marshal_with
from os import path
from datetime import datetime
import json
app = Flask(__name__)
api = Api(app)
# parser = reqparse.RequestParser()
users = {"test": "1"}
rooms = {
"Pub... | [
"flask_restful.Api",
"os.path.realpath",
"flask.Flask",
"flask_restful.reqparse.RequestParser",
"flask.send_from_directory",
"datetime.datetime.now"
] | [((211, 226), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (216, 226), False, 'from flask import Flask, send_from_directory\n'), ((234, 242), 'flask_restful.Api', 'Api', (['app'], {}), '(app)\n', (237, 242), False, 'from flask_restful import Resource, Api, reqparse, fields, marshal_with\n'), ((585, 608),... |
import typing as tp
from datetime import date
import numpy as np
import pendulum
def get_latest_price_from_quote(price_data: tp.Dict[str, tp.Any]) -> float:
if not price_data:
raise ValueError("No price data found.")
# regular market price
regular_market_price = price_data["regularMarketPrice"][... | [
"pendulum.now",
"datetime.date.today",
"pendulum.from_timestamp"
] | [((353, 409), 'pendulum.from_timestamp', 'pendulum.from_timestamp', (["price_data['regularMarketTime']"], {}), "(price_data['regularMarketTime'])\n", (376, 409), False, 'import pendulum\n'), ((745, 797), 'pendulum.from_timestamp', 'pendulum.from_timestamp', (["price_data['preMarketTime']"], {}), "(price_data['preMarket... |