code stringlengths 22 1.05M | apis listlengths 1 3.31k | extract_api stringlengths 75 3.25M |
|---|---|---|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.utils.timezone
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('town', '0001... | [
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.db.models.AutoField",
"django.db.models.DateTimeField",
"django.db.migrations.swappable_dependency",
"django.db.models.CharField"
] | [((239, 296), 'django.db.migrations.swappable_dependency', 'migrations.swappable_dependency', (['settings.AUTH_USER_MODEL'], {}), '(settings.AUTH_USER_MODEL)\n', (270, 296), False, 'from django.db import models, migrations\n'), ((459, 552), 'django.db.models.AutoField', 'models.AutoField', ([], {'auto_created': '(True)... |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2016 <NAME> <<EMAIL>>
# Copyright (C) 2016 Rackspace US, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License... | [
"json.loads",
"subprocess.Popen",
"sys.modules.keys",
"os.getcwd",
"os.path.realpath",
"runpy.run_module",
"ansible.module_utils.basic.FILE_COMMON_ARGUMENTS.items",
"ansible.module_utils._text.to_bytes",
"sys.exc_info",
"ansible.executor.powershell.module_manifest.PSModuleDepFinder",
"ansible.mo... | [((3157, 3208), 'ansible.module_utils._text.to_bytes', 'to_bytes', (['module_path'], {'errors': '"""surrogate_or_strict"""'}), "(module_path, errors='surrogate_or_strict')\n", (3165, 3208), False, 'from ansible.module_utils._text import to_bytes, to_text\n'), ((3325, 3344), 'ansible.executor.powershell.module_manifest.... |
"""
print scripts
"""
from termcolor import colored
from pygitscrum.args import compute_args
import colorama
def print_resume_list(list_to_print, message):
"""
print list summary
"""
if len(list_to_print) > 0:
print("")
print(
my_colored(
message + " : ",
... | [
"pygitscrum.args.compute_args",
"termcolor.colored"
] | [((1923, 1946), 'termcolor.colored', 'colored', (['message', 'color'], {}), '(message, color)\n', (1930, 1946), False, 'from termcolor import colored\n'), ((1458, 1472), 'pygitscrum.args.compute_args', 'compute_args', ([], {}), '()\n', (1470, 1472), False, 'from pygitscrum.args import compute_args\n'), ((1865, 1879), '... |
import torch
from estimation import compute_m
i = [[0, 1, 1, 2],
[2, 0, 2, 1]]
v_z = [3, 4, 5, 2]
v_c = [0, 1, 1, 0]
z = torch.sparse_coo_tensor(i, v_z, (3, 3))
c = torch.sparse_coo_tensor(i, v_c, (3, 3))
max_K = 10
m = compute_m(z, c, max_K)
print(m) | [
"torch.sparse_coo_tensor",
"estimation.compute_m"
] | [((128, 167), 'torch.sparse_coo_tensor', 'torch.sparse_coo_tensor', (['i', 'v_z', '(3, 3)'], {}), '(i, v_z, (3, 3))\n', (151, 167), False, 'import torch\n'), ((172, 211), 'torch.sparse_coo_tensor', 'torch.sparse_coo_tensor', (['i', 'v_c', '(3, 3)'], {}), '(i, v_c, (3, 3))\n', (195, 211), False, 'import torch\n'), ((229... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of the SMSGateway project
#
#
#
# Distributed under the terms of the MIT license.
# See LICENSE.txt for more info.
"""Contain the tests for the SMSGateway for PANIC."""
# Path
import sys
import os
path = os.path.join(os.path.dirname(__file__), os.pard... | [
"os.path.abspath",
"os.path.dirname",
"devicetest.main"
] | [((286, 311), 'os.path.dirname', 'os.path.dirname', (['__file__'], {}), '(__file__)\n', (301, 311), False, 'import os\n'), ((343, 364), 'os.path.abspath', 'os.path.abspath', (['path'], {}), '(path)\n', (358, 364), False, 'import os\n'), ((3670, 3676), 'devicetest.main', 'main', ([], {}), '()\n', (3674, 3676), False, 'f... |
#!/home/allen/Documents/TamarawTechProjects/interedregistration/intered/bin/python3
from django.core import management
if __name__ == "__main__":
management.execute_from_command_line()
| [
"django.core.management.execute_from_command_line"
] | [((151, 189), 'django.core.management.execute_from_command_line', 'management.execute_from_command_line', ([], {}), '()\n', (187, 189), False, 'from django.core import management\n')] |
import os.path
import numpy as np
import pickle
from .common import Benchmark
from refnx.analysis import CurveFitter, Objective, Parameter
import refnx.reflect
from refnx.reflect._creflect import abeles as c_abeles
from refnx.reflect._reflect import abeles
from refnx.reflect import SLD, Slab, Structure, ReflectModel,... | [
"refnx.reflect.ReflectModel",
"refnx.reflect._reflect.abeles",
"refnx.reflect.SLD",
"pickle.dumps",
"refnx.analysis.Objective",
"numpy.array",
"refnx.reflect.reflectivity",
"numpy.linspace",
"pickle.loads",
"refnx.analysis.CurveFitter",
"refnx.reflect._creflect.abeles"
] | [((446, 476), 'numpy.linspace', 'np.linspace', (['(0.005)', '(0.5)', '(50000)'], {}), '(0.005, 0.5, 50000)\n', (457, 476), True, 'import numpy as np\n'), ((499, 609), 'numpy.array', 'np.array', (['[[0, 2.07, 0, 3], [50, 3.47, 0.0001, 4], [200, -0.5, 1e-05, 5], [50, 1, 0, \n 3], [0, 6.36, 0, 3]]'], {}), '([[0, 2.07, ... |
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponse
from django.template import loader
from .models import Question
from django.http import Http404
def index(request):
#last_questions_list = Question.objects.order_by('-pub_date')[:5]
#template = loader.get_template("poll... | [
"django.shortcuts.render",
"django.http.HttpResponse",
"django.shortcuts.get_object_or_404"
] | [((684, 728), 'django.shortcuts.render', 'render', (['request', '"""polls/index.html"""', 'context'], {}), "(request, 'polls/index.html', context)\n", (690, 728), False, 'from django.shortcuts import render, get_object_or_404\n'), ((761, 814), 'django.http.HttpResponse', 'HttpResponse', (['"""Hola mundo, esta es el edi... |
import os
from abc import ABC, abstractmethod
class File(ABC):
"""
Abstract class representing text files.
"""
@abstractmethod
def __init__(self):
pass
@staticmethod
def write_file(filename, text, overwrite_existing=True):
"""
Writes output text to a file.
... | [
"os.path.exists"
] | [((1617, 1641), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (1631, 1641), False, 'import os\n'), ((790, 814), 'os.path.exists', 'os.path.exists', (['filename'], {}), '(filename)\n', (804, 814), False, 'import os\n')] |
# Author: <NAME>
import sys as sys
# Morse code dictionary
char_to_dots = {
'A': '.-', 'B': '-...', 'C': '-.-.', 'D': '-..', 'E': '.', 'F': '..-.',
'G': '--.', 'H': '....', 'I': '..', 'J': '.---', 'K': '-.-', 'L': '.-..',
'M': '--', 'N': '-.', 'O': '---', 'P': '.--.', 'Q': '--.-', 'R': '.-.',
'S': '...', 'T':... | [
"sys.exit"
] | [((1355, 1365), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1363, 1365), True, 'import sys as sys\n')] |
import tensorflow as tf
import numpy as np
from self_implement_learning_to_adapt.model import construct_fc_weights,construct_inputs,construct_loss,forward_fc
from self_implement_learning_to_adapt.batch_sampler import ParrallelSampler
from self_implement_learning_to_adapt.vectorized_sampler import VectorizedSampler
from... | [
"numpy.random.rand",
"matplotlib.pyplot.ylabel",
"tensorflow.get_default_session",
"numpy.array",
"self_implement_learning_to_adapt.model.construct_inputs",
"self_implement_learning_to_adapt.vectorized_sampler.VectorizedSampler",
"matplotlib.pyplot.xlabel",
"tensorflow.Session",
"matplotlib.pyplot.p... | [((2881, 2926), 'tensorflow.train.AdamOptimizer', 'tf.train.AdamOptimizer', ([], {'learning_rate': 'self.lr'}), '(learning_rate=self.lr)\n', (2903, 2926), True, 'import tensorflow as tf\n'), ((3020, 3076), 'self_implement_learning_to_adapt.model.construct_inputs', 'construct_inputs', (['self.s_size', 'self.a_size', '""... |
# -*- coding: utf-8 -*-
from logging import getLogger
from pkg_resources import get_distribution
from openprocurement.auctions.core.plugins.contracting.base.utils import (
check_auction_status
)
from openprocurement.auctions.core.utils import (
cleanup_bids_for_cancelled_lots, check_complaint_status,
remov... | [
"logging.getLogger",
"openprocurement.auctions.core.utils.context_unpack",
"openprocurement.auctions.core.utils.get_now",
"openprocurement.auctions.core.utils.remove_draft_bids",
"openprocurement.auctions.core.utils.check_complaint_status",
"openprocurement.auctions.core.plugins.contracting.base.utils.che... | [((385, 414), 'pkg_resources.get_distribution', 'get_distribution', (['__package__'], {}), '(__package__)\n', (401, 414), False, 'from pkg_resources import get_distribution\n'), ((424, 451), 'logging.getLogger', 'getLogger', (['PKG.project_name'], {}), '(PKG.project_name)\n', (433, 451), False, 'from logging import get... |
import sys
from Training.observer_abilities import *
from Training.cortex_3x3_caddy import *
class Player(Observer):
def __init__(self, marker_code):
self.ui = None
self.marker_code = marker_code
def get_enemy_code(self):
if self.marker_code == 10:
return 1
return ... | [
"sys.exit"
] | [((1773, 1783), 'sys.exit', 'sys.exit', ([], {}), '()\n', (1781, 1783), False, 'import sys\n')] |
import cv2
import numpy as np
from numpy.linalg import norm
import requests
def _get_image_frame(camera) -> np.ndarray:
_, frame = camera.read()
return frame
def _convert_frame_to_hsv(frame: np.ndarray) -> np.ndarray:
return cv2.cvtColor(frame, cv2.COLOR_BGR2HSV)
def _post_to_michi() -> None:
try:
... | [
"requests.post",
"numpy.sqrt",
"cv2.VideoCapture",
"cv2.cvtColor",
"numpy.linalg.norm"
] | [((239, 277), 'cv2.cvtColor', 'cv2.cvtColor', (['frame', 'cv2.COLOR_BGR2HSV'], {}), '(frame, cv2.COLOR_BGR2HSV)\n', (251, 277), False, 'import cv2\n'), ((477, 496), 'cv2.VideoCapture', 'cv2.VideoCapture', (['(0)'], {}), '(0)\n', (493, 496), False, 'import cv2\n'), ((326, 395), 'requests.post', 'requests.post', (['"""ht... |
from flask import Flask, render_template, Response
from topicsconsumer import TopicsConsumer
import math
import time
import queue
import threading
import json
app = Flask(__name__)
@app.route('/', methods=['GET', 'POST'])
def searchTopic():
return render_template('base.html')
@app.route('/topics', methods=['GET'... | [
"flask.render_template",
"topicsconsumer.TopicsConsumer",
"json.loads",
"flask.Flask",
"time.sleep",
"queue.Queue"
] | [((166, 181), 'flask.Flask', 'Flask', (['__name__'], {}), '(__name__)\n', (171, 181), False, 'from flask import Flask, render_template, Response\n'), ((254, 282), 'flask.render_template', 'render_template', (['"""base.html"""'], {}), "('base.html')\n", (269, 282), False, 'from flask import Flask, render_template, Respo... |
from datetime import datetime
import boto3
import json
from .stage import Stage
class SQS(object):
"""
class SQS is a collection of utils related to Foursight queues
"""
def __init__(self, foursight_prefix):
self.stage = Stage(foursight_prefix)
def invoke_check_runner(self, runner_input)... | [
"boto3.resource",
"json.dumps",
"boto3.client",
"datetime.datetime.utcnow"
] | [((489, 511), 'boto3.client', 'boto3.client', (['"""lambda"""'], {}), "('lambda')\n", (501, 511), False, 'import boto3\n'), ((1626, 1645), 'boto3.client', 'boto3.client', (['"""sqs"""'], {}), "('sqs')\n", (1638, 1645), False, 'import boto3\n'), ((2709, 2728), 'boto3.client', 'boto3.client', (['"""sqs"""'], {}), "('sqs'... |
#!/usr/bin/env python
import os
from setuptools import setup
from setuptools.command.install import install
LONG_DESCRIPTION = ""
with open(os.path.join(os.path.dirname(__file__), 'README.md'), 'r') as f:
LONG_DESCRIPTION = f.read()
setup(
name='shadho',
version='0.4.3.post2',
description='Hyperparam... | [
"os.path.dirname",
"setuptools.setup"
] | [((240, 1302), 'setuptools.setup', 'setup', ([], {'name': '"""shadho"""', 'version': '"""0.4.3.post2"""', 'description': '"""Hyperparameter optimizer with distributed hardware at heart"""', 'long_description': 'LONG_DESCRIPTION', 'long_description_content_type': '"""text/markdown"""', 'url': '"""https://github.com/jeff... |
import os
class config():
input_dir = ''
max_len = '128'
pretrain_model_dir = ''
home_dir = os.getcwd() + '/'
data_dir = home_dir + 'raw_data/ske/'
tf_serving_addr = '127.0.0.1:8501'
bert_vocab_dir = home_dir + 'pretrained_model/chinese_wwm_ext_L-12_H-768_A-12/vocab.txt'
bert_config_dir ... | [
"os.getcwd"
] | [((108, 119), 'os.getcwd', 'os.getcwd', ([], {}), '()\n', (117, 119), False, 'import os\n')] |
import json
import sys
import os
import requests
from datasets.diff_helper import DiffHelper
from common.constants import BASE_HEADERS, FAIR_API_ENDPOINT, SSL_VERIFY, FAIR_URL, DRY_RUN
def dataset_url(code):
return f"{FAIR_API_ENDPOINT}{code}"
def get_request(dataset_code):
resp = requests.get(
datase... | [
"os.path.isfile",
"json.dumps",
"json.loads",
"datasets.diff_helper.DiffHelper.dataset_diff"
] | [((740, 779), 'datasets.diff_helper.DiffHelper.dataset_diff', 'DiffHelper.dataset_diff', (['original', 'data'], {}), '(original, data)\n', (763, 779), False, 'from datasets.diff_helper import DiffHelper\n'), ((1804, 1835), 'os.path.isfile', 'os.path.isfile', (['definition_file'], {}), '(definition_file)\n', (1818, 1835... |
import os
import json
from collections import OrderedDict
import pandas as pd
def write_json_to_file(json_data, json_file_path):
parsed = json.loads(json_data)
parsed = json.dumps(parsed, indent=4, sort_keys=True)
obj = open(json_file_path, 'w')
obj.write(parsed)
obj.close()
# replace " with ' ... | [
"json.loads",
"collections.OrderedDict",
"json.dumps",
"os.path.join",
"os.getcwd",
"os.path.dirname",
"os.path.basename",
"pandas.read_excel"
] | [((145, 166), 'json.loads', 'json.loads', (['json_data'], {}), '(json_data)\n', (155, 166), False, 'import json\n'), ((180, 224), 'json.dumps', 'json.dumps', (['parsed'], {'indent': '(4)', 'sort_keys': '(True)'}), '(parsed, indent=4, sort_keys=True)\n', (190, 224), False, 'import json\n'), ((1589, 1602), 'collections.O... |
# -*- coding: utf-8 -*-
from datetime import datetime, timedelta
from django.contrib.auth.models import User
from django.test import TestCase
from cms.api import assign_user_to_page, create_page
from ..helpers import get_request
from ..views import SearchResultsView
class PermissionsTestCase(TestCase):
def set... | [
"cms.api.assign_user_to_page",
"cms.api.create_page",
"django.contrib.auth.models.User.objects.create_user"
] | [((567, 654), 'django.contrib.auth.models.User.objects.create_user', 'User.objects.create_user', ([], {'username': '"""jacob"""', 'email': '"""jacob@…"""', 'password': '"""<PASSWORD>"""'}), "(username='jacob', email='jacob@…', password=\n '<PASSWORD>')\n", (591, 654), False, 'from django.contrib.auth.models import U... |
# -*-coding:Utf-8 -*
from repetier_ui import *
import time
import set_ifttt
from FUTIL.my_logging import *
my_logging(console_level = DEBUG, logfile_level = INFO)
HD = repetier_printer (repetier_api(api_key='<KEY>'),'HD')
sys.path.insert(0,'/home/pi')
import iftt_key
ifttt0 = set_ifttt.ifttt(iftt_key.key)
def wa... | [
"time.sleep",
"set_ifttt.ifttt"
] | [((283, 312), 'set_ifttt.ifttt', 'set_ifttt.ifttt', (['iftt_key.key'], {}), '(iftt_key.key)\n', (298, 312), False, 'import set_ifttt\n'), ((1036, 1050), 'time.sleep', 'time.sleep', (['(10)'], {}), '(10)\n', (1046, 1050), False, 'import time\n')] |
import pandas as pd
class Normalizer:
csv_data = 'dataset/water_potability.csv' # file from work data
def __init__(self) -> None:
self.dataset = pd.read_csv(self.csv_data)
self.__normalize_data__()
self.__separate__()
'''
@ convert all info to number
'''
def __normalize_data__(self) -> Non... | [
"pandas.read_csv"
] | [((156, 182), 'pandas.read_csv', 'pd.read_csv', (['self.csv_data'], {}), '(self.csv_data)\n', (167, 182), True, 'import pandas as pd\n')] |
# -*- coding: utf-8 -*-
from distutils.version import LooseVersion
from marshmallow.utils import missing
# Make marshmallow's validation functions importable from webargs
from marshmallow import validate
from webargs.core import dict2schema, ValidationError
from webargs import fields
__version__ = "5.3.2"
__version_... | [
"distutils.version.LooseVersion"
] | [((335, 360), 'distutils.version.LooseVersion', 'LooseVersion', (['__version__'], {}), '(__version__)\n', (347, 360), False, 'from distutils.version import LooseVersion\n')] |
#!C:\Users\stpny\Downloads\grasp_public-master\grasp_public-master\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'imageio==2.5.0','console_scripts','imageio_remove_bin'
__requires__ = 'imageio==2.5.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] =... | [
"re.sub",
"pkg_resources.load_entry_point"
] | [((321, 373), 're.sub', 're.sub', (['"""(-script\\\\.pyw?|\\\\.exe)?$"""', '""""""', 'sys.argv[0]'], {}), "('(-script\\\\.pyw?|\\\\.exe)?$', '', sys.argv[0])\n", (327, 373), False, 'import re\n'), ((397, 472), 'pkg_resources.load_entry_point', 'load_entry_point', (['"""imageio==2.5.0"""', '"""console_scripts"""', '"""i... |
import logging
import sys
from .pipeline import MWFPipeline
def build(config):
config["source"] = config["source"] or {}
config["tweaks"] = config["tweaks"] or []
config["converter"] = config["converter"] or {}
config["generator"] = config["generator"] or []
pipeline = MWFPipeline(config["source"... | [
"logging.error",
"sys.exit"
] | [((618, 675), 'logging.error', 'logging.error', (['"""No api_path or file_path provided. Stop."""'], {}), "('No api_path or file_path provided. Stop.')\n", (631, 675), False, 'import logging\n'), ((688, 699), 'sys.exit', 'sys.exit', (['(1)'], {}), '(1)\n', (696, 699), False, 'import sys\n')] |
from django.shortcuts import render
from django.http import HttpResponse
import json
# Create your views here.
def info(request):
userInfo = {
'id': '4291d7da9005377ec9aec4a71ea837f',
'name': '天野远子',
'username': 'admin',
'password': '',
'avatar': '/avatar2.jpg',
'status': 1,
'telephone': ... | [
"json.dumps"
] | [((13030, 13060), 'json.dumps', 'json.dumps', (['userInfo'], {'indent': '(4)'}), '(userInfo, indent=4)\n', (13040, 13060), False, 'import json\n'), ((21313, 21344), 'json.dumps', 'json.dumps', (['navResult'], {'indent': '(4)'}), '(navResult, indent=4)\n', (21323, 21344), False, 'import json\n')] |
#%%
# read full assignment
# think algo before implementing
# dont use a dict when you need a list
# assignment is still = and not ==
# dont use itertools when you can use np.roll
# check mathemathical functions if the parentheses are ok
# networkx is awesome
# sometimes while true is better than just too small for loo... | [
"numpy.roll",
"networkx.Graph",
"numpy.ndenumerate",
"os.getcwd",
"numpy.array",
"networkx.number_connected_components",
"operator.xor",
"numpy.arange"
] | [((1816, 1830), 'numpy.array', 'np.array', (['grid'], {}), '(grid)\n', (1824, 1830), True, 'import numpy as np\n'), ((1853, 1863), 'networkx.Graph', 'nx.Graph', ([], {}), '()\n', (1861, 1863), True, 'import networkx as nx\n'), ((1885, 1905), 'numpy.ndenumerate', 'np.ndenumerate', (['grid'], {}), '(grid)\n', (1899, 1905... |
import numpy as np
from scipy.io.wavfile import read
import torch
def get_mask_from_lengths(lengths):
max_len = torch.max(lengths).item()
if torch.cuda.is_available():
ids = torch.arange(0, max_len, out=torch.cuda.LongTensor(max_len))
else:
ids = torch.arange(0, max_len, out=torch.LongTens... | [
"torch.cuda.LongTensor",
"torch.LongTensor",
"torch.max",
"torch.cuda.is_available",
"scipy.io.wavfile.read",
"torch.autograd.Variable"
] | [((151, 176), 'torch.cuda.is_available', 'torch.cuda.is_available', ([], {}), '()\n', (174, 176), False, 'import torch\n'), ((458, 473), 'scipy.io.wavfile.read', 'read', (['full_path'], {}), '(full_path)\n', (462, 473), False, 'from scipy.io.wavfile import read\n'), ((767, 792), 'torch.cuda.is_available', 'torch.cuda.i... |
#!/usr/bin/env python
# circuits.py - convert a Boolean circuit to an equivalent Boolean formula
#
# Copyright 2016 <NAME> <<EMAIL>>.
#
# This file is part of NetworkX.
#
# NetworkX is distributed under a BSD license; see LICENSE.txt for more
# information.
"""
========
Circuits
========
Convert a Boolean circuit to a... | [
"networkx.utils.arbitrary_element",
"networkx.DiGraph",
"networkx.dag_to_branching"
] | [((895, 920), 'networkx.dag_to_branching', 'dag_to_branching', (['circuit'], {}), '(circuit)\n', (911, 920), False, 'from networkx import dag_to_branching\n'), ((2748, 2757), 'networkx.DiGraph', 'DiGraph', ([], {}), '()\n', (2755, 2757), False, 'from networkx import DiGraph\n'), ((1584, 1611), 'networkx.utils.arbitrary... |
import pygame
import numpy as np
from math import *
import json
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RAINBOW = (0, 0, 0)
rainbow = True
WIDTH, HEIGHT = 800, 600
#WIDTH, HEIGHT = 1600, 900
def drawLine(point1, point2, screen):
if rainbow:
pygame.draw.line(screen, RAINBOW, (point1[0], point1[1]), (po... | [
"json.loads",
"pygame.quit",
"pygame.draw.line",
"pygame.event.get",
"pygame.display.set_mode",
"pygame.time.Clock",
"json.load",
"pygame.display.update",
"numpy.matrix"
] | [((2393, 2433), 'pygame.display.set_mode', 'pygame.display.set_mode', (['(WIDTH, HEIGHT)'], {}), '((WIDTH, HEIGHT))\n', (2416, 2433), False, 'import pygame\n'), ((2442, 2461), 'pygame.time.Clock', 'pygame.time.Clock', ([], {}), '()\n', (2459, 2461), False, 'import pygame\n'), ((1431, 1443), 'json.load', 'json.load', ([... |
from xrsolver import Problem
import solver
# This example is the second case from https://www.youtube.com/watch?v=WJEZh7GWHnw
s = solver.Solver()
p = Problem()
x1 = p.generateVariable("x1", lb=0, ub=3)
x2 = p.generateVariable("x2", lb=0, ub=3)
x3 = p.generateVariable("x3", lb=0, ub=3)
x4 = p.generateVariable("x4",... | [
"xrsolver.Problem",
"solver.Solver"
] | [((133, 148), 'solver.Solver', 'solver.Solver', ([], {}), '()\n', (146, 148), False, 'import solver\n'), ((154, 163), 'xrsolver.Problem', 'Problem', ([], {}), '()\n', (161, 163), False, 'from xrsolver import Problem\n')] |
"""Main routines for interacting with an Apple TV."""
import asyncio
import datetime # noqa
from ipaddress import IPv4Address
from typing import List
import aiohttp
from pyatv import conf, exceptions, interface
from pyatv.airplay import AirPlayStreamAPI
from pyatv.const import Protocol
from pyatv.dmap import DmapAp... | [
"pyatv.support.scan.MulticastMdnsScanner",
"pyatv.support.net.create_session",
"ipaddress.IPv4Address",
"pyatv.airplay.AirPlayStreamAPI",
"pyatv.exceptions.DeviceIdMissingError"
] | [((2170, 2200), 'pyatv.airplay.AirPlayStreamAPI', 'AirPlayStreamAPI', (['config', 'loop'], {}), '(config, loop)\n', (2186, 2200), False, 'from pyatv.airplay import AirPlayStreamAPI\n'), ((1320, 1358), 'pyatv.support.scan.MulticastMdnsScanner', 'MulticastMdnsScanner', (['loop', 'identifier'], {}), '(loop, identifier)\n'... |
import glob
import os
from doc2vec import read_file, embed_document
def get_file_embeddings():
# Returns a list of names in list files.
txt_files = glob.glob('**/*.txt', recursive=True)
pdf_files = glob.glob('**/*.pdf', recursive=True)
docx_files = glob.glob('**/*.docx', recursive=True)
file_names... | [
"os.path.exists",
"os.mkdir",
"os.path.abspath",
"doc2vec.read_file",
"glob.glob"
] | [((158, 195), 'glob.glob', 'glob.glob', (['"""**/*.txt"""'], {'recursive': '(True)'}), "('**/*.txt', recursive=True)\n", (167, 195), False, 'import glob\n'), ((212, 249), 'glob.glob', 'glob.glob', (['"""**/*.pdf"""'], {'recursive': '(True)'}), "('**/*.pdf', recursive=True)\n", (221, 249), False, 'import glob\n'), ((267... |
#!/usr/bin/env python3
import sys
import os
import argparse
from string import Template
import re
# Patch site-packages to find numpy
import jinja2
if sys.platform.startswith("win"):
site_packages_path = os.path.abspath(os.path.join(os.path.dirname(jinja2.__file__), "../../../ext-site-packages"))
else:
site_packa... | [
"os.path.exists",
"tflite_model_parameters.TfliteModelParameters.load_from_tflite_flatbuffer",
"os.listdir",
"string.Template",
"sys.path.insert",
"argparse.ArgumentParser",
"sys.platform.startswith",
"os.path.join",
"os.path.splitext",
"os.path.dirname",
"re.sub"
] | [((153, 183), 'sys.platform.startswith', 'sys.platform.startswith', (['"""win"""'], {}), "('win')\n", (176, 183), False, 'import sys\n'), ((431, 465), 'os.path.exists', 'os.path.exists', (['site_packages_path'], {}), '(site_packages_path)\n', (445, 465), False, 'import os\n'), ((4618, 4651), 're.sub', 're.sub', (['"""[... |
from flask import Flask
app = Flask(__name__,static_folder='../static') | [
"flask.Flask"
] | [((31, 73), 'flask.Flask', 'Flask', (['__name__'], {'static_folder': '"""../static"""'}), "(__name__, static_folder='../static')\n", (36, 73), False, 'from flask import Flask\n')] |
import re
import urllib
import numbers
from clayful.models import register_models
from clayful.requester import request
from clayful.exception import ClayfulException
class Clayful:
base_url = 'https://api.clayful.io'
default_headers = {
'Accept-Encoding': 'gzip',
'User-Agent': 'clayful-python',
'Clayfu... | [
"re.findall",
"clayful.models.register_models"
] | [((5574, 5598), 'clayful.models.register_models', 'register_models', (['Clayful'], {}), '(Clayful)\n', (5589, 5598), False, 'from clayful.models import register_models\n'), ((4934, 4970), 're.findall', 're.findall', (['""".{1,3}"""', 'parts[0][::-1]'], {}), "('.{1,3}', parts[0][::-1])\n", (4944, 4970), False, 'import r... |
from dataclasses import dataclass
from typing import Dict
from racecar_gym.bullet import load_world, load_vehicle
from racecar_gym.tasks import Task, get_task
from racecar_gym.core import World, Agent
from .specs import ScenarioSpec, TaskSpec
def task_from_spec(spec: TaskSpec) -> Task:
task = get_task(spec.task_n... | [
"racecar_gym.tasks.get_task",
"racecar_gym.bullet.load_world",
"racecar_gym.bullet.load_vehicle"
] | [((300, 324), 'racecar_gym.tasks.get_task', 'get_task', (['spec.task_name'], {}), '(spec.task_name)\n', (308, 324), False, 'from racecar_gym.tasks import Task, get_task\n'), ((1311, 1343), 'racecar_gym.bullet.load_vehicle', 'load_vehicle', (['agent_spec.vehicle'], {}), '(agent_spec.vehicle)\n', (1323, 1343), False, 'fr... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import copy
import argparse
import cv2 as cv
import numpy as np
import mediapipe as mp
from utils import CvFpsCalc
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("--device", type=int, default=0)
parser.add_argument("--width", help='c... | [
"cv2.rectangle",
"cv2.flip",
"argparse.ArgumentParser",
"cv2.boundingRect",
"cv2.line",
"cv2.imshow",
"numpy.append",
"numpy.array",
"cv2.circle",
"numpy.empty",
"cv2.destroyAllWindows",
"cv2.VideoCapture",
"copy.deepcopy",
"cv2.cvtColor",
"cv2.waitKey",
"utils.CvFpsCalc"
] | [((194, 219), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (217, 219), False, 'import argparse\n'), ((1449, 1476), 'cv2.VideoCapture', 'cv.VideoCapture', (['cap_device'], {}), '(cap_device)\n', (1464, 1476), True, 'import cv2 as cv\n'), ((1982, 2006), 'utils.CvFpsCalc', 'CvFpsCalc', ([], {'bu... |
"""Vista del inventario del modulo de prestamos tecnologicos."""
# Django REST Framework
from rest_framework import viewsets, mixins
# Permisos
from rest_framework.permissions import IsAuthenticated
from andromeda.modules.inventory.permissions import IsAdmin, IsStaff
# Modelos
from andromeda.modules.loans.models imp... | [
"andromeda.modules.loans.models.InventoryLoans.objects.all"
] | [((818, 846), 'andromeda.modules.loans.models.InventoryLoans.objects.all', 'InventoryLoans.objects.all', ([], {}), '()\n', (844, 846), False, 'from andromeda.modules.loans.models import InventoryLoans\n')] |
import matplotlib.pyplot as plt
x = ["N=1", "N=2", "N=3", "N=4", "N=5","N=6"]
y = [0.9365, 0.9865, 0.9895, 0.9950,0.9880,0.9615]
rects = plt.barh(x, y, color=["red", "blue", "purple", "violet", "green", "black"])
for rect in rects: # rects 是三根柱子的集合
width = rect.get_width()
print(width)
plt.text(width, rec... | [
"matplotlib.pyplot.barh",
"matplotlib.pyplot.xlim",
"matplotlib.pyplot.show"
] | [((138, 213), 'matplotlib.pyplot.barh', 'plt.barh', (['x', 'y'], {'color': "['red', 'blue', 'purple', 'violet', 'green', 'black']"}), "(x, y, color=['red', 'blue', 'purple', 'violet', 'green', 'black'])\n", (146, 213), True, 'import matplotlib.pyplot as plt\n'), ((376, 394), 'matplotlib.pyplot.xlim', 'plt.xlim', (['(0.... |
"""
Clip rendering helpers.
"""
import vapoursynth as vs
from enum import Enum
from threading import Condition
from typing import BinaryIO, Callable, Dict, List, Optional, TextIO, Union
from concurrent.futures import Future
from functools import partial
from .progress import Progress, BarColumn, FPSColumn, TextColumn... | [
"threading.Condition",
"functools.partial"
] | [((917, 928), 'threading.Condition', 'Condition', ([], {}), '()\n', (926, 928), False, 'from threading import Condition\n'), ((5104, 5121), 'functools.partial', 'partial', (['cb'], {'n': 'nn'}), '(cb, n=nn)\n', (5111, 5121), False, 'from functools import partial\n'), ((6767, 6783), 'functools.partial', 'partial', (['cb... |
from django import forms
from django.utils.translation import ugettext_lazy as _
from geekjobs.models import Job
"""
class JobForm(forms.Form):
title = forms.CharField(label='Job title', max_length=380)
city = forms.CharField(label='City', max_length=100, required=False)
state = forms.ChoiceField(label='St... | [
"django.utils.translation.ugettext_lazy",
"django.forms.Textarea"
] | [((1224, 1257), 'django.forms.Textarea', 'forms.Textarea', ([], {'attrs': "{'rows': 3}"}), "(attrs={'rows': 3})\n", (1238, 1257), False, 'from django import forms\n'), ((1308, 1322), 'django.utils.translation.ugettext_lazy', '_', (['"""Job Title"""'], {}), "('Job Title')\n", (1309, 1322), True, 'from django.utils.trans... |
import asyncio
import os
from youwol_utils import WhereClause, QueryBody, Query, Path, flatten
from .configurations import Configuration
from .utils import format_download_form, post_storage_by_chunk, md5_from_folder
from .utils_indexing import format_doc_db_record, post_indexes, get_version_number_str
async def in... | [
"youwol_utils.Path",
"youwol_utils.Query"
] | [((1197, 1218), 'youwol_utils.Query', 'Query', ([], {'where_clause': 'c'}), '(where_clause=c)\n', (1202, 1218), False, 'from youwol_utils import WhereClause, QueryBody, Query, Path, flatten\n'), ((1582, 1596), 'youwol_utils.Path', 'Path', (['__file__'], {}), '(__file__)\n', (1586, 1596), False, 'from youwol_utils impor... |
from django.contrib import admin
from .models import KwikPost, Comment, Like
# Register your models here.
@admin.register(KwikPost)
class KwikPostAdmin(admin.ModelAdmin):
list_display = ['user', 'featured_image', 'slug', 'post_body', 'created_at']
list_filter = ['created_at']
prepopulated_fields = {'slug... | [
"django.contrib.admin.register"
] | [((110, 134), 'django.contrib.admin.register', 'admin.register', (['KwikPost'], {}), '(KwikPost)\n', (124, 134), False, 'from django.contrib import admin\n'), ((347, 370), 'django.contrib.admin.register', 'admin.register', (['Comment'], {}), '(Comment)\n', (361, 370), False, 'from django.contrib import admin\n'), ((478... |
import keras
from keras import layers
from keras.layers import Dropout, Dense
from keras.preprocessing.image import ImageDataGenerator
import numpy as np
import tensorflow_hub as hub
import cv2
import pandas as p
IMAGE_SHAPE = (224, 224) #(HEIGHT, WIDTH)
TRAINING_DATA_DIRECTORY = '/content/drive/My Drive/Colab ... | [
"keras.optimizers.Adam",
"keras.Sequential",
"numpy.ceil",
"keras.preprocessing.image.ImageDataGenerator",
"keras.layers.Dense",
"tensorflow_hub.KerasLayer",
"keras.layers.Dropout"
] | [((489, 525), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '(**datagen_kwargs)\n', (507, 525), False, 'from keras.preprocessing.image import ImageDataGenerator\n'), ((812, 848), 'keras.preprocessing.image.ImageDataGenerator', 'ImageDataGenerator', ([], {}), '(**datagen_kwargs)\n', (83... |
"""
A set of functions for extracting header information from PSG objects
Typically only used internally in from unet.io.header.header_extractors
Each function takes some PSG or header-like object and returns a dictionary with at least
the following keys:
{
'n_channels': int,
'channel_names': list of strings,... | [
"logging.getLogger",
"datetime.datetime.utcfromtimestamp",
"psg_utils.errors.VariableSampleRateError",
"numpy.isclose",
"psg_utils.io.channels.utils.check_duplicate_channels",
"numpy.array",
"psg_utils.errors.HeaderFieldTypeError",
"numpy.issubdtype",
"psg_utils.errors.FloatSampleRateWarning",
"wa... | [((821, 848), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (838, 848), False, 'import logging\n'), ((2174, 2245), 'psg_utils.io.channels.utils.check_duplicate_channels', 'check_duplicate_channels', (["header['channel_names']"], {'raise_or_warn': '"""warn"""'}), "(header['channel_names']... |
import sys,os
import json
import logging as log
import socket
from collections import OrderedDict
import datetime
from platform import system as system_name # Returns the system/OS name
from subprocess import call as system_call # Execute a shell command
def ping(host):
"""
Returns True if host (str) re... | [
"logging.basicConfig",
"logging.getLogger",
"logging.StreamHandler",
"datetime.datetime.utcnow",
"os.path.isfile",
"os.path.dirname",
"platform.system",
"subprocess.call",
"logging.root.removeHandler",
"socket.gethostname"
] | [((961, 989), 'os.path.dirname', 'os.path.dirname', (['sys.argv[0]'], {}), '(sys.argv[0])\n', (976, 989), False, 'import sys, os\n'), ((1115, 1142), 'os.path.isfile', 'os.path.isfile', (['config_file'], {}), '(config_file)\n', (1129, 1142), False, 'import sys, os\n'), ((2071, 2243), 'logging.basicConfig', 'log.basicCon... |
#
# Modules Info
#
import pykd
moduleList = []
def reloadModules():
global moduleList
for m in moduleList: globals()[ m.name().lower() ] = None
if pykd.isKernelDebugging():
global nt
nt = pykd.loadModule("nt")
modules = pykd.typedV... | [
"pykd.typedVarList",
"pykd.loadModule",
"pykd.typedVar",
"pykd.getCurrentProcess",
"pykd.findModule",
"pykd.isKernelDebugging"
] | [((202, 226), 'pykd.isKernelDebugging', 'pykd.isKernelDebugging', ([], {}), '()\n', (224, 226), False, 'import pykd\n'), ((266, 287), 'pykd.loadModule', 'pykd.loadModule', (['"""nt"""'], {}), "('nt')\n", (281, 287), False, 'import pykd\n'), ((309, 404), 'pykd.typedVarList', 'pykd.typedVarList', (['nt.PsLoadedModuleList... |
"""Test module for the Error dialog widget."""
import os
import logging
import pytest
from PySide2.QtGui import QClipboard
from src.widgets import error_dialog
from src.about import about_to_string
@pytest.fixture()
def error_log_path(_package):
"""Get the log directory path."""
yield os.path.join(_package... | [
"src.widgets.error_dialog.ErrorDialog",
"src.widgets.error_dialog._get_critical_logger",
"os.path.join",
"PySide2.QtGui.QClipboard",
"pytest.fixture",
"src.about.about_to_string"
] | [((204, 220), 'pytest.fixture', 'pytest.fixture', ([], {}), '()\n', (218, 220), False, 'import pytest\n'), ((353, 382), 'pytest.fixture', 'pytest.fixture', ([], {'name': '"""report"""'}), "(name='report')\n", (367, 382), False, 'import pytest\n'), ((645, 683), 'src.widgets.error_dialog.ErrorDialog', 'error_dialog.Error... |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | [
"ossdbtoolsservice.utils.time.get_elapsed_time_str",
"ossdbtoolsservice.query.contracts.BatchSummary.from_batch",
"uuid.uuid4",
"datetime.datetime.now",
"ossdbtoolsservice.query.file_storage_result_set.FileStorageResultSet",
"ossdbtoolsservice.query.in_memory_result_set.InMemoryResultSet",
"ossdbtoolsse... | [((7119, 7161), 'ossdbtoolsservice.query.in_memory_result_set.InMemoryResultSet', 'InMemoryResultSet', (['result_set_id', 'batch_id'], {}), '(result_set_id, batch_id)\n', (7136, 7161), False, 'from ossdbtoolsservice.query.in_memory_result_set import InMemoryResultSet\n'), ((7321, 7347), 'sqlparse.parse', 'sqlparse.pars... |
"""Sequence generation framework.
Recurrent networks are often used to generate/model sequences.
Examples include language modelling, machine translation, handwriting
synthesis, etc.. A typical pattern in this context is that
sequence elements are generated one often another, and every generated
element is fed back in... | [
"blocks.bricks.NDimensionalSoftmax",
"theano.tensor.roll",
"theano.tensor.ones",
"six.add_metaclass",
"blocks.utils.dict_union",
"blocks.bricks.Bias",
"blocks.bricks.base.lazy",
"theano.tensor.zeros_like",
"blocks.bricks.base.application",
"theano.tensor.zeros",
"blocks.roles.add_role",
"block... | [((13908, 13930), 'six.add_metaclass', 'add_metaclass', (['ABCMeta'], {}), '(ABCMeta)\n', (13921, 13930), False, 'from six import add_metaclass\n'), ((21289, 21311), 'six.add_metaclass', 'add_metaclass', (['ABCMeta'], {}), '(ABCMeta)\n', (21302, 21311), False, 'from six import add_metaclass\n'), ((22594, 22616), 'six.a... |
import pandas as pd
from my_mod import enlarge
print("Hello!")
df = pd.DataFrame({"a":[1,2,3], "b":[4,5,6]})
print(df.head())
x = 11
print(enlarge(x)) | [
"pandas.DataFrame",
"my_mod.enlarge"
] | [((70, 116), 'pandas.DataFrame', 'pd.DataFrame', (["{'a': [1, 2, 3], 'b': [4, 5, 6]}"], {}), "({'a': [1, 2, 3], 'b': [4, 5, 6]})\n", (82, 116), True, 'import pandas as pd\n'), ((143, 153), 'my_mod.enlarge', 'enlarge', (['x'], {}), '(x)\n', (150, 153), False, 'from my_mod import enlarge\n')] |
#-*-coding: utf-8-*-
from requests import session
from bs4 import BeautifulSoup
#Aqui pones la ip de tu maquina.
host = "192.168.1.167"
#Aqui pones la ruta de el dns-lookup.php
route = "/mutillidae/index.php?page=dns-lookup.php"
with session() as s:
cmd = ''
while cmd != 'exit':
cmd = input(">>")
payload = "|... | [
"bs4.BeautifulSoup",
"requests.session"
] | [((238, 247), 'requests.session', 'session', ([], {}), '()\n', (245, 247), False, 'from requests import session\n'), ((538, 581), 'bs4.BeautifulSoup', 'BeautifulSoup', (['response.text', '"""html.parser"""'], {}), "(response.text, 'html.parser')\n", (551, 581), False, 'from bs4 import BeautifulSoup\n')] |
"""
Utility classes and functions for RSMTool file management.
:author: <NAME> (<EMAIL>)
:author: <NAME> (<EMAIL>)
:author: <NAME> (<EMAIL>)
:organization: ETS
"""
import json
import re
from glob import glob
from pathlib import Path
from os.path import join
from .constants import POSSIBLE_EXTENSIONS
def parse_js... | [
"json.loads",
"pathlib.Path",
"re.compile"
] | [((1062, 1161), 're.compile', 're.compile', (['"""(^)?[^\\\\S\\\\n]*/(?:\\\\*(.*?)\\\\*/[^\\\\S\\\\n]*|/[^\\\\n]*)($)?"""', '(re.DOTALL | re.MULTILINE)'], {}), "('(^)?[^\\\\S\\\\n]*/(?:\\\\*(.*?)\\\\*/[^\\\\S\\\\n]*|/[^\\\\n]*)($)?', re.\n DOTALL | re.MULTILINE)\n", (1072, 1161), False, 'import re\n'), ((1286, 1300)... |
import random
def go_to_sleep(text):
replies = ['See you later!', 'Just call my name and I\'ll be there!']
return (random.choice(replies))
quit()
| [
"random.choice"
] | [((125, 147), 'random.choice', 'random.choice', (['replies'], {}), '(replies)\n', (138, 147), False, 'import random\n')] |
import logging
from django.contrib.messages import get_messages
from django.utils.encoding import force_str
logger = logging.getLogger('django_sso_app')
def get_request_messages_string(request):
"""
Serializes django messages
:param request:
:return:
"""
storage = get_messages(request)
... | [
"logging.getLogger",
"django.contrib.messages.get_messages",
"django.utils.encoding.force_str"
] | [((119, 154), 'logging.getLogger', 'logging.getLogger', (['"""django_sso_app"""'], {}), "('django_sso_app')\n", (136, 154), False, 'import logging\n'), ((294, 315), 'django.contrib.messages.get_messages', 'get_messages', (['request'], {}), '(request)\n', (306, 315), False, 'from django.contrib.messages import get_messa... |
"""
This module contains functions related to integer formatting and math.
"""
from functools import reduce
from itertools import count
from math import gcd, prod
# ================ ARRAY FORMATTING FUNCTIONS ================
def str_array_to_int(intarray):
return int(''.join(intarray))
def int_array_to_int(i... | [
"functools.reduce",
"math.gcd",
"itertools.count"
] | [((900, 938), 'functools.reduce', 'reduce', (['(lambda x, y: x * y)', 'numlist', '(1)'], {}), '(lambda x, y: x * y, numlist, 1)\n', (906, 938), False, 'from functools import reduce\n'), ((2024, 2032), 'itertools.count', 'count', (['(1)'], {}), '(1)\n', (2029, 2032), False, 'from itertools import count\n'), ((2069, 2077... |
# -*- coding: utf-8 -*-
import random
from datetime import datetime
from operator import itemgetter
import requests
import time
from pyinstagram.model import Media
from .exceptions import OAuthException, PyInstagramException
from .oauth import OAuth
from .constants import API_URL
from .utils import DESAdapter
class... | [
"requests.Session",
"datetime.datetime.strptime",
"time.sleep",
"operator.itemgetter",
"pyinstagram.model.Media",
"random.randint"
] | [((1110, 1129), 'time.sleep', 'time.sleep', (['seconds'], {}), '(seconds)\n', (1120, 1129), False, 'import time\n'), ((6041, 6059), 'requests.Session', 'requests.Session', ([], {}), '()\n', (6057, 6059), False, 'import requests\n'), ((5525, 5550), 'operator.itemgetter', 'itemgetter', (['"""media_count"""'], {}), "('med... |
import ImportTitanicData
import DataPreparation
# analiza danych przed preparacją danych
class DataAnaliysisBefore():
def showTrain(self):
importData = ImportTitanicData.DataImport()
train = importData.importTrain()
return train
def shapeTrain(self):
return self.showTrain().sha... | [
"ImportTitanicData.DataImport",
"DataPreparation.DataPreparation"
] | [((165, 195), 'ImportTitanicData.DataImport', 'ImportTitanicData.DataImport', ([], {}), '()\n', (193, 195), False, 'import ImportTitanicData\n'), ((436, 466), 'ImportTitanicData.DataImport', 'ImportTitanicData.DataImport', ([], {}), '()\n', (464, 466), False, 'import ImportTitanicData\n'), ((772, 805), 'DataPreparation... |
"""Test Predict API calls"""
import io
from PIL import Image
from dataclasses import dataclass
import tempfile
from pathlib import Path
import pytest
from mock import patch
from mldock.api.predict import send_image_jpeg, send_csv, send_json, handle_prediction
import responses
import requests
@pytest.fixture
def image... | [
"tempfile.TemporaryDirectory",
"PIL.Image.open",
"mldock.api.predict.handle_prediction",
"mock.patch",
"pathlib.Path",
"io.BytesIO",
"responses.add",
"pytest.raises"
] | [((379, 431), 'PIL.Image.open', 'Image.open', (['"""tests/api/fixtures/eight.png"""'], {'mode': '"""r"""'}), "('tests/api/fixtures/eight.png', mode='r')\n", (389, 431), False, 'from PIL import Image\n'), ((451, 463), 'io.BytesIO', 'io.BytesIO', ([], {}), '()\n', (461, 463), False, 'import io\n'), ((915, 1034), 'respons... |
# 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... | [
"tempest.lib.decorators.idempotent_id",
"tempest.test.attr"
] | [((1056, 1082), 'tempest.test.attr', 'test.attr', ([], {'type': '"""negative"""'}), "(type='negative')\n", (1065, 1082), False, 'from tempest import test\n'), ((1088, 1152), 'tempest.lib.decorators.idempotent_id', 'decorators.idempotent_id', (['"""b9dce555-d3b3-11e5-950a-54ee757c77da"""'], {}), "('b9dce555-d3b3-11e5-95... |
""" Don't load any Eclipse stuff at global scope, needs to be importable previous to Eclipse starting """
from storytext import javarcptoolkit
import sys
class ScriptEngine(javarcptoolkit.ScriptEngine):
def createReplayer(self, universalLogging=False, **kw):
return UseCaseReplayer(self.uiMap, universalLo... | [
"storytext.javarcptoolkit.TestRunner.initEclipsePackages"
] | [((748, 799), 'storytext.javarcptoolkit.TestRunner.initEclipsePackages', 'javarcptoolkit.TestRunner.initEclipsePackages', (['self'], {}), '(self)\n', (793, 799), False, 'from storytext import javarcptoolkit\n')] |
# -*- coding: utf-8 -*-
# Copyright (c) 2011,2014 <NAME> <<EMAIL>>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS I... | [
"logging.getLogger",
"django.db.models.EmailField",
"traceback.format_exc",
"django.db.models.TextField",
"django.db.models.IntegerField",
"django.db.models.ForeignKey",
"django.template.Template",
"django.db.models.BooleanField",
"datetime.datetime.now",
"django.db.models.SlugField",
"django.db... | [((965, 992), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (982, 992), False, 'import logging\n'), ((1677, 1709), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(200)'}), '(max_length=200)\n', (1693, 1709), False, 'from django.db import models\n'), ((1721, 1739),... |
# -*- test-case-name: vumi.tests.test_worker -*-
"""Basic tools for workers that handle TransportMessages."""
import time
import os
import socket
from twisted.internet.defer import (
inlineCallbacks, succeed, maybeDeferred, gatherResults)
from twisted.python import log
from vumi.service import Worker
from vumi.... | [
"twisted.python.log.msg",
"twisted.internet.defer.maybeDeferred",
"vumi.config.ConfigInt",
"vumi.middleware.setup_middlewares_from_config",
"vumi.errors.DuplicateConnectorError",
"vumi.utils.generate_worker_id",
"time.time",
"os.getpid",
"socket.gethostname",
"twisted.internet.defer.succeed"
] | [((961, 1098), 'vumi.config.ConfigInt', 'ConfigInt', (['"""The number of messages fetched concurrently from each AMQP queue by each worker instance."""'], {'default': '(20)', 'static': '(True)'}), "(\n 'The number of messages fetched concurrently from each AMQP queue by each worker instance.'\n , default=20, stat... |
# setup.py
# This script will build the main subpackages
# See LICENSE for details
from __future__ import print_function, absolute_import
from numpy.distutils.misc_util import Configuration
from os.path import join
TTFORT_DIR = '../tt-fort'
EXPM_DIR = '../tt-fort/expm'
EXPOKIT_SRC = [
'explib.f90',
'n... | [
"os.path.join",
"numpy.distutils.misc_util.Configuration"
] | [((711, 757), 'numpy.distutils.misc_util.Configuration', 'Configuration', (['"""ksl"""', 'parent_package', 'top_path'], {}), "('ksl', parent_package, top_path)\n", (724, 757), False, 'from numpy.distutils.misc_util import Configuration\n'), ((564, 581), 'os.path.join', 'join', (['EXPM_DIR', 'x'], {}), '(EXPM_DIR, x)\n'... |
from NekoGram import Neko, Bot
import json
def test_json_text_processor():
neko = Neko(bot=Bot(token='0:0', validate_token=False), validate_text_names=False)
raw_json = '{"x": {"text": "hello"} }'
neko.add_texts(texts=raw_json, lang='en')
assert neko.texts['en'] == json.loads(raw_json)
| [
"NekoGram.Bot",
"json.loads"
] | [((284, 304), 'json.loads', 'json.loads', (['raw_json'], {}), '(raw_json)\n', (294, 304), False, 'import json\n'), ((97, 135), 'NekoGram.Bot', 'Bot', ([], {'token': '"""0:0"""', 'validate_token': '(False)'}), "(token='0:0', validate_token=False)\n", (100, 135), False, 'from NekoGram import Neko, Bot\n')] |
from collections import namedtuple
import numpy as np
import talib
from jesse.indicators.ma import ma
from jesse.indicators.mean_ad import mean_ad
from jesse.indicators.median_ad import median_ad
from jesse.helpers import get_candle_source, slice_candles
BollingerBands = namedtuple('BollingerBands', ['upperband', 'm... | [
"talib.STDDEV",
"collections.namedtuple",
"jesse.indicators.ma.ma",
"jesse.indicators.mean_ad.mean_ad",
"jesse.indicators.median_ad.median_ad",
"jesse.helpers.slice_candles",
"jesse.helpers.get_candle_source"
] | [((275, 345), 'collections.namedtuple', 'namedtuple', (['"""BollingerBands"""', "['upperband', 'middleband', 'lowerband']"], {}), "('BollingerBands', ['upperband', 'middleband', 'lowerband'])\n", (285, 345), False, 'from collections import namedtuple\n'), ((1020, 1054), 'jesse.helpers.slice_candles', 'slice_candles', (... |
""" Global Flask Application Settings """
import os
from app import app
class Config(object):
DEBUG = False
TESTING = False
PRODUCTION = False
class Development(Config):
MODE = 'Development'
DEBUG = True
class Production(Config):
MODE = 'Production'
DEBUG = False
PRODUCTION = True... | [
"os.environ.get"
] | [((408, 453), 'os.environ.get', 'os.environ.get', (['"""FLASK_CONFIG"""', '"""Development"""'], {}), "('FLASK_CONFIG', 'Development')\n", (422, 453), False, 'import os\n')] |
from flask import Blueprint, jsonify, make_response
from flask_restful import Resource, Api, reqparse, inputs
from ..models.decorators import admin_required
from ..models.models import UserModel
import os
class SignUp(Resource):
def __init__(self):
"""
Validates both json and form-data input
... | [
"flask_restful.reqparse.RequestParser",
"os.getenv",
"flask_restful.Api",
"flask_restful.inputs.regex",
"flask.Blueprint",
"flask.jsonify"
] | [((5152, 5190), 'flask.Blueprint', 'Blueprint', (['"""resources.users"""', '__name__'], {}), "('resources.users', __name__)\n", (5161, 5190), False, 'from flask import Blueprint, jsonify, make_response\n'), ((5197, 5211), 'flask_restful.Api', 'Api', (['users_api'], {}), '(users_api)\n', (5200, 5211), False, 'from flask... |
"""
Test the model blocks
"""
import datetime
from django.test import TestCase
from mock import Mock
from django.db.models import Model, IntegerField, DateTimeField, CharField
from django.template import Context, Template, TemplateSyntaxError
from example_project.pepulator_factory.models import Pepulator, Distribut... | [
"example_project.pepulator_factory.models.Distributor.objects.get",
"model_blocks.templatetags.model_nodes.get_template.assert_called_with",
"model_blocks.templatetags.model_filters.as_teaser_block",
"django.template.Template",
"model_blocks.templatetags.model_filters.as_list_block",
"model_blocks.templat... | [((1753, 1794), 'example_project.pepulator_factory.models.Pepulator.objects.get', 'Pepulator.objects.get', ([], {'serial_number': '(1235)'}), '(serial_number=1235)\n', (1774, 1794), False, 'from example_project.pepulator_factory.models import Pepulator, Distributor\n'), ((2311, 2351), 'model_blocks.templatetags.model_f... |
"""
Copyright 2015 Brocade Communications Systems, 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 t... | [
"os.getpid"
] | [((704, 715), 'os.getpid', 'os.getpid', ([], {}), '()\n', (713, 715), False, 'import os\n')] |
import pytest
from labelsync.github import Github
from labelsync.helpers import HTTPError
from tests.helpers import fl, FIXTURES_PATH, create_cfg_env, get_labels
c = create_cfg_env('good.cfg')
github = Github(c, name='github', api_url='https://api.github.com/repos')
label = {
'name':'blabla',
'color':... | [
"tests.helpers.get_labels",
"tests.helpers.create_cfg_env",
"labelsync.github.Github"
] | [((167, 193), 'tests.helpers.create_cfg_env', 'create_cfg_env', (['"""good.cfg"""'], {}), "('good.cfg')\n", (181, 193), False, 'from tests.helpers import fl, FIXTURES_PATH, create_cfg_env, get_labels\n'), ((203, 267), 'labelsync.github.Github', 'Github', (['c'], {'name': '"""github"""', 'api_url': '"""https://api.githu... |
import os
import tensorflow as tf
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('--ckpt_path', type=str)
parser.add_argument('--output_path', type=str)
args = parser.parse_args()
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
checkpoint = args.ckpt_path
##input_checkpoint
input_che... | [
"os.system",
"os.path.join",
"argparse.ArgumentParser"
] | [((66, 91), 'argparse.ArgumentParser', 'argparse.ArgumentParser', ([], {}), '()\n', (89, 91), False, 'import argparse\n'), ((576, 621), 'os.path.join', 'os.path.join', (['args.output_path', '"""detector.pb"""'], {}), "(args.output_path, 'detector.pb')\n", (588, 621), False, 'import os\n'), ((833, 851), 'os.system', 'os... |
import pandas as pd
from pathlib import Path
import sys
''' Concatenates all csv files in the folder passed to stdin '''
path = Path(sys.argv[1])
def get_csv_paths(path):
return [p for p in path.iterdir() if p.suffix == '.csv']
def ask_details():
print('Please specify the following:')
encod... | [
"pandas.DataFrame",
"pandas.concat",
"pandas.read_csv",
"pathlib.Path"
] | [((136, 153), 'pathlib.Path', 'Path', (['sys.argv[1]'], {}), '(sys.argv[1])\n', (140, 153), False, 'from pathlib import Path\n'), ((609, 623), 'pandas.DataFrame', 'pd.DataFrame', ([], {}), '()\n', (621, 623), True, 'import pandas as pd\n'), ((483, 544), 'pandas.read_csv', 'pd.read_csv', (['p'], {'sep': 'delimiter', 'dt... |
import argparse, os
import lib.config as config
import lib.utils as utils
def count_present_and_missing(cls, directory, metadata):
"""
Count present and missing videos for a class based on metadata.
:param cls: The class. If None, count all videos (used for testing videos - no classes).
:param direc... | [
"os.path.isdir",
"lib.utils.load_json",
"argparse.ArgumentParser"
] | [((824, 860), 'lib.utils.load_json', 'utils.load_json', (['config.CLASSES_PATH'], {}), '(config.CLASSES_PATH)\n', (839, 860), True, 'import lib.utils as utils\n'), ((906, 949), 'lib.utils.load_json', 'utils.load_json', (['config.TRAIN_METADATA_PATH'], {}), '(config.TRAIN_METADATA_PATH)\n', (921, 949), True, 'import lib... |
import tensorflow as tf
def tanh(x):
return tf.nn.tanh(x)
| [
"tensorflow.nn.tanh"
] | [((50, 63), 'tensorflow.nn.tanh', 'tf.nn.tanh', (['x'], {}), '(x)\n', (60, 63), True, 'import tensorflow as tf\n')] |
# Generated by Django 3.0 on 2019-12-23 06:19
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('game', '0010_auto_20191223_0818'),
]
operations = [
migrations.AddField(
model_name='onlinegame',
name='... | [
"django.db.models.IntegerField"
] | [((354, 384), 'django.db.models.IntegerField', 'models.IntegerField', ([], {'default': '(0)'}), '(default=0)\n', (373, 384), False, 'from django.db import migrations, models\n')] |
import shutil
import pathlib
asset_dirs = ["artifacts/main", "artifacts/build_python_version"]
pathlib.Path("distfiles").mkdir(exist_ok=True)
for asset_dir in asset_dirs:
for fname in list(pathlib.Path(asset_dir).glob('**/RobotRaconteur-*-MATLAB*')):
print(fname)
dest = pathlib.Path(fname)
... | [
"pathlib.Path"
] | [((97, 122), 'pathlib.Path', 'pathlib.Path', (['"""distfiles"""'], {}), "('distfiles')\n", (109, 122), False, 'import pathlib\n'), ((294, 313), 'pathlib.Path', 'pathlib.Path', (['fname'], {}), '(fname)\n', (306, 313), False, 'import pathlib\n'), ((196, 219), 'pathlib.Path', 'pathlib.Path', (['asset_dir'], {}), '(asset_... |
"""Metadata for package to allow installation with pip."""
import setuptools
exec(open("closek/version.py").read())
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="closek",
description="Scikit-learn-style implementation of the close-k classifier.",
long_descri... | [
"setuptools.find_packages"
] | [((529, 555), 'setuptools.find_packages', 'setuptools.find_packages', ([], {}), '()\n', (553, 555), False, 'import setuptools\n')] |
import numpy as np
from cdlib.evaluation.internal import onmi
from cdlib.evaluation.internal.omega import Omega
from nf1 import NF1
from collections import namedtuple, defaultdict
__all__ = [
"MatchingResult",
"normalized_mutual_information",
"overlapping_normalized_mutual_information_LFK",
"overlappin... | [
"cdlib.evaluation.internal.omega.Omega",
"collections.namedtuple",
"sklearn.metrics.adjusted_mutual_info_score",
"numpy.log2",
"sklearn.metrics.adjusted_rand_score",
"collections.defaultdict",
"sklearn.metrics.normalized_mutual_info_score",
"nf1.NF1"
] | [((606, 647), 'collections.namedtuple', 'namedtuple', (['"""MatchingResult"""', '"""score std"""'], {}), "('MatchingResult', 'score std')\n", (616, 647), False, 'from collections import namedtuple, defaultdict\n'), ((7282, 7322), 'cdlib.evaluation.internal.omega.Omega', 'Omega', (['first_partition', 'second_partition']... |
from typing import Optional
import pytest
from fastapi import FastAPI, Header
from fastapi.testclient import TestClient
from meiga import BoolResult, Failure, isFailure, isSuccess
from petisco import NotFound, assert_http
from petisco.extra.fastapi import FastAPIController
app = FastAPI(title="test-app")
result_fro... | [
"fastapi.Header",
"fastapi.FastAPI",
"fastapi.testclient.TestClient",
"pytest.mark.parametrize",
"petisco.assert_http",
"petisco.NotFound"
] | [((283, 308), 'fastapi.FastAPI', 'FastAPI', ([], {'title': '"""test-app"""'}), "(title='test-app')\n", (290, 308), False, 'from fastapi import FastAPI, Header\n'), ((784, 918), 'pytest.mark.parametrize', 'pytest.mark.parametrize', (['"""behavior,expected_status_code"""', "[('success', 200), ('failure_generic', 500), ('... |
from django.core.mail import send_mail
from component.reminder.models import Reminder
from server.celery import app
@app.task
def send_email(id):
reminder = Reminder.objects.filter(id=id).first()
if reminder is not None:
send_mail(subject="ReminderMessage",
message=reminder.text,
... | [
"django.core.mail.send_mail",
"component.reminder.models.Reminder.objects.filter"
] | [((240, 359), 'django.core.mail.send_mail', 'send_mail', ([], {'subject': '"""ReminderMessage"""', 'message': 'reminder.text', 'from_email': '"""<EMAIL>"""', 'recipient_list': '[reminder.email]'}), "(subject='ReminderMessage', message=reminder.text, from_email=\n '<EMAIL>', recipient_list=[reminder.email])\n", (249,... |
import pandas as pd
import pytest
from ..base import BaseMiner, MDLOptimizer
def test_inst_params():
class MyMiner(BaseMiner):
def __init__(self, eps=3):
self.eps = eps
self._a = 2
def fit(self, D):
self._a = 12
kwargs = dict(eps=4)
miner = MyMiner(**... | [
"pytest.raises"
] | [((548, 573), 'pytest.raises', 'pytest.raises', (['ValueError'], {}), '(ValueError)\n', (561, 573), False, 'import pytest\n')] |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import copy
import io
import onnx
import torch
import torch.onnx.symbolic_helper as sym_help
import torch.onnx.symbo... | [
"torch.onnx.symbolic_helper.parse_args",
"tensorflow.Graph",
"torch.onnx.symbolic_helper._get_const",
"io.BytesIO",
"torch.onnx.symbolic_registry._registry.items",
"tf2onnx.tf_loader.tf_session",
"tf2onnx.optimizer.optimize_graph",
"onnx.load_model_from_string",
"onnx.load",
"tensorflow.import_gra... | [((9120, 9157), 'torch.onnx.symbolic_helper.parse_args', 'sym_help.parse_args', (['"""v"""', '"""i"""', '"""none"""'], {}), "('v', 'i', 'none')\n", (9139, 9157), True, 'import torch.onnx.symbolic_helper as sym_help\n'), ((9806, 9843), 'torch.onnx.symbolic_helper.parse_args', 'sym_help.parse_args', (['"""v"""', '"""i"""... |
from arekit.common.data.input.providers.label.multiple import MultipleLabelProvider
from arekit.common.data.row_ids.multiple import MultipleIDProvider
from arekit.common.data.storages.base import BaseRowsStorage
from arekit.common.data.views.samples import BaseSampleStorageView
from arekit.common.experiment.data_type i... | [
"arekit.contrib.networks.core.ctx_inference.InferenceContext.create_empty",
"examples.repository.pipeline_serialize",
"arekit.contrib.networks.core.input.helper_embedding.EmbeddingHelper.load_vocab",
"arekit.contrib.networks.core.predict.tsv_writer.TsvPredictWriter",
"arekit.contrib.experiment_rusentrel.lab... | [((1454, 1468), 'arekit.contrib.networks.context.architectures.pcnn.PiecewiseCNN', 'PiecewiseCNN', ([], {}), '()\n', (1466, 1468), False, 'from arekit.contrib.networks.context.architectures.pcnn import PiecewiseCNN\n'), ((1482, 1493), 'arekit.contrib.networks.context.configurations.cnn.CNNConfig', 'CNNConfig', ([], {})... |
from Point import Point
import Constant as c
from GeometryMath import bisector_point
class Bisector(Point):
def __init__(self, item):
"""Construct Bisector."""
Point.__init__(self, item)
self.item["sub_type"] = c.Point.Definition.BISECTOR
def tikzify(self):
return '\\tkzDefLin... | [
"Point.Point.__init__",
"GeometryMath.bisector_point"
] | [((182, 208), 'Point.Point.__init__', 'Point.__init__', (['self', 'item'], {}), '(self, item)\n', (196, 208), False, 'from Point import Point\n'), ((973, 996), 'GeometryMath.bisector_point', 'bisector_point', (['A', 'B', 'C'], {}), '(A, B, C)\n', (987, 996), False, 'from GeometryMath import bisector_point\n')] |
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import int_or_none
class SciVeeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?scivee\.tv/node/(?P<id>\d+)'
_TEST = {
'url': 'http://www.scivee.tv/node/62352',
'md5': 'b16699b74c9e6a120f677... | [
"re.match"
] | [((636, 666), 're.match', 're.match', (['self._VALID_URL', 'url'], {}), '(self._VALID_URL, url)\n', (644, 666), False, 'import re\n')] |
"""Module containing class `JobLoggingManager`."""
from collections import defaultdict
from logging import FileHandler, Handler
from logging.handlers import QueueHandler, QueueListener
from multiprocessing import Queue
import logging
import vesper.util.logging_utils as logging_utils
import vesper.util.os_utils as os... | [
"logging.handlers.QueueHandler",
"vesper.util.logging_utils.create_formatter",
"logging.handlers.QueueListener",
"vesper.util.os_utils.create_parent_directory",
"logging.shutdown",
"collections.defaultdict",
"logging.FileHandler",
"multiprocessing.Queue"
] | [((621, 637), 'collections.defaultdict', 'defaultdict', (['int'], {}), '(int)\n', (632, 637), False, 'from collections import defaultdict\n'), ((2101, 2120), 'logging.handlers.QueueHandler', 'QueueHandler', (['queue'], {}), '(queue)\n', (2113, 2120), False, 'from logging.handlers import QueueHandler, QueueListener\n'),... |
import math
from typing import List
import numpy as np
from datasets.Dataset import Dataset
from models.Solution import Solution
def calculate_avgValue(population: List[Solution]) -> float:
avgValue = 0
for ind in population:
avgValue += ind.compute_mono_objective_score()
avgValue /= len(populati... | [
"numpy.count_nonzero",
"math.sqrt",
"math.dist",
"numpy.max"
] | [((3003, 3020), 'math.dist', 'math.dist', (['v1', 'v2'], {}), '(v1, v2)\n', (3012, 3020), False, 'import math\n'), ((3190, 3230), 'numpy.max', 'np.max', (['dataset.pbis_satisfaction_scaled'], {}), '(dataset.pbis_satisfaction_scaled)\n', (3196, 3230), True, 'import numpy as np\n'), ((3246, 3278), 'numpy.max', 'np.max', ... |
import json
import mtgsdk as mtg
magic_sets = ('grn',)
def main():
for s in magic_sets:
cards = [vars(c) for c in mtg.Card.where(set=s).all()]
with open(f'tests/data/{s}.json', 'w') as f:
json.dump(cards, f, indent=4, sort_keys=True)
if __name__ == '__main__':
main()
| [
"mtgsdk.Card.where",
"json.dump"
] | [((224, 269), 'json.dump', 'json.dump', (['cards', 'f'], {'indent': '(4)', 'sort_keys': '(True)'}), '(cards, f, indent=4, sort_keys=True)\n', (233, 269), False, 'import json\n'), ((130, 151), 'mtgsdk.Card.where', 'mtg.Card.where', ([], {'set': 's'}), '(set=s)\n', (144, 151), True, 'import mtgsdk as mtg\n')] |
# (C) Copyright 2017- ECMWF.
#
# This software is licensed under the terms of the Apache Licence Version 2.0
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
#
# In applying this licence, ECMWF does not waive the privileges and immunities
# granted to it by virtue of its status as an intergovernme... | [
"logging.getLogger",
"IPython.get_ipython",
"re.compile",
"pandas.DataFrame.from_dict",
"pandas.set_option",
"metview.grib_get",
"pandas.DataFrame",
"IPython.display.HTML",
"pandas.get_option"
] | [((686, 713), 'logging.getLogger', 'logging.getLogger', (['__name__'], {}), '(__name__)\n', (703, 713), False, 'import logging\n'), ((1667, 1687), 're.compile', 're.compile', (['"""(\\\\d+)"""'], {}), "('(\\\\d+)')\n", (1677, 1687), False, 'import re\n'), ((1701, 1721), 're.compile', 're.compile', (['"""[0-9]+"""'], {}... |
from hashlib import sha256
from django.http import HttpResponse
from django.shortcuts import redirect, render
from .models import Usuarios
def login(request):
if request.session.get('usuario'):
return redirect('/livro/home/')
status = request.GET.get('status')
return render(request, 'login.... | [
"django.shortcuts.render",
"django.http.HttpResponse",
"django.shortcuts.redirect"
] | [((297, 346), 'django.shortcuts.render', 'render', (['request', '"""login.html"""', "{'status': status}"], {}), "(request, 'login.html', {'status': status})\n", (303, 346), False, 'from django.shortcuts import redirect, render\n'), ((505, 557), 'django.shortcuts.render', 'render', (['request', '"""cadastro.html"""', "{... |
import matplotlib
matplotlib.use("Agg")
from matplotlib import pyplot as plt
import numpy as np
import os
from nanopores.tools import fields
from scipy.interpolate import interp1d
HOME = os.path.expanduser("~")
DATADIR = os.path.join(HOME, "Dropbox", "nanopores", "fields")
fields.set_dir(DATADIR)
data = fields.get_fi... | [
"nanopores.tools.fields.get_fields",
"matplotlib.pyplot.savefig",
"matplotlib.pyplot.ylabel",
"matplotlib.use",
"matplotlib.pyplot.legend",
"matplotlib.pyplot.xlabel",
"matplotlib.pyplot.plot",
"os.path.join",
"scipy.interpolate.interp1d",
"numpy.inner",
"numpy.array",
"numpy.linspace",
"num... | [((18, 39), 'matplotlib.use', 'matplotlib.use', (['"""Agg"""'], {}), "('Agg')\n", (32, 39), False, 'import matplotlib\n'), ((188, 211), 'os.path.expanduser', 'os.path.expanduser', (['"""~"""'], {}), "('~')\n", (206, 211), False, 'import os\n'), ((222, 274), 'os.path.join', 'os.path.join', (['HOME', '"""Dropbox"""', '""... |
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'hnc.ui'
#
# Created by: PyQt5 UI code generator 5.15.6
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, Q... | [
"PyQt5.QtWidgets.QWidget",
"PyQt5.QtCore.QMetaObject.connectSlotsByName",
"PyQt5.QtCore.QTimer",
"PyQt5.QtCore.QRect",
"PyQt5.QtWidgets.QLabel",
"PyQt5.QtWidgets.QApplication",
"PyQt5.QtWidgets.QPushButton",
"PyQt5.QtCore.QSize"
] | [((3802, 3828), 'PyQt5.QtWidgets.QApplication', 'QtWidgets.QApplication', (['[]'], {}), '([])\n', (3824, 3828), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((3838, 3853), 'PyQt5.QtCore.QTimer', 'QtCore.QTimer', ([], {}), '()\n', (3851, 3853), False, 'from PyQt5 import QtCore, QtGui, QtWidgets\n'), ((1088, 1... |
import os
import nibabel
import numpy as np
import random
from scipy import ndimage
import SimpleITK as sitk
def load_nifty_volume_as_array(filename, with_header = False):
"""
load nifty image into numpy array, and transpose it based on the [z,y,x] axis order
The output array shape is like [Depth, Height,... | [
"SimpleITK.GetImageFromArray",
"nibabel.load",
"SimpleITK.WriteImage",
"SimpleITK.ReadImage",
"numpy.transpose"
] | [((529, 551), 'nibabel.load', 'nibabel.load', (['filename'], {}), '(filename)\n', (541, 551), False, 'import nibabel\n'), ((589, 618), 'numpy.transpose', 'np.transpose', (['data', '[2, 1, 0]'], {}), '(data, [2, 1, 0])\n', (601, 618), True, 'import numpy as np\n'), ((1071, 1099), 'SimpleITK.GetImageFromArray', 'sitk.Get... |
from random import randint
s = t = ma = 0
m = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
for l in range(0, 3):
for c in range(0, 3):
m[l][c] = randint(0, 100)
print('-='*15)
for l in range(0, 3):
t += m[l][2]
for c in range(0, 3):
print(f'[{m[l][c]:^5}]', end='')
if m[l][c] % 2 == 0:
... | [
"random.randint"
] | [((146, 161), 'random.randint', 'randint', (['(0)', '(100)'], {}), '(0, 100)\n', (153, 161), False, 'from random import randint\n')] |
#!/usr/bin/env python
import rospy as rp
import numpy as np
import math as math
from geometry_msgs.msg import PoseStamped, TwistStamped
from styx_msgs.msg import Lane, Waypoint
from scipy.spatial import KDTree
from std_msgs.msg import Int32
'''
This node will publish waypoints from the car's current position to some... | [
"rospy.logerr",
"rospy.Subscriber",
"rospy.is_shutdown",
"rospy.init_node",
"scipy.spatial.KDTree",
"math.sqrt",
"numpy.array",
"numpy.dot",
"rospy.Rate",
"styx_msgs.msg.Waypoint",
"rospy.Publisher",
"styx_msgs.msg.Lane"
] | [((1071, 1103), 'rospy.init_node', 'rp.init_node', (['"""waypoint_updater"""'], {}), "('waypoint_updater')\n", (1083, 1103), True, 'import rospy as rp\n'), ((1199, 1256), 'rospy.Subscriber', 'rp.Subscriber', (['"""/current_pose"""', 'PoseStamped', 'self.pose_cb'], {}), "('/current_pose', PoseStamped, self.pose_cb)\n", ... |
# Copyright 2017 Rice University
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | [
"program_helper.ast.ops.DAPIInvoke.delimiter"
] | [((3184, 3206), 'program_helper.ast.ops.DAPIInvoke.delimiter', 'DAPIInvoke.delimiter', ([], {}), '()\n', (3204, 3206), False, 'from program_helper.ast.ops import DAPIInvoke\n')] |
from tkinter import *
from tkinter import filedialog
from pyascii import main
class App:
def __init__(self, master):
#initalize myFile instance variable
self.myFile = None
self.saveFile = None
#set window height
master.minsize(height = 440, width = 680)
#create frame
frame = Frame(master)
f... | [
"pyascii.main",
"tkinter.filedialog.askopenfilename"
] | [((1046, 1115), 'tkinter.filedialog.askopenfilename', 'filedialog.askopenfilename', ([], {'parent': 'root', 'title': '"""Choose your picture!"""'}), "(parent=root, title='Choose your picture!')\n", (1072, 1115), False, 'from tkinter import filedialog\n'), ((1285, 1302), 'pyascii.main', 'main', (['self.myFile'], {}), '(... |