code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from math import radians, cos, sqrt
from dbi import select_from_zip, select_from_id, create_connection
from api import *
import usaddress
def distance(lat1, lon1, lat2, lon2):
x = radians(lon1 - lon2) * cos(radians((lat1 + lat2) / 2))
y = radians(lat1 - lat2)
# 6371000 is the radius of earth, used to tria... | [
"dbi.select_from_zip",
"dbi.create_connection",
"math.sqrt",
"dbi.select_from_id",
"math.radians",
"usaddress.tag"
] | [((249, 269), 'math.radians', 'radians', (['(lat1 - lat2)'], {}), '(lat1 - lat2)\n', (256, 269), False, 'from math import radians, cos, sqrt\n'), ((186, 206), 'math.radians', 'radians', (['(lon1 - lon2)'], {}), '(lon1 - lon2)\n', (193, 206), False, 'from math import radians, cos, sqrt\n'), ((359, 378), 'math.sqrt', 'sq... |
# Generated by Django 3.0 on 2021-05-28 20:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0003_auto_20210528_1759'),
]
operations = [
migrations.AlterField(
model_name='site',
name='stati... | [
"django.db.models.CharField"
] | [((351, 400), 'django.db.models.CharField', 'models.CharField', ([], {'default': '"""False"""', 'max_length': '(255)'}), "(default='False', max_length=255)\n", (367, 400), False, 'from django.db import migrations, models\n')] |
import os
import shutil
import pkg_resources
delineation_d8 = pkg_resources.resource_filename(
__name__, 'sh_code/grass_delineation_d8.sh')
delineation_dinf = pkg_resources.resource_filename(
__name__, 'sh_code/grass_delineation_dinf.sh')
spatial_hierarchy = pkg_resources.resource_filename(
__n... | [
"pkg_resources.resource_filename"
] | [((63, 139), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename', (['__name__', '"""sh_code/grass_delineation_d8.sh"""'], {}), "(__name__, 'sh_code/grass_delineation_d8.sh')\n", (94, 139), False, 'import pkg_resources\n'), ((168, 246), 'pkg_resources.resource_filename', 'pkg_resources.resource_filename... |
import numpy as np
def _GLMHMM_symb_lik(emit_w, X_trial, y_trial):
num_states = emit_w.shape[0]
num_emissions = emit_w.shape[1]
# Put the stimulus (X_trial) in a different format for easier multiplication
X_trial_mod = np.tile(np.reshape(X_trial, (1, 1, X_trial.shape[0], X_trial.shape[1]), ... | [
"numpy.sum",
"numpy.reshape",
"numpy.isnan"
] | [((256, 330), 'numpy.reshape', 'np.reshape', (['X_trial', '(1, 1, X_trial.shape[0], X_trial.shape[1])'], {'order': '"""F"""'}), "(X_trial, (1, 1, X_trial.shape[0], X_trial.shape[1]), order='F')\n", (266, 330), True, 'import numpy as np\n'), ((1175, 1199), 'numpy.isnan', 'np.isnan', (['symb_lik[:, t]'], {}), '(symb_lik[... |
import copy
import logging
from datetime import datetime, timedelta
from collections import namedtuple
from blinker import Signal
__all__ = [
'Event',
'TrainingMachineObserver',
'TrainingMachine',
]
logger = logging.getLogger(__name__)
class Event(dict):
""" Events that are expected by the process... | [
"logging.getLogger",
"collections.namedtuple",
"datetime.datetime.utcnow",
"copy.deepcopy",
"datetime.timedelta"
] | [((224, 251), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (241, 251), False, 'import logging\n'), ((2222, 2263), 'collections.namedtuple', 'namedtuple', (['"""KeyStroke"""', "['char', 'time']"], {}), "('KeyStroke', ['char', 'time'])\n", (2232, 2263), False, 'from collections import nam... |
"""
Authors: <NAME>, <NAME>.
Copyright:
Copyright (c) 2021 Microsoft Research
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, ... | [
"os.path.dirname",
"math.floor"
] | [((7048, 7079), 'os.path.dirname', 'os.path.dirname', (['tree_file_path'], {}), '(tree_file_path)\n', (7063, 7079), False, 'import os\n'), ((7487, 7542), 'math.floor', 'math.floor', (['(2 ** scaling_factor * ctx.ezpc_threshold[i])'], {}), '(2 ** scaling_factor * ctx.ezpc_threshold[i])\n', (7497, 7542), False, 'import m... |
#!/usr/bin/python3
import socket
UDP_IP="127.0.0.1"
UDP_PORT=5000
MESSAGE="Snapshot: 2"
print("UDP target IP:", UDP_IP)
print("UDP target port:", UDP_PORT)
print("message: \"%s\"" % MESSAGE)
sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM )
sock.sendto( MESSAGE.encode('ascii'), (UDP_IP, UDP_PORT) )
| [
"socket.socket"
] | [((202, 250), 'socket.socket', 'socket.socket', (['socket.AF_INET', 'socket.SOCK_DGRAM'], {}), '(socket.AF_INET, socket.SOCK_DGRAM)\n', (215, 250), False, 'import socket\n')] |
#!/usr/bin/python
import simple_test
simple_test.test("test29", ["-h", ])
| [
"simple_test.test"
] | [((39, 73), 'simple_test.test', 'simple_test.test', (['"""test29"""', "['-h']"], {}), "('test29', ['-h'])\n", (55, 73), False, 'import simple_test\n')] |
import abc
from protos.clock_pb2 import (
SESSION_START,
SESSION_END,
MINUTE_END,
BEFORE_TRADING_START
)
from pluto.coms.utils import conversions
class StopExecution(Exception):
pass
class Command(abc.ABC):
__slots__ = ['_request', '_controllable']
def __init__(self, controllable, reque... | [
"pluto.coms.utils.conversions.to_datetime"
] | [((2284, 2326), 'pluto.coms.utils.conversions.to_datetime', 'conversions.to_datetime', (['request.timestamp'], {}), '(request.timestamp)\n', (2307, 2326), False, 'from pluto.coms.utils import conversions\n'), ((2773, 2800), 'pluto.coms.utils.conversions.to_datetime', 'conversions.to_datetime', (['ts'], {}), '(ts)\n', (... |
'''
@Date: 2019-08-26 20:55:29
@Author: ywyz
@LastModifiedBy: ywyz
@Github: https://github.com/ywyz
@LastEditors: ywyz
@LastEditTime: 2019-08-26 20:56:13
'''
import turtle
import math
x1, y1, width1, height1 = eval(
input("Enter r1's center x- and y-coordinates,width, and height: "))
x2, y2, width2, height2 = eval... | [
"turtle.pendown",
"turtle.penup",
"turtle.done",
"turtle.goto",
"math.fabs",
"turtle.write"
] | [((404, 422), 'math.fabs', 'math.fabs', (['(x2 - x1)'], {}), '(x2 - x1)\n', (413, 422), False, 'import math\n'), ((432, 450), 'math.fabs', 'math.fabs', (['(y2 - y1)'], {}), '(y2 - y1)\n', (441, 450), False, 'import math\n'), ((452, 466), 'turtle.penup', 'turtle.penup', ([], {}), '()\n', (464, 466), False, 'import turtl... |
import unittest
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import processparser as pp
class PstTestCase(unittest.TestCase):
"""This class represents the pst test case"""
def test_ps_output(self):
ps_command = 'ps -e l'
column_header, processes = pp.get... | [
"processparser.build_process_trees",
"processparser.format_process_trees",
"processparser.get_ps_output",
"os.path.dirname",
"processparser.get_process_data",
"processparser.get_heading_indexes",
"unittest.main"
] | [((693, 721), 'unittest.main', 'unittest.main', ([], {'failfast': '(True)'}), '(failfast=True)\n', (706, 721), False, 'import unittest\n'), ((66, 91), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (81, 91), False, 'import os\n'), ((314, 342), 'processparser.get_ps_output', 'pp.get_ps_output'... |
import LanguageSource
import Inserter
class Main(object):
def __init__(self):
self.source = LanguageSource.LanguageSource()
self.inserter = Inserter.Inserter()
def Run(self):
self.inserter.Insert(self.source.Get())
if __name__ == "__main__":
m = Main()
m.Run()
| [
"Inserter.Inserter",
"LanguageSource.LanguageSource"
] | [((104, 135), 'LanguageSource.LanguageSource', 'LanguageSource.LanguageSource', ([], {}), '()\n', (133, 135), False, 'import LanguageSource\n'), ((160, 179), 'Inserter.Inserter', 'Inserter.Inserter', ([], {}), '()\n', (177, 179), False, 'import Inserter\n')] |
# 길찾기 게임
import heapq
class Node:
def __init__(self, data, idx):
self._data = data
self._idx = idx
self.left = None
self.right = None
@property
def data(self):
return self._data
@data.setter
def data(self, data):
self._data = data
@property
... | [
"heapq.heappush",
"heapq.heappop"
] | [((1744, 1805), 'heapq.heappush', 'heapq.heappush', (['q', '(-current_node[1], current_node[0], i + 1)'], {}), '(q, (-current_node[1], current_node[0], i + 1))\n', (1758, 1805), False, 'import heapq\n'), ((1842, 1858), 'heapq.heappop', 'heapq.heappop', (['q'], {}), '(q)\n', (1855, 1858), False, 'import heapq\n')] |
from menu import Menu
from coffee_maker import CoffeeMaker
from money_machine import MoneyMachine
coffee_maker = CoffeeMaker()
money_machine = MoneyMachine()
menu = Menu()
def coffee_machine():
while True:
choose = input(f'What would you like: ({menu.get_items()})').lower()
if choose == 'report'... | [
"coffee_maker.CoffeeMaker",
"menu.Menu",
"money_machine.MoneyMachine"
] | [((114, 127), 'coffee_maker.CoffeeMaker', 'CoffeeMaker', ([], {}), '()\n', (125, 127), False, 'from coffee_maker import CoffeeMaker\n'), ((144, 158), 'money_machine.MoneyMachine', 'MoneyMachine', ([], {}), '()\n', (156, 158), False, 'from money_machine import MoneyMachine\n'), ((166, 172), 'menu.Menu', 'Menu', ([], {})... |
import click
from parsec.cli import pass_context, json_loads
from parsec.decorators import custom_exception, json_output
@click.command('extract_workflow_from_history')
@click.argument("history_id", type=str)
@click.argument("workflow_name", type=str)
@click.option(
"--job_ids",
help="Optional list of job IDs... | [
"click.option",
"click.argument",
"click.command"
] | [((124, 170), 'click.command', 'click.command', (['"""extract_workflow_from_history"""'], {}), "('extract_workflow_from_history')\n", (137, 170), False, 'import click\n'), ((172, 210), 'click.argument', 'click.argument', (['"""history_id"""'], {'type': 'str'}), "('history_id', type=str)\n", (186, 210), False, 'import c... |
# Generated by Django 3.2.5 on 2021-11-26 20:07
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
("organisations", "0004_auto_20210718_1147"),
("schools", "0004_auto_20211126_2107"),
]
o... | [
"django.db.models.EmailField",
"django.db.models.DateField",
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.ManyToManyField",
"django.db.models.BooleanField",
"django.db.models.BigAutoField",
"django.db.models.PositiveSmallIntegerField",
"django.db.models.CharField"
] | [((9872, 10063), 'django.db.models.ForeignKey', 'models.ForeignKey', ([], {'on_delete': 'django.db.models.deletion.PROTECT', 'related_name': '"""employees"""', 'related_query_name': '"""employees"""', 'to': '"""secondments.studyprogram"""', 'verbose_name': '"""study program"""'}), "(on_delete=django.db.models.deletion.... |
import gui_rest_client.common as common
import pyglet
def on_key_release_factory(window):
"""
Function used to create specific on_key_release method for window property of MenuWindow object.
:param window: MenuWindow object
:return: functor with prepared on_key_release method
"""
def functor(s... | [
"gui_rest_client.common.check_if_inside",
"pyglet.gl.glClearColor"
] | [((971, 1032), 'pyglet.gl.glClearColor', 'pyglet.gl.glClearColor', (['(65 / 256.0)', '(65 / 256.0)', '(70 / 256.0)', '(1)'], {}), '(65 / 256.0, 65 / 256.0, 70 / 256.0, 1)\n', (993, 1032), False, 'import pyglet\n'), ((1675, 1708), 'gui_rest_client.common.check_if_inside', 'common.check_if_inside', (['x', 'y', 'obj'], {}... |
import torch
import torch.nn as nn
import torch.nn.functional as F
class VGG(nn.Module):
def __init__(self, use_bn=False):
super(VGG, self).__init__()
self.conv1 = VGG._make_conv_block(3, 64, 3, 1, 1, use_bn)
self.conv2 = VGG._make_conv_block(64, 64, 3, 1, 1, use_bn)
self.pool1 = n... | [
"torch.nn.BatchNorm2d",
"torch.nn.ReLU",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.functional.relu"
] | [((319, 356), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', ([], {'kernel_size': '(2)', 'stride': '(2)'}), '(kernel_size=2, stride=2)\n', (331, 356), True, 'import torch.nn as nn\n'), ((516, 564), 'torch.nn.MaxPool2d', 'nn.MaxPool2d', ([], {'kernel_size': '(2)', 'stride': '(2)', 'padding': '(1)'}), '(kernel_size=2, stride=2, p... |
import re
velocidad_xy=200 #[mm/minuto]
velocidad_z=10 #[mm/minuto]
fichero_nombres=['agujeros_broca0.6.gcode',
'agujeros_broca0.8.gcode',
'agujeros_broca1.1.gcode']
def procesa_fichero(fichero_nombre):
fichero=open(fichero_nombre,'r')
texto_todo=fichero.read()
fichero.c... | [
"re.search"
] | [((429, 458), 're.search', 're.search', (['"""G0[0,1] X"""', 'linea'], {}), "('G0[0,1] X', linea)\n", (438, 458), False, 'import re\n'), ((526, 555), 're.search', 're.search', (['"""G0[0,1] Z"""', 'linea'], {}), "('G0[0,1] Z', linea)\n", (535, 555), False, 'import re\n')] |
"""
tobias.fyi :: Base Django settings
"""
import os
import dj_database_url
PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR)
# === Application definition === #
INSTALLED_APPS = [
"home",
"search",
"blog",
"navigator",
"wagtail.co... | [
"os.getenv",
"dj_database_url.config",
"os.path.join",
"os.environ.get",
"os.path.dirname",
"os.path.abspath"
] | [((164, 192), 'os.path.dirname', 'os.path.dirname', (['PROJECT_DIR'], {}), '(PROJECT_DIR)\n', (179, 192), False, 'import os\n'), ((3112, 3142), 'os.environ.get', 'os.environ.get', (['"""DATABASE_URL"""'], {}), "('DATABASE_URL')\n", (3126, 3142), False, 'import os\n'), ((3151, 3236), 'dj_database_url.config', 'dj_databa... |
import tkinter as tk
import os
def get_values(event):
global window, title_value, title_entry, details_value, details_entry
title_value = title_entry.get()
details_value = details_entry.get()
window.destroy()
def toggle_details(event):
global window, title_entry, details_entry
if details_entry... | [
"os.path.abspath",
"tkinter.Tk",
"tkinter.Entry"
] | [((666, 673), 'tkinter.Tk', 'tk.Tk', ([], {}), '()\n', (671, 673), True, 'import tkinter as tk\n'), ((908, 998), 'tkinter.Entry', 'tk.Entry', (['window'], {'font': '"""SegoeUI 26"""', 'bg': '"""#292929"""', 'fg': '"""white"""', 'width': '(60)', 'borderwidth': '(5)'}), "(window, font='SegoeUI 26', bg='#292929', fg='whit... |
import numpy as np
import time
import sys
import warnings
if not sys.warnoptions:
warnings.simplefilter("ignore")
path_train = sys.argv[1];
path_test = sys.argv[2];
one_train = sys.argv[3];
one_test = sys.argv[4];
def one_hot(array):
n = array.shape[0];
X = np.zeros((n,85));
Y = np.zeros((n,10));
for i in rang... | [
"warnings.simplefilter",
"numpy.zeros",
"numpy.genfromtxt",
"numpy.savetxt"
] | [((545, 585), 'numpy.genfromtxt', 'np.genfromtxt', (['path_train'], {'delimiter': '""","""'}), "(path_train, delimiter=',')\n", (558, 585), True, 'import numpy as np\n'), ((597, 636), 'numpy.genfromtxt', 'np.genfromtxt', (['path_test'], {'delimiter': '""","""'}), "(path_test, delimiter=',')\n", (610, 636), True, 'impor... |
"""
imdb dataset saved in https://github.com/Oneflow-Inc/models/imdb
"""
import sys
sys.path.append("../")
from imdb.utils import pad_sequences, load_imdb_data, colored_string
__all__ = ["pad_sequences", "load_imdb_data", "colored_string"]
| [
"sys.path.append"
] | [((86, 108), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (101, 108), False, 'import sys\n')] |
from app.db_models.models import userModel
from sqlalchemy.orm import session
from app.db_models import Session
from app.db_models.users import User
import math
class get_details():
def __init__(self, inputs: userModel):
self.__inputs = inputs
self.session = Session()
| [
"app.db_models.Session"
] | [((285, 294), 'app.db_models.Session', 'Session', ([], {}), '()\n', (292, 294), False, 'from app.db_models import Session\n')] |
import logging
from django.shortcuts import render
from rest_framework.response import Response
from rest_framework.views import APIView
from random import randint
from django_redis import get_redis_connection
from rest_framework import status
from meiduo_mall.libs.yuntongxun.sms import CCP
from . import constants
fr... | [
"logging.getLogger",
"django_redis.get_redis_connection",
"rest_framework.response.Response",
"celery_tasks.sms.tasks.send_sms_code.delay",
"random.randint"
] | [((377, 404), 'logging.getLogger', 'logging.getLogger', (['"""django"""'], {}), "('django')\n", (394, 404), False, 'import logging\n'), ((669, 705), 'django_redis.get_redis_connection', 'get_redis_connection', (['"""verify_codes"""'], {}), "('verify_codes')\n", (689, 705), False, 'from django_redis import get_redis_con... |
from django.conf import settings
from django.urls import path, include
from django.views.static import serve
urlpatterns = (
path('', include('freenodejobs.account.urls',
namespace='account')),
path('', include('freenodejobs.admin.urls',
namespace='admin')),
path('', include('freenodejob... | [
"django.urls.path",
"django.urls.include"
] | [((708, 818), 'django.urls.path', 'path', (['"""storage/<path:path>"""', 'serve', "{'show_indexes': settings.DEBUG, 'document_root': settings.MEDIA_ROOT}"], {}), "('storage/<path:path>', serve, {'show_indexes': settings.DEBUG,\n 'document_root': settings.MEDIA_ROOT})\n", (712, 818), False, 'from django.urls import p... |
#!/usr/bin/env python3
# Copyright 2018 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""AppEngine integration test for hwid_util"""
import os.path
import unittest
from cros.factory.hwid.service.appengine import hwid... | [
"cros.factory.hwid.service.appengine.hwid_util.GetTotalRamFromHwidData",
"cros.factory.hwid.v3.database.Database.LoadFile",
"cros.factory.hwid.service.appengine.hwid_util.GetSkuFromBom",
"cros.factory.hwid.service.appengine.hwid_util.GetComponentValueFromBom",
"unittest.main",
"cros.factory.hwid.service.a... | [((625, 719), 'cros.factory.hwid.service.appengine.hwid_manager.Component', 'hwid_manager.Component', ([], {'cls_': '"""dram"""', 'name': '"""dram_micron_1g_dimm2"""', 'fields': "{'size': '1024'}"}), "(cls_='dram', name='dram_micron_1g_dimm2', fields={\n 'size': '1024'})\n", (647, 719), False, 'from cros.factory.hwi... |
#!/usr/bin/env python3
from WellKnownHandler import WellKnownHandler
from WellKnownHandler import TYPE_UMA_V2, KEY_UMA_V2_RESOURCE_REGISTRATION_ENDPOINT, KEY_UMA_V2_PERMISSION_ENDPOINT, KEY_UMA_V2_INTROSPECTION_ENDPOINT
from flask import Flask, request, Response
from flask_swagger_ui import get_swaggerui_blueprint
fr... | [
"logging.getLogger",
"handlers.uma_handler.UMA_Handler",
"random.choice",
"jwkest.jwk.import_rsa_key_from_file",
"flask.Flask",
"jwkest.jws.JWS",
"config.get_default_resources",
"blueprints.proxy.construct_blueprint",
"Crypto.PublicKey.RSA.generate",
"config.get_verb_config",
"config.get_config"... | [((1359, 1390), 'logging.getLogger', 'logging.getLogger', (['"""PEP_ENGINE"""'], {}), "('PEP_ENGINE')\n", (1376, 1390), False, 'import logging\n'), ((1484, 1516), 'config.get_config', 'get_config', (['"""config/config.json"""'], {}), "('config/config.json')\n", (1494, 1516), False, 'from config import get_config, get_v... |
import copy
import numpy as np
from sklearn.tree import DecisionTreeClassifier
from sklearn.ensemble import RandomForestClassifier
from adapt.parameter_based import TransferTreeClassifier, TransferForestClassifier
methods = [
'relab',
'ser',
'strut',
'ser_nr',
'ser_no_ext',
'ser_nr_lambda',
... | [
"numpy.random.multivariate_normal",
"sklearn.tree.DecisionTreeClassifier",
"sklearn.ensemble.RandomForestClassifier",
"adapt.parameter_based.TransferTreeClassifier",
"numpy.diag",
"numpy.sum",
"numpy.zeros",
"numpy.random.seed",
"copy.deepcopy",
"adapt.parameter_based.TransferForestClassifier",
... | [((466, 483), 'numpy.random.seed', 'np.random.seed', (['(0)'], {}), '(0)\n', (480, 483), True, 'import numpy as np\n'), ((592, 607), 'numpy.diag', 'np.diag', (['[1, 1]'], {}), '([1, 1])\n', (599, 607), True, 'import numpy as np\n'), ((640, 655), 'numpy.diag', 'np.diag', (['[2, 2]'], {}), '([2, 2])\n', (647, 655), True,... |
from django.contrib.sites.models import Site
from django.contrib.auth import get_user_model
from django.contrib.sites.shortcuts import get_current_site
from rest_framework import viewsets
from core.models import SiteUser
from core import sites
from core.serializers import SiteUserSerializer, SiteSerializer, UserSeri... | [
"django.contrib.auth.get_user_model",
"core.sites.get_users_for_site",
"core.sites.get_siteusers_for_site",
"django.contrib.sites.models.Site.objects.all",
"django.contrib.sites.shortcuts.get_current_site"
] | [((383, 399), 'django.contrib.auth.get_user_model', 'get_user_model', ([], {}), '()\n', (397, 399), False, 'from django.contrib.auth import get_user_model\n'), ((1057, 1075), 'django.contrib.sites.models.Site.objects.all', 'Site.objects.all', ([], {}), '()\n', (1073, 1075), False, 'from django.contrib.sites.models impo... |
#!/usr/bin/env python
'''
run social sim trials
'''
import actionlib
import rospy
from rospy_message_converter import message_converter
import tf
from geometry_msgs.msg import PoseArray, Pose
from move_base_msgs.msg import MoveBaseAction, MoveBaseGoal, MoveBaseActionGoal
from social_sim_ros.msg import TrialStart, Tria... | [
"logging.getLogger",
"csv.DictWriter",
"logging.StreamHandler",
"rospy.init_node",
"rospy_message_converter.message_converter.convert_dictionary_to_ros_message",
"logging.info",
"social_sim_ros.msg.TrialStart",
"logging.error",
"os.path.exists",
"logging.warn",
"json.dumps",
"rospy.Duration.fr... | [((525, 549), 'json.loads', 'json.loads', (['json_message'], {}), '(json_message)\n', (535, 549), False, 'import json\n'), ((629, 737), 'rospy_message_converter.message_converter.convert_dictionary_to_ros_message', 'message_converter.convert_dictionary_to_ros_message', (['message_type', 'dict_message'], {'strict_mode':... |
'''
This version uses a Q function for PPO, the same that is
later used for BCQ
'''
import torch
import torch.nn as nn
import torch.autograd as autograd
import torch.nn.functional as F
from torch.distributions.categorical import Categorical
import random
import numpy as np
# Function from https://github.com/ikostrik... | [
"torch.nn.ReLU",
"torch.nn.Tanh",
"torch.nn.ModuleList",
"torch.nn.Conv2d",
"torch.nn.MaxPool2d",
"torch.nn.functional.log_softmax",
"torch.nn.Linear",
"torch.no_grad",
"torch.zeros",
"torch.cat",
"torch.device"
] | [((903, 923), 'torch.device', 'torch.device', (['"""cuda"""'], {}), "('cuda')\n", (915, 923), False, 'import torch\n'), ((1766, 1781), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (1779, 1781), True, 'import torch.nn as nn\n'), ((2146, 2161), 'torch.nn.ModuleList', 'nn.ModuleList', ([], {}), '()\n', (2159,... |
from __future__ import annotations
from enum import unique, IntEnum
import json
@unique
class ErrorType(IntEnum):
WARNING = 5
ERROR = 6
OK = 4
class FirmwareError:
def __init__(self, number: int, task: str, description: str) -> None:
self.number = number
self.task = task
sel... | [
"json.dumps"
] | [((1239, 1285), 'json.dumps', 'json.dumps', (['self'], {'default': '(lambda o: o.__dict__)'}), '(self, default=lambda o: o.__dict__)\n', (1249, 1285), False, 'import json\n')] |
import pytest
import tempfile
from conftest import load_circuit_files
def test_load_files():
# load nodes file
net = load_circuit_files(data_files='examples/v1_nodes.h5', data_type_files='examples/v1_node_types.csv')
assert(net.nodes is not None)
assert(net.has_nodes)
assert(net.edges is None)
... | [
"conftest.load_circuit_files",
"tempfile.mkstemp",
"pytest.raises",
"h5py.File"
] | [((128, 232), 'conftest.load_circuit_files', 'load_circuit_files', ([], {'data_files': '"""examples/v1_nodes.h5"""', 'data_type_files': '"""examples/v1_node_types.csv"""'}), "(data_files='examples/v1_nodes.h5', data_type_files=\n 'examples/v1_node_types.csv')\n", (146, 232), False, 'from conftest import load_circuit... |
from PIL import Image
import pytesser
import pytesseract
image = Image.open('test.jpg')
print(pytesseract.image_file_to_string('test.jpg'))
print(pytesseract.image_to_string(image))
| [
"pytesseract.image_file_to_string",
"PIL.Image.open",
"pytesseract.image_to_string"
] | [((70, 92), 'PIL.Image.open', 'Image.open', (['"""test.jpg"""'], {}), "('test.jpg')\n", (80, 92), False, 'from PIL import Image\n'), ((102, 146), 'pytesseract.image_file_to_string', 'pytesseract.image_file_to_string', (['"""test.jpg"""'], {}), "('test.jpg')\n", (134, 146), False, 'import pytesseract\n'), ((155, 189), '... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import sys
from gpvdm_api import gpvdm_api
def run():
a=gpvdm_api(verbose=True)
a.set_save_dir(device_data)
a.edit("light.inp","#light_model","qe")
a.edit("jv0.inp","#Vstop","0.8")
a.run() | [
"gpvdm_api.gpvdm_api"
] | [((116, 139), 'gpvdm_api.gpvdm_api', 'gpvdm_api', ([], {'verbose': '(True)'}), '(verbose=True)\n', (125, 139), False, 'from gpvdm_api import gpvdm_api\n')] |
# Eurek the Alchemist (2040050)
from net.swordie.ms.constants import JobConstants
echoDict = {
112: 1005, # Hero
122: 1005, # Paladin
132: 1005, # Dark Knight
212: 1005, # F/P
222: 1005, # I/L
232: 1005, # Bishop
312: 1005, # Bowmaster
322: 1005, # Marksman
412: 1005, # Night Lord
... | [
"net.swordie.ms.constants.JobConstants.isBeastTamer"
] | [((2011, 2048), 'net.swordie.ms.constants.JobConstants.isBeastTamer', 'JobConstants.isBeastTamer', (['currentJob'], {}), '(currentJob)\n', (2036, 2048), False, 'from net.swordie.ms.constants import JobConstants\n')] |
from distriopt import VirtualNetwork
from distriopt.embedding.physical import PhysicalNetwork
from distriopt.embedding.algorithms import (
EmbedBalanced,
# EmbedILP,
EmbedPartition,
EmbedGreedy,
)
from distriopt.packing.algorithms import ( BestFitDopProduct,
Fir... | [
"subprocess.check_output",
"distriopt.embedding.physical.PhysicalNetwork.from_files",
"distriopt.VirtualNetwork.from_mininet",
"pathlib.Path",
"distriopt.VirtualNetwork.create_fat_tree",
"distriopt.packing.CloudInstance.read_ec2_instances"
] | [((14570, 14663), 'distriopt.VirtualNetwork.create_fat_tree', 'VirtualNetwork.create_fat_tree', ([], {'k': '(2)', 'density': '(2)', 'req_cores': '(2)', 'req_memory': '(100)', 'req_rate': '(100)'}), '(k=2, density=2, req_cores=2, req_memory=100,\n req_rate=100)\n', (14600, 14663), False, 'from distriopt import Virtua... |
import torch
import torch_quiver as torch_qv
import random
import numpy as np
import time
from typing import List
from quiver.shard_tensor import ShardTensor, ShardTensorConfig, Topo
from quiver.utils import reindex_feature
import torch.multiprocessing as mp
from torch.multiprocessing import Process
import os
import sy... | [
"quiver.shard_tensor.Topo",
"quiver.Feature",
"torch.cuda.device_count",
"torch.from_numpy",
"torch.cuda.synchronize",
"numpy.array",
"quiver.shard_tensor.ShardTensorConfig",
"quiver.shard_tensor.ShardTensor.new_from_share_ipc",
"torch.randint",
"os.getpid",
"torch.multiprocessing.set_start_meth... | [((11270, 11318), 'multiprocessing.reduction.ForkingPickler.register', 'ForkingPickler.register', (['Feature', 'reduce_feature'], {}), '(Feature, reduce_feature)\n', (11293, 11318), False, 'from multiprocessing.reduction import ForkingPickler\n'), ((11519, 11546), 'torch.cuda.set_device', 'torch.cuda.set_device', (['ra... |
from django import template
from django.template.loader import get_template
register = template.Library()
@register.inclusion_tag('project_overview_list.html')
def project_overview_list(project_list):
return {'project_list': project_list} | [
"django.template.Library"
] | [((87, 105), 'django.template.Library', 'template.Library', ([], {}), '()\n', (103, 105), False, 'from django import template\n')] |
import os
import logging
from PyQt4.QtCore import Qt, QObject, SIGNAL
from PyQt4.QtGui import (QMainWindow, QWidget, QPixmap, QLabel,
QGraphicsDropShadowEffect, QColor,
QDesktopWidget)
class BillboardDisplay(QMainWindow):
def __init__(self, parent=None, workdir=... | [
"logging.getLogger",
"PyQt4.QtGui.QWidget",
"PyQt4.QtGui.QColor",
"PyQt4.QtGui.QLabel",
"os.path.join",
"PyQt4.QtGui.QDesktopWidget",
"PyQt4.QtGui.QPixmap",
"PyQt4.QtGui.QPixmap.grabWidget",
"PyQt4.QtCore.SIGNAL",
"PyQt4.QtGui.QGraphicsDropShadowEffect"
] | [((448, 476), 'logging.getLogger', 'logging.getLogger', (['"""display"""'], {}), "('display')\n", (465, 476), False, 'import logging\n'), ((579, 620), 'os.path.join', 'os.path.join', (['self.workdir', '"""current.jpg"""'], {}), "(self.workdir, 'current.jpg')\n", (591, 620), False, 'import os\n'), ((639, 655), 'PyQt4.Qt... |
# Copyright (c) 2014-present PlatformIO <<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 ag... | [
"platformio.fs.cd",
"platformio.test.result.TestResult",
"click.secho",
"click.option",
"click.IntRange",
"click.style",
"platformio.test.reports.base.TestReportFactory.new",
"shutil.get_terminal_size",
"click.echo",
"platformio.test.runners.base.TestRunnerOptions",
"platformio.exception.ReturnE... | [((1029, 1077), 'click.command', 'click.command', (['"""test"""'], {'short_help': '"""Unit Testing"""'}), "('test', short_help='Unit Testing')\n", (1042, 1077), False, 'import click\n'), ((1079, 1129), 'click.option', 'click.option', (['"""--environment"""', '"""-e"""'], {'multiple': '(True)'}), "('--environment', '-e'... |
#
# Copyright (c) 2019 Juniper Networks, Inc. All rights reserved.
#
from builtins import str
from cfgm_common.exceptions import NoIdError, RefsExistError
from vnc_api.gen.resource_client import BgpRouter
from vnc_api.gen.resource_xsd import AddressFamilies, BgpSessionAttributes
from vnc_api.gen.resource_xsd import B... | [
"schema_transformer.resources._resource_base.ResourceBaseST.get_obj_type_map",
"vnc_api.gen.resource_xsd.BgpPeeringAttributes",
"vnc_api.gen.resource_xsd.AddressFamilies",
"builtins.str",
"vnc_api.gen.resource_xsd.BgpSessionAttributes",
"schema_transformer.sandesh.st_introspect.ttypes.PropList",
"vnc_ap... | [((15207, 15218), 'vnc_api.gen.resource_client.BgpRouter', 'BgpRouter', ([], {}), '()\n', (15216, 15218), False, 'from vnc_api.gen.resource_client import BgpRouter\n'), ((15284, 15310), 'vnc_api.gen.resource_xsd.AddressFamilies', 'AddressFamilies', ([], {'family': '[]'}), '(family=[])\n', (15299, 15310), False, 'from v... |
from django.core.management import BaseCommand
from apps.staff.models import Team, Role, Staff
from apps.content.models import Event
class Command(BaseCommand):
help = '''
team_csv format:
team.persian_name, team.english_name, team.position_from_top
role_csv format:
role.... | [
"apps.staff.models.Team.objects.create",
"apps.content.models.Event.objects.filter",
"os.path.join",
"apps.staff.models.Team.objects.filter",
"subprocess.call",
"apps.staff.models.Role.objects.filter"
] | [((1594, 1617), 'subprocess.call', 'subprocess.call', (['params'], {}), '(params)\n', (1609, 1617), False, 'import subprocess\n'), ((1059, 1092), 'apps.content.models.Event.objects.filter', 'Event.objects.filter', ([], {'pk': 'event_id'}), '(pk=event_id)\n', (1079, 1092), False, 'from apps.content.models import Event\n... |
# Copyright: (c) 2021, <NAME>
import sys
sys.path.append('../../py-cuda-sdr/')
sys.path.append('../')
import importlib
import softCombiner
import json,rjsmin
importlib.reload(softCombiner)
import numpy as np
import matplotlib.pyplot as plt
import logging
import zmq
import time
import unittest
import numpy as np
imp... | [
"copy.deepcopy",
"time.sleep",
"numpy.array",
"numpy.random.randint",
"softCombiner.Worker",
"importlib.reload",
"time.time",
"unittest.main",
"sys.path.append",
"numpy.all",
"loadConfig.getConfigAndLog",
"numpy.random.randn"
] | [((42, 79), 'sys.path.append', 'sys.path.append', (['"""../../py-cuda-sdr/"""'], {}), "('../../py-cuda-sdr/')\n", (57, 79), False, 'import sys\n'), ((80, 102), 'sys.path.append', 'sys.path.append', (['"""../"""'], {}), "('../')\n", (95, 102), False, 'import sys\n'), ((160, 190), 'importlib.reload', 'importlib.reload', ... |
from pychorus import find_and_output_chorus
def extract_song_chorus(path, main):
# songname = path.split('/',2)[0].split('.')[0]
Newpath = main + '/' + "song_to_predict"+'.wav'
chorus = find_and_output_chorus(path, Newpath, 15)
if chorus == None:
return None
else:
return Newpath
| [
"pychorus.find_and_output_chorus"
] | [((202, 243), 'pychorus.find_and_output_chorus', 'find_and_output_chorus', (['path', 'Newpath', '(15)'], {}), '(path, Newpath, 15)\n', (224, 243), False, 'from pychorus import find_and_output_chorus\n')] |
import hashlib
import math
import time
import typing
import jwt
import pydantic
from fastapi.exceptions import HTTPException
from fastapi.requests import Request
from fastapi.security import OAuth2PasswordBearer
from starlette.status import HTTP_401_UNAUTHORIZED, HTTP_403_FORBIDDEN
from fastapi_token.encrypt import g... | [
"fastapi_token.schemas.HashAuth",
"jwt.decode",
"fastapi.exceptions.HTTPException",
"fastapi_token.encrypt.encrypt",
"fastapi_token.encrypt.gen_nonce_from_timestamp",
"math.fabs",
"time.time"
] | [((4110, 4167), 'fastapi_token.schemas.HashAuth', 'HashAuth', ([], {'user_id': 'user_id', 'timestamp': 'timestamp', 'code': 'code'}), '(user_id=user_id, timestamp=timestamp, code=code)\n', (4118, 4167), False, 'from fastapi_token.schemas import EncryptAuth, GrantToken, Auth, HashAuth, AccessField\n'), ((5241, 5252), 't... |
"""Unit tests for solana.system_program."""
import solana.system_program as sp
from solana.account import Account
def test_transfer():
"""Test creating a transaction for transfer."""
params = sp.TransferParams(from_pubkey=Account().public_key(), to_pubkey=Account().public_key(), lamports=123)
txn = sp.tra... | [
"solana.system_program.decode_transfer",
"solana.account.Account",
"solana.system_program.transfer"
] | [((314, 333), 'solana.system_program.transfer', 'sp.transfer', (['params'], {}), '(params)\n', (325, 333), True, 'import solana.system_program as sp\n'), ((383, 422), 'solana.system_program.decode_transfer', 'sp.decode_transfer', (['txn.instructions[0]'], {}), '(txn.instructions[0])\n', (401, 422), True, 'import solana... |
import scanpy as sc
import muon as mu
import numpy as np
## VIASH START
par = {
'input': 'resources_test/pbmc_1k_protein_v3/pbmc_1k_protein_v3_filtered_feature_bc_matrix.h5mu',
'modality': ['rna'],
'output': 'output.h5mu',
'var_name_filter': 'filter_with_hvg',
'do_subset': False,
'flavor': 'seurat',
'n_t... | [
"numpy.ravel",
"muon.read_h5mu",
"scanpy.pp.highly_variable_genes"
] | [((472, 498), 'muon.read_h5mu', 'mu.read_h5mu', (["par['input']"], {}), "(par['input'])\n", (484, 498), True, 'import muon as mu\n'), ((1377, 1416), 'scanpy.pp.highly_variable_genes', 'sc.pp.highly_variable_genes', ([], {}), '(**hvg_args)\n', (1404, 1416), True, 'import scanpy as sc\n'), ((2116, 2158), 'numpy.ravel', '... |
import decimal
import os
from datetime import datetime
from unittest import TestCase
from db.db import Listing, Item, init_db
TWODIGITS = decimal.Decimal('0.01')
class TestSteamDatabase(TestCase):
@classmethod
def tearDownClass(cls) -> None:
os.remove('sales_test.sqlite')
@classmethod
def s... | [
"db.db.Listing.query_ref",
"db.db.Item.query.session.flush",
"db.db.Item.query.session.delete",
"db.db.Item",
"db.db.Listing.query.session.flush",
"datetime.datetime.now",
"db.db.Item.query_ref",
"db.db.init_db",
"db.db.Listing.query.session.add",
"db.db.Item.query.session.add",
"decimal.Decimal... | [((140, 163), 'decimal.Decimal', 'decimal.Decimal', (['"""0.01"""'], {}), "('0.01')\n", (155, 163), False, 'import decimal\n'), ((262, 292), 'os.remove', 'os.remove', (['"""sales_test.sqlite"""'], {}), "('sales_test.sqlite')\n", (271, 292), False, 'import os\n'), ((352, 390), 'db.db.init_db', 'init_db', (['"""sqlite://... |
#!/usr/bin/env -S python3 -u
import os
import time
pid = os.fork()
if pid != 0:
print("Child pid={}".format(pid))
time.sleep(999999)
else:
time.sleep(1)
# child forks grandchild and exits
pid2 = os.fork()
if pid2 != 0:
print("Grandchild pid={}".format(pid2))
time.sleep(5)
print("Child exits a... | [
"os.fork",
"time.sleep"
] | [((59, 68), 'os.fork', 'os.fork', ([], {}), '()\n', (66, 68), False, 'import os\n'), ((120, 138), 'time.sleep', 'time.sleep', (['(999999)'], {}), '(999999)\n', (130, 138), False, 'import time\n'), ((147, 160), 'time.sleep', 'time.sleep', (['(1)'], {}), '(1)\n', (157, 160), False, 'import time\n'), ((208, 217), 'os.fork... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2019-01-30 15:20
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('django_comments', '0003_add_submit_date_index'),
]
operations = [
migration... | [
"django.db.migrations.AlterModelOptions",
"django.db.models.CharField",
"django.db.models.IntegerField"
] | [((311, 519), 'django.db.migrations.AlterModelOptions', 'migrations.AlterModelOptions', ([], {'name': '"""comment"""', 'options': "{'ordering': ('submit_date',), 'permissions': [('can_moderate',\n 'Can moderate comments')], 'verbose_name': '评论', 'verbose_name_plural':\n '评论'}"}), "(name='comment', options={'order... |
from unittest import TestCase
from exercicios.ex1020 import calcula_idade_em_dias
class TesteEx1020(TestCase):
def test_400_dever_retornar_1ano_1mes_5dia(self):
chamada = 400
esperado = '1 ano(s)\n1 mes(es)\n5 dia(s)'
self.assertEqual(calcula_idade_em_dias(chamada), esperado)
def te... | [
"exercicios.ex1020.calcula_idade_em_dias"
] | [((266, 296), 'exercicios.ex1020.calcula_idade_em_dias', 'calcula_idade_em_dias', (['chamada'], {}), '(chamada)\n', (287, 296), False, 'from exercicios.ex1020 import calcula_idade_em_dias\n'), ((465, 495), 'exercicios.ex1020.calcula_idade_em_dias', 'calcula_idade_em_dias', (['chamada'], {}), '(chamada)\n', (486, 495), ... |
# 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 the ... | [
"os.path.exists",
"shutil.copy2",
"os.path.join",
"tensorflow.app.flags.DEFINE_string",
"tensorflow.app.run"
] | [((822, 941), 'tensorflow.app.flags.DEFINE_string', 'tf.app.flags.DEFINE_string', (['"""aug_data_folder"""', '"""./pascal_voc_seg/benchmark_RELEASE/dataset"""', '"""Augmented data foler"""'], {}), "('aug_data_folder',\n './pascal_voc_seg/benchmark_RELEASE/dataset', 'Augmented data foler')\n", (848, 941), True, 'impo... |
##### Student name: <NAME>
##### Student ID: 200 684 094
### This program has a series of functions/procedures that produce anagrams.
### The final procedure/function of the program reads from a text file, extracts
### all student names and then produces a one word and two word anagrams.
# This function takes two s... | [
"time.time"
] | [((11731, 11742), 'time.time', 'time.time', ([], {}), '()\n', (11740, 11742), False, 'import time\n')] |
import sys
from django.apps import apps
from django.core.management import BaseCommand
from viewwork import BaseViewWork
from viewwork.models import Menu
class Command(BaseCommand):
def add_arguments(self, parser):
super().add_arguments(parser)
parser.add_argument('action', action='store', type... | [
"viewwork.BaseViewWork.vw.items",
"django.apps.apps.get_app_config",
"viewwork.models.Menu.objects.filter"
] | [((406, 429), 'viewwork.BaseViewWork.vw.items', 'BaseViewWork.vw.items', ([], {}), '()\n', (427, 429), False, 'from viewwork import BaseViewWork\n'), ((839, 879), 'viewwork.models.Menu.objects.filter', 'Menu.objects.filter', ([], {'view__icontains': '""":"""'}), "(view__icontains=':')\n", (858, 879), False, 'from vieww... |
import sys
import codecs
import nltk
from nltk.corpus import stopwords
from nltk import pos_tag, word_tokenize
import csv
import datetime
from collections import Counter
import re
now = datetime.datetime.now()
today = now.strftime("%Y-%m-%d")
dTrading = 'C:/Users/vitor/Documents/GetDataset/TradingView/'... | [
"nltk.corpus.stopwords.words",
"collections.Counter",
"datetime.datetime.now",
"re.sub",
"csv.reader"
] | [((198, 221), 'datetime.datetime.now', 'datetime.datetime.now', ([], {}), '()\n', (219, 221), False, 'import datetime\n'), ((348, 389), 'nltk.corpus.stopwords.words', 'nltk.corpus.stopwords.words', (['"""portuguese"""'], {}), "('portuguese')\n", (375, 389), False, 'import nltk\n'), ((743, 772), 're.sub', 're.sub', (['"... |
# -*- coding: utf-8 -*-
"""
Kay generics.
:Copyright: (c) 2009 <NAME> <<EMAIL>> All rights reserved.
:license: BSD, see LICENSE for more details.
"""
from kay.exceptions import NotAuthorized
OP_LIST = 'list'
OP_SHOW = 'show'
OP_CREATE = 'create'
OP_UPDATE = 'update'
OP_DELETE = 'delete'
# presets for authorization... | [
"kay.exceptions.NotAuthorized"
] | [((474, 489), 'kay.exceptions.NotAuthorized', 'NotAuthorized', ([], {}), '()\n', (487, 489), False, 'from kay.exceptions import NotAuthorized\n'), ((641, 656), 'kay.exceptions.NotAuthorized', 'NotAuthorized', ([], {}), '()\n', (654, 656), False, 'from kay.exceptions import NotAuthorized\n'), ((915, 930), 'kay.exception... |
#
# This is a minimal server-side web application that authenticates visitors
# using Google Sign-in.
#
# See the README.md and LICENSE.md files for the purpose of this code.
#
# ENVIRONMENT VARIABLES YOU MUST SET
#
# The following values must be provided in environment variables for Google
# Sign-in to work.
#
# The... | [
"flask.render_template",
"requests.post",
"flask.request.args.to_dict",
"flask.Flask",
"google.auth.transport.requests.Request",
"flask.redirect"
] | [((820, 835), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (825, 835), False, 'from flask import Flask, redirect, render_template, request, session\n'), ((1177, 1230), 'flask.render_template', 'render_template', (['"""index.html"""'], {'email': "session['email']"}), "('index.html', email=session['email']... |
from django.conf.urls import url
from blog import views
urlpatterns = [
url(r'^archive/$', views.archive, name='archive'),
url(r'^comment/$', views.comment, name='comment'),
url(r'^(?P<slug>[A-Za-z0-9_\-.]+)?/?$', views.post, name='post'),
]
| [
"django.conf.urls.url"
] | [((78, 126), 'django.conf.urls.url', 'url', (['"""^archive/$"""', 'views.archive'], {'name': '"""archive"""'}), "('^archive/$', views.archive, name='archive')\n", (81, 126), False, 'from django.conf.urls import url\n'), ((133, 181), 'django.conf.urls.url', 'url', (['"""^comment/$"""', 'views.comment'], {'name': '"""com... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'C:\Users\Victor\Dropbox\DFR\film2dose\qt_ui\evo_widget.ui'
#
# Created: Tue Sep 29 14:54:23 2015
# by: pyside-uic 0.2.15 running on PySide 1.2.2
#
# WARNING! All changes made in this file will be lost!
from PySide import QtCore, QtGui
... | [
"PySide.QtGui.QSpinBox",
"PySide.QtGui.QGridLayout",
"PySide.QtGui.QCheckBox",
"PySide.QtCore.QMetaObject.connectSlotsByName",
"PySide.QtGui.QComboBox",
"PySide.QtGui.QPushButton",
"PySide.QtGui.QDoubleSpinBox",
"PySide.QtGui.QWidget",
"PySide.QtGui.QLabel",
"PySide.QtGui.QApplication.translate"
] | [((466, 489), 'PySide.QtGui.QGridLayout', 'QtGui.QGridLayout', (['Form'], {}), '(Form)\n', (483, 489), False, 'from PySide import QtCore, QtGui\n'), ((573, 596), 'PySide.QtGui.QPushButton', 'QtGui.QPushButton', (['Form'], {}), '(Form)\n', (590, 596), False, 'from PySide import QtCore, QtGui\n'), ((752, 772), 'PySide.Qt... |
from django.urls import path
from rest_framework.routers import SimpleRouter
from apps.cursos.api.views_genericsview import CursoAPIView, CursosAPIView, AvaliacaoAPIView, AvaliacoesAPIView
from apps.cursos.api.viewsets import CursoViewSet, AvaliacaoViewSet
router = SimpleRouter()
router.register('cursos', CursoViewS... | [
"apps.cursos.api.views_genericsview.CursosAPIView.as_view",
"apps.cursos.api.views_genericsview.AvaliacaoAPIView.as_view",
"rest_framework.routers.SimpleRouter",
"apps.cursos.api.views_genericsview.CursoAPIView.as_view",
"apps.cursos.api.views_genericsview.AvaliacoesAPIView.as_view"
] | [((269, 283), 'rest_framework.routers.SimpleRouter', 'SimpleRouter', ([], {}), '()\n', (281, 283), False, 'from rest_framework.routers import SimpleRouter\n'), ((410, 433), 'apps.cursos.api.views_genericsview.CursosAPIView.as_view', 'CursosAPIView.as_view', ([], {}), '()\n', (431, 433), False, 'from apps.cursos.api.vie... |
import pandas as pd
from django.db import models
from django.db.models.query import ModelIterable
class DataFrameQuerySet(models.QuerySet):
def to_dataframe(self):
records = (
self.values() if issubclass(self._iterable_class, ModelIterable) else self
)
return pd.DataFrame.from_... | [
"pandas.DataFrame.from_records"
] | [((302, 336), 'pandas.DataFrame.from_records', 'pd.DataFrame.from_records', (['records'], {}), '(records)\n', (327, 336), True, 'import pandas as pd\n')] |
"""
Runs the susceptibility variability study.
Modify the params variable to set the parameters of the study.
Parameters:
pInfect: Rate of infection
pRemove: Rate of removal
pInfected: Starting percent of population that is infected
population: Approximate popul... | [
"covidsim.datastructures.VariabilityStudyParams",
"dataclasses.asdict",
"epyc.JSONLabNotebook",
"epyc.Lab",
"epyc.RepeatedExperiment",
"covidsim.experiments.variability_study.VariabilityExperiment"
] | [((1897, 1921), 'covidsim.datastructures.VariabilityStudyParams', 'VariabilityStudyParams', ([], {}), '()\n', (1919, 1921), False, 'from covidsim.datastructures import VariabilityStudyParams\n'), ((2313, 2342), 'covidsim.experiments.variability_study.VariabilityExperiment', 'VariabilityExperiment', (['params'], {}), '(... |
import json
import torch
import torch.nn as nn
import numpy as np
import torchvision
from torchvision import models, transforms
import ConfigSpace as CS
import ConfigSpace.hyperparameters as CSH
from efficientnet_pytorch import EfficientNet
from PIL import Image
from trivialaugment import aug_lib
np.random.seed(42)
to... | [
"ConfigSpace.hyperparameters.UniformIntegerHyperparameter",
"trivialaugment.aug_lib.set_augmentation_space",
"ConfigSpace.hyperparameters.UniformFloatHyperparameter",
"efficientnet_pytorch.EfficientNet.from_name",
"torchvision.models.densenet161",
"torchvision.models.resnet18",
"numpy.array",
"torch.n... | [((299, 317), 'numpy.random.seed', 'np.random.seed', (['(42)'], {}), '(42)\n', (313, 317), True, 'import numpy as np\n'), ((318, 339), 'torch.manual_seed', 'torch.manual_seed', (['(42)'], {}), '(42)\n', (335, 339), False, 'import torch\n'), ((340, 370), 'torch.cuda.manual_seed_all', 'torch.cuda.manual_seed_all', (['(42... |
from config_resolver import get_config
cfg = get_config("bird_feeder", "acmecorp")
print(cfg.meta)
| [
"config_resolver.get_config"
] | [((46, 83), 'config_resolver.get_config', 'get_config', (['"""bird_feeder"""', '"""acmecorp"""'], {}), "('bird_feeder', 'acmecorp')\n", (56, 83), False, 'from config_resolver import get_config\n')] |
# -*- coding: utf-8 -*-
import sys
# Print iterations progress
def print_progress(iteration, total, prefix='', suffix='', decimals=1,
bar_length=100):
"""
Call in a loop to create terminal progress bar
"""
str_format = "{0:." + str(decimals) + "f}"
percents = str_format.format(... | [
"sys.stdout.flush",
"sys.stdout.write"
] | [((496, 572), 'sys.stdout.write', 'sys.stdout.write', (["('\\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix))"], {}), "('\\r%s |%s| %s%s %s' % (prefix, bar, percents, '%', suffix))\n", (512, 572), False, 'import sys\n'), ((650, 668), 'sys.stdout.flush', 'sys.stdout.flush', ([], {}), '()\n', (666, 668), False, ... |
# Copyright 2017 The Forseti Security Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | [
"google.cloud.forseti.actions.action_config_validator.ActionTypeDoesntExist",
"google.cloud.forseti.actions.action_config_validator._load_actions",
"google.cloud.forseti.actions.action_config_validator._load_and_validate_yaml",
"os.path.join",
"google.cloud.forseti.actions.action_config_validator.validate",... | [((3754, 3769), 'unittest.main', 'unittest.main', ([], {}), '()\n', (3767, 3769), False, 'import unittest\n'), ((1096, 1132), 'google.cloud.forseti.actions.action_config_validator._load_actions', 'acv._load_actions', (['self.valid_config'], {}), '(self.valid_config)\n', (1113, 1132), True, 'import google.cloud.forseti.... |
from robot.libraries.BuiltIn import BuiltIn
import json
class VariablesBuiltIn:
@staticmethod
def getVariables():
USERNAME = BuiltIn().get_variable_value("${USERNAME}") or "USERNAME"
ENVIRONNEMENT = BuiltIn().get_variable_value("${ENVIRONNEMENT}") or "ENVIRONNEMENT"
JOB_ID = BuiltIn().... | [
"robot.libraries.BuiltIn.BuiltIn"
] | [((517, 526), 'robot.libraries.BuiltIn.BuiltIn', 'BuiltIn', ([], {}), '()\n', (524, 526), False, 'from robot.libraries.BuiltIn import BuiltIn\n'), ((142, 151), 'robot.libraries.BuiltIn.BuiltIn', 'BuiltIn', ([], {}), '()\n', (149, 151), False, 'from robot.libraries.BuiltIn import BuiltIn\n'), ((224, 233), 'robot.librari... |
import os
os.system("python manage.py runserver")
| [
"os.system"
] | [((10, 49), 'os.system', 'os.system', (['"""python manage.py runserver"""'], {}), "('python manage.py runserver')\n", (19, 49), False, 'import os\n')] |
from datetime import date
class LinkedData:
"""
Generates JSON-LD based on gages and the flood event.
"""
def __init__(self):
self.ld = self._blank_thing("WebSite")
self.ld.update({
"name": "Active flood visualization placeholder name",
"datePublished": str(date... | [
"datetime.date.today"
] | [((316, 328), 'datetime.date.today', 'date.today', ([], {}), '()\n', (326, 328), False, 'from datetime import date\n')] |
from argparse import ArgumentError
from argparse import ArgumentParser
from argparse import Namespace
from enum import Enum
import pytest
from pyapp.app import argument_actions
class TestKeyValueAction:
def test_init__default_values(self):
target = argument_actions.KeyValueAction(
option_str... | [
"pyapp.app.argument_actions.EnumName",
"argparse.ArgumentParser",
"pyapp.app.argument_actions.EnumValue",
"pytest.mark.parametrize",
"argparse.Namespace",
"pytest.raises",
"pyapp.app.argument_actions.KeyValueAction"
] | [((462, 641), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""value, expected"""', "(('x=y', {'x': 'y'}), ('x=1', {'x': '1'}), ('x=', {'x': ''}), ('x=a=b', {\n 'x': 'a=b'}), (('x=1', 'y=2'), {'x': '1', 'y': '2'}))"], {}), "('value, expected', (('x=y', {'x': 'y'}), ('x=1', {\n 'x': '1'}), ('x=', {'x': ... |
"""
Storing tensors such that torchscript can work with them can be
quite a pain. This set of tools makes it a lot easier. Tensors
are stored by placing them in the initialization region, and become
something that can then be accessed by looking at
.stored
"""
from __future__ import annotations
from typing import ... | [
"torch.nn.Parameter",
"torch.nn.ModuleDict"
] | [((882, 897), 'torch.nn.ModuleDict', 'nn.ModuleDict', ([], {}), '()\n', (895, 897), False, 'from torch import nn\n'), ((678, 727), 'torch.nn.Parameter', 'nn.Parameter', (['tensor'], {'requires_grad': 'requires_grad'}), '(tensor, requires_grad=requires_grad)\n', (690, 727), False, 'from torch import nn\n')] |
from django.db import models
from django.contrib.auth.models import User
# 处理图片
from PIL import Image
# 引入内置信号
# from django.db.models.signals import post_save
# 引入信号接收器的装饰器
# from django.dispatch import receiver
from imagekit.models import ProcessedImageField
from imagekit.processors import ResizeToFit
# 用户扩展信息
cla... | [
"django.db.models.OneToOneField",
"django.db.models.TextField",
"imagekit.processors.ResizeToFit",
"django.db.models.CharField"
] | [((381, 457), 'django.db.models.OneToOneField', 'models.OneToOneField', (['User'], {'on_delete': 'models.CASCADE', 'related_name': '"""profile"""'}), "(User, on_delete=models.CASCADE, related_name='profile')\n", (401, 457), False, 'from django.db import models\n'), ((483, 526), 'django.db.models.CharField', 'models.Cha... |
from django.conf.urls import url, include
from rest_framework import routers
from . import views
# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
urlpatterns = [
url(r'^prices/(?P<mid>[0-9]+)/$', views.PriceLis... | [
"django.conf.urls.include",
"rest_framework.routers.DefaultRouter"
] | [((181, 204), 'rest_framework.routers.DefaultRouter', 'routers.DefaultRouter', ([], {}), '()\n', (202, 204), False, 'from rest_framework import routers\n'), ((348, 368), 'django.conf.urls.include', 'include', (['router.urls'], {}), '(router.urls)\n', (355, 368), False, 'from django.conf.urls import url, include\n')] |
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error as mae
import matplotlib.pyplot as plt
import pandas as pd
import csv
df = pd.read_csv('vgsales.csv')
print(df.head())
y = df['Global_Sales']
df =... | [
"pandas.read_csv",
"matplotlib.pyplot.ylabel",
"sklearn.model_selection.train_test_split",
"matplotlib.pyplot.xlabel",
"sklearn.metrics.mean_absolute_error",
"matplotlib.pyplot.scatter",
"matplotlib.pyplot.axis",
"sklearn.linear_model.LinearRegression",
"numpy.nan_to_num",
"matplotlib.pyplot.show"... | [((247, 273), 'pandas.read_csv', 'pd.read_csv', (['"""vgsales.csv"""'], {}), "('vgsales.csv')\n", (258, 273), True, 'import pandas as pd\n'), ((429, 445), 'numpy.nan_to_num', 'np.nan_to_num', (['X'], {}), '(X)\n', (442, 445), True, 'import numpy as np\n'), ((482, 520), 'sklearn.model_selection.train_test_split', 'train... |
from itertools import combinations
def item_in_string(g, str):
for item in g:
if item in str:
return True
return False
def main():
print ('Filter data')
distributions = ['uniform', 'diagonal', 'gauss', 'parcel', 'bit']
for r in range(1, len(distributions) + 1):
grou... | [
"itertools.combinations"
] | [((325, 355), 'itertools.combinations', 'combinations', (['distributions', 'r'], {}), '(distributions, r)\n', (337, 355), False, 'from itertools import combinations\n')] |
import gputransform
import numpy as np
import numpy.testing as npt
import time
import os
import numpy.testing as npt
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
# load test point cloud util
def load_pc_file(filename):
# returns Nx3 matrix
pc = np.fromfile(os.path.join("./", filename... | [
"matplotlib.pyplot.imshow",
"numpy.reshape",
"os.path.join",
"gputransform.GPUTransformer",
"matplotlib.pyplot.close",
"numpy.array",
"matplotlib.pyplot.figure",
"matplotlib.pyplot.pause",
"time.time",
"mpl_toolkits.mplot3d.Axes3D",
"matplotlib.pyplot.show"
] | [((717, 729), 'matplotlib.pyplot.figure', 'plt.figure', ([], {}), '()\n', (727, 729), True, 'import matplotlib.pyplot as plt\n'), ((735, 746), 'mpl_toolkits.mplot3d.Axes3D', 'Axes3D', (['fig'], {}), '(fig)\n', (741, 746), False, 'from mpl_toolkits.mplot3d import Axes3D\n'), ((767, 777), 'matplotlib.pyplot.show', 'plt.s... |
import asyncio
def get_page(self):
"""
A function which will be monkeypatched onto the request to get the current
integer representing the current page.
"""
try:
if self.POST:
p = self.POST['page']
else:
p = self.GET['page']
if p == 'last':
... | [
"asyncio.iscoroutinefunction"
] | [((472, 513), 'asyncio.iscoroutinefunction', 'asyncio.iscoroutinefunction', (['get_response'], {}), '(get_response)\n', (499, 513), False, 'import asyncio\n')] |
import os
import datetime
import zipfile
import threading
import hashlib
import shutil
import subprocess
import pprint
from invoke import task
import boto3
S3_BUCKET = 'ai2-thor'
UNITY_VERSION = '2018.3.6f1'
def add_files(zipf, start_dir):
for root, dirs, files in os.walk(start_dir):
for f in files:
... | [
"boto3.client",
"zipfile.ZipFile",
"multiprocessing.Process",
"io.BytesIO",
"time.sleep",
"datetime.timedelta",
"multiprocessing.set_start_method",
"os.walk",
"os.path.exists",
"os.listdir",
"ai2thor.build.platform_map.keys",
"itertools.product",
"json.dumps",
"os.path.split",
"numpy.max... | [((271, 289), 'os.walk', 'os.walk', (['start_dir'], {}), '(start_dir)\n', (278, 289), False, 'import os\n'), ((685, 705), 'boto3.resource', 'boto3.resource', (['"""s3"""'], {}), "('s3')\n", (699, 705), False, 'import boto3\n'), ((725, 761), 'os.path.basename', 'os.path.basename', (['build_archive_name'], {}), '(build_a... |
'''
Created on Aug 10, 2018
@author: <NAME>
@contact: <EMAIL>
This module uses tensorflow on a dataset to implement a multivarian linear regression.
The following input arguments are needed and for practical purposes, in CSV format
and only float values
1. File name. Must be specified with -i
2. Colum... | [
"getopt.getopt",
"pandas.read_csv",
"sys.exit"
] | [((979, 1017), 'getopt.getopt', 'getopt.getopt', (['argv', '"""hHei:y:a:t:"""', '[]'], {}), "(argv, 'hHei:y:a:t:', [])\n", (992, 1017), False, 'import getopt\n'), ((1439, 1450), 'sys.exit', 'sys.exit', (['(2)'], {}), '(2)\n', (1447, 1450), False, 'import sys\n'), ((5339, 5428), 'pandas.read_csv', 'pd.read_csv', (["argu... |
import sys
import numpy as np
def l0gurobi(x, y, l0, l2, m, lb, ub, relaxed=True):
try:
from gurobipy import Model, GRB, QuadExpr, LinExpr
except ModuleNotFoundError:
raise Exception('Gurobi is not installed')
model = Model() # the optimization model
n = x.shape[0] # number of sampl... | [
"mosek.fusion.Domain.greaterThan",
"mosek.fusion.Expr.sum",
"mosek.fusion.Domain.inRotatedQCone",
"numpy.ones",
"mosek.fusion.Expr.add",
"mosek.fusion.Expr.mul",
"mosek.fusion.Domain.unbounded",
"mosek.fusion.Domain.inRange",
"gurobipy.QuadExpr",
"mosek.fusion.Expr.sub",
"gurobipy.Model",
"gur... | [((249, 256), 'gurobipy.Model', 'Model', ([], {}), '()\n', (254, 256), False, 'from gurobipy import Model, GRB, QuadExpr, LinExpr\n'), ((1353, 1363), 'gurobipy.QuadExpr', 'QuadExpr', ([], {}), '()\n', (1361, 1363), False, 'from gurobipy import Model, GRB, QuadExpr, LinExpr\n'), ((2684, 2695), 'mosek.fusion.Model', 'msk... |
# Generated by Django 3.1.8 on 2021-04-13 07:02
from decimal import Decimal
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUT... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.models.DecimalField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField",
"decimal.Decimal"
] | [((276, 333), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (307, 333), False, 'from django.db import migrations, models\n'), ((539, 632), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
import numpy as np
import torch
from pyquaternion import Quaternion
from utils.data_classes import Box
def anchor_to_standup_box2d(anchors):
# (N, 4) -> (N, 4); x,y,w,l -> x1,y1,x2,y2
anchor_standup = np.zeros_like(anchors)
# r == 0
anchor_standup[::2, 0] = anchors[::2, 0] - anchors[::2, 3] / 2
a... | [
"pyquaternion.Quaternion",
"torch.mul",
"torch.atan2",
"torch.sqrt",
"torch.sin",
"torch.exp",
"numpy.max",
"numpy.zeros",
"torch.cos",
"numpy.min",
"utils.data_classes.Box",
"torch.zeros_like",
"numpy.zeros_like",
"torch.FloatTensor"
] | [((212, 234), 'numpy.zeros_like', 'np.zeros_like', (['anchors'], {}), '(anchors)\n', (225, 234), True, 'import numpy as np\n'), ((978, 994), 'numpy.zeros', 'np.zeros', (['(N, 4)'], {}), '((N, 4))\n', (986, 994), True, 'import numpy as np\n'), ((1023, 1060), 'numpy.min', 'np.min', (['boxes_corner[:, :, 0]'], {'axis': '(... |
import requests
import xml.etree.ElementTree as ET
import urllib.request, urllib.parse, urllib.error
import json
import ssl
import sys
import re
import getopt
ctx = ssl.create_default_context()
ctx.check_hostname = False
ctx.verify_mode = ssl.CERT_NONE
lon = str(37.7812808)
lat = str(-122.4152363)
url = "https://no... | [
"ssl.create_default_context",
"json.loads",
"json.dumps"
] | [((166, 194), 'ssl.create_default_context', 'ssl.create_default_context', ([], {}), '()\n', (192, 194), False, 'import ssl\n'), ((535, 551), 'json.loads', 'json.loads', (['data'], {}), '(data)\n', (545, 551), False, 'import json\n'), ((558, 598), 'json.dumps', 'json.dumps', (['js'], {'indent': '(4)', 'sort_keys': '(Tru... |
# Beispielprogramm für das Buch "Python Challenge"
#
# Copyright 2020 by <NAME>
from ch06_arrays.solutions.ex09_sudoku_checker import is_sudoku_valid
def create_initialized_board():
return [[1, 2, 0, 4, 5, 0, 7, 8, 9],
[0, 5, 6, 7, 0, 9, 0, 2, 3],
[7, 8, 0, 1, 2, 3, 4, 5, 6],
[... | [
"ch06_arrays.solutions.ex09_sudoku_checker.is_sudoku_valid"
] | [((645, 667), 'ch06_arrays.solutions.ex09_sudoku_checker.is_sudoku_valid', 'is_sudoku_valid', (['board'], {}), '(board)\n', (660, 667), False, 'from ch06_arrays.solutions.ex09_sudoku_checker import is_sudoku_valid\n'), ((881, 903), 'ch06_arrays.solutions.ex09_sudoku_checker.is_sudoku_valid', 'is_sudoku_valid', (['board... |
#!/usr/bin/env python
import argparse
import json
parser = argparse.ArgumentParser()
parser.add_argument('file_to_parse', type=argparse.FileType('r'))
args = parser.parse_args()
json_payload = json.load(args.file_to_parse)
outputs = json_payload.get('properties', {}).get('outputs', {})
for key, value in outputs.ite... | [
"json.load",
"argparse.FileType",
"argparse.ArgumentParser"
] | [((61, 86), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (84, 86), False, 'import argparse\n'), ((196, 225), 'json.load', 'json.load', (['args.file_to_parse'], {}), '(args.file_to_parse)\n', (205, 225), False, 'import json\n'), ((129, 151), 'argparse.FileType', 'argparse.FileType', (['"""r"""... |
"""
Present both functional and object-oriented interfaces for executing
lookups in Hesiod, Project Athena's service name resolution protocol.
"""
from _hesiod import bind, resolve
from pwd import struct_passwd
from grp import struct_group
class HesiodParseError(Exception):
pass
class Lookup(object):
"""
... | [
"_hesiod.resolve",
"pwd.struct_passwd",
"grp.struct_group"
] | [((421, 448), '_hesiod.resolve', 'resolve', (['hes_name', 'hes_type'], {}), '(hes_name, hes_type)\n', (428, 448), False, 'from _hesiod import bind, resolve\n'), ((3050, 3076), 'pwd.struct_passwd', 'struct_passwd', (['passwd_info'], {}), '(passwd_info)\n', (3063, 3076), False, 'from pwd import struct_passwd\n'), ((3609,... |
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
"""
About: Basic chain topology for test DPDK L2 forwarding application.
"""
import argparse
import multiprocessing
import subprocess
import sys
import time
from shlex import split
from subprocess import check_output
from comnetsemu.cli import CLI
from... | [
"argparse.ArgumentParser",
"comnetsemu.cli.CLI",
"shlex.split",
"time.sleep",
"comnetsemu.net.Containernet",
"multiprocessing.cpu_count",
"mininet.log.setLogLevel",
"sys.exit",
"mininet.log.info"
] | [((1038, 1099), 'mininet.log.info', 'info', (['"""*** Run DPDK l2fwd sample application on the relay.\n"""'], {}), "('*** Run DPDK l2fwd sample application on the relay.\\n')\n", (1042, 1099), False, 'from mininet.log import info, setLogLevel\n'), ((1733, 1797), 'mininet.log.info', 'info', (['f"""*** Run Sockperf serve... |
import random
from xlsxcessive.worksheet import Worksheet
class TestAddingCellsToWorksheet:
def setup_method(self, method):
self.sheet = Worksheet(None, 'test', None, None)
def _coords_to_a1(self, coords):
def num_to_a(n):
if n < 0:
return ""
if n == 0... | [
"xlsxcessive.worksheet.Worksheet",
"random.randint"
] | [((152, 187), 'xlsxcessive.worksheet.Worksheet', 'Worksheet', (['None', '"""test"""', 'None', 'None'], {}), "(None, 'test', None, None)\n", (161, 187), False, 'from xlsxcessive.worksheet import Worksheet\n'), ((1477, 1512), 'xlsxcessive.worksheet.Worksheet', 'Worksheet', (['None', '"""test"""', 'None', 'None'], {}), "(... |
import os
import pytest
from stupid_ai.markov_chain import MarkovChain
@pytest.fixture
def markov_chain():
m = MarkovChain()
m.set_file(os.path.join('data', 'male.txt'))
m.train()
return m
def test_p_values(markov_chain):
assert markov_chain.P[0][0] == 0.004246284501061571
assert markov_chai... | [
"stupid_ai.markov_chain.MarkovChain",
"os.path.join"
] | [((117, 130), 'stupid_ai.markov_chain.MarkovChain', 'MarkovChain', ([], {}), '()\n', (128, 130), False, 'from stupid_ai.markov_chain import MarkovChain\n'), ((146, 178), 'os.path.join', 'os.path.join', (['"""data"""', '"""male.txt"""'], {}), "('data', 'male.txt')\n", (158, 178), False, 'import os\n')] |
import os
from unittest.mock import MagicMock, patch
import pytest
from shared import create_base_application
from shared.di import injector
from shared.services import EnvironmentService, ShutdownService
from shared.tests import reset_di # noqa
@pytest.fixture()
def env_service(reset_di): # noqa
injector.reg... | [
"shared.create_base_application",
"unittest.mock.MagicMock",
"shared.di.injector.register",
"unittest.mock.patch.object",
"pytest.fixture",
"shared.di.injector.get",
"unittest.mock.patch"
] | [((252, 268), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (266, 268), False, 'import pytest\n'), ((308, 365), 'shared.di.injector.register', 'injector.register', (['EnvironmentService', 'EnvironmentService'], {}), '(EnvironmentService, EnvironmentService)\n', (325, 365), False, 'from shared.di import injector... |
# 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... | [
"keystoneauth1.loading.Opt"
] | [((832, 872), 'keystoneauth1.loading.Opt', 'loading.Opt', (['"""username"""'], {'help': '"""Username"""'}), "('username', help='Username')\n", (843, 872), False, 'from keystoneauth1 import loading\n'), ((910, 964), 'keystoneauth1.loading.Opt', 'loading.Opt', (['"""api-key"""'], {'dest': '"""api_key"""', 'help': '"""API... |
from hibp import HIBP, AsyncHIBP
import time
import logging
logging.basicConfig(level=logging.INFO, format='%(message)s')
logging.getLogger("requests").setLevel(logging.WARNING)
if __name__ == '__main__':
# random set of query paramaters
names = ['adobe','ashleymadison', 'naughtyamerica', 'myspace']
accou... | [
"logging.basicConfig",
"logging.getLogger",
"hibp.HIBP.get_account_breaches",
"hibp.HIBP.get_breach",
"hibp.HIBP.get_domain_breaches",
"logging.info",
"hibp.AsyncHIBP",
"time.time"
] | [((61, 122), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.INFO', 'format': '"""%(message)s"""'}), "(level=logging.INFO, format='%(message)s')\n", (80, 122), False, 'import logging\n'), ((695, 706), 'time.time', 'time.time', ([], {}), '()\n', (704, 706), False, 'import time\n'), ((798, 858), 'lo... |
#!/usr/bin/env python3
import fileinput
from collections import defaultdict
from threading import Thread
from queue import Queue
class Memory(defaultdict):
def __init__(self, content):
super(Memory, self).__init__(int, enumerate(content))
def __getitem__(self, address):
if address < 0:
... | [
"queue.Queue",
"fileinput.input"
] | [((947, 954), 'queue.Queue', 'Queue', ([], {}), '()\n', (952, 954), False, 'from queue import Queue\n'), ((1029, 1036), 'queue.Queue', 'Queue', ([], {}), '()\n', (1034, 1036), False, 'from queue import Queue\n'), ((4839, 4856), 'fileinput.input', 'fileinput.input', ([], {}), '()\n', (4854, 4856), False, 'import fileinp... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import math
def get_min_node_pred(queue):
min_node = 0
for node in range(len(queue)):
if queue[node].cost_for_pred < queue[min_node].cost_for_pred:
min_node = node
return queue.pop(min_node)
def get_min_node_prey(queue):... | [
"numpy.clip",
"math.sqrt",
"numpy.sqrt",
"numpy.ones"
] | [((2585, 2625), 'numpy.sqrt', 'np.sqrt', (['((x1 - x2) ** 2 + (y1 - y2) ** 2)'], {}), '((x1 - x2) ** 2 + (y1 - y2) ** 2)\n', (2592, 2625), True, 'import numpy as np\n'), ((2861, 2903), 'math.sqrt', 'math.sqrt', (['((x1 - x2) ** 2 + (y1 - y2) ** 2)'], {}), '((x1 - x2) ** 2 + (y1 - y2) ** 2)\n', (2870, 2903), False, 'imp... |
import StatusChanger.StatusChanger as StatusChanger
from States.States import States
import unittest
class StatusChangerTest(unittest.TestCase):
def test_motor(self):
# start motor, slow
StatusChanger.status_changer(132)
self.assertTrue(States.MOTOR_STARTED)
self.assertTrue(States... | [
"unittest.main",
"StatusChanger.StatusChanger.status_changer"
] | [((210, 243), 'StatusChanger.StatusChanger.status_changer', 'StatusChanger.status_changer', (['(132)'], {}), '(132)\n', (238, 243), True, 'import StatusChanger.StatusChanger as StatusChanger\n'), ((414, 447), 'StatusChanger.StatusChanger.status_changer', 'StatusChanger.status_changer', (['(122)'], {}), '(122)\n', (442,... |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
from __future__ import (absolute_import, division, print_function,
unicode_literals)
from astropy.tests.helper import pytest
import numpy as np
from numpy.testing import assert_allclose
from astropy.modeling.models import Gaussian2D... | [
"astropy.tests.helper.pytest.raises",
"numpy.ones",
"astropy.tests.helper.pytest.mark.skipif",
"numpy.testing.assert_allclose",
"astropy.modeling.models.Gaussian2D"
] | [((512, 547), 'astropy.tests.helper.pytest.mark.skipif', 'pytest.mark.skipif', (['"""not HAS_SCIPY"""'], {}), "('not HAS_SCIPY')\n", (530, 547), False, 'from astropy.tests.helper import pytest\n'), ((582, 597), 'numpy.ones', 'np.ones', (['(5, 5)'], {}), '((5, 5))\n', (589, 597), True, 'import numpy as np\n'), ((796, 82... |
from pynput.keyboard import Key, Listener
import logging
import datetime
import sys
log_file='/home/bertrand/Desktop/file_no_display.log'
logging.basicConfig(filename=log_file, level=logging.DEBUG, format='%(message)s')
message = ""
# stop = False
def on_press(key):
global message
if (hasattr(key, 'name')):
... | [
"logging.basicConfig",
"datetime.datetime.now",
"pynput.keyboard.Listener",
"logging.info"
] | [((139, 225), 'logging.basicConfig', 'logging.basicConfig', ([], {'filename': 'log_file', 'level': 'logging.DEBUG', 'format': '"""%(message)s"""'}), "(filename=log_file, level=logging.DEBUG, format=\n '%(message)s')\n", (158, 225), False, 'import logging\n'), ((926, 949), 'datetime.datetime.now', 'datetime.datetime.... |
"""
This module contains methods for creating a game H2H chart.
"""
import matplotlib.pyplot as plt
import numpy as np # standard scientific python stack
import pandas as pd # standard scientific python stack
from scrapenhl2.manipulate import manipulate as manip
from scrapenhl2.scrape import schedules, team_info, p... | [
"scrapenhl2.scrape.schedules.get_home_team",
"scrapenhl2.scrape.players.playerlst_as_str",
"scrapenhl2.scrape.schedules.get_road_score",
"scrapenhl2.scrape.games.most_recent_game_id",
"scrapenhl2.manipulate.manipulate.get_player_toi",
"scrapenhl2.scrape.schedules.get_road_team",
"matplotlib.pyplot.close... | [((960, 999), 'scrapenhl2.scrape.games.most_recent_game_id', 'games.most_recent_game_id', (['team1', 'team2'], {}), '(team1, team2)\n', (985, 999), False, 'from scrapenhl2.scrape import games\n'), ((3071, 3087), 'matplotlib.pyplot.close', 'plt.close', (['"""all"""'], {}), "('all')\n", (3080, 3087), True, 'import matplo... |