code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
Copyright 2019-2021 <NAME>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in wr... | [
"torch.arange"
] | [((869, 894), 'torch.arange', 'torch.arange', (['cardinality'], {}), '(cardinality)\n', (881, 894), False, 'import torch\n')] |
import pandas as pd
import trade_client as tr
import settings
import logging
import processing
import time
import datetime
from joblib import load
import csv
import warnings
warnings.simplefilter(action='ignore',
category=pd.core.common.SettingWithCopyWarning)
def write_csv(time_str, predict_re... | [
"logging.basicConfig",
"trade_client.trade_client",
"pandas.read_csv",
"csv.writer",
"pandas.DataFrame.from_dict",
"datetime.timedelta",
"processing.fillter_datetime_dict",
"datetime.datetime.today",
"time.sleep",
"processing.drop_column",
"datetime.datetime.fromisoformat",
"joblib.load",
"w... | [((175, 266), 'warnings.simplefilter', 'warnings.simplefilter', ([], {'action': '"""ignore"""', 'category': 'pd.core.common.SettingWithCopyWarning'}), "(action='ignore', category=pd.core.common.\n SettingWithCopyWarning)\n", (196, 266), False, 'import warnings\n'), ((528, 566), 'pandas.read_csv', 'pd.read_csv', (['s... |
#!/usr/bin/env python3
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, softwar... | [
"openstack.enable_logging",
"openstack.connect"
] | [((627, 657), 'openstack.enable_logging', 'openstack.enable_logging', (['(True)'], {}), '(True)\n', (651, 657), False, 'import openstack\n'), ((665, 695), 'openstack.connect', 'openstack.connect', ([], {'cloud': '"""otc"""'}), "(cloud='otc')\n", (682, 695), False, 'import openstack\n')] |
#
# usage:
# python3 raw-aer-diff.py -first result1.txt -second result2.txt > out.html
#
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-first', required=True)
parser.add_argument('-second', required=True)
args = parser.parse_args()
fp = open(args.first)
first = fp.read().split("\n")[:-1]
fi... | [
"argparse.ArgumentParser"
] | [((116, 141), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (139, 141), False, 'import argparse\n')] |
# python3.6
import random
import base64
from paho.mqtt import client as mqtt_client
broker = '172.16.58.3'
port = 1883
topic = "info/12340000000000"
# generate client ID with pub prefix randomly
client_id = f'python-mqtt-{random.randint(0, 100)}'
# username = 'emqx'
# password = '<PASSWORD>'
def ecg(mensagem):
... | [
"paho.mqtt.client.Client",
"numpy.core.fromnumeric.size",
"random.randint"
] | [((1923, 1952), 'paho.mqtt.client.Client', 'mqtt_client.Client', (['client_id'], {}), '(client_id)\n', (1941, 1952), True, 'from paho.mqtt import client as mqtt_client\n'), ((226, 248), 'random.randint', 'random.randint', (['(0)', '(100)'], {}), '(0, 100)\n', (240, 248), False, 'import random\n'), ((1084, 1100), 'numpy... |
"""This script implements a low-rank linear layer."""
import torch
import torch.nn as nn
from .hypercomplex.inits import glorot_uniform, glorot_normal
class LowRankLinear(torch.nn.Module):
def __init__(self, input_dim: int, output_dim: int, rank: int = 1,
bias: bool = True, w_init: str = "glorot-uniform... | [
"torch.zeros_like",
"torch.matmul",
"torch.Tensor"
] | [((1455, 1485), 'torch.matmul', 'torch.matmul', ([], {'input': 'x', 'other': 'W'}), '(input=x, other=W)\n', (1467, 1485), False, 'import torch\n'), ((557, 593), 'torch.Tensor', 'torch.Tensor', ([], {'size': '(input_dim, rank)'}), '(size=(input_dim, rank))\n', (569, 593), False, 'import torch\n'), ((651, 688), 'torch.Te... |
from pudding.clustering import kmeans
import pytest
import numpy as np
from sklearn.datasets import make_blobs
import pudding
def testKmeansToyData():
'''
Test KMeans uisng a toy dataset
'''
X = [[0.0, 0.0], [0.5, 0.0], [0.5, 1.0], [1.0, 1.0]]
initial_centers = [[0.0, 0.0], [1.0, 1.0]]
expecte... | [
"pytest.approx",
"sklearn.datasets.make_blobs",
"numpy.array",
"numpy.random.seed",
"pudding.clustering.KMeans"
] | [((1473, 1493), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (1487, 1493), True, 'import numpy as np\n'), ((1575, 1647), 'sklearn.datasets.make_blobs', 'make_blobs', ([], {'n_samples': 'n_examples', 'centers': 'truth_centers', 'cluster_std': '(0.7)'}), '(n_samples=n_examples, centers=truth_centers... |
from rest_framework import serializers
from post.models import Post
class PostSerializer(serializers.ModelSerializer):
username = serializers.SerializerMethodField('get_username_from_author')
user_id = serializers.SerializerMethodField('get_id_from_author')
class Meta:
model = Post
fiel... | [
"rest_framework.serializers.SerializerMethodField"
] | [((138, 199), 'rest_framework.serializers.SerializerMethodField', 'serializers.SerializerMethodField', (['"""get_username_from_author"""'], {}), "('get_username_from_author')\n", (171, 199), False, 'from rest_framework import serializers\n'), ((214, 269), 'rest_framework.serializers.SerializerMethodField', 'serializers... |
from django.shortcuts import render
from .models import *
from django.db.models import Q,F,Aggregate
from django.http import HttpResponse, HttpResponseRedirect, QueryDict, JsonResponse
from django.urls import reverse
from django.template import loader
# Create your views here.
def game(req):
return render(req,'2048... | [
"django.shortcuts.render",
"django.urls.reverse",
"django.http.HttpResponseRedirect",
"django.http.JsonResponse"
] | [((304, 328), 'django.shortcuts.render', 'render', (['req', '"""2048.html"""'], {}), "(req, '2048.html')\n", (310, 328), False, 'from django.shortcuts import render\n'), ((897, 918), 'django.http.JsonResponse', 'JsonResponse', (['my_dict'], {}), '(my_dict)\n', (909, 918), False, 'from django.http import HttpResponse, H... |
from azureml.core.webservice import AksWebservice,AciWebservice
from azureml.core import Workspace
from ml_service.utils.environment_variables import ENV
import secrets
import requests
import time
import argparse
input = {"data": [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
[10, 9, 8, 7, 6, 5, 4, 3, 2, 1]]}
out... | [
"secrets.token_hex",
"requests.post",
"argparse.ArgumentParser",
"azureml.core.Workspace.get",
"azureml.core.webservice.AksWebservice",
"azureml.core.webservice.AciWebservice",
"time.sleep",
"ml_service.utils.environment_variables.ENV"
] | [((404, 512), 'azureml.core.Workspace.get', 'Workspace.get', ([], {'name': 'e.workspace_name', 'subscription_id': 'e.subscription_id', 'resource_group': 'e.resource_group'}), '(name=e.workspace_name, subscription_id=e.subscription_id,\n resource_group=e.resource_group)\n', (417, 512), False, 'from azureml.core impor... |
from magesim.simulation import Sim
s = Sim()
s.run()
s.print_log() | [
"magesim.simulation.Sim"
] | [((40, 45), 'magesim.simulation.Sim', 'Sim', ([], {}), '()\n', (43, 45), False, 'from magesim.simulation import Sim\n')] |
import numpy as np
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras.layers import Dense, Flatten, Conv2D, Input, BatchNormalization, Activation, Add
import os
import math
from typing import Optional, Dict, Tuple, Any
from game import Game, State
import constants as c
os.environ['TF_CPP_MIN_L... | [
"tensorflow.keras.layers.Input",
"numpy.flip",
"tensorflow.keras.Model",
"tensorflow.keras.layers.Conv2D",
"tensorflow.keras.layers.Add",
"tensorflow.keras.layers.BatchNormalization",
"numpy.array",
"numpy.zeros",
"game.Game.get_legal_moves",
"tensorflow.keras.layers.Dense",
"tensorflow.optimize... | [((7261, 7300), 'game.Game', 'Game', (['"""8/1P3k2/8/8/8/8/4K3/8 w - - 0 1"""'], {}), "('8/1P3k2/8/8/8/8/4K3/8 w - - 0 1')\n", (7265, 7300), False, 'from game import Game, State\n'), ((382, 407), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (397, 407), False, 'import os\n'), ((1099, 1142), ... |
from elasticsearch import Elasticsearch
def es_connection():
elasticsearch_host = 'http://localhost:9200/'
return Elasticsearch([elasticsearch_host], verify_certs=True)
def specific_study_search(identifier_type, identifier_value):
es_client = es_connection()
query_body = {
"query": {
... | [
"elasticsearch.Elasticsearch"
] | [((124, 178), 'elasticsearch.Elasticsearch', 'Elasticsearch', (['[elasticsearch_host]'], {'verify_certs': '(True)'}), '([elasticsearch_host], verify_certs=True)\n', (137, 178), False, 'from elasticsearch import Elasticsearch\n')] |
import pandas as pd
import matplotlib.pyplot as plt
import datetime
import torch
import torch.nn as nn
import numpy as np
from torch.utils.data import Dataset, DataLoader
def generate_df_affect_by_n_days(series, n, index=False):
if len(series) <= n:
raise Exception("The Length of series is %d, while affec... | [
"torch.squeeze",
"numpy.mean",
"pandas.read_csv",
"torch.utils.data.DataLoader",
"torch.nn.LSTM",
"torch.unsqueeze",
"torch.load",
"matplotlib.pyplot.plot",
"torch.Tensor",
"numpy.array",
"torch.nn.MSELoss",
"torch.save",
"numpy.std",
"pandas.DataFrame",
"torch.nn.Linear",
"matplotlib.... | [((2113, 2158), 'matplotlib.pyplot.plot', 'plt.plot', (['df_index', 'df_all'], {'label': '"""real-data"""'}), "(df_index, df_all, label='real-data')\n", (2121, 2158), True, 'import matplotlib.pyplot as plt\n'), ((2171, 2183), 'numpy.array', 'np.array', (['df'], {}), '(df)\n', (2179, 2183), True, 'import numpy as np\n')... |
from django.db import models
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.core.urlresolvers import reverse
# Create your models here.
class Visitor(models.Model):
"""docstring for Visitor"""
user = models.OneToOneField(Use... | [
"django.dispatch.receiver",
"django.db.models.OneToOneField",
"django.core.urlresolvers.reverse",
"django.db.models.IntegerField"
] | [((584, 616), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'User'}), '(post_save, sender=User)\n', (592, 616), False, 'from django.dispatch import receiver\n'), ((743, 775), 'django.dispatch.receiver', 'receiver', (['post_save'], {'sender': 'User'}), '(post_save, sender=User)\n', (751, 775), False... |
import unittest
from aids.strings.is_anagram import *
class IsAnagramTestCase(unittest.TestCase):
'''
Unit tests for determine anagrams
'''
def setUp(self):
pass
def test_is_anagram_sort(self):
self.assertTrue(is_anagram_sort('listen', 'silent'))
def test_is_anagram(self):
... | [
"unittest.main"
] | [((533, 548), 'unittest.main', 'unittest.main', ([], {}), '()\n', (546, 548), False, 'import unittest\n')] |
#!/usr/bin/env python3
# coding: utf-8
import seaborn as sns
import matplotlib
from matplotlib import pyplot as plt
#import pandas as pd
import os
import csv
import sys
# common setup BEGIN
cur_dir = os.path.dirname(os.path.realpath(__file__))
plt.figure(figsize=[3.6, 2.8])
sns.set_style("whitegrid")
sns.set_palette... | [
"matplotlib.pyplot.savefig",
"matplotlib.rcParams.update",
"seaborn.distplot",
"seaborn.color_palette",
"matplotlib.pyplot.gca",
"seaborn.set_style",
"os.path.realpath",
"matplotlib.pyplot.figure",
"os.path.basename",
"matplotlib.pyplot.show"
] | [((247, 277), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '[3.6, 2.8]'}), '(figsize=[3.6, 2.8])\n', (257, 277), True, 'from matplotlib import pyplot as plt\n'), ((278, 304), 'seaborn.set_style', 'sns.set_style', (['"""whitegrid"""'], {}), "('whitegrid')\n", (291, 304), True, 'import seaborn as sns\n'), (... |
import numpy
from neural_network import NeuralNetwork
NR_INPUT_NODES = 784
NR_HIDDEN_NODES = 200
NR_OUTPUT_NODES = 10
LEARNING_RATE = 0.1
EPOCH = 5
neural_network = NeuralNetwork(NR_INPUT_NODES, NR_HIDDEN_NODES, NR_OUTPUT_NODES, LEARNING_RATE)
training_data_file = open('dataset/training/mnist_train.csv')
training_... | [
"neural_network.NeuralNetwork",
"numpy.asarray",
"numpy.argmax",
"numpy.asfarray",
"numpy.zeros"
] | [((169, 247), 'neural_network.NeuralNetwork', 'NeuralNetwork', (['NR_INPUT_NODES', 'NR_HIDDEN_NODES', 'NR_OUTPUT_NODES', 'LEARNING_RATE'], {}), '(NR_INPUT_NODES, NR_HIDDEN_NODES, NR_OUTPUT_NODES, LEARNING_RATE)\n', (182, 247), False, 'from neural_network import NeuralNetwork\n'), ((1386, 1410), 'numpy.asarray', 'numpy.... |
import copy
from PyQt5.QtWidgets import QUndoCommand
from urh.signalprocessing.ProtocolAnalyzer import ProtocolAnalyzer
from urh.signalprocessing.ProtocolAnalyzerContainer import ProtocolAnalyzerContainer
class InsertBitsAndPauses(QUndoCommand):
def __init__(self, proto_analyzer_container: ProtocolAnalyzerConta... | [
"copy.deepcopy"
] | [((771, 824), 'copy.deepcopy', 'copy.deepcopy', (['self.proto_analyzer_container.messages'], {}), '(self.proto_analyzer_container.messages)\n', (784, 824), False, 'import copy\n')] |
# -*- coding: utf-8 -*
"""Implementation of the ``repeat_analysis`` step
The ``repeat_analysis`` step takes as the input the results of the ``ngs_mapping`` step
(aligned reads in BAM format) and performs repeat expansion analysis. The result are variant files
(VCF) with the repeat expansions definitions, and associat... | [
"collections.OrderedDict",
"snappy_pipeline.base.UnsupportedActionException",
"os.path.join",
"snappy_pipeline.workflows.repeat_expansion.annotate_expansionhunter.AnnotateExpansionHunter",
"os.getcwd",
"snakemake.io.expand"
] | [((3744, 3757), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (3755, 3757), False, 'from collections import OrderedDict\n'), ((5177, 5218), 'snappy_pipeline.base.UnsupportedActionException', 'UnsupportedActionException', (['error_message'], {}), '(error_message)\n', (5203, 5218), False, 'from snappy_pipel... |
# ISD Copyright (c) 2021 <NAME>
# Licensed under the MIT license
# https://github.com/Cooolrik/ISD/blob/main/LICENSE
import CodeGeneratorHelpers as hlp
import Entities as ents
def CreateEntityHeader(entity):
lines = []
lines.append('// ISD Copyright (c) 2021 <NAME>')
lines.append('// Licensed under the MIT license ... | [
"CodeGeneratorHelpers.get_base_type_variant",
"CodeGeneratorHelpers.write_lines_to_file"
] | [((4618, 4679), 'CodeGeneratorHelpers.write_lines_to_file', 'hlp.write_lines_to_file', (['f"""../ISD/ISD_{entity.Name}.h"""', 'lines'], {}), "(f'../ISD/ISD_{entity.Name}.h', lines)\n", (4641, 4679), True, 'import CodeGeneratorHelpers as hlp\n'), ((4877, 4912), 'CodeGeneratorHelpers.get_base_type_variant', 'hlp.get_base... |
# -*- coding: utf-8 -*-
import json
from cms.api import add_plugin, create_page
from cms.test_utils.testcases import CMSTestCase
from djangocms_transfer.exporter import export_page
from djangocms_translations.providers.supertext import (
_get_translation_export_content, _set_translation_import_content,
)
class... | [
"cms.api.create_page",
"cms.api.add_plugin",
"djangocms_transfer.exporter.export_page",
"djangocms_translations.providers.supertext._get_translation_export_content"
] | [((477, 541), 'cms.api.create_page', 'create_page', (['"""test page"""', '"""test_page.html"""', '"""en"""'], {'published': '(True)'}), "('test page', 'test_page.html', 'en', published=True)\n", (488, 541), False, 'from cms.api import add_plugin, create_page\n'), ((858, 929), 'cms.api.add_plugin', 'add_plugin', (['self... |
import boto3
import logging
import os
logger = logging.getLogger()
logger.setLevel(logging.INFO)
region = os.environ['AWS_REGION']
ec2 = boto3.resource('ec2', region_name=region)
def lambda_handler(event, context):
filters = [
{
'Name': 'tag:AutoStop',
'Values': ['... | [
"logging.getLogger",
"boto3.resource"
] | [((52, 71), 'logging.getLogger', 'logging.getLogger', ([], {}), '()\n', (69, 71), False, 'import logging\n'), ((147, 188), 'boto3.resource', 'boto3.resource', (['"""ec2"""'], {'region_name': 'region'}), "('ec2', region_name=region)\n", (161, 188), False, 'import boto3\n')] |
import requests
from .exceptions import QuidMustLoginException, QuidUnauthorizedException, \
QuidTooManyRetriesException
class QuidRequests:
refresh_token = None
access_token = None
def __init__(self, quid_uri: str, server_uri: str,
namespace: str, timeouts={
"re... | [
"requests.post",
"requests.get"
] | [((1179, 1206), 'requests.post', 'requests.post', (['uri', 'payload'], {}), '(uri, payload)\n', (1192, 1206), False, 'import requests\n'), ((1995, 2022), 'requests.post', 'requests.post', (['uri', 'payload'], {}), '(uri, payload)\n', (2008, 2022), False, 'import requests\n'), ((2696, 2753), 'requests.get', 'requests.ge... |
#!/usr/bin/env python3
# TODO:
# - option to only extract given files
# - automatically link textures/materials to models
# - option to merge a gameobject's multiple models
# - option to clobber existing files
import sys
import os
import traceback
import subprocess
import argparse
from io import BytesIO
from ... | [
"os.path.exists",
"os.listdir",
"unitypack.export.OBJMesh",
"io.BytesIO",
"os.path.join",
"os.path.dirname",
"os.path.isdir",
"os.path.basename",
"PIL.ImageOps.flip",
"sys.exit",
"traceback.print_exc",
"unitypack.environment.UnityEnvironment"
] | [((688, 706), 'unitypack.environment.UnityEnvironment', 'UnityEnvironment', ([], {}), '()\n', (704, 706), False, 'from unitypack.environment import UnityEnvironment\n'), ((1152, 1172), 'os.path.exists', 'os.path.exists', (['path'], {}), '(path)\n', (1166, 1172), False, 'import os\n'), ((1791, 1811), 'PIL.ImageOps.flip'... |
import logging
from abc import ABCMeta
from typing import Optional, Sequence
from wyze_sdk.errors import WyzeClientConfigurationError
from wyze_sdk.service import (ApiServiceClient, EarthServiceClient,
GeneralApiServiceClient, PlatformServiceClient,
ScaleServ... | [
"logging.getLogger",
"wyze_sdk.errors.WyzeClientConfigurationError",
"wyze_sdk.service.GeneralApiServiceClient"
] | [((604, 631), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (621, 631), False, 'import logging\n'), ((2150, 2277), 'wyze_sdk.service.GeneralApiServiceClient', 'GeneralApiServiceClient', ([], {'token': 'self._token', 'user_id': 'self._user_id'}), "(token=self._token, **{'base_url': self._... |
import os
import sys
import uuid
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
import common.tms_logger as logger
class AES_GCM():
NONCE_BYTE_SIZE = 12
__aesgcm = None
def __init__(self, key):
self.__aesgcm = AESGCM(key)
... | [
"os.urandom",
"cryptography.hazmat.primitives.ciphers.aead.AESGCM"
] | [((307, 318), 'cryptography.hazmat.primitives.ciphers.aead.AESGCM', 'AESGCM', (['key'], {}), '(key)\n', (313, 318), False, 'from cryptography.hazmat.primitives.ciphers.aead import AESGCM\n'), ((434, 466), 'os.urandom', 'os.urandom', (['self.NONCE_BYTE_SIZE'], {}), '(self.NONCE_BYTE_SIZE)\n', (444, 466), False, 'import ... |
# notes for this course can be found at:
# https://deeplearningcourses.com/c/data-science-linear-regression-in-python
# https://www.udemy.com/data-science-linear-regression-in-python
import numpy as np
import matplotlib.pyplot as plt
def make_poly(X, deg):
n = len(X)
data = [np.ones(n)]
for d in xrange(... | [
"numpy.ones",
"numpy.random.choice",
"matplotlib.pyplot.plot",
"numpy.linspace",
"numpy.vstack",
"matplotlib.pyplot.scatter",
"numpy.sin",
"matplotlib.pyplot.title",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.show"
] | [((526, 553), 'numpy.random.choice', 'np.random.choice', (['N', 'sample'], {}), '(N, sample)\n', (542, 553), True, 'import numpy as np\n'), ((611, 638), 'matplotlib.pyplot.scatter', 'plt.scatter', (['Xtrain', 'Ytrain'], {}), '(Xtrain, Ytrain)\n', (622, 638), True, 'import matplotlib.pyplot as plt\n'), ((643, 653), 'mat... |
# Generated by Django 2.1.7 on 2019-06-18 16:08
from django.db import migrations, models
from course_catalog.constants import ListType
class Migration(migrations.Migration):
dependencies = [("course_catalog", "0025_adds_favorites_renames_learningpath")]
operations = [
migrations.RenameField(
... | [
"django.db.migrations.RenameField",
"django.db.models.CharField"
] | [((291, 392), 'django.db.migrations.RenameField', 'migrations.RenameField', ([], {'model_name': '"""userlistitem"""', 'old_name': '"""learning_path"""', 'new_name': '"""user_list"""'}), "(model_name='userlistitem', old_name='learning_path',\n new_name='user_list')\n", (313, 392), False, 'from django.db import migrat... |
# -*- coding: utf-8 -*-
"""
mslib.utils.verify_user_token
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Collection of unit conversion related routines for the Mission Support System.
This file is part of mss.
:copyright: Copyright 2008-2014 Deutsches Zentrum fuer Luft- und Raumfahrt e.V.
:copyright: Copyrig... | [
"logging.debug",
"requests.get",
"mslib.utils.config.config_loader"
] | [((1162, 1217), 'mslib.utils.config.config_loader', 'config_loader', ([], {'dataset': '"""mscolab_skip_verify_user_token"""'}), "(dataset='mscolab_skip_verify_user_token')\n", (1175, 1217), False, 'from mslib.utils.config import config_loader\n'), ((1303, 1367), 'requests.get', 'requests.get', (['f"""{mscolab_server_ur... |
'''
Adapted from article: http://stackoverflow.com/questions/1171166/how-can-i-profile-a-sqlalchemy-powered-application
'''
import cProfile as profiler
import gc, pstats, time
def profile(fn):
def wrapper(*args, **kw):
elapsed, stat_loader, result = _profile("foo.txt", fn, *args, **kw)
s... | [
"pstats.Stats",
"time.time",
"gc.collect"
] | [((651, 663), 'gc.collect', 'gc.collect', ([], {}), '()\n', (661, 663), False, 'import gc, pstats, time\n'), ((677, 688), 'time.time', 'time.time', ([], {}), '()\n', (686, 688), False, 'import gc, pstats, time\n'), ((791, 802), 'time.time', 'time.time', ([], {}), '()\n', (800, 802), False, 'import gc, pstats, time\n'),... |
import random
import itertools
import collections
#OZNAKE
#zapis karte: (stevilo, znak)
znaki = ['KARA', 'KRIZ', 'SRCE', 'PIK']
stevila = [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
oznake_slike = {
1: '1',
2: '2',
3: '3',
4: '4',
5: '5',
6: '6',
7: '7',
8: '8',
9: '9',
10: '1... | [
"itertools.combinations",
"random.choice",
"random.shuffle"
] | [((1165, 1184), 'random.shuffle', 'random.shuffle', (['kup'], {}), '(kup)\n', (1179, 1184), False, 'import random\n'), ((1484, 1503), 'random.shuffle', 'random.shuffle', (['kup'], {}), '(kup)\n', (1498, 1503), False, 'import random\n'), ((5647, 5679), 'itertools.combinations', 'itertools.combinations', (['karte', '(5)'... |
#!/usr/bin/env python
import setuptools
import os
os.chmod("run.py", 0o744)
setuptools.setup(
name='neurSLS',
version='1.0',
url='https://github.com/DecodEPFL/neurSLS',
license='CC-BY-4.0 License',
author='<NAME>',
author_email='<EMAIL>',
description='Neural System Level Synthesis',
pa... | [
"setuptools.find_packages",
"os.chmod"
] | [((51, 74), 'os.chmod', 'os.chmod', (['"""run.py"""', '(484)'], {}), "('run.py', 484)\n", (59, 74), False, 'import os\n'), ((327, 353), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (351, 353), False, 'import setuptools\n')] |
from django.contrib import admin
from django.contrib.gis.admin import GeoModelAdmin
from simple_history.admin import SimpleHistoryAdmin
from locations.models import FeatureCategory, Feature, Location, Comment, Photo
admin.site.register(FeatureCategory, SimpleHistoryAdmin)
admin.site.register(Feature, SimpleHistoryAdm... | [
"django.contrib.admin.site.register"
] | [((218, 274), 'django.contrib.admin.site.register', 'admin.site.register', (['FeatureCategory', 'SimpleHistoryAdmin'], {}), '(FeatureCategory, SimpleHistoryAdmin)\n', (237, 274), False, 'from django.contrib import admin\n'), ((275, 323), 'django.contrib.admin.site.register', 'admin.site.register', (['Feature', 'SimpleH... |
"""
预测3
BY 李说啥都对
2018.3
"""
import os
import numpy as np
import tensorflow as tf
from PIL import Image
from cfg_3 import MAX_CAPTCHA, CHAR_SET_LEN, model_path_3_1, model_path_3_2, model_path_3_3
from cnn_sys_3 import crack_captcha_cnn, X, keep_prob
from utils_3 import vec2text, get_clear_bin_image
from PyQt... | [
"os.listdir",
"PIL.Image.open",
"tensorflow.Session",
"tensorflow.train.Saver",
"utils_3.vec2text",
"numpy.array",
"numpy.zeros",
"PyQt5.QtWidgets.QApplication.processEvents",
"utils_3.get_clear_bin_image",
"tensorflow.reshape",
"tensorflow.train.latest_checkpoint",
"cnn_sys_3.crack_captcha_cn... | [((536, 572), 'numpy.zeros', 'np.zeros', (['(MAX_CAPTCHA * CHAR_SET_LEN)'], {}), '(MAX_CAPTCHA * CHAR_SET_LEN)\n', (544, 572), True, 'import numpy as np\n'), ((674, 690), 'utils_3.vec2text', 'vec2text', (['vector'], {}), '(vector)\n', (682, 690), False, 'from utils_3 import vec2text, get_clear_bin_image\n'), ((767, 786... |
from LESO import System
from LESO import PhotoVoltaic, Wind, Lithium, Grid, FinalBalance
import os
import pandas as pd
import LESO
battery_cost_factor = 0.41
pv_cost_factor = 0.38
#%% Define system and components
modelname = "cablepool_alternative"
lat, lon = 51.81, 5.84 # Nijmegen
SDE_price = 55
equity_share = 0.... | [
"pandas.read_pickle",
"LESO.Wind",
"LESO.FinalBalance",
"LESO.Grid",
"os.path.dirname",
"LESO.System",
"LESO.Lithium",
"LESO.PhotoVoltaic"
] | [((548, 578), 'pandas.read_pickle', 'pd.read_pickle', (['price_filepath'], {}), '(price_filepath)\n', (562, 578), True, 'import pandas as pd\n'), ((1084, 1157), 'LESO.System', 'System', ([], {'lat': 'lat', 'lon': 'lon', 'model_name': 'modelname', 'equity_share': 'equity_share'}), '(lat=lat, lon=lon, model_name=modelnam... |
import argparse,cmd,functools,json,os,re,time
import fgoCore
from fgoIniParser import IniParser
logger=fgoCore.getLogger('Cli')
def wrapTry(func):
@functools.wraps(func)
def wrapper(self,*args,**kwargs):
try:return func(self,*args,**kwargs)
except ArgError as e:
if e.args[0]is not ... | [
"fgoIniParser.IniParser",
"fgoCore.Device.enumDevices",
"re.match",
"fgoCore.control.stopOnKizunaReisou",
"functools.wraps",
"time.sleep",
"json.load",
"fgoCore.fuse.reset",
"argparse.Namespace",
"fgoCore.control.reset",
"fgoCore.Device",
"fgoCore.control.stopOnDefeated",
"os.system",
"fgo... | [((104, 128), 'fgoCore.getLogger', 'fgoCore.getLogger', (['"""Cli"""'], {}), "('Cli')\n", (121, 128), False, 'import fgoCore\n'), ((154, 175), 'functools.wraps', 'functools.wraps', (['func'], {}), '(func)\n', (169, 175), False, 'import argparse, cmd, functools, json, os, re, time\n'), ((1154, 1180), 'fgoIniParser.IniPa... |
import os
from chazutsu.datasets.framework.xtqdm import xtqdm
from chazutsu.datasets.framework.dataset import Dataset
from chazutsu.datasets.framework.resource import Resource
class MovieReview(Dataset):
def __init__(self, kind="polarity"):
super().__init__(
name="Moview Review Data",
... | [
"os.listdir",
"chazutsu.datasets.framework.resource.Resource",
"os.path.join",
"os.path.isdir",
"os.path.basename",
"chazutsu.datasets.framework.xtqdm.xtqdm"
] | [((3386, 3435), 'os.path.join', 'os.path.join', (['dataset_root', '"""review_polarity.txt"""'], {}), "(dataset_root, 'review_polarity.txt')\n", (3398, 3435), False, 'import os\n'), ((3460, 3508), 'os.path.join', 'os.path.join', (['extracted_path', '"""txt_sentoken/neg"""'], {}), "(extracted_path, 'txt_sentoken/neg')\n"... |
"""
This module has simple examples of multicore programs.
The first few examples are the same as those in
IoTPy/IoTPy/tests/multicore_test.py
"""
import sys
import os
import threading
import random
import multiprocessing
import numpy as np
sys.path.append(os.path.abspath("../multiprocessing"))
sys.path.append(os.path... | [
"run.run",
"time.sleep",
"print_stream.print_stream",
"multicore.copy_data_to_stream",
"os.path.abspath",
"multicore.multicore",
"stream.Stream"
] | [((258, 295), 'os.path.abspath', 'os.path.abspath', (['"""../multiprocessing"""'], {}), "('../multiprocessing')\n", (273, 295), False, 'import os\n'), ((313, 339), 'os.path.abspath', 'os.path.abspath', (['"""../core"""'], {}), "('../core')\n", (328, 339), False, 'import os\n'), ((357, 390), 'os.path.abspath', 'os.path.... |
from parlaparser.data_parsers.base_parser import PdfParser
from parlaparser import settings
from enum import Enum
from collections import Counter
from datetime import datetime, timedelta
import logging
import re
class ParserState(Enum):
META = 1
TITLE = 2
RESULT = 3
CONTENT = 4
VOTE = 5
PRE_TIT... | [
"re.split",
"logging.debug",
"datetime.datetime.strptime",
"logging.warning",
"re.findall",
"logging.info"
] | [((531, 566), 'logging.debug', 'logging.debug', (["data['session_name']"], {}), "(data['session_name'])\n", (544, 566), False, 'import logging\n'), ((13545, 13567), 're.split', 're.split', (['"""\\\\s+"""', 'data'], {}), "('\\\\s+', data)\n", (13553, 13567), False, 'import re\n'), ((3087, 3145), 'datetime.datetime.strp... |
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
"openstack.cdn.v1.statistic.BandwidthDetail",
"openstack.cdn.v1.statistic.ConsumptionSummaryDetail",
"mock.Mock",
"openstack.cdn.v1.statistic.BandwidthPeak",
"openstack.cdn.v1.statistic.NetworkTraffic",
"openstack.cdn.v1.statistic.ConsumptionSummary",
"openstack.cdn.v1.statistic.NetworkTrafficDetail"
] | [((1077, 1088), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1086, 1088), False, 'import mock\n'), ((1173, 1184), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (1182, 1184), False, 'import mock\n'), ((2715, 2726), 'mock.Mock', 'mock.Mock', ([], {}), '()\n', (2724, 2726), False, 'import mock\n'), ((2811, 2822), 'mock.Mock... |
import random
import pickle
with open("run_number", 'rb') as f:
run_number = pickle.load(f)
def sus_info():
global run_number
suspects = {0: {"Name": "<NAME>", "Blood Type": "AB+", "Occupation": "actor", "Hair Color": "brown", "Age": 64,
"Sex": "man"},
1... | [
"random.choice",
"pickle.dump",
"random.randrange",
"pickle.load",
"random.randint"
] | [((86, 100), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (97, 100), False, 'import pickle\n'), ((1787, 1801), 'pickle.load', 'pickle.load', (['f'], {}), '(f)\n', (1798, 1801), False, 'import pickle\n'), ((1853, 1876), 'random.choice', 'random.choice', (['suspects'], {}), '(suspects)\n', (1866, 1876), False, 'im... |
import os
import sys
import pvl
import re
def find_keyword(obj, key, group=None):
if group is not None:
return find_keyword(obj[group], key)
if key is None or obj is None:
return None
elif key in obj:
return obj[key]
for k, v in obj.items():
if isinstance(v, dict):
... | [
"re.sub",
"pvl.load",
"re.compile"
] | [((1826, 1862), 're.compile', 're.compile', (['"""^([0-9]+)[Ee]([0-9]+)$"""'], {}), "('^([0-9]+)[Ee]([0-9]+)$')\n", (1836, 1862), False, 'import re\n'), ((747, 783), 'pvl.load', 'pvl.load', (['input_pvl'], {'decoder': 'decoder'}), '(input_pvl, decoder=decoder)\n', (755, 783), False, 'import pvl\n'), ((1213, 1256), 're.... |
"""
Select a nested RVT link. The script will search through this linked model.
It will create accordingly sized void instances, based on the bounding box size of
found "WD - RECH" generic models in that link, and will mirror a set of parameters.
The Voids are set to the closest "Building Story" level.
It will cut inte... | [
"rpw.doc.ParameterBindings.ForwardIterator",
"rpw.doc.GetElement",
"rpw.uidoc.Selection.GetElementIds",
"re.compile",
"Autodesk.Revit.DB.ModelPathUtils.ConvertModelPathToUserVisiblePath",
"Autodesk.Revit.DB.BoundingBoxXYZ",
"Autodesk.Revit.DB.SolidOptions",
"Autodesk.Revit.DB.RevitLinkOptions",
"sys... | [((777, 805), 'clr.AddReference', 'clr.AddReference', (['"""RevitAPI"""'], {}), "('RevitAPI')\n", (793, 805), False, 'import clr\n'), ((21388, 21399), 'System.Diagnostics.Stopwatch', 'Stopwatch', ([], {}), '()\n', (21397, 21399), False, 'from System.Diagnostics import Stopwatch\n'), ((21891, 21903), 'Autodesk.Revit.DB.... |
# -*- coding: utf-8 -*-
#
# anim_sequence_EI_networks_spont_stim.py
#
# Copyright 2019 <NAME>
# The MIT License
import numpy as np
import pylab as pl
import lib.protocol as protocol
import lib.animation_image as ai
import datetime
landscapes = [
{'mode': 'symmetric'},
{'mode': 'homogeneous', 'specs': {'phi': ... | [
"numpy.max",
"lib.protocol.get_or_simulate",
"datetime.datetime.now",
"lib.protocol.get_parameters",
"pylab.subplots",
"numpy.arange",
"pylab.show"
] | [((601, 645), 'lib.protocol.get_or_simulate', 'protocol.get_or_simulate', (['simulation', 'params'], {}), '(simulation, params)\n', (625, 645), True, 'import lib.protocol as protocol\n'), ((776, 806), 'numpy.arange', 'np.arange', (['(500.0)', '(2500.0)', '(10.0)'], {}), '(500.0, 2500.0, 10.0)\n', (785, 806), True, 'imp... |
import cv2
import numpy as np
import glob
# Load previously saved data
with np.load('1. Camera Calibration\camera.py') as X:
mtx, dist, _, _ = [X[i] for i in ('mtx','dist','rvecs','tvecs')]
| [
"numpy.load"
] | [((77, 120), 'numpy.load', 'np.load', (['"""1. Camera Calibration\\\\camera.py"""'], {}), "('1. Camera Calibration\\\\camera.py')\n", (84, 120), True, 'import numpy as np\n')] |
import datetime
import logging
import os
from flask import Flask, request
from flask import jsonify
from flask_cors import CORS
from werkzeug.utils import secure_filename
import JSONFormatter
import database_handler
from bias_evaluation import bias_eval_methods
from debiasing import debiasing_models
''' RestAPI '''
... | [
"logging.basicConfig",
"flask.request.args.to_dict",
"debiasing.debiasing_models.return_pca_debiasing",
"flask_cors.CORS",
"flask.Flask",
"JSONFormatter.retrieve_vectors_from_json_evaluation",
"database_handler.get_multiple_augmentation_from_db",
"flask.jsonify",
"os.path.join",
"datetime.datetime... | [((640, 655), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (645, 655), False, 'from flask import Flask, request\n'), ((656, 665), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (660, 665), False, 'from flask_cors import CORS\n'), ((849, 913), 'logging.basicConfig', 'logging.basicConfig', ([], {'fil... |
# http://github.com/timestocome
# adapted from:
# https://github.com/maxpumperla/betago
# https://www.manning.com/books/deep-learning-and-the-game-of-go
from six.moves import input
import goboard
import gotypes
import depthprune
from utils import print_board, print_move, point_from_coords
BOARD_SIZE = 5
"""Ca... | [
"utils.print_board",
"goboard.GameState.new_game",
"six.moves.input",
"goboard.Move.play",
"gotypes.Point",
"utils.print_move",
"depthprune.DepthPrunedAgent"
] | [((1342, 1380), 'goboard.GameState.new_game', 'goboard.GameState.new_game', (['BOARD_SIZE'], {}), '(BOARD_SIZE)\n', (1368, 1380), False, 'import goboard\n'), ((1391, 1435), 'depthprune.DepthPrunedAgent', 'depthprune.DepthPrunedAgent', (['(3)', 'capture_diff'], {}), '(3, capture_diff)\n', (1418, 1435), False, 'import de... |
"""
Data loader for TUM RGBD benchmark
@author: <NAME>
@date: March 2019
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import sys, os, random
import pickle
import numpy as np
import os.path as osp
import torch... | [
"numpy.clip",
"torch.utils.data.replace",
"numpy.array",
"torchvision.utils.make_grid",
"numpy.searchsorted",
"numpy.asarray",
"scipy.misc.imread",
"numpy.eye",
"random.choice",
"pickle.load",
"os.path.isfile",
"cv2.resize",
"matplotlib.pyplot.show",
"numpy.roll",
"pickle.dump",
"os.pa... | [((12246, 12258), 'numpy.array', 'np.array', (['tq'], {}), '(tq)\n', (12254, 12258), True, 'import numpy as np\n'), ((12267, 12276), 'numpy.eye', 'np.eye', (['(4)'], {}), '(4)\n', (12273, 12276), True, 'import numpy as np\n'), ((12554, 12607), 'os.path.join', 'osp.join', (['local_dir', 'dataset', 'subject_name', '"""rg... |
from django.contrib.admin import site
from django.urls import path
from datahub.admin_report.views import download_report, list_reports
app_name = 'admin_report'
urlpatterns = [
path(
'admin/reports/',
site.admin_view(list_reports),
name='index',
),
path(
'admin/reports/<r... | [
"django.contrib.admin.site.admin_view"
] | [((225, 254), 'django.contrib.admin.site.admin_view', 'site.admin_view', (['list_reports'], {}), '(list_reports)\n', (240, 254), False, 'from django.contrib.admin import site\n'), ((349, 381), 'django.contrib.admin.site.admin_view', 'site.admin_view', (['download_report'], {}), '(download_report)\n', (364, 381), False,... |
import argparse
import sys
from util.enum_util import PackageManagerEnum, LanguageEnum, DistanceAlgorithmEnum, TraceTypeEnum, DataTypeEnum
def parse_args(argv):
parser = argparse.ArgumentParser(prog="maloss", description="Parse arguments")
subparsers = parser.add_subparsers(help='Command (e.g. crawl )', dest... | [
"interpret_util.build_author",
"interpret_util.get_versions",
"interpret_util.split_graph",
"interpret_util.select_pm",
"crawl.get_stats_wrapper",
"pm_util.dynamic_scan",
"interpret_util.filter_versions",
"pm_util.get_metadata",
"argparse.ArgumentParser",
"static_util.taint",
"static_util.astgen... | [((177, 246), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""maloss"""', 'description': '"""Parse arguments"""'}), "(prog='maloss', description='Parse arguments')\n", (200, 246), False, 'import argparse\n'), ((31065, 31100), 'interpret_util.select_pm', 'select_pm', ([], {'threshold': 'args.thre... |
from setuptools import setup
from setuptools import find_packages
setup(name='h5ify',
version='0.0.1',
description='Simple utility functions for saving stuff built on keras and deepdish.',
author='<NAME>',
author_email='<EMAIL>',
install_requires=['keras', 'six', 'tables'],
packages... | [
"setuptools.find_packages"
] | [((321, 336), 'setuptools.find_packages', 'find_packages', ([], {}), '()\n', (334, 336), False, 'from setuptools import find_packages\n')] |
import logging
import json
from webcandy import util
from flask import (
g, Blueprint, render_template, jsonify, request, url_for
)
from werkzeug.exceptions import NotFound
from typing import Optional
from webcandy.definitions import ROOT_DIR, DATA_DIR
from .models import User
from .extensions import auth, db
fro... | [
"flask.render_template",
"flask.request.args.get",
"webcandy.util.load_user_data",
"werkzeug.exceptions.NotFound",
"webcandy.util.format_error",
"flask.request.get_data",
"flask.url_for",
"flask.g.user.generate_auth_token",
"flask.request.json.get",
"flask.request.get_json",
"webcandy.util.is_co... | [((368, 479), 'flask.Blueprint', 'Blueprint', (['"""views"""', '__name__'], {'static_folder': 'f"""{ROOT_DIR}/static/dist"""', 'template_folder': 'f"""{ROOT_DIR}/static"""'}), "('views', __name__, static_folder=f'{ROOT_DIR}/static/dist',\n template_folder=f'{ROOT_DIR}/static')\n", (377, 479), False, 'from flask impo... |
# Generated by Django 2.0 on 2019-07-07 02:24
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('pages', '0005_accessanalysis'),
]
operations = [
migrations.CreateModel(
name='CategoryTools',
... | [
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"django.db.models.AutoField",
"django.db.models.CharField"
] | [((2474, 2566), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.CASCADE', 'to': '"""pages.ToolCategory"""'}), "(on_delete=django.db.models.deletion.CASCADE, to=\n 'pages.ToolCategory')\n", (2491, 2566), False, 'from django.db import migrations, models\n'), ((2686, 27... |
"""
Mind that this class requires isri-ocr-evaluation tools installed,
go to: https://github.com/eddieantonio/isri-ocr-evaluation-tools
download, build the tools and install globally
Tested for linux
Other systems will raise exception
"""
from subprocess import call
import os
from akf_corelib.conditional_print import... | [
"akf_corelib.conditional_print.ConditionalPrint",
"os.name.lower",
"configuration.configuration_handler.ConfigurationHandler",
"subprocess.call"
] | [((479, 494), 'os.name.lower', 'os.name.lower', ([], {}), '()\n', (492, 494), False, 'import os\n'), ((520, 558), 'configuration.configuration_handler.ConfigurationHandler', 'ConfigurationHandler', ([], {'first_init': '(False)'}), '(first_init=False)\n', (540, 558), False, 'from configuration.configuration_handler impo... |
"""
@Time : 2021/8/27 14:35
@Author : <NAME>
@E-mail : <EMAIL>
@Project : CVPR2021_PDNet
@File : pdnet.py
@Function:
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
import backbone.resnet.resnet as resnet
class PM(nn.Module):
""" positioning module """
def __init__(s... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Softmax",
"torch.nn.Sequential",
"torch.sigmoid",
"torch.nn.Conv2d",
"torch.nn.UpsamplingBilinear2d",
"torch.nn.MaxPool2d",
"torch.nn.AdaptiveAvgPool2d",
"backbone.resnet.resnet.resnet50",
"torch.bmm",
"torch.cat",
"torch.ones"
] | [((1371, 1401), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', (['self.in_dim_xy'], {}), '(self.in_dim_xy)\n', (1385, 1401), True, 'import torch.nn as nn\n'), ((1428, 1437), 'torch.nn.ReLU', 'nn.ReLU', ([], {}), '()\n', (1435, 1437), True, 'import torch.nn as nn\n'), ((1462, 1492), 'torch.nn.BatchNorm2d', 'nn.BatchNorm2d', ... |
import rospy
import actionlib
from math import radians
import numpy as np
import scipy.signal
import time
import dynamic_reconfigure.client
from robot_localization.srv import SetPose
from pyquaternion import Quaternion as qt
from std_srvs.srv import Empty
from gazebo_msgs.msg import ModelState
from geometry_msgs.msg ... | [
"numpy.sqrt",
"numpy.column_stack",
"numpy.array",
"numpy.arctan2",
"geometry_msgs.msg.PoseWithCovarianceStamped",
"numpy.sin",
"geometry_msgs.msg.Pose",
"rospy.ServiceProxy",
"numpy.asarray",
"geometry_msgs.msg.Quaternion",
"numpy.matmul",
"rospy.Subscriber",
"move_base_msgs.msg.MoveBaseGoa... | [((750, 764), 'move_base_msgs.msg.MoveBaseGoal', 'MoveBaseGoal', ([], {}), '()\n', (762, 764), False, 'from move_base_msgs.msg import MoveBaseGoal, MoveBaseAction\n'), ((1115, 1149), 'geometry_msgs.msg.Quaternion', 'Quaternion', (['e[1]', 'e[2]', 'e[3]', 'e[0]'], {}), '(e[1], e[2], e[3], e[0])\n', (1125, 1149), False, ... |
from lixian_plugins.api import task_filter
import re
@task_filter(protocol='size')
def filter_by_size(keyword, task):
'''
Example:
lx download size:10m-
lx download size:1G+
lx download 0/size:1g-
'''
m = re.match(r'^([<>])?(\d+(?:\.\d+)?)([GM])?([+-])?$', keyword, flags=re.I)
assert ... | [
"lixian_plugins.api.task_filter",
"re.match"
] | [((57, 85), 'lixian_plugins.api.task_filter', 'task_filter', ([], {'protocol': '"""size"""'}), "(protocol='size')\n", (68, 85), False, 'from lixian_plugins.api import task_filter\n'), ((236, 310), 're.match', 're.match', (['"""^([<>])?(\\\\d+(?:\\\\.\\\\d+)?)([GM])?([+-])?$"""', 'keyword'], {'flags': 're.I'}), "('^([<>... |
"""
Models for config buckets
"""
from typing import Optional, Set
from pydantic import BaseModel
from pydantic.fields import Field
from pydantic.types import DirectoryPath
class ListConfigBucket(BaseModel):
"""Class for obtaining list of files for a config bucket"""
directory_path: DirectoryPath = Field(
... | [
"pydantic.fields.Field"
] | [((312, 466), 'pydantic.fields.Field', 'Field', (['...'], {'title': '"""Directory path for the bucket"""', 'description': '"""This is the path of the directory in which the config file(s) reside"""'}), "(..., title='Directory path for the bucket', description=\n 'This is the path of the directory ... |
# coding: utf-8
from __future__ import absolute_import
from datetime import date, datetime # noqa: F401
from typing import List, Dict # noqa: F401
from jobbing.models.base_model_ import Model
from jobbing import util
class ServiceProvided(Model):
"""NOTE: This class is auto generated by the swagger code gene... | [
"jobbing.util.deserialize_model"
] | [((3012, 3045), 'jobbing.util.deserialize_model', 'util.deserialize_model', (['dikt', 'cls'], {}), '(dikt, cls)\n', (3034, 3045), False, 'from jobbing import util\n')] |
import os
import magic
from django.conf import settings
from django.db import models
from taggit.managers import TaggableManager
from wagtail.images.models import AbstractImage, AbstractRendition
from django.utils.translation import gettext_lazy as _
class Image(AbstractImage):
# Necessary to resolve related nam... | [
"magic.Magic",
"django.utils.translation.gettext_lazy",
"django.db.models.CharField",
"django.db.models.ForeignKey"
] | [((1017, 1072), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(100)', 'blank': '(True)', 'null': '(True)'}), '(max_length=100, blank=True, null=True)\n', (1033, 1072), False, 'from django.db import models\n'), ((2096, 2173), 'django.db.models.ForeignKey', 'models.ForeignKey', (['Image'], {'on_d... |
# pylint: disable=invalid-name
from __future__ import absolute_import, division
__license__ = """MIT License
Copyright (c) 2014-2019 <NAME> and <NAME>
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 So... | [
"numpy.atleast_2d",
"numpy.sqrt",
"numpy.ones",
"numpy.random.choice",
"numpy.array",
"numpy.zeros",
"warnings.warn"
] | [((2245, 2265), 'numpy.atleast_2d', 'n.atleast_2d', (['points'], {}), '(points)\n', (2257, 2265), True, 'import numpy as n\n'), ((2356, 2376), 'numpy.array', 'n.array', (['self.values'], {}), '(self.values)\n', (2363, 2376), True, 'import numpy as n\n'), ((2625, 2643), 'numpy.atleast_2d', 'n.atleast_2d', (['data'], {})... |
from setuptools import setup
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / 'README.md').read_text()
setup(
name='mitmproxy-escher',
description='Sign mitmproxy requests with Escher',
long_description=long_description,
long_description_content_type... | [
"setuptools.setup",
"pathlib.Path"
] | [((157, 923), 'setuptools.setup', 'setup', ([], {'name': '"""mitmproxy-escher"""', 'description': '"""Sign mitmproxy requests with Escher"""', 'long_description': 'long_description', 'long_description_content_type': '"""text/markdown"""', 'version': '"""2.0.2"""', 'url': '"""https://github.com/knagy/mitmproxy-escher"""... |
import sys
import nuclio_sdk
import nuclio_sdk.test
import functions.api_serving
import functions.face_prediction
import logging
def chain_call_function_mock(name, event, node=None, timeout=None, service_name_override=None):
logger = nuclio_sdk.Logger(level=logging.DEBUG)
logger.set_handler('default', sys.st... | [
"nuclio_sdk.test.Platform",
"nuclio_sdk.Event",
"nuclio_sdk.logger.HumanReadableFormatter",
"nuclio_sdk.Logger"
] | [((241, 279), 'nuclio_sdk.Logger', 'nuclio_sdk.Logger', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (258, 279), False, 'import nuclio_sdk\n'), ((851, 877), 'nuclio_sdk.test.Platform', 'nuclio_sdk.test.Platform', ([], {}), '()\n', (875, 877), False, 'import nuclio_sdk\n'), ((965, 993), 'nuclio_sdk.Event... |
import unittest # unit tests for the server
from server import *
from werkzeug.exceptions import *
import json
class ServerTests(unittest.TestCase):
"""Tests for the ``server`` functions"""
def setUp(self):
app.robots_dictionary = {
1: RobotState(robot_id=1, robot_type='cozmo', x=1, y=1,... | [
"unittest.main",
"json.loads"
] | [((2192, 2207), 'unittest.main', 'unittest.main', ([], {}), '()\n', (2205, 2207), False, 'import unittest\n'), ((720, 745), 'json.loads', 'json.loads', (['response.data'], {}), '(response.data)\n', (730, 745), False, 'import json\n'), ((1262, 1287), 'json.loads', 'json.loads', (['response.data'], {}), '(response.data)\... |
#!/usr/bin/env python3.6
import boto3
import datetime
import json
import time
import decimal
from botocore.client import ClientError
from boto3 import resource
from boto3.dynamodb.conditions import Key
import logging
import subprocess
#import urllib
from urllib.parse import urlparse
import timecode
from timecode import... | [
"logging.getLogger",
"subprocess.check_output",
"json.loads",
"boto3.client",
"urllib.parse.urlparse",
"xmltodict.parse",
"traceback.print_stack",
"datetime.datetime.strptime",
"json.dumps",
"boto3.resource",
"timecode.Timecode"
] | [((728, 751), 'boto3.client', 'boto3.client', (['"""kinesis"""'], {}), "('kinesis')\n", (740, 751), False, 'import boto3\n'), ((768, 794), 'boto3.resource', 'boto3.resource', (['"""dynamodb"""'], {}), "('dynamodb')\n", (782, 794), False, 'import boto3\n'), ((834, 860), 'logging.getLogger', 'logging.getLogger', (['"""bo... |
from . import db
from werkzeug.security import generate_password_hash,check_password_hash
from flask_login import UserMixin
from . import login_manager
from sqlalchemy.sql import func
@login_manager.user_loader
def load_user(user_id):
return User.query.get(int(user_id))
class User(UserMixin,db.Model):
__tabl... | [
"sqlalchemy.sql.func.now",
"werkzeug.security.generate_password_hash",
"werkzeug.security.check_password_hash"
] | [((935, 967), 'werkzeug.security.generate_password_hash', 'generate_password_hash', (['password'], {}), '(password)\n', (957, 967), False, 'from werkzeug.security import generate_password_hash, check_password_hash\n'), ((1025, 1076), 'werkzeug.security.check_password_hash', 'check_password_hash', (['self.password_secur... |
import numpy as np
def CIS(occ, F, C, VeeMOspin):
# Make the spin MO fock matrix
Fspin = np.zeros((len(F)*2,len(F)*2))
Cspin = np.zeros((len(F)*2,len(F)*2))
for p in range(1,len(F)*2+1):
for q in range(1,len(F)*2+1):
Fspin[p-1,q-1] = F[(p+1)//2-1,(q+1)//2-1] * (p%2 == q%2)
... | [
"numpy.linalg.eigvalsh",
"numpy.dot",
"numpy.transpose"
] | [((1072, 1093), 'numpy.linalg.eigvalsh', 'np.linalg.eigvalsh', (['H'], {}), '(H)\n', (1090, 1093), True, 'import numpy as np\n'), ((411, 430), 'numpy.transpose', 'np.transpose', (['Cspin'], {}), '(Cspin)\n', (423, 430), True, 'import numpy as np\n'), ((431, 451), 'numpy.dot', 'np.dot', (['Fspin', 'Cspin'], {}), '(Fspin... |
# michaelpeterswa
# kulo.py
import csv
import geojson
import datetime
import numpy as np
from shapely.geometry import shape, MultiPolygon, Polygon, Point
from keras.models import Sequential
from keras.layers import Dense
from keras.callbacks import TensorBoard
input_file = "..\data\Washington_Large_Fires_1973-2019.g... | [
"csv.writer",
"numpy.array",
"shapely.geometry.Polygon",
"shapely.geometry.shape",
"geojson.load"
] | [((950, 965), 'shapely.geometry.Polygon', 'Polygon', (['points'], {}), '(points)\n', (957, 965), False, 'from shapely.geometry import shape, MultiPolygon, Polygon, Point\n'), ((1960, 1984), 'numpy.array', 'np.array', (['fire_data_list'], {}), '(fire_data_list)\n', (1968, 1984), True, 'import numpy as np\n'), ((454, 469... |
import torch
from onnx_tools import torch2onnx
from ssd import build_ssd
from nets.ssd import SSD300
from data import *
cfg = voc
sys.path.append(os.getcwd())
pth_model_path = "weights/ssd300_mAP_77.43_v2.pth"
# pth_model_path = "weights/ssd_weights.pth"
onnx_model_path = "onnx_models/ssd300_voc.onnx"
onnx_model_da... | [
"torch.load",
"nets.ssd.SSD300",
"torch.cuda.is_available",
"ssd.build_ssd",
"torch.randn",
"torch.onnx.export"
] | [((426, 480), 'ssd.build_ssd', 'build_ssd', (['"""train"""', "cfg['min_dim']", "cfg['num_classes']"], {}), "('train', cfg['min_dim'], cfg['num_classes'])\n", (435, 480), False, 'from ssd import build_ssd\n'), ((492, 508), 'nets.ssd.SSD300', 'SSD300', (['(2)', '"""vgg"""'], {}), "(2, 'vgg')\n", (498, 508), False, 'from ... |
# -*- coding: utf-8 -*-
import torch
import math
def train() -> None:
# Check if CUDA is available
assert torch.cuda.is_available()
print("CUDA device: ", torch.cuda.get_device_name())
print("Device capability: ", torch.cuda.get_device_properties(torch.device("cuda:0")))
dtype = torch.float
... | [
"torch.cuda.get_device_name",
"torch.sin",
"torch.cuda.is_available",
"torch.no_grad",
"torch.randn",
"torch.linspace",
"torch.device"
] | [((116, 141), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (139, 141), False, 'import torch\n'), ((329, 351), 'torch.device', 'torch.device', (['"""cuda:0"""'], {}), "('cuda:0')\n", (341, 351), False, 'import torch\n'), ((582, 649), 'torch.linspace', 'torch.linspace', (['(-math.pi)', 'math.pi... |
import argparse
import re
from typing import Dict, List, Set
parser = argparse.ArgumentParser(description='Run an Advent of Code program')
parser.add_argument(
'input_file', type=str, help='the file containing input data'
)
args = parser.parse_args()
input_data: List = []
with open(args.input_file) as f:
inpu... | [
"re.match",
"argparse.ArgumentParser"
] | [((71, 139), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'description': '"""Run an Advent of Code program"""'}), "(description='Run an Advent of Code program')\n", (94, 139), False, 'import argparse\n'), ((408, 463), 're.match', 're.match', (['"""([0-9]+)? ?([a-z ]+) bags?\\\\.?"""', 'description'], {})... |
# -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2016-2021 CERN.
#
# Invenio is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
"""Pytest configuration."""
import uuid
import pytest
from invenio_accounts.testuti... | [
"invenio_pidstore.models.PersistentIdentifier.create",
"invenio_accounts.testutils.create_test_user",
"invenio_indexer.api.RecordIndexer",
"invenio_communities.communities.records.api.Record.create"
] | [((723, 786), 'invenio_communities.communities.records.api.Record.create', 'Record.create', (["{'title': 'Title', '_owners': [record_owner.id]}"], {}), "({'title': 'Title', '_owners': [record_owner.id]})\n", (736, 786), False, 'from invenio_communities.communities.records.api import Record\n'), ((822, 961), 'invenio_pi... |
import numpy as np
import theano
import theano.tensor as T
from nose.tools import assert_true
from numpy.testing import assert_equal, assert_array_equal
from smartlearner.interfaces.dataset import Dataset
floatX = theano.config.floatX
ALL_DTYPES = np.sctypes['int'] + np.sctypes['uint'] + np.sctypes['float']
def te... | [
"numpy.testing.assert_equal",
"theano.function",
"theano.tensor.sum",
"smartlearner.interfaces.dataset.Dataset",
"numpy.array",
"numpy.sum",
"nose.tools.assert_true",
"numpy.random.RandomState"
] | [((368, 395), 'numpy.random.RandomState', 'np.random.RandomState', (['(1234)'], {}), '(1234)\n', (389, 395), True, 'import numpy as np\n'), ((558, 582), 'smartlearner.interfaces.dataset.Dataset', 'Dataset', (['inputs', 'targets'], {}), '(inputs, targets)\n', (565, 582), False, 'from smartlearner.interfaces.dataset impo... |
"""
"""
from pandas import DataFrame, Series
from src.linear_regression.parameter_optimisations import normal_equation
label_values = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
features = DataFrame(
{
"theta_zero": [1 for _ in label_values],
"feature_1": [x / 10 for x in label_values],
}
)
l... | [
"pandas.DataFrame",
"src.linear_regression.parameter_optimisations.normal_equation",
"pandas.Series"
] | [((191, 297), 'pandas.DataFrame', 'DataFrame', (["{'theta_zero': [(1) for _ in label_values], 'feature_1': [(x / 10) for x in\n label_values]}"], {}), "({'theta_zero': [(1) for _ in label_values], 'feature_1': [(x / 10\n ) for x in label_values]})\n", (200, 297), False, 'from pandas import DataFrame, Series\n'), ... |
#coding:utf-8
#
# id: functional.datatypes.decfloat_binding_to_legacy
# title: Test ability for DECFLOAT values to be represented as other data types using LEGACY keyword.
# decription:
# We check here that values from DECFLOAT will be actually converted to legacy datatypes
# ... | [
"pytest.mark.version",
"firebird.qa.db_factory",
"firebird.qa.isql_act"
] | [((2706, 2751), 'firebird.qa.db_factory', 'db_factory', ([], {'sql_dialect': '(3)', 'init': 'init_script_1'}), '(sql_dialect=3, init=init_script_1)\n', (2716, 2751), False, 'from firebird.qa import db_factory, isql_act, Action\n'), ((4608, 4670), 'firebird.qa.isql_act', 'isql_act', (['"""db_1"""', 'test_script_1'], {'s... |
# quart_cors.py
from quart import Quart
from quart_cors import cors, route_cors
app = Quart(__name__)
app = cors(app, allow_origin="https://quart.com")
# app = cors(app, allow_origin="*")
@app.route("/api")
# @route_cors(allow_origin=["https://quart.com"])
async def my_microservice():
return {"Hello": "World!"}
... | [
"quart_cors.cors",
"quart.Quart"
] | [((87, 102), 'quart.Quart', 'Quart', (['__name__'], {}), '(__name__)\n', (92, 102), False, 'from quart import Quart\n'), ((109, 152), 'quart_cors.cors', 'cors', (['app'], {'allow_origin': '"""https://quart.com"""'}), "(app, allow_origin='https://quart.com')\n", (113, 152), False, 'from quart_cors import cors, route_cor... |
import os
from os import path
from dotenv import load_dotenv
from bs4 import BeautifulSoup as bsp
import requests as rq
import re
import psycopg2 as pg2
from psycopg2 import sql
import time
#################################### Dev Functions ###################################
#################################### ... | [
"psycopg2.connect",
"os.path.exists",
"re.compile",
"re.match",
"os.environ.get",
"requests.get",
"dotenv.load_dotenv",
"bs4.BeautifulSoup",
"time.time",
"psycopg2.sql.Identifier",
"psycopg2.sql.SQL"
] | [((476, 498), 'os.path.exists', 'path.exists', (['file_name'], {}), '(file_name)\n', (487, 498), False, 'from os import path\n'), ((672, 694), 'os.path.exists', 'path.exists', (['file_name'], {}), '(file_name)\n', (683, 694), False, 'from os import path\n'), ((982, 993), 'time.time', 'time.time', ([], {}), '()\n', (991... |
from search_imdb import *
import time, os
def run_maintenance_explicit():
dir_path = os.path.dirname(os.path.realpath(__file__))
print(dir_path)
movies_path = get_movies_path()
movies_list = os.listdir(movies_path)
total = len(movies_list)
count = 1
for folder in movies_list:
if no... | [
"os.path.realpath",
"os.system",
"os.listdir",
"time.sleep"
] | [((208, 231), 'os.listdir', 'os.listdir', (['movies_path'], {}), '(movies_path)\n', (218, 231), False, 'import time, os\n'), ((727, 750), 'os.listdir', 'os.listdir', (['movies_path'], {}), '(movies_path)\n', (737, 750), False, 'import time, os\n'), ((1714, 1732), 'os.system', 'os.system', (['"""pause"""'], {}), "('paus... |
import argparse
import os, sys
from classes import *
from difftotex import version
description = """\
Create latex from git diff supplied in FILE or standard input.
Make sure it does not contain coloring: add option --no-color to git diff cmd
"""
epilog = """\
Make sure to include the following in your preamble:
\\u... | [
"argparse.ArgumentParser",
"os.path.isfile",
"os.path.dirname",
"os.path.isdir",
"sys.exit",
"sys.stdin.read"
] | [((680, 845), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'usage': '"""%(prog)s [OPTION ...] [FILE]"""', 'description': 'description', 'epilog': 'epilog', 'formatter_class': 'argparse.RawDescriptionHelpFormatter'}), "(usage='%(prog)s [OPTION ...] [FILE]', description=\n description, epilog=epilog, fo... |
import pytest
import pyhf
import tensorflow as tf
import sys
@pytest.fixture(scope='function')
def isolate_modules():
"""
This fixture isolates the sys.modules imported in case you need to mess around with them and do not want to break other tests.
This is not done automatically.
"""
CACHE_MODULE... | [
"tensorflow.reset_default_graph",
"sys.modules.update",
"pyhf.events.__events.clear",
"pyhf.optimize.minuit_optimizer",
"tensorflow.Session",
"pyhf.events.__disabled_events.clear",
"pyhf.tensor.numpy_backend",
"pyhf.tensor.pytorch_backend",
"pyhf.tensor.mxnet_backend",
"pyhf.set_backend",
"pytes... | [((64, 96), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""'}), "(scope='function')\n", (78, 96), False, 'import pytest\n'), ((410, 456), 'pytest.fixture', 'pytest.fixture', ([], {'scope': '"""function"""', 'autouse': '(True)'}), "(scope='function', autouse=True)\n", (424, 456), False, 'import pytest... |
#!/usr/bin/env python3
from itypes import Grid2D
g = Grid2D(none_in_range=True, none_outside_range=True)
g[1, 2] = "x"
print(f'min_col={g.min_col()} max_col={g.max_col()} num_cols={g.num_cols()} '
f'min_row={g.min_row()} max_row={g.max_row()} num_rows={g.num_rows()}')
print(f'g[0, 0] = {g[0,0]}')
print(f'g[1... | [
"itypes.Grid2D"
] | [((55, 106), 'itypes.Grid2D', 'Grid2D', ([], {'none_in_range': '(True)', 'none_outside_range': '(True)'}), '(none_in_range=True, none_outside_range=True)\n', (61, 106), False, 'from itypes import Grid2D\n')] |
import serial
import time
import sys
import os
#-------------------------------------------------------------------------------
# !!! START USER UPDATE !!!
COM_PORT = 'COM3' # Windows COM port # the Teensy is connected to
BAUD_RATE = 1... | [
"os.path.isfile",
"serial.Serial",
"time.sleep"
] | [((5772, 5796), 'os.path.isfile', 'os.path.isfile', (['fileName'], {}), '(fileName)\n', (5786, 5796), False, 'import os\n'), ((4585, 4630), 'serial.Serial', 'serial.Serial', (['COM_PORT', 'BAUD_RATE'], {'timeout': '(1)'}), '(COM_PORT, BAUD_RATE, timeout=1)\n', (4598, 4630), False, 'import serial\n'), ((5898, 5911), 'ti... |
"""
# Definition for Employee.
class Employee:
def __init__(self, id: int, importance: int, subordinates: List[int]):
self.id = id
self.importance = importance
self.subordinates = subordinates
"""
from collections import deque
class Solution:
# Employee id to ind Map + BFS (Accepted), ... | [
"collections.deque"
] | [((581, 611), 'collections.deque', 'deque', (['[employees[id_ind[id]]]'], {}), '([employees[id_ind[id]]])\n', (586, 611), False, 'from collections import deque\n')] |
import pandas as pd
from pycomod.elements import *
#class for building and running the model
class model:
def __init__(self, init=None):
#time info
self._t = sim_time()
self._date = sim_date()
#run info
self._dt = run_info(1)
self._end = run_info(365)
self._reps = ... | [
"pandas.ExcelWriter",
"pandas.DataFrame.from_dict"
] | [((4571, 4601), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['d[key]'], {}), '(d[key])\n', (4593, 4601), True, 'import pandas as pd\n'), ((4846, 4870), 'pandas.ExcelWriter', 'pd.ExcelWriter', (['filename'], {}), '(filename)\n', (4860, 4870), True, 'import pandas as pd\n')] |
import tornado.web
import json
import cStringIO
from collections import defaultdict
import numpy as np
from matplotlib.figure import Figure
from matplotlib.backends.backend_agg import FigureCanvasAgg
from status.util import dthandler, SafeHandler
#TODO - Have date slider to select range
#TODO - Ask if anyone uses i... | [
"numpy.median",
"cStringIO.StringIO",
"matplotlib.figure.Figure",
"collections.defaultdict",
"matplotlib.backends.backend_agg.FigureCanvasAgg"
] | [((1641, 1658), 'collections.defaultdict', 'defaultdict', (['list'], {}), '(list)\n', (1652, 1658), False, 'from collections import defaultdict\n'), ((3703, 3723), 'matplotlib.backends.backend_agg.FigureCanvasAgg', 'FigureCanvasAgg', (['fig'], {}), '(fig)\n', (3718, 3723), False, 'from matplotlib.backends.backend_agg i... |
#!/usr/bin/env python
import ConfigParser
import errno
from gimpfu import register, PF_INT16, pdb, main
from gimpenums import INTERPOLATION_CUBIC
import gimp
import os
def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc:
if exc.errno == errno.EEXIST and os.path.isdir(path):
... | [
"gimp.context_push",
"ConfigParser.RawConfigParser",
"os.makedirs",
"gimpfu.register",
"os.path.join",
"gimpfu.pdb.gimp_image_scale_full",
"gimpfu.main",
"os.path.isdir",
"gimp.context_pop",
"os.path.expanduser"
] | [((490, 529), 'os.path.join', 'os.path.join', (['CONFIG_DIR', '"""resizer_max"""'], {}), "(CONFIG_DIR, 'resizer_max')\n", (502, 529), False, 'import os\n'), ((548, 578), 'ConfigParser.RawConfigParser', 'ConfigParser.RawConfigParser', ([], {}), '()\n', (576, 578), False, 'import ConfigParser\n'), ((1327, 1593), 'gimpfu.... |
# Copyright 2019 <NAME>, <EMAIL>
#
# 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 writin... | [
"bs4.BeautifulSoup",
"json.dumps",
"phpipampyez.utils.expand_ids"
] | [((3094, 3135), 'bs4.BeautifulSoup', 'BeautifulSoup', (['res.content', '"""html.parser"""'], {}), "(res.content, 'html.parser')\n", (3107, 3135), False, 'from bs4 import BeautifulSoup\n'), ((3948, 3994), 'phpipampyez.utils.expand_ids', 'expand_ids', (['client.subnets', "results['subnets']"], {}), "(client.subnets, resu... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# File name: test_open_selecter_view.py
# First Edit: 2021-03-25
# Last Change: 2021-03-25
__description__ = ""
__author__ = "@anosillus"
__license__ = "MIT"
__email__ = "<EMAIL>"
__status__ = "Production"
import logging
import itertools
import os
from collections import ... | [
"logzero.logger.error",
"logzero.logger.warning",
"logzero.loglevel",
"logzero.logger.info",
"logzero.setup_logger",
"logzero.logger.debug"
] | [((672, 723), 'logzero.setup_logger', 'setup_logger', ([], {'name': '__name__'}), '(name=__name__, **DEFAULT_LOG_SETTINGS)\n', (684, 723), False, 'from logzero import setup_logger\n'), ((726, 756), 'logzero.loglevel', 'logzero.loglevel', (['logging.INFO'], {}), '(logging.INFO)\n', (742, 756), False, 'import logzero\n')... |
import os
from os import environ
class Config(object):
basedir = os.path.abspath(os.path.dirname(__file__))
SECRET_KEY = 'key'
class ProductionConfig(Config):
DEBUG = False
SESSION_COOKIE_HTTPONLY = True
REMEMBER_COOKIE_HTTPONLY = True
REMEMBER_COOKIE_DURATION = 3600
class DebugConfi... | [
"os.path.dirname"
] | [((92, 117), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (107, 117), False, 'import os\n')] |
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import tensorflow as tf
import time
import numpy as np
import os
root_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')
import sys
sys.path.append(root_dir)
from adversarial_robustness.cnns import *
from adversarial_robustness.da... | [
"matplotlib.pyplot.ylabel",
"tensorflow.gradients",
"adversarial_robustness.datasets.mnist.MNIST",
"tensorflow.nn.softmax",
"sys.path.append",
"adversarial_robustness.datasets.notmnist.notMNIST",
"argparse.ArgumentParser",
"tensorflow.Session",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.xlabel",... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((222, 247), 'sys.path.append', 'sys.path.append', (['root_dir'], {}), '(root_dir)\n', (237, 247), False, 'import sys\n'), ((502, 527), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}... |
import os, sys
import numpy as np
import time
import argparse
import traceback
import glob
import trimesh
import math
import shutil
import json
import open3d as o3d
from tqdm import tqdm
import ctypes
import logging
from contextlib import closing
import multiprocessing as mp
from multiprocessing import Pool
sys.path... | [
"multiprocessing.Array",
"numpy.array",
"multiprocessing.freeze_support",
"open3d.io.read_triangle_mesh",
"numpy.isfinite",
"os.path.exists",
"multiprocessing.log_to_stderr",
"numpy.max",
"multiprocessing.get_logger",
"os.path.isdir",
"trimesh.Trimesh.export",
"open3d.geometry.TriangleMesh.cre... | [((455, 470), 'multiprocessing.get_logger', 'mp.get_logger', ([], {}), '()\n', (468, 470), True, 'import multiprocessing as mp\n'), ((519, 537), 'multiprocessing.log_to_stderr', 'mp.log_to_stderr', ([], {}), '()\n', (535, 537), True, 'import multiprocessing as mp\n'), ((626, 658), 'multiprocessing.Array', 'mp.Array', (... |
# In the mysterious country of Byteland, everything is quite different from what you'd normally expect. In most places, if
# you were approached by two mobsters in a dark alley, they would probably tell you to give them all the money that you
# have. If you refused, or didn't have any - they might even beat you up.
#
#... | [
"itertools.combinations"
] | [((2167, 2185), 'itertools.combinations', 'combinations', (['a', 'i'], {}), '(a, i)\n', (2179, 2185), False, 'from itertools import combinations\n')] |
import sys
from vcflat.cli import vcflat as cli
"""
vcfflat.__main__
~~~~~~~~~~~~~~~~~~~~~
The main entry point for the command line interface.
Invoke as ``vcflat`` (if installed)
or ``python -m vcflat`` (no install required).
"""
if __name__ == "__main__":
# exit using whatever exit code the CLI returned
sy... | [
"vcflat.cli.vcflat"
] | [((327, 332), 'vcflat.cli.vcflat', 'cli', ([], {}), '()\n', (330, 332), True, 'from vcflat.cli import vcflat as cli\n')] |
import logging
from voluptuous import Schema, Required, All, Range, REMOVE_EXTRA
from ..utils import _err, _json
from ..decorators import auth_route
log = logging.getLogger(__name__)
class InvitesEndpoint:
def __init__(self, server):
self.server = server
self.guild_man = server.guild_man
... | [
"logging.getLogger",
"voluptuous.Required",
"voluptuous.Range"
] | [((158, 185), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (175, 185), False, 'import logging\n'), ((371, 405), 'voluptuous.Required', 'Required', (['"""max_age"""'], {'default': '(86400)'}), "('max_age', default=86400)\n", (379, 405), False, 'from voluptuous import Schema, Required, Al... |
"""
Python 3 Object-Oriented Programming
Chapter 7. Python Data Structures
"""
from __future__ import annotations
import abc
from pathlib import Path
from typing import cast, Type, Union, List
import time
class DirectoryVisitor(abc.ABC):
queue_class: Type["PathQueue"]
def __init__(self, base: Path) -> None:... | [
"pathlib.Path.cwd",
"time.perf_counter"
] | [((2774, 2793), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (2791, 2793), False, 'import time\n'), ((2928, 2947), 'time.perf_counter', 'time.perf_counter', ([], {}), '()\n', (2945, 2947), False, 'import time\n'), ((2848, 2858), 'pathlib.Path.cwd', 'Path.cwd', ([], {}), '()\n', (2856, 2858), False, 'from... |
#!/usr/bin/env python
# Gemini Flat light controller (National Control Devices Pulsar series)
# RLM + DL 19 Jan 2016
import socket
import struct
import binascii
import sys
def dimmer(Intensity):
# TCP port of light dimmer
TCP_IP = '192.168.1.22'
TCP_PORT = 2101
BUFFER_SIZE = 1024
# Get desire... | [
"socket.socket",
"sys.exit"
] | [((619, 668), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_STREAM'], {}), '(socket.AF_INET, socket.SOCK_STREAM)\n', (632, 668), False, 'import socket\n'), ((536, 592), 'sys.exit', 'sys.exit', (["('Intensity (%i) must be 0->254, exiting' % ans)"], {}), "('Intensity (%i) must be 0->254, exiting' % a... |
from datetime import date
class ToDoDAO():
def __init__(self):
self._todo_list = []
def inserir(self, todo):
todo.set_id(len(self._todo_list) + 1)
todo.set_data(date.today())
self._todo_list.append(todo)
def listar(self):
return self._todo_list | [
"datetime.date.today"
] | [((200, 212), 'datetime.date.today', 'date.today', ([], {}), '()\n', (210, 212), False, 'from datetime import date\n')] |
import argparse
from paddle.vision import transforms
from paddle.io import DataLoader
from paddle.vision.models import vgg
from dataset import ImageNetClassification
import numpy as np
import os
parser = argparse.ArgumentParser()
parser.add_argument('--results_dir', type=str, default='./result', help='path for generat... | [
"paddle.vision.transforms.ToTensor",
"paddle.vision.transforms.Normalize",
"argparse.ArgumentParser",
"paddle.vision.models.vgg.vgg16",
"paddle.vision.transforms.CenterCrop",
"os.path.join",
"paddle.io.DataLoader",
"paddle.vision.transforms.Resize",
"dataset.ImageNetClassification"
] | [((205, 230), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (228, 230), False, 'import argparse\n'), ((489, 515), 'paddle.vision.models.vgg.vgg16', 'vgg.vgg16', ([], {'pretrained': '(True)'}), '(pretrained=True)\n', (498, 515), False, 'from paddle.vision.models import vgg\n'), ((762, 832), 'da... |
#!/usr/bin/python
import sys
# working directory
sys.path.insert(0,"/var/www/webroot/ROOT/")
# write app name after from. for example if it is hello.py then write hello
from app import app as application
| [
"sys.path.insert"
] | [((49, 93), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""/var/www/webroot/ROOT/"""'], {}), "(0, '/var/www/webroot/ROOT/')\n", (64, 93), False, 'import sys\n')] |