code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
from itertools import chain
from nose.tools import *
from hawkweed.monads.either import Either, Left, Right, is_right,\
is_left, is_either, either, lefts, rights, partition_eithers
from hawkweed.functional.primitives import identity
def test_right():
assert_equal(Right(10).bind(identity), 10)
def test_not... | [
"hawkweed.monads.either.either",
"hawkweed.monads.either.rights",
"hawkweed.monads.either.Left",
"hawkweed.monads.either.Right",
"hawkweed.monads.either.is_either",
"hawkweed.monads.either.lefts",
"hawkweed.monads.either.is_right",
"hawkweed.monads.either.is_left",
"hawkweed.monads.either.partition_... | [((336, 351), 'hawkweed.monads.either.Left', 'Left', (['"""failure"""'], {}), "('failure')\n", (340, 351), False, 'from hawkweed.monads.either import Either, Left, Right, is_right, is_left, is_either, either, lefts, rights, partition_eithers\n'), ((512, 524), 'hawkweed.monads.either.is_right', 'is_right', (['(10)'], {}... |
import numpy as np
import pandas as pd
from .libbinding import t_schema, t_dtype, t_table
class Perspective(object):
def __init__(self, column_names, types):
self._columns = {}
dtypes = []
for name, _type in zip(column_names, types):
dtypes.append(self._type_to_dtype(_type))
... | [
"pandas.DataFrame"
] | [((3233, 3247), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (3245, 3247), True, 'import pandas as pd\n')] |
import os
import shutil
import tempfile
import unittest
from django.test import TestCase
from ...plugins import DatabaseCacheLayer
from .handler import ShelfDatabasePlugin
class ShelfDatabaseTest(TestCase):
def setUp(self):
self.temp_path = tempfile.mkdtemp()
self.db_path = os.path.join(self.tem... | [
"os.path.join",
"tempfile.mkdtemp",
"unittest.SkipTest",
"shutil.rmtree"
] | [((257, 275), 'tempfile.mkdtemp', 'tempfile.mkdtemp', ([], {}), '()\n', (273, 275), False, 'import tempfile\n'), ((299, 333), 'os.path.join', 'os.path.join', (['self.temp_path', '"""db"""'], {}), "(self.temp_path, 'db')\n", (311, 333), False, 'import os\n'), ((513, 542), 'shutil.rmtree', 'shutil.rmtree', (['self.temp_p... |
from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DATE
from sqlalchemy.orm import relationship
from database import Base
class User(Base):
__tablename__ = "users"
username = Column(String, primary_key=True, index=True)
email = Column(String, unique=True, index=True)
name = Column(... | [
"sqlalchemy.orm.relationship",
"sqlalchemy.ForeignKey",
"sqlalchemy.Column"
] | [((205, 249), 'sqlalchemy.Column', 'Column', (['String'], {'primary_key': '(True)', 'index': '(True)'}), '(String, primary_key=True, index=True)\n', (211, 249), False, 'from sqlalchemy import Boolean, Column, ForeignKey, Integer, String, DATE\n'), ((262, 301), 'sqlalchemy.Column', 'Column', (['String'], {'unique': '(Tr... |
from openpathsampling.high_level.network import FixedLengthTPSNetwork
from openpathsampling.high_level.transition import FixedLengthTPSTransition
import openpathsampling as paths
class PartInBFixedLengthTPSTransition(FixedLengthTPSTransition):
"""Fixed length TPS transition accepting any frame in the final state.
... | [
"openpathsampling.LengthEnsemble",
"openpathsampling.AllInXEnsemble",
"openpathsampling.PartInXEnsemble"
] | [((802, 825), 'openpathsampling.LengthEnsemble', 'paths.LengthEnsemble', (['(1)'], {}), '(1)\n', (822, 825), True, 'import openpathsampling as paths\n'), ((828, 856), 'openpathsampling.AllInXEnsemble', 'paths.AllInXEnsemble', (['stateA'], {}), '(stateA)\n', (848, 856), True, 'import openpathsampling as paths\n'), ((870... |
from django.contrib import admin
from players.models import Player
class PlayerAdmin(admin.ModelAdmin):
pass
admin.site.register(Player, PlayerAdmin)
| [
"django.contrib.admin.site.register"
] | [((117, 157), 'django.contrib.admin.site.register', 'admin.site.register', (['Player', 'PlayerAdmin'], {}), '(Player, PlayerAdmin)\n', (136, 157), False, 'from django.contrib import admin\n')] |
from . import Checksum
from django.conf import settings
import requests
import json
def VerifyPaytmResponse(response):
response_dict = {}
if response.method == "POST":
data_dict = {}
for key in response.POST:
data_dict[key] = response.POST[key]
MID = data_dict['MID']
... | [
"requests.post"
] | [((722, 775), 'requests.post', 'requests.post', (['STATUS_URL'], {'data': 'data', 'headers': 'headers'}), '(STATUS_URL, data=data, headers=headers)\n', (735, 775), False, 'import requests\n')] |
# Copyright (c) 2016-present, Facebook, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | [
"numpy.random.rand",
"numpy.log",
"hypothesis.strategies.integers",
"caffe2.python.core.CreateOperator"
] | [((1536, 1590), 'caffe2.python.core.CreateOperator', 'core.CreateOperator', (['"""BernoulliJSD"""', "['p', 'q']", "['l']"], {}), "('BernoulliJSD', ['p', 'q'], ['l'])\n", (1555, 1590), False, 'from caffe2.python import core\n'), ((1031, 1040), 'numpy.log', 'np.log', (['p'], {}), '(p)\n', (1037, 1040), True, 'import nump... |
from collections import deque
import networkx as nx
import numpy as np
def random_subtree(T, alpha, beta, subtree_mark):
""" Random subtree of T according to Algorithm X in [1].
Args:
alpha (float): probability of continuing to a neighbor
beta (float): probability of non empty subtree
... | [
"numpy.float",
"collections.deque",
"numpy.power",
"networkx.Graph",
"numpy.random.multinomial",
"numpy.random.randint"
] | [((937, 946), 'collections.deque', 'deque', (['[]'], {}), '([])\n', (942, 946), False, 'from collections import deque\n'), ((959, 979), 'numpy.random.randint', 'np.random.randint', (['n'], {}), '(n)\n', (976, 979), True, 'import numpy as np\n'), ((2194, 2216), 'numpy.power', 'np.power', (['(1 - alpha)', 'w'], {}), '(1 ... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Constants parameter functions
DRS Import Rules:
- only from apero.lang and apero.core.constants
Created on 2019-01-17 at 15:24
@author: cook
"""
from collections import OrderedDict
import copy
import numpy as np
import os
import pkg_resources
import shutil
import sy... | [
"ctypes.create_string_buffer",
"copy.deepcopy",
"sys.exit",
"numpy.nanmin",
"os.remove",
"os.path.exists",
"ctypes.windll.kernel32.GetConsoleScreenBufferInfo",
"os.listdir",
"apero.core.constants.constant_functions.generate_consts",
"os.path.normpath",
"apero.core.constants.constant_functions.Di... | [((44313, 44368), 'apero.core.constants.constant_functions.import_module', 'constant_functions.import_module', (['func_name', 'modules[0]'], {}), '(func_name, modules[0])\n', (44345, 44368), False, 'from apero.core.constants import constant_functions\n'), ((61893, 61925), 'apero.core.constants.constant_functions.Displa... |
from math import sin #para usar la función seno
from time import time #importamos la función time para capturar tiempos
x = list(range(0,100)) #vector de valores desde 0 a 99
y = [0.0 for i in range(len(x))] #inicializamos el vector de resultados con 100 valores 0.0
tiempo_inicial = time()
for i in range(100):... | [
"math.sin",
"time.time"
] | [((290, 296), 'time.time', 'time', ([], {}), '()\n', (294, 296), False, 'from time import time\n'), ((361, 367), 'time.time', 'time', ([], {}), '()\n', (365, 367), False, 'from time import time\n'), ((334, 343), 'math.sin', 'sin', (['x[i]'], {}), '(x[i])\n', (337, 343), False, 'from math import sin\n')] |
# -*- coding: utf-8 -*-
# Copyright (C) <NAME> <<EMAIL>>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify,... | [
"logging.getLogger",
"django.shortcuts.render",
"json.loads",
"base64.urlsafe_b64decode",
"django.http.HttpResponse",
"apps.nagios.models.SecurityPort.objects.all",
"apps.nagios.models.Satellite.live_connect",
"apps.nagios.models.Satellite.objects.filter",
"cipher.AESCipher",
"django.core.serializ... | [((1599, 1626), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (1616, 1626), False, 'import logging\n'), ((1795, 1806), 'time.time', 'time.time', ([], {}), '()\n', (1804, 1806), False, 'import time\n'), ((1820, 1872), 'cipher.AESCipher', 'AESCipher', (['"""ABCDEF0123456789"""'], {'iv': '"... |
from flask_wtf import Form
from flask_wtf import FlaskForm
from wtforms import StringField,TextAreaField,SubmitField,SelectField
#from flask_wtf import import Required
#from wtforms.validators import Required
class PitchForm(FlaskForm):
title = StringField('Pitch title')
text = TextAreaField('Text')
cate... | [
"wtforms.SelectField",
"wtforms.SubmitField",
"wtforms.StringField",
"wtforms.TextAreaField"
] | [((252, 278), 'wtforms.StringField', 'StringField', (['"""Pitch title"""'], {}), "('Pitch title')\n", (263, 278), False, 'from wtforms import StringField, TextAreaField, SubmitField, SelectField\n'), ((290, 311), 'wtforms.TextAreaField', 'TextAreaField', (['"""Text"""'], {}), "('Text')\n", (303, 311), False, 'from wtfo... |
import json
import os
import sys
import yaml
def parseYaml(file):
yFile = open(file)
yml = yaml.load(yFile, Loader=yaml.FullLoader)
yFile.close()
return yml
def generateCosts(tosca, deploymentInfo):
# creating empty costs dictionary
costs = {}
# adding cost for bottom
costs["bottom"] ... | [
"os.path.exists",
"json.dumps",
"yaml.load",
"os.chdir",
"os.mkdir",
"os.path.abspath"
] | [((100, 140), 'yaml.load', 'yaml.load', (['yFile'], {'Loader': 'yaml.FullLoader'}), '(yFile, Loader=yaml.FullLoader)\n', (109, 140), False, 'import yaml\n'), ((3150, 3174), 'os.path.abspath', 'os.path.abspath', (['args[0]'], {}), '(args[0])\n', (3165, 3174), False, 'import os\n'), ((3200, 3224), 'os.path.abspath', 'os.... |
import sys
import os
sys.path = [os.path.abspath(os.path.join(__file__, '..', '..')), ] + sys.path
import INoDS_model as inods
import numpy as np
import time
##################################################
## NOTE: INoDS requires the network and health data to be formatted in
## a specific manner. Check example file... | [
"os.path.join",
"time.time",
"INoDS_model.run_inods_sampler"
] | [((1442, 1453), 'time.time', 'time.time', ([], {}), '()\n', (1451, 1453), False, 'import time\n'), ((1454, 1739), 'INoDS_model.run_inods_sampler', 'inods.run_inods_sampler', (['edge_filename', 'health_filename', 'output_filename', 'infection_type', 'null_networks', 'burnin', 'iteration'], {'truth': 'truth', 'verbose': ... |
import os
import random as rn
def clear(): return os.system('cls')
lines = [x.replace('\n', '') for x in tuple(open('words.txt', 'r'))]
clear()
words = lines
char_set = set()
word = ''
word_set = set(word)
word_len = len(word)
trie = 6
score = [0, 0]
def reset():
x = rn.randint(0, len(words) - 1)
global ... | [
"os.system"
] | [((52, 68), 'os.system', 'os.system', (['"""cls"""'], {}), "('cls')\n", (61, 68), False, 'import os\n')] |
import os
import sys
import fcntl
fh=0
def run_once():
global fh
fh=open(os.path.realpath(__file__),'r')
try:
fcntl.flock(fh,fcntl.LOCK_EX|fcntl.LOCK_NB)
except:
os._exit(0)
run_once()
| [
"os.path.realpath",
"os._exit",
"fcntl.flock"
] | [((81, 107), 'os.path.realpath', 'os.path.realpath', (['__file__'], {}), '(__file__)\n', (97, 107), False, 'import os\n'), ((130, 176), 'fcntl.flock', 'fcntl.flock', (['fh', '(fcntl.LOCK_EX | fcntl.LOCK_NB)'], {}), '(fh, fcntl.LOCK_EX | fcntl.LOCK_NB)\n', (141, 176), False, 'import fcntl\n'), ((194, 205), 'os._exit', '... |
import pytest
import asyncio
@pytest.mark.asyncio
async def test_faulty_setup(Player):
p = Player.from_description("videotestsrc ! faulty ! fakesink")
await p.play()
await asyncio.sleep(5)
await p.stop() | [
"asyncio.sleep"
] | [((186, 202), 'asyncio.sleep', 'asyncio.sleep', (['(5)'], {}), '(5)\n', (199, 202), False, 'import asyncio\n')] |
# Library imports
from flask import Flask, request, make_response, Response
from flask_cors import CORS
import json
import os
import sys
# Add James to path
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
# Project imports
from api.jamesClasses import inputCorpus
from api.jamesConfig import cfg
from api.jam... | [
"api.jamesClasses.inputCorpus",
"flask.request.files.get",
"json.loads",
"flask_cors.CORS",
"flask.Flask",
"json.dumps",
"api.jamesCSV.makeCSV",
"api.jamesMain.process",
"os.path.dirname",
"flask.make_response",
"api.jamesPreProcessing.separateSentences"
] | [((457, 472), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (462, 472), False, 'from flask import Flask, request, make_response, Response\n'), ((480, 489), 'flask_cors.CORS', 'CORS', (['app'], {}), '(app)\n', (484, 489), False, 'from flask_cors import CORS\n'), ((189, 214), 'os.path.dirname', 'os.path.dir... |
from os import name
from django.shortcuts import render,redirect
# Create your views here.
# from django.contrib.auth.forms import UserCreationForm
from django.contrib import messages
from .forms import UserRegisterForm,UserUpdateForm,ProfileUpdateForm
from django.contrib.auth.decorators import login_required
# from... | [
"django.shortcuts.render",
"django.shortcuts.redirect",
"django.contrib.messages.success"
] | [((398, 435), 'django.shortcuts.render', 'render', (['request', '"""neighapp/base.html"""'], {}), "(request, 'neighapp/base.html')\n", (404, 435), False, 'from django.shortcuts import render, redirect\n'), ((922, 972), 'django.shortcuts.render', 'render', (['request', '"""neighapp/register.html"""', 'context'], {}), "(... |
import matplotlib.pyplot as plt
import matplotlib
from matplotlib import animation
import seaborn as sns
import numpy as np
import cmocean
import os
from mpl_toolkits.axes_grid1 import AxesGrid
from mpl_toolkits.axes_grid1 import make_axes_locatable
import scipy
import scipy.ndimage
from scipy.stats import norm
import ... | [
"matplotlib.pyplot.pcolormesh",
"numpy.array",
"scipy.ndimage.gaussian_filter",
"numpy.sin",
"matplotlib.pyplot.imshow",
"matplotlib.pyplot.contourf",
"seaborn.set",
"matplotlib.pyplot.close",
"matplotlib.pyplot.contour",
"numpy.linspace",
"os.path.isdir",
"matplotlib.pyplot.clabel",
"numpy.... | [((2947, 2993), 'scipy.ndimage.gaussian_filter', 'scipy.ndimage.gaussian_filter', (['V'], {'sigma': 'sigVal'}), '(V, sigma=sigVal)\n', (2976, 2993), False, 'import scipy\n'), ((3053, 3099), 'scipy.ndimage.gaussian_filter', 'scipy.ndimage.gaussian_filter', (['W'], {'sigma': 'sigVal'}), '(W, sigma=sigVal)\n', (3082, 3099... |
from creature import *
from nn_model import model_simple_predator
class Predator(Creature):
def __init__(self,starting_pos=[0,0],
speed=np.random.randint(10,20),
size=np.random.randint(1,10),
sense = np.random.uniform(0,20),
weights_food = np.random.uniform(-1,1,(2,6))):
super(Predator,self).__i... | [
"nn_model.model_simple_predator"
] | [((395, 430), 'nn_model.model_simple_predator', 'model_simple_predator', (['weights_food'], {}), '(weights_food)\n', (416, 430), False, 'from nn_model import model_simple_predator\n')] |
# encoding: utf-8
# Copyright 2011 Tree.io Limited
# This file is part of Treeio.
# License www.tree.io/license
"""
Project management models
"""
from django.db import models
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from treeio.core.models import Object, User
from... | [
"django.db.models.TextField",
"django.db.models.ForeignKey",
"django.db.models.IntegerField",
"django.db.models.ManyToManyField",
"django.core.urlresolvers.reverse",
"django.db.models.BooleanField",
"django.utils.translation.ugettext",
"datetime.datetime.now",
"django.db.models.DateTimeField",
"da... | [((482, 514), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(255)'}), '(max_length=255)\n', (498, 514), False, 'from django.db import models\n'), ((528, 602), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""self"""'], {'blank': '(True)', 'null': '(True)', 'related_name': '"""child_set... |
# <NAME> <<EMAIL>>
# Seg 14 Mar 2011 21:46:55 BRT
import logging, os, zc.buildout
class CreateSymbolicLinks:
"""
Buildout recipe for create dir and link modules. Use as:
[buildout]
parts =
django
tipfy
[django]
recipe = recipes:ln
target = /home/carlo/django/trunk/django
directory = app/lib/dist/django... | [
"logging.getLogger",
"os.path.exists",
"os.readlink",
"os.path.join",
"os.symlink",
"os.path.realpath",
"os.path.dirname",
"os.unlink"
] | [((1774, 1797), 'logging.getLogger', 'logging.getLogger', (['name'], {}), '(name)\n', (1791, 1797), False, 'import logging, os, zc.buildout\n'), ((559, 587), 'logging.getLogger', 'logging.getLogger', (['self.name'], {}), '(self.name)\n', (576, 587), False, 'import logging, os, zc.buildout\n'), ((1202, 1227), 'os.path.e... |
from django.shortcuts import render,redirect,HttpResponse
from django.contrib.auth.decorators import login_required
from django.urls import reverse
from .forms import NewsForm
from .models import News
from django.contrib import messages
from RoboClub.decorators import has_role_head_or_coordinator
from django.template.l... | [
"django.shortcuts.render",
"django.contrib.messages.info",
"django.shortcuts.redirect",
"django.contrib.messages.success",
"django.core.mail.EmailMessage",
"django.contrib.auth.models.User.objects.all",
"django.template.loader.render_to_string"
] | [((754, 798), 'django.shortcuts.render', 'render', (['request', '"""news/notice.html"""', 'context'], {}), "(request, 'news/notice.html', context)\n", (760, 798), False, 'from django.shortcuts import render, redirect, HttpResponse\n'), ((945, 997), 'django.shortcuts.render', 'render', (['request', '"""news/notice_colle... |
from websocket import WebSocket
from pymongo import MongoClient
import json
import re
#preventing eval mistakes
true = True
false = False
null = None
#connecting to db for posts and blockchain websocket
db = MongoClient().golos
ws = WebSocket()
ws.connect('wss://api.golos.cf')
print('Sending for 100')
#Sending quer... | [
"re.sub",
"pymongo.MongoClient",
"json.dumps",
"websocket.WebSocket"
] | [((235, 246), 'websocket.WebSocket', 'WebSocket', ([], {}), '()\n', (244, 246), False, 'from websocket import WebSocket\n'), ((210, 223), 'pymongo.MongoClient', 'MongoClient', ([], {}), '()\n', (221, 223), False, 'from pymongo import MongoClient\n'), ((354, 461), 'json.dumps', 'json.dumps', (["{'id': 6, 'method': 'get_... |
'''
Description:
Given an array A of integers, return true if and only if it is a valid mountain array.
Recall that A is a mountain array if and only if:
A.length >= 3
There exists some i with 0 < i < A.length - 1 such that:
A[0] < A[1] < ... A[i-1] < A[i]
A[i] > A[i+1] > ... > A[A.length - 1]
Example 1:
Input... | [
"collections.namedtuple"
] | [((2007, 2042), 'collections.namedtuple', 'namedtuple', (['"""TestEntry"""', '"""sequence"""'], {}), "('TestEntry', 'sequence')\n", (2017, 2042), False, 'from collections import namedtuple\n')] |
from typing import TypeVar, Generic, Iterable, Tuple
T = TypeVar('T')
class ImmutableSequence(Generic[T]):
def __init__(self, items: Iterable[T]):
self._items: Tuple[T] = tuple(items)
def __eq__(self, other) -> bool:
if not isinstance(other, ImmutableSequence):
return False
... | [
"typing.TypeVar"
] | [((58, 70), 'typing.TypeVar', 'TypeVar', (['"""T"""'], {}), "('T')\n", (65, 70), False, 'from typing import TypeVar, Generic, Iterable, Tuple\n')] |
#!/usr/bin/env python3
"""
ROS component that implement a ball detector
"""
# Import of libraries
import sys
import time
import numpy as np
from scipy.ndimage import filters
import imutils
import cv2
import roslib
import rospy
from sensor_msgs.msg import CompressedImage
from sensoring.srv import DetectImage,Dete... | [
"rospy.init_node",
"cv2.imshow",
"cv2.destroyAllWindows",
"cv2.imdecode",
"cv2.erode",
"rospy.Service",
"imutils.grab_contours",
"rospy.spin",
"numpy.fromstring",
"rospy.Subscriber",
"cv2.waitKey",
"cv2.minEnclosingCircle",
"sensoring.srv.DetectImageResponse",
"cv2.circle",
"cv2.cvtColor... | [((5511, 5534), 'cv2.destroyAllWindows', 'cv2.destroyAllWindows', ([], {}), '()\n', (5532, 5534), False, 'import cv2\n'), ((1227, 1276), 'rospy.init_node', 'rospy.init_node', (['"""image_detector"""'], {'anonymous': '(True)'}), "('image_detector', anonymous=True)\n", (1242, 1276), False, 'import rospy\n'), ((1361, 1466... |
import logging
import datetime
from concurrent.futures import ThreadPoolExecutor
thread_pool = ThreadPoolExecutor()
def debug():
logger = logging.getLogger('discord')
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename=f'Logs/{datetime.date.today()}-debug.log', encoding='utf-8')
han... | [
"logging.getLogger",
"concurrent.futures.ThreadPoolExecutor",
"logging.Formatter",
"datetime.datetime.now",
"datetime.date.today"
] | [((96, 116), 'concurrent.futures.ThreadPoolExecutor', 'ThreadPoolExecutor', ([], {}), '()\n', (114, 116), False, 'from concurrent.futures import ThreadPoolExecutor\n'), ((145, 173), 'logging.getLogger', 'logging.getLogger', (['"""discord"""'], {}), "('discord')\n", (162, 173), False, 'import logging\n'), ((466, 494), '... |
from model.user_form import UserForm
import random
import string
# def random_string(prefix, maxlen):
# symbols = string.ascii_letters + string.digits + " " * 10
# return prefix + "".join([random.choice(symbols) for i in range(random.randrange(maxlen))])
#
#
# testdata =[
# UserForm(firstname=random_strin... | [
"model.user_form.UserForm"
] | [((714, 834), 'model.user_form.UserForm', 'UserForm', ([], {'firstname': '"""firstname"""', 'lastname': '"""lastname"""', 'middlename': '"""miDname"""', 'nickname': '"""nickname"""', 'homepage': '"""homePage"""'}), "(firstname='firstname', lastname='lastname', middlename='miDname',\n nickname='nickname', homepage='h... |
# project/tests/test_users.py
import json
from project.tests.base import BaseTestCase
from project import create_app
app = create_app()
class TestSendersService(BaseTestCase):
"""Tests for the Users Service."""
def test_all_senders(self):
"""Ensure get all senders behaves correctly."""
wi... | [
"project.create_app"
] | [((127, 139), 'project.create_app', 'create_app', ([], {}), '()\n', (137, 139), False, 'from project import create_app\n')] |
from django.test import TestCase
from django.core.urlresolvers import reverse
from http import HTTPStatus
from django.contrib.auth.models import Group
class SurveyRenderTestCase(TestCase):
@classmethod
def setUpTestData(cls):
Group.objects.create(name='admin')
def setUp(self):
pass
clas... | [
"django.core.urlresolvers.reverse",
"django.contrib.auth.models.Group.objects.create"
] | [((244, 278), 'django.contrib.auth.models.Group.objects.create', 'Group.objects.create', ([], {'name': '"""admin"""'}), "(name='admin')\n", (264, 278), False, 'from django.contrib.auth.models import Group\n'), ((460, 504), 'django.core.urlresolvers.reverse', 'reverse', (['"""well_detail"""'], {'kwargs': "{'pk': '123'}"... |
import numpy as np
import openpnm as op
from porespy.filters import trim_nonpercolating_paths
import collections
def tortuosity(im, axis, return_im=False, **kwargs):
r"""
Calculates tortuosity of given image in specified direction
Parameters
----------
im : ND-image
The binary image to an... | [
"numpy.prod",
"openpnm.utils.toc",
"openpnm.phases.Water",
"openpnm.utils.tic",
"collections.namedtuple",
"numpy.allclose",
"numpy.reshape",
"porespy.filters.trim_nonpercolating_paths",
"numpy.zeros",
"openpnm.algorithms.FickianDiffusion",
"openpnm.network.CubicTemplate"
] | [((1416, 1480), 'porespy.filters.trim_nonpercolating_paths', 'trim_nonpercolating_paths', (['im'], {'inlet_axis': 'axis', 'outlet_axis': 'axis'}), '(im, inlet_axis=axis, outlet_axis=axis)\n', (1441, 1480), False, 'from porespy.filters import trim_nonpercolating_paths\n'), ((1819, 1867), 'openpnm.network.CubicTemplate',... |
import unittest
import numpy
from oo_trees.dataset import *
from oo_trees.decision_tree import *
from oo_trees.attribute import *
class TestDecisionTree(unittest.TestCase):
def test_classification(self):
X = numpy.array([[0, 1], [0, 0], [1, 0], [1, 1]])
y = numpy.array(['H', 'H', 'H', 'T'])
... | [
"numpy.array"
] | [((221, 266), 'numpy.array', 'numpy.array', (['[[0, 1], [0, 0], [1, 0], [1, 1]]'], {}), '([[0, 1], [0, 0], [1, 0], [1, 1]])\n', (232, 266), False, 'import numpy\n'), ((279, 312), 'numpy.array', 'numpy.array', (["['H', 'H', 'H', 'T']"], {}), "(['H', 'H', 'H', 'T'])\n", (290, 312), False, 'import numpy\n'), ((1039, 1067)... |
#!/usr/local/bin/python
from sprint import sprint as print
import string
import uuid
import basics
import config
import useful
# ------ user editor
def print_users(pif):
table_info = pif.dbh.table_info['user']
entries = []
for user in pif.dbh.fetch_users():
user['user_id'] = '<a href="user.cgi... | [
"useful.generate_token",
"useful.SimpleError",
"useful.bit_list",
"basics.process_command_list",
"uuid.uuid4",
"sprint.sprint",
"useful.warn",
"useful.simple_process",
"useful.Redirect"
] | [((5222, 5247), 'useful.generate_token', 'useful.generate_token', (['(10)'], {}), '(10)\n', (5243, 5247), False, 'import useful\n'), ((5996, 6007), 'sprint.sprint', 'print', (['user'], {}), '(user)\n', (6001, 6007), True, 'from sprint import sprint as print\n'), ((6563, 6619), 'useful.simple_process', 'useful.simple_pr... |
import tensorflow as tf # for tf libs
import pathlib # for giving path of the images
# a closs to wrap dataset functions
class LoadImages:
def __init__(self, data_path):
# assign a data path to all the libs
self.__data_root = pathlib.Path(data_path)
# def a function to process data
def _... | [
"tensorflow.data.Dataset.zip",
"tensorflow.data.Dataset.from_tensor_slices",
"pathlib.Path",
"tensorflow.image.resize",
"tensorflow.io.read_file",
"tensorflow.image.decode_image"
] | [((249, 272), 'pathlib.Path', 'pathlib.Path', (['data_path'], {}), '(data_path)\n', (261, 272), False, 'import pathlib\n'), ((401, 428), 'tensorflow.io.read_file', 'tf.io.read_file', (['image_data'], {}), '(image_data)\n', (416, 428), True, 'import tensorflow as tf\n'), ((453, 485), 'tensorflow.image.decode_image', 'tf... |
#!/usr/bin/env python3
from setuptools import find_packages, setup
VERSION = '0.0.3'
PYTHON_REQUIRES = '3.8'
packagedata = {
'include_package_data': True,
'name': "snowshu",
'version': VERSION,
'author': "Health Union Data Team",
'author_email': '<EMAIL>',
'url': 'https://snowshu.readthedocs.... | [
"setuptools.find_packages",
"setuptools.setup"
] | [((1209, 1229), 'setuptools.setup', 'setup', ([], {}), '(**packagedata)\n', (1214, 1229), False, 'from setuptools import find_packages, setup\n'), ((674, 706), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['tests']"}), "(exclude=['tests'])\n", (687, 706), False, 'from setuptools import find_packages, ... |
from ivy import ivy_module as im
from ivy.ivy_compiler import ivy_from_string
from ivy.tk_ui import new_ui
from ivy import ivy_utils as iu
prog = """#lang ivy1.6
type t
individual x(X:t) : t
object foo(me:t) = {
after init {
x(me) := me;
assert false
}
}
isolate iso_foo(me:t) = foo(me) wit... | [
"ivy.ivy_module.Module",
"ivy.tk_ui.new_ui",
"ivy.ivy_compiler.ivy_from_string",
"ivy.ivy_utils.set_parameters"
] | [((339, 350), 'ivy.ivy_module.Module', 'im.Module', ([], {}), '()\n', (348, 350), True, 'from ivy import ivy_module as im\n'), ((356, 447), 'ivy.ivy_utils.set_parameters', 'iu.set_parameters', (["{'mode': 'induction', 'isolate': 'iso_foo', 'show_compiled': 'true'}"], {}), "({'mode': 'induction', 'isolate': 'iso_foo',\n... |
#
# Copyright 2017 Import.io
#
# 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, ... | [
"logging.getLogger",
"os.path.exists",
"csv.DictReader",
"datetime.datetime.now",
"json.dump"
] | [((704, 731), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (721, 731), False, 'import logging\n'), ((4582, 4606), 'csv.DictReader', 'csv.DictReader', (['csv_file'], {}), '(csv_file)\n', (4596, 4606), False, 'import csv\n'), ((5767, 5798), 'os.path.exists', 'os.path.exists', (['self._jso... |
#!/usr/bin/env python
import glob
import os
import shutil
import subprocess
import uuid
def renameFiles(tooldir, dadir, fromnames, toname):
"Recursively replace file names and contents."
tooldir = os.path.join('..', tooldir)
os.chdir(dadir)
for fromname in fromnames:
fromspaced = "".join([x if x.islower() else ... | [
"os.rename",
"shutil.ignore_patterns",
"os.path.join",
"os.chdir",
"uuid.uuid1",
"os.path.isdir",
"subprocess.call",
"sys.exit",
"glob.glob",
"os.remove"
] | [((201, 228), 'os.path.join', 'os.path.join', (['""".."""', 'tooldir'], {}), "('..', tooldir)\n", (213, 228), False, 'import os\n'), ((230, 245), 'os.chdir', 'os.chdir', (['dadir'], {}), '(dadir)\n', (238, 245), False, 'import os\n'), ((1167, 1181), 'glob.glob', 'glob.glob', (['"""*"""'], {}), "('*')\n", (1176, 1181), ... |
import json
from automator_class import Automator
# fetch('https://jsonplaceholder.typicode.com/posts/1')
# .then(res => res.json())
# .then(console.log)
if __name__ == "__main__":
url = "https://jsonplaceholder.typicode.com/posts/1"
automator = Automator()
automator.start_html_session()
res_sta... | [
"automator_class.Automator"
] | [((262, 273), 'automator_class.Automator', 'Automator', ([], {}), '()\n', (271, 273), False, 'from automator_class import Automator\n')] |
import unittest
import hashids
import time
import os
hashid = hashids.Hashids()
__all__ = ['user_tester', 'NormTestCase']
os.environ['NORM_DATA_STORAGE_ROOT'] = 'data'
os.environ['NORM_DB_PATH'] = 'norm/db/norm.db'
from norm.config import session
def user_tester():
from norm.models.user import User
tester... | [
"norm.config.session.add",
"norm.models.user.User",
"norm.config.session.commit",
"hashids.Hashids",
"time.time",
"norm.config.session.query",
"norm.engine.NormCompiler"
] | [((63, 80), 'hashids.Hashids', 'hashids.Hashids', ([], {}), '()\n', (78, 80), False, 'import hashids\n'), ((490, 569), 'norm.models.user.User', 'User', ([], {'username': '"""tester"""', 'first_name': '"""tester"""', 'last_name': '"""norm"""', 'email': '"""<EMAIL>"""'}), "(username='tester', first_name='tester', last_na... |
import numpy as np
k_i = np.array([0.20, 0.22, 0.78, 0.80,
0.30, 0.32, 0.96, 1.00,
1.20, 1.43, 1.80, 1.88,
0.40, 0.50, 3.24, 3.50,
0.38, 0.43, 2.24, 4.90,
0.40, 0.44, 1.22, 4.00,
0.39, 0.44, 0.96, 1.80,
0.39... | [
"numpy.linalg.solve",
"numpy.sqrt",
"numpy.array",
"numpy.linspace",
"numpy.zeros"
] | [((26, 255), 'numpy.array', 'np.array', (['[0.2, 0.22, 0.78, 0.8, 0.3, 0.32, 0.96, 1.0, 1.2, 1.43, 1.8, 1.88, 0.4, 0.5,\n 3.24, 3.5, 0.38, 0.43, 2.24, 4.9, 0.4, 0.44, 1.22, 4.0, 0.39, 0.44, \n 0.96, 1.8, 0.39, 0.45, 0.8, 1.6, 0.4, 0.47, 0.6, 1.6]'], {'dtype': 'float'}), '([0.2, 0.22, 0.78, 0.8, 0.3, 0.32, 0.96, 1... |
'''
A command library help user upload their results to dashboard.
'''
#!/usr/bin/env python
import argparse
from ..file_utils import get_resource_file_path, get_resource_list
from . import cli_constant as cli
def entry(args):
'''Entrance of show resources path and whether resource is cached or not'''
resource_nam... | [
"argparse.ArgumentParser"
] | [((355, 493), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {'prog': '"""cotk resources"""', 'description': '"""check resources site and whether s specific resource cache is available"""'}), "(prog='cotk resources', description=\n 'check resources site and whether s specific resource cache is available'... |
from Bio.Data.IUPACData import protein_letters_3to1_extended
import os
import pandas as pd
import re
import sys
# Note: the 'logging' module does not work with unit tests for some reason, replaced to 'print' for now
# logging.basicConfig(level=logging.DEBUG)
COL__INFO = 'INFO'
def eprint(*a):
"""Print message ... | [
"pandas.Series",
"pandas.read_csv",
"re.match",
"os.path.isfile",
"re.finditer"
] | [((1814, 1874), 'pandas.read_csv', 'pd.read_csv', (['file_name'], {'sep': '"""\t"""', 'skiprows': 'comment_lines_cnt'}), "(file_name, sep='\\t', skiprows=comment_lines_cnt)\n", (1825, 1874), True, 'import pandas as pd\n'), ((5270, 5383), 're.finditer', 're.finditer', (['"""protein_coding\\\\|\\\\d+/\\\\d+\\\\|(?P<nuc_m... |
import os
import shutil
import json
import pandas as pd
import ast
import numpy as np
from utils.read_convergence import plot_convergence, parse, get_cffl_best
fairness_keys = [
'standalone_vs_fedavg_mean',
'standalone_vs_rrdssgd_mean',
'standalone_vs_final_mean',
]
def collect_and_compile_performance(dirnam... | [
"os.listdir",
"os.path.join",
"utils.read_convergence.plot_convergence",
"utils.read_convergence.parse",
"pandas.DataFrame"
] | [((383, 402), 'os.listdir', 'os.listdir', (['dirname'], {}), '(dirname)\n', (393, 402), False, 'import os\n'), ((2500, 2532), 'os.path.join', 'os.path.join', (['dirname', '"""figures"""'], {}), "(dirname, 'figures')\n", (2512, 2532), False, 'import os\n'), ((2553, 2572), 'os.listdir', 'os.listdir', (['dirname'], {}), '... |
#!/usr/bin/python
import sys
import requests
import json
import kerberos
"""
Queries the YARN Job History Server (JHS) for a given jobId and returns the Hive counters
Works with unauthenticated and SPNEGO (Kerberos) authenticated API endpoints
"""
__author__ = "<NAME>"
__copyright__ = "Copyright 2016, <NAME>"
... | [
"json.loads",
"kerberos.authGSSClientInit",
"requests.get",
"sys.stderr.write",
"kerberos.authGSSClientStep",
"kerberos.authGSSClientResponse",
"sys.stdout.write"
] | [((662, 719), 'kerberos.authGSSClientInit', 'kerberos.authGSSClientInit', (["('%s@%s' % (service, hostname))"], {}), "('%s@%s' % (service, hostname))\n", (688, 719), False, 'import kerberos\n'), ((722, 765), 'kerberos.authGSSClientStep', 'kerberos.authGSSClientStep', (['krb_context', '""""""'], {}), "(krb_context, '')\... |
#!/usr/bin/python
# -*- coding: utf8 -*-
"""
Functions and classes for handling next generation sequencing data.
:author: <NAME>
:license: FreeBSD
License
----------
Copyright (c) 2016, <NAME>
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided ... | [
"datetime.date.today"
] | [((3222, 3243), 'datetime.date.today', 'datetime.date.today', ([], {}), '()\n', (3241, 3243), False, 'import datetime\n')] |
import numpy as np
def fit_MRF_pseudolikelihood(adj_exc,adj_inh,y):
'''
Fit a Markov random field using maximum pseudolikelihood estimation,
also known as logistic regression. The conditional probabilities
follow
y_i ~ Logistic(B[0] + B[1] A1_{ij} y_j + A1[2] X_{ij} (1-y_j)
+ B[... | [
"numpy.random.rand",
"numpy.column_stack",
"numpy.array",
"networkx.closeness_centrality",
"networkx.betweenness_centrality",
"numpy.arange",
"networkx.eigenvector_centrality_numpy",
"numpy.mean",
"numpy.multiply",
"networkx.clustering",
"networkx.DiGraph",
"numpy.exp",
"numpy.dot",
"netwo... | [((2585, 2605), 'numpy.random.rand', 'np.random.rand', (['N', '(1)'], {}), '(N, 1)\n', (2599, 2605), True, 'import numpy as np\n'), ((2617, 2637), 'numpy.zeros', 'np.zeros', (['(N, steps)'], {}), '((N, steps))\n', (2625, 2637), True, 'import numpy as np\n'), ((2684, 2712), 'numpy.fill_diagonal', 'np.fill_diagonal', (['... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('wuqian', '0008_wuqianbusiness_image'),
]
operations = [
migrations.CreateModel(
name='UploadImage',
... | [
"django.db.models.ImageField",
"django.db.models.AutoField"
] | [((352, 445), 'django.db.models.AutoField', 'models.AutoField', ([], {'verbose_name': '"""ID"""', 'serialize': '(False)', 'auto_created': '(True)', 'primary_key': '(True)'}), "(verbose_name='ID', serialize=False, auto_created=True,\n primary_key=True)\n", (368, 445), False, 'from django.db import models, migrations\... |
from __future__ import print_function
import numpy as np
import treegp
from treegp_test_helper import timer
from treegp_test_helper import get_correlation_length_matrix
from treegp_test_helper import make_1d_grf
from treegp_test_helper import make_2d_grf
@timer
def test_hyperparameter_search_1d():
optimizer = ['l... | [
"numpy.mean",
"treegp.GPInterpolation",
"treegp.eval_kernel",
"numpy.sqrt",
"numpy.ones_like",
"numpy.testing.assert_allclose",
"treegp_test_helper.make_1d_grf",
"numpy.diag",
"numpy.exp",
"treegp_test_helper.get_correlation_length_matrix",
"numpy.array",
"numpy.linalg.inv",
"numpy.max",
"... | [((3968, 4014), 'treegp_test_helper.get_correlation_length_matrix', 'get_correlation_length_matrix', (['size[n]', 'g1', 'g2'], {}), '(size[n], g1, g2)\n', (3997, 4014), False, 'from treegp_test_helper import get_correlation_length_matrix\n'), ((4030, 4046), 'numpy.linalg.inv', 'np.linalg.inv', (['L'], {}), '(L)\n', (40... |
#!/usr/bin/env python
# *-* coding: utf-8 *-*
from os import path
from setuptools import setup, find_packages
with open('VERSION') as v_file:
version = v_file.read().strip()
def read(fname):
return open(path.join(path.dirname(__file__), fname)).read()
setup(
name='vbox_sdk',
packages=find_packages... | [
"os.path.dirname",
"setuptools.find_packages"
] | [((307, 338), 'setuptools.find_packages', 'find_packages', ([], {'exclude': "['docs']"}), "(exclude=['docs'])\n", (320, 338), False, 'from setuptools import setup, find_packages\n'), ((225, 247), 'os.path.dirname', 'path.dirname', (['__file__'], {}), '(__file__)\n', (237, 247), False, 'from os import path\n')] |
import numpy as np
import pandas as pd
from collections import OrderedDict
import tabulate
del(tabulate.LATEX_ESCAPE_RULES[u'$'])
del(tabulate.LATEX_ESCAPE_RULES[u'\\'])
del(tabulate.LATEX_ESCAPE_RULES[u'{'])
del(tabulate.LATEX_ESCAPE_RULES[u'}'])
del(tabulate.LATEX_ESCAPE_RULES[u'^'])
data = {}
scens = ["SPEAR-SWV"... | [
"numpy.argmin",
"tabulate.tabulate"
] | [((4159, 4228), 'tabulate.tabulate', 'tabulate.tabulate', ([], {'tabular_data': 'table_data', 'tablefmt': '"""latex_booktabs"""'}), "(tabular_data=table_data, tablefmt='latex_booktabs')\n", (4176, 4228), False, 'import tabulate\n'), ((2679, 2696), 'numpy.argmin', 'np.argmin', (['rmse_I'], {}), '(rmse_I)\n', (2688, 2696... |
import numpy as np
from utils import Data
import keras.optimizers
from keras.callbacks import LambdaCallback, ModelCheckpoint
from keras.models import Sequential
from keras.layers import Dense, Embedding, GlobalMaxPooling1D, CuDNNLSTM, Dropout, BatchNormalization, Activation, LSTM
import getopt
import sys
from sklearn.... | [
"keras.layers.CuDNNLSTM",
"getopt.getopt",
"keras.callbacks.ModelCheckpoint",
"sklearn.utils.shuffle",
"keras.models.Sequential",
"utils.Data.Data",
"keras.layers.Activation",
"sys.exit",
"keras.layers.Dense",
"keras.layers.BatchNormalization",
"keras.layers.Dropout"
] | [((1049, 1105), 'utils.Data.Data', 'Data.Data', (['seq_len'], {'hm_char': 'num_char', 'which_text': '"""bible"""'}), "(seq_len, hm_char=num_char, which_text='bible')\n", (1058, 1105), False, 'from utils import Data\n'), ((1354, 1366), 'keras.models.Sequential', 'Sequential', ([], {}), '()\n', (1364, 1366), False, 'from... |
# 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under t... | [
"users_pb2.User",
"threading.Lock",
"os.environ.get",
"time.sleep",
"users_pb2.AddUserResponse",
"random.randint"
] | [((4843, 4877), 'os.environ.get', 'os.environ.get', (['"""GRPC_PORT"""', '(50051)'], {}), "('GRPC_PORT', 50051)\n", (4857, 4877), False, 'import os\n'), ((1548, 1574), 'random.randint', 'random.randint', (['(1)', '_MAX_ID'], {}), '(1, _MAX_ID)\n', (1562, 1574), False, 'import random\n'), ((1921, 1937), 'threading.Lock'... |
#!/usr/bin/python3
import os
import sys
file_dir = os.path.dirname(__file__)
sys.path.append(file_dir)
import io
import logging
import time
import traceback
from flask import Flask, render_template, send_file, Response
from threading import Condition, Lock
from enums import Position
from mymemcache import MemCache... | [
"logging.basicConfig",
"flask.render_template",
"camera_emulation.PiCamera",
"flask.Flask",
"threading.Lock",
"io.BytesIO",
"logging.info",
"mymemcache.MemCache",
"servo.Servo",
"picamera.PiCamera",
"os.path.dirname",
"sys.exc_info",
"traceback.print_tb",
"time.sleep",
"camera_emulation.... | [((53, 78), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (68, 78), False, 'import os\n'), ((79, 104), 'sys.path.append', 'sys.path.append', (['file_dir'], {}), '(file_dir)\n', (94, 104), False, 'import sys\n'), ((421, 460), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'loggi... |
"""Storage registry."""
from typing import Type
from mode.utils.imports import FactoryMapping
from faust.types import StoreT
__all__ = ['by_name', 'by_url']
STORES: FactoryMapping[Type[StoreT]] = FactoryMapping(
memory='faust.stores.memory:Store',
rocksdb='faust.stores.rocksdb:Store',
)
STORES.include_setupto... | [
"mode.utils.imports.FactoryMapping"
] | [((198, 291), 'mode.utils.imports.FactoryMapping', 'FactoryMapping', ([], {'memory': '"""faust.stores.memory:Store"""', 'rocksdb': '"""faust.stores.rocksdb:Store"""'}), "(memory='faust.stores.memory:Store', rocksdb=\n 'faust.stores.rocksdb:Store')\n", (212, 291), False, 'from mode.utils.imports import FactoryMapping... |
# Copyright (C) 2016 <NAME> <<EMAIL>>
# Released under the terms of the BSD license.
import os
import re
import sys
import click
import string
import datetime
import subprocess
from . import __version__
from .remote import get_remote
from .crypto import fernet_encrypt, fernet_decrypt, sha512_hash, digest
from .forma... | [
"click.argument",
"re.compile",
"click.group",
"click.option",
"os.rename",
"os.path.splitext",
"os.path.isfile",
"click.echo",
"datetime.datetime.now",
"os.path.dirname",
"os.path.basename",
"subprocess.call",
"sys.exit",
"weasyprint.HTML",
"re.sub",
"weasyprint.CSS",
"os.remove"
] | [((1098, 1138), 'click.group', 'click.group', ([], {'invoke_without_command': '(True)'}), '(invoke_without_command=True)\n', (1109, 1138), False, 'import click\n'), ((1140, 1216), 'click.option', 'click.option', (['"""-v"""', '"""--version"""'], {'is_flag': '(True)', 'help': '"""Print program version."""'}), "('-v', '-... |
# -*- coding: utf-8 -*-
# Generated by Django 1.11.7 on 2018-12-17 19:55
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('App', '0006_goods_user'),
]
operations = [
migrations.RemoveField(
mode... | [
"django.db.migrations.RemoveField"
] | [((280, 342), 'django.db.migrations.RemoveField', 'migrations.RemoveField', ([], {'model_name': '"""user"""', 'name': '"""phone_number"""'}), "(model_name='user', name='phone_number')\n", (302, 342), False, 'from django.db import migrations\n')] |
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sublime
import sublime_plugin
import LiveReload
import webbrowser
import os
class LiveReloadTest(sublime_plugin.ApplicationCommand):
def run(self):
path = os.path.join(sublime.packages_path(), 'LiveReload', 'web')
file_name = os.path.join(path, 't... | [
"sublime.active_window",
"LiveReload.Plugin.togglePlugin",
"os.path.join",
"LiveReload.Plugin.listPlugins",
"webbrowser.open_new_tab",
"sublime.packages_path"
] | [((299, 330), 'os.path.join', 'os.path.join', (['path', '"""test.html"""'], {}), "(path, 'test.html')\n", (311, 330), False, 'import os\n'), ((339, 385), 'webbrowser.open_new_tab', 'webbrowser.open_new_tab', (["('file://' + file_name)"], {}), "('file://' + file_name)\n", (362, 385), False, 'import webbrowser\n'), ((471... |
# Advent of Code 2019, Day 6
# (c) blu3r4y
import networkx as nx
from aocd.models import Puzzle
from funcy import print_calls
@print_calls
def part1(graph):
checksum = 0
for target in graph.nodes:
checksum += nx.shortest_path_length(graph, "COM", target)
return checksum
@print_calls
def part2(... | [
"networkx.shortest_path_length",
"aocd.models.Puzzle"
] | [((530, 554), 'aocd.models.Puzzle', 'Puzzle', ([], {'year': '(2019)', 'day': '(6)'}), '(year=2019, day=6)\n', (536, 554), False, 'from aocd.models import Puzzle\n'), ((229, 274), 'networkx.shortest_path_length', 'nx.shortest_path_length', (['graph', '"""COM"""', 'target'], {}), "(graph, 'COM', target)\n", (252, 274), T... |
from decimal import Decimal
import json
import logging
from django.shortcuts import render
from django.core.serializers.json import DjangoJSONEncoder
from django.http import (HttpResponse)
from django.views.generic import View
from rest_framework import status
from rest_framework.views import APIView
from api.models i... | [
"django.shortcuts.render",
"logging.getLogger",
"json.dumps",
"api.api.SpotsViewSet",
"decimal.Decimal"
] | [((1887, 1972), 'django.shortcuts.render', 'render', (['request'], {'template_name': '"""frontend/index.html"""', 'context': 'self.response_data'}), "(request, template_name='frontend/index.html', context=self.response_data\n )\n", (1893, 1972), False, 'from django.shortcuts import render\n'), ((837, 851), 'api.api.... |
# -*- coding: utf-8 -*-
"""
.. module:: openzwave.group
This file is part of **python-openzwave** project https://github.com/OpenZWave/python-openzwave.
:platform: Unix, Windows, MacOS X
:sinopsis: openzwave API
.. moduleauthor: bibi21000 aka <NAME> <<EMAIL>>
License : GPL(v3)
**python-openzwave** is free s... | [
"logging.getLogger",
"openzwave.object.ZWaveObject.__init__",
"logging.NullHandler"
] | [((1268, 1298), 'logging.getLogger', 'logging.getLogger', (['"""openzwave"""'], {}), "('openzwave')\n", (1285, 1298), False, 'import logging\n'), ((1317, 1330), 'logging.NullHandler', 'NullHandler', ([], {}), '()\n', (1328, 1330), False, 'from logging import NullHandler\n'), ((1871, 1919), 'openzwave.object.ZWaveObject... |
"""
(C) Copyright 2021 IBM Corp.
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
d... | [
"torch.mul",
"numpy.array",
"fuse.utils.utils_hierarchical_dict.FuseUtilsHierarchicalDict.get",
"torch.nn.functional.interpolate",
"torch.nn.functional.max_pool2d",
"torch.zeros"
] | [((1137, 1158), 'numpy.array', 'np.array', (['input.shape'], {}), '(input.shape)\n', (1145, 1158), True, 'import numpy as np\n'), ((1224, 1257), 'torch.zeros', 'torch.zeros', (['shape'], {'device': 'device'}), '(shape, device=device)\n', (1235, 1257), False, 'import torch\n'), ((4650, 4707), 'fuse.utils.utils_hierarchi... |
from base import assert_case
def test_script_pipeline():
assert_case('scm_pipeline')
| [
"base.assert_case"
] | [((63, 90), 'base.assert_case', 'assert_case', (['"""scm_pipeline"""'], {}), "('scm_pipeline')\n", (74, 90), False, 'from base import assert_case\n')] |
from typing import Optional
import tensorflow as tf
import tensorflow.keras.backend as K
from tensorflow.keras import Model
from tensorflow.keras.layers import Layer
import numpy as np
import rinokeras as rk
from rinokeras.layers import WeightNormDense as Dense
from rinokeras.layers import LayerNorm, Stack
class Ra... | [
"tensorflow.keras.backend.shape",
"numpy.random.random",
"numpy.asarray",
"numpy.isin",
"numpy.max",
"rinokeras.utils.convert_sequence_length_to_sequence_mask",
"numpy.cumsum",
"tensorflow.keras.backend.random_uniform",
"tensorflow.py_func",
"tensorflow.cast",
"numpy.arange"
] | [((1368, 1383), 'tensorflow.keras.backend.shape', 'K.shape', (['inputs'], {}), '(inputs)\n', (1375, 1383), True, 'import tensorflow.keras.backend as K\n'), ((2467, 2517), 'tensorflow.cast', 'tf.cast', (['(token_bert_mask & bert_mask)', 'inputs.dtype'], {}), '(token_bert_mask & bert_mask, inputs.dtype)\n', (2474, 2517),... |
from django.shortcuts import render, redirect
from django.http import HttpResponse
from .models import BoardMember
# Post 추가
from django.core import serializers
from rest_framework.decorators import api_view, permission_classes, authentication_classes
from rest_framework.permissions import IsAuthenticated # 로그인여부 확인
f... | [
"django.shortcuts.render",
"rest_framework.decorators.permission_classes",
"django.http.HttpResponse",
"rest_framework.decorators.authentication_classes",
"django.shortcuts.redirect",
"django.core.serializers.serialize",
"rest_framework.decorators.api_view"
] | [((1197, 1214), 'rest_framework.decorators.api_view', 'api_view', (["['GET']"], {}), "(['GET'])\n", (1205, 1214), False, 'from rest_framework.decorators import api_view, permission_classes, authentication_classes\n'), ((1246, 1284), 'rest_framework.decorators.permission_classes', 'permission_classes', (['(IsAuthenticat... |
#!/usr/bin/python2.6
# Copyright 2011 Google Inc. 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 ... | [
"logging.basicConfig",
"os.path.join",
"unittest.main",
"os.path.isdir",
"ibmperf.HardwarePerformanceCounter",
"random.randint"
] | [((12278, 12318), 'logging.basicConfig', 'logging.basicConfig', ([], {'level': 'logging.DEBUG'}), '(level=logging.DEBUG)\n', (12297, 12318), False, 'import logging\n'), ((12321, 12336), 'unittest.main', 'unittest.main', ([], {}), '()\n', (12334, 12336), False, 'import unittest\n'), ((6431, 6456), 'random.randint', 'ran... |
#!/usr/bin/env python3
from dev_aberto import hello
from babel.dates import format_datetime
from datetime import datetime
import gettext
gettext.install('hello', localedir='locale')
if __name__ == '__main__':
date, name = hello()
date = format_datetime(datetime.strptime(date, '%Y-%m-%dT%H:%M:%SZ'))
print(... | [
"datetime.datetime.strptime",
"gettext.install",
"dev_aberto.hello"
] | [((138, 182), 'gettext.install', 'gettext.install', (['"""hello"""'], {'localedir': '"""locale"""'}), "('hello', localedir='locale')\n", (153, 182), False, 'import gettext\n'), ((228, 235), 'dev_aberto.hello', 'hello', ([], {}), '()\n', (233, 235), False, 'from dev_aberto import hello\n'), ((263, 308), 'datetime.dateti... |
# from __future__ import absolute_import
# from __future__ import division
# from __future__ import print_function
# import _init_paths
# from opts import opts
import os
import json
import cv2
import collections
def xychange(a, w, h):
ans = [(a[0]+a[2]/2)/w, (a[1]+a[3]/2)/h, a[2]/w, a[3]/h]
ret... | [
"json.load",
"collections.defaultdict",
"os.path.join",
"cv2.imread"
] | [((590, 619), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (613, 619), False, 'import collections\n'), ((628, 657), 'collections.defaultdict', 'collections.defaultdict', (['list'], {}), '(list)\n', (651, 657), False, 'import collections\n'), ((474, 491), 'json.load', 'json.load', ([... |
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="iam-permissions-guardrails", # Replace with your own username
version="0.0.3",
author="<NAME>",
author_email="<EMAIL>",
description="IAM Permissions Guardrails module",
long_descripti... | [
"setuptools.find_packages"
] | [((491, 517), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (515, 517), False, 'import setuptools\n')] |
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import os
import sys
from scrapy.cmdline import execute
if __name__ == '__main__':
sys.path.append(os.path.abspath(__file__))
# execute(['scrapy', 'crawl', 'XiLa'])
execute(['scrapy', 'crawl', 'Kuai'])
| [
"os.path.abspath",
"scrapy.cmdline.execute"
] | [((228, 264), 'scrapy.cmdline.execute', 'execute', (["['scrapy', 'crawl', 'Kuai']"], {}), "(['scrapy', 'crawl', 'Kuai'])\n", (235, 264), False, 'from scrapy.cmdline import execute\n'), ((154, 179), 'os.path.abspath', 'os.path.abspath', (['__file__'], {}), '(__file__)\n', (169, 179), False, 'import os\n')] |
from django.utils.translation import ugettext_lazy as _
from django.contrib import messages
from django.contrib.auth import logout as logout_user
from django.contrib.auth.decorators import login_required
from django.contrib.sites.models import Site
from django.shortcuts import render, redirect, get_object_or_404
from ... | [
"django.shortcuts.render",
"django.utils.translation.ugettext_lazy",
"events.models.profiles.Team.objects.filter",
"events.forms.OrganizationForm",
"django.shortcuts.get_object_or_404",
"datetime.datetime.now",
"django.shortcuts.redirect",
"events.forms.NewCommonEventForm",
"events.models.events.Com... | [((919, 965), 'django.shortcuts.get_object_or_404', 'get_object_or_404', (['Organization'], {'slug': 'org_slug'}), '(Organization, slug=org_slug)\n', (936, 965), False, 'from django.shortcuts import render, redirect, get_object_or_404\n'), ((1585, 1644), 'django.shortcuts.render', 'render', (['request', '"""get_togethe... |
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import glob as glb
import os
import cv2
import pickle
#################################################################################################################
def create_new_folder (new_dir):
if not os.path.exists(new_dir... | [
"numpy.copy",
"os.path.exists",
"pickle.dump",
"os.makedirs",
"cv2.getPerspectiveTransform",
"matplotlib.image.imread",
"numpy.float32",
"glob.glob"
] | [((1438, 1457), 'glob.glob', 'glb.glob', (['"""./*.jpg"""'], {}), "('./*.jpg')\n", (1446, 1457), True, 'import glob as glb\n'), ((878, 890), 'numpy.copy', 'np.copy', (['src'], {}), '(src)\n', (885, 890), True, 'import numpy as np\n'), ((1066, 1103), 'cv2.getPerspectiveTransform', 'cv2.getPerspectiveTransform', (['src',... |
from django.db.models import Avg, Count
from prof_education.regions.models import Region
from prof_education.students.models import Student
from ..column_sets import ColumnFormats, ColumnSet, ColumnSetItem
from ..columns import AggrColumn, IntegerAggrColumn
from ..filters import ModelChoicesFilter, NumberFilter
from ... | [
"django.db.models.Count",
"prof_education.students.models.Student.objects.with_age",
"django.db.models.Avg"
] | [((728, 738), 'django.db.models.Count', 'Count', (['"""*"""'], {}), "('*')\n", (733, 738), False, 'from django.db.models import Avg, Count\n'), ((824, 834), 'django.db.models.Avg', 'Avg', (['"""age"""'], {}), "('age')\n", (827, 834), False, 'from django.db.models import Avg, Count\n'), ((1705, 1715), 'django.db.models.... |
#!/usr/bin/env python3
"""Application for managing the PyLith build environment.
"""
import sys
import os
import argparse
import subprocess
import configparser
class Package():
"""Base class for software package.
"""
NAME = None
CLONE_RECURSIVE = False
def __init__(self, config):
if not ... | [
"os.path.exists",
"configparser.ConfigParser",
"argparse.ArgumentParser",
"subprocess.run",
"os.path.join",
"os.path.isfile"
] | [((1152, 1211), 'os.path.join', 'os.path.join', (["self.base['build_dir']", 'build_arch', 'self.NAME'], {}), "(self.base['build_dir'], build_arch, self.NAME)\n", (1164, 1211), False, 'import os\n'), ((1322, 1372), 'os.path.join', 'os.path.join', (["self.base['install_dir']", 'build_arch'], {}), "(self.base['install_dir... |
from django import forms
from django.forms import ModelForm, CharField
from ckeditor.widgets import CKEditorWidget
from .models import URP, Application
class URPCreateForm(ModelForm):
"""Form for URP creation"""
description = CharField(widget=CKEditorWidget())
class Meta:
model = URP
fiel... | [
"django.forms.ChoiceField",
"ckeditor.widgets.CKEditorWidget",
"django.forms.CharField"
] | [((748, 759), 'django.forms.CharField', 'CharField', ([], {}), '()\n', (757, 759), False, 'from django.forms import ModelForm, CharField\n'), ((954, 1009), 'django.forms.ChoiceField', 'forms.ChoiceField', ([], {'widget': 'forms.Select', 'choices': 'ACTIONS'}), '(widget=forms.Select, choices=ACTIONS)\n', (971, 1009), Fa... |
import logging
from collections import OrderedDict
from copy import deepcopy
from datetime import datetime, timedelta
from pathlib import Path
from time import sleep
import cv2
import numpy as np
import pandas as pd
from PyQt5.QtCore import Qt, QTimer, pyqtSlot
from PyQt5.QtGui import QColor, QImage, QPixmap
from PyQt... | [
"cv2.rectangle",
"PyQt5.QtCore.QTimer.singleShot",
"datetime.datetime.strptime",
"pathlib.Path",
"PyQt5.QtGui.QColor",
"PyQt5.QtCore.pyqtSlot",
"PyQt5.QtGui.QImage",
"PyQt5.QtWidgets.QMessageBox.information",
"numpy.array",
"PyQt5.QtWidgets.QMessageBox.question",
"PyQt5.QtWidgets.QMessageBox.abo... | [((10100, 10110), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (10108, 10110), False, 'from PyQt5.QtCore import Qt, QTimer, pyqtSlot\n'), ((10451, 10461), 'PyQt5.QtCore.pyqtSlot', 'pyqtSlot', ([], {}), '()\n', (10459, 10461), False, 'from PyQt5.QtCore import Qt, QTimer, pyqtSlot\n'), ((10793, 10803), 'PyQt5.Q... |
from math import floor
from math import ceil
hours_needed = int(input())
days_for_work = int(input())
overtime_workers = int(input())
normal_shift = 8
learn_time = days_for_work - days_for_work * 10 / 100
hours_for_work = learn_time * normal_shift
overtime = overtime_workers * (2 * days_for_work)
all_time = hours_for... | [
"math.floor"
] | [((398, 413), 'math.floor', 'floor', (['all_time'], {}), '(all_time)\n', (403, 413), False, 'from math import floor\n')] |
"""Test the :class:`~polymatheia.data.reader.LocalReader`."""
import os
import pytest
from lxml.etree import XMLSyntaxError
from polymatheia.data.reader import XMLReader
def test_xml_reader():
"""Test that the XML local reading works."""
count = 0
for record in XMLReader('tests/fixtures/xml_reader_test'... | [
"polymatheia.data.reader.XMLReader",
"pytest.raises",
"os.unlink"
] | [((278, 321), 'polymatheia.data.reader.XMLReader', 'XMLReader', (['"""tests/fixtures/xml_reader_test"""'], {}), "('tests/fixtures/xml_reader_test')\n", (287, 321), False, 'from polymatheia.data.reader import XMLReader\n'), ((819, 862), 'polymatheia.data.reader.XMLReader', 'XMLReader', (['"""tests/fixtures/xml_reader_te... |
from app.infrastructure.repositories.camera.capture import CameraCapture
def main():
CameraCapture().run()
| [
"app.infrastructure.repositories.camera.capture.CameraCapture"
] | [((91, 106), 'app.infrastructure.repositories.camera.capture.CameraCapture', 'CameraCapture', ([], {}), '()\n', (104, 106), False, 'from app.infrastructure.repositories.camera.capture import CameraCapture\n')] |
from fipu_face import retina_face as rf
import binascii
import time
from fipu_face.utils import *
from fipu_face.img_utils import *
from exceptions.image_exception import *
from fipu_face.img_config import *
from fipu_face.segmentation.bg_segmentation import get_non_white_bg_pct
# from fipu_face.facial_landmarks.emoti... | [
"fipu_face.segmentation.bg_segmentation.get_non_white_bg_pct"
] | [((8062, 8089), 'fipu_face.segmentation.bg_segmentation.get_non_white_bg_pct', 'get_non_white_bg_pct', (['frame'], {}), '(frame)\n', (8082, 8089), False, 'from fipu_face.segmentation.bg_segmentation import get_non_white_bg_pct\n'), ((8524, 8551), 'fipu_face.segmentation.bg_segmentation.get_non_white_bg_pct', 'get_non_w... |
import numpy as np
from paz.abstract import Processor
from paz.backend.keypoints import project_points3D
from paz.backend.keypoints import build_cube_points3D
from paz.backend.image import draw_cube
from paz.processors import DrawBoxes3D
class DrawBoxes3D(Processor):
def __init__(self, camera, class_to_dimensions... | [
"paz.backend.keypoints.project_points3D",
"paz.backend.keypoints.build_cube_points3D",
"paz.backend.image.draw_cube"
] | [((1404, 1451), 'paz.backend.keypoints.project_points3D', 'project_points3D', (['points3D', 'pose6D', 'self.camera'], {}), '(points3D, pose6D, self.camera)\n', (1420, 1451), False, 'from paz.backend.keypoints import project_points3D\n'), ((1505, 1557), 'paz.backend.image.draw_cube', 'draw_cube', (['image', 'points2D'],... |
import scrapy
from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from emails.items import ImageItem
class EmailTemplateSpire(CrawlSpider):
name = "email"
start_urls = [
'https://reallygoodemails.com/category/inaugural/welcome/',
]
rules = [
R... | [
"scrapy.linkextractors.LinkExtractor"
] | [((324, 527), 'scrapy.linkextractors.LinkExtractor', 'LinkExtractor', ([], {'allow': "('inaugural\\\\/welcome\\\\/[a-z-]+\\\\/', 'inaugural\\\\/welcome\\\\/page/\\\\D+\\\\/')", 'unique': '(True)', 'allow_domains': '"""reallygoodemails.com"""', 'restrict_css': "('.entry_hover', '.page-numbers')"}), "(allow=('inaugural\\... |
from matplotlib import pyplot as plt
from collections import deque
from threading import Lock, Thread
import myo
import numpy as np
import serial
import csv
import re
import time
from datetime import datetime
## serial port and rate for reading F/T sensor data
SERIAL_PORT = 'COM1'
SERIAL_RATE = 1152... | [
"csv.DictWriter",
"collections.deque",
"threading.Lock",
"time.sleep",
"datetime.datetime.now",
"myo.Hub",
"serial.Serial",
"myo.init",
"re.sub",
"time.time"
] | [((804, 857), 'myo.init', 'myo.init', ([], {'sdk_path': '"""E:\\\\sensors\\\\myo-sdk-win-0.9.0\\\\"""'}), "(sdk_path='E:\\\\sensors\\\\myo-sdk-win-0.9.0\\\\')\n", (812, 857), False, 'import myo\n'), ((899, 908), 'myo.Hub', 'myo.Hub', ([], {}), '()\n', (906, 908), False, 'import myo\n'), ((952, 991), 'serial.Serial', 's... |
"""JUnit metric collector."""
from datetime import datetime
from dateutil.parser import parse
from base_collectors import SourceUpToDatenessCollector, XMLFileSourceCollector
from collector_utilities.functions import parse_source_response_xml
from collector_utilities.type import Response
class JUnitSourceUpToDatene... | [
"datetime.datetime.now",
"collector_utilities.functions.parse_source_response_xml"
] | [((603, 638), 'collector_utilities.functions.parse_source_response_xml', 'parse_source_response_xml', (['response'], {}), '(response)\n', (628, 638), False, 'from collector_utilities.functions import parse_source_response_xml\n'), ((1476, 1490), 'datetime.datetime.now', 'datetime.now', ([], {}), '()\n', (1488, 1490), F... |
# -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.model.document import Document
from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_ta... | [
"frappe.db.get_value",
"erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_charges_template.valdiate_taxes_and_charges_template"
] | [((464, 505), 'erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_charges_template.valdiate_taxes_and_charges_template', 'valdiate_taxes_and_charges_template', (['self'], {}), '(self)\n', (499, 505), False, 'from erpnext.accounts.doctype.sales_taxes_and_charges_template.sales_taxes_and_charges_te... |
from django.db import models
from django.utils.translation import gettext_lazy as _
from wagtail.admin.edit_handlers import FieldPanel, TabbedInterface, ObjectList
from .state import StateCampaignPageBase
from areas.widgets.place_widgets import PlaceChooser
from offices.widgets import OfficeTypeChooser, LocalOfficeCh... | [
"offices.widgets.OfficeTypeChooser",
"django.db.models.ForeignKey",
"django.utils.translation.gettext_lazy",
"offices.widgets.LocalOfficeChooser",
"areas.widgets.place_widgets.PlaceChooser",
"wagtail.admin.edit_handlers.ObjectList"
] | [((397, 492), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""areas.Place"""'], {'on_delete': 'models.PROTECT', 'related_name': '"""local_campaigns"""'}), "('areas.Place', on_delete=models.PROTECT, related_name=\n 'local_campaigns')\n", (414, 492), False, 'from django.db import models\n'), ((921, 932), 'dj... |
import RPi.GPIO as GPIO
import time
from PololuDriver import PololuDriver
res = 1.8
step_amount = 1
class Stepper():
def __init__(self):
self.Motor1 = PololuDriver(dir_pin=26, step_pin=20, enable_pin=21)
def step_num(self, num, dir='forward'):
self.Motor1.TurnStep(Dir=dir, steps=num, stepdela... | [
"PololuDriver.PololuDriver"
] | [((165, 217), 'PololuDriver.PololuDriver', 'PololuDriver', ([], {'dir_pin': '(26)', 'step_pin': '(20)', 'enable_pin': '(21)'}), '(dir_pin=26, step_pin=20, enable_pin=21)\n', (177, 217), False, 'from PololuDriver import PololuDriver\n')] |
import hyperopt
import csv
import json
import traceback
import os.path
from pprint import pprint
import datetime
import time
import numpy.random
import threading
import queue
import copy
import tempfile
import random
import subprocess
import concurrent.futures
import tempfile
import functools
import math
import atexit
... | [
"tempfile.TemporaryDirectory",
"hypermax.algorithms.atpe_optimizer.ATPEOptimizer",
"hypermax.algorithms.tpe_optimizer.TPEOptimizer",
"csv.DictReader",
"hypermax.hyperparameter.Hyperparameter",
"subprocess.run",
"hypermax.algorithms.random_search_optimizer.RandomSearchOptimizer",
"time.sleep",
"datet... | [((1155, 1183), 'hypermax.configuration.Configuration', 'Configuration', (['configuration'], {}), '(configuration)\n', (1168, 1183), False, 'from hypermax.configuration import Configuration\n'), ((1487, 1517), 'hypermax.results_analyzer.ResultsAnalyzer', 'ResultsAnalyzer', (['configuration'], {}), '(configuration)\n', ... |
import doddq.helpers as helpers
import numpy as np
from qiskit import QuantumCircuit, QuantumRegister
from qiskit.circuit.library import HGate, PhaseGate, QFT
from typing import Callable
class GeneralizedQPEInfo:
def __init__(self, qr_eval: QuantumRegister, qr_state: QuantumRegister, circuit: QuantumCircuit) -... | [
"qiskit.circuit.library.PhaseGate",
"qiskit.circuit.library.QFT",
"qiskit.circuit.library.HGate",
"doddq.helpers.rand_gaussian_array",
"doddq.helpers.time_evolution_circuit",
"qiskit.QuantumRegister",
"qiskit.QuantumCircuit"
] | [((1836, 1867), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['num_eval_qubits'], {}), '(num_eval_qubits)\n', (1850, 1867), False, 'from qiskit import QuantumCircuit, QuantumRegister\n'), ((2853, 2884), 'qiskit.QuantumCircuit', 'QuantumCircuit', (['num_eval_qubits'], {}), '(num_eval_qubits)\n', (2867, 2884), False, 'fro... |
import numpy as np
import pandas as pd
from .scm import SCM
class DataGenerator:
def generate(self, scm: SCM, n_samples: int, seed: int):
pass
class SimpleDataGenerator(DataGenerator):
def generate(self, scm: SCM, n_samples: int, seed: int):
"""
Generates date according to the given... | [
"numpy.random.normal",
"numpy.zeros",
"numpy.random.seed",
"pandas.DataFrame.from_dict"
] | [((653, 673), 'numpy.random.seed', 'np.random.seed', (['seed'], {}), '(seed)\n', (667, 673), True, 'import numpy as np\n'), ((2057, 2085), 'pandas.DataFrame.from_dict', 'pd.DataFrame.from_dict', (['data'], {}), '(data)\n', (2079, 2085), True, 'import pandas as pd\n'), ((786, 805), 'numpy.zeros', 'np.zeros', (['n_sample... |
import cv2
image = cv2.imread("database-tea-cake/1018-1-a.jpg")
cv2.imshow("palm",image) #to view the palm in python
cv2.waitKey(0)
gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
edges = cv2.Canny(gray,60,65,apertureSize = 3)
cv2.imshow("edges",edges)
cv2.waitKey(0)
edges = cv2.bitwise_not(edges)
cv2.imshow("change ... | [
"cv2.imwrite",
"cv2.imshow",
"cv2.addWeighted",
"cv2.cvtColor",
"cv2.bitwise_not",
"cv2.Canny",
"cv2.waitKey",
"cv2.imread"
] | [((20, 64), 'cv2.imread', 'cv2.imread', (['"""database-tea-cake/1018-1-a.jpg"""'], {}), "('database-tea-cake/1018-1-a.jpg')\n", (30, 64), False, 'import cv2\n'), ((65, 90), 'cv2.imshow', 'cv2.imshow', (['"""palm"""', 'image'], {}), "('palm', image)\n", (75, 90), False, 'import cv2\n'), ((118, 132), 'cv2.waitKey', 'cv2.... |
#!/usr/bin/env python3
import numpy
from rl.agents.policy.policy_agent import PolicyAgent
class Random(PolicyAgent):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
def act(self, state: numpy.ndarray, available_actions: numpy.ndarray):
"""
Uses a uniform rando... | [
"numpy.random.choice"
] | [((644, 682), 'numpy.random.choice', 'numpy.random.choice', (['available_actions'], {}), '(available_actions)\n', (663, 682), False, 'import numpy\n')] |
import PP_Calculator
from pppredict.predict import predict
from util import str_to_dict, mod_convert, add_spaces
from re import findall
from lang_init import Initialization
from get_local import get_sample
import users
import maps
class Commands:
def __init__(self):
pass
''' +====-----------==------... | [
"lang_init.Initialization",
"util.add_spaces",
"users.Users.getStat",
"maps.Maps.addMap",
"get_local.get_sample",
"maps.Maps.getLastNP",
"users.Users.addMapToPushed",
"users.Users.isPushMap",
"maps.Maps.dropMap",
"PP_Calculator.PP_Calculator",
"maps.Maps.getTop",
"pppredict.predict.predict.Pre... | [((4395, 4513), 'PP_Calculator.PP_Calculator', 'PP_Calculator.PP_Calculator', (["arg_list['combo']", 'beatmap_ID', "arg_list['mods']", '(1)', "arg_list['acc']", "arg_list['miss']"], {}), "(arg_list['combo'], beatmap_ID, arg_list['mods'],\n 1, arg_list['acc'], arg_list['miss'])\n", (4422, 4513), False, 'import PP_Cal... |
# ---------------------------------------------------
# Intermediate Python - Loops
# 22 set 2020
# VNTBJR
# ---------------------------------------------------
#
# Load packages
library(reticulate)
# while loop -------------------------------------------
# Basic while loop
# Initialize offset
offset = 8
# Code... | [
"numpy.array",
"numpy.nditer",
"pandas.read_csv"
] | [((2262, 2302), 'pandas.read_csv', 'pd.read_csv', (['"""Datasets/MLB.csv"""'], {'sep': '""","""'}), "('Datasets/MLB.csv', sep=',')\n", (2273, 2302), True, 'import pandas as pd\n'), ((2349, 2374), 'numpy.array', 'np.array', (["mlb[['Height']]"], {}), "(mlb[['Height']])\n", (2357, 2374), True, 'import numpy as np\n'), ((... |
from unittest import TestCase
import sys
sys.path.append("./AerialNavigation/rocket_powered_landing/")
from AerialNavigation.rocket_powered_landing import rocket_powered_landing as m
print(__file__)
class Test(TestCase):
def test1(self):
m.show_animation = False
m.main()
| [
"AerialNavigation.rocket_powered_landing.rocket_powered_landing.main",
"sys.path.append"
] | [((42, 103), 'sys.path.append', 'sys.path.append', (['"""./AerialNavigation/rocket_powered_landing/"""'], {}), "('./AerialNavigation/rocket_powered_landing/')\n", (57, 103), False, 'import sys\n'), ((288, 296), 'AerialNavigation.rocket_powered_landing.rocket_powered_landing.main', 'm.main', ([], {}), '()\n', (294, 296)... |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import http, _
from odoo.http import request
from odoo.addons.website_sale.controllers.main import WebsiteSale
from odoo.exceptions import UserError
class WebsiteSaleDelivery(WebsiteSale):
@http.route(['... | [
"odoo._",
"odoo.http.request.website.sale_get_order",
"odoo.http.route",
"odoo.http.request.env.user.has_group",
"odoo.http.request.redirect",
"odoo.http.request.env.ref"
] | [((307, 378), 'odoo.http.route', 'http.route', (["['/shop/payment']"], {'type': '"""http"""', 'auth': '"""public"""', 'website': '(True)'}), "(['/shop/payment'], type='http', auth='public', website=True)\n", (317, 378), False, 'from odoo import http, _\n'), ((812, 925), 'odoo.http.route', 'http.route', (["['/shop/updat... |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
import functools
import gzip
import hashlib
import json
import logging
import os
import random
import warnings
... | [
"logging.getLogger",
"numpy.prod",
"gzip.open",
"dataclasses.dataclass",
"torch.from_numpy",
"numpy.array",
"numpy.isfinite",
"random.Random",
"numpy.flatnonzero",
"os.path.normpath",
"pytorch3d.io.IO",
"warnings.warn",
"dataclasses.field",
"torch.ones_like",
"torch.clamp",
"PIL.Image.... | [((908, 935), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (925, 935), False, 'import logging\n'), ((1046, 1065), 'dataclasses.dataclass', 'dataclass', ([], {'eq': '(False)'}), '(eq=False)\n', (1055, 1065), False, 'from dataclasses import dataclass, field\n'), ((30535, 30567), 'functool... |