code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
"""
For ODIN[1], we simply apply
f(x) = [max prob_t(x')]> theta, where
- x' is the epsilon-perturbed x in direction that minimizes the CE loss on **the most likely output class**.
- For the loss calculation, the output is scaled according to the temperature.
we use the s... | [
"torch.nn.CrossEntropyLoss",
"utils.iterative_trainer.IterativeTrainerConfig",
"methods.SVMLoss",
"torch.nn.functional.softmax",
"datasets.MirroredDataset",
"methods.get_cached",
"torch.nn.Module",
"os.path.isdir",
"torch.optim.lr_scheduler.ReduceLROnPlateau",
"torch.Tensor",
"os.path.isfile",
... | [((1731, 1742), 'torch.nn.Module', 'nn.Module', ([], {}), '()\n', (1740, 1742), True, 'import torch.nn as nn\n'), ((2103, 2124), 'torch.nn.CrossEntropyLoss', 'nn.CrossEntropyLoss', ([], {}), '()\n', (2122, 2124), True, 'import torch.nn as nn\n'), ((3836, 3864), 'torch.nn.functional.softmax', 'F.softmax', (['new_output'... |
#!/usr/bin/env python
"""
Created on Wed Feb 27 12:32:07 2019
@author: mitchell
"""
import rospy
import std_msgs.msg
from sensor_msgs.msg import Image, PointCloud2
from cv_bridge import CvBridge, CvBridgeError
import cv2
class image_republish:
def __init__(self):
self.image_pub = rospy.Publisher... | [
"rospy.Subscriber",
"cv2.flip",
"rospy.is_shutdown",
"rospy.init_node",
"sensor_msgs.msg.Image",
"cv_bridge.CvBridge",
"rospy.Rate",
"rospy.spin",
"rospy.Publisher"
] | [((1397, 1426), 'rospy.init_node', 'rospy.init_node', (['"""image_sync"""'], {}), "('image_sync')\n", (1412, 1426), False, 'import rospy\n'), ((1458, 1470), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (1468, 1470), False, 'import rospy\n'), ((305, 368), 'rospy.Publisher', 'rospy.Publisher', (['"""/camera/rgb/image_co... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#############################################################
# Adapted in part from linux-source-3.2/drivers/mtd/ubi/ubi-media.h
# for use in Python.
# Oct. 2013 by <NAME>
#
# Original copyright notice.
# --------------------------
#
# Copyright (c) International Business ... | [
"struct.calcsize"
] | [((2111, 2141), 'struct.calcsize', 'struct.calcsize', (['EC_HDR_FORMAT'], {}), '(EC_HDR_FORMAT)\n', (2126, 2141), False, 'import struct\n'), ((3375, 3406), 'struct.calcsize', 'struct.calcsize', (['VID_HDR_FORMAT'], {}), '(VID_HDR_FORMAT)\n', (3390, 3406), False, 'import struct\n'), ((4136, 4168), 'struct.calcsize', 'st... |
from flask import render_template
# from app import app
from . import main
from ..request import get_news_category, get_news
# Views
@main.route('/')
def index():
'''
View root page function that returns the index page and its data
'''
#method to get the news
entertainment_news = get_news_catego... | [
"flask.render_template"
] | [((620, 798), 'flask.render_template', 'render_template', (['"""index.html"""'], {'title': 'title', 'entertainment': 'entertainment_news', 'business': 'business_news', 'health': 'health_news', 'science': 'science_news', 'technology': 'technology_news'}), "('index.html', title=title, entertainment=entertainment_news,\n ... |
# Copyright 2013 Google Inc. All Rights Reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
"""A simple, direct connection to the vtgate proxy server, using gRPC.
"""
import datetime
import logging
import re
from urlparse import urlparse
from grpc.beta impo... | [
"re.compile",
"logging.exception",
"vtproto.query_pb2.BoundQuery",
"urlparse.urlparse",
"vtdb.vtgate_utils.convert_exception_kwargs",
"vtdb.dbexceptions.DatabaseError",
"vtproto.vtgate_pb2.GetSrvKeyspaceRequest",
"vtdb.vtgate_utils.exponential_backoff_retry",
"vtdb.field_types_proto3.conversions.get... | [((929, 976), 're.compile', 're.compile', (['"""\\\\(errno (\\\\d+)\\\\)"""', 're.IGNORECASE'], {}), "('\\\\(errno (\\\\d+)\\\\)', re.IGNORECASE)\n", (939, 976), False, 'import re\n'), ((1000, 1063), 're.compile', 're.compile', (['"""exceeded (.*) quota, rate limiting"""', 're.IGNORECASE'], {}), "('exceeded (.*) quota,... |
from rest_framework import viewsets, filters, status
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.decorators import action
from rest_framework.response import Response
from rest_framework.permissions import IsAuthenticated
from ..models import Course
from ..serializers import Cours... | [
"rest_framework.response.Response",
"rest_framework.decorators.action"
] | [((2544, 2619), 'rest_framework.decorators.action', 'action', ([], {'detail': '(True)', 'methods': "['post']", 'permission_classes': '[IsAuthenticated]'}), "(detail=True, methods=['post'], permission_classes=[IsAuthenticated])\n", (2550, 2619), False, 'from rest_framework.decorators import action\n'), ((3355, 3375), 'r... |
import logging
import random
from subprocess import Popen, PIPE
from tqdm import tqdm
log = logging.getLogger(__name__)
class Arena():
"""
An Arena class where any 2 agents can be pit against each other.
"""
def __init__(self, AlphaPlayer, MinimaxPlayer, game, display=None):
"""
Inp... | [
"logging.getLogger",
"random.randint"
] | [((94, 121), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (111, 121), False, 'import logging\n'), ((4478, 4504), 'random.randint', 'random.randint', (['(1)', '(1000000)'], {}), '(1, 1000000)\n', (4492, 4504), False, 'import random\n'), ((5057, 5083), 'random.randint', 'random.randint', ... |
import math
import matplotlib.pyplot as plt
n = 23
R2 = 5*(2*n*n + 1135*n + 110780)/(n+155)
R1 = 7340-60*n-R2
v = []
v.append(0)
for x in range(1,310+2*n+1):
aux = R1
if x>10:
aux = aux-(12-n)*(x-10)
if x>130+2*n:
aux = aux-(5000+10*n)
if x>80:
aux = aux + (12-n)*(x-80)
if x... | [
"matplotlib.pyplot.grid",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"math.sqrt",
"matplotlib.pyplot.figure"
] | [((544, 570), 'matplotlib.pyplot.figure', 'plt.figure', ([], {'figsize': '(9, 4)'}), '(figsize=(9, 4))\n', (554, 570), True, 'import matplotlib.pyplot as plt\n'), ((570, 597), 'matplotlib.pyplot.xlabel', 'plt.xlabel', (['"""Longitud (mm)"""'], {}), "('Longitud (mm)')\n", (580, 597), True, 'import matplotlib.pyplot as p... |
from flask import Flask, json, jsonify
app = Flask(__name__)
menucard = [{'Item' : 'Rice', 'Price':10},{'Item': 'Dal','Price':15},{'Item':'Chicken','Price':20},{'Item':'Mutton', 'Price':25},{'Item':'Fish','Price':20},{'Item':'IceCream','Price':10}]
orders = []
@app.route('/')
def hello_world():
response = jsoni... | [
"flask.jsonify",
"flask.Flask"
] | [((45, 60), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (50, 60), False, 'from flask import Flask, json, jsonify\n'), ((315, 338), 'flask.jsonify', 'jsonify', (['"""Hello world!"""'], {}), "('Hello world!')\n", (322, 338), False, 'from flask import Flask, json, jsonify\n'), ((447, 474), 'flask.jsonify',... |
'''
This class keeps the state of local deployments.
Local Deployment states consist of:
* Corresponding pwb config files
* Corresponding terraform files
Note: This class structure and utility is still under construction
may be changed in the future.
'''
import os
import random
import l... | [
"logging.getLogger",
"os.system",
"random.randint"
] | [((337, 362), 'logging.getLogger', 'logging.getLogger', (['"""root"""'], {}), "('root')\n", (354, 362), False, 'import logging\n'), ((456, 477), 'random.randint', 'random.randint', (['(0)', '(10)'], {}), '(0, 10)\n', (470, 477), False, 'import random\n'), ((698, 750), 'os.system', 'os.system', (['"""sudo /vagrant/src/s... |
import pandas as pd
def read(performances, out_table):
out = pd.DataFrame()
for performance in performances:
perf = pd.read_csv(performance, sep = "\t", index_col = 0)
cv_mode = "_".join(performance.split("/")[0].split("_")[-2:])
mode = "_".join(performance.split("/")[0].split("_")[1:... | [
"pandas.DataFrame",
"pandas.concat",
"argparse.ArgumentParser",
"pandas.read_csv"
] | [((67, 81), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (79, 81), True, 'import pandas as pd\n'), ((686, 772), 'argparse.ArgumentParser', 'argparse.ArgumentParser', (['"""prepare performance vs number of features for plotting"""'], {}), "(\n 'prepare performance vs number of features for plotting')\n", (70... |
# Copyright 2004-2008 <NAME>.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
"""contains classes that allow to configure code generation for free\\member functions, operators and etc."""
import os
from . import u... | [
"pygccxml.declarations.is_array",
"pygccxml.declarations.is_integral",
"pygccxml.declarations.is_reference",
"pygccxml.declarations.class_traits.get_declaration",
"pygccxml.declarations.templates.is_instantiation",
"pygccxml.declarations.is_fundamental",
"pygccxml.declarations.is_std_wostream",
"pygcc... | [((11548, 11617), 'pygccxml.declarations.member_function_t.__init__', 'declarations.member_function_t.__init__', (['self', '*arguments'], {}), '(self, *arguments, **keywords)\n', (11587, 11617), False, 'from pygccxml import declarations\n'), ((14620, 14685), 'pygccxml.declarations.constructor_t.__init__', 'declarations... |
import pytest
from django.core.exceptions import ImproperlyConfigured
from django.db import connection, models
from psqlextra.backend.schema import PostgresSchemaEditor
from psqlextra.types import PostgresPartitioningMethod
from . import db_introspection
from .fake_model import define_fake_partitioned_model
def te... | [
"django.db.models.TextField",
"pytest.mark.parametrize",
"pytest.raises",
"psqlextra.backend.schema.PostgresSchemaEditor",
"django.db.models.DateTimeField"
] | [((6950, 7090), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""method,key"""', "[(PostgresPartitioningMethod.RANGE, ['timestamp']), (\n PostgresPartitioningMethod.LIST, ['name'])]"], {}), "('method,key', [(PostgresPartitioningMethod.RANGE, [\n 'timestamp']), (PostgresPartitioningMethod.LIST, ['name']... |
import fiona
import numpy as np
import os
import pytest
import rasterio
import mapchete
from mapchete.index import zoom_index_gen
from mapchete.io import get_boto3_bucket
@pytest.mark.remote
def test_remote_indexes(mp_s3_tmpdir, gtiff_s3):
zoom = 7
gtiff_s3.dict.update(zoom_levels=zoom)
def gen_indexes... | [
"mapchete.index.zoom_index_gen",
"rasterio.open",
"os.path.join",
"numpy.array_equal",
"os.system",
"mapchete.open"
] | [((2545, 2597), 'os.path.join', 'os.path.join', (['mp.config.output.path', "('%s.vrt' % zoom)"], {}), "(mp.config.output.path, '%s.vrt' % zoom)\n", (2557, 2597), False, 'import os\n'), ((2978, 3017), 'os.path.join', 'os.path.join', (['mp_tmpdir', '"""cleantopo_br"""'], {}), "(mp_tmpdir, 'cleantopo_br')\n", (2990, 3017)... |
# %%
"""
This module contains copies of the classes SOMToolBox_Parse and SomViz provided by the lecturers.
"""
import pandas as pd
import numpy as np
import gzip
from scipy.spatial import distance_matrix, distance
from ipywidgets import Layout, HBox, Box, widgets, interact
import plotly.graph_objects as go
class SOM... | [
"sklearn.datasets.load_iris",
"plotly.graph_objects.Heatmap",
"plotly.graph_objects.Layout",
"gzip.open",
"numpy.power",
"scipy.spatial.distance_matrix",
"src.NeighbourhoodGraph.NeighbourhoodGraph",
"numpy.zeros",
"plotly.graph_objects.Scatter",
"plotly.graph_objects.FigureWidget",
"numpy.array"... | [((8420, 8490), 'src.NeighbourhoodGraph.NeighbourhoodGraph', 'NeighbourhoodGraph', (['s_weights', 'smap_x_dim', 'smap_y_dim'], {'input_data': 'iris'}), '(s_weights, smap_x_dim, smap_y_dim, input_data=iris)\n', (8438, 8490), False, 'from src.NeighbourhoodGraph import NeighbourhoodGraph\n'), ((9079, 9186), 'plotly.graph_... |
import sys
from pathlib import Path
from flask import Flask, request, jsonify, redirect
from flasgger import Swagger
from flask_cors import CORS
from deeppavlov.core.common.file import read_json
from deeppavlov.core.commands.infer import build_model_from_config
from deeppavlov.core.data.utils import check_nested_dict... | [
"deeppavlov.core.common.file.read_json",
"deeppavlov.core.common.log.get_logger",
"flask_cors.CORS",
"flask.Flask",
"pathlib.Path",
"flasgger.Swagger",
"flask.redirect",
"flask.request.get_json",
"sys.exit",
"deeppavlov.core.data.utils.jsonify_data",
"deeppavlov.core.commands.infer.build_model_f... | [((445, 465), 'deeppavlov.core.common.log.get_logger', 'get_logger', (['__name__'], {}), '(__name__)\n', (455, 465), False, 'from deeppavlov.core.common.log import get_logger\n'), ((473, 488), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (478, 488), False, 'from flask import Flask, request, jsonify, redi... |
#!/usr/bin/env python
# pylint: disable=W0201
import sys
import argparse
import yaml
import numpy as np
import random
import os.path as osp
# torch
import torch
import torch.nn as nn
import torch.optim as optim
# torchlight
import torchlight
from torchlight import str2bool
from torchlight import DictAction
from torchl... | [
"matplotlib.pyplot.ylabel",
"torchlight.import_class",
"numpy.mean",
"argparse.ArgumentParser",
"matplotlib.pyplot.xlabel",
"numpy.random.seed",
"numpy.concatenate",
"sklearn.metrics.confusion_matrix",
"subprocess.check_output",
"matplotlib.use",
"matplotlib.pyplot.title",
"matplotlib.pyplot.m... | [((365, 386), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (379, 386), False, 'import matplotlib\n'), ((1391, 1512), 'subprocess.check_output', 'subprocess.check_output', (["['nvidia-smi', '--query-gpu=memory.used', '--format=csv,nounits,noheader']"], {'encoding': '"""utf-8"""'}), "(['nvidia-sm... |
from django.contrib import admin
from .models import *
class VehicleAdmin(admin.ModelAdmin):
fields = ('regno', 'dueinsurance',)
list_display = ('regno', 'dueinsurance',)
list_filter = ('regno', 'dueinsurance',)
list_per_page = 10
class DriverAdmin(admin.ModelAdmin):
fields = ('idno', 'fname', 'lname', 'ad... | [
"django.contrib.admin.site.register"
] | [((1075, 1117), 'django.contrib.admin.site.register', 'admin.site.register', (['Vehicle', 'VehicleAdmin'], {}), '(Vehicle, VehicleAdmin)\n', (1094, 1117), False, 'from django.contrib import admin\n'), ((1118, 1158), 'django.contrib.admin.site.register', 'admin.site.register', (['Driver', 'DriverAdmin'], {}), '(Driver, ... |
from math import sqrt, pi as PI
import tensorflow as tf
from .feature_extraction import feature_extraction
class FeaturesTest(tf.test.TestCase):
def test_features(self):
image = tf.constant([
[[255, 0, 0], [0, 0, 0], [0, 0, 0]],
[[0, 0, 0], [0, 0, 0], [... | [
"math.sqrt",
"tensorflow.constant"
] | [((195, 344), 'tensorflow.constant', 'tf.constant', (['[[[255, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [255, 255, 255\n ]], [[255, 255, 255], [255, 255, 255], [255, 255, 255]]]'], {}), '([[[255, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [\n 255, 255, 255]], [[255, 255, 255], [255, 255, 255... |
#! /usr/bin/env python
from PyFoam.Applications.InitVCSCase import InitVCSCase
InitVCSCase()
| [
"PyFoam.Applications.InitVCSCase.InitVCSCase"
] | [((82, 95), 'PyFoam.Applications.InitVCSCase.InitVCSCase', 'InitVCSCase', ([], {}), '()\n', (93, 95), False, 'from PyFoam.Applications.InitVCSCase import InitVCSCase\n')] |
#!/usr/bin/env python
import rospy
import time
import numpy as np
from Adafruit_LSM303 import Adafruit_LSM303
from Gyro_L3GD20 import Gyro_L3GD20
from sensor_msgs.msg import Imu
from sensor_msgs.msg import MagneticField
class AdafruitIMU(object):
# Physical constants
G = 9.80665 # Standart gravity at sea le... | [
"Gyro_L3GD20.Gyro_L3GD20",
"sensor_msgs.msg.MagneticField",
"rospy.init_node",
"rospy.get_param",
"rospy.set_param",
"rospy.Duration.from_sec",
"sensor_msgs.msg.Imu",
"rospy.Time.now",
"Adafruit_LSM303.Adafruit_LSM303",
"rospy.spin",
"rospy.get_name",
"rospy.Publisher",
"rospy.loginfo"
] | [((2504, 2552), 'rospy.init_node', 'rospy.init_node', (['"""Adafruit_IMU"""'], {'anonymous': '(False)'}), "('Adafruit_IMU', anonymous=False)\n", (2519, 2552), False, 'import rospy\n'), ((2590, 2602), 'rospy.spin', 'rospy.spin', ([], {}), '()\n', (2600, 2602), False, 'import rospy\n'), ((504, 520), 'rospy.get_name', 'ro... |
# ------------------------------------------------------------------------------------------
# Copyright <NAME> 2021.
#
# Distributed under the MIT License.
# (See accompanying file license.md file or copy at http://opensource.org/licenses/MIT)
#
# -----------------------------------------------------------------------... | [
"utime.sleep_us",
"microbit.display.clear",
"microbit.button_b.was_pressed",
"microbit.sleep",
"microbit.display.show"
] | [((4639, 4654), 'microbit.display.clear', 'display.clear', ([], {}), '()\n', (4652, 4654), False, 'from microbit import i2c, sleep, display, button_b\n'), ((4659, 4676), 'microbit.display.show', 'display.show', (['""">"""'], {}), "('>')\n", (4671, 4676), False, 'from microbit import i2c, sleep, display, button_b\n'), (... |
# aixing_bot.py
# A discord bot created by <NAME>
# This is mostly a tutorial project for use on my discord server.
import os
import logging
import datetime
from itertools import cycle
import discord
from discord.ext import commands, tasks
from discord.ext.commands import Context, CommandError
from dotenv import loa... | [
"logging.getLogger",
"itertools.cycle",
"os.listdir",
"os.getenv",
"discord.ext.commands.Bot",
"logging.Formatter",
"discord.utils.get",
"discord.Colour.from_rgb",
"dotenv.load_dotenv",
"discord.ext.commands.is_owner",
"datetime.datetime.now",
"logging.FileHandler",
"discord.ext.tasks.loop"
... | [((329, 342), 'dotenv.load_dotenv', 'load_dotenv', ([], {}), '()\n', (340, 342), False, 'from dotenv import load_dotenv\n'), ((352, 378), 'os.getenv', 'os.getenv', (['"""DISCORD_TOKEN"""'], {}), "('DISCORD_TOKEN')\n", (361, 378), False, 'import os\n'), ((387, 413), 'os.getenv', 'os.getenv', (['"""DISCORD_GUILD"""'], {}... |
#!/usr/bin/env python3.9
from user import User
from user import Credentials
def logo():
print(" ____ _ _ ")
print(" | _ \ | | | | /\ ")
print(" | |_) ) ____ ___ ___ | | __... | [
"user.Credentials.find_by_account",
"user.Credentials.verify_user",
"user.Credentials.display_credentials",
"user.Credentials.generatePassword",
"user.Credentials.copy_password",
"user.User",
"user.Credentials"
] | [((743, 767), 'user.User', 'User', (['username', 'password'], {}), '(username, password)\n', (747, 767), False, 'from user import User\n'), ((1128, 1171), 'user.Credentials.verify_user', 'Credentials.verify_user', (['username', 'password'], {}), '(username, password)\n', (1151, 1171), False, 'from user import Credentia... |
from collections import OrderedDict
import chainer.functions as F
def _parse_subscripts(subscripts):
if '->' in subscripts:
has_arrow = True
else:
subscripts = subscripts + '->'
has_arrow = False
in_subs, out_sub = subscripts.split('->')
in_subs = in_subs.split(',')
out_s... | [
"chainer.functions.transpose",
"collections.OrderedDict",
"chainer.functions.sum",
"chainer.functions.matmul"
] | [((1156, 1169), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1167, 1169), False, 'from collections import OrderedDict\n'), ((1259, 1272), 'collections.OrderedDict', 'OrderedDict', ([], {}), '()\n', (1270, 1272), False, 'from collections import OrderedDict\n'), ((2722, 2752), 'chainer.functions.transpose... |
""" Abstraction for audio file formats. """
import logging
from trax.format.flac import FLAC
from trax.format.mp3 import MP3
from trax.format.mp4 import MP4
log = logging.getLogger(__name__)
FORMAT_MAP = {
'flac': FLAC,
'mp3' : MP3,
'mp4' : MP4,
'm4a' : MP4,
}
EXTENSION_MAP = {
'flac': 'flac',
'alac'... | [
"logging.getLogger"
] | [((168, 195), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (185, 195), False, 'import logging\n')] |
####################
import cherrypy
from indigopy.basereqhandler import BaseRequestHandler
####################
def PluginName():
return u"Twilio Ping"
def PluginDescription():
return u"This is the Twilio-Indigo Ping Plugin."
def ShowOnControlPageList():
return False # if True, then above name/description is sh... | [
"indigopy.basereqhandler.BaseRequestHandler.__init__",
"cherrypy.server.indigoDb.VariableSetValue"
] | [((473, 529), 'indigopy.basereqhandler.BaseRequestHandler.__init__', 'BaseRequestHandler.__init__', (['self', 'logFunc', 'debugLogFunc'], {}), '(self, logFunc, debugLogFunc)\n', (500, 529), False, 'from indigopy.basereqhandler import BaseRequestHandler\n'), ((560, 656), 'cherrypy.server.indigoDb.VariableSetValue', 'che... |
# coding=UTF-8
# coding to generate logs
# crontab -e
# */1 * * * * sh /Users/eric_sun/IdeaProjects/SparkProject/log_generator.sh
import random
import time
url_paths = [
"class/112.html",
"class/130.html",
"class/131.html",
"class/145.html",
"class/128.html",
"class/146.html",
"learn/821",... | [
"time.localtime",
"random.uniform",
"random.sample"
] | [((1158, 1185), 'random.sample', 'random.sample', (['ip_slices', '(4)'], {}), '(ip_slices, 4)\n', (1171, 1185), False, 'import random\n'), ((1339, 1371), 'random.sample', 'random.sample', (['http_referrers', '(1)'], {}), '(http_referrers, 1)\n', (1352, 1371), False, 'import random\n'), ((1097, 1124), 'random.sample', '... |
"""Renaming delimiters table to limiters
Revision ID: 17346cf564bc
Revises: <PASSWORD>
Create Date: 2014-03-07 14:45:27.909631
"""
# revision identifiers, used by Alembic.
revision = '17346cf564bc'
down_revision = '<PASSWORD>'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.rename_table('deli... | [
"alembic.op.rename_table"
] | [((299, 340), 'alembic.op.rename_table', 'op.rename_table', (['"""delimiters"""', '"""limiters"""'], {}), "('delimiters', 'limiters')\n", (314, 340), False, 'from alembic import op\n'), ((364, 405), 'alembic.op.rename_table', 'op.rename_table', (['"""limiters"""', '"""delimiters"""'], {}), "('limiters', 'delimiters')\n... |
import unittest
from jsonpatchext.mutators import InitItemMutator # type: ignore
from helmion.helmchart import HelmRequest, HelmChart
from helmion.config import BoolFilter
from helmion.processor import DefaultProcessor
class TestInfo(unittest.TestCase):
def setUp(self):
self.req = HelmRequest(repositor... | [
"helmion.helmchart.HelmRequest",
"helmion.helmchart.HelmChart",
"helmion.processor.DefaultProcessor"
] | [((299, 446), 'helmion.helmchart.HelmRequest', 'HelmRequest', ([], {'repository': '"""https://helm.traefik.io/traefik"""', 'chart': '"""traefik"""', 'version': '"""9.10.1"""', 'releasename': '"""helmion-traefik"""', 'namespace': '"""router"""'}), "(repository='https://helm.traefik.io/traefik', chart='traefik',\n ver... |
from pyridge.generic.scaler import Scaler
import numpy as np
class LogScaler(Scaler):
"""
Scaler for that transform the values in a logaritmic
scaler.
"""
def __init__(self):
self.min_: np.float
def get_params(self):
return {'min_': self.min_}
def fit(self, values):
... | [
"numpy.exp",
"numpy.log",
"numpy.min"
] | [((335, 357), 'numpy.min', 'np.min', (['values'], {'axis': '(0)'}), '(values, axis=0)\n', (341, 357), True, 'import numpy as np\n'), ((407, 441), 'numpy.log', 'np.log', (['(values + (1.0 - self.min_))'], {}), '(values + (1.0 - self.min_))\n', (413, 441), True, 'import numpy as np\n'), ((600, 614), 'numpy.exp', 'np.exp'... |
from typing import Optional
from app import db
from app.models import JoinToken, Team
def team_by_join_token(join_token_str: str) -> Optional[Team]:
"""
Returns the team associated with a given join token.
:param join_token_str: The join token to search over
:return: Returns a Team if the join token ... | [
"app.db.get_session",
"app.models.JoinToken"
] | [((368, 384), 'app.db.get_session', 'db.get_session', ([], {}), '()\n', (382, 384), False, 'from app import db\n'), ((895, 911), 'app.db.get_session', 'db.get_session', ([], {}), '()\n', (909, 911), False, 'from app import db\n'), ((1473, 1489), 'app.db.get_session', 'db.get_session', ([], {}), '()\n', (1487, 1489), Fa... |
import json
import jinja2
def tojson(obj, **kwargs):
return jinja2.Markup(json.dumps(obj, **kwargs))
| [
"json.dumps"
] | [((80, 105), 'json.dumps', 'json.dumps', (['obj'], {}), '(obj, **kwargs)\n', (90, 105), False, 'import json\n')] |
import time
""" Count list elements
"""
def count_items(elements):
if elements == []: return 0
return 1 + count_items(elements[1:])
# Faster
def count_items_two(elements):
try: elements[1]
except: return 1
return 1 + count_items_two(elements[1:])
elements = [1,2,3,4,5,6,7,8,9,99]
start = time.p... | [
"time.process_time"
] | [((314, 333), 'time.process_time', 'time.process_time', ([], {}), '()\n', (331, 333), False, 'import time\n'), ((425, 444), 'time.process_time', 'time.process_time', ([], {}), '()\n', (442, 444), False, 'import time\n'), ((373, 392), 'time.process_time', 'time.process_time', ([], {}), '()\n', (390, 392), False, 'import... |
from math import ceil
while True:
try: n, l, c = [int(x) for x in input().split()]
except: break
e = [len(x) for x in input().split()]
car = i = 0
par = 1
while i < n:
car += e[i]
if i == len(e)-1: break
if car + 1 + e[i+1] > c:
par += 1
car = 0
else: car += ... | [
"math.ceil"
] | [((344, 357), 'math.ceil', 'ceil', (['(par / l)'], {}), '(par / l)\n', (348, 357), False, 'from math import ceil\n')] |
# Autogenerated from KST: please remove this line if doing any edits by hand!
import unittest
from default_endian_expr_inherited import DefaultEndianExprInherited
class TestDefaultEndianExprInherited(unittest.TestCase):
def test_default_endian_expr_inherited(self):
with DefaultEndianExprInherited.from_fi... | [
"default_endian_expr_inherited.DefaultEndianExprInherited.from_file"
] | [((286, 345), 'default_endian_expr_inherited.DefaultEndianExprInherited.from_file', 'DefaultEndianExprInherited.from_file', (['"""src/endian_expr.bin"""'], {}), "('src/endian_expr.bin')\n", (322, 345), False, 'from default_endian_expr_inherited import DefaultEndianExprInherited\n')] |
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
from mo.front.extractor import FrontExtractorOp
from mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs
from mo.ops.squeeze import Squeeze
class SqueezeExtractor(FrontExtractorOp):
op = 'squeeze'
enabled = True
@... | [
"mo.front.mxnet.extractors.utils.get_mxnet_layer_attrs"
] | [((376, 415), 'mo.front.mxnet.extractors.utils.get_mxnet_layer_attrs', 'get_mxnet_layer_attrs', (['node.symbol_dict'], {}), '(node.symbol_dict)\n', (397, 415), False, 'from mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs\n')] |
from rest_framework import serializers
from scheduler.apps.tasks.models import Task
from scheduler.apps.authentication.models import User
class ProfileSerializer(serializers.ModelSerializer):
assigned_to = serializers.StringRelatedField(many=True)
class Meta:
model = Task
fields = ('id',
... | [
"rest_framework.serializers.StringRelatedField"
] | [((212, 253), 'rest_framework.serializers.StringRelatedField', 'serializers.StringRelatedField', ([], {'many': '(True)'}), '(many=True)\n', (242, 253), False, 'from rest_framework import serializers\n')] |
#!/usr/bin/python
#
# -*- coding: utf-8 -*-
#
"""
iptables_converter.py:
convert iptables commands within a script
into a correspondig iptables-save script
default filename to read is rules, to read some other
file, append: -s filename
output is written to stdout for maximum flexibilty
Author... | [
"re.search",
"UserDict.UserDict.__init__",
"logging.debug",
"sys.exit"
] | [((843, 854), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (851, 854), False, 'import sys\n'), ((1002, 1025), 'UserDict.UserDict.__init__', 'UserDict.__init__', (['self'], {}), '(self)\n', (1019, 1025), False, 'from UserDict import UserDict\n'), ((4675, 4698), 'UserDict.UserDict.__init__', 'UserDict.__init__', (['se... |
#!/usr/bin/env python3
from pathlib import Path
import shutil
import subprocess
import tempfile
def update_bundled() -> None:
ts_client = Path("typeshed_client")
assert (
ts_client.is_dir()
), "this script must be run at the root of the typeshed_client repository"
bundled_ts_dir = ts_client /... | [
"tempfile.TemporaryDirectory",
"subprocess.check_call",
"pathlib.Path",
"shutil.copytree",
"shutil.rmtree"
] | [((145, 168), 'pathlib.Path', 'Path', (['"""typeshed_client"""'], {}), "('typeshed_client')\n", (149, 168), False, 'from pathlib import Path\n'), ((372, 401), 'shutil.rmtree', 'shutil.rmtree', (['bundled_ts_dir'], {}), '(bundled_ts_dir)\n', (385, 401), False, 'import shutil\n'), ((411, 440), 'tempfile.TemporaryDirector... |
import argparse
import pathlib
import subprocess
import sys
import typing
def configure_parser(parser: argparse.ArgumentParser) -> None:
parser.description = "Fetch the openshift config for CARA"
parser.set_defaults(handler=handler)
parser.add_argument(
"instance", choices=['cara-prod', 'test-cara... | [
"subprocess.check_output",
"argparse.ArgumentParser",
"pathlib.Path",
"subprocess.run",
"sys.exit"
] | [((2222, 2312), 'subprocess.run', 'subprocess.run', (["['oc', 'project', project_name]"], {'stdout': 'subprocess.DEVNULL', 'check': '(True)'}), "(['oc', 'project', project_name], stdout=subprocess.DEVNULL,\n check=True)\n", (2236, 2312), False, 'import subprocess\n'), ((2391, 2416), 'argparse.ArgumentParser', 'argpa... |
# Copyright 2021 <NAME>
# Apache 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
"""Basic Flow modules used in VITS.
This code is based on https://github.com/jaywalnut310/vits.
"""
import math
from typing import Optional, Tuple, Union
import torch
from espnet2.gan_tts.vits.transform import piecewise_rational_q... | [
"torch.nn.Dropout",
"torch.nn.GELU",
"torch.nn.ModuleList",
"torch.nn.LayerNorm",
"math.sqrt",
"torch.clamp_min",
"torch.exp",
"espnet2.gan_tts.vits.transform.piecewise_rational_quadratic_transform",
"torch.flip",
"torch.sum",
"torch.zeros",
"torch.nn.Conv1d",
"torch.cat"
] | [((892, 910), 'torch.flip', 'torch.flip', (['x', '[1]'], {}), '(x, [1])\n', (902, 910), False, 'import torch\n'), ((4320, 4341), 'torch.nn.ModuleList', 'torch.nn.ModuleList', ([], {}), '()\n', (4339, 4341), False, 'import torch\n'), ((7112, 7167), 'torch.nn.Conv1d', 'torch.nn.Conv1d', (['self.half_channels', 'hidden_ch... |
#! /usr/bin/env python
# title : TurboTest.py
# description : This script tests the turbo decoding for parallel concatenated convolutional codes
# author : <NAME>
# python_version : 3.5.2
import numpy as np
from numpy.random import rand, randn
from scipy.stats import norm
import matplotlib.pypl... | [
"ConvEncoder.TurboEncoder",
"matplotlib.pyplot.grid",
"numpy.sqrt",
"numpy.random.rand",
"matplotlib.pyplot.xscale",
"matplotlib.pyplot.ylabel",
"matplotlib.pyplot.xlabel",
"ConvTrellisDef.ConvTrellisDef",
"Interleaver.Interleaver",
"matplotlib.pyplot.plot",
"matplotlib.pyplot.yscale",
"numpy.... | [((782, 795), 'Interleaver.Interleaver', 'Interleaver', ([], {}), '()\n', (793, 795), False, 'from Interleaver import Interleaver\n'), ((1012, 1034), 'SisoDecoder.SisoDecoder', 'SisoDecoder', (['trellis_p'], {}), '(trellis_p)\n', (1023, 1034), False, 'from SisoDecoder import SisoDecoder\n'), ((1139, 1166), 'ConvEncoder... |
# Copyright 1997 - 2018 by IXIA Keysight
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, p... | [
"ixnetwork_restpy.testplatform.sessions.ixnetwork.topology.tables.Tables",
"ixnetwork_restpy.testplatform.sessions.ixnetwork.topology.groups.Groups",
"ixnetwork_restpy.testplatform.sessions.ixnetwork.topology.meters.Meters"
] | [((2239, 2251), 'ixnetwork_restpy.testplatform.sessions.ixnetwork.topology.groups.Groups', 'Groups', (['self'], {}), '(self)\n', (2245, 2251), False, 'from ixnetwork_restpy.testplatform.sessions.ixnetwork.topology.groups import Groups\n'), ((2685, 2697), 'ixnetwork_restpy.testplatform.sessions.ixnetwork.topology.meters... |
## GROUP
import numpy as np
import cv2
from PIL import Image
import os
from options.test_options import TestOptions
from options.train_options import TrainOptions
from data import create_dataset
from models import create_model
from util.visualizer import save_images
from util import html
import torch
i... | [
"torchvision.transforms.CenterCrop",
"numpy.tile",
"PIL.Image.fromarray",
"data.create_dataset",
"PIL.Image.new",
"options.train_options.TrainOptions",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"cv2.cvtColor",
"torchvision.transforms.Normalize",
"torchvision.utils.make_grid",
"cv2.resize",
... | [((419, 438), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (435, 438), False, 'import cv2\n'), ((1283, 1300), 'models.create_model', 'create_model', (['opt'], {}), '(opt)\n', (1295, 1300), False, 'from models import create_model\n'), ((1513, 1532), 'data.create_dataset', 'create_dataset', (['opt'], {... |
# Licensed to Modin Development Team under one or more contributor license agreements.
# See the NOTICE file distributed with this work for additional information regarding
# copyright ownership. The Modin Development Team licenses this file to you under the
# Apache License, Version 2.0 (the "License"); you may not u... | [
"pandas.Grouper",
"modin.utils._inherit_docstrings",
"pandas.core.dtypes.common.is_list_like",
"pandas.DataFrame.resample"
] | [((1109, 1160), 'modin.utils._inherit_docstrings', '_inherit_docstrings', (['pandas.core.resample.Resampler'], {}), '(pandas.core.resample.Resampler)\n', (1128, 1160), False, 'from modin.utils import _inherit_docstrings\n'), ((3702, 3866), 'pandas.Grouper', 'pandas.Grouper', ([], {'key': 'on', 'freq': 'rule', 'closed':... |
# No shebang line, this module is meant to be imported
#
# Copyright 2013 <NAME>
# Copyright 2014 Ambient Entertainment GmbH & Co. KG
#
# 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
#
# ht... | [
"pyfarm.master.application.db.Column",
"pyfarm.master.application.db.relationship",
"pyfarm.core.logger.getLogger",
"sqlalchemy.orm.validates",
"pyfarm.models.core.types.id_column",
"pyfarm.master.application.db.backref",
"pyfarm.master.config.config.get",
"sqlalchemy.schema.UniqueConstraint"
] | [((1252, 1279), 'pyfarm.core.logger.getLogger', 'getLogger', (['"""models.jobtype"""'], {}), "('models.jobtype')\n", (1261, 1279), False, 'from pyfarm.core.logger import getLogger\n'), ((1431, 1459), 'pyfarm.master.config.config.get', 'config.get', (['"""table_job_type"""'], {}), "('table_job_type')\n", (1441, 1459), F... |
import re
from capybara.compat import cmp
from capybara.helpers import declension, desc, failure_message
from capybara.utils import cached_property
class Result(object):
"""
A :class:`Result` represents a collection of :class:`Element` objects on the page. It is
possible to interact with this collection ... | [
"re.sub",
"capybara.helpers.failure_message",
"capybara.helpers.desc"
] | [((3083, 3142), 'capybara.helpers.failure_message', 'failure_message', (['self.query.description', 'self.query.options'], {}), '(self.query.description, self.query.options)\n', (3098, 3142), False, 'from capybara.helpers import declension, desc, failure_message\n'), ((3812, 3864), 're.sub', 're.sub', (['"""(to find)"""... |
import enum
import pathlib
from typing import DefaultDict, Dict, List, Optional, Sequence, Tuple
from pysen import ComponentBase
from pysen.command import CommandBase
from pysen.diagnostic import Diagnostic
from pysen.reporter import Reporter
from pysen.runner_options import PathContext, RunOptions
from pysen.setting ... | [
"pathlib.Path"
] | [((1289, 1306), 'pathlib.Path', 'pathlib.Path', (['"""."""'], {}), "('.')\n", (1301, 1306), False, 'import pathlib\n')] |
# -*- coding: utf-8 -*-
from future import standard_library
standard_library.install_aliases()
from builtins import str
from builtins import map
from builtins import object
import re
class HocrSpecProperties(object):
class HocrSpecProperty(object):
"""
Definition of a 'title' property
... | [
"future.standard_library.install_aliases",
"re.split",
"re.match",
"builtins.str"
] | [((61, 95), 'future.standard_library.install_aliases', 'standard_library.install_aliases', ([], {}), '()\n', (93, 95), False, 'from future import standard_library\n'), ((22360, 22388), 're.split', 're.split', (['"""\\\\s*;\\\\s*"""', 'title'], {}), "('\\\\s*;\\\\s*', title)\n", (22368, 22388), False, 'import re\n'), ((... |
import requests,urllib,socket,random,time,re,threading,sys,whois,json,os,xtelnet
import bs4
from bs4 import BeautifulSoup
from bane.payloads import *
if os.path.isdir('/data/data/com.termux/')==False:
import dns.resolver
def get_banner(u,p=23,timeout=3,payload=None):
try:
return xtelnet.get_banner(u,p=p,timeout=... | [
"requests.session",
"random.choice",
"socket.socket",
"time.sleep",
"bs4.BeautifulSoup",
"urllib.quote",
"os.path.isdir",
"threading.Thread",
"sys.stdout.flush",
"whois.whois",
"xtelnet.get_banner",
"sys.stdout.write"
] | [((153, 192), 'os.path.isdir', 'os.path.isdir', (['"""/data/data/com.termux/"""'], {}), "('/data/data/com.termux/')\n", (166, 192), False, 'import requests, urllib, socket, random, time, re, threading, sys, whois, json, os, xtelnet\n'), ((287, 347), 'xtelnet.get_banner', 'xtelnet.get_banner', (['u'], {'p': 'p', 'timeou... |
#!/usr/bin/env python3
import templates
print(templates.login_page()) | [
"templates.login_page"
] | [((47, 69), 'templates.login_page', 'templates.login_page', ([], {}), '()\n', (67, 69), False, 'import templates\n')] |
# coding=utf-8
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import tensorflow as tf
from pct.layers import common_layers
class ElmanRNNCell(tf.keras.Model):
""" Elman Recurrent Neural Network Cell
Paper: https://www.cs.swarthmore.edu/~meeden/cs6... | [
"tensorflow.contrib.layers.xavier_initializer",
"tensorflow.matmul",
"tensorflow.constant_initializer",
"tensorflow.zeros_initializer",
"tensorflow.identity",
"tensorflow.cast",
"tensorflow.stack",
"tensorflow.abs"
] | [((2296, 2322), 'tensorflow.identity', 'tf.identity', (['initial_state'], {}), '(initial_state)\n', (2307, 2322), True, 'import tensorflow as tf\n'), ((2419, 2452), 'tensorflow.cast', 'tf.cast', (['feature_mask', 'tf.float32'], {}), '(feature_mask, tf.float32)\n', (2426, 2452), True, 'import tensorflow as tf\n'), ((308... |
import os
import imp
import unittest
import SwissKnife
import tests.test_utils as test_utils
from unittest.mock import MagicMock
from unittest import mock
from SwissKnife.gcloud.GCloudStorage import GCloudStorage
class TestGCloudStorage(unittest.TestCase):
def setUp(self):
self.bucket_path_env_value = '... | [
"unittest.mock.MagicMock",
"imp.reload",
"SwissKnife.gcloud.GCloudStorage.GCloudStorage",
"tests.test_utils.set_env_variable",
"unittest.mock.patch"
] | [((1221, 1273), 'unittest.mock.patch', 'mock.patch', (['"""SwissKnife.gcloud.GCloudStorage.gcloud"""'], {}), "('SwissKnife.gcloud.GCloudStorage.gcloud')\n", (1231, 1273), False, 'from unittest import mock\n'), ((1643, 1695), 'unittest.mock.patch', 'mock.patch', (['"""SwissKnife.gcloud.GCloudStorage.gcloud"""'], {}), "(... |
# --------------
import pandas as pd
import scipy.stats as stats
import math
import numpy as np
import warnings
warnings.filterwarnings('ignore')
#Sample_Size
sample_size=2000
#Z_Critical Score
z_critical = stats.norm.ppf(q = 0.95)
# path [File location variable]
data=pd.read_csv(path)
#Cod... | [
"warnings.filterwarnings",
"pandas.Series",
"pandas.read_csv",
"scipy.stats.chi2_contingency",
"scipy.stats.norm.ppf",
"numpy.array",
"scipy.stats.chi2.ppf",
"statsmodels.stats.weightstats.ztest",
"pandas.concat",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((119, 152), 'warnings.filterwarnings', 'warnings.filterwarnings', (['"""ignore"""'], {}), "('ignore')\n", (142, 152), False, 'import warnings\n'), ((220, 242), 'scipy.stats.norm.ppf', 'stats.norm.ppf', ([], {'q': '(0.95)'}), '(q=0.95)\n', (234, 242), True, 'import scipy.stats as stats\n'), ((297, 314), 'pandas.read_c... |
"""
File to handle the rollback process in order to delete users added.
"""
import logging
import logging.config
import time
from concurrent.futures import ThreadPoolExecutor
from multiprocessing import Lock
import requests
from janrain.capture import ApiResponseError
from tqdm import tqdm
from utils.reader import C... | [
"logging.getLogger",
"concurrent.futures.ThreadPoolExecutor",
"tqdm.tqdm",
"utils.utils.rate_limiter",
"utils.reader.CsvReader",
"multiprocessing.Lock",
"time.time",
"utils.utils.count_lines_in_file"
] | [((397, 424), 'logging.getLogger', 'logging.getLogger', (['__file__'], {}), '(__file__)\n', (414, 424), False, 'import logging\n'), ((443, 487), 'logging.getLogger', 'logging.getLogger', (['"""success_rollback_logger"""'], {}), "('success_rollback_logger')\n", (460, 487), False, 'import logging\n'), ((502, 543), 'loggi... |
from __future__ import unicode_literals
from frappe import _
def get_data():
return [
{
"label": _("Reporte Stock"),
"icon": "fa fa-star",
"items": [
{
"type": "report",
"name": "Stock",
"doctype": "Stock One",
"is_query_report": True
}
]
}
]
| [
"frappe._"
] | [((104, 122), 'frappe._', '_', (['"""Reporte Stock"""'], {}), "('Reporte Stock')\n", (105, 122), False, 'from frappe import _\n')] |
"""
Settings for gRPC framework are all namespaced in the GRPC_FRAMEWORK setting.
For example your project's `settings.py` file might look like this:
GRPC_FRAMEWORK = {
'ROOT_HANDLERS_HOOK': 'path.to.my.custom_grpc_handlers',
'SERVER_INTERCEPTORS': [Interceptor1(), Interceptor2()],
'DEFAULT_FILTER_BACKEN... | [
"django.utils.module_loading.import_string",
"django.test.signals.setting_changed.connect"
] | [((4805, 4850), 'django.test.signals.setting_changed.connect', 'setting_changed.connect', (['reload_grpc_settings'], {}), '(reload_grpc_settings)\n', (4828, 4850), False, 'from django.test.signals import setting_changed\n'), ((2662, 2680), 'django.utils.module_loading.import_string', 'import_string', (['val'], {}), '(v... |
import sys
def isSorted(array):
for i in range(0,len(array)-1):
if array[i] > array[i+1]:
return False
return True
# from Sedgewick and Wayne, Section 2.2
def merge(array, aux, lo1, hi1, lo2, hi2):
# copy to aux[]
for k in range(lo1, hi1+1):
aux[k... | [
"sys.stdin.readline"
] | [((3324, 3344), 'sys.stdin.readline', 'sys.stdin.readline', ([], {}), '()\n', (3342, 3344), False, 'import sys\n')] |
import os
import re
import torch
CHECKPOINTS_DIR = 'checkpoints'
def find_last_checkpoint_epoch(savedir, prefix = None):
root = os.path.join(savedir, CHECKPOINTS_DIR)
if not os.path.exists(root):
return -1
if prefix is None:
r = re.compile(r'(\d+)_.*')
else:
r = re.compile(r'(... | [
"os.path.exists",
"re.escape",
"os.listdir",
"os.makedirs",
"re.compile",
"torch.load",
"os.path.join"
] | [((134, 172), 'os.path.join', 'os.path.join', (['savedir', 'CHECKPOINTS_DIR'], {}), '(savedir, CHECKPOINTS_DIR)\n', (146, 172), False, 'import os\n'), ((395, 411), 'os.listdir', 'os.listdir', (['root'], {}), '(root)\n', (405, 411), False, 'import os\n'), ((830, 855), 'os.path.join', 'os.path.join', (['root', 'fname'], ... |
# Generated by Django 3.0.7 on 2020-06-22 09:28
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0001_initial"),
]
operations = [
migrations.AlterField(
model_name="user",
name="email",
field=... | [
"django.db.models.EmailField",
"django.db.models.CharField"
] | [((320, 382), 'django.db.models.EmailField', 'models.EmailField', ([], {'max_length': '(100)', 'verbose_name': '"""Adresse mail"""'}), "(max_length=100, verbose_name='Adresse mail')\n", (337, 382), False, 'from django.db import migrations, models\n'), ((536, 591), 'django.db.models.CharField', 'models.CharField', ([], ... |
from agave.frames import ethernet, arp
from agave.frames.core import Buffer
from ipaddress import ip_address, IPv4Address
import select
import socket
import time
def main(argv):
try:
MITM(*tuple(argv)).run()
except KeyboardInterrupt as e:
pass
def is_at(
sender_mac: bytes, sender_ipv4: IPv4Address,
target_m... | [
"select.select",
"ipaddress.ip_address",
"agave.frames.ethernet.Ethernet",
"agave.frames.ethernet.str_to_mac",
"socket.htons",
"agave.frames.arp.ARP.build",
"agave.frames.ethernet.Ethernet.read_from_buffer",
"agave.frames.arp.ARP.read_from_buffer",
"agave.frames.core.Buffer.from_bytes",
"time.time... | [((381, 447), 'agave.frames.ethernet.Ethernet', 'ethernet.Ethernet', (['target_mac', 'sender_mac', 'ethernet.ETHER_TYPE_ARP'], {}), '(target_mac, sender_mac, ethernet.ETHER_TYPE_ARP)\n', (398, 447), False, 'from agave.frames import ethernet, arp\n'), ((461, 563), 'agave.frames.arp.ARP.build', 'arp.ARP.build', (['arp.OP... |
"""Setup script for SWITCH.
Use "pip install --upgrade ." to install a copy in the site packages directory.
Use "pip install --upgrade --editable ." to install SWITCH to be run from its
current location.
Optional dependencies can be added during the initial install or later by
running a command like this:
pip instal... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((620, 645), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (635, 645), False, 'import os\n'), ((1826, 1883), 'setuptools.find_packages', 'find_packages', ([], {'include': "['switch_model', 'switch_model.*']"}), "(include=['switch_model', 'switch_model.*'])\n", (1839, 1883), False, 'from set... |
from django.contrib import admin
from .models import IR
# Register your models here.
class IRAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'date_posted')
list_filter = ('title', 'date_posted', 'author')
admin.site.register(IR, IRAdmin)
| [
"django.contrib.admin.site.register"
] | [((229, 261), 'django.contrib.admin.site.register', 'admin.site.register', (['IR', 'IRAdmin'], {}), '(IR, IRAdmin)\n', (248, 261), False, 'from django.contrib import admin\n')] |
from pathlib import Path
from urlpath import URL
# file urls
ROOT_DIR = Path(__file__).parent.parent
CONFIG_DIR = ROOT_DIR / 'config'
DATA_DIR = ROOT_DIR / 'data'
# hv urls
HV_ROOT = URL('http://alt.hentaiverse.org')
HV_BAZAAR = HV_ROOT.add_query(s='Bazaar')
HV_LOTTO_WEAPON = HV_BAZAAR.add_query(ss='lt')
HV_LOTTO... | [
"pathlib.Path",
"urlpath.URL"
] | [((187, 220), 'urlpath.URL', 'URL', (['"""http://alt.hentaiverse.org"""'], {}), "('http://alt.hentaiverse.org')\n", (190, 220), False, 'from urlpath import URL\n'), ((386, 430), 'urlpath.URL', 'URL', (['"""https://forums.e-hentai.org/index.php"""'], {}), "('https://forums.e-hentai.org/index.php')\n", (389, 430), False,... |
from sqlalchemy import Table
from sqlalchemy import MetaData
from sqlalchemy import Column
from sqlalchemy import Integer
from sqlalchemy import String
from sqlalchemy import ForeignKey
from sqlalchemy.orm import mapper
from sqlalchemy.orm import relationship
import domain.models as models
class Mapper(object):
_... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.ForeignKey",
"sqlalchemy.MetaData",
"sqlalchemy.String",
"sqlalchemy.Column"
] | [((523, 533), 'sqlalchemy.MetaData', 'MetaData', ([], {}), '()\n', (531, 533), False, 'from sqlalchemy import MetaData\n'), ((666, 705), 'sqlalchemy.Column', 'Column', (['"""id"""', 'Integer'], {'primary_key': '(True)'}), "('id', Integer, primary_key=True)\n", (672, 705), False, 'from sqlalchemy import Column\n'), ((71... |
from osziplotter.network.Headers import BeaconHeader, SampleTransmissionHeader, CommandHeader
from osziplotter.network.SampleCollector import SampleCollector
from osziplotter.modelcontroller.BoardEvents import BoardEvents
from socket import socket, AF_INET, SOCK_DGRAM, error
from errno import EAGAIN, EWOULDBLOCK
from ... | [
"osziplotter.network.SampleCollector.SampleCollector",
"socket.socket",
"osziplotter.network.Headers.CommandHeader",
"osziplotter.network.Headers.SampleTransmissionHeader",
"osziplotter.network.Headers.BeaconHeader"
] | [((526, 543), 'osziplotter.network.SampleCollector.SampleCollector', 'SampleCollector', ([], {}), '()\n', (541, 543), False, 'from osziplotter.network.SampleCollector import SampleCollector\n'), ((567, 594), 'socket.socket', 'socket', (['AF_INET', 'SOCK_DGRAM'], {}), '(AF_INET, SOCK_DGRAM)\n', (573, 594), False, 'from ... |
#from flask import Flask, render_template
#from flask_sqlalchemy import SQLAlchemy
from flask_wtf import FlaskForm
from wtforms import Form, FieldList, FormField, IntegerField, StringField, \
SubmitField
class LapForm(Form):
"""Subform.
CSRF is disabled for this subform (using `Form` as parent class) ... | [
"wtforms.StringField",
"wtforms.FormField"
] | [((386, 415), 'wtforms.StringField', 'StringField', (['"""Quota Position"""'], {}), "('Quota Position')\n", (397, 415), False, 'from wtforms import Form, FieldList, FormField, IntegerField, StringField, SubmitField\n'), ((539, 557), 'wtforms.FormField', 'FormField', (['LapForm'], {}), '(LapForm)\n', (548, 557), False, ... |
from typing import TextIO, Iterator
import click
from pafpy import PafFile, PafRecord
@click.command()
@click.help_option("--help", "-h")
@click.option(
"-i",
"--infile",
help="PAF file to assess.",
type=click.Path(exists=True, dir_okay=False),
required=True,
)
@click.option(
"-o",
"--out... | [
"pafpy.PafFile",
"click.option",
"click.help_option",
"click.File",
"click.Path",
"click.command"
] | [((90, 105), 'click.command', 'click.command', ([], {}), '()\n', (103, 105), False, 'import click\n'), ((107, 140), 'click.help_option', 'click.help_option', (['"""--help"""', '"""-h"""'], {}), "('--help', '-h')\n", (124, 140), False, 'import click\n'), ((448, 568), 'click.option', 'click.option', (['"""--delim"""'], {... |
# Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License").
# You may not use this file except in compliance with the License.
# A copy of the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "LICENSE.txt" file acc... | [
"xml.etree.ElementTree.parse",
"json.dumps",
"os.path.join",
"os.path.isfile",
"os.walk"
] | [((906, 931), 'os.walk', 'os.walk', (['test_results_dir'], {}), '(test_results_dir)\n', (913, 931), False, 'import os\n'), ((1610, 1659), 'os.path.join', 'os.path.join', (['test_results_dir', '"""test_report.xml"""'], {}), "(test_results_dir, 'test_report.xml')\n", (1622, 1659), False, 'import os\n'), ((1671, 1703), 'o... |
from picamera.array import PiRGBArray
import picamera
from picamera import PiCamera
import time
import cv2
def CaptureImage(camera, rawCapture):
print('Capturing frames...')
print('Press Ctrl-C to end')
try:
# capture frames from the camera
for frame in camera.capture_continuous(rawCapture... | [
"time.time",
"picamera.PiCamera",
"time.sleep",
"picamera.array.PiRGBArray"
] | [((923, 933), 'picamera.PiCamera', 'PiCamera', ([], {}), '()\n', (931, 933), False, 'from picamera import PiCamera\n'), ((1012, 1047), 'picamera.array.PiRGBArray', 'PiRGBArray', (['camera'], {'size': '(640, 320)'}), '(camera, size=(640, 320))\n', (1022, 1047), False, 'from picamera.array import PiRGBArray\n'), ((1160, ... |
from __future__ import unicode_literals
import datetime
import logging
import os
import sys
from six.moves import cStringIO as StringIO
import unicodecsv
from dateutil import parser
from data_research.models import (
County, CountyMortgageData, MortgageDataConstant
)
from data_research.mortgage_utilities.fips_me... | [
"logging.getLogger",
"dateutil.parser.parse",
"data_research.models.CountyMortgageData.objects.all",
"datetime.datetime.now",
"data_research.models.MortgageDataConstant.objects.get_or_create",
"data_research.models.MortgageDataConstant.objects.get",
"data_research.scripts.update_county_msa_meta.run",
... | [((620, 630), 'six.moves.cStringIO', 'StringIO', ([], {}), '()\n', (628, 630), True, 'from six.moves import cStringIO as StringIO\n'), ((695, 722), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (712, 722), False, 'import logging\n'), ((784, 847), 'data_research.models.MortgageDataConstan... |
import numpy as np
from pysal.lib.common import requires
@requires('matplotlib')
def shift_colormap(cmap, start=0, midpoint=0.5, stop=1.0, name='shiftedcmap'):
'''
Function to offset the "center" of a colormap. Useful for
data with a negative min and positive max and you want the
middle of the colormap... | [
"matplotlib.pyplot.savefig",
"matplotlib.colors.LinearSegmentedColormap",
"matplotlib.pyplot.Normalize",
"numpy.max",
"numpy.linspace",
"pysal.lib.common.requires",
"numpy.min",
"matplotlib.pyplot.register_cmap",
"matplotlib.pyplot.subplots",
"matplotlib.pyplot.show"
] | [((59, 81), 'pysal.lib.common.requires', 'requires', (['"""matplotlib"""'], {}), "('matplotlib')\n", (67, 81), False, 'from pysal.lib.common import requires\n'), ((1974, 1996), 'pysal.lib.common.requires', 'requires', (['"""matplotlib"""'], {}), "('matplotlib')\n", (1982, 1996), False, 'from pysal.lib.common import req... |
#! /usr/bin/env python3
from popoff.bond_types import BondType
import pytest
@pytest.fixture
def bond_type():
return BondType(1, 'Li-O', 65.0)
def test_assert_bond_type(bond_type):
assert bond_type.bond_type_index == 1
assert bond_type.label == 'Li-O'
assert bond_type.spring_coeff_1 == 65.0
assert... | [
"pytest.mark.parametrize",
"pytest.raises",
"popoff.bond_types.BondType"
] | [((356, 419), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""bond_type_index"""', "['test', 1.0, True]"], {}), "('bond_type_index', ['test', 1.0, True])\n", (379, 419), False, 'import pytest\n'), ((648, 696), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""label"""', '[1, 1.0, True]'], {}), "('... |
# TODO
# Fix the importing
# import CustomName
# ...
# obj = CustomName()
# obj.account.get_balance()
# obj.parser.extract_symbols()
import __init__
from __init__ import Account
from __init__ import Webservice
from __init__ import Database
from __init__ import Parser
import sys, json
if __name__ == "__main__":
#... | [
"__init__.Account",
"__init__.Webservice",
"__init__.Parser"
] | [((379, 388), '__init__.Account', 'Account', ([], {}), '()\n', (386, 388), False, 'from __init__ import Account\n'), ((406, 418), '__init__.Webservice', 'Webservice', ([], {}), '()\n', (416, 418), False, 'from __init__ import Webservice\n'), ((833, 841), '__init__.Parser', 'Parser', ([], {}), '()\n', (839, 841), False,... |
import scipy
import numpy as np
import unittest as ut
from qfactor import get_distance
from qfactor.gates import RxGate
class TestRxGateConstructor ( ut.TestCase ):
def test_rxgate_constructor_invalid ( self ):
self.assertRaises( TypeError, RxGate, 1, 0 )
self.assertRaises( TypeError, RxGate, ... | [
"qfactor.get_distance",
"numpy.array",
"qfactor.gates.RxGate",
"scipy.linalg.expm",
"numpy.array_equal",
"unittest.main"
] | [((1137, 1146), 'unittest.main', 'ut.main', ([], {}), '()\n', (1144, 1146), True, 'import unittest as ut\n'), ((767, 789), 'qfactor.gates.RxGate', 'RxGate', (['np.pi', '(0)', '(True)'], {}), '(np.pi, 0, True)\n', (773, 789), False, 'from qfactor.gates import RxGate\n'), ((804, 830), 'numpy.array', 'np.array', (['[[0, 1... |
from __future__ import absolute_import
from __future__ import print_function
import pylab as plt
import sys
sys.path.insert(0, r'c:\work\dist\git\camb')
import camb
from cosmomc_to_camb import get_camb_params
import planckStyle as s
import numpy as np
from planck import SN
import os
g = s.getSinglePlotter()
like = S... | [
"sys.path.insert",
"pylab.subplots_adjust",
"numpy.log10",
"pylab.savefig",
"planckStyle.plotBands",
"numpy.log",
"numpy.argsort",
"numpy.array",
"camb.get_background",
"numpy.mean",
"numpy.ix_",
"numpy.max",
"cosmomc_to_camb.get_camb_params",
"numpy.min",
"pylab.subplots",
"numpy.logs... | [((109, 156), 'sys.path.insert', 'sys.path.insert', (['(0)', '"""c:\\\\work\\\\dist\\\\git\\\\camb"""'], {}), "(0, 'c:\\\\work\\\\dist\\\\git\\\\camb')\n", (124, 156), False, 'import sys\n'), ((290, 310), 'planckStyle.getSinglePlotter', 's.getSinglePlotter', ([], {}), '()\n', (308, 310), True, 'import planckStyle as s\... |
from contextlib import contextmanager
from unittest.mock import MagicMock
from cognite.client import CogniteClient
from cognite.client._api.assets import AssetsAPI
from cognite.client._api.data_sets import DataSetsAPI
from cognite.client._api.datapoints import DatapointsAPI
from cognite.client._api.entity_matching imp... | [
"unittest.mock.MagicMock"
] | [((1520, 1553), 'unittest.mock.MagicMock', 'MagicMock', ([], {'spec_set': 'TimeSeriesAPI'}), '(spec_set=TimeSeriesAPI)\n', (1529, 1553), False, 'from unittest.mock import MagicMock\n'), ((1580, 1613), 'unittest.mock.MagicMock', 'MagicMock', ([], {'spec_set': 'DatapointsAPI'}), '(spec_set=DatapointsAPI)\n', (1589, 1613)... |
# Copyright 2014 Google LLC
#
# 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, s... | [
"viur.xeno.databases.dbinterface.get_multi",
"viur.xeno.databases.dbinterface.connect",
"viur.xeno.databases.dbinterface.generateID",
"random.random",
"time.time"
] | [((1424, 1445), 'viur.xeno.databases.dbinterface.connect', 'dbinterface.connect', ([], {}), '()\n', (1443, 1445), False, 'from viur.xeno.databases import dbinterface\n'), ((6230, 6257), 'viur.xeno.databases.dbinterface.get_multi', 'dbinterface.get_multi', (['keys'], {}), '(keys)\n', (6251, 6257), False, 'from viur.xeno... |
import torch
import torch.nn as nn
import torch.nn.functional as F
from pytorch_transformers.modeling_bert import BertPreTrainedModel, BertModel
from configs.basic_config import config as basic_config
class BertFCForMultiLable(BertPreTrainedModel):
def __init__(self, config):
super(BertFCForMul... | [
"torch.nn.MaxPool1d",
"torch.nn.ReLU",
"torch.nn.Dropout",
"torch.nn.ZeroPad2d",
"torch.nn.LSTM",
"pytorch_transformers.modeling_bert.BertModel",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.Linear",
"torch.nn.functional.relu",
"torch.cat"
] | [((434, 451), 'pytorch_transformers.modeling_bert.BertModel', 'BertModel', (['config'], {}), '(config)\n', (443, 451), False, 'from pytorch_transformers.modeling_bert import BertPreTrainedModel, BertModel\n'), ((562, 600), 'torch.nn.Dropout', 'nn.Dropout', (['config.hidden_dropout_prob'], {}), '(config.hidden_dropout_p... |
import pygame
import random
from inc.player import Player
from inc.monster import Monster
from pygame import mixer
# define the screen dimensions
width = 1200
height = 800
pygame.init()
screen = pygame.display.set_mode((width,height))
# add title and icon
pygame.display.set_caption("<NAME>'s 2D shooter Game")
icon... | [
"pygame.mixer.music.play",
"pygame.init",
"pygame.quit",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.display.set_icon",
"pygame.time.Clock",
"inc.monster.Monster",
"inc.player.Player",
"pygame.display.set_caption",
"pygame.image.load",
"pygame.display.update",
"pygame.mixer.music.... | [((175, 188), 'pygame.init', 'pygame.init', ([], {}), '()\n', (186, 188), False, 'import pygame\n'), ((199, 239), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(width, height)'], {}), '((width, height))\n', (222, 239), False, 'import pygame\n'), ((261, 315), 'pygame.display.set_caption', 'pygame.display.set_... |
from flask import Blueprint
mentors = Blueprint('mentors', __name__)
from . import views
| [
"flask.Blueprint"
] | [((39, 69), 'flask.Blueprint', 'Blueprint', (['"""mentors"""', '__name__'], {}), "('mentors', __name__)\n", (48, 69), False, 'from flask import Blueprint\n')] |
from conans import ConanFile, CMake, tools
import os
class TslRobinMapConan(ConanFile):
name = "tsl-robin-map"
license = "MIT"
description = "C++ implementation of a fast hash map and hash set using robin hood hashing."
homepage = "https://github.com/Tessil/robin-map"
url = "https://github.com/cona... | [
"conans.tools.get",
"os.path.join"
] | [((455, 508), 'conans.tools.get', 'tools.get', ([], {}), "(**self.conan_data['sources'][self.version])\n", (464, 508), False, 'from conans import ConanFile, CMake, tools\n'), ((765, 812), 'os.path.join', 'os.path.join', (['self._source_subfolder', '"""include"""'], {}), "(self._source_subfolder, 'include')\n", (777, 81... |
import os
from homeassistant.core import HomeAssistant
import pytest
from custom_components.hacs.websocket import (
acknowledge_critical_repository,
get_critical_repositories,
hacs_config,
hacs_removed,
hacs_repositories,
hacs_repository,
hacs_repository_data,
hacs_settings,
hacs_s... | [
"custom_components.hacs.websocket.hacs_config",
"os.makedirs",
"homeassistant.core.HomeAssistant",
"custom_components.hacs.websocket.hacs_status",
"custom_components.hacs.websocket.hacs_repositories",
"custom_components.hacs.websocket.get_critical_repositories",
"custom_components.hacs.websocket.hacs_re... | [((427, 442), 'homeassistant.core.HomeAssistant', 'HomeAssistant', ([], {}), '()\n', (440, 442), False, 'from homeassistant.core import HomeAssistant\n'), ((447, 481), 'os.makedirs', 'os.makedirs', (['tmpdir'], {'exist_ok': '(True)'}), '(tmpdir, exist_ok=True)\n', (458, 481), False, 'import os\n'), ((486, 545), 'custom... |
"""
Copyright (c) 2013, SMART Technologies ULC
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 list of conditions an... | [
"org.sikuli.script.Env.getOSVersion",
"os.getcwd",
"entity.Application.__subclasses__",
"org.sikuli.script.Env.getOS",
"java.lang.System.getProperty"
] | [((2158, 2186), 'entity.Application.__subclasses__', 'Application.__subclasses__', ([], {}), '()\n', (2184, 2186), False, 'from entity import Application\n'), ((2274, 2285), 'org.sikuli.script.Env.getOS', 'Env.getOS', ([], {}), '()\n', (2283, 2285), False, 'from org.sikuli.script import App, Env\n'), ((2315, 2346), 'or... |
from sqlalchemy import Column, DateTime, Enum, Integer, String
from sqlalchemy.sql.schema import UniqueConstraint
from virtool.pg.base import Base
from virtool.samples.models import ArtifactType
class SampleArtifactCache(Base):
"""
SQL model to store a cached sample artifact
"""
__tablename__ = "sa... | [
"sqlalchemy.String",
"sqlalchemy.sql.schema.UniqueConstraint",
"sqlalchemy.Column",
"sqlalchemy.Enum"
] | [((418, 451), 'sqlalchemy.Column', 'Column', (['Integer'], {'primary_key': '(True)'}), '(Integer, primary_key=True)\n', (424, 451), False, 'from sqlalchemy import Column, DateTime, Enum, Integer, String\n'), ((462, 492), 'sqlalchemy.Column', 'Column', (['String'], {'nullable': '(False)'}), '(String, nullable=False)\n',... |
"""
Store classes with settings for specified daily fantasy sports site and kind of sport.
"""
from abc import ABCMeta, abstractmethod
from collections import namedtuple
import csv
from .player import Player
LineupPosition = namedtuple('LineupPosition', ['name', 'positions'])
class BaseSettings(object):
__metac... | [
"collections.namedtuple",
"csv.DictReader"
] | [((227, 278), 'collections.namedtuple', 'namedtuple', (['"""LineupPosition"""', "['name', 'positions']"], {}), "('LineupPosition', ['name', 'positions'])\n", (237, 278), False, 'from collections import namedtuple\n'), ((883, 929), 'csv.DictReader', 'csv.DictReader', (['csvfile'], {'skipinitialspace': '(True)'}), '(csvf... |
import os
import datetime
import setproctitle
from tf_rl.common.abs_path import ROOT_DIR as ROOT, ROOT_colab
from tf_rl.common.colab_utils import copy_dir
def set_up_for_training(env_name, seed, gpu_id, log_dir="Test", prev_log="", google_colab=False):
os.environ["CUDA_VISIBLE_DEVICES"] = str(gpu_id)
if prev... | [
"os.makedirs",
"google.colab.drive.mount",
"tf_rl.common.colab_utils.copy_dir",
"datetime.datetime.now",
"os.path.isdir"
] | [((2198, 2228), 'google.colab.drive.mount', 'drive.mount', (['"""/content/gdrive"""'], {}), "('/content/gdrive')\n", (2209, 2228), False, 'from google.colab import drive\n'), ((1038, 1058), 'os.path.isdir', 'os.path.isdir', (['value'], {}), '(value)\n', (1051, 1058), False, 'import os\n'), ((2342, 2383), 'os.path.isdir... |
from aestate.ajson import aj
from aestate.exception import FieldNotExist
from aestate.util.Log import ALog
from aestate.dbs import _mysql
from aestate.dbs import _mssql
from aestate.work.Adapter import LanguageAdapter
DB_KWARGS = {
'pymysql': _mysql,
'pymssql': _mssql
}
class MySqlConfig(_mysql.ParseUtil):
... | [
"aestate.util.Log.ALog.log_error",
"aestate.work.Adapter.LanguageAdapter"
] | [((876, 1011), 'aestate.util.Log.ALog.log_error', 'ALog.log_error', ([], {'msg': '"""The creator is missing, do you want to set`db_type=\'pymysql\'`?"""', 'obj': 'FieldNotExist', 'raise_exception': '(True)'}), '(msg=\n "The creator is missing, do you want to set`db_type=\'pymysql\'`?", obj=\n FieldNotExist, raise... |
import re
from sklearn.utils.validation import check_is_fitted
from gensim.models.word2vec import Word2Vec
import sys
from owl2vec_star.rdf2vec.walkers.random import RandomWalker
import numpy as np
import multiprocessing
class RDF2VecTransformer():
"""Project random walks or subtrees in graphs into embeddings, s... | [
"sklearn.utils.validation.check_is_fitted",
"gensim.models.word2vec.Word2Vec",
"multiprocessing.cpu_count"
] | [((3173, 3356), 'gensim.models.word2vec.Word2Vec', 'Word2Vec', (['sentences'], {'size': 'self.vector_size', 'window': 'self.window', 'workers': 'self.n_jobs', 'sg': 'self.sg', 'iter': 'self.max_iter', 'negative': 'self.negative', 'min_count': 'self.min_count', 'seed': '(42)'}), '(sentences, size=self.vector_size, windo... |
"""
Proof of concept for pytest + rich integration.
"""
import sys
import warnings
from pathlib import Path
from typing import Dict
from typing import List
from typing import Optional
from typing import Sequence
from typing import Tuple
from typing import Union
import attr
import pytest
from _pytest._code.code import ... | [
"attr.s",
"rich.console.Group",
"rich.columns.Columns",
"rich.rule.Rule",
"sys.stdout.isatty",
"rich.progress.Progress",
"rich.progress.SpinnerColumn",
"attr.Factory",
"rich.markdown.Markdown"
] | [((1310, 1346), 'attr.s', 'attr.s', ([], {'auto_attribs': '(True)', 'hash': '(True)'}), '(auto_attribs=True, hash=True)\n', (1316, 1346), False, 'import attr\n'), ((1424, 1445), 'attr.Factory', 'attr.Factory', (['Console'], {}), '(Console)\n', (1436, 1445), False, 'import attr\n'), ((927, 946), 'sys.stdout.isatty', 'sy... |
#!/usr/bin/env python
# Copyright 2021 Owkin, 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... | [
"torch.no_grad",
"torch.Tensor"
] | [((1174, 1189), 'torch.Tensor', 'torch.Tensor', (['y'], {}), '(y)\n', (1186, 1189), False, 'import torch\n'), ((960, 975), 'torch.no_grad', 'torch.no_grad', ([], {}), '()\n', (973, 975), False, 'import torch\n')] |
# module
from __future__ import absolute_import
import requests
import json
import six.moves.urllib.parse
import logging
from pycws.utils import b64encode
logger = logging.getLogger(__name__)
def _member_by_user(url, login, pw, user):
member_id = "__invalid_user_id__"
members = fetch_members(url, login, pw)... | [
"logging.getLogger",
"pycws.utils.b64encode",
"json.loads",
"json.dumps"
] | [((166, 193), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (183, 193), False, 'import logging\n'), ((1091, 1116), 'json.loads', 'json.loads', (['response.text'], {}), '(response.text)\n', (1101, 1116), False, 'import json\n'), ((1014, 1030), 'json.dumps', 'json.dumps', (['data'], {}), '... |
import math
import numpy as np
from scipy.signal import convolve2d
from skimage.morphology import dilation, disk
def generate_cross(size, lw):
assert size % 2 == 1
center = math.floor(size/2.)
cross = np.zeros([size, size])
cross[center, :] = np.ones(size)
cross[:, center] = np.ones(size)
... | [
"scipy.signal.convolve2d",
"numpy.ones",
"math.floor",
"numpy.array",
"numpy.zeros",
"numpy.sum",
"numpy.linalg.norm",
"math.exp",
"skimage.morphology.disk",
"skimage.measure.label"
] | [((187, 209), 'math.floor', 'math.floor', (['(size / 2.0)'], {}), '(size / 2.0)\n', (197, 209), False, 'import math\n'), ((219, 241), 'numpy.zeros', 'np.zeros', (['[size, size]'], {}), '([size, size])\n', (227, 241), True, 'import numpy as np\n'), ((265, 278), 'numpy.ones', 'np.ones', (['size'], {}), '(size)\n', (272, ... |
"""Unit tests for echo_classification.py."""
import copy
import unittest
import numpy
from gewittergefahr.gg_utils import grids
from gewittergefahr.gg_utils import radar_utils
from gewittergefahr.gg_utils import echo_classification as echo_classifn
TOLERANCE = 1e-6
# The following constants are used to test _estimat... | [
"gewittergefahr.gg_utils.echo_classification._apply_convective_criterion1",
"gewittergefahr.gg_utils.echo_classification._apply_convective_criterion5",
"gewittergefahr.gg_utils.echo_classification._get_peakedness",
"gewittergefahr.gg_utils.echo_classification._apply_convective_criterion4",
"numpy.array",
... | [((368, 403), 'numpy.linspace', 'numpy.linspace', (['(-90.0)', '(90.0)'], {'num': '(19)'}), '(-90.0, 90.0, num=19)\n', (382, 403), False, 'import numpy\n'), ((758, 868), 'gewittergefahr.gg_utils.radar_utils.get_valid_heights', 'radar_utils.get_valid_heights', ([], {'data_source': 'radar_utils.MYRORSS_SOURCE_ID', 'field... |
import tvm
import numpy as np
from tvm import relay
from tvm.relay.ir_pass import infer_type
from tvm.relay.ir_builder import IRBuilder, func_type
from tvm.relay.ir_builder import scalar_type, convert, tensor_type
from tvm.relay.env import Environment
def assert_has_type(expr, typ, env=Environment({})):
checked_ex... | [
"tvm.relay.ir_pass.infer_type",
"tvm.relay.env.Environment",
"tvm.relay.ir_builder.func_type",
"tvm.relay.ir_builder.tensor_type",
"tvm.relay.TensorType",
"tvm.relay.ir_builder.IRBuilder"
] | [((288, 303), 'tvm.relay.env.Environment', 'Environment', (['{}'], {}), '({})\n', (299, 303), False, 'from tvm.relay.env import Environment\n'), ((325, 346), 'tvm.relay.ir_pass.infer_type', 'infer_type', (['env', 'expr'], {}), '(env, expr)\n', (335, 346), False, 'from tvm.relay.ir_pass import infer_type\n'), ((730, 758... |
import pandas as pd
import csv
import math
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
#################################################################
# #
# #
# ... | [
"pandas.Series",
"pandas.read_csv",
"math.sqrt",
"pandas.to_numeric",
"csv.reader"
] | [((614, 677), 'pandas.read_csv', 'pd.read_csv', (['"""gcse-english-and-maths-national-data-2019-20.csv"""'], {}), "('gcse-english-and-maths-national-data-2019-20.csv')\n", (625, 677), True, 'import pandas as pd\n'), ((8095, 8115), 'pandas.to_numeric', 'pd.to_numeric', (['value'], {}), '(value)\n', (8108, 8115), True, '... |
# -*- coding: utf-8 -*-
import os
import re
import sys
import json
import shutil
import hashlib
import inspect
import datetime as dt
import click
import requests
import sqlalchemy
import textdistance
from rich.table import Table
from rich.console import Console
try:
import bs4
import git
import pandas
... | [
"textdistance.levenshtein.normalized_similarity",
"click.echo",
"datetime.timedelta",
"sqlalchemy.and_",
"click.confirmation_option",
"click.UsageError",
"os.path.exists",
"inspect.getmembers",
"click.option",
"json.dumps",
"click.argument",
"click.confirm",
"shutil.which",
"requests.get",... | [((6283, 6324), 'click.version_option', 'click.version_option', ([], {'version': '__version__'}), '(version=__version__)\n', (6303, 6324), False, 'import click\n'), ((6552, 6638), 'click.confirmation_option', 'click.confirmation_option', ([], {'prompt': '"""Would you like conrad to look for new events?"""'}), "(prompt=... |
# encoding: utf-8
"""
neighbor.py
Created by <NAME> on 2015-03-31.
Copyright (c) 2009-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
import socket
from struct import calcsize
from collections import namedtuple
from exabgp.netlink.message import Message
# 0 ... | [
"struct.calcsize",
"collections.namedtuple"
] | [((1020, 1086), 'collections.namedtuple', 'namedtuple', (['"""Neighbor"""', '"""family index state flags type attributes"""'], {}), "('Neighbor', 'family index state flags type attributes')\n", (1030, 1086), False, 'from collections import namedtuple\n'), ((994, 1008), 'struct.calcsize', 'calcsize', (['PACK'], {}), '(P... |
# from __future__ import print_function
import meshio
import math, sys, random, argparse, json, os, tempfile, pickle
import shutil
import subprocess
import os
import numpy as np
import time
# import bpy
from subprocess import Popen, PIPE
import shlex
import sys
import imageio
import ipdb
st = ipdb.set_trace
import ima... | [
"shlex.split",
"subprocess.Popen",
"os.path.join",
"time.sleep",
"imageio.imread",
"imageio.mimsave"
] | [((777, 805), 'shlex.split', 'shlex.split', (['blender_command'], {}), '(blender_command)\n', (788, 805), False, 'import shlex\n'), ((811, 864), 'subprocess.Popen', 'Popen', (['blender_command_args'], {'stdout': 'PIPE', 'stderr': 'PIPE'}), '(blender_command_args, stdout=PIPE, stderr=PIPE)\n', (816, 864), False, 'from s... |